/* VideoPlayer version 1.3.0 */ !(function (t, e) { "object" == typeof exports && "undefined" != typeof module ? (module.exports = e()) : "function" == typeof define && define.amd ? define(e) : ((t = "undefined" != typeof globalThis ? globalThis : t || self).VideoPlayer = e()); })(this, function () { "use strict"; var t = "undefined" != typeof document ? document.currentScript : null; function e(t, e, n) { if ("function" == typeof t ? t === e : t.has(e)) return arguments.length < 3 ? e : n; throw new TypeError("Private element is not present on this object"); } function n(t, e, n) { return ( (e = A(e)), (function (t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return (function (t) { if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t; })(t); })(t, s() ? Reflect.construct(e, n || [], A(t).constructor) : e.apply(t, n)) ); } function r(t, n) { return t.get(e(t, n)); } function a(t, n, i) { return t.set(e(t, n), i), i; } function s() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () { })); } catch (t) { } return (s = function () { return !!t; })(); } function o(t, e) { var n = Object.keys(t); if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(t); e && (i = i.filter(function (e) { return Object.getOwnPropertyDescriptor(t, e).enumerable; })), n.push.apply(n, i); } return n; } function l(t) { for (var e = 1; e < arguments.length; e++) { var n = null != arguments[e] ? arguments[e] : {}; e % 2 ? o(Object(n), !0).forEach(function (e) { g(t, e, n[e]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : o(Object(n)).forEach(function (e) { Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e)); }); } return t; } function d() { d = function () { return e; }; var t, e = {}, n = Object.prototype, i = n.hasOwnProperty, r = Object.defineProperty || function (t, e, n) { t[e] = n.value; }, a = "function" == typeof Symbol ? Symbol : {}, s = a.iterator || "@@iterator", o = a.asyncIterator || "@@asyncIterator", l = a.toStringTag || "@@toStringTag"; function c(t, e, n) { return Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { c({}, ""); } catch (t) { c = function (t, e, n) { return (t[e] = n); }; } function u(t, e, n, i) { var a = e && e.prototype instanceof A ? e : A, s = Object.create(a.prototype), o = new R(i || []); return r(s, "_invoke", { value: k(t, n, o) }), s; } function h(t, e, n) { try { return { type: "normal", arg: t.call(e, n) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = u; var p = "suspendedStart", f = "suspendedYield", m = "executing", g = "completed", y = {}; function A() { } function v() { } function b() { } var E = {}; c(E, s, function () { return this; }); var w = Object.getPrototypeOf, x = w && w(w(D([]))); x && x !== n && i.call(x, s) && (E = x); var S = (b.prototype = A.prototype = Object.create(E)); function _(t) { ["next", "throw", "return"].forEach(function (e) { c(t, e, function (t) { return this._invoke(e, t); }); }); } function T(t, e) { function n(r, a, s, o) { var l = h(t[r], t, a); if ("throw" !== l.type) { var d = l.arg, c = d.value; return c && "object" == typeof c && i.call(c, "__await") ? e.resolve(c.__await).then( function (t) { n("next", t, s, o); }, function (t) { n("throw", t, s, o); } ) : e.resolve(c).then( function (t) { (d.value = t), s(d); }, function (t) { return n("throw", t, s, o); } ); } o(l.arg); } var a; r(this, "_invoke", { value: function (t, i) { function r() { return new e(function (e, r) { n(t, i, e, r); }); } return (a = a ? a.then(r, r) : r()); } }); } function k(e, n, i) { var r = p; return function (a, s) { if (r === m) throw Error("Generator is already running"); if (r === g) { if ("throw" === a) throw s; return { value: t, done: !0 }; } for (i.method = a, i.arg = s; ;) { var o = i.delegate; if (o) { var l = C(o, i); if (l) { if (l === y) continue; return l; } } if ("next" === i.method) i.sent = i._sent = i.arg; else if ("throw" === i.method) { if (r === p) throw ((r = g), i.arg); i.dispatchException(i.arg); } else "return" === i.method && i.abrupt("return", i.arg); r = m; var d = h(e, n, i); if ("normal" === d.type) { if (((r = i.done ? g : f), d.arg === y)) continue; return { value: d.arg, done: i.done }; } "throw" === d.type && ((r = g), (i.method = "throw"), (i.arg = d.arg)); } }; } function C(e, n) { var i = n.method, r = e.iterator[i]; if (r === t) return ( (n.delegate = null), ("throw" === i && e.iterator.return && ((n.method = "return"), (n.arg = t), C(e, n), "throw" === n.method)) || ("return" !== i && ((n.method = "throw"), (n.arg = new TypeError("The iterator does not provide a '" + i + "' method")))), y ); var a = h(r, e.iterator, n.arg); if ("throw" === a.type) return (n.method = "throw"), (n.arg = a.arg), (n.delegate = null), y; var s = a.arg; return s ? s.done ? ((n[e.resultName] = s.value), (n.next = e.nextLoc), "return" !== n.method && ((n.method = "next"), (n.arg = t)), (n.delegate = null), y) : s : ((n.method = "throw"), (n.arg = new TypeError("iterator result is not an object")), (n.delegate = null), y); } function L(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && ((e.finallyLoc = t[2]), (e.afterLoc = t[3])), this.tryEntries.push(e); } function I(t) { var e = t.completion || {}; (e.type = "normal"), delete e.arg, (t.completion = e); } function R(t) { (this.tryEntries = [{ tryLoc: "root" }]), t.forEach(L, this), this.reset(!0); } function D(e) { if (e || "" === e) { var n = e[s]; if (n) return n.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var r = -1, a = function n() { for (; ++r < e.length;) if (i.call(e, r)) return (n.value = e[r]), (n.done = !1), n; return (n.value = t), (n.done = !0), n; }; return (a.next = a); } } throw new TypeError(typeof e + " is not iterable"); } return ( (v.prototype = b), r(S, "constructor", { value: b, configurable: !0 }), r(b, "constructor", { value: v, configurable: !0 }), (v.displayName = c(b, l, "GeneratorFunction")), (e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === v || "GeneratorFunction" === (e.displayName || e.name)); }), (e.mark = function (t) { return ( Object.setPrototypeOf ? Object.setPrototypeOf(t, b) : ((t.__proto__ = b), c(t, l, "GeneratorFunction")), (t.prototype = Object.create(S)), t ); }), (e.awrap = function (t) { return { __await: t }; }), _(T.prototype), c(T.prototype, o, function () { return this; }), (e.AsyncIterator = T), (e.async = function (t, n, i, r, a) { void 0 === a && (a = Promise); var s = new T(u(t, n, i, r), a); return e.isGeneratorFunction(n) ? s : s.next().then(function (t) { return t.done ? t.value : s.next(); }); }), _(S), c(S, l, "Generator"), c(S, s, function () { return this; }), c(S, "toString", function () { return "[object Generator]"; }), (e.keys = function (t) { var e = Object(t), n = []; for (var i in e) n.push(i); return ( n.reverse(), function t() { for (; n.length;) { var i = n.pop(); if (i in e) return (t.value = i), (t.done = !1), t; } return (t.done = !0), t; } ); }), (e.values = D), (R.prototype = { constructor: R, reset: function (e) { if ( ((this.prev = 0), (this.next = 0), (this.sent = this._sent = t), (this.done = !1), (this.delegate = null), (this.method = "next"), (this.arg = t), this.tryEntries.forEach(I), !e) ) for (var n in this) "t" === n.charAt(0) && i.call(this, n) && !isNaN(+n.slice(1)) && (this[n] = t); }, stop: function () { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function (e) { if (this.done) throw e; var n = this; function r(i, r) { return (o.type = "throw"), (o.arg = e), (n.next = i), r && ((n.method = "next"), (n.arg = t)), !!r; } for (var a = this.tryEntries.length - 1; a >= 0; --a) { var s = this.tryEntries[a], o = s.completion; if ("root" === s.tryLoc) return r("end"); if (s.tryLoc <= this.prev) { var l = i.call(s, "catchLoc"), d = i.call(s, "finallyLoc"); if (l && d) { if (this.prev < s.catchLoc) return r(s.catchLoc, !0); if (this.prev < s.finallyLoc) return r(s.finallyLoc); } else if (l) { if (this.prev < s.catchLoc) return r(s.catchLoc, !0); } else { if (!d) throw Error("try statement without catch or finally"); if (this.prev < s.finallyLoc) return r(s.finallyLoc); } } } }, abrupt: function (t, e) { for (var n = this.tryEntries.length - 1; n >= 0; --n) { var r = this.tryEntries[n]; if (r.tryLoc <= this.prev && i.call(r, "finallyLoc") && this.prev < r.finallyLoc) { var a = r; break; } } a && ("break" === t || "continue" === t) && a.tryLoc <= e && e <= a.finallyLoc && (a = null); var s = a ? a.completion : {}; return ( (s.type = t), (s.arg = e), a ? ((this.method = "next"), (this.next = a.finallyLoc), y) : this.complete(s) ); }, complete: function (t, e) { if ("throw" === t.type) throw t.arg; return ( "break" === t.type || "continue" === t.type ? (this.next = t.arg) : "return" === t.type ? ((this.rval = this.arg = t.arg), (this.method = "return"), (this.next = "end")) : "normal" === t.type && e && (this.next = e), y ); }, finish: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n.finallyLoc === t) return this.complete(n.completion, n.afterLoc), I(n), y; } }, catch: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n.tryLoc === t) { var i = n.completion; if ("throw" === i.type) { var r = i.arg; I(n); } return r; } } throw Error("illegal catch attempt"); }, delegateYield: function (e, n, i) { return ( (this.delegate = { iterator: D(e), resultName: n, nextLoc: i }), "next" === this.method && (this.arg = t), y ); } }), e ); } function c(t) { var e = (function (t, e) { if ("object" != typeof t || !t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); })(t, "string"); return "symbol" == typeof e ? e : e + ""; } function u(t) { return ( (u = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t; } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t; }), u(t) ); } function h(t, e, n, i, r, a, s) { try { var o = t[a](s), l = o.value; } catch (t) { return void n(t); } o.done ? e(l) : Promise.resolve(l).then(i, r); } function p(t) { return function () { var e = this, n = arguments; return new Promise(function (i, r) { var a = t.apply(e, n); function s(t) { h(a, i, r, s, o, "next", t); } function o(t) { h(a, i, r, s, o, "throw", t); } s(void 0); }); }; } function f(t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); } function m(t, e, n) { return ( e && (function (t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty(t, c(i.key), i); } })(t.prototype, e), Object.defineProperty(t, "prototype", { writable: !1 }), t ); } function g(t, e, n) { return ( (e = c(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : (t[e] = n), t ); } function y(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); (t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } })), Object.defineProperty(t, "prototype", { writable: !1 }), e && v(t, e); } function A(t) { return ( (A = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }), A(t) ); } function v(t, e) { return ( (v = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return (t.__proto__ = e), t; }), v(t, e) ); } function b(t, e) { return ( (function (t) { if (Array.isArray(t)) return t; })(t) || (function (t, e) { var n = null == t ? null : ("undefined" != typeof Symbol && t[Symbol.iterator]) || t["@@iterator"]; if (null != n) { var i, r, a, s, o = [], l = !0, d = !1; try { if (((a = (n = n.call(t)).next), 0 === e)); else for (; !(l = (i = a.call(n)).done) && (o.push(i.value), o.length !== e); l = !0); } catch (t) { (d = !0), (r = t); } finally { try { if (!l && null != n.return && ((s = n.return()), Object(s) !== s)) return; } finally { if (d) throw r; } } return o; } })(t, e) || w(t, e) || (function () { throw new TypeError( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ); })() ); } function E(t) { return ( (function (t) { if (Array.isArray(t)) return x(t); })(t) || (function (t) { if (("undefined" != typeof Symbol && null != t[Symbol.iterator]) || null != t["@@iterator"]) return Array.from(t); })(t) || w(t) || (function () { throw new TypeError( "Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ); })() ); } function w(t, e) { if (t) { if ("string" == typeof t) return x(t, e); var n = Object.prototype.toString.call(t).slice(8, -1); return ( "Object" === n && t.constructor && (n = t.constructor.name), "Map" === n || "Set" === n ? Array.from(t) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? x(t, e) : void 0 ); } } function x(t, e) { (null == e || e > t.length) && (e = t.length); for (var n = 0, i = new Array(e); n < e; n++) i[n] = t[n]; return i; } function S(t, e) { if (e.has(t)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } function _(t, e, n) { S(t, e), e.set(t, n); } var T = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; function k(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } var C = { exports: {} }; !(function (t, e) { !(function (n, i) { var r = "function", a = "undefined", s = "object", o = "string", l = "major", d = "model", c = "name", h = "type", p = "vendor", f = "version", m = "architecture", g = "console", y = "mobile", A = "tablet", v = "smarttv", b = "wearable", E = "embedded", w = "Amazon", x = "Apple", S = "ASUS", _ = "BlackBerry", T = "Browser", k = "Chrome", C = "Firefox", L = "Google", I = "Huawei", R = "LG", D = "Microsoft", B = "Motorola", P = "Opera", U = "Samsung", F = "Sharp", O = "Sony", M = "Xiaomi", N = "Zebra", z = "Facebook", G = "Chromium OS", j = "Mac OS", H = function (t) { for (var e = {}, n = 0; n < t.length; n++) e[t[n].toUpperCase()] = t[n]; return e; }, Y = function (t, e) { return u(t) === o && -1 !== $(e).indexOf($(t)); }, $ = function (t) { return t.toLowerCase(); }, K = function (t, e) { if (u(t) === o) return (t = t.replace(/^\s\s*/, "")), u(e) === a ? t : t.substring(0, 500); }, q = function (t, e) { for (var n, a, o, l, d, c, h = 0; h < e.length && !d;) { var p = e[h], f = e[h + 1]; for (n = a = 0; n < p.length && !d && p[n];) if ((d = p[n++].exec(t))) for (o = 0; o < f.length; o++) (c = d[++a]), u((l = f[o])) === s && l.length > 0 ? 2 === l.length ? u(l[1]) == r ? (this[l[0]] = l[1].call(this, c)) : (this[l[0]] = l[1]) : 3 === l.length ? u(l[1]) !== r || (l[1].exec && l[1].test) ? (this[l[0]] = c ? c.replace(l[1], l[2]) : i) : (this[l[0]] = c ? l[1].call(this, c, l[2]) : i) : 4 === l.length && (this[l[0]] = c ? l[3].call(this, c.replace(l[1], l[2])) : i) : (this[l] = c || i); h += 2; } }, V = function (t, e) { for (var n in e) if (u(e[n]) === s && e[n].length > 0) { for (var r = 0; r < e[n].length; r++) if (Y(e[n][r], t)) return "?" === n ? i : n; } else if (Y(e[n], t)) return "?" === n ? i : n; return t; }, W = { ME: "4.90", "NT 3.11": "NT3.51", "NT 4.0": "NT4.0", 2e3: "NT 5.0", XP: ["NT 5.1", "NT 5.2"], Vista: "NT 6.0", 7: "NT 6.1", 8: "NT 6.2", 8.1: "NT 6.3", 10: ["NT 6.4", "NT 10.0"], RT: "ARM" }, Q = { browser: [ [/\b(?:crmo|crios)\/([\w\.]+)/i], [f, [c, "Chrome"]], [/edg(?:e|ios|a)?\/([\w\.]+)/i], [f, [c, "Edge"]], [ /(opera mini)\/([-\w\.]+)/i, /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i ], [c, f], [/opios[\/ ]+([\w\.]+)/i], [f, [c, P + " Mini"]], [/\bopr\/([\w\.]+)/i], [f, [c, P]], [/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i], [f, [c, "Baidu"]], [ /(kindle)\/([\w\.]+)/i, /(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i, /(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i, /(?:ms|\()(ie) ([\w\.]+)/i, /(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i, /(heytap|ovi)browser\/([\d\.]+)/i, /(weibo)__([\d\.]+)/i ], [c, f], [/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i], [f, [c, "UC" + T]], [/microm.+\bqbcore\/([\w\.]+)/i, /\bqbcore\/([\w\.]+).+microm/i, /micromessenger\/([\w\.]+)/i], [f, [c, "WeChat"]], [/konqueror\/([\w\.]+)/i], [f, [c, "Konqueror"]], [/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i], [f, [c, "IE"]], [/ya(?:search)?browser\/([\w\.]+)/i], [f, [c, "Yandex"]], [/slbrowser\/([\w\.]+)/i], [f, [c, "Smart Lenovo " + T]], [/(avast|avg)\/([\w\.]+)/i], [[c, /(.+)/, "$1 Secure " + T], f], [/\bfocus\/([\w\.]+)/i], [f, [c, C + " Focus"]], [/\bopt\/([\w\.]+)/i], [f, [c, P + " Touch"]], [/coc_coc\w+\/([\w\.]+)/i], [f, [c, "Coc Coc"]], [/dolfin\/([\w\.]+)/i], [f, [c, "Dolphin"]], [/coast\/([\w\.]+)/i], [f, [c, P + " Coast"]], [/miuibrowser\/([\w\.]+)/i], [f, [c, "MIUI " + T]], [/fxios\/([-\w\.]+)/i], [f, [c, C]], [/\bqihu|(qi?ho?o?|360)browser/i], [[c, "360 " + T]], [/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i], [[c, /(.+)/, "$1 " + T], f], [/samsungbrowser\/([\w\.]+)/i], [f, [c, U + " Internet"]], [/(comodo_dragon)\/([\w\.]+)/i], [[c, /_/g, " "], f], [/metasr[\/ ]?([\d\.]+)/i], [f, [c, "Sogou Explorer"]], [/(sogou)mo\w+\/([\d\.]+)/i], [[c, "Sogou Mobile"], f], [ /(electron)\/([\w\.]+) safari/i, /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, /m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i ], [c, f], [/(lbbrowser)/i, /\[(linkedin)app\]/i], [c], [/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i], [[c, z], f], [ /(Klarna)\/([\w\.]+)/i, /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, /safari (line)\/([\w\.]+)/i, /\b(line)\/([\w\.]+)\/iab/i, /(alipay)client\/([\w\.]+)/i, /(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i ], [c, f], [/\bgsa\/([\w\.]+) .*safari\//i], [f, [c, "GSA"]], [/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i], [f, [c, "TikTok"]], [/headlesschrome(?:\/([\w\.]+)| )/i], [f, [c, k + " Headless"]], [/ wv\).+(chrome)\/([\w\.]+)/i], [[c, k + " WebView"], f], [/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i], [f, [c, "Android " + T]], [/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i], [c, f], [/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i], [f, [c, "Mobile Safari"]], [/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i], [f, c], [/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i], [ c, [ f, V, { "1.0": "/8", 1.2: "/1", 1.3: "/3", "2.0": "/412", "2.0.2": "/416", "2.0.3": "/417", "2.0.4": "/419", "?": "/" } ] ], [/(webkit|khtml)\/([\w\.]+)/i], [c, f], [/(navigator|netscape\d?)\/([-\w\.]+)/i], [[c, "Netscape"], f], [/mobile vr; rv:([\w\.]+)\).+firefox/i], [f, [c, C + " Reality"]], [ /ekiohf.+(flow)\/([\w\.]+)/i, /(swiftfox)/i, /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i, /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, /(firefox)\/([\w\.]+)/i, /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, /(links) \(([\w\.]+)/i, /panasonic;(viera)/i ], [c, f], [/(cobalt)\/([\w\.]+)/i], [c, [f, /master.|lts./, ""]] ], cpu: [ [/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i], [[m, "amd64"]], [/(ia32(?=;))/i], [[m, $]], [/((?:i[346]|x)86)[;\)]/i], [[m, "ia32"]], [/\b(aarch64|arm(v?8e?l?|_?64))\b/i], [[m, "arm64"]], [/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i], [[m, "armhf"]], [/windows (ce|mobile); ppc;/i], [[m, "arm"]], [/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i], [[m, /ower/, "", $]], [/(sun4\w)[;\)]/i], [[m, "sparc"]], [ /((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i ], [[m, $]] ], device: [ [/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i], [d, [p, U], [h, A]], [/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, /samsung[- ]([-\w]+)/i, /sec-(sgh\w+)/i], [d, [p, U], [h, y]], [/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i], [d, [p, x], [h, y]], [/\((ipad);[-\w\),; ]+apple/i, /applecoremedia\/[\w\.]+ \((ipad)/i, /\b(ipad)\d\d?,\d\d?[;\]].+ios/i], [d, [p, x], [h, A]], [/(macintosh);/i], [d, [p, x]], [/\b(sh-?[altvz]?\d\d[a-ekm]?)/i], [d, [p, F], [h, y]], [/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i], [d, [p, I], [h, A]], [/(?:huawei|honor)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i], [d, [p, I], [h, y]], [ /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, /\b; (\w+) build\/hm\1/i, /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i ], [ [d, /_/g, " "], [p, M], [h, y] ], [/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, /\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i], [ [d, /_/g, " "], [p, M], [h, A] ], [/; (\w+) bui.+ oppo/i, /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i], [d, [p, "OPPO"], [h, y]], [/vivo (\w+)(?: bui|\))/i, /\b(v[12]\d{3}\w?[at])(?: bui|;)/i], [d, [p, "Vivo"], [h, y]], [/\b(rmx[1-3]\d{3})(?: bui|;|\))/i], [d, [p, "Realme"], [h, y]], [ /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, /\bmot(?:orola)?[- ](\w*)/i, /((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i ], [d, [p, B], [h, y]], [/\b(mz60\d|xoom[2 ]{0,2}) build\//i], [d, [p, B], [h, A]], [/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i], [d, [p, R], [h, A]], [ /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, /\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i, /\blg-?([\d\w]+) bui/i ], [d, [p, R], [h, y]], [/(ideatab[-\w ]+)/i, /lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i], [d, [p, "Lenovo"], [h, A]], [/(?:maemo|nokia).*(n900|lumia \d+)/i, /nokia[-_ ]?([-\w\.]*)/i], [ [d, /_/g, " "], [p, "Nokia"], [h, y] ], [/(pixel c)\b/i], [d, [p, L], [h, A]], [/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i], [d, [p, L], [h, y]], [ /droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i ], [d, [p, O], [h, y]], [/sony tablet [ps]/i, /\b(?:sony)?sgp\w+(?: bui|\))/i], [ [d, "Xperia Tablet"], [p, O], [h, A] ], [/ (kb2005|in20[12]5|be20[12][59])\b/i, /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i], [d, [p, "OnePlus"], [h, y]], [/(alexa)webm/i, /(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i, /(kf[a-z]+)( bui|\)).+silk\//i], [d, [p, w], [h, A]], [/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i], [ [d, /(.+)/g, "Fire Phone $1"], [p, w], [h, y] ], [/(playbook);[-\w\),; ]+(rim)/i], [d, p, [h, A]], [/\b((?:bb[a-f]|st[hv])100-\d)/i, /\(bb10; (\w+)/i], [d, [p, _], [h, y]], [/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i], [d, [p, S], [h, A]], [/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i], [d, [p, S], [h, y]], [/(nexus 9)/i], [d, [p, "HTC"], [h, A]], [ /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i ], [p, [d, /_/g, " "], [h, y]], [/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i], [d, [p, "Acer"], [h, A]], [/droid.+; (m[1-5] note) bui/i, /\bmz-([-\w]{2,})/i], [d, [p, "Meizu"], [h, y]], [/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i], [d, [p, "Ulefone"], [h, y]], [ /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i, /(hp) ([\w ]+\w)/i, /(asus)-?(\w+)/i, /(microsoft); (lumia[\w ]+)/i, /(lenovo)[-_ ]?([-\w]+)/i, /(jolla)/i, /(oppo) ?([\w ]+) bui/i ], [p, d, [h, y]], [ /(kobo)\s(ereader|touch)/i, /(archos) (gamepad2?)/i, /(hp).+(touchpad(?!.+tablet)|tablet)/i, /(kindle)\/([\w\.]+)/i, /(nook)[\w ]+build\/(\w+)/i, /(dell) (strea[kpr\d ]*[\dko])/i, /(le[- ]+pan)[- ]+(\w{1,9}) bui/i, /(trinity)[- ]*(t\d{3}) bui/i, /(gigaset)[- ]+(q\w{1,9}) bui/i, /(vodafone) ([\w ]+)(?:\)| bui)/i ], [p, d, [h, A]], [/(surface duo)/i], [d, [p, D], [h, A]], [/droid [\d\.]+; (fp\du?)(?: b|\))/i], [d, [p, "Fairphone"], [h, y]], [/(u304aa)/i], [d, [p, "AT&T"], [h, y]], [/\bsie-(\w*)/i], [d, [p, "Siemens"], [h, y]], [/\b(rct\w+) b/i], [d, [p, "RCA"], [h, A]], [/\b(venue[\d ]{2,7}) b/i], [d, [p, "Dell"], [h, A]], [/\b(q(?:mv|ta)\w+) b/i], [d, [p, "Verizon"], [h, A]], [/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i], [d, [p, "Barnes & Noble"], [h, A]], [/\b(tm\d{3}\w+) b/i], [d, [p, "NuVision"], [h, A]], [/\b(k88) b/i], [d, [p, "ZTE"], [h, A]], [/\b(nx\d{3}j) b/i], [d, [p, "ZTE"], [h, y]], [/\b(gen\d{3}) b.+49h/i], [d, [p, "Swiss"], [h, y]], [/\b(zur\d{3}) b/i], [d, [p, "Swiss"], [h, A]], [/\b((zeki)?tb.*\b) b/i], [d, [p, "Zeki"], [h, A]], [/\b([yr]\d{2}) b/i, /\b(dragon[- ]+touch |dt)(\w{5}) b/i], [[p, "Dragon Touch"], d, [h, A]], [/\b(ns-?\w{0,9}) b/i], [d, [p, "Insignia"], [h, A]], [/\b((nxa|next)-?\w{0,9}) b/i], [d, [p, "NextBook"], [h, A]], [/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i], [[p, "Voice"], d, [h, y]], [/\b(lvtel\-)?(v1[12]) b/i], [[p, "LvTel"], d, [h, y]], [/\b(ph-1) /i], [d, [p, "Essential"], [h, y]], [/\b(v(100md|700na|7011|917g).*\b) b/i], [d, [p, "Envizen"], [h, A]], [/\b(trio[-\w\. ]+) b/i], [d, [p, "MachSpeed"], [h, A]], [/\btu_(1491) b/i], [d, [p, "Rotor"], [h, A]], [/(shield[\w ]+) b/i], [d, [p, "Nvidia"], [h, A]], [/(sprint) (\w+)/i], [p, d, [h, y]], [/(kin\.[onetw]{3})/i], [ [d, /\./g, " "], [p, D], [h, y] ], [/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i], [d, [p, N], [h, A]], [/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i], [d, [p, N], [h, y]], [/smart-tv.+(samsung)/i], [p, [h, v]], [/hbbtv.+maple;(\d+)/i], [ [d, /^/, "SmartTV"], [p, U], [h, v] ], [/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i], [ [p, R], [h, v] ], [/(apple) ?tv/i], [p, [d, x + " TV"], [h, v]], [/crkey/i], [ [d, k + "cast"], [p, L], [h, v] ], [/droid.+aft(\w+)( bui|\))/i], [d, [p, w], [h, v]], [/\(dtv[\);].+(aquos)/i, /(aquos-tv[\w ]+)\)/i], [d, [p, F], [h, v]], [/(bravia[\w ]+)( bui|\))/i], [d, [p, O], [h, v]], [/(mitv-\w{5}) bui/i], [d, [p, M], [h, v]], [/Hbbtv.*(technisat) (.*);/i], [p, d, [h, v]], [/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i], [ [p, K], [d, K], [h, v] ], [/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i], [[h, v]], [/(ouya)/i, /(nintendo) ([wids3utch]+)/i], [p, d, [h, g]], [/droid.+; (shield) bui/i], [d, [p, "Nvidia"], [h, g]], [/(playstation [345portablevi]+)/i], [d, [p, O], [h, g]], [/\b(xbox(?: one)?(?!; xbox))[\); ]/i], [d, [p, D], [h, g]], [/((pebble))app/i], [p, d, [h, b]], [/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i], [d, [p, x], [h, b]], [/droid.+; (glass) \d/i], [d, [p, L], [h, b]], [/droid.+; (wt63?0{2,3})\)/i], [d, [p, N], [h, b]], [/(quest( 2| pro)?)/i], [d, [p, z], [h, b]], [/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i], [p, [h, E]], [/(aeobc)\b/i], [d, [p, w], [h, E]], [/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i], [d, [h, y]], [/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i], [d, [h, A]], [/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i], [[h, A]], [/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i], [[h, y]], [/(android[-\w\. ]{0,9});.+buil/i], [d, [p, "Generic"]] ], engine: [ [/windows.+ edge\/([\w\.]+)/i], [f, [c, "EdgeHTML"]], [/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i], [f, [c, "Blink"]], [ /(presto)\/([\w\.]+)/i, /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i, /ekioh(flow)\/([\w\.]+)/i, /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, /(icab)[\/ ]([23]\.[\d\.]+)/i, /\b(libweb)/i ], [c, f], [/rv\:([\w\.]{1,9})\b.+(gecko)/i], [f, c] ], os: [ [/microsoft (windows) (vista|xp)/i], [c, f], [/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i], [c, [f, V, W]], [ /windows nt 6\.2; (arm)/i, /windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i, /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i ], [ [f, V, W], [c, "Windows"] ], [ /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, /cfnetwork\/.+darwin/i ], [ [f, /_/g, "."], [c, "iOS"] ], [/(mac os x) ?([\w\. ]*)/i, /(macintosh|mac_powerpc\b)(?!.+haiku)/i], [ [c, j], [f, /_/g, "."] ], [/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i], [f, c], [ /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i, /(blackberry)\w*\/([\w\.]*)/i, /(tizen|kaios)[\/ ]([\w\.]+)/i, /\((series40);/i ], [c, f], [/\(bb(10);/i], [f, [c, _]], [/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i], [f, [c, "Symbian"]], [/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i], [f, [c, C + " OS"]], [/web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i], [f, [c, "webOS"]], [/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i], [f, [c, "watchOS"]], [/crkey\/([\d\.]+)/i], [f, [c, k + "cast"]], [/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i], [[c, G], f], [ /panasonic;(viera)/i, /(netrange)mmh/i, /(nettv)\/(\d+\.[\w\.]+)/i, /(nintendo|playstation) ([wids345portablevuch]+)/i, /(xbox); +xbox ([^\);]+)/i, /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, /(mint)[\/\(\) ]?(\w*)/i, /(mageia|vectorlinux)[; ]/i, /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, /(hurd|linux) ?([\w\.]*)/i, /(gnu) ?([\w\.]*)/i, /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, /(haiku) (\w+)/i ], [c, f], [/(sunos) ?([\w\.\d]*)/i], [[c, "Solaris"], f], [ /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, /(unix) ?([\w\.]*)/i ], [c, f] ] }, X = function t(e, g) { if ((u(e) === s && ((g = e), (e = i)), !(this instanceof t))) return new t(e, g).getResult(); var v = u(n) !== a && n.navigator ? n.navigator : i, b = e || (v && v.userAgent ? v.userAgent : ""), E = v && v.userAgentData ? v.userAgentData : i, w = g ? (function (t, e) { var n = {}; for (var i in t) e[i] && e[i].length % 2 == 0 ? (n[i] = e[i].concat(t[i])) : (n[i] = t[i]); return n; })(Q, g) : Q, x = v && v.userAgent == b; return ( (this.getBrowser = function () { var t, e = {}; return ( (e[c] = i), (e[f] = i), q.call(e, b, w.browser), (e[l] = u((t = e[f])) === o ? t.replace(/[^\d\.]/g, "").split(".")[0] : i), x && v && v.brave && u(v.brave.isBrave) == r && (e[c] = "Brave"), e ); }), (this.getCPU = function () { var t = {}; return (t[m] = i), q.call(t, b, w.cpu), t; }), (this.getDevice = function () { var t = {}; return ( (t[p] = i), (t[d] = i), (t[h] = i), q.call(t, b, w.device), x && !t[h] && E && E.mobile && (t[h] = y), x && "Macintosh" == t[d] && v && u(v.standalone) !== a && v.maxTouchPoints && v.maxTouchPoints > 2 && ((t[d] = "iPad"), (t[h] = A)), t ); }), (this.getEngine = function () { var t = {}; return (t[c] = i), (t[f] = i), q.call(t, b, w.engine), t; }), (this.getOS = function () { var t = {}; return ( (t[c] = i), (t[f] = i), q.call(t, b, w.os), x && !t[c] && E && "Unknown" != E.platform && (t[c] = E.platform.replace(/chrome os/i, G).replace(/macos/i, j)), t ); }), (this.getResult = function () { return { ua: this.getUA(), browser: this.getBrowser(), engine: this.getEngine(), os: this.getOS(), device: this.getDevice(), cpu: this.getCPU() }; }), (this.getUA = function () { return b; }), (this.setUA = function (t) { return (b = u(t) === o && t.length > 500 ? K(t, 500) : t), this; }), this.setUA(b), this ); }; (X.VERSION = "1.0.37"), (X.BROWSER = H([c, f, l])), (X.CPU = H([m])), (X.DEVICE = H([d, p, h, g, y, v, A, b, E])), (X.ENGINE = X.OS = H([c, f])), t.exports && (e = t.exports = X), (e.UAParser = X); var J = u(n) !== a && (n.jQuery || n.Zepto); if (J && !J.ua) { var Z = new X(); (J.ua = Z.getResult()), (J.ua.get = function () { return Z.getUA(); }), (J.ua.set = function (t) { Z.setUA(t); var e = Z.getResult(); for (var n in e) J.ua[n] = e[n]; }); } })("object" === ("undefined" == typeof window ? "undefined" : u(window)) ? window : T); })(C, C.exports); var L, I = new (k(C.exports))().getResult(), R = function () { return { hasVideoDecode: !!window.VideoDecoder, hasAudioContext: !!window.AudioContext, system: "" .concat(I.device.vendor, "->") .concat(I.device.model, "->") .concat(I.device.type, ":") .concat(I.os.name, "(") .concat(I.os.version, ")"), browser: "".concat(I.browser.name, "(").concat(I.browser.version, ")") }; }, D = I.browser.name.toLowerCase(); I.browser.version, I.os.name; var B = !(null === (L = I.device) || void 0 === L || !L.type), P = "Apple" === I.device.vendor && B, U = ["UCBrowser", "Quark", "Chrome WebView", "Vivo Browser"]; P && (U.push("baidu"), U.push("qqbrowser")); var F = B && ["UCBrowser", "Quark", "baidu", "qqbrowser", "Chrome WebView", "Vivo Browser"].some(function (t) { return D.includes(t.toLowerCase()); }), O = B && U.some(function (t) { return D.includes(t.toLowerCase()); }), M = "M3U8", N = "CANVAS", z = function () { return O && window.VideoDecoder && window.AudioContext ? N : M; }, G = { exports: {} }; !(function (t, e) { self, (t.exports = (function () { var t = { 916: function (t, e, n) { var i = n(471); t.exports = function (t) { var e, r = "", a = (t = t || {}).video, s = t.options, o = i.$escape, l = t.tran, d = t.icons, c = t.index, u = i.$each; return ( t.$value, t.$index, (r += '
\n
\n '), (e = n(568)(a)), (r += e), (r += "\n "), s.logo && ((r += '\n \n ')), (r += '\n
" ); }; }, 49: function (t, e, n) { n.d(e, { Z: function () { return o; } }); var i = n(415), r = n.n(i), a = n(352), s = n.n(a)()(r()); s.push([ t.id, ':root {\n --balloon-border-radius: 2px;\n --balloon-color: rgba(16, 16, 16, 0.95);\n --balloon-text-color: #fff;\n --balloon-font-size: 12px;\n --balloon-move: 4px; }\n\nbutton[aria-label][data-balloon-pos] {\n overflow: visible; }\n\n[aria-label][data-balloon-pos] {\n position: relative;\n cursor: pointer; }\n [aria-label][data-balloon-pos]:after {\n opacity: 0;\n pointer-events: none;\n transition: all 0.18s ease-out 0.18s;\n text-indent: 0;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n font-weight: normal;\n font-style: normal;\n text-shadow: none;\n font-size: 12px;\n font-size: var(--balloon-font-size);\n background: rgba(16, 16, 16, 0.95);\n background: var(--balloon-color);\n border-radius: 2px;\n color: #fff;\n color: var(--balloon-text-color);\n border-radius: var(--balloon-border-radius);\n content: attr(aria-label);\n padding: .5em 1em;\n position: absolute;\n white-space: nowrap;\n z-index: 10; }\n [aria-label][data-balloon-pos]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-top-color: rgba(16, 16, 16, 0.95);\n border-top-color: var(--balloon-color);\n opacity: 0;\n pointer-events: none;\n transition: all 0.18s ease-out 0.18s;\n content: "";\n position: absolute;\n z-index: 10; }\n [aria-label][data-balloon-pos]:hover:before, [aria-label][data-balloon-pos]:hover:after, [aria-label][data-balloon-pos][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-visible]:after, [aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:before, [aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:after {\n opacity: 1;\n pointer-events: none; }\n [aria-label][data-balloon-pos].font-awesome:after {\n font-family: FontAwesome, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif; }\n [aria-label][data-balloon-pos][data-balloon-break]:after {\n white-space: pre; }\n [aria-label][data-balloon-pos][data-balloon-break][data-balloon-length]:after {\n white-space: pre-line;\n word-break: break-word; }\n [aria-label][data-balloon-pos][data-balloon-blunt]:before, [aria-label][data-balloon-pos][data-balloon-blunt]:after {\n transition: none; }\n [aria-label][data-balloon-pos][data-balloon-pos="up"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="up"][data-balloon-visible]:after, [aria-label][data-balloon-pos][data-balloon-pos="down"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="down"][data-balloon-visible]:after {\n transform: translate(-50%, 0); }\n [aria-label][data-balloon-pos][data-balloon-pos="up"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="up"][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-pos="down"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="down"][data-balloon-visible]:before {\n transform: translate(-50%, 0); }\n [aria-label][data-balloon-pos][data-balloon-pos*="-left"]:after {\n left: 0; }\n [aria-label][data-balloon-pos][data-balloon-pos*="-left"]:before {\n left: 5px; }\n [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:after {\n right: 0; }\n [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:before {\n right: 5px; }\n [aria-label][data-balloon-pos][data-balloon-po*="-left"]:hover:after, [aria-label][data-balloon-pos][data-balloon-po*="-left"][data-balloon-visible]:after, [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos*="-right"][data-balloon-visible]:after {\n transform: translate(0, 0); }\n [aria-label][data-balloon-pos][data-balloon-po*="-left"]:hover:before, [aria-label][data-balloon-pos][data-balloon-po*="-left"][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos*="-right"][data-balloon-visible]:before {\n transform: translate(0, 0); }\n [aria-label][data-balloon-pos][data-balloon-pos^="up"]:before, [aria-label][data-balloon-pos][data-balloon-pos^="up"]:after {\n bottom: 100%;\n transform-origin: top;\n transform: translate(0, 4px);\n transform: translate(0, var(--balloon-move)); }\n [aria-label][data-balloon-pos][data-balloon-pos^="up"]:after {\n margin-bottom: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos="up"]:before, [aria-label][data-balloon-pos][data-balloon-pos="up"]:after {\n left: 50%;\n transform: translate(-50%, 4px);\n transform: translate(-50%, var(--balloon-move)); }\n [aria-label][data-balloon-pos][data-balloon-pos^="down"]:before, [aria-label][data-balloon-pos][data-balloon-pos^="down"]:after {\n top: 100%;\n transform: translate(0, calc(4px * -1));\n transform: translate(0, calc(var(--balloon-move) * -1)); }\n [aria-label][data-balloon-pos][data-balloon-pos^="down"]:after {\n margin-top: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos^="down"]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-bottom-color: rgba(16, 16, 16, 0.95);\n border-bottom-color: var(--balloon-color); }\n [aria-label][data-balloon-pos][data-balloon-pos="down"]:after, [aria-label][data-balloon-pos][data-balloon-pos="down"]:before {\n left: 50%;\n transform: translate(-50%, calc(4px * -1));\n transform: translate(-50%, calc(var(--balloon-move) * -1)); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="left"][data-balloon-visible]:after, [aria-label][data-balloon-pos][data-balloon-pos="right"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="right"][data-balloon-visible]:after {\n transform: translate(0, -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="left"][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-pos="right"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="right"][data-balloon-visible]:before {\n transform: translate(0, -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:after, [aria-label][data-balloon-pos][data-balloon-pos="left"]:before {\n right: 100%;\n top: 50%;\n transform: translate(4px, -50%);\n transform: translate(var(--balloon-move), -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:after {\n margin-right: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-left-color: rgba(16, 16, 16, 0.95);\n border-left-color: var(--balloon-color); }\n [aria-label][data-balloon-pos][data-balloon-pos="right"]:after, [aria-label][data-balloon-pos][data-balloon-pos="right"]:before {\n left: 100%;\n top: 50%;\n transform: translate(calc(4px * -1), -50%);\n transform: translate(calc(var(--balloon-move) * -1), -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="right"]:after {\n margin-left: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos="right"]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-right-color: rgba(16, 16, 16, 0.95);\n border-right-color: var(--balloon-color); }\n [aria-label][data-balloon-pos][data-balloon-length]:after {\n white-space: normal; }\n [aria-label][data-balloon-pos][data-balloon-length="small"]:after {\n width: 80px; }\n [aria-label][data-balloon-pos][data-balloon-length="medium"]:after {\n width: 150px; }\n [aria-label][data-balloon-pos][data-balloon-length="large"]:after {\n width: 260px; }\n [aria-label][data-balloon-pos][data-balloon-length="xlarge"]:after {\n width: 380px; }\n @media screen and (max-width: 768px) {\n [aria-label][data-balloon-pos][data-balloon-length="xlarge"]:after {\n width: 90vw; } }\n [aria-label][data-balloon-pos][data-balloon-length="fit"]:after {\n width: 100%; }\n', "", { version: 3, sources: [ "webpack://./node_modules/.pnpm/balloon-css@1.2.0/node_modules/balloon-css/balloon.css" ], names: [], mappings: "AAAA;EACE,4BAA4B;EAC5B,uCAAuC;EACvC,0BAA0B;EAC1B,yBAAyB;EACzB,mBAAmB,EAAE;;AAEvB;EACE,iBAAiB,EAAE;;AAErB;EACE,kBAAkB;EAClB,eAAe,EAAE;EACjB;IACE,UAAU;IACV,oBAAoB;IACpB,oCAAoC;IACpC,cAAc;IACd,wIAAwI;IACxI,mBAAmB;IACnB,kBAAkB;IAClB,iBAAiB;IACjB,eAAmC;IAAnC,mCAAmC;IACnC,kCAAgC;IAAhC,gCAAgC;IAChC,kBAAkB;IAClB,WAAgC;IAAhC,gCAAgC;IAChC,2CAA2C;IAC3C,yBAAyB;IACzB,iBAAiB;IACjB,kBAAkB;IAClB,mBAAmB;IACnB,WAAW,EAAE;EACf;IACE,QAAQ;IACR,SAAS;IACT,6BAA6B;IAC7B,wCAAsC;IAAtC,sCAAsC;IACtC,UAAU;IACV,oBAAoB;IACpB,oCAAoC;IACpC,WAAW;IACX,kBAAkB;IAClB,WAAW,EAAE;EACf;IACE,UAAU;IACV,oBAAoB,EAAE;EACxB;IACE,qJAAqJ,EAAE;EACzJ;IACE,gBAAgB,EAAE;EACpB;IACE,qBAAqB;IACrB,sBAAsB,EAAE;EAC1B;IACE,gBAAgB,EAAE;EACpB;IACE,6BAA6B,EAAE;EACjC;IACE,6BAA6B,EAAE;EACjC;IACE,OAAO,EAAE;EACX;IACE,SAAS,EAAE;EACb;IACE,QAAQ,EAAE;EACZ;IACE,UAAU,EAAE;EACd;IACE,0BAA0B,EAAE;EAC9B;IACE,0BAA0B,EAAE;EAC9B;IACE,YAAY;IACZ,qBAAqB;IACrB,4BAA4C;IAA5C,4CAA4C,EAAE;EAChD;IACE,mBAAmB,EAAE;EACvB;IACE,SAAS;IACT,+BAA+C;IAA/C,+CAA+C,EAAE;EACnD;IACE,SAAS;IACT,uCAAuD;IAAvD,uDAAuD,EAAE;EAC3D;IACE,gBAAgB,EAAE;EACpB;IACE,QAAQ;IACR,SAAS;IACT,6BAA6B;IAC7B,2CAAyC;IAAzC,yCAAyC,EAAE;EAC7C;IACE,SAAS;IACT,0CAA0D;IAA1D,0DAA0D,EAAE;EAC9D;IACE,6BAA6B,EAAE;EACjC;IACE,6BAA6B,EAAE;EACjC;IACE,WAAW;IACX,QAAQ;IACR,+BAA+C;IAA/C,+CAA+C,EAAE;EACnD;IACE,kBAAkB,EAAE;EACtB;IACE,QAAQ;IACR,SAAS;IACT,6BAA6B;IAC7B,yCAAuC;IAAvC,uCAAuC,EAAE;EAC3C;IACE,UAAU;IACV,QAAQ;IACR,0CAA0D;IAA1D,0DAA0D,EAAE;EAC9D;IACE,iBAAiB,EAAE;EACrB;IACE,QAAQ;IACR,SAAS;IACT,6BAA6B;IAC7B,0CAAwC;IAAxC,wCAAwC,EAAE;EAC5C;IACE,mBAAmB,EAAE;EACvB;IACE,WAAW,EAAE;EACf;IACE,YAAY,EAAE;EAChB;IACE,YAAY,EAAE;EAChB;IACE,YAAY,EAAE;IACd;MACE;QACE,WAAW,EAAE,EAAE;EACrB;IACE,WAAW,EAAE", sourcesContent: [ ':root {\n --balloon-border-radius: 2px;\n --balloon-color: rgba(16, 16, 16, 0.95);\n --balloon-text-color: #fff;\n --balloon-font-size: 12px;\n --balloon-move: 4px; }\n\nbutton[aria-label][data-balloon-pos] {\n overflow: visible; }\n\n[aria-label][data-balloon-pos] {\n position: relative;\n cursor: pointer; }\n [aria-label][data-balloon-pos]:after {\n opacity: 0;\n pointer-events: none;\n transition: all 0.18s ease-out 0.18s;\n text-indent: 0;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n font-weight: normal;\n font-style: normal;\n text-shadow: none;\n font-size: var(--balloon-font-size);\n background: var(--balloon-color);\n border-radius: 2px;\n color: var(--balloon-text-color);\n border-radius: var(--balloon-border-radius);\n content: attr(aria-label);\n padding: .5em 1em;\n position: absolute;\n white-space: nowrap;\n z-index: 10; }\n [aria-label][data-balloon-pos]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-top-color: var(--balloon-color);\n opacity: 0;\n pointer-events: none;\n transition: all 0.18s ease-out 0.18s;\n content: "";\n position: absolute;\n z-index: 10; }\n [aria-label][data-balloon-pos]:hover:before, [aria-label][data-balloon-pos]:hover:after, [aria-label][data-balloon-pos][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-visible]:after, [aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:before, [aria-label][data-balloon-pos]:not([data-balloon-nofocus]):focus:after {\n opacity: 1;\n pointer-events: none; }\n [aria-label][data-balloon-pos].font-awesome:after {\n font-family: FontAwesome, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, \'Open Sans\', \'Helvetica Neue\', sans-serif; }\n [aria-label][data-balloon-pos][data-balloon-break]:after {\n white-space: pre; }\n [aria-label][data-balloon-pos][data-balloon-break][data-balloon-length]:after {\n white-space: pre-line;\n word-break: break-word; }\n [aria-label][data-balloon-pos][data-balloon-blunt]:before, [aria-label][data-balloon-pos][data-balloon-blunt]:after {\n transition: none; }\n [aria-label][data-balloon-pos][data-balloon-pos="up"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="up"][data-balloon-visible]:after, [aria-label][data-balloon-pos][data-balloon-pos="down"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="down"][data-balloon-visible]:after {\n transform: translate(-50%, 0); }\n [aria-label][data-balloon-pos][data-balloon-pos="up"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="up"][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-pos="down"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="down"][data-balloon-visible]:before {\n transform: translate(-50%, 0); }\n [aria-label][data-balloon-pos][data-balloon-pos*="-left"]:after {\n left: 0; }\n [aria-label][data-balloon-pos][data-balloon-pos*="-left"]:before {\n left: 5px; }\n [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:after {\n right: 0; }\n [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:before {\n right: 5px; }\n [aria-label][data-balloon-pos][data-balloon-po*="-left"]:hover:after, [aria-label][data-balloon-pos][data-balloon-po*="-left"][data-balloon-visible]:after, [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos*="-right"][data-balloon-visible]:after {\n transform: translate(0, 0); }\n [aria-label][data-balloon-pos][data-balloon-po*="-left"]:hover:before, [aria-label][data-balloon-pos][data-balloon-po*="-left"][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-pos*="-right"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos*="-right"][data-balloon-visible]:before {\n transform: translate(0, 0); }\n [aria-label][data-balloon-pos][data-balloon-pos^="up"]:before, [aria-label][data-balloon-pos][data-balloon-pos^="up"]:after {\n bottom: 100%;\n transform-origin: top;\n transform: translate(0, var(--balloon-move)); }\n [aria-label][data-balloon-pos][data-balloon-pos^="up"]:after {\n margin-bottom: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos="up"]:before, [aria-label][data-balloon-pos][data-balloon-pos="up"]:after {\n left: 50%;\n transform: translate(-50%, var(--balloon-move)); }\n [aria-label][data-balloon-pos][data-balloon-pos^="down"]:before, [aria-label][data-balloon-pos][data-balloon-pos^="down"]:after {\n top: 100%;\n transform: translate(0, calc(var(--balloon-move) * -1)); }\n [aria-label][data-balloon-pos][data-balloon-pos^="down"]:after {\n margin-top: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos^="down"]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-bottom-color: var(--balloon-color); }\n [aria-label][data-balloon-pos][data-balloon-pos="down"]:after, [aria-label][data-balloon-pos][data-balloon-pos="down"]:before {\n left: 50%;\n transform: translate(-50%, calc(var(--balloon-move) * -1)); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="left"][data-balloon-visible]:after, [aria-label][data-balloon-pos][data-balloon-pos="right"]:hover:after, [aria-label][data-balloon-pos][data-balloon-pos="right"][data-balloon-visible]:after {\n transform: translate(0, -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="left"][data-balloon-visible]:before, [aria-label][data-balloon-pos][data-balloon-pos="right"]:hover:before, [aria-label][data-balloon-pos][data-balloon-pos="right"][data-balloon-visible]:before {\n transform: translate(0, -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:after, [aria-label][data-balloon-pos][data-balloon-pos="left"]:before {\n right: 100%;\n top: 50%;\n transform: translate(var(--balloon-move), -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:after {\n margin-right: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos="left"]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-left-color: var(--balloon-color); }\n [aria-label][data-balloon-pos][data-balloon-pos="right"]:after, [aria-label][data-balloon-pos][data-balloon-pos="right"]:before {\n left: 100%;\n top: 50%;\n transform: translate(calc(var(--balloon-move) * -1), -50%); }\n [aria-label][data-balloon-pos][data-balloon-pos="right"]:after {\n margin-left: 10px; }\n [aria-label][data-balloon-pos][data-balloon-pos="right"]:before {\n width: 0;\n height: 0;\n border: 5px solid transparent;\n border-right-color: var(--balloon-color); }\n [aria-label][data-balloon-pos][data-balloon-length]:after {\n white-space: normal; }\n [aria-label][data-balloon-pos][data-balloon-length="small"]:after {\n width: 80px; }\n [aria-label][data-balloon-pos][data-balloon-length="medium"]:after {\n width: 150px; }\n [aria-label][data-balloon-pos][data-balloon-length="large"]:after {\n width: 260px; }\n [aria-label][data-balloon-pos][data-balloon-length="xlarge"]:after {\n width: 380px; }\n @media screen and (max-width: 768px) {\n [aria-label][data-balloon-pos][data-balloon-length="xlarge"]:after {\n width: 90vw; } }\n [aria-label][data-balloon-pos][data-balloon-length="fit"]:after {\n width: 100%; }\n' ], sourceRoot: "" } ]); var o = s; }, 685: function (t, e, n) { n.d(e, { Z: function () { return p; } }); var i = n(415), r = n.n(i), a = n(352), s = n.n(a), o = n(49), l = n(80), d = n.n(l), c = new URL(n(831), n.b), u = s()(r()); u.i(o.Z); var h = d()(c); u.push([ t.id, '@keyframes my-face {\n 2% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 4% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 6% {\n transform: translate(0, 1.5px) rotate(-1.5deg);\n }\n 8% {\n transform: translate(0, -1.5px) rotate(-1.5deg);\n }\n 10% {\n transform: translate(0, 2.5px) rotate(1.5deg);\n }\n 12% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 14% {\n transform: translate(0, -1.5px) rotate(1.5deg);\n }\n 16% {\n transform: translate(0, -0.5px) rotate(-1.5deg);\n }\n 18% {\n transform: translate(0, 0.5px) rotate(-1.5deg);\n }\n 20% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 22% {\n transform: translate(0, 0.5px) rotate(-1.5deg);\n }\n 24% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 26% {\n transform: translate(0, 0.5px) rotate(0.5deg);\n }\n 28% {\n transform: translate(0, 0.5px) rotate(1.5deg);\n }\n 30% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 32% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 34% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 36% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 38% {\n transform: translate(0, 1.5px) rotate(-1.5deg);\n }\n 40% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 42% {\n transform: translate(0, 2.5px) rotate(-1.5deg);\n }\n 44% {\n transform: translate(0, 1.5px) rotate(0.5deg);\n }\n 46% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 48% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 50% {\n transform: translate(0, 0.5px) rotate(0.5deg);\n }\n 52% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 54% {\n transform: translate(0, -1.5px) rotate(1.5deg);\n }\n 56% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 58% {\n transform: translate(0, 0.5px) rotate(2.5deg);\n }\n 60% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 62% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 64% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 66% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 68% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 70% {\n transform: translate(0, 1.5px) rotate(0.5deg);\n }\n 72% {\n transform: translate(0, 2.5px) rotate(1.5deg);\n }\n 74% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 76% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 78% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 80% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 82% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 84% {\n transform: translate(0, 1.5px) rotate(2.5deg);\n }\n 86% {\n transform: translate(0, -1.5px) rotate(-1.5deg);\n }\n 88% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 90% {\n transform: translate(0, 2.5px) rotate(-0.5deg);\n }\n 92% {\n transform: translate(0, 0.5px) rotate(-0.5deg);\n }\n 94% {\n transform: translate(0, 2.5px) rotate(0.5deg);\n }\n 96% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 98% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 0%,\n 100% {\n transform: translate(0, 0) rotate(0deg);\n }\n}\n.dplayer {\n position: relative;\n overflow: hidden;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n line-height: 1;\n}\n.dplayer * {\n box-sizing: content-box;\n}\n.dplayer svg {\n width: 100%;\n height: 100%;\n}\n.dplayer svg path,\n.dplayer svg circle {\n fill: #fff;\n}\n.dplayer:-webkit-full-screen {\n width: 100%;\n height: 100%;\n background: #000;\n position: fixed;\n z-index: 100000;\n left: 0;\n top: 0;\n margin: 0;\n padding: 0;\n transform: translate(0, 0);\n}\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box .dplayer-setting-showdan,\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box .dplayer-setting-danmaku,\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box .dplayer-setting-danunlimit {\n display: none;\n}\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-comment {\n display: none;\n}\n.dplayer.dplayer-no-danmaku .dplayer-danmaku {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-time {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-bar-wrap {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-setting-speed {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-setting-loop {\n display: none;\n}\n.dplayer.dplayer-live.dplayer-no-danmaku .dplayer-setting {\n display: none;\n}\n.dplayer.dplayer-arrow .dplayer-danmaku {\n font-size: 18px;\n}\n.dplayer.dplayer-arrow .dplayer-icon {\n margin: 0 -3px;\n}\n.dplayer.dplayer-playing .dplayer-danmaku .dplayer-danmaku-move {\n animation-play-state: running;\n}\n@media (min-width: 900px) {\n .dplayer.dplayer-playing .dplayer-controller-mask {\n opacity: 0;\n }\n .dplayer.dplayer-playing .dplayer-controller {\n opacity: 0;\n }\n .dplayer.dplayer-playing:hover .dplayer-controller-mask {\n opacity: 1;\n }\n .dplayer.dplayer-playing:hover .dplayer-controller {\n opacity: 1;\n }\n}\n.dplayer.dplayer-loading .dplayer-bezel .diplayer-loading-icon {\n display: block;\n}\n.dplayer.dplayer-loading .dplayer-danmaku,\n.dplayer.dplayer-paused .dplayer-danmaku,\n.dplayer.dplayer-loading .dplayer-danmaku-move,\n.dplayer.dplayer-paused .dplayer-danmaku-move {\n animation-play-state: paused;\n}\n.dplayer.dplayer-hide-controller {\n cursor: none;\n}\n.dplayer.dplayer-hide-controller .dplayer-controller-mask {\n opacity: 0;\n transform: translateY(100%);\n}\n.dplayer.dplayer-hide-controller .dplayer-controller {\n opacity: 0;\n transform: translateY(100%);\n}\n.dplayer.dplayer-show-controller .dplayer-controller-mask {\n opacity: 1;\n}\n.dplayer.dplayer-show-controller .dplayer-controller {\n opacity: 1;\n}\n.dplayer.dplayer-fulled {\n width: 100% !important;\n height: 100% !important;\n}\n.dplayer.dplayer-fulled {\n position: fixed;\n z-index: 100000;\n left: 0;\n top: 0;\n}\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-volume,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-camera-icon,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-airplay-icon,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-chromecast-icon,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-play-icon {\n display: none;\n}\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-full .dplayer-full-in-icon {\n position: static;\n display: inline-block;\n}\n.dplayer.dplayer-mobile .dplayer-bar-time {\n display: none;\n}\n.dplayer.dplayer-mobile.dplayer-hide-controller .dplayer-mobile-play {\n display: none;\n}\n.dplayer.dplayer-mobile .dplayer-mobile-play {\n display: block;\n}\n.dplayer-web-fullscreen-fix {\n position: fixed;\n top: 0;\n left: 0;\n margin: 0;\n padding: 0;\n}\n[data-balloon]:before {\n display: none;\n}\n[data-balloon]:after {\n padding: 0.3em 0.7em;\n background: rgba(17, 17, 17, 0.7);\n}\n[data-balloon][data-balloon-pos="up"]:after {\n margin-bottom: 0;\n}\n.dplayer-bezel {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n font-size: 22px;\n color: #fff;\n pointer-events: none;\n}\n.dplayer-bezel .dplayer-bezel-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -26px 0 0 -26px;\n height: 52px;\n width: 52px;\n padding: 12px;\n box-sizing: border-box;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n}\n.dplayer-bezel .dplayer-bezel-icon.dplayer-bezel-transition {\n animation: bezel-hide 0.5s linear;\n}\n@keyframes bezel-hide {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(2);\n }\n}\n.dplayer-bezel .dplayer-danloading {\n position: absolute;\n top: 50%;\n margin-top: -7px;\n width: 100%;\n text-align: center;\n font-size: 14px;\n line-height: 14px;\n animation: my-face 5s infinite ease-in-out;\n}\n.dplayer-bezel .diplayer-loading-icon {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -18px 0 0 -18px;\n height: 36px;\n width: 36px;\n pointer-events: none;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-hide {\n display: none;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot {\n animation: diplayer-loading-dot-fade 0.8s ease infinite;\n opacity: 0;\n transform-origin: 4px 4px;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-1 {\n animation-delay: 0.1s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-2 {\n animation-delay: 0.2s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-3 {\n animation-delay: 0.3s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-4 {\n animation-delay: 0.4s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-5 {\n animation-delay: 0.5s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-6 {\n animation-delay: 0.6s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-7 {\n animation-delay: 0.7s;\n}\n@keyframes diplayer-loading-dot-fade {\n 0% {\n opacity: 0.7;\n transform: scale(1.2, 1.2);\n }\n 50% {\n opacity: 0.25;\n transform: scale(0.9, 0.9);\n }\n to {\n opacity: 0.25;\n transform: scale(0.85, 0.85);\n }\n}\n.dplayer-controller-mask {\n background: url(' + h + ") repeat-x bottom;\n height: 98px;\n width: 100%;\n position: absolute;\n bottom: 0;\n transition: all 0.3s ease;\n}\n.dplayer-controller {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 41px;\n padding: 0 20px;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n transition: all 0.3s ease;\n}\n.dplayer-controller.dplayer-controller-comment .dplayer-icons {\n display: none;\n}\n.dplayer-controller.dplayer-controller-comment .dplayer-icons.dplayer-comment-box {\n display: block;\n}\n.dplayer-controller .dplayer-bar-wrap {\n padding: 5px 0;\n cursor: pointer;\n position: absolute;\n bottom: 33px;\n width: calc(100% - 40px);\n height: 3px;\n}\n.dplayer-controller .dplayer-bar-wrap:hover .dplayer-bar .dplayer-played .dplayer-thumb {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-bar-wrap:hover .dplayer-highlight {\n display: block;\n width: 8px;\n transform: translateX(-4px);\n top: 4px;\n height: 40%;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight {\n z-index: 12;\n position: absolute;\n top: 5px;\n width: 6px;\n height: 20%;\n border-radius: 6px;\n background-color: #fff;\n text-align: center;\n transform: translateX(-3px);\n transition: all 0.2s ease-in-out;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight:hover .dplayer-highlight-text {\n display: block;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight:hover ~ .dplayer-bar-preview {\n opacity: 0;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight:hover ~ .dplayer-bar-time {\n opacity: 0;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight .dplayer-highlight-text {\n display: none;\n position: absolute;\n left: 50%;\n top: -24px;\n padding: 5px 8px;\n background-color: rgba(0, 0, 0, 0.62);\n color: #fff;\n border-radius: 4px;\n font-size: 12px;\n white-space: nowrap;\n transform: translateX(-50%);\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-preview {\n position: absolute;\n background: #fff;\n pointer-events: none;\n display: none;\n background-size: 16000px 100%;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-preview-canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 1;\n pointer-events: none;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-time {\n position: absolute;\n left: 0px;\n top: -20px;\n border-radius: 4px;\n padding: 5px 7px;\n background-color: rgba(0, 0, 0, 0.62);\n color: #fff;\n font-size: 12px;\n text-align: center;\n opacity: 1;\n transition: opacity 0.1s ease-in-out;\n word-wrap: normal;\n word-break: normal;\n z-index: 2;\n pointer-events: none;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-time.hidden {\n opacity: 0;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar {\n position: relative;\n height: 3px;\n width: 100%;\n background: rgba(255, 255, 255, 0.2);\n cursor: pointer;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-loaded {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n background: rgba(255, 255, 255, 0.4);\n height: 3px;\n transition: all 0.5s ease;\n will-change: width;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-played {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n height: 3px;\n will-change: width;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-played .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n transform: scale(0);\n}\n.dplayer-controller .dplayer-icons {\n height: 38px;\n position: absolute;\n bottom: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box {\n display: none;\n position: absolute;\n transition: all 0.3s ease-in-out;\n z-index: 2;\n height: 38px;\n bottom: 0;\n left: 20px;\n right: 20px;\n color: #fff;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-icon {\n padding: 7px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-icon {\n position: absolute;\n left: 0;\n top: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-send-icon {\n position: absolute;\n right: 0;\n top: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box {\n position: absolute;\n background: rgba(28, 28, 28, 0.9);\n bottom: 41px;\n left: 0;\n box-shadow: 0 0 25px rgba(0, 0, 0, 0.3);\n border-radius: 4px;\n padding: 10px 10px 16px;\n font-size: 14px;\n width: 204px;\n transition: all 0.3s ease-in-out;\n transform: scale(0);\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box.dplayer-comment-setting-open {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box input[type=radio] {\n display: none;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box label {\n cursor: pointer;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-title {\n font-size: 13px;\n color: #fff;\n line-height: 30px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type {\n font-size: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type .dplayer-comment-setting-title {\n margin-bottom: 6px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type label:nth-child(2) span {\n border-radius: 4px 0 0 4px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type label:nth-child(4) span {\n border-radius: 0 4px 4px 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type span {\n width: 33%;\n padding: 4px 6px;\n line-height: 16px;\n display: inline-block;\n font-size: 12px;\n color: #fff;\n border: 1px solid #fff;\n margin-right: -1px;\n box-sizing: border-box;\n text-align: center;\n cursor: pointer;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type input:checked + span {\n background: #E4E4E6;\n color: #1c1c1c;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color {\n font-size: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color label {\n font-size: 0;\n padding: 6px;\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color span {\n width: 22px;\n height: 22px;\n display: inline-block;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color span:hover {\n animation: my-face 5s infinite ease-in-out;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input {\n outline: none;\n border: none;\n padding: 8px 31px;\n font-size: 14px;\n line-height: 18px;\n text-align: center;\n border-radius: 4px;\n background: none;\n margin: 0;\n height: 100%;\n box-sizing: border-box;\n width: 100%;\n color: #fff;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input::-moz-placeholder {\n color: #fff;\n opacity: 0.8;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input::placeholder {\n color: #fff;\n opacity: 0.8;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input::-ms-clear {\n display: none;\n}\n.dplayer-controller .dplayer-icons.dplayer-icons-left .dplayer-icon {\n padding: 7px;\n}\n.dplayer-controller .dplayer-icons.dplayer-icons-right {\n right: 20px;\n}\n.dplayer-controller .dplayer-icons.dplayer-icons-right .dplayer-icon {\n padding: 8px;\n}\n.dplayer-controller .dplayer-icons .dplayer-time,\n.dplayer-controller .dplayer-icons .dplayer-live-badge {\n line-height: 38px;\n color: #eee;\n text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);\n vertical-align: middle;\n font-size: 13px;\n cursor: default;\n}\n.dplayer-controller .dplayer-icons .dplayer-live-dot {\n display: inline-block;\n width: 6px;\n height: 6px;\n vertical-align: 4%;\n margin-right: 5px;\n content: '';\n border-radius: 6px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon {\n width: 40px;\n height: 100%;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n vertical-align: middle;\n box-sizing: border-box;\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon .dplayer-icon-content {\n transition: all 0.2s ease-in-out;\n opacity: 0.8;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon:hover .dplayer-icon-content {\n opacity: 1;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-quality-icon {\n color: #fff;\n width: auto;\n line-height: 22px;\n font-size: 14px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-comment-icon {\n padding: 10px 9px 9px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-setting-icon {\n padding-top: 8.5px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-volume-icon {\n width: 43px;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume {\n position: relative;\n display: inline-block;\n cursor: pointer;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume:hover .dplayer-volume-bar-wrap .dplayer-volume-bar {\n width: 45px;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume:hover .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-volume.dplayer-volume-active .dplayer-volume-bar-wrap .dplayer-volume-bar {\n width: 45px;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume.dplayer-volume-active .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap {\n display: inline-block;\n margin: 0 10px 0 -5px;\n vertical-align: middle;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar {\n position: relative;\n top: 17px;\n width: 0;\n height: 3px;\n background: #aaa;\n transition: all 0.3s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 100%;\n transition: all 0.1s ease;\n will-change: width;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n transform: scale(0);\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitle-btn {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-box {\n position: absolute;\n right: 0;\n bottom: 50px;\n transform: scale(0);\n width: -moz-fit-content;\n width: fit-content;\n max-width: 240px;\n min-width: 120px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 7px 0;\n transition: all 0.3s ease-in-out;\n overflow: auto;\n z-index: 2;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-box.dplayer-subtitles-panel {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-box.dplayer-subtitles-box-open {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-item {\n height: 30px;\n padding: 5px 10px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-controller .dplayer-icons .dplayer-setting {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box {\n position: absolute;\n right: 0;\n bottom: 50px;\n transform: scale(0);\n width: 150px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 7px 0;\n transition: all 0.3s ease-in-out;\n overflow: hidden;\n z-index: 2;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box > div {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box > div.dplayer-setting-origin-panel {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-open {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-narrow {\n width: 70px;\n text-align: center;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-speed .dplayer-setting-origin-panel {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-speed .dplayer-setting-speed-panel {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item,\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-speed-item {\n height: 30px;\n padding: 5px 10px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item:hover,\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-speed-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku {\n padding: 5px 0;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-label {\n padding: 0 10px;\n display: inline;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku:hover .dplayer-label {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku:hover .dplayer-danmaku-bar-wrap {\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku.dplayer-setting-danmaku-active .dplayer-label {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku.dplayer-setting-danmaku-active .dplayer-danmaku-bar-wrap {\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap {\n padding: 0 10px;\n box-sizing: border-box;\n display: none;\n vertical-align: middle;\n height: 100%;\n width: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar {\n position: relative;\n top: 8.5px;\n width: 100%;\n height: 3px;\n background: #fff;\n transition: all 0.3s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar .dplayer-danmaku-bar-inner {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 100%;\n transition: all 0.1s ease;\n background: #aaa;\n will-change: width;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar .dplayer-danmaku-bar-inner .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n background: #aaa;\n}\n.dplayer-controller .dplayer-icons .dplayer-full {\n display: inline-block;\n height: 100%;\n position: relative;\n}\n.dplayer-controller .dplayer-icons .dplayer-full:hover .dplayer-full-in-icon {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-full .dplayer-full-in-icon {\n position: absolute;\n top: -30px;\n z-index: 1;\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality {\n position: relative;\n display: inline-block;\n height: 100%;\n z-index: 2;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality:hover .dplayer-quality-list {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality:hover .dplayer-quality-mask {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-mask {\n display: none;\n position: absolute;\n bottom: 38px;\n left: -18px;\n width: 80px;\n padding-bottom: 12px;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-list {\n display: none;\n font-size: 12px;\n width: 80px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 5px 0;\n transition: all 0.3s ease-in-out;\n overflow: hidden;\n color: #fff;\n text-align: center;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-item {\n height: 25px;\n box-sizing: border-box;\n cursor: pointer;\n line-height: 25px;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-controller .dplayer-icons .dplayer-comment {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-label {\n color: #eee;\n font-size: 13px;\n display: inline-block;\n vertical-align: middle;\n white-space: nowrap;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle {\n width: 32px;\n height: 20px;\n text-align: center;\n font-size: 0;\n vertical-align: middle;\n position: absolute;\n top: 5px;\n right: 10px;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input {\n max-height: 0;\n max-width: 0;\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input + label {\n display: inline-block;\n position: relative;\n box-shadow: #dfdfdf 0 0 0 0 inset;\n border: 1px solid #dfdfdf;\n height: 20px;\n width: 32px;\n border-radius: 10px;\n box-sizing: border-box;\n cursor: pointer;\n transition: 0.2s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input + label:before {\n content: \"\";\n position: absolute;\n display: block;\n height: 18px;\n width: 18px;\n top: 0;\n left: 0;\n border-radius: 15px;\n transition: 0.2s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input + label:after {\n content: \"\";\n position: absolute;\n display: block;\n left: 0;\n top: 0;\n border-radius: 15px;\n background: #fff;\n transition: 0.2s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n height: 18px;\n width: 18px;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input:checked + label {\n border-color: rgba(255, 255, 255, 0.5);\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input:checked + label:before {\n width: 30px;\n background: rgba(255, 255, 255, 0.5);\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input:checked + label:after {\n left: 12px;\n}\n.dplayer-mobile-play {\n display: none;\n width: 50px;\n height: 50px;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n box-sizing: border-box;\n bottom: 0;\n opacity: 0.8;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.dplayer-danmaku {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n font-size: 22px;\n color: #fff;\n}\n.dplayer-danmaku .dplayer-danmaku-item {\n display: inline-block;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n cursor: default;\n white-space: nowrap;\n text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.5);\n}\n.dplayer-danmaku .dplayer-danmaku-item--demo {\n position: absolute;\n visibility: hidden;\n}\n.dplayer-danmaku .dplayer-danmaku-right {\n position: absolute;\n right: 0;\n transform: translateX(100%);\n}\n.dplayer-danmaku .dplayer-danmaku-right.dplayer-danmaku-move {\n will-change: transform;\n animation-name: 'danmaku';\n animation-timing-function: linear;\n animation-play-state: paused;\n}\n@keyframes danmaku {\n from {\n transform: translateX(100%);\n }\n}\n.dplayer-danmaku .dplayer-danmaku-top,\n.dplayer-danmaku .dplayer-danmaku-bottom {\n position: absolute;\n width: 100%;\n text-align: center;\n visibility: hidden;\n}\n.dplayer-danmaku .dplayer-danmaku-top.dplayer-danmaku-move,\n.dplayer-danmaku .dplayer-danmaku-bottom.dplayer-danmaku-move {\n will-change: visibility;\n animation-name: 'danmaku-center';\n animation-timing-function: linear;\n animation-play-state: paused;\n}\n@keyframes danmaku-center {\n from {\n visibility: visible;\n }\n to {\n visibility: visible;\n }\n}\n.dplayer-logo {\n pointer-events: none;\n position: absolute;\n left: 20px;\n top: 20px;\n max-width: 50px;\n max-height: 50px;\n}\n.dplayer-logo img {\n max-width: 100%;\n max-height: 100%;\n background: none;\n}\n.dplayer-menu {\n position: absolute;\n width: 170px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.85);\n padding: 5px 0;\n overflow: hidden;\n z-index: 3;\n display: none;\n}\n.dplayer-menu.dplayer-menu-show {\n display: block;\n}\n.dplayer-menu .dplayer-menu-item {\n height: 30px;\n box-sizing: border-box;\n cursor: pointer;\n}\n.dplayer-menu .dplayer-menu-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-menu .dplayer-menu-item a {\n padding: 0 10px;\n line-height: 30px;\n color: #eee;\n font-size: 13px;\n display: inline-block;\n vertical-align: middle;\n width: 100%;\n box-sizing: border-box;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.dplayer-menu .dplayer-menu-item a:hover {\n text-decoration: none;\n}\n.dplayer-notice-list {\n position: absolute;\n bottom: 60px;\n left: 20px;\n}\n.dplayer-notice-list .dplayer-notice {\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n transition: all 0.3s ease-in-out;\n overflow: hidden;\n color: #fff;\n display: table;\n pointer-events: none;\n animation: showNotice 0.3s ease 1 forwards;\n}\n.dplayer-notice-list .remove-notice {\n animation: removeNotice 0.3s ease 1 forwards;\n}\n@keyframes showNotice {\n from {\n padding: 0;\n font-size: 0;\n margin-top: 0;\n }\n to {\n padding: 7px 20px;\n font-size: 14px;\n margin-top: 5px;\n }\n}\n@keyframes removeNotice {\n 0% {\n padding: 7px 20px;\n font-size: 14px;\n margin-top: 5px;\n }\n 20% {\n font-size: 12px;\n }\n 21% {\n font-size: 0;\n padding: 7px 10px;\n }\n 100% {\n padding: 0;\n margin-top: 0;\n font-size: 0;\n }\n}\n.dplayer-subtitle {\n position: absolute;\n bottom: 40px;\n width: 90%;\n left: 5%;\n text-align: center;\n color: #fff;\n text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.5);\n font-size: 20px;\n}\n.dplayer-subtitle.dplayer-subtitle-hide {\n display: none;\n}\n.dplayer-mask {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n display: none;\n}\n.dplayer-mask.dplayer-mask-show {\n display: block;\n}\n.dplayer-video-wrap {\n position: relative;\n background: #000;\n font-size: 0;\n width: 100%;\n height: 100%;\n}\n.dplayer-video-wrap .dplayer-video {\n width: 100%;\n height: 100%;\n display: none;\n}\n.dplayer-video-wrap .dplayer-video-current {\n display: block;\n}\n.dplayer-video-wrap .dplayer-video-prepare {\n display: none;\n}\n.dplayer-info-panel {\n position: absolute;\n top: 10px;\n left: 10px;\n width: 400px;\n background: rgba(28, 28, 28, 0.8);\n padding: 10px;\n color: #fff;\n font-size: 12px;\n border-radius: 2px;\n}\n.dplayer-info-panel-hide {\n display: none;\n}\n.dplayer-info-panel .dplayer-info-panel-close {\n cursor: pointer;\n position: absolute;\n right: 10px;\n top: 10px;\n}\n.dplayer-info-panel .dplayer-info-panel-item > span {\n display: inline-block;\n vertical-align: middle;\n line-height: 15px;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.dplayer-info-panel .dplayer-info-panel-item-title {\n width: 100px;\n text-align: right;\n margin-right: 10px;\n}\n.dplayer-info-panel .dplayer-info-panel-item-data {\n width: 260px;\n}\n", "", { version: 3, sources: [ "webpack://./src/css/global.less", "webpack://./src/css/index.less", "webpack://./src/css/player.less", "webpack://./src/css/balloon.less", "webpack://./src/css/bezel.less", "webpack://./src/css/notice.less", "webpack://./src/css/controller.less", "webpack://./src/css/danmaku.less", "webpack://./src/css/logo.less", "webpack://./src/css/menu.less", "webpack://./src/css/subtitle.less", "webpack://./src/css/video.less", "webpack://./src/css/info-panel.less" ], names: [], mappings: "AAAA;EACI;IACI,6CAAA;ECEN;EDAE;IACI,+CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,+CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,+CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,+CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,+CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,6CAAA;ECEN;EDAE;IACI,8CAAA;ECEN;EDAE;IACI,+CAAA;ECEN;EDAE;;IAEI,uCAAA;ECEN;AACF;ACzJA;EACI,kBAAA;EACA,gBAAA;EACA,yBAAA;KAAA,sBAAA;UAAA,iBAAA;EACA,cAAA;AD2JJ;AC/JA;EAOQ,uBAAA;AD2JR;AClKA;EAWQ,WAAA;EACA,YAAA;AD0JR;ACtKA;;EAgBY,UAAA;AD0JZ;ACtJI;EACI,WAAA;EACA,YAAA;EACA,gBAAA;EACA,eAAA;EACA,eAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;EACA,UAAA;EACA,0BAAA;ADwJR;ACpJI;;;EAKY,aAAA;ADoJhB;ACzJI;EAUQ,aAAA;ADkJZ;AC5JI;EAcQ,aAAA;ADiJZ;AC7II;EAEQ,aAAA;AD8IZ;AChJI;EAKQ,aAAA;AD8IZ;ACnJI;EAQQ,aAAA;AD8IZ;ACtJI;EAWQ,aAAA;AD8IZ;AC3IQ;EAEQ,aAAA;AD4IhB;ACvII;EAEQ,eAAA;ADwIZ;AC1II;EAKQ,cAAA;ADwIZ;ACpII;EAEQ,6BAAA;ADqIZ;AClIQ;EAAA;IAEQ,UAAA;EDoId;ECtIM;IAKQ,UAAA;EDoId;ECjIU;IAEQ,UAAA;EDkIlB;ECpIU;IAKQ,UAAA;EDkIlB;AACF;AC7HI;EAEQ,cAAA;AD8HZ;AC1HI;;;;EAIQ,4BAAA;AD4HZ;ACxHI;EACI,YAAA;AD0HR;AC3HI;EAIQ,UAAA;EACA,2BAAA;AD0HZ;AC/HI;EAQQ,UAAA;EACA,2BAAA;AD0HZ;ACvHI;EAEQ,UAAA;ADwHZ;AC1HI;EAKQ,UAAA;ADwHZ;ACrHI;EAKI,sBAAA;EACA,uBAAA;ADuHR;AC7HI;EACI,eAAA;EACA,eAAA;EACA,OAAA;EACA,MAAA;ADyHR;ACrHI;;;;;EAOY,aAAA;ADqHhB;AC5HI;EAUY,gBAAA;EACA,qBAAA;ADqHhB;AChII;EAgBQ,aAAA;ADmHZ;AChHQ;EAEQ,aAAA;ADiHhB;ACtII;EA0BQ,cAAA;AD+GZ;ACzGA;EACI,eAAA;EACA,MAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;AD2GJ;AElSA;EACI,aAAA;AFoSJ;AEjSA;EACI,oBAAA;EACA,iCAAA;AFmSJ;AEhSA;EACI,gBAAA;AFkSJ;AG9SA;EACI,kBAAA;EACA,OAAA;EACA,QAAA;EACA,MAAA;EACA,SAAA;EACA,eAAA;EACA,WAAA;EACA,oBAAA;AHgTJ;AGxTA;EAUQ,kBAAA;EACA,QAAA;EACA,SAAA;EACA,uBAAA;EACA,YAAA;EACA,WAAA;EACA,aAAA;EACA,sBAAA;EACA,8BAAA;EACA,kBAAA;EACA,UAAA;EACA,oBAAA;AHiTR;AGhTQ;EACI,iCAAA;AHkTZ;AGhTQ;EACI;IACI,UAAA;IACA,mBAAA;EHkTd;EGhTU;IACI,UAAA;IACA,mBAAA;EHkTd;AACF;AGnVA;EAqCQ,kBAAA;EACA,QAAA;EACA,gBAAA;EACA,WAAA;EACA,kBAAA;EACA,eAAA;EACA,iBAAA;EACA,0CAAA;AHiTR;AG7VA;EA+CQ,aAAA;EACA,kBAAA;EACA,QAAA;EACA,SAAA;EACA,uBAAA;EACA,YAAA;EACA,WAAA;EACA,oBAAA;AHiTR;AGvWA;EAwDY,aAAA;AHkTZ;AG1WA;EA2DY,uDAAA;EACA,UAAA;EACA,yBAAA;AHkTZ;AI/WC;EDgEmB,qBAAA;AHkTpB;AIlXC;EDgEmB,qBAAA;AHqTpB;AIrXC;EDgEmB,qBAAA;AHwTpB;AIxXC;EDgEmB,qBAAA;AH2TpB;AI3XC;EDgEmB,qBAAA;AH8TpB;AI9XC;EDgEmB,qBAAA;AHiUpB;AIjYC;EDgEmB,qBAAA;AHoUpB;AGhUQ;EACI;IACI,YAAA;IACA,0BAAA;EHkUd;EGhUU;IACI,aAAA;IACA,0BAAA;EHkUd;EGhUU;IACI,aAAA;IACA,4BAAA;EHkUd;AACF;AKlZA;EACI,mEAAA;EACA,YAAA;EACA,WAAA;EACA,kBAAA;EACA,SAAA;EACA,yBAAA;ALoZJ;AKjZA;EACI,kBAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EACA,YAAA;EACA,eAAA;EACA,yBAAA;KAAA,sBAAA;UAAA,iBAAA;EACA,yBAAA;ALmZJ;AKlZI;EAEQ,aAAA;ALmZZ;AKrZI;EAKQ,cAAA;ALmZZ;AKjaA;EAkBQ,cAAA;EACA,eAAA;EACA,kBAAA;EACA,YAAA;EACA,wBAAA;EACA,WAAA;ALkZR;AKjZQ;EAEQ,mBAAA;ALkZhB;AKpZQ;EAKQ,cAAA;EACA,UAAA;EACA,2BAAA;EACA,QAAA;EACA,WAAA;ALkZhB;AKnbA;EAqCY,WAAA;EACA,kBAAA;EACA,QAAA;EACA,UAAA;EACA,WAAA;EACA,kBAAA;EACA,sBAAA;EACA,kBAAA;EACA,2BAAA;EACA,gCAAA;ALiZZ;AKhZY;EAEQ,cAAA;ALiZpB;AK/YgB;EACI,UAAA;ALiZpB;AK/YgB;EACI,UAAA;ALiZpB;AKxcA;EA2DgB,aAAA;EACA,kBAAA;EACA,SAAA;EACA,UAAA;EACA,gBAAA;EACA,qCAAA;EACA,WAAA;EACA,kBAAA;EACA,eAAA;EACA,mBAAA;EACA,2BAAA;ALgZhB;AKrdA;EAyEY,kBAAA;EACA,gBAAA;EACA,oBAAA;EACA,aAAA;EACA,6BAAA;AL+YZ;AK5dA;EAgFY,kBAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,oBAAA;AL+YZ;AKneA;EA0FY,kBAAA;EACA,SAAA;EACA,UAAA;EACA,kBAAA;EACA,gBAAA;EACA,qCAAA;EACA,WAAA;EACA,eAAA;EACA,kBAAA;EACA,UAAA;EACA,oCAAA;EACA,iBAAA;EACA,kBAAA;EACA,UAAA;EACA,oBAAA;AL4YZ;AK7ZY;EACI,UAAA;AL+ZhB;AKvfA;EA2GY,kBAAA;EACA,WAAA;EACA,WAAA;EACA,oCAAA;EACA,eAAA;AL+YZ;AK9fA;EAiHgB,kBAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;EACA,oCAAA;EACA,WAAA;EACA,yBAAA;EACA,kBAAA;ALgZhB;AKxgBA;EA2HgB,kBAAA;EACA,OAAA;EACA,MAAA;EACA,SAAA;EACA,WAAA;EACA,kBAAA;ALgZhB;AKhhBA;EAkIoB,kBAAA;EACA,MAAA;EACA,UAAA;EACA,gBAAA;EACA,mBAAA;EACA,YAAA;EACA,WAAA;EACA,kBAAA;EACA,eAAA;EACA,gCAAA;EACA,mBAAA;ALiZpB;AK7hBA;EAkJQ,YAAA;EACA,kBAAA;EACA,SAAA;AL8YR;AK7YQ;EACI,aAAA;EACA,kBAAA;EACA,gCAAA;EACA,UAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,WAAA;EACA,WAAA;AL+YZ;AKxZQ;EAWQ,YAAA;ALgZhB;AK3ZQ;EAcQ,kBAAA;EACA,OAAA;EACA,MAAA;ALgZhB;AKhaQ;EAmBQ,kBAAA;EACA,QAAA;EACA,MAAA;ALgZhB;AKraQ;EAwBQ,kBAAA;EACA,iCAAA;EACA,YAAA;EACA,OAAA;EACA,uCAAA;EACA,kBAAA;EACA,uBAAA;EACA,eAAA;EACA,YAAA;EACA,gCAAA;EACA,mBAAA;ALgZhB;AK/YgB;EACI,mBAAA;ALiZpB;AKrbQ;EAuCY,aAAA;ALiZpB;AKxbQ;EA0CY,eAAA;ALiZpB;AK3bQ;EA6CY,eAAA;EACA,WAAA;EACA,iBAAA;ALiZpB;AKhcQ;EAkDY,YAAA;ALiZpB;AKncQ;EAoDgB,kBAAA;ALkZxB;AK/YwB;EAEQ,0BAAA;ALgZhC;AK7YwB;EAEQ,0BAAA;AL8YhC;AK5cQ;EAmEgB,UAAA;EACA,gBAAA;EACA,iBAAA;EACA,qBAAA;EACA,eAAA;EACA,WAAA;EACA,sBAAA;EACA,kBAAA;EACA,sBAAA;EACA,kBAAA;EACA,eAAA;AL4YxB;AKzdQ;EAgFgB,mBAAA;EACA,cAAA;AL4YxB;AK7dQ;EAqFY,YAAA;AL2YpB;AKheQ;EAuFgB,YAAA;EACA,YAAA;EACA,qBAAA;AL4YxB;AKreQ;EA4FgB,WAAA;EACA,YAAA;EACA,qBAAA;EACA,kBAAA;EACA,sBAAA;EACA,eAAA;AL4YxB;AK3YwB;EACI,0CAAA;AL6Y5B;AKhfQ;EAyGQ,aAAA;EACA,YAAA;EACA,iBAAA;EACA,eAAA;EACA,iBAAA;EACA,kBAAA;EACA,kBAAA;EACA,gBAAA;EACA,SAAA;EACA,YAAA;EACA,sBAAA;EACA,WAAA;EACA,WAAA;AL0YhB;AKzYgB;EACI,WAAA;EACA,YAAA;AL2YpB;AK7YgB;EACI,WAAA;EACA,YAAA;AL2YpB;AKzYgB;EACI,aAAA;AL2YpB;AKvYQ;EAEQ,YAAA;ALwYhB;AKrYQ;EACI,WAAA;ALuYZ;AKxYQ;EAGQ,YAAA;ALwYhB;AKpqBA;;EAiSY,iBAAA;EACA,WAAA;EACA,uCAAA;EACA,sBAAA;EACA,eAAA;EACA,eAAA;ALuYZ;AK7qBA;EAySY,qBAAA;EACA,UAAA;EACA,WAAA;EACA,kBAAA;EACA,iBAAA;EACA,WAAA;EACA,kBAAA;ALuYZ;AKtrBA;EAkTY,WAAA;EACA,YAAA;EACA,YAAA;EACA,6BAAA;EACA,aAAA;EACA,eAAA;EACA,sBAAA;EACA,sBAAA;EACA,qBAAA;ALuYZ;AKjsBA;EA4TgB,gCAAA;EACA,YAAA;ALwYhB;AKtYY;EAEQ,UAAA;ALuYpB;AKpYY;EACI,WAAA;EACA,WAAA;EACA,iBAAA;EACA,eAAA;ALsYhB;AKpYY;EACI,qBAAA;ALsYhB;AKpYY;EACI,kBAAA;ALsYhB;AKpYY;EACI,WAAA;ALsYhB;AKvtBA;EAqVY,kBAAA;EACA,qBAAA;EACA,eAAA;EACA,YAAA;ALqYZ;AKpYY;EAEQ,WAAA;ALqYpB;AKvYY;EAKQ,mBAAA;ALqYpB;AKlYY;EAEQ,WAAA;ALmYpB;AKrYY;EAKQ,mBAAA;ALmYpB;AKzuBA;EA0WgB,qBAAA;EACA,qBAAA;EACA,sBAAA;EACA,YAAA;ALkYhB;AK/uBA;EA+WoB,kBAAA;EACA,SAAA;EACA,QAAA;EACA,WAAA;EACA,gBAAA;EACA,gCAAA;ALmYpB;AKvvBA;EAsXwB,kBAAA;EACA,SAAA;EACA,OAAA;EACA,YAAA;EACA,yBAAA;EACA,kBAAA;ALoYxB;AK/vBA;EA6X4B,kBAAA;EACA,MAAA;EACA,UAAA;EACA,gBAAA;EACA,mBAAA;EACA,YAAA;EACA,WAAA;EACA,kBAAA;EACA,eAAA;EACA,gCAAA;EACA,mBAAA;ALqY5B;AK5wBA;EA8YY,qBAAA;EACA,YAAA;ALiYZ;AKhxBA;EAkZY,qBAAA;EACA,YAAA;ALiYZ;AKpxBA;EAqZgB,kBAAA;EACA,QAAA;EACA,YAAA;EACA,mBAAA;EACA,uBAAA;EAAA,kBAAA;EACA,gBAAA;EACA,gBAAA;EACA,kBAAA;EACA,iCAAA;EACA,cAAA;EACA,gCAAA;EACA,cAAA;EACA,UAAA;ALkYhB;AKjYgB;EACI,cAAA;ALmYpB;AKjYgB;EACI,mBAAA;ALmYpB;AKzyBA;EA0agB,YAAA;EACA,iBAAA;EACA,sBAAA;EACA,eAAA;EACA,kBAAA;ALkYhB;AKjYgB;EACI,0CAAA;ALmYpB;AKnzBA;EAqbY,qBAAA;EACA,YAAA;ALiYZ;AKvzBA;EAwbgB,kBAAA;EACA,QAAA;EACA,YAAA;EACA,mBAAA;EACA,YAAA;EACA,kBAAA;EACA,iCAAA;EACA,cAAA;EACA,gCAAA;EACA,gBAAA;EACA,UAAA;ALkYhB;AKjYgB;EACI,aAAA;ALmYpB;AKlYoB;EACI,cAAA;ALoYxB;AKjYgB;EACI,mBAAA;ALmYpB;AKjYgB;EACI,WAAA;EACA,kBAAA;ALmYpB;AKjYgB;EAEQ,aAAA;ALkYxB;AKpYgB;EAKQ,cAAA;ALkYxB;AKv1BA;;EA2dgB,YAAA;EACA,iBAAA;EACA,sBAAA;EACA,eAAA;EACA,kBAAA;ALgYhB;AK/XgB;;EACI,0CAAA;ALkYpB;AKn2BA;EAqegB,cAAA;ALiYhB;AKt2BA;EAueoB,eAAA;EACA,eAAA;ALkYpB;AKhYgB;EAEQ,aAAA;ALiYxB;AKnYgB;EAKQ,qBAAA;ALiYxB;AK9XgB;EAEQ,aAAA;AL+XxB;AKjYgB;EAKQ,qBAAA;AL+XxB;AKt3BA;EA2foB,eAAA;EACA,sBAAA;EACA,aAAA;EACA,sBAAA;EACA,YAAA;EACA,WAAA;AL8XpB;AK93BA;EAkgBwB,kBAAA;EACA,UAAA;EACA,WAAA;EACA,WAAA;EACA,gBAAA;EACA,gCAAA;AL+XxB;AKt4BA;EAygB4B,kBAAA;EACA,SAAA;EACA,OAAA;EACA,YAAA;EACA,yBAAA;EACA,gBAAA;EACA,kBAAA;ALgY5B;AK/4BA;EAihBgC,kBAAA;EACA,MAAA;EACA,UAAA;EACA,gBAAA;EACA,mBAAA;EACA,YAAA;EACA,WAAA;EACA,kBAAA;EACA,eAAA;EACA,gCAAA;EACA,gBAAA;ALiYhC;AK55BA;EAmiBY,qBAAA;EACA,YAAA;EACA,kBAAA;AL4XZ;AK3XY;EAEQ,cAAA;AL4XpB;AKp6BA;EA4iBgB,kBAAA;EACA,UAAA;EACA,UAAA;EACA,aAAA;AL2XhB;AK16BA;EAmjBY,kBAAA;EACA,qBAAA;EACA,YAAA;EACA,UAAA;AL0XZ;AKzXY;EAEQ,cAAA;AL0XpB;AK5XY;EAKQ,cAAA;AL0XpB;AKt7BA;EAgkBgB,aAAA;EACA,kBAAA;EACA,YAAA;EACA,WAAA;EACA,WAAA;EACA,oBAAA;ALyXhB;AK97BA;EAwkBgB,aAAA;EACA,eAAA;EACA,WAAA;EACA,kBAAA;EACA,iCAAA;EACA,cAAA;EACA,gCAAA;EACA,gBAAA;EACA,WAAA;EACA,kBAAA;ALyXhB;AK18BA;EAolBgB,YAAA;EACA,sBAAA;EACA,eAAA;EACA,iBAAA;ALyXhB;AKxXgB;EACI,0CAAA;AL0XpB;AKn9BA;EA8lBY,qBAAA;EACA,YAAA;ALwXZ;AKv9BA;EAkmBY,WAAA;EACA,eAAA;EACA,qBAAA;EACA,sBAAA;EACA,mBAAA;ALwXZ;AK99BA;EAymBY,WAAA;EACA,YAAA;EACA,kBAAA;EACA,YAAA;EACA,sBAAA;EACA,kBAAA;EACA,QAAA;EACA,WAAA;ALwXZ;AKx+BA;EAknBgB,aAAA;EACA,YAAA;EACA,aAAA;ALyXhB;AK7+BA;EAunBgB,qBAAA;EACA,kBAAA;EACA,iCAAA;EACA,yBAAA;EACA,YAAA;EACA,WAAA;EACA,mBAAA;EACA,sBAAA;EACA,eAAA;EACA,4BAAA;ALyXhB;AKz/BA;EAmoBgB,WAAA;EACA,kBAAA;EACA,cAAA;EACA,YAAA;EACA,WAAA;EACA,MAAA;EACA,OAAA;EACA,mBAAA;EACA,4BAAA;ALyXhB;AKpgCA;EA8oBgB,WAAA;EACA,kBAAA;EACA,cAAA;EACA,OAAA;EACA,MAAA;EACA,mBAAA;EACA,gBAAA;EACA,4BAAA;EACA,wCAAA;EACA,YAAA;EACA,WAAA;ALyXhB;AKjhCA;EA2pBgB,sCAAA;ALyXhB;AKphCA;EA8pBgB,WAAA;EACA,oCAAA;ALyXhB;AKxhCA;EAkqBgB,UAAA;ALyXhB;AKnXA;EACI,aAAA;EACA,WAAA;EACA,YAAA;EACA,YAAA;EACA,6BAAA;EACA,aAAA;EACA,eAAA;EACA,sBAAA;EAEA,SAAA;EACA,YAAA;EACA,kBAAA;EACA,SAAA;EACA,QAAA;EACA,gCAAA;ALoXJ;AMpjCA;EACI,kBAAA;EACA,OAAA;EACA,QAAA;EACA,MAAA;EACA,SAAA;EACA,eAAA;EACA,WAAA;ANsjCJ;AM7jCA;EASQ,qBAAA;EACA,oBAAA;EACA,yBAAA;KAAA,sBAAA;UAAA,iBAAA;EACA,eAAA;EACA,mBAAA;EACA,iDAAA;ANujCR;AMtjCQ;EACI,kBAAA;EACA,kBAAA;ANwjCZ;AMzkCA;EAqBQ,kBAAA;EACA,QAAA;EACA,2BAAA;ANujCR;AMtjCQ;EACI,sBAAA;EACA,yBAAA;EACA,iCAAA;EACA,4BAAA;ANwjCZ;AMrjCI;EACI;IACI,2BAAA;ENujCV;AACF;AMzlCA;;EAsCQ,kBAAA;EACA,WAAA;EACA,kBAAA;EACA,kBAAA;ANujCR;AMtjCQ;;EACI,uBAAA;EACA,gCAAA;EACA,iCAAA;EACA,4BAAA;ANyjCZ;AMtjCI;EACI;IACI,mBAAA;ENwjCV;EMtjCM;IACI,mBAAA;ENwjCV;AACF;AO/mCA;EACI,oBAAA;EACA,kBAAA;EACA,UAAA;EACA,SAAA;EACA,eAAA;EACA,gBAAA;APinCJ;AOvnCA;EAQQ,eAAA;EACA,gBAAA;EACA,gBAAA;APknCR;AQ5nCA;EACI,kBAAA;EACA,YAAA;EACA,kBAAA;EACA,kCAAA;EACA,cAAA;EACA,gBAAA;EACA,UAAA;EACA,aAAA;AR8nCJ;AQ7nCI;EACI,cAAA;AR+nCR;AQzoCA;EAaQ,YAAA;EACA,sBAAA;EACA,eAAA;AR+nCR;AQ9nCQ;EACI,0CAAA;ARgoCZ;AQjpCA;EAqBY,eAAA;EACA,iBAAA;EACA,WAAA;EACA,eAAA;EACA,qBAAA;EACA,sBAAA;EACA,WAAA;EACA,sBAAA;EACA,mBAAA;EACA,uBAAA;EACA,gBAAA;AR+nCZ;AQ9nCY;EACI,qBAAA;ARgoChB;AIjqCA;EACI,kBAAA;EACA,YAAA;EACA,UAAA;AJmqCJ;AItqCA;EAMQ,kBAAA;EACA,iCAAA;EACA,gCAAA;EACA,gBAAA;EACA,WAAA;EACA,cAAA;EACA,oBAAA;EACA,0CAAA;AJmqCR;AIhrCA;EAiBQ,4CAAA;AJkqCR;AI9pCA;EACI;IACI,UAAA;IACA,YAAA;IACA,aAAA;EJgqCN;EI9pCE;IACI,iBAAA;IACA,eAAA;IACA,eAAA;EJgqCN;AACF;AI7pCA;EACI;IACI,iBAAA;IACA,eAAA;IACA,eAAA;EJ+pCN;EI7pCE;IACI,eAAA;EJ+pCN;EI7pCE;IACI,YAAA;IACA,iBAAA;EJ+pCN;EI7pCE;IACI,UAAA;IACA,aAAA;IACA,YAAA;EJ+pCN;AACF;ASltCA;EACI,kBAAA;EACA,YAAA;EACA,UAAA;EACA,QAAA;EACA,kBAAA;EACA,WAAA;EACA,iDAAA;EACA,eAAA;ATotCJ;ASntCI;EACI,aAAA;ATqtCR;AU/tCA;EACI,kBAAA;EACA,MAAA;EACA,SAAA;EACA,OAAA;EACA,QAAA;EACA,UAAA;EACA,aAAA;AViuCJ;AUhuCI;EACI,cAAA;AVkuCR;AU9tCA;EACI,kBAAA;EACA,gBAAA;EACA,YAAA;EACA,WAAA;EACA,YAAA;AVguCJ;AUruCA;EAOQ,WAAA;EACA,YAAA;EACA,aAAA;AViuCR;AU1uCA;EAYQ,cAAA;AViuCR;AU7uCA;EAeQ,aAAA;AViuCR;AW7vCA;EACI,kBAAA;EACA,SAAA;EACA,UAAA;EACA,YAAA;EACA,iCAAA;EACA,aAAA;EACA,WAAA;EACA,eAAA;EACA,kBAAA;AX+vCJ;AW7vCI;EACI,aAAA;AX+vCR;AW3wCA;EAgBQ,eAAA;EACA,kBAAA;EACA,WAAA;EACA,SAAA;AX8vCR;AW1vCQ;EACI,qBAAA;EACA,sBAAA;EACA,iBAAA;EACA,mBAAA;EACA,uBAAA;EACA,gBAAA;AX4vCZ;AWzxCA;EAkCQ,YAAA;EACA,iBAAA;EACA,kBAAA;AX0vCR;AW9xCA;EAwCQ,YAAA;AXyvCR", sourcesContent: [ "@keyframes my-face {\n 2% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 4% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 6% {\n transform: translate(0, 1.5px) rotate(-1.5deg);\n }\n 8% {\n transform: translate(0, -1.5px) rotate(-1.5deg);\n }\n 10% {\n transform: translate(0, 2.5px) rotate(1.5deg);\n }\n 12% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 14% {\n transform: translate(0, -1.5px) rotate(1.5deg);\n }\n 16% {\n transform: translate(0, -0.5px) rotate(-1.5deg);\n }\n 18% {\n transform: translate(0, 0.5px) rotate(-1.5deg);\n }\n 20% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 22% {\n transform: translate(0, 0.5px) rotate(-1.5deg);\n }\n 24% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 26% {\n transform: translate(0, 0.5px) rotate(0.5deg);\n }\n 28% {\n transform: translate(0, 0.5px) rotate(1.5deg);\n }\n 30% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 32% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 34% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 36% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 38% {\n transform: translate(0, 1.5px) rotate(-1.5deg);\n }\n 40% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 42% {\n transform: translate(0, 2.5px) rotate(-1.5deg);\n }\n 44% {\n transform: translate(0, 1.5px) rotate(0.5deg);\n }\n 46% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 48% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 50% {\n transform: translate(0, 0.5px) rotate(0.5deg);\n }\n 52% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 54% {\n transform: translate(0, -1.5px) rotate(1.5deg);\n }\n 56% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 58% {\n transform: translate(0, 0.5px) rotate(2.5deg);\n }\n 60% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 62% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 64% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 66% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 68% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 70% {\n transform: translate(0, 1.5px) rotate(0.5deg);\n }\n 72% {\n transform: translate(0, 2.5px) rotate(1.5deg);\n }\n 74% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 76% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 78% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 80% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 82% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 84% {\n transform: translate(0, 1.5px) rotate(2.5deg);\n }\n 86% {\n transform: translate(0, -1.5px) rotate(-1.5deg);\n }\n 88% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 90% {\n transform: translate(0, 2.5px) rotate(-0.5deg);\n }\n 92% {\n transform: translate(0, 0.5px) rotate(-0.5deg);\n }\n 94% {\n transform: translate(0, 2.5px) rotate(0.5deg);\n }\n 96% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 98% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 0%,\n 100% {\n transform: translate(0, 0) rotate(0deg);\n }\n}", "@import '../../node_modules/balloon-css/balloon.css';\n@keyframes my-face {\n 2% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 4% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 6% {\n transform: translate(0, 1.5px) rotate(-1.5deg);\n }\n 8% {\n transform: translate(0, -1.5px) rotate(-1.5deg);\n }\n 10% {\n transform: translate(0, 2.5px) rotate(1.5deg);\n }\n 12% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 14% {\n transform: translate(0, -1.5px) rotate(1.5deg);\n }\n 16% {\n transform: translate(0, -0.5px) rotate(-1.5deg);\n }\n 18% {\n transform: translate(0, 0.5px) rotate(-1.5deg);\n }\n 20% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 22% {\n transform: translate(0, 0.5px) rotate(-1.5deg);\n }\n 24% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 26% {\n transform: translate(0, 0.5px) rotate(0.5deg);\n }\n 28% {\n transform: translate(0, 0.5px) rotate(1.5deg);\n }\n 30% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 32% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 34% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 36% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 38% {\n transform: translate(0, 1.5px) rotate(-1.5deg);\n }\n 40% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 42% {\n transform: translate(0, 2.5px) rotate(-1.5deg);\n }\n 44% {\n transform: translate(0, 1.5px) rotate(0.5deg);\n }\n 46% {\n transform: translate(0, -1.5px) rotate(2.5deg);\n }\n 48% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 50% {\n transform: translate(0, 0.5px) rotate(0.5deg);\n }\n 52% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 54% {\n transform: translate(0, -1.5px) rotate(1.5deg);\n }\n 56% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 58% {\n transform: translate(0, 0.5px) rotate(2.5deg);\n }\n 60% {\n transform: translate(0, 2.5px) rotate(2.5deg);\n }\n 62% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 64% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 66% {\n transform: translate(0, 1.5px) rotate(-0.5deg);\n }\n 68% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 70% {\n transform: translate(0, 1.5px) rotate(0.5deg);\n }\n 72% {\n transform: translate(0, 2.5px) rotate(1.5deg);\n }\n 74% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 76% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 78% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 80% {\n transform: translate(0, 1.5px) rotate(1.5deg);\n }\n 82% {\n transform: translate(0, -0.5px) rotate(0.5deg);\n }\n 84% {\n transform: translate(0, 1.5px) rotate(2.5deg);\n }\n 86% {\n transform: translate(0, -1.5px) rotate(-1.5deg);\n }\n 88% {\n transform: translate(0, -0.5px) rotate(2.5deg);\n }\n 90% {\n transform: translate(0, 2.5px) rotate(-0.5deg);\n }\n 92% {\n transform: translate(0, 0.5px) rotate(-0.5deg);\n }\n 94% {\n transform: translate(0, 2.5px) rotate(0.5deg);\n }\n 96% {\n transform: translate(0, -0.5px) rotate(1.5deg);\n }\n 98% {\n transform: translate(0, -1.5px) rotate(-0.5deg);\n }\n 0%,\n 100% {\n transform: translate(0, 0) rotate(0deg);\n }\n}\n.dplayer {\n position: relative;\n overflow: hidden;\n user-select: none;\n line-height: 1;\n}\n.dplayer * {\n box-sizing: content-box;\n}\n.dplayer svg {\n width: 100%;\n height: 100%;\n}\n.dplayer svg path,\n.dplayer svg circle {\n fill: #fff;\n}\n.dplayer:-webkit-full-screen {\n width: 100%;\n height: 100%;\n background: #000;\n position: fixed;\n z-index: 100000;\n left: 0;\n top: 0;\n margin: 0;\n padding: 0;\n transform: translate(0, 0);\n}\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box .dplayer-setting-showdan,\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box .dplayer-setting-danmaku,\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box .dplayer-setting-danunlimit {\n display: none;\n}\n.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-comment {\n display: none;\n}\n.dplayer.dplayer-no-danmaku .dplayer-danmaku {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-time {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-bar-wrap {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-setting-speed {\n display: none;\n}\n.dplayer.dplayer-live .dplayer-setting-loop {\n display: none;\n}\n.dplayer.dplayer-live.dplayer-no-danmaku .dplayer-setting {\n display: none;\n}\n.dplayer.dplayer-arrow .dplayer-danmaku {\n font-size: 18px;\n}\n.dplayer.dplayer-arrow .dplayer-icon {\n margin: 0 -3px;\n}\n.dplayer.dplayer-playing .dplayer-danmaku .dplayer-danmaku-move {\n animation-play-state: running;\n}\n@media (min-width: 900px) {\n .dplayer.dplayer-playing .dplayer-controller-mask {\n opacity: 0;\n }\n .dplayer.dplayer-playing .dplayer-controller {\n opacity: 0;\n }\n .dplayer.dplayer-playing:hover .dplayer-controller-mask {\n opacity: 1;\n }\n .dplayer.dplayer-playing:hover .dplayer-controller {\n opacity: 1;\n }\n}\n.dplayer.dplayer-loading .dplayer-bezel .diplayer-loading-icon {\n display: block;\n}\n.dplayer.dplayer-loading .dplayer-danmaku,\n.dplayer.dplayer-paused .dplayer-danmaku,\n.dplayer.dplayer-loading .dplayer-danmaku-move,\n.dplayer.dplayer-paused .dplayer-danmaku-move {\n animation-play-state: paused;\n}\n.dplayer.dplayer-hide-controller {\n cursor: none;\n}\n.dplayer.dplayer-hide-controller .dplayer-controller-mask {\n opacity: 0;\n transform: translateY(100%);\n}\n.dplayer.dplayer-hide-controller .dplayer-controller {\n opacity: 0;\n transform: translateY(100%);\n}\n.dplayer.dplayer-show-controller .dplayer-controller-mask {\n opacity: 1;\n}\n.dplayer.dplayer-show-controller .dplayer-controller {\n opacity: 1;\n}\n.dplayer.dplayer-fulled {\n position: fixed;\n z-index: 100000;\n left: 0;\n top: 0;\n width: 100% !important;\n height: 100% !important;\n}\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-volume,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-camera-icon,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-airplay-icon,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-chromecast-icon,\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-play-icon {\n display: none;\n}\n.dplayer.dplayer-mobile .dplayer-controller .dplayer-icons .dplayer-full .dplayer-full-in-icon {\n position: static;\n display: inline-block;\n}\n.dplayer.dplayer-mobile .dplayer-bar-time {\n display: none;\n}\n.dplayer.dplayer-mobile.dplayer-hide-controller .dplayer-mobile-play {\n display: none;\n}\n.dplayer.dplayer-mobile .dplayer-mobile-play {\n display: block;\n}\n.dplayer-web-fullscreen-fix {\n position: fixed;\n top: 0;\n left: 0;\n margin: 0;\n padding: 0;\n}\n[data-balloon]:before {\n display: none;\n}\n[data-balloon]:after {\n padding: 0.3em 0.7em;\n background: rgba(17, 17, 17, 0.7);\n}\n[data-balloon][data-balloon-pos=\"up\"]:after {\n margin-bottom: 0;\n}\n.dplayer-bezel {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n font-size: 22px;\n color: #fff;\n pointer-events: none;\n}\n.dplayer-bezel .dplayer-bezel-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -26px 0 0 -26px;\n height: 52px;\n width: 52px;\n padding: 12px;\n box-sizing: border-box;\n background: rgba(0, 0, 0, 0.5);\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n}\n.dplayer-bezel .dplayer-bezel-icon.dplayer-bezel-transition {\n animation: bezel-hide 0.5s linear;\n}\n@keyframes bezel-hide {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(2);\n }\n}\n.dplayer-bezel .dplayer-danloading {\n position: absolute;\n top: 50%;\n margin-top: -7px;\n width: 100%;\n text-align: center;\n font-size: 14px;\n line-height: 14px;\n animation: my-face 5s infinite ease-in-out;\n}\n.dplayer-bezel .diplayer-loading-icon {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -18px 0 0 -18px;\n height: 36px;\n width: 36px;\n pointer-events: none;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-hide {\n display: none;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot {\n animation: diplayer-loading-dot-fade 0.8s ease infinite;\n opacity: 0;\n transform-origin: 4px 4px;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-1 {\n animation-delay: 0.1s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-2 {\n animation-delay: 0.2s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-3 {\n animation-delay: 0.3s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-4 {\n animation-delay: 0.4s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-5 {\n animation-delay: 0.5s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-6 {\n animation-delay: 0.6s;\n}\n.dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-7 {\n animation-delay: 0.7s;\n}\n@keyframes diplayer-loading-dot-fade {\n 0% {\n opacity: 0.7;\n transform: scale(1.2, 1.2);\n }\n 50% {\n opacity: 0.25;\n transform: scale(0.9, 0.9);\n }\n to {\n opacity: 0.25;\n transform: scale(0.85, 0.85);\n }\n}\n.dplayer-controller-mask {\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==) repeat-x bottom;\n height: 98px;\n width: 100%;\n position: absolute;\n bottom: 0;\n transition: all 0.3s ease;\n}\n.dplayer-controller {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 41px;\n padding: 0 20px;\n user-select: none;\n transition: all 0.3s ease;\n}\n.dplayer-controller.dplayer-controller-comment .dplayer-icons {\n display: none;\n}\n.dplayer-controller.dplayer-controller-comment .dplayer-icons.dplayer-comment-box {\n display: block;\n}\n.dplayer-controller .dplayer-bar-wrap {\n padding: 5px 0;\n cursor: pointer;\n position: absolute;\n bottom: 33px;\n width: calc(100% - 40px);\n height: 3px;\n}\n.dplayer-controller .dplayer-bar-wrap:hover .dplayer-bar .dplayer-played .dplayer-thumb {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-bar-wrap:hover .dplayer-highlight {\n display: block;\n width: 8px;\n transform: translateX(-4px);\n top: 4px;\n height: 40%;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight {\n z-index: 12;\n position: absolute;\n top: 5px;\n width: 6px;\n height: 20%;\n border-radius: 6px;\n background-color: #fff;\n text-align: center;\n transform: translateX(-3px);\n transition: all 0.2s ease-in-out;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight:hover .dplayer-highlight-text {\n display: block;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight:hover ~ .dplayer-bar-preview {\n opacity: 0;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight:hover ~ .dplayer-bar-time {\n opacity: 0;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-highlight .dplayer-highlight-text {\n display: none;\n position: absolute;\n left: 50%;\n top: -24px;\n padding: 5px 8px;\n background-color: rgba(0, 0, 0, 0.62);\n color: #fff;\n border-radius: 4px;\n font-size: 12px;\n white-space: nowrap;\n transform: translateX(-50%);\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-preview {\n position: absolute;\n background: #fff;\n pointer-events: none;\n display: none;\n background-size: 16000px 100%;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-preview-canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 1;\n pointer-events: none;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-time {\n position: absolute;\n left: 0px;\n top: -20px;\n border-radius: 4px;\n padding: 5px 7px;\n background-color: rgba(0, 0, 0, 0.62);\n color: #fff;\n font-size: 12px;\n text-align: center;\n opacity: 1;\n transition: opacity 0.1s ease-in-out;\n word-wrap: normal;\n word-break: normal;\n z-index: 2;\n pointer-events: none;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar-time.hidden {\n opacity: 0;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar {\n position: relative;\n height: 3px;\n width: 100%;\n background: rgba(255, 255, 255, 0.2);\n cursor: pointer;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-loaded {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n background: rgba(255, 255, 255, 0.4);\n height: 3px;\n transition: all 0.5s ease;\n will-change: width;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-played {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n height: 3px;\n will-change: width;\n}\n.dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-played .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n transform: scale(0);\n}\n.dplayer-controller .dplayer-icons {\n height: 38px;\n position: absolute;\n bottom: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box {\n display: none;\n position: absolute;\n transition: all 0.3s ease-in-out;\n z-index: 2;\n height: 38px;\n bottom: 0;\n left: 20px;\n right: 20px;\n color: #fff;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-icon {\n padding: 7px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-icon {\n position: absolute;\n left: 0;\n top: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-send-icon {\n position: absolute;\n right: 0;\n top: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box {\n position: absolute;\n background: rgba(28, 28, 28, 0.9);\n bottom: 41px;\n left: 0;\n box-shadow: 0 0 25px rgba(0, 0, 0, 0.3);\n border-radius: 4px;\n padding: 10px 10px 16px;\n font-size: 14px;\n width: 204px;\n transition: all 0.3s ease-in-out;\n transform: scale(0);\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box.dplayer-comment-setting-open {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box input[type=radio] {\n display: none;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box label {\n cursor: pointer;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-title {\n font-size: 13px;\n color: #fff;\n line-height: 30px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type {\n font-size: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type .dplayer-comment-setting-title {\n margin-bottom: 6px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type label:nth-child(2) span {\n border-radius: 4px 0 0 4px;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type label:nth-child(4) span {\n border-radius: 0 4px 4px 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type span {\n width: 33%;\n padding: 4px 6px;\n line-height: 16px;\n display: inline-block;\n font-size: 12px;\n color: #fff;\n border: 1px solid #fff;\n margin-right: -1px;\n box-sizing: border-box;\n text-align: center;\n cursor: pointer;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type input:checked + span {\n background: #E4E4E6;\n color: #1c1c1c;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color {\n font-size: 0;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color label {\n font-size: 0;\n padding: 6px;\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color span {\n width: 22px;\n height: 22px;\n display: inline-block;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color span:hover {\n animation: my-face 5s infinite ease-in-out;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input {\n outline: none;\n border: none;\n padding: 8px 31px;\n font-size: 14px;\n line-height: 18px;\n text-align: center;\n border-radius: 4px;\n background: none;\n margin: 0;\n height: 100%;\n box-sizing: border-box;\n width: 100%;\n color: #fff;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input::placeholder {\n color: #fff;\n opacity: 0.8;\n}\n.dplayer-controller .dplayer-icons.dplayer-comment-box .dplayer-comment-input::-ms-clear {\n display: none;\n}\n.dplayer-controller .dplayer-icons.dplayer-icons-left .dplayer-icon {\n padding: 7px;\n}\n.dplayer-controller .dplayer-icons.dplayer-icons-right {\n right: 20px;\n}\n.dplayer-controller .dplayer-icons.dplayer-icons-right .dplayer-icon {\n padding: 8px;\n}\n.dplayer-controller .dplayer-icons .dplayer-time,\n.dplayer-controller .dplayer-icons .dplayer-live-badge {\n line-height: 38px;\n color: #eee;\n text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);\n vertical-align: middle;\n font-size: 13px;\n cursor: default;\n}\n.dplayer-controller .dplayer-icons .dplayer-live-dot {\n display: inline-block;\n width: 6px;\n height: 6px;\n vertical-align: 4%;\n margin-right: 5px;\n content: '';\n border-radius: 6px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon {\n width: 40px;\n height: 100%;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n vertical-align: middle;\n box-sizing: border-box;\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon .dplayer-icon-content {\n transition: all 0.2s ease-in-out;\n opacity: 0.8;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon:hover .dplayer-icon-content {\n opacity: 1;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-quality-icon {\n color: #fff;\n width: auto;\n line-height: 22px;\n font-size: 14px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-comment-icon {\n padding: 10px 9px 9px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-setting-icon {\n padding-top: 8.5px;\n}\n.dplayer-controller .dplayer-icons .dplayer-icon.dplayer-volume-icon {\n width: 43px;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume {\n position: relative;\n display: inline-block;\n cursor: pointer;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume:hover .dplayer-volume-bar-wrap .dplayer-volume-bar {\n width: 45px;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume:hover .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-volume.dplayer-volume-active .dplayer-volume-bar-wrap .dplayer-volume-bar {\n width: 45px;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume.dplayer-volume-active .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap {\n display: inline-block;\n margin: 0 10px 0 -5px;\n vertical-align: middle;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar {\n position: relative;\n top: 17px;\n width: 0;\n height: 3px;\n background: #aaa;\n transition: all 0.3s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 100%;\n transition: all 0.1s ease;\n will-change: width;\n}\n.dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n transform: scale(0);\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitle-btn {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-box {\n position: absolute;\n right: 0;\n bottom: 50px;\n transform: scale(0);\n width: fit-content;\n max-width: 240px;\n min-width: 120px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 7px 0;\n transition: all 0.3s ease-in-out;\n overflow: auto;\n z-index: 2;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-box.dplayer-subtitles-panel {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-box.dplayer-subtitles-box-open {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-item {\n height: 30px;\n padding: 5px 10px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n}\n.dplayer-controller .dplayer-icons .dplayer-subtitles .dplayer-subtitles-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-controller .dplayer-icons .dplayer-setting {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box {\n position: absolute;\n right: 0;\n bottom: 50px;\n transform: scale(0);\n width: 150px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 7px 0;\n transition: all 0.3s ease-in-out;\n overflow: hidden;\n z-index: 2;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box > div {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box > div.dplayer-setting-origin-panel {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-open {\n transform: scale(1);\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-narrow {\n width: 70px;\n text-align: center;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-speed .dplayer-setting-origin-panel {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-speed .dplayer-setting-speed-panel {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item,\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-speed-item {\n height: 30px;\n padding: 5px 10px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item:hover,\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-speed-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku {\n padding: 5px 0;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-label {\n padding: 0 10px;\n display: inline;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku:hover .dplayer-label {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku:hover .dplayer-danmaku-bar-wrap {\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku.dplayer-setting-danmaku-active .dplayer-label {\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku.dplayer-setting-danmaku-active .dplayer-danmaku-bar-wrap {\n display: inline-block;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap {\n padding: 0 10px;\n box-sizing: border-box;\n display: none;\n vertical-align: middle;\n height: 100%;\n width: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar {\n position: relative;\n top: 8.5px;\n width: 100%;\n height: 3px;\n background: #fff;\n transition: all 0.3s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar .dplayer-danmaku-bar-inner {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 100%;\n transition: all 0.1s ease;\n background: #aaa;\n will-change: width;\n}\n.dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar .dplayer-danmaku-bar-inner .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n background: #aaa;\n}\n.dplayer-controller .dplayer-icons .dplayer-full {\n display: inline-block;\n height: 100%;\n position: relative;\n}\n.dplayer-controller .dplayer-icons .dplayer-full:hover .dplayer-full-in-icon {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-full .dplayer-full-in-icon {\n position: absolute;\n top: -30px;\n z-index: 1;\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality {\n position: relative;\n display: inline-block;\n height: 100%;\n z-index: 2;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality:hover .dplayer-quality-list {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality:hover .dplayer-quality-mask {\n display: block;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-mask {\n display: none;\n position: absolute;\n bottom: 38px;\n left: -18px;\n width: 80px;\n padding-bottom: 12px;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-list {\n display: none;\n font-size: 12px;\n width: 80px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 5px 0;\n transition: all 0.3s ease-in-out;\n overflow: hidden;\n color: #fff;\n text-align: center;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-item {\n height: 25px;\n box-sizing: border-box;\n cursor: pointer;\n line-height: 25px;\n}\n.dplayer-controller .dplayer-icons .dplayer-quality .dplayer-quality-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-controller .dplayer-icons .dplayer-comment {\n display: inline-block;\n height: 100%;\n}\n.dplayer-controller .dplayer-icons .dplayer-label {\n color: #eee;\n font-size: 13px;\n display: inline-block;\n vertical-align: middle;\n white-space: nowrap;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle {\n width: 32px;\n height: 20px;\n text-align: center;\n font-size: 0;\n vertical-align: middle;\n position: absolute;\n top: 5px;\n right: 10px;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input {\n max-height: 0;\n max-width: 0;\n display: none;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input + label {\n display: inline-block;\n position: relative;\n box-shadow: #dfdfdf 0 0 0 0 inset;\n border: 1px solid #dfdfdf;\n height: 20px;\n width: 32px;\n border-radius: 10px;\n box-sizing: border-box;\n cursor: pointer;\n transition: 0.2s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input + label:before {\n content: \"\";\n position: absolute;\n display: block;\n height: 18px;\n width: 18px;\n top: 0;\n left: 0;\n border-radius: 15px;\n transition: 0.2s ease-in-out;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input + label:after {\n content: \"\";\n position: absolute;\n display: block;\n left: 0;\n top: 0;\n border-radius: 15px;\n background: #fff;\n transition: 0.2s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n height: 18px;\n width: 18px;\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input:checked + label {\n border-color: rgba(255, 255, 255, 0.5);\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input:checked + label:before {\n width: 30px;\n background: rgba(255, 255, 255, 0.5);\n}\n.dplayer-controller .dplayer-icons .dplayer-toggle input:checked + label:after {\n left: 12px;\n}\n.dplayer-mobile-play {\n display: none;\n width: 50px;\n height: 50px;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n box-sizing: border-box;\n bottom: 0;\n opacity: 0.8;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.dplayer-danmaku {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n font-size: 22px;\n color: #fff;\n}\n.dplayer-danmaku .dplayer-danmaku-item {\n display: inline-block;\n pointer-events: none;\n user-select: none;\n cursor: default;\n white-space: nowrap;\n text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.5);\n}\n.dplayer-danmaku .dplayer-danmaku-item--demo {\n position: absolute;\n visibility: hidden;\n}\n.dplayer-danmaku .dplayer-danmaku-right {\n position: absolute;\n right: 0;\n transform: translateX(100%);\n}\n.dplayer-danmaku .dplayer-danmaku-right.dplayer-danmaku-move {\n will-change: transform;\n animation-name: 'danmaku';\n animation-timing-function: linear;\n animation-play-state: paused;\n}\n@keyframes danmaku {\n from {\n transform: translateX(100%);\n }\n}\n.dplayer-danmaku .dplayer-danmaku-top,\n.dplayer-danmaku .dplayer-danmaku-bottom {\n position: absolute;\n width: 100%;\n text-align: center;\n visibility: hidden;\n}\n.dplayer-danmaku .dplayer-danmaku-top.dplayer-danmaku-move,\n.dplayer-danmaku .dplayer-danmaku-bottom.dplayer-danmaku-move {\n will-change: visibility;\n animation-name: 'danmaku-center';\n animation-timing-function: linear;\n animation-play-state: paused;\n}\n@keyframes danmaku-center {\n from {\n visibility: visible;\n }\n to {\n visibility: visible;\n }\n}\n.dplayer-logo {\n pointer-events: none;\n position: absolute;\n left: 20px;\n top: 20px;\n max-width: 50px;\n max-height: 50px;\n}\n.dplayer-logo img {\n max-width: 100%;\n max-height: 100%;\n background: none;\n}\n.dplayer-menu {\n position: absolute;\n width: 170px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.85);\n padding: 5px 0;\n overflow: hidden;\n z-index: 3;\n display: none;\n}\n.dplayer-menu.dplayer-menu-show {\n display: block;\n}\n.dplayer-menu .dplayer-menu-item {\n height: 30px;\n box-sizing: border-box;\n cursor: pointer;\n}\n.dplayer-menu .dplayer-menu-item:hover {\n background-color: rgba(255, 255, 255, 0.1);\n}\n.dplayer-menu .dplayer-menu-item a {\n padding: 0 10px;\n line-height: 30px;\n color: #eee;\n font-size: 13px;\n display: inline-block;\n vertical-align: middle;\n width: 100%;\n box-sizing: border-box;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.dplayer-menu .dplayer-menu-item a:hover {\n text-decoration: none;\n}\n.dplayer-notice-list {\n position: absolute;\n bottom: 60px;\n left: 20px;\n}\n.dplayer-notice-list .dplayer-notice {\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n transition: all 0.3s ease-in-out;\n overflow: hidden;\n color: #fff;\n display: table;\n pointer-events: none;\n animation: showNotice 0.3s ease 1 forwards;\n}\n.dplayer-notice-list .remove-notice {\n animation: removeNotice 0.3s ease 1 forwards;\n}\n@keyframes showNotice {\n from {\n padding: 0;\n font-size: 0;\n margin-top: 0;\n }\n to {\n padding: 7px 20px;\n font-size: 14px;\n margin-top: 5px;\n }\n}\n@keyframes removeNotice {\n 0% {\n padding: 7px 20px;\n font-size: 14px;\n margin-top: 5px;\n }\n 20% {\n font-size: 12px;\n }\n 21% {\n font-size: 0;\n padding: 7px 10px;\n }\n 100% {\n padding: 0;\n margin-top: 0;\n font-size: 0;\n }\n}\n.dplayer-subtitle {\n position: absolute;\n bottom: 40px;\n width: 90%;\n left: 5%;\n text-align: center;\n color: #fff;\n text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.5);\n font-size: 20px;\n}\n.dplayer-subtitle.dplayer-subtitle-hide {\n display: none;\n}\n.dplayer-mask {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n display: none;\n}\n.dplayer-mask.dplayer-mask-show {\n display: block;\n}\n.dplayer-video-wrap {\n position: relative;\n background: #000;\n font-size: 0;\n width: 100%;\n height: 100%;\n}\n.dplayer-video-wrap .dplayer-video {\n width: 100%;\n height: 100%;\n display: none;\n}\n.dplayer-video-wrap .dplayer-video-current {\n display: block;\n}\n.dplayer-video-wrap .dplayer-video-prepare {\n display: none;\n}\n.dplayer-info-panel {\n position: absolute;\n top: 10px;\n left: 10px;\n width: 400px;\n background: rgba(28, 28, 28, 0.8);\n padding: 10px;\n color: #fff;\n font-size: 12px;\n border-radius: 2px;\n}\n.dplayer-info-panel-hide {\n display: none;\n}\n.dplayer-info-panel .dplayer-info-panel-close {\n cursor: pointer;\n position: absolute;\n right: 10px;\n top: 10px;\n}\n.dplayer-info-panel .dplayer-info-panel-item > span {\n display: inline-block;\n vertical-align: middle;\n line-height: 15px;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.dplayer-info-panel .dplayer-info-panel-item-title {\n width: 100px;\n text-align: right;\n margin-right: 10px;\n}\n.dplayer-info-panel .dplayer-info-panel-item-data {\n width: 260px;\n}\n", ".dplayer {\n position: relative;\n overflow: hidden;\n user-select: none;\n line-height: 1;\n\n * {\n box-sizing: content-box;\n }\n\n svg {\n width: 100%;\n height: 100%;\n\n path,\n circle {\n fill: #fff;\n }\n }\n\n &:-webkit-full-screen {\n width: 100%;\n height: 100%;\n background: #000;\n position: fixed;\n z-index: 100000;\n left: 0;\n top: 0;\n margin: 0;\n padding: 0;\n transform: translate(0, 0);\n \n }\n\n &.dplayer-no-danmaku {\n .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box {\n .dplayer-setting-showdan,\n .dplayer-setting-danmaku,\n .dplayer-setting-danunlimit {\n display: none;\n }\n }\n\n .dplayer-controller .dplayer-icons .dplayer-comment {\n display: none;\n }\n\n .dplayer-danmaku {\n display: none;\n }\n }\n\n &.dplayer-live {\n .dplayer-time {\n display: none;\n }\n .dplayer-bar-wrap {\n display: none;\n }\n .dplayer-setting-speed {\n display: none;\n }\n .dplayer-setting-loop {\n display: none;\n }\n\n &.dplayer-no-danmaku {\n .dplayer-setting {\n display: none;\n }\n }\n }\n\n &.dplayer-arrow {\n .dplayer-danmaku {\n font-size: 18px;\n }\n .dplayer-icon {\n margin: 0 -3px;\n }\n }\n\n &.dplayer-playing {\n .dplayer-danmaku .dplayer-danmaku-move {\n animation-play-state: running;\n }\n\n @media (min-width: 900px) {\n .dplayer-controller-mask {\n opacity: 0;\n }\n .dplayer-controller {\n opacity: 0;\n }\n\n &:hover {\n .dplayer-controller-mask {\n opacity: 1;\n }\n .dplayer-controller {\n opacity: 1;\n }\n }\n }\n }\n\n &.dplayer-loading {\n .dplayer-bezel .diplayer-loading-icon {\n display: block;\n }\n }\n\n &.dplayer-loading,\n &.dplayer-paused {\n .dplayer-danmaku,\n .dplayer-danmaku-move {\n animation-play-state: paused;\n }\n }\n\n &.dplayer-hide-controller {\n cursor: none;\n\n .dplayer-controller-mask {\n opacity: 0;\n transform: translateY(100%);\n }\n .dplayer-controller {\n opacity: 0;\n transform: translateY(100%);\n }\n }\n &.dplayer-show-controller {\n .dplayer-controller-mask {\n opacity: 1;\n }\n .dplayer-controller {\n opacity: 1;\n }\n }\n &.dplayer-fulled {\n position: fixed;\n z-index: 100000;\n left: 0;\n top: 0;\n width: 100% !important;\n height: 100% !important;\n }\n &.dplayer-mobile {\n .dplayer-controller .dplayer-icons {\n .dplayer-volume,\n .dplayer-camera-icon,\n .dplayer-airplay-icon,\n .dplayer-chromecast-icon,\n .dplayer-play-icon {\n display: none;\n }\n .dplayer-full .dplayer-full-in-icon {\n position: static;\n display: inline-block;\n }\n }\n\n .dplayer-bar-time {\n display: none;\n }\n\n &.dplayer-hide-controller {\n .dplayer-mobile-play {\n display: none;\n }\n }\n\n .dplayer-mobile-play {\n display: block;\n }\n }\n}\n\n// To hide scroll bar, apply this class to \n.dplayer-web-fullscreen-fix {\n position: fixed;\n top: 0;\n left: 0;\n margin: 0;\n padding: 0;\n}\n", "@import '../../node_modules/balloon-css/balloon.css';\n\n[data-balloon]:before {\n display: none;\n}\n\n[data-balloon]:after {\n padding: 0.3em 0.7em;\n background: rgba(17, 17, 17, 0.7);\n}\n\n[data-balloon][data-balloon-pos=\"up\"]:after {\n margin-bottom: 0;\n}", ".dplayer-bezel {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n font-size: 22px;\n color: #fff;\n pointer-events: none;\n .dplayer-bezel-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -26px 0 0 -26px;\n height: 52px;\n width: 52px;\n padding: 12px;\n box-sizing: border-box;\n background: rgba(0, 0, 0, .5);\n border-radius: 50%;\n opacity: 0;\n pointer-events: none;\n &.dplayer-bezel-transition {\n animation: bezel-hide .5s linear;\n }\n @keyframes bezel-hide {\n from {\n opacity: 1;\n transform: scale(1);\n }\n to {\n opacity: 0;\n transform: scale(2);\n }\n }\n }\n .dplayer-danloading {\n position: absolute;\n top: 50%;\n margin-top: -7px;\n width: 100%;\n text-align: center;\n font-size: 14px;\n line-height: 14px;\n animation: my-face 5s infinite ease-in-out;\n }\n .diplayer-loading-icon {\n display: none;\n position: absolute;\n top: 50%;\n left: 50%;\n margin: -18px 0 0 -18px;\n height: 36px;\n width: 36px;\n pointer-events: none;\n .diplayer-loading-hide {\n display: none;\n }\n .diplayer-loading-dot {\n animation: diplayer-loading-dot-fade .8s ease infinite;\n opacity: 0;\n transform-origin: 4px 4px;\n each(range(7), {\n &.diplayer-loading-dot-@{value} {\n animation-delay: (@value * 0.1s);\n }\n });\n }\n @keyframes diplayer-loading-dot-fade {\n 0% {\n opacity: .7;\n transform: scale(1.2, 1.2)\n }\n 50% {\n opacity: .25;\n transform: scale(.9, .9)\n }\n to {\n opacity: .25;\n transform: scale(.85, .85)\n }\n }\n }\n}", ".dplayer-notice-list{\n position: absolute;\n bottom: 60px;\n left: 20px;\n\n .dplayer-notice {\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n transition: all .3s ease-in-out;\n overflow: hidden;\n color: #fff;\n display: table;\n pointer-events: none;\n animation: showNotice .3s ease 1 forwards;\n }\n\n .remove-notice{\n animation: removeNotice .3s ease 1 forwards;\n }\n}\n\n@keyframes showNotice {\n from {\n padding: 0;\n font-size: 0;\n margin-top: 0;\n }\n to {\n padding: 7px 20px;\n font-size: 14px;\n margin-top: 5px;\n }\n}\n\n@keyframes removeNotice {\n 0%{\n padding: 7px 20px;\n font-size: 14px;\n margin-top: 5px;\n }\n 20%{\n font-size: 12px;\n }\n 21%{\n font-size: 0;\n padding: 7px 10px;\n }\n 100%{\n padding: 0;\n margin-top: 0;\n font-size: 0;\n }\n}\n", '.dplayer-controller-mask {\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==) repeat-x bottom;\n height: 98px;\n width: 100%;\n position: absolute;\n bottom: 0;\n transition: all 0.3s ease;\n}\n\n.dplayer-controller {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 41px;\n padding: 0 20px;\n user-select: none;\n transition: all 0.3s ease;\n &.dplayer-controller-comment {\n .dplayer-icons {\n display: none;\n }\n .dplayer-icons.dplayer-comment-box {\n display: block;\n }\n }\n .dplayer-bar-wrap {\n padding: 5px 0;\n cursor: pointer;\n position: absolute;\n bottom: 33px;\n width: calc(100% - 40px);\n height: 3px;\n &:hover {\n .dplayer-bar .dplayer-played .dplayer-thumb {\n transform: scale(1);\n }\n .dplayer-highlight {\n display: block;\n width: 8px;\n transform: translateX(-4px);\n top: 4px;\n height: 40%;\n }\n }\n .dplayer-highlight {\n z-index: 12;\n position: absolute;\n top: 5px;\n width: 6px;\n height: 20%;\n border-radius: 6px;\n background-color: #fff;\n text-align: center;\n transform: translateX(-3px);\n transition: all .2s ease-in-out;\n &:hover {\n .dplayer-highlight-text {\n display: block;\n }\n &~.dplayer-bar-preview {\n opacity: 0;\n }\n &~.dplayer-bar-time {\n opacity: 0;\n }\n }\n .dplayer-highlight-text {\n display: none;\n position: absolute;\n left: 50%;\n top: -24px;\n padding: 5px 8px;\n background-color: rgba(0, 0, 0, .62);\n color: #fff;\n border-radius: 4px;\n font-size: 12px;\n white-space: nowrap;\n transform: translateX(-50%);\n }\n }\n .dplayer-bar-preview {\n position: absolute;\n background: #fff;\n pointer-events: none;\n display: none;\n background-size: 16000px 100%;\n }\n .dplayer-bar-preview-canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: 1;\n pointer-events: none;\n }\n .dplayer-bar-time {\n &.hidden {\n opacity: 0;\n }\n position: absolute;\n left: 0px;\n top: -20px;\n border-radius: 4px;\n padding: 5px 7px;\n background-color: rgba(0, 0, 0, 0.62);\n color: #fff;\n font-size: 12px;\n text-align: center;\n opacity: 1;\n transition: opacity .1s ease-in-out;\n word-wrap: normal;\n word-break: normal;\n z-index: 2;\n pointer-events: none;\n }\n .dplayer-bar {\n position: relative;\n height: 3px;\n width: 100%;\n background: rgba(255, 255, 255, .2);\n cursor: pointer;\n .dplayer-loaded {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n background: rgba(255, 255, 255, .4);\n height: 3px;\n transition: all 0.5s ease;\n will-change: width;\n }\n .dplayer-played {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n height: 3px;\n will-change: width;\n .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all .3s ease-in-out;\n transform: scale(0);\n }\n }\n }\n }\n .dplayer-icons {\n height: 38px;\n position: absolute;\n bottom: 0;\n &.dplayer-comment-box {\n display: none;\n position: absolute;\n transition: all .3s ease-in-out;\n z-index: 2;\n height: 38px;\n bottom: 0;\n left: 20px;\n right: 20px;\n color: #fff;\n .dplayer-icon {\n padding: 7px;\n }\n .dplayer-comment-setting-icon {\n position: absolute;\n left: 0;\n top: 0;\n }\n .dplayer-send-icon {\n position: absolute;\n right: 0;\n top: 0;\n }\n .dplayer-comment-setting-box {\n position: absolute;\n background: rgba(28, 28, 28, 0.9);\n bottom: 41px;\n left: 0;\n box-shadow: 0 0 25px rgba(0, 0, 0, .3);\n border-radius: 4px;\n padding: 10px 10px 16px;\n font-size: 14px;\n width: 204px;\n transition: all .3s ease-in-out;\n transform: scale(0);\n &.dplayer-comment-setting-open {\n transform: scale(1);\n }\n input[type=radio] {\n display: none;\n }\n label {\n cursor: pointer;\n }\n .dplayer-comment-setting-title {\n font-size: 13px;\n color: #fff;\n line-height: 30px;\n }\n .dplayer-comment-setting-type {\n font-size: 0;\n .dplayer-comment-setting-title {\n margin-bottom: 6px;\n }\n label {\n &:nth-child(2) {\n span {\n border-radius: 4px 0 0 4px;\n }\n }\n &:nth-child(4) {\n span {\n border-radius: 0 4px 4px 0;\n }\n }\n }\n span {\n width: 33%;\n padding: 4px 6px;\n line-height: 16px;\n display: inline-block;\n font-size: 12px;\n color: #fff;\n border: 1px solid #fff;\n margin-right: -1px;\n box-sizing: border-box;\n text-align: center;\n cursor: pointer;\n }\n input:checked+span {\n background: #E4E4E6;\n color: #1c1c1c;\n }\n }\n .dplayer-comment-setting-color {\n font-size: 0;\n label {\n font-size: 0;\n padding: 6px;\n display: inline-block;\n }\n span {\n width: 22px;\n height: 22px;\n display: inline-block;\n border-radius: 50%;\n box-sizing: border-box;\n cursor: pointer;\n &:hover {\n animation: my-face 5s infinite ease-in-out;\n }\n }\n }\n }\n .dplayer-comment-input {\n outline: none;\n border: none;\n padding: 8px 31px;\n font-size: 14px;\n line-height: 18px;\n text-align: center;\n border-radius: 4px;\n background: none;\n margin: 0;\n height: 100%;\n box-sizing: border-box;\n width: 100%;\n color: #fff;\n &::placeholder {\n color: #fff;\n opacity: 0.8;\n }\n &::-ms-clear {\n display: none;\n }\n }\n }\n &.dplayer-icons-left {\n .dplayer-icon {\n padding: 7px;\n }\n }\n &.dplayer-icons-right {\n right: 20px;\n .dplayer-icon {\n padding: 8px;\n }\n }\n .dplayer-time,\n .dplayer-live-badge {\n line-height: 38px;\n color: #eee;\n text-shadow: 0 0 2px rgba(0, 0, 0, .5);\n vertical-align: middle;\n font-size: 13px;\n cursor: default;\n }\n .dplayer-live-dot {\n display: inline-block;\n width: 6px;\n height: 6px;\n vertical-align: 4%;\n margin-right: 5px;\n content: \'\';\n border-radius: 6px;\n }\n .dplayer-icon {\n width: 40px;\n height: 100%;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n vertical-align: middle;\n box-sizing: border-box;\n display: inline-block;\n .dplayer-icon-content {\n transition: all .2s ease-in-out;\n opacity: .8;\n }\n &:hover {\n .dplayer-icon-content {\n opacity: 1;\n }\n }\n &.dplayer-quality-icon {\n color: #fff;\n width: auto;\n line-height: 22px;\n font-size: 14px;\n }\n &.dplayer-comment-icon {\n padding: 10px 9px 9px;\n }\n &.dplayer-setting-icon {\n padding-top: 8.5px;\n }\n &.dplayer-volume-icon {\n width: 43px;\n }\n }\n .dplayer-volume {\n position: relative;\n display: inline-block;\n cursor: pointer;\n height: 100%;\n &:hover {\n .dplayer-volume-bar-wrap .dplayer-volume-bar {\n width: 45px;\n }\n .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n transform: scale(1);\n }\n }\n &.dplayer-volume-active {\n .dplayer-volume-bar-wrap .dplayer-volume-bar {\n width: 45px;\n }\n .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb {\n transform: scale(1);\n }\n }\n .dplayer-volume-bar-wrap {\n display: inline-block;\n margin: 0 10px 0 -5px;\n vertical-align: middle;\n height: 100%;\n .dplayer-volume-bar {\n position: relative;\n top: 17px;\n width: 0;\n height: 3px;\n background: #aaa;\n transition: all 0.3s ease-in-out;\n .dplayer-volume-bar-inner {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 100%;\n transition: all 0.1s ease;\n will-change: width;\n .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all .3s ease-in-out;\n transform: scale(0);\n }\n }\n }\n }\n }\n .dplayer-subtitle-btn {\n display: inline-block;\n height: 100%;\n }\n .dplayer-subtitles {\n display: inline-block;\n height: 100%;\n .dplayer-subtitles-box {\n position: absolute;\n right: 0;\n bottom: 50px;\n transform: scale(0);\n width: fit-content;\n max-width: 240px;\n min-width: 120px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 7px 0;\n transition: all .3s ease-in-out;\n overflow: auto;\n z-index: 2;\n &.dplayer-subtitles-panel {\n display: block;\n }\n &.dplayer-subtitles-box-open {\n transform: scale(1);\n }\n }\n .dplayer-subtitles-item {\n height: 30px;\n padding: 5px 10px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n &:hover {\n background-color: rgba(255, 255, 255, .1);\n }\n }\n }\n .dplayer-setting {\n display: inline-block;\n height: 100%;\n .dplayer-setting-box {\n position: absolute;\n right: 0;\n bottom: 50px;\n transform: scale(0);\n width: 150px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 7px 0;\n transition: all .3s ease-in-out;\n overflow: hidden;\n z-index: 2;\n &>div {\n display: none;\n &.dplayer-setting-origin-panel {\n display: block;\n }\n }\n &.dplayer-setting-box-open {\n transform: scale(1);\n }\n &.dplayer-setting-box-narrow {\n width: 70px;\n text-align: center;\n }\n &.dplayer-setting-box-speed {\n .dplayer-setting-origin-panel {\n display: none;\n }\n .dplayer-setting-speed-panel {\n display: block;\n }\n }\n }\n .dplayer-setting-item,\n .dplayer-setting-speed-item {\n height: 30px;\n padding: 5px 10px;\n box-sizing: border-box;\n cursor: pointer;\n position: relative;\n &:hover {\n background-color: rgba(255, 255, 255, .1);\n }\n }\n .dplayer-setting-danmaku {\n padding: 5px 0;\n .dplayer-label {\n padding: 0 10px;\n display: inline;\n }\n &:hover {\n .dplayer-label {\n display: none;\n }\n .dplayer-danmaku-bar-wrap {\n display: inline-block;\n }\n }\n &.dplayer-setting-danmaku-active {\n .dplayer-label {\n display: none;\n }\n .dplayer-danmaku-bar-wrap {\n display: inline-block;\n }\n }\n .dplayer-danmaku-bar-wrap {\n padding: 0 10px;\n box-sizing: border-box;\n display: none;\n vertical-align: middle;\n height: 100%;\n width: 100%;\n .dplayer-danmaku-bar {\n position: relative;\n top: 8.5px;\n width: 100%;\n height: 3px;\n background: #fff;\n transition: all 0.3s ease-in-out;\n .dplayer-danmaku-bar-inner {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 100%;\n transition: all 0.1s ease;\n background: #aaa;\n will-change: width;\n .dplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 11px;\n width: 11px;\n border-radius: 50%;\n cursor: pointer;\n transition: all .3s ease-in-out;\n background: #aaa;\n }\n }\n }\n }\n }\n }\n .dplayer-full {\n display: inline-block;\n height: 100%;\n position: relative;\n &:hover {\n .dplayer-full-in-icon {\n display: block;\n }\n }\n .dplayer-full-in-icon {\n position: absolute;\n top: -30px;\n z-index: 1;\n display: none;\n }\n }\n .dplayer-quality {\n position: relative;\n display: inline-block;\n height: 100%;\n z-index: 2;\n &:hover {\n .dplayer-quality-list {\n display: block;\n }\n .dplayer-quality-mask {\n display: block;\n }\n }\n .dplayer-quality-mask {\n display: none;\n position: absolute;\n bottom: 38px;\n left: -18px;\n width: 80px;\n padding-bottom: 12px;\n }\n .dplayer-quality-list {\n display: none;\n font-size: 12px;\n width: 80px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.9);\n padding: 5px 0;\n transition: all .3s ease-in-out;\n overflow: hidden;\n color: #fff;\n text-align: center;\n }\n .dplayer-quality-item {\n height: 25px;\n box-sizing: border-box;\n cursor: pointer;\n line-height: 25px;\n &:hover {\n background-color: rgba(255, 255, 255, .1);\n }\n }\n }\n .dplayer-comment {\n display: inline-block;\n height: 100%;\n }\n .dplayer-label {\n color: #eee;\n font-size: 13px;\n display: inline-block;\n vertical-align: middle;\n white-space: nowrap;\n }\n .dplayer-toggle {\n width: 32px;\n height: 20px;\n text-align: center;\n font-size: 0;\n vertical-align: middle;\n position: absolute;\n top: 5px;\n right: 10px;\n input {\n max-height: 0;\n max-width: 0;\n display: none;\n }\n input+label {\n display: inline-block;\n position: relative;\n box-shadow: rgb(223, 223, 223) 0 0 0 0 inset;\n border: 1px solid rgb(223, 223, 223);\n height: 20px;\n width: 32px;\n border-radius: 10px;\n box-sizing: border-box;\n cursor: pointer;\n transition: .2s ease-in-out;\n }\n input+label:before {\n content: "";\n position: absolute;\n display: block;\n height: 18px;\n width: 18px;\n top: 0;\n left: 0;\n border-radius: 15px;\n transition: .2s ease-in-out;\n }\n input+label:after {\n content: "";\n position: absolute;\n display: block;\n left: 0;\n top: 0;\n border-radius: 15px;\n background: #fff;\n transition: .2s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n height: 18px;\n width: 18px;\n }\n input:checked+label {\n border-color: rgba(255, 255, 255, 0.5);\n }\n input:checked+label:before {\n width: 30px;\n background: rgba(255, 255, 255, 0.5);\n }\n input:checked+label:after {\n left: 12px;\n }\n }\n }\n}\n\n.dplayer-mobile-play {\n display: none;\n width: 50px;\n height: 50px;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n box-sizing: border-box;\n position: absolute;\n bottom: 0;\n opacity: 0.8;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}', ".dplayer-danmaku {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n font-size: 22px;\n color: #fff;\n .dplayer-danmaku-item {\n display: inline-block;\n pointer-events: none;\n user-select: none;\n cursor: default;\n white-space: nowrap;\n text-shadow: .5px .5px .5px rgba(0, 0, 0, .5);\n &--demo {\n position: absolute;\n visibility: hidden;\n }\n }\n .dplayer-danmaku-right {\n position: absolute;\n right: 0;\n transform: translateX(100%);\n &.dplayer-danmaku-move {\n will-change: transform;\n animation-name: 'danmaku';\n animation-timing-function: linear;\n animation-play-state: paused;\n }\n }\n @keyframes danmaku {\n from {\n transform: translateX(100%);\n }\n }\n .dplayer-danmaku-top,\n .dplayer-danmaku-bottom {\n position: absolute;\n width: 100%;\n text-align: center;\n visibility: hidden;\n &.dplayer-danmaku-move {\n will-change: visibility;\n animation-name: 'danmaku-center';\n animation-timing-function: linear;\n animation-play-state: paused;\n }\n }\n @keyframes danmaku-center {\n from {\n visibility: visible;\n }\n to {\n visibility: visible;\n }\n }\n}", ".dplayer-logo {\n pointer-events: none;\n position: absolute;\n left: 20px;\n top: 20px;\n max-width: 50px;\n max-height: 50px;\n img {\n max-width: 100%;\n max-height: 100%;\n background: none;\n }\n}", ".dplayer-menu {\n position: absolute;\n width: 170px;\n border-radius: 2px;\n background: rgba(28, 28, 28, 0.85);\n padding: 5px 0;\n overflow: hidden;\n z-index: 3;\n display: none;\n &.dplayer-menu-show {\n display: block;\n }\n .dplayer-menu-item {\n height: 30px;\n box-sizing: border-box;\n cursor: pointer;\n &:hover {\n background-color: rgba(255, 255, 255, .1);\n }\n a {\n display: inline-block;\n padding: 0 10px;\n line-height: 30px;\n color: #eee;\n font-size: 13px;\n display: inline-block;\n vertical-align: middle;\n width: 100%;\n box-sizing: border-box;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n &:hover {\n text-decoration: none;\n }\n }\n }\n}", ".dplayer-subtitle {\n position: absolute;\n bottom: 40px;\n width: 90%;\n left: 5%;\n text-align: center;\n color: #fff;\n text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.5);\n font-size: 20px;\n &.dplayer-subtitle-hide {\n display: none;\n }\n}", ".dplayer-mask {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1;\n display: none;\n &.dplayer-mask-show {\n display: block;\n }\n}\n\n.dplayer-video-wrap {\n position: relative;\n background: #000;\n font-size: 0;\n width: 100%;\n height: 100%;\n .dplayer-video {\n width: 100%;\n height: 100%;\n display: none;\n }\n .dplayer-video-current {\n display: block;\n }\n .dplayer-video-prepare {\n display: none;\n }\n}", ".dplayer-info-panel {\n position: absolute;\n top: 10px;\n left: 10px;\n width: 400px;\n background: rgba(28, 28, 28, 0.8);\n padding: 10px;\n color: #fff;\n font-size: 12px;\n border-radius: 2px;\n\n &-hide {\n display: none;\n }\n\n .dplayer-info-panel-close {\n cursor: pointer;\n position: absolute;\n right: 10px;\n top: 10px;\n }\n\n .dplayer-info-panel-item {\n & > span {\n display: inline-block;\n vertical-align: middle;\n line-height: 15px;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n }\n\n .dplayer-info-panel-item-title {\n width: 100px;\n text-align: right;\n margin-right: 10px;\n }\n \n .dplayer-info-panel-item-data {\n width: 260px;\n }\n}" ], sourceRoot: "" } ]); var p = u; }, 856: function (t) { var e = []; function n(t) { for (var n = -1, i = 0; i < e.length; i++) if (e[i].identifier === t) { n = i; break; } return n; } function i(t, i) { for (var a = {}, s = [], o = 0; o < t.length; o++) { var l = t[o], d = i.base ? l[0] + i.base : l[0], c = a[d] || 0, u = "".concat(d, " ").concat(c); a[d] = c + 1; var h = n(u), p = { css: l[1], media: l[2], sourceMap: l[3], supports: l[4], layer: l[5] }; if (-1 !== h) e[h].references++, e[h].updater(p); else { var f = r(p, i); (i.byIndex = o), e.splice(o, 0, { identifier: u, updater: f, references: 1 }); } s.push(u); } return s; } function r(t, e) { var n = e.domAPI(e); return ( n.update(t), function (e) { if (e) { if ( e.css === t.css && e.media === t.media && e.sourceMap === t.sourceMap && e.supports === t.supports && e.layer === t.layer ) return; n.update((t = e)); } else n.remove(); } ); } t.exports = function (t, r) { var a = i((t = t || []), (r = r || {})); return function (t) { t = t || []; for (var s = 0; s < a.length; s++) { var o = n(a[s]); e[o].references--; } for (var l = i(t, r), d = 0; d < a.length; d++) { var c = n(a[d]); 0 === e[c].references && (e[c].updater(), e.splice(c, 1)); } a = l; }; }; }, 370: function (t) { var e = {}; t.exports = function (t, n) { var i = (function (t) { if (void 0 === e[t]) { var n = document.querySelector(t); if (window.HTMLIFrameElement && n instanceof window.HTMLIFrameElement) try { n = n.contentDocument.head; } catch (t) { n = null; } e[t] = n; } return e[t]; })(t); if (!i) throw new Error( "Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid." ); i.appendChild(n); }; }, 278: function (t) { t.exports = function (t) { var e = document.createElement("style"); return t.setAttributes(e, t.attributes), t.insert(e, t.options), e; }; }, 458: function (t, e, n) { t.exports = function (t) { var e = n.nc; e && t.setAttribute("nonce", e); }; }, 470: function (t) { t.exports = function (t) { var e = t.insertStyleElement(t); return { update: function (n) { !(function (t, e, n) { var i = ""; n.supports && (i += "@supports (".concat(n.supports, ") {")), n.media && (i += "@media ".concat(n.media, " {")); var r = void 0 !== n.layer; r && (i += "@layer".concat(n.layer.length > 0 ? " ".concat(n.layer) : "", " {")), (i += n.css), r && (i += "}"), n.media && (i += "}"), n.supports && (i += "}"); var a = n.sourceMap; a && "undefined" != typeof btoa && (i += "\n/*# sourceMappingURL=data:application/json;base64,".concat( btoa(unescape(encodeURIComponent(JSON.stringify(a)))), " */" )), e.styleTagTransform(i, t, e.options); })(e, t, n); }, remove: function () { !(function (t) { if (null === t.parentNode) return !1; t.parentNode.removeChild(t); })(e); } }; }; }, 488: function (t) { t.exports = function (t, e) { if (e.styleSheet) e.styleSheet.cssText = t; else { for (; e.firstChild;) e.removeChild(e.firstChild); e.appendChild(document.createTextNode(t)); } }; }, 251: function (t) { t.exports = ''; }, 113: function (t) { t.exports = ''; }, 193: function (t) { t.exports = ''; }, 338: function (t) { t.exports = ''; }, 807: function (t) { t.exports = ''; }, 300: function (t) { t.exports = ''; }, 574: function (t) { t.exports = ''; }, 182: function (t) { t.exports = ''; }, 965: function (t) { t.exports = ''; }, 74: function (t) { t.exports = ''; }, 730: function (t) { t.exports = ''; }, 428: function (t) { t.exports = ''; }, 254: function (t) { t.exports = ''; }, 934: function (t) { t.exports = ''; }, 410: function (t) { t.exports = ''; }, 644: function (t) { t.exports = ''; }, 324: function (t) { t.exports = ''; }, 437: function (t) { t.exports = ''; }, 897: function (t, e, n) { var i = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n.g ? n.g : {}, r = Object.create(i), a = /["&'<>]/; function s(t) { return ( "string" != typeof t && (t = null == t ? "" : "function" == typeof t ? s(t.call(t)) : JSON.stringify(t)), t ); } (r.$escape = function (t) { return (function (t) { var e = "" + t, n = a.exec(e); if (!n) return t; var i = "", r = void 0, s = void 0, o = void 0; for (r = n.index, s = 0; r < e.length; r++) { switch (e.charCodeAt(r)) { case 34: o = """; break; case 38: o = "&"; break; case 39: o = "'"; break; case 60: o = "<"; break; case 62: o = ">"; break; default: continue; } s !== r && (i += e.substring(s, r)), (s = r + 1), (i += o); } return s !== r ? i + e.substring(s, r) : i; })(s(t)); }), (r.$each = function (t, e) { if (Array.isArray(t)) for (var n = 0, i = t.length; n < i; n++) e(t[n], n); else for (var r in t) e(t[r], r); }), (t.exports = r); }, 471: function (t, e, n) { t.exports = n(897); }, 352: function (t) { t.exports = function (t) { var e = []; return ( (e.toString = function () { return this.map(function (e) { var n = "", i = void 0 !== e[5]; return ( e[4] && (n += "@supports (".concat(e[4], ") {")), e[2] && (n += "@media ".concat(e[2], " {")), i && (n += "@layer".concat(e[5].length > 0 ? " ".concat(e[5]) : "", " {")), (n += t(e)), i && (n += "}"), e[2] && (n += "}"), e[4] && (n += "}"), n ); }).join(""); }), (e.i = function (t, n, i, r, a) { "string" == typeof t && (t = [[null, t, void 0]]); var s = {}; if (i) for (var o = 0; o < this.length; o++) { var l = this[o][0]; null != l && (s[l] = !0); } for (var d = 0; d < t.length; d++) { var c = [].concat(t[d]); (i && s[c[0]]) || (void 0 !== a && (void 0 === c[5] || (c[1] = "@layer" .concat(c[5].length > 0 ? " ".concat(c[5]) : "", " {") .concat(c[1], "}")), (c[5] = a)), n && (c[2] ? ((c[1] = "@media ".concat(c[2], " {").concat(c[1], "}")), (c[2] = n)) : (c[2] = n)), r && (c[4] ? ((c[1] = "@supports (".concat(c[4], ") {").concat(c[1], "}")), (c[4] = r)) : (c[4] = "".concat(r))), e.push(c)); } }), e ); }; }, 80: function (t) { t.exports = function (t, e) { return ( e || (e = {}), t ? ((t = String(t.__esModule ? t.default : t)), /^['"].*['"]$/.test(t) && (t = t.slice(1, -1)), e.hash && (t += e.hash), /["'() \t\n]|(%20)/.test(t) || e.needQuotes ? '"'.concat(t.replace(/"/g, '\\"').replace(/\n/g, "\\n"), '"') : t) : t ); }; }, 415: function (t) { t.exports = function (t) { var e = t[1], n = t[3]; if (!n) return e; if ("function" == typeof btoa) { var i = btoa(unescape(encodeURIComponent(JSON.stringify(n)))), r = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i), a = "/*# ".concat(r, " */"); return [e].concat([a]).join("\n"); } return [e].join("\n"); }; }, 937: function (t) { function e(t) { return ( (e = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), e(t) ); } t.exports = "object" == ("undefined" == typeof self ? "undefined" : e(self)) ? self.FormData : window.FormData; }, 831: function (t) { t.exports = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg=="; } }, e = {}; function n(i) { var r = e[i]; if (void 0 !== r) return r.exports; var a = (e[i] = { id: i, exports: {} }); return t[i](a, a.exports, n), a.exports; } (n.m = t), (n.n = function (t) { var e = t && t.__esModule ? function () { return t.default; } : function () { return t; }; return n.d(e, { a: e }), e; }), (n.d = function (t, e) { for (var i in e) n.o(e, i) && !n.o(t, i) && Object.defineProperty(t, i, { enumerable: !0, get: e[i] }); }), (n.g = (function () { if ("object" == ("undefined" == typeof globalThis ? "undefined" : u(globalThis))) return globalThis; try { return this || new Function("return this")(); } catch (t) { if ("object" == ("undefined" == typeof window ? "undefined" : u(window))) return window; } })()), (n.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e); }), (n.b = document.baseURI || self.location.href), (n.nc = void 0); var i = {}; return ( (function () { n.d(i, { default: function () { return Qi; } }); var t = n(856), e = n.n(t), r = n(470), a = n.n(r), s = n(370), o = n.n(s), l = n(458), d = n.n(l), c = n(278), h = n.n(c), p = n(488), f = n.n(p), m = n(685), g = {}; function y(t) { return ( (y = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), y(t) ); } function A(t, e) { (this.name = "AggregateError"), (this.errors = t), (this.message = e || ""); } function v(t) { return ( (v = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), v(t) ); } (g.styleTagTransform = f()), (g.setAttributes = d()), (g.insert = o().bind(null, "head")), (g.domAPI = a()), (g.insertStyleElement = h()), e()(m.Z, g), m.Z && m.Z.locals && m.Z.locals, (A.prototype = Error.prototype); var b = setTimeout; function E(t) { return Boolean(t && void 0 !== t.length); } function w() { } function x(t) { if (!(this instanceof x)) throw new TypeError("Promises must be constructed via new"); if ("function" != typeof t) throw new TypeError("not a function"); (this._state = 0), (this._handled = !1), (this._value = void 0), (this._deferreds = []), I(t, this); } function S(t, e) { for (; 3 === t._state;) t = t._value; 0 !== t._state ? ((t._handled = !0), x._immediateFn(function () { var n = 1 === t._state ? e.onFulfilled : e.onRejected; if (null !== n) { var i; try { i = n(t._value); } catch (t) { return void k(e.promise, t); } _(e.promise, i); } else (1 === t._state ? _ : k)(e.promise, t._value); })) : t._deferreds.push(e); } function _(t, e) { try { if (e === t) throw new TypeError("A promise cannot be resolved with itself."); if (e && ("object" === v(e) || "function" == typeof e)) { var n = e.then; if (e instanceof x) return (t._state = 3), (t._value = e), void C(t); if ("function" == typeof n) return void I( ((i = n), (r = e), function () { i.apply(r, arguments); }), t ); } (t._state = 1), (t._value = e), C(t); } catch (e) { k(t, e); } var i, r; } function k(t, e) { (t._state = 2), (t._value = e), C(t); } function C(t) { 2 === t._state && 0 === t._deferreds.length && x._immediateFn(function () { t._handled || x._unhandledRejectionFn(t._value); }); for (var e = 0, n = t._deferreds.length; e < n; e++) S(t, t._deferreds[e]); t._deferreds = null; } function L(t, e, n) { (this.onFulfilled = "function" == typeof t ? t : null), (this.onRejected = "function" == typeof e ? e : null), (this.promise = n); } function I(t, e) { var n = !1; try { t( function (t) { n || ((n = !0), _(e, t)); }, function (t) { n || ((n = !0), k(e, t)); } ); } catch (t) { if (n) return; (n = !0), k(e, t); } } (x.prototype.catch = function (t) { return this.then(null, t); }), (x.prototype.then = function (t, e) { var n = new this.constructor(w); return S(this, new L(t, e, n)), n; }), (x.prototype.finally = function (t) { var e = this.constructor; return this.then( function (n) { return e.resolve(t()).then(function () { return n; }); }, function (n) { return e.resolve(t()).then(function () { return e.reject(n); }); } ); }), (x.all = function (t) { return new x(function (e, n) { if (!E(t)) return n(new TypeError("Promise.all accepts an array")); var i = Array.prototype.slice.call(t); if (0 === i.length) return e([]); var r = i.length; function a(t, s) { try { if (s && ("object" === v(s) || "function" == typeof s)) { var o = s.then; if ("function" == typeof o) return void o.call( s, function (e) { a(t, e); }, n ); } (i[t] = s), 0 == --r && e(i); } catch (t) { n(t); } } for (var s = 0; s < i.length; s++) a(s, i[s]); }); }), (x.any = function (t) { var e = this; return new e(function (n, i) { if (!t || void 0 === t.length) return i(new TypeError("Promise.any accepts an array")); var r = Array.prototype.slice.call(t); if (0 === r.length) return i(); for (var a = [], s = 0; s < r.length; s++) try { e.resolve(r[s]) .then(n) .catch(function (t) { a.push(t), a.length === r.length && i(new A(a, "All promises were rejected")); }); } catch (t) { i(t); } }); }), (x.allSettled = function (t) { return new this(function (e, n) { if (!t || void 0 === t.length) return n( new TypeError( y(t) + " " + t + " is not iterable(cannot read property Symbol(Symbol.iterator))" ) ); var i = Array.prototype.slice.call(t); if (0 === i.length) return e([]); var r = i.length; function a(t, n) { if (n && ("object" === y(n) || "function" == typeof n)) { var s = n.then; if ("function" == typeof s) return void s.call( n, function (e) { a(t, e); }, function (n) { (i[t] = { status: "rejected", reason: n }), 0 == --r && e(i); } ); } (i[t] = { status: "fulfilled", value: n }), 0 == --r && e(i); } for (var s = 0; s < i.length; s++) a(s, i[s]); }); }), (x.resolve = function (t) { return t && "object" === v(t) && t.constructor === x ? t : new x(function (e) { e(t); }); }), (x.reject = function (t) { return new x(function (e, n) { n(t); }); }), (x.race = function (t) { return new x(function (e, n) { if (!E(t)) return n(new TypeError("Promise.race accepts an array")); for (var i = 0, r = t.length; i < r; i++) x.resolve(t[i]).then(e, n); }); }), (x._immediateFn = ("function" == typeof setImmediate && function (t) { setImmediate(t); }) || function (t) { b(t, 0); }), (x._unhandledRejectionFn = function (t) { "undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", t); }); var R = x, D = /mobile/i.test(window.navigator.userAgent), B = { secondToTime: function (t) { if (0 === (t = t || 0) || t === 1 / 0 || "NaN" === t.toString()) return "00:00"; var e = Math.floor(t / 3600), n = Math.floor((t - 3600 * e) / 60), i = Math.floor(t - 3600 * e - 60 * n); return (e > 0 ? [e, n, i] : [n, i]) .map(function (t) { return t < 10 ? "0" + t : "" + t; }) .join(":"); }, getElementViewLeft: function (t) { var e = t.offsetLeft, n = t.offsetParent, i = document.body.scrollLeft + document.documentElement.scrollLeft; if ( document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement ) for (; null !== n && n !== t;) (e += n.offsetLeft), (n = n.offsetParent); else for (; null !== n;) (e += n.offsetLeft), (n = n.offsetParent); return e - i; }, getBoundingClientRectViewLeft: function (t) { var e = window.scrollY || window.pageYOffset || document.body.scrollTop + ((document.documentElement && document.documentElement.scrollTop) || 0); if (t.getBoundingClientRect) { if ("number" != typeof this.getBoundingClientRectViewLeft.offset) { var n = document.createElement("div"); (n.style.cssText = "position:absolute;top:0;left:0;"), document.body.appendChild(n), (this.getBoundingClientRectViewLeft.offset = -n.getBoundingClientRect().top - e), document.body.removeChild(n), (n = null); } var i = t.getBoundingClientRect(), r = this.getBoundingClientRectViewLeft.offset; return i.left + r; } return this.getElementViewLeft(t); }, getScrollPosition: function () { return { left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0, top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0 }; }, setScrollPosition: function (t) { var e = t.left, n = void 0 === e ? 0 : e, i = t.top, r = void 0 === i ? 0 : i; this.isFirefox ? ((document.documentElement.scrollLeft = n), (document.documentElement.scrollTop = r)) : window.scrollTo(n, r); }, isMobile: D, isFirefox: /firefox/i.test(window.navigator.userAgent), isChrome: /chrome/i.test(window.navigator.userAgent), isSafari: /safari/i.test(window.navigator.userAgent), storage: { set: function (t, e) { localStorage.setItem(t, e); }, get: function (t) { return localStorage.getItem(t); } }, nameMap: { dragStart: D ? "touchstart" : "mousedown", dragMove: D ? "touchmove" : "mousemove", dragEnd: D ? "touchend" : "mouseup" }, color2Number: function (t) { return ( "#" === t[0] && (t = t.substr(1)), 3 === t.length && (t = "" .concat(t[0]) .concat(t[0]) .concat(t[1]) .concat(t[1]) .concat(t[2]) .concat(t[2])), (parseInt(t, 16) + 0) & 16777215 ); }, number2Color: function (t) { return "#" + ("00000" + t.toString(16)).slice(-6); }, number2Type: function (t) { switch (t) { case 0: default: return "right"; case 1: return "top"; case 2: return "bottom"; } } }; function P(t, e) { return function () { return t.apply(e, arguments); }; } function U(t) { return ( (U = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), U(t) ); } var F, O = Object.prototype.toString, M = Object.getPrototypeOf, N = ((F = Object.create(null)), function (t) { var e = O.call(t); return F[e] || (F[e] = e.slice(8, -1).toLowerCase()); }), z = function (t) { return ( (t = t.toLowerCase()), function (e) { return N(e) === t; } ); }, G = function (t) { return function (e) { return U(e) === t; }; }, j = Array.isArray, H = G("undefined"), Y = z("ArrayBuffer"), $ = G("string"), K = G("function"), q = G("number"), V = function (t) { return null !== t && "object" === U(t); }, W = function (t) { if ("object" !== N(t)) return !1; var e = M(t); return !( (null !== e && e !== Object.prototype && null !== Object.getPrototypeOf(e)) || Symbol.toStringTag in t || Symbol.iterator in t ); }, Q = z("Date"), X = z("File"), J = z("Blob"), Z = z("FileList"), tt = z("URLSearchParams"); function et(t, e) { var n, i, r = (arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}).allOwnKeys, a = void 0 !== r && r; if (null != t) if (("object" !== U(t) && (t = [t]), j(t))) for (n = 0, i = t.length; n < i; n++) e.call(null, t[n], n, t); else { var s, o = a ? Object.getOwnPropertyNames(t) : Object.keys(t), l = o.length; for (n = 0; n < l; n++) (s = o[n]), e.call(null, t[s], s, t); } } function nt(t, e) { e = e.toLowerCase(); for (var n, i = Object.keys(t), r = i.length; r-- > 0;) if (e === (n = i[r]).toLowerCase()) return n; return null; } var it, rt, at = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : T, st = function (t) { return !H(t) && t !== at; }, ot = ((it = "undefined" != typeof Uint8Array && M(Uint8Array)), function (t) { return it && t instanceof it; }), lt = z("HTMLFormElement"), dt = ((rt = Object.prototype.hasOwnProperty), function (t, e) { return rt.call(t, e); }), ct = z("RegExp"), ut = function (t, e) { var n = Object.getOwnPropertyDescriptors(t), i = {}; et(n, function (n, r) { !1 !== e(n, r, t) && (i[r] = n); }), Object.defineProperties(t, i); }, ht = { isArray: j, isArrayBuffer: Y, isBuffer: function (t) { return ( null !== t && !H(t) && null !== t.constructor && !H(t.constructor) && K(t.constructor.isBuffer) && t.constructor.isBuffer(t) ); }, isFormData: function (t) { var e = "[object FormData]"; return ( t && (("function" == typeof FormData && t instanceof FormData) || O.call(t) === e || (K(t.toString) && t.toString() === e)) ); }, isArrayBufferView: function (t) { return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(t) : t && t.buffer && Y(t.buffer); }, isString: $, isNumber: q, isBoolean: function (t) { return !0 === t || !1 === t; }, isObject: V, isPlainObject: W, isUndefined: H, isDate: Q, isFile: X, isBlob: J, isRegExp: ct, isFunction: K, isStream: function (t) { return V(t) && K(t.pipe); }, isURLSearchParams: tt, isTypedArray: ot, isFileList: Z, forEach: et, merge: function t() { for ( var e = ((st(this) && this) || {}).caseless, n = {}, i = function (i, r) { var a = (e && nt(n, r)) || r; W(n[a]) && W(i) ? (n[a] = t(n[a], i)) : W(i) ? (n[a] = t({}, i)) : j(i) ? (n[a] = i.slice()) : (n[a] = i); }, r = 0, a = arguments.length; r < a; r++ ) arguments[r] && et(arguments[r], i); return n; }, extend: function (t, e, n) { return ( et( e, function (e, i) { n && K(e) ? (t[i] = P(e, n)) : (t[i] = e); }, { allOwnKeys: (arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {}) .allOwnKeys } ), t ); }, trim: function (t) { return t.trim ? t.trim() : t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); }, stripBOM: function (t) { return 65279 === t.charCodeAt(0) && (t = t.slice(1)), t; }, inherits: function (t, e, n, i) { (t.prototype = Object.create(e.prototype, i)), (t.prototype.constructor = t), Object.defineProperty(t, "super", { value: e.prototype }), n && Object.assign(t.prototype, n); }, toFlatObject: function (t, e, n, i) { var r, a, s, o = {}; if (((e = e || {}), null == t)) return e; do { for (a = (r = Object.getOwnPropertyNames(t)).length; a-- > 0;) (s = r[a]), (i && !i(s, t, e)) || o[s] || ((e[s] = t[s]), (o[s] = !0)); t = !1 !== n && M(t); } while (t && (!n || n(t, e)) && t !== Object.prototype); return e; }, kindOf: N, kindOfTest: z, endsWith: function (t, e, n) { (t = String(t)), (void 0 === n || n > t.length) && (n = t.length), (n -= e.length); var i = t.indexOf(e, n); return -1 !== i && i === n; }, toArray: function (t) { if (!t) return null; if (j(t)) return t; var e = t.length; if (!q(e)) return null; for (var n = new Array(e); e-- > 0;) n[e] = t[e]; return n; }, forEachEntry: function (t, e) { for (var n, i = (t && t[Symbol.iterator]).call(t); (n = i.next()) && !n.done;) { var r = n.value; e.call(t, r[0], r[1]); } }, matchAll: function (t, e) { for (var n, i = []; null !== (n = t.exec(e));) i.push(n); return i; }, isHTMLForm: lt, hasOwnProperty: dt, hasOwnProp: dt, reduceDescriptors: ut, freezeMethods: function (t) { ut(t, function (e, n) { if (K(t) && -1 !== ["arguments", "caller", "callee"].indexOf(n)) return !1; var i = t[n]; K(i) && ((e.enumerable = !1), "writable" in e ? (e.writable = !1) : e.set || (e.set = function () { throw Error("Can not rewrite read-only method '" + n + "'"); })); }); }, toObjectSet: function (t, e) { var n = {}, i = function (t) { t.forEach(function (t) { n[t] = !0; }); }; return j(t) ? i(t) : i(String(t).split(e)), n; }, toCamelCase: function (t) { return t.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g, function (t, e, n) { return e.toUpperCase() + n; }); }, noop: function () { }, toFiniteNumber: function (t, e) { return (t = +t), Number.isFinite(t) ? t : e; }, findKey: nt, global: at, isContextDefined: st, toJSONObject: function (t) { var e = new Array(10); return (function t(n, i) { if (V(n)) { if (e.indexOf(n) >= 0) return; if (!("toJSON" in n)) { e[i] = n; var r = j(n) ? [] : {}; return ( et(n, function (e, n) { var a = t(e, i + 1); !H(a) && (r[n] = a); }), (e[i] = void 0), r ); } } return n; })(t, 0); } }; function pt(t, e, n, i, r) { Error.call(this), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : (this.stack = new Error().stack), (this.message = t), (this.name = "AxiosError"), e && (this.code = e), n && (this.config = n), i && (this.request = i), r && (this.response = r); } ht.inherits(pt, Error, { toJSON: function () { return { message: this.message, name: this.name, description: this.description, number: this.number, fileName: this.fileName, lineNumber: this.lineNumber, columnNumber: this.columnNumber, stack: this.stack, config: ht.toJSONObject(this.config), code: this.code, status: this.response && this.response.status ? this.response.status : null }; } }); var ft = pt.prototype, mt = {}; [ "ERR_BAD_OPTION_VALUE", "ERR_BAD_OPTION", "ECONNABORTED", "ETIMEDOUT", "ERR_NETWORK", "ERR_FR_TOO_MANY_REDIRECTS", "ERR_DEPRECATED", "ERR_BAD_RESPONSE", "ERR_BAD_REQUEST", "ERR_CANCELED", "ERR_NOT_SUPPORT", "ERR_INVALID_URL" ].forEach(function (t) { mt[t] = { value: t }; }), Object.defineProperties(pt, mt), Object.defineProperty(ft, "isAxiosError", { value: !0 }), (pt.from = function (t, e, n, i, r, a) { var s = Object.create(ft); return ( ht.toFlatObject( t, s, function (t) { return t !== Error.prototype; }, function (t) { return "isAxiosError" !== t; } ), pt.call(s, t.message, e, n, i, r), (s.cause = t), (s.name = t.name), a && Object.assign(s, a), s ); }); var gt = pt, yt = n(937); function At(t) { return ( (At = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), At(t) ); } function vt(t) { return ht.isPlainObject(t) || ht.isArray(t); } function bt(t) { return ht.endsWith(t, "[]") ? t.slice(0, -2) : t; } function Et(t, e, n) { return t ? t .concat(e) .map(function (t, e) { return (t = bt(t)), !n && e ? "[" + t + "]" : t; }) .join(n ? "." : "") : e; } var wt = ht.toFlatObject(ht, {}, null, function (t) { return /^is[A-Z]/.test(t); }), xt = function (t, e, n) { if (!ht.isObject(t)) throw new TypeError("target must be an object"); e = e || new (yt || FormData)(); var i, r = (n = ht.toFlatObject(n, { metaTokens: !0, dots: !1, indexes: !1 }, !1, function (t, e) { return !ht.isUndefined(e[t]); })).metaTokens, a = n.visitor || c, s = n.dots, o = n.indexes, l = (n.Blob || ("undefined" != typeof Blob && Blob)) && (i = e) && ht.isFunction(i.append) && "FormData" === i[Symbol.toStringTag] && i[Symbol.iterator]; if (!ht.isFunction(a)) throw new TypeError("visitor must be a function"); function d(t) { if (null === t) return ""; if (ht.isDate(t)) return t.toISOString(); if (!l && ht.isBlob(t)) throw new gt("Blob is not supported. Use a Buffer instead."); return ht.isArrayBuffer(t) || ht.isTypedArray(t) ? l && "function" == typeof Blob ? new Blob([t]) : Buffer.from(t) : t; } function c(t, n, i) { var a = t; if (t && !i && "object" === At(t)) if (ht.endsWith(n, "{}")) (n = r ? n : n.slice(0, -2)), (t = JSON.stringify(t)); else if ( (ht.isArray(t) && (function (t) { return ht.isArray(t) && !t.some(vt); })(t)) || ht.isFileList(t) || (ht.endsWith(n, "[]") && (a = ht.toArray(t))) ) return ( (n = bt(n)), a.forEach(function (t, i) { !ht.isUndefined(t) && null !== t && e.append(!0 === o ? Et([n], i, s) : null === o ? n : n + "[]", d(t)); }), !1 ); return !!vt(t) || (e.append(Et(i, n, s), d(t)), !1); } var u = [], h = Object.assign(wt, { defaultVisitor: c, convertValue: d, isVisitable: vt }); if (!ht.isObject(t)) throw new TypeError("data must be an object"); return ( (function t(n, i) { if (!ht.isUndefined(n)) { if (-1 !== u.indexOf(n)) throw Error("Circular reference detected in " + i.join(".")); u.push(n), ht.forEach(n, function (n, r) { !0 === (!(ht.isUndefined(n) || null === n) && a.call(e, n, ht.isString(r) ? r.trim() : r, i, h)) && t(n, i ? i.concat(r) : [r]); }), u.pop(); } })(t), e ); }; function St(t) { var e = { "!": "%21", "'": "%27", "(": "%28", ")": "%29", "~": "%7E", "%20": "+", "%00": "\0" }; return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g, function (t) { return e[t]; }); } function _t(t, e) { (this._pairs = []), t && xt(t, this, e); } var Tt = _t.prototype; (Tt.append = function (t, e) { this._pairs.push([t, e]); }), (Tt.toString = function (t) { var e = t ? function (e) { return t.call(this, e, St); } : St; return this._pairs .map(function (t) { return e(t[0]) + "=" + e(t[1]); }, "") .join("&"); }); var kt = _t; function Ct(t) { return encodeURIComponent(t) .replace(/%3A/gi, ":") .replace(/%24/g, "$") .replace(/%2C/gi, ",") .replace(/%20/g, "+") .replace(/%5B/gi, "[") .replace(/%5D/gi, "]"); } function Lt(t, e, n) { if (!e) return t; var i, r = (n && n.encode) || Ct, a = n && n.serialize; if ((i = a ? a(e, n) : ht.isURLSearchParams(e) ? e.toString() : new kt(e, n).toString(r))) { var s = t.indexOf("#"); -1 !== s && (t = t.slice(0, s)), (t += (-1 === t.indexOf("?") ? "?" : "&") + i); } return t; } function It(t) { return ( (It = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), It(t) ); } function Rt(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== It(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== It(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === It(r) ? r : String(r)), i ); } var r; } var Dt, Bt = (function () { function t() { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.handlers = []); } var e, n; return ( (e = t), (n = [ { key: "use", value: function (t, e, n) { return ( this.handlers.push({ fulfilled: t, rejected: e, synchronous: !!n && n.synchronous, runWhen: n ? n.runWhen : null }), this.handlers.length - 1 ); } }, { key: "eject", value: function (t) { this.handlers[t] && (this.handlers[t] = null); } }, { key: "clear", value: function () { this.handlers && (this.handlers = []); } }, { key: "forEach", value: function (t) { ht.forEach(this.handlers, function (e) { null !== e && t(e); }); } } ]), n && Rt(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Pt = Bt, Ut = { silentJSONParsing: !0, forcedJSONParsing: !0, clarifyTimeoutError: !1 }, Ft = "undefined" != typeof URLSearchParams ? URLSearchParams : kt, Ot = FormData, Mt = ("undefined" == typeof navigator || ("ReactNative" !== (Dt = navigator.product) && "NativeScript" !== Dt && "NS" !== Dt)) && "undefined" != typeof window && "undefined" != typeof document, Nt = "undefined" != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope && "function" == typeof self.importScripts, zt = { isBrowser: !0, classes: { URLSearchParams: Ft, FormData: Ot, Blob: Blob }, isStandardBrowserEnv: Mt, isStandardBrowserWebWorkerEnv: Nt, protocols: ["http", "https", "file", "blob", "url", "data"] }, Gt = function (t) { function e(t, n, i, r) { var a = t[r++], s = Number.isFinite(+a), o = r >= t.length; return ( (a = !a && ht.isArray(i) ? i.length : a), o ? (ht.hasOwnProp(i, a) ? (i[a] = [i[a], n]) : (i[a] = n), !s) : ((i[a] && ht.isObject(i[a])) || (i[a] = []), e(t, n, i[a], r) && ht.isArray(i[a]) && (i[a] = (function (t) { var e, n, i = {}, r = Object.keys(t), a = r.length; for (e = 0; e < a; e++) i[(n = r[e])] = t[n]; return i; })(i[a])), !s) ); } if (ht.isFormData(t) && ht.isFunction(t.entries)) { var n = {}; return ( ht.forEachEntry(t, function (t, i) { e( (function (t) { return ht.matchAll(/\w+|\[(\w*)]/g, t).map(function (t) { return "[]" === t[0] ? "" : t[1] || t[0]; }); })(t), i, n, 0 ); }), n ); } return null; }, jt = { "Content-Type": void 0 }, Ht = { transitional: Ut, adapter: ["xhr", "http"], transformRequest: [ function (t, e) { var n, i = e.getContentType() || "", r = i.indexOf("application/json") > -1, a = ht.isObject(t); if ((a && ht.isHTMLForm(t) && (t = new FormData(t)), ht.isFormData(t))) return r && r ? JSON.stringify(Gt(t)) : t; if ( ht.isArrayBuffer(t) || ht.isBuffer(t) || ht.isStream(t) || ht.isFile(t) || ht.isBlob(t) ) return t; if (ht.isArrayBufferView(t)) return t.buffer; if (ht.isURLSearchParams(t)) return ( e.setContentType("application/x-www-form-urlencoded;charset=utf-8", !1), t.toString() ); if (a) { if (i.indexOf("application/x-www-form-urlencoded") > -1) return (function (t, e) { return xt( t, new zt.classes.URLSearchParams(), Object.assign( { visitor: function (t, e, n, i) { return zt.isNode && ht.isBuffer(t) ? (this.append(e, t.toString("base64")), !1) : i.defaultVisitor.apply(this, arguments); } }, e ) ); })(t, this.formSerializer).toString(); if ((n = ht.isFileList(t)) || i.indexOf("multipart/form-data") > -1) { var s = this.env && this.env.FormData; return xt(n ? { "files[]": t } : t, s && new s(), this.formSerializer); } } return a || r ? (e.setContentType("application/json", !1), (function (t, e, n) { if (ht.isString(t)) try { return (0, JSON.parse)(t), ht.trim(t); } catch (t) { if ("SyntaxError" !== t.name) throw t; } return (0, JSON.stringify)(t); })(t)) : t; } ], transformResponse: [ function (t) { var e = this.transitional || Ht.transitional, n = e && e.forcedJSONParsing, i = "json" === this.responseType; if (t && ht.isString(t) && ((n && !this.responseType) || i)) { var r = !(e && e.silentJSONParsing) && i; try { return JSON.parse(t); } catch (t) { if (r) { if ("SyntaxError" === t.name) throw gt.from(t, gt.ERR_BAD_RESPONSE, this, null, this.response); throw t; } } } return t; } ], timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, maxBodyLength: -1, env: { FormData: zt.classes.FormData, Blob: zt.classes.Blob }, validateStatus: function (t) { return t >= 200 && t < 300; }, headers: { common: { Accept: "application/json, text/plain, */*" } } }; ht.forEach(["delete", "get", "head"], function (t) { Ht.headers[t] = {}; }), ht.forEach(["post", "put", "patch"], function (t) { Ht.headers[t] = ht.merge(jt); }); var Yt = Ht, $t = ht.toObjectSet([ "age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent" ]); function Kt(t) { return ( (Kt = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Kt(t) ); } function qt(t, e) { (null == e || e > t.length) && (e = t.length); for (var n = 0, i = new Array(e); n < e; n++) i[n] = t[n]; return i; } function Vt(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Kt(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Kt(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Kt(r) ? r : String(r)), i ); } var r; } var Wt = Symbol("internals"); function Qt(t) { return t && String(t).trim().toLowerCase(); } function Xt(t) { return !1 === t || null == t ? t : ht.isArray(t) ? t.map(Xt) : String(t); } function Jt(t, e, n, i) { return ht.isFunction(i) ? i.call(this, e, n) : ht.isString(e) ? ht.isString(i) ? -1 !== e.indexOf(i) : ht.isRegExp(i) ? i.test(e) : void 0 : void 0; } var Zt = (function (t, e) { function n(t) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, n), t && this.set(t); } var i, r, a; return ( (i = n), (r = [ { key: "set", value: function (t, e, n) { var i = this; function r(t, e, n) { var r = Qt(e); if (!r) throw new Error("header name must be a non-empty string"); var a = ht.findKey(i, r); (!a || void 0 === i[a] || !0 === n || (void 0 === n && !1 !== i[a])) && (i[a || e] = Xt(t)); } var a, s, o, l, d, c = function (t, e) { return ht.forEach(t, function (t, n) { return r(t, n, e); }); }; return ( ht.isPlainObject(t) || t instanceof this.constructor ? c(t, e) : ht.isString(t) && (t = t.trim()) && !/^[-_a-zA-Z]+$/.test(t.trim()) ? c( ((d = {}), (a = t) && a.split("\n").forEach(function (t) { (l = t.indexOf(":")), (s = t.substring(0, l).trim().toLowerCase()), (o = t.substring(l + 1).trim()), !s || (d[s] && $t[s]) || ("set-cookie" === s ? d[s] ? d[s].push(o) : (d[s] = [o]) : (d[s] = d[s] ? d[s] + ", " + o : o)); }), d), e ) : null != t && r(e, t, n), this ); } }, { key: "get", value: function (t, e) { if ((t = Qt(t))) { var n = ht.findKey(this, t); if (n) { var i = this[n]; if (!e) return i; if (!0 === e) return (function (t) { for ( var e, n = Object.create(null), i = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; (e = i.exec(t)); ) n[e[1]] = e[2]; return n; })(i); if (ht.isFunction(e)) return e.call(this, i, n); if (ht.isRegExp(e)) return e.exec(i); throw new TypeError("parser must be boolean|regexp|function"); } } } }, { key: "has", value: function (t, e) { if ((t = Qt(t))) { var n = ht.findKey(this, t); return !(!n || (e && !Jt(0, this[n], n, e))); } return !1; } }, { key: "delete", value: function (t, e) { var n = this, i = !1; function r(t) { if ((t = Qt(t))) { var r = ht.findKey(n, t); !r || (e && !Jt(0, n[r], r, e)) || (delete n[r], (i = !0)); } } return ht.isArray(t) ? t.forEach(r) : r(t), i; } }, { key: "clear", value: function () { return Object.keys(this).forEach(this.delete.bind(this)); } }, { key: "normalize", value: function (t) { var e = this, n = {}; return ( ht.forEach(this, function (i, r) { var a = ht.findKey(n, r); if (a) return (e[a] = Xt(i)), void delete e[r]; var s = t ? (function (t) { return t .trim() .toLowerCase() .replace(/([a-z\d])(\w*)/g, function (t, e, n) { return e.toUpperCase() + n; }); })(r) : String(r).trim(); s !== r && delete e[r], (e[s] = Xt(i)), (n[s] = !0); }), this ); } }, { key: "concat", value: function () { for (var t, e = arguments.length, n = new Array(e), i = 0; i < e; i++) n[i] = arguments[i]; return (t = this.constructor).concat.apply(t, [this].concat(n)); } }, { key: "toJSON", value: function (t) { var e = Object.create(null); return ( ht.forEach(this, function (n, i) { null != n && !1 !== n && (e[i] = t && ht.isArray(n) ? n.join(", ") : n); }), e ); } }, { key: Symbol.iterator, value: function () { return Object.entries(this.toJSON())[Symbol.iterator](); } }, { key: "toString", value: function () { return Object.entries(this.toJSON()) .map(function (t) { var e, n, i = ((n = 2), (function (t) { if (Array.isArray(t)) return t; })((e = t)) || (function (t, e) { var n = null == t ? null : ("undefined" != typeof Symbol && t[Symbol.iterator]) || t["@@iterator"]; if (null != n) { var i, r, a, s, o = [], l = !0, d = !1; try { if (((a = (n = n.call(t)).next), 0 === e)) { if (Object(n) !== n) return; l = !1; } else for ( ; !(l = (i = a.call(n)).done) && (o.push(i.value), o.length !== e); l = !0 ); } catch (t) { (d = !0), (r = t); } finally { try { if ( !l && null != n.return && ((s = n.return()), Object(s) !== s) ) return; } finally { if (d) throw r; } } return o; } })(e, n) || (function (t, e) { if (t) { if ("string" == typeof t) return qt(t, e); var n = Object.prototype.toString.call(t).slice(8, -1); return ( "Object" === n && t.constructor && (n = t.constructor.name), "Map" === n || "Set" === n ? Array.from(t) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test( n ) ? qt(t, e) : void 0 ); } })(e, n) || (function () { throw new TypeError( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ); })()); return i[0] + ": " + i[1]; }) .join("\n"); } }, { key: Symbol.toStringTag, get: function () { return "AxiosHeaders"; } } ]), (a = [ { key: "from", value: function (t) { return t instanceof this ? t : new this(t); } }, { key: "concat", value: function (t) { for ( var e = new this(t), n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++ ) i[r - 1] = arguments[r]; return ( i.forEach(function (t) { return e.set(t); }), e ); } }, { key: "accessor", value: function (t) { var e = (this[Wt] = this[Wt] = { accessors: {} }).accessors, n = this.prototype; function i(t) { var i = Qt(t); e[i] || ((function (t, e) { var n = ht.toCamelCase(" " + e); ["get", "set", "has"].forEach(function (i) { Object.defineProperty(t, i + n, { value: function (t, n, r) { return this[i].call(this, e, t, n, r); }, configurable: !0 }); }); })(n, t), (e[i] = !0)); } return ht.isArray(t) ? t.forEach(i) : i(t), this; } } ]), r && Vt(i.prototype, r), a && Vt(i, a), Object.defineProperty(i, "prototype", { writable: !1 }), n ); })(); Zt.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent"]), ht.freezeMethods(Zt.prototype), ht.freezeMethods(Zt); var te = Zt; function ee(t, e) { var n = this || Yt, i = e || n, r = te.from(i.headers), a = i.data; return ( ht.forEach(t, function (t) { a = t.call(n, a, r.normalize(), e ? e.status : void 0); }), r.normalize(), a ); } function ne(t) { return !(!t || !t.__CANCEL__); } function ie(t, e, n) { gt.call(this, null == t ? "canceled" : t, gt.ERR_CANCELED, e, n), (this.name = "CanceledError"); } ht.inherits(ie, gt, { __CANCEL__: !0 }); var re = ie, ae = zt.isStandardBrowserEnv ? { write: function (t, e, n, i, r, a) { var s = []; s.push(t + "=" + encodeURIComponent(e)), ht.isNumber(n) && s.push("expires=" + new Date(n).toGMTString()), ht.isString(i) && s.push("path=" + i), ht.isString(r) && s.push("domain=" + r), !0 === a && s.push("secure"), (document.cookie = s.join("; ")); }, read: function (t) { var e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)")); return e ? decodeURIComponent(e[3]) : null; }, remove: function (t) { this.write(t, "", Date.now() - 864e5); } } : { write: function () { }, read: function () { return null; }, remove: function () { } }; function se(t, e) { return t && !/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e) ? (function (t, e) { return e ? t.replace(/\/+$/, "") + "/" + e.replace(/^\/+/, "") : t; })(t, e) : e; } var oe = zt.isStandardBrowserEnv ? (function () { var t, e = /(msie|trident)/i.test(navigator.userAgent), n = document.createElement("a"); function i(t) { var i = t; return ( e && (n.setAttribute("href", i), (i = n.href)), n.setAttribute("href", i), { href: n.href, protocol: n.protocol ? n.protocol.replace(/:$/, "") : "", host: n.host, search: n.search ? n.search.replace(/^\?/, "") : "", hash: n.hash ? n.hash.replace(/^#/, "") : "", hostname: n.hostname, port: n.port, pathname: "/" === n.pathname.charAt(0) ? n.pathname : "/" + n.pathname } ); } return ( (t = i(window.location.href)), function (e) { var n = ht.isString(e) ? i(e) : e; return n.protocol === t.protocol && n.host === t.host; } ); })() : function () { return !0; }; function le(t, e) { var n = 0, i = (function (t, e) { t = t || 10; var n, i = new Array(t), r = new Array(t), a = 0, s = 0; return ( (e = void 0 !== e ? e : 1e3), function (o) { var l = Date.now(), d = r[s]; n || (n = l), (i[a] = o), (r[a] = l); for (var c = s, u = 0; c !== a;) (u += i[c++]), (c %= t); if (((a = (a + 1) % t) === s && (s = (s + 1) % t), !(l - n < e))) { var h = d && l - d; return h ? Math.round((1e3 * u) / h) : void 0; } } ); })(50, 250); return function (r) { var a = r.loaded, s = r.lengthComputable ? r.total : void 0, o = a - n, l = i(o); n = a; var d = { loaded: a, total: s, progress: s ? a / s : void 0, bytes: o, rate: l || void 0, estimated: l && s && a <= s ? (s - a) / l : void 0, event: r }; (d[e ? "download" : "upload"] = !0), t(d); }; } var de = "undefined" != typeof XMLHttpRequest && function (t) { return new Promise(function (e, n) { var i, r = t.data, a = te.from(t.headers).normalize(), s = t.responseType; function o() { t.cancelToken && t.cancelToken.unsubscribe(i), t.signal && t.signal.removeEventListener("abort", i); } ht.isFormData(r) && (zt.isStandardBrowserEnv || zt.isStandardBrowserWebWorkerEnv) && a.setContentType(!1); var l = new XMLHttpRequest(); if (t.auth) { var d = t.auth.username || "", c = t.auth.password ? unescape(encodeURIComponent(t.auth.password)) : ""; a.set("Authorization", "Basic " + btoa(d + ":" + c)); } var u = se(t.baseURL, t.url); function h() { if (l) { var i = te.from("getAllResponseHeaders" in l && l.getAllResponseHeaders()); !(function (t, e, n) { var i = n.config.validateStatus; n.status && i && !i(n.status) ? e( new gt( "Request failed with status code " + n.status, [gt.ERR_BAD_REQUEST, gt.ERR_BAD_RESPONSE][ Math.floor(n.status / 100) - 4 ], n.config, n.request, n ) ) : t(n); })( function (t) { e(t), o(); }, function (t) { n(t), o(); }, { data: s && "text" !== s && "json" !== s ? l.response : l.responseText, status: l.status, statusText: l.statusText, headers: i, config: t, request: l } ), (l = null); } } if ( (l.open(t.method.toUpperCase(), Lt(u, t.params, t.paramsSerializer), !0), (l.timeout = t.timeout), "onloadend" in l ? (l.onloadend = h) : (l.onreadystatechange = function () { l && 4 === l.readyState && (0 !== l.status || (l.responseURL && 0 === l.responseURL.indexOf("file:"))) && setTimeout(h); }), (l.onabort = function () { l && (n(new gt("Request aborted", gt.ECONNABORTED, t, l)), (l = null)); }), (l.onerror = function () { n(new gt("Network Error", gt.ERR_NETWORK, t, l)), (l = null); }), (l.ontimeout = function () { var e = t.timeout ? "timeout of " + t.timeout + "ms exceeded" : "timeout exceeded", i = t.transitional || Ut; t.timeoutErrorMessage && (e = t.timeoutErrorMessage), n(new gt(e, i.clarifyTimeoutError ? gt.ETIMEDOUT : gt.ECONNABORTED, t, l)), (l = null); }), zt.isStandardBrowserEnv) ) { var p = (t.withCredentials || oe(u)) && t.xsrfCookieName && ae.read(t.xsrfCookieName); p && a.set(t.xsrfHeaderName, p); } void 0 === r && a.setContentType(null), "setRequestHeader" in l && ht.forEach(a.toJSON(), function (t, e) { l.setRequestHeader(e, t); }), ht.isUndefined(t.withCredentials) || (l.withCredentials = !!t.withCredentials), s && "json" !== s && (l.responseType = t.responseType), "function" == typeof t.onDownloadProgress && l.addEventListener("progress", le(t.onDownloadProgress, !0)), "function" == typeof t.onUploadProgress && l.upload && l.upload.addEventListener("progress", le(t.onUploadProgress)), (t.cancelToken || t.signal) && ((i = function (e) { l && (n(!e || e.type ? new re(null, t, l) : e), l.abort(), (l = null)); }), t.cancelToken && t.cancelToken.subscribe(i), t.signal && (t.signal.aborted ? i() : t.signal.addEventListener("abort", i))); var f, m = ((f = /^([-+\w]{1,25})(:?\/\/|:)/.exec(u)) && f[1]) || ""; m && -1 === zt.protocols.indexOf(m) ? n(new gt("Unsupported protocol " + m + ":", gt.ERR_BAD_REQUEST, t)) : l.send(r || null); }); }, ce = { http: null, xhr: de }; function ue(t) { if ((t.cancelToken && t.cancelToken.throwIfRequested(), t.signal && t.signal.aborted)) throw new re(null, t); } function he(t) { return ( ue(t), (t.headers = te.from(t.headers)), (t.data = ee.call(t, t.transformRequest)), -1 !== ["post", "put", "patch"].indexOf(t.method) && t.headers.setContentType("application/x-www-form-urlencoded", !1), (function (t) { for ( var e, n, i = (t = ht.isArray(t) ? t : [t]).length, r = 0; r < i && ((e = t[r]), !(n = ht.isString(e) ? ce[e.toLowerCase()] : e)); r++ ); if (!n) { if (!1 === n) throw new gt( "Adapter ".concat(e, " is not supported by the environment"), "ERR_NOT_SUPPORT" ); throw new Error( ht.hasOwnProp(ce, e) ? "Adapter '".concat(e, "' is not available in the build") : "Unknown adapter '".concat(e, "'") ); } if (!ht.isFunction(n)) throw new TypeError("adapter is not a function"); return n; })(t.adapter || Yt.adapter)(t).then( function (e) { return ( ue(t), (e.data = ee.call(t, t.transformResponse, e)), (e.headers = te.from(e.headers)), e ); }, function (e) { return ( ne(e) || (ue(t), e && e.response && ((e.response.data = ee.call(t, t.transformResponse, e.response)), (e.response.headers = te.from(e.response.headers)))), Promise.reject(e) ); } ) ); } ht.forEach(ce, function (t, e) { if (t) { try { Object.defineProperty(t, "name", { value: e }); } catch (t) { } Object.defineProperty(t, "adapterName", { value: e }); } }); var pe = function (t) { return t instanceof te ? t.toJSON() : t; }; function fe(t, e) { e = e || {}; var n = {}; function i(t, e, n) { return ht.isPlainObject(t) && ht.isPlainObject(e) ? ht.merge.call({ caseless: n }, t, e) : ht.isPlainObject(e) ? ht.merge({}, e) : ht.isArray(e) ? e.slice() : e; } function r(t, e, n) { return ht.isUndefined(e) ? (ht.isUndefined(t) ? void 0 : i(void 0, t, n)) : i(t, e, n); } function a(t, e) { if (!ht.isUndefined(e)) return i(void 0, e); } function s(t, e) { return ht.isUndefined(e) ? (ht.isUndefined(t) ? void 0 : i(void 0, t)) : i(void 0, e); } function o(n, r, a) { return a in e ? i(n, r) : a in t ? i(void 0, n) : void 0; } var l = { url: a, method: a, data: a, baseURL: s, transformRequest: s, transformResponse: s, paramsSerializer: s, timeout: s, timeoutMessage: s, withCredentials: s, adapter: s, responseType: s, xsrfCookieName: s, xsrfHeaderName: s, onUploadProgress: s, onDownloadProgress: s, decompress: s, maxContentLength: s, maxBodyLength: s, beforeRedirect: s, transport: s, httpAgent: s, httpsAgent: s, cancelToken: s, socketPath: s, responseEncoding: s, validateStatus: o, headers: function (t, e) { return r(pe(t), pe(e), !0); } }; return ( ht.forEach(Object.keys(t).concat(Object.keys(e)), function (i) { var a = l[i] || r, s = a(t[i], e[i], i); (ht.isUndefined(s) && a !== o) || (n[i] = s); }), n ); } function me(t) { return ( (me = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), me(t) ); } var ge = {}; ["object", "boolean", "number", "function", "string", "symbol"].forEach(function (t, e) { ge[t] = function (n) { return me(n) === t || "a" + (e < 1 ? "n " : " ") + t; }; }); var ye = {}; ge.transitional = function (t, e, n) { function i(t, e) { return "[Axios v1.2.3] Transitional option '" + t + "'" + e + (n ? ". " + n : ""); } return function (n, r, a) { if (!1 === t) throw new gt(i(r, " has been removed" + (e ? " in " + e : "")), gt.ERR_DEPRECATED); return ( e && !ye[r] && ((ye[r] = !0), console.warn( i(r, " has been deprecated since v" + e + " and will be removed in the near future") )), !t || t(n, r, a) ); }; }; var Ae = { assertOptions: function (t, e, n) { if ("object" !== me(t)) throw new gt("options must be an object", gt.ERR_BAD_OPTION_VALUE); for (var i = Object.keys(t), r = i.length; r-- > 0;) { var a = i[r], s = e[a]; if (s) { var o = t[a], l = void 0 === o || s(o, a, t); if (!0 !== l) throw new gt("option " + a + " must be " + l, gt.ERR_BAD_OPTION_VALUE); } else if (!0 !== n) throw new gt("Unknown option " + a, gt.ERR_BAD_OPTION); } }, validators: ge }; function ve(t) { return ( (ve = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), ve(t) ); } function be(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== ve(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== ve(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === ve(r) ? r : String(r)), i ); } var r; } var Ee = Ae.validators, we = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.defaults = e), (this.interceptors = { request: new Pt(), response: new Pt() }); } var e, n; return ( (e = t), (n = [ { key: "request", value: function (t, e) { "string" == typeof t ? ((e = e || {}).url = t) : (e = t || {}); var n, i = (e = fe(this.defaults, e)), r = i.transitional, a = i.paramsSerializer, s = i.headers; void 0 !== r && Ae.assertOptions( r, { silentJSONParsing: Ee.transitional(Ee.boolean), forcedJSONParsing: Ee.transitional(Ee.boolean), clarifyTimeoutError: Ee.transitional(Ee.boolean) }, !1 ), void 0 !== a && Ae.assertOptions(a, { encode: Ee.function, serialize: Ee.function }, !0), (e.method = (e.method || this.defaults.method || "get").toLowerCase()), (n = s && ht.merge(s.common, s[e.method])) && ht.forEach( ["delete", "get", "head", "post", "put", "patch", "common"], function (t) { delete s[t]; } ), (e.headers = te.concat(n, s)); var o = [], l = !0; this.interceptors.request.forEach(function (t) { ("function" == typeof t.runWhen && !1 === t.runWhen(e)) || ((l = l && t.synchronous), o.unshift(t.fulfilled, t.rejected)); }); var d, c = []; this.interceptors.response.forEach(function (t) { c.push(t.fulfilled, t.rejected); }); var u, h = 0; if (!l) { var p = [he.bind(this), void 0]; for ( p.unshift.apply(p, o), p.push.apply(p, c), u = p.length, d = Promise.resolve(e); h < u; ) d = d.then(p[h++], p[h++]); return d; } u = o.length; var f = e; for (h = 0; h < u;) { var m = o[h++], g = o[h++]; try { f = m(f); } catch (t) { g.call(this, t); break; } } try { d = he.call(this, f); } catch (t) { return Promise.reject(t); } for (h = 0, u = c.length; h < u;) d = d.then(c[h++], c[h++]); return d; } }, { key: "getUri", value: function (t) { return Lt( se((t = fe(this.defaults, t)).baseURL, t.url), t.params, t.paramsSerializer ); } } ]) && be(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(); ht.forEach(["delete", "get", "head", "options"], function (t) { we.prototype[t] = function (e, n) { return this.request(fe(n || {}, { method: t, url: e, data: (n || {}).data })); }; }), ht.forEach(["post", "put", "patch"], function (t) { function e(e) { return function (n, i, r) { return this.request( fe(r || {}, { method: t, headers: e ? { "Content-Type": "multipart/form-data" } : {}, url: n, data: i }) ); }; } (we.prototype[t] = e()), (we.prototype[t + "Form"] = e(!0)); }); var xe = we; function Se(t) { return ( (Se = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Se(t) ); } function _e(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Se(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Se(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Se(r) ? r : String(r)), i ); } var r; } var Te = (function () { function t(e) { if ( ((function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), "function" != typeof e) ) throw new TypeError("executor must be a function."); var n; this.promise = new Promise(function (t) { n = t; }); var i = this; this.promise.then(function (t) { if (i._listeners) { for (var e = i._listeners.length; e-- > 0;) i._listeners[e](t); i._listeners = null; } }), (this.promise.then = function (t) { var e, n = new Promise(function (t) { i.subscribe(t), (e = t); }).then(t); return ( (n.cancel = function () { i.unsubscribe(e); }), n ); }), e(function (t, e, r) { i.reason || ((i.reason = new re(t, e, r)), n(i.reason)); }); } var e, n, i; return ( (e = t), (n = [ { key: "throwIfRequested", value: function () { if (this.reason) throw this.reason; } }, { key: "subscribe", value: function (t) { this.reason ? t(this.reason) : this._listeners ? this._listeners.push(t) : (this._listeners = [t]); } }, { key: "unsubscribe", value: function (t) { if (this._listeners) { var e = this._listeners.indexOf(t); -1 !== e && this._listeners.splice(e, 1); } } } ]), (i = [ { key: "source", value: function () { var e; return { token: new t(function (t) { e = t; }), cancel: e }; } } ]), n && _e(e.prototype, n), i && _e(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), ke = Te; function Ce(t, e) { (null == e || e > t.length) && (e = t.length); for (var n = 0, i = new Array(e); n < e; n++) i[n] = t[n]; return i; } var Le = { Continue: 100, SwitchingProtocols: 101, Processing: 102, EarlyHints: 103, Ok: 200, Created: 201, Accepted: 202, NonAuthoritativeInformation: 203, NoContent: 204, ResetContent: 205, PartialContent: 206, MultiStatus: 207, AlreadyReported: 208, ImUsed: 226, MultipleChoices: 300, MovedPermanently: 301, Found: 302, SeeOther: 303, NotModified: 304, UseProxy: 305, Unused: 306, TemporaryRedirect: 307, PermanentRedirect: 308, BadRequest: 400, Unauthorized: 401, PaymentRequired: 402, Forbidden: 403, NotFound: 404, MethodNotAllowed: 405, NotAcceptable: 406, ProxyAuthenticationRequired: 407, RequestTimeout: 408, Conflict: 409, Gone: 410, LengthRequired: 411, PreconditionFailed: 412, PayloadTooLarge: 413, UriTooLong: 414, UnsupportedMediaType: 415, RangeNotSatisfiable: 416, ExpectationFailed: 417, ImATeapot: 418, MisdirectedRequest: 421, UnprocessableEntity: 422, Locked: 423, FailedDependency: 424, TooEarly: 425, UpgradeRequired: 426, PreconditionRequired: 428, TooManyRequests: 429, RequestHeaderFieldsTooLarge: 431, UnavailableForLegalReasons: 451, InternalServerError: 500, NotImplemented: 501, BadGateway: 502, ServiceUnavailable: 503, GatewayTimeout: 504, HttpVersionNotSupported: 505, VariantAlsoNegotiates: 506, InsufficientStorage: 507, LoopDetected: 508, NotExtended: 510, NetworkAuthenticationRequired: 511 }; Object.entries(Le).forEach(function (t) { var e, n, i = ((n = 2), (function (t) { if (Array.isArray(t)) return t; })((e = t)) || (function (t, e) { var n = null == t ? null : ("undefined" != typeof Symbol && t[Symbol.iterator]) || t["@@iterator"]; if (null != n) { var i, r, a, s, o = [], l = !0, d = !1; try { if (((a = (n = n.call(t)).next), 0 === e)) { if (Object(n) !== n) return; l = !1; } else for ( ; !(l = (i = a.call(n)).done) && (o.push(i.value), o.length !== e); l = !0 ); } catch (t) { (d = !0), (r = t); } finally { try { if (!l && null != n.return && ((s = n.return()), Object(s) !== s)) return; } finally { if (d) throw r; } } return o; } })(e, n) || (function (t, e) { if (t) { if ("string" == typeof t) return Ce(t, e); var n = Object.prototype.toString.call(t).slice(8, -1); return ( "Object" === n && t.constructor && (n = t.constructor.name), "Map" === n || "Set" === n ? Array.from(t) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Ce(t, e) : void 0 ); } })(e, n) || (function () { throw new TypeError( "Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ); })()), r = i[0], a = i[1]; Le[a] = r; }); var Ie = Le, Re = (function t(e) { var n = new xe(e), i = P(xe.prototype.request, n); return ( ht.extend(i, xe.prototype, n, { allOwnKeys: !0 }), ht.extend(i, n, null, { allOwnKeys: !0 }), (i.create = function (n) { return t(fe(e, n)); }), i ); })(Yt); (Re.Axios = xe), (Re.CanceledError = re), (Re.CancelToken = ke), (Re.isCancel = ne), (Re.VERSION = "1.2.3"), (Re.toFormData = xt), (Re.AxiosError = gt), (Re.Cancel = Re.CanceledError), (Re.all = function (t) { return Promise.all(t); }), (Re.spread = function (t) { return function (e) { return t.apply(null, e); }; }), (Re.isAxiosError = function (t) { return ht.isObject(t) && !0 === t.isAxiosError; }), (Re.mergeConfig = fe), (Re.AxiosHeaders = te), (Re.formToJSON = function (t) { return Gt(ht.isHTMLForm(t) ? new FormData(t) : t); }), (Re.HttpStatusCode = Ie), (Re.default = Re); var De = Re, Be = { send: function (t) { De.post(t.url, t.data) .then(function (e) { var n = e.data; n && 0 === n.code ? t.success && t.success(n) : t.error && t.error(n && n.msg); }) .catch(function (e) { console.error(e), t.error && t.error(); }); }, read: function (t) { De.get(t.url) .then(function (e) { var n = e.data; n && 0 === n.code ? t.success && t.success( n.data.map(function (t) { return { time: t[0], type: t[1], color: t[2], author: t[3], text: t[4] }; }) ) : t.error && t.error(n && n.msg); }) .catch(function (e) { console.error(e), t.error && t.error(); }); } }; function Pe(t) { return ( (Pe = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Pe(t) ); } function Ue(t) { var e = this; (this.lang = t), (this.fallbackLang = this.lang.includes("-") ? this.lang.split("-")[0] : this.lang), (this.tran = function (t) { return ( (t = t.toLowerCase()), Oe[e.lang] && Oe[e.lang][t] ? Oe[e.lang][t] : Oe[e.fallbackLang] && Oe[e.fallbackLang][t] ? Oe[e.fallbackLang][t] : Fe[t] ? Fe[t] : t ); }); } var Fe = { "danmaku-loading": "Danmaku is loading", top: "Top", bottom: "Bottom", rolling: "Rolling", "input-danmaku-enter": "Input danmaku, hit Enter", "about-author": "About author", "dplayer-feedback": "DPlayer feedback", "about-dplayer": "About DPlayer", loop: "Loop", speed: "Speed", "opacity-danmaku": "Opacity for danmaku", normal: "Normal", "please-input-danmaku": "Please input danmaku content!", "set-danmaku-color": "Set danmaku color", "set-danmaku-type": "Set danmaku type", "show-danmaku": "Show danmaku", "video-failed": "Video load failed", "danmaku-failed": "Danmaku load failed", "danmaku-send-failed": "Danmaku send failed", "switching-quality": "Switching to %q quality", "switched-quality": "Switched to %q quality", ff: "FF %s s", rew: "REW %s s", "unlimited-danmaku": "Unlimited danmaku", "send-danmaku": "Send danmaku", setting: "Setting", fullscreen: "Full screen", "web-fullscreen": "Web full screen", send: "Send", screenshot: "Screenshot", airplay: "AirPlay", chromecast: "ChromeCast", subtitle: "Subtitle", off: "Off", "show-subs": "Show subtitle", "hide-subs": "Hide subtitle", volume: "Volume", live: "Live", "video-info": "Video info" }, Oe = { en: Fe, "zh-cn": { "danmaku-loading": "弹幕加载中", top: "顶部", bottom: "底部", rolling: "滚动", "input-danmaku-enter": "输入弹幕,回车发送", "about-author": "关于作者", "dplayer-feedback": "播放器意见反馈", "about-dplayer": "关于 DPlayer 播放器", loop: "洗脑循环", speed: "速度", "opacity-danmaku": "弹幕透明度", normal: "正常", "please-input-danmaku": "要输入弹幕内容啊喂!", "set-danmaku-color": "设置弹幕颜色", "set-danmaku-type": "设置弹幕类型", "show-danmaku": "显示弹幕", "video-failed": "视频加载失败", "danmaku-failed": "弹幕加载失败", "danmaku-send-failed": "弹幕发送失败", "switching-quality": "正在切换至 %q 画质", "switched-quality": "已经切换至 %q 画质", ff: "快进 %s 秒", rew: "快退 %s 秒", "unlimited-danmaku": "海量弹幕", "send-danmaku": "发送弹幕", setting: "设置", fullscreen: "全屏", "web-fullscreen": "页面全屏", send: "发送", screenshot: "截图", airplay: "无线投屏", chromecast: "ChromeCast", subtitle: "字幕", off: "关闭", "show-subs": "显示字幕", "hide-subs": "隐藏字幕", volume: "音量", live: "直播", "video-info": "视频统计信息" }, "zh-tw": { "danmaku-loading": "彈幕載入中", top: "頂部", bottom: "底部", rolling: "滾動", "input-danmaku-enter": "輸入彈幕,Enter 發送", "about-author": "關於作者", "dplayer-feedback": "播放器意見回饋", "about-dplayer": "關於 DPlayer 播放器", loop: "循環播放", speed: "速度", "opacity-danmaku": "彈幕透明度", normal: "正常", "please-input-danmaku": "請輸入彈幕內容啊!", "set-danmaku-color": "設定彈幕顏色", "set-danmaku-type": "設定彈幕類型", "show-danmaku": "顯示彈幕", "video-failed": "影片載入失敗", "danmaku-failed": "彈幕載入失敗", "danmaku-send-failed": "彈幕發送失敗", "switching-quality": "正在切換至 %q 畫質", "switched-quality": "已經切換至 %q 畫質", ff: "快進 %s 秒", rew: "快退 %s 秒", "unlimited-danmaku": "巨量彈幕", "send-danmaku": "發送彈幕", setting: "設定", fullscreen: "全螢幕", "web-fullscreen": "頁面全螢幕", send: "發送", screenshot: "截圖", airplay: "無線投屏", chromecast: "ChromeCast", subtitle: "字幕", off: "關閉", "show-subs": "顯示字幕", "hide-subs": "隱藏字幕", volume: "音量", live: "直播", "video-info": "影片統計訊息" }, "ko-kr": { "danmaku-loading": "Danmaku를 불러오는 중입니다.", top: "Top", bottom: "Bottom", rolling: "Rolling", "input-danmaku-enter": "Danmaku를 입력하고 Enter를 누르세요.", "about-author": "만든이", "dplayer-feedback": "피드백 보내기", "about-dplayer": "DPlayer 정보", loop: "반복", speed: "배속", "opacity-danmaku": "Danmaku 불투명도", normal: "표준", "please-input-danmaku": "Danmaku를 입력하세요!", "set-danmaku-color": "Danmaku 색상", "set-danmaku-type": "Danmaku 설정", "show-danmaku": "Danmaku 표시", "video-failed": "비디오를 불러오지 못했습니다.", "danmaku-failed": "Danmaku를 불러오지 못했습니다.", "danmaku-send-failed": "Danmaku 전송에 실패했습니다.", "Switching to": "", "Switched to": "", "switching-quality": "전환 %q 화질", "switched-quality": "전환 됨 %q 화질", ff: "앞으로 %s 초", rew: "뒤로 %s 초", "unlimited-danmaku": "끝없는 Danmaku", "send-danmaku": "Danmaku 보내기", setting: "설정", fullscreen: "전체 화면", "web-fullscreen": "웹 내 전체화면", send: "보내기", screenshot: "화면 캡쳐", airplay: "에어플레이", chromecast: "ChromeCast", subtitle: "부제", off: "끄다", "show-subs": "자막 보이기", "hide-subs": "자막 숨기기", Volume: "볼륨", live: "생방송", "video-info": "비디오 정보" }, de: { "danmaku-loading": "Danmaku lädt...", top: "Oben", bottom: "Unten", rolling: "Rollend", "input-danmaku-enter": "Drücke Enter nach dem Einfügen vom Danmaku", "about-author": "Über den Autor", "dplayer-feedback": "DPlayer Feedback", "about-dplayer": "Über DPlayer", loop: "Wiederholen", speed: "Geschwindigkeit", "opacity-danmaku": "Transparenz für Danmaku", normal: "Normal", "please-input-danmaku": "Bitte Danmaku Inhalt eingeben!", "set-danmaku-color": "Danmaku Farbe festlegen", "set-danmaku-type": "Danmaku Typ festlegen", "show-danmaku": "Zeige Danmaku", "video-failed": "Das Video konnte nicht geladen werden", "danmaku-failed": "Danmaku konnte nicht geladen werden", "danmaku-send-failed": "Das senden von Danmaku ist fehgeschlagen", "switching-quality": "Wechsle zur %q Qualität", "switched-quality": "Zur %q Qualität gewechselt", ff: "%s s Vorwärts", rew: "%s s Zurück", "unlimited-danmaku": "Unlimitiertes Danmaku", "send-danmaku": "Sende Danmaku", setting: "Einstellungen", fullscreen: "Vollbild", "web-fullscreen": "Browser Vollbild", send: "Senden", screenshot: "Screenshot", airplay: "AirPlay", "show-subs": "Zeige Untertitel", chromecast: "ChromeCast", subtitle: "Untertitel", off: "Schließung", "hide-subs": "Verstecke Untertitel", volume: "Lautstärke", live: "Live", "video-info": "Video Info" } }, Me = n(730), Ne = n.n(Me), ze = n(74), Ge = n.n(ze), je = n(437), He = n.n(je), Ye = n(644), $e = n.n(Ye), Ke = n(324), qe = n.n(Ke), Ve = n(574), We = n.n(Ve), Qe = n(300), Xe = n.n(Qe), Je = n(934), Ze = n.n(Je), tn = n(428), en = n.n(tn), nn = n(807), rn = n.n(nn), an = n(338), sn = n.n(an), on = n(254), ln = n.n(on), dn = n(965), cn = n.n(dn), un = n(113), hn = n.n(un), pn = n(251), fn = n.n(pn), mn = n(410), gn = n.n(mn), yn = n(182), An = n.n(yn), vn = n(193), bn = n.n(vn), En = { play: Ne(), pause: Ge(), volumeUp: He(), volumeDown: $e(), volumeOff: qe(), full: We(), fullWeb: Xe(), setting: Ze(), right: en(), comment: rn(), commentOff: sn(), send: ln(), pallette: cn(), camera: hn(), subtitle: gn(), loading: An(), airplay: fn(), chromecast: bn() }, wn = n(916), xn = n.n(wn); function Sn(t) { return ( (Sn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Sn(t) ); } function _n(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Sn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Sn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Sn(r) ? r : String(r)), i ); } var r; } var Tn = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.container = e.container), (this.options = e.options), (this.index = e.index), (this.tran = e.tran), this.init(); } var e, n, i; return ( (e = t), (i = [ { key: "NewNotice", value: function (t, e, n) { var i = document.createElement("div"); return ( i.classList.add("dplayer-notice"), (i.style.opacity = e), (i.innerText = t), n && (i.id = "dplayer-notice-".concat(n)), i ); } } ]), (n = [ { key: "init", value: function () { (this.container.innerHTML = xn()({ options: this.options, index: this.index, tran: this.tran, icons: En, mobile: B.isMobile, video: { current: !0, pic: this.options.video.pic, screenshot: this.options.screenshot, airplay: !(!B.isSafari || B.isChrome) && this.options.airplay, chromecast: this.options.chromecast, preload: this.options.preload, url: this.options.video.url, subtitle: this.options.subtitle } })), (this.volumeBar = this.container.querySelector(".dplayer-volume-bar-inner")), (this.volumeBarWrap = this.container.querySelector(".dplayer-volume-bar")), (this.volumeBarWrapWrap = this.container.querySelector(".dplayer-volume-bar-wrap")), (this.volumeButton = this.container.querySelector(".dplayer-volume")), (this.volumeButtonIcon = this.container.querySelector(".dplayer-volume-icon")), (this.volumeIcon = this.container.querySelector( ".dplayer-volume-icon .dplayer-icon-content" )), (this.playedBar = this.container.querySelector(".dplayer-played")), (this.loadedBar = this.container.querySelector(".dplayer-loaded")), (this.playedBarWrap = this.container.querySelector(".dplayer-bar-wrap")), (this.playedBarTime = this.container.querySelector(".dplayer-bar-time")), (this.danmaku = this.container.querySelector(".dplayer-danmaku")), (this.danmakuLoading = this.container.querySelector(".dplayer-danloading")), (this.video = this.container.querySelector(".dplayer-video-current")), (this.bezel = this.container.querySelector(".dplayer-bezel-icon")), (this.playButton = this.container.querySelector(".dplayer-play-icon")), (this.mobilePlayButton = this.container.querySelector(".dplayer-mobile-play")), (this.videoWrap = this.container.querySelector(".dplayer-video-wrap")), (this.controllerMask = this.container.querySelector(".dplayer-controller-mask")), (this.ptime = this.container.querySelector(".dplayer-ptime")), (this.settingButton = this.container.querySelector(".dplayer-setting-icon")), (this.settingBox = this.container.querySelector(".dplayer-setting-box")), (this.mask = this.container.querySelector(".dplayer-mask")), (this.loop = this.container.querySelector(".dplayer-setting-loop")), (this.loopToggle = this.container.querySelector( ".dplayer-setting-loop .dplayer-toggle-setting-input" )), (this.showDanmaku = this.container.querySelector(".dplayer-setting-showdan")), (this.showDanmakuToggle = this.container.querySelector(".dplayer-showdan-setting-input")), (this.unlimitDanmaku = this.container.querySelector(".dplayer-setting-danunlimit")), (this.unlimitDanmakuToggle = this.container.querySelector( ".dplayer-danunlimit-setting-input" )), (this.speed = this.container.querySelector(".dplayer-setting-speed")), (this.speedItem = this.container.querySelectorAll(".dplayer-setting-speed-item")), (this.danmakuOpacityBar = this.container.querySelector(".dplayer-danmaku-bar-inner")), (this.danmakuOpacityBarWrap = this.container.querySelector(".dplayer-danmaku-bar")), (this.danmakuOpacityBarWrapWrap = this.container.querySelector(".dplayer-danmaku-bar-wrap")), (this.danmakuOpacityBox = this.container.querySelector(".dplayer-setting-danmaku")), (this.dtime = this.container.querySelector(".dplayer-dtime")), (this.controller = this.container.querySelector(".dplayer-controller")), (this.commentInput = this.container.querySelector(".dplayer-comment-input")), (this.commentButton = this.container.querySelector(".dplayer-comment-icon")), (this.commentSettingBox = this.container.querySelector(".dplayer-comment-setting-box")), (this.commentSettingButton = this.container.querySelector(".dplayer-comment-setting-icon")), (this.commentSettingFill = this.container.querySelector( ".dplayer-comment-setting-icon path" )), (this.commentSendButton = this.container.querySelector(".dplayer-send-icon")), (this.commentSendFill = this.container.querySelector(".dplayer-send-icon path")), (this.commentColorSettingBox = this.container.querySelector(".dplayer-comment-setting-color")), (this.browserFullButton = this.container.querySelector(".dplayer-full-icon")), (this.webFullButton = this.container.querySelector(".dplayer-full-in-icon")), (this.menu = this.container.querySelector(".dplayer-menu")), (this.menuItem = this.container.querySelectorAll(".dplayer-menu-item")), (this.qualityList = this.container.querySelector(".dplayer-quality-list")), (this.camareButton = this.container.querySelector(".dplayer-camera-icon")), (this.airplayButton = this.container.querySelector(".dplayer-airplay-icon")), (this.chromecastButton = this.container.querySelector(".dplayer-chromecast-icon")), (this.subtitleButton = this.container.querySelector(".dplayer-subtitle-icon")), (this.subtitleButtonInner = this.container.querySelector( ".dplayer-subtitle-icon .dplayer-icon-content" )), (this.subtitlesButton = this.container.querySelector(".dplayer-subtitles-icon")), (this.subtitlesBox = this.container.querySelector(".dplayer-subtitles-box")), (this.subtitlesItem = this.container.querySelectorAll(".dplayer-subtitles-item")), (this.subtitle = this.container.querySelector(".dplayer-subtitle")), (this.subtrack = this.container.querySelector(".dplayer-subtrack")), (this.qualityButton = this.container.querySelector(".dplayer-quality-icon")), (this.barPreview = this.container.querySelector(".dplayer-bar-preview")), (this.barWrap = this.container.querySelector(".dplayer-bar-wrap")), (this.noticeList = this.container.querySelector(".dplayer-notice-list")), (this.infoPanel = this.container.querySelector(".dplayer-info-panel")), (this.infoPanelClose = this.container.querySelector(".dplayer-info-panel-close")), (this.infoVersion = this.container.querySelector( ".dplayer-info-panel-item-version .dplayer-info-panel-item-data" )), (this.infoFPS = this.container.querySelector( ".dplayer-info-panel-item-fps .dplayer-info-panel-item-data" )), (this.infoType = this.container.querySelector( ".dplayer-info-panel-item-type .dplayer-info-panel-item-data" )), (this.infoUrl = this.container.querySelector( ".dplayer-info-panel-item-url .dplayer-info-panel-item-data" )), (this.infoResolution = this.container.querySelector( ".dplayer-info-panel-item-resolution .dplayer-info-panel-item-data" )), (this.infoDuration = this.container.querySelector( ".dplayer-info-panel-item-duration .dplayer-info-panel-item-data" )), (this.infoDanmakuId = this.container.querySelector( ".dplayer-info-panel-item-danmaku-id .dplayer-info-panel-item-data" )), (this.infoDanmakuApi = this.container.querySelector( ".dplayer-info-panel-item-danmaku-api .dplayer-info-panel-item-data" )), (this.infoDanmakuAmount = this.container.querySelector( ".dplayer-info-panel-item-danmaku-amount .dplayer-info-panel-item-data" )); } } ]) && _n(e.prototype, n), i && _n(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), kn = Tn; function Cn(t) { return ( (Cn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Cn(t) ); } function Ln(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Cn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Cn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Cn(r) ? r : String(r)), i ); } var r; } var In = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.options = e), (this.player = this.options.player), (this.container = this.options.container), (this.danTunnel = { right: {}, top: {}, bottom: {} }), (this.danIndex = 0), (this.dan = []), (this.showing = !0), (this._opacity = this.options.opacity), (this.events = this.options.events), (this.unlimited = this.options.unlimited), this._measure(""), this.load(); } var e, n; return ( (e = t), (n = [ { key: "load", value: function () { var t, e = this; t = this.options.api.maximum ? "" .concat(this.options.api.address, "v3/?id=") .concat(this.options.api.id, "&max=") .concat(this.options.api.maximum) : "".concat(this.options.api.address, "v3/?id=").concat(this.options.api.id); var n = (this.options.api.addition || []).slice(0); n.push(t), this.events && this.events.trigger("danmaku_load_start", n), this._readAllEndpoints(n, function (t) { (e.dan = [].concat.apply([], t).sort(function (t, e) { return t.time - e.time; })), window.requestAnimationFrame(function () { e.frame(); }), e.options.callback(), e.events && e.events.trigger("danmaku_load_end"); }); } }, { key: "reload", value: function (t) { (this.options.api = t), (this.dan = []), this.clear(), this.load(); } }, { key: "_readAllEndpoints", value: function (t, e) { for ( var n = this, i = [], r = 0, a = function (a) { n.options.apiBackend.read({ url: t[a], success: function (n) { (i[a] = n), ++r === t.length && e(i); }, error: function (s) { n.options.error(s || n.options.tran("danmaku-failed")), (i[a] = []), ++r === t.length && e(i); } }); }, s = 0; s < t.length; ++s ) a(s); } }, { key: "send", value: function (t, e) { var n = this, i = { token: this.options.api.token, id: this.options.api.id, author: this.options.api.user, time: this.options.time(), text: t.text, color: t.color, type: t.type }; this.options.apiBackend.send({ url: this.options.api.address + "v3/", data: i, success: e, error: function (t) { n.options.error(t || n.options.tran("danmaku-failed")); } }), this.dan.splice(this.danIndex, 0, i), this.danIndex++; var r = { text: this.htmlEncode(i.text), color: i.color, type: i.type, border: "2px solid ".concat(this.options.borderColor) }; this.draw(r), this.events && this.events.trigger("danmaku_send", i); } }, { key: "frame", value: function () { var t = this; if (this.dan.length && !this.paused && this.showing) { for ( var e = this.dan[this.danIndex], n = []; e && this.options.time() > parseFloat(e.time); ) n.push(e), (e = this.dan[++this.danIndex]); this.draw(n); } window.requestAnimationFrame(function () { t.frame(); }); } }, { key: "opacity", value: function (t) { if (void 0 !== t) { for ( var e = this.container.getElementsByClassName("dplayer-danmaku-item"), n = 0; n < e.length; n++ ) e[n].style.opacity = t; (this._opacity = t), this.events && this.events.trigger("danmaku_opacity", this._opacity); } return this._opacity; } }, { key: "draw", value: function (t) { var e = this; if (this.showing) { var n = this.options.height, i = this.container.offsetWidth, r = this.container.offsetHeight, a = parseInt(r / n), s = function (t) { var n = t.offsetWidth || parseInt(t.style.width), i = t.getBoundingClientRect().right || e.container.getBoundingClientRect().right + n; return e.container.getBoundingClientRect().right - i; }, o = function (t) { return (i + t) / 5; }, l = function (t, n, r) { for ( var l = i / o(r), d = function (r) { var d = e.danTunnel[n][r + ""]; if (!d || !d.length) return ( (e.danTunnel[n][r + ""] = [t]), t.addEventListener("animationend", function () { e.danTunnel[n][r + ""].splice(0, 1); }), { v: r % a } ); if ("right" !== n) return "continue"; for (var c = 0; c < d.length; c++) { var u = s(d[c]) - 10; if ( u <= i - l * o(parseInt(d[c].style.width)) || u <= 0 ) break; if (c === d.length - 1) return ( e.danTunnel[n][r + ""].push(t), t.addEventListener( "animationend", function () { e.danTunnel[n][r + ""].splice(0, 1); } ), { v: r % a } ); } }, c = 0; e.unlimited || c < a; c++ ) { var u = d(c); if ("continue" !== u && "object" === Cn(u)) return u.v; } return -1; }; "[object Array]" !== Object.prototype.toString.call(t) && (t = [t]); for ( var d = document.createDocumentFragment(), c = function () { (t[u].type = B.number2Type(t[u].type)), t[u].color || (t[u].color = 16777215); var r = document.createElement("div"); r.classList.add("dplayer-danmaku-item"), r.classList.add("dplayer-danmaku-".concat(t[u].type)), t[u].border ? (r.innerHTML = '') .concat(t[u].text, "")) : (r.innerHTML = t[u].text), (r.style.opacity = e._opacity), (r.style.color = B.number2Color(t[u].color)), r.addEventListener("animationend", function () { e.container.removeChild(r); }); var a, s = e._measure(t[u].text); switch (t[u].type) { case "right": (a = l(r, t[u].type, s)) >= 0 && ((r.style.width = s + 1 + "px"), (r.style.top = n * a + "px"), (r.style.transform = "translateX(-".concat( i, "px)" ))); break; case "top": (a = l(r, t[u].type)) >= 0 && (r.style.top = n * a + "px"); break; case "bottom": (a = l(r, t[u].type)) >= 0 && (r.style.bottom = n * a + "px"); break; default: console.error( "Can't handled danmaku type: ".concat(t[u].type) ); } a >= 0 && (r.classList.add("dplayer-danmaku-move"), (r.style.animationDuration = e._danAnimation(t[u].type)), d.appendChild(r)); }, u = 0; u < t.length; u++ ) c(); return this.container.appendChild(d), d; } } }, { key: "play", value: function () { this.paused = !1; } }, { key: "pause", value: function () { this.paused = !0; } }, { key: "_measure", value: function (t) { if (!this.context) { var e = getComputedStyle( this.container.getElementsByClassName("dplayer-danmaku-item")[0], null ); (this.context = document.createElement("canvas").getContext("2d")), (this.context.font = e.getPropertyValue("font")); } return this.context.measureText(t).width; } }, { key: "seek", value: function () { this.clear(); for (var t = 0; t < this.dan.length; t++) { if (this.dan[t].time >= this.options.time()) { this.danIndex = t; break; } this.danIndex = this.dan.length; } } }, { key: "clear", value: function () { (this.danTunnel = { right: {}, top: {}, bottom: {} }), (this.danIndex = 0), (this.options.container.innerHTML = ""), this.events && this.events.trigger("danmaku_clear"); } }, { key: "htmlEncode", value: function (t) { return t .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'") .replace(/\//g, "/"); } }, { key: "resize", value: function () { for ( var t = this.container.offsetWidth, e = this.container.getElementsByClassName("dplayer-danmaku-item"), n = 0; n < e.length; n++ ) e[n].style.transform = "translateX(-".concat(t, "px)"); } }, { key: "hide", value: function () { (this.showing = !1), this.pause(), this.clear(), this.events && this.events.trigger("danmaku_hide"); } }, { key: "show", value: function () { this.seek(), (this.showing = !0), this.play(), this.events && this.events.trigger("danmaku_show"); } }, { key: "unlimit", value: function (t) { this.unlimited = t; } }, { key: "speed", value: function (t) { this.options.api.speedRate = t; } }, { key: "_danAnimation", value: function (t) { var e = this.options.api.speedRate || 1, n = !!this.player.fullScreen.isFullScreen(); return { top: "".concat((n ? 6 : 4) / e, "s"), right: "".concat((n ? 8 : 5) / e, "s"), bottom: "".concat((n ? 6 : 4) / e, "s") }[t]; } } ]), n && Ln(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Rn = In; function Dn(t) { return ( (Dn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Dn(t) ); } function Bn(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Dn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Dn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Dn(r) ? r : String(r)), i ); } var r; } var Pn = (function () { function t() { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.events = {}), (this.videoEvents = [ "abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "mozaudioavailable", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting" ]), (this.playerEvents = [ "screenshot", "thumbnails_show", "thumbnails_hide", "danmaku_show", "danmaku_hide", "danmaku_clear", "danmaku_loaded", "danmaku_send", "danmaku_opacity", "contextmenu_show", "contextmenu_hide", "notice_show", "notice_hide", "quality_start", "quality_end", "destroy", "resize", "fullscreen", "fullscreen_cancel", "webfullscreen", "webfullscreen_cancel", "subtitle_show", "subtitle_hide", "subtitle_change" ]); } var e, n; return ( (e = t), (n = [ { key: "on", value: function (t, e) { this.type(t) && "function" == typeof e && (this.events[t] || (this.events[t] = []), this.events[t].push(e)); } }, { key: "trigger", value: function (t, e) { if (this.events[t] && this.events[t].length) for (var n = 0; n < this.events[t].length; n++) this.events[t][n](e); } }, { key: "type", value: function (t) { return -1 !== this.playerEvents.indexOf(t) ? "player" : -1 !== this.videoEvents.indexOf(t) ? "video" : (console.error("Unknown event name: ".concat(t)), null); } } ]) && Bn(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(); function Un(t) { return ( (Un = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Un(t) ); } function Fn(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Un(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Un(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Un(r) ? r : String(r)), i ); } var r; } var On = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), (this.lastScrollPosition = { left: 0, top: 0 }), this.player.events.on("webfullscreen", function () { n.player.resize(); }), this.player.events.on("webfullscreen_cancel", function () { n.player.resize(), B.setScrollPosition(n.lastScrollPosition); }), (this.fullscreenchange = function () { n.player.resize(), n.isFullScreen("browser") ? n.player.events.trigger("fullscreen") : (B.setScrollPosition(n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel")); }), (this.docfullscreenchange = function () { var t = document.fullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; (t && t !== n.player.container) || (n.player.resize(), t ? n.player.events.trigger("fullscreen") : (B.setScrollPosition(n.lastScrollPosition), n.player.events.trigger("fullscreen_cancel"))); }), /Firefox/.test(navigator.userAgent) ? (document.addEventListener("mozfullscreenchange", this.docfullscreenchange), document.addEventListener("fullscreenchange", this.docfullscreenchange)) : (this.player.container.addEventListener("fullscreenchange", this.fullscreenchange), this.player.container.addEventListener( "webkitfullscreenchange", this.fullscreenchange ), document.addEventListener("msfullscreenchange", this.docfullscreenchange), document.addEventListener("MSFullscreenChange", this.docfullscreenchange)); } var e, n; return ( (e = t), (n = [ { key: "isFullScreen", value: function () { switch ( arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser" ) { case "browser": return ( document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement ); case "web": return this.player.container.classList.contains("dplayer-fulled"); } } }, { key: "request", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser", e = "browser" === t ? "web" : "browser", n = this.isFullScreen(e); switch ((n || (this.lastScrollPosition = B.getScrollPosition()), t)) { case "browser": this.player.container.requestFullscreen ? this.player.container.requestFullscreen() : this.player.container.mozRequestFullScreen ? this.player.container.mozRequestFullScreen() : this.player.container.webkitRequestFullscreen ? this.player.container.webkitRequestFullscreen() : this.player.video.webkitEnterFullscreen ? this.player.video.webkitEnterFullscreen() : this.player.video.webkitEnterFullScreen ? this.player.video.webkitEnterFullScreen() : this.player.container.msRequestFullscreen && this.player.container.msRequestFullscreen(); break; case "web": this.player.container.classList.add("dplayer-fulled"), document.body.classList.add("dplayer-web-fullscreen-fix"), this.player.events.trigger("webfullscreen"); } n && this.cancel(e); } }, { key: "cancel", value: function () { switch ( arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser" ) { case "browser": document.cancelFullScreen ? document.cancelFullScreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.webkitCancelFullscreen ? document.webkitCancelFullscreen() : document.msCancelFullScreen ? document.msCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen(); break; case "web": this.player.container.classList.remove("dplayer-fulled"), document.body.classList.remove("dplayer-web-fullscreen-fix"), this.player.events.trigger("webfullscreen_cancel"); } } }, { key: "toggle", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "browser"; this.isFullScreen(t) ? this.cancel(t) : this.request(t); } }, { key: "destroy", value: function () { /Firefox/.test(navigator.userAgent) ? (document.removeEventListener( "mozfullscreenchange", this.docfullscreenchange ), document.removeEventListener("fullscreenchange", this.docfullscreenchange)) : (this.player.container.removeEventListener( "fullscreenchange", this.fullscreenchange ), this.player.container.removeEventListener( "webkitfullscreenchange", this.fullscreenchange ), document.removeEventListener( "msfullscreenchange", this.docfullscreenchange ), document.removeEventListener( "MSFullscreenChange", this.docfullscreenchange )); } } ]), n && Fn(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Mn = On; function Nn(t) { return ( (Nn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Nn(t) ); } function zn(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Nn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Nn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Nn(r) ? r : String(r)), i ); } var r; } var Gn = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.storageName = { opacity: "dplayer-danmaku-opacity", volume: "dplayer-volume", unlimited: "dplayer-danmaku-unlimited", danmaku: "dplayer-danmaku-show", subtitle: "dplayer-subtitle-show" }), (this.default = { opacity: 0.7, volume: e.options.hasOwnProperty("volume") ? e.options.volume : 0.7, unlimited: (e.options.danmaku && e.options.danmaku.unlimited ? 1 : 0) || 0, danmaku: 1, subtitle: 1 }), (this.data = {}), this.init(); } var e, n; return ( (e = t), (n = [ { key: "init", value: function () { for (var t in this.storageName) { var e = this.storageName[t]; this.data[t] = parseFloat(B.storage.get(e) || this.default[t]); } } }, { key: "get", value: function (t) { return this.data[t]; } }, { key: "set", value: function (t, e) { (this.data[t] = e), B.storage.set(this.storageName[t], e); } } ]) && zn(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), jn = Gn; function Hn(t) { return ( (Hn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Hn(t) ); } function Yn(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Hn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Hn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Hn(r) ? r : String(r)), i ); } var r; } var $n = (function () { function t(e, n, i, r) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.container = e), (this.video = n), (this.options = i), (this.events = r), this.init(); } var e, n; return ( (e = t), (n = [ { key: "init", value: function () { var t = this; if ( ((this.container.style.fontSize = this.options.fontSize), (this.container.style.bottom = this.options.bottom), (this.container.style.color = this.options.color), this.video.textTracks && this.video.textTracks[0]) ) { var e = this.video.textTracks[0]; e.oncuechange = function () { var n = e.activeCues[e.activeCues.length - 1]; if (((t.container.innerHTML = ""), n)) { var i = document.createElement("div"); i.appendChild(n.getCueAsHTML()); var r = i.innerHTML .split(/\r?\n/) .map(function (t) { return "

".concat(t, "

"); }) .join(""); t.container.innerHTML = r; } t.events.trigger("subtitle_change"); }; } } }, { key: "show", value: function () { this.container.classList.remove("dplayer-subtitle-hide"), this.events.trigger("subtitle_show"); } }, { key: "hide", value: function () { this.container.classList.add("dplayer-subtitle-hide"), this.events.trigger("subtitle_hide"); } }, { key: "toggle", value: function () { this.container.classList.contains("dplayer-subtitle-hide") ? this.show() : this.hide(); } } ]), n && Yn(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Kn = $n; function qn(t) { return ( (qn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), qn(t) ); } function Vn(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== qn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== qn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === qn(r) ? r : String(r)), i ); } var r; } var Wn = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), this.player.template.mask.addEventListener("click", function () { n.hide(); }), this.player.template.subtitlesButton.addEventListener("click", function () { n.adaptiveHeight(), n.show(); }); for ( var i = this.player.template.subtitlesItem.length - 1, r = function (t) { n.player.template.subtitlesItem[t].addEventListener("click", function () { n.hide(), n.player.options.subtitle.index !== t && ((n.player.template.subtitle.innerHTML = "

"), (n.player.template.subtrack.src = n.player.template.subtitlesItem[t].dataset.subtitle), (n.player.options.subtitle.index = t), n.player.template.subtitle.classList.contains( "dplayer-subtitle-hide" ) && n.subContainerShow()); }); }, a = 0; a < i; a++ ) r(a); this.player.template.subtitlesItem[i].addEventListener("click", function () { n.hide(), n.player.options.subtitle.index !== i && ((n.player.template.subtitle.innerHTML = "

"), (n.player.template.subtrack.src = ""), (n.player.options.subtitle.index = i), n.subContainerHide()); }); } var e, n; return ( (e = t), (n = [ { key: "subContainerShow", value: function () { this.player.template.subtitle.classList.remove("dplayer-subtitle-hide"), this.player.events.trigger("subtitle_show"); } }, { key: "subContainerHide", value: function () { this.player.template.subtitle.classList.add("dplayer-subtitle-hide"), this.player.events.trigger("subtitle_hide"); } }, { key: "hide", value: function () { this.player.template.subtitlesBox.classList.remove("dplayer-subtitles-box-open"), this.player.template.mask.classList.remove("dplayer-mask-show"), (this.player.controller.disableAutoHide = !1); } }, { key: "show", value: function () { this.player.template.subtitlesBox.classList.add("dplayer-subtitles-box-open"), this.player.template.mask.classList.add("dplayer-mask-show"), (this.player.controller.disableAutoHide = !0); } }, { key: "adaptiveHeight", value: function () { var t = 30 * this.player.template.subtitlesItem.length + 14, e = 0.8 * this.player.template.videoWrap.offsetHeight; t >= e - 50 ? ((this.player.template.subtitlesBox.style.bottom = "8px"), (this.player.template.subtitlesBox.style["max-height"] = e - 8 + "px")) : ((this.player.template.subtitlesBox.style.bottom = "50px"), (this.player.template.subtitlesBox.style["max-height"] = e - 50 + "px")); } } ]) && Vn(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Qn = Wn; function Xn(t) { return ( (Xn = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Xn(t) ); } function Jn(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Xn(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Xn(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Xn(r) ? r : String(r)), i ); } var r; } var Zn = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.elements = {}), (this.elements.volume = e.volumeBar), (this.elements.played = e.playedBar), (this.elements.loaded = e.loadedBar), (this.elements.danmaku = e.danmakuOpacityBar); } var e, n; return ( (e = t), (n = [ { key: "set", value: function (t, e, n) { (e = Math.max(e, 0)), (e = Math.min(e, 1)), (this.elements[t].style[n] = 100 * e + "%"); } }, { key: "get", value: function (t) { return parseFloat(this.elements[t].style.width) / 100; } } ]) && Jn(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), ti = Zn; function ei(t) { return ( (ei = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), ei(t) ); } function ni(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== ei(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== ei(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === ei(r) ? r : String(r)), i ); } var r; } var ii = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), (window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (t) { window.setTimeout(t, 1e3 / 60); }), (this.types = ["loading", "info", "fps"]), this.init(); } var e, n; return ( (e = t), (n = [ { key: "init", value: function () { var t = this; this.types.map(function (e) { return "fps" !== e && t["init".concat(e, "Checker")](), e; }); } }, { key: "initloadingChecker", value: function () { var t = this, e = 0, n = 0, i = !1; this.loadingChecker = setInterval(function () { t.enableloadingChecker && ((n = t.player.video.currentTime), i || n !== e || t.player.video.paused || (t.player.container.classList.add("dplayer-loading"), (i = !0)), i && n > e && !t.player.video.paused && (t.player.container.classList.remove("dplayer-loading"), (i = !1)), (e = n)); }, 100); } }, { key: "initfpsChecker", value: function () { var t = this; window.requestAnimationFrame(function () { if (t.enablefpsChecker) if ((t.initfpsChecker(), t.fpsStart)) { t.fpsIndex++; var e = new Date(); e - t.fpsStart > 1e3 && (t.player.infoPanel.fps((t.fpsIndex / (e - t.fpsStart)) * 1e3), (t.fpsStart = new Date()), (t.fpsIndex = 0)); } else (t.fpsStart = new Date()), (t.fpsIndex = 0); else (t.fpsStart = 0), (t.fpsIndex = 0); }); } }, { key: "initinfoChecker", value: function () { var t = this; this.infoChecker = setInterval(function () { t.enableinfoChecker && t.player.infoPanel.update(); }, 1e3); } }, { key: "enable", value: function (t) { (this["enable".concat(t, "Checker")] = !0), "fps" === t && this.initfpsChecker(); } }, { key: "disable", value: function (t) { this["enable".concat(t, "Checker")] = !1; } }, { key: "destroy", value: function () { var t = this; this.types.map(function (e) { return ( (t["enable".concat(e, "Checker")] = !1), t["".concat(e, "Checker")] && clearInterval(t["".concat(e, "Checker")]), e ); }); } } ]) && ni(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), ri = ii; function ai(t) { return ( (ai = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), ai(t) ); } function si(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== ai(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== ai(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === ai(r) ? r : String(r)), i ); } var r; } var oi = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.container = e), this.container.addEventListener("animationend", function () { n.container.classList.remove("dplayer-bezel-transition"); }); } var e, n; return ( (e = t), (n = [ { key: "switch", value: function (t) { (this.container.innerHTML = t), this.container.classList.add("dplayer-bezel-transition"); } } ]) && si(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(); function li(t) { return ( (li = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), li(t) ); } function di(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== li(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== li(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === li(r) ? r : String(r)), i ); } var r; } var ci = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.container = e.container), (this.barWidth = e.barWidth), (this.container.style.backgroundImage = "url('".concat(e.url, "')")), (this.events = e.events); } var e, n; return ( (e = t), (n = [ { key: "resize", value: function (t, e, n) { (this.container.style.width = "".concat(t, "px")), (this.container.style.height = "".concat(e, "px")), (this.container.style.top = "".concat(2 - e, "px")), (this.barWidth = n); } }, { key: "show", value: function () { (this.container.style.display = "block"), this.events && this.events.trigger("thumbnails_show"); } }, { key: "move", value: function (t) { (this.container.style.backgroundPosition = "-".concat( 160 * (Math.ceil((t / this.barWidth) * 100) - 1), "px 0" )), (this.container.style.left = "".concat( Math.min( Math.max(t - this.container.offsetWidth / 2, -10), this.barWidth - 150 ), "px" )); } }, { key: "hide", value: function () { (this.container.style.display = "none"), this.events && this.events.trigger("thumbnails_hide"); } } ]) && di(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), ui = ci; function hi(t) { return ( (hi = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), hi(t) ); } function pi(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== hi(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== hi(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === hi(r) ? r : String(r)), i ); } var r; } var fi, mi = !0, gi = !1, yi = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), (this.autoHideTimer = 0), B.isMobile || ((this.setAutoHideHandler = this.setAutoHide.bind(this)), this.player.container.addEventListener("mousemove", this.setAutoHideHandler), this.player.container.addEventListener("click", this.setAutoHideHandler), this.player.on("play", this.setAutoHideHandler), this.player.on("pause", this.setAutoHideHandler)), this.initPlayButton(), this.initThumbnails(), this.initPlayedBar(), this.initFullButton(), this.initQualityButton(), this.initScreenshotButton(), this.player.options.subtitle && "string" == typeof this.player.options.subtitle.url && this.initSubtitleButton(), this.initHighlights(), this.initAirplayButton(), this.initChromecastButton(), B.isMobile || this.initVolumeButton(); } var e, n; return ( (e = t), (n = [ { key: "initPlayButton", value: function () { var t = this; this.player.template.playButton.addEventListener("click", function () { t.player.toggle(); }), this.player.template.mobilePlayButton.addEventListener("click", function () { t.player.toggle(); }), B.isMobile ? (this.player.template.videoWrap.addEventListener("click", function () { t.toggle(); }), this.player.template.controllerMask.addEventListener( "click", function () { t.toggle(); } )) : this.player.options.preventClickToggle || (this.player.template.videoWrap.addEventListener("click", function () { t.player.toggle(); }), this.player.template.controllerMask.addEventListener( "click", function () { t.player.toggle(); } )); } }, { key: "initHighlights", value: function () { var t = this; this.player.on("durationchange", function () { if ( 1 !== t.player.video.duration && t.player.video.duration !== 1 / 0 && t.player.options.highlight ) { var e = t.player.template.playedBarWrap.querySelectorAll( ".dplayer-highlight" ); [].slice.call(e, 0).forEach(function (e) { t.player.template.playedBarWrap.removeChild(e); }); for (var n = 0; n < t.player.options.highlight.length; n++) if ( t.player.options.highlight[n].text && t.player.options.highlight[n].time ) { var i = document.createElement("div"); i.classList.add("dplayer-highlight"), (i.style.left = (t.player.options.highlight[n].time / t.player.video.duration) * 100 + "%"), (i.innerHTML = '' + t.player.options.highlight[n].text + ""), t.player.template.playedBarWrap.insertBefore( i, t.player.template.playedBarTime ); } } }); } }, { key: "initThumbnails", value: function () { var t = this; this.player.options.video.thumbnails && ((this.thumbnails = new ui({ container: this.player.template.barPreview, barWidth: this.player.template.barWrap.offsetWidth, url: this.player.options.video.thumbnails, events: this.player.events })), this.player.on("loadedmetadata", function () { t.thumbnails.resize( 160, (t.player.video.videoHeight / t.player.video.videoWidth) * 160, t.player.template.barWrap.offsetWidth ); })); } }, { key: "initPlayedBar", value: function () { var t = this, e = function (e) { var n = ((e.clientX || e.changedTouches[0].clientX) - B.getBoundingClientRectViewLeft( t.player.template.playedBarWrap )) / t.player.template.playedBarWrap.clientWidth; (n = Math.max(n, 0)), (n = Math.min(n, 1)), t.player.bar.set("played", n, "width"), (t.player.template.ptime.innerHTML = B.secondToTime( n * t.player.video.duration )); }, n = function n(i) { document.removeEventListener(B.nameMap.dragEnd, n), document.removeEventListener(B.nameMap.dragMove, e); var r = ((i.clientX || i.changedTouches[0].clientX) - B.getBoundingClientRectViewLeft( t.player.template.playedBarWrap )) / t.player.template.playedBarWrap.clientWidth; (r = Math.max(r, 0)), (r = Math.min(r, 1)), t.player.bar.set("played", r, "width"), t.player.seek(t.player.bar.get("played") * t.player.video.duration), t.player.timer.enable("progress"); }; this.player.template.playedBarWrap.addEventListener( B.nameMap.dragStart, function () { t.player.timer.disable("progress"), document.addEventListener(B.nameMap.dragMove, e), document.addEventListener(B.nameMap.dragEnd, n); } ), this.player.template.playedBarWrap.addEventListener( B.nameMap.dragMove, function (e) { if (t.player.video.duration) { var n = t.player.template.playedBarWrap.getBoundingClientRect() .left, i = (e.clientX || e.changedTouches[0].clientX) - n; if (i < 0 || i > t.player.template.playedBarWrap.offsetWidth) return; var r = t.player.video.duration * (i / t.player.template.playedBarWrap.offsetWidth); B.isMobile && t.thumbnails && t.thumbnails.show(), t.thumbnails && t.thumbnails.move(i), (t.player.template.playedBarTime.style.left = "".concat( i - (r >= 3600 ? 25 : 20), "px" )), (t.player.template.playedBarTime.innerText = B.secondToTime(r)), t.player.template.playedBarTime.classList.remove("hidden"); } } ), this.player.template.playedBarWrap.addEventListener( B.nameMap.dragEnd, function () { B.isMobile && t.thumbnails && t.thumbnails.hide(); } ), B.isMobile || (this.player.template.playedBarWrap.addEventListener( "mouseenter", function () { t.player.video.duration && (t.thumbnails && t.thumbnails.show(), t.player.template.playedBarTime.classList.remove("hidden")); } ), this.player.template.playedBarWrap.addEventListener( "mouseleave", function () { t.player.video.duration && (t.thumbnails && t.thumbnails.hide(), t.player.template.playedBarTime.classList.add("hidden")); } )); } }, { key: "initFullButton", value: function () { var t = this; this.player.template.browserFullButton.addEventListener("click", function () { t.player.fullScreen.toggle("browser"); }), this.player.template.webFullButton.addEventListener("click", function () { t.player.fullScreen.toggle("web"); }); } }, { key: "initVolumeButton", value: function () { var t = this, e = function (e) { var n = e || window.event, i = ((n.clientX || n.changedTouches[0].clientX) - B.getBoundingClientRectViewLeft( t.player.template.volumeBarWrap ) - 5.5) / 35; t.player.volume(i); }, n = function n() { document.removeEventListener(B.nameMap.dragEnd, n), document.removeEventListener(B.nameMap.dragMove, e), t.player.template.volumeButton.classList.remove( "dplayer-volume-active" ); }; this.player.template.volumeBarWrapWrap.addEventListener("click", function (e) { var n = e || window.event, i = ((n.clientX || n.changedTouches[0].clientX) - B.getBoundingClientRectViewLeft(t.player.template.volumeBarWrap) - 5.5) / 35; t.player.volume(i); }), this.player.template.volumeBarWrapWrap.addEventListener( B.nameMap.dragStart, function () { document.addEventListener(B.nameMap.dragMove, e), document.addEventListener(B.nameMap.dragEnd, n), t.player.template.volumeButton.classList.add( "dplayer-volume-active" ); } ), this.player.template.volumeButtonIcon.addEventListener("click", function () { t.player.video.muted ? ((t.player.video.muted = !1), t.player.switchVolumeIcon(), t.player.bar.set("volume", t.player.volume(), "width")) : ((t.player.video.muted = !0), (t.player.template.volumeIcon.innerHTML = En.volumeOff), t.player.bar.set("volume", 0, "width")); }); } }, { key: "initQualityButton", value: function () { var t = this; this.player.options.video.quality && this.player.template.qualityList.addEventListener("click", function (e) { e.target.classList.contains("dplayer-quality-item") && t.player.switchQuality(e.target.dataset.index); }); } }, { key: "initScreenshotButton", value: function () { var t = this; this.player.options.screenshot && this.player.template.camareButton.addEventListener("click", function () { var e, n = document.createElement("canvas"); (n.width = t.player.video.videoWidth), (n.height = t.player.video.videoHeight), n.getContext("2d").drawImage(t.player.video, 0, 0, n.width, n.height), n.toBlob(function (n) { e = URL.createObjectURL(n); var i = document.createElement("a"); (i.href = e), (i.download = "DPlayer.png"), (i.style.display = "none"), document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(e), t.player.events.trigger("screenshot", e); }); }); } }, { key: "initAirplayButton", value: function () { this.player.options.airplay && (window.WebKitPlaybackTargetAvailabilityEvent ? this.player.video.addEventListener( "webkitplaybacktargetavailabilitychanged", function (t) { "available" === t.availability ? (this.template.airplayButton.disable = !1) : (this.template.airplayButton.disable = !0), this.template.airplayButton.addEventListener( "click", function () { this.video.webkitShowPlaybackTargetPicker(); }.bind(this) ); }.bind(this.player) ) : (this.player.template.airplayButton.style.display = "none")); } }, { key: "initChromecast", value: function () { var t = window.document.createElement("script"); t.setAttribute("type", "text/javascript"), t.setAttribute( "src", "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1" ), window.document.body.appendChild(t), (window.__onGCastApiAvailable = function (t) { if (t) { var e = new (fi = window.chrome.cast).SessionRequest( fi.media.DEFAULT_MEDIA_RECEIVER_APP_ID ), n = new fi.ApiConfig( e, function () { }, function (t) { t === fi.ReceiverAvailability.AVAILABLE && console.log("chromecast: ", t); } ); fi.initialize(n, function () { }); } }); } }, { key: "initChromecastButton", value: function () { var t = this; if (this.player.options.chromecast) { mi && ((mi = !1), this.initChromecast()); var e = function (e, n) { t.currentMedia = n; }, n = function (t) { console.error("Error launching media", t); }; this.player.template.chromecastButton.addEventListener("click", function () { gi ? ((gi = !1), t.currentMedia.stop(), t.session.stop(), t.initChromecast()) : ((gi = !0), fi.requestSession( function (i) { var r, a, s; (t.session = i), (r = t.player.options.video.url), (a = new fi.media.MediaInfo(r)), (s = new fi.media.LoadRequest(a)), t.session ? t.session .loadMedia(s, e.bind(t, "loadMedia"), n) .play() : window.open(r); }, function (e) { "cancel" === e.code ? (t.session = void 0) : console.error("Error selecting a cast device", e); } )); }); } } }, { key: "initSubtitleButton", value: function () { var t = this; this.player.events.on("subtitle_show", function () { (t.player.template.subtitleButton.dataset.balloon = t.player.tran("hide-subs")), (t.player.template.subtitleButtonInner.style.opacity = ""), t.player.user.set("subtitle", 1); }), this.player.events.on("subtitle_hide", function () { (t.player.template.subtitleButton.dataset.balloon = t.player.tran("show-subs")), (t.player.template.subtitleButtonInner.style.opacity = "0.4"), t.player.user.set("subtitle", 0); }), this.player.template.subtitleButton.addEventListener("click", function () { t.player.subtitle.toggle(); }); } }, { key: "setAutoHide", value: function () { var t = this; this.show(), clearTimeout(this.autoHideTimer), (this.autoHideTimer = setTimeout(function () { !t.player.video.played.length || t.player.paused || t.disableAutoHide || t.hide(); }, 3e3)); } }, { key: "show", value: function () { this.player.container.classList.remove("dplayer-hide-controller"); } }, { key: "hide", value: function () { this.player.container.classList.add("dplayer-hide-controller"), this.player.setting.hide(), this.player.comment && this.player.comment.hide(); } }, { key: "isShow", value: function () { return !this.player.container.classList.contains("dplayer-hide-controller"); } }, { key: "toggle", value: function () { this.isShow() ? this.hide() : this.show(); } }, { key: "destroy", value: function () { B.isMobile || (this.player.container.removeEventListener( "mousemove", this.setAutoHideHandler ), this.player.container.removeEventListener("click", this.setAutoHideHandler)), clearTimeout(this.autoHideTimer); } } ]) && pi(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Ai = yi; function vi(t) { return ( (vi = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), vi(t) ); } function bi(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== vi(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== vi(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === vi(r) ? r : String(r)), i ); } var r; } var Ei = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), this.player.template.mask.addEventListener("click", function () { n.hide(); }), this.player.template.settingButton.addEventListener("click", function () { n.show(); }), (this.loop = this.player.options.loop), (this.player.template.loopToggle.checked = this.loop), this.player.template.loop.addEventListener("click", function () { (n.player.template.loopToggle.checked = !n.player.template.loopToggle.checked), n.player.template.loopToggle.checked ? (n.loop = !0) : (n.loop = !1), n.hide(); }), (this.showDanmaku = this.player.user.get("danmaku")), this.showDanmaku || (this.player.danmaku && this.player.danmaku.hide()), (this.player.template.showDanmakuToggle.checked = this.showDanmaku), this.player.template.showDanmaku.addEventListener("click", function () { (n.player.template.showDanmakuToggle.checked = !n.player.template.showDanmakuToggle.checked), n.player.template.showDanmakuToggle.checked ? ((n.showDanmaku = !0), n.player.danmaku.show()) : ((n.showDanmaku = !1), n.player.danmaku.hide()), n.player.user.set("danmaku", n.showDanmaku ? 1 : 0), n.hide(); }), (this.unlimitDanmaku = this.player.user.get("unlimited")), (this.player.template.unlimitDanmakuToggle.checked = this.unlimitDanmaku), this.player.template.unlimitDanmaku.addEventListener("click", function () { (n.player.template.unlimitDanmakuToggle.checked = !n.player.template.unlimitDanmakuToggle.checked), n.player.template.unlimitDanmakuToggle.checked ? ((n.unlimitDanmaku = !0), n.player.danmaku.unlimit(!0)) : ((n.unlimitDanmaku = !1), n.player.danmaku.unlimit(!1)), n.player.user.set("unlimited", n.unlimitDanmaku ? 1 : 0), n.hide(); }), this.player.template.speed.addEventListener("click", function () { n.player.template.settingBox.classList.add("dplayer-setting-box-narrow"), n.player.template.settingBox.classList.add("dplayer-setting-box-speed"); }); for ( var i = function (t) { n.player.template.speedItem[t].addEventListener("click", function () { n.player.speed(n.player.template.speedItem[t].dataset.speed), n.hide(); }); }, r = 0; r < this.player.template.speedItem.length; r++ ) i(r); if (this.player.danmaku) { this.player.on("danmaku_opacity", function (t) { n.player.bar.set("danmaku", t, "width"), n.player.user.set("opacity", t); }), this.player.danmaku.opacity(this.player.user.get("opacity")); var a = function (t) { var e = t || window.event, i = ((e.clientX || e.changedTouches[0].clientX) - B.getBoundingClientRectViewLeft( n.player.template.danmakuOpacityBarWrap )) / 130; (i = Math.max(i, 0)), (i = Math.min(i, 1)), n.player.danmaku.opacity(i); }, s = function t() { document.removeEventListener(B.nameMap.dragEnd, t), document.removeEventListener(B.nameMap.dragMove, a), n.player.template.danmakuOpacityBox.classList.remove( "dplayer-setting-danmaku-active" ); }; this.player.template.danmakuOpacityBarWrapWrap.addEventListener("click", function (t) { var e = t || window.event, i = ((e.clientX || e.changedTouches[0].clientX) - B.getBoundingClientRectViewLeft( n.player.template.danmakuOpacityBarWrap )) / 130; (i = Math.max(i, 0)), (i = Math.min(i, 1)), n.player.danmaku.opacity(i); }), this.player.template.danmakuOpacityBarWrapWrap.addEventListener( B.nameMap.dragStart, function () { document.addEventListener(B.nameMap.dragMove, a), document.addEventListener(B.nameMap.dragEnd, s), n.player.template.danmakuOpacityBox.classList.add( "dplayer-setting-danmaku-active" ); } ); } } var e, n; return ( (e = t), (n = [ { key: "hide", value: function () { var t = this; this.player.template.settingBox.classList.remove("dplayer-setting-box-open"), this.player.template.mask.classList.remove("dplayer-mask-show"), setTimeout(function () { t.player.template.settingBox.classList.remove( "dplayer-setting-box-narrow" ), t.player.template.settingBox.classList.remove( "dplayer-setting-box-speed" ); }, 300), (this.player.controller.disableAutoHide = !1); } }, { key: "show", value: function () { this.player.template.settingBox.classList.add("dplayer-setting-box-open"), this.player.template.mask.classList.add("dplayer-mask-show"), (this.player.controller.disableAutoHide = !0); } } ]) && bi(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), wi = Ei; function xi(t) { return ( (xi = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), xi(t) ); } function Si(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== xi(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== xi(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === xi(r) ? r : String(r)), i ); } var r; } var _i = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), this.player.template.mask.addEventListener("click", function () { n.hide(); }), this.player.template.commentButton.addEventListener("click", function () { n.show(); }), this.player.template.commentSettingButton.addEventListener("click", function () { n.toggleSetting(); }), this.player.template.commentColorSettingBox.addEventListener("click", function () { if (n.player.template.commentColorSettingBox.querySelector("input:checked+span")) { var t = n.player.template.commentColorSettingBox.querySelector("input:checked").value; (n.player.template.commentSettingFill.style.fill = t), (n.player.template.commentInput.style.color = t), (n.player.template.commentSendFill.style.fill = t); } }), this.player.template.commentInput.addEventListener("click", function () { n.hideSetting(); }), this.player.template.commentInput.addEventListener("keydown", function (t) { 13 === (t || window.event).keyCode && n.send(); }), this.player.template.commentSendButton.addEventListener("click", function () { n.send(); }); } var e, n; return ( (e = t), (n = [ { key: "show", value: function () { (this.player.controller.disableAutoHide = !0), this.player.template.controller.classList.add("dplayer-controller-comment"), this.player.template.mask.classList.add("dplayer-mask-show"), this.player.container.classList.add("dplayer-show-controller"), this.player.template.commentInput.focus(); } }, { key: "hide", value: function () { this.player.template.controller.classList.remove("dplayer-controller-comment"), this.player.template.mask.classList.remove("dplayer-mask-show"), this.player.container.classList.remove("dplayer-show-controller"), (this.player.controller.disableAutoHide = !1), this.hideSetting(); } }, { key: "showSetting", value: function () { this.player.template.commentSettingBox.classList.add( "dplayer-comment-setting-open" ); } }, { key: "hideSetting", value: function () { this.player.template.commentSettingBox.classList.remove( "dplayer-comment-setting-open" ); } }, { key: "toggleSetting", value: function () { this.player.template.commentSettingBox.classList.contains( "dplayer-comment-setting-open" ) ? this.hideSetting() : this.showSetting(); } }, { key: "send", value: function () { var t = this; this.player.template.commentInput.blur(), this.player.template.commentInput.value.replace(/^\s+|\s+$/g, "") ? this.player.danmaku.send( { text: this.player.template.commentInput.value, color: B.color2Number( this.player.container.querySelector( ".dplayer-comment-setting-color input:checked" ).value ), type: parseInt( this.player.container.querySelector( ".dplayer-comment-setting-type input:checked" ).value ) }, function () { (t.player.template.commentInput.value = ""), t.hide(); } ) : this.player.notice(this.player.tran("please-input-danmaku")); } } ]) && Si(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Ti = _i; function ki(t) { return ( (ki = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), ki(t) ); } function Ci(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== ki(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== ki(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === ki(r) ? r : String(r)), i ); } var r; } var Li = (function () { function t(e) { !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), (this.doHotKeyHandler = this.doHotKey.bind(this)), (this.cancelFullScreenHandler = this.cancelFullScreen.bind(this)), this.player.options.hotkey && document.addEventListener("keydown", this.doHotKeyHandler), document.addEventListener("keydown", this.cancelFullScreenHandler); } var e, n; return ( (e = t), (n = [ { key: "doHotKey", value: function (t) { if (this.player.focus) { var e = document.activeElement.tagName.toUpperCase(), n = document.activeElement.getAttribute("contenteditable"); if ("INPUT" !== e && "TEXTAREA" !== e && "" !== n && "true" !== n) { var i, r = t || window.event; switch (r.keyCode) { case 32: r.preventDefault(), this.player.toggle(); break; case 37: if ((r.preventDefault(), this.player.options.live)) break; this.player.seek(this.player.video.currentTime - 5), this.player.controller.setAutoHide(); break; case 39: if ((r.preventDefault(), this.player.options.live)) break; this.player.seek(this.player.video.currentTime + 5), this.player.controller.setAutoHide(); break; case 38: r.preventDefault(), (i = this.player.volume() + 0.1), this.player.volume(i); break; case 40: r.preventDefault(), (i = this.player.volume() - 0.1), this.player.volume(i); } } } } }, { key: "cancelFullScreen", value: function (t) { 27 === (t || window.event).keyCode && this.player.fullScreen.isFullScreen("web") && this.player.fullScreen.cancel("web"); } }, { key: "destroy", value: function () { this.player.options.hotkey && document.removeEventListener("keydown", this.doHotKeyHandler), document.removeEventListener("keydown", this.cancelFullScreenHandler); } } ]) && Ci(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Ii = Li; function Ri(t) { return ( (Ri = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Ri(t) ); } function Di(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Ri(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Ri(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Ri(r) ? r : String(r)), i ); } var r; } var Bi = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.player = e), (this.shown = !1), Array.prototype.slice.call(this.player.template.menuItem).forEach(function (t, e) { n.player.options.contextmenu[e].click && t.addEventListener("click", function () { n.player.options.contextmenu[e].click(n.player), n.hide(); }); }), (this.contextmenuHandler = function (t) { if (n.shown) n.hide(); else { var e = t || window.event; e.preventDefault(); var i = n.player.container.getBoundingClientRect(); n.show(e.clientX - i.left, e.clientY - i.top), n.player.template.mask.addEventListener("click", function () { n.hide(); }); } }), this.player.container.addEventListener("contextmenu", this.contextmenuHandler); } var e, n; return ( (e = t), (n = [ { key: "show", value: function (t, e) { this.player.template.menu.classList.add("dplayer-menu-show"); var n = this.player.container.getBoundingClientRect(); t + this.player.template.menu.offsetWidth >= n.width ? ((this.player.template.menu.style.right = n.width - t + "px"), (this.player.template.menu.style.left = "initial")) : ((this.player.template.menu.style.left = t + "px"), (this.player.template.menu.style.right = "initial")), e + this.player.template.menu.offsetHeight >= n.height ? ((this.player.template.menu.style.bottom = n.height - e + "px"), (this.player.template.menu.style.top = "initial")) : ((this.player.template.menu.style.top = e + "px"), (this.player.template.menu.style.bottom = "initial")), this.player.template.mask.classList.add("dplayer-mask-show"), (this.shown = !0), this.player.events.trigger("contextmenu_show"); } }, { key: "hide", value: function () { this.player.template.mask.classList.remove("dplayer-mask-show"), this.player.template.menu.classList.remove("dplayer-menu-show"), (this.shown = !1), this.player.events.trigger("contextmenu_hide"); } }, { key: "destroy", value: function () { this.player.container.removeEventListener("contextmenu", this.contextmenuHandler); } } ]) && Di(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Pi = Bi; function Ui(t) { return ( (Ui = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Ui(t) ); } function Fi(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty( t, ((r = (function (t, e) { if ("object" !== Ui(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Ui(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(i.key)), "symbol" === Ui(r) ? r : String(r)), i ); } var r; } var Oi = (function () { function t(e) { var n = this; !(function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.container = e.template.infoPanel), (this.template = e.template), (this.video = e.video), (this.player = e), this.template.infoPanelClose.addEventListener("click", function () { n.hide(); }); } var e, n; return ( (e = t), (n = [ { key: "show", value: function () { (this.beginTime = Date.now()), this.update(), this.player.timer.enable("info"), this.player.timer.enable("fps"), this.container.classList.remove("dplayer-info-panel-hide"); } }, { key: "hide", value: function () { this.player.timer.disable("info"), this.player.timer.disable("fps"), this.container.classList.add("dplayer-info-panel-hide"); } }, { key: "triggle", value: function () { this.container.classList.contains("dplayer-info-panel-hide") ? this.show() : this.hide(); } }, { key: "update", value: function () { (this.template.infoVersion.innerHTML = "v" .concat("1.27.1", " ") .concat("v1.27.0-12-g4f61091")), (this.template.infoType.innerHTML = this.player.type), (this.template.infoUrl.innerHTML = this.player.options.video.url), (this.template.infoResolution.innerHTML = "" .concat(this.player.video.videoWidth, " x ") .concat(this.player.video.videoHeight)), (this.template.infoDuration.innerHTML = this.player.video.duration), this.player.options.danmaku && ((this.template.infoDanmakuId.innerHTML = this.player.options.danmaku.id), (this.template.infoDanmakuApi.innerHTML = this.player.options.danmaku.api), (this.template.infoDanmakuAmount.innerHTML = this.player.danmaku.dan.length)); } }, { key: "fps", value: function (t) { this.template.infoFPS.innerHTML = "".concat(t.toFixed(1)); } } ]) && Fi(e.prototype, n), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Mi = Oi, Ni = n(568), zi = n.n(Ni); function Gi(t) { return ( (Gi = "function" == typeof Symbol && "symbol" == u(Symbol.iterator) ? function (t) { return u(t); } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : u(t); }), Gi(t) ); } function ji(t, e) { var n = Object.keys(t); if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(t); e && (i = i.filter(function (e) { return Object.getOwnPropertyDescriptor(t, e).enumerable; })), n.push.apply(n, i); } return n; } function Hi(t, e, n) { return ( (e = $i(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : (t[e] = n), t ); } function Yi(t, e) { for (var n = 0; n < e.length; n++) { var i = e[n]; (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty(t, $i(i.key), i); } } function $i(t) { var e = (function (t, e) { if ("object" !== Gi(t) || null === t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, "string"); if ("object" !== Gi(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return String(t); })(t); return "symbol" === Gi(e) ? e : String(e); } var Ki = 0, qi = [], Vi = (function () { function t(e) { var n = this; (function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); })(this, t), (this.options = (function (t) { var e = { container: t.element || document.getElementsByClassName("dplayer")[0], live: !1, autoplay: !1, theme: "#b7daff", loop: !1, lang: (navigator.language || navigator.browserLanguage).toLowerCase(), screenshot: !1, airplay: !0, chromecast: !1, hotkey: !0, preload: "metadata", volume: 0.7, playbackSpeed: [0.5, 0.75, 1, 1.25, 1.5, 2], apiBackend: Be, video: {}, contextmenu: [], mutex: !0, pluginOptions: { hls: {}, flv: {}, dash: {}, webtorrent: {} }, preventClickToggle: !1 }; for (var n in e) e.hasOwnProperty(n) && !t.hasOwnProperty(n) && (t[n] = e[n]); return ( t.video && !t.video.type && (t.video.type = "auto"), "object" === Pe(t.danmaku) && t.danmaku && !t.danmaku.user && (t.danmaku.user = "DIYgod"), t.subtitle && (!t.subtitle.type && (t.subtitle.type = "webvtt"), !t.subtitle.fontSize && (t.subtitle.fontSize = "20px"), !t.subtitle.bottom && (t.subtitle.bottom = "40px"), !t.subtitle.color && (t.subtitle.color = "#fff")), t.video.quality && (t.video.url = t.video.quality[t.video.defaultQuality].url), t.lang && (t.lang = t.lang.toLowerCase()), (t.contextmenu = t.contextmenu.concat([ { key: "video-info", click: function (t) { t.infoPanel.triggle(); } }, { key: "about-author", link: "https://diygod.me" }, { text: "DPlayer v".concat("1.27.1"), link: "https://github.com/MoePlayer/DPlayer" } ])), t ); })( (function (t) { for (var e = 1; e < arguments.length; e++) { var n = null != arguments[e] ? arguments[e] : {}; e % 2 ? ji(Object(n), !0).forEach(function (e) { Hi(t, e, n[e]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ji(Object(n)).forEach(function (e) { Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e)); }); } return t; })({ preload: "webtorrent" === e.video.type ? "none" : "metadata" }, e) )), this.options.video.quality && ((this.qualityIndex = this.options.video.defaultQuality), (this.quality = this.options.video.quality[this.options.video.defaultQuality])), (this.tran = new Ue(this.options.lang).tran), (this.events = new Pn()), (this.user = new jn(this)), (this.container = this.options.container), (this.noticeList = {}), this.container.classList.add("dplayer"), this.options.danmaku || this.container.classList.add("dplayer-no-danmaku"), this.options.live ? this.container.classList.add("dplayer-live") : this.container.classList.remove("dplayer-live"), B.isMobile && this.container.classList.add("dplayer-mobile"), (this.arrow = this.container.offsetWidth <= 500), this.arrow && this.container.classList.add("dplayer-arrow"), this.options.subtitle && Array.isArray(this.options.subtitle.url) && (this.options.subtitle.url.push({ subtitle: "", lang: "off" }), this.options.subtitle.defaultSubtitle && ("string" == typeof this.options.subtitle.defaultSubtitle ? (this.options.subtitle.index = this.options.subtitle.url.findIndex( function (t) { return ( t.lang === n.options.subtitle.defaultSubtitle || t.name === n.options.subtitle.defaultSubtitle ); } )) : "number" == typeof this.options.subtitle.defaultSubtitle && (this.options.subtitle.index = this.options.subtitle.defaultSubtitle)), (-1 === this.options.subtitle.index || !this.options.subtitle.index || this.options.subtitle.index > this.options.subtitle.url.length - 1) && (this.options.subtitle.index = this.options.subtitle.url.findIndex(function (t) { return t.lang === n.options.lang; })), -1 === this.options.subtitle.index && (this.options.subtitle.index = this.options.subtitle.url.length - 1)), (this.template = new kn({ container: this.container, options: this.options, index: Ki, tran: this.tran })), (this.video = this.template.video), (this.bar = new ti(this.template)), (this.bezel = new oi(this.template.bezel)), (this.fullScreen = new Mn(this)), (this.controller = new Ai(this)), this.options.danmaku && ((this.danmaku = new Rn({ player: this, container: this.template.danmaku, opacity: this.user.get("opacity"), callback: function () { setTimeout(function () { (n.template.danmakuLoading.style.display = "none"), n.options.autoplay && n.play(); }, 0); }, error: function (t) { n.notice(t); }, apiBackend: this.options.apiBackend, borderColor: this.options.theme, height: this.arrow ? 24 : 30, time: function () { return n.video.currentTime; }, unlimited: this.user.get("unlimited"), api: { id: this.options.danmaku.id, address: this.options.danmaku.api, token: this.options.danmaku.token, maximum: this.options.danmaku.maximum, addition: this.options.danmaku.addition, user: this.options.danmaku.user, speedRate: this.options.danmaku.speedRate }, events: this.events, tran: function (t) { return n.tran(t); } })), (this.comment = new Ti(this))), (this.setting = new wi(this)), (this.plugins = {}), (this.docClickFun = function () { n.focus = !1; }), (this.containerClickFun = function () { n.focus = !0; }), document.addEventListener("click", this.docClickFun, !0), this.container.addEventListener("click", this.containerClickFun, !0), (this.paused = !0), (this.timer = new ri(this)), (this.hotkey = new Ii(this)), (this.contextmenu = new Pi(this)), this.initVideo( this.video, (this.quality && this.quality.type) || this.options.video.type ), (this.infoPanel = new Mi(this)), !this.danmaku && this.options.autoplay && this.play(), Ki++, qi.push(this); } var e, n, i; return ( (e = t), (n = [ { key: "seek", value: function (t) { (t = Math.max(t, 0)), this.video.duration && (t = Math.min(t, this.video.duration)), this.video.currentTime < t ? this.notice( "".concat( this.tran("ff").replace( "%s", (t - this.video.currentTime).toFixed(0) ) ) ) : this.video.currentTime > t && this.notice( "".concat( this.tran("rew").replace( "%s", (this.video.currentTime - t).toFixed(0) ) ) ), (this.video.currentTime = t), this.danmaku && this.danmaku.seek(), this.bar.set("played", t / this.video.duration, "width"), (this.template.ptime.innerHTML = B.secondToTime(t)); } }, { key: "play", value: function (t) { var e = this; if ( ((this.paused = !1), this.video.paused && !B.isMobile && this.bezel.switch(En.play), (this.template.playButton.innerHTML = En.pause), (this.template.mobilePlayButton.innerHTML = En.pause), t || R.resolve(this.video.play()) .catch(function () { e.pause(); }) .then(function () { }), this.timer.enable("loading"), this.container.classList.remove("dplayer-paused"), this.container.classList.add("dplayer-playing"), this.danmaku && this.danmaku.play(), this.options.mutex) ) for (var n = 0; n < qi.length; n++) this !== qi[n] && qi[n].pause(); } }, { key: "pause", value: function (t) { (this.paused = !0), this.container.classList.remove("dplayer-loading"), this.video.paused || B.isMobile || this.bezel.switch(En.pause), (this.template.playButton.innerHTML = En.play), (this.template.mobilePlayButton.innerHTML = En.play), t || this.video.pause(), this.timer.disable("loading"), this.container.classList.remove("dplayer-playing"), this.container.classList.add("dplayer-paused"), this.danmaku && this.danmaku.pause(); } }, { key: "switchVolumeIcon", value: function () { this.volume() >= 0.95 ? (this.template.volumeIcon.innerHTML = En.volumeUp) : this.volume() > 0 ? (this.template.volumeIcon.innerHTML = En.volumeDown) : (this.template.volumeIcon.innerHTML = En.volumeOff); } }, { key: "volume", value: function (t, e, n) { if (((t = parseFloat(t)), !isNaN(t))) { (t = Math.max(t, 0)), (t = Math.min(t, 1)), this.bar.set("volume", t, "width"); var i = "".concat((100 * t).toFixed(0), "%"); (this.template.volumeBarWrapWrap.dataset.balloon = i), e || this.user.set("volume", t), n || this.notice( "" .concat(this.tran("volume"), " ") .concat((100 * t).toFixed(0), "%"), void 0, void 0, "volume" ), (this.video.volume = t), this.video.muted && (this.video.muted = !1), this.switchVolumeIcon(); } return this.video.volume; } }, { key: "toggle", value: function () { this.video.paused ? this.play() : this.pause(); } }, { key: "on", value: function (t, e) { this.events.on(t, e); } }, { key: "switchVideo", value: function (t, e) { this.pause(), (this.video.poster = t.pic ? t.pic : ""), (this.video.src = t.url), this.initMSE(this.video, t.type || "auto"), e && ((this.template.danmakuLoading.style.display = "block"), this.bar.set("played", 0, "width"), this.bar.set("loaded", 0, "width"), (this.template.ptime.innerHTML = "00:00"), (this.template.danmaku.innerHTML = ""), this.danmaku && this.danmaku.reload({ id: e.id, address: e.api, token: e.token, maximum: e.maximum, addition: e.addition, user: e.user })); } }, { key: "initMSE", value: function (t, e) { var n = this; if ( ((this.type = e), this.options.video.customType && this.options.video.customType[e]) ) "[object Function]" === Object.prototype.toString.call(this.options.video.customType[e]) ? this.options.video.customType[e](this.video, this) : console.error("Illegal customType: ".concat(e)); else switch ( ("auto" === this.type && (/m3u8(#|\?|$)/i.exec(t.src) ? (this.type = "hls") : /.flv(#|\?|$)/i.exec(t.src) ? (this.type = "flv") : /.mpd(#|\?|$)/i.exec(t.src) ? (this.type = "dash") : (this.type = "normal")), "hls" === this.type && (t.canPlayType("application/x-mpegURL") || t.canPlayType("application/vnd.apple.mpegURL")) && (this.type = "normal"), this.type) ) { case "hls": if (window.Hls) if (window.Hls.isSupported()) { var i = this.options.pluginOptions.hls, r = new window.Hls(i); (this.plugins.hls = r), r.loadSource(t.src), r.attachMedia(t), this.events.on("destroy", function () { r.destroy(), delete n.plugins.hls; }); } else this.notice("Error: Hls is not supported."); else this.notice("Error: Can't find Hls."); break; case "flv": if (window.flvjs) if (window.flvjs.isSupported()) { var a = window.flvjs.createPlayer( Object.assign( this.options.pluginOptions.flv.mediaDataSource || {}, { type: "flv", url: t.src } ), this.options.pluginOptions.flv.config ); (this.plugins.flvjs = a), a.attachMediaElement(t), a.load(), this.events.on("destroy", function () { a.unload(), a.detachMediaElement(), a.destroy(), delete n.plugins.flvjs; }); } else this.notice("Error: flvjs is not supported."); else this.notice("Error: Can't find flvjs."); break; case "dash": if (window.dashjs) { var s = window.dashjs .MediaPlayer() .create() .initialize(t, t.src, !1), o = this.options.pluginOptions.dash; s.updateSettings(o), (this.plugins.dash = s), this.events.on("destroy", function () { window.dashjs.MediaPlayer().reset(), delete n.plugins.dash; }); } else this.notice("Error: Can't find dashjs."); break; case "webtorrent": if (window.WebTorrent) if (window.WebTorrent.WEBRTC_SUPPORT) { this.container.classList.add("dplayer-loading"); var l = this.options.pluginOptions.webtorrent, d = new window.WebTorrent(l); this.plugins.webtorrent = d; var c = t.src; (t.src = ""), (t.preload = "metadata"), t.addEventListener( "durationchange", function () { return n.container.classList.remove( "dplayer-loading" ); }, { once: !0 } ), d.add(c, function (t) { t.files .find(function (t) { return t.name.endsWith(".mp4"); }) .renderTo(n.video, { autoplay: n.options.autoplay, controls: !1 }); }), this.events.on("destroy", function () { d.remove(c), d.destroy(), delete n.plugins.webtorrent; }); } else this.notice("Error: Webtorrent is not supported."); else this.notice("Error: Can't find Webtorrent."); } } }, { key: "initVideo", value: function (t, e) { var n = this; this.initMSE(t, e), this.on("durationchange", function () { 1 !== t.duration && t.duration !== 1 / 0 && (n.template.dtime.innerHTML = B.secondToTime(t.duration)); }), this.on("progress", function () { var e = t.buffered.length ? t.buffered.end(t.buffered.length - 1) / t.duration : 0; n.bar.set("loaded", e, "width"); }), this.on("error", function () { n.video.error && n.tran && n.notice && "webtorrent" !== n.type && n.notice(n.tran("video-failed")); }), this.on("ended", function () { n.bar.set("played", 1, "width"), n.setting.loop ? (n.seek(0), n.play()) : n.pause(), n.danmaku && (n.danmaku.danIndex = 0); }), this.on("play", function () { n.paused && n.play(!0); }), this.on("pause", function () { n.paused || n.pause(!0); }), this.on("timeupdate", function () { n.bar.set("played", n.video.currentTime / n.video.duration, "width"); var t = B.secondToTime(n.video.currentTime); n.template.ptime.innerHTML !== t && (n.template.ptime.innerHTML = t); }); for ( var i = function (e) { t.addEventListener(n.events.videoEvents[e], function (t) { n.events.trigger(n.events.videoEvents[e], t); }); }, r = 0; r < this.events.videoEvents.length; r++ ) i(r); this.volume(this.user.get("volume"), !0, !0), this.options.subtitle && ((this.subtitle = new Kn( this.template.subtitle, this.video, this.options.subtitle, this.events )), Array.isArray(this.options.subtitle.url) && (this.subtitles = new Qn(this)), this.user.get("subtitle") || this.subtitle.hide()); } }, { key: "switchQuality", value: function (t) { var e = this; if ( ((t = "string" == typeof t ? parseInt(t) : t), this.qualityIndex !== t && !this.switchingQuality) ) { (this.prevIndex = this.qualityIndex), (this.qualityIndex = t), (this.switchingQuality = !0), (this.quality = this.options.video.quality[t]), (this.template.qualityButton.innerHTML = this.quality.name); var n = this.video.paused; this.video.pause(); var i = zi()({ current: !1, pic: null, screenshot: this.options.screenshot, preload: "auto", url: this.quality.url, subtitle: this.options.subtitle }), r = new DOMParser().parseFromString(i, "text/html").body.firstChild; this.template.videoWrap.insertBefore( r, this.template.videoWrap.getElementsByTagName("div")[0] ), (this.prevVideo = this.video), (this.video = r), this.initVideo(this.video, this.quality.type || this.options.video.type), this.seek(this.prevVideo.currentTime), this.notice( "".concat( this.tran("switching-quality").replace("%q", this.quality.name) ), -1, void 0, "switch-quality" ), this.events.trigger("quality_start", this.quality), this.on("canplay", function () { if (e.prevVideo) { if (e.video.currentTime !== e.prevVideo.currentTime) return void e.seek(e.prevVideo.currentTime); e.template.videoWrap.removeChild(e.prevVideo), e.video.classList.add("dplayer-video-current"), n || e.video.play(), (e.prevVideo = null), e.notice( "".concat( e .tran("switched-quality") .replace("%q", e.quality.name) ), void 0, void 0, "switch-quality" ), (e.switchingQuality = !1), e.events.trigger("quality_end"); } }), this.on("error", function () { e.video.error && e.prevVideo && (e.template.videoWrap.removeChild(e.video), (e.video = e.prevVideo), n || e.video.play(), (e.qualityIndex = e.prevIndex), (e.quality = e.options.video.quality[e.qualityIndex]), (e.noticeTime = setTimeout(function () { (e.template.notice.style.opacity = 0), e.events.trigger("notice_hide"); }, 3e3)), (e.prevVideo = null), (e.switchingQuality = !1)); }); } } }, { key: "notice", value: function (t) { var e, n, i, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2e3, a = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0.8, s = arguments.length > 3 ? arguments[3] : void 0; if ( (s && ((e = document.getElementById("dplayer-notice-".concat(s))) && (e.innerHTML = t), this.noticeList[s] && (clearTimeout(this.noticeList[s]), (this.noticeList[s] = null))), !e) ) { var o = kn.NewNotice(t, a, s); this.template.noticeList.appendChild(o), (e = o); } this.events.trigger("notice_show", e), r > 0 && (this.noticeList[s] = setTimeout( ((n = e), (i = this), function () { n.addEventListener("animationend", function () { i.template.noticeList.removeChild(n); }), n.classList.add("remove-notice"), i.events.trigger("notice_hide"), (i.noticeList[s] = null); }), r )); } }, { key: "resize", value: function () { this.danmaku && this.danmaku.resize(), this.controller.thumbnails && this.controller.thumbnails.resize( 160, (this.video.videoHeight / this.video.videoWidth) * 160, this.template.barWrap.offsetWidth ), this.events.trigger("resize"); } }, { key: "speed", value: function (t) { this.video.playbackRate = t; } }, { key: "destroy", value: function () { qi.splice(qi.indexOf(this), 1), this.pause(), document.removeEventListener("click", this.docClickFun, !0), this.container.removeEventListener("click", this.containerClickFun, !0), this.fullScreen.destroy(), this.hotkey.destroy(), this.contextmenu.destroy(), this.controller.destroy(), this.timer.destroy(), (this.video.src = ""), (this.container.innerHTML = ""), this.events.trigger("destroy"); } } ]), (i = [ { key: "version", get: function () { return "1.27.1"; } } ]), n && Yi(e.prototype, n), i && Yi(e, i), Object.defineProperty(e, "prototype", { writable: !1 }), t ); })(), Wi = Vi; console.log( "\n" .concat(" %c DPlayer v", "1.27.1", " ") .concat("v1.27.0-12-g4f61091", " %c https://dplayer.diygod.dev ", "\n", "\n"), "color: #fadfa3; background: #030307; padding:5px 0;", "background: #fadfa3; padding:5px 0;" ); var Qi = Wi; })(), i.default ); })()); })(G); var j = k(G.exports); function H(t) { return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t; } var Y = { exports: {} }; !(function (t, e) { var n, i, r, a, s; (n = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/), (i = /^(?=([^\/?#]*))\1([^]*)$/), (r = /(?:\/|^)\.(?=\/)/g), (a = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g), (s = { buildAbsoluteURL: function (t, e, n) { if (((n = n || {}), (t = t.trim()), !(e = e.trim()))) { if (!n.alwaysNormalize) return t; var r = s.parseURL(t); if (!r) throw new Error("Error trying to parse base URL."); return (r.path = s.normalizePath(r.path)), s.buildURLFromParts(r); } var a = s.parseURL(e); if (!a) throw new Error("Error trying to parse relative URL."); if (a.scheme) return n.alwaysNormalize ? ((a.path = s.normalizePath(a.path)), s.buildURLFromParts(a)) : e; var o = s.parseURL(t); if (!o) throw new Error("Error trying to parse base URL."); if (!o.netLoc && o.path && "/" !== o.path[0]) { var l = i.exec(o.path); (o.netLoc = l[1]), (o.path = l[2]); } o.netLoc && !o.path && (o.path = "/"); var d = { scheme: o.scheme, netLoc: a.netLoc, path: null, params: a.params, query: a.query, fragment: a.fragment }; if (!a.netLoc && ((d.netLoc = o.netLoc), "/" !== a.path[0])) if (a.path) { var c = o.path, u = c.substring(0, c.lastIndexOf("/") + 1) + a.path; d.path = s.normalizePath(u); } else (d.path = o.path), a.params || ((d.params = o.params), a.query || (d.query = o.query)); return ( null === d.path && (d.path = n.alwaysNormalize ? s.normalizePath(a.path) : a.path), s.buildURLFromParts(d) ); }, parseURL: function (t) { var e = n.exec(t); return e ? { scheme: e[1] || "", netLoc: e[2] || "", path: e[3] || "", params: e[4] || "", query: e[5] || "", fragment: e[6] || "" } : null; }, normalizePath: function (t) { for (t = t.split("").reverse().join("").replace(r, ""); t.length !== (t = t.replace(a, "")).length;); return t.split("").reverse().join(""); }, buildURLFromParts: function (t) { return t.scheme + t.netLoc + t.path + t.params + t.query + t.fragment; } }), (t.exports = s); })(Y); var $ = Y.exports; function K(t, e) { var n = Object.keys(t); if (Object.getOwnPropertySymbols) { var i = Object.getOwnPropertySymbols(t); e && (i = i.filter(function (e) { return Object.getOwnPropertyDescriptor(t, e).enumerable; })), n.push.apply(n, i); } return n; } function q(t) { for (var e = 1; e < arguments.length; e++) { var n = null != arguments[e] ? arguments[e] : {}; e % 2 ? K(Object(n), !0).forEach(function (e) { W(t, e, n[e]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : K(Object(n)).forEach(function (e) { Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e)); }); } return t; } function V(t) { var e = (function (t, e) { if ("object" != typeof t || !t) return t; var n = t[Symbol.toPrimitive]; if (void 0 !== n) { var i = n.call(t, e || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); })(t, "string"); return "symbol" == typeof e ? e : String(e); } function W(t, e, n) { return ( (e = V(e)) in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : (t[e] = n), t ); } function Q() { return ( (Q = Object.assign ? Object.assign.bind() : function (t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); } return t; }), Q.apply(this, arguments) ); } const X = Number.isFinite || function (t) { return "number" == typeof t && isFinite(t); }, J = Number.isSafeInteger || function (t) { return "number" == typeof t && Math.abs(t) <= Z; }, Z = Number.MAX_SAFE_INTEGER || 9007199254740991; let tt = (function (t) { return ( (t.MEDIA_ATTACHING = "hlsMediaAttaching"), (t.MEDIA_ATTACHED = "hlsMediaAttached"), (t.MEDIA_DETACHING = "hlsMediaDetaching"), (t.MEDIA_DETACHED = "hlsMediaDetached"), (t.BUFFER_RESET = "hlsBufferReset"), (t.BUFFER_CODECS = "hlsBufferCodecs"), (t.BUFFER_CREATED = "hlsBufferCreated"), (t.BUFFER_APPENDING = "hlsBufferAppending"), (t.BUFFER_APPENDED = "hlsBufferAppended"), (t.BUFFER_EOS = "hlsBufferEos"), (t.BUFFER_FLUSHING = "hlsBufferFlushing"), (t.BUFFER_FLUSHED = "hlsBufferFlushed"), (t.MANIFEST_LOADING = "hlsManifestLoading"), (t.MANIFEST_LOADED = "hlsManifestLoaded"), (t.MANIFEST_PARSED = "hlsManifestParsed"), (t.LEVEL_SWITCHING = "hlsLevelSwitching"), (t.LEVEL_SWITCHED = "hlsLevelSwitched"), (t.LEVEL_LOADING = "hlsLevelLoading"), (t.LEVEL_LOADED = "hlsLevelLoaded"), (t.LEVEL_UPDATED = "hlsLevelUpdated"), (t.LEVEL_PTS_UPDATED = "hlsLevelPtsUpdated"), (t.LEVELS_UPDATED = "hlsLevelsUpdated"), (t.AUDIO_TRACKS_UPDATED = "hlsAudioTracksUpdated"), (t.AUDIO_TRACK_SWITCHING = "hlsAudioTrackSwitching"), (t.AUDIO_TRACK_SWITCHED = "hlsAudioTrackSwitched"), (t.AUDIO_TRACK_LOADING = "hlsAudioTrackLoading"), (t.AUDIO_TRACK_LOADED = "hlsAudioTrackLoaded"), (t.SUBTITLE_TRACKS_UPDATED = "hlsSubtitleTracksUpdated"), (t.SUBTITLE_TRACKS_CLEARED = "hlsSubtitleTracksCleared"), (t.SUBTITLE_TRACK_SWITCH = "hlsSubtitleTrackSwitch"), (t.SUBTITLE_TRACK_LOADING = "hlsSubtitleTrackLoading"), (t.SUBTITLE_TRACK_LOADED = "hlsSubtitleTrackLoaded"), (t.SUBTITLE_FRAG_PROCESSED = "hlsSubtitleFragProcessed"), (t.CUES_PARSED = "hlsCuesParsed"), (t.NON_NATIVE_TEXT_TRACKS_FOUND = "hlsNonNativeTextTracksFound"), (t.INIT_PTS_FOUND = "hlsInitPtsFound"), (t.FRAG_LOADING = "hlsFragLoading"), (t.FRAG_LOAD_EMERGENCY_ABORTED = "hlsFragLoadEmergencyAborted"), (t.FRAG_LOADED = "hlsFragLoaded"), (t.FRAG_DECRYPTED = "hlsFragDecrypted"), (t.FRAG_PARSING_INIT_SEGMENT = "hlsFragParsingInitSegment"), (t.FRAG_PARSING_USERDATA = "hlsFragParsingUserdata"), (t.FRAG_PARSING_METADATA = "hlsFragParsingMetadata"), (t.FRAG_PARSED = "hlsFragParsed"), (t.FRAG_BUFFERED = "hlsFragBuffered"), (t.FRAG_CHANGED = "hlsFragChanged"), (t.FPS_DROP = "hlsFpsDrop"), (t.FPS_DROP_LEVEL_CAPPING = "hlsFpsDropLevelCapping"), (t.MAX_AUTO_LEVEL_UPDATED = "hlsMaxAutoLevelUpdated"), (t.ERROR = "hlsError"), (t.DESTROYING = "hlsDestroying"), (t.KEY_LOADING = "hlsKeyLoading"), (t.KEY_LOADED = "hlsKeyLoaded"), (t.LIVE_BACK_BUFFER_REACHED = "hlsLiveBackBufferReached"), (t.BACK_BUFFER_REACHED = "hlsBackBufferReached"), (t.STEERING_MANIFEST_LOADED = "hlsSteeringManifestLoaded"), t ); })({}), et = (function (t) { return ( (t.NETWORK_ERROR = "networkError"), (t.MEDIA_ERROR = "mediaError"), (t.KEY_SYSTEM_ERROR = "keySystemError"), (t.MUX_ERROR = "muxError"), (t.OTHER_ERROR = "otherError"), t ); })({}), nt = (function (t) { return ( (t.KEY_SYSTEM_NO_KEYS = "keySystemNoKeys"), (t.KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess"), (t.KEY_SYSTEM_NO_SESSION = "keySystemNoSession"), (t.KEY_SYSTEM_NO_CONFIGURED_LICENSE = "keySystemNoConfiguredLicense"), (t.KEY_SYSTEM_LICENSE_REQUEST_FAILED = "keySystemLicenseRequestFailed"), (t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED = "keySystemServerCertificateRequestFailed"), (t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED = "keySystemServerCertificateUpdateFailed"), (t.KEY_SYSTEM_SESSION_UPDATE_FAILED = "keySystemSessionUpdateFailed"), (t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED = "keySystemStatusOutputRestricted"), (t.KEY_SYSTEM_STATUS_INTERNAL_ERROR = "keySystemStatusInternalError"), (t.MANIFEST_LOAD_ERROR = "manifestLoadError"), (t.MANIFEST_LOAD_TIMEOUT = "manifestLoadTimeOut"), (t.MANIFEST_PARSING_ERROR = "manifestParsingError"), (t.MANIFEST_INCOMPATIBLE_CODECS_ERROR = "manifestIncompatibleCodecsError"), (t.LEVEL_EMPTY_ERROR = "levelEmptyError"), (t.LEVEL_LOAD_ERROR = "levelLoadError"), (t.LEVEL_LOAD_TIMEOUT = "levelLoadTimeOut"), (t.LEVEL_PARSING_ERROR = "levelParsingError"), (t.LEVEL_SWITCH_ERROR = "levelSwitchError"), (t.AUDIO_TRACK_LOAD_ERROR = "audioTrackLoadError"), (t.AUDIO_TRACK_LOAD_TIMEOUT = "audioTrackLoadTimeOut"), (t.SUBTITLE_LOAD_ERROR = "subtitleTrackLoadError"), (t.SUBTITLE_TRACK_LOAD_TIMEOUT = "subtitleTrackLoadTimeOut"), (t.FRAG_LOAD_ERROR = "fragLoadError"), (t.FRAG_LOAD_TIMEOUT = "fragLoadTimeOut"), (t.FRAG_DECRYPT_ERROR = "fragDecryptError"), (t.FRAG_PARSING_ERROR = "fragParsingError"), (t.FRAG_GAP = "fragGap"), (t.REMUX_ALLOC_ERROR = "remuxAllocError"), (t.KEY_LOAD_ERROR = "keyLoadError"), (t.KEY_LOAD_TIMEOUT = "keyLoadTimeOut"), (t.BUFFER_ADD_CODEC_ERROR = "bufferAddCodecError"), (t.BUFFER_INCOMPATIBLE_CODECS_ERROR = "bufferIncompatibleCodecsError"), (t.BUFFER_APPEND_ERROR = "bufferAppendError"), (t.BUFFER_APPENDING_ERROR = "bufferAppendingError"), (t.BUFFER_STALLED_ERROR = "bufferStalledError"), (t.BUFFER_FULL_ERROR = "bufferFullError"), (t.BUFFER_SEEK_OVER_HOLE = "bufferSeekOverHole"), (t.BUFFER_NUDGE_ON_STALL = "bufferNudgeOnStall"), (t.INTERNAL_EXCEPTION = "internalException"), (t.INTERNAL_ABORTED = "aborted"), (t.UNKNOWN = "unknown"), t ); })({}); const it = function () { }, rt = { trace: it, debug: it, log: it, warn: it, info: it, error: it }; let at = rt; function st(t, ...e) { e.forEach(function (e) { at[e] = t[e] ? t[e].bind(t) : (function (t) { const e = self.console[t]; return e ? e.bind(self.console, `[${t}] >`) : it; })(e); }); } const ot = at, lt = /^(\d+)x(\d+)$/, dt = /(.+?)=(".*?"|.*?)(?:,|$)/g; class ct { constructor(t) { "string" == typeof t && (t = ct.parseAttrList(t)), Q(this, t); } get clientAttrs() { return Object.keys(this).filter(t => "X-" === t.substring(0, 2)); } decimalInteger(t) { const e = parseInt(this[t], 10); return e > Number.MAX_SAFE_INTEGER ? 1 / 0 : e; } hexadecimalInteger(t) { if (this[t]) { let e = (this[t] || "0x").slice(2); e = (1 & e.length ? "0" : "") + e; const n = new Uint8Array(e.length / 2); for (let t = 0; t < e.length / 2; t++) n[t] = parseInt(e.slice(2 * t, 2 * t + 2), 16); return n; } return null; } hexadecimalIntegerAsNumber(t) { const e = parseInt(this[t], 16); return e > Number.MAX_SAFE_INTEGER ? 1 / 0 : e; } decimalFloatingPoint(t) { return parseFloat(this[t]); } optionalFloat(t, e) { const n = this[t]; return n ? parseFloat(n) : e; } enumeratedString(t) { return this[t]; } bool(t) { return "YES" === this[t]; } decimalResolution(t) { const e = lt.exec(this[t]); if (null !== e) return { width: parseInt(e[1], 10), height: parseInt(e[2], 10) }; } static parseAttrList(t) { let e; const n = {}; for (dt.lastIndex = 0; null !== (e = dt.exec(t));) { let t = e[2]; 0 === t.indexOf('"') && t.lastIndexOf('"') === t.length - 1 && (t = t.slice(1, -1)); n[e[1].trim()] = t; } return n; } } function ut(t) { return "SCTE35-OUT" === t || "SCTE35-IN" === t; } class ht { constructor(t, e) { if ( ((this.attr = void 0), (this._startDate = void 0), (this._endDate = void 0), (this._badValueForSameId = void 0), e) ) { const n = e.attr; for (const e in n) if (Object.prototype.hasOwnProperty.call(t, e) && t[e] !== n[e]) { ot.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`), (this._badValueForSameId = e); break; } t = Q(new ct({}), n, t); } if (((this.attr = t), (this._startDate = new Date(t["START-DATE"])), "END-DATE" in this.attr)) { const t = new Date(this.attr["END-DATE"]); X(t.getTime()) && (this._endDate = t); } } 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 t = this.duration; return null !== t ? new Date(this._startDate.getTime() + 1e3 * t) : null; } get duration() { if ("DURATION" in this.attr) { const t = this.attr.decimalFloatingPoint("DURATION"); if (X(t)) return t; } 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 && X(this.startDate.getTime()) && (null === this.duration || this.duration >= 0) && (!this.endOnNext || !!this.class) ); } } class pt { 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 ft = "audio", mt = "video", gt = "audiovideo"; class yt { constructor(t) { (this._byteRange = null), (this._url = null), (this.baseurl = void 0), (this.relurl = void 0), (this.elementaryStreams = { [ft]: null, [mt]: null, [gt]: null }), (this.baseurl = t); } setByteRange(t, e) { const n = t.split("@", 2); let i; (i = 1 === n.length ? (null == e ? void 0 : e.byteRangeEndOffset) || 0 : parseInt(n[1])), (this._byteRange = [i, parseInt(n[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 = $.buildAbsoluteURL(this.baseurl, this.relurl, { alwaysNormalize: !0 })), this._url || "" ); } set url(t) { this._url = t; } } class At extends yt { constructor(t, e) { super(e), (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 pt()), (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 = t); } get decryptdata() { const { levelkeys: t } = this; if (!t && !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 t = Object.keys(this.levelkeys); if (1 === t.length) return (this._decryptdata = this.levelkeys[t[0]].getDecryptData(this.sn)); } } return this._decryptdata; } get end() { return this.start + this.duration; } get endProgramDateTime() { if (null === this.programDateTime) return null; if (!X(this.programDateTime)) return null; const t = X(this.duration) ? this.duration : 0; return this.programDateTime + 1e3 * t; } get encrypted() { var t; if (null != (t = this._decryptdata) && t.encrypted) return !0; if (this.levelkeys) { const t = Object.keys(this.levelkeys), e = t.length; if (e > 1 || (1 === e && this.levelkeys[t[0]].encrypted)) return !0; } return !1; } setKeyFormat(t) { if (this.levelkeys) { const e = this.levelkeys[t]; e && !this._decryptdata && (this._decryptdata = e.getDecryptData(this.sn)); } } abortRequests() { var t, e; null == (t = this.loader) || t.abort(), null == (e = this.keyLoader) || e.abort(); } setElementaryStreamInfo(t, e, n, i, r, a = !1) { const { elementaryStreams: s } = this, o = s[t]; o ? ((o.startPTS = Math.min(o.startPTS, e)), (o.endPTS = Math.max(o.endPTS, n)), (o.startDTS = Math.min(o.startDTS, i)), (o.endDTS = Math.max(o.endDTS, r))) : (s[t] = { startPTS: e, endPTS: n, startDTS: i, endDTS: r, partial: a }); } clearElementaryStreamInfo() { const { elementaryStreams: t } = this; (t[ft] = null), (t[mt] = null), (t[gt] = null); } } class vt extends yt { constructor(t, e, n, i, r) { super(n), (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 pt()), (this.duration = t.decimalFloatingPoint("DURATION")), (this.gap = t.bool("GAP")), (this.independent = t.bool("INDEPENDENT")), (this.relurl = t.enumeratedString("URI")), (this.fragment = e), (this.index = i); const a = t.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: t } = this; return !!(t.audio || t.video || t.audiovideo); } } class bt { constructor(t) { (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 = t); } reloaded(t) { if (!t) return (this.advanced = !0), void (this.updated = !0); const e = this.lastPartSn - t.lastPartSn, n = this.lastPartIndex - t.lastPartIndex; (this.updated = this.endSN !== t.endSN || !!n || !!e || !this.live), (this.advanced = this.endSN > t.endSN || e > 0 || (0 === e && n > 0)), this.updated || this.advanced ? (this.misses = Math.floor(0.6 * t.misses)) : (this.misses = t.misses + 1), (this.availabilityDelay = t.availabilityDelay); } get hasProgramDateTime() { return !!this.fragments.length && X(this.fragments[this.fragments.length - 1].programDateTime); } get levelTargetDuration() { return this.averagetargetduration || this.targetduration || 10; } get drift() { const t = this.driftEndTime - this.driftStartTime; if (t > 0) { return (1e3 * (this.driftEnd - this.driftStart)) / t; } return 1; } get edge() { return this.partEnd || this.fragmentEnd; } get partEnd() { var t; return null != (t = this.partList) && t.length ? this.partList[this.partList.length - 1].end : this.fragmentEnd; } get fragmentEnd() { var t; return null != (t = this.fragments) && t.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 t; return null != (t = this.partList) && t.length ? this.partList[this.partList.length - 1].index : -1; } get lastPartSn() { var t; return null != (t = this.partList) && t.length ? this.partList[this.partList.length - 1].fragment.sn : this.endSN; } } function Et(t) { return Uint8Array.from(atob(t), t => t.charCodeAt(0)); } function wt(t) { const e = t.split(":"); let n = null; if ("data" === e[0] && 2 === e.length) { const t = e[1].split(";"), i = t[t.length - 1].split(","); if (2 === i.length) { const e = "base64" === i[0], r = i[1]; e ? (t.splice(-1, 1), (n = Et(r))) : (n = (function (t) { const e = xt(t).subarray(0, 16), n = new Uint8Array(16); return n.set(e, 16 - e.length), n; })(r)); } } return n; } function xt(t) { return Uint8Array.from(unescape(encodeURIComponent(t)), t => t.charCodeAt(0)); } const St = "undefined" != typeof self ? self : void 0; var _t = { CLEARKEY: "org.w3.clearkey", FAIRPLAY: "com.apple.fps", PLAYREADY: "com.microsoft.playready", WIDEVINE: "com.widevine.alpha" }, Tt = "org.w3.clearkey", kt = "com.apple.streamingkeydelivery", Ct = "com.microsoft.playready", Lt = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"; function It(t) { switch (t) { case kt: return _t.FAIRPLAY; case Ct: return _t.PLAYREADY; case Lt: return _t.WIDEVINE; case Tt: return _t.CLEARKEY; } } var Rt = "edef8ba979d64acea3c827dcd51d21ed"; function Dt(t) { switch (t) { case _t.FAIRPLAY: return kt; case _t.PLAYREADY: return Ct; case _t.WIDEVINE: return Lt; case _t.CLEARKEY: return Tt; } } function Bt(t) { const { drmSystems: e, widevineLicenseUrl: n } = t, i = e ? [_t.FAIRPLAY, _t.WIDEVINE, _t.PLAYREADY, _t.CLEARKEY].filter(t => !!e[t]) : []; return !i[_t.WIDEVINE] && n && i.push(_t.WIDEVINE), i; } const Pt = null != St && null != (Ut = St.navigator) && Ut.requestMediaKeySystemAccess ? self.navigator.requestMediaKeySystemAccess.bind(self.navigator) : null; var Ut; function Ft(t, e, n) { return Uint8Array.prototype.slice ? t.slice(e, n) : new Uint8Array(Array.prototype.slice.call(t, e, n)); } const Ot = (t, e) => e + 10 <= t.length && 73 === t[e] && 68 === t[e + 1] && 51 === t[e + 2] && t[e + 3] < 255 && t[e + 4] < 255 && t[e + 6] < 128 && t[e + 7] < 128 && t[e + 8] < 128 && t[e + 9] < 128, Mt = (t, e) => e + 10 <= t.length && 51 === t[e] && 68 === t[e + 1] && 73 === t[e + 2] && t[e + 3] < 255 && t[e + 4] < 255 && t[e + 6] < 128 && t[e + 7] < 128 && t[e + 8] < 128 && t[e + 9] < 128, Nt = (t, e) => { const n = e; let i = 0; for (; Ot(t, e);) { i += 10; (i += zt(t, e + 6)), Mt(t, e + 10) && (i += 10), (e += i); } if (i > 0) return t.subarray(n, n + i); }, zt = (t, e) => { let n = 0; return ( (n = (127 & t[e]) << 21), (n |= (127 & t[e + 1]) << 14), (n |= (127 & t[e + 2]) << 7), (n |= 127 & t[e + 3]), n ); }, Gt = (t, e) => Ot(t, e) && zt(t, e + 6) + 10 <= t.length - e, jt = t => { const e = $t(t); for (let t = 0; t < e.length; t++) { const n = e[t]; if (Ht(n)) return Qt(n); } }, Ht = t => t && "PRIV" === t.key && "com.apple.streaming.transportStreamTimestamp" === t.info, Yt = t => { const e = String.fromCharCode(t[0], t[1], t[2], t[3]), n = zt(t, 4); return { type: e, size: n, data: t.subarray(10, 10 + n) }; }, $t = t => { let e = 0; const n = []; for (; Ot(t, e);) { const i = zt(t, e + 6); e += 10; const r = e + i; for (; e + 8 < r;) { const i = Yt(t.subarray(e)), r = Kt(i); r && n.push(r), (e += i.size + 10); } Mt(t, e) && (e += 10); } return n; }, Kt = t => ("PRIV" === t.type ? qt(t) : "W" === t.type[0] ? Wt(t) : Vt(t)), qt = t => { if (t.size < 2) return; const e = Xt(t.data, !0), n = new Uint8Array(t.data.subarray(e.length + 1)); return { key: t.type, info: e, data: n.buffer }; }, Vt = t => { if (t.size < 2) return; if ("TXXX" === t.type) { let e = 1; const n = Xt(t.data.subarray(e), !0); e += n.length + 1; const i = Xt(t.data.subarray(e)); return { key: t.type, info: n, data: i }; } const e = Xt(t.data.subarray(1)); return { key: t.type, data: e }; }, Wt = t => { if ("WXXX" === t.type) { if (t.size < 2) return; let e = 1; const n = Xt(t.data.subarray(e), !0); e += n.length + 1; const i = Xt(t.data.subarray(e)); return { key: t.type, info: n, data: i }; } const e = Xt(t.data); return { key: t.type, data: e }; }, Qt = t => { if (8 === t.data.byteLength) { const e = new Uint8Array(t.data), n = 1 & e[3]; let i = (e[4] << 23) + (e[5] << 15) + (e[6] << 7) + e[7]; return (i /= 45), n && (i += 47721858.84), Math.round(i); } }, Xt = (t, e = !1) => { const n = Zt(); if (n) { const i = n.decode(t); if (e) { const t = i.indexOf("\0"); return -1 !== t ? i.substring(0, t) : i; } return i.replace(/\0/g, ""); } const i = t.length; let r, a, s, o = "", l = 0; for (; l < i;) { if (((r = t[l++]), 0 === r && e)) return o; if (0 !== r && 3 !== r) switch (r >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: o += String.fromCharCode(r); break; case 12: case 13: (a = t[l++]), (o += String.fromCharCode(((31 & r) << 6) | (63 & a))); break; case 14: (a = t[l++]), (s = t[l++]), (o += String.fromCharCode(((15 & r) << 12) | ((63 & a) << 6) | (63 & s))); } } return o; }; let Jt; function Zt() { if (!navigator.userAgent.includes("PlayStation 4")) return Jt || void 0 === self.TextDecoder || (Jt = new self.TextDecoder("utf-8")), Jt; } const te = function (t) { let e = ""; for (let n = 0; n < t.length; n++) { let i = t[n].toString(16); i.length < 2 && (i = "0" + i), (e += i); } return e; }, ee = Math.pow(2, 32) - 1, ne = [].push, ie = { video: 1, audio: 2, id3: 3, text: 4 }; function re(t) { return String.fromCharCode.apply(null, t); } function ae(t, e) { const n = (t[e] << 8) | t[e + 1]; return n < 0 ? 65536 + n : n; } function se(t, e) { const n = le(t, e); return n < 0 ? 4294967296 + n : n; } function oe(t, e) { let n = se(t, e); return (n *= Math.pow(2, 32)), (n += se(t, e + 4)), n; } function le(t, e) { return (t[e] << 24) | (t[e + 1] << 16) | (t[e + 2] << 8) | t[e + 3]; } function de(t, e, n) { (t[e] = n >> 24), (t[e + 1] = (n >> 16) & 255), (t[e + 2] = (n >> 8) & 255), (t[e + 3] = 255 & n); } function ce(t, e) { const n = []; if (!e.length) return n; const i = t.byteLength; for (let r = 0; r < i;) { const a = se(t, r), s = a > 1 ? r + a : i; if (re(t.subarray(r + 4, r + 8)) === e[0]) if (1 === e.length) n.push(t.subarray(r + 8, s)); else { const i = ce(t.subarray(r + 8, s), e.slice(1)); i.length && ne.apply(n, i); } r = s; } return n; } function ue(t) { const e = [], n = t[0]; let i = 8; const r = se(t, i); i += 4; let a = 0, s = 0; 0 === n ? ((a = se(t, i)), (s = se(t, i + 4)), (i += 8)) : ((a = oe(t, i)), (s = oe(t, i + 8)), (i += 16)), (i += 2); let o = t.length + s; const l = ae(t, i); i += 2; for (let n = 0; n < l; n++) { let n = i; const a = se(t, n); n += 4; const s = 2147483647 & a; if (1 === (2147483648 & a) >>> 31) return ot.warn("SIDX has hierarchical references (not supported)"), null; const l = se(t, n); (n += 4), e.push({ referenceSize: s, subsegmentDuration: l, info: { duration: l / r, start: o, end: o + s - 1 } }), (o += s), (n += 4), (i = n); } return { earliestPresentationTime: a, timescale: r, version: n, referencesCount: l, references: e }; } function he(t) { const e = [], n = ce(t, ["moov", "trak"]); for (let t = 0; t < n.length; t++) { const i = n[t], r = ce(i, ["tkhd"])[0]; if (r) { let t = r[0]; const n = se(r, 0 === t ? 12 : 20), a = ce(i, ["mdia", "mdhd"])[0]; if (a) { t = a[0]; const r = se(a, 0 === t ? 12 : 20), s = ce(i, ["mdia", "hdlr"])[0]; if (s) { const t = re(s.subarray(8, 12)), a = { soun: ft, vide: mt }[t]; if (a) { const t = pe(ce(i, ["mdia", "minf", "stbl", "stsd"])[0]); (e[n] = { timescale: r, type: a }), (e[a] = q({ timescale: r, id: n }, t)); } } } } } return ( ce(t, ["moov", "mvex", "trex"]).forEach(t => { const n = se(t, 4), i = e[n]; i && (i.default = { duration: se(t, 12), flags: se(t, 20) }); }), e ); } function pe(t) { const e = t.subarray(8), n = e.subarray(86), i = re(e.subarray(4, 8)); let r = i; const a = "enca" === i || "encv" === i; if (a) { const t = ce(e, [i])[0]; ce(t.subarray("enca" === i ? 28 : 78), ["sinf"]).forEach(t => { const e = ce(t, ["schm"])[0]; if (e) { const n = re(e.subarray(4, 8)); if ("cbcs" === n || "cenc" === n) { const e = ce(t, ["frma"])[0]; e && (r = re(e)); } } }); } switch (r) { case "avc1": case "avc2": case "avc3": case "avc4": { const t = ce(n, ["avcC"])[0]; r += "." + me(t[1]) + me(t[2]) + me(t[3]); break; } case "mp4a": { const t = ce(e, [i])[0], n = ce(t.subarray(28), ["esds"])[0]; if (n && n.length > 12) { let t = 4; if (3 !== n[t++]) break; (t = fe(n, t)), (t += 2); const e = n[t++]; if ((128 & e && (t += 2), 64 & e && (t += n[t++]), 4 !== n[t++])) break; t = fe(n, t); const i = n[t++]; if (64 !== i) break; if (((r += "." + me(i)), (t += 12), 5 !== n[t++])) break; t = fe(n, t); const a = n[t++]; let s = (248 & a) >> 3; 31 === s && (s += 1 + ((7 & a) << 3) + ((224 & n[t]) >> 5)), (r += "." + s); } break; } case "hvc1": case "hev1": { const t = ce(n, ["hvcC"])[0], e = t[1], i = ["", "A", "B", "C"][e >> 6], a = 31 & e, s = se(t, 2), o = (32 & e) >> 5 ? "H" : "L", l = t[12], d = t.subarray(6, 12); (r += "." + i + a), (r += "." + s.toString(16).toUpperCase()), (r += "." + o + l); let c = ""; for (let t = d.length; t--;) { const e = d[t]; if (e || c) { c = "." + e.toString(16).toUpperCase() + c; } } r += c; break; } case "dvh1": case "dvhe": { const t = ce(n, ["dvcC"])[0], e = (t[2] >> 1) & 127, i = ((t[2] << 5) & 32) | ((t[3] >> 3) & 31); r += "." + ge(e) + "." + ge(i); break; } case "vp09": { const t = ce(n, ["vpcC"])[0], e = t[4], i = t[5], a = (t[6] >> 4) & 15; r += "." + ge(e) + "." + ge(i) + "." + ge(a); break; } case "av01": { const t = ce(n, ["av1C"])[0], e = t[1] >>> 5, i = 31 & t[1], a = t[2] >>> 7 ? "H" : "M", s = (64 & t[2]) >> 6, o = (32 & t[2]) >> 5, l = 2 === e && s ? (o ? 12 : 10) : s ? 10 : 8, d = (16 & t[2]) >> 4, c = (8 & t[2]) >> 3, u = (4 & t[2]) >> 2, h = 3 & t[2], p = 1, f = 1, m = 1, g = 0; r += "." + e + "." + ge(i) + a + "." + ge(l) + "." + d + "." + c + u + h + "." + ge(p) + "." + ge(f) + "." + ge(m) + "." + g; break; } } return { codec: r, encrypted: a }; } function fe(t, e) { const n = e + 5; for (; 128 & t[e++] && e < n;); return e; } function me(t) { return ("0" + t.toString(16).toUpperCase()).slice(-2); } function ge(t) { return (t < 10 ? "0" : "") + t; } function ye(t) { const e = ce(t, ["schm"])[0]; if (e) { const n = re(e.subarray(4, 8)); if ("cbcs" === n || "cenc" === n) return ce(t, ["schi", "tenc"])[0]; } return ot.error("[eme] missing 'schm' box"), null; } function Ae(t) { const e = se(t, 0); let n = 8; 1 & e && (n += 4), 4 & e && (n += 4); let i = 0; const r = se(t, 4); for (let a = 0; a < r; a++) { if (256 & e) { (i += se(t, n)), (n += 4); } 512 & e && (n += 4), 1024 & e && (n += 4), 2048 & e && (n += 4); } return i; } function ve(t, e) { const n = new Uint8Array(t.length + e.length); return n.set(t), n.set(e, t.length), n; } function be(t, e) { const n = [], i = e.samples, r = e.timescale, a = e.id; let s = !1; return ( ce(i, ["moof"]).map(o => { const l = o.byteOffset - 8; ce(o, ["traf"]).map(o => { const d = ce(o, ["tfdt"]).map(t => { const e = t[0]; let n = se(t, 4); return 1 === e && ((n *= Math.pow(2, 32)), (n += se(t, 8))), n / r; })[0]; return ( void 0 !== d && (t = d), ce(o, ["tfhd"]).map(d => { const c = se(d, 4), u = 16777215 & se(d, 0); let h = 0; const p = !!(16 & u); let f = 0; const m = !!(32 & u); let g = 8; c === a && (!!(1 & u) && (g += 8), !!(2 & u) && (g += 4), !!(8 & u) && ((h = se(d, g)), (g += 4)), p && ((f = se(d, g)), (g += 4)), m && (g += 4), "video" === e.type && (s = (function (t) { if (!t) return !1; const e = t.indexOf("."), n = e < 0 ? t : t.substring(0, e); return "hvc1" === n || "hev1" === n || "dvh1" === n || "dvhe" === n; })(e.codec)), ce(o, ["trun"]).map(a => { const o = a[0], d = 16777215 & se(a, 0), c = !!(1 & d); let u = 0; const p = !!(4 & d), m = !!(256 & d); let g = 0; const y = !!(512 & d); let A = 0; const v = !!(1024 & d), b = !!(2048 & d); let E = 0; const w = se(a, 4); let x = 8; c && ((u = se(a, x)), (x += 4)), p && (x += 4); let S = u + l; for (let l = 0; l < w; l++) { if ( (m ? ((g = se(a, x)), (x += 4)) : (g = h), y ? ((A = se(a, x)), (x += 4)) : (A = f), v && (x += 4), b && ((E = 0 === o ? se(a, x) : le(a, x)), (x += 4)), e.type === mt) ) { let e = 0; for (; e < A;) { const a = se(i, S); if (((S += 4), Ee(s, i[S]))) { we(i.subarray(S, S + a), s ? 2 : 1, t + E / r, n); } (S += a), (e += a + 4); } } t += g / r; } })); }) ); }); }), n ); } function Ee(t, e) { if (t) { const t = (e >> 1) & 63; return 39 === t || 40 === t; } return 6 === (31 & e); } function we(t, e, n, i) { const r = xe(t); let a = 0; a += e; let s = 0, o = 0, l = 0; for (; a < r.length;) { s = 0; do { if (a >= r.length) break; (l = r[a++]), (s += l); } while (255 === l); o = 0; do { if (a >= r.length) break; (l = r[a++]), (o += l); } while (255 === l); const t = r.length - a; let e = a; if (o < t) a += o; else if (o > t) { ot.error(`Malformed SEI payload. ${o} is too small, only ${t} bytes left to parse.`); break; } if (4 === s) { if (181 === r[e++]) { const t = ae(r, e); if (((e += 2), 49 === t)) { const t = se(r, e); if (((e += 4), 1195456820 === t)) { const t = r[e++]; if (3 === t) { const a = r[e++], o = 64 & a, l = o ? 2 + 3 * (31 & a) : 0, d = new Uint8Array(l); if (o) { d[0] = a; for (let t = 1; t < l; t++) d[t] = r[e++]; } i.push({ type: t, payloadType: s, pts: n, bytes: d }); } } } } } else if (5 === s && o > 16) { const t = []; for (let n = 0; n < 16; n++) { const i = r[e++].toString(16); t.push(1 == i.length ? "0" + i : i), (3 !== n && 5 !== n && 7 !== n && 9 !== n) || t.push("-"); } const a = o - 16, l = new Uint8Array(a); for (let t = 0; t < a; t++) l[t] = r[e++]; i.push({ payloadType: s, pts: n, uuid: t.join(""), userData: Xt(l), userDataBytes: l }); } } } function xe(t) { const e = t.byteLength, n = []; let i = 1; for (; i < e - 2;) 0 === t[i] && 0 === t[i + 1] && 3 === t[i + 2] ? (n.push(i + 2), (i += 2)) : i++; if (0 === n.length) return t; const r = e - n.length, a = new Uint8Array(r); let s = 0; for (i = 0; i < r; s++, i++) s === n[0] && (s++, n.shift()), (a[i] = t[s]); return a; } function Se(t, e, n) { if (16 !== t.byteLength) throw new RangeError("Invalid system id"); let i, r, a; (i = 0), (r = new Uint8Array()), (a = new Uint8Array()); const s = new Uint8Array(4); return ( n && n.byteLength > 0 && new DataView(s.buffer).setUint32(0, n.byteLength, !1), (function (t, ...e) { const n = e.length; let i = 8, r = n; for (; r--;) i += e[r].byteLength; const a = new Uint8Array(i); for ( a[0] = (i >> 24) & 255, a[1] = (i >> 16) & 255, a[2] = (i >> 8) & 255, a[3] = 255 & i, a.set(t, 4), r = 0, i = 8; r < n; r++ ) a.set(e[r], i), (i += e[r].byteLength); return a; })([112, 115, 115, 104], new Uint8Array([0, 0, 0, 0]), t, a, r, s, n || new Uint8Array()) ); } let _e = {}; class Te { static clearKeyUriToKeyIdMap() { _e = {}; } constructor(t, e, n, i = [1], r = null) { (this.uri = void 0), (this.method = void 0), (this.keyFormat = void 0), (this.keyFormatVersions = void 0), (this.encrypted = void 0), (this.isCommonEncryption = void 0), (this.iv = null), (this.key = null), (this.keyId = null), (this.pssh = null), (this.method = t), (this.uri = e), (this.keyFormat = n), (this.keyFormatVersions = i), (this.iv = r), (this.encrypted = !!t && "NONE" !== t), (this.isCommonEncryption = this.encrypted && "AES-128" !== t); } isSupported() { if (this.method) { if ("AES-128" === this.method || "NONE" === this.method) return !0; if ("identity" === this.keyFormat) return "SAMPLE-AES" === this.method; switch (this.keyFormat) { case kt: case Lt: case Ct: case Tt: return -1 !== ["ISO-23001-7", "SAMPLE-AES", "SAMPLE-AES-CENC", "SAMPLE-AES-CTR"].indexOf(this.method); } } return !1; } getDecryptData(t) { if (!this.encrypted || !this.uri) return null; if ("AES-128" === this.method && this.uri && !this.iv) { "number" != typeof t && ("AES-128" !== this.method || this.iv || ot.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`), (t = 0)); const e = (function (t) { const e = new Uint8Array(16); for (let n = 12; n < 16; n++) e[n] = (t >> (8 * (15 - n))) & 255; return e; })(t); return new Te(this.method, this.uri, "identity", this.keyFormatVersions, e); } const e = wt(this.uri); if (e) switch (this.keyFormat) { case Lt: (this.pssh = e), e.length >= 22 && (this.keyId = e.subarray(e.length - 22, e.length - 6)); break; case Ct: { const t = new Uint8Array([154, 4, 240, 121, 152, 64, 66, 134, 171, 146, 230, 91, 224, 136, 95, 149]); this.pssh = Se(t, 0, e); const n = new Uint16Array(e.buffer, e.byteOffset, e.byteLength / 2), i = String.fromCharCode.apply(null, Array.from(n)), r = i.substring(i.indexOf("<"), i.length), a = new DOMParser().parseFromString(r, "text/xml").getElementsByTagName("KID")[0]; if (a) { const t = a.childNodes[0] ? a.childNodes[0].nodeValue : a.getAttribute("VALUE"); if (t) { const e = Et(t).subarray(0, 16); !(function (t) { const e = function (t, e, n) { const i = t[e]; (t[e] = t[n]), (t[n] = i); }; e(t, 0, 3), e(t, 1, 2), e(t, 4, 5), e(t, 6, 7); })(e), (this.keyId = e); } } break; } default: { let t = e.subarray(0, 16); if (16 !== t.length) { const e = new Uint8Array(16); e.set(t, 16 - t.length), (t = e); } this.keyId = t; break; } } if (!this.keyId || 16 !== this.keyId.byteLength) { let t = _e[this.uri]; if (!t) { const e = Object.keys(_e).length % Number.MAX_SAFE_INTEGER; t = new Uint8Array(16); new DataView(t.buffer, 12, 4).setUint32(0, e), (_e[this.uri] = t); } this.keyId = t; } return this; } } const ke = /\{\$([a-zA-Z0-9-_]+)\}/g; function Ce(t) { return ke.test(t); } function Le(t, e, n) { if (null !== t.variableList || t.hasVariableRefs) for (let i = n.length; i--;) { const r = n[i], a = e[r]; a && (e[r] = Ie(t, a)); } } function Ie(t, e) { if (null !== t.variableList || t.hasVariableRefs) { const n = t.variableList; return e.replace(ke, e => { const i = e.substring(2, e.length - 1), r = null == n ? void 0 : n[i]; return void 0 === r ? (t.playlistParsingError || (t.playlistParsingError = new Error( `Missing preceding EXT-X-DEFINE tag for Variable Reference: "${i}"` )), e) : r; }); } return e; } function Re(t, e, n) { let i, r, a = t.variableList; if ((a || (t.variableList = a = {}), "QUERYPARAM" in e)) { i = e.QUERYPARAM; try { const t = new self.URL(n).searchParams; if (!t.has(i)) throw new Error(`"${i}" does not match any query parameter in URI: "${n}"`); r = t.get(i); } catch (e) { t.playlistParsingError || (t.playlistParsingError = new Error(`EXT-X-DEFINE QUERYPARAM: ${e.message}`)); } } else (i = e.NAME), (r = e.VALUE); i in a ? t.playlistParsingError || (t.playlistParsingError = new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${i}"`)) : (a[i] = r || ""); } function De(t, e, n) { const i = e.IMPORT; if (n && i in n) { let e = t.variableList; e || (t.variableList = e = {}), (e[i] = n[i]); } else t.playlistParsingError || (t.playlistParsingError = new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`)); } function Be(t = !0) { if ("undefined" == typeof self) return; return ((t || !self.MediaSource) && self.ManagedMediaSource) || self.MediaSource || self.WebKitMediaSource; } const Pe = { audio: { a3ds: 1, "ac-3": 0.95, "ac-4": 1, alac: 0.9, alaw: 1, dra1: 1, "dts+": 1, "dts-": 1, dtsc: 1, dtse: 1, dtsh: 1, "ec-3": 0.9, enca: 1, fLaC: 0.9, flac: 0.9, FLAC: 0.9, g719: 1, g726: 1, m4ae: 1, mha1: 1, mha2: 1, mhm1: 1, mhm2: 1, mlpa: 1, mp4a: 1, "raw ": 1, Opus: 1, opus: 1, samr: 1, sawb: 1, sawp: 1, sevc: 1, sqcp: 1, ssmv: 1, twos: 1, ulaw: 1 }, video: { avc1: 1, avc2: 1, avc3: 1, avc4: 1, avcp: 1, av01: 0.8, drac: 1, dva1: 1, dvav: 1, dvh1: 0.7, dvhe: 0.7, encv: 1, hev1: 0.75, hvc1: 0.75, mjp2: 1, mp4v: 1, mvc1: 1, mvc2: 1, mvc3: 1, mvc4: 1, resv: 1, rv60: 1, s263: 1, svc1: 1, svc2: 1, "vc-1": 1, vp08: 1, vp09: 0.9 }, text: { stpp: 1, wvtt: 1 } }; function Ue(t, e, n = !0) { return !t.split(",").some(t => !Fe(t, e, n)); } function Fe(t, e, n = !0) { var i; const r = Be(n); return null != (i = null == r ? void 0 : r.isTypeSupported(Oe(t, e))) && i; } function Oe(t, e) { return `${e}/mp4;codecs="${t}"`; } function Me(t) { if (t) { const e = t.substring(0, 4); return Pe.video[e]; } return 2; } function Ne(t) { return t.split(",").reduce((t, e) => { const n = Pe.video[e]; return n ? (2 * n + t) / (t ? 3 : 2) : (Pe.audio[e] + t) / (t ? 2 : 1); }, 0); } const ze = {}; const Ge = /flac|opus/i; function je(t, e = !0) { return t.replace(Ge, t => (function (t, e = !0) { if (ze[t]) return ze[t]; const n = { flac: ["flac", "fLaC", "FLAC"], opus: ["opus", "Opus"] }[t]; for (let i = 0; i < n.length; i++) if (Fe(n[i], "audio", e)) return (ze[t] = n[i]), n[i]; return t; })(t.toLowerCase(), e) ); } function He(t, e) { return t && "mp4a" !== t ? t : e ? e.split(",")[0] : e; } const Ye = /#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g, $e = /#EXT-X-MEDIA:(.*)/g, Ke = /^#EXT(?:INF|-X-TARGETDURATION):/m, qe = new RegExp( [ /#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source, /(?!#) *(\S[\S ]*)/.source, /#EXT-X-BYTERANGE:*(.+)/.source, /#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, /#.*/.source ].join("|"), "g" ), Ve = new RegExp( [ /#(EXTM3U)/.source, /#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/ .source, /#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source, /#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source, /(#)([^:]*):(.*)/.source, /(#)(.*)(?:.*)\r?\n?/.source ].join("|") ); class We { static findGroup(t, e) { for (let n = 0; n < t.length; n++) { const i = t[n]; if (i.id === e) return i; } } static resolve(t, e) { return $.buildAbsoluteURL(e, t, { alwaysNormalize: !0 }); } static isMediaPlaylist(t) { return Ke.test(t); } static parseMasterPlaylist(t, e) { const n = { contentSteering: null, levels: [], playlistParsingError: null, sessionData: null, sessionKeys: null, startTimeOffset: null, variableList: null, hasVariableRefs: Ce(t) }, i = []; let r; for (Ye.lastIndex = 0; null != (r = Ye.exec(t));) if (r[1]) { var a; const t = new ct(r[1]); Le(n, t, [ "CODECS", "SUPPLEMENTAL-CODECS", "ALLOWED-CPC", "PATHWAY-ID", "STABLE-VARIANT-ID", "AUDIO", "VIDEO", "SUBTITLES", "CLOSED-CAPTIONS", "NAME" ]); const s = Ie(n, r[2]), o = { attrs: t, bitrate: t.decimalInteger("BANDWIDTH") || t.decimalInteger("AVERAGE-BANDWIDTH"), name: t.NAME, url: We.resolve(s, e) }, l = t.decimalResolution("RESOLUTION"); l && ((o.width = l.width), (o.height = l.height)), Je(t.CODECS, o), (null != (a = o.unknownCodecs) && a.length) || i.push(o), n.levels.push(o); } else if (r[3]) { const t = r[3], i = r[4]; switch (t) { case "SESSION-DATA": { const t = new ct(i); Le(n, t, ["DATA-ID", "LANGUAGE", "VALUE", "URI"]); const e = t["DATA-ID"]; e && (null === n.sessionData && (n.sessionData = {}), (n.sessionData[e] = t)); break; } case "SESSION-KEY": { const t = Qe(i, e, n); t.encrypted && t.isSupported() ? (null === n.sessionKeys && (n.sessionKeys = []), n.sessionKeys.push(t)) : ot.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${i}"`); break; } case "DEFINE": { const t = new ct(i); Le(n, t, ["NAME", "VALUE", "QUERYPARAM"]), Re(n, t, e); } break; case "CONTENT-STEERING": { const t = new ct(i); Le(n, t, ["SERVER-URI", "PATHWAY-ID"]), (n.contentSteering = { uri: We.resolve(t["SERVER-URI"], e), pathwayId: t["PATHWAY-ID"] || "." }); break; } case "START": n.startTimeOffset = Xe(i); } } const s = i.length > 0 && i.length < n.levels.length; return ( (n.levels = s ? i : n.levels), 0 === n.levels.length && (n.playlistParsingError = new Error("no levels found in manifest")), n ); } static parseMasterPlaylistMedia(t, e, n) { let i; const r = {}, a = n.levels, s = { AUDIO: a.map(t => ({ id: t.attrs.AUDIO, audioCodec: t.audioCodec })), SUBTITLES: a.map(t => ({ id: t.attrs.SUBTITLES, textCodec: t.textCodec })), "CLOSED-CAPTIONS": [] }; let o = 0; for ($e.lastIndex = 0; null !== (i = $e.exec(t));) { const t = new ct(i[1]), a = t.TYPE; if (a) { const i = s[a], l = r[a] || []; (r[a] = l), Le(n, t, [ "URI", "GROUP-ID", "LANGUAGE", "ASSOC-LANGUAGE", "STABLE-RENDITION-ID", "NAME", "INSTREAM-ID", "CHARACTERISTICS", "CHANNELS" ]); const d = t.LANGUAGE, c = t["ASSOC-LANGUAGE"], u = t.CHANNELS, h = t.CHARACTERISTICS, p = t["INSTREAM-ID"], f = { attrs: t, bitrate: 0, id: o++, groupId: t["GROUP-ID"] || "", name: t.NAME || d || "", type: a, default: t.bool("DEFAULT"), autoselect: t.bool("AUTOSELECT"), forced: t.bool("FORCED"), lang: d, url: t.URI ? We.resolve(t.URI, e) : "" }; if ( (c && (f.assocLang = c), u && (f.channels = u), h && (f.characteristics = h), p && (f.instreamId = p), null != i && i.length) ) { const t = We.findGroup(i, f.groupId) || i[0]; Ze(f, t, "audioCodec"), Ze(f, t, "textCodec"); } l.push(f); } } return r; } static parseLevelPlaylist(t, e, n, i, r, a) { const s = new bt(e), o = s.fragments; let l, d, c, u = null, h = 0, p = 0, f = 0, m = 0, g = null, y = new At(i, e), A = -1, v = !1, b = null; for (qe.lastIndex = 0, s.m3u8 = t, s.hasVariableRefs = Ce(t); null !== (l = qe.exec(t));) { v && ((v = !1), (y = new At(i, e)), (y.start = f), (y.sn = h), (y.cc = m), (y.level = n), u && ((y.initSegment = u), (y.rawProgramDateTime = u.rawProgramDateTime), (u.rawProgramDateTime = null), b && (y.setByteRange(b), (b = null)))); const t = l[1]; if (t) { y.duration = parseFloat(t); const e = (" " + l[2]).slice(1); (y.title = e || null), y.tagList.push(e ? ["INF", t, e] : ["INF", t]); } else if (l[3]) { if (X(y.duration)) { (y.start = f), c && nn(y, c, s), (y.sn = h), (y.level = n), (y.cc = m), o.push(y); const t = (" " + l[3]).slice(1); (y.relurl = Ie(s, t)), tn(y, g), (g = y), (f += y.duration), h++, (p = 0), (v = !0); } } else if (l[4]) { const t = (" " + l[4]).slice(1); g ? y.setByteRange(t, g) : y.setByteRange(t); } else if (l[5]) (y.rawProgramDateTime = (" " + l[5]).slice(1)), y.tagList.push(["PROGRAM-DATE-TIME", y.rawProgramDateTime]), -1 === A && (A = o.length); else { if (((l = l[0].match(Ve)), !l)) { ot.warn("No matches on slow regex match for level playlist!"); continue; } for (d = 1; d < l.length && void 0 === l[d]; d++); const t = (" " + l[d]).slice(1), r = (" " + l[d + 1]).slice(1), f = l[d + 2] ? (" " + l[d + 2]).slice(1) : ""; switch (t) { case "PLAYLIST-TYPE": s.type = r.toUpperCase(); break; case "MEDIA-SEQUENCE": h = s.startSN = parseInt(r); break; case "SKIP": { const t = new ct(r); Le(s, t, ["RECENTLY-REMOVED-DATERANGES"]); const e = t.decimalInteger("SKIPPED-SEGMENTS"); if (X(e)) { s.skippedSegments = e; for (let t = e; t--;) o.unshift(null); h += e; } const n = t.enumeratedString("RECENTLY-REMOVED-DATERANGES"); n && (s.recentlyRemovedDateranges = n.split("\t")); break; } case "TARGETDURATION": s.targetduration = Math.max(parseInt(r), 1); break; case "VERSION": s.version = parseInt(r); break; case "INDEPENDENT-SEGMENTS": case "EXTM3U": break; case "ENDLIST": s.live = !1; break; case "#": (r || f) && y.tagList.push(f ? [r, f] : [r]); break; case "DISCONTINUITY": m++, y.tagList.push(["DIS"]); break; case "GAP": (y.gap = !0), y.tagList.push([t]); break; case "BITRATE": y.tagList.push([t, r]); break; case "DATERANGE": { const t = new ct(r); Le(s, t, ["ID", "CLASS", "START-DATE", "END-DATE", "SCTE35-CMD", "SCTE35-OUT", "SCTE35-IN"]), Le(s, t, t.clientAttrs); const e = new ht(t, s.dateRanges[t.ID]); e.isValid || s.skippedSegments ? (s.dateRanges[e.id] = e) : ot.warn(`Ignoring invalid DATERANGE tag: "${r}"`), y.tagList.push(["EXT-X-DATERANGE", r]); break; } case "DEFINE": { const t = new ct(r); Le(s, t, ["NAME", "VALUE", "IMPORT", "QUERYPARAM"]), "IMPORT" in t ? De(s, t, a) : Re(s, t, e); } break; case "DISCONTINUITY-SEQUENCE": m = parseInt(r); break; case "KEY": { const t = Qe(r, e, s); if (t.isSupported()) { if ("NONE" === t.method) { c = void 0; break; } c || (c = {}), c[t.keyFormat] && (c = Q({}, c)), (c[t.keyFormat] = t); } else ot.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${r}"`); break; } case "START": s.startTimeOffset = Xe(r); break; case "MAP": { const t = new ct(r); if ((Le(s, t, ["BYTERANGE", "URI"]), y.duration)) { const r = new At(i, e); en(r, t, n, c), (u = r), (y.initSegment = u), u.rawProgramDateTime && !y.rawProgramDateTime && (y.rawProgramDateTime = u.rawProgramDateTime); } else { const e = y.byteRangeEndOffset; if (e) { const t = y.byteRangeStartOffset; b = `${e - t}@${t}`; } else b = null; en(y, t, n, c), (u = y), (v = !0); } break; } case "SERVER-CONTROL": { const t = new ct(r); (s.canBlockReload = t.bool("CAN-BLOCK-RELOAD")), (s.canSkipUntil = t.optionalFloat("CAN-SKIP-UNTIL", 0)), (s.canSkipDateRanges = s.canSkipUntil > 0 && t.bool("CAN-SKIP-DATERANGES")), (s.partHoldBack = t.optionalFloat("PART-HOLD-BACK", 0)), (s.holdBack = t.optionalFloat("HOLD-BACK", 0)); break; } case "PART-INF": { const t = new ct(r); s.partTarget = t.decimalFloatingPoint("PART-TARGET"); break; } case "PART": { let t = s.partList; t || (t = s.partList = []); const n = p > 0 ? t[t.length - 1] : void 0, i = p++, a = new ct(r); Le(s, a, ["BYTERANGE", "URI"]); const o = new vt(a, y, e, i, n); t.push(o), (y.duration += o.duration); break; } case "PRELOAD-HINT": { const t = new ct(r); Le(s, t, ["URI"]), (s.preloadHint = t); break; } case "RENDITION-REPORT": { const t = new ct(r); Le(s, t, ["URI"]), (s.renditionReports = s.renditionReports || []), s.renditionReports.push(t); break; } default: ot.warn(`line parsed but not handled: ${l}`); } } } g && !g.relurl ? (o.pop(), (f -= g.duration), s.partList && (s.fragmentHint = g)) : s.partList && (tn(y, g), (y.cc = m), (s.fragmentHint = y), c && nn(y, c, s)); const E = o.length, w = o[0], x = o[E - 1]; if (((f += s.skippedSegments * s.targetduration), f > 0 && E && x)) { s.averagetargetduration = f / E; const t = x.sn; (s.endSN = "initSegment" !== t ? t : 0), s.live || (x.endList = !0), w && (s.startCC = w.cc); } else (s.endSN = 0), (s.startCC = 0); return ( s.fragmentHint && (f += s.fragmentHint.duration), (s.totalduration = f), (s.endCC = m), A > 0 && (function (t, e) { let n = t[e]; for (let i = e; i--;) { const e = t[i]; if (!e) return; (e.programDateTime = n.programDateTime - 1e3 * e.duration), (n = e); } })(o, A), s ); } } function Qe(t, e, n) { var i, r; const a = new ct(t); Le(n, a, ["KEYFORMAT", "KEYFORMATVERSIONS", "URI", "IV", "URI"]); const s = null != (i = a.METHOD) ? i : "", o = a.URI, l = a.hexadecimalInteger("IV"), d = a.KEYFORMATVERSIONS, c = null != (r = a.KEYFORMAT) ? r : "identity"; o && a.IV && !l && ot.error(`Invalid IV: ${a.IV}`); const u = o ? We.resolve(o, e) : "", h = (d || "1").split("/").map(Number).filter(Number.isFinite); return new Te(s, u, c, h, l); } function Xe(t) { const e = new ct(t).decimalFloatingPoint("TIME-OFFSET"); return X(e) ? e : null; } function Je(t, e) { let n = (t || "").split(/[ ,]+/).filter(t => t); ["video", "audio", "text"].forEach(t => { const i = n.filter(e => (function (t, e) { const n = Pe[e]; return !!n && !!n[t.slice(0, 4)]; })(e, t) ); i.length && ((e[`${t}Codec`] = i.join(",")), (n = n.filter(t => -1 === i.indexOf(t)))); }), (e.unknownCodecs = n); } function Ze(t, e, n) { const i = e[n]; i && (t[n] = i); } function tn(t, e) { t.rawProgramDateTime ? (t.programDateTime = Date.parse(t.rawProgramDateTime)) : null != e && e.programDateTime && (t.programDateTime = e.endProgramDateTime), X(t.programDateTime) || ((t.programDateTime = null), (t.rawProgramDateTime = null)); } function en(t, e, n, i) { (t.relurl = e.URI), e.BYTERANGE && t.setByteRange(e.BYTERANGE), (t.level = n), (t.sn = "initSegment"), i && (t.levelkeys = i), (t.initSegment = null); } function nn(t, e, n) { t.levelkeys = e; const { encryptedFragments: i } = n; (i.length && i[i.length - 1].levelkeys === e) || !Object.keys(e).some(t => e[t].isCommonEncryption) || i.push(t); } var rn = "manifest", an = "level", sn = "audioTrack", on = "subtitleTrack", ln = "main", dn = "audio", cn = "subtitle"; function un(t) { const { type: e } = t; switch (e) { case sn: return dn; case on: return cn; default: return ln; } } function hn(t, e) { let n = t.url; return (void 0 !== n && 0 !== n.indexOf("data:")) || (n = e.url), n; } class pn { constructor(t) { (this.hls = void 0), (this.loaders = Object.create(null)), (this.variableList = null), (this.hls = t), this.registerListeners(); } startLoad(t) { } stopLoad() { this.destroyInternalLoaders(); } registerListeners() { const { hls: t } = this; t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.LEVEL_LOADING, this.onLevelLoading, this), t.on(tt.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), t.on(tt.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this); } unregisterListeners() { const { hls: t } = this; t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.LEVEL_LOADING, this.onLevelLoading, this), t.off(tt.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this), t.off(tt.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this); } createInternalLoader(t) { const e = this.hls.config, n = e.pLoader, i = e.loader, r = new (n || i)(e); return (this.loaders[t.type] = r), r; } getInternalLoader(t) { return this.loaders[t.type]; } resetInternalLoader(t) { this.loaders[t] && delete this.loaders[t]; } destroyInternalLoaders() { for (const t in this.loaders) { const e = this.loaders[t]; e && e.destroy(), this.resetInternalLoader(t); } } destroy() { (this.variableList = null), this.unregisterListeners(), this.destroyInternalLoaders(); } onManifestLoading(t, e) { const { url: n } = e; (this.variableList = null), this.load({ id: null, level: 0, responseType: "text", type: rn, url: n, deliveryDirectives: null }); } onLevelLoading(t, e) { const { id: n, level: i, pathwayId: r, url: a, deliveryDirectives: s } = e; this.load({ id: n, level: i, pathwayId: r, responseType: "text", type: an, url: a, deliveryDirectives: s }); } onAudioTrackLoading(t, e) { const { id: n, groupId: i, url: r, deliveryDirectives: a } = e; this.load({ id: n, groupId: i, level: null, responseType: "text", type: sn, url: r, deliveryDirectives: a }); } onSubtitleTrackLoading(t, e) { const { id: n, groupId: i, url: r, deliveryDirectives: a } = e; this.load({ id: n, groupId: i, level: null, responseType: "text", type: on, url: r, deliveryDirectives: a }); } load(t) { var e; const n = this.hls.config; let i, r = this.getInternalLoader(t); if (r) { const e = r.context; if (e && e.url === t.url && e.level === t.level) return void ot.trace("[playlist-loader]: playlist request ongoing"); ot.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`), r.abort(); } if ( ((i = t.type === rn ? n.manifestLoadPolicy.default : Q({}, n.playlistLoadPolicy.default, { timeoutRetry: null, errorRetry: null })), (r = this.createInternalLoader(t)), X(null == (e = t.deliveryDirectives) ? void 0 : e.part)) ) { let e; if ( (t.type === an && null !== t.level ? (e = this.hls.levels[t.level].details) : t.type === sn && null !== t.id ? (e = this.hls.audioTracks[t.id].details) : t.type === on && null !== t.id && (e = this.hls.subtitleTracks[t.id].details), e) ) { const t = e.partTarget, n = e.targetduration; if (t && n) { const e = 1e3 * Math.max(3 * t, 0.8 * n); i = Q({}, i, { maxTimeToFirstByteMs: Math.min(e, i.maxTimeToFirstByteMs), maxLoadTimeMs: Math.min(e, i.maxTimeToFirstByteMs) }); } } } const a = i.errorRetry || i.timeoutRetry || {}, s = { loadPolicy: i, timeout: i.maxLoadTimeMs, maxRetry: a.maxNumRetry || 0, retryDelay: a.retryDelayMs || 0, maxRetryDelay: a.maxRetryDelayMs || 0 }, o = { onSuccess: (t, e, n, i) => { const r = this.getInternalLoader(n); this.resetInternalLoader(n.type); const a = t.data; 0 === a.indexOf("#EXTM3U") ? ((e.parsing.start = performance.now()), We.isMediaPlaylist(a) ? this.handleTrackOrLevelPlaylist(t, e, n, i || null, r) : this.handleMasterPlaylist(t, e, n, i)) : this.handleManifestParsingError(t, n, new Error("no EXTM3U delimiter"), i || null, e); }, onError: (t, e, n, i) => { this.handleNetworkError(e, n, !1, t, i); }, onTimeout: (t, e, n) => { this.handleNetworkError(e, n, !0, void 0, t); } }; r.load(t, s, o); } handleMasterPlaylist(t, e, n, i) { const r = this.hls, a = t.data, s = hn(t, n), o = We.parseMasterPlaylist(a, s); if (o.playlistParsingError) return void this.handleManifestParsingError(t, n, o.playlistParsingError, i, e); const { contentSteering: l, levels: d, sessionData: c, sessionKeys: u, startTimeOffset: h, variableList: p } = o; this.variableList = p; const { AUDIO: f = [], SUBTITLES: m, "CLOSED-CAPTIONS": g } = We.parseMasterPlaylistMedia(a, s, o); if (f.length) { f.some(t => !t.url) || !d[0].audioCodec || d[0].attrs.AUDIO || (ot.log( "[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one" ), f.unshift({ type: "main", name: "main", groupId: "main", default: !1, autoselect: !1, forced: !1, id: -1, attrs: new ct({}), bitrate: 0, url: "" })); } r.trigger(tt.MANIFEST_LOADED, { levels: d, audioTracks: f, subtitles: m, captions: g, contentSteering: l, url: s, stats: e, networkDetails: i, sessionData: c, sessionKeys: u, startTimeOffset: h, variableList: p }); } handleTrackOrLevelPlaylist(t, e, n, i, r) { const a = this.hls, { id: s, level: o, type: l } = n, d = hn(t, n), c = X(o) ? o : X(s) ? s : 0, u = un(n), h = We.parseLevelPlaylist(t.data, d, c, u, 0, this.variableList); if (l === rn) { const t = { attrs: new ct({}), bitrate: 0, details: h, name: "", url: d }; a.trigger(tt.MANIFEST_LOADED, { levels: [t], audioTracks: [], url: d, stats: e, networkDetails: i, sessionData: null, sessionKeys: null, contentSteering: null, startTimeOffset: null, variableList: null }); } (e.parsing.end = performance.now()), (n.levelDetails = h), this.handlePlaylistLoaded(h, t, e, n, i, r); } handleManifestParsingError(t, e, n, i, r) { this.hls.trigger(tt.ERROR, { type: et.NETWORK_ERROR, details: nt.MANIFEST_PARSING_ERROR, fatal: e.type === rn, url: t.url, err: n, error: n, reason: n.message, response: t, context: e, networkDetails: i, stats: r }); } handleNetworkError(t, e, n = !1, i, r) { let a = `A network ${n ? "timeout" : "error" + (i ? " (status " + i.code + ")" : "")} occurred while loading ${t.type }`; t.type === an ? (a += `: ${t.level} id: ${t.id}`) : (t.type !== sn && t.type !== on) || (a += ` id: ${t.id} group-id: "${t.groupId}"`); const s = new Error(a); ot.warn(`[playlist-loader]: ${a}`); let o = nt.UNKNOWN, l = !1; const d = this.getInternalLoader(t); switch (t.type) { case rn: (o = n ? nt.MANIFEST_LOAD_TIMEOUT : nt.MANIFEST_LOAD_ERROR), (l = !0); break; case an: (o = n ? nt.LEVEL_LOAD_TIMEOUT : nt.LEVEL_LOAD_ERROR), (l = !1); break; case sn: (o = n ? nt.AUDIO_TRACK_LOAD_TIMEOUT : nt.AUDIO_TRACK_LOAD_ERROR), (l = !1); break; case on: (o = n ? nt.SUBTITLE_TRACK_LOAD_TIMEOUT : nt.SUBTITLE_LOAD_ERROR), (l = !1); } d && this.resetInternalLoader(t.type); const c = { type: et.NETWORK_ERROR, details: o, fatal: l, url: t.url, loader: d, context: t, error: s, networkDetails: e, stats: r }; if (i) { const n = (null == e ? void 0 : e.url) || t.url; c.response = q({ url: n, data: void 0 }, i); } this.hls.trigger(tt.ERROR, c); } handlePlaylistLoaded(t, e, n, i, r, a) { const s = this.hls, { type: o, level: l, id: d, groupId: c, deliveryDirectives: u } = i, h = hn(e, i), p = un(i), f = "number" == typeof i.level && p === ln ? l : void 0; if (!t.fragments.length) { const t = new Error("No Segments found in Playlist"); return void s.trigger(tt.ERROR, { type: et.NETWORK_ERROR, details: nt.LEVEL_EMPTY_ERROR, fatal: !1, url: h, error: t, reason: t.message, response: e, context: i, level: f, parent: p, networkDetails: r, stats: n }); } t.targetduration || (t.playlistParsingError = new Error("Missing Target Duration")); const m = t.playlistParsingError; if (m) s.trigger(tt.ERROR, { type: et.NETWORK_ERROR, details: nt.LEVEL_PARSING_ERROR, fatal: !1, url: h, error: m, reason: m.message, response: e, context: i, level: f, parent: p, networkDetails: r, stats: n }); else switch ( (t.live && a && (a.getCacheAge && (t.ageHeader = a.getCacheAge() || 0), (a.getCacheAge && !isNaN(t.ageHeader)) || (t.ageHeader = 0)), o) ) { case rn: case an: s.trigger(tt.LEVEL_LOADED, { details: t, level: f || 0, id: d || 0, stats: n, networkDetails: r, deliveryDirectives: u }); break; case sn: s.trigger(tt.AUDIO_TRACK_LOADED, { details: t, id: d || 0, groupId: c || "", stats: n, networkDetails: r, deliveryDirectives: u }); break; case on: s.trigger(tt.SUBTITLE_TRACK_LOADED, { details: t, id: d || 0, groupId: c || "", stats: n, networkDetails: r, deliveryDirectives: u }); } } } function fn(t, e) { let n; try { n = new Event("addtrack"); } catch (t) { (n = document.createEvent("Event")), n.initEvent("addtrack", !1, !1); } (n.track = t), e.dispatchEvent(n); } function mn(t, e) { const n = t.mode; if (("disabled" === n && (t.mode = "hidden"), t.cues && !t.cues.getCueById(e.id))) try { if ((t.addCue(e), !t.cues.getCueById(e.id))) throw new Error(`addCue is failed for: ${e}`); } catch (n) { ot.debug(`[texttrack-utils]: ${n}`); try { const n = new self.TextTrackCue(e.startTime, e.endTime, e.text); (n.id = e.id), t.addCue(n); } catch (t) { ot.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${t}`); } } "disabled" === n && (t.mode = n); } function gn(t) { const e = t.mode; if (("disabled" === e && (t.mode = "hidden"), t.cues)) for (let e = t.cues.length; e--;) t.removeCue(t.cues[e]); "disabled" === e && (t.mode = e); } function yn(t, e, n, i) { const r = t.mode; if (("disabled" === r && (t.mode = "hidden"), t.cues && t.cues.length > 0)) { const r = (function (t, e, n) { const i = [], r = (function (t, e) { if (e < t[0].startTime) return 0; const n = t.length - 1; if (e > t[n].endTime) return -1; let i = 0, r = n; for (; i <= r;) { const a = Math.floor((r + i) / 2); if (e < t[a].startTime) r = a - 1; else { if (!(e > t[a].startTime && i < n)) return a; i = a + 1; } } return t[i].startTime - e < e - t[r].startTime ? i : r; })(t, e); if (r > -1) for (let a = r, s = t.length; a < s; a++) { const r = t[a]; if (r.startTime >= e && r.endTime <= n) i.push(r); else if (r.startTime > n) return i; } return i; })(t.cues, e, n); for (let e = 0; e < r.length; e++) (i && !i(r[e])) || t.removeCue(r[e]); } "disabled" === r && (t.mode = r); } function An(t) { const e = []; for (let n = 0; n < t.length; n++) { const i = t[n]; ("subtitles" !== i.kind && "captions" !== i.kind) || !i.label || e.push(t[n]); } return e; } var vn = "org.id3", bn = "com.apple.quicktime.HLS", En = "https://aomedia.org/emsg/ID3"; function wn() { if ("undefined" != typeof self) return self.VTTCue || self.TextTrackCue; } function xn(t, e, n, i, r) { let a = new t(e, n, ""); try { (a.value = i), r && (a.type = r); } catch (s) { a = new t(e, n, JSON.stringify(r ? q({ type: r }, i) : i)); } return a; } const Sn = (() => { const t = wn(); try { t && new t(0, Number.POSITIVE_INFINITY, ""); } catch (t) { return Number.MAX_VALUE; } return Number.POSITIVE_INFINITY; })(); function _n(t, e) { return t.getTime() / 1e3 - e; } class Tn { constructor(t) { (this.hls = void 0), (this.id3Track = null), (this.media = null), (this.dateRangeCuesAppended = {}), (this.hls = t), this._registerListeners(); } destroy() { this._unregisterListeners(), (this.id3Track = null), (this.media = null), (this.dateRangeCuesAppended = {}), (this.hls = null); } _registerListeners() { const { hls: t } = this; t.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), t.on(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(tt.LEVEL_UPDATED, this.onLevelUpdated, this); } _unregisterListeners() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.FRAG_PARSING_METADATA, this.onFragParsingMetadata, this), t.off(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(tt.LEVEL_UPDATED, this.onLevelUpdated, this); } onMediaAttached(t, e) { this.media = e.media; } onMediaDetaching() { this.id3Track && (gn(this.id3Track), (this.id3Track = null), (this.media = null), (this.dateRangeCuesAppended = {})); } onManifestLoading() { this.dateRangeCuesAppended = {}; } createTrack(t) { const e = this.getID3Track(t.textTracks); return (e.mode = "hidden"), e; } getID3Track(t) { if (this.media) { for (let e = 0; e < t.length; e++) { const n = t[e]; if ("metadata" === n.kind && "id3" === n.label) return fn(n, this.media), n; } return this.media.addTextTrack("metadata", "id3"); } } onFragParsingMetadata(t, e) { if (!this.media) return; const { hls: { config: { enableEmsgMetadataCues: n, enableID3MetadataCues: i } } } = this; if (!n && !i) return; const { samples: r } = e; this.id3Track || (this.id3Track = this.createTrack(this.media)); const a = wn(); if (a) for (let t = 0; t < r.length; t++) { const e = r[t].type; if ((e === En && !n) || !i) continue; const s = $t(r[t].data); if (s) { const n = r[t].pts; let i = n + r[t].duration; i > Sn && (i = Sn); i - n <= 0 && (i = n + 0.25); for (let t = 0; t < s.length; t++) { const r = s[t]; if (!Ht(r)) { this.updateId3CueEnds(n, e); const t = xn(a, n, i, r, e); t && this.id3Track.addCue(t); } } } } } updateId3CueEnds(t, e) { var n; const i = null == (n = this.id3Track) ? void 0 : n.cues; if (i) for (let n = i.length; n--;) { const r = i[n]; r.type === e && r.startTime < t && r.endTime === Sn && (r.endTime = t); } } onBufferFlushing(t, { startOffset: e, endOffset: n, type: i }) { const { id3Track: r, hls: a } = this; if (!a) return; const { config: { enableEmsgMetadataCues: s, enableID3MetadataCues: o } } = a; if (r && (s || o)) { let t; (t = "audio" === i ? t => t.type === vn && o : "video" === i ? t => t.type === En && s : t => (t.type === vn && o) || (t.type === En && s)), yn(r, e, n, t); } } onLevelUpdated(t, { details: e }) { if (!this.media || !e.hasProgramDateTime || !this.hls.config.enableDateRangeMetadataCues) return; const { dateRangeCuesAppended: n, id3Track: i } = this, { dateRanges: r } = e, a = Object.keys(r); if (i) { const t = Object.keys(n).filter(t => !a.includes(t)); for (let e = t.length; e--;) { const r = t[e]; Object.keys(n[r].cues).forEach(t => { i.removeCue(n[r].cues[t]); }), delete n[r]; } } const s = e.fragments[e.fragments.length - 1]; if (0 === a.length || !X(null == s ? void 0 : s.programDateTime)) return; this.id3Track || (this.id3Track = this.createTrack(this.media)); const o = s.programDateTime / 1e3 - s.start, l = wn(); for (let t = 0; t < a.length; t++) { const e = a[t], i = r[e], s = _n(i.startDate, o), u = n[e], h = (null == u ? void 0 : u.cues) || {}; let p = (null == u ? void 0 : u.durationKnown) || !1, f = Sn; const m = i.endDate; if (m) (f = _n(m, o)), (p = !0); else if (i.endOnNext && !p) { const t = a.reduce((t, e) => { if (e !== i.id) { const n = r[e]; if (n.class === i.class && n.startDate > i.startDate && (!t || i.startDate < t.startDate)) return n; } return t; }, null); t && ((f = _n(t.startDate, o)), (p = !0)); } const g = Object.keys(i.attr); for (let t = 0; t < g.length; t++) { const n = g[t]; if ( "ID" === (c = n) || "CLASS" === c || "START-DATE" === c || "DURATION" === c || "END-DATE" === c || "END-ON-NEXT" === c ) continue; const r = h[n]; if (r) p && !u.durationKnown && (r.endTime = f); else if (l) { let t = i.attr[n]; ut(n) && ((d = t), (t = Uint8Array.from( d .replace(/^0x/, "") .replace(/([\da-fA-F]{2}) ?/g, "0x$1 ") .replace(/ +$/, "") .split(" ") ).buffer)); const r = xn(l, s, f, { key: n, data: t }, bn); r && ((r.id = e), this.id3Track.addCue(r), (h[n] = r)); } } n[e] = { cues: h, dateRange: i, durationKnown: p }; } var d, c; } } class kn { constructor(t) { (this.hls = void 0), (this.config = void 0), (this.media = null), (this.levelDetails = null), (this.currentTime = 0), (this.stallCount = 0), (this._latency = null), (this.timeupdateHandler = () => this.timeupdate()), (this.hls = t), (this.config = t.config), this.registerListeners(); } get latency() { return this._latency || 0; } get maxLatency() { const { config: t, levelDetails: e } = this; return void 0 !== t.liveMaxLatencyDuration ? t.liveMaxLatencyDuration : e ? t.liveMaxLatencyDurationCount * e.targetduration : 0; } get targetLatency() { const { levelDetails: t } = this; if (null === t) return null; const { holdBack: e, partHoldBack: n, targetduration: i } = t, { liveSyncDuration: r, liveSyncDurationCount: a, lowLatencyMode: s } = this.config, o = this.hls.userConfig; let l = (s && n) || e; (o.liveSyncDuration || o.liveSyncDurationCount || 0 === l) && (l = void 0 !== r ? r : a * i); const d = i; return l + Math.min(1 * this.stallCount, d); } get liveSyncPosition() { const t = this.estimateLiveEdge(), e = this.targetLatency, n = this.levelDetails; if (null === t || null === e || null === n) return null; const i = n.edge, r = t - e - this.edgeStalled, a = i - n.totalduration, s = i - ((this.config.lowLatencyMode && n.partTarget) || n.targetduration); return Math.min(Math.max(a, r), s); } get drift() { const { levelDetails: t } = this; return null === t ? 1 : t.drift; } get edgeStalled() { const { levelDetails: t } = this; if (null === t) return 0; const e = 3 * ((this.config.lowLatencyMode && t.partTarget) || t.targetduration); return Math.max(t.age - e, 0); } get forwardBufferLength() { const { media: t, levelDetails: e } = this; if (!t || !e) return 0; const n = t.buffered.length; return (n ? t.buffered.end(n - 1) : e.edge) - this.currentTime; } destroy() { this.unregisterListeners(), this.onMediaDetaching(), (this.levelDetails = null), (this.hls = this.timeupdateHandler = null); } registerListeners() { this.hls.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), this.hls.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.on(tt.LEVEL_UPDATED, this.onLevelUpdated, this), this.hls.on(tt.ERROR, this.onError, this); } unregisterListeners() { this.hls.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), this.hls.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.off(tt.LEVEL_UPDATED, this.onLevelUpdated, this), this.hls.off(tt.ERROR, this.onError, this); } onMediaAttached(t, e) { (this.media = e.media), this.media.addEventListener("timeupdate", this.timeupdateHandler); } onMediaDetaching() { this.media && (this.media.removeEventListener("timeupdate", this.timeupdateHandler), (this.media = null)); } onManifestLoading() { (this.levelDetails = null), (this._latency = null), (this.stallCount = 0); } onLevelUpdated(t, { details: e }) { (this.levelDetails = e), e.advanced && this.timeupdate(), !e.live && this.media && this.media.removeEventListener("timeupdate", this.timeupdateHandler); } onError(t, e) { var n; e.details === nt.BUFFER_STALLED_ERROR && (this.stallCount++, null != (n = this.levelDetails) && n.live && ot.warn("[playback-rate-controller]: Stall detected, adjusting target latency")); } timeupdate() { const { media: t, levelDetails: e } = this; if (!t || !e) return; this.currentTime = t.currentTime; const n = this.computeLatency(); if (null === n) return; this._latency = n; const { lowLatencyMode: i, maxLiveSyncPlaybackRate: r } = this.config; if (!i || 1 === r || !e.live) return; const a = this.targetLatency; if (null === a) return; const s = n - a; if (s < Math.min(this.maxLatency, a + e.targetduration) && s > 0.05 && this.forwardBufferLength > 1) { const e = Math.min(2, Math.max(1, r)), n = Math.round((2 / (1 + Math.exp(-0.75 * s - this.edgeStalled))) * 20) / 20; t.playbackRate = Math.min(e, Math.max(1, n)); } else 1 !== t.playbackRate && 0 !== t.playbackRate && (t.playbackRate = 1); } estimateLiveEdge() { const { levelDetails: t } = this; return null === t ? null : t.edge + t.age; } computeLatency() { const t = this.estimateLiveEdge(); return null === t ? null : t - this.currentTime; } } const Cn = ["NONE", "TYPE-0", "TYPE-1", null]; const Ln = ["SDR", "PQ", "HLG"]; var In = "", Rn = "YES", Dn = "v2"; function Bn(t) { const { canSkipUntil: e, canSkipDateRanges: n, age: i } = t; return e && i < e / 2 ? (n ? Dn : Rn) : In; } class Pn { constructor(t, e, n) { (this.msn = void 0), (this.part = void 0), (this.skip = void 0), (this.msn = t), (this.part = e), (this.skip = n); } addDirectives(t) { const e = new self.URL(t); return ( void 0 !== this.msn && e.searchParams.set("_HLS_msn", this.msn.toString()), void 0 !== this.part && e.searchParams.set("_HLS_part", this.part.toString()), this.skip && e.searchParams.set("_HLS_skip", this.skip), e.href ); } } class Un { constructor(t) { (this._attrs = void 0), (this.audioCodec = void 0), (this.bitrate = void 0), (this.codecSet = void 0), (this.url = void 0), (this.frameRate = void 0), (this.height = void 0), (this.id = void 0), (this.name = void 0), (this.videoCodec = void 0), (this.width = void 0), (this.details = void 0), (this.fragmentError = 0), (this.loadError = 0), (this.loaded = void 0), (this.realBitrate = 0), (this.supportedPromise = void 0), (this.supportedResult = void 0), (this._avgBitrate = 0), (this._audioGroups = void 0), (this._subtitleGroups = void 0), (this._urlId = 0), (this.url = [t.url]), (this._attrs = [t.attrs]), (this.bitrate = t.bitrate), t.details && (this.details = t.details), (this.id = t.id || 0), (this.name = t.name), (this.width = t.width || 0), (this.height = t.height || 0), (this.frameRate = t.attrs.optionalFloat("FRAME-RATE", 0)), (this._avgBitrate = t.attrs.decimalInteger("AVERAGE-BANDWIDTH")), (this.audioCodec = t.audioCodec), (this.videoCodec = t.videoCodec), (this.codecSet = [t.videoCodec, t.audioCodec] .filter(t => !!t) .map(t => t.substring(0, 4)) .join(",")), this.addGroupId("audio", t.attrs.AUDIO), this.addGroupId("text", t.attrs.SUBTITLES); } get maxBitrate() { return Math.max(this.realBitrate, this.bitrate); } get averageBitrate() { return this._avgBitrate || this.realBitrate || this.bitrate; } get attrs() { return this._attrs[0]; } get codecs() { return this.attrs.CODECS || ""; } get pathwayId() { return this.attrs["PATHWAY-ID"] || "."; } get videoRange() { return this.attrs["VIDEO-RANGE"] || "SDR"; } get score() { return this.attrs.optionalFloat("SCORE", 0); } get uri() { return this.url[0] || ""; } hasAudioGroup(t) { return Fn(this._audioGroups, t); } hasSubtitleGroup(t) { return Fn(this._subtitleGroups, t); } get audioGroups() { return this._audioGroups; } get subtitleGroups() { return this._subtitleGroups; } addGroupId(t, e) { if (e) if ("audio" === t) { let t = this._audioGroups; t || (t = this._audioGroups = []), -1 === t.indexOf(e) && t.push(e); } else if ("text" === t) { let t = this._subtitleGroups; t || (t = this._subtitleGroups = []), -1 === t.indexOf(e) && t.push(e); } } get urlId() { return 0; } set urlId(t) { } get audioGroupIds() { return this.audioGroups ? [this.audioGroupId] : void 0; } get textGroupIds() { return this.subtitleGroups ? [this.textGroupId] : void 0; } get audioGroupId() { var t; return null == (t = this.audioGroups) ? void 0 : t[0]; } get textGroupId() { var t; return null == (t = this.subtitleGroups) ? void 0 : t[0]; } addFallback() { } } function Fn(t, e) { return !(!e || !t) && -1 !== t.indexOf(e); } function On(t, e) { const n = e.startPTS; if (X(n)) { let i, r = 0; e.sn > t.sn ? ((r = n - t.start), (i = t)) : ((r = t.start - n), (i = e)), i.duration !== r && (i.duration = r); } else if (e.sn > t.sn) { t.cc === e.cc && t.minEndPTS ? (e.start = t.start + (t.minEndPTS - t.start)) : (e.start = t.start + t.duration); } else e.start = Math.max(t.start - e.duration, 0); } function Mn(t, e, n, i, r, a) { i - n <= 0 && (ot.warn("Fragment should have a positive duration", e), (i = n + e.duration), (a = r + e.duration)); let s = n, o = i; const l = e.startPTS, d = e.endPTS; if (X(l)) { const t = Math.abs(l - n); X(e.deltaPTS) ? (e.deltaPTS = Math.max(t, e.deltaPTS)) : (e.deltaPTS = t), (s = Math.max(n, l)), (n = Math.min(n, l)), (r = Math.min(r, e.startDTS)), (o = Math.min(i, d)), (i = Math.max(i, d)), (a = Math.max(a, e.endDTS)); } const c = n - e.start; 0 !== e.start && (e.start = n), (e.duration = i - e.start), (e.startPTS = n), (e.maxStartPTS = s), (e.startDTS = r), (e.endPTS = i), (e.minEndPTS = o), (e.endDTS = a); const u = e.sn; if (!t || u < t.startSN || u > t.endSN) return 0; let h; const p = u - t.startSN, f = t.fragments; for (f[p] = e, h = p; h > 0; h--) On(f[h], f[h - 1]); for (h = p; h < f.length - 1; h++) On(f[h], f[h + 1]); return t.fragmentHint && On(f[f.length - 1], t.fragmentHint), (t.PTSKnown = t.alignedSliding = !0), c; } function Nn(t, e) { let n = null; const i = t.fragments; for (let t = i.length - 1; t >= 0; t--) { const e = i[t].initSegment; if (e) { n = e; break; } } t.fragmentHint && delete t.fragmentHint.endPTS; let r, a = 0; if ( ((function (t, e, n) { const i = e.skippedSegments, r = Math.max(t.startSN, e.startSN) - e.startSN, a = (t.fragmentHint ? 1 : 0) + (i ? e.endSN : Math.min(t.endSN, e.endSN)) - e.startSN, s = e.startSN - t.startSN, o = e.fragmentHint ? e.fragments.concat(e.fragmentHint) : e.fragments, l = t.fragmentHint ? t.fragments.concat(t.fragmentHint) : t.fragments; for (let t = r; t <= a; t++) { const r = l[s + t]; let a = o[t]; i && !a && t < i && (a = e.fragments[t] = r), r && a && n(r, a); } })(t, e, (t, i) => { t.relurl && (a = t.cc - i.cc), X(t.startPTS) && X(t.endPTS) && ((i.start = i.startPTS = t.startPTS), (i.startDTS = t.startDTS), (i.maxStartPTS = t.maxStartPTS), (i.endPTS = t.endPTS), (i.endDTS = t.endDTS), (i.minEndPTS = t.minEndPTS), (i.duration = t.endPTS - t.startPTS), i.duration && (r = i), (e.PTSKnown = e.alignedSliding = !0)), (i.elementaryStreams = t.elementaryStreams), (i.loader = t.loader), (i.stats = t.stats), t.initSegment && ((i.initSegment = t.initSegment), (n = t.initSegment)); }), n) ) { (e.fragmentHint ? e.fragments.concat(e.fragmentHint) : e.fragments).forEach(t => { var e; !t || (t.initSegment && t.initSegment.relurl !== (null == (e = n) ? void 0 : e.relurl)) || (t.initSegment = n); }); } if (e.skippedSegments) if (((e.deltaUpdateFailed = e.fragments.some(t => !t)), e.deltaUpdateFailed)) { ot.warn("[level-helper] Previous playlist missing segments skipped in delta playlist"); for (let t = e.skippedSegments; t--;) e.fragments.shift(); (e.startSN = e.fragments[0].sn), (e.startCC = e.fragments[0].cc); } else e.canSkipDateRanges && (e.dateRanges = (function (t, e, n) { const i = Q({}, t); n && n.forEach(t => { delete i[t]; }); return ( Object.keys(e).forEach(t => { const n = new ht(e[t].attr, i[t]); n.isValid ? (i[t] = n) : ot.warn( `Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[t].attr)}"` ); }), i ); })(t.dateRanges, e.dateRanges, e.recentlyRemovedDateranges)); const s = e.fragments; if (a) { ot.warn("discontinuity sliding from playlist, take drift into account"); for (let t = 0; t < s.length; t++) s[t].cc += a; } e.skippedSegments && (e.startCC = e.fragments[0].cc), (function (t, e, n) { if (t && e) { let i = 0; for (let r = 0, a = t.length; r <= a; r++) { const a = t[r], s = e[r + i]; a && s && a.index === s.index && a.fragment.sn === s.fragment.sn ? n(a, s) : i--; } } })(t.partList, e.partList, (t, e) => { (e.elementaryStreams = t.elementaryStreams), (e.stats = t.stats); }), r ? Mn(e, r, r.startPTS, r.endPTS, r.startDTS, r.endDTS) : zn(t, e), s.length && (e.totalduration = e.edge - s[0].start), (e.driftStartTime = t.driftStartTime), (e.driftStart = t.driftStart); const o = e.advancedDateTime; if (e.advanced && o) { const t = e.edge; e.driftStart || ((e.driftStartTime = o), (e.driftStart = t)), (e.driftEndTime = o), (e.driftEnd = t); } else (e.driftEndTime = t.driftEndTime), (e.driftEnd = t.driftEnd), (e.advancedDateTime = t.advancedDateTime); } function zn(t, e) { const n = e.startSN + e.skippedSegments - t.startSN, i = t.fragments; n < 0 || n >= i.length || Gn(e, i[n].start); } function Gn(t, e) { if (e) { const n = t.fragments; for (let i = t.skippedSegments; i < n.length; i++) n[i].start += e; t.fragmentHint && (t.fragmentHint.start += e); } } function jn(t, e, n) { var i; return null != t && t.details ? Hn(null == (i = t.details) ? void 0 : i.partList, e, n) : null; } function Hn(t, e, n) { if (t) for (let i = t.length; i--;) { const r = t[i]; if (r.index === n && r.fragment.sn === e) return r; } return null; } function Yn(t) { t.forEach((t, e) => { const { details: n } = t; null != n && n.fragments && n.fragments.forEach(t => { t.level = e; }); }); } function $n(t) { switch (t.details) { case nt.FRAG_LOAD_TIMEOUT: case nt.KEY_LOAD_TIMEOUT: case nt.LEVEL_LOAD_TIMEOUT: case nt.MANIFEST_LOAD_TIMEOUT: return !0; } return !1; } function Kn(t, e) { const n = $n(e); return t.default[(n ? "timeout" : "error") + "Retry"]; } function qn(t, e) { const n = "linear" === t.backoff ? 1 : Math.pow(2, e); return Math.min(n * t.retryDelayMs, t.maxRetryDelayMs); } function Vn(t) { return q(q({}, t), { errorRetry: null, timeoutRetry: null }); } function Wn(t, e, n, i) { if (!t) return !1; const r = null == i ? void 0 : i.code, a = e < t.maxNumRetry && ((function (t) { return (0 === t && !1 === navigator.onLine) || (!!t && (t < 400 || t > 499)); })(r) || !!n); return t.shouldRetry ? t.shouldRetry(t, e, n, i, a) : a; } const Qn = function (t, e) { let n = 0, i = t.length - 1, r = null, a = null; for (; n <= i;) { (r = ((n + i) / 2) | 0), (a = t[r]); const s = e(a); if (s > 0) n = r + 1; else { if (!(s < 0)) return a; i = r - 1; } } return null; }; function Xn(t, e, n = 0, i = 0) { let r = null; if (t) { r = e[t.sn - e[0].sn + 1] || null; const i = t.endDTS - n; i > 0 && i < 15e-7 && (n += 15e-7); } else 0 === n && 0 === e[0].start && (r = e[0]); if (r && (!t || t.level === r.level) && 0 === Jn(n, i, r)) return r; const a = Qn(e, Jn.bind(null, n, i)); return !a || (a === t && r) ? r : a; } function Jn(t = 0, e = 0, n) { if (n.start <= t && n.start + n.duration > t) return 0; const i = Math.min(e, n.duration + (n.deltaPTS ? n.deltaPTS : 0)); return n.start + n.duration - i <= t ? 1 : n.start - i > t && n.start ? -1 : 0; } function Zn(t, e, n) { const i = 1e3 * Math.min(e, n.duration + (n.deltaPTS ? n.deltaPTS : 0)); return (n.endProgramDateTime || 0) - i > t; } var ti = 0, ei = 2, ni = 3, ii = 5, ri = 0, ai = 1, si = 2; class oi { constructor(t, e) { (this.hls = void 0), (this.timer = -1), (this.requestScheduled = -1), (this.canLoad = !1), (this.log = void 0), (this.warn = void 0), (this.log = ot.log.bind(ot, `${e}:`)), (this.warn = ot.warn.bind(ot, `${e}:`)), (this.hls = t); } destroy() { this.clearTimer(), (this.hls = this.log = this.warn = null); } clearTimer() { -1 !== this.timer && (self.clearTimeout(this.timer), (this.timer = -1)); } startLoad() { (this.canLoad = !0), (this.requestScheduled = -1), this.loadPlaylist(); } stopLoad() { (this.canLoad = !1), this.clearTimer(); } switchParams(t, e, n) { const i = null == e ? void 0 : e.renditionReports; if (i) { let r = -1; for (let n = 0; n < i.length; n++) { const a = i[n]; let s; try { s = new self.URL(a.URI, e.url).href; } catch (t) { ot.warn(`Could not construct new URL for Rendition Report: ${t}`), (s = a.URI || ""); } if (s === t) { r = n; break; } s === t.substring(0, s.length) && (r = n); } if (-1 !== r) { const t = i[r], a = parseInt(t["LAST-MSN"]) || (null == e ? void 0 : e.lastPartSn); let s = parseInt(t["LAST-PART"]) || (null == e ? void 0 : e.lastPartIndex); if (this.hls.config.lowLatencyMode) { const t = Math.min(e.age - e.partTarget, e.targetduration); s >= 0 && t > e.partTarget && (s += 1); } const o = n && Bn(n); return new Pn(a, s >= 0 ? s : void 0, o); } } } loadPlaylist(t) { -1 === this.requestScheduled && (this.requestScheduled = self.performance.now()); } shouldLoadPlaylist(t) { return this.canLoad && !!t && !!t.url && (!t.details || t.details.live); } shouldReloadPlaylist(t) { return -1 === this.timer && -1 === this.requestScheduled && this.shouldLoadPlaylist(t); } playlistLoaded(t, e, n) { const { details: i, stats: r } = e, a = self.performance.now(), s = r.loading.first ? Math.max(0, a - r.loading.first) : 0; if (((i.advancedDateTime = Date.now() - s), i.live || (null != n && n.live))) { if ( (i.reloaded(n), n && this.log( `live playlist ${t} ${i.advanced ? "REFRESHED " + i.lastPartSn + "-" + i.lastPartIndex : i.updated ? "UPDATED" : "MISSED" }` ), n && i.fragments.length > 0 && Nn(n, i), !this.canLoad || !i.live) ) return; let s, o, l; if (i.canBlockReload && i.endSN && i.advanced) { const t = this.hls.config.lowLatencyMode, r = i.lastPartSn, a = i.endSN, d = i.lastPartIndex, c = r === a; -1 !== d ? ((o = c ? a + 1 : r), (l = c ? (t ? 0 : d) : d + 1)) : (o = a + 1); const u = i.age, h = u + i.ageHeader; let p = Math.min(h - i.partTarget, 1.5 * i.targetduration); if (p > 0) { if (n && p > n.tuneInGoal) this.warn(`CDN Tune-in goal increased from: ${n.tuneInGoal} to: ${p} with playlist age: ${i.age}`), (p = 0); else { const t = Math.floor(p / i.targetduration); if (((o += t), void 0 !== l)) { l += Math.round((p % i.targetduration) / i.partTarget); } this.log( `CDN Tune-in age: ${i.ageHeader}s last advanced ${u.toFixed( 2 )}s goal: ${p} skip sn ${t} to part ${l}` ); } i.tuneInGoal = p; } if (((s = this.getDeliveryDirectives(i, e.deliveryDirectives, o, l)), t || !c)) return void this.loadPlaylist(s); } else (i.canBlockReload || i.canSkipUntil) && (s = this.getDeliveryDirectives(i, e.deliveryDirectives, o, l)); const d = this.hls.mainForwardBufferInfo, c = d ? d.end - d.len : 0, u = (function (t, e = 1 / 0) { let n = 1e3 * t.targetduration; if (t.updated) { const i = t.fragments, r = 4; if (i.length && n * r > e) { const t = 1e3 * i[i.length - 1].duration; t < n && (n = t); } } else n /= 2; return Math.round(n); })(i, 1e3 * (i.edge - c)); i.updated && a > this.requestScheduled + u && (this.requestScheduled = r.loading.start), void 0 !== o && i.canBlockReload ? (this.requestScheduled = r.loading.first + u - (1e3 * i.partTarget || 1e3)) : -1 === this.requestScheduled || this.requestScheduled + u < a ? (this.requestScheduled = a) : this.requestScheduled - a <= 0 && (this.requestScheduled += u); let h = this.requestScheduled - a; (h = Math.max(0, h)), this.log(`reload live playlist ${t} in ${Math.round(h)} ms`), (this.timer = self.setTimeout(() => this.loadPlaylist(s), h)); } else this.clearTimer(); } getDeliveryDirectives(t, e, n, i) { let r = Bn(t); return null != e && e.skip && t.deltaUpdateFailed && ((n = e.msn), (i = e.part), (r = In)), new Pn(n, i, r); } checkRetry(t) { const e = t.details, n = $n(t), i = t.errorAction, { action: r, retryCount: a = 0, retryConfig: s } = i || {}, o = !!i && !!s && (r === ii || (!i.resolved && r === ei)); if (o) { var l; if (((this.requestScheduled = -1), a >= s.maxNumRetry)) return !1; if (n && null != (l = t.context) && l.deliveryDirectives) this.warn(`Retrying playlist loading ${a + 1}/${s.maxNumRetry} after "${e}" without delivery-directives`), this.loadPlaylist(); else { const t = qn(s, a); (this.timer = self.setTimeout(() => this.loadPlaylist(), t)), this.warn(`Retrying playlist loading ${a + 1}/${s.maxNumRetry} after "${e}" in ${t}ms`); } (t.levelRetry = !0), (i.resolved = !0); } return o; } } class li { constructor(t, e = 0, n = 0) { (this.halfLife = void 0), (this.alpha_ = void 0), (this.estimate_ = void 0), (this.totalWeight_ = void 0), (this.halfLife = t), (this.alpha_ = t ? Math.exp(Math.log(0.5) / t) : 0), (this.estimate_ = e), (this.totalWeight_ = n); } sample(t, e) { const n = Math.pow(this.alpha_, t); (this.estimate_ = e * (1 - n) + n * this.estimate_), (this.totalWeight_ += t); } getTotalWeight() { return this.totalWeight_; } getEstimate() { if (this.alpha_) { const t = 1 - Math.pow(this.alpha_, this.totalWeight_); if (t) return this.estimate_ / t; } return this.estimate_; } } class di { constructor(t, e, n, i = 100) { (this.defaultEstimate_ = void 0), (this.minWeight_ = void 0), (this.minDelayMs_ = void 0), (this.slow_ = void 0), (this.fast_ = void 0), (this.defaultTTFB_ = void 0), (this.ttfb_ = void 0), (this.defaultEstimate_ = n), (this.minWeight_ = 0.001), (this.minDelayMs_ = 50), (this.slow_ = new li(t)), (this.fast_ = new li(e)), (this.defaultTTFB_ = i), (this.ttfb_ = new li(t)); } update(t, e) { const { slow_: n, fast_: i, ttfb_: r } = this; n.halfLife !== t && (this.slow_ = new li(t, n.getEstimate(), n.getTotalWeight())), i.halfLife !== e && (this.fast_ = new li(e, i.getEstimate(), i.getTotalWeight())), r.halfLife !== t && (this.ttfb_ = new li(t, r.getEstimate(), r.getTotalWeight())); } sample(t, e) { const n = (t = Math.max(t, this.minDelayMs_)) / 1e3, i = (8 * e) / n; this.fast_.sample(n, i), this.slow_.sample(n, i); } sampleTTFB(t) { const e = t / 1e3, n = Math.sqrt(2) * Math.exp(-Math.pow(e, 2) / 2); this.ttfb_.sample(n, Math.max(t, 5)); } canEstimate() { return this.fast_.getTotalWeight() >= this.minWeight_; } getEstimate() { return this.canEstimate() ? Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()) : this.defaultEstimate_; } getEstimateTTFB() { return this.ttfb_.getTotalWeight() >= this.minWeight_ ? this.ttfb_.getEstimate() : this.defaultTTFB_; } destroy() { } } const ci = { supported: !0, configurations: [], decodingInfoResults: [{ supported: !0, powerEfficient: !0, smooth: !0 }] }, ui = {}; function hi(t, e, n, i, r, a) { const s = t.audioCodec ? t.audioGroups : null, o = null == a ? void 0 : a.audioCodec, l = null == a ? void 0 : a.channels, d = l ? parseInt(l) : o ? 1 / 0 : 2; let c = null; if (null != s && s.length) try { c = 1 === s.length && s[0] ? e.groups[s[0]].channels : s.reduce( (t, n) => { if (n) { const i = e.groups[n]; if (!i) throw new Error(`Audio track group ${n} not found`); Object.keys(i.channels).forEach(e => { t[e] = (t[e] || 0) + i.channels[e]; }); } return t; }, { 2: 0 } ); } catch (t) { return !0; } return ( (void 0 !== t.videoCodec && ((t.width > 1920 && t.height > 1088) || (t.height > 1920 && t.width > 1088) || t.frameRate > Math.max(i, 30) || ("SDR" !== t.videoRange && t.videoRange !== n) || t.bitrate > Math.max(r, 8e6))) || (!!c && X(d) && Object.keys(c).some(t => parseInt(t) > d)) ); } function pi(t, e, n) { const i = t.videoCodec, r = t.audioCodec; if (!i || !r || !n) return Promise.resolve(ci); const a = { width: t.width, height: t.height, bitrate: Math.ceil(Math.max(0.9 * t.bitrate, t.averageBitrate)), framerate: t.frameRate || 30 }, s = t.videoRange; "SDR" !== s && (a.transferFunction = s.toLowerCase()); const o = i.split(",").map(t => ({ type: "media-source", video: q(q({}, a), {}, { contentType: Oe(t, "video") }) })); return ( r && t.audioGroups && t.audioGroups.forEach(t => { var n; t && (null == (n = e.groups[t]) || n.tracks.forEach(e => { if (e.groupId === t) { const t = e.channels || "", n = parseFloat(t); X(n) && n > 2 && o.push.apply( o, r .split(",") .map(t => ({ type: "media-source", audio: { contentType: Oe(t, "audio"), channels: "" + n } })) ); } })); }), Promise.all( o.map(t => { const e = (function (t) { const { audio: e, video: n } = t, i = n || e; if (i) { const t = i.contentType.split('"')[1]; if (n) return `r${n.height}x${n.width}f${Math.ceil(n.framerate)}${n.transferFunction || "sd" }_${t}_${Math.ceil(n.bitrate / 1e5)}`; if (e) return `c${e.channels}${e.spatialRendering ? "s" : "n"}_${t}`; } return ""; })(t); return ui[e] || (ui[e] = n.decodingInfo(t)); }) ) .then(t => ({ supported: !t.some(t => !t.supported), configurations: o, decodingInfoResults: t })) .catch(t => ({ supported: !1, configurations: o, decodingInfoResults: [], error: t })) ); } function fi(t, e) { let n = !1, i = []; return ( t && ((n = "SDR" !== t), (i = [t])), e && ((i = e.allowedVideoRanges || Ln.slice(0)), (n = void 0 !== e.preferHDR ? e.preferHDR : (function () { if ("function" == typeof matchMedia) { const t = matchMedia("(dynamic-range: high)"), e = matchMedia("bad query"); if (t.media !== e.media) return !0 === t.matches; } return !1; })()), (i = n ? i.filter(t => "SDR" !== t) : ["SDR"])), { preferHDR: n, allowedVideoRanges: i } ); } function mi(t, e) { ot.log(`[abr] start candidates with "${t}" ignored because ${e}`); } function gi(t, e, n) { if ("attrs" in t) { const n = e.indexOf(t); if (-1 !== n) return n; } for (let i = 0; i < e.length; i++) { if (yi(t, e[i], n)) return i; } return -1; } function yi(t, e, n) { const { groupId: i, name: r, lang: a, assocLang: s, characteristics: o, default: l } = t, d = t.forced; return ( (void 0 === i || e.groupId === i) && (void 0 === r || e.name === r) && (void 0 === a || e.lang === a) && (void 0 === a || e.assocLang === s) && (void 0 === l || e.default === l) && (void 0 === d || e.forced === d) && (void 0 === o || (function (t, e = "") { const n = t.split(","), i = e.split(","); return n.length === i.length && !n.some(t => -1 === i.indexOf(t)); })(o, e.characteristics)) && (void 0 === n || n(t, e)) ); } function Ai(t, e) { const { audioCodec: n, channels: i } = t; return !( (void 0 !== n && (e.audioCodec || "").substring(0, 4) !== n.substring(0, 4)) || (void 0 !== i && i !== (e.channels || "2")) ); } function vi(t, e, n) { for (let i = e; i; i--) if (n(t[i])) return i; for (let i = e + 1; i < t.length; i++) if (n(t[i])) return i; return -1; } class bi { constructor() { (this._boundTick = void 0), (this._tickTimer = null), (this._tickInterval = null), (this._tickCallCount = 0), (this._boundTick = this.tick.bind(this)); } destroy() { this.onHandlerDestroying(), this.onHandlerDestroyed(); } onHandlerDestroying() { this.clearNextTick(), this.clearInterval(); } onHandlerDestroyed() { } hasInterval() { return !!this._tickInterval; } hasNextTick() { return !!this._tickTimer; } setInterval(t) { return ( !this._tickInterval && ((this._tickCallCount = 0), (this._tickInterval = self.setInterval(this._boundTick, t)), !0) ); } clearInterval() { return !!this._tickInterval && (self.clearInterval(this._tickInterval), (this._tickInterval = null), !0); } clearNextTick() { return !!this._tickTimer && (self.clearTimeout(this._tickTimer), (this._tickTimer = null), !0); } tick() { this._tickCallCount++, 1 === this._tickCallCount && (this.doTick(), this._tickCallCount > 1 && this.tickImmediate(), (this._tickCallCount = 0)); } tickImmediate() { this.clearNextTick(), (this._tickTimer = self.setTimeout(this._boundTick, 0)); } doTick() { } } var Ei = "NOT_LOADED", wi = "APPENDING", xi = "PARTIAL", Si = "OK"; class _i { constructor(t) { (this.activePartLists = Object.create(null)), (this.endListFragments = Object.create(null)), (this.fragments = Object.create(null)), (this.timeRanges = Object.create(null)), (this.bufferPadding = 0.2), (this.hls = void 0), (this.hasGaps = !1), (this.hls = t), this._registerListeners(); } _registerListeners() { const { hls: t } = this; t.on(tt.BUFFER_APPENDED, this.onBufferAppended, this), t.on(tt.FRAG_BUFFERED, this.onFragBuffered, this), t.on(tt.FRAG_LOADED, this.onFragLoaded, this); } _unregisterListeners() { const { hls: t } = this; t.off(tt.BUFFER_APPENDED, this.onBufferAppended, this), t.off(tt.FRAG_BUFFERED, this.onFragBuffered, this), t.off(tt.FRAG_LOADED, this.onFragLoaded, this); } destroy() { this._unregisterListeners(), (this.fragments = this.activePartLists = this.endListFragments = this.timeRanges = null); } getAppendedFrag(t, e) { const n = this.activePartLists[e]; if (n) for (let e = n.length; e--;) { const i = n[e]; if (!i) break; const r = i.end; if (i.start <= t && null !== r && t <= r) return i; } return this.getBufferedFrag(t, e); } getBufferedFrag(t, e) { const { fragments: n } = this, i = Object.keys(n); for (let r = i.length; r--;) { const a = n[i[r]]; if ((null == a ? void 0 : a.body.type) === e && a.buffered) { const e = a.body; if (e.start <= t && t <= e.end) return e; } } return null; } detectEvictedFragments(t, e, n, i) { this.timeRanges && (this.timeRanges[t] = e); const r = (null == i ? void 0 : i.fragment.sn) || -1; Object.keys(this.fragments).forEach(i => { const a = this.fragments[i]; if (!a) return; if (r >= a.body.sn) return; if (!a.buffered && !a.loaded) return void (a.body.type === n && this.removeFragment(a.body)); const s = a.range[t]; s && s.time.some(t => { const n = !this.isTimeBuffered(t.startPTS, t.endPTS, e); return n && this.removeFragment(a.body), n; }); }); } detectPartialFragments(t) { const e = this.timeRanges, { frag: n, part: i } = t; if (!e || "initSegment" === n.sn) return; const r = ki(n), a = this.fragments[r]; if (!a || (a.buffered && n.gap)) return; const s = !n.relurl; if ( (Object.keys(e).forEach(t => { const r = n.elementaryStreams[t]; if (!r) return; const o = e[t], l = s || !0 === r.partial; a.range[t] = this.getBufferedTimes(n, i, l, o); }), (a.loaded = null), Object.keys(a.range).length) ) { a.buffered = !0; (a.body.endList = n.endList || a.body.endList) && (this.endListFragments[a.body.type] = a), Ti(a) || this.removeParts(n.sn - 1, n.type); } else this.removeFragment(a.body); } removeParts(t, e) { const n = this.activePartLists[e]; n && (this.activePartLists[e] = n.filter(e => e.fragment.sn >= t)); } fragBuffered(t, e) { const n = ki(t); let i = this.fragments[n]; !i && e && ((i = this.fragments[n] = { body: t, appendedPTS: null, loaded: null, buffered: !1, range: Object.create(null) }), t.gap && (this.hasGaps = !0)), i && ((i.loaded = null), (i.buffered = !0)); } getBufferedTimes(t, e, n, i) { const r = { time: [], partial: n }, a = t.start, s = t.end, o = t.minEndPTS || s, l = t.maxStartPTS || a; for (let t = 0; t < i.length; t++) { const e = i.start(t) - this.bufferPadding, n = i.end(t) + this.bufferPadding; if (l >= e && o <= n) { r.time.push({ startPTS: Math.max(a, i.start(t)), endPTS: Math.min(s, i.end(t)) }); break; } if (a < n && s > e) { const e = Math.max(a, i.start(t)), n = Math.min(s, i.end(t)); n > e && ((r.partial = !0), r.time.push({ startPTS: e, endPTS: n })); } else if (s <= e) break; } return r; } getPartialFragment(t) { let e, n, i, r = null, a = 0; const { bufferPadding: s, fragments: o } = this; return ( Object.keys(o).forEach(l => { const d = o[l]; d && Ti(d) && ((n = d.body.start - s), (i = d.body.end + s), t >= n && t <= i && ((e = Math.min(t - n, i - t)), a <= e && ((r = d.body), (a = e)))); }), r ); } isEndListAppended(t) { const e = this.endListFragments[t]; return void 0 !== e && (e.buffered || Ti(e)); } getState(t) { const e = ki(t), n = this.fragments[e]; return n ? (n.buffered ? (Ti(n) ? xi : Si) : wi) : Ei; } isTimeBuffered(t, e, n) { let i, r; for (let a = 0; a < n.length; a++) { if (((i = n.start(a) - this.bufferPadding), (r = n.end(a) + this.bufferPadding), t >= i && e <= r)) return !0; if (e <= i) return !1; } return !1; } onFragLoaded(t, e) { const { frag: n, part: i } = e; if ("initSegment" === n.sn || n.bitrateTest) return; const r = i ? null : e, a = ki(n); this.fragments[a] = { body: n, appendedPTS: null, loaded: r, buffered: !1, range: Object.create(null) }; } onBufferAppended(t, e) { const { frag: n, part: i, timeRanges: r } = e; if ("initSegment" === n.sn) return; const a = n.type; if (i) { let t = this.activePartLists[a]; t || (this.activePartLists[a] = t = []), t.push(i); } (this.timeRanges = r), Object.keys(r).forEach(t => { const e = r[t]; this.detectEvictedFragments(t, e, a, i); }); } onFragBuffered(t, e) { this.detectPartialFragments(e); } hasFragment(t) { const e = ki(t); return !!this.fragments[e]; } hasParts(t) { var e; return !(null == (e = this.activePartLists[t]) || !e.length); } removeFragmentsInRange(t, e, n, i, r) { (i && !this.hasGaps) || Object.keys(this.fragments).forEach(a => { const s = this.fragments[a]; if (!s) return; const o = s.body; o.type !== n || (i && !o.gap) || (o.start < e && o.end > t && (s.buffered || r) && this.removeFragment(o)); }); } removeFragment(t) { const e = ki(t); (t.stats.loaded = 0), t.clearElementaryStreamInfo(); const n = this.activePartLists[t.type]; if (n) { const e = t.sn; this.activePartLists[t.type] = n.filter(t => t.fragment.sn !== e); } delete this.fragments[e], t.endList && delete this.endListFragments[t.type]; } removeAllFragments() { (this.fragments = Object.create(null)), (this.endListFragments = Object.create(null)), (this.activePartLists = Object.create(null)), (this.hasGaps = !1); } } function Ti(t) { var e, n, i; return ( t.buffered && (t.body.gap || (null == (e = t.range.video) ? void 0 : e.partial) || (null == (n = t.range.audio) ? void 0 : n.partial) || (null == (i = t.range.audiovideo) ? void 0 : i.partial)) ); } function ki(t) { return `${t.type}_${t.level}_${t.sn}`; } const Ci = { length: 0, start: () => 0, end: () => 0 }; class Li { static isBuffered(t, e) { try { if (t) { const n = Li.getBuffered(t); for (let t = 0; t < n.length; t++) if (e >= n.start(t) && e <= n.end(t)) return !0; } } catch (t) { } return !1; } static bufferInfo(t, e, n) { try { if (t) { const i = Li.getBuffered(t), r = []; let a; for (a = 0; a < i.length; a++) r.push({ start: i.start(a), end: i.end(a) }); return this.bufferedInfo(r, e, n); } } catch (t) { } return { len: 0, start: e, end: e, nextStart: void 0 }; } static bufferedInfo(t, e, n) { (e = Math.max(0, e)), t.sort(function (t, e) { const n = t.start - e.start; return n || e.end - t.end; }); let i = []; if (n) for (let e = 0; e < t.length; e++) { const r = i.length; if (r) { const a = i[r - 1].end; t[e].start - a < n ? t[e].end > a && (i[r - 1].end = t[e].end) : i.push(t[e]); } else i.push(t[e]); } else i = t; let r, a = 0, s = e, o = e; for (let t = 0; t < i.length; t++) { const l = i[t].start, d = i[t].end; if (e + n >= l && e < d) (s = l), (o = d), (a = o - e); else if (e + n < l) { r = l; break; } } return { len: a, start: s || 0, end: o || 0, nextStart: r }; } static getBuffered(t) { try { return t.buffered; } catch (t) { return ot.log("failed to get media.buffered", t), Ci; } } } class Ii { constructor(t, e, n, i = 0, r = -1, a = !1) { (this.level = void 0), (this.sn = void 0), (this.part = void 0), (this.id = void 0), (this.size = void 0), (this.partial = void 0), (this.transmuxing = { start: 0, executeStart: 0, executeEnd: 0, end: 0 }), (this.buffering = { audio: { start: 0, executeStart: 0, executeEnd: 0, end: 0 }, video: { start: 0, executeStart: 0, executeEnd: 0, end: 0 }, audiovideo: { start: 0, executeStart: 0, executeEnd: 0, end: 0 } }), (this.level = t), (this.sn = e), (this.id = n), (this.size = i), (this.part = r), (this.partial = a); } } function Ri(t, e) { for (let i = 0, r = t.length; i < r; i++) { var n; if ((null == (n = t[i]) ? void 0 : n.cc) === e) return t[i]; } return null; } function Di(t, e) { if (t) { const n = t.start + e; (t.start = t.startPTS = n), (t.endPTS = n + t.duration); } } function Bi(t, e) { const n = e.fragments; for (let e = 0, i = n.length; e < i; e++) Di(n[e], t); e.fragmentHint && Di(e.fragmentHint, t), (e.alignedSliding = !0); } function Pi(t, e, n) { e && (!(function (t, e, n) { if ( (function (t, e, n) { return !(!e || !(n.endCC > n.startCC || (t && t.cc < n.startCC))); })(t, n, e) ) { const t = (function (t, e) { const n = t.fragments, i = e.fragments; if (!i.length || !n.length) return void ot.log("No fragments to align"); const r = Ri(n, i[0].cc); if (r && (!r || r.startPTS)) return r; ot.log("No frag in previous level to align on"); })(n, e); t && X(t.start) && (ot.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`), Bi(t.start, e)); } })(t, n, e), !n.alignedSliding && e && Ui(n, e), n.alignedSliding || !e || n.skippedSegments || zn(e, n)); } function Ui(t, e) { if (!t.hasProgramDateTime || !e.hasProgramDateTime) return; const n = t.fragments, i = e.fragments; if (!n.length || !i.length) return; let r, a; const s = Math.min(e.endCC, t.endCC); e.startCC < s && t.startCC < s && ((r = Ri(i, s)), (a = Ri(n, s))), (r && a) || ((r = i[Math.floor(i.length / 2)]), (a = Ri(n, r.cc) || n[Math.floor(n.length / 2)])); const o = r.programDateTime, l = a.programDateTime; if (!o || !l) return; Bi((l - o) / 1e3 - (a.start - r.start), t); } const Fi = Math.pow(2, 17); class Oi { constructor(t) { (this.config = void 0), (this.loader = null), (this.partLoadTimeout = -1), (this.config = t); } destroy() { this.loader && (this.loader.destroy(), (this.loader = null)); } abort() { this.loader && this.loader.abort(); } load(t, e) { const n = t.url; if (!n) return Promise.reject( new zi({ type: et.NETWORK_ERROR, details: nt.FRAG_LOAD_ERROR, fatal: !1, frag: t, error: new Error("Fragment does not have a " + (n ? "part list" : "url")), networkDetails: null }) ); this.abort(); const i = this.config, r = i.fLoader, a = i.loader; return new Promise((s, o) => { if ((this.loader && this.loader.destroy(), t.gap)) { if (t.tagList.some(t => "GAP" === t[0])) return void o(Ni(t)); t.gap = !1; } const l = (this.loader = t.loader = r ? new r(i) : new a(i)), d = Mi(t), c = Vn(i.fragLoadPolicy.default), u = { loadPolicy: c, timeout: c.maxLoadTimeMs, maxRetry: 0, retryDelay: 0, maxRetryDelay: 0, highWaterMark: "initSegment" === t.sn ? 1 / 0 : Fi }; (t.stats = l.stats), l.load(d, u, { onSuccess: (e, n, i, r) => { this.resetLoader(t, l); let a = e.data; i.resetIV && t.decryptdata && ((t.decryptdata.iv = new Uint8Array(a.slice(0, 16))), (a = a.slice(16))), s({ frag: t, part: null, payload: a, networkDetails: r }); }, onError: (e, i, r, a) => { this.resetLoader(t, l), o( new zi({ type: et.NETWORK_ERROR, details: nt.FRAG_LOAD_ERROR, fatal: !1, frag: t, response: q({ url: n, data: void 0 }, e), error: new Error(`HTTP Error ${e.code} ${e.text}`), networkDetails: r, stats: a }) ); }, onAbort: (e, n, i) => { this.resetLoader(t, l), o( new zi({ type: et.NETWORK_ERROR, details: nt.INTERNAL_ABORTED, fatal: !1, frag: t, error: new Error("Aborted"), networkDetails: i, stats: e }) ); }, onTimeout: (e, n, i) => { this.resetLoader(t, l), o( new zi({ type: et.NETWORK_ERROR, details: nt.FRAG_LOAD_TIMEOUT, fatal: !1, frag: t, error: new Error(`Timeout after ${u.timeout}ms`), networkDetails: i, stats: e }) ); }, onProgress: (n, i, r, a) => { e && e({ frag: t, part: null, payload: r, networkDetails: a }); } }); }); } loadPart(t, e, n) { this.abort(); const i = this.config, r = i.fLoader, a = i.loader; return new Promise((s, o) => { if ((this.loader && this.loader.destroy(), t.gap || e.gap)) return void o(Ni(t, e)); const l = (this.loader = t.loader = r ? new r(i) : new a(i)), d = Mi(t, e), c = Vn(i.fragLoadPolicy.default), u = { loadPolicy: c, timeout: c.maxLoadTimeMs, maxRetry: 0, retryDelay: 0, maxRetryDelay: 0, highWaterMark: Fi }; (e.stats = l.stats), l.load(d, u, { onSuccess: (i, r, a, o) => { this.resetLoader(t, l), this.updateStatsFromPart(t, e); const d = { frag: t, part: e, payload: i.data, networkDetails: o }; n(d), s(d); }, onError: (n, i, r, a) => { this.resetLoader(t, l), o( new zi({ type: et.NETWORK_ERROR, details: nt.FRAG_LOAD_ERROR, fatal: !1, frag: t, part: e, response: q({ url: d.url, data: void 0 }, n), error: new Error(`HTTP Error ${n.code} ${n.text}`), networkDetails: r, stats: a }) ); }, onAbort: (n, i, r) => { (t.stats.aborted = e.stats.aborted), this.resetLoader(t, l), o( new zi({ type: et.NETWORK_ERROR, details: nt.INTERNAL_ABORTED, fatal: !1, frag: t, part: e, error: new Error("Aborted"), networkDetails: r, stats: n }) ); }, onTimeout: (n, i, r) => { this.resetLoader(t, l), o( new zi({ type: et.NETWORK_ERROR, details: nt.FRAG_LOAD_TIMEOUT, fatal: !1, frag: t, part: e, error: new Error(`Timeout after ${u.timeout}ms`), networkDetails: r, stats: n }) ); } }); }); } updateStatsFromPart(t, e) { const n = t.stats, i = e.stats, r = i.total; if (((n.loaded += i.loaded), r)) { const i = Math.round(t.duration / e.duration), a = Math.min(Math.round(n.loaded / r), i), s = (i - a) * Math.round(n.loaded / a); n.total = n.loaded + s; } else n.total = Math.max(n.loaded, n.total); const a = n.loading, s = i.loading; a.start ? (a.first += s.first - s.start) : ((a.start = s.start), (a.first = s.first)), (a.end = s.end); } resetLoader(t, e) { (t.loader = null), this.loader === e && (self.clearTimeout(this.partLoadTimeout), (this.loader = null)), e.destroy(); } } function Mi(t, e = null) { const n = e || t, i = { frag: t, part: e, responseType: "arraybuffer", url: n.url, headers: {}, rangeStart: 0, rangeEnd: 0 }, r = n.byteRangeStartOffset, a = n.byteRangeEndOffset; if (X(r) && X(a)) { var s; let e = r, n = a; if ("initSegment" === t.sn && "AES-128" === (null == (s = t.decryptdata) ? void 0 : s.method)) { const t = a - r; t % 16 && (n = a + (16 - (t % 16))), 0 !== r && ((i.resetIV = !0), (e = r - 16)); } (i.rangeStart = e), (i.rangeEnd = n); } return i; } function Ni(t, e) { const n = new Error(`GAP ${t.gap ? "tag" : "attribute"} found`), i = { type: et.MEDIA_ERROR, details: nt.FRAG_GAP, fatal: !1, frag: t, error: n, networkDetails: null }; return e && (i.part = e), ((e || t).stats.aborted = !0), new zi(i); } class zi extends Error { constructor(t) { super(t.error.message), (this.data = void 0), (this.data = t); } } class Gi { constructor(t, e) { (this.subtle = void 0), (this.aesIV = void 0), (this.subtle = t), (this.aesIV = e); } decrypt(t, e) { return this.subtle.decrypt({ name: "AES-CBC", iv: this.aesIV }, e, t); } } class ji { constructor(t, e) { (this.subtle = void 0), (this.key = void 0), (this.subtle = t), (this.key = e); } expandKey() { return this.subtle.importKey("raw", this.key, { name: "AES-CBC" }, !1, ["encrypt", "decrypt"]); } } class Hi { constructor() { (this.rcon = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54]), (this.subMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)]), (this.invSubMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)]), (this.sBox = new Uint32Array(256)), (this.invSBox = new Uint32Array(256)), (this.key = new Uint32Array(0)), (this.ksRows = 0), (this.keySize = 0), (this.keySchedule = void 0), (this.invKeySchedule = void 0), this.initTable(); } uint8ArrayToUint32Array_(t) { const e = new DataView(t), n = new Uint32Array(4); for (let t = 0; t < 4; t++) n[t] = e.getUint32(4 * t); return n; } initTable() { const t = this.sBox, e = this.invSBox, n = this.subMix, i = n[0], r = n[1], a = n[2], s = n[3], o = this.invSubMix, l = o[0], d = o[1], c = o[2], u = o[3], h = new Uint32Array(256); let p = 0, f = 0, m = 0; for (m = 0; m < 256; m++) h[m] = m < 128 ? m << 1 : (m << 1) ^ 283; for (m = 0; m < 256; m++) { let n = f ^ (f << 1) ^ (f << 2) ^ (f << 3) ^ (f << 4); (n = (n >>> 8) ^ (255 & n) ^ 99), (t[p] = n), (e[n] = p); const o = h[p], m = h[o], g = h[m]; let y = (257 * h[n]) ^ (16843008 * n); (i[p] = (y << 24) | (y >>> 8)), (r[p] = (y << 16) | (y >>> 16)), (a[p] = (y << 8) | (y >>> 24)), (s[p] = y), (y = (16843009 * g) ^ (65537 * m) ^ (257 * o) ^ (16843008 * p)), (l[n] = (y << 24) | (y >>> 8)), (d[n] = (y << 16) | (y >>> 16)), (c[n] = (y << 8) | (y >>> 24)), (u[n] = y), p ? ((p = o ^ h[h[h[g ^ o]]]), (f ^= h[h[f]])) : (p = f = 1); } } expandKey(t) { const e = this.uint8ArrayToUint32Array_(t); let n = !0, i = 0; for (; i < e.length && n;) (n = e[i] === this.key[i]), i++; if (n) return; this.key = e; const r = (this.keySize = e.length); if (4 !== r && 6 !== r && 8 !== r) throw new Error("Invalid aes key size=" + r); const a = (this.ksRows = 4 * (r + 6 + 1)); let s, o; const l = (this.keySchedule = new Uint32Array(a)), d = (this.invKeySchedule = new Uint32Array(a)), c = this.sBox, u = this.rcon, h = this.invSubMix, p = h[0], f = h[1], m = h[2], g = h[3]; let y, A; for (s = 0; s < a; s++) s < r ? (y = l[s] = e[s]) : ((A = y), s % r == 0 ? ((A = (A << 8) | (A >>> 24)), (A = (c[A >>> 24] << 24) | (c[(A >>> 16) & 255] << 16) | (c[(A >>> 8) & 255] << 8) | c[255 & A]), (A ^= u[(s / r) | 0] << 24)) : r > 6 && s % r == 4 && (A = (c[A >>> 24] << 24) | (c[(A >>> 16) & 255] << 16) | (c[(A >>> 8) & 255] << 8) | c[255 & A]), (l[s] = y = (l[s - r] ^ A) >>> 0)); for (o = 0; o < a; o++) (s = a - o), (A = 3 & o ? l[s] : l[s - 4]), (d[o] = o < 4 || s <= 4 ? A : p[c[A >>> 24]] ^ f[c[(A >>> 16) & 255]] ^ m[c[(A >>> 8) & 255]] ^ g[c[255 & A]]), (d[o] = d[o] >>> 0); } networkToHostOrderSwap(t) { return (t << 24) | ((65280 & t) << 8) | ((16711680 & t) >> 8) | (t >>> 24); } decrypt(t, e, n) { const i = this.keySize + 6, r = this.invKeySchedule, a = this.invSBox, s = this.invSubMix, o = s[0], l = s[1], d = s[2], c = s[3], u = this.uint8ArrayToUint32Array_(n); let h = u[0], p = u[1], f = u[2], m = u[3]; const g = new Int32Array(t), y = new Int32Array(g.length); let A, v, b, E, w, x, S, _, T, k, C, L, I, R; const D = this.networkToHostOrderSwap; for (; e < g.length;) { for ( T = D(g[e]), k = D(g[e + 1]), C = D(g[e + 2]), L = D(g[e + 3]), w = T ^ r[0], x = L ^ r[1], S = C ^ r[2], _ = k ^ r[3], I = 4, R = 1; R < i; R++ ) (A = o[w >>> 24] ^ l[(x >> 16) & 255] ^ d[(S >> 8) & 255] ^ c[255 & _] ^ r[I]), (v = o[x >>> 24] ^ l[(S >> 16) & 255] ^ d[(_ >> 8) & 255] ^ c[255 & w] ^ r[I + 1]), (b = o[S >>> 24] ^ l[(_ >> 16) & 255] ^ d[(w >> 8) & 255] ^ c[255 & x] ^ r[I + 2]), (E = o[_ >>> 24] ^ l[(w >> 16) & 255] ^ d[(x >> 8) & 255] ^ c[255 & S] ^ r[I + 3]), (w = A), (x = v), (S = b), (_ = E), (I += 4); (A = (a[w >>> 24] << 24) ^ (a[(x >> 16) & 255] << 16) ^ (a[(S >> 8) & 255] << 8) ^ a[255 & _] ^ r[I]), (v = (a[x >>> 24] << 24) ^ (a[(S >> 16) & 255] << 16) ^ (a[(_ >> 8) & 255] << 8) ^ a[255 & w] ^ r[I + 1]), (b = (a[S >>> 24] << 24) ^ (a[(_ >> 16) & 255] << 16) ^ (a[(w >> 8) & 255] << 8) ^ a[255 & x] ^ r[I + 2]), (E = (a[_ >>> 24] << 24) ^ (a[(w >> 16) & 255] << 16) ^ (a[(x >> 8) & 255] << 8) ^ a[255 & S] ^ r[I + 3]), (y[e] = D(A ^ h)), (y[e + 1] = D(E ^ p)), (y[e + 2] = D(b ^ f)), (y[e + 3] = D(v ^ m)), (h = T), (p = k), (f = C), (m = L), (e += 4); } return y.buffer; } } class Yi { constructor(t, { removePKCS7Padding: e = !0 } = {}) { if ( ((this.logEnabled = !0), (this.removePKCS7Padding = void 0), (this.subtle = null), (this.softwareDecrypter = null), (this.key = null), (this.fastAesKey = null), (this.remainderData = null), (this.currentIV = null), (this.currentResult = null), (this.useSoftware = void 0), (this.useSoftware = t.enableSoftwareAES), (this.removePKCS7Padding = e), e) ) try { const t = self.crypto; t && (this.subtle = t.subtle || t.webkitSubtle); } catch (t) { } null === this.subtle && (this.useSoftware = !0); } destroy() { (this.subtle = null), (this.softwareDecrypter = null), (this.key = null), (this.fastAesKey = null), (this.remainderData = null), (this.currentIV = null), (this.currentResult = null); } isSync() { return this.useSoftware; } flush() { const { currentResult: t, remainderData: e } = this; if (!t || e) return this.reset(), null; const n = new Uint8Array(t); return ( this.reset(), this.removePKCS7Padding ? (function (t) { const e = t.byteLength, n = e && new DataView(t.buffer).getUint8(e - 1); return n ? Ft(t, 0, e - n) : t; })(n) : n ); } reset() { (this.currentResult = null), (this.currentIV = null), (this.remainderData = null), this.softwareDecrypter && (this.softwareDecrypter = null); } decrypt(t, e, n) { return this.useSoftware ? new Promise((i, r) => { this.softwareDecrypt(new Uint8Array(t), e, n); const a = this.flush(); a ? i(a.buffer) : r(new Error("[softwareDecrypt] Failed to decrypt data")); }) : this.webCryptoDecrypt(new Uint8Array(t), e, n); } softwareDecrypt(t, e, n) { const { currentIV: i, currentResult: r, remainderData: a } = this; this.logOnce("JS AES decrypt"), a && ((t = ve(a, t)), (this.remainderData = null)); const s = this.getValidChunk(t); if (!s.length) return null; i && (n = i); let o = this.softwareDecrypter; o || (o = this.softwareDecrypter = new Hi()), o.expandKey(e); const l = r; return (this.currentResult = o.decrypt(s.buffer, 0, n)), (this.currentIV = Ft(s, -16).buffer), l || null; } webCryptoDecrypt(t, e, n) { const i = this.subtle; return ( (this.key === e && this.fastAesKey) || ((this.key = e), (this.fastAesKey = new ji(i, e))), this.fastAesKey .expandKey() .then(e => { if (!i) return Promise.reject(new Error("web crypto not initialized")); this.logOnce("WebCrypto AES decrypt"); return new Gi(i, new Uint8Array(n)).decrypt(t.buffer, e); }) .catch( i => ( ot.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`), this.onWebCryptoError(t, e, n) ) ) ); } onWebCryptoError(t, e, n) { (this.useSoftware = !0), (this.logEnabled = !0), this.softwareDecrypt(t, e, n); const i = this.flush(); if (i) return i.buffer; throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data"); } getValidChunk(t) { let e = t; const n = t.length - (t.length % 16); return n !== t.length && ((e = Ft(t, 0, n)), (this.remainderData = Ft(t, n))), e; } logOnce(t) { this.logEnabled && (ot.log(`[decrypter]: ${t}`), (this.logEnabled = !1)); } } const $i = function (t) { let e = ""; const n = t.length; for (let i = 0; i < n; i++) e += `[${t.start(i).toFixed(3)}-${t.end(i).toFixed(3)}]`; return e; }, Ki = "STOPPED", qi = "IDLE", Vi = "KEY_LOADING", Wi = "FRAG_LOADING", Qi = "FRAG_LOADING_WAITING_RETRY", Xi = "WAITING_TRACK", Ji = "PARSING", Zi = "PARSED", tr = "ENDED", er = "ERROR", nr = "WAITING_INIT_PTS", ir = "WAITING_LEVEL"; class rr extends bi { constructor(t, e, n, i, r) { super(), (this.hls = void 0), (this.fragPrevious = null), (this.fragCurrent = null), (this.fragmentTracker = void 0), (this.transmuxer = null), (this._state = Ki), (this.playlistType = void 0), (this.media = null), (this.mediaBuffer = null), (this.config = void 0), (this.bitrateTest = !1), (this.lastCurrentTime = 0), (this.nextLoadPosition = 0), (this.startPosition = 0), (this.startTimeOffset = null), (this.loadedmetadata = !1), (this.retryDate = 0), (this.levels = null), (this.fragmentLoader = void 0), (this.keyLoader = void 0), (this.levelLastLoaded = null), (this.startFragRequested = !1), (this.decrypter = void 0), (this.initPTS = []), (this.onvseeking = null), (this.onvended = null), (this.logPrefix = ""), (this.log = void 0), (this.warn = void 0), (this.playlistType = r), (this.logPrefix = i), (this.log = ot.log.bind(ot, `${i}:`)), (this.warn = ot.warn.bind(ot, `${i}:`)), (this.hls = t), (this.fragmentLoader = new Oi(t.config)), (this.keyLoader = n), (this.fragmentTracker = e), (this.config = t.config), (this.decrypter = new Yi(t.config)), t.on(tt.MANIFEST_LOADED, this.onManifestLoaded, this); } doTick() { this.onTickEnd(); } onTickEnd() { } startLoad(t) { } stopLoad() { this.fragmentLoader.abort(), this.keyLoader.abort(this.playlistType); const t = this.fragCurrent; null != t && t.loader && (t.abortRequests(), this.fragmentTracker.removeFragment(t)), this.resetTransmuxer(), (this.fragCurrent = null), (this.fragPrevious = null), this.clearInterval(), this.clearNextTick(), (this.state = Ki); } _streamEnded(t, e) { if (e.live || t.nextStart || !t.end || !this.media) return !1; const n = e.partList; if (null != n && n.length) { const t = n[n.length - 1]; return Li.isBuffered(this.media, t.start + t.duration / 2); } const i = e.fragments[e.fragments.length - 1].type; return this.fragmentTracker.isEndListAppended(i); } getLevelDetails() { var t; if (this.levels && null !== this.levelLastLoaded) return null == (t = this.levelLastLoaded) ? void 0 : t.details; } onMediaAttached(t, e) { const n = (this.media = this.mediaBuffer = e.media); (this.onvseeking = this.onMediaSeeking.bind(this)), (this.onvended = this.onMediaEnded.bind(this)), n.addEventListener("seeking", this.onvseeking), n.addEventListener("ended", this.onvended); const i = this.config; this.levels && i.autoStartLoad && this.state === Ki && this.startLoad(i.startPosition); } onMediaDetaching() { const t = this.media; null != t && t.ended && (this.log("MSE detaching and video ended, reset startPosition"), (this.startPosition = this.lastCurrentTime = 0)), t && this.onvseeking && this.onvended && (t.removeEventListener("seeking", this.onvseeking), t.removeEventListener("ended", this.onvended), (this.onvseeking = this.onvended = null)), this.keyLoader && this.keyLoader.detach(), (this.media = this.mediaBuffer = null), (this.loadedmetadata = !1), this.fragmentTracker.removeAllFragments(), this.stopLoad(); } onMediaSeeking() { const { config: t, fragCurrent: e, media: n, mediaBuffer: i, state: r } = this, a = n ? n.currentTime : 0, s = Li.bufferInfo(i || n, a, t.maxBufferHole); if ((this.log(`media seeking to ${X(a) ? a.toFixed(3) : a}, state: ${r}`), this.state === tr)) this.resetLoadingState(); else if (e) { const n = t.maxFragLookUpTolerance, i = e.start - n, r = e.start + e.duration + n; if (!s.len || r < s.start || i > s.end) { const t = a > r; (a < i || t) && (t && e.loader && (this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"), e.abortRequests(), this.resetLoadingState()), (this.fragPrevious = null)); } } n && (this.fragmentTracker.removeFragmentsInRange(a, 1 / 0, this.playlistType, !0), (this.lastCurrentTime = a)), this.loadedmetadata || s.len || (this.nextLoadPosition = this.startPosition = a), this.tickImmediate(); } onMediaEnded() { this.startPosition = this.lastCurrentTime = 0; } onManifestLoaded(t, e) { (this.startTimeOffset = e.startTimeOffset), (this.initPTS = []); } onHandlerDestroying() { this.hls.off(tt.MANIFEST_LOADED, this.onManifestLoaded, this), this.stopLoad(), super.onHandlerDestroying(), (this.hls = null); } onHandlerDestroyed() { (this.state = Ki), this.fragmentLoader && this.fragmentLoader.destroy(), this.keyLoader && this.keyLoader.destroy(), this.decrypter && this.decrypter.destroy(), (this.hls = this.log = this.warn = this.decrypter = this.keyLoader = this.fragmentLoader = this.fragmentTracker = null), super.onHandlerDestroyed(); } loadFragment(t, e, n) { this._loadFragForPlayback(t, e, n); } _loadFragForPlayback(t, e, n) { this._doFragLoad(t, e, n, e => { if (this.fragContextChanged(t)) return ( this.warn( `Fragment ${t.sn}${e.part ? " p: " + e.part.index : ""} of level ${t.level } was dropped during download.` ), void this.fragmentTracker.removeFragment(t) ); t.stats.chunkCount++, this._handleFragmentLoadProgress(e); }) .then(e => { if (!e) return; const n = this.state; this.fragContextChanged(t) ? (n === Wi || (!this.fragCurrent && n === Ji)) && (this.fragmentTracker.removeFragment(t), (this.state = qi)) : ("payload" in e && (this.log(`Loaded fragment ${t.sn} of level ${t.level}`), this.hls.trigger(tt.FRAG_LOADED, e)), this._handleFragmentLoadComplete(e)); }) .catch(e => { this.state !== Ki && this.state !== er && (this.warn(e), this.resetFragmentLoading(t)); }); } clearTrackerIfNeeded(t) { var e; const { fragmentTracker: n } = this; if (n.getState(t) === wi) { const e = t.type, i = this.getFwdBufferInfo(this.mediaBuffer, e), r = Math.max(t.duration, i ? i.len : this.config.maxBufferLength); this.reduceMaxBufferLength(r) && n.removeFragment(t); } else 0 === (null == (e = this.mediaBuffer) ? void 0 : e.buffered.length) ? n.removeAllFragments() : n.hasParts(t.type) && (n.detectPartialFragments({ frag: t, part: null, stats: t.stats, id: t.type }), n.getState(t) === xi && n.removeFragment(t)); } checkLiveUpdate(t) { if (t.updated && !t.live) { const e = t.fragments[t.fragments.length - 1]; this.fragmentTracker.detectPartialFragments({ frag: e, part: null, stats: e.stats, id: e.type }); } t.fragments[0] || (t.deltaUpdateFailed = !0); } flushMainBuffer(t, e, n = null) { if (!(t - e)) return; const i = { startOffset: t, endOffset: e, type: n }; this.hls.trigger(tt.BUFFER_FLUSHING, i); } _loadInitSegment(t, e) { this._doFragLoad(t, e) .then(e => { if (!e || this.fragContextChanged(t) || !this.levels) throw new Error("init load aborted"); return e; }) .then(e => { const { hls: n } = this, { payload: i } = e, r = t.decryptdata; if (i && i.byteLength > 0 && null != r && r.key && r.iv && "AES-128" === r.method) { const a = self.performance.now(); return this.decrypter .decrypt(new Uint8Array(i), r.key.buffer, r.iv.buffer) .catch(e => { throw ( (n.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_DECRYPT_ERROR, fatal: !1, error: e, reason: e.message, frag: t }), e) ); }) .then(i => { const r = self.performance.now(); return ( n.trigger(tt.FRAG_DECRYPTED, { frag: t, payload: i, stats: { tstart: a, tdecrypt: r } }), (e.payload = i), this.completeInitSegmentLoad(e) ); }); } return this.completeInitSegmentLoad(e); }) .catch(e => { this.state !== Ki && this.state !== er && (this.warn(e), this.resetFragmentLoading(t)); }); } completeInitSegmentLoad(t) { const { levels: e } = this; if (!e) throw new Error("init load aborted, missing levels"); const n = t.frag.stats; (this.state = qi), (t.frag.data = new Uint8Array(t.payload)), (n.parsing.start = n.buffering.start = self.performance.now()), (n.parsing.end = n.buffering.end = self.performance.now()), this.tick(); } fragContextChanged(t) { const { fragCurrent: e } = this; return !t || !e || t.sn !== e.sn || t.level !== e.level; } fragBufferedComplete(t, e) { var n, i, r, a; const s = this.mediaBuffer ? this.mediaBuffer : this.media; if ( (this.log( `Buffered ${t.type} sn: ${t.sn}${e ? " part: " + e.index : ""} of ${this.playlistType === ln ? "level" : "track" } ${t.level} (frag:[${(null != (n = t.startPTS) ? n : NaN).toFixed(3)}-${(null != (i = t.endPTS) ? i : NaN ).toFixed(3)}] > buffer:${s ? $i(Li.getBuffered(s)) : "(detached)"})` ), "initSegment" !== t.sn) ) { var o; if (t.type !== cn) { const e = t.elementaryStreams; if (!Object.keys(e).some(t => !!e[t])) return void (this.state = qi); } const e = null == (o = this.levels) ? void 0 : o[t.level]; null != e && e.fragmentError && (this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`), (e.fragmentError = 0)); } (this.state = qi), s && (!this.loadedmetadata && t.type == ln && s.buffered.length && (null == (r = this.fragCurrent) ? void 0 : r.sn) === (null == (a = this.fragPrevious) ? void 0 : a.sn) && ((this.loadedmetadata = !0), this.seekToStartPos()), this.tick()); } seekToStartPos() { } _handleFragmentLoadComplete(t) { const { transmuxer: e } = this; if (!e) return; const { frag: n, part: i, partsLoaded: r } = t, a = !r || 0 === r.length || r.some(t => !t), s = new Ii(n.level, n.sn, n.stats.chunkCount + 1, 0, i ? i.index : -1, !a); e.flush(s); } _handleFragmentLoadProgress(t) { } _doFragLoad(t, e, n = null, i) { var r; const a = null == e ? void 0 : e.details; if (!this.levels || !a) throw new Error(`frag load aborted, missing level${a ? "" : " detail"}s`); let s = null; if ( (!t.encrypted || (null != (r = t.decryptdata) && r.key) ? !t.encrypted && a.encryptedFragments.length && this.keyLoader.loadClear(t, a.encryptedFragments) : (this.log( `Loading key for ${t.sn} of [${a.startSN}-${a.endSN}], ${"[stream-controller]" === this.logPrefix ? "level" : "track" } ${t.level}` ), (this.state = Vi), (this.fragCurrent = t), (s = this.keyLoader.load(t).then(t => { if (!this.fragContextChanged(t.frag)) return this.hls.trigger(tt.KEY_LOADED, t), this.state === Vi && (this.state = qi), t; })), this.hls.trigger(tt.KEY_LOADING, { frag: t }), null === this.fragCurrent && (s = Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))), (n = Math.max(t.start, n || 0)), this.config.lowLatencyMode && "initSegment" !== t.sn) ) { const r = a.partList; if (r && i) { n > t.end && a.fragmentHint && (t = a.fragmentHint); const o = this.getNextPart(r, t, n); if (o > -1) { const l = r[o]; let d; return ( this.log( `Loading part sn: ${t.sn} p: ${l.index} cc: ${t.cc} of playlist [${a.startSN}-${a.endSN }] parts [0-${o}-${r.length - 1}] ${"[stream-controller]" === this.logPrefix ? "level" : "track" }: ${t.level}, target: ${parseFloat(n.toFixed(3))}` ), (this.nextLoadPosition = l.start + l.duration), (this.state = Wi), (d = s ? s .then(n => !n || this.fragContextChanged(n.frag) ? null : this.doFragPartsLoad(t, l, e, i) ) .catch(t => this.handleFragLoadError(t)) : this.doFragPartsLoad(t, l, e, i).catch(t => this.handleFragLoadError(t))), this.hls.trigger(tt.FRAG_LOADING, { frag: t, part: l, targetBufferTime: n }), null === this.fragCurrent ? Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")) : d ); } if (!t.url || this.loadedEndOfParts(r, n)) return Promise.resolve(null); } } this.log( `Loading fragment ${t.sn} cc: ${t.cc} ${a ? "of [" + a.startSN + "-" + a.endSN + "] " : ""}${"[stream-controller]" === this.logPrefix ? "level" : "track" }: ${t.level}, target: ${parseFloat(n.toFixed(3))}` ), X(t.sn) && !this.bitrateTest && (this.nextLoadPosition = t.start + t.duration), (this.state = Wi); const o = this.config.progressive; let l; return ( (l = o && s ? s .then(e => !e || this.fragContextChanged(null == e ? void 0 : e.frag) ? null : this.fragmentLoader.load(t, i) ) .catch(t => this.handleFragLoadError(t)) : Promise.all([this.fragmentLoader.load(t, o ? i : void 0), s]) .then(([t]) => (!o && t && i && i(t), t)) .catch(t => this.handleFragLoadError(t))), this.hls.trigger(tt.FRAG_LOADING, { frag: t, targetBufferTime: n }), null === this.fragCurrent ? Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")) : l ); } doFragPartsLoad(t, e, n, i) { return new Promise((r, a) => { var s; const o = [], l = null == (s = n.details) ? void 0 : s.partList, d = e => { this.fragmentLoader .loadPart(t, e, i) .then(i => { o[e.index] = i; const a = i.part; this.hls.trigger(tt.FRAG_LOADED, i); const s = jn(n, t.sn, e.index + 1) || Hn(l, t.sn, e.index + 1); if (!s) return r({ frag: t, part: a, partsLoaded: o }); d(s); }) .catch(a); }; d(e); }); } handleFragLoadError(t) { if ("data" in t) { const e = t.data; t.data && e.details === nt.INTERNAL_ABORTED ? this.handleFragLoadAborted(e.frag, e.part) : this.hls.trigger(tt.ERROR, e); } else this.hls.trigger(tt.ERROR, { type: et.OTHER_ERROR, details: nt.INTERNAL_EXCEPTION, err: t, error: t, fatal: !0 }); return null; } _handleTransmuxerFlush(t) { const e = this.getCurrentContext(t); if (!e || this.state !== Ji) return void (this.fragCurrent || this.state === Ki || this.state === er || (this.state = qi)); const { frag: n, part: i, level: r } = e, a = self.performance.now(); (n.stats.parsing.end = a), i && (i.stats.parsing.end = a), this.updateLevelTiming(n, i, r, t.partial); } getCurrentContext(t) { const { levels: e, fragCurrent: n } = this, { level: i, sn: r, part: a } = t; if (null == e || !e[i]) return ( this.warn( `Levels object was unset while buffering fragment ${r} of level ${i}. The current chunk will not be buffered.` ), null ); const s = e[i], o = a > -1 ? jn(s, r, a) : null, l = o ? o.fragment : (function (t, e, n) { if (null == t || !t.details) return null; const i = t.details; let r = i.fragments[e - i.startSN]; return r || ((r = i.fragmentHint), r && r.sn === e ? r : e < i.startSN && n && n.sn === e ? n : null); })(s, r, n); return l ? (n && n !== l && (l.stats = n.stats), { frag: l, part: o, level: s }) : null; } bufferFragmentData(t, e, n, i, r) { var a; if (!t || this.state !== Ji) return; const { data1: s, data2: o } = t; let l = s; if ((s && o && (l = ve(s, o)), null == (a = l) || !a.length)) return; const d = { type: t.type, frag: e, part: n, chunkMeta: i, parent: e.type, data: l }; if ((this.hls.trigger(tt.BUFFER_APPENDING, d), t.dropped && t.independent && !n)) { if (r) return; this.flushBufferGap(e); } } flushBufferGap(t) { const e = this.media; if (!e) return; if (!Li.isBuffered(e, e.currentTime)) return void this.flushMainBuffer(0, t.start); const n = e.currentTime, i = Li.bufferInfo(e, n, 0), r = t.duration, a = Math.min(2 * this.config.maxFragLookUpTolerance, 0.25 * r), s = Math.max(Math.min(t.start - a, i.end - a), n + a); t.start - s > a && this.flushMainBuffer(s, t.start); } getFwdBufferInfo(t, e) { const n = this.getLoadPosition(); return X(n) ? this.getFwdBufferInfoAtPos(t, n, e) : null; } getFwdBufferInfoAtPos(t, e, n) { const { config: { maxBufferHole: i } } = this, r = Li.bufferInfo(t, e, i); if (0 === r.len && void 0 !== r.nextStart) { const a = this.fragmentTracker.getBufferedFrag(e, n); if (a && r.nextStart < a.end) return Li.bufferInfo(t, e, Math.max(r.nextStart, i)); } return r; } getMaxBufferLength(t) { const { config: e } = this; let n; return ( (n = t ? Math.max((8 * e.maxBufferSize) / t, e.maxBufferLength) : e.maxBufferLength), Math.min(n, e.maxMaxBufferLength) ); } reduceMaxBufferLength(t) { const e = this.config, n = t || e.maxBufferLength; return ( e.maxMaxBufferLength >= n && ((e.maxMaxBufferLength /= 2), this.warn(`Reduce max buffer length to ${e.maxMaxBufferLength}s`), !0) ); } getAppendedFrag(t, e = ln) { const n = this.fragmentTracker.getAppendedFrag(t, ln); return n && "fragment" in n ? n.fragment : n; } getNextFragment(t, e) { const n = e.fragments, i = n.length; if (!i) return null; const { config: r } = this, a = n[0].start; let s; if (e.live) { const o = r.initialLiveManifestSize; if (i < o) return this.warn(`Not enough fragments to start playback (have: ${i}, need: ${o})`), null; ((!e.PTSKnown && !this.startFragRequested && -1 === this.startPosition) || t < a) && ((s = this.getInitialLiveFragment(e, n)), (this.startPosition = this.nextLoadPosition = s ? this.hls.liveSyncPosition || s.start : t)); } else t <= a && (s = n[0]); if (!s) { const n = r.lowLatencyMode ? e.partEnd : e.fragmentEnd; s = this.getFragmentAtPosition(t, n, e); } return this.mapToInitFragWhenRequired(s); } isLoopLoading(t, e) { const n = this.fragmentTracker.getState(t); return (n === Si || (n === xi && !!t.gap)) && this.nextLoadPosition > e; } getNextFragmentLoopLoading(t, e, n, i, r) { const a = t.gap, s = this.getNextFragment(this.nextLoadPosition, e); if (null === s) return s; if (((t = s), a && t && !t.gap && n.nextStart)) { const e = this.getFwdBufferInfoAtPos(this.mediaBuffer ? this.mediaBuffer : this.media, n.nextStart, i); if (null !== e && n.len + e.len >= r) return this.log(`buffer full after gaps in "${i}" playlist starting at sn: ${t.sn}`), null; } return t; } mapToInitFragWhenRequired(t) { return null == t || !t.initSegment || (null != t && t.initSegment.data) || this.bitrateTest ? t : t.initSegment; } getNextPart(t, e, n) { let i = -1, r = !1, a = !0; for (let s = 0, o = t.length; s < o; s++) { const o = t[s]; if (((a = a && !o.independent), i > -1 && n < o.start)) break; const l = o.loaded; l ? (i = -1) : (r || o.independent || a) && o.fragment === e && (i = s), (r = l); } return i; } loadedEndOfParts(t, e) { const n = t[t.length - 1]; return n && e > n.start && n.loaded; } getInitialLiveFragment(t, e) { const n = this.fragPrevious; let i = null; if (n) { if ( (t.hasProgramDateTime && (this.log(`Live playlist, switching playlist, load frag with same PDT: ${n.programDateTime}`), (i = (function (t, e, n) { if (null === e || !Array.isArray(t) || !t.length || !X(e)) return null; if (e < (t[0].programDateTime || 0)) return null; if (e >= (t[t.length - 1].endProgramDateTime || 0)) return null; n = n || 0; for (let i = 0; i < t.length; ++i) { const r = t[i]; if (Zn(e, n, r)) return r; } return null; })(e, n.endProgramDateTime, this.config.maxFragLookUpTolerance))), !i) ) { const r = n.sn + 1; if (r >= t.startSN && r <= t.endSN) { const a = e[r - t.startSN]; n.cc === a.cc && ((i = a), this.log(`Live playlist, switching playlist, load frag with next SN: ${i.sn}`)); } i || ((i = (function (t, e) { return Qn(t, t => (t.cc < e ? 1 : t.cc > e ? -1 : 0)); })(e, n.cc)), i && this.log(`Live playlist, switching playlist, load frag with same CC: ${i.sn}`)); } } else { const e = this.hls.liveSyncPosition; null !== e && (i = this.getFragmentAtPosition(e, this.bitrateTest ? t.fragmentEnd : t.edge, t)); } return i; } getFragmentAtPosition(t, e, n) { const { config: i } = this; let { fragPrevious: r } = this, { fragments: a, endSN: s } = n; const { fragmentHint: o } = n, l = i.maxFragLookUpTolerance, d = n.partList, c = !!(i.lowLatencyMode && null != d && d.length && o); let u; if ((c && o && !this.bitrateTest && ((a = a.concat(o)), (s = o.sn)), t < e)) { u = Xn(r, a, t, t > e - l ? 0 : l); } else u = a[a.length - 1]; if (u) { const t = u.sn - n.startSN, e = this.fragmentTracker.getState(u); if (((e === Si || (e === xi && u.gap)) && (r = u), r && u.sn === r.sn && (!c || d[0].fragment.sn > u.sn))) { if (r && u.level === r.level) { const e = a[t + 1]; u = u.sn < s && this.fragmentTracker.getState(e) !== Si ? e : null; } } } return u; } synchronizeToLiveEdge(t) { const { config: e, media: n } = this; if (!n) return; const i = this.hls.liveSyncPosition, r = n.currentTime, a = t.fragments[0].start, s = t.edge, o = r >= a - e.maxFragLookUpTolerance && r <= s; if (null !== i && n.duration > i && (r < i || !o)) { const a = void 0 !== e.liveMaxLatencyDuration ? e.liveMaxLatencyDuration : e.liveMaxLatencyDurationCount * t.targetduration; ((!o && n.readyState < 4) || r < s - a) && (this.loadedmetadata || (this.nextLoadPosition = i), n.readyState && (this.warn( `Playback: ${r.toFixed( 3 )} is located too far from the end of live sliding playlist: ${s}, reset currentTime to : ${i.toFixed( 3 )}` ), (n.currentTime = i))); } } alignPlaylists(t, e, n) { const i = t.fragments.length; if (!i) return this.warn("No fragments in live playlist"), 0; const r = t.fragments[0].start, a = !e, s = t.alignedSliding && X(r); if (a || (!s && !r)) { const { fragPrevious: r } = this; Pi(r, n, t); const a = t.fragments[0].start; return ( this.log( `Live playlist sliding: ${a.toFixed(2)} start-sn: ${e ? e.startSN : "na"}->${t.startSN} prev-sn: ${r ? r.sn : "na" } fragments: ${i}` ), a ); } return r; } waitForCdnTuneIn(t) { return t.live && t.canBlockReload && t.partTarget && t.tuneInGoal > Math.max(t.partHoldBack, 3 * t.partTarget); } setStartPosition(t, e) { let n = this.startPosition; if ((n < e && (n = -1), -1 === n || -1 === this.lastCurrentTime)) { const i = null !== this.startTimeOffset, r = i ? this.startTimeOffset : t.startTimeOffset; null !== r && X(r) ? ((n = e + r), r < 0 && (n += t.totalduration), (n = Math.min(Math.max(e, n), e + t.totalduration)), this.log( `Start time offset ${r} found in ${i ? "multivariant" : "media"} playlist, adjust startPosition to ${n}` ), (this.startPosition = n)) : t.live ? (n = this.hls.liveSyncPosition || e) : (this.startPosition = n = 0), (this.lastCurrentTime = n); } this.nextLoadPosition = n; } getLoadPosition() { const { media: t } = this; let e = 0; return this.loadedmetadata && t ? (e = t.currentTime) : this.nextLoadPosition && (e = this.nextLoadPosition), e; } handleFragLoadAborted(t, e) { this.transmuxer && "initSegment" !== t.sn && t.stats.aborted && (this.warn(`Fragment ${t.sn}${e ? " part " + e.index : ""} of level ${t.level} was aborted`), this.resetFragmentLoading(t)); } resetFragmentLoading(t) { (this.fragCurrent && (this.fragContextChanged(t) || this.state === Qi)) || (this.state = qi); } onFragmentOrKeyLoadError(t, e) { if (e.chunkMeta && !e.frag) { const t = this.getCurrentContext(e.chunkMeta); t && (e.frag = t.frag); } const n = e.frag; if (!n || n.type !== t || !this.levels) return; var i; if (this.fragContextChanged(n)) return void this.warn( `Frag load error must match current frag to retry ${n.url} > ${null == (i = this.fragCurrent) ? void 0 : i.url }` ); const r = e.details === nt.FRAG_GAP; r && this.fragmentTracker.fragBuffered(n, !0); const a = e.errorAction, { action: s, retryCount: o = 0, retryConfig: l } = a || {}; if (a && s === ii && l) { this.resetStartWhenNotLoaded(this.levelLastLoaded); const i = qn(l, o); this.warn( `Fragment ${n.sn} of ${t} ${n.level} errored with ${e.details}, retrying loading ${o + 1}/${l.maxNumRetry } in ${i}ms` ), (a.resolved = !0), (this.retryDate = self.performance.now() + i), (this.state = Qi); } else if (l && a) { if ((this.resetFragmentErrors(t), !(o < l.maxNumRetry))) return void ot.warn(`${e.details} reached or exceeded max retry (${o})`); r || s === ni || (a.resolved = !0); } else (null == a ? void 0 : a.action) === ei ? (this.state = ir) : (this.state = er); this.tickImmediate(); } reduceLengthAndFlushBuffer(t) { if (this.state === Ji || this.state === Zi) { const e = t.parent, n = this.getFwdBufferInfo(this.mediaBuffer, e), i = n && n.len > 0.5; i && this.reduceMaxBufferLength(n.len); const r = !i; return ( r && this.warn(`Buffer full error while media.currentTime is not buffered, flush ${e} buffer`), t.frag && (this.fragmentTracker.removeFragment(t.frag), (this.nextLoadPosition = t.frag.start)), this.resetLoadingState(), r ); } return !1; } resetFragmentErrors(t) { t === dn && (this.fragCurrent = null), this.loadedmetadata || (this.startFragRequested = !1), this.state !== Ki && (this.state = qi); } afterBufferFlushed(t, e, n) { if (!t) return; const i = Li.getBuffered(t); this.fragmentTracker.detectEvictedFragments(e, i, n), this.state === tr && this.resetLoadingState(); } resetLoadingState() { this.log("Reset loading state"), (this.fragCurrent = null), (this.fragPrevious = null), (this.state = qi); } resetStartWhenNotLoaded(t) { if (!this.loadedmetadata) { this.startFragRequested = !1; const e = t ? t.details : null; null != e && e.live ? ((this.startPosition = -1), this.setStartPosition(e, 0), this.resetLoadingState()) : (this.nextLoadPosition = this.startPosition); } } resetWhenMissingContext(t) { this.warn( `The loading context changed while buffering fragment ${t.sn} of level ${t.level}. This chunk will not be buffered.` ), this.removeUnbufferedFrags(), this.resetStartWhenNotLoaded(this.levelLastLoaded), this.resetLoadingState(); } removeUnbufferedFrags(t = 0) { this.fragmentTracker.removeFragmentsInRange(t, 1 / 0, this.playlistType, !1, !0); } updateLevelTiming(t, e, n, i) { var r; const a = n.details; if (!a) return void this.warn("level.details undefined"); if ( !Object.keys(t.elementaryStreams).reduce((e, r) => { const s = t.elementaryStreams[r]; if (s) { const o = s.endPTS - s.startPTS; if (o <= 0) return this.warn(`Could not parse fragment ${t.sn} ${r} duration reliably (${o})`), e || !1; const l = i ? 0 : Mn(a, t, s.startPTS, s.endPTS, s.startDTS, s.endDTS); return ( this.hls.trigger(tt.LEVEL_PTS_UPDATED, { details: a, level: n, drift: l, type: r, frag: t, start: s.startPTS, end: s.endPTS }), !0 ); } return e; }, !1) && null === (null == (r = this.transmuxer) ? void 0 : r.error) ) { const e = new Error( `Found no media in fragment ${t.sn} of level ${t.level} resetting transmuxer to fallback to playlist timing` ); if ( (0 === n.fragmentError && (n.fragmentError++, (t.gap = !0), this.fragmentTracker.removeFragment(t), this.fragmentTracker.fragBuffered(t, !0)), this.warn(e.message), this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_PARSING_ERROR, fatal: !1, error: e, frag: t, reason: `Found no media in msn ${t.sn} of level "${n.url}"` }), !this.hls) ) return; this.resetTransmuxer(); } (this.state = Zi), this.hls.trigger(tt.FRAG_PARSED, { frag: t, part: e }); } resetTransmuxer() { this.transmuxer && (this.transmuxer.destroy(), (this.transmuxer = null)); } recoverWorkerError(t) { "demuxerWorker" === t.event && (this.fragmentTracker.removeAllFragments(), this.resetTransmuxer(), this.resetStartWhenNotLoaded(this.levelLastLoaded), this.resetLoadingState()); } set state(t) { const e = this._state; e !== t && ((this._state = t), this.log(`${e}->${t}`)); } get state() { return this._state; } } class ar { constructor() { (this.chunks = []), (this.dataLength = 0); } push(t) { this.chunks.push(t), (this.dataLength += t.length); } flush() { const { chunks: t, dataLength: e } = this; let n; return t.length ? ((n = 1 === t.length ? t[0] : (function (t, e) { const n = new Uint8Array(e); let i = 0; for (let e = 0; e < t.length; e++) { const r = t[e]; n.set(r, i), (i += r.length); } return n; })(t, e)), this.reset(), n) : new Uint8Array(0); } reset() { (this.chunks.length = 0), (this.dataLength = 0); } } function sr(t = "", e = 9e4) { return { type: t, id: -1, pid: -1, inputTimeScale: e, sequenceNumber: -1, samples: [], dropped: 0 }; } class or { constructor() { (this._audioTrack = void 0), (this._id3Track = void 0), (this.frameIndex = 0), (this.cachedData = null), (this.basePTS = null), (this.initPTS = null), (this.lastPTS = null); } resetInitSegment(t, e, n, i) { this._id3Track = { type: "id3", id: 3, pid: -1, inputTimeScale: 9e4, sequenceNumber: 0, samples: [], dropped: 0 }; } resetTimeStamp(t) { (this.initPTS = t), this.resetContiguity(); } resetContiguity() { (this.basePTS = null), (this.lastPTS = null), (this.frameIndex = 0); } canParse(t, e) { return !1; } appendFrame(t, e, n) { } demux(t, e) { this.cachedData && ((t = ve(this.cachedData, t)), (this.cachedData = null)); let n, i = Nt(t, 0), r = i ? i.length : 0; const a = this._audioTrack, s = this._id3Track, o = i ? jt(i) : void 0, l = t.length; for ( (null === this.basePTS || (0 === this.frameIndex && X(o))) && ((this.basePTS = lr(o, e, this.initPTS)), (this.lastPTS = this.basePTS)), null === this.lastPTS && (this.lastPTS = this.basePTS), i && i.length > 0 && s.samples.push({ pts: this.lastPTS, dts: this.lastPTS, data: i, type: vn, duration: Number.POSITIVE_INFINITY }); r < l; ) { if (this.canParse(t, r)) { const e = this.appendFrame(a, t, r); e ? (this.frameIndex++, (this.lastPTS = e.sample.pts), (r += e.length), (n = r)) : (r = l); } else Gt(t, r) ? ((i = Nt(t, r)), s.samples.push({ pts: this.lastPTS, dts: this.lastPTS, data: i, type: vn, duration: Number.POSITIVE_INFINITY }), (r += i.length), (n = r)) : r++; if (r === l && n !== l) { const e = Ft(t, n); this.cachedData ? (this.cachedData = ve(this.cachedData, e)) : (this.cachedData = e); } } return { audioTrack: a, videoTrack: sr(), id3Track: s, textTrack: sr() }; } demuxSampleAes(t, e, n) { return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`)); } flush(t) { const e = this.cachedData; return ( e && ((this.cachedData = null), this.demux(e, 0)), { audioTrack: this._audioTrack, videoTrack: sr(), id3Track: this._id3Track, textTrack: sr() } ); } destroy() { } } const lr = (t, e, n) => { if (X(t)) return 90 * t; return 9e4 * e + (n ? (9e4 * n.baseTime) / n.timescale : 0); }; function dr(t, e) { return 255 === t[e] && 240 == (246 & t[e + 1]); } function cr(t, e) { return 1 & t[e + 1] ? 7 : 9; } function ur(t, e) { return ((3 & t[e + 3]) << 11) | (t[e + 4] << 3) | ((224 & t[e + 5]) >>> 5); } function hr(t, e) { return e + 1 < t.length && dr(t, e); } function pr(t, e) { if (hr(t, e)) { const n = cr(t, e); if (e + n >= t.length) return !1; const i = ur(t, e); if (i <= n) return !1; const r = e + i; return r === t.length || hr(t, r); } return !1; } function fr(t, e, n, i, r) { if (!t.samplerate) { const a = (function (t, e, n, i) { let r, a, s, o; const l = navigator.userAgent.toLowerCase(), d = i, c = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]; r = 1 + ((192 & e[n + 2]) >>> 6); const u = (60 & e[n + 2]) >>> 2; if (!(u > c.length - 1)) return ( (s = (1 & e[n + 2]) << 2), (s |= (192 & e[n + 3]) >>> 6), ot.log(`manifest codec:${i}, ADTS type:${r}, samplingIndex:${u}`), /firefox/i.test(l) ? u >= 6 ? ((r = 5), (o = new Array(4)), (a = u - 3)) : ((r = 2), (o = new Array(2)), (a = u)) : -1 !== l.indexOf("android") ? ((r = 2), (o = new Array(2)), (a = u)) : ((r = 5), (o = new Array(4)), (i && (-1 !== i.indexOf("mp4a.40.29") || -1 !== i.indexOf("mp4a.40.5"))) || (!i && u >= 6) ? (a = u - 3) : (((i && -1 !== i.indexOf("mp4a.40.2") && ((u >= 6 && 1 === s) || /vivaldi/i.test(l))) || (!i && 1 === s)) && ((r = 2), (o = new Array(2))), (a = u))), (o[0] = r << 3), (o[0] |= (14 & u) >> 1), (o[1] |= (1 & u) << 7), (o[1] |= s << 3), 5 === r && ((o[1] |= (14 & a) >> 1), (o[2] = (1 & a) << 7), (o[2] |= 8), (o[3] = 0)), { config: o, samplerate: c[u], channelCount: s, codec: "mp4a.40." + r, manifestCodec: d } ); { const e = new Error(`invalid ADTS sampling index:${u}`); t.emit(tt.ERROR, tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_PARSING_ERROR, fatal: !0, error: e, reason: e.message }); } })(e, n, i, r); if (!a) return; (t.config = a.config), (t.samplerate = a.samplerate), (t.channelCount = a.channelCount), (t.codec = a.codec), (t.manifestCodec = a.manifestCodec), ot.log(`parsed codec:${t.codec}, rate:${a.samplerate}, channels:${a.channelCount}`); } } function mr(t) { return 9216e4 / t; } function gr(t, e, n, i, r) { const a = i + r * mr(t.samplerate), s = (function (t, e) { const n = cr(t, e); if (e + n <= t.length) { const i = ur(t, e) - n; if (i > 0) return { headerLength: n, frameLength: i }; } })(e, n); let o; if (s) { const { frameLength: i, headerLength: r } = s, l = r + i, d = Math.max(0, n + l - e.length); d ? ((o = new Uint8Array(l - r)), o.set(e.subarray(n + r, e.length), 0)) : (o = e.subarray(n + r, n + l)); const c = { unit: o, pts: a }; return d || t.samples.push(c), { sample: c, length: l, missing: d }; } const l = e.length - n; (o = new Uint8Array(l)), o.set(e.subarray(n, e.length), 0); return { sample: { unit: o, pts: a }, length: l, missing: -1 }; } let yr = null; const Ar = [ 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 ], vr = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3], br = [ [0, 72, 144, 12], [0, 0, 0, 0], [0, 72, 144, 12], [0, 144, 144, 12] ], Er = [0, 1, 1, 4]; function wr(t, e, n, i, r) { if (n + 24 > e.length) return; const a = xr(e, n); if (a && n + a.frameLength <= e.length) { const s = i + r * ((9e4 * a.samplesPerFrame) / a.sampleRate), o = { unit: e.subarray(n, n + a.frameLength), pts: s, dts: s }; return ( (t.config = []), (t.channelCount = a.channelCount), (t.samplerate = a.sampleRate), t.samples.push(o), { sample: o, length: a.frameLength, missing: 0 } ); } } function xr(t, e) { const n = (t[e + 1] >> 3) & 3, i = (t[e + 1] >> 1) & 3, r = (t[e + 2] >> 4) & 15, a = (t[e + 2] >> 2) & 3; if (1 !== n && 0 !== r && 15 !== r && 3 !== a) { const s = (t[e + 2] >> 1) & 1, o = t[e + 3] >> 6, l = 1e3 * Ar[14 * (3 === n ? 3 - i : 3 === i ? 3 : 4) + r - 1], d = vr[3 * (3 === n ? 0 : 2 === n ? 1 : 2) + a], c = 3 === o ? 1 : 2, u = br[n][i], h = Er[i], p = 8 * u * h, f = Math.floor((u * l) / d + s) * h; if (null === yr) { const t = (navigator.userAgent || "").match(/Chrome\/(\d+)/i); yr = t ? parseInt(t[1]) : 0; } return ( !!yr && yr <= 87 && 2 === i && l >= 224e3 && 0 === o && (t[e + 3] = 128 | t[e + 3]), { sampleRate: d, channelCount: c, frameLength: f, samplesPerFrame: p } ); } } function Sr(t, e) { return !(255 !== t[e] || 224 & ~t[e + 1] || !(6 & t[e + 1])); } function _r(t, e) { return e + 1 < t.length && Sr(t, e); } function Tr(t, e) { if (e + 1 < t.length && Sr(t, e)) { const n = 4, i = xr(t, e); let r = n; null != i && i.frameLength && (r = i.frameLength); const a = e + r; return a === t.length || _r(t, a); } return !1; } const kr = /\/emsg[-/]ID3/i; const Cr = (t, e) => { let n = 0, i = 5; e += i; const r = new Uint32Array(1), a = new Uint32Array(1), s = new Uint8Array(1); for (; i > 0;) { s[0] = t[e]; const o = Math.min(i, 8), l = 8 - o; (a[0] = (4278190080 >>> (24 + l)) << l), (r[0] = (s[0] & a[0]) >> l), (n = n ? (n << o) | r[0] : r[0]), (e += 1), (i -= o); } return n; }; class Lr extends or { constructor(t) { super(), (this.observer = void 0), (this.observer = t); } resetInitSegment(t, e, n, i) { super.resetInitSegment(t, e, n, i), (this._audioTrack = { container: "audio/ac-3", type: "audio", id: 2, pid: -1, sequenceNumber: 0, segmentCodec: "ac3", samples: [], manifestCodec: e, duration: i, inputTimeScale: 9e4, dropped: 0 }); } canParse(t, e) { return e + 64 < t.length; } appendFrame(t, e, n) { const i = Ir(t, e, n, this.basePTS, this.frameIndex); if (-1 !== i) { return { sample: t.samples[t.samples.length - 1], length: i, missing: 0 }; } } static probe(t) { if (!t) return !1; const e = Nt(t, 0); if (!e) return !1; const n = e.length; return 11 === t[n] && 119 === t[n + 1] && void 0 !== jt(e) && Cr(t, n) < 16; } } function Ir(t, e, n, i, r) { if (n + 8 > e.length) return -1; if (11 !== e[n] || 119 !== e[n + 1]) return -1; const a = e[n + 4] >> 6; if (a >= 3) return -1; const s = [48e3, 44100, 32e3][a], o = 63 & e[n + 4], l = 2 * [ 64, 69, 96, 64, 70, 96, 80, 87, 120, 80, 88, 120, 96, 104, 144, 96, 105, 144, 112, 121, 168, 112, 122, 168, 128, 139, 192, 128, 140, 192, 160, 174, 240, 160, 175, 240, 192, 208, 288, 192, 209, 288, 224, 243, 336, 224, 244, 336, 256, 278, 384, 256, 279, 384, 320, 348, 480, 320, 349, 480, 384, 417, 576, 384, 418, 576, 448, 487, 672, 448, 488, 672, 512, 557, 768, 512, 558, 768, 640, 696, 960, 640, 697, 960, 768, 835, 1152, 768, 836, 1152, 896, 975, 1344, 896, 976, 1344, 1024, 1114, 1536, 1024, 1115, 1536, 1152, 1253, 1728, 1152, 1254, 1728, 1280, 1393, 1920, 1280, 1394, 1920 ][3 * o + a]; if (n + l > e.length) return -1; const d = e[n + 6] >> 5; let c = 0; 2 === d ? (c += 2) : (1 & d && 1 !== d && (c += 2), 4 & d && (c += 2)); const u = (((e[n + 6] << 8) | e[n + 7]) >> (12 - c)) & 1, h = [2, 1, 2, 3, 3, 4, 4, 5][d] + u, p = e[n + 5] >> 3, f = 7 & e[n + 5], m = new Uint8Array([(a << 6) | (p << 1) | (f >> 2), ((3 & f) << 6) | (d << 3) | (u << 2) | (o >> 4), (o << 4) & 224]), g = i + r * ((1536 / s) * 9e4), y = e.subarray(n, n + l); return (t.config = m), (t.channelCount = h), (t.samplerate = s), t.samples.push({ unit: y, pts: g }), l; } class Rr { constructor() { this.VideoSample = null; } createVideoSample(t, e, n, i) { return { key: t, frame: !1, pts: e, dts: n, units: [], debug: i, length: 0 }; } getLastNalUnit(t) { var e; let n, i = this.VideoSample; if (((i && 0 !== i.units.length) || (i = t[t.length - 1]), null != (e = i) && e.units)) { const t = i.units; n = t[t.length - 1]; } return n; } pushAccessUnit(t, e) { if (t.units.length && t.frame) { if (void 0 === t.pts) { const n = e.samples, i = n.length; if (!i) return void e.dropped++; { const e = n[i - 1]; (t.pts = e.pts), (t.dts = e.dts); } } e.samples.push(t); } t.debug.length && ot.log(t.pts + "/" + t.dts + ":" + t.debug); } } class Dr { constructor(t) { (this.data = void 0), (this.bytesAvailable = void 0), (this.word = void 0), (this.bitsAvailable = void 0), (this.data = t), (this.bytesAvailable = t.byteLength), (this.word = 0), (this.bitsAvailable = 0); } loadWord() { const t = this.data, e = this.bytesAvailable, n = t.byteLength - e, i = new Uint8Array(4), r = Math.min(4, e); if (0 === r) throw new Error("no bytes available"); i.set(t.subarray(n, n + r)), (this.word = new DataView(i.buffer).getUint32(0)), (this.bitsAvailable = 8 * r), (this.bytesAvailable -= r); } skipBits(t) { let e; (t = Math.min(t, 8 * this.bytesAvailable + this.bitsAvailable)), this.bitsAvailable > t ? ((this.word <<= t), (this.bitsAvailable -= t)) : ((e = (t -= this.bitsAvailable) >> 3), (t -= e << 3), (this.bytesAvailable -= e), this.loadWord(), (this.word <<= t), (this.bitsAvailable -= t)); } readBits(t) { let e = Math.min(this.bitsAvailable, t); const n = this.word >>> (32 - e); if ( (t > 32 && ot.error("Cannot read more than 32 bits at a time"), (this.bitsAvailable -= e), this.bitsAvailable > 0) ) this.word <<= e; else { if (!(this.bytesAvailable > 0)) throw new Error("no bits available"); this.loadWord(); } return (e = t - e), e > 0 && this.bitsAvailable ? (n << e) | this.readBits(e) : n; } skipLZ() { let t; for (t = 0; t < this.bitsAvailable; ++t) if (this.word & (2147483648 >>> t)) return (this.word <<= t), (this.bitsAvailable -= t), t; return this.loadWord(), t + this.skipLZ(); } skipUEG() { this.skipBits(1 + this.skipLZ()); } skipEG() { this.skipBits(1 + this.skipLZ()); } readUEG() { const t = this.skipLZ(); return this.readBits(t + 1) - 1; } readEG() { const t = this.readUEG(); return 1 & t ? (1 + t) >>> 1 : -1 * (t >>> 1); } readBoolean() { return 1 === this.readBits(1); } readUByte() { return this.readBits(8); } readUShort() { return this.readBits(16); } readUInt() { return this.readBits(32); } skipScalingList(t) { let e, n = 8, i = 8; for (let r = 0; r < t; r++) 0 !== i && ((e = this.readEG()), (i = (n + e + 256) % 256)), (n = 0 === i ? n : i); } readSPS() { let t, e, n, i = 0, r = 0, a = 0, s = 0; const o = this.readUByte.bind(this), l = this.readBits.bind(this), d = this.readUEG.bind(this), c = this.readBoolean.bind(this), u = this.skipBits.bind(this), h = this.skipEG.bind(this), p = this.skipUEG.bind(this), f = this.skipScalingList.bind(this); o(); const m = o(); if ( (l(5), u(3), o(), p(), 100 === m || 110 === m || 122 === m || 244 === m || 44 === m || 83 === m || 86 === m || 118 === m || 128 === m) ) { const t = d(); if ((3 === t && u(1), p(), p(), u(1), c())) for (e = 3 !== t ? 8 : 12, n = 0; n < e; n++) c() && f(n < 6 ? 16 : 64); } p(); const g = d(); if (0 === g) d(); else if (1 === g) for (u(1), h(), h(), t = d(), n = 0; n < t; n++) h(); p(), u(1); const y = d(), A = d(), v = l(1); 0 === v && u(1), u(1), c() && ((i = d()), (r = d()), (a = d()), (s = d())); let b = [1, 1]; if (c() && c()) { switch (o()) { case 1: b = [1, 1]; break; case 2: b = [12, 11]; break; case 3: b = [10, 11]; break; case 4: b = [16, 11]; break; case 5: b = [40, 33]; break; case 6: b = [24, 11]; break; case 7: b = [20, 11]; break; case 8: b = [32, 11]; break; case 9: b = [80, 33]; break; case 10: b = [18, 11]; break; case 11: b = [15, 11]; break; case 12: b = [64, 33]; break; case 13: b = [160, 99]; break; case 14: b = [4, 3]; break; case 15: b = [3, 2]; break; case 16: b = [2, 1]; break; case 255: b = [(o() << 8) | o(), (o() << 8) | o()]; } } return { width: Math.ceil(16 * (y + 1) - 2 * i - 2 * r), height: (2 - v) * (A + 1) * 16 - (v ? 2 : 4) * (a + s), pixelRatio: b }; } readSliceType() { return this.readUByte(), this.readUEG(), this.readUEG(); } } class Br extends Rr { parseAVCPES(t, e, n, i, r) { const a = this.parseAVCNALu(t, n.data); let s, o = this.VideoSample, l = !1; (n.data = null), o && a.length && !t.audFound && (this.pushAccessUnit(o, t), (o = this.VideoSample = this.createVideoSample(!1, n.pts, n.dts, ""))), a.forEach(i => { var a; switch (i.type) { case 1: { let e = !1; s = !0; const r = i.data; if (l && r.length > 4) { const t = new Dr(r).readSliceType(); (2 !== t && 4 !== t && 7 !== t && 9 !== t) || (e = !0); } var d; if (e) null != (d = o) && d.frame && !o.key && (this.pushAccessUnit(o, t), (o = this.VideoSample = null)); o || (o = this.VideoSample = this.createVideoSample(!0, n.pts, n.dts, "")), (o.frame = !0), (o.key = e); break; } case 5: (s = !0), null != (a = o) && a.frame && !o.key && (this.pushAccessUnit(o, t), (o = this.VideoSample = null)), o || (o = this.VideoSample = this.createVideoSample(!0, n.pts, n.dts, "")), (o.key = !0), (o.frame = !0); break; case 6: (s = !0), we(i.data, 1, n.pts, e.samples); break; case 7: { var c, u; (s = !0), (l = !0); const e = i.data, n = new Dr(e).readSPS(); if ( !t.sps || t.width !== n.width || t.height !== n.height || (null == (c = t.pixelRatio) ? void 0 : c[0]) !== n.pixelRatio[0] || (null == (u = t.pixelRatio) ? void 0 : u[1]) !== n.pixelRatio[1] ) { (t.width = n.width), (t.height = n.height), (t.pixelRatio = n.pixelRatio), (t.sps = [e]), (t.duration = r); const i = e.subarray(1, 4); let a = "avc1."; for (let t = 0; t < 3; t++) { let e = i[t].toString(16); e.length < 2 && (e = "0" + e), (a += e); } t.codec = a; } break; } case 8: (s = !0), (t.pps = [i.data]); break; case 9: (s = !0), (t.audFound = !0), o && this.pushAccessUnit(o, t), (o = this.VideoSample = this.createVideoSample(!1, n.pts, n.dts, "")); break; case 12: s = !0; break; default: (s = !1), o && (o.debug += "unknown NAL " + i.type + " "); } if (o && s) { o.units.push(i); } }), i && o && (this.pushAccessUnit(o, t), (this.VideoSample = null)); } parseAVCNALu(t, e) { const n = e.byteLength; let i = t.naluState || 0; const r = i, a = []; let s, o, l, d = 0, c = -1, u = 0; for (-1 === i && ((c = 0), (u = 31 & e[0]), (i = 0), (d = 1)); d < n;) if (((s = e[d++]), i)) if (1 !== i) if (s) if (1 === s) { if (((o = d - i - 1), c >= 0)) { const t = { data: e.subarray(c, o), type: u }; a.push(t); } else { const n = this.getLastNalUnit(t.samples); n && (r && d <= 4 - r && n.state && (n.data = n.data.subarray(0, n.data.byteLength - r)), o > 0 && ((n.data = ve(n.data, e.subarray(0, o))), (n.state = 0))); } d < n ? ((l = 31 & e[d]), (c = d), (u = l), (i = 0)) : (i = -1); } else i = 0; else i = 3; else i = s ? 0 : 2; else i = s ? 0 : 1; if (c >= 0 && i >= 0) { const t = { data: e.subarray(c, n), type: u, state: i }; a.push(t); } if (0 === a.length) { const n = this.getLastNalUnit(t.samples); n && (n.data = ve(n.data, e)); } return (t.naluState = i), a; } } class Pr { constructor(t, e, n) { (this.keyData = void 0), (this.decrypter = void 0), (this.keyData = n), (this.decrypter = new Yi(e, { removePKCS7Padding: !1 })); } decryptBuffer(t) { return this.decrypter.decrypt(t, this.keyData.key.buffer, this.keyData.iv.buffer); } decryptAacSample(t, e, n) { const i = t[e].unit; if (i.length <= 16) return; const r = i.subarray(16, i.length - (i.length % 16)), a = r.buffer.slice(r.byteOffset, r.byteOffset + r.length); this.decryptBuffer(a).then(r => { const a = new Uint8Array(r); i.set(a, 16), this.decrypter.isSync() || this.decryptAacSamples(t, e + 1, n); }); } decryptAacSamples(t, e, n) { for (; ; e++) { if (e >= t.length) return void n(); if (!(t[e].unit.length < 32) && (this.decryptAacSample(t, e, n), !this.decrypter.isSync())) return; } } getAvcEncryptedData(t) { const e = 16 * Math.floor((t.length - 48) / 160) + 16, n = new Int8Array(e); let i = 0; for (let e = 32; e < t.length - 16; e += 160, i += 16) n.set(t.subarray(e, e + 16), i); return n; } getAvcDecryptedUnit(t, e) { const n = new Uint8Array(e); let i = 0; for (let e = 32; e < t.length - 16; e += 160, i += 16) t.set(n.subarray(i, i + 16), e); return t; } decryptAvcSample(t, e, n, i, r) { const a = xe(r.data), s = this.getAvcEncryptedData(a); this.decryptBuffer(s.buffer).then(s => { (r.data = this.getAvcDecryptedUnit(a, s)), this.decrypter.isSync() || this.decryptAvcSamples(t, e, n + 1, i); }); } decryptAvcSamples(t, e, n, i) { if (t instanceof Uint8Array) throw new Error("Cannot decrypt samples of type Uint8Array"); for (; ; e++, n = 0) { if (e >= t.length) return void i(); const r = t[e].units; for (; !(n >= r.length); n++) { const a = r[n]; if ( !( a.data.length <= 48 || (1 !== a.type && 5 !== a.type) || (this.decryptAvcSample(t, e, n, i, a), this.decrypter.isSync()) ) ) return; } } } } const Ur = 188; class Fr { constructor(t, e, n) { (this.observer = void 0), (this.config = void 0), (this.typeSupported = void 0), (this.sampleAes = null), (this.pmtParsed = !1), (this.audioCodec = void 0), (this.videoCodec = void 0), (this._duration = 0), (this._pmtId = -1), (this._videoTrack = void 0), (this._audioTrack = void 0), (this._id3Track = void 0), (this._txtTrack = void 0), (this.aacOverFlow = null), (this.remainderData = null), (this.videoParser = void 0), (this.observer = t), (this.config = e), (this.typeSupported = n), (this.videoParser = new Br()); } static probe(t) { const e = Fr.syncOffset(t); return e > 0 && ot.warn(`MPEG2-TS detected but first sync word found @ offset ${e}`), -1 !== e; } static syncOffset(t) { const e = t.length; let n = Math.min(940, e - Ur) + 1, i = 0; for (; i < n;) { let r = !1, a = -1, s = 0; for (let o = i; o < e; o += Ur) { if (71 !== t[o] || (e - o !== Ur && 71 !== t[o + Ur])) { if (s) return -1; break; } if ( (s++, -1 === a && ((a = o), 0 !== a && (n = Math.min(a + 18612, t.length - Ur) + 1)), r || (r = 0 === Or(t, o)), r && s > 1 && ((0 === a && s > 2) || o + Ur > n)) ) return a; } i++; } return -1; } static createTrack(t, e) { return { container: "video" === t || "audio" === t ? "video/mp2t" : void 0, type: t, id: ie[t], pid: -1, inputTimeScale: 9e4, sequenceNumber: 0, samples: [], dropped: 0, duration: "audio" === t ? e : void 0 }; } resetInitSegment(t, e, n, i) { (this.pmtParsed = !1), (this._pmtId = -1), (this._videoTrack = Fr.createTrack("video")), (this._audioTrack = Fr.createTrack("audio", i)), (this._id3Track = Fr.createTrack("id3")), (this._txtTrack = Fr.createTrack("text")), (this._audioTrack.segmentCodec = "aac"), (this.aacOverFlow = null), (this.remainderData = null), (this.audioCodec = e), (this.videoCodec = n), (this._duration = i); } resetTimeStamp() { } resetContiguity() { const { _audioTrack: t, _videoTrack: e, _id3Track: n } = this; t && (t.pesData = null), e && (e.pesData = null), n && (n.pesData = null), (this.aacOverFlow = null), (this.remainderData = null); } demux(t, e, n = !1, i = !1) { let r; n || (this.sampleAes = null); const a = this._videoTrack, s = this._audioTrack, o = this._id3Track, l = this._txtTrack; let d = a.pid, c = a.pesData, u = s.pid, h = o.pid, p = s.pesData, f = o.pesData, m = null, g = this.pmtParsed, y = this._pmtId, A = t.length; if ((this.remainderData && ((A = (t = ve(this.remainderData, t)).length), (this.remainderData = null)), A < Ur && !i)) return (this.remainderData = t), { audioTrack: s, videoTrack: a, id3Track: o, textTrack: l }; const v = Math.max(0, Fr.syncOffset(t)); (A -= (A - v) % Ur), A < t.byteLength && !i && (this.remainderData = new Uint8Array(t.buffer, A, t.buffer.byteLength - A)); let b = 0; for (let e = v; e < A; e += Ur) if (71 === t[e]) { const i = !!(64 & t[e + 1]), A = Or(t, e); let b; if ((48 & t[e + 3]) >> 4 > 1) { if (((b = e + 5 + t[e + 4]), b === e + Ur)) continue; } else b = e + 4; switch (A) { case d: i && (c && (r = Gr(c)) && this.videoParser.parseAVCPES(a, l, r, !1, this._duration), (c = { data: [], size: 0 })), c && (c.data.push(t.subarray(b, e + Ur)), (c.size += e + Ur - b)); break; case u: if (i) { if (p && (r = Gr(p))) switch (s.segmentCodec) { case "aac": this.parseAACPES(s, r); break; case "mp3": this.parseMPEGPES(s, r); break; case "ac3": this.parseAC3PES(s, r); } p = { data: [], size: 0 }; } p && (p.data.push(t.subarray(b, e + Ur)), (p.size += e + Ur - b)); break; case h: i && (f && (r = Gr(f)) && this.parseID3PES(o, r), (f = { data: [], size: 0 })), f && (f.data.push(t.subarray(b, e + Ur)), (f.size += e + Ur - b)); break; case 0: i && (b += t[b] + 1), (y = this._pmtId = Mr(t, b)); break; case y: { i && (b += t[b] + 1); const r = Nr(t, b, this.typeSupported, n); (d = r.videoPid), d > 0 && ((a.pid = d), (a.segmentCodec = r.segmentVideoCodec)), (u = r.audioPid), u > 0 && ((s.pid = u), (s.segmentCodec = r.segmentAudioCodec)), (h = r.id3Pid), h > 0 && (o.pid = h), null === m || g || (ot.warn( `MPEG-TS PMT found at ${e} after unknown PID '${m}'. Backtracking to sync byte @${v} to parse all TS packets.` ), (m = null), (e = v - 188)), (g = this.pmtParsed = !0); break; } case 17: case 8191: break; default: m = A; } } else b++; if (b > 0) { const t = new Error(`Found ${b} TS packet/s that do not start with 0x47`); this.observer.emit(tt.ERROR, tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_PARSING_ERROR, fatal: !1, error: t, reason: t.message }); } (a.pesData = c), (s.pesData = p), (o.pesData = f); const E = { audioTrack: s, videoTrack: a, id3Track: o, textTrack: l }; return i && this.extractRemainingSamples(E), E; } flush() { const { remainderData: t } = this; let e; return ( (this.remainderData = null), (e = t ? this.demux(t, -1, !1, !0) : { videoTrack: this._videoTrack, audioTrack: this._audioTrack, id3Track: this._id3Track, textTrack: this._txtTrack }), this.extractRemainingSamples(e), this.sampleAes ? this.decrypt(e, this.sampleAes) : e ); } extractRemainingSamples(t) { const { audioTrack: e, videoTrack: n, id3Track: i, textTrack: r } = t, a = n.pesData, s = e.pesData, o = i.pesData; let l; if ( (a && (l = Gr(a)) ? (this.videoParser.parseAVCPES(n, r, l, !0, this._duration), (n.pesData = null)) : (n.pesData = a), s && (l = Gr(s))) ) { switch (e.segmentCodec) { case "aac": this.parseAACPES(e, l); break; case "mp3": this.parseMPEGPES(e, l); break; case "ac3": this.parseAC3PES(e, l); } e.pesData = null; } else null != s && s.size && ot.log("last AAC PES packet truncated,might overlap between fragments"), (e.pesData = s); o && (l = Gr(o)) ? (this.parseID3PES(i, l), (i.pesData = null)) : (i.pesData = o); } demuxSampleAes(t, e, n) { const i = this.demux(t, n, !0, !this.config.progressive), r = (this.sampleAes = new Pr(this.observer, this.config, e)); return this.decrypt(i, r); } decrypt(t, e) { return new Promise(n => { const { audioTrack: i, videoTrack: r } = t; i.samples && "aac" === i.segmentCodec ? e.decryptAacSamples(i.samples, 0, () => { r.samples ? e.decryptAvcSamples(r.samples, 0, 0, () => { n(t); }) : n(t); }) : r.samples && e.decryptAvcSamples(r.samples, 0, 0, () => { n(t); }); }); } destroy() { this._duration = 0; } parseAACPES(t, e) { let n = 0; const i = this.aacOverFlow; let r, a, s, o = e.data; if (i) { this.aacOverFlow = null; const e = i.missing, r = i.sample.unit.byteLength; if (-1 === e) o = ve(i.sample.unit, o); else { const a = r - e; i.sample.unit.set(o.subarray(0, e), a), t.samples.push(i.sample), (n = i.missing); } } for (r = n, a = o.length; r < a - 1 && !hr(o, r); r++); if (r !== n) { let t; const e = r < a - 1; t = e ? `AAC PES did not start with ADTS header,offset:${r}` : "No ADTS header found in AAC PES"; const n = new Error(t); if ( (ot.warn(`parsing error: ${t}`), this.observer.emit(tt.ERROR, tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_PARSING_ERROR, fatal: !1, levelRetry: e, error: n, reason: t }), !e) ) return; } if ((fr(t, this.observer, o, r, this.audioCodec), void 0 !== e.pts)) s = e.pts; else { if (!i) return void ot.warn("[tsdemuxer]: AAC PES unknown PTS"); { const e = mr(t.samplerate); s = i.sample.pts + e; } } let l, d = 0; for (; r < a;) { if (((l = gr(t, o, r, s, d)), (r += l.length), l.missing)) { this.aacOverFlow = l; break; } for (d++; r < a - 1 && !hr(o, r); r++); } } parseMPEGPES(t, e) { const n = e.data, i = n.length; let r = 0, a = 0; const s = e.pts; if (void 0 !== s) for (; a < i;) if (_r(n, a)) { const e = wr(t, n, a, s, r); if (!e) break; (a += e.length), r++; } else a++; else ot.warn("[tsdemuxer]: MPEG PES unknown PTS"); } parseAC3PES(t, e) { { const n = e.data, i = e.pts; if (void 0 === i) return void ot.warn("[tsdemuxer]: AC3 PES unknown PTS"); const r = n.length; let a, s = 0, o = 0; for (; o < r && (a = Ir(t, n, o, i, s++)) > 0;) o += a; } } parseID3PES(t, e) { if (void 0 === e.pts) return void ot.warn("[tsdemuxer]: ID3 PES unknown PTS"); const n = Q({}, e, { type: this._videoTrack ? En : vn, duration: Number.POSITIVE_INFINITY }); t.samples.push(n); } } function Or(t, e) { return ((31 & t[e + 1]) << 8) + t[e + 2]; } function Mr(t, e) { return ((31 & t[e + 10]) << 8) | t[e + 11]; } function Nr(t, e, n, i) { const r = { audioPid: -1, videoPid: -1, id3Pid: -1, segmentVideoCodec: "avc", segmentAudioCodec: "aac" }, a = e + 3 + (((15 & t[e + 1]) << 8) | t[e + 2]) - 4; for (e += 12 + (((15 & t[e + 10]) << 8) | t[e + 11]); e < a;) { const a = Or(t, e), s = ((15 & t[e + 3]) << 8) | t[e + 4]; switch (t[e]) { case 207: if (!i) { zr("ADTS AAC"); break; } case 15: -1 === r.audioPid && (r.audioPid = a); break; case 21: -1 === r.id3Pid && (r.id3Pid = a); break; case 219: if (!i) { zr("H.264"); break; } case 27: -1 === r.videoPid && ((r.videoPid = a), (r.segmentVideoCodec = "avc")); break; case 3: case 4: n.mpeg || n.mp3 ? -1 === r.audioPid && ((r.audioPid = a), (r.segmentAudioCodec = "mp3")) : ot.log("MPEG audio found, not supported in this browser"); break; case 193: if (!i) { zr("AC-3"); break; } case 129: n.ac3 ? -1 === r.audioPid && ((r.audioPid = a), (r.segmentAudioCodec = "ac3")) : ot.log("AC-3 audio found, not supported in this browser"); break; case 6: if (-1 === r.audioPid && s > 0) { let i = e + 5, o = s; for (; o > 2;) { if (106 === t[i]) !0 !== n.ac3 ? ot.log("AC-3 audio found, not supported in this browser for now") : ((r.audioPid = a), (r.segmentAudioCodec = "ac3")); const e = t[i + 1] + 2; (i += e), (o -= e); } } break; case 194: case 135: ot.warn("Unsupported EC-3 in M2TS found"); break; case 36: ot.warn("Unsupported HEVC in M2TS found"); } e += s + 5; } return r; } function zr(t) { ot.log(`${t} with AES-128-CBC encryption found in unencrypted stream`); } function Gr(t) { let e, n, i, r, a, s = 0; const o = t.data; if (!t || 0 === t.size) return null; for (; o[0].length < 19 && o.length > 1;) (o[0] = ve(o[0], o[1])), o.splice(1, 1); e = o[0]; if (1 === (e[0] << 16) + (e[1] << 8) + e[2]) { if (((n = (e[4] << 8) + e[5]), n && n > t.size - 6)) return null; const l = e[7]; 192 & l && ((r = 536870912 * (14 & e[9]) + 4194304 * (255 & e[10]) + 16384 * (254 & e[11]) + 128 * (255 & e[12]) + (254 & e[13]) / 2), 64 & l ? ((a = 536870912 * (14 & e[14]) + 4194304 * (255 & e[15]) + 16384 * (254 & e[16]) + 128 * (255 & e[17]) + (254 & e[18]) / 2), r - a > 54e5 && (ot.warn(`${Math.round((r - a) / 9e4)}s delta between PTS and DTS, align them`), (r = a))) : (a = r)), (i = e[8]); let d = i + 9; if (t.size <= d) return null; t.size -= d; const c = new Uint8Array(t.size); for (let t = 0, n = o.length; t < n; t++) { e = o[t]; let n = e.byteLength; if (d) { if (d > n) { d -= n; continue; } (e = e.subarray(d)), (n -= d), (d = 0); } c.set(e, s), (s += n); } return n && (n -= i + 3), { data: c, pts: r, dts: a, len: n }; } return null; } class jr { static getSilentFrame(t, e) { if ("mp4a.40.2" === t) { if (1 === e) return new Uint8Array([0, 200, 0, 128, 35, 128]); if (2 === e) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]); if (3 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]); if (4 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]); if (5 === e) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]); if (6 === e) return new Uint8Array([ 0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224 ]); } else { if (1 === e) return new Uint8Array([ 1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); if (2 === e) return new Uint8Array([ 1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); if (3 === e) return new Uint8Array([ 1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94 ]); } } } const Hr = Math.pow(2, 32) - 1; class Yr { static init() { let t; for (t in ((Yr.types = { avc1: [], avcC: [], btrt: [], dinf: [], dref: [], esds: [], ftyp: [], hdlr: [], mdat: [], mdhd: [], mdia: [], mfhd: [], minf: [], moof: [], moov: [], mp4a: [], ".mp3": [], dac3: [], "ac-3": [], mvex: [], mvhd: [], pasp: [], sdtp: [], stbl: [], stco: [], stsc: [], stsd: [], stsz: [], stts: [], tfdt: [], tfhd: [], traf: [], trak: [], trun: [], trex: [], tkhd: [], vmhd: [], smhd: [] }), Yr.types)) Yr.types.hasOwnProperty(t) && (Yr.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t.charCodeAt(2), t.charCodeAt(3)]); const e = new Uint8Array([ 0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0 ]), n = new Uint8Array([ 0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0 ]); Yr.HDLR_TYPES = { video: e, audio: n }; const i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]); (Yr.STTS = Yr.STSC = Yr.STCO = r), (Yr.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), (Yr.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0])), (Yr.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0])), (Yr.STSD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1])); const a = new Uint8Array([105, 115, 111, 109]), s = new Uint8Array([97, 118, 99, 49]), o = new Uint8Array([0, 0, 0, 1]); (Yr.FTYP = Yr.box(Yr.types.ftyp, a, o, a, s)), (Yr.DINF = Yr.box(Yr.types.dinf, Yr.box(Yr.types.dref, i))); } static box(t, ...e) { let n = 8, i = e.length; const r = i; for (; i--;) n += e[i].byteLength; const a = new Uint8Array(n); for ( a[0] = (n >> 24) & 255, a[1] = (n >> 16) & 255, a[2] = (n >> 8) & 255, a[3] = 255 & n, a.set(t, 4), i = 0, n = 8; i < r; i++ ) a.set(e[i], n), (n += e[i].byteLength); return a; } static hdlr(t) { return Yr.box(Yr.types.hdlr, Yr.HDLR_TYPES[t]); } static mdat(t) { return Yr.box(Yr.types.mdat, t); } static mdhd(t, e) { e *= t; const n = Math.floor(e / (Hr + 1)), i = Math.floor(e % (Hr + 1)); return Yr.box( Yr.types.mdhd, new Uint8Array([ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, (t >> 24) & 255, (t >> 16) & 255, (t >> 8) & 255, 255 & t, n >> 24, (n >> 16) & 255, (n >> 8) & 255, 255 & n, i >> 24, (i >> 16) & 255, (i >> 8) & 255, 255 & i, 85, 196, 0, 0 ]) ); } static mdia(t) { return Yr.box(Yr.types.mdia, Yr.mdhd(t.timescale, t.duration), Yr.hdlr(t.type), Yr.minf(t)); } static mfhd(t) { return Yr.box(Yr.types.mfhd, new Uint8Array([0, 0, 0, 0, t >> 24, (t >> 16) & 255, (t >> 8) & 255, 255 & t])); } static minf(t) { return "audio" === t.type ? Yr.box(Yr.types.minf, Yr.box(Yr.types.smhd, Yr.SMHD), Yr.DINF, Yr.stbl(t)) : Yr.box(Yr.types.minf, Yr.box(Yr.types.vmhd, Yr.VMHD), Yr.DINF, Yr.stbl(t)); } static moof(t, e, n) { return Yr.box(Yr.types.moof, Yr.mfhd(t), Yr.traf(n, e)); } static moov(t) { let e = t.length; const n = []; for (; e--;) n[e] = Yr.trak(t[e]); return Yr.box.apply(null, [Yr.types.moov, Yr.mvhd(t[0].timescale, t[0].duration)].concat(n).concat(Yr.mvex(t))); } static mvex(t) { let e = t.length; const n = []; for (; e--;) n[e] = Yr.trex(t[e]); return Yr.box.apply(null, [Yr.types.mvex, ...n]); } static mvhd(t, e) { e *= t; const n = Math.floor(e / (Hr + 1)), i = Math.floor(e % (Hr + 1)), r = new Uint8Array([ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, (t >> 24) & 255, (t >> 16) & 255, (t >> 8) & 255, 255 & t, n >> 24, (n >> 16) & 255, (n >> 8) & 255, 255 & n, i >> 24, (i >> 16) & 255, (i >> 8) & 255, 255 & i, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255 ]); return Yr.box(Yr.types.mvhd, r); } static sdtp(t) { const e = t.samples || [], n = new Uint8Array(4 + e.length); let i, r; for (i = 0; i < e.length; i++) (r = e[i].flags), (n[i + 4] = (r.dependsOn << 4) | (r.isDependedOn << 2) | r.hasRedundancy); return Yr.box(Yr.types.sdtp, n); } static stbl(t) { return Yr.box( Yr.types.stbl, Yr.stsd(t), Yr.box(Yr.types.stts, Yr.STTS), Yr.box(Yr.types.stsc, Yr.STSC), Yr.box(Yr.types.stsz, Yr.STSZ), Yr.box(Yr.types.stco, Yr.STCO) ); } static avc1(t) { let e, n, i, r = [], a = []; for (e = 0; e < t.sps.length; e++) (n = t.sps[e]), (i = n.byteLength), r.push((i >>> 8) & 255), r.push(255 & i), (r = r.concat(Array.prototype.slice.call(n))); for (e = 0; e < t.pps.length; e++) (n = t.pps[e]), (i = n.byteLength), a.push((i >>> 8) & 255), a.push(255 & i), (a = a.concat(Array.prototype.slice.call(n))); const s = Yr.box( Yr.types.avcC, new Uint8Array([1, r[3], r[4], r[5], 255, 224 | t.sps.length].concat(r).concat([t.pps.length]).concat(a)) ), o = t.width, l = t.height, d = t.pixelRatio[0], c = t.pixelRatio[1]; return Yr.box( Yr.types.avc1, new Uint8Array([ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (o >> 8) & 255, 255 & o, (l >> 8) & 255, 255 & l, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 18, 100, 97, 105, 108, 121, 109, 111, 116, 105, 111, 110, 47, 104, 108, 115, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17 ]), s, Yr.box(Yr.types.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198, 192])), Yr.box( Yr.types.pasp, new Uint8Array([ d >> 24, (d >> 16) & 255, (d >> 8) & 255, 255 & d, c >> 24, (c >> 16) & 255, (c >> 8) & 255, 255 & c ]) ) ); } static esds(t) { const e = t.config.length; return new Uint8Array( [0, 0, 0, 0, 3, 23 + e, 0, 1, 0, 4, 15 + e, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5] .concat([e]) .concat(t.config) .concat([6, 1, 2]) ); } static audioStsd(t) { const e = t.samplerate; return new Uint8Array([ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, t.channelCount, 0, 16, 0, 0, 0, 0, (e >> 8) & 255, 255 & e, 0, 0 ]); } static mp4a(t) { return Yr.box(Yr.types.mp4a, Yr.audioStsd(t), Yr.box(Yr.types.esds, Yr.esds(t))); } static mp3(t) { return Yr.box(Yr.types[".mp3"], Yr.audioStsd(t)); } static ac3(t) { return Yr.box(Yr.types["ac-3"], Yr.audioStsd(t), Yr.box(Yr.types.dac3, t.config)); } static stsd(t) { return "audio" === t.type ? "mp3" === t.segmentCodec && "mp3" === t.codec ? Yr.box(Yr.types.stsd, Yr.STSD, Yr.mp3(t)) : "ac3" === t.segmentCodec ? Yr.box(Yr.types.stsd, Yr.STSD, Yr.ac3(t)) : Yr.box(Yr.types.stsd, Yr.STSD, Yr.mp4a(t)) : Yr.box(Yr.types.stsd, Yr.STSD, Yr.avc1(t)); } static tkhd(t) { const e = t.id, n = t.duration * t.timescale, i = t.width, r = t.height, a = Math.floor(n / (Hr + 1)), s = Math.floor(n % (Hr + 1)); return Yr.box( Yr.types.tkhd, new Uint8Array([ 1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, (e >> 24) & 255, (e >> 16) & 255, (e >> 8) & 255, 255 & e, 0, 0, 0, 0, a >> 24, (a >> 16) & 255, (a >> 8) & 255, 255 & a, s >> 24, (s >> 16) & 255, (s >> 8) & 255, 255 & s, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (i >> 8) & 255, 255 & i, 0, 0, (r >> 8) & 255, 255 & r, 0, 0 ]) ); } static traf(t, e) { const n = Yr.sdtp(t), i = t.id, r = Math.floor(e / (Hr + 1)), a = Math.floor(e % (Hr + 1)); return Yr.box( Yr.types.traf, Yr.box(Yr.types.tfhd, new Uint8Array([0, 0, 0, 0, i >> 24, (i >> 16) & 255, (i >> 8) & 255, 255 & i])), Yr.box( Yr.types.tfdt, new Uint8Array([ 1, 0, 0, 0, r >> 24, (r >> 16) & 255, (r >> 8) & 255, 255 & r, a >> 24, (a >> 16) & 255, (a >> 8) & 255, 255 & a ]) ), Yr.trun(t, n.length + 16 + 20 + 8 + 16 + 8 + 8), n ); } static trak(t) { return (t.duration = t.duration || 4294967295), Yr.box(Yr.types.trak, Yr.tkhd(t), Yr.mdia(t)); } static trex(t) { const e = t.id; return Yr.box( Yr.types.trex, new Uint8Array([ 0, 0, 0, 0, e >> 24, (e >> 16) & 255, (e >> 8) & 255, 255 & e, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1 ]) ); } static trun(t, e) { const n = t.samples || [], i = n.length, r = 12 + 16 * i, a = new Uint8Array(r); let s, o, l, d, c, u; for ( e += 8 + r, a.set( [ "video" === t.type ? 1 : 0, 0, 15, 1, (i >>> 24) & 255, (i >>> 16) & 255, (i >>> 8) & 255, 255 & i, (e >>> 24) & 255, (e >>> 16) & 255, (e >>> 8) & 255, 255 & e ], 0 ), s = 0; s < i; s++ ) (o = n[s]), (l = o.duration), (d = o.size), (c = o.flags), (u = o.cts), a.set( [ (l >>> 24) & 255, (l >>> 16) & 255, (l >>> 8) & 255, 255 & l, (d >>> 24) & 255, (d >>> 16) & 255, (d >>> 8) & 255, 255 & d, (c.isLeading << 2) | c.dependsOn, (c.isDependedOn << 6) | (c.hasRedundancy << 4) | (c.paddingValue << 1) | c.isNonSync, 61440 & c.degradPrio, 15 & c.degradPrio, (u >>> 24) & 255, (u >>> 16) & 255, (u >>> 8) & 255, 255 & u ], 12 + 16 * s ); return Yr.box(Yr.types.trun, a); } static initSegment(t) { Yr.types || Yr.init(); const e = Yr.moov(t); return ve(Yr.FTYP, e); } } (Yr.types = void 0), (Yr.HDLR_TYPES = void 0), (Yr.STTS = void 0), (Yr.STSC = void 0), (Yr.STCO = void 0), (Yr.STSZ = void 0), (Yr.VMHD = void 0), (Yr.SMHD = void 0), (Yr.STSD = void 0), (Yr.FTYP = void 0), (Yr.DINF = void 0); const $r = 9e4; function Kr(t, e, n = 1, i = !1) { const r = t * e * n; return i ? Math.round(r) : r; } function qr(t, e = !1) { return Kr(t, 1e3, 1 / $r, e); } let Vr, Wr = null, Qr = null; class Xr { constructor(t, e, n, i = "") { if ( ((this.observer = void 0), (this.config = void 0), (this.typeSupported = void 0), (this.ISGenerated = !1), (this._initPTS = null), (this._initDTS = null), (this.nextAvcDts = null), (this.nextAudioPts = null), (this.videoSampleDuration = null), (this.isAudioContiguous = !1), (this.isVideoContiguous = !1), (this.videoTrackConfig = void 0), (this.observer = t), (this.config = e), (this.typeSupported = n), (this.ISGenerated = !1), null === Wr) ) { const t = (navigator.userAgent || "").match(/Chrome\/(\d+)/i); Wr = t ? parseInt(t[1]) : 0; } if (null === Qr) { const t = navigator.userAgent.match(/Safari\/(\d+)/i); Qr = t ? parseInt(t[1]) : 0; } } destroy() { this.config = this.videoTrackConfig = this._initPTS = this._initDTS = null; } resetTimeStamp(t) { ot.log("[mp4-remuxer]: initPTS & initDTS reset"), (this._initPTS = this._initDTS = t); } resetNextTimestamp() { ot.log("[mp4-remuxer]: reset next timestamp"), (this.isVideoContiguous = !1), (this.isAudioContiguous = !1); } resetInitSegment() { ot.log("[mp4-remuxer]: ISGenerated flag reset"), (this.ISGenerated = !1), (this.videoTrackConfig = void 0); } getVideoStartPts(t) { let e = !1; const n = t.reduce((t, n) => { const i = n.pts - t; return i < -4294967296 ? ((e = !0), Jr(t, n.pts)) : i > 0 ? t : n.pts; }, t[0].pts); return e && ot.debug("PTS rollover detected"), n; } remux(t, e, n, i, r, a, s, o) { let l, d, c, u, h, p, f = r, m = r; const g = t.pid > -1, y = e.pid > -1, A = e.samples.length, v = t.samples.length > 0, b = (s && A > 0) || A > 1; if (((!g || v) && (!y || b)) || this.ISGenerated || s) { if (this.ISGenerated) { var E, w, x, S; const t = this.videoTrackConfig; !t || (e.width === t.width && e.height === t.height && (null == (E = e.pixelRatio) ? void 0 : E[0]) === (null == (w = t.pixelRatio) ? void 0 : w[0]) && (null == (x = e.pixelRatio) ? void 0 : x[1]) === (null == (S = t.pixelRatio) ? void 0 : S[1])) || this.resetInitSegment(); } else c = this.generateIS(t, e, r, a); const n = this.isVideoContiguous; let i, s = -1; if ( b && ((s = (function (t) { for (let e = 0; e < t.length; e++) if (t[e].key) return e; return -1; })(e.samples)), !n && this.config.forceKeyFrameOnDiscontinuity) ) if (((p = !0), s > 0)) { ot.warn(`[mp4-remuxer]: Dropped ${s} out of ${A} video samples due to a missing keyframe`); const t = this.getVideoStartPts(e.samples); (e.samples = e.samples.slice(s)), (e.dropped += s), (m += (e.samples[0].pts - t) / e.inputTimeScale), (i = m); } else -1 === s && (ot.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`), (p = !1)); if (this.ISGenerated) { if (v && b) { const n = this.getVideoStartPts(e.samples), i = (Jr(t.samples[0].pts, n) - n) / e.inputTimeScale; (f += Math.max(0, i)), (m += Math.max(0, -i)); } if (v) { if ( (t.samplerate || (ot.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"), (c = this.generateIS(t, e, r, a))), (d = this.remuxAudio(t, f, this.isAudioContiguous, a, y || b || o === dn ? m : void 0)), b) ) { const i = d ? d.endPTS - d.startPTS : 0; e.inputTimeScale || (ot.warn("[mp4-remuxer]: regenerate InitSegment as video detected"), (c = this.generateIS(t, e, r, a))), (l = this.remuxVideo(e, m, n, i)); } } else b && (l = this.remuxVideo(e, m, n, 0)); l && ((l.firstKeyFrame = s), (l.independent = -1 !== s), (l.firstKeyFramePTS = i)); } } return ( this.ISGenerated && this._initPTS && this._initDTS && (n.samples.length && (h = Zr(n, r, this._initPTS, this._initDTS)), i.samples.length && (u = ta(i, r, this._initPTS))), { audio: d, video: l, initSegment: c, independent: p, text: u, id3: h } ); } generateIS(t, e, n, i) { const r = t.samples, a = e.samples, s = this.typeSupported, o = {}, l = this._initPTS; let d, c, u, h = !l || i, p = "audio/mp4"; if ((h && (d = c = 1 / 0), t.config && r.length)) { switch (((t.timescale = t.samplerate), t.segmentCodec)) { case "mp3": s.mpeg ? ((p = "audio/mpeg"), (t.codec = "")) : s.mp3 && (t.codec = "mp3"); break; case "ac3": t.codec = "ac-3"; } (o.audio = { id: "audio", container: p, codec: t.codec, initSegment: "mp3" === t.segmentCodec && s.mpeg ? new Uint8Array(0) : Yr.initSegment([t]), metadata: { channelCount: t.channelCount } }), h && ((u = t.inputTimeScale), l && u === l.timescale ? (h = !1) : (d = c = r[0].pts - Math.round(u * n))); } if (e.sps && e.pps && a.length) { if ( ((e.timescale = e.inputTimeScale), (o.video = { id: "main", container: "video/mp4", codec: e.codec, initSegment: Yr.initSegment([e]), metadata: { width: e.width, height: e.height } }), h) ) if (((u = e.inputTimeScale), l && u === l.timescale)) h = !1; else { const t = this.getVideoStartPts(a), e = Math.round(u * n); (c = Math.min(c, Jr(a[0].dts, t) - e)), (d = Math.min(d, t - e)); } this.videoTrackConfig = { width: e.width, height: e.height, pixelRatio: e.pixelRatio }; } if (Object.keys(o).length) return ( (this.ISGenerated = !0), h ? ((this._initPTS = { baseTime: d, timescale: u }), (this._initDTS = { baseTime: c, timescale: u })) : (d = u = void 0), { tracks: o, initPTS: d, timescale: u } ); } remuxVideo(t, e, n, i) { const r = t.inputTimeScale, a = t.samples, s = [], o = a.length, l = this._initPTS; let d, c, u = this.nextAvcDts, h = 8, p = this.videoSampleDuration, f = Number.POSITIVE_INFINITY, m = Number.NEGATIVE_INFINITY, g = !1; if (!n || null === u) { const t = e * r, i = a[0].pts - Jr(a[0].dts, a[0].pts); Wr && null !== u && Math.abs(t - i - u) < 15e3 ? (n = !0) : (u = t - i); } const y = (l.baseTime * r) / l.timescale; for (let t = 0; t < o; t++) { const e = a[t]; (e.pts = Jr(e.pts - y, u)), (e.dts = Jr(e.dts - y, u)), e.dts < a[t > 0 ? t - 1 : t].dts && (g = !0); } g && a.sort(function (t, e) { const n = t.dts - e.dts, i = t.pts - e.pts; return n || i; }), (d = a[0].dts), (c = a[a.length - 1].dts); const A = c - d, v = A ? Math.round(A / (o - 1)) : p || t.inputTimeScale / 30; if (n) { const t = d - u, n = t > v, i = t < -1; if ( (n || i) && (n ? ot.warn(`AVC: ${qr(t, !0)} ms (${t}dts) hole between fragments detected at ${e.toFixed(3)}`) : ot.warn(`AVC: ${qr(-t, !0)} ms (${t}dts) overlapping between fragments detected at ${e.toFixed(3)}`), !i || u >= a[0].pts || Wr) ) { d = u; const e = a[0].pts - t; if (n) (a[0].dts = d), (a[0].pts = e); else for (let n = 0; n < a.length && !(a[n].dts > e); n++) (a[n].dts -= t), (a[n].pts -= t); ot.log(`Video: Initial PTS/DTS adjusted: ${qr(e, !0)}/${qr(d, !0)}, delta: ${qr(t, !0)} ms`); } } d = Math.max(0, d); let b = 0, E = 0, w = d; for (let t = 0; t < o; t++) { const e = a[t], n = e.units, i = n.length; let r = 0; for (let t = 0; t < i; t++) r += n[t].data.length; (E += r), (b += i), (e.length = r), e.dts < w ? ((e.dts = w), (w += (v / 4) | 0 || 1)) : (w = e.dts), (f = Math.min(e.pts, f)), (m = Math.max(e.pts, m)); } c = a[o - 1].dts; const x = E + 4 * b + 8; let S; try { S = new Uint8Array(x); } catch (t) { return void this.observer.emit(tt.ERROR, tt.ERROR, { type: et.MUX_ERROR, details: nt.REMUX_ALLOC_ERROR, fatal: !1, error: t, bytes: x, reason: `fail allocating video mdat ${x}` }); } const _ = new DataView(S.buffer); _.setUint32(0, x), S.set(Yr.types.mdat, 4); let T = !1, k = Number.POSITIVE_INFINITY, C = Number.POSITIVE_INFINITY, L = Number.NEGATIVE_INFINITY, I = Number.NEGATIVE_INFINITY; for (let t = 0; t < o; t++) { const e = a[t], n = e.units; let l, d = 0; for (let t = 0, e = n.length; t < e; t++) { const e = n[t], i = e.data, r = e.data.byteLength; _.setUint32(h, r), (h += 4), S.set(i, h), (h += r), (d += 4 + r); } if (t < o - 1) (p = a[t + 1].dts - e.dts), (l = a[t + 1].pts - e.pts); else { const n = this.config, s = t > 0 ? e.dts - a[t - 1].dts : v; if (((l = t > 0 ? e.pts - a[t - 1].pts : v), n.stretchShortVideoTrack && null !== this.nextAudioPts)) { const t = Math.floor(n.maxBufferHole * r), a = (i ? f + i * r : this.nextAudioPts) - e.pts; a > t ? ((p = a - s), p < 0 ? (p = s) : (T = !0), ot.log( `[mp4-remuxer]: It is approximately ${a / 90} ms to the next segment; using duration ${p / 90 } ms for the last video frame.` )) : (p = s); } else p = s; } const c = Math.round(e.pts - e.dts); (k = Math.min(k, p)), (L = Math.max(L, p)), (C = Math.min(C, l)), (I = Math.max(I, l)), s.push(new ea(e.key, p, d, c)); } if (s.length) if (Wr) { if (Wr < 70) { const t = s[0].flags; (t.dependsOn = 2), (t.isNonSync = 0); } } else if (Qr && I - C < L - k && v / L < 0.025 && 0 === s[0].cts) { ot.warn( "Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration." ); let t = d; for (let e = 0, n = s.length; e < n; e++) { const i = t + s[e].duration, r = t + s[e].cts; if (e < n - 1) { const t = i + s[e + 1].cts; s[e].duration = t - r; } else s[e].duration = e ? s[e - 1].duration : v; (s[e].cts = 0), (t = i); } } (p = T || !p ? v : p), (this.nextAvcDts = u = c + p), (this.videoSampleDuration = p), (this.isVideoContiguous = !0); const R = { data1: Yr.moof(t.sequenceNumber++, d, Q({}, t, { samples: s })), data2: S, startPTS: f / r, endPTS: (m + p) / r, startDTS: d / r, endDTS: u / r, type: "video", hasAudio: !1, hasVideo: !0, nb: s.length, dropped: t.dropped }; return (t.samples = []), (t.dropped = 0), R; } getSamplesPerFrame(t) { switch (t.segmentCodec) { case "mp3": return 1152; case "ac3": return 1536; default: return 1024; } } remuxAudio(t, e, n, i, r) { const a = t.inputTimeScale, s = a / (t.samplerate ? t.samplerate : a), o = this.getSamplesPerFrame(t), l = o * s, d = this._initPTS, c = "mp3" === t.segmentCodec && this.typeSupported.mpeg, u = [], h = void 0 !== r; let p = t.samples, f = c ? 0 : 8, m = this.nextAudioPts || -1; const g = e * a, y = (d.baseTime * a) / d.timescale; if ( ((this.isAudioContiguous = n = n || (p.length && m > 0 && ((i && Math.abs(g - m) < 9e3) || Math.abs(Jr(p[0].pts - y, g) - m) < 20 * l))), p.forEach(function (t) { t.pts = Jr(t.pts - y, g); }), !n || m < 0) ) { if (((p = p.filter(t => t.pts >= 0)), !p.length)) return; m = 0 === r ? 0 : i && !h ? Math.max(0, g) : p[0].pts; } if ("aac" === t.segmentCodec) { const e = this.config.maxAudioFramesDrift; for (let n = 0, i = m; n < p.length; n++) { const r = p[n], s = r.pts, o = s - i, d = Math.abs((1e3 * o) / a); if (o <= -e * l && h) 0 === n && (ot.warn( `Audio frame @ ${(s / a).toFixed(3)}s overlaps nextAudioPts by ${Math.round((1e3 * o) / a)} ms.` ), (this.nextAudioPts = m = i = s)); else if (o >= e * l && d < 1e4 && h) { let e = Math.round(o / l); (i = s - e * l), i < 0 && (e--, (i += l)), 0 === n && (this.nextAudioPts = m = i), ot.warn( `[mp4-remuxer]: Injecting ${e} audio frame @ ${(i / a).toFixed(3)}s due to ${Math.round( (1e3 * o) / a )} ms gap.` ); for (let a = 0; a < e; a++) { const e = Math.max(i, 0); let a = jr.getSilentFrame(t.manifestCodec || t.codec, t.channelCount); a || (ot.log( "[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead." ), (a = r.unit.subarray())), p.splice(n, 0, { unit: a, pts: e }), (i += l), n++; } } (r.pts = i), (i += l); } } let A, v = null, b = null, E = 0, w = p.length; for (; w--;) E += p[w].unit.byteLength; for (let e = 0, i = p.length; e < i; e++) { const i = p[e], r = i.unit; let a = i.pts; if (null !== b) { u[e - 1].duration = Math.round((a - b) / s); } else { if ((n && "aac" === t.segmentCodec && (a = m), (v = a), !(E > 0))) return; E += f; try { A = new Uint8Array(E); } catch (t) { return void this.observer.emit(tt.ERROR, tt.ERROR, { type: et.MUX_ERROR, details: nt.REMUX_ALLOC_ERROR, fatal: !1, error: t, bytes: E, reason: `fail allocating audio mdat ${E}` }); } if (!c) { new DataView(A.buffer).setUint32(0, E), A.set(Yr.types.mdat, 4); } } A.set(r, f); const l = r.byteLength; (f += l), u.push(new ea(!0, o, l, 0)), (b = a); } const x = u.length; if (!x) return; const S = u[u.length - 1]; this.nextAudioPts = m = b + s * S.duration; const _ = c ? new Uint8Array(0) : Yr.moof(t.sequenceNumber++, v / s, Q({}, t, { samples: u })); t.samples = []; const T = v / a, k = m / a, C = { data1: _, data2: A, startPTS: T, endPTS: k, startDTS: T, endDTS: k, type: "audio", hasAudio: !0, hasVideo: !1, nb: x }; return (this.isAudioContiguous = !0), C; } remuxEmptyAudio(t, e, n, i) { const r = t.inputTimeScale, a = r / (t.samplerate ? t.samplerate : r), s = this.nextAudioPts, o = this._initDTS, l = (9e4 * o.baseTime) / o.timescale, d = (null !== s ? s : i.startDTS * r) + l, c = i.endDTS * r + l, u = 1024 * a, h = Math.ceil((c - d) / u), p = jr.getSilentFrame(t.manifestCodec || t.codec, t.channelCount); if ((ot.warn("[mp4-remuxer]: remux empty Audio"), !p)) return void ot.trace( "[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec" ); const f = []; for (let t = 0; t < h; t++) { const e = d + t * u; f.push({ unit: p, pts: e, dts: e }); } return (t.samples = f), this.remuxAudio(t, e, n, !1); } } function Jr(t, e) { let n; if (null === e) return t; for (n = e < t ? -8589934592 : 8589934592; Math.abs(t - e) > 4294967296;) t += n; return t; } function Zr(t, e, n, i) { const r = t.samples.length; if (!r) return; const a = t.inputTimeScale; for (let s = 0; s < r; s++) { const r = t.samples[s]; (r.pts = Jr(r.pts - (n.baseTime * a) / n.timescale, e * a) / a), (r.dts = Jr(r.dts - (i.baseTime * a) / i.timescale, e * a) / a); } const s = t.samples; return (t.samples = []), { samples: s }; } function ta(t, e, n) { const i = t.samples.length; if (!i) return; const r = t.inputTimeScale; for (let a = 0; a < i; a++) { const i = t.samples[a]; i.pts = Jr(i.pts - (n.baseTime * r) / n.timescale, e * r) / r; } t.samples.sort((t, e) => t.pts - e.pts); const a = t.samples; return (t.samples = []), { samples: a }; } class ea { constructor(t, e, n, i) { (this.size = void 0), (this.duration = void 0), (this.cts = void 0), (this.flags = void 0), (this.duration = e), (this.size = n), (this.cts = i), (this.flags = { isLeading: 0, isDependedOn: 0, hasRedundancy: 0, degradPrio: 0, dependsOn: t ? 2 : 1, isNonSync: t ? 0 : 1 }); } } function na(t, e) { const n = null == t ? void 0 : t.codec; if (n && n.length > 4) return n; if (e === ft) { if ("ec-3" === n || "ac-3" === n || "alac" === n) return n; if ("fLaC" === n || "Opus" === n) { return je(n, !1); } const t = "mp4a.40.5"; return ot.info(`Parsed audio codec "${n}" or audio object type not handled. Using "${t}"`), t; } return ( ot.warn(`Unhandled video codec "${n}"`), "hvc1" === n || "hev1" === n ? "hvc1.1.6.L120.90" : "av01" === n ? "av01.0.04M.08" : "avc1.42e01e" ); } try { Vr = self.performance.now.bind(self.performance); } catch (t) { ot.debug("Unable to use Performance API on this environment"), (Vr = null == St ? void 0 : St.Date.now); } const ia = [ { demux: class { constructor(t, e) { (this.remainderData = null), (this.timeOffset = 0), (this.config = void 0), (this.videoTrack = void 0), (this.audioTrack = void 0), (this.id3Track = void 0), (this.txtTrack = void 0), (this.config = e); } resetTimeStamp() { } resetInitSegment(t, e, n, i) { const r = (this.videoTrack = sr("video", 1)), a = (this.audioTrack = sr("audio", 1)), s = (this.txtTrack = sr("text", 1)); if (((this.id3Track = sr("id3", 1)), (this.timeOffset = 0), null == t || !t.byteLength)) return; const o = he(t); if (o.video) { const { id: t, timescale: e, codec: n } = o.video; (r.id = t), (r.timescale = s.timescale = e), (r.codec = n); } if (o.audio) { const { id: t, timescale: e, codec: n } = o.audio; (a.id = t), (a.timescale = e), (a.codec = n); } (s.id = ie.text), (r.sampleDuration = 0), (r.duration = a.duration = i); } resetContiguity() { this.remainderData = null; } static probe(t) { return (function (t) { const e = t.byteLength; for (let n = 0; n < e;) { const i = se(t, n); if (i > 8 && 109 === t[n + 4] && 111 === t[n + 5] && 111 === t[n + 6] && 102 === t[n + 7]) return !0; n = i > 1 ? n + i : e; } return !1; })(t); } demux(t, e) { this.timeOffset = e; let n = t; const i = this.videoTrack, r = this.txtTrack; if (this.config.progressive) { this.remainderData && (n = ve(this.remainderData, t)); const e = (function (t) { const e = { valid: null, remainder: null }, n = ce(t, ["moof"]); if (n.length < 2) return (e.remainder = t), e; const i = n[n.length - 1]; return (e.valid = Ft(t, 0, i.byteOffset - 8)), (e.remainder = Ft(t, i.byteOffset - 8)), e; })(n); (this.remainderData = e.remainder), (i.samples = e.valid || new Uint8Array()); } else i.samples = n; const a = this.extractID3Track(i, e); return ( (r.samples = be(e, i)), { videoTrack: i, audioTrack: this.audioTrack, id3Track: a, textTrack: this.txtTrack } ); } flush() { const t = this.timeOffset, e = this.videoTrack, n = this.txtTrack; (e.samples = this.remainderData || new Uint8Array()), (this.remainderData = null); const i = this.extractID3Track(e, this.timeOffset); return (n.samples = be(t, e)), { videoTrack: e, audioTrack: sr(), id3Track: i, textTrack: sr() }; } extractID3Track(t, e) { const n = this.id3Track; if (t.samples.length) { const i = ce(t.samples, ["emsg"]); i && i.forEach(t => { const i = (function (t) { const e = t[0]; let n = "", i = "", r = 0, a = 0, s = 0, o = 0, l = 0, d = 0; if (0 === e) { for (; "\0" !== re(t.subarray(d, d + 1));) (n += re(t.subarray(d, d + 1))), (d += 1); for (n += re(t.subarray(d, d + 1)), d += 1; "\0" !== re(t.subarray(d, d + 1));) (i += re(t.subarray(d, d + 1))), (d += 1); (i += re(t.subarray(d, d + 1))), (d += 1), (r = se(t, 12)), (a = se(t, 16)), (o = se(t, 20)), (l = se(t, 24)), (d = 28); } else if (1 === e) { (d += 4), (r = se(t, d)), (d += 4); const e = se(t, d); d += 4; const a = se(t, d); for ( d += 4, s = 2 ** 32 * e + a, J(s) || ((s = Number.MAX_SAFE_INTEGER), ot.warn( "Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box" )), o = se(t, d), d += 4, l = se(t, d), d += 4; "\0" !== re(t.subarray(d, d + 1)); ) (n += re(t.subarray(d, d + 1))), (d += 1); for (n += re(t.subarray(d, d + 1)), d += 1; "\0" !== re(t.subarray(d, d + 1));) (i += re(t.subarray(d, d + 1))), (d += 1); (i += re(t.subarray(d, d + 1))), (d += 1); } return { schemeIdUri: n, value: i, timeScale: r, presentationTime: s, presentationTimeDelta: a, eventDuration: o, id: l, payload: t.subarray(d, t.byteLength) }; })(t); if (kr.test(i.schemeIdUri)) { const t = X(i.presentationTime) ? i.presentationTime / i.timeScale : e + i.presentationTimeDelta / i.timeScale; let r = 4294967295 === i.eventDuration ? Number.POSITIVE_INFINITY : i.eventDuration / i.timeScale; r <= 0.001 && (r = Number.POSITIVE_INFINITY); const a = i.payload; n.samples.push({ data: a, len: a.byteLength, dts: t, pts: t, type: En, duration: r }); } }); } return n; } demuxSampleAes(t, e, n) { return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption")); } destroy() { } }, remux: class { constructor() { (this.emitInitSegment = !1), (this.audioCodec = void 0), (this.videoCodec = void 0), (this.initData = void 0), (this.initPTS = null), (this.initTracks = void 0), (this.lastEndTime = null); } destroy() { } resetTimeStamp(t) { (this.initPTS = t), (this.lastEndTime = null); } resetNextTimestamp() { this.lastEndTime = null; } resetInitSegment(t, e, n, i) { (this.audioCodec = e), (this.videoCodec = n), this.generateInitSegment( (function (t, e) { if (!t || !e) return t; const n = e.keyId; n && e.isCommonEncryption && ce(t, ["moov", "trak"]).forEach(t => { const e = ce(t, ["mdia", "minf", "stbl", "stsd"])[0].subarray(8); let i = ce(e, ["enca"]); const r = i.length > 0; r || (i = ce(e, ["encv"])), i.forEach(t => { ce(r ? t.subarray(28) : t.subarray(78), ["sinf"]).forEach(t => { const e = ye(t); if (e) { const t = e.subarray(8, 24); t.some(t => 0 !== t) || (ot.log( `[eme] Patching keyId in 'enc${r ? "a" : "v" }>sinf>>tenc' box: ${te(t)} -> ${te(n)}` ), e.set(n, 8)); } }); }); }); return t; })(t, i) ), (this.emitInitSegment = !0); } generateInitSegment(t) { let { audioCodec: e, videoCodec: n } = this; if (null == t || !t.byteLength) return (this.initTracks = void 0), void (this.initData = void 0); const i = (this.initData = he(t)); i.audio && (e = na(i.audio, ft)), i.video && (n = na(i.video, mt)); const r = {}; i.audio && i.video ? (r.audiovideo = { container: "video/mp4", codec: e + "," + n, initSegment: t, id: "main" }) : i.audio ? (r.audio = { container: "audio/mp4", codec: e, initSegment: t, id: "audio" }) : i.video ? (r.video = { container: "video/mp4", codec: n, initSegment: t, id: "main" }) : ot.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."), (this.initTracks = r); } remux(t, e, n, i, r, a) { var s, o; let { initPTS: l, lastEndTime: d } = this; const c = { audio: void 0, video: void 0, text: i, id3: n, initSegment: void 0 }; X(d) || (d = this.lastEndTime = r || 0); const u = e.samples; if (null == u || !u.length) return c; const h = { initPTS: void 0, timescale: 1 }; let p = this.initData; if ( ((null != (s = p) && s.length) || (this.generateInitSegment(u), (p = this.initData)), null == (o = p) || !o.length) ) return ot.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."), c; this.emitInitSegment && ((h.tracks = this.initTracks), (this.emitInitSegment = !1)); const f = (function (t, e) { let n = 0, i = 0, r = 0; const a = ce(t, ["moof", "traf"]); for (let t = 0; t < a.length; t++) { const s = a[t], o = ce(s, ["tfhd"])[0], l = e[se(o, 4)]; if (!l) continue; const d = l.default, c = se(o, 0) | (null == d ? void 0 : d.flags); let u = null == d ? void 0 : d.duration; 8 & c && (u = se(o, 2 & c ? 12 : 8)); const h = l.timescale || 9e4, p = ce(s, ["trun"]); for (let t = 0; t < p.length; t++) (n = Ae(p[t])), !n && u && (n = u * se(p[t], 4)), l.type === mt ? (i += n / h) : l.type === ft && (r += n / h); } if (0 === i && 0 === r) { let e = 1 / 0, n = 0, i = 0; const r = ce(t, ["sidx"]); for (let t = 0; t < r.length; t++) { const a = ue(r[t]); if (null != a && a.references) { e = Math.min(e, a.earliestPresentationTime / a.timescale); const t = a.references.reduce((t, e) => t + e.info.duration || 0, 0); (n = Math.max(n, t + a.earliestPresentationTime / a.timescale)), (i = n - e); } } if (i && X(i)) return i; } return i || r; })(u, p), m = (function (t, e) { return ce(e, ["moof", "traf"]).reduce((e, n) => { const i = ce(n, ["tfdt"])[0], r = i[0], a = ce(n, ["tfhd"]).reduce((e, n) => { const a = se(n, 4), s = t[a]; if (s) { let t = se(i, 4); if (1 === r) { if (t === ee) return ( ot.warn( "[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time" ), e ); (t *= ee + 1), (t += se(i, 8)); } const n = t / (s.timescale || 9e4); if (X(n) && (null === e || n < e)) return n; } return e; }, null); return null !== a && X(a) && (null === e || a < e) ? a : e; }, null); })(p, u), g = null === m ? r : m; ((function (t, e, n, i) { if (null === t) return !0; const r = Math.max(i, 1), a = e - t.baseTime / t.timescale; return Math.abs(a - n) > r; })(l, g, r, f) || (h.timescale !== l.timescale && a)) && ((h.initPTS = g - r), l && 1 === l.timescale && ot.warn("Adjusting initPTS by " + (h.initPTS - l.baseTime)), (this.initPTS = l = { baseTime: h.initPTS, timescale: 1 })); const y = t ? g - l.baseTime / l.timescale : d, A = y + f; !(function (t, e, n) { ce(e, ["moof", "traf"]).forEach(e => { ce(e, ["tfhd"]).forEach(i => { const r = se(i, 4), a = t[r]; if (!a) return; const s = a.timescale || 9e4; ce(e, ["tfdt"]).forEach(t => { const e = t[0], i = n * s; if (i) { let n = se(t, 4); if (0 === e) (n -= i), (n = Math.max(n, 0)), de(t, 4, n); else { (n *= Math.pow(2, 32)), (n += se(t, 8)), (n -= i), (n = Math.max(n, 0)); const e = Math.floor(n / (ee + 1)), r = Math.floor(n % (ee + 1)); de(t, 4, e), de(t, 8, r); } } }); }); }); })(p, u, l.baseTime / l.timescale), f > 0 ? (this.lastEndTime = A) : (ot.warn("Duration parsed from mp4 should be greater than zero"), this.resetNextTimestamp()); const v = !!p.audio, b = !!p.video; let E = ""; v && (E += "audio"), b && (E += "video"); const w = { data1: u, startPTS: y, startDTS: y, endPTS: A, endDTS: A, type: E, hasAudio: v, hasVideo: b, nb: 1, dropped: 0 }; return ( (c.audio = "audio" === w.type ? w : void 0), (c.video = "audio" !== w.type ? w : void 0), (c.initSegment = h), (c.id3 = Zr(n, r, l, l)), i.samples.length && (c.text = ta(i, r, l)), c ); } } }, { demux: Fr, remux: Xr }, { demux: class extends or { constructor(t, e) { super(), (this.observer = void 0), (this.config = void 0), (this.observer = t), (this.config = e); } resetInitSegment(t, e, n, i) { super.resetInitSegment(t, e, n, i), (this._audioTrack = { container: "audio/adts", type: "audio", id: 2, pid: -1, sequenceNumber: 0, segmentCodec: "aac", samples: [], manifestCodec: e, duration: i, inputTimeScale: 9e4, dropped: 0 }); } static probe(t) { if (!t) return !1; const e = Nt(t, 0); let n = (null == e ? void 0 : e.length) || 0; if (Tr(t, n)) return !1; for (let e = t.length; n < e; n++) if (pr(t, n)) return ot.log("ADTS sync word found !"), !0; return !1; } canParse(t, e) { return (function (t, e) { return ( (function (t, e) { return e + 5 < t.length; })(t, e) && dr(t, e) && ur(t, e) <= t.length - e ); })(t, e); } appendFrame(t, e, n) { fr(t, this.observer, e, n, t.manifestCodec); const i = gr(t, e, n, this.basePTS, this.frameIndex); if (i && 0 === i.missing) return i; } }, remux: Xr }, { demux: class extends or { resetInitSegment(t, e, n, i) { super.resetInitSegment(t, e, n, i), (this._audioTrack = { container: "audio/mpeg", type: "audio", id: 2, pid: -1, sequenceNumber: 0, segmentCodec: "mp3", samples: [], manifestCodec: e, duration: i, inputTimeScale: 9e4, dropped: 0 }); } static probe(t) { if (!t) return !1; const e = Nt(t, 0); let n = (null == e ? void 0 : e.length) || 0; if (e && 11 === t[n] && 119 === t[n + 1] && void 0 !== jt(e) && Cr(t, n) <= 16) return !1; for (let e = t.length; n < e; n++) if (Tr(t, n)) return ot.log("MPEG Audio sync word found !"), !0; return !1; } canParse(t, e) { return (function (t, e) { return Sr(t, e) && 4 <= t.length - e; })(t, e); } appendFrame(t, e, n) { if (null !== this.basePTS) return wr(t, e, n, this.basePTS, this.frameIndex); } }, remux: Xr } ]; ia.splice(2, 0, { demux: Lr, remux: Xr }); class ra { constructor(t, e, n, i, r) { (this.async = !1), (this.observer = void 0), (this.typeSupported = void 0), (this.config = void 0), (this.vendor = void 0), (this.id = void 0), (this.demuxer = void 0), (this.remuxer = void 0), (this.decrypter = void 0), (this.probe = void 0), (this.decryptionPromise = null), (this.transmuxConfig = void 0), (this.currentTransmuxState = void 0), (this.observer = t), (this.typeSupported = e), (this.config = n), (this.vendor = i), (this.id = r); } configure(t) { (this.transmuxConfig = t), this.decrypter && this.decrypter.reset(); } push(t, e, n, i) { const r = n.transmuxing; r.executeStart = Vr(); let a = new Uint8Array(t); const { currentTransmuxState: s, transmuxConfig: o } = this; i && (this.currentTransmuxState = i); const { contiguous: l, discontinuity: d, trackSwitch: c, accurateTimeOffset: u, timeOffset: h, initSegmentChange: p } = i || s, { audioCodec: f, videoCodec: m, defaultInitPts: g, duration: y, initSegmentData: A } = o, v = (function (t, e) { let n = null; t.byteLength > 0 && null != (null == e ? void 0 : e.key) && null !== e.iv && null != e.method && (n = e); return n; })(a, e); if (v && "AES-128" === v.method) { const t = this.getDecrypter(); if (!t.isSync()) return ( (this.decryptionPromise = t.webCryptoDecrypt(a, v.key.buffer, v.iv.buffer).then(t => { const e = this.push(t, null, n); return (this.decryptionPromise = null), e; })), this.decryptionPromise ); { let e = t.softwareDecrypt(a, v.key.buffer, v.iv.buffer); if ((n.part > -1 && (e = t.flush()), !e)) return (r.executeEnd = Vr()), aa(n); a = new Uint8Array(e); } } const b = this.needsProbing(d, c); if (b) { const t = this.configureTransmuxer(a); if (t) return ( ot.warn(`[transmuxer] ${t.message}`), this.observer.emit(tt.ERROR, tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_PARSING_ERROR, fatal: !1, error: t, reason: t.message }), (r.executeEnd = Vr()), aa(n) ); } (d || c || p || b) && this.resetInitSegment(A, f, m, y, e), (d || p || b) && this.resetInitialTimestamp(g), l || this.resetContiguity(); const E = this.transmux(a, v, h, u, n), w = this.currentTransmuxState; return (w.contiguous = !0), (w.discontinuity = !1), (w.trackSwitch = !1), (r.executeEnd = Vr()), E; } flush(t) { const e = t.transmuxing; e.executeStart = Vr(); const { decrypter: n, currentTransmuxState: i, decryptionPromise: r } = this; if (r) return r.then(() => this.flush(t)); const a = [], { timeOffset: s } = i; if (n) { const e = n.flush(); e && a.push(this.push(e, null, t)); } const { demuxer: o, remuxer: l } = this; if (!o || !l) return (e.executeEnd = Vr()), [aa(t)]; const d = o.flush(s); return sa(d) ? d.then(e => (this.flushRemux(a, e, t), a)) : (this.flushRemux(a, d, t), a); } flushRemux(t, e, n) { const { audioTrack: i, videoTrack: r, id3Track: a, textTrack: s } = e, { accurateTimeOffset: o, timeOffset: l } = this.currentTransmuxState; ot.log(`[transmuxer.ts]: Flushed fragment ${n.sn}${n.part > -1 ? " p: " + n.part : ""} of level ${n.level}`); const d = this.remuxer.remux(i, r, a, s, l, o, !0, this.id); t.push({ remuxResult: d, chunkMeta: n }), (n.transmuxing.executeEnd = Vr()); } resetInitialTimestamp(t) { const { demuxer: e, remuxer: n } = this; e && n && (e.resetTimeStamp(t), n.resetTimeStamp(t)); } resetContiguity() { const { demuxer: t, remuxer: e } = this; t && e && (t.resetContiguity(), e.resetNextTimestamp()); } resetInitSegment(t, e, n, i, r) { const { demuxer: a, remuxer: s } = this; a && s && (a.resetInitSegment(t, e, n, i), s.resetInitSegment(t, e, n, r)); } destroy() { this.demuxer && (this.demuxer.destroy(), (this.demuxer = void 0)), this.remuxer && (this.remuxer.destroy(), (this.remuxer = void 0)); } transmux(t, e, n, i, r) { let a; return ( (a = e && "SAMPLE-AES" === e.method ? this.transmuxSampleAes(t, e, n, i, r) : this.transmuxUnencrypted(t, n, i, r)), a ); } transmuxUnencrypted(t, e, n, i) { const { audioTrack: r, videoTrack: a, id3Track: s, textTrack: o } = this.demuxer.demux(t, e, !1, !this.config.progressive); return { remuxResult: this.remuxer.remux(r, a, s, o, e, n, !1, this.id), chunkMeta: i }; } transmuxSampleAes(t, e, n, i, r) { return this.demuxer .demuxSampleAes(t, e, n) .then(t => ({ remuxResult: this.remuxer.remux(t.audioTrack, t.videoTrack, t.id3Track, t.textTrack, n, i, !1, this.id), chunkMeta: r })); } configureTransmuxer(t) { const { config: e, observer: n, typeSupported: i, vendor: r } = this; let a; for (let e = 0, n = ia.length; e < n; e++) { var s; if (null != (s = ia[e].demux) && s.probe(t)) { a = ia[e]; break; } } if (!a) return new Error("Failed to find demuxer by probing fragment data"); const o = this.demuxer, l = this.remuxer, d = a.remux, c = a.demux; (l && l instanceof d) || (this.remuxer = new d(n, e, i, r)), (o && o instanceof c) || ((this.demuxer = new c(n, e, i)), (this.probe = c.probe)); } needsProbing(t, e) { return !this.demuxer || !this.remuxer || t || e; } getDecrypter() { let t = this.decrypter; return t || (t = this.decrypter = new Yi(this.config)), t; } } const aa = t => ({ remuxResult: {}, chunkMeta: t }); function sa(t) { return "then" in t && t.then instanceof Function; } class oa { constructor(t, e, n, i, r) { (this.audioCodec = void 0), (this.videoCodec = void 0), (this.initSegmentData = void 0), (this.duration = void 0), (this.defaultInitPts = void 0), (this.audioCodec = t), (this.videoCodec = e), (this.initSegmentData = n), (this.duration = i), (this.defaultInitPts = r || null); } } class la { constructor(t, e, n, i, r, a) { (this.discontinuity = void 0), (this.contiguous = void 0), (this.accurateTimeOffset = void 0), (this.trackSwitch = void 0), (this.timeOffset = void 0), (this.initSegmentChange = void 0), (this.discontinuity = t), (this.contiguous = e), (this.accurateTimeOffset = n), (this.trackSwitch = i), (this.timeOffset = r), (this.initSegmentChange = a); } } var da = { exports: {} }; !(function (t) { var e = Object.prototype.hasOwnProperty, n = "~"; function i() { } function r(t, e, n) { (this.fn = t), (this.context = e), (this.once = n || !1); } function a(t, e, i, a, s) { if ("function" != typeof i) throw new TypeError("The listener must be a function"); var o = new r(i, a || t, s), l = n ? n + e : e; return ( t._events[l] ? t._events[l].fn ? (t._events[l] = [t._events[l], o]) : t._events[l].push(o) : ((t._events[l] = o), t._eventsCount++), t ); } function s(t, e) { 0 == --t._eventsCount ? (t._events = new i()) : delete t._events[e]; } function o() { (this._events = new i()), (this._eventsCount = 0); } Object.create && ((i.prototype = Object.create(null)), new i().__proto__ || (n = !1)), (o.prototype.eventNames = function () { var t, i, r = []; if (0 === this._eventsCount) return r; for (i in (t = this._events)) e.call(t, i) && r.push(n ? i.slice(1) : i); return Object.getOwnPropertySymbols ? r.concat(Object.getOwnPropertySymbols(t)) : r; }), (o.prototype.listeners = function (t) { var e = n ? n + t : t, i = this._events[e]; if (!i) return []; if (i.fn) return [i.fn]; for (var r = 0, a = i.length, s = new Array(a); r < a; r++) s[r] = i[r].fn; return s; }), (o.prototype.listenerCount = function (t) { var e = n ? n + t : t, i = this._events[e]; return i ? (i.fn ? 1 : i.length) : 0; }), (o.prototype.emit = function (t, e, i, r, a, s) { var o = n ? n + t : t; if (!this._events[o]) return !1; var l, d, c = this._events[o], u = arguments.length; if (c.fn) { switch ((c.once && this.removeListener(t, c.fn, void 0, !0), u)) { case 1: return c.fn.call(c.context), !0; case 2: return c.fn.call(c.context, e), !0; case 3: return c.fn.call(c.context, e, i), !0; case 4: return c.fn.call(c.context, e, i, r), !0; case 5: return c.fn.call(c.context, e, i, r, a), !0; case 6: return c.fn.call(c.context, e, i, r, a, s), !0; } for (d = 1, l = new Array(u - 1); d < u; d++) l[d - 1] = arguments[d]; c.fn.apply(c.context, l); } else { var h, p = c.length; for (d = 0; d < p; d++) switch ((c[d].once && this.removeListener(t, c[d].fn, void 0, !0), u)) { case 1: c[d].fn.call(c[d].context); break; case 2: c[d].fn.call(c[d].context, e); break; case 3: c[d].fn.call(c[d].context, e, i); break; case 4: c[d].fn.call(c[d].context, e, i, r); break; default: if (!l) for (h = 1, l = new Array(u - 1); h < u; h++) l[h - 1] = arguments[h]; c[d].fn.apply(c[d].context, l); } } return !0; }), (o.prototype.on = function (t, e, n) { return a(this, t, e, n, !1); }), (o.prototype.once = function (t, e, n) { return a(this, t, e, n, !0); }), (o.prototype.removeListener = function (t, e, i, r) { var a = n ? n + t : t; if (!this._events[a]) return this; if (!e) return s(this, a), this; var o = this._events[a]; if (o.fn) o.fn !== e || (r && !o.once) || (i && o.context !== i) || s(this, a); else { for (var l = 0, d = [], c = o.length; l < c; l++) (o[l].fn !== e || (r && !o[l].once) || (i && o[l].context !== i)) && d.push(o[l]); d.length ? (this._events[a] = 1 === d.length ? d[0] : d) : s(this, a); } return this; }), (o.prototype.removeAllListeners = function (t) { var e; return ( t ? ((e = n ? n + t : t), this._events[e] && s(this, e)) : ((this._events = new i()), (this._eventsCount = 0)), this ); }), (o.prototype.off = o.prototype.removeListener), (o.prototype.addListener = o.prototype.on), (o.prefixed = n), (o.EventEmitter = o), (t.exports = o); })(da); var ca = H(da.exports); class ua { constructor(t, e, n, i) { (this.error = null), (this.hls = void 0), (this.id = void 0), (this.observer = void 0), (this.frag = null), (this.part = null), (this.useWorker = void 0), (this.workerContext = null), (this.onwmsg = void 0), (this.transmuxer = null), (this.onTransmuxComplete = void 0), (this.onFlush = void 0); const r = t.config; (this.hls = t), (this.id = e), (this.useWorker = !!r.enableWorker), (this.onTransmuxComplete = n), (this.onFlush = i); const a = (t, e) => { ((e = e || {}).frag = this.frag), (e.id = this.id), t === tt.ERROR && (this.error = e.error), this.hls.trigger(t, e); }; (this.observer = new ca()), this.observer.on(tt.FRAG_DECRYPTED, a), this.observer.on(tt.ERROR, a); const s = Be(r.preferManagedMediaSource) || { isTypeSupported: () => !1 }, o = { mpeg: s.isTypeSupported("audio/mpeg"), mp3: s.isTypeSupported('audio/mp4; codecs="mp3"'), ac3: s.isTypeSupported('audio/mp4; codecs="ac-3"') }, l = navigator.vendor; if (this.useWorker && "undefined" != typeof Worker) { if (r.workerPath || "function" == typeof __HLS_WORKER_BUNDLE__) { try { r.workerPath ? (ot.log(`loading Web Worker ${r.workerPath} for "${e}"`), (this.workerContext = (function (t) { const e = new self.URL(t, self.location.href).href; return { worker: new self.Worker(e), scriptURL: e }; })(r.workerPath))) : (ot.log(`injecting Web Worker for "${e}"`), (this.workerContext = (function () { const t = new self.Blob( [ `var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);` ], { type: "text/javascript" } ), e = self.URL.createObjectURL(t); return { worker: new self.Worker(e), objectURL: e }; })())), (this.onwmsg = t => this.onWorkerMessage(t)); const { worker: t } = this.workerContext; t.addEventListener("message", this.onwmsg), (t.onerror = t => { const n = new Error(`${t.message} (${t.filename}:${t.lineno})`); (r.enableWorker = !1), ot.warn(`Error in "${e}" Web Worker, fallback to inline`), this.hls.trigger(tt.ERROR, { type: et.OTHER_ERROR, details: nt.INTERNAL_EXCEPTION, fatal: !1, event: "demuxerWorker", error: n }); }), t.postMessage({ cmd: "init", typeSupported: o, vendor: l, id: e, config: JSON.stringify(r) }); } catch (t) { ot.warn(`Error setting up "${e}" Web Worker, fallback to inline`, t), this.resetWorker(), (this.error = null), (this.transmuxer = new ra(this.observer, o, r, l, e)); } return; } } this.transmuxer = new ra(this.observer, o, r, l, e); } resetWorker() { if (this.workerContext) { const { worker: t, objectURL: e } = this.workerContext; e && self.URL.revokeObjectURL(e), t.removeEventListener("message", this.onwmsg), (t.onerror = null), t.terminate(), (this.workerContext = null); } } destroy() { if (this.workerContext) this.resetWorker(), (this.onwmsg = void 0); else { const t = this.transmuxer; t && (t.destroy(), (this.transmuxer = null)); } const t = this.observer; t && t.removeAllListeners(), (this.frag = null), (this.observer = null), (this.hls = null); } push(t, e, n, i, r, a, s, o, l, d) { var c, u; l.transmuxing.start = self.performance.now(); const { transmuxer: h } = this, p = a ? a.start : r.start, f = r.decryptdata, m = this.frag, g = !(m && r.cc === m.cc), y = !(m && l.level === m.level), A = m ? l.sn - m.sn : -1, v = this.part ? l.part - this.part.index : -1, b = 0 === A && l.id > 1 && l.id === (null == m ? void 0 : m.stats.chunkCount), E = !y && (1 === A || (0 === A && (1 === v || (b && v <= 0)))), w = self.performance.now(); (y || A || 0 === r.stats.parsing.start) && (r.stats.parsing.start = w), !a || (!v && E) || (a.stats.parsing.start = w); const x = !(m && (null == (c = r.initSegment) ? void 0 : c.url) === (null == (u = m.initSegment) ? void 0 : u.url)), S = new la(g, E, o, y, p, x); if (!E || g || x) { ot.log( `[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${E}\n accurateTimeOffset: ${o}\n timeOffset: ${p}\n initSegmentChange: ${x}` ); const t = new oa(n, i, e, s, d); this.configureTransmuxer(t); } if (((this.frag = r), (this.part = a), this.workerContext)) this.workerContext.worker.postMessage( { cmd: "demux", data: t, decryptdata: f, chunkMeta: l, state: S }, t instanceof ArrayBuffer ? [t] : [] ); else if (h) { const e = h.push(t, f, l, S); sa(e) ? ((h.async = !0), e .then(t => { this.handleTransmuxComplete(t); }) .catch(t => { this.transmuxerError(t, l, "transmuxer-interface push error"); })) : ((h.async = !1), this.handleTransmuxComplete(e)); } } flush(t) { t.transmuxing.start = self.performance.now(); const { transmuxer: e } = this; if (this.workerContext) this.workerContext.worker.postMessage({ cmd: "flush", chunkMeta: t }); else if (e) { let n = e.flush(t); sa(n) || e.async ? (sa(n) || (n = Promise.resolve(n)), n .then(e => { this.handleFlushResult(e, t); }) .catch(e => { this.transmuxerError(e, t, "transmuxer-interface flush error"); })) : this.handleFlushResult(n, t); } } transmuxerError(t, e, n) { this.hls && ((this.error = t), this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_PARSING_ERROR, chunkMeta: e, fatal: !1, error: t, err: t, reason: n })); } handleFlushResult(t, e) { t.forEach(t => { this.handleTransmuxComplete(t); }), this.onFlush(e); } onWorkerMessage(t) { const e = t.data, n = this.hls; switch (e.event) { case "init": { var i; const t = null == (i = this.workerContext) ? void 0 : i.objectURL; t && self.URL.revokeObjectURL(t); break; } case "transmuxComplete": this.handleTransmuxComplete(e.data); break; case "flush": this.onFlush(e.data); break; case "workerLog": ot[e.data.logType] && ot[e.data.logType](e.data.message); break; default: (e.data = e.data || {}), (e.data.frag = this.frag), (e.data.id = this.id), n.trigger(e.event, e.data); } } configureTransmuxer(t) { const { transmuxer: e } = this; this.workerContext ? this.workerContext.worker.postMessage({ cmd: "configure", config: t }) : e && e.configure(t); } handleTransmuxComplete(t) { (t.chunkMeta.transmuxing.end = self.performance.now()), this.onTransmuxComplete(t); } } function ha(t, e) { if (t.length !== e.length) return !1; for (let n = 0; n < t.length; n++) if (!pa(t[n].attrs, e[n].attrs)) return !1; return !0; } function pa(t, e, n) { const i = t["STABLE-RENDITION-ID"]; return i && !n ? i === e["STABLE-RENDITION-ID"] : !(n || ["LANGUAGE", "NAME", "CHARACTERISTICS", "AUTOSELECT", "DEFAULT", "FORCED", "ASSOC-LANGUAGE"]).some( n => t[n] !== e[n] ); } function fa(t, e) { return ( e.label.toLowerCase() === t.name.toLowerCase() && (!e.language || e.language.toLowerCase() === (t.lang || "").toLowerCase()) ); } class ma { constructor(t) { this.buffered = void 0; const e = (e, n, i) => { if ((n >>>= 0) > i - 1) throw new DOMException( `Failed to execute '${e}' on 'TimeRanges': The index provided (${n}) is greater than the maximum bound (${i})` ); return t[n][e]; }; this.buffered = { get length() { return t.length; }, end: n => e("end", n, t.length), start: n => e("start", n, t.length) }; } } class ga { constructor(t) { (this.buffers = void 0), (this.queues = { video: [], audio: [], audiovideo: [] }), (this.buffers = t); } append(t, e, n) { const i = this.queues[e]; i.push(t), 1 !== i.length || n || this.executeNext(e); } insertAbort(t, e) { this.queues[e].unshift(t), this.executeNext(e); } appendBlocker(t) { let e; const n = new Promise(t => { e = t; }), i = { execute: e, onStart: () => { }, onComplete: () => { }, onError: () => { } }; return this.append(i, t), n; } executeNext(t) { const e = this.queues[t]; if (e.length) { const n = e[0]; try { n.execute(); } catch (e) { ot.warn(`[buffer-operation-queue]: Exception executing "${t}" SourceBuffer operation: ${e}`), n.onError(e); const i = this.buffers[t]; (null != i && i.updating) || this.shiftAndExecuteNext(t); } } } shiftAndExecuteNext(t) { this.queues[t].shift(), this.executeNext(t); } current(t) { return this.queues[t][0]; } } const ya = /(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/; function Aa(t) { const e = t.querySelectorAll("source"); [].slice.call(e).forEach(e => { t.removeChild(e); }); } const va = { 42: 225, 92: 233, 94: 237, 95: 243, 96: 250, 123: 231, 124: 247, 125: 209, 126: 241, 127: 9608, 128: 174, 129: 176, 130: 189, 131: 191, 132: 8482, 133: 162, 134: 163, 135: 9834, 136: 224, 137: 32, 138: 232, 139: 226, 140: 234, 141: 238, 142: 244, 143: 251, 144: 193, 145: 201, 146: 211, 147: 218, 148: 220, 149: 252, 150: 8216, 151: 161, 152: 42, 153: 8217, 154: 9473, 155: 169, 156: 8480, 157: 8226, 158: 8220, 159: 8221, 160: 192, 161: 194, 162: 199, 163: 200, 164: 202, 165: 203, 166: 235, 167: 206, 168: 207, 169: 239, 170: 212, 171: 217, 172: 249, 173: 219, 174: 171, 175: 187, 176: 195, 177: 227, 178: 205, 179: 204, 180: 236, 181: 210, 182: 242, 183: 213, 184: 245, 185: 123, 186: 125, 187: 92, 188: 94, 189: 95, 190: 124, 191: 8764, 192: 196, 193: 228, 194: 214, 195: 246, 196: 223, 197: 165, 198: 164, 199: 9475, 200: 197, 201: 229, 202: 216, 203: 248, 204: 9487, 205: 9491, 206: 9495, 207: 9499 }, ba = function (t) { let e = t; return va.hasOwnProperty(t) && (e = va[t]), String.fromCharCode(e); }, Ea = 15, wa = 100, xa = { 17: 1, 18: 3, 21: 5, 22: 7, 23: 9, 16: 11, 19: 12, 20: 14 }, Sa = { 17: 2, 18: 4, 21: 6, 22: 8, 23: 10, 19: 13, 20: 15 }, _a = { 25: 1, 26: 3, 29: 5, 30: 7, 31: 9, 24: 11, 27: 12, 28: 14 }, Ta = { 25: 2, 26: 4, 29: 6, 30: 8, 31: 10, 27: 13, 28: 15 }, ka = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "black", "transparent"]; class Ca { constructor() { (this.time = null), (this.verboseLevel = 0); } log(t, e) { if (this.verboseLevel >= t) { const n = "function" == typeof e ? e() : e; ot.log(`${this.time} [${t}] ${n}`); } } } const La = function (t) { const e = []; for (let n = 0; n < t.length; n++) e.push(t[n].toString(16)); return e; }; class Ia { constructor() { (this.foreground = "white"), (this.underline = !1), (this.italics = !1), (this.background = "black"), (this.flash = !1); } reset() { (this.foreground = "white"), (this.underline = !1), (this.italics = !1), (this.background = "black"), (this.flash = !1); } setStyles(t) { const e = ["foreground", "underline", "italics", "background", "flash"]; for (let n = 0; n < e.length; n++) { const i = e[n]; t.hasOwnProperty(i) && (this[i] = t[i]); } } isDefault() { return "white" === this.foreground && !this.underline && !this.italics && "black" === this.background && !this.flash; } equals(t) { return ( this.foreground === t.foreground && this.underline === t.underline && this.italics === t.italics && this.background === t.background && this.flash === t.flash ); } copy(t) { (this.foreground = t.foreground), (this.underline = t.underline), (this.italics = t.italics), (this.background = t.background), (this.flash = t.flash); } toString() { return ( "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this.italics + ", background=" + this.background + ", flash=" + this.flash ); } } class Ra { constructor() { (this.uchar = " "), (this.penState = new Ia()); } reset() { (this.uchar = " "), this.penState.reset(); } setChar(t, e) { (this.uchar = t), this.penState.copy(e); } setPenState(t) { this.penState.copy(t); } equals(t) { return this.uchar === t.uchar && this.penState.equals(t.penState); } copy(t) { (this.uchar = t.uchar), this.penState.copy(t.penState); } isEmpty() { return " " === this.uchar && this.penState.isDefault(); } } class Da { constructor(t) { (this.chars = []), (this.pos = 0), (this.currPenState = new Ia()), (this.cueStartTime = null), (this.logger = void 0); for (let t = 0; t < wa; t++) this.chars.push(new Ra()); this.logger = t; } equals(t) { for (let e = 0; e < wa; e++) if (!this.chars[e].equals(t.chars[e])) return !1; return !0; } copy(t) { for (let e = 0; e < wa; e++) this.chars[e].copy(t.chars[e]); } isEmpty() { let t = !0; for (let e = 0; e < wa; e++) if (!this.chars[e].isEmpty()) { t = !1; break; } return t; } setCursor(t) { this.pos !== t && (this.pos = t), this.pos < 0 ? (this.logger.log(3, "Negative cursor position " + this.pos), (this.pos = 0)) : this.pos > wa && (this.logger.log(3, "Too large cursor position " + this.pos), (this.pos = wa)); } moveCursor(t) { const e = this.pos + t; if (t > 1) for (let t = this.pos + 1; t < e + 1; t++) this.chars[t].setPenState(this.currPenState); this.setCursor(e); } backSpace() { this.moveCursor(-1), this.chars[this.pos].setChar(" ", this.currPenState); } insertChar(t) { t >= 144 && this.backSpace(); const e = ba(t); this.pos >= wa ? this.logger.log( 0, () => "Cannot insert " + t.toString(16) + " (" + e + ") at position " + this.pos + ". Skipping it!" ) : (this.chars[this.pos].setChar(e, this.currPenState), this.moveCursor(1)); } clearFromPos(t) { let e; for (e = t; e < wa; e++) this.chars[e].reset(); } clear() { this.clearFromPos(0), (this.pos = 0), this.currPenState.reset(); } clearToEndOfRow() { this.clearFromPos(this.pos); } getTextString() { const t = []; let e = !0; for (let n = 0; n < wa; n++) { const i = this.chars[n].uchar; " " !== i && (e = !1), t.push(i); } return e ? "" : t.join(""); } setPenStyles(t) { this.currPenState.setStyles(t); this.chars[this.pos].setPenState(this.currPenState); } } class Ba { constructor(t) { (this.rows = []), (this.currRow = 14), (this.nrRollUpRows = null), (this.lastOutputScreen = null), (this.logger = void 0); for (let e = 0; e < Ea; e++) this.rows.push(new Da(t)); this.logger = t; } reset() { for (let t = 0; t < Ea; t++) this.rows[t].clear(); this.currRow = 14; } equals(t) { let e = !0; for (let n = 0; n < Ea; n++) if (!this.rows[n].equals(t.rows[n])) { e = !1; break; } return e; } copy(t) { for (let e = 0; e < Ea; e++) this.rows[e].copy(t.rows[e]); } isEmpty() { let t = !0; for (let e = 0; e < Ea; e++) if (!this.rows[e].isEmpty()) { t = !1; break; } return t; } backSpace() { this.rows[this.currRow].backSpace(); } clearToEndOfRow() { this.rows[this.currRow].clearToEndOfRow(); } insertChar(t) { this.rows[this.currRow].insertChar(t); } setPen(t) { this.rows[this.currRow].setPenStyles(t); } moveCursor(t) { this.rows[this.currRow].moveCursor(t); } setCursor(t) { this.logger.log(2, "setCursor: " + t); this.rows[this.currRow].setCursor(t); } setPAC(t) { this.logger.log(2, () => "pacData = " + JSON.stringify(t)); let e = t.row - 1; if ( (this.nrRollUpRows && e < this.nrRollUpRows - 1 && (e = this.nrRollUpRows - 1), this.nrRollUpRows && this.currRow !== e) ) { for (let t = 0; t < Ea; t++) this.rows[t].clear(); const t = this.currRow + 1 - this.nrRollUpRows, n = this.lastOutputScreen; if (n) { const i = n.rows[t].cueStartTime, r = this.logger.time; if (null !== i && null !== r && i < r) for (let i = 0; i < this.nrRollUpRows; i++) this.rows[e - this.nrRollUpRows + i + 1].copy(n.rows[t + i]); } } this.currRow = e; const n = this.rows[this.currRow]; if (null !== t.indent) { const e = t.indent, i = Math.max(e - 1, 0); n.setCursor(t.indent), (t.color = n.chars[i].penState.foreground); } const i = { foreground: t.color, underline: t.underline, italics: t.italics, background: "black", flash: !1 }; this.setPen(i); } setBkgData(t) { this.logger.log(2, () => "bkgData = " + JSON.stringify(t)), this.backSpace(), this.setPen(t), this.insertChar(32); } setRollUpRows(t) { this.nrRollUpRows = t; } rollUp() { if (null === this.nrRollUpRows) return void this.logger.log(3, "roll_up but nrRollUpRows not set yet"); this.logger.log(1, () => this.getDisplayText()); const t = this.currRow + 1 - this.nrRollUpRows, e = this.rows.splice(t, 1)[0]; e.clear(), this.rows.splice(this.currRow, 0, e), this.logger.log(2, "Rolling up"); } getDisplayText(t) { t = t || !1; const e = []; let n = "", i = -1; for (let n = 0; n < Ea; n++) { const r = this.rows[n].getTextString(); r && ((i = n + 1), t ? e.push("Row " + i + ": '" + r + "'") : e.push(r.trim())); } return e.length > 0 && (n = t ? "[" + e.join(" | ") + "]" : e.join("\n")), n; } getTextAndFormat() { return this.rows; } } class Pa { constructor(t, e, n) { (this.chNr = void 0), (this.outputFilter = void 0), (this.mode = void 0), (this.verbose = void 0), (this.displayedMemory = void 0), (this.nonDisplayedMemory = void 0), (this.lastOutputScreen = void 0), (this.currRollUpRow = void 0), (this.writeScreen = void 0), (this.cueStartTime = void 0), (this.logger = void 0), (this.chNr = t), (this.outputFilter = e), (this.mode = null), (this.verbose = 0), (this.displayedMemory = new Ba(n)), (this.nonDisplayedMemory = new Ba(n)), (this.lastOutputScreen = new Ba(n)), (this.currRollUpRow = this.displayedMemory.rows[14]), (this.writeScreen = this.displayedMemory), (this.mode = null), (this.cueStartTime = null), (this.logger = n); } reset() { (this.mode = null), this.displayedMemory.reset(), this.nonDisplayedMemory.reset(), this.lastOutputScreen.reset(), this.outputFilter.reset(), (this.currRollUpRow = this.displayedMemory.rows[14]), (this.writeScreen = this.displayedMemory), (this.mode = null), (this.cueStartTime = null); } getHandler() { return this.outputFilter; } setHandler(t) { this.outputFilter = t; } setPAC(t) { this.writeScreen.setPAC(t); } setBkgData(t) { this.writeScreen.setBkgData(t); } setMode(t) { t !== this.mode && ((this.mode = t), this.logger.log(2, () => "MODE=" + t), "MODE_POP-ON" === this.mode ? (this.writeScreen = this.nonDisplayedMemory) : ((this.writeScreen = this.displayedMemory), this.writeScreen.reset()), "MODE_ROLL-UP" !== this.mode && ((this.displayedMemory.nrRollUpRows = null), (this.nonDisplayedMemory.nrRollUpRows = null)), (this.mode = t)); } insertChars(t) { for (let e = 0; e < t.length; e++) this.writeScreen.insertChar(t[e]); const e = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP"; this.logger.log(2, () => e + ": " + this.writeScreen.getDisplayText(!0)), ("MODE_PAINT-ON" !== this.mode && "MODE_ROLL-UP" !== this.mode) || (this.logger.log(1, () => "DISPLAYED: " + this.displayedMemory.getDisplayText(!0)), this.outputDataUpdate()); } ccRCL() { this.logger.log(2, "RCL - Resume Caption Loading"), this.setMode("MODE_POP-ON"); } ccBS() { this.logger.log(2, "BS - BackSpace"), "MODE_TEXT" !== this.mode && (this.writeScreen.backSpace(), this.writeScreen === this.displayedMemory && this.outputDataUpdate()); } ccAOF() { } ccAON() { } ccDER() { this.logger.log(2, "DER- Delete to End of Row"), this.writeScreen.clearToEndOfRow(), this.outputDataUpdate(); } ccRU(t) { this.logger.log(2, "RU(" + t + ") - Roll Up"), (this.writeScreen = this.displayedMemory), this.setMode("MODE_ROLL-UP"), this.writeScreen.setRollUpRows(t); } ccFON() { this.logger.log(2, "FON - Flash On"), this.writeScreen.setPen({ flash: !0 }); } ccRDC() { this.logger.log(2, "RDC - Resume Direct Captioning"), this.setMode("MODE_PAINT-ON"); } ccTR() { this.logger.log(2, "TR"), this.setMode("MODE_TEXT"); } ccRTD() { this.logger.log(2, "RTD"), this.setMode("MODE_TEXT"); } ccEDM() { this.logger.log(2, "EDM - Erase Displayed Memory"), this.displayedMemory.reset(), this.outputDataUpdate(!0); } ccCR() { this.logger.log(2, "CR - Carriage Return"), this.writeScreen.rollUp(), this.outputDataUpdate(!0); } ccENM() { this.logger.log(2, "ENM - Erase Non-displayed Memory"), this.nonDisplayedMemory.reset(); } ccEOC() { if ((this.logger.log(2, "EOC - End Of Caption"), "MODE_POP-ON" === this.mode)) { const t = this.displayedMemory; (this.displayedMemory = this.nonDisplayedMemory), (this.nonDisplayedMemory = t), (this.writeScreen = this.nonDisplayedMemory), this.logger.log(1, () => "DISP: " + this.displayedMemory.getDisplayText()); } this.outputDataUpdate(!0); } ccTO(t) { this.logger.log(2, "TO(" + t + ") - Tab Offset"), this.writeScreen.moveCursor(t); } ccMIDROW(t) { const e = { flash: !1 }; if (((e.underline = t % 2 == 1), (e.italics = t >= 46), e.italics)) e.foreground = "white"; else { const n = Math.floor(t / 2) - 16, i = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"]; e.foreground = i[n]; } this.logger.log(2, "MIDROW: " + JSON.stringify(e)), this.writeScreen.setPen(e); } outputDataUpdate(t = !1) { const e = this.logger.time; null !== e && this.outputFilter && (null !== this.cueStartTime || this.displayedMemory.isEmpty() ? this.displayedMemory.equals(this.lastOutputScreen) || (this.outputFilter.newCue(this.cueStartTime, e, this.lastOutputScreen), t && this.outputFilter.dispatchCue && this.outputFilter.dispatchCue(), (this.cueStartTime = this.displayedMemory.isEmpty() ? null : e)) : (this.cueStartTime = e), this.lastOutputScreen.copy(this.displayedMemory)); } cueSplitAtTime(t) { this.outputFilter && (this.displayedMemory.isEmpty() || (this.outputFilter.newCue && this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory), (this.cueStartTime = t))); } } class Ua { constructor(t, e, n) { (this.channels = void 0), (this.currentChannel = 0), (this.cmdHistory = { a: null, b: null }), (this.logger = void 0); const i = (this.logger = new Ca()); this.channels = [null, new Pa(t, e, i), new Pa(t + 1, n, i)]; } getHandler(t) { return this.channels[t].getHandler(); } setHandler(t, e) { this.channels[t].setHandler(e); } addData(t, e) { let n, i, r, a = !1; this.logger.time = t; for (let t = 0; t < e.length; t += 2) if (((i = 127 & e[t]), (r = 127 & e[t + 1]), 0 !== i || 0 !== r)) { if ( (this.logger.log(3, "[" + La([e[t], e[t + 1]]) + "] -> (" + La([i, r]) + ")"), (n = this.parseCmd(i, r)), n || (n = this.parseMidrow(i, r)), n || (n = this.parsePAC(i, r)), n || (n = this.parseBackgroundAttributes(i, r)), !n && ((a = this.parseChars(i, r)), a)) ) { const t = this.currentChannel; if (t && t > 0) { this.channels[t].insertChars(a); } else this.logger.log(2, "No channel found yet. TEXT-MODE?"); } n || a || this.logger.log(2, "Couldn't parse cleaned data " + La([i, r]) + " orig: " + La([e[t], e[t + 1]])); } } parseCmd(t, e) { const { cmdHistory: n } = this; if ( !((20 === t || 28 === t || 21 === t || 29 === t) && e >= 32 && e <= 47) && !((23 === t || 31 === t) && e >= 33 && e <= 35) ) return !1; if (Oa(t, e, n)) return Fa(null, null, n), this.logger.log(3, "Repeated command (" + La([t, e]) + ") is dropped"), !0; const i = 20 === t || 21 === t || 23 === t ? 1 : 2, r = this.channels[i]; return ( 20 === t || 21 === t || 28 === t || 29 === t ? 32 === e ? r.ccRCL() : 33 === e ? r.ccBS() : 34 === e ? r.ccAOF() : 35 === e ? r.ccAON() : 36 === e ? r.ccDER() : 37 === e ? r.ccRU(2) : 38 === e ? r.ccRU(3) : 39 === e ? r.ccRU(4) : 40 === e ? r.ccFON() : 41 === e ? r.ccRDC() : 42 === e ? r.ccTR() : 43 === e ? r.ccRTD() : 44 === e ? r.ccEDM() : 45 === e ? r.ccCR() : 46 === e ? r.ccENM() : 47 === e && r.ccEOC() : r.ccTO(e - 32), Fa(t, e, n), (this.currentChannel = i), !0 ); } parseMidrow(t, e) { let n = 0; if ((17 === t || 25 === t) && e >= 32 && e <= 47) { if (((n = 17 === t ? 1 : 2), n !== this.currentChannel)) return this.logger.log(0, "Mismatch channel in midrow parsing"), !1; const i = this.channels[n]; return !!i && (i.ccMIDROW(e), this.logger.log(3, "MIDROW (" + La([t, e]) + ")"), !0); } return !1; } parsePAC(t, e) { let n; const i = this.cmdHistory; if ( !(((t >= 17 && t <= 23) || (t >= 25 && t <= 31)) && e >= 64 && e <= 127) && !((16 === t || 24 === t) && e >= 64 && e <= 95) ) return !1; if (Oa(t, e, i)) return Fa(null, null, i), !0; const r = t <= 23 ? 1 : 2; n = e >= 64 && e <= 95 ? (1 === r ? xa[t] : _a[t]) : 1 === r ? Sa[t] : Ta[t]; const a = this.channels[r]; return !!a && (a.setPAC(this.interpretPAC(n, e)), Fa(t, e, i), (this.currentChannel = r), !0); } interpretPAC(t, e) { let n; const i = { color: null, italics: !1, indent: null, underline: !1, row: t }; return ( (n = e > 95 ? e - 96 : e - 64), (i.underline = !(1 & ~n)), n <= 13 ? (i.color = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "white"][Math.floor(n / 2)]) : n <= 15 ? ((i.italics = !0), (i.color = "white")) : (i.indent = 4 * Math.floor((n - 16) / 2)), i ); } parseChars(t, e) { let n, i = null, r = null; if ((t >= 25 ? ((n = 2), (r = t - 8)) : ((n = 1), (r = t)), r >= 17 && r <= 19)) { let t; (t = 17 === r ? e + 80 : 18 === r ? e + 112 : e + 144), this.logger.log(2, "Special char '" + ba(t) + "' in channel " + n), (i = [t]); } else t >= 32 && t <= 127 && (i = 0 === e ? [t] : [t, e]); if (i) { const n = La(i); this.logger.log(3, "Char codes = " + n.join(",")), Fa(t, e, this.cmdHistory); } return i; } parseBackgroundAttributes(t, e) { if (!((16 === t || 24 === t) && e >= 32 && e <= 47) && !((23 === t || 31 === t) && e >= 45 && e <= 47)) return !1; let n; const i = {}; 16 === t || 24 === t ? ((n = Math.floor((e - 32) / 2)), (i.background = ka[n]), e % 2 == 1 && (i.background = i.background + "_semi")) : 45 === e ? (i.background = "transparent") : ((i.foreground = "black"), 47 === e && (i.underline = !0)); const r = t <= 23 ? 1 : 2; return this.channels[r].setBkgData(i), Fa(t, e, this.cmdHistory), !0; } reset() { for (let t = 0; t < Object.keys(this.channels).length; t++) { const e = this.channels[t]; e && e.reset(); } this.cmdHistory = { a: null, b: null }; } cueSplitAtTime(t) { for (let e = 0; e < this.channels.length; e++) { const n = this.channels[e]; n && n.cueSplitAtTime(t); } } } function Fa(t, e, n) { (n.a = t), (n.b = e); } function Oa(t, e, n) { return n.a === t && n.b === e; } class Ma { constructor(t, e) { (this.timelineController = void 0), (this.cueRanges = []), (this.trackName = void 0), (this.startTime = null), (this.endTime = null), (this.screen = null), (this.timelineController = t), (this.trackName = e); } dispatchCue() { null !== this.startTime && (this.timelineController.addCues(this.trackName, this.startTime, this.endTime, this.screen, this.cueRanges), (this.startTime = null)); } newCue(t, e, n) { (null === this.startTime || this.startTime > t) && (this.startTime = t), (this.endTime = e), (this.screen = n), this.timelineController.createCaptionsTrack(this.trackName); } reset() { (this.cueRanges = []), (this.startTime = null); } } var Na = (function () { if (null != St && St.VTTCue) return self.VTTCue; const t = ["", "lr", "rl"], e = ["start", "middle", "end", "left", "right"]; function n(t, e) { if ("string" != typeof e) return !1; if (!Array.isArray(t)) return !1; const n = e.toLowerCase(); return !!~t.indexOf(n) && n; } function i(t) { return n(e, t); } function r(t, ...e) { let n = 1; for (; n < arguments.length; n++) { const e = arguments[n]; for (const n in e) t[n] = e[n]; } return t; } function a(e, a, s) { const o = this, l = { enumerable: !0 }; o.hasBeenReset = !1; let d = "", c = !1, u = e, h = a, p = s, f = null, m = "", g = !0, y = "auto", A = "start", v = 50, b = "middle", E = 50, w = "middle"; Object.defineProperty( o, "id", r({}, l, { get: function () { return d; }, set: function (t) { d = "" + t; } }) ), Object.defineProperty( o, "pauseOnExit", r({}, l, { get: function () { return c; }, set: function (t) { c = !!t; } }) ), Object.defineProperty( o, "startTime", r({}, l, { get: function () { return u; }, set: function (t) { if ("number" != typeof t) throw new TypeError("Start time must be set to a number."); (u = t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "endTime", r({}, l, { get: function () { return h; }, set: function (t) { if ("number" != typeof t) throw new TypeError("End time must be set to a number."); (h = t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "text", r({}, l, { get: function () { return p; }, set: function (t) { (p = "" + t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "region", r({}, l, { get: function () { return f; }, set: function (t) { (f = t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "vertical", r({}, l, { get: function () { return m; }, set: function (e) { const i = (function (e) { return n(t, e); })(e); if (!1 === i) throw new SyntaxError("An invalid or illegal string was specified."); (m = i), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "snapToLines", r({}, l, { get: function () { return g; }, set: function (t) { (g = !!t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "line", r({}, l, { get: function () { return y; }, set: function (t) { if ("number" != typeof t && "auto" !== t) throw new SyntaxError("An invalid number or illegal string was specified."); (y = t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "lineAlign", r({}, l, { get: function () { return A; }, set: function (t) { const e = i(t); if (!e) throw new SyntaxError("An invalid or illegal string was specified."); (A = e), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "position", r({}, l, { get: function () { return v; }, set: function (t) { if (t < 0 || t > 100) throw new Error("Position must be between 0 and 100."); (v = t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "positionAlign", r({}, l, { get: function () { return b; }, set: function (t) { const e = i(t); if (!e) throw new SyntaxError("An invalid or illegal string was specified."); (b = e), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "size", r({}, l, { get: function () { return E; }, set: function (t) { if (t < 0 || t > 100) throw new Error("Size must be between 0 and 100."); (E = t), (this.hasBeenReset = !0); } }) ), Object.defineProperty( o, "align", r({}, l, { get: function () { return w; }, set: function (t) { const e = i(t); if (!e) throw new SyntaxError("An invalid or illegal string was specified."); (w = e), (this.hasBeenReset = !0); } }) ), (o.displayState = void 0); } return ( (a.prototype.getCueAsHTML = function () { return self.WebVTT.convertCueToDOMTree(self, this.text); }), a ); })(); class za { decode(t, e) { if (!t) return ""; if ("string" != typeof t) throw new Error("Error - expected string data."); return decodeURIComponent(encodeURIComponent(t)); } } function Ga(t) { function e(t, e, n, i) { return 3600 * (0 | t) + 60 * (0 | e) + (0 | n) + parseFloat(i || 0); } const n = t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/); return n ? (parseFloat(n[2]) > 59 ? e(n[2], n[3], 0, n[4]) : e(n[1], n[2], n[3], n[4])) : null; } class ja { constructor() { this.values = Object.create(null); } set(t, e) { this.get(t) || "" === e || (this.values[t] = e); } get(t, e, n) { return n ? (this.has(t) ? this.values[t] : e[n]) : this.has(t) ? this.values[t] : e; } has(t) { return t in this.values; } alt(t, e, n) { for (let i = 0; i < n.length; ++i) if (e === n[i]) { this.set(t, e); break; } } integer(t, e) { /^-?\d+$/.test(e) && this.set(t, parseInt(e, 10)); } percent(t, e) { if (/^([\d]{1,3})(\.[\d]*)?%$/.test(e)) { const n = parseFloat(e); if (n >= 0 && n <= 100) return this.set(t, n), !0; } return !1; } } function Ha(t, e, n, i) { const r = i ? t.split(i) : [t]; for (const t in r) { if ("string" != typeof r[t]) continue; const i = r[t].split(n); if (2 !== i.length) continue; e(i[0], i[1]); } } const Ya = new Na(0, 0, ""), $a = "middle" === Ya.align ? "middle" : "center"; function Ka(t, e, n) { const i = t; function r() { const e = Ga(t); if (null === e) throw new Error("Malformed timestamp: " + i); return (t = t.replace(/^[^\sa-zA-Z-]+/, "")), e; } function a() { t = t.replace(/^\s+/, ""); } if ((a(), (e.startTime = r()), a(), "--\x3e" !== t.slice(0, 3))) throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): " + i); (t = t.slice(3)), a(), (e.endTime = r()), a(), (function (t, e) { const i = new ja(); Ha( t, function (t, e) { let r; switch (t) { case "region": for (let r = n.length - 1; r >= 0; r--) if (n[r].id === e) { i.set(t, n[r].region); break; } break; case "vertical": i.alt(t, e, ["rl", "lr"]); break; case "line": (r = e.split(",")), i.integer(t, r[0]), i.percent(t, r[0]) && i.set("snapToLines", !1), i.alt(t, r[0], ["auto"]), 2 === r.length && i.alt("lineAlign", r[1], ["start", $a, "end"]); break; case "position": (r = e.split(",")), i.percent(t, r[0]), 2 === r.length && i.alt("positionAlign", r[1], ["start", $a, "end", "line-left", "line-right", "auto"]); break; case "size": i.percent(t, e); break; case "align": i.alt(t, e, ["start", $a, "end", "left", "right"]); } }, /:/, /\s/ ), (e.region = i.get("region", null)), (e.vertical = i.get("vertical", "")); let r = i.get("line", "auto"); "auto" === r && -1 === Ya.line && (r = -1), (e.line = r), (e.lineAlign = i.get("lineAlign", "start")), (e.snapToLines = i.get("snapToLines", !0)), (e.size = i.get("size", 100)), (e.align = i.get("align", $a)); let a = i.get("position", "auto"); "auto" === a && 50 === Ya.position && (a = "start" === e.align || "left" === e.align ? 0 : "end" === e.align || "right" === e.align ? 100 : 50), (e.position = a); })(t, e); } function qa(t) { return t.replace(//gi, "\n"); } class Va { constructor() { (this.state = "INITIAL"), (this.buffer = ""), (this.decoder = new za()), (this.regionList = []), (this.cue = null), (this.oncue = void 0), (this.onparsingerror = void 0), (this.onflush = void 0); } parse(t) { const e = this; function n() { let t = e.buffer, n = 0; for (t = qa(t); n < t.length && "\r" !== t[n] && "\n" !== t[n];) ++n; const i = t.slice(0, n); return "\r" === t[n] && ++n, "\n" === t[n] && ++n, (e.buffer = t.slice(n)), i; } t && (e.buffer += e.decoder.decode(t, { stream: !0 })); try { let t = ""; if ("INITIAL" === e.state) { if (!/\r\n|\n/.test(e.buffer)) return this; t = n(); const i = t.match(/^()?WEBVTT([ \t].*)?$/); if (null == i || !i[0]) throw new Error("Malformed WebVTT signature."); e.state = "HEADER"; } let i = !1; for (; e.buffer;) { if (!/\r\n|\n/.test(e.buffer)) return this; switch ((i ? (i = !1) : (t = n()), e.state)) { case "HEADER": /:/.test(t) ? Ha(t, function (t, e) { }, /:/) : t || (e.state = "ID"); continue; case "NOTE": t || (e.state = "ID"); continue; case "ID": if (/^NOTE($|[ \t])/.test(t)) { e.state = "NOTE"; break; } if (!t) continue; if (((e.cue = new Na(0, 0, "")), (e.state = "CUE"), -1 === t.indexOf("--\x3e"))) { e.cue.id = t; continue; } case "CUE": if (!e.cue) { e.state = "BADCUE"; continue; } try { Ka(t, e.cue, e.regionList); } catch (t) { (e.cue = null), (e.state = "BADCUE"); continue; } e.state = "CUETEXT"; continue; case "CUETEXT": { const n = -1 !== t.indexOf("--\x3e"); if (!t || (n && (i = !0))) { e.oncue && e.cue && e.oncue(e.cue), (e.cue = null), (e.state = "ID"); continue; } if (null === e.cue) continue; e.cue.text && (e.cue.text += "\n"), (e.cue.text += t); } continue; case "BADCUE": t || (e.state = "ID"); } } } catch (t) { "CUETEXT" === e.state && e.cue && e.oncue && e.oncue(e.cue), (e.cue = null), (e.state = "INITIAL" === e.state ? "BADWEBVTT" : "BADCUE"); } return this; } flush() { const t = this; try { if ( ((t.cue || "HEADER" === t.state) && ((t.buffer += "\n\n"), t.parse()), "INITIAL" === t.state || "BADWEBVTT" === t.state) ) throw new Error("Malformed WebVTT signature."); } catch (e) { t.onparsingerror && t.onparsingerror(e); } return t.onflush && t.onflush(), this; } } const Wa = /\r\n|\n\r|\n|\r/g, Qa = function (t, e, n = 0) { return t.slice(n, n + e.length) === e; }, Xa = function (t) { let e = 5381, n = t.length; for (; n;) e = (33 * e) ^ t.charCodeAt(--n); return (e >>> 0).toString(); }; function Ja(t, e, n) { return Xa(t.toString()) + Xa(e.toString()) + Xa(n); } function Za(t, e, n, i, r, a, s) { const o = new Va(), l = Xt(new Uint8Array(t)).trim().replace(Wa, "\n").split("\n"), d = [], c = e ? (function (t, e = 1) { return Kr(t, $r, 1 / e); })(e.baseTime, e.timescale) : 0; let u, h = "00:00.000", p = 0, f = 0, m = !0; (o.oncue = function (t) { const a = n[i]; let s = n.ccOffset; const o = (p - c) / 9e4; if ( (null != a && a.new && (void 0 !== f ? (s = n.ccOffset = a.start) : (function (t, e, n) { let i = t[e], r = t[i.prevCC]; if (!r || (!r.new && i.new)) return (t.ccOffset = t.presentationOffset = i.start), void (i.new = !1); for (; null != (a = r) && a.new;) { var a; (t.ccOffset += i.start - r.start), (i.new = !1), (i = r), (r = t[i.prevCC]); } t.presentationOffset = n; })(n, i, o)), o) ) { if (!e) return void (u = new Error("Missing initPTS for VTT MPEGTS")); s = o - n.presentationOffset; } const l = t.endTime - t.startTime, h = Jr(9e4 * (t.startTime + s - f), 9e4 * r) / 9e4; (t.startTime = Math.max(h, 0)), (t.endTime = Math.max(h + l, 0)); const m = t.text.trim(); (t.text = decodeURIComponent(encodeURIComponent(m))), t.id || (t.id = Ja(t.startTime, t.endTime, m)), t.endTime > 0 && d.push(t); }), (o.onparsingerror = function (t) { u = t; }), (o.onflush = function () { u ? s(u) : a(d); }), l.forEach(t => { if (m) { if (Qa(t, "X-TIMESTAMP-MAP=")) { (m = !1), t .slice(16) .split(",") .forEach(t => { Qa(t, "LOCAL:") ? (h = t.slice(6)) : Qa(t, "MPEGTS:") && (p = parseInt(t.slice(7))); }); try { f = (function (t) { let e = parseInt(t.slice(-3)); const n = parseInt(t.slice(-6, -4)), i = parseInt(t.slice(-9, -7)), r = t.length > 9 ? parseInt(t.substring(0, t.indexOf(":"))) : 0; if (!(X(e) && X(n) && X(i) && X(r))) throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`); return (e += 1e3 * n), (e += 6e4 * i), (e += 36e5 * r), e; })(h) / 1e3; } catch (t) { u = t; } return; } "" === t && (m = !1); } o.parse(t + "\n"); }), o.flush(); } const ts = "stpp.ttml.im1t", es = /^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/, ns = /^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/, is = { left: "start", center: "center", right: "end", start: "start", end: "end" }; function rs(t, e, n, i) { const r = ce(new Uint8Array(t), ["mdat"]); if (0 === r.length) return void i(new Error("Could not parse IMSC1 mdat")); const a = r.map(t => Xt(t)), s = (function (t, e, n = 1, i = !1) { return Kr(t, e, 1 / n, i); })(e.baseTime, 1, e.timescale); try { a.forEach(t => n( (function (t, e) { const n = new DOMParser(), i = n.parseFromString(t, "text/xml"), r = i.getElementsByTagName("tt")[0]; if (!r) throw new Error("Invalid ttml"); const a = { frameRate: 30, subFrameRate: 1, frameRateMultiplier: 0, tickRate: 0 }, s = Object.keys(a).reduce((t, e) => ((t[e] = r.getAttribute(`ttp:${e}`) || a[e]), t), {}), o = "preserve" !== r.getAttribute("xml:space"), l = ss(as(r, "styling", "style")), d = ss(as(r, "layout", "region")), c = as(r, "body", "[begin]"); return [].map .call(c, t => { const n = os(t, o); if (!n || !t.hasAttribute("begin")) return null; const i = cs(t.getAttribute("begin"), s), r = cs(t.getAttribute("dur"), s); let a = cs(t.getAttribute("end"), s); if (null === i) throw ds(t); if (null === a) { if (null === r) throw ds(t); a = i + r; } const c = new Na(i - e, a - e, n); c.id = Ja(c.startTime, c.endTime, c.text); const u = (function (t, e, n) { const i = "http://www.w3.org/ns/ttml#styling"; let r = null; const a = [ "displayAlign", "textAlign", "color", "backgroundColor", "fontSize", "fontFamily" ], s = null != t && t.hasAttribute("style") ? t.getAttribute("style") : null; s && n.hasOwnProperty(s) && (r = n[s]); return a.reduce((n, a) => { const s = ls(e, i, a) || ls(t, i, a) || ls(r, i, a); return s && (n[a] = s), n; }, {}); })(d[t.getAttribute("region")], l[t.getAttribute("style")], l), { textAlign: h } = u; if (h) { const t = is[h]; t && (c.lineAlign = t), (c.align = h); } return Q(c, u), c; }) .filter(t => null !== t); })(t, s) ) ); } catch (t) { i(t); } } function as(t, e, n) { const i = t.getElementsByTagName(e)[0]; return i ? [].slice.call(i.querySelectorAll(n)) : []; } function ss(t) { return t.reduce((t, e) => { const n = e.getAttribute("xml:id"); return n && (t[n] = e), t; }, {}); } function os(t, e) { return [].slice.call(t.childNodes).reduce((t, n, i) => { var r; return "br" === n.nodeName && i ? t + "\n" : null != (r = n.childNodes) && r.length ? os(n, e) : e ? t + n.textContent.trim().replace(/\s+/g, " ") : t + n.textContent; }, ""); } function ls(t, e, n) { return t && t.hasAttributeNS(e, n) ? t.getAttributeNS(e, n) : null; } function ds(t) { return new Error(`Could not parse ttml timestamp ${t}`); } function cs(t, e) { if (!t) return null; let n = Ga(t); return ( null === n && (es.test(t) ? (n = (function (t, e) { const n = es.exec(t), i = (0 | n[4]) + (0 | n[5]) / e.subFrameRate; return 3600 * (0 | n[1]) + 60 * (0 | n[2]) + (0 | n[3]) + i / e.frameRate; })(t, e)) : ns.test(t) && (n = (function (t, e) { const n = ns.exec(t), i = Number(n[1]); switch (n[2]) { case "h": return 3600 * i; case "m": return 60 * i; case "ms": return 1e3 * i; case "f": return i / e.frameRate; case "t": return i / e.tickRate; } return i; })(t, e))), n ); } function us(t) { return t.characteristics && /transcribes-spoken-dialog/gi.test(t.characteristics) && /describes-music-and-sound/gi.test(t.characteristics) ? "captions" : "subtitles"; } function hs(t, e) { return !!t && t.kind === us(e) && fa(e, t); } class ps { constructor(t) { (this.hls = void 0), (this.autoLevelCapping = void 0), (this.firstLevel = void 0), (this.media = void 0), (this.restrictedLevels = void 0), (this.timer = void 0), (this.clientRect = void 0), (this.streamController = void 0), (this.hls = t), (this.autoLevelCapping = Number.POSITIVE_INFINITY), (this.firstLevel = -1), (this.media = null), (this.restrictedLevels = []), (this.timer = void 0), (this.clientRect = null), this.registerListeners(); } setStreamController(t) { this.streamController = t; } destroy() { this.hls && this.unregisterListener(), this.timer && this.stopCapping(), (this.media = null), (this.clientRect = null), (this.hls = this.streamController = null); } registerListeners() { const { hls: t } = this; t.on(tt.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), t.on(tt.MEDIA_ATTACHING, this.onMediaAttaching, this), t.on(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.on(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(tt.BUFFER_CODECS, this.onBufferCodecs, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this); } unregisterListener() { const { hls: t } = this; t.off(tt.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), t.off(tt.MEDIA_ATTACHING, this.onMediaAttaching, this), t.off(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.off(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(tt.BUFFER_CODECS, this.onBufferCodecs, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this); } onFpsDropLevelCapping(t, e) { const n = this.hls.levels[e.droppedLevel]; this.isLevelAllowed(n) && this.restrictedLevels.push({ bitrate: n.bitrate, height: n.height, width: n.width }); } onMediaAttaching(t, e) { (this.media = e.media instanceof HTMLVideoElement ? e.media : null), (this.clientRect = null), this.timer && this.hls.levels.length && this.detectPlayerSize(); } onManifestParsed(t, e) { const n = this.hls; (this.restrictedLevels = []), (this.firstLevel = e.firstLevel), n.config.capLevelToPlayerSize && e.video && this.startCapping(); } onLevelsUpdated(t, e) { this.timer && X(this.autoLevelCapping) && this.detectPlayerSize(); } onBufferCodecs(t, e) { this.hls.config.capLevelToPlayerSize && e.video && this.startCapping(); } onMediaDetaching() { this.stopCapping(); } detectPlayerSize() { if (this.media) { if (this.mediaHeight <= 0 || this.mediaWidth <= 0) return void (this.clientRect = null); const t = this.hls.levels; if (t.length) { const e = this.hls, n = this.getMaxLevel(t.length - 1); n !== this.autoLevelCapping && ot.log( `Setting autoLevelCapping to ${n}: ${t[n].height}p@${t[n].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}` ), (e.autoLevelCapping = n), e.autoLevelCapping > this.autoLevelCapping && this.streamController && this.streamController.nextLevelSwitch(), (this.autoLevelCapping = e.autoLevelCapping); } } } getMaxLevel(t) { const e = this.hls.levels; if (!e.length) return -1; const n = e.filter((e, n) => this.isLevelAllowed(e) && n <= t); return (this.clientRect = null), ps.getMaxLevelByMediaSize(n, this.mediaWidth, this.mediaHeight); } startCapping() { this.timer || ((this.autoLevelCapping = Number.POSITIVE_INFINITY), self.clearInterval(this.timer), (this.timer = self.setInterval(this.detectPlayerSize.bind(this), 1e3)), this.detectPlayerSize()); } stopCapping() { (this.restrictedLevels = []), (this.firstLevel = -1), (this.autoLevelCapping = Number.POSITIVE_INFINITY), this.timer && (self.clearInterval(this.timer), (this.timer = void 0)); } getDimensions() { if (this.clientRect) return this.clientRect; const t = this.media, e = { width: 0, height: 0 }; if (t) { const n = t.getBoundingClientRect(); (e.width = n.width), (e.height = n.height), e.width || e.height || ((e.width = n.right - n.left || t.width || 0), (e.height = n.bottom - n.top || t.height || 0)); } return (this.clientRect = e), e; } get mediaWidth() { return this.getDimensions().width * this.contentScaleFactor; } get mediaHeight() { return this.getDimensions().height * this.contentScaleFactor; } get contentScaleFactor() { let t = 1; if (!this.hls.config.ignoreDevicePixelRatio) try { t = self.devicePixelRatio; } catch (t) { } return t; } isLevelAllowed(t) { return !this.restrictedLevels.some(e => t.bitrate === e.bitrate && t.width === e.width && t.height === e.height); } static getMaxLevelByMediaSize(t, e, n) { if (null == t || !t.length) return -1; let i = t.length - 1; const r = Math.max(e, n); for (let e = 0; e < t.length; e += 1) { const n = t[e]; if ( (n.width >= r || n.height >= r) && ((a = n), !(s = t[e + 1]) || a.width !== s.width || a.height !== s.height) ) { i = e; break; } } var a, s; return i; } } const fs = "[eme]"; class ms { constructor(t) { (this.hls = void 0), (this.config = void 0), (this.media = null), (this.keyFormatPromise = null), (this.keySystemAccessPromises = {}), (this._requestLicenseFailureCount = 0), (this.mediaKeySessions = []), (this.keyIdToKeySessionPromise = {}), (this.setMediaKeysQueue = ms.CDMCleanupPromise ? [ms.CDMCleanupPromise] : []), (this.onMediaEncrypted = this._onMediaEncrypted.bind(this)), (this.onWaitingForKey = this._onWaitingForKey.bind(this)), (this.debug = ot.debug.bind(ot, fs)), (this.log = ot.log.bind(ot, fs)), (this.warn = ot.warn.bind(ot, fs)), (this.error = ot.error.bind(ot, fs)), (this.hls = t), (this.config = t.config), this.registerListeners(); } destroy() { this.unregisterListeners(), this.onMediaDetached(); const t = this.config; (t.requestMediaKeySystemAccessFunc = null), (t.licenseXhrSetup = t.licenseResponseCallback = void 0), (t.drmSystems = t.drmSystemOptions = {}), (this.hls = this.onMediaEncrypted = this.onWaitingForKey = this.keyIdToKeySessionPromise = null), (this.config = null); } registerListeners() { this.hls.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(tt.MEDIA_DETACHED, this.onMediaDetached, this), this.hls.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.on(tt.MANIFEST_LOADED, this.onManifestLoaded, this); } unregisterListeners() { this.hls.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.off(tt.MEDIA_DETACHED, this.onMediaDetached, this), this.hls.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), this.hls.off(tt.MANIFEST_LOADED, this.onManifestLoaded, this); } getLicenseServerUrl(t) { const { drmSystems: e, widevineLicenseUrl: n } = this.config, i = e[t]; if (i) return i.licenseUrl; if (t === _t.WIDEVINE && n) return n; throw new Error(`no license server URL configured for key-system "${t}"`); } getServerCertificateUrl(t) { const { drmSystems: e } = this.config, n = e[t]; if (n) return n.serverCertificateUrl; this.log(`No Server Certificate in config.drmSystems["${t}"]`); } attemptKeySystemAccess(t) { const e = this.hls.levels, n = (t, e, n) => !!t && n.indexOf(t) === e, i = e.map(t => t.audioCodec).filter(n), r = e.map(t => t.videoCodec).filter(n); return ( i.length + r.length === 0 && r.push("avc1.42e01e"), new Promise((e, n) => { const a = t => { const s = t.shift(); this.getMediaKeysPromise(s, i, r) .then(t => e({ keySystem: s, mediaKeys: t })) .catch(e => { t.length ? a(t) : n( e instanceof gs ? e : new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_NO_ACCESS, error: e, fatal: !0 }, e.message ) ); }); }; a(t); }) ); } requestMediaKeySystemAccess(t, e) { const { requestMediaKeySystemAccessFunc: n } = this.config; if ("function" != typeof n) { let t = `Configured requestMediaKeySystemAccess is not a function ${n}`; return ( null === Pt && "http:" === self.location.protocol && (t = `navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`), Promise.reject(new Error(t)) ); } return n(t, e); } getMediaKeysPromise(t, e, n) { const i = (function (t, e, n, i) { let r; switch (t) { case _t.FAIRPLAY: r = ["cenc", "sinf"]; break; case _t.WIDEVINE: case _t.PLAYREADY: r = ["cenc"]; break; case _t.CLEARKEY: r = ["cenc", "keyids"]; break; default: throw new Error(`Unknown key-system: ${t}`); } return (function (t, e, n, i) { return [ { initDataTypes: t, persistentState: i.persistentState || "optional", distinctiveIdentifier: i.distinctiveIdentifier || "optional", sessionTypes: i.sessionTypes || [i.sessionType || "temporary"], audioCapabilities: e.map(t => ({ contentType: `audio/mp4; codecs="${t}"`, robustness: i.audioRobustness || "", encryptionScheme: i.audioEncryptionScheme || null })), videoCapabilities: n.map(t => ({ contentType: `video/mp4; codecs="${t}"`, robustness: i.videoRobustness || "", encryptionScheme: i.videoEncryptionScheme || null })) } ]; })(r, e, n, i); })(t, e, n, this.config.drmSystemOptions), r = this.keySystemAccessPromises[t]; let a = null == r ? void 0 : r.keySystemAccess; if (!a) { this.log(`Requesting encrypted media "${t}" key-system access with config: ${JSON.stringify(i)}`), (a = this.requestMediaKeySystemAccess(t, i)); const e = (this.keySystemAccessPromises[t] = { keySystemAccess: a }); return ( a.catch(e => { this.log(`Failed to obtain access to key-system "${t}": ${e}`); }), a.then(n => { this.log(`Access for key-system "${n.keySystem}" obtained`); const i = this.fetchServerCertificate(t); return ( this.log(`Create media-keys for "${t}"`), (e.mediaKeys = n .createMediaKeys() .then( e => ( this.log(`Media-keys created for "${t}"`), i.then(n => (n ? this.setMediaKeysServerCertificate(e, t, n) : e)) ) )), e.mediaKeys.catch(e => { this.error(`Failed to create media-keys for "${t}"}: ${e}`); }), e.mediaKeys ); }) ); } return a.then(() => r.mediaKeys); } createMediaKeySessionContext({ decryptdata: t, keySystem: e, mediaKeys: n }) { this.log(`Creating key-system session "${e}" keyId: ${te(t.keyId || [])}`); const i = n.createSession(), r = { decryptdata: t, keySystem: e, mediaKeys: n, mediaKeysSession: i, keyStatus: "status-pending" }; return this.mediaKeySessions.push(r), r; } renewKeySession(t) { const e = t.decryptdata; if (e.pssh) { const n = this.createMediaKeySessionContext(t), i = this.getKeyIdString(e), r = "cenc"; this.keyIdToKeySessionPromise[i] = this.generateRequestWithPreferredKeySession(n, r, e.pssh, "expired"); } else this.warn("Could not renew expired session. Missing pssh initData."); this.removeSession(t); } getKeyIdString(t) { if (!t) throw new Error("Could not read keyId of undefined decryptdata"); if (null === t.keyId) throw new Error("keyId is null"); return te(t.keyId); } updateKeySession(t, e) { var n; const i = t.mediaKeysSession; return ( this.log( `Updating key-session "${i.sessionId}" for keyID ${te( (null == (n = t.decryptdata) ? void 0 : n.keyId) || [] )}\n } (data length: ${e ? e.byteLength : e})` ), i.update(e) ); } selectKeySystemFormat(t) { const e = Object.keys(t.levelkeys || {}); return ( this.keyFormatPromise || (this.log( `Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${e.join(", ")}` ), (this.keyFormatPromise = this.getKeyFormatPromise(e))), this.keyFormatPromise ); } getKeyFormatPromise(t) { return new Promise((e, n) => { const i = Bt(this.config), r = t.map(It).filter(t => !!t && -1 !== i.indexOf(t)); return this.getKeySystemSelectionPromise(r) .then(({ keySystem: t }) => { const i = Dt(t); i ? e(i) : n(new Error(`Unable to find format for key-system "${t}"`)); }) .catch(n); }); } loadKey(t) { const e = t.keyInfo.decryptdata, n = this.getKeyIdString(e), i = `(keyId: ${n} format: "${e.keyFormat}" method: ${e.method} uri: ${e.uri})`; this.log(`Starting session for key ${i}`); let r = this.keyIdToKeySessionPromise[n]; return ( r || ((r = this.keyIdToKeySessionPromise[n] = this.getKeySystemForKeyPromise(e).then( ({ keySystem: n, mediaKeys: r }) => ( this.throwIfDestroyed(), this.log( `Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${i}` ), this.attemptSetMediaKeys(n, r).then(() => { this.throwIfDestroyed(); const t = this.createMediaKeySessionContext({ keySystem: n, mediaKeys: r, decryptdata: e }); return this.generateRequestWithPreferredKeySession(t, "cenc", e.pssh, "playlist-key"); }) ) )), r.catch(t => this.handleError(t))), r ); } throwIfDestroyed(t = "Invalid state") { if (!this.hls) throw new Error("invalid state"); } handleError(t) { this.hls && (this.error(t.message), t instanceof gs ? this.hls.trigger(tt.ERROR, t.data) : this.hls.trigger(tt.ERROR, { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_NO_KEYS, error: t, fatal: !0 })); } getKeySystemForKeyPromise(t) { const e = this.getKeyIdString(t), n = this.keyIdToKeySessionPromise[e]; if (!n) { const e = It(t.keyFormat), n = e ? [e] : Bt(this.config); return this.attemptKeySystemAccess(n); } return n; } getKeySystemSelectionPromise(t) { if ((t.length || (t = Bt(this.config)), 0 === t.length)) throw new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_NO_CONFIGURED_LICENSE, fatal: !0 }, `Missing key-system license configuration options ${JSON.stringify({ drmSystems: this.config.drmSystems })}` ); return this.attemptKeySystemAccess(t); } _onMediaEncrypted(t) { const { initDataType: e, initData: n } = t; if ((this.debug(`"${t.type}" event: init data type: "${e}"`), null === n)) return; let i, r; if ("sinf" === e && this.config.drmSystems[_t.FAIRPLAY]) { const t = re(new Uint8Array(n)); try { const e = Et(JSON.parse(t).sinf), n = ye(new Uint8Array(e)); if (!n) return; (i = n.subarray(8, 24)), (r = _t.FAIRPLAY); } catch (t) { return void this.warn('Failed to parse sinf "encrypted" event message initData'); } } else { const t = (function (t) { if (!(t instanceof ArrayBuffer) || t.byteLength < 32) return null; const e = { version: 0, systemId: "", kids: null, data: null }, n = new DataView(t), i = n.getUint32(0); if (t.byteLength !== i && i > 44) return null; if (1886614376 !== n.getUint32(4)) return null; if (((e.version = n.getUint32(8) >>> 24), e.version > 1)) return null; e.systemId = te(new Uint8Array(t, 12, 16)); const r = n.getUint32(28); if (0 === e.version) { if (i - 32 < r) return null; e.data = new Uint8Array(t, 32, r); } else if (1 === e.version) { e.kids = []; for (let n = 0; n < r; n++) e.kids.push(new Uint8Array(t, 32 + 16 * n, 16)); } return e; })(n); if (null === t) return; 0 === t.version && t.systemId === Rt && t.data && (i = t.data.subarray(8, 24)), (r = (function (t) { if (t === Rt) return _t.WIDEVINE; })(t.systemId)); } if (!r || !i) return; const a = te(i), { keyIdToKeySessionPromise: s, mediaKeySessions: o } = this; let l = s[a]; for (let t = 0; t < o.length; t++) { const r = o[t], d = r.decryptdata; if (d.pssh || !d.keyId) continue; const c = te(d.keyId); if (a === c || -1 !== d.uri.replace(/-/g, "").indexOf(a)) { (l = s[c]), delete s[c], (d.pssh = new Uint8Array(n)), (d.keyId = i), (l = s[a] = l.then(() => this.generateRequestWithPreferredKeySession(r, e, n, "encrypted-event-key-match"))); break; } } l || (l = s[a] = this.getKeySystemSelectionPromise([r]).then(({ keySystem: t, mediaKeys: r }) => { var s; this.throwIfDestroyed(); const o = new Te("ISO-23001-7", a, null != (s = Dt(t)) ? s : ""); return ( (o.pssh = new Uint8Array(n)), (o.keyId = i), this.attemptSetMediaKeys(t, r).then(() => { this.throwIfDestroyed(); const i = this.createMediaKeySessionContext({ decryptdata: o, keySystem: t, mediaKeys: r }); return this.generateRequestWithPreferredKeySession(i, e, n, "encrypted-event-no-match"); }) ); })), l.catch(t => this.handleError(t)); } _onWaitingForKey(t) { this.log(`"${t.type}" event`); } attemptSetMediaKeys(t, e) { const n = this.setMediaKeysQueue.slice(); this.log(`Setting media-keys for "${t}"`); const i = Promise.all(n).then(() => { if (!this.media) throw new Error("Attempted to set mediaKeys without media element attached"); return this.media.setMediaKeys(e); }); return ( this.setMediaKeysQueue.push(i), i.then(() => { this.log(`Media-keys set for "${t}"`), n.push(i), (this.setMediaKeysQueue = this.setMediaKeysQueue.filter(t => -1 === n.indexOf(t))); }) ); } generateRequestWithPreferredKeySession(t, e, n, i) { var r, a; const s = null == (r = this.config.drmSystems) || null == (a = r[t.keySystem]) ? void 0 : a.generateRequest; if (s) try { const i = s.call(this.hls, e, n, t); if (!i) throw new Error("Invalid response from configured generateRequest filter"); (e = i.initDataType), (n = t.decryptdata.pssh = i.initData ? new Uint8Array(i.initData) : null); } catch (t) { var o; if ((this.warn(t.message), null != (o = this.hls) && o.config.debug)) throw t; } if (null === n) return this.log(`Skipping key-session request for "${i}" (no initData)`), Promise.resolve(t); const l = this.getKeyIdString(t.decryptdata); this.log(`Generating key-session request for "${i}": ${l} (init data type: ${e} length: ${n ? n.byteLength : null})`); const d = new ca(), c = (t._onmessage = e => { const n = t.mediaKeysSession; if (!n) return void d.emit("error", new Error("invalid state")); const { messageType: i, message: r } = e; this.log(`"${i}" message event for session "${n.sessionId}" message size: ${r.byteLength}`), "license-request" === i || "license-renewal" === i ? this.renewLicense(t, r).catch(t => { this.handleError(t), d.emit("error", t); }) : "license-release" === i ? t.keySystem === _t.FAIRPLAY && (this.updateKeySession(t, xt("acknowledged")), this.removeSession(t)) : this.warn(`unhandled media key message type "${i}"`); }), u = (t._onkeystatuseschange = e => { if (!t.mediaKeysSession) return void d.emit("error", new Error("invalid state")); this.onKeyStatusChange(t); const n = t.keyStatus; d.emit("keyStatus", n), "expired" === n && (this.warn(`${t.keySystem} expired for key ${l}`), this.renewKeySession(t)); }); t.mediaKeysSession.addEventListener("message", c), t.mediaKeysSession.addEventListener("keystatuseschange", u); const h = new Promise((t, e) => { d.on("error", e), d.on("keyStatus", n => { n.startsWith("usable") ? t() : "output-restricted" === n ? e( new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED, fatal: !1 }, "HDCP level output restricted" ) ) : "internal-error" === n ? e( new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_STATUS_INTERNAL_ERROR, fatal: !0 }, `key status changed to "${n}"` ) ) : "expired" === n ? e(new Error("key expired while generating request")) : this.warn(`unhandled key status change "${n}"`); }); }); return t.mediaKeysSession .generateRequest(e, n) .then(() => { var e; this.log( `Request generated for key-session "${null == (e = t.mediaKeysSession) ? void 0 : e.sessionId }" keyId: ${l}` ); }) .catch(t => { throw new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_NO_SESSION, error: t, fatal: !1 }, `Error generating key-session request: ${t}` ); }) .then(() => h) .catch(e => { throw (d.removeAllListeners(), this.removeSession(t), e); }) .then(() => (d.removeAllListeners(), t)); } onKeyStatusChange(t) { t.mediaKeysSession.keyStatuses.forEach((e, n) => { this.log( `key status change "${e}" for keyStatuses keyId: ${te( "buffer" in n ? new Uint8Array(n.buffer, n.byteOffset, n.byteLength) : new Uint8Array(n) )} session keyId: ${te(new Uint8Array(t.decryptdata.keyId || []))} uri: ${t.decryptdata.uri}` ), (t.keyStatus = e); }); } fetchServerCertificate(t) { const e = this.config, n = new (0, e.loader)(e), i = this.getServerCertificateUrl(t); return i ? (this.log(`Fetching server certificate for "${t}"`), new Promise((r, a) => { const s = { responseType: "arraybuffer", url: i }, o = e.certLoadPolicy.default, l = { loadPolicy: o, timeout: o.maxLoadTimeMs, maxRetry: 0, retryDelay: 0, maxRetryDelay: 0 }, d = { onSuccess: (t, e, n, i) => { r(t.data); }, onError: (e, n, r, o) => { a( new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED, fatal: !0, networkDetails: r, response: q({ url: s.url, data: void 0 }, e) }, `"${t}" certificate request failed (${i}). Status: ${e.code} (${e.text})` ) ); }, onTimeout: (e, n, r) => { a( new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED, fatal: !0, networkDetails: r, response: { url: s.url, data: void 0 } }, `"${t}" certificate request timed out (${i})` ) ); }, onAbort: (t, e, n) => { a(new Error("aborted")); } }; n.load(s, l, d); })) : Promise.resolve(); } setMediaKeysServerCertificate(t, e, n) { return new Promise((i, r) => { t.setServerCertificate(n) .then(r => { this.log( `setServerCertificate ${r ? "success" : "not supported by CDM"} (${null == n ? void 0 : n.byteLength }) on "${e}"` ), i(t); }) .catch(t => { r( new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED, error: t, fatal: !0 }, t.message ) ); }); }); } renewLicense(t, e) { return this.requestLicense(t, new Uint8Array(e)).then(e => this.updateKeySession(t, new Uint8Array(e)).catch(t => { throw new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_SESSION_UPDATE_FAILED, error: t, fatal: !0 }, t.message ); }) ); } unpackPlayReadyKeyMessage(t, e) { const n = String.fromCharCode.apply(null, new Uint16Array(e.buffer)); if (!n.includes("PlayReadyKeyMessage")) return t.setRequestHeader("Content-Type", "text/xml; charset=utf-8"), e; const i = new DOMParser().parseFromString(n, "application/xml"), r = i.querySelectorAll("HttpHeader"); if (r.length > 0) { let e; for (let n = 0, i = r.length; n < i; n++) { var a, s; e = r[n]; const i = null == (a = e.querySelector("name")) ? void 0 : a.textContent, o = null == (s = e.querySelector("value")) ? void 0 : s.textContent; i && o && t.setRequestHeader(i, o); } } const o = i.querySelector("Challenge"), l = null == o ? void 0 : o.textContent; if (!l) throw new Error("Cannot find in key message"); return xt(atob(l)); } setupLicenseXHR(t, e, n, i) { const r = this.config.licenseXhrSetup; return r ? Promise.resolve() .then(() => { if (!n.decryptdata) throw new Error("Key removed"); return r.call(this.hls, t, e, n, i); }) .catch(a => { if (!n.decryptdata) throw a; return t.open("POST", e, !0), r.call(this.hls, t, e, n, i); }) .then(n => { t.readyState || t.open("POST", e, !0); return { xhr: t, licenseChallenge: n || i }; }) : (t.open("POST", e, !0), Promise.resolve({ xhr: t, licenseChallenge: i })); } requestLicense(t, e) { const n = this.config.keyLoadPolicy.default; return new Promise((i, r) => { const a = this.getLicenseServerUrl(t.keySystem); this.log(`Sending license request to URL: ${a}`); const s = new XMLHttpRequest(); (s.responseType = "arraybuffer"), (s.onreadystatechange = () => { if (!this.hls || !t.mediaKeysSession) return r(new Error("invalid state")); if (4 === s.readyState) if (200 === s.status) { this._requestLicenseFailureCount = 0; let e = s.response; this.log(`License received ${e instanceof ArrayBuffer ? e.byteLength : e}`); const n = this.config.licenseResponseCallback; if (n) try { e = n.call(this.hls, s, a, t); } catch (t) { this.error(t); } i(e); } else { const o = n.errorRetry, l = o ? o.maxNumRetry : 0; if ( (this._requestLicenseFailureCount++, this._requestLicenseFailureCount > l || (s.status >= 400 && s.status < 500)) ) r( new gs( { type: et.KEY_SYSTEM_ERROR, details: nt.KEY_SYSTEM_LICENSE_REQUEST_FAILED, fatal: !0, networkDetails: s, response: { url: a, data: void 0, code: s.status, text: s.statusText } }, `License Request XHR failed (${a}). Status: ${s.status} (${s.statusText})` ) ); else { const n = l - this._requestLicenseFailureCount + 1; this.warn(`Retrying license request, ${n} attempts left`), this.requestLicense(t, e).then(i, r); } } }), t.licenseXhr && t.licenseXhr.readyState !== XMLHttpRequest.DONE && t.licenseXhr.abort(), (t.licenseXhr = s), this.setupLicenseXHR(s, a, t, e).then(({ xhr: e, licenseChallenge: n }) => { t.keySystem == _t.PLAYREADY && (n = this.unpackPlayReadyKeyMessage(e, n)), e.send(n); }); }); } onMediaAttached(t, e) { if (!this.config.emeEnabled) return; const n = e.media; (this.media = n), n.addEventListener("encrypted", this.onMediaEncrypted), n.addEventListener("waitingforkey", this.onWaitingForKey); } onMediaDetached() { const t = this.media, e = this.mediaKeySessions; t && (t.removeEventListener("encrypted", this.onMediaEncrypted), t.removeEventListener("waitingforkey", this.onWaitingForKey), (this.media = null)), (this._requestLicenseFailureCount = 0), (this.setMediaKeysQueue = []), (this.mediaKeySessions = []), (this.keyIdToKeySessionPromise = {}), Te.clearKeyUriToKeyIdMap(); const n = e.length; ms.CDMCleanupPromise = Promise.all( e .map(t => this.removeSession(t)) .concat( null == t ? void 0 : t.setMediaKeys(null).catch(t => { this.log(`Could not clear media keys: ${t}`); }) ) ) .then(() => { n && (this.log("finished closing key sessions and clearing media keys"), (e.length = 0)); }) .catch(t => { this.log(`Could not close sessions and clear media keys: ${t}`); }); } onManifestLoading() { this.keyFormatPromise = null; } onManifestLoaded(t, { sessionKeys: e }) { if (e && this.config.emeEnabled && !this.keyFormatPromise) { const t = e.reduce((t, e) => (-1 === t.indexOf(e.keyFormat) && t.push(e.keyFormat), t), []); this.log(`Selecting key-system from session-keys ${t.join(", ")}`), (this.keyFormatPromise = this.getKeyFormatPromise(t)); } } removeSession(t) { const { mediaKeysSession: e, licenseXhr: n } = t; if (e) { this.log(`Remove licenses and keys and close session ${e.sessionId}`), t._onmessage && (e.removeEventListener("message", t._onmessage), (t._onmessage = void 0)), t._onkeystatuseschange && (e.removeEventListener("keystatuseschange", t._onkeystatuseschange), (t._onkeystatuseschange = void 0)), n && n.readyState !== XMLHttpRequest.DONE && n.abort(), (t.mediaKeysSession = t.decryptdata = t.licenseXhr = void 0); const i = this.mediaKeySessions.indexOf(t); return ( i > -1 && this.mediaKeySessions.splice(i, 1), e .remove() .catch(t => { this.log(`Could not remove session: ${t}`); }) .then(() => e.close()) .catch(t => { this.log(`Could not close session: ${t}`); }) ); } } } ms.CDMCleanupPromise = void 0; class gs extends Error { constructor(t, e) { super(e), (this.data = void 0), t.error || (t.error = new Error(e)), (this.data = t), (t.err = t.error); } } var ys, As, vs; !(function (t) { (t.MANIFEST = "m"), (t.AUDIO = "a"), (t.VIDEO = "v"), (t.MUXED = "av"), (t.INIT = "i"), (t.CAPTION = "c"), (t.TIMED_TEXT = "tt"), (t.KEY = "k"), (t.OTHER = "o"); })(ys || (ys = {})), (function (t) { (t.DASH = "d"), (t.HLS = "h"), (t.SMOOTH = "s"), (t.OTHER = "o"); })(As || (As = {})), (function (t) { (t.OBJECT = "CMCD-Object"), (t.REQUEST = "CMCD-Request"), (t.SESSION = "CMCD-Session"), (t.STATUS = "CMCD-Status"); })(vs || (vs = {})); const bs = { [vs.OBJECT]: ["br", "d", "ot", "tb"], [vs.REQUEST]: ["bl", "dl", "mtp", "nor", "nrr", "su"], [vs.SESSION]: ["cid", "pr", "sf", "sid", "st", "v"], [vs.STATUS]: ["bs", "rtp"] }; class Es { constructor(t, e) { (this.value = void 0), (this.params = void 0), Array.isArray(t) && (t = t.map(t => (t instanceof Es ? t : new Es(t)))), (this.value = t), (this.params = e); } } class ws { constructor(t) { (this.description = void 0), (this.description = t); } } const xs = "Dict"; function Ss(t, e, n, i) { return new Error( `failed to ${t} "${((r = e), Array.isArray(r) ? JSON.stringify(r) : r instanceof Map ? "Map{}" : r instanceof Set ? "Set{}" : "object" == typeof r ? JSON.stringify(r) : String(r)) }" as ${n}`, { cause: i } ); var r; } const _s = "Bare Item", Ts = "Boolean", ks = "Byte Sequence", Cs = "Decimal", Ls = "Integer"; const Is = /[\x00-\x1f\x7f]+/, Rs = "Token", Ds = "Key"; function Bs(t, e, n) { return Ss("serialize", t, e, n); } function Ps(t) { if (!1 === ArrayBuffer.isView(t)) throw Bs(t, ks); return `:${((e = t), btoa(String.fromCharCode(...e)))}:`; var e; } function Us(t) { if ( (function (t) { return t < -999999999999999 || 999999999999999 < t; })(t) ) throw Bs(t, Ls); return t.toString(); } function Fs(t, e) { if (t < 0) return -Fs(-t, e); const n = Math.pow(10, e); if (Math.abs(((t * n) % 1) - 0.5) < Number.EPSILON) { const e = Math.floor(t * n); return (e % 2 == 0 ? e : e + 1) / n; } return Math.round(t * n) / n; } function Os(t) { const e = Fs(t, 3); if (Math.floor(Math.abs(e)).toString().length > 12) throw Bs(t, Cs); const n = e.toString(); return n.includes(".") ? n : `${n}.0`; } const Ms = "String"; function Ns(t) { const e = (n = t).description || n.toString().slice(7, -1); var n; if (!1 === /^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)) throw Bs(e, Rs); return e; } function zs(t) { switch (typeof t) { case "number": if (!X(t)) throw Bs(t, _s); return Number.isInteger(t) ? Us(t) : Os(t); case "string": return (function (t) { if (Is.test(t)) throw Bs(t, Ms); return `"${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`; })(t); case "symbol": return Ns(t); case "boolean": return (function (t) { if ("boolean" != typeof t) throw Bs(t, Ts); return t ? "?1" : "?0"; })(t); case "object": if (t instanceof Date) return (function (t) { return `@${Us(t.getTime() / 1e3)}`; })(t); if (t instanceof Uint8Array) return Ps(t); if (t instanceof ws) return Ns(t); default: throw Bs(t, _s); } } function Gs(t) { if (!1 === /^[a-z*][a-z0-9\-_.*]*$/.test(t)) throw Bs(t, Ds); return t; } function js(t) { return null == t ? "" : Object.entries(t) .map(([t, e]) => (!0 === e ? `;${Gs(t)}` : `;${Gs(t)}=${zs(e)}`)) .join(""); } function Hs(t) { return t instanceof Es ? `${zs(t.value)}${js(t.params)}` : zs(t); } function Ys(t, e = { whitespace: !0 }) { if ("object" != typeof t) throw Bs(t, xs); const n = t instanceof Map ? t.entries() : Object.entries(t), i = null != e && e.whitespace ? " " : ""; return Array.from(n) .map(([t, e]) => { e instanceof Es == !1 && (e = new Es(e)); let n = Gs(t); var i; return ( !0 === e.value ? (n += js(e.params)) : ((n += "="), Array.isArray(e.value) ? (n += `(${(i = e).value.map(Hs).join(" ")})${js(i.params)}`) : (n += Hs(e))), n ); }) .join(`,${i}`); } const $s = t => "ot" === t || "sf" === t || "st" === t, Ks = t => ("number" == typeof t ? X(t) : null != t && "" !== t && !1 !== t); const qs = t => Math.round(t), Vs = t => 100 * qs(t / 100), Ws = { br: qs, d: qs, bl: Vs, dl: Vs, mtp: Vs, nor: (t, e) => ( null != e && e.baseUrl && (t = (function (t, e) { const n = new URL(t), i = new URL(e); if (n.origin !== i.origin) return t; const r = n.pathname.split("/").slice(1), a = i.pathname.split("/").slice(1, -1); for (; r[0] === a[0];) r.shift(), a.shift(); for (; a.length;) a.shift(), r.unshift(".."); return r.join("/"); })(t, e.baseUrl)), encodeURIComponent(t) ), rtp: Vs, tb: qs }; function Qs(t, e = {}) { return t ? (function (t, e) { return Ys(t, e); })( (function (t, e) { const n = {}; if (null == t || "object" != typeof t) return n; const i = Object.keys(t).sort(), r = Q({}, Ws, null == e ? void 0 : e.formatters), a = null == e ? void 0 : e.filter; return ( i.forEach(i => { if (null != a && a(i)) return; let s = t[i]; const o = r[i]; o && (s = o(s, e)), ("v" === i && 1 === s) || ("pr" == i && 1 === s) || (Ks(s) && ($s(i) && "string" == typeof s && (s = new ws(s)), (n[i] = s))); }), n ); })(t, e), Q({ whitespace: !1 }, e) ) : ""; } function Xs(t, e, n) { return Q( t, (function (t, e = {}) { if (!t) return {}; const n = Object.entries(t), i = Object.entries(bs).concat(Object.entries((null == e ? void 0 : e.customHeaderMap) || {})), r = n.reduce((t, e) => { var n; const [r, a] = e, s = (null == (n = i.find(t => t[1].includes(r))) ? void 0 : n[0]) || vs.REQUEST; return null != t[s] || (t[s] = {}), (t[s][r] = a), t; }, {}); return Object.entries(r).reduce((t, [n, i]) => ((t[n] = Qs(i, e)), t), {}); })(e, n) ); } const Js = "CMCD"; const Zs = /CMCD=[^&#]+/; function to(t, e, n) { const i = (function (t, e = {}) { if (!t) return ""; const n = Qs(t, e); return `${Js}=${encodeURIComponent(n)}`; })(e, n); if (!i) return t; if (Zs.test(t)) return t.replace(Zs, i); const r = t.includes("?") ? "&" : "?"; return `${t}${r}${i}`; } function eo(t, e, n, i) { t && Object.keys(e).forEach(r => { const a = t .filter(t => t.groupId === r) .map(t => { const a = Q({}, t); return ( (a.details = void 0), (a.attrs = new ct(a.attrs)), (a.url = a.attrs.URI = no(t.url, t.attrs["STABLE-RENDITION-ID"], "PER-RENDITION-URIS", n)), (a.groupId = a.attrs["GROUP-ID"] = e[r]), (a.attrs["PATHWAY-ID"] = i), a ); }); t.push(...a); }); } function no(t, e, n, i) { const { HOST: r, PARAMS: a, [n]: s } = i; let o; e && ((o = null == s ? void 0 : s[e]), o && (t = o)); const l = new self.URL(t); return ( r && !o && (l.host = r), a && Object.keys(a) .sort() .forEach(t => { t && l.searchParams.set(t, a[t]); }), l.href ); } const io = /^age:\s*[\d.]+\s*$/im; class ro { constructor(t) { (this.xhrSetup = void 0), (this.requestTimeout = void 0), (this.retryTimeout = void 0), (this.retryDelay = void 0), (this.config = null), (this.callbacks = null), (this.context = null), (this.loader = null), (this.stats = void 0), (this.xhrSetup = (t && t.xhrSetup) || null), (this.stats = new pt()), (this.retryDelay = 0); } destroy() { (this.callbacks = null), this.abortInternal(), (this.loader = null), (this.config = null), (this.context = null), (this.xhrSetup = null), (this.stats = null); } abortInternal() { const t = this.loader; self.clearTimeout(this.requestTimeout), self.clearTimeout(this.retryTimeout), t && ((t.onreadystatechange = null), (t.onprogress = null), 4 !== t.readyState && ((this.stats.aborted = !0), t.abort())); } abort() { var t; this.abortInternal(), null != (t = this.callbacks) && t.onAbort && this.callbacks.onAbort(this.stats, this.context, this.loader); } load(t, e, n) { if (this.stats.loading.start) throw new Error("Loader can only be used once."); (this.stats.loading.start = self.performance.now()), (this.context = t), (this.config = e), (this.callbacks = n), this.loadInternal(); } loadInternal() { const { config: t, context: e } = this; if (!t || !e) return; const n = (this.loader = new self.XMLHttpRequest()), i = this.stats; (i.loading.first = 0), (i.loaded = 0), (i.aborted = !1); const r = this.xhrSetup; r ? Promise.resolve() .then(() => { if (!this.stats.aborted) return r(n, e.url); }) .catch(t => (n.open("GET", e.url, !0), r(n, e.url))) .then(() => { this.stats.aborted || this.openAndSendXhr(n, e, t); }) .catch(t => { this.callbacks.onError({ code: n.status, text: t.message }, e, n, i); }) : this.openAndSendXhr(n, e, t); } openAndSendXhr(t, e, n) { t.readyState || t.open("GET", e.url, !0); const i = e.headers, { maxTimeToFirstByteMs: r, maxLoadTimeMs: a } = n.loadPolicy; if (i) for (const e in i) t.setRequestHeader(e, i[e]); e.rangeEnd && t.setRequestHeader("Range", "bytes=" + e.rangeStart + "-" + (e.rangeEnd - 1)), (t.onreadystatechange = this.readystatechange.bind(this)), (t.onprogress = this.loadprogress.bind(this)), (t.responseType = e.responseType), self.clearTimeout(this.requestTimeout), (n.timeout = r && X(r) ? r : a), (this.requestTimeout = self.setTimeout(this.loadtimeout.bind(this), n.timeout)), t.send(); } readystatechange() { const { context: t, loader: e, stats: n } = this; if (!t || !e) return; const i = e.readyState, r = this.config; if ( !n.aborted && i >= 2 && (0 === n.loading.first && ((n.loading.first = Math.max(self.performance.now(), n.loading.start)), r.timeout !== r.loadPolicy.maxLoadTimeMs && (self.clearTimeout(this.requestTimeout), (r.timeout = r.loadPolicy.maxLoadTimeMs), (this.requestTimeout = self.setTimeout( this.loadtimeout.bind(this), r.loadPolicy.maxLoadTimeMs - (n.loading.first - n.loading.start) )))), 4 === i) ) { self.clearTimeout(this.requestTimeout), (e.onreadystatechange = null), (e.onprogress = null); const i = e.status, a = "text" !== e.responseType; if (i >= 200 && i < 300 && ((a && e.response) || null !== e.responseText)) { n.loading.end = Math.max(self.performance.now(), n.loading.first); const r = a ? e.response : e.responseText, s = "arraybuffer" === e.responseType ? r.byteLength : r.length; if ( ((n.loaded = n.total = s), (n.bwEstimate = (8e3 * n.total) / (n.loading.end - n.loading.first)), !this.callbacks) ) return; const o = this.callbacks.onProgress; if ((o && o(n, t, r, e), !this.callbacks)) return; const l = { url: e.responseURL, data: r, code: i }; this.callbacks.onSuccess(l, n, t, e); } else { const a = r.loadPolicy.errorRetry; Wn(a, n.retry, !1, { url: t.url, data: void 0, code: i }) ? this.retry(a) : (ot.error(`${i} while loading ${t.url}`), this.callbacks.onError({ code: i, text: e.statusText }, t, e, n)); } } } loadtimeout() { var t; const e = null == (t = this.config) ? void 0 : t.loadPolicy.timeoutRetry; if (Wn(e, this.stats.retry, !0)) this.retry(e); else { var n; ot.warn(`timeout while loading ${null == (n = this.context) ? void 0 : n.url}`); const t = this.callbacks; t && (this.abortInternal(), t.onTimeout(this.stats, this.context, this.loader)); } } retry(t) { const { context: e, stats: n } = this; (this.retryDelay = qn(t, n.retry)), n.retry++, ot.warn( `${status ? "HTTP Status " + status : "Timeout"} while loading ${null == e ? void 0 : e.url}, retrying ${n.retry }/${t.maxNumRetry} in ${this.retryDelay}ms` ), this.abortInternal(), (this.loader = null), self.clearTimeout(this.retryTimeout), (this.retryTimeout = self.setTimeout(this.loadInternal.bind(this), this.retryDelay)); } loadprogress(t) { const e = this.stats; (e.loaded = t.loaded), t.lengthComputable && (e.total = t.total); } getCacheAge() { let t = null; if (this.loader && io.test(this.loader.getAllResponseHeaders())) { const e = this.loader.getResponseHeader("age"); t = e ? parseFloat(e) : null; } return t; } getResponseHeader(t) { return this.loader && new RegExp(`^${t}:\\s*[\\d.]+\\s*$`, "im").test(this.loader.getAllResponseHeaders()) ? this.loader.getResponseHeader(t) : null; } } const ao = /(\d+)-(\d+)\/(\d+)/; class so { constructor(t) { (this.fetchSetup = void 0), (this.requestTimeout = void 0), (this.request = null), (this.response = null), (this.controller = void 0), (this.context = null), (this.config = null), (this.callbacks = null), (this.stats = void 0), (this.loader = null), (this.fetchSetup = t.fetchSetup || oo), (this.controller = new self.AbortController()), (this.stats = new pt()); } destroy() { (this.loader = this.callbacks = this.context = this.config = this.request = null), this.abortInternal(), (this.response = null), (this.fetchSetup = this.controller = this.stats = null); } abortInternal() { this.controller && !this.stats.loading.end && ((this.stats.aborted = !0), this.controller.abort()); } abort() { var t; this.abortInternal(), null != (t = this.callbacks) && t.onAbort && this.callbacks.onAbort(this.stats, this.context, this.response); } load(t, e, n) { const i = this.stats; if (i.loading.start) throw new Error("Loader can only be used once."); i.loading.start = self.performance.now(); const r = (function (t, e) { const n = { method: "GET", mode: "cors", credentials: "same-origin", signal: e, headers: new self.Headers(Q({}, t.headers)) }; t.rangeEnd && n.headers.set("Range", "bytes=" + t.rangeStart + "-" + String(t.rangeEnd - 1)); return n; })(t, this.controller.signal), a = n.onProgress, s = "arraybuffer" === t.responseType, o = s ? "byteLength" : "length", { maxTimeToFirstByteMs: l, maxLoadTimeMs: d } = e.loadPolicy; (this.context = t), (this.config = e), (this.callbacks = n), (this.request = this.fetchSetup(t, r)), self.clearTimeout(this.requestTimeout), (e.timeout = l && X(l) ? l : d), (this.requestTimeout = self.setTimeout(() => { this.abortInternal(), n.onTimeout(i, t, this.response); }, e.timeout)), self .fetch(this.request) .then(r => { this.response = this.loader = r; const o = Math.max(self.performance.now(), i.loading.start); if ( (self.clearTimeout(this.requestTimeout), (e.timeout = d), (this.requestTimeout = self.setTimeout(() => { this.abortInternal(), n.onTimeout(i, t, this.response); }, d - (o - i.loading.start))), !r.ok) ) { const { status: t, statusText: e } = r; throw new lo(e || "fetch, bad network response", t, r); } return ( (i.loading.first = o), (i.total = (function (t) { const e = t.get("Content-Range"); if (e) { const t = (function (t) { const e = ao.exec(t); if (e) return parseInt(e[2]) - parseInt(e[1]) + 1; })(e); if (X(t)) return t; } const n = t.get("Content-Length"); if (n) return parseInt(n); })(r.headers) || i.total), a && X(e.highWaterMark) ? this.loadProgressively(r, i, t, e.highWaterMark, a) : s ? r.arrayBuffer() : "json" === t.responseType ? r.json() : r.text() ); }) .then(r => { const s = this.response; if (!s) throw new Error("loader destroyed"); self.clearTimeout(this.requestTimeout), (i.loading.end = Math.max(self.performance.now(), i.loading.first)); const l = r[o]; l && (i.loaded = i.total = l); const d = { url: s.url, data: r, code: s.status }; a && !X(e.highWaterMark) && a(i, t, r, s), n.onSuccess(d, i, t, s); }) .catch(e => { if ((self.clearTimeout(this.requestTimeout), i.aborted)) return; const r = (e && e.code) || 0, a = e ? e.message : null; n.onError({ code: r, text: a }, t, e ? e.details : null, i); }); } getCacheAge() { let t = null; if (this.response) { const e = this.response.headers.get("age"); t = e ? parseFloat(e) : null; } return t; } getResponseHeader(t) { return this.response ? this.response.headers.get(t) : null; } loadProgressively(t, e, n, i = 0, r) { const a = new ar(), s = t.body.getReader(), o = () => s .read() .then(s => { if (s.done) return a.dataLength && r(e, n, a.flush(), t), Promise.resolve(new ArrayBuffer(0)); const l = s.value, d = l.length; return ( (e.loaded += d), d < i || a.dataLength ? (a.push(l), a.dataLength >= i && r(e, n, a.flush(), t)) : r(e, n, l, t), o() ); }) .catch(() => Promise.reject()); return o(); } } function oo(t, e) { return new self.Request(t.url, e); } class lo extends Error { constructor(t, e, n) { super(t), (this.code = void 0), (this.details = void 0), (this.code = e), (this.details = n); } } const co = /\s/, uo = { newCue(t, e, n, i) { const r = []; let a, s, o, l, d; const c = self.VTTCue || self.TextTrackCue; for (let h = 0; h < i.rows.length; h++) if (((a = i.rows[h]), (o = !0), (l = 0), (d = ""), !a.isEmpty())) { var u; for (let t = 0; t < a.chars.length; t++) co.test(a.chars[t].uchar) && o ? l++ : ((d += a.chars[t].uchar), (o = !1)); (a.cueStartTime = e), e === n && (n += 1e-4), l >= 16 ? l-- : l++; const i = qa(d.trim()), p = Ja(e, n, i); (null != t && null != (u = t.cues) && u.getCueById(p)) || ((s = new c(e, n, i)), (s.id = p), (s.line = h + 1), (s.align = "left"), (s.position = 10 + Math.min(80, 10 * Math.floor((8 * l) / 32))), r.push(s)); } return ( t && r.length && (r.sort((t, e) => "auto" === t.line || "auto" === e.line ? 0 : t.line > 8 && e.line > 8 ? e.line - t.line : t.line - e.line ), r.forEach(e => mn(t, e))), r ); } }, ho = q( q( { autoStartLoad: !0, startPosition: -1, defaultAudioCodec: void 0, debug: !1, capLevelOnFPSDrop: !1, capLevelToPlayerSize: !1, ignoreDevicePixelRatio: !1, preferManagedMediaSource: !0, initialLiveManifestSize: 1, maxBufferLength: 30, backBufferLength: 1 / 0, frontBufferFlushThreshold: 1 / 0, maxBufferSize: 6e7, maxBufferHole: 0.1, highBufferWatchdogPeriod: 2, nudgeOffset: 0.1, nudgeMaxRetry: 3, maxFragLookUpTolerance: 0.25, liveSyncDurationCount: 3, liveMaxLatencyDurationCount: 1 / 0, liveSyncDuration: void 0, liveMaxLatencyDuration: void 0, maxLiveSyncPlaybackRate: 1, liveDurationInfinity: !1, liveBackBufferLength: null, maxMaxBufferLength: 600, enableWorker: !0, workerPath: null, enableSoftwareAES: !0, startLevel: void 0, startFragPrefetch: !1, fpsDroppedMonitoringPeriod: 5e3, fpsDroppedMonitoringThreshold: 0.2, appendErrorMaxRetry: 3, loader: ro, fLoader: void 0, pLoader: void 0, xhrSetup: void 0, licenseXhrSetup: void 0, licenseResponseCallback: void 0, abrController: class { constructor(t) { (this.hls = void 0), (this.lastLevelLoadSec = 0), (this.lastLoadedFragLevel = -1), (this.firstSelection = -1), (this._nextAutoLevel = -1), (this.nextAutoLevelKey = ""), (this.audioTracksByGroup = null), (this.codecTiers = null), (this.timer = -1), (this.fragCurrent = null), (this.partCurrent = null), (this.bitrateTestDelay = 0), (this.bwEstimator = void 0), (this._abandonRulesCheck = () => { const { fragCurrent: t, partCurrent: e, hls: n } = this, { autoLevelEnabled: i, media: r } = n; if (!t || !r) return; const a = performance.now(), s = e ? e.stats : t.stats, o = e ? e.duration : t.duration, l = a - s.loading.start, d = n.minAutoLevel; if (s.aborted || (s.loaded && s.loaded === s.total) || t.level <= d) return this.clearTimer(), void (this._nextAutoLevel = -1); if (!i || r.paused || !r.playbackRate || !r.readyState) return; const c = n.mainForwardBufferInfo; if (null === c) return; const u = this.bwEstimator.getEstimateTTFB(), h = Math.abs(r.playbackRate); if (l <= Math.max(u, (o / (2 * h)) * 1e3)) return; const p = c.len / h, f = s.loading.first ? s.loading.first - s.loading.start : -1, m = s.loaded && f > -1, g = this.getBwEstimate(), y = n.levels, A = y[t.level], v = s.total || Math.max(s.loaded, Math.round((o * A.averageBitrate) / 8)); let b = m ? l - f : l; b < 1 && m && (b = Math.min(l, (8 * s.loaded) / g)); const E = m ? (1e3 * s.loaded) / b : 0, w = E ? (v - s.loaded) / E : (8 * v) / g + u / 1e3; if (w <= p) return; const x = E ? 8 * E : g; let S, _ = Number.POSITIVE_INFINITY; for (S = t.level - 1; S > d; S--) { const t = y[S].maxBitrate; if (((_ = this.getTimeToLoadFrag(u / 1e3, x, o * t, !y[S].details)), _ < p)) break; } if (_ >= w) return; if (_ > 10 * o) return; (n.nextLoadLevel = n.nextAutoLevel = S), m ? this.bwEstimator.sample(l - Math.min(u, f), s.loaded) : this.bwEstimator.sampleTTFB(l); const T = y[S].maxBitrate; this.getBwEstimate() * this.hls.config.abrBandWidthUpFactor > T && this.resetEstimator(T), this.clearTimer(), ot.warn( `[abr] Fragment ${t.sn}${e ? " part " + e.index : ""} of level ${t.level } is loading too slowly;\n Time to underbuffer: ${p.toFixed( 3 )} s\n Estimated load time for current fragment: ${w.toFixed( 3 )} s\n Estimated load time for down switch fragment: ${_.toFixed( 3 )} s\n TTFB estimate: ${0 | f} ms\n Current BW estimate: ${X(g) ? 0 | g : "Unknown" } bps\n New BW estimate: ${0 | this.getBwEstimate() } bps\n Switching to level ${S} @ ${0 | T} bps` ), n.trigger(tt.FRAG_LOAD_EMERGENCY_ABORTED, { frag: t, part: e, stats: s }); }), (this.hls = t), (this.bwEstimator = this.initEstimator()), this.registerListeners(); } resetEstimator(t) { t && (ot.log(`setting initial bwe to ${t}`), (this.hls.config.abrEwmaDefaultEstimate = t)), (this.firstSelection = -1), (this.bwEstimator = this.initEstimator()); } initEstimator() { const t = this.hls.config; return new di(t.abrEwmaSlowVoD, t.abrEwmaFastVoD, t.abrEwmaDefaultEstimate); } registerListeners() { const { hls: t } = this; t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.FRAG_LOADING, this.onFragLoading, this), t.on(tt.FRAG_LOADED, this.onFragLoaded, this), t.on(tt.FRAG_BUFFERED, this.onFragBuffered, this), t.on(tt.LEVEL_SWITCHING, this.onLevelSwitching, this), t.on(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.on(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(tt.MAX_AUTO_LEVEL_UPDATED, this.onMaxAutoLevelUpdated, this), t.on(tt.ERROR, this.onError, this); } unregisterListeners() { const { hls: t } = this; t && (t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.FRAG_LOADING, this.onFragLoading, this), t.off(tt.FRAG_LOADED, this.onFragLoaded, this), t.off(tt.FRAG_BUFFERED, this.onFragBuffered, this), t.off(tt.LEVEL_SWITCHING, this.onLevelSwitching, this), t.off(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.off(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(tt.MAX_AUTO_LEVEL_UPDATED, this.onMaxAutoLevelUpdated, this), t.off(tt.ERROR, this.onError, this)); } destroy() { this.unregisterListeners(), this.clearTimer(), (this.hls = this._abandonRulesCheck = null), (this.fragCurrent = this.partCurrent = null); } onManifestLoading(t, e) { (this.lastLoadedFragLevel = -1), (this.firstSelection = -1), (this.lastLevelLoadSec = 0), (this.fragCurrent = this.partCurrent = null), this.onLevelsUpdated(), this.clearTimer(); } onLevelsUpdated() { this.lastLoadedFragLevel > -1 && this.fragCurrent && (this.lastLoadedFragLevel = this.fragCurrent.level), (this._nextAutoLevel = -1), this.onMaxAutoLevelUpdated(), (this.codecTiers = null), (this.audioTracksByGroup = null); } onMaxAutoLevelUpdated() { (this.firstSelection = -1), (this.nextAutoLevelKey = ""); } onFragLoading(t, e) { const n = e.frag; if (!this.ignoreFragment(n)) { var i; if (!n.bitrateTest) (this.fragCurrent = n), (this.partCurrent = null != (i = e.part) ? i : null); this.clearTimer(), (this.timer = self.setInterval(this._abandonRulesCheck, 100)); } } onLevelSwitching(t, e) { this.clearTimer(); } onError(t, e) { if (!e.fatal) switch (e.details) { case nt.BUFFER_ADD_CODEC_ERROR: case nt.BUFFER_APPEND_ERROR: (this.lastLoadedFragLevel = -1), (this.firstSelection = -1); break; case nt.FRAG_LOAD_TIMEOUT: { const t = e.frag, { fragCurrent: n, partCurrent: i } = this; if (t && n && t.sn === n.sn && t.level === n.level) { const e = performance.now(), n = i ? i.stats : t.stats, r = e - n.loading.start, a = n.loading.first ? n.loading.first - n.loading.start : -1; if (n.loaded && a > -1) { const t = this.bwEstimator.getEstimateTTFB(); this.bwEstimator.sample(r - Math.min(t, a), n.loaded); } else this.bwEstimator.sampleTTFB(r); } break; } } } getTimeToLoadFrag(t, e, n, i) { return t + n / e + (i ? this.lastLevelLoadSec : 0); } onLevelLoaded(t, e) { const n = this.hls.config, { loading: i } = e.stats, r = i.end - i.start; X(r) && (this.lastLevelLoadSec = r / 1e3), e.details.live ? this.bwEstimator.update(n.abrEwmaSlowLive, n.abrEwmaFastLive) : this.bwEstimator.update(n.abrEwmaSlowVoD, n.abrEwmaFastVoD); } onFragLoaded(t, { frag: e, part: n }) { const i = n ? n.stats : e.stats; if ( (e.type === ln && this.bwEstimator.sampleTTFB(i.loading.first - i.loading.start), !this.ignoreFragment(e)) ) { if ( (this.clearTimer(), e.level === this._nextAutoLevel && (this._nextAutoLevel = -1), (this.firstSelection = -1), this.hls.config.abrMaxWithRealBitrate) ) { const t = n ? n.duration : e.duration, r = this.hls.levels[e.level], a = (r.loaded ? r.loaded.bytes : 0) + i.loaded, s = (r.loaded ? r.loaded.duration : 0) + t; (r.loaded = { bytes: a, duration: s }), (r.realBitrate = Math.round((8 * a) / s)); } if (e.bitrateTest) { const t = { stats: i, frag: e, part: n, id: e.type }; this.onFragBuffered(tt.FRAG_BUFFERED, t), (e.bitrateTest = !1); } else this.lastLoadedFragLevel = e.level; } } onFragBuffered(t, e) { const { frag: n, part: i } = e, r = null != i && i.stats.loaded ? i.stats : n.stats; if (r.aborted) return; if (this.ignoreFragment(n)) return; const a = r.parsing.end - r.loading.start - Math.min(r.loading.first - r.loading.start, this.bwEstimator.getEstimateTTFB()); this.bwEstimator.sample(a, r.loaded), (r.bwEstimate = this.getBwEstimate()), n.bitrateTest ? (this.bitrateTestDelay = a / 1e3) : (this.bitrateTestDelay = 0); } ignoreFragment(t) { return t.type !== ln || "initSegment" === t.sn; } clearTimer() { this.timer > -1 && (self.clearInterval(this.timer), (this.timer = -1)); } get firstAutoLevel() { const { maxAutoLevel: t, minAutoLevel: e } = this.hls, n = this.getBwEstimate(), i = this.hls.config.maxStarvationDelay, r = this.findBestLevel(n, e, t, 0, i, 1, 1); if (r > -1) return r; const a = this.hls.firstLevel, s = Math.min(Math.max(a, e), t); return ( ot.warn( `[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${s}` ), s ); } get forcedAutoLevel() { return this.nextAutoLevelKey ? -1 : this._nextAutoLevel; } get nextAutoLevel() { const t = this.forcedAutoLevel, e = this.bwEstimator.canEstimate(), n = this.lastLoadedFragLevel > -1; if (!(-1 === t || (e && n && this.nextAutoLevelKey !== this.getAutoLevelKey()))) return t; const i = e && n ? this.getNextABRAutoLevel() : this.firstAutoLevel; if (-1 !== t) { const e = this.hls.levels; if (e.length > Math.max(t, i) && e[t].loadError <= e[i].loadError) return t; } return (this._nextAutoLevel = i), (this.nextAutoLevelKey = this.getAutoLevelKey()), i; } getAutoLevelKey() { return `${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`; } getNextABRAutoLevel() { const { fragCurrent: t, partCurrent: e, hls: n } = this, { maxAutoLevel: i, config: r, minAutoLevel: a } = n, s = e ? e.duration : t ? t.duration : 0, o = this.getBwEstimate(), l = this.getStarvationDelay(); let d = r.abrBandWidthFactor, c = r.abrBandWidthUpFactor; if (l) { const t = this.findBestLevel(o, a, i, l, 0, d, c); if (t >= 0) return t; } let u = s ? Math.min(s, r.maxStarvationDelay) : r.maxStarvationDelay; if (!l) { const t = this.bitrateTestDelay; if (t) { (u = (s ? Math.min(s, r.maxLoadingDelay) : r.maxLoadingDelay) - t), ot.info( `[abr] bitrate test took ${Math.round( 1e3 * t )}ms, set first fragment max fetchDuration to ${Math.round(1e3 * u)} ms` ), (d = c = 1); } } const h = this.findBestLevel(o, a, i, l, u, d, c); if ( (ot.info(`[abr] ${l ? "rebuffering expected" : "buffer is empty"}, optimal quality level ${h}`), h > -1) ) return h; const p = n.levels[a], f = n.levels[n.loadLevel]; return (null == p ? void 0 : p.bitrate) < (null == f ? void 0 : f.bitrate) ? a : n.loadLevel; } getStarvationDelay() { const t = this.hls, e = t.media; if (!e) return 1 / 0; const n = e && 0 !== e.playbackRate ? Math.abs(e.playbackRate) : 1, i = t.mainForwardBufferInfo; return (i ? i.len : 0) / n; } getBwEstimate() { return this.bwEstimator.canEstimate() ? this.bwEstimator.getEstimate() : this.hls.config.abrEwmaDefaultEstimate; } findBestLevel(t, e, n, i, r, a, s) { var o; const l = i + r, d = this.lastLoadedFragLevel, c = -1 === d ? this.hls.firstLevel : d, { fragCurrent: u, partCurrent: h } = this, { levels: p, allAudioTracks: f, loadLevel: m, config: g } = this.hls; if (1 === p.length) return 0; const y = p[c], A = !(null == y || null == (o = y.details) || !o.live), v = -1 === m || -1 === d; let b, E = "SDR", w = (null == y ? void 0 : y.frameRate) || 0; const { audioPreference: x, videoPreference: S } = g, _ = this.audioTracksByGroup || (this.audioTracksByGroup = (function (t) { return t.reduce( (t, e) => { let n = t.groups[e.groupId]; n || (n = t.groups[e.groupId] = { tracks: [], channels: { 2: 0 }, hasDefault: !1, hasAutoSelect: !1 }), n.tracks.push(e); const i = e.channels || "2"; return ( (n.channels[i] = (n.channels[i] || 0) + 1), (n.hasDefault = n.hasDefault || e.default), (n.hasAutoSelect = n.hasAutoSelect || e.autoselect), n.hasDefault && (t.hasDefaultAudio = !0), n.hasAutoSelect && (t.hasAutoSelectAudio = !0), t ); }, { hasDefaultAudio: !1, hasAutoSelectAudio: !1, groups: {} } ); })(f)); if (v) { if (-1 !== this.firstSelection) return this.firstSelection; const i = this.codecTiers || (this.codecTiers = (function (t, e, n, i) { return t.slice(n, i + 1).reduce((t, n) => { if (!n.codecSet) return t; const i = n.audioGroups; let r = t[n.codecSet]; r || (t[n.codecSet] = r = { minBitrate: 1 / 0, minHeight: 1 / 0, minFramerate: 1 / 0, maxScore: 0, videoRanges: { SDR: 0 }, channels: { 2: 0 }, hasDefaultAudio: !i, fragmentError: 0 }), (r.minBitrate = Math.min(r.minBitrate, n.bitrate)); const a = Math.min(n.height, n.width); return ( (r.minHeight = Math.min(r.minHeight, a)), (r.minFramerate = Math.min(r.minFramerate, n.frameRate)), (r.maxScore = Math.max(r.maxScore, n.score)), (r.fragmentError += n.fragmentError), (r.videoRanges[n.videoRange] = (r.videoRanges[n.videoRange] || 0) + 1), i && i.forEach(t => { if (!t) return; const n = e.groups[t]; n && ((r.hasDefaultAudio = r.hasDefaultAudio || e.hasDefaultAudio ? n.hasDefault : n.hasAutoSelect || (!e.hasDefaultAudio && !e.hasAutoSelectAudio)), Object.keys(n.channels).forEach(t => { r.channels[t] = (r.channels[t] || 0) + n.channels[t]; })); }), t ); }, {}); })(p, _, e, n)), r = (function (t, e, n, i, r) { const a = Object.keys(t), s = null == i ? void 0 : i.channels, o = null == i ? void 0 : i.audioCodec, l = s && 2 === parseInt(s); let d = !0, c = !1, u = 1 / 0, h = 1 / 0, p = 1 / 0, f = 0, m = []; const { preferHDR: g, allowedVideoRanges: y } = fi(e, r); for (let e = a.length; e--;) { const n = t[a[e]]; (d = n.channels[2] > 0), (u = Math.min(u, n.minHeight)), (h = Math.min(h, n.minFramerate)), (p = Math.min(p, n.minBitrate)); const i = y.filter(t => n.videoRanges[t] > 0); i.length > 0 && ((c = !0), (m = i)); } (u = X(u) ? u : 0), (h = X(h) ? h : 0); const A = Math.max(1080, u), v = Math.max(30, h); return ( (p = X(p) ? p : n), (n = Math.max(p, n)), c || ((e = void 0), (m = [])), { codecSet: a.reduce((e, i) => { const r = t[i]; if (i === e) return e; if (r.minBitrate > n) return ( mi(i, `min bitrate of ${r.minBitrate} > current estimate of ${n}`), e ); if (!r.hasDefaultAudio) return mi(i, "no renditions with default or auto-select sound found"), e; if (o && i.indexOf(o.substring(0, 4)) % 5 != 0) return mi(i, `audio codec preference "${o}" not found`), e; if (s && !l) { if (!r.channels[s]) return ( mi( i, `no renditions with ${s} channel sound found (channels options: ${Object.keys( r.channels )})` ), e ); } else if ((!o || l) && d && 0 === r.channels[2]) return mi(i, "no renditions with stereo sound found"), e; return r.minHeight > A ? (mi(i, `min resolution of ${r.minHeight} > maximum of ${A}`), e) : r.minFramerate > v ? (mi(i, `min framerate of ${r.minFramerate} > maximum of ${v}`), e) : m.some(t => r.videoRanges[t] > 0) ? r.maxScore < f ? (mi(i, `max score of ${r.maxScore} < selected max of ${f}`), e) : e && (Ne(i) >= Ne(e) || r.fragmentError > t[e].fragmentError) ? e : ((f = r.maxScore), i) : (mi(i, `no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`), e); }, void 0), videoRanges: m, preferHDR: g, minFramerate: h, minBitrate: p } ); })(i, E, t, x, S), { codecSet: a, videoRanges: s, minFramerate: o, minBitrate: l, preferHDR: d } = r; (b = a), (E = d ? s[s.length - 1] : s[0]), (w = o), (t = Math.max(t, l)), ot.log(`[abr] picked start tier ${JSON.stringify(r)}`); } else (b = null == y ? void 0 : y.codecSet), (E = null == y ? void 0 : y.videoRange); const T = h ? h.duration : u ? u.duration : 0, k = this.bwEstimator.getEstimateTTFB() / 1e3, C = []; for (let o = n; o >= e; o--) { var L; const e = p[o], u = o > c; if (!e) continue; if (g.useMediaCapabilities && !e.supportedResult && !e.supportedPromise) { const n = navigator.mediaCapabilities; "function" == typeof (null == n ? void 0 : n.decodingInfo) && hi(e, _, E, w, t, x) ? ((e.supportedPromise = pi(e, _, n)), e.supportedPromise.then(t => { if (!this.hls) return; e.supportedResult = t; const n = this.hls.levels, i = n.indexOf(e); t.error ? ot.warn( `[abr] MediaCapabilities decodingInfo error: "${t.error }" for level ${i} ${JSON.stringify(t)}` ) : t.supported || (ot.warn( `[abr] Unsupported MediaCapabilities decodingInfo result for level ${i} ${JSON.stringify( t )}` ), i > -1 && n.length > 1 && (ot.log(`[abr] Removing unsupported level ${i}`), this.hls.removeLevel(i))); })) : (e.supportedResult = ci); } if ( (b && e.codecSet !== b) || (E && e.videoRange !== E) || (u && w > e.frameRate) || (!u && w > 0 && w < e.frameRate) || (e.supportedResult && (null == (L = e.supportedResult.decodingInfoResults) || !L[0].smooth)) ) { C.push(o); continue; } const f = e.details, S = (h ? null == f ? void 0 : f.partTarget : null == f ? void 0 : f.averagetargetduration) || T; let I; I = u ? s * t : a * t; const R = T && i >= 2 * T && 0 === r ? p[o].averageBitrate : p[o].maxBitrate, D = this.getTimeToLoadFrag(k, I, R * S, void 0 === f); if ( I >= R && (o === d || (0 === e.loadError && 0 === e.fragmentError)) && (D <= k || !X(D) || (A && !this.bitrateTestDelay) || D < l) ) { const t = this.forcedAutoLevel; return ( o === m || (-1 !== t && t === m) || (C.length && ot.trace( `[abr] Skipped level(s) ${C.join( "," )} of ${n} max with CODECS and VIDEO-RANGE:"${p[C[0]].codecs}" ${p[C[0]].videoRange }; not compatible with "${y.codecs}" ${E}` ), ot.info( `[abr] switch candidate:${c}->${o} adjustedbw(${Math.round( I )})-bitrate=${Math.round(I - R)} ttfb:${k.toFixed(1)} avgDuration:${S.toFixed( 1 )} maxFetchDuration:${l.toFixed(1)} fetchDuration:${D.toFixed( 1 )} firstSelection:${v} codecSet:${b} videoRange:${E} hls.loadLevel:${m}` )), v && (this.firstSelection = o), o ); } } return -1; } set nextAutoLevel(t) { const { maxAutoLevel: e, minAutoLevel: n } = this.hls, i = Math.min(Math.max(t, n), e); this._nextAutoLevel !== i && ((this.nextAutoLevelKey = ""), (this._nextAutoLevel = i)); } }, bufferController: class { constructor(t) { (this.details = null), (this._objectUrl = null), (this.operationQueue = void 0), (this.listeners = void 0), (this.hls = void 0), (this.bufferCodecEventsExpected = 0), (this._bufferCodecEventsTotal = 0), (this.media = null), (this.mediaSource = null), (this.lastMpegAudioChunk = null), (this.appendSource = void 0), (this.appendErrors = { audio: 0, video: 0, audiovideo: 0 }), (this.tracks = {}), (this.pendingTracks = {}), (this.sourceBuffer = void 0), (this.log = void 0), (this.warn = void 0), (this.error = void 0), (this._onEndStreaming = t => { this.hls && this.hls.pauseBuffering(); }), (this._onStartStreaming = t => { this.hls && this.hls.resumeBuffering(); }), (this._onMediaSourceOpen = () => { const { media: t, mediaSource: e } = this; this.log("Media source opened"), t && (t.removeEventListener("emptied", this._onMediaEmptied), this.updateMediaElementDuration(), this.hls.trigger(tt.MEDIA_ATTACHED, { media: t, mediaSource: e })), e && e.removeEventListener("sourceopen", this._onMediaSourceOpen), this.checkPendingTracks(); }), (this._onMediaSourceClose = () => { this.log("Media source closed"); }), (this._onMediaSourceEnded = () => { this.log("Media source ended"); }), (this._onMediaEmptied = () => { const { mediaSrc: t, _objectUrl: e } = this; t !== e && ot.error(`Media element src was set while attaching MediaSource (${e} > ${t})`); }), (this.hls = t); const e = "[buffer-controller]"; var n; (this.appendSource = ((n = Be(t.config.preferManagedMediaSource)), "undefined" != typeof self && n === self.ManagedMediaSource)), (this.log = ot.log.bind(ot, e)), (this.warn = ot.warn.bind(ot, e)), (this.error = ot.error.bind(ot, e)), this._initSourceBuffer(), this.registerListeners(); } hasSourceTypes() { return this.getSourceBufferTypes().length > 0 || Object.keys(this.pendingTracks).length > 0; } destroy() { this.unregisterListeners(), (this.details = null), (this.lastMpegAudioChunk = null), (this.hls = null); } registerListeners() { const { hls: t } = this; t.on(tt.MEDIA_ATTACHING, this.onMediaAttaching, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.on(tt.BUFFER_RESET, this.onBufferReset, this), t.on(tt.BUFFER_APPENDING, this.onBufferAppending, this), t.on(tt.BUFFER_CODECS, this.onBufferCodecs, this), t.on(tt.BUFFER_EOS, this.onBufferEos, this), t.on(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(tt.LEVEL_UPDATED, this.onLevelUpdated, this), t.on(tt.FRAG_PARSED, this.onFragParsed, this), t.on(tt.FRAG_CHANGED, this.onFragChanged, this); } unregisterListeners() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHING, this.onMediaAttaching, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.off(tt.BUFFER_RESET, this.onBufferReset, this), t.off(tt.BUFFER_APPENDING, this.onBufferAppending, this), t.off(tt.BUFFER_CODECS, this.onBufferCodecs, this), t.off(tt.BUFFER_EOS, this.onBufferEos, this), t.off(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(tt.LEVEL_UPDATED, this.onLevelUpdated, this), t.off(tt.FRAG_PARSED, this.onFragParsed, this), t.off(tt.FRAG_CHANGED, this.onFragChanged, this); } _initSourceBuffer() { (this.sourceBuffer = {}), (this.operationQueue = new ga(this.sourceBuffer)), (this.listeners = { audio: [], video: [], audiovideo: [] }), (this.appendErrors = { audio: 0, video: 0, audiovideo: 0 }), (this.lastMpegAudioChunk = null); } onManifestLoading() { (this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = 0), (this.details = null); } onManifestParsed(t, e) { let n = 2; ((e.audio && !e.video) || !e.altAudio) && (n = 1), (this.bufferCodecEventsExpected = this._bufferCodecEventsTotal = n), this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`); } onMediaAttaching(t, e) { const n = (this.media = e.media), i = Be(this.appendSource); if (n && i) { var r; const t = (this.mediaSource = new i()); this.log(`created media source: ${null == (r = t.constructor) ? void 0 : r.name}`), t.addEventListener("sourceopen", this._onMediaSourceOpen), t.addEventListener("sourceended", this._onMediaSourceEnded), t.addEventListener("sourceclose", this._onMediaSourceClose), this.appendSource && (t.addEventListener("startstreaming", this._onStartStreaming), t.addEventListener("endstreaming", this._onEndStreaming)); const e = (this._objectUrl = self.URL.createObjectURL(t)); if (this.appendSource) try { n.removeAttribute("src"); const i = self.ManagedMediaSource; (n.disableRemotePlayback = n.disableRemotePlayback || (i && t instanceof i)), Aa(n), (function (t, e) { const n = self.document.createElement("source"); (n.type = "video/mp4"), (n.src = e), t.appendChild(n); })(n, e), n.load(); } catch (t) { n.src = e; } else n.src = e; n.addEventListener("emptied", this._onMediaEmptied); } } onMediaDetaching() { const { media: t, mediaSource: e, _objectUrl: n } = this; if (e) { if ((this.log("media source detaching"), "open" === e.readyState)) try { e.endOfStream(); } catch (t) { this.warn(`onMediaDetaching: ${t.message} while calling endOfStream`); } this.onBufferReset(), e.removeEventListener("sourceopen", this._onMediaSourceOpen), e.removeEventListener("sourceended", this._onMediaSourceEnded), e.removeEventListener("sourceclose", this._onMediaSourceClose), this.appendSource && (e.removeEventListener("startstreaming", this._onStartStreaming), e.removeEventListener("endstreaming", this._onEndStreaming)), t && (t.removeEventListener("emptied", this._onMediaEmptied), n && self.URL.revokeObjectURL(n), this.mediaSrc === n ? (t.removeAttribute("src"), this.appendSource && Aa(t), t.load()) : this.warn("media|source.src was changed by a third party - skip cleanup")), (this.mediaSource = null), (this.media = null), (this._objectUrl = null), (this.bufferCodecEventsExpected = this._bufferCodecEventsTotal), (this.pendingTracks = {}), (this.tracks = {}); } this.hls.trigger(tt.MEDIA_DETACHED, void 0); } onBufferReset() { this.getSourceBufferTypes().forEach(t => { this.resetBuffer(t); }), this._initSourceBuffer(); } resetBuffer(t) { const e = this.sourceBuffer[t]; try { var n; if (e) this.removeBufferListeners(t), (this.sourceBuffer[t] = void 0), null != (n = this.mediaSource) && n.sourceBuffers.length && this.mediaSource.removeSourceBuffer(e); } catch (e) { this.warn(`onBufferReset ${t}`, e); } } onBufferCodecs(t, e) { const n = this.getSourceBufferTypes().length, i = Object.keys(e); if ( (i.forEach(t => { if (n) { const n = this.tracks[t]; if (n && "function" == typeof n.buffer.changeType) { var i; const { id: r, codec: a, levelCodec: s, container: o, metadata: l } = e[t], d = He(n.codec, n.levelCodec), c = null == d ? void 0 : d.replace(ya, "$1"); let u = He(a, s); const h = null == (i = u) ? void 0 : i.replace(ya, "$1"); if (u && c !== h) { "audio" === t.slice(0, 5) && (u = je(u, this.appendSource)); const e = `${o};codecs=${u}`; this.appendChangeType(t, e), this.log(`switching codec ${d} to ${u}`), (this.tracks[t] = { buffer: n.buffer, codec: a, container: o, levelCodec: s, metadata: l, id: r }); } } } else this.pendingTracks[t] = e[t]; }), n) ) return; const r = Math.max(this.bufferCodecEventsExpected - 1, 0); this.bufferCodecEventsExpected !== r && (this.log(`${r} bufferCodec event(s) expected ${i.join(",")}`), (this.bufferCodecEventsExpected = r)), this.mediaSource && "open" === this.mediaSource.readyState && this.checkPendingTracks(); } appendChangeType(t, e) { const { operationQueue: n } = this, i = { execute: () => { const i = this.sourceBuffer[t]; i && (this.log(`changing ${t} sourceBuffer type to ${e}`), i.changeType(e)), n.shiftAndExecuteNext(t); }, onStart: () => { }, onComplete: () => { }, onError: e => { this.warn(`Failed to change ${t} SourceBuffer type`, e); } }; n.append(i, t, !!this.pendingTracks[t]); } onBufferAppending(t, e) { const { hls: n, operationQueue: i, tracks: r } = this, { data: a, type: s, frag: o, part: l, chunkMeta: d } = e, c = d.buffering[s], u = self.performance.now(); c.start = u; const h = o.stats.buffering, p = l ? l.stats.buffering : null; 0 === h.start && (h.start = u), p && 0 === p.start && (p.start = u); const f = r.audio; let m = !1; "audio" === s && "audio/mpeg" === (null == f ? void 0 : f.container) && ((m = !this.lastMpegAudioChunk || 1 === d.id || this.lastMpegAudioChunk.sn !== d.sn), (this.lastMpegAudioChunk = d)); const g = o.start, y = { execute: () => { if (((c.executeStart = self.performance.now()), m)) { const t = this.sourceBuffer[s]; if (t) { const e = g - t.timestampOffset; Math.abs(e) >= 0.1 && (this.log( `Updating audio SourceBuffer timestampOffset to ${g} (delta: ${e}) sn: ${o.sn})` ), (t.timestampOffset = g)); } } this.appendExecutor(a, s); }, onStart: () => { }, onComplete: () => { const t = self.performance.now(); (c.executeEnd = c.end = t), 0 === h.first && (h.first = t), p && 0 === p.first && (p.first = t); const { sourceBuffer: e } = this, n = {}; for (const t in e) n[t] = Li.getBuffered(e[t]); (this.appendErrors[s] = 0), "audio" === s || "video" === s ? (this.appendErrors.audiovideo = 0) : ((this.appendErrors.audio = 0), (this.appendErrors.video = 0)), this.hls.trigger(tt.BUFFER_APPENDED, { type: s, frag: o, part: l, chunkMeta: d, parent: o.type, timeRanges: n }); }, onError: t => { const e = { type: et.MEDIA_ERROR, parent: o.type, details: nt.BUFFER_APPEND_ERROR, sourceBufferName: s, frag: o, part: l, chunkMeta: d, error: t, err: t, fatal: !1 }; if (t.code === DOMException.QUOTA_EXCEEDED_ERR) e.details = nt.BUFFER_FULL_ERROR; else { const t = ++this.appendErrors[s]; (e.details = nt.BUFFER_APPEND_ERROR), this.warn( `Failed ${t}/${n.config.appendErrorMaxRetry} times to append segment in "${s}" sourceBuffer` ), t >= n.config.appendErrorMaxRetry && (e.fatal = !0); } n.trigger(tt.ERROR, e); } }; i.append(y, s, !!this.pendingTracks[s]); } onBufferFlushing(t, e) { const { operationQueue: n } = this, i = t => ({ execute: this.removeExecutor.bind(this, t, e.startOffset, e.endOffset), onStart: () => { }, onComplete: () => { this.hls.trigger(tt.BUFFER_FLUSHED, { type: t }); }, onError: e => { this.warn(`Failed to remove from ${t} SourceBuffer`, e); } }); e.type ? n.append(i(e.type), e.type) : this.getSourceBufferTypes().forEach(t => { n.append(i(t), t); }); } onFragParsed(t, e) { const { frag: n, part: i } = e, r = [], a = i ? i.elementaryStreams : n.elementaryStreams; a[gt] ? r.push("audiovideo") : (a[ft] && r.push("audio"), a[mt] && r.push("video")); 0 === r.length && this.warn( `Fragments must have at least one ElementaryStreamType set. type: ${n.type} level: ${n.level} sn: ${n.sn}` ), this.blockBuffers(() => { const t = self.performance.now(); (n.stats.buffering.end = t), i && (i.stats.buffering.end = t); const e = i ? i.stats : n.stats; this.hls.trigger(tt.FRAG_BUFFERED, { frag: n, part: i, stats: e, id: n.type }); }, r); } onFragChanged(t, e) { this.trimBuffers(); } onBufferEos(t, e) { this.getSourceBufferTypes().reduce((t, n) => { const i = this.sourceBuffer[n]; return ( !i || (e.type && e.type !== n) || ((i.ending = !0), i.ended || ((i.ended = !0), this.log(`${n} sourceBuffer now EOS`))), t && !(i && !i.ended) ); }, !0) && (this.log("Queueing mediaSource.endOfStream()"), this.blockBuffers(() => { this.getSourceBufferTypes().forEach(t => { const e = this.sourceBuffer[t]; e && (e.ending = !1); }); const { mediaSource: t } = this; t && "open" === t.readyState ? (this.log("Calling mediaSource.endOfStream()"), t.endOfStream()) : t && this.log( `Could not call mediaSource.endOfStream(). mediaSource.readyState: ${t.readyState}` ); })); } onLevelUpdated(t, { details: e }) { e.fragments.length && ((this.details = e), this.getSourceBufferTypes().length ? this.blockBuffers(this.updateMediaElementDuration.bind(this)) : this.updateMediaElementDuration()); } trimBuffers() { const { hls: t, details: e, media: n } = this; if (!n || null === e) return; if (!this.getSourceBufferTypes().length) return; const i = t.config, r = n.currentTime, a = e.levelTargetDuration, s = e.live && null !== i.liveBackBufferLength ? i.liveBackBufferLength : i.backBufferLength; if (X(s) && s > 0) { const t = Math.max(s, a), e = Math.floor(r / a) * a - t; this.flushBackBuffer(r, a, e); } if (X(i.frontBufferFlushThreshold) && i.frontBufferFlushThreshold > 0) { const t = Math.max(i.maxBufferLength, i.frontBufferFlushThreshold), e = Math.max(t, a), n = Math.floor(r / a) * a + e; this.flushFrontBuffer(r, a, n); } } flushBackBuffer(t, e, n) { const { details: i, sourceBuffer: r } = this; this.getSourceBufferTypes().forEach(a => { const s = r[a]; if (s) { const r = Li.getBuffered(s); if (r.length > 0 && n > r.start(0)) { if ((this.hls.trigger(tt.BACK_BUFFER_REACHED, { bufferEnd: n }), null != i && i.live)) this.hls.trigger(tt.LIVE_BACK_BUFFER_REACHED, { bufferEnd: n }); else if (s.ended && r.end(r.length - 1) - t < 2 * e) return void this.log( `Cannot flush ${a} back buffer while SourceBuffer is in ended state` ); this.hls.trigger(tt.BUFFER_FLUSHING, { startOffset: 0, endOffset: n, type: a }); } } }); } flushFrontBuffer(t, e, n) { const { sourceBuffer: i } = this; this.getSourceBufferTypes().forEach(r => { const a = i[r]; if (a) { const i = Li.getBuffered(a), s = i.length; if (s < 2) return; const o = i.start(s - 1), l = i.end(s - 1); if (n > o || (t >= o && t <= l)) return; if (a.ended && t - l < 2 * e) return void this.log( `Cannot flush ${r} front buffer while SourceBuffer is in ended state` ); this.hls.trigger(tt.BUFFER_FLUSHING, { startOffset: o, endOffset: 1 / 0, type: r }); } }); } updateMediaElementDuration() { if (!this.details || !this.media || !this.mediaSource || "open" !== this.mediaSource.readyState) return; const { details: t, hls: e, media: n, mediaSource: i } = this, r = t.fragments[0].start + t.totalduration, a = n.duration, s = X(i.duration) ? i.duration : 0; t.live && e.config.liveDurationInfinity ? ((i.duration = 1 / 0), this.updateSeekableRange(t)) : ((r > s && r > a) || !X(a)) && (this.log(`Updating Media Source duration to ${r.toFixed(3)}`), (i.duration = r)); } updateSeekableRange(t) { const e = this.mediaSource, n = t.fragments; if (n.length && t.live && null != e && e.setLiveSeekableRange) { const i = Math.max(0, n[0].start), r = Math.max(i, i + t.totalduration); this.log(`Media Source duration is set to ${e.duration}. Setting seekable range to ${i}-${r}.`), e.setLiveSeekableRange(i, r); } } checkPendingTracks() { const { bufferCodecEventsExpected: t, operationQueue: e, pendingTracks: n } = this, i = Object.keys(n).length; if (i && (!t || 2 === i || "audiovideo" in n)) { this.createSourceBuffers(n), (this.pendingTracks = {}); const t = this.getSourceBufferTypes(); if (t.length) this.hls.trigger(tt.BUFFER_CREATED, { tracks: this.tracks }), t.forEach(t => { e.executeNext(t); }); else { const t = new Error("could not create source buffer for media codec(s)"); this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_INCOMPATIBLE_CODECS_ERROR, fatal: !0, error: t, reason: t.message }); } } } createSourceBuffers(t) { const { sourceBuffer: e, mediaSource: n } = this; if (!n) throw Error("createSourceBuffers called when mediaSource was null"); for (const r in t) if (!e[r]) { var i; const a = t[r]; if (!a) throw Error(`source buffer exists for track ${r}, however track does not`); let s = -1 === (null == (i = a.levelCodec) ? void 0 : i.indexOf(",")) ? a.levelCodec : a.codec; s && "audio" === r.slice(0, 5) && (s = je(s, this.appendSource)); const o = `${a.container};codecs=${s}`; this.log(`creating sourceBuffer(${o})`); try { const t = (e[r] = n.addSourceBuffer(o)), i = r; this.addBufferListener(i, "updatestart", this._onSBUpdateStart), this.addBufferListener(i, "updateend", this._onSBUpdateEnd), this.addBufferListener(i, "error", this._onSBUpdateError), this.appendSource && this.addBufferListener(i, "bufferedchange", (t, e) => { const n = e.removedRanges; null != n && n.length && this.hls.trigger(tt.BUFFER_FLUSHED, { type: r }); }), (this.tracks[r] = { buffer: t, codec: s, container: a.container, levelCodec: a.levelCodec, metadata: a.metadata, id: a.id }); } catch (t) { this.error(`error while trying to add sourceBuffer: ${t.message}`), this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_ADD_CODEC_ERROR, fatal: !1, error: t, sourceBufferName: r, mimeType: o }); } } } get mediaSrc() { var t; const e = (null == (t = this.media) ? void 0 : t.firstChild) || this.media; return null == e ? void 0 : e.src; } _onSBUpdateStart(t) { const { operationQueue: e } = this; e.current(t).onStart(); } _onSBUpdateEnd(t) { var e; if ("closed" === (null == (e = this.mediaSource) ? void 0 : e.readyState)) return void this.resetBuffer(t); const { operationQueue: n } = this; n.current(t).onComplete(), n.shiftAndExecuteNext(t); } _onSBUpdateError(t, e) { var n; const i = new Error( `${t} SourceBuffer error. MediaSource readyState: ${null == (n = this.mediaSource) ? void 0 : n.readyState }` ); this.error(`${i}`, e), this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_APPENDING_ERROR, sourceBufferName: t, error: i, fatal: !1 }); const r = this.operationQueue.current(t); r && r.onError(i); } removeExecutor(t, e, n) { const { media: i, mediaSource: r, operationQueue: a, sourceBuffer: s } = this, o = s[t]; if (!i || !r || !o) return ( this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`), void a.shiftAndExecuteNext(t) ); const l = X(i.duration) ? i.duration : 1 / 0, d = X(r.duration) ? r.duration : 1 / 0, c = Math.max(0, e), u = Math.min(n, l, d); u > c && (!o.ending || o.ended) ? ((o.ended = !1), this.log(`Removing [${c},${u}] from the ${t} SourceBuffer`), o.remove(c, u)) : a.shiftAndExecuteNext(t); } appendExecutor(t, e) { const n = this.sourceBuffer[e]; if (n) (n.ended = !1), n.appendBuffer(t); else if (!this.pendingTracks[e]) throw new Error(`Attempting to append to the ${e} SourceBuffer, but it does not exist`); } blockBuffers(t, e = this.getSourceBufferTypes()) { if (!e.length) return ( this.log("Blocking operation requested, but no SourceBuffers exist"), void Promise.resolve().then(t) ); const { operationQueue: n } = this, i = e.map(t => n.appendBlocker(t)); Promise.all(i).then(() => { t(), e.forEach(t => { const e = this.sourceBuffer[t]; (null != e && e.updating) || n.shiftAndExecuteNext(t); }); }); } getSourceBufferTypes() { return Object.keys(this.sourceBuffer); } addBufferListener(t, e, n) { const i = this.sourceBuffer[t]; if (!i) return; const r = n.bind(this, t); this.listeners[t].push({ event: e, listener: r }), i.addEventListener(e, r); } removeBufferListeners(t) { const e = this.sourceBuffer[t]; e && this.listeners[t].forEach(t => { e.removeEventListener(t.event, t.listener); }); } }, capLevelController: ps, errorController: class { constructor(t) { (this.hls = void 0), (this.playlistError = 0), (this.penalizedRenditions = {}), (this.log = void 0), (this.warn = void 0), (this.error = void 0), (this.hls = t), (this.log = ot.log.bind(ot, "[info]:")), (this.warn = ot.warn.bind(ot, "[warning]:")), (this.error = ot.error.bind(ot, "[error]:")), this.registerListeners(); } registerListeners() { const t = this.hls; t.on(tt.ERROR, this.onError, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.LEVEL_UPDATED, this.onLevelUpdated, this); } unregisterListeners() { const t = this.hls; t && (t.off(tt.ERROR, this.onError, this), t.off(tt.ERROR, this.onErrorOut, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.LEVEL_UPDATED, this.onLevelUpdated, this)); } destroy() { this.unregisterListeners(), (this.hls = null), (this.penalizedRenditions = {}); } startLoad(t) { } stopLoad() { this.playlistError = 0; } getVariantLevelIndex(t) { return (null == t ? void 0 : t.type) === ln ? t.level : this.hls.loadLevel; } onManifestLoading() { (this.playlistError = 0), (this.penalizedRenditions = {}); } onLevelUpdated() { this.playlistError = 0; } onError(t, e) { var n, i; if (e.fatal) return; const r = this.hls, a = e.context; switch (e.details) { case nt.FRAG_LOAD_ERROR: case nt.FRAG_LOAD_TIMEOUT: case nt.KEY_LOAD_ERROR: case nt.KEY_LOAD_TIMEOUT: return void (e.errorAction = this.getFragRetryOrSwitchAction(e)); case nt.FRAG_PARSING_ERROR: if (null != (n = e.frag) && n.gap) return void (e.errorAction = { action: ti, flags: ri }); case nt.FRAG_GAP: case nt.FRAG_DECRYPT_ERROR: return (e.errorAction = this.getFragRetryOrSwitchAction(e)), void (e.errorAction.action = ei); case nt.LEVEL_EMPTY_ERROR: case nt.LEVEL_PARSING_ERROR: { var s, o; const t = e.parent === ln ? e.level : r.loadLevel; e.details === nt.LEVEL_EMPTY_ERROR && null != (s = e.context) && null != (o = s.levelDetails) && o.live ? (e.errorAction = this.getPlaylistRetryOrSwitchAction(e, t)) : ((e.levelRetry = !1), (e.errorAction = this.getLevelSwitchAction(e, t))); } return; case nt.LEVEL_LOAD_ERROR: case nt.LEVEL_LOAD_TIMEOUT: return void ( "number" == typeof (null == a ? void 0 : a.level) && (e.errorAction = this.getPlaylistRetryOrSwitchAction(e, a.level)) ); case nt.AUDIO_TRACK_LOAD_ERROR: case nt.AUDIO_TRACK_LOAD_TIMEOUT: case nt.SUBTITLE_LOAD_ERROR: case nt.SUBTITLE_TRACK_LOAD_TIMEOUT: if (a) { const t = r.levels[r.loadLevel]; if ( t && ((a.type === sn && t.hasAudioGroup(a.groupId)) || (a.type === on && t.hasSubtitleGroup(a.groupId))) ) return ( (e.errorAction = this.getPlaylistRetryOrSwitchAction(e, r.loadLevel)), (e.errorAction.action = ei), void (e.errorAction.flags = ai) ); } return; case nt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED: { const t = r.levels[r.loadLevel], n = null == t ? void 0 : t.attrs["HDCP-LEVEL"]; n ? (e.errorAction = { action: ei, flags: si, hdcpLevel: n }) : this.keySystemError(e); } return; case nt.BUFFER_ADD_CODEC_ERROR: case nt.REMUX_ALLOC_ERROR: case nt.BUFFER_APPEND_ERROR: return void (e.errorAction = this.getLevelSwitchAction( e, null != (i = e.level) ? i : r.loadLevel )); case nt.INTERNAL_EXCEPTION: case nt.BUFFER_APPENDING_ERROR: case nt.BUFFER_FULL_ERROR: case nt.LEVEL_SWITCH_ERROR: case nt.BUFFER_STALLED_ERROR: case nt.BUFFER_SEEK_OVER_HOLE: case nt.BUFFER_NUDGE_ON_STALL: return void (e.errorAction = { action: ti, flags: ri }); } e.type === et.KEY_SYSTEM_ERROR && this.keySystemError(e); } keySystemError(t) { const e = this.getVariantLevelIndex(t.frag); (t.levelRetry = !1), (t.errorAction = this.getLevelSwitchAction(t, e)); } getPlaylistRetryOrSwitchAction(t, e) { const n = Kn(this.hls.config.playlistLoadPolicy, t), i = this.playlistError++; if (Wn(n, i, $n(t), t.response)) return { action: ii, flags: ri, retryConfig: n, retryCount: i }; const r = this.getLevelSwitchAction(t, e); return n && ((r.retryConfig = n), (r.retryCount = i)), r; } getFragRetryOrSwitchAction(t) { const e = this.hls, n = this.getVariantLevelIndex(t.frag), i = e.levels[n], { fragLoadPolicy: r, keyLoadPolicy: a } = e.config, s = Kn(t.details.startsWith("key") ? a : r, t), o = e.levels.reduce((t, e) => t + e.fragmentError, 0); if (i) { t.details !== nt.FRAG_GAP && i.fragmentError++; if (Wn(s, o, $n(t), t.response)) return { action: ii, flags: ri, retryConfig: s, retryCount: o }; } const l = this.getLevelSwitchAction(t, n); return s && ((l.retryConfig = s), (l.retryCount = o)), l; } getLevelSwitchAction(t, e) { const n = this.hls; null == e && (e = n.loadLevel); const i = this.hls.levels[e]; if (i) { var r, a; const e = t.details; i.loadError++, e === nt.BUFFER_APPEND_ERROR && i.fragmentError++; let l = -1; const { levels: d, loadLevel: c, minAutoLevel: u, maxAutoLevel: h } = n; n.autoLevelEnabled || (n.loadLevel = -1); const p = null == (r = t.frag) ? void 0 : r.type, f = ((p === dn && e === nt.FRAG_PARSING_ERROR) || ("audio" === t.sourceBufferName && (e === nt.BUFFER_ADD_CODEC_ERROR || e === nt.BUFFER_APPEND_ERROR))) && d.some(({ audioCodec: t }) => i.audioCodec !== t), m = "video" === t.sourceBufferName && (e === nt.BUFFER_ADD_CODEC_ERROR || e === nt.BUFFER_APPEND_ERROR) && d.some(({ codecSet: t, audioCodec: e }) => i.codecSet !== t && i.audioCodec === e), { type: g, groupId: y } = null != (a = t.context) ? a : {}; for (let n = d.length; n--;) { const r = (n + c) % d.length; if (r !== c && r >= u && r <= h && 0 === d[r].loadError) { var s, o; const n = d[r]; if (e === nt.FRAG_GAP && t.frag) { const e = d[r].details; if (e) { const n = Xn(t.frag, e.fragments, t.frag.start); if (null != n && n.gap) continue; } } else { if ((g === sn && n.hasAudioGroup(y)) || (g === on && n.hasSubtitleGroup(y))) continue; if ( (p === dn && null != (s = i.audioGroups) && s.some(t => n.hasAudioGroup(t))) || (p === cn && null != (o = i.subtitleGroups) && o.some(t => n.hasSubtitleGroup(t))) || (f && i.audioCodec === n.audioCodec) || (!f && i.audioCodec !== n.audioCodec) || (m && i.codecSet === n.codecSet) ) continue; } l = r; break; } } if (l > -1 && n.loadLevel !== l) return ( (t.levelRetry = !0), (this.playlistError = 0), { action: ei, flags: ri, nextAutoLevel: l } ); } return { action: ei, flags: ai }; } onErrorOut(t, e) { var n; switch (null == (n = e.errorAction) ? void 0 : n.action) { case ti: break; case ei: this.sendAlternateToPenaltyBox(e), e.errorAction.resolved || e.details === nt.FRAG_GAP ? /MediaSource readyState: ended/.test(e.error.message) && (this.warn( `MediaSource ended after "${e.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.` ), this.hls.recoverMediaError()) : (e.fatal = !0); } e.fatal && this.hls.stopLoad(); } sendAlternateToPenaltyBox(t) { const e = this.hls, n = t.errorAction; if (!n) return; const { flags: i, hdcpLevel: r, nextAutoLevel: a } = n; switch (i) { case ri: this.switchLevel(t, a); break; case si: r && ((e.maxHdcpLevel = Cn[Cn.indexOf(r) - 1]), (n.resolved = !0)), this.warn(`Restricting playback to HDCP-LEVEL of "${e.maxHdcpLevel}" or lower`); } n.resolved || this.switchLevel(t, a); } switchLevel(t, e) { void 0 !== e && t.errorAction && (this.warn(`switching to level ${e} after ${t.details}`), (this.hls.nextAutoLevel = e), (t.errorAction.resolved = !0), (this.hls.nextLoadLevel = this.hls.nextAutoLevel)); } }, fpsController: class { constructor(t) { (this.hls = void 0), (this.isVideoPlaybackQualityAvailable = !1), (this.timer = void 0), (this.media = null), (this.lastTime = void 0), (this.lastDroppedFrames = 0), (this.lastDecodedFrames = 0), (this.streamController = void 0), (this.hls = t), this.registerListeners(); } setStreamController(t) { this.streamController = t; } registerListeners() { this.hls.on(tt.MEDIA_ATTACHING, this.onMediaAttaching, this); } unregisterListeners() { this.hls.off(tt.MEDIA_ATTACHING, this.onMediaAttaching, this); } destroy() { this.timer && clearInterval(this.timer), this.unregisterListeners(), (this.isVideoPlaybackQualityAvailable = !1), (this.media = null); } onMediaAttaching(t, e) { const n = this.hls.config; if (n.capLevelOnFPSDrop) { const t = e.media instanceof self.HTMLVideoElement ? e.media : null; (this.media = t), t && "function" == typeof t.getVideoPlaybackQuality && (this.isVideoPlaybackQualityAvailable = !0), self.clearInterval(this.timer), (this.timer = self.setInterval( this.checkFPSInterval.bind(this), n.fpsDroppedMonitoringPeriod )); } } checkFPS(t, e, n) { const i = performance.now(); if (e) { if (this.lastTime) { const t = i - this.lastTime, r = n - this.lastDroppedFrames, a = e - this.lastDecodedFrames, s = (1e3 * r) / t, o = this.hls; if ( (o.trigger(tt.FPS_DROP, { currentDropped: r, currentDecoded: a, totalDroppedFrames: n }), s > 0 && r > o.config.fpsDroppedMonitoringThreshold * a) ) { let t = o.currentLevel; ot.warn("drop FPS ratio greater than max allowed value for currentLevel: " + t), t > 0 && (-1 === o.autoLevelCapping || o.autoLevelCapping >= t) && ((t -= 1), o.trigger(tt.FPS_DROP_LEVEL_CAPPING, { level: t, droppedLevel: o.currentLevel }), (o.autoLevelCapping = t), this.streamController.nextLevelSwitch()); } } (this.lastTime = i), (this.lastDroppedFrames = n), (this.lastDecodedFrames = e); } } checkFPSInterval() { const t = this.media; if (t) if (this.isVideoPlaybackQualityAvailable) { const e = t.getVideoPlaybackQuality(); this.checkFPS(t, e.totalVideoFrames, e.droppedVideoFrames); } else this.checkFPS(t, t.webkitDecodedFrameCount, t.webkitDroppedFrameCount); } }, stretchShortVideoTrack: !1, maxAudioFramesDrift: 1, forceKeyFrameOnDiscontinuity: !0, abrEwmaFastLive: 3, abrEwmaSlowLive: 9, abrEwmaFastVoD: 3, abrEwmaSlowVoD: 9, abrEwmaDefaultEstimate: 5e5, abrEwmaDefaultEstimateMax: 5e6, abrBandWidthFactor: 0.95, abrBandWidthUpFactor: 0.7, abrMaxWithRealBitrate: !1, maxStarvationDelay: 4, maxLoadingDelay: 4, minAutoBitrate: 0, emeEnabled: !1, widevineLicenseUrl: void 0, drmSystems: {}, drmSystemOptions: {}, requestMediaKeySystemAccessFunc: Pt, testBandwidth: !0, progressive: !1, lowLatencyMode: !0, cmcd: void 0, enableDateRangeMetadataCues: !0, enableEmsgMetadataCues: !0, enableID3MetadataCues: !0, useMediaCapabilities: !0, certLoadPolicy: { default: { maxTimeToFirstByteMs: 8e3, maxLoadTimeMs: 2e4, timeoutRetry: null, errorRetry: null } }, keyLoadPolicy: { default: { maxTimeToFirstByteMs: 8e3, maxLoadTimeMs: 2e4, timeoutRetry: { maxNumRetry: 1, retryDelayMs: 1e3, maxRetryDelayMs: 2e4, backoff: "linear" }, errorRetry: { maxNumRetry: 8, retryDelayMs: 1e3, maxRetryDelayMs: 2e4, backoff: "linear" } } }, manifestLoadPolicy: { default: { maxTimeToFirstByteMs: 1 / 0, maxLoadTimeMs: 2e4, timeoutRetry: { maxNumRetry: 2, retryDelayMs: 0, maxRetryDelayMs: 0 }, errorRetry: { maxNumRetry: 1, retryDelayMs: 1e3, maxRetryDelayMs: 8e3 } } }, playlistLoadPolicy: { default: { maxTimeToFirstByteMs: 1e4, maxLoadTimeMs: 2e4, timeoutRetry: { maxNumRetry: 2, retryDelayMs: 0, maxRetryDelayMs: 0 }, errorRetry: { maxNumRetry: 2, retryDelayMs: 1e3, maxRetryDelayMs: 8e3 } } }, fragLoadPolicy: { default: { maxTimeToFirstByteMs: 1e4, maxLoadTimeMs: 12e4, timeoutRetry: { maxNumRetry: 4, retryDelayMs: 0, maxRetryDelayMs: 0 }, errorRetry: { maxNumRetry: 6, retryDelayMs: 1e3, maxRetryDelayMs: 8e3 } } }, steeringManifestLoadPolicy: { default: { maxTimeToFirstByteMs: 1e4, maxLoadTimeMs: 2e4, timeoutRetry: { maxNumRetry: 2, retryDelayMs: 0, maxRetryDelayMs: 0 }, errorRetry: { maxNumRetry: 1, retryDelayMs: 1e3, maxRetryDelayMs: 8e3 } } }, manifestLoadingTimeOut: 1e4, manifestLoadingMaxRetry: 1, manifestLoadingRetryDelay: 1e3, manifestLoadingMaxRetryTimeout: 64e3, levelLoadingTimeOut: 1e4, levelLoadingMaxRetry: 4, levelLoadingRetryDelay: 1e3, levelLoadingMaxRetryTimeout: 64e3, fragLoadingTimeOut: 2e4, fragLoadingMaxRetry: 6, fragLoadingRetryDelay: 1e3, fragLoadingMaxRetryTimeout: 64e3 }, { cueHandler: uo, enableWebVTT: !0, enableIMSC1: !0, enableCEA708Captions: !0, captionsTextTrack1Label: "English", captionsTextTrack1LanguageCode: "en", captionsTextTrack2Label: "Spanish", captionsTextTrack2LanguageCode: "es", captionsTextTrack3Label: "Unknown CC", captionsTextTrack3LanguageCode: "", captionsTextTrack4Label: "Unknown CC", captionsTextTrack4LanguageCode: "", renderTextTracksNatively: !0 } ), {}, { subtitleStreamController: class extends rr { constructor(t, e, n) { super(t, e, n, "[subtitle-stream-controller]", cn), (this.currentTrackId = -1), (this.tracksBuffered = []), (this.mainDetails = null), this._registerListeners(); } onHandlerDestroying() { this._unregisterListeners(), super.onHandlerDestroying(), (this.mainDetails = null); } _registerListeners() { const { hls: t } = this; t.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.on(tt.ERROR, this.onError, this), t.on(tt.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.on(tt.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), t.on(tt.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.on(tt.SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), t.on(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(tt.FRAG_BUFFERED, this.onFragBuffered, this); } _unregisterListeners() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.off(tt.ERROR, this.onError, this), t.off(tt.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.off(tt.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), t.off(tt.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.off(tt.SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), t.off(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(tt.FRAG_BUFFERED, this.onFragBuffered, this); } startLoad(t) { this.stopLoad(), (this.state = qi), this.setInterval(500), (this.nextLoadPosition = this.startPosition = this.lastCurrentTime = t), this.tick(); } onManifestLoading() { (this.mainDetails = null), this.fragmentTracker.removeAllFragments(); } onMediaDetaching() { (this.tracksBuffered = []), super.onMediaDetaching(); } onLevelLoaded(t, e) { this.mainDetails = e.details; } onSubtitleFragProcessed(t, e) { const { frag: n, success: i } = e; if (((this.fragPrevious = n), (this.state = qi), !i)) return; const r = this.tracksBuffered[this.currentTrackId]; if (!r) return; let a; const s = n.start; for (let t = 0; t < r.length; t++) if (s >= r[t].start && s <= r[t].end) { a = r[t]; break; } const o = n.start + n.duration; a ? (a.end = o) : ((a = { start: s, end: o }), r.push(a)), this.fragmentTracker.fragBuffered(n), this.fragBufferedComplete(n, null); } onBufferFlushing(t, e) { const { startOffset: n, endOffset: i } = e; if (0 === n && i !== Number.POSITIVE_INFINITY) { const t = i - 1; if (t <= 0) return; (e.endOffsetSubtitles = Math.max(0, t)), this.tracksBuffered.forEach(e => { for (let n = 0; n < e.length;) if (e[n].end <= t) e.shift(); else { if (!(e[n].start < t)) break; (e[n].start = t), n++; } }), this.fragmentTracker.removeFragmentsInRange(n, t, cn); } } onFragBuffered(t, e) { var n; this.loadedmetadata || e.frag.type !== ln || (null != (n = this.media) && n.buffered.length && (this.loadedmetadata = !0)); } onError(t, e) { const n = e.frag; (null == n ? void 0 : n.type) === cn && (this.fragCurrent && this.fragCurrent.abortRequests(), this.state !== Ki && (this.state = qi)); } onSubtitleTracksUpdated(t, { subtitleTracks: e }) { this.levels && ha(this.levels, e) ? (this.levels = e.map(t => new Un(t))) : ((this.tracksBuffered = []), (this.levels = e.map(t => { const e = new Un(t); return (this.tracksBuffered[e.id] = []), e; })), this.fragmentTracker.removeFragmentsInRange(0, Number.POSITIVE_INFINITY, cn), (this.fragPrevious = null), (this.mediaBuffer = null)); } onSubtitleTrackSwitch(t, e) { var n; if (((this.currentTrackId = e.id), null == (n = this.levels) || !n.length || -1 === this.currentTrackId)) return void this.clearInterval(); const i = this.levels[this.currentTrackId]; null != i && i.details ? (this.mediaBuffer = this.mediaBufferTimeRanges) : (this.mediaBuffer = null), i && this.setInterval(500); } onSubtitleTrackLoaded(t, e) { var n; const { currentTrackId: i, levels: r } = this, { details: a, id: s } = e; if (!r) return void this.warn(`Subtitle tracks were reset while loading level ${s}`); const o = r[i]; if (s >= r.length || s !== i || !o) return; this.log( `Subtitle track ${s} loaded [${a.startSN},${a.endSN}]${a.lastPartSn ? `[part-${a.lastPartSn}-${a.lastPartIndex}]` : "" },duration:${a.totalduration}` ), (this.mediaBuffer = this.mediaBufferTimeRanges); let l = 0; if (a.live || (null != (n = o.details) && n.live)) { const t = this.mainDetails; if (a.deltaUpdateFailed || !t) return; const e = t.fragments[0]; var d; if (o.details) (l = this.alignPlaylists(a, o.details, null == (d = this.levelLastLoaded) ? void 0 : d.details)), 0 === l && e && ((l = e.start), Gn(a, l)); else a.hasProgramDateTime && t.hasProgramDateTime ? (Ui(a, t), (l = a.fragments[0].start)) : e && ((l = e.start), Gn(a, l)); } if ( ((o.details = a), (this.levelLastLoaded = o), this.startFragRequested || (!this.mainDetails && a.live) || this.setStartPosition(this.mainDetails || a, l), this.tick(), a.live && !this.fragCurrent && this.media && this.state === qi) ) { Xn(null, a.fragments, this.media.currentTime, 0) || (this.warn("Subtitle playlist not aligned with playback"), (o.details = void 0)); } } _handleFragmentLoadComplete(t) { const { frag: e, payload: n } = t, i = e.decryptdata, r = this.hls; if ( !this.fragContextChanged(e) && n && n.byteLength > 0 && null != i && i.key && i.iv && "AES-128" === i.method ) { const t = performance.now(); this.decrypter .decrypt(new Uint8Array(n), i.key.buffer, i.iv.buffer) .catch(t => { throw ( (r.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.FRAG_DECRYPT_ERROR, fatal: !1, error: t, reason: t.message, frag: e }), t) ); }) .then(n => { const i = performance.now(); r.trigger(tt.FRAG_DECRYPTED, { frag: e, payload: n, stats: { tstart: t, tdecrypt: i } }); }) .catch(t => { this.warn(`${t.name}: ${t.message}`), (this.state = qi); }); } } doTick() { if (this.media) { if (this.state === qi) { const { currentTrackId: t, levels: e } = this, n = null == e ? void 0 : e[t]; if (!n || !e.length || !n.details) return; const { config: i } = this, r = this.getLoadPosition(), a = Li.bufferedInfo(this.tracksBuffered[this.currentTrackId] || [], r, i.maxBufferHole), { end: s, len: o } = a, l = this.getFwdBufferInfo(this.media, ln), d = n.details; if (o > this.getMaxBufferLength(null == l ? void 0 : l.len) + d.levelTargetDuration) return; const c = d.fragments, u = c.length, h = d.edge; let p = null; const f = this.fragPrevious; if (s < h) { const t = i.maxFragLookUpTolerance, e = s > h - t ? 0 : t; (p = Xn(f, c, Math.max(c[0].start, s), e)), !p && f && f.start < c[0].start && (p = c[0]); } else p = c[u - 1]; if (!p) return; if (((p = this.mapToInitFragWhenRequired(p)), "initSegment" !== p.sn)) { const t = c[p.sn - d.startSN - 1]; t && t.cc === p.cc && this.fragmentTracker.getState(t) === Ei && (p = t); } this.fragmentTracker.getState(p) === Ei && this.loadFragment(p, n, s); } } else this.state = qi; } getMaxBufferLength(t) { const e = super.getMaxBufferLength(); return t ? Math.max(e, t) : e; } loadFragment(t, e, n) { (this.fragCurrent = t), "initSegment" === t.sn ? this._loadInitSegment(t, e) : ((this.startFragRequested = !0), super.loadFragment(t, e, n)); } get mediaBufferTimeRanges() { return new ma(this.tracksBuffered[this.currentTrackId] || []); } }, subtitleTrackController: class extends oi { constructor(t) { super(t, "[subtitle-track-controller]"), (this.media = null), (this.tracks = []), (this.groupIds = null), (this.tracksInGroup = []), (this.trackId = -1), (this.currentTrack = null), (this.selectDefaultTrack = !0), (this.queuedDefaultTrack = -1), (this.asyncPollTrackChange = () => this.pollTrackChange(0)), (this.useTextTrackPolling = !1), (this.subtitlePollingInterval = -1), (this._subtitleDisplay = !0), (this.onTextTracksChanged = () => { if ( (this.useTextTrackPolling || self.clearInterval(this.subtitlePollingInterval), !this.media || !this.hls.config.renderTextTracksNatively) ) return; let t = null; const e = An(this.media.textTracks); for (let n = 0; n < e.length; n++) if ("hidden" === e[n].mode) t = e[n]; else if ("showing" === e[n].mode) { t = e[n]; break; } const n = this.findTrackForTextTrack(t); this.subtitleTrack !== n && this.setSubtitleTrack(n); }), this.registerListeners(); } destroy() { this.unregisterListeners(), (this.tracks.length = 0), (this.tracksInGroup.length = 0), (this.currentTrack = null), (this.onTextTracksChanged = this.asyncPollTrackChange = null), super.destroy(); } get subtitleDisplay() { return this._subtitleDisplay; } set subtitleDisplay(t) { (this._subtitleDisplay = t), this.trackId > -1 && this.toggleTrackModes(); } registerListeners() { const { hls: t } = this; t.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.on(tt.LEVEL_LOADING, this.onLevelLoading, this), t.on(tt.LEVEL_SWITCHING, this.onLevelSwitching, this), t.on(tt.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.on(tt.ERROR, this.onError, this); } unregisterListeners() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.off(tt.LEVEL_LOADING, this.onLevelLoading, this), t.off(tt.LEVEL_SWITCHING, this.onLevelSwitching, this), t.off(tt.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), t.off(tt.ERROR, this.onError, this); } onMediaAttached(t, e) { (this.media = e.media), this.media && (this.queuedDefaultTrack > -1 && ((this.subtitleTrack = this.queuedDefaultTrack), (this.queuedDefaultTrack = -1)), (this.useTextTrackPolling = !(this.media.textTracks && "onchange" in this.media.textTracks)), this.useTextTrackPolling ? this.pollTrackChange(500) : this.media.textTracks.addEventListener("change", this.asyncPollTrackChange)); } pollTrackChange(t) { self.clearInterval(this.subtitlePollingInterval), (this.subtitlePollingInterval = self.setInterval(this.onTextTracksChanged, t)); } onMediaDetaching() { if (!this.media) return; self.clearInterval(this.subtitlePollingInterval), this.useTextTrackPolling || this.media.textTracks.removeEventListener("change", this.asyncPollTrackChange), this.trackId > -1 && (this.queuedDefaultTrack = this.trackId); An(this.media.textTracks).forEach(t => { gn(t); }), (this.subtitleTrack = -1), (this.media = null); } onManifestLoading() { (this.tracks = []), (this.groupIds = null), (this.tracksInGroup = []), (this.trackId = -1), (this.currentTrack = null), (this.selectDefaultTrack = !0); } onManifestParsed(t, e) { this.tracks = e.subtitleTracks; } onSubtitleTrackLoaded(t, e) { const { id: n, groupId: i, details: r } = e, a = this.tracksInGroup[n]; if (!a || a.groupId !== i) return void this.warn( `Subtitle track with id:${n} and group:${i} not found in active group ${null == a ? void 0 : a.groupId }` ); const s = a.details; (a.details = e.details), this.log( `Subtitle track ${n} "${a.name}" lang:${a.lang} group:${i} loaded [${r.startSN}-${r.endSN}]` ), n === this.trackId && this.playlistLoaded(n, e, s); } onLevelLoading(t, e) { this.switchLevel(e.level); } onLevelSwitching(t, e) { this.switchLevel(e.level); } switchLevel(t) { const e = this.hls.levels[t]; if (!e) return; const n = e.subtitleGroups || null, i = this.groupIds; let r = this.currentTrack; if ( !n || (null == i ? void 0 : i.length) !== (null == n ? void 0 : n.length) || (null != n && n.some(t => -1 === (null == i ? void 0 : i.indexOf(t)))) ) { (this.groupIds = n), (this.trackId = -1), (this.currentTrack = null); const t = this.tracks.filter(t => !n || -1 !== n.indexOf(t.groupId)); if (t.length) this.selectDefaultTrack && !t.some(t => t.default) && (this.selectDefaultTrack = !1), t.forEach((t, e) => { t.id = e; }); else if (!r && !this.tracksInGroup.length) return; this.tracksInGroup = t; const e = this.hls.config.subtitlePreference; if (!r && e) { this.selectDefaultTrack = !1; const n = gi(e, t); if (n > -1) r = t[n]; else { const t = gi(e, this.tracks); r = this.tracks[t]; } } let i = this.findTrackId(r); -1 === i && r && (i = this.findTrackId(null)); const a = { subtitleTracks: t }; this.log( `Updating subtitle tracks, ${t.length} track(s) found in "${null == n ? void 0 : n.join(",") }" group-id` ), this.hls.trigger(tt.SUBTITLE_TRACKS_UPDATED, a), -1 !== i && -1 === this.trackId && this.setSubtitleTrack(i); } else this.shouldReloadPlaylist(r) && this.setSubtitleTrack(this.trackId); } findTrackId(t) { const e = this.tracksInGroup, n = this.selectDefaultTrack; for (let i = 0; i < e.length; i++) { const r = e[i]; if ((!n || r.default) && (n || t) && (!t || yi(r, t))) return i; } if (t) { for (let n = 0; n < e.length; n++) { const i = e[n]; if (pa(t.attrs, i.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"])) return n; } for (let n = 0; n < e.length; n++) { const i = e[n]; if (pa(t.attrs, i.attrs, ["LANGUAGE"])) return n; } } return -1; } findTrackForTextTrack(t) { if (t) { const e = this.tracksInGroup; for (let n = 0; n < e.length; n++) { if (fa(e[n], t)) return n; } } return -1; } onError(t, e) { !e.fatal && e.context && (e.context.type !== on || e.context.id !== this.trackId || (this.groupIds && -1 === this.groupIds.indexOf(e.context.groupId)) || this.checkRetry(e)); } get allSubtitleTracks() { return this.tracks; } get subtitleTracks() { return this.tracksInGroup; } get subtitleTrack() { return this.trackId; } set subtitleTrack(t) { (this.selectDefaultTrack = !1), this.setSubtitleTrack(t); } setSubtitleOption(t) { if (((this.hls.config.subtitlePreference = t), t)) { const e = this.allSubtitleTracks; if (((this.selectDefaultTrack = !1), e.length)) { const n = this.currentTrack; if (n && yi(t, n)) return n; const i = gi(t, this.tracksInGroup); if (i > -1) { const t = this.tracksInGroup[i]; return this.setSubtitleTrack(i), t; } if (n) return null; { const n = gi(t, e); if (n > -1) return e[n]; } } } return null; } loadPlaylist(t) { super.loadPlaylist(); const e = this.currentTrack; if (this.shouldLoadPlaylist(e) && e) { const n = e.id, i = e.groupId; let r = e.url; if (t) try { r = t.addDirectives(r); } catch (t) { this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`); } this.log(`Loading subtitle playlist for id ${n}`), this.hls.trigger(tt.SUBTITLE_TRACK_LOADING, { url: r, id: n, groupId: i, deliveryDirectives: t || null }); } } toggleTrackModes() { const { media: t } = this; if (!t) return; const e = An(t.textTracks), n = this.currentTrack; let i; if ( (n && ((i = e.filter(t => fa(n, t))[0]), i || this.warn( `Unable to find subtitle TextTrack with name "${n.name}" and language "${n.lang}"` )), [].slice.call(e).forEach(t => { "disabled" !== t.mode && t !== i && (t.mode = "disabled"); }), i) ) { const t = this.subtitleDisplay ? "showing" : "hidden"; i.mode !== t && (i.mode = t); } } setSubtitleTrack(t) { const e = this.tracksInGroup; if (!this.media) return void (this.queuedDefaultTrack = t); if (t < -1 || t >= e.length || !X(t)) return void this.warn(`Invalid subtitle track id: ${t}`); this.clearTimer(), (this.selectDefaultTrack = !1); const n = this.currentTrack, i = e[t] || null; if (((this.trackId = t), (this.currentTrack = i), this.toggleTrackModes(), !i)) return void this.hls.trigger(tt.SUBTITLE_TRACK_SWITCH, { id: t }); const r = !!i.details && !i.details.live; if (t === this.trackId && i === n && r) return; this.log( `Switching to subtitle-track ${t}` + (i ? ` "${i.name}" lang:${i.lang} group:${i.groupId}` : "") ); const { id: a, groupId: s = "", name: o, type: l, url: d } = i; this.hls.trigger(tt.SUBTITLE_TRACK_SWITCH, { id: a, groupId: s, name: o, type: l, url: d }); const c = this.switchParams(i.url, null == n ? void 0 : n.details, i.details); this.loadPlaylist(c); } }, timelineController: class { constructor(t) { (this.hls = void 0), (this.media = null), (this.config = void 0), (this.enabled = !0), (this.Cues = void 0), (this.textTracks = []), (this.tracks = []), (this.initPTS = []), (this.unparsedVttFrags = []), (this.captionsTracks = {}), (this.nonNativeCaptionsTracks = {}), (this.cea608Parser1 = void 0), (this.cea608Parser2 = void 0), (this.lastCc = -1), (this.lastSn = -1), (this.lastPartIndex = -1), (this.prevCC = -1), (this.vttCCs = { ccOffset: 0, presentationOffset: 0, 0: { start: 0, prevCC: -1, new: !0 } }), (this.captionsProperties = void 0), (this.hls = t), (this.config = t.config), (this.Cues = t.config.cueHandler), (this.captionsProperties = { textTrack1: { label: this.config.captionsTextTrack1Label, languageCode: this.config.captionsTextTrack1LanguageCode }, textTrack2: { label: this.config.captionsTextTrack2Label, languageCode: this.config.captionsTextTrack2LanguageCode }, textTrack3: { label: this.config.captionsTextTrack3Label, languageCode: this.config.captionsTextTrack3LanguageCode }, textTrack4: { label: this.config.captionsTextTrack4Label, languageCode: this.config.captionsTextTrack4LanguageCode } }), t.on(tt.MEDIA_ATTACHING, this.onMediaAttaching, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_LOADED, this.onManifestLoaded, this), t.on(tt.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.on(tt.FRAG_LOADING, this.onFragLoading, this), t.on(tt.FRAG_LOADED, this.onFragLoaded, this), t.on(tt.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), t.on(tt.FRAG_DECRYPTED, this.onFragDecrypted, this), t.on(tt.INIT_PTS_FOUND, this.onInitPtsFound, this), t.on(tt.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), t.on(tt.BUFFER_FLUSHING, this.onBufferFlushing, this); } destroy() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHING, this.onMediaAttaching, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_LOADED, this.onManifestLoaded, this), t.off(tt.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), t.off(tt.FRAG_LOADING, this.onFragLoading, this), t.off(tt.FRAG_LOADED, this.onFragLoaded, this), t.off(tt.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), t.off(tt.FRAG_DECRYPTED, this.onFragDecrypted, this), t.off(tt.INIT_PTS_FOUND, this.onInitPtsFound, this), t.off(tt.SUBTITLE_TRACKS_CLEARED, this.onSubtitleTracksCleared, this), t.off(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), (this.hls = this.config = null), (this.cea608Parser1 = this.cea608Parser2 = void 0); } initCea608Parsers() { if (this.config.enableCEA708Captions && (!this.cea608Parser1 || !this.cea608Parser2)) { const t = new Ma(this, "textTrack1"), e = new Ma(this, "textTrack2"), n = new Ma(this, "textTrack3"), i = new Ma(this, "textTrack4"); (this.cea608Parser1 = new Ua(1, t, e)), (this.cea608Parser2 = new Ua(3, n, i)); } } addCues(t, e, n, i, r) { let a = !1; for (let t = r.length; t--;) { const i = r[t], c = ((s = i[0]), (o = i[1]), (l = e), (d = n), Math.min(o, d) - Math.max(s, l)); if (c >= 0 && ((i[0] = Math.min(i[0], e)), (i[1] = Math.max(i[1], n)), (a = !0), c / (n - e) > 0.5)) return; } var s, o, l, d; if ((a || r.push([e, n]), this.config.renderTextTracksNatively)) { const r = this.captionsTracks[t]; this.Cues.newCue(r, e, n, i); } else { const r = this.Cues.newCue(null, e, n, i); this.hls.trigger(tt.CUES_PARSED, { type: "captions", cues: r, track: t }); } } onInitPtsFound(t, { frag: e, id: n, initPTS: i, timescale: r }) { const { unparsedVttFrags: a } = this; "main" === n && (this.initPTS[e.cc] = { baseTime: i, timescale: r }), a.length && ((this.unparsedVttFrags = []), a.forEach(t => { this.onFragLoaded(tt.FRAG_LOADED, t); })); } getExistingTrack(t, e) { const { media: n } = this; if (n) for (let i = 0; i < n.textTracks.length; i++) { const r = n.textTracks[i]; if (hs(r, { name: t, lang: e, attrs: {} })) return r; } return null; } createCaptionsTrack(t) { this.config.renderTextTracksNatively ? this.createNativeTrack(t) : this.createNonNativeTrack(t); } createNativeTrack(t) { if (this.captionsTracks[t]) return; const { captionsProperties: e, captionsTracks: n, media: i } = this, { label: r, languageCode: a } = e[t], s = this.getExistingTrack(r, a); if (s) (n[t] = s), gn(n[t]), fn(n[t], i); else { const e = this.createTextTrack("captions", r, a); e && ((e[t] = !0), (n[t] = e)); } } createNonNativeTrack(t) { if (this.nonNativeCaptionsTracks[t]) return; const e = this.captionsProperties[t]; if (!e) return; const n = { _id: t, label: e.label, kind: "captions", default: !!e.media && !!e.media.default, closedCaptions: e.media }; (this.nonNativeCaptionsTracks[t] = n), this.hls.trigger(tt.NON_NATIVE_TEXT_TRACKS_FOUND, { tracks: [n] }); } createTextTrack(t, e, n) { const i = this.media; if (i) return i.addTextTrack(t, e, n); } onMediaAttaching(t, e) { (this.media = e.media), this._cleanTracks(); } onMediaDetaching() { const { captionsTracks: t } = this; Object.keys(t).forEach(e => { gn(t[e]), delete t[e]; }), (this.nonNativeCaptionsTracks = {}); } onManifestLoading() { (this.lastCc = -1), (this.lastSn = -1), (this.lastPartIndex = -1), (this.prevCC = -1), (this.vttCCs = { ccOffset: 0, presentationOffset: 0, 0: { start: 0, prevCC: -1, new: !0 } }), this._cleanTracks(), (this.tracks = []), (this.captionsTracks = {}), (this.nonNativeCaptionsTracks = {}), (this.textTracks = []), (this.unparsedVttFrags = []), (this.initPTS = []), this.cea608Parser1 && this.cea608Parser2 && (this.cea608Parser1.reset(), this.cea608Parser2.reset()); } _cleanTracks() { const { media: t } = this; if (!t) return; const e = t.textTracks; if (e) for (let t = 0; t < e.length; t++) gn(e[t]); } onSubtitleTracksUpdated(t, e) { const n = e.subtitleTracks || [], i = n.some(t => t.textCodec === ts); if (this.config.enableWebVTT || (i && this.config.enableIMSC1)) { if (ha(this.tracks, n)) return void (this.tracks = n); if (((this.textTracks = []), (this.tracks = n), this.config.renderTextTracksNatively)) { const t = this.media, e = t ? An(t.textTracks) : null; if ( (this.tracks.forEach((t, n) => { let i; if (e) { let n = null; for (let i = 0; i < e.length; i++) if (e[i] && hs(e[i], t)) { (n = e[i]), (e[i] = null); break; } n && (i = n); } if (i) gn(i); else { const e = us(t); (i = this.createTextTrack(e, t.name, t.lang)), i && (i.mode = "disabled"); } i && this.textTracks.push(i); }), null != e && e.length) ) { const t = e.filter(t => null !== t).map(t => t.label); t.length && ot.warn( `Media element contains unused subtitle tracks: ${t.join( ", " )}. Replace media element for each source to clear TextTracks and captions menu.` ); } } else if (this.tracks.length) { const t = this.tracks.map(t => ({ label: t.name, kind: t.type.toLowerCase(), default: t.default, subtitleTrack: t })); this.hls.trigger(tt.NON_NATIVE_TEXT_TRACKS_FOUND, { tracks: t }); } } } onManifestLoaded(t, e) { this.config.enableCEA708Captions && e.captions && e.captions.forEach(t => { const e = /(?:CC|SERVICE)([1-4])/.exec(t.instreamId); if (!e) return; const n = `textTrack${e[1]}`, i = this.captionsProperties[n]; i && ((i.label = t.name), t.lang && (i.languageCode = t.lang), (i.media = t)); }); } closedCaptionsForLevel(t) { const e = this.hls.levels[t.level]; return null == e ? void 0 : e.attrs["CLOSED-CAPTIONS"]; } onFragLoading(t, e) { this.initCea608Parsers(); const { cea608Parser1: n, cea608Parser2: i, lastCc: r, lastSn: a, lastPartIndex: s } = this; if (this.enabled && n && i && e.frag.type === ln) { var o, l; const { cc: t, sn: d } = e.frag, c = null != (o = null == e || null == (l = e.part) ? void 0 : l.index) ? o : -1; d === a + 1 || (d === a && c === s + 1) || t === r || (n.reset(), i.reset()), (this.lastCc = t), (this.lastSn = d), (this.lastPartIndex = c); } } onFragLoaded(t, e) { const { frag: n, payload: i } = e; if (n.type === cn) if (i.byteLength) { const t = n.decryptdata, r = "stats" in e; if (null == t || !t.encrypted || r) { const t = this.tracks[n.level], r = this.vttCCs; r[n.cc] || ((r[n.cc] = { start: n.start, prevCC: this.prevCC, new: !0 }), (this.prevCC = n.cc)), t && t.textCodec === ts ? this._parseIMSC1(n, i) : this._parseVTTs(e); } } else this.hls.trigger(tt.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: n, error: new Error("Empty subtitle payload") }); } _parseIMSC1(t, e) { const n = this.hls; rs( e, this.initPTS[t.cc], e => { this._appendCues(e, t.level), n.trigger(tt.SUBTITLE_FRAG_PROCESSED, { success: !0, frag: t }); }, e => { ot.log(`Failed to parse IMSC1: ${e}`), n.trigger(tt.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: t, error: e }); } ); } _parseVTTs(t) { var e; const { frag: n, payload: i } = t, { initPTS: r, unparsedVttFrags: a } = this, s = r.length - 1; if (!r[n.cc] && -1 === s) return void a.push(t); const o = this.hls; Za( null != (e = n.initSegment) && e.data ? ve(n.initSegment.data, new Uint8Array(i)) : i, this.initPTS[n.cc], this.vttCCs, n.cc, n.start, t => { this._appendCues(t, n.level), o.trigger(tt.SUBTITLE_FRAG_PROCESSED, { success: !0, frag: n }); }, e => { const r = "Missing initPTS for VTT MPEGTS" === e.message; r ? a.push(t) : this._fallbackToIMSC1(n, i), ot.log(`Failed to parse VTT cue: ${e}`), (r && s > n.cc) || o.trigger(tt.SUBTITLE_FRAG_PROCESSED, { success: !1, frag: n, error: e }); } ); } _fallbackToIMSC1(t, e) { const n = this.tracks[t.level]; n.textCodec || rs( e, this.initPTS[t.cc], () => { (n.textCodec = ts), this._parseIMSC1(t, e); }, () => { n.textCodec = "wvtt"; } ); } _appendCues(t, e) { const n = this.hls; if (this.config.renderTextTracksNatively) { const n = this.textTracks[e]; if (!n || "disabled" === n.mode) return; t.forEach(t => mn(n, t)); } else { const i = this.tracks[e]; if (!i) return; const r = i.default ? "default" : "subtitles" + e; n.trigger(tt.CUES_PARSED, { type: "subtitles", cues: t, track: r }); } } onFragDecrypted(t, e) { const { frag: n } = e; n.type === cn && this.onFragLoaded(tt.FRAG_LOADED, e); } onSubtitleTracksCleared() { (this.tracks = []), (this.captionsTracks = {}); } onFragParsingUserdata(t, e) { this.initCea608Parsers(); const { cea608Parser1: n, cea608Parser2: i } = this; if (!this.enabled || !n || !i) return; const { frag: r, samples: a } = e; if (r.type !== ln || "NONE" !== this.closedCaptionsForLevel(r)) for (let t = 0; t < a.length; t++) { const e = a[t].bytes; if (e) { const r = this.extractCea608Data(e); n.addData(a[t].pts, r[0]), i.addData(a[t].pts, r[1]); } } } onBufferFlushing(t, { startOffset: e, endOffset: n, endOffsetSubtitles: i, type: r }) { const { media: a } = this; if (a && !(a.currentTime < n)) { if (!r || "video" === r) { const { captionsTracks: t } = this; Object.keys(t).forEach(i => yn(t[i], e, n)); } if (this.config.renderTextTracksNatively && 0 === e && void 0 !== i) { const { textTracks: t } = this; Object.keys(t).forEach(n => yn(t[n], e, i)); } } } extractCea608Data(t) { const e = [[], []], n = 31 & t[0]; let i = 2; for (let r = 0; r < n; r++) { const n = t[i++], r = 127 & t[i++], a = 127 & t[i++]; if (0 === r && 0 === a) continue; if (!!(4 & n)) { const t = 3 & n; (0 !== t && 1 !== t) || (e[t].push(r), e[t].push(a)); } } return e; } }, audioStreamController: class extends rr { constructor(t, e, n) { super(t, e, n, "[audio-stream-controller]", dn), (this.videoBuffer = null), (this.videoTrackCC = -1), (this.waitingVideoCC = -1), (this.bufferedTrack = null), (this.switchingTrack = null), (this.trackId = -1), (this.waitingData = null), (this.mainDetails = null), (this.flushing = !1), (this.bufferFlushed = !1), (this.cachedTrackLoadedData = null), this._registerListeners(); } onHandlerDestroying() { this._unregisterListeners(), super.onHandlerDestroying(), (this.mainDetails = null), (this.bufferedTrack = null), (this.switchingTrack = null); } _registerListeners() { const { hls: t } = this; t.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.on(tt.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), t.on(tt.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.on(tt.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.on(tt.ERROR, this.onError, this), t.on(tt.BUFFER_RESET, this.onBufferReset, this), t.on(tt.BUFFER_CREATED, this.onBufferCreated, this), t.on(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.on(tt.BUFFER_FLUSHED, this.onBufferFlushed, this), t.on(tt.INIT_PTS_FOUND, this.onInitPtsFound, this), t.on(tt.FRAG_BUFFERED, this.onFragBuffered, this); } _unregisterListeners() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.off(tt.AUDIO_TRACKS_UPDATED, this.onAudioTracksUpdated, this), t.off(tt.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.off(tt.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.off(tt.ERROR, this.onError, this), t.off(tt.BUFFER_RESET, this.onBufferReset, this), t.off(tt.BUFFER_CREATED, this.onBufferCreated, this), t.off(tt.BUFFER_FLUSHING, this.onBufferFlushing, this), t.off(tt.BUFFER_FLUSHED, this.onBufferFlushed, this), t.off(tt.INIT_PTS_FOUND, this.onInitPtsFound, this), t.off(tt.FRAG_BUFFERED, this.onFragBuffered, this); } onInitPtsFound(t, { frag: e, id: n, initPTS: i, timescale: r }) { if ("main" === n) { const t = e.cc; (this.initPTS[e.cc] = { baseTime: i, timescale: r }), this.log(`InitPTS for cc: ${t} found from main: ${i}`), (this.videoTrackCC = t), this.state === nr && this.tick(); } } startLoad(t) { if (!this.levels) return (this.startPosition = t), void (this.state = Ki); const e = this.lastCurrentTime; this.stopLoad(), this.setInterval(100), e > 0 && -1 === t ? (this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`), (t = e), (this.state = qi)) : ((this.loadedmetadata = !1), (this.state = Xi)), (this.nextLoadPosition = this.startPosition = this.lastCurrentTime = t), this.tick(); } doTick() { switch (this.state) { case qi: this.doTickIdle(); break; case Xi: { var t; const { levels: e, trackId: n } = this, i = null == e || null == (t = e[n]) ? void 0 : t.details; if (i) { if (this.waitForCdnTuneIn(i)) break; this.state = nr; } break; } case Qi: { var e; const t = performance.now(), n = this.retryDate; if (!n || t >= n || (null != (e = this.media) && e.seeking)) { const { levels: t, trackId: e } = this; this.log("RetryDate reached, switch back to IDLE state"), this.resetStartWhenNotLoaded((null == t ? void 0 : t[e]) || null), (this.state = qi); } break; } case nr: { const t = this.waitingData; if (t) { const { frag: e, part: n, cache: i, complete: r } = t; if (void 0 !== this.initPTS[e.cc]) { (this.waitingData = null), (this.waitingVideoCC = -1), (this.state = Wi); const t = { frag: e, part: n, payload: i.flush(), networkDetails: null }; this._handleFragmentLoadProgress(t), r && super._handleFragmentLoadComplete(t); } else if (this.videoTrackCC !== this.waitingVideoCC) this.log( `Waiting fragment cc (${e.cc}) cancelled because video is at cc ${this.videoTrackCC}` ), this.clearWaitingFragment(); else { const t = this.getLoadPosition(), n = Li.bufferInfo(this.mediaBuffer, t, this.config.maxBufferHole); Jn(n.end, this.config.maxFragLookUpTolerance, e) < 0 && (this.log( `Waiting fragment cc (${e.cc}) @ ${e.start} cancelled because another fragment at ${n.end} is needed` ), this.clearWaitingFragment()); } } else this.state = qi; } } this.onTickEnd(); } clearWaitingFragment() { const t = this.waitingData; t && (this.fragmentTracker.removeFragment(t.frag), (this.waitingData = null), (this.waitingVideoCC = -1), (this.state = qi)); } resetLoadingState() { this.clearWaitingFragment(), super.resetLoadingState(); } onTickEnd() { const { media: t } = this; null != t && t.readyState && (this.lastCurrentTime = t.currentTime); } doTickIdle() { const { hls: t, levels: e, media: n, trackId: i } = this, r = t.config; if ((!n && (this.startFragRequested || !r.startFragPrefetch)) || null == e || !e[i]) return; const a = e[i], s = a.details; if (!s || (s.live && this.levelLastLoaded !== a) || this.waitForCdnTuneIn(s)) return void (this.state = Xi); const o = this.mediaBuffer ? this.mediaBuffer : this.media; this.bufferFlushed && o && ((this.bufferFlushed = !1), this.afterBufferFlushed(o, ft, dn)); const l = this.getFwdBufferInfo(o, dn); if (null === l) return; const { bufferedTrack: d, switchingTrack: c } = this; if (!c && this._streamEnded(l, s)) return t.trigger(tt.BUFFER_EOS, { type: "audio" }), void (this.state = tr); const u = this.getFwdBufferInfo(this.videoBuffer ? this.videoBuffer : this.media, ln), h = l.len, p = this.getMaxBufferLength(null == u ? void 0 : u.len), f = s.fragments, m = f[0].start; let g = this.flushing ? this.getLoadPosition() : l.end; if (c && n) { const t = this.getLoadPosition(); d && !pa(c.attrs, d.attrs) && (g = t), s.PTSKnown && t < m && (l.end > m || l.nextStart) && (this.log("Alt audio track ahead of main track, seek to start of alt audio track"), (n.currentTime = m + 0.05)); } if (h >= p && !c && g < f[f.length - 1].start) return; let y = this.getNextFragment(g, s), A = !1; if ( (y && this.isLoopLoading(y, g) && ((A = !!y.gap), (y = this.getNextFragmentLoopLoading(y, s, l, ln, p))), !y) ) return void (this.bufferFlushed = !0); const v = u && y.start > u.end + s.targetduration; if (v || ((null == u || !u.len) && l.len)) { const t = this.getAppendedFrag(y.start, ln); if (null === t) return; if ( (A || (A = !!t.gap || (!!v && 0 === u.len)), (v && !A) || (A && l.nextStart && l.nextStart < t.end)) ) return; } this.loadFragment(y, a, g); } getMaxBufferLength(t) { const e = super.getMaxBufferLength(); return t ? Math.min(Math.max(e, t), this.config.maxMaxBufferLength) : e; } onMediaDetaching() { (this.videoBuffer = null), (this.bufferFlushed = this.flushing = !1), super.onMediaDetaching(); } onAudioTracksUpdated(t, { audioTracks: e }) { this.resetTransmuxer(), (this.levels = e.map(t => new Un(t))); } onAudioTrackSwitching(t, e) { const n = !!e.url; this.trackId = e.id; const { fragCurrent: i } = this; i && (i.abortRequests(), this.removeUnbufferedFrags(i.start)), this.resetLoadingState(), n ? this.setInterval(100) : this.resetTransmuxer(), n ? ((this.switchingTrack = e), (this.state = qi), this.flushAudioIfNeeded(e)) : ((this.switchingTrack = null), (this.bufferedTrack = e), (this.state = Ki)), this.tick(); } onManifestLoading() { this.fragmentTracker.removeAllFragments(), (this.startPosition = this.lastCurrentTime = 0), (this.bufferFlushed = this.flushing = !1), (this.levels = this.mainDetails = this.waitingData = this.bufferedTrack = this.cachedTrackLoadedData = this.switchingTrack = null), (this.startFragRequested = !1), (this.trackId = this.videoTrackCC = this.waitingVideoCC = -1); } onLevelLoaded(t, e) { (this.mainDetails = e.details), null !== this.cachedTrackLoadedData && (this.hls.trigger(tt.AUDIO_TRACK_LOADED, this.cachedTrackLoadedData), (this.cachedTrackLoadedData = null)); } onAudioTrackLoaded(t, e) { var n; if (null == this.mainDetails) return void (this.cachedTrackLoadedData = e); const { levels: i } = this, { details: r, id: a } = e; if (!i) return void this.warn(`Audio tracks were reset while loading level ${a}`); this.log( `Audio track ${a} loaded [${r.startSN},${r.endSN}]${r.lastPartSn ? `[part-${r.lastPartSn}-${r.lastPartIndex}]` : "" },duration:${r.totalduration}` ); const s = i[a]; let o = 0; if (r.live || (null != (n = s.details) && n.live)) { this.checkLiveUpdate(r); const t = this.mainDetails; if (r.deltaUpdateFailed || !t) return; var l; if (!s.details && r.hasProgramDateTime && t.hasProgramDateTime) Ui(r, t), (o = r.fragments[0].start); else o = this.alignPlaylists(r, s.details, null == (l = this.levelLastLoaded) ? void 0 : l.details); } (s.details = r), (this.levelLastLoaded = s), this.startFragRequested || (!this.mainDetails && r.live) || this.setStartPosition(this.mainDetails || r, o), this.state !== Xi || this.waitForCdnTuneIn(r) || (this.state = qi), this.tick(); } _handleFragmentLoadProgress(t) { var e; const { frag: n, part: i, payload: r } = t, { config: a, trackId: s, levels: o } = this; if (!o) return void this.warn( `Audio tracks were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered` ); const l = o[s]; if (!l) return void this.warn("Audio track is undefined on fragment load progress"); const d = l.details; if (!d) return ( this.warn("Audio track details undefined on fragment load progress"), void this.removeUnbufferedFrags(n.start) ); const c = a.defaultAudioCodec || l.audioCodec || "mp4a.40.2"; let u = this.transmuxer; u || (u = this.transmuxer = new ua( this.hls, dn, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this) )); const h = this.initPTS[n.cc], p = null == (e = n.initSegment) ? void 0 : e.data; if (void 0 !== h) { const t = !1, e = i ? i.index : -1, a = -1 !== e, s = new Ii(n.level, n.sn, n.stats.chunkCount, r.byteLength, e, a); u.push(r, p, c, "", n, i, d.totalduration, t, s, h); } else { this.log( `Unknown video PTS for cc ${n.cc}, waiting for video PTS before demuxing audio frag ${n.sn} of [${d.startSN} ,${d.endSN}],track ${s}` ); const { cache: t } = (this.waitingData = this.waitingData || { frag: n, part: i, cache: new ar(), complete: !1 }); t.push(new Uint8Array(r)), (this.waitingVideoCC = this.videoTrackCC), (this.state = nr); } } _handleFragmentLoadComplete(t) { this.waitingData ? (this.waitingData.complete = !0) : super._handleFragmentLoadComplete(t); } onBufferReset() { (this.mediaBuffer = this.videoBuffer = null), (this.loadedmetadata = !1); } onBufferCreated(t, e) { const n = e.tracks.audio; n && (this.mediaBuffer = n.buffer || null), e.tracks.video && (this.videoBuffer = e.tracks.video.buffer || null); } onFragBuffered(t, e) { const { frag: n, part: i } = e; if (n.type === dn) if (this.fragContextChanged(n)) this.warn( `Fragment ${n.sn}${i ? " p: " + i.index : ""} of level ${n.level } finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack ? this.switchingTrack.name : "false" }` ); else { if ("initSegment" !== n.sn) { this.fragPrevious = n; const t = this.switchingTrack; t && ((this.bufferedTrack = t), (this.switchingTrack = null), this.hls.trigger(tt.AUDIO_TRACK_SWITCHED, q({}, t))); } this.fragBufferedComplete(n, i); } else if (!this.loadedmetadata && n.type === ln) { const t = this.videoBuffer || this.media; if (t) { Li.getBuffered(t).length && (this.loadedmetadata = !0); } } } onError(t, e) { var n; if (e.fatal) this.state = er; else switch (e.details) { case nt.FRAG_GAP: case nt.FRAG_PARSING_ERROR: case nt.FRAG_DECRYPT_ERROR: case nt.FRAG_LOAD_ERROR: case nt.FRAG_LOAD_TIMEOUT: case nt.KEY_LOAD_ERROR: case nt.KEY_LOAD_TIMEOUT: this.onFragmentOrKeyLoadError(dn, e); break; case nt.AUDIO_TRACK_LOAD_ERROR: case nt.AUDIO_TRACK_LOAD_TIMEOUT: case nt.LEVEL_PARSING_ERROR: e.levelRetry || this.state !== Xi || (null == (n = e.context) ? void 0 : n.type) !== sn || (this.state = qi); break; case nt.BUFFER_APPEND_ERROR: case nt.BUFFER_FULL_ERROR: if (!e.parent || "audio" !== e.parent) return; if (e.details === nt.BUFFER_APPEND_ERROR) return void this.resetLoadingState(); this.reduceLengthAndFlushBuffer(e) && ((this.bufferedTrack = null), super.flushMainBuffer(0, Number.POSITIVE_INFINITY, "audio")); break; case nt.INTERNAL_EXCEPTION: this.recoverWorkerError(e); } } onBufferFlushing(t, { type: e }) { e !== mt && (this.flushing = !0); } onBufferFlushed(t, { type: e }) { if (e !== mt) { (this.flushing = !1), (this.bufferFlushed = !0), this.state === tr && (this.state = qi); const t = this.mediaBuffer || this.media; t && (this.afterBufferFlushed(t, e, dn), this.tick()); } } _handleTransmuxComplete(t) { var e; const n = "audio", { hls: i } = this, { remuxResult: r, chunkMeta: a } = t, s = this.getCurrentContext(a); if (!s) return void this.resetWhenMissingContext(a); const { frag: o, part: l, level: d } = s, { details: c } = d, { audio: u, text: h, id3: p, initSegment: f } = r; if (!this.fragContextChanged(o) && c) { if ( ((this.state = Ji), this.switchingTrack && u && this.completeAudioSwitch(this.switchingTrack), null != f && f.tracks) ) { const t = o.initSegment || o; this._bufferInitSegment(d, f.tracks, t, a), i.trigger(tt.FRAG_PARSING_INIT_SEGMENT, { frag: t, id: n, tracks: f.tracks }); } if (u) { const { startPTS: t, endPTS: e, startDTS: n, endDTS: i } = u; l && (l.elementaryStreams[ft] = { startPTS: t, endPTS: e, startDTS: n, endDTS: i }), o.setElementaryStreamInfo(ft, t, e, n, i), this.bufferFragmentData(u, o, l, a); } if (null != p && null != (e = p.samples) && e.length) { const t = Q({ id: n, frag: o, details: c }, p); i.trigger(tt.FRAG_PARSING_METADATA, t); } if (h) { const t = Q({ id: n, frag: o, details: c }, h); i.trigger(tt.FRAG_PARSING_USERDATA, t); } } else this.fragmentTracker.removeFragment(o); } _bufferInitSegment(t, e, n, i) { if (this.state !== Ji) return; e.video && delete e.video; const r = e.audio; if (!r) return; r.id = "audio"; const a = t.audioCodec; this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`), a && 1 === a.split(",").length && (r.levelCodec = a), this.hls.trigger(tt.BUFFER_CODECS, e); const s = r.initSegment; if (null != s && s.byteLength) { const t = { type: "audio", frag: n, part: null, chunkMeta: i, parent: n.type, data: s }; this.hls.trigger(tt.BUFFER_APPENDING, t); } this.tickImmediate(); } loadFragment(t, e, n) { const i = this.fragmentTracker.getState(t); var r; if (((this.fragCurrent = t), this.switchingTrack || i === Ei || i === xi)) if ("initSegment" === t.sn) this._loadInitSegment(t, e); else if (null != (r = e.details) && r.live && !this.initPTS[t.cc]) { this.log( `Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}` ), (this.state = nr); const n = this.mainDetails; n && n.fragments[0].start !== e.details.fragments[0].start && Ui(e.details, n); } else (this.startFragRequested = !0), super.loadFragment(t, e, n); else this.clearTrackerIfNeeded(t); } flushAudioIfNeeded(t) { const { media: e, bufferedTrack: n } = this, i = null == n ? void 0 : n.attrs, r = t.attrs; e && i && (i.CHANNELS !== r.CHANNELS || n.name !== t.name || n.lang !== t.lang) && (this.log("Switching audio track : flushing all audio"), super.flushMainBuffer(0, Number.POSITIVE_INFINITY, "audio"), (this.bufferedTrack = null)); } completeAudioSwitch(t) { const { hls: e } = this; this.flushAudioIfNeeded(t), (this.bufferedTrack = t), (this.switchingTrack = null), e.trigger(tt.AUDIO_TRACK_SWITCHED, q({}, t)); } }, audioTrackController: class extends oi { constructor(t) { super(t, "[audio-track-controller]"), (this.tracks = []), (this.groupIds = null), (this.tracksInGroup = []), (this.trackId = -1), (this.currentTrack = null), (this.selectDefaultTrack = !0), this.registerListeners(); } registerListeners() { const { hls: t } = this; t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.on(tt.LEVEL_LOADING, this.onLevelLoading, this), t.on(tt.LEVEL_SWITCHING, this.onLevelSwitching, this), t.on(tt.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.on(tt.ERROR, this.onError, this); } unregisterListeners() { const { hls: t } = this; t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.off(tt.LEVEL_LOADING, this.onLevelLoading, this), t.off(tt.LEVEL_SWITCHING, this.onLevelSwitching, this), t.off(tt.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), t.off(tt.ERROR, this.onError, this); } destroy() { this.unregisterListeners(), (this.tracks.length = 0), (this.tracksInGroup.length = 0), (this.currentTrack = null), super.destroy(); } onManifestLoading() { (this.tracks = []), (this.tracksInGroup = []), (this.groupIds = null), (this.currentTrack = null), (this.trackId = -1), (this.selectDefaultTrack = !0); } onManifestParsed(t, e) { this.tracks = e.audioTracks || []; } onAudioTrackLoaded(t, e) { const { id: n, groupId: i, details: r } = e, a = this.tracksInGroup[n]; if (!a || a.groupId !== i) return void this.warn( `Audio track with id:${n} and group:${i} not found in active group ${null == a ? void 0 : a.groupId }` ); const s = a.details; (a.details = e.details), this.log(`Audio track ${n} "${a.name}" lang:${a.lang} group:${i} loaded [${r.startSN}-${r.endSN}]`), n === this.trackId && this.playlistLoaded(n, e, s); } onLevelLoading(t, e) { this.switchLevel(e.level); } onLevelSwitching(t, e) { this.switchLevel(e.level); } switchLevel(t) { const e = this.hls.levels[t]; if (!e) return; const n = e.audioGroups || null, i = this.groupIds; let r = this.currentTrack; if ( !n || (null == i ? void 0 : i.length) !== (null == n ? void 0 : n.length) || (null != n && n.some(t => -1 === (null == i ? void 0 : i.indexOf(t)))) ) { (this.groupIds = n), (this.trackId = -1), (this.currentTrack = null); const t = this.tracks.filter(t => !n || -1 !== n.indexOf(t.groupId)); if (t.length) this.selectDefaultTrack && !t.some(t => t.default) && (this.selectDefaultTrack = !1), t.forEach((t, e) => { t.id = e; }); else if (!r && !this.tracksInGroup.length) return; this.tracksInGroup = t; const e = this.hls.config.audioPreference; if (!r && e) { const n = gi(e, t, Ai); if (n > -1) r = t[n]; else { const t = gi(e, this.tracks); r = this.tracks[t]; } } let i = this.findTrackId(r); -1 === i && r && (i = this.findTrackId(null)); const s = { audioTracks: t }; this.log( `Updating audio tracks, ${t.length} track(s) found in group(s): ${null == n ? void 0 : n.join(",") }` ), this.hls.trigger(tt.AUDIO_TRACKS_UPDATED, s); const o = this.trackId; if (-1 !== i && -1 === o) this.setAudioTrack(i); else if (t.length && -1 === o) { var a; const e = new Error( `No audio track selected for current audio group-ID(s): ${null == (a = this.groupIds) ? void 0 : a.join(",") } track count: ${t.length}` ); this.warn(e.message), this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.AUDIO_TRACK_LOAD_ERROR, fatal: !0, error: e }); } } else this.shouldReloadPlaylist(r) && this.setAudioTrack(this.trackId); } onError(t, e) { !e.fatal && e.context && (e.context.type !== sn || e.context.id !== this.trackId || (this.groupIds && -1 === this.groupIds.indexOf(e.context.groupId)) || ((this.requestScheduled = -1), this.checkRetry(e))); } get allAudioTracks() { return this.tracks; } get audioTracks() { return this.tracksInGroup; } get audioTrack() { return this.trackId; } set audioTrack(t) { (this.selectDefaultTrack = !1), this.setAudioTrack(t); } setAudioOption(t) { const e = this.hls; if (((e.config.audioPreference = t), t)) { const n = this.allAudioTracks; if (((this.selectDefaultTrack = !1), n.length)) { const i = this.currentTrack; if (i && yi(t, i, Ai)) return i; const r = gi(t, this.tracksInGroup, Ai); if (r > -1) { const t = this.tracksInGroup[r]; return this.setAudioTrack(r), t; } if (i) { let i = e.loadLevel; -1 === i && (i = e.firstAutoLevel); const r = (function (t, e, n, i, r) { const a = e[i], s = e.reduce((t, e, n) => { const i = e.uri; return (t[i] || (t[i] = [])).push(n), t; }, {})[a.uri]; s.length > 1 && (i = Math.max.apply(Math, s)); const o = a.videoRange, l = a.frameRate, d = a.codecSet.substring(0, 4), c = vi(e, i, e => { if (e.videoRange !== o || e.frameRate !== l || e.codecSet.substring(0, 4) !== d) return !1; const i = e.audioGroups, a = n.filter(t => !i || -1 !== i.indexOf(t.groupId)); return gi(t, a, r) > -1; }); return c > -1 ? c : vi(e, i, e => { const i = e.audioGroups, a = n.filter(t => !i || -1 !== i.indexOf(t.groupId)); return gi(t, a, r) > -1; }); })(t, e.levels, n, i, Ai); if (-1 === r) return null; e.nextLoadLevel = r; } if (t.channels || t.audioCodec) { const e = gi(t, n); if (e > -1) return n[e]; } } } return null; } setAudioTrack(t) { const e = this.tracksInGroup; if (t < 0 || t >= e.length) return void this.warn(`Invalid audio track id: ${t}`); this.clearTimer(), (this.selectDefaultTrack = !1); const n = this.currentTrack, i = e[t], r = i.details && !i.details.live; if (t === this.trackId && i === n && r) return; if ( (this.log( `Switching to audio-track ${t} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}` ), (this.trackId = t), (this.currentTrack = i), this.hls.trigger(tt.AUDIO_TRACK_SWITCHING, q({}, i)), r) ) return; const a = this.switchParams(i.url, null == n ? void 0 : n.details, i.details); this.loadPlaylist(a); } findTrackId(t) { const e = this.tracksInGroup; for (let n = 0; n < e.length; n++) { const i = e[n]; if ((!this.selectDefaultTrack || i.default) && (!t || yi(t, i, Ai))) return n; } if (t) { const { name: n, lang: i, assocLang: r, characteristics: a, audioCodec: s, channels: o } = t; for (let t = 0; t < e.length; t++) { if ( yi( { name: n, lang: i, assocLang: r, characteristics: a, audioCodec: s, channels: o }, e[t], Ai ) ) return t; } for (let n = 0; n < e.length; n++) { const i = e[n]; if (pa(t.attrs, i.attrs, ["LANGUAGE", "ASSOC-LANGUAGE", "CHARACTERISTICS"])) return n; } for (let n = 0; n < e.length; n++) { const i = e[n]; if (pa(t.attrs, i.attrs, ["LANGUAGE"])) return n; } } return -1; } loadPlaylist(t) { const e = this.currentTrack; if (this.shouldLoadPlaylist(e) && e) { super.loadPlaylist(); const n = e.id, i = e.groupId; let r = e.url; if (t) try { r = t.addDirectives(r); } catch (t) { this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`); } this.log(`loading audio-track playlist ${n} "${e.name}" lang:${e.lang} group:${i}`), this.clearTimer(), this.hls.trigger(tt.AUDIO_TRACK_LOADING, { url: r, id: n, groupId: i, deliveryDirectives: t || null }); } } }, emeController: ms, cmcdController: class { constructor(t) { (this.hls = void 0), (this.config = void 0), (this.media = void 0), (this.sid = void 0), (this.cid = void 0), (this.useHeaders = !1), (this.includeKeys = void 0), (this.initialized = !1), (this.starved = !1), (this.buffering = !0), (this.audioBuffer = void 0), (this.videoBuffer = void 0), (this.onWaiting = () => { this.initialized && (this.starved = !0), (this.buffering = !0); }), (this.onPlaying = () => { this.initialized || (this.initialized = !0), (this.buffering = !1); }), (this.applyPlaylistData = t => { try { this.apply(t, { ot: ys.MANIFEST, su: !this.initialized }); } catch (t) { ot.warn("Could not generate manifest CMCD data.", t); } }), (this.applyFragmentData = t => { try { const e = t.frag, n = this.hls.levels[e.level], i = this.getObjectType(e), r = { d: 1e3 * e.duration, ot: i }; (i !== ys.VIDEO && i !== ys.AUDIO && i != ys.MUXED) || ((r.br = n.bitrate / 1e3), (r.tb = this.getTopBandwidth(i) / 1e3), (r.bl = this.getBufferLength(i))), this.apply(t, r); } catch (t) { ot.warn("Could not generate segment CMCD data.", t); } }), (this.hls = t); const e = (this.config = t.config), { cmcd: n } = e; null != n && ((e.pLoader = this.createPlaylistLoader()), (e.fLoader = this.createFragmentLoader()), (this.sid = n.sessionId || (function () { try { return crypto.randomUUID(); } catch (t) { try { const t = URL.createObjectURL(new Blob()), e = t.toString(); return URL.revokeObjectURL(t), e.slice(e.lastIndexOf("/") + 1); } catch (t) { let e = new Date().getTime(); return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, t => { const n = (e + 16 * Math.random()) % 16 | 0; return (e = Math.floor(e / 16)), ("x" == t ? n : (3 & n) | 8).toString(16); }); } } })()), (this.cid = n.contentId), (this.useHeaders = !0 === n.useHeaders), (this.includeKeys = n.includeKeys), this.registerListeners()); } registerListeners() { const t = this.hls; t.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(tt.MEDIA_DETACHED, this.onMediaDetached, this), t.on(tt.BUFFER_CREATED, this.onBufferCreated, this); } unregisterListeners() { const t = this.hls; t.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(tt.MEDIA_DETACHED, this.onMediaDetached, this), t.off(tt.BUFFER_CREATED, this.onBufferCreated, this); } destroy() { this.unregisterListeners(), this.onMediaDetached(), (this.hls = this.config = this.audioBuffer = this.videoBuffer = null), (this.onWaiting = this.onPlaying = null); } onMediaAttached(t, e) { (this.media = e.media), this.media.addEventListener("waiting", this.onWaiting), this.media.addEventListener("playing", this.onPlaying); } onMediaDetached() { this.media && (this.media.removeEventListener("waiting", this.onWaiting), this.media.removeEventListener("playing", this.onPlaying), (this.media = null)); } onBufferCreated(t, e) { var n, i; (this.audioBuffer = null == (n = e.tracks.audio) ? void 0 : n.buffer), (this.videoBuffer = null == (i = e.tracks.video) ? void 0 : i.buffer); } createData() { var t; return { v: 1, sf: As.HLS, sid: this.sid, cid: this.cid, pr: null == (t = this.media) ? void 0 : t.playbackRate, mtp: this.hls.bandwidthEstimate / 1e3 }; } apply(t, e = {}) { Q(e, this.createData()); const n = e.ot === ys.INIT || e.ot === ys.VIDEO || e.ot === ys.MUXED; this.starved && n && ((e.bs = !0), (e.su = !0), (this.starved = !1)), null == e.su && (e.su = this.buffering); const { includeKeys: i } = this; i && (e = Object.keys(e).reduce((t, n) => (i.includes(n) && (t[n] = e[n]), t), {})), this.useHeaders ? (t.headers || (t.headers = {}), Xs(t.headers, e)) : (t.url = to(t.url, e)); } getObjectType(t) { const { type: e } = t; return "subtitle" === e ? ys.TIMED_TEXT : "initSegment" === t.sn ? ys.INIT : "audio" === e ? ys.AUDIO : "main" === e ? this.hls.audioTracks.length ? ys.VIDEO : ys.MUXED : void 0; } getTopBandwidth(t) { let e, n = 0; const i = this.hls; if (t === ys.AUDIO) e = i.audioTracks; else { const t = i.maxAutoLevel, n = t > -1 ? t + 1 : i.levels.length; e = i.levels.slice(0, n); } for (const t of e) t.bitrate > n && (n = t.bitrate); return n > 0 ? n : NaN; } getBufferLength(t) { const e = this.hls.media, n = t === ys.AUDIO ? this.audioBuffer : this.videoBuffer; if (!n || !e) return NaN; return 1e3 * Li.bufferInfo(n, e.currentTime, this.config.maxBufferHole).len; } createPlaylistLoader() { const { pLoader: t } = this.config, e = this.applyPlaylistData, n = t || this.config.loader; return class { constructor(t) { (this.loader = void 0), (this.loader = new n(t)); } get stats() { return this.loader.stats; } get context() { return this.loader.context; } destroy() { this.loader.destroy(); } abort() { this.loader.abort(); } load(t, n, i) { e(t), this.loader.load(t, n, i); } }; } createFragmentLoader() { const { fLoader: t } = this.config, e = this.applyFragmentData, n = t || this.config.loader; return class { constructor(t) { (this.loader = void 0), (this.loader = new n(t)); } get stats() { return this.loader.stats; } get context() { return this.loader.context; } destroy() { this.loader.destroy(); } abort() { this.loader.abort(); } load(t, n, i) { e(t), this.loader.load(t, n, i); } }; } }, contentSteeringController: class { constructor(t) { (this.hls = void 0), (this.log = void 0), (this.loader = null), (this.uri = null), (this.pathwayId = "."), (this.pathwayPriority = null), (this.timeToLoad = 300), (this.reloadTimer = -1), (this.updated = 0), (this.started = !1), (this.enabled = !0), (this.levels = null), (this.audioTracks = null), (this.subtitleTracks = null), (this.penalizedPathways = {}), (this.hls = t), (this.log = ot.log.bind(ot, "[content-steering]:")), this.registerListeners(); } registerListeners() { const t = this.hls; t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_LOADED, this.onManifestLoaded, this), t.on(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.on(tt.ERROR, this.onError, this); } unregisterListeners() { const t = this.hls; t && (t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_LOADED, this.onManifestLoaded, this), t.off(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.off(tt.ERROR, this.onError, this)); } startLoad() { if (((this.started = !0), this.clearTimeout(), this.enabled && this.uri)) { if (this.updated) { const t = 1e3 * this.timeToLoad - (performance.now() - this.updated); if (t > 0) return void this.scheduleRefresh(this.uri, t); } this.loadSteeringManifest(this.uri); } } stopLoad() { (this.started = !1), this.loader && (this.loader.destroy(), (this.loader = null)), this.clearTimeout(); } clearTimeout() { -1 !== this.reloadTimer && (self.clearTimeout(this.reloadTimer), (this.reloadTimer = -1)); } destroy() { this.unregisterListeners(), this.stopLoad(), (this.hls = null), (this.levels = this.audioTracks = this.subtitleTracks = null); } removeLevel(t) { const e = this.levels; e && (this.levels = e.filter(e => e !== t)); } onManifestLoading() { this.stopLoad(), (this.enabled = !0), (this.timeToLoad = 300), (this.updated = 0), (this.uri = null), (this.pathwayId = "."), (this.levels = this.audioTracks = this.subtitleTracks = null); } onManifestLoaded(t, e) { const { contentSteering: n } = e; null !== n && ((this.pathwayId = n.pathwayId), (this.uri = n.uri), this.started && this.startLoad()); } onManifestParsed(t, e) { (this.audioTracks = e.audioTracks), (this.subtitleTracks = e.subtitleTracks); } onError(t, e) { const { errorAction: n } = e; if ((null == n ? void 0 : n.action) === ei && n.flags === ai) { const t = this.levels; let i = this.pathwayPriority, r = this.pathwayId; if (e.context) { const { groupId: n, pathwayId: i, type: a } = e.context; n && t ? (r = this.getPathwayForGroupId(n, a, r)) : i && (r = i); } r in this.penalizedPathways || (this.penalizedPathways[r] = performance.now()), !i && t && (i = t.reduce((t, e) => (-1 === t.indexOf(e.pathwayId) && t.push(e.pathwayId), t), [])), i && i.length > 1 && (this.updatePathwayPriority(i), (n.resolved = this.pathwayId !== r)), n.resolved || ot.warn( `Could not resolve ${e.details} ("${e.error.message }") with content-steering for Pathway: ${r} levels: ${t ? t.length : t } priorities: ${JSON.stringify(i)} penalized: ${JSON.stringify(this.penalizedPathways)}` ); } } filterParsedLevels(t) { this.levels = t; let e = this.getLevelsForPathway(this.pathwayId); if (0 === e.length) { const n = t[0].pathwayId; this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${n}"`), (e = this.getLevelsForPathway(n)), (this.pathwayId = n); } return e.length !== t.length ? (this.log(`Found ${e.length}/${t.length} levels in Pathway "${this.pathwayId}"`), e) : t; } getLevelsForPathway(t) { return null === this.levels ? [] : this.levels.filter(e => t === e.pathwayId); } updatePathwayPriority(t) { let e; this.pathwayPriority = t; const n = this.penalizedPathways, i = performance.now(); Object.keys(n).forEach(t => { i - n[t] > 3e5 && delete n[t]; }); for (let i = 0; i < t.length; i++) { const r = t[i]; if (r in n) continue; if (r === this.pathwayId) return; const a = this.hls.nextLoadLevel, s = this.hls.levels[a]; if (((e = this.getLevelsForPathway(r)), e.length > 0)) { this.log(`Setting Pathway to "${r}"`), (this.pathwayId = r), Yn(e), this.hls.trigger(tt.LEVELS_UPDATED, { levels: e }); const t = this.hls.levels[a]; s && t && this.levels && (t.attrs["STABLE-VARIANT-ID"] !== s.attrs["STABLE-VARIANT-ID"] && t.bitrate !== s.bitrate && this.log(`Unstable Pathways change from bitrate ${s.bitrate} to ${t.bitrate}`), (this.hls.nextLoadLevel = a)); break; } } } getPathwayForGroupId(t, e, n) { const i = this.getLevelsForPathway(n).concat(this.levels || []); for (let n = 0; n < i.length; n++) if ((e === sn && i[n].hasAudioGroup(t)) || (e === on && i[n].hasSubtitleGroup(t))) return i[n].pathwayId; return n; } clonePathways(t) { const e = this.levels; if (!e) return; const n = {}, i = {}; t.forEach(t => { const { ID: r, "BASE-ID": a, "URI-REPLACEMENT": s } = t; if (e.some(t => t.pathwayId === r)) return; const o = this.getLevelsForPathway(a).map(t => { const e = new ct(t.attrs); e["PATHWAY-ID"] = r; const a = e.AUDIO && `${e.AUDIO}_clone_${r}`, o = e.SUBTITLES && `${e.SUBTITLES}_clone_${r}`; a && ((n[e.AUDIO] = a), (e.AUDIO = a)), o && ((i[e.SUBTITLES] = o), (e.SUBTITLES = o)); const l = no(t.uri, e["STABLE-VARIANT-ID"], "PER-VARIANT-URIS", s), d = new Un({ attrs: e, audioCodec: t.audioCodec, bitrate: t.bitrate, height: t.height, name: t.name, url: l, videoCodec: t.videoCodec, width: t.width }); if (t.audioGroups) for (let e = 1; e < t.audioGroups.length; e++) d.addGroupId("audio", `${t.audioGroups[e]}_clone_${r}`); if (t.subtitleGroups) for (let e = 1; e < t.subtitleGroups.length; e++) d.addGroupId("text", `${t.subtitleGroups[e]}_clone_${r}`); return d; }); e.push(...o), eo(this.audioTracks, n, s, r), eo(this.subtitleTracks, i, s, r); }); } loadSteeringManifest(t) { const e = this.hls.config, n = e.loader; let i; this.loader && this.loader.destroy(), (this.loader = new n(e)); try { i = new self.URL(t); } catch (e) { return (this.enabled = !1), void this.log(`Failed to parse Steering Manifest URI: ${t}`); } if ("data:" !== i.protocol) { const t = 0 | (this.hls.bandwidthEstimate || e.abrEwmaDefaultEstimate); i.searchParams.set("_HLS_pathway", this.pathwayId), i.searchParams.set("_HLS_throughput", "" + t); } const r = { responseType: "json", url: i.href }, a = e.steeringManifestLoadPolicy.default, s = a.errorRetry || a.timeoutRetry || {}, o = { loadPolicy: a, timeout: a.maxLoadTimeMs, maxRetry: s.maxNumRetry || 0, retryDelay: s.retryDelayMs || 0, maxRetryDelay: s.maxRetryDelayMs || 0 }, l = { onSuccess: (t, e, n, r) => { this.log(`Loaded steering manifest: "${i}"`); const a = t.data; if (1 !== a.VERSION) return void this.log(`Steering VERSION ${a.VERSION} not supported!`); (this.updated = performance.now()), (this.timeToLoad = a.TTL); const { "RELOAD-URI": s, "PATHWAY-CLONES": o, "PATHWAY-PRIORITY": l } = a; if (s) try { this.uri = new self.URL(s, i).href; } catch (t) { return ( (this.enabled = !1), void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${s}`) ); } this.scheduleRefresh(this.uri || n.url), o && this.clonePathways(o); const d = { steeringManifest: a, url: i.toString() }; this.hls.trigger(tt.STEERING_MANIFEST_LOADED, d), l && this.updatePathwayPriority(l); }, onError: (t, e, n, i) => { if ( (this.log(`Error loading steering manifest: ${t.code} ${t.text} (${e.url})`), this.stopLoad(), 410 === t.code) ) return ( (this.enabled = !1), void this.log(`Steering manifest ${e.url} no longer available`) ); let r = 1e3 * this.timeToLoad; if (429 !== t.code) this.scheduleRefresh(this.uri || e.url, r); else { const t = this.loader; if ("function" == typeof (null == t ? void 0 : t.getResponseHeader)) { const e = t.getResponseHeader("Retry-After"); e && (r = 1e3 * parseFloat(e)); } this.log(`Steering manifest ${e.url} rate limited`); } }, onTimeout: (t, e, n) => { this.log(`Timeout loading steering manifest (${e.url})`), this.scheduleRefresh(this.uri || e.url); } }; this.log(`Requesting steering manifest: ${i}`), this.loader.load(r, o, l); } scheduleRefresh(t, e = 1e3 * this.timeToLoad) { this.clearTimeout(), (this.reloadTimer = self.setTimeout(() => { var e; const n = null == (e = this.hls) ? void 0 : e.media; !n || n.ended ? this.scheduleRefresh(t, 1e3 * this.timeToLoad) : this.loadSteeringManifest(t); }, e)); } } } ); function po(t) { return t && "object" == typeof t ? Array.isArray(t) ? t.map(po) : Object.keys(t).reduce((e, n) => ((e[n] = po(t[n])), e), {}) : t; } function fo(t) { const e = t.loader; if (e !== so && e !== ro) ot.log("[config]: Custom loader detected, cannot enable progressive streaming"), (t.progressive = !1); else { (function () { if (self.fetch && self.AbortController && self.ReadableStream && self.Request) try { return new self.ReadableStream({}), !0; } catch (t) { } return !1; })() && ((t.loader = so), (t.progressive = !0), (t.enableSoftwareAES = !0), ot.log("[config]: Progressive streaming enabled, using FetchLoader")); } } let mo; class go extends oi { constructor(t, e) { super(t, "[level-controller]"), (this._levels = []), (this._firstLevel = -1), (this._maxAutoLevel = -1), (this._startLevel = void 0), (this.currentLevel = null), (this.currentLevelIndex = -1), (this.manualLevelIndex = -1), (this.steering = void 0), (this.onParsedComplete = void 0), (this.steering = e), this._registerListeners(); } _registerListeners() { const { hls: t } = this; t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_LOADED, this.onManifestLoaded, this), t.on(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.on(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(tt.FRAG_BUFFERED, this.onFragBuffered, this), t.on(tt.ERROR, this.onError, this); } _unregisterListeners() { const { hls: t } = this; t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_LOADED, this.onManifestLoaded, this), t.off(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.off(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(tt.FRAG_BUFFERED, this.onFragBuffered, this), t.off(tt.ERROR, this.onError, this); } destroy() { this._unregisterListeners(), (this.steering = null), this.resetLevels(), super.destroy(); } stopLoad() { this._levels.forEach(t => { (t.loadError = 0), (t.fragmentError = 0); }), super.stopLoad(); } resetLevels() { (this._startLevel = void 0), (this.manualLevelIndex = -1), (this.currentLevelIndex = -1), (this.currentLevel = null), (this._levels = []), (this._maxAutoLevel = -1); } onManifestLoading(t, e) { this.resetLevels(); } onManifestLoaded(t, e) { const n = this.hls.config.preferManagedMediaSource, i = [], r = {}, a = {}; let s = !1, o = !1, l = !1; e.levels.forEach(t => { var e, d; const c = t.attrs; let { audioCodec: u, videoCodec: h } = t; -1 !== (null == (e = u) ? void 0 : e.indexOf("mp4a.40.34")) && (mo || (mo = /chrome|firefox/i.test(navigator.userAgent)), mo && (t.audioCodec = u = void 0)), u && (t.audioCodec = u = je(u, n)), 0 === (null == (d = h) ? void 0 : d.indexOf("avc1")) && (h = t.videoCodec = (function (t) { const e = t.split("."); if (e.length > 2) { let t = e.shift() + "."; return ( (t += parseInt(e.shift()).toString(16)), (t += ("000" + parseInt(e.shift()).toString(16)).slice(-4)), t ); } return t; })(h)); const { width: p, height: f, unknownCodecs: m } = t; if ( (s || (s = !(!p || !f)), o || (o = !!h), l || (l = !!u), (null != m && m.length) || (u && !Ue(u, "audio", n)) || (h && !Ue(h, "video", n))) ) return; const { CODECS: g, "FRAME-RATE": y, "HDCP-LEVEL": A, "PATHWAY-ID": v, RESOLUTION: b, "VIDEO-RANGE": E } = c, w = `${`${v || "."}-`}${t.bitrate}-${b}-${y}-${g}-${E}-${A}`; if (r[w]) if (r[w].uri === t.url || t.attrs["PATHWAY-ID"]) r[w].addGroupId("audio", c.AUDIO), r[w].addGroupId("text", c.SUBTITLES); else { const e = (a[w] += 1); t.attrs["PATHWAY-ID"] = new Array(e + 1).join("."); const n = new Un(t); (r[w] = n), i.push(n); } else { const e = new Un(t); (r[w] = e), (a[w] = 1), i.push(e); } }), this.filterAndSortMediaOptions(i, e, s, o, l); } filterAndSortMediaOptions(t, e, n, i, r) { let a = [], s = [], o = t; if ( ((n || i) && r && (o = o.filter(({ videoCodec: t, videoRange: e, width: n, height: i }) => { return (!!t || !(!n || !i)) && !!(r = e) && Ln.indexOf(r) > -1; var r; })), 0 === o.length) ) return void Promise.resolve().then(() => { if (this.hls) { e.levels.length && this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(e.levels[0].attrs)}`); const t = new Error("no level with compatible codecs found in manifest"); this.hls.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal: !0, url: e.url, error: t, reason: t.message }); } }); if (e.audioTracks) { const { preferManagedMediaSource: t } = this.hls.config; (a = e.audioTracks.filter(e => !e.audioCodec || Ue(e.audioCodec, "audio", t))), yo(a); } e.subtitles && ((s = e.subtitles), yo(s)); const l = o.slice(0); o.sort((t, e) => { if (t.attrs["HDCP-LEVEL"] !== e.attrs["HDCP-LEVEL"]) return (t.attrs["HDCP-LEVEL"] || "") > (e.attrs["HDCP-LEVEL"] || "") ? 1 : -1; if (n && t.height !== e.height) return t.height - e.height; if (t.frameRate !== e.frameRate) return t.frameRate - e.frameRate; if (t.videoRange !== e.videoRange) return Ln.indexOf(t.videoRange) - Ln.indexOf(e.videoRange); if (t.videoCodec !== e.videoCodec) { const n = Me(t.videoCodec), i = Me(e.videoCodec); if (n !== i) return i - n; } if (t.uri === e.uri && t.codecSet !== e.codecSet) { const n = Ne(t.codecSet), i = Ne(e.codecSet); if (n !== i) return i - n; } return t.averageBitrate !== e.averageBitrate ? t.averageBitrate - e.averageBitrate : 0; }); let d = l[0]; if (this.steering && ((o = this.steering.filterParsedLevels(o)), o.length !== l.length)) for (let t = 0; t < l.length; t++) if (l[t].pathwayId === o[0].pathwayId) { d = l[t]; break; } this._levels = o; for (let t = 0; t < o.length; t++) if (o[t] === d) { var c; this._firstLevel = t; const e = d.bitrate, n = this.hls.bandwidthEstimate; if ( (this.log(`manifest loaded, ${o.length} level(s) found, first bitrate: ${e}`), void 0 === (null == (c = this.hls.userConfig) ? void 0 : c.abrEwmaDefaultEstimate)) ) { const t = Math.min(e, this.hls.config.abrEwmaDefaultEstimateMax); t > n && n === ho.abrEwmaDefaultEstimate && (this.hls.bandwidthEstimate = t); } break; } const u = r && !i, h = { levels: o, audioTracks: a, subtitleTracks: s, sessionData: e.sessionData, sessionKeys: e.sessionKeys, firstLevel: this._firstLevel, stats: e.stats, audio: r, video: i, altAudio: !u && a.some(t => !!t.url) }; this.hls.trigger(tt.MANIFEST_PARSED, h), (this.hls.config.autoStartLoad || this.hls.forceStartLoad) && this.hls.startLoad(this.hls.config.startPosition); } get levels() { return 0 === this._levels.length ? null : this._levels; } get level() { return this.currentLevelIndex; } set level(t) { const e = this._levels; if (0 === e.length) return; if (t < 0 || t >= e.length) { const n = new Error("invalid level idx"), i = t < 0; if ( (this.hls.trigger(tt.ERROR, { type: et.OTHER_ERROR, details: nt.LEVEL_SWITCH_ERROR, level: t, fatal: i, error: n, reason: n.message }), i) ) return; t = Math.min(t, e.length - 1); } const n = this.currentLevelIndex, i = this.currentLevel, r = i ? i.attrs["PATHWAY-ID"] : void 0, a = e[t], s = a.attrs["PATHWAY-ID"]; if (((this.currentLevelIndex = t), (this.currentLevel = a), n === t && a.details && i && r === s)) return; this.log( `Switching to level ${t} (${a.height ? a.height + "p " : ""}${a.videoRange ? a.videoRange + " " : ""}${a.codecSet ? a.codecSet + " " : "" }@${a.bitrate})${s ? " with Pathway " + s : ""} from level ${n}${r ? " with Pathway " + r : ""}` ); const o = { level: t, attrs: a.attrs, details: a.details, bitrate: a.bitrate, averageBitrate: a.averageBitrate, maxBitrate: a.maxBitrate, realBitrate: a.realBitrate, width: a.width, height: a.height, codecSet: a.codecSet, audioCodec: a.audioCodec, videoCodec: a.videoCodec, audioGroups: a.audioGroups, subtitleGroups: a.subtitleGroups, loaded: a.loaded, loadError: a.loadError, fragmentError: a.fragmentError, name: a.name, id: a.id, uri: a.uri, url: a.url, urlId: 0, audioGroupIds: a.audioGroupIds, textGroupIds: a.textGroupIds }; this.hls.trigger(tt.LEVEL_SWITCHING, o); const l = a.details; if (!l || l.live) { const t = this.switchParams(a.uri, null == i ? void 0 : i.details, l); this.loadPlaylist(t); } } get manualLevel() { return this.manualLevelIndex; } set manualLevel(t) { (this.manualLevelIndex = t), void 0 === this._startLevel && (this._startLevel = t), -1 !== t && (this.level = t); } get firstLevel() { return this._firstLevel; } set firstLevel(t) { this._firstLevel = t; } get startLevel() { if (void 0 === this._startLevel) { const t = this.hls.config.startLevel; return void 0 !== t ? t : this.hls.firstAutoLevel; } return this._startLevel; } set startLevel(t) { this._startLevel = t; } onError(t, e) { !e.fatal && e.context && e.context.type === an && e.context.level === this.level && this.checkRetry(e); } onFragBuffered(t, { frag: e }) { if (void 0 !== e && e.type === ln) { const t = e.elementaryStreams; if (!Object.keys(t).some(e => !!t[e])) return; const n = this._levels[e.level]; null != n && n.loadError && (this.log(`Resetting level error count of ${n.loadError} on frag buffered`), (n.loadError = 0)); } } onLevelLoaded(t, e) { var n; const { level: i, details: r } = e, a = this._levels[i]; var s; if (!a) return ( this.warn(`Invalid level index ${i}`), void (null != (s = e.deliveryDirectives) && s.skip && (r.deltaUpdateFailed = !0)) ); i === this.currentLevelIndex ? (0 === a.fragmentError && (a.loadError = 0), this.playlistLoaded(i, e, a.details)) : null != (n = e.deliveryDirectives) && n.skip && (r.deltaUpdateFailed = !0); } loadPlaylist(t) { super.loadPlaylist(); const e = this.currentLevelIndex, n = this.currentLevel; if (n && this.shouldLoadPlaylist(n)) { let i = n.uri; if (t) try { i = t.addDirectives(i); } catch (t) { this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`); } const r = n.attrs["PATHWAY-ID"]; this.log( `Loading level index ${e}${void 0 !== (null == t ? void 0 : t.msn) ? " at sn " + t.msn + " part " + t.part : "" } with${r ? " Pathway " + r : ""} ${i}` ), this.clearTimer(), this.hls.trigger(tt.LEVEL_LOADING, { url: i, level: e, pathwayId: n.attrs["PATHWAY-ID"], id: 0, deliveryDirectives: t || null }); } } get nextLoadLevel() { return -1 !== this.manualLevelIndex ? this.manualLevelIndex : this.hls.nextAutoLevel; } set nextLoadLevel(t) { (this.level = t), -1 === this.manualLevelIndex && (this.hls.nextAutoLevel = t); } removeLevel(t) { var e; const n = this._levels.filter( (e, n) => n !== t || (this.steering && this.steering.removeLevel(e), e === this.currentLevel && ((this.currentLevel = null), (this.currentLevelIndex = -1), e.details && e.details.fragments.forEach(t => (t.level = -1))), !1) ); Yn(n), (this._levels = n), this.currentLevelIndex > -1 && null != (e = this.currentLevel) && e.details && (this.currentLevelIndex = this.currentLevel.details.fragments[0].level), this.hls.trigger(tt.LEVELS_UPDATED, { levels: n }); } onLevelsUpdated(t, { levels: e }) { this._levels = e; } checkMaxAutoUpdated() { const { autoLevelCapping: t, maxAutoLevel: e, maxHdcpLevel: n } = this.hls; this._maxAutoLevel !== e && ((this._maxAutoLevel = e), this.hls.trigger(tt.MAX_AUTO_LEVEL_UPDATED, { autoLevelCapping: t, levels: this.levels, maxAutoLevel: e, minAutoLevel: this.hls.minAutoLevel, maxHdcpLevel: n })); } } function yo(t) { const e = {}; t.forEach(t => { const n = t.groupId || ""; (t.id = e[n] = e[n] || 0), e[n]++; }); } class Ao { constructor(t) { (this.config = void 0), (this.keyUriToKeyInfo = {}), (this.emeController = null), (this.config = t); } abort(t) { for (const n in this.keyUriToKeyInfo) { const i = this.keyUriToKeyInfo[n].loader; if (i) { var e; if (t && t !== (null == (e = i.context) ? void 0 : e.frag.type)) return; i.abort(); } } } detach() { for (const t in this.keyUriToKeyInfo) { const e = this.keyUriToKeyInfo[t]; (e.mediaKeySessionContext || e.decryptdata.isCommonEncryption) && delete this.keyUriToKeyInfo[t]; } } destroy() { this.detach(); for (const t in this.keyUriToKeyInfo) { const e = this.keyUriToKeyInfo[t].loader; e && e.destroy(); } this.keyUriToKeyInfo = {}; } createKeyLoadError(t, e = nt.KEY_LOAD_ERROR, n, i, r) { return new zi({ type: et.NETWORK_ERROR, details: e, fatal: !1, frag: t, response: r, error: n, networkDetails: i }); } loadClear(t, e) { if (this.emeController && this.config.emeEnabled) { const { sn: n, cc: i } = t; for (let t = 0; t < e.length; t++) { const r = e[t]; if (i <= r.cc && ("initSegment" === n || "initSegment" === r.sn || n < r.sn)) { this.emeController.selectKeySystemFormat(r).then(t => { r.setKeyFormat(t); }); break; } } } } load(t) { return !t.decryptdata && t.encrypted && this.emeController ? this.emeController.selectKeySystemFormat(t).then(e => this.loadInternal(t, e)) : this.loadInternal(t); } loadInternal(t, e) { var n, i; e && t.setKeyFormat(e); const r = t.decryptdata; if (!r) { const n = new Error( e ? `Expected frag.decryptdata to be defined after setting format ${e}` : "Missing decryption data on fragment in onKeyLoading" ); return Promise.reject(this.createKeyLoadError(t, nt.KEY_LOAD_ERROR, n)); } const a = r.uri; if (!a) return Promise.reject(this.createKeyLoadError(t, nt.KEY_LOAD_ERROR, new Error(`Invalid key URI: "${a}"`))); let s = this.keyUriToKeyInfo[a]; if (null != (n = s) && n.decryptdata.key) return (r.key = s.decryptdata.key), Promise.resolve({ frag: t, keyInfo: s }); var o; if (null != (i = s) && i.keyLoadPromise) switch (null == (o = s.mediaKeySessionContext) ? void 0 : o.keyStatus) { case void 0: case "status-pending": case "usable": case "usable-in-future": return s.keyLoadPromise.then(e => ((r.key = e.keyInfo.decryptdata.key), { frag: t, keyInfo: s })); } switch ( ((s = this.keyUriToKeyInfo[a] = { decryptdata: r, keyLoadPromise: null, loader: null, mediaKeySessionContext: null }), r.method) ) { case "ISO-23001-7": case "SAMPLE-AES": case "SAMPLE-AES-CENC": case "SAMPLE-AES-CTR": return "identity" === r.keyFormat ? this.loadKeyHTTP(s, t) : this.loadKeyEME(s, t); case "AES-128": return this.loadKeyHTTP(s, t); default: return Promise.reject( this.createKeyLoadError( t, nt.KEY_LOAD_ERROR, new Error(`Key supplied with unsupported METHOD: "${r.method}"`) ) ); } } loadKeyEME(t, e) { const n = { frag: e, keyInfo: t }; if (this.emeController && this.config.emeEnabled) { const e = this.emeController.loadKey(n); if (e) return (t.keyLoadPromise = e.then(e => ((t.mediaKeySessionContext = e), n))).catch(e => { throw ((t.keyLoadPromise = null), e); }); } return Promise.resolve(n); } loadKeyHTTP(t, e) { const n = this.config, i = new (0, n.loader)(n); return ( (e.keyLoader = t.loader = i), (t.keyLoadPromise = new Promise((r, a) => { const s = { keyInfo: t, frag: e, responseType: "arraybuffer", url: t.decryptdata.uri }, o = n.keyLoadPolicy.default, l = { loadPolicy: o, timeout: o.maxLoadTimeMs, maxRetry: 0, retryDelay: 0, maxRetryDelay: 0 }, d = { onSuccess: (t, e, n, i) => { const { frag: s, keyInfo: o, url: l } = n; if (!s.decryptdata || o !== this.keyUriToKeyInfo[l]) return a( this.createKeyLoadError( s, nt.KEY_LOAD_ERROR, new Error("after key load, decryptdata unset or changed"), i ) ); (o.decryptdata.key = s.decryptdata.key = new Uint8Array(t.data)), (s.keyLoader = null), (o.loader = null), r({ frag: s, keyInfo: o }); }, onError: (t, n, i, r) => { this.resetLoader(n), a( this.createKeyLoadError( e, nt.KEY_LOAD_ERROR, new Error(`HTTP Error ${t.code} loading key ${t.text}`), i, q({ url: s.url, data: void 0 }, t) ) ); }, onTimeout: (t, n, i) => { this.resetLoader(n), a(this.createKeyLoadError(e, nt.KEY_LOAD_TIMEOUT, new Error("key loading timed out"), i)); }, onAbort: (t, n, i) => { this.resetLoader(n), a(this.createKeyLoadError(e, nt.INTERNAL_ABORTED, new Error("key loading aborted"), i)); } }; i.load(s, l, d); })) ); } resetLoader(t) { const { frag: e, keyInfo: n, url: i } = t, r = n.loader; e.keyLoader === r && ((e.keyLoader = null), (n.loader = null)), delete this.keyUriToKeyInfo[i], r && r.destroy(); } } function vo() { return self.SourceBuffer || self.WebKitSourceBuffer; } function bo() { if (!Be()) return !1; const t = vo(); return !t || (t.prototype && "function" == typeof t.prototype.appendBuffer && "function" == typeof t.prototype.remove); } class Eo { constructor(t, e, n, i) { (this.config = void 0), (this.media = null), (this.fragmentTracker = void 0), (this.hls = void 0), (this.nudgeRetry = 0), (this.stallReported = !1), (this.stalled = null), (this.moved = !1), (this.seeking = !1), (this.config = t), (this.media = e), (this.fragmentTracker = n), (this.hls = i); } destroy() { (this.media = null), (this.hls = this.fragmentTracker = null); } poll(t, e) { const { config: n, media: i, stalled: r } = this; if (null === i) return; const { currentTime: a, seeking: s } = i, o = this.seeking && !s, l = !this.seeking && s; if (((this.seeking = s), a !== t)) { if (((this.moved = !0), s || (this.nudgeRetry = 0), null !== r)) { if (this.stallReported) { const t = self.performance.now() - r; ot.warn(`playback not stuck anymore @${a}, after ${Math.round(t)}ms`), (this.stallReported = !1); } this.stalled = null; } return; } if (l || o) return void (this.stalled = null); if ((i.paused && !s) || i.ended || 0 === i.playbackRate || !Li.getBuffered(i).length) return void (this.nudgeRetry = 0); const d = Li.bufferInfo(i, a, 0), c = d.nextStart || 0; if (s) { const t = d.len > 2, n = !c || (e && e.start <= a) || (c - a > 2 && !this.fragmentTracker.getPartialFragment(a)); if (t || n) return; this.moved = !1; } if (!this.moved && null !== this.stalled) { var u; if (!(d.len > 0) && !c) return; const t = Math.max(c, d.start || 0) - a, e = this.hls.levels ? this.hls.levels[this.hls.currentLevel] : null, n = (null == e || null == (u = e.details) ? void 0 : u.live) ? 2 * e.details.targetduration : 2, r = this.fragmentTracker.getPartialFragment(a); if (t > 0 && (t <= n || r)) return void (i.paused || this._trySkipBufferHole(r)); } const h = self.performance.now(); if (null === r) return void (this.stalled = h); const p = h - r; if (!s && p >= 250 && (this._reportStall(d), !this.media)) return; const f = Li.bufferInfo(i, a, n.maxBufferHole); this._tryFixBufferStall(f, p); } _tryFixBufferStall(t, e) { const { config: n, fragmentTracker: i, media: r } = this; if (null === r) return; const a = r.currentTime, s = i.getPartialFragment(a); if (s) { if (this._trySkipBufferHole(s) || !this.media) return; } (t.len > n.maxBufferHole || (t.nextStart && t.nextStart - a < n.maxBufferHole)) && e > 1e3 * n.highBufferWatchdogPeriod && (ot.warn("Trying to nudge playhead over buffer-hole"), (this.stalled = null), this._tryNudgeBuffer()); } _reportStall(t) { const { hls: e, media: n, stallReported: i } = this; if (!i && n) { this.stallReported = !0; const i = new Error(`Playback stalling at @${n.currentTime} due to low buffer (${JSON.stringify(t)})`); ot.warn(i.message), e.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_STALLED_ERROR, fatal: !1, error: i, buffer: t.len }); } } _trySkipBufferHole(t) { const { config: e, hls: n, media: i } = this; if (null === i) return 0; const r = i.currentTime, a = Li.bufferInfo(i, r, 0), s = r < a.start ? a.start : a.nextStart; if (s) { const o = a.len <= e.maxBufferHole, l = a.len > 0 && a.len < 1 && i.readyState < 3, d = s - r; if (d > 0 && (o || l)) { if (d > e.maxBufferHole) { const { fragmentTracker: e } = this; let n = !1; if (0 === r) { const t = e.getAppendedFrag(0, ln); t && s < t.end && (n = !0); } if (!n) { const n = t || e.getAppendedFrag(r, ln); if (n) { let t = !1, i = n.end; for (; i < s;) { const n = e.getPartialFragment(i); if (!n) { t = !0; break; } i += n.duration; } if (t) return 0; } } } const a = Math.max(s + 0.05, r + 0.1); if ( (ot.warn(`skipping hole, adjusting currentTime from ${r} to ${a}`), (this.moved = !0), (this.stalled = null), (i.currentTime = a), t && !t.gap) ) { const e = new Error(`fragment loaded with buffer holes, seeking from ${r} to ${a}`); n.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_SEEK_OVER_HOLE, fatal: !1, error: e, reason: e.message, frag: t }); } return a; } } return 0; } _tryNudgeBuffer() { const { config: t, hls: e, media: n, nudgeRetry: i } = this; if (null === n) return; const r = n.currentTime; if ((this.nudgeRetry++, i < t.nudgeMaxRetry)) { const a = r + (i + 1) * t.nudgeOffset, s = new Error(`Nudging 'currentTime' from ${r} to ${a}`); ot.warn(s.message), (n.currentTime = a), e.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_NUDGE_ON_STALL, error: s, fatal: !1 }); } else { const n = new Error(`Playhead still not moving while enough data buffered @${r} after ${t.nudgeMaxRetry} nudges`); ot.error(n.message), e.trigger(tt.ERROR, { type: et.MEDIA_ERROR, details: nt.BUFFER_STALLED_ERROR, error: n, fatal: !0 }); } } } class wo extends rr { constructor(t, e, n) { super(t, e, n, "[stream-controller]", ln), (this.audioCodecSwap = !1), (this.gapController = null), (this.level = -1), (this._forceStartLoad = !1), (this.altAudio = !1), (this.audioOnly = !1), (this.fragPlaying = null), (this.onvplaying = null), (this.onvseeked = null), (this.fragLastKbps = 0), (this.couldBacktrack = !1), (this.backtrackFragment = null), (this.audioCodecSwitch = !1), (this.videoBuffer = null), this._registerListeners(); } _registerListeners() { const { hls: t } = this; t.on(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.on(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.on(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.on(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.on(tt.LEVEL_LOADING, this.onLevelLoading, this), t.on(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.on(tt.FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this), t.on(tt.ERROR, this.onError, this), t.on(tt.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.on(tt.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), t.on(tt.BUFFER_CREATED, this.onBufferCreated, this), t.on(tt.BUFFER_FLUSHED, this.onBufferFlushed, this), t.on(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.on(tt.FRAG_BUFFERED, this.onFragBuffered, this); } _unregisterListeners() { const { hls: t } = this; t.off(tt.MEDIA_ATTACHED, this.onMediaAttached, this), t.off(tt.MEDIA_DETACHING, this.onMediaDetaching, this), t.off(tt.MANIFEST_LOADING, this.onManifestLoading, this), t.off(tt.MANIFEST_PARSED, this.onManifestParsed, this), t.off(tt.LEVEL_LOADED, this.onLevelLoaded, this), t.off(tt.FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this), t.off(tt.ERROR, this.onError, this), t.off(tt.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), t.off(tt.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), t.off(tt.BUFFER_CREATED, this.onBufferCreated, this), t.off(tt.BUFFER_FLUSHED, this.onBufferFlushed, this), t.off(tt.LEVELS_UPDATED, this.onLevelsUpdated, this), t.off(tt.FRAG_BUFFERED, this.onFragBuffered, this); } onHandlerDestroying() { this._unregisterListeners(), super.onHandlerDestroying(); } startLoad(t) { if (this.levels) { const { lastCurrentTime: e, hls: n } = this; if ((this.stopLoad(), this.setInterval(100), (this.level = -1), !this.startFragRequested)) { let t = n.startLevel; -1 === t && (n.config.testBandwidth && this.levels.length > 1 ? ((t = 0), (this.bitrateTest = !0)) : (t = n.firstAutoLevel)), (n.nextLoadLevel = t), (this.level = n.loadLevel), (this.loadedmetadata = !1); } e > 0 && -1 === t && (this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`), (t = e)), (this.state = qi), (this.nextLoadPosition = this.startPosition = this.lastCurrentTime = t), this.tick(); } else (this._forceStartLoad = !0), (this.state = Ki); } stopLoad() { (this._forceStartLoad = !1), super.stopLoad(); } doTick() { switch (this.state) { case ir: { const { levels: t, level: e } = this, n = null == t ? void 0 : t[e], i = null == n ? void 0 : n.details; if (i && (!i.live || this.levelLastLoaded === n)) { if (this.waitForCdnTuneIn(i)) break; this.state = qi; break; } if (this.hls.nextLoadLevel !== this.level) { this.state = qi; break; } break; } case Qi: { var t; const e = self.performance.now(), n = this.retryDate; if (!n || e >= n || (null != (t = this.media) && t.seeking)) { const { levels: t, level: e } = this, n = null == t ? void 0 : t[e]; this.resetStartWhenNotLoaded(n || null), (this.state = qi); } } } this.state === qi && this.doTickIdle(), this.onTickEnd(); } onTickEnd() { super.onTickEnd(), this.checkBuffer(), this.checkFragmentChanged(); } doTickIdle() { const { hls: t, levelLastLoaded: e, levels: n, media: i } = this; if (null === e || (!i && (this.startFragRequested || !t.config.startFragPrefetch))) return; if (this.altAudio && this.audioOnly) return; const r = t.nextLoadLevel; if (null == n || !n[r]) return; const a = n[r], s = this.getMainFwdBufferInfo(); if (null === s) return; const o = this.getLevelDetails(); if (o && this._streamEnded(s, o)) { const t = {}; return this.altAudio && (t.type = "video"), this.hls.trigger(tt.BUFFER_EOS, t), void (this.state = tr); } t.loadLevel !== r && -1 === t.manualLevel && this.log(`Adapting to level ${r} from level ${this.level}`), (this.level = t.nextLoadLevel = r); const l = a.details; if (!l || this.state === ir || (l.live && this.levelLastLoaded !== a)) return (this.level = r), void (this.state = ir); const d = s.len, c = this.getMaxBufferLength(a.maxBitrate); if (d >= c) return; this.backtrackFragment && this.backtrackFragment.start > s.end && (this.backtrackFragment = null); const u = this.backtrackFragment ? this.backtrackFragment.start : s.end; let h = this.getNextFragment(u, l); if ( this.couldBacktrack && !this.fragPrevious && h && "initSegment" !== h.sn && this.fragmentTracker.getState(h) !== Si ) { var p; const t = (null != (p = this.backtrackFragment) ? p : h).sn - l.startSN, e = l.fragments[t - 1]; e && h.cc === e.cc && ((h = e), this.fragmentTracker.removeFragment(e)); } else this.backtrackFragment && s.len && (this.backtrackFragment = null); if (h && this.isLoopLoading(h, u)) { if (!h.gap) { const t = this.audioOnly && !this.altAudio ? ft : mt, e = (t === mt ? this.videoBuffer : this.mediaBuffer) || this.media; e && this.afterBufferFlushed(e, t, ln); } h = this.getNextFragmentLoopLoading(h, l, s, ln, c); } h && (!h.initSegment || h.initSegment.data || this.bitrateTest || (h = h.initSegment), this.loadFragment(h, a, u)); } loadFragment(t, e, n) { const i = this.fragmentTracker.getState(t); (this.fragCurrent = t), i === Ei || i === xi ? "initSegment" === t.sn ? this._loadInitSegment(t, e) : this.bitrateTest ? (this.log( `Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered` ), this._loadBitrateTestFrag(t, e)) : ((this.startFragRequested = !0), super.loadFragment(t, e, n)) : this.clearTrackerIfNeeded(t); } getBufferedFrag(t) { return this.fragmentTracker.getBufferedFrag(t, ln); } followingBufferedFrag(t) { return t ? this.getBufferedFrag(t.end + 0.5) : null; } immediateLevelSwitch() { this.abortCurrentFrag(), this.flushMainBuffer(0, Number.POSITIVE_INFINITY); } nextLevelSwitch() { const { levels: t, media: e } = this; if (null != e && e.readyState) { let n; const i = this.getAppendedFrag(e.currentTime); i && i.start > 1 && this.flushMainBuffer(0, i.start - 1); const r = this.getLevelDetails(); if (null != r && r.live) { const t = this.getMainFwdBufferInfo(); if (!t || t.len < 2 * r.targetduration) return; } if (!e.paused && t) { const e = t[this.hls.nextLoadLevel], i = this.fragLastKbps; n = i && this.fragCurrent ? (this.fragCurrent.duration * e.maxBitrate) / (1e3 * i) + 1 : 0; } else n = 0; const a = this.getBufferedFrag(e.currentTime + n); if (a) { const t = this.followingBufferedFrag(a); if (t) { this.abortCurrentFrag(); const e = t.maxStartPTS ? t.maxStartPTS : t.start, n = t.duration, i = Math.max( a.end, e + Math.min( Math.max(n - this.config.maxFragLookUpTolerance, n * (this.couldBacktrack ? 0.5 : 0.125)), n * (this.couldBacktrack ? 0.75 : 0.25) ) ); this.flushMainBuffer(i, Number.POSITIVE_INFINITY); } } } } abortCurrentFrag() { const t = this.fragCurrent; switch ( ((this.fragCurrent = null), (this.backtrackFragment = null), t && (t.abortRequests(), this.fragmentTracker.removeFragment(t)), this.state) ) { case Vi: case Wi: case Qi: case Ji: case Zi: this.state = qi; } this.nextLoadPosition = this.getLoadPosition(); } flushMainBuffer(t, e) { super.flushMainBuffer(t, e, this.altAudio ? "video" : null); } onMediaAttached(t, e) { super.onMediaAttached(t, e); const n = e.media; (this.onvplaying = this.onMediaPlaying.bind(this)), (this.onvseeked = this.onMediaSeeked.bind(this)), n.addEventListener("playing", this.onvplaying), n.addEventListener("seeked", this.onvseeked), (this.gapController = new Eo(this.config, n, this.fragmentTracker, this.hls)); } onMediaDetaching() { const { media: t } = this; t && this.onvplaying && this.onvseeked && (t.removeEventListener("playing", this.onvplaying), t.removeEventListener("seeked", this.onvseeked), (this.onvplaying = this.onvseeked = null), (this.videoBuffer = null)), (this.fragPlaying = null), this.gapController && (this.gapController.destroy(), (this.gapController = null)), super.onMediaDetaching(); } onMediaPlaying() { this.tick(); } onMediaSeeked() { const t = this.media, e = t ? t.currentTime : null; X(e) && this.log(`Media seeked to ${e.toFixed(3)}`); const n = this.getMainFwdBufferInfo(); null !== n && 0 !== n.len ? this.tick() : this.warn(`Main forward buffer length on "seeked" event ${n ? n.len : "empty"})`); } onManifestLoading() { this.log("Trigger BUFFER_RESET"), this.hls.trigger(tt.BUFFER_RESET, void 0), this.fragmentTracker.removeAllFragments(), (this.couldBacktrack = !1), (this.startPosition = this.lastCurrentTime = this.fragLastKbps = 0), (this.levels = this.fragPlaying = this.backtrackFragment = this.levelLastLoaded = null), (this.altAudio = this.audioOnly = this.startFragRequested = !1); } onManifestParsed(t, e) { let n = !1, i = !1; e.levels.forEach(t => { const e = t.audioCodec; e && ((n = n || -1 !== e.indexOf("mp4a.40.2")), (i = i || -1 !== e.indexOf("mp4a.40.5"))); }), (this.audioCodecSwitch = n && i && !(function () { var t; const e = vo(); return "function" == typeof (null == e || null == (t = e.prototype) ? void 0 : t.changeType); })()), this.audioCodecSwitch && this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"), (this.levels = e.levels), (this.startFragRequested = !1); } onLevelLoading(t, e) { const { levels: n } = this; if (!n || this.state !== qi) return; const i = n[e.level]; (!i.details || (i.details.live && this.levelLastLoaded !== i) || this.waitForCdnTuneIn(i.details)) && (this.state = ir); } onLevelLoaded(t, e) { var n; const { levels: i } = this, r = e.level, a = e.details, s = a.totalduration; if (!i) return void this.warn(`Levels were reset while loading level ${r}`); this.log( `Level ${r} loaded [${a.startSN},${a.endSN}]${a.lastPartSn ? `[part-${a.lastPartSn}-${a.lastPartIndex}]` : "" }, cc [${a.startCC}, ${a.endCC}] duration:${s}` ); const o = i[r], l = this.fragCurrent; !l || (this.state !== Wi && this.state !== Qi) || (l.level !== e.level && l.loader && this.abortCurrentFrag()); let d = 0; if (a.live || (null != (n = o.details) && n.live)) { var c; if ((this.checkLiveUpdate(a), a.deltaUpdateFailed)) return; d = this.alignPlaylists(a, o.details, null == (c = this.levelLastLoaded) ? void 0 : c.details); } if ( ((o.details = a), (this.levelLastLoaded = o), this.hls.trigger(tt.LEVEL_UPDATED, { details: a, level: r }), this.state === ir) ) { if (this.waitForCdnTuneIn(a)) return; this.state = qi; } this.startFragRequested ? a.live && this.synchronizeToLiveEdge(a) : this.setStartPosition(a, d), this.tick(); } _handleFragmentLoadProgress(t) { var e; const { frag: n, part: i, payload: r } = t, { levels: a } = this; if (!a) return void this.warn( `Levels were reset while fragment load was in progress. Fragment ${n.sn} of level ${n.level} will not be buffered` ); const s = a[n.level], o = s.details; if (!o) return ( this.warn(`Dropping fragment ${n.sn} of level ${n.level} after level details were reset`), void this.fragmentTracker.removeFragment(n) ); const l = s.videoCodec, d = o.PTSKnown || !o.live, c = null == (e = n.initSegment) ? void 0 : e.data, u = this._getAudioCodec(s), h = (this.transmuxer = this.transmuxer || new ua(this.hls, ln, this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this))), p = i ? i.index : -1, f = -1 !== p, m = new Ii(n.level, n.sn, n.stats.chunkCount, r.byteLength, p, f), g = this.initPTS[n.cc]; h.push(r, c, u, l, n, i, o.totalduration, d, m, g); } onAudioTrackSwitching(t, e) { const n = this.altAudio; if (!!!e.url) { if (this.mediaBuffer !== this.media) { this.log("Switching on main audio, use media.buffered to schedule main fragment loading"), (this.mediaBuffer = this.media); const t = this.fragCurrent; t && (this.log("Switching to main audio track, cancel main fragment load"), t.abortRequests(), this.fragmentTracker.removeFragment(t)), this.resetTransmuxer(), this.resetLoadingState(); } else this.audioOnly && this.resetTransmuxer(); const t = this.hls; n && (t.trigger(tt.BUFFER_FLUSHING, { startOffset: 0, endOffset: Number.POSITIVE_INFINITY, type: null }), this.fragmentTracker.removeAllFragments()), t.trigger(tt.AUDIO_TRACK_SWITCHED, e); } } onAudioTrackSwitched(t, e) { const n = e.id, i = !!this.hls.audioTracks[n].url; if (i) { const t = this.videoBuffer; t && this.mediaBuffer !== t && (this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"), (this.mediaBuffer = t)); } (this.altAudio = i), this.tick(); } onBufferCreated(t, e) { const n = e.tracks; let i, r, a = !1; for (const t in n) { const e = n[t]; if ("main" === e.id) { if (((r = t), (i = e), "video" === t)) { const e = n[t]; e && (this.videoBuffer = e.buffer); } } else a = !0; } a && i ? (this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`), (this.mediaBuffer = i.buffer)) : (this.mediaBuffer = this.media); } onFragBuffered(t, e) { const { frag: n, part: i } = e; if (n && n.type !== ln) return; if (this.fragContextChanged(n)) return ( this.warn( `Fragment ${n.sn}${i ? " p: " + i.index : ""} of level ${n.level } finished buffering, but was aborted. state: ${this.state}` ), void (this.state === Zi && (this.state = qi)) ); const r = i ? i.stats : n.stats; (this.fragLastKbps = Math.round((8 * r.total) / (r.buffering.end - r.loading.first))), "initSegment" !== n.sn && (this.fragPrevious = n), this.fragBufferedComplete(n, i); } onError(t, e) { var n; if (e.fatal) this.state = er; else switch (e.details) { case nt.FRAG_GAP: case nt.FRAG_PARSING_ERROR: case nt.FRAG_DECRYPT_ERROR: case nt.FRAG_LOAD_ERROR: case nt.FRAG_LOAD_TIMEOUT: case nt.KEY_LOAD_ERROR: case nt.KEY_LOAD_TIMEOUT: this.onFragmentOrKeyLoadError(ln, e); break; case nt.LEVEL_LOAD_ERROR: case nt.LEVEL_LOAD_TIMEOUT: case nt.LEVEL_PARSING_ERROR: e.levelRetry || this.state !== ir || (null == (n = e.context) ? void 0 : n.type) !== an || (this.state = qi); break; case nt.BUFFER_APPEND_ERROR: case nt.BUFFER_FULL_ERROR: if (!e.parent || "main" !== e.parent) return; if (e.details === nt.BUFFER_APPEND_ERROR) return void this.resetLoadingState(); this.reduceLengthAndFlushBuffer(e) && this.flushMainBuffer(0, Number.POSITIVE_INFINITY); break; case nt.INTERNAL_EXCEPTION: this.recoverWorkerError(e); } } checkBuffer() { const { media: t, gapController: e } = this; if (t && e && t.readyState) { if (this.loadedmetadata || !Li.getBuffered(t).length) { const t = this.state !== qi ? this.fragCurrent : null; e.poll(this.lastCurrentTime, t); } this.lastCurrentTime = t.currentTime; } } onFragLoadEmergencyAborted() { (this.state = qi), this.loadedmetadata || ((this.startFragRequested = !1), (this.nextLoadPosition = this.startPosition)), this.tickImmediate(); } onBufferFlushed(t, { type: e }) { if (e !== ft || (this.audioOnly && !this.altAudio)) { const t = (e === mt ? this.videoBuffer : this.mediaBuffer) || this.media; this.afterBufferFlushed(t, e, ln), this.tick(); } } onLevelsUpdated(t, e) { this.level > -1 && this.fragCurrent && (this.level = this.fragCurrent.level), (this.levels = e.levels); } swapAudioCodec() { this.audioCodecSwap = !this.audioCodecSwap; } seekToStartPos() { const { media: t } = this; if (!t) return; const e = t.currentTime; let n = this.startPosition; if (n >= 0 && e < n) { if (t.seeking) return void this.log(`could not seek to ${n}, already seeking at ${e}`); const i = Li.getBuffered(t), r = (i.length ? i.start(0) : 0) - n; r > 0 && (r < this.config.maxBufferHole || r < this.config.maxFragLookUpTolerance) && (this.log(`adjusting start position by ${r} to match buffer start`), (n += r), (this.startPosition = n)), this.log(`seek to target start position ${n} from current time ${e}`), (t.currentTime = n); } } _getAudioCodec(t) { let e = this.config.defaultAudioCodec || t.audioCodec; return ( this.audioCodecSwap && e && (this.log("Swapping audio codec"), (e = -1 !== e.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5")), e ); } _loadBitrateTestFrag(t, e) { (t.bitrateTest = !0), this._doFragLoad(t, e).then(n => { const { hls: i } = this; if (!n || this.fragContextChanged(t)) return; (e.fragmentError = 0), (this.state = qi), (this.startFragRequested = !1), (this.bitrateTest = !1); const r = t.stats; (r.parsing.start = r.parsing.end = r.buffering.start = r.buffering.end = self.performance.now()), i.trigger(tt.FRAG_LOADED, n), (t.bitrateTest = !1); }); } _handleTransmuxComplete(t) { var e; const n = "main", { hls: i } = this, { remuxResult: r, chunkMeta: a } = t, s = this.getCurrentContext(a); if (!s) return void this.resetWhenMissingContext(a); const { frag: o, part: l, level: d } = s, { video: c, text: u, id3: h, initSegment: p } = r, { details: f } = d, m = this.altAudio ? void 0 : r.audio; if (this.fragContextChanged(o)) this.fragmentTracker.removeFragment(o); else { if (((this.state = Ji), p)) { if (null != p && p.tracks) { const t = o.initSegment || o; this._bufferInitSegment(d, p.tracks, t, a), i.trigger(tt.FRAG_PARSING_INIT_SEGMENT, { frag: t, id: n, tracks: p.tracks }); } const t = p.initPTS, e = p.timescale; X(t) && ((this.initPTS[o.cc] = { baseTime: t, timescale: e }), i.trigger(tt.INIT_PTS_FOUND, { frag: o, id: n, initPTS: t, timescale: e })); } if (c && f && "initSegment" !== o.sn) { const t = f.fragments[o.sn - 1 - f.startSN], e = o.sn === f.startSN, n = !t || o.cc > t.cc; if (!1 !== r.independent) { const { startPTS: t, endPTS: i, startDTS: r, endDTS: s } = c; if (l) l.elementaryStreams[c.type] = { startPTS: t, endPTS: i, startDTS: r, endDTS: s }; else if ( (c.firstKeyFrame && c.independent && 1 === a.id && !n && (this.couldBacktrack = !0), c.dropped && c.independent) ) { const r = this.getMainFwdBufferInfo(), a = (r ? r.end : this.getLoadPosition()) + this.config.maxBufferHole, l = c.firstKeyFramePTS ? c.firstKeyFramePTS : t; if (!e && a < l - this.config.maxBufferHole && !n) return void this.backtrack(o); n && (o.gap = !0), o.setElementaryStreamInfo(c.type, o.start, i, o.start, s, !0); } else e && t > 2 && (o.gap = !0); o.setElementaryStreamInfo(c.type, t, i, r, s), this.backtrackFragment && (this.backtrackFragment = o), this.bufferFragmentData(c, o, l, a, e || n); } else { if (!e && !n) return void this.backtrack(o); o.gap = !0; } } if (m) { const { startPTS: t, endPTS: e, startDTS: n, endDTS: i } = m; l && (l.elementaryStreams[ft] = { startPTS: t, endPTS: e, startDTS: n, endDTS: i }), o.setElementaryStreamInfo(ft, t, e, n, i), this.bufferFragmentData(m, o, l, a); } if (f && null != h && null != (e = h.samples) && e.length) { const t = { id: n, frag: o, details: f, samples: h.samples }; i.trigger(tt.FRAG_PARSING_METADATA, t); } if (f && u) { const t = { id: n, frag: o, details: f, samples: u.samples }; i.trigger(tt.FRAG_PARSING_USERDATA, t); } } } _bufferInitSegment(t, e, n, i) { if (this.state !== Ji) return; (this.audioOnly = !!e.audio && !e.video), this.altAudio && !this.audioOnly && delete e.audio; const { audio: r, video: a, audiovideo: s } = e; if (r) { let e = t.audioCodec; const n = navigator.userAgent.toLowerCase(); this.audioCodecSwitch && (e && (e = -1 !== e.indexOf("mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), 1 !== r.metadata.channelCount && -1 === n.indexOf("firefox") && (e = "mp4a.40.5")), e && -1 !== e.indexOf("mp4a.40.5") && -1 !== n.indexOf("android") && "audio/mpeg" !== r.container && ((e = "mp4a.40.2"), this.log(`Android: force audio codec to ${e}`)), t.audioCodec && t.audioCodec !== e && this.log(`Swapping manifest audio codec "${t.audioCodec}" for "${e}"`), (r.levelCodec = e), (r.id = "main"), this.log( `Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${e || ""}/${t.audioCodec || "" }/${r.codec}]` ); } a && ((a.levelCodec = t.videoCodec), (a.id = "main"), this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${t.videoCodec || ""}/${a.codec}]`)), s && this.log(`Init audiovideo buffer, container:${s.container}, codecs[level/parsed]=[${t.codecs}/${s.codec}]`), this.hls.trigger(tt.BUFFER_CODECS, e), Object.keys(e).forEach(t => { const r = e[t].initSegment; null != r && r.byteLength && this.hls.trigger(tt.BUFFER_APPENDING, { type: t, data: r, frag: n, part: null, chunkMeta: i, parent: n.type }); }), this.tickImmediate(); } getMainFwdBufferInfo() { return this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : this.media, ln); } backtrack(t) { (this.couldBacktrack = !0), (this.backtrackFragment = t), this.resetTransmuxer(), this.flushBufferGap(t), this.fragmentTracker.removeFragment(t), (this.fragPrevious = null), (this.nextLoadPosition = t.start), (this.state = qi); } checkFragmentChanged() { const t = this.media; let e = null; if (t && t.readyState > 1 && !1 === t.seeking) { const n = t.currentTime; if ( (Li.isBuffered(t, n) ? (e = this.getAppendedFrag(n)) : Li.isBuffered(t, n + 0.1) && (e = this.getAppendedFrag(n + 0.1)), e) ) { this.backtrackFragment = null; const t = this.fragPlaying, n = e.level; (t && e.sn === t.sn && t.level === n) || ((this.fragPlaying = e), this.hls.trigger(tt.FRAG_CHANGED, { frag: e }), (t && t.level === n) || this.hls.trigger(tt.LEVEL_SWITCHED, { level: n })); } } } get nextLevel() { const t = this.nextBufferedFrag; return t ? t.level : -1; } get currentFrag() { const t = this.media; return t ? this.fragPlaying || this.getAppendedFrag(t.currentTime) : null; } get currentProgramDateTime() { const t = this.media; if (t) { const e = t.currentTime, n = this.currentFrag; if (n && X(e) && X(n.programDateTime)) { const t = n.programDateTime + 1e3 * (e - n.start); return new Date(t); } } return null; } get currentLevel() { const t = this.currentFrag; return t ? t.level : -1; } get nextBufferedFrag() { const t = this.currentFrag; return t ? this.followingBufferedFrag(t) : null; } get forceStartLoad() { return this._forceStartLoad; } } class xo { static get version() { return "1.5.8"; } static isMSESupported() { return bo(); } static isSupported() { return (function () { if (!bo()) return !1; const t = Be(); return ( "function" == typeof (null == t ? void 0 : t.isTypeSupported) && (["avc1.42E01E,mp4a.40.2", "av01.0.01M.08", "vp09.00.50.08"].some(e => t.isTypeSupported(Oe(e, "video"))) || ["mp4a.40.2", "fLaC"].some(e => t.isTypeSupported(Oe(e, "audio")))) ); })(); } static getMediaSource() { return Be(); } static get Events() { return tt; } static get ErrorTypes() { return et; } static get ErrorDetails() { return nt; } static get DefaultConfig() { return xo.defaultConfig ? xo.defaultConfig : ho; } static set DefaultConfig(t) { xo.defaultConfig = t; } constructor(t = {}) { (this.config = void 0), (this.userConfig = void 0), (this.coreComponents = void 0), (this.networkControllers = void 0), (this.started = !1), (this._emitter = new ca()), (this._autoLevelCapping = -1), (this._maxHdcpLevel = null), (this.abrController = void 0), (this.bufferController = void 0), (this.capLevelController = void 0), (this.latencyController = void 0), (this.levelController = void 0), (this.streamController = void 0), (this.audioTrackController = void 0), (this.subtitleTrackController = void 0), (this.emeController = void 0), (this.cmcdController = void 0), (this._media = null), (this.url = null), (this.triggeringException = void 0), (function (t, e) { if (("object" == typeof console && !0 === t) || "object" == typeof t) { st(t, "debug", "log", "info", "warn", "error"); try { at.log(`Debug logs enabled for "${e}" in hls.js version 1.5.8`); } catch (t) { at = rt; } } else at = rt; })(t.debug || !1, "Hls instance"); const e = (this.config = (function (t, e) { if ( (e.liveSyncDurationCount || e.liveMaxLatencyDurationCount) && (e.liveSyncDuration || e.liveMaxLatencyDuration) ) throw new Error( "Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration" ); if ( void 0 !== e.liveMaxLatencyDurationCount && (void 0 === e.liveSyncDurationCount || e.liveMaxLatencyDurationCount <= e.liveSyncDurationCount) ) throw new Error( 'Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"' ); if ( void 0 !== e.liveMaxLatencyDuration && (void 0 === e.liveSyncDuration || e.liveMaxLatencyDuration <= e.liveSyncDuration) ) throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"'); const n = po(t), i = ["TimeOut", "MaxRetry", "RetryDelay", "MaxRetryTimeout"]; return ( ["manifest", "level", "frag"].forEach(t => { const r = `${"level" === t ? "playlist" : t}LoadPolicy`, a = void 0 === e[r], s = []; i.forEach(i => { const o = `${t}Loading${i}`, l = e[o]; if (void 0 !== l && a) { s.push(o); const t = n[r].default; switch (((e[r] = { default: t }), i)) { case "TimeOut": (t.maxLoadTimeMs = l), (t.maxTimeToFirstByteMs = l); break; case "MaxRetry": (t.errorRetry.maxNumRetry = l), (t.timeoutRetry.maxNumRetry = l); break; case "RetryDelay": (t.errorRetry.retryDelayMs = l), (t.timeoutRetry.retryDelayMs = l); break; case "MaxRetryTimeout": (t.errorRetry.maxRetryDelayMs = l), (t.timeoutRetry.maxRetryDelayMs = l); } } }), s.length && ot.warn( `hls.js config: "${s.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify( e[r] )}` ); }), q(q({}, n), e) ); })(xo.DefaultConfig, t)); (this.userConfig = t), e.progressive && fo(e); const { abrController: n, bufferController: i, capLevelController: r, errorController: a, fpsController: s } = e, o = new a(this), l = (this.abrController = new n(this)), d = (this.bufferController = new i(this)), c = (this.capLevelController = new r(this)), u = new s(this), h = new pn(this), p = new Tn(this), f = e.contentSteeringController, m = f ? new f(this) : null, g = (this.levelController = new go(this, m)), y = new _i(this), A = new Ao(this.config), v = (this.streamController = new wo(this, y, A)); c.setStreamController(v), u.setStreamController(v); const b = [h, g, v]; m && b.splice(1, 0, m), (this.networkControllers = b); const E = [l, d, c, u, p, y]; this.audioTrackController = this.createController(e.audioTrackController, b); const w = e.audioStreamController; w && b.push(new w(this, y, A)), (this.subtitleTrackController = this.createController(e.subtitleTrackController, b)); const x = e.subtitleStreamController; x && b.push(new x(this, y, A)), this.createController(e.timelineController, E), (A.emeController = this.emeController = this.createController(e.emeController, E)), (this.cmcdController = this.createController(e.cmcdController, E)), (this.latencyController = this.createController(kn, E)), (this.coreComponents = E), b.push(o); const S = o.onErrorOut; "function" == typeof S && this.on(tt.ERROR, S, o); } createController(t, e) { if (t) { const n = new t(this); return e && e.push(n), n; } return null; } on(t, e, n = this) { this._emitter.on(t, e, n); } once(t, e, n = this) { this._emitter.once(t, e, n); } removeAllListeners(t) { this._emitter.removeAllListeners(t); } off(t, e, n = this, i) { this._emitter.off(t, e, n, i); } listeners(t) { return this._emitter.listeners(t); } emit(t, e, n) { return this._emitter.emit(t, e, n); } trigger(t, e) { if (this.config.debug) return this.emit(t, t, e); try { return this.emit(t, t, e); } catch (e) { if ( (ot.error( "An internal error happened while handling event " + t + '. Error message: "' + e.message + '". Here is a stacktrace:', e ), !this.triggeringException) ) { this.triggeringException = !0; const n = t === tt.ERROR; this.trigger(tt.ERROR, { type: et.OTHER_ERROR, details: nt.INTERNAL_EXCEPTION, fatal: n, event: t, error: e }), (this.triggeringException = !1); } } return !1; } listenerCount(t) { return this._emitter.listenerCount(t); } destroy() { ot.log("destroy"), this.trigger(tt.DESTROYING, void 0), this.detachMedia(), this.removeAllListeners(), (this._autoLevelCapping = -1), (this.url = null), this.networkControllers.forEach(t => t.destroy()), (this.networkControllers.length = 0), this.coreComponents.forEach(t => t.destroy()), (this.coreComponents.length = 0); const t = this.config; (t.xhrSetup = t.fetchSetup = void 0), (this.userConfig = null); } attachMedia(t) { ot.log("attachMedia"), (this._media = t), this.trigger(tt.MEDIA_ATTACHING, { media: t }); } detachMedia() { ot.log("detachMedia"), this.trigger(tt.MEDIA_DETACHING, void 0), (this._media = null); } loadSource(t) { this.stopLoad(); const e = this.media, n = this.url, i = (this.url = $.buildAbsoluteURL(self.location.href, t, { alwaysNormalize: !0 })); (this._autoLevelCapping = -1), (this._maxHdcpLevel = null), ot.log(`loadSource:${i}`), e && n && (n !== i || this.bufferController.hasSourceTypes()) && (this.detachMedia(), this.attachMedia(e)), this.trigger(tt.MANIFEST_LOADING, { url: t }); } startLoad(t = -1) { ot.log(`startLoad(${t})`), (this.started = !0), this.networkControllers.forEach(e => { e.startLoad(t); }); } stopLoad() { ot.log("stopLoad"), (this.started = !1), this.networkControllers.forEach(t => { t.stopLoad(); }); } resumeBuffering() { this.started && this.networkControllers.forEach(t => { "fragmentLoader" in t && t.startLoad(-1); }); } pauseBuffering() { this.networkControllers.forEach(t => { "fragmentLoader" in t && t.stopLoad(); }); } swapAudioCodec() { ot.log("swapAudioCodec"), this.streamController.swapAudioCodec(); } recoverMediaError() { ot.log("recoverMediaError"); const t = this._media; this.detachMedia(), t && this.attachMedia(t); } removeLevel(t) { this.levelController.removeLevel(t); } get levels() { const t = this.levelController.levels; return t || []; } get currentLevel() { return this.streamController.currentLevel; } set currentLevel(t) { ot.log(`set currentLevel:${t}`), (this.levelController.manualLevel = t), this.streamController.immediateLevelSwitch(); } get nextLevel() { return this.streamController.nextLevel; } set nextLevel(t) { ot.log(`set nextLevel:${t}`), (this.levelController.manualLevel = t), this.streamController.nextLevelSwitch(); } get loadLevel() { return this.levelController.level; } set loadLevel(t) { ot.log(`set loadLevel:${t}`), (this.levelController.manualLevel = t); } get nextLoadLevel() { return this.levelController.nextLoadLevel; } set nextLoadLevel(t) { this.levelController.nextLoadLevel = t; } get firstLevel() { return Math.max(this.levelController.firstLevel, this.minAutoLevel); } set firstLevel(t) { ot.log(`set firstLevel:${t}`), (this.levelController.firstLevel = t); } get startLevel() { const t = this.levelController.startLevel; return -1 === t && this.abrController.forcedAutoLevel > -1 ? this.abrController.forcedAutoLevel : t; } set startLevel(t) { ot.log(`set startLevel:${t}`), -1 !== t && (t = Math.max(t, this.minAutoLevel)), (this.levelController.startLevel = t); } get capLevelToPlayerSize() { return this.config.capLevelToPlayerSize; } set capLevelToPlayerSize(t) { const e = !!t; e !== this.config.capLevelToPlayerSize && (e ? this.capLevelController.startCapping() : (this.capLevelController.stopCapping(), (this.autoLevelCapping = -1), this.streamController.nextLevelSwitch()), (this.config.capLevelToPlayerSize = e)); } get autoLevelCapping() { return this._autoLevelCapping; } get bandwidthEstimate() { const { bwEstimator: t } = this.abrController; return t ? t.getEstimate() : NaN; } set bandwidthEstimate(t) { this.abrController.resetEstimator(t); } get ttfbEstimate() { const { bwEstimator: t } = this.abrController; return t ? t.getEstimateTTFB() : NaN; } set autoLevelCapping(t) { this._autoLevelCapping !== t && (ot.log(`set autoLevelCapping:${t}`), (this._autoLevelCapping = t), this.levelController.checkMaxAutoUpdated()); } get maxHdcpLevel() { return this._maxHdcpLevel; } set maxHdcpLevel(t) { (function (t) { return Cn.indexOf(t) > -1; })(t) && this._maxHdcpLevel !== t && ((this._maxHdcpLevel = t), this.levelController.checkMaxAutoUpdated()); } get autoLevelEnabled() { return -1 === this.levelController.manualLevel; } get manualLevel() { return this.levelController.manualLevel; } get minAutoLevel() { const { levels: t, config: { minAutoBitrate: e } } = this; if (!t) return 0; const n = t.length; for (let i = 0; i < n; i++) if (t[i].maxBitrate >= e) return i; return 0; } get maxAutoLevel() { const { levels: t, autoLevelCapping: e, maxHdcpLevel: n } = this; let i; if (((i = -1 === e && null != t && t.length ? t.length - 1 : e), n)) for (let e = i; e--;) { const i = t[e].attrs["HDCP-LEVEL"]; if (i && i <= n) return e; } return i; } get firstAutoLevel() { return this.abrController.firstAutoLevel; } get nextAutoLevel() { return this.abrController.nextAutoLevel; } set nextAutoLevel(t) { this.abrController.nextAutoLevel = t; } get playingDate() { return this.streamController.currentProgramDateTime; } get mainForwardBufferInfo() { return this.streamController.getMainFwdBufferInfo(); } setAudioOption(t) { var e; return null == (e = this.audioTrackController) ? void 0 : e.setAudioOption(t); } setSubtitleOption(t) { var e; return null == (e = this.subtitleTrackController) || e.setSubtitleOption(t), null; } get allAudioTracks() { const t = this.audioTrackController; return t ? t.allAudioTracks : []; } get audioTracks() { const t = this.audioTrackController; return t ? t.audioTracks : []; } get audioTrack() { const t = this.audioTrackController; return t ? t.audioTrack : -1; } set audioTrack(t) { const e = this.audioTrackController; e && (e.audioTrack = t); } get allSubtitleTracks() { const t = this.subtitleTrackController; return t ? t.allSubtitleTracks : []; } get subtitleTracks() { const t = this.subtitleTrackController; return t ? t.subtitleTracks : []; } get subtitleTrack() { const t = this.subtitleTrackController; return t ? t.subtitleTrack : -1; } get media() { return this._media; } set subtitleTrack(t) { const e = this.subtitleTrackController; e && (e.subtitleTrack = t); } get subtitleDisplay() { const t = this.subtitleTrackController; return !!t && t.subtitleDisplay; } set subtitleDisplay(t) { const e = this.subtitleTrackController; e && (e.subtitleDisplay = t); } get lowLatencyMode() { return this.config.lowLatencyMode; } set lowLatencyMode(t) { this.config.lowLatencyMode = t; } get liveSyncPosition() { return this.latencyController.liveSyncPosition; } get latency() { return this.latencyController.latency; } get maxLatency() { return this.latencyController.maxLatency; } get targetLatency() { return this.latencyController.targetLatency; } get drift() { return this.latencyController.drift; } get forceStartLoad() { return this.streamController.forceStartLoad; } } function So(t) { return { all: (t = t || new Map()), on: function (e, n) { var i = t.get(e); i ? i.push(n) : t.set(e, [n]); }, off: function (e, n) { var i = t.get(e); i && (n ? i.splice(i.indexOf(n) >>> 0, 1) : t.set(e, [])); }, emit: function (e, n) { var i = t.get(e); i && i.slice().map(function (t) { t(n); }), (i = t.get("*")) && i.slice().map(function (t) { t(e, n); }); } }; } xo.defaultConfig = void 0; var _o = function () { }, To = (function () { return m( function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; f(this, t), this.config(e), this.init(); }, [ { key: "init", value: function () { var t = this; ["debug", "log", "info", "warn", "error"].forEach(function (e) { t[e] = t.enable ? self.console[e].bind(self.console, t.prefix) : _o; }); } }, { key: "config", value: function (t) { var e = t.prefix, n = void 0 === e ? "[video-player]::" : e, i = t.debug, r = void 0 !== i && i; (this.prefix = n), (this.enable = r), this.init(); } } ] ); })(), ko = "object" == ("undefined" == typeof global ? "undefined" : u(global)) && global && global.Object === Object && global, Co = "object" == ("undefined" == typeof self ? "undefined" : u(self)) && self && self.Object === Object && self, Lo = ko || Co || Function("return this")(), Io = Lo.Symbol, Ro = Object.prototype, Do = Ro.hasOwnProperty, Bo = Ro.toString, Po = Io ? Io.toStringTag : void 0; var Uo = Object.prototype.toString; var Fo = "[object Null]", Oo = "[object Undefined]", Mo = Io ? Io.toStringTag : void 0; function No(t) { return null == t ? void 0 === t ? Oo : Fo : Mo && Mo in Object(t) ? (function (t) { var e = Do.call(t, Po), n = t[Po]; try { t[Po] = void 0; var i = !0; } catch (t) { } var r = Bo.call(t); return i && (e ? (t[Po] = n) : delete t[Po]), r; })(t) : (function (t) { return Uo.call(t); })(t); } function zo(t) { return null != t && "object" == u(t); } var Go = "[object Symbol]"; function jo(t) { return "symbol" == u(t) || (zo(t) && No(t) == Go); } var Ho = Array.isArray, Yo = 1 / 0, $o = Io ? Io.prototype : void 0, Ko = $o ? $o.toString : void 0; function qo(t) { if ("string" == typeof t) return t; if (Ho(t)) return ( (function (t, e) { for (var n = -1, i = null == t ? 0 : t.length, r = Array(i); ++n < i;) r[n] = e(t[n], n, t); return r; })(t, qo) + "" ); if (jo(t)) return Ko ? Ko.call(t) : ""; var e = t + ""; return "0" == e && 1 / t == -Yo ? "-0" : e; } function Vo(t) { var e = u(t); return null != t && ("object" == e || "function" == e); } function Wo(t) { return t; } var Qo = "[object AsyncFunction]", Xo = "[object Function]", Jo = "[object GeneratorFunction]", Zo = "[object Proxy]"; function tl(t) { if (!Vo(t)) return !1; var e = No(t); return e == Xo || e == Jo || e == Qo || e == Zo; } var el, nl = Lo["__core-js_shared__"], il = (el = /[^.]+$/.exec((nl && nl.keys && nl.keys.IE_PROTO) || "")) ? "Symbol(src)_1." + el : ""; var rl = Function.prototype.toString; function al(t) { if (null != t) { try { return rl.call(t); } catch (t) { } try { return t + ""; } catch (t) { } } return ""; } var sl = /^\[object .+?Constructor\]$/, ol = Function.prototype, ll = Object.prototype, dl = ol.toString, cl = ll.hasOwnProperty, ul = RegExp( "^" + dl .call(cl) .replace(/[\\^$.*+?()[\]{}|]/g, "\\$&") .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function hl(t) { return !(!Vo(t) || ((e = t), il && il in e)) && (tl(t) ? ul : sl).test(al(t)); var e; } function pl(t, e) { var n = (function (t, e) { return null == t ? void 0 : t[e]; })(t, e); return hl(n) ? n : void 0; } var fl = pl(Lo, "WeakMap"), ml = Object.create, gl = (function () { function t() { } return function (e) { if (!Vo(e)) return {}; if (ml) return ml(e); t.prototype = e; var n = new t(); return (t.prototype = void 0), n; }; })(); var yl = (function () { try { var t = pl(Object, "defineProperty"); return t({}, "", {}), t; } catch (t) { } })(); var Al = 9007199254740991, vl = /^(?:0|[1-9]\d*)$/; function bl(t, e) { var n = u(t); return !!(e = null == e ? Al : e) && ("number" == n || ("symbol" != n && vl.test(t))) && t > -1 && t % 1 == 0 && t < e; } function El(t, e, n) { "__proto__" == e && yl ? yl(t, e, { configurable: !0, enumerable: !0, value: n, writable: !0 }) : (t[e] = n); } function wl(t, e) { return t === e || (t != t && e != e); } var xl = Object.prototype.hasOwnProperty; function Sl(t, e, n) { var i = t[e]; (xl.call(t, e) && wl(i, n) && (void 0 !== n || e in t)) || El(t, e, n); } function _l(t, e, n, i) { var r = !n; n || (n = {}); for (var a = -1, s = e.length; ++a < s;) { var o = e[a], l = void 0; void 0 === l && (l = t[o]), r ? El(n, o, l) : Sl(n, o, l); } return n; } var Tl = 9007199254740991; function kl(t) { return "number" == typeof t && t > -1 && t % 1 == 0 && t <= Tl; } function Cl(t) { return null != t && kl(t.length) && !tl(t); } var Ll = Object.prototype; function Il(t) { var e = t && t.constructor; return t === (("function" == typeof e && e.prototype) || Ll); } function Rl(t) { return zo(t) && "[object Arguments]" == No(t); } var Dl = Object.prototype, Bl = Dl.hasOwnProperty, Pl = Dl.propertyIsEnumerable, Ul = Rl( (function () { return arguments; })() ) ? Rl : function (t) { return zo(t) && Bl.call(t, "callee") && !Pl.call(t, "callee"); }; var Fl = "object" == ("undefined" == typeof exports ? "undefined" : u(exports)) && exports && !exports.nodeType && exports, Ol = Fl && "object" == ("undefined" == typeof module ? "undefined" : u(module)) && module && !module.nodeType && module, Ml = Ol && Ol.exports === Fl ? Lo.Buffer : void 0, Nl = (Ml ? Ml.isBuffer : void 0) || function () { return !1; }, zl = {}; function Gl(t) { return function (e) { return t(e); }; } (zl["[object Float32Array]"] = zl["[object Float64Array]"] = zl["[object Int8Array]"] = zl["[object Int16Array]"] = zl["[object Int32Array]"] = zl["[object Uint8Array]"] = zl["[object Uint8ClampedArray]"] = zl["[object Uint16Array]"] = zl["[object Uint32Array]"] = !0), (zl["[object Arguments]"] = zl["[object Array]"] = zl["[object ArrayBuffer]"] = zl["[object Boolean]"] = zl["[object DataView]"] = zl["[object Date]"] = zl["[object Error]"] = zl["[object Function]"] = zl["[object Map]"] = zl["[object Number]"] = zl["[object Object]"] = zl["[object RegExp]"] = zl["[object Set]"] = zl["[object String]"] = zl["[object WeakMap]"] = !1); var jl = "object" == ("undefined" == typeof exports ? "undefined" : u(exports)) && exports && !exports.nodeType && exports, Hl = jl && "object" == ("undefined" == typeof module ? "undefined" : u(module)) && module && !module.nodeType && module, Yl = Hl && Hl.exports === jl && ko.process, $l = (function () { try { var t = Hl && Hl.require && Hl.require("util").types; return t || (Yl && Yl.binding && Yl.binding("util")); } catch (t) { } })(), Kl = $l && $l.isTypedArray, ql = Kl ? Gl(Kl) : function (t) { return zo(t) && kl(t.length) && !!zl[No(t)]; }, Vl = Object.prototype.hasOwnProperty; function Wl(t, e) { var n = Ho(t), i = !n && Ul(t), r = !n && !i && Nl(t), a = !n && !i && !r && ql(t), s = n || i || r || a, o = s ? (function (t, e) { for (var n = -1, i = Array(t); ++n < t;) i[n] = e(n); return i; })(t.length, String) : [], l = o.length; for (var d in t) (!e && !Vl.call(t, d)) || (s && ("length" == d || (r && ("offset" == d || "parent" == d)) || (a && ("buffer" == d || "byteLength" == d || "byteOffset" == d)) || bl(d, l))) || o.push(d); return o; } function Ql(t, e) { return function (n) { return t(e(n)); }; } var Xl = Ql(Object.keys, Object), Jl = Object.prototype.hasOwnProperty; function Zl(t) { if (!Il(t)) return Xl(t); var e = []; for (var n in Object(t)) Jl.call(t, n) && "constructor" != n && e.push(n); return e; } function td(t) { return Cl(t) ? Wl(t) : Zl(t); } var ed = Object.prototype.hasOwnProperty; function nd(t) { if (!Vo(t)) return (function (t) { var e = []; if (null != t) for (var n in Object(t)) e.push(n); return e; })(t); var e = Il(t), n = []; for (var i in t) ("constructor" != i || (!e && ed.call(t, i))) && n.push(i); return n; } function id(t) { return Cl(t) ? Wl(t, !0) : nd(t); } var rd = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, ad = /^\w*$/; function sd(t, e) { if (Ho(t)) return !1; var n = u(t); return ( !("number" != n && "symbol" != n && "boolean" != n && null != t && !jo(t)) || ad.test(t) || !rd.test(t) || (null != e && t in Object(e)) ); } var od = pl(Object, "create"); var ld = Object.prototype.hasOwnProperty; var dd = Object.prototype.hasOwnProperty; function cd(t) { var e = -1, n = null == t ? 0 : t.length; for (this.clear(); ++e < n;) { var i = t[e]; this.set(i[0], i[1]); } } function ud(t, e) { for (var n = t.length; n--;) if (wl(t[n][0], e)) return n; return -1; } (cd.prototype.clear = function () { (this.__data__ = od ? od(null) : {}), (this.size = 0); }), (cd.prototype.delete = function (t) { var e = this.has(t) && delete this.__data__[t]; return (this.size -= e ? 1 : 0), e; }), (cd.prototype.get = function (t) { var e = this.__data__; if (od) { var n = e[t]; return "__lodash_hash_undefined__" === n ? void 0 : n; } return ld.call(e, t) ? e[t] : void 0; }), (cd.prototype.has = function (t) { var e = this.__data__; return od ? void 0 !== e[t] : dd.call(e, t); }), (cd.prototype.set = function (t, e) { var n = this.__data__; return (this.size += this.has(t) ? 0 : 1), (n[t] = od && void 0 === e ? "__lodash_hash_undefined__" : e), this; }); var hd = Array.prototype.splice; function pd(t) { var e = -1, n = null == t ? 0 : t.length; for (this.clear(); ++e < n;) { var i = t[e]; this.set(i[0], i[1]); } } (pd.prototype.clear = function () { (this.__data__ = []), (this.size = 0); }), (pd.prototype.delete = function (t) { var e = this.__data__, n = ud(e, t); return !(n < 0) && (n == e.length - 1 ? e.pop() : hd.call(e, n, 1), --this.size, !0); }), (pd.prototype.get = function (t) { var e = this.__data__, n = ud(e, t); return n < 0 ? void 0 : e[n][1]; }), (pd.prototype.has = function (t) { return ud(this.__data__, t) > -1; }), (pd.prototype.set = function (t, e) { var n = this.__data__, i = ud(n, t); return i < 0 ? (++this.size, n.push([t, e])) : (n[i][1] = e), this; }); var fd = pl(Lo, "Map"); function md(t, e) { var n, i, r = t.__data__; return ("string" == (i = u((n = e))) || "number" == i || "symbol" == i || "boolean" == i ? "__proto__" !== n : null === n) ? r["string" == typeof e ? "string" : "hash"] : r.map; } function gd(t) { var e = -1, n = null == t ? 0 : t.length; for (this.clear(); ++e < n;) { var i = t[e]; this.set(i[0], i[1]); } } (gd.prototype.clear = function () { (this.size = 0), (this.__data__ = { hash: new cd(), map: new (fd || pd)(), string: new cd() }); }), (gd.prototype.delete = function (t) { var e = md(this, t).delete(t); return (this.size -= e ? 1 : 0), e; }), (gd.prototype.get = function (t) { return md(this, t).get(t); }), (gd.prototype.has = function (t) { return md(this, t).has(t); }), (gd.prototype.set = function (t, e) { var n = md(this, t), i = n.size; return n.set(t, e), (this.size += n.size == i ? 0 : 1), this; }); var yd = "Expected a function"; function Ad(t, e) { if ("function" != typeof t || (null != e && "function" != typeof e)) throw new TypeError(yd); var n = function n() { var i = arguments, r = e ? e.apply(this, i) : i[0], a = n.cache; if (a.has(r)) return a.get(r); var s = t.apply(this, i); return (n.cache = a.set(r, s) || a), s; }; return (n.cache = new (Ad.Cache || gd)()), n; } Ad.Cache = gd; var vd, bd, Ed, wd = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, xd = /\\(\\)?/g, Sd = ((vd = function (t) { var e = []; return ( 46 === t.charCodeAt(0) && e.push(""), t.replace(wd, function (t, n, i, r) { e.push(i ? r.replace(xd, "$1") : n || t); }), e ); }), (bd = Ad(vd, function (t) { return 500 === Ed.size && Ed.clear(), t; })), (Ed = bd.cache), bd); function _d(t, e) { return Ho(t) ? t : sd(t, e) ? [t] : Sd( (function (t) { return null == t ? "" : qo(t); })(t) ); } var Td = 1 / 0; function kd(t) { if ("string" == typeof t || jo(t)) return t; var e = t + ""; return "0" == e && 1 / t == -Td ? "-0" : e; } function Cd(t, e) { for (var n = 0, i = (e = _d(e, t)).length; null != t && n < i;) t = t[kd(e[n++])]; return n && n == i ? t : void 0; } function Ld(t, e) { for (var n = -1, i = e.length, r = t.length; ++n < i;) t[r + n] = e[n]; return t; } var Id = Ql(Object.getPrototypeOf, Object); function Rd(t) { var e = (this.__data__ = new pd(t)); this.size = e.size; } (Rd.prototype.clear = function () { (this.__data__ = new pd()), (this.size = 0); }), (Rd.prototype.delete = function (t) { var e = this.__data__, n = e.delete(t); return (this.size = e.size), n; }), (Rd.prototype.get = function (t) { return this.__data__.get(t); }), (Rd.prototype.has = function (t) { return this.__data__.has(t); }), (Rd.prototype.set = function (t, e) { var n = this.__data__; if (n instanceof pd) { var i = n.__data__; if (!fd || i.length < 199) return i.push([t, e]), (this.size = ++n.size), this; n = this.__data__ = new gd(i); } return n.set(t, e), (this.size = n.size), this; }); var Dd = "object" == ("undefined" == typeof exports ? "undefined" : u(exports)) && exports && !exports.nodeType && exports, Bd = Dd && "object" == ("undefined" == typeof module ? "undefined" : u(module)) && module && !module.nodeType && module, Pd = Bd && Bd.exports === Dd ? Lo.Buffer : void 0, Ud = Pd ? Pd.allocUnsafe : void 0; function Fd() { return []; } var Od = Object.prototype.propertyIsEnumerable, Md = Object.getOwnPropertySymbols, Nd = Md ? function (t) { return null == t ? [] : ((t = Object(t)), (function (t, e) { for (var n = -1, i = null == t ? 0 : t.length, r = 0, a = []; ++n < i;) { var s = t[n]; e(s, n, t) && (a[r++] = s); } return a; })(Md(t), function (e) { return Od.call(t, e); })); } : Fd; var zd = Object.getOwnPropertySymbols ? function (t) { for (var e = []; t;) Ld(e, Nd(t)), (t = Id(t)); return e; } : Fd; function Gd(t, e, n) { var i = e(t); return Ho(t) ? i : Ld(i, n(t)); } function jd(t) { return Gd(t, td, Nd); } function Hd(t) { return Gd(t, id, zd); } var Yd = pl(Lo, "DataView"), $d = pl(Lo, "Promise"), Kd = pl(Lo, "Set"), qd = "[object Map]", Vd = "[object Promise]", Wd = "[object Set]", Qd = "[object WeakMap]", Xd = "[object DataView]", Jd = al(Yd), Zd = al(fd), tc = al($d), ec = al(Kd), nc = al(fl), ic = No; ((Yd && ic(new Yd(new ArrayBuffer(1))) != Xd) || (fd && ic(new fd()) != qd) || ($d && ic($d.resolve()) != Vd) || (Kd && ic(new Kd()) != Wd) || (fl && ic(new fl()) != Qd)) && (ic = function (t) { var e = No(t), n = "[object Object]" == e ? t.constructor : void 0, i = n ? al(n) : ""; if (i) switch (i) { case Jd: return Xd; case Zd: return qd; case tc: return Vd; case ec: return Wd; case nc: return Qd; } return e; }); var rc = Object.prototype.hasOwnProperty; var ac = Lo.Uint8Array; function sc(t) { var e = new t.constructor(t.byteLength); return new ac(e).set(new ac(t)), e; } var oc = /\w*$/; var lc = Io ? Io.prototype : void 0, dc = lc ? lc.valueOf : void 0; var cc = "[object Boolean]", uc = "[object Date]", hc = "[object Map]", pc = "[object Number]", fc = "[object RegExp]", mc = "[object Set]", gc = "[object String]", yc = "[object Symbol]", Ac = "[object ArrayBuffer]", vc = "[object DataView]", bc = "[object Float32Array]", Ec = "[object Float64Array]", wc = "[object Int8Array]", xc = "[object Int16Array]", Sc = "[object Int32Array]", _c = "[object Uint8Array]", Tc = "[object Uint8ClampedArray]", kc = "[object Uint16Array]", Cc = "[object Uint32Array]"; function Lc(t, e, n) { var i, r = t.constructor; switch (e) { case Ac: return sc(t); case cc: case uc: return new r(+t); case vc: return (function (t, e) { var n = e ? sc(t.buffer) : t.buffer; return new t.constructor(n, t.byteOffset, t.byteLength); })(t, n); case bc: case Ec: case wc: case xc: case Sc: case _c: case Tc: case kc: case Cc: return (function (t, e) { var n = e ? sc(t.buffer) : t.buffer; return new t.constructor(n, t.byteOffset, t.length); })(t, n); case hc: return new r(); case pc: case gc: return new r(t); case fc: return (function (t) { var e = new t.constructor(t.source, oc.exec(t)); return (e.lastIndex = t.lastIndex), e; })(t); case mc: return new r(); case yc: return (i = t), dc ? Object(dc.call(i)) : {}; } } var Ic = $l && $l.isMap, Rc = Ic ? Gl(Ic) : function (t) { return zo(t) && "[object Map]" == ic(t); }; var Dc = $l && $l.isSet, Bc = Dc ? Gl(Dc) : function (t) { return zo(t) && "[object Set]" == ic(t); }, Pc = 1, Uc = 2, Fc = 4, Oc = "[object Arguments]", Mc = "[object Function]", Nc = "[object GeneratorFunction]", zc = "[object Object]", Gc = {}; function jc(t, e, n, i, r, a) { var s, o = e & Pc, l = e & Uc, d = e & Fc; if (void 0 !== s) return s; if (!Vo(t)) return t; var c = Ho(t); if (c) { if ( ((s = (function (t) { var e = t.length, n = new t.constructor(e); return e && "string" == typeof t[0] && rc.call(t, "index") && ((n.index = t.index), (n.input = t.input)), n; })(t)), !o) ) return (function (t, e) { var n = -1, i = t.length; for (e || (e = Array(i)); ++n < i;) e[n] = t[n]; return e; })(t, s); } else { var u = ic(t), h = u == Mc || u == Nc; if (Nl(t)) return (function (t, e) { if (e) return t.slice(); var n = t.length, i = Ud ? Ud(n) : new t.constructor(n); return t.copy(i), i; })(t, o); if (u == zc || u == Oc || (h && !r)) { if ( ((s = l || h ? {} : (function (t) { return "function" != typeof t.constructor || Il(t) ? {} : gl(Id(t)); })(t)), !o) ) return l ? (function (t, e) { return _l(t, zd(t), e); })( t, (function (t, e) { return t && _l(e, id(e), t); })(s, t) ) : (function (t, e) { return _l(t, Nd(t), e); })( t, (function (t, e) { return t && _l(e, td(e), t); })(s, t) ); } else { if (!Gc[u]) return r ? t : {}; s = Lc(t, u, o); } } a || (a = new Rd()); var p = a.get(t); if (p) return p; a.set(t, s), Bc(t) ? t.forEach(function (i) { s.add(jc(i, e, n, i, t, a)); }) : Rc(t) && t.forEach(function (i, r) { s.set(r, jc(i, e, n, r, t, a)); }); var f = c ? void 0 : (d ? (l ? Hd : jd) : l ? id : td)(t); return ( (function (t, e) { for (var n = -1, i = null == t ? 0 : t.length; ++n < i && !1 !== e(t[n], n, t);); })(f || t, function (i, r) { f && (i = t[(r = i)]), Sl(s, r, jc(i, e, n, r, t, a)); }), s ); } (Gc[Oc] = Gc["[object Array]"] = Gc["[object ArrayBuffer]"] = Gc["[object DataView]"] = Gc["[object Boolean]"] = Gc["[object Date]"] = Gc["[object Float32Array]"] = Gc["[object Float64Array]"] = Gc["[object Int8Array]"] = Gc["[object Int16Array]"] = Gc["[object Int32Array]"] = Gc["[object Map]"] = Gc["[object Number]"] = Gc[zc] = Gc["[object RegExp]"] = Gc["[object Set]"] = Gc["[object String]"] = Gc["[object Symbol]"] = Gc["[object Uint8Array]"] = Gc["[object Uint8ClampedArray]"] = Gc["[object Uint16Array]"] = Gc["[object Uint32Array]"] = !0), (Gc["[object Error]"] = Gc[Mc] = Gc["[object WeakMap]"] = !1); function Hc(t) { var e = -1, n = null == t ? 0 : t.length; for (this.__data__ = new gd(); ++e < n;) this.add(t[e]); } function Yc(t, e) { for (var n = -1, i = null == t ? 0 : t.length; ++n < i;) if (e(t[n], n, t)) return !0; return !1; } function $c(t, e) { return t.has(e); } (Hc.prototype.add = Hc.prototype.push = function (t) { return this.__data__.set(t, "__lodash_hash_undefined__"), this; }), (Hc.prototype.has = function (t) { return this.__data__.has(t); }); var Kc = 1, qc = 2; function Vc(t, e, n, i, r, a) { var s = n & Kc, o = t.length, l = e.length; if (o != l && !(s && l > o)) return !1; var d = a.get(t), c = a.get(e); if (d && c) return d == e && c == t; var u = -1, h = !0, p = n & qc ? new Hc() : void 0; for (a.set(t, e), a.set(e, t); ++u < o;) { var f = t[u], m = e[u]; if (i) var g = s ? i(m, f, u, e, t, a) : i(f, m, u, t, e, a); if (void 0 !== g) { if (g) continue; h = !1; break; } if (p) { if ( !Yc(e, function (t, e) { if (!$c(p, e) && (f === t || r(f, t, n, i, a))) return p.push(e); }) ) { h = !1; break; } } else if (f !== m && !r(f, m, n, i, a)) { h = !1; break; } } return a.delete(t), a.delete(e), h; } function Wc(t) { var e = -1, n = Array(t.size); return ( t.forEach(function (t, i) { n[++e] = [i, t]; }), n ); } function Qc(t) { var e = -1, n = Array(t.size); return ( t.forEach(function (t) { n[++e] = t; }), n ); } var Xc = 1, Jc = 2, Zc = "[object Boolean]", tu = "[object Date]", eu = "[object Error]", nu = "[object Map]", iu = "[object Number]", ru = "[object RegExp]", au = "[object Set]", su = "[object String]", ou = "[object Symbol]", lu = "[object ArrayBuffer]", du = "[object DataView]", cu = Io ? Io.prototype : void 0, uu = cu ? cu.valueOf : void 0; var hu = 1, pu = Object.prototype.hasOwnProperty; var fu = 1, mu = "[object Arguments]", gu = "[object Array]", yu = "[object Object]", Au = Object.prototype.hasOwnProperty; function vu(t, e, n, i, r, a) { var s = Ho(t), o = Ho(e), l = s ? gu : ic(t), d = o ? gu : ic(e), c = (l = l == mu ? yu : l) == yu, u = (d = d == mu ? yu : d) == yu, h = l == d; if (h && Nl(t)) { if (!Nl(e)) return !1; (s = !0), (c = !1); } if (h && !c) return ( a || (a = new Rd()), s || ql(t) ? Vc(t, e, n, i, r, a) : (function (t, e, n, i, r, a, s) { switch (n) { case du: if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset) return !1; (t = t.buffer), (e = e.buffer); case lu: return !(t.byteLength != e.byteLength || !a(new ac(t), new ac(e))); case Zc: case tu: case iu: return wl(+t, +e); case eu: return t.name == e.name && t.message == e.message; case ru: case su: return t == e + ""; case nu: var o = Wc; case au: var l = i & Xc; if ((o || (o = Qc), t.size != e.size && !l)) return !1; var d = s.get(t); if (d) return d == e; (i |= Jc), s.set(t, e); var c = Vc(o(t), o(e), i, r, a, s); return s.delete(t), c; case ou: if (uu) return uu.call(t) == uu.call(e); } return !1; })(t, e, l, n, i, r, a) ); if (!(n & fu)) { var p = c && Au.call(t, "__wrapped__"), f = u && Au.call(e, "__wrapped__"); if (p || f) { var m = p ? t.value() : t, g = f ? e.value() : e; return a || (a = new Rd()), r(m, g, n, i, a); } } return ( !!h && (a || (a = new Rd()), (function (t, e, n, i, r, a) { var s = n & hu, o = jd(t), l = o.length; if (l != jd(e).length && !s) return !1; for (var d = l; d--;) { var c = o[d]; if (!(s ? c in e : pu.call(e, c))) return !1; } var u = a.get(t), h = a.get(e); if (u && h) return u == e && h == t; var p = !0; a.set(t, e), a.set(e, t); for (var f = s; ++d < l;) { var m = t[(c = o[d])], g = e[c]; if (i) var y = s ? i(g, m, c, e, t, a) : i(m, g, c, t, e, a); if (!(void 0 === y ? m === g || r(m, g, n, i, a) : y)) { p = !1; break; } f || (f = "constructor" == c); } if (p && !f) { var A = t.constructor, v = e.constructor; A == v || !("constructor" in t) || !("constructor" in e) || ("function" == typeof A && A instanceof A && "function" == typeof v && v instanceof v) || (p = !1); } return a.delete(t), a.delete(e), p; })(t, e, n, i, r, a)) ); } function bu(t, e, n, i, r) { return t === e || (null == t || null == e || (!zo(t) && !zo(e)) ? t != t && e != e : vu(t, e, n, i, bu, r)); } var Eu = 1, wu = 2; function xu(t) { return t == t && !Vo(t); } function Su(t, e) { return function (n) { return null != n && n[t] === e && (void 0 !== e || t in Object(n)); }; } function _u(t) { var e = (function (t) { for (var e = td(t), n = e.length; n--;) { var i = e[n], r = t[i]; e[n] = [i, r, xu(r)]; } return e; })(t); return 1 == e.length && e[0][2] ? Su(e[0][0], e[0][1]) : function (n) { return ( n === t || (function (t, e, n, i) { var r = n.length, a = r; if (null == t) return !a; for (t = Object(t); r--;) { var s = n[r]; if (s[2] ? s[1] !== t[s[0]] : !(s[0] in t)) return !1; } for (; ++r < a;) { var o = (s = n[r])[0], l = t[o], d = s[1]; if (s[2]) { if (void 0 === l && !(o in t)) return !1; } else { var c = new Rd(); if (!bu(d, l, Eu | wu, i, c)) return !1; } } return !0; })(n, 0, e) ); }; } function Tu(t, e) { return null != t && e in Object(t); } function ku(t, e) { return ( null != t && (function (t, e, n) { for (var i = -1, r = (e = _d(e, t)).length, a = !1; ++i < r;) { var s = kd(e[i]); if (!(a = null != t && n(t, s))) break; t = t[s]; } return a || ++i != r ? a : !!(r = null == t ? 0 : t.length) && kl(r) && bl(s, r) && (Ho(t) || Ul(t)); })(t, e, Tu) ); } var Cu = 1, Lu = 2; function Iu(t, e) { return sd(t) && xu(e) ? Su(kd(t), e) : function (n) { var i = (function (t, e, n) { var i = null == t ? void 0 : Cd(t, e); return void 0 === i ? n : i; })(n, t); return void 0 === i && i === e ? ku(n, t) : bu(e, i, Cu | Lu); }; } function Ru(t) { return sd(t) ? ((e = kd(t)), function (t) { return null == t ? void 0 : t[e]; }) : (function (t) { return function (e) { return Cd(e, t); }; })(t); var e; } function Du(t, e, n) { if (!(null == t ? 0 : t.length)) return -1; var i; return (function (t, e, n, i) { for (var r = t.length, a = n + -1; ++a < r;) if (e(t[a], a, t)) return a; return -1; })(t, "function" == typeof (i = e) ? i : null == i ? Wo : "object" == u(i) ? (Ho(i) ? Iu(i[0], i[1]) : _u(i)) : Ru(i), 0); } var Bu = "[object String]"; function Pu(t) { return "string" == typeof t || (!Ho(t) && zo(t) && No(t) == Bu); } function Uu(t) { return !0 === t || !1 === t || (zo(t) && "[object Boolean]" == No(t)); } var Fu = $l && $l.isDate, Ou = Fu ? Gl(Fu) : function (t) { return zo(t) && "[object Date]" == No(t); }, Mu = Object.prototype.hasOwnProperty; var Nu = "[object Number]"; function zu(t) { return "number" == typeof t || (zo(t) && No(t) == Nu); } function Gu(t) { return void 0 === t; } var ju = (function () { return m( function t(e) { var n = e.logger, i = e.emitter; e.interval, f(this, t), g(this, "reports", []), g(this, "timer", null), (this.Logger = n || console), (this.Eimtter = i), i.on("report-event", this.add.bind(this)); }, [ { key: "add", value: function () { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; (t.time = new Date().toLocaleString()), this.reports.push(t); } }, { key: "uploadReports", value: function () { this.reports.length; } }, { key: "destroy", value: function () { this.uploadReports(), (this.reports = []), clearInterval(this.timer); } } ] ); })(), Hu = (function () { function t() { this.listeners = {}; } var e = t.prototype; return ( (e.on = function (t, e) { this.listeners[t] || (this.listeners[t] = []), this.listeners[t].push(e); }), (e.off = function (t, e) { if (!this.listeners[t]) return !1; var n = this.listeners[t].indexOf(e); return (this.listeners[t] = this.listeners[t].slice(0)), this.listeners[t].splice(n, 1), n > -1; }), (e.trigger = function (t) { var e = this.listeners[t]; if (e) if (2 === arguments.length) for (var n = e.length, i = 0; i < n; ++i) e[i].call(this, arguments[1]); else for (var r = Array.prototype.slice.call(arguments, 1), a = e.length, s = 0; s < a; ++s) e[s].apply(this, r); }), (e.dispose = function () { this.listeners = {}; }), (e.pipe = function (t) { this.on("data", function (e) { t.push(e); }); }), t ); })(); function Yu() { return ( (Yu = Object.assign ? Object.assign.bind() : function (t) { for (var e = 1; e < arguments.length; e++) { var n = arguments[e]; for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]); } return t; }), Yu.apply(this, arguments) ); } var $u = k("undefined" != typeof window ? window : void 0 !== T ? T : "undefined" != typeof self ? self : {}); function Ku(t) { for ( var e, n = ((e = t), $u.atob ? $u.atob(e) : Buffer.from(e, "base64").toString("binary")), i = new Uint8Array(n.length), r = 0; r < n.length; r++ ) i[r] = n.charCodeAt(r); return i; } var qu = (function (t) { function e() { var t; return f(this, e), ((t = n(this, e)).buffer = ""), t; } return ( y(e, t), m(e, [ { key: "push", value: function (t) { var e; for (this.buffer += t, e = this.buffer.indexOf("\n"); e > -1; e = this.buffer.indexOf("\n")) this.trigger("data", this.buffer.substring(0, e)), (this.buffer = this.buffer.substring(e + 1)); } } ]) ); })(Hu), Vu = String.fromCharCode(9), Wu = function (t) { var e = /([0-9.]*)?@?([0-9.]*)?/.exec(t || ""), n = {}; return e[1] && (n.length = parseInt(e[1], 10)), e[2] && (n.offset = parseInt(e[2], 10)), n; }, Qu = function (t) { var e = {}; if (!t) return e; for (var n, i = t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), r = i.length; r--;) "" !== i[r] && (((n = /([^=]*)=(.*)/.exec(i[r]).slice(1))[0] = n[0].replace(/^\s+|\s+$/g, "")), (n[1] = n[1].replace(/^\s+|\s+$/g, "")), (n[1] = n[1].replace(/^['"](.*)['"]$/g, "$1")), (e[n[0]] = n[1])); return e; }, Xu = (function (t) { function e() { var t; return f(this, e), ((t = n(this, e)).customParsers = []), (t.tagMappers = []), t; } return ( y(e, t), m(e, [ { key: "push", value: function (t) { var e, n, i = this; 0 !== (t = t.trim()).length && ("#" === t[0] ? this.tagMappers .reduce( function (e, n) { var i = n(t); return i === t ? e : e.concat([i]); }, [t] ) .forEach(function (t) { for (var r = 0; r < i.customParsers.length; r++) if (i.customParsers[r].call(i, t)) return; if (0 === t.indexOf("#EXT")) if (((t = t.replace("\r", "")), (e = /^#EXTM3U/.exec(t)))) i.trigger("data", { type: "tag", tagType: "m3u" }); else { if ((e = /^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(t))) return ( (n = { type: "tag", tagType: "inf" }), e[1] && (n.duration = parseFloat(e[1])), e[2] && (n.title = e[2]), void i.trigger("data", n) ); if ((e = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(t))) return ( (n = { type: "tag", tagType: "targetduration" }), e[1] && (n.duration = parseInt(e[1], 10)), void i.trigger("data", n) ); if ((e = /^#EXT-X-VERSION:([0-9.]*)?/.exec(t))) return ( (n = { type: "tag", tagType: "version" }), e[1] && (n.version = parseInt(e[1], 10)), void i.trigger("data", n) ); if ((e = /^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(t))) return ( (n = { type: "tag", tagType: "media-sequence" }), e[1] && (n.number = parseInt(e[1], 10)), void i.trigger("data", n) ); if ((e = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(t))) return ( (n = { type: "tag", tagType: "discontinuity-sequence" }), e[1] && (n.number = parseInt(e[1], 10)), void i.trigger("data", n) ); if ((e = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(t))) return ( (n = { type: "tag", tagType: "playlist-type" }), e[1] && (n.playlistType = e[1]), void i.trigger("data", n) ); if ((e = /^#EXT-X-BYTERANGE:(.*)?$/.exec(t))) return ( (n = Yu(Wu(e[1]), { type: "tag", tagType: "byterange" })), void i.trigger("data", n) ); if ((e = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(t))) return ( (n = { type: "tag", tagType: "allow-cache" }), e[1] && (n.allowed = !/NO/.test(e[1])), void i.trigger("data", n) ); if ((e = /^#EXT-X-MAP:(.*)$/.exec(t))) { if (((n = { type: "tag", tagType: "map" }), e[1])) { var a = Qu(e[1]); a.URI && (n.uri = a.URI), a.BYTERANGE && (n.byterange = Wu(a.BYTERANGE)); } i.trigger("data", n); } else if ((e = /^#EXT-X-STREAM-INF:(.*)$/.exec(t))) { if (((n = { type: "tag", tagType: "stream-inf" }), e[1])) { if (((n.attributes = Qu(e[1])), n.attributes.RESOLUTION)) { var s = n.attributes.RESOLUTION.split("x"), o = {}; s[0] && (o.width = parseInt(s[0], 10)), s[1] && (o.height = parseInt(s[1], 10)), (n.attributes.RESOLUTION = o); } n.attributes.BANDWIDTH && (n.attributes.BANDWIDTH = parseInt(n.attributes.BANDWIDTH, 10)), n.attributes["FRAME-RATE"] && (n.attributes["FRAME-RATE"] = parseFloat( n.attributes["FRAME-RATE"] )), n.attributes["PROGRAM-ID"] && (n.attributes["PROGRAM-ID"] = parseInt( n.attributes["PROGRAM-ID"], 10 )); } i.trigger("data", n); } else { if ((e = /^#EXT-X-MEDIA:(.*)$/.exec(t))) return ( (n = { type: "tag", tagType: "media" }), e[1] && (n.attributes = Qu(e[1])), void i.trigger("data", n) ); if ((e = /^#EXT-X-ENDLIST/.exec(t))) i.trigger("data", { type: "tag", tagType: "endlist" }); else if ((e = /^#EXT-X-DISCONTINUITY/.exec(t))) i.trigger("data", { type: "tag", tagType: "discontinuity" }); else { if ((e = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(t))) return ( (n = { type: "tag", tagType: "program-date-time" }), e[1] && ((n.dateTimeString = e[1]), (n.dateTimeObject = new Date(e[1]))), void i.trigger("data", n) ); if ((e = /^#EXT-X-KEY:(.*)$/.exec(t))) return ( (n = { type: "tag", tagType: "key" }), e[1] && ((n.attributes = Qu(e[1])), n.attributes.IV && ("0x" === n.attributes.IV.substring(0, 2).toLowerCase() && (n.attributes.IV = n.attributes.IV.substring(2)), (n.attributes.IV = n.attributes.IV.match(/.{8}/g)), (n.attributes.IV[0] = parseInt( n.attributes.IV[0], 16 )), (n.attributes.IV[1] = parseInt( n.attributes.IV[1], 16 )), (n.attributes.IV[2] = parseInt( n.attributes.IV[2], 16 )), (n.attributes.IV[3] = parseInt( n.attributes.IV[3], 16 )), (n.attributes.IV = new Uint32Array( n.attributes.IV )))), void i.trigger("data", n) ); if ((e = /^#EXT-X-START:(.*)$/.exec(t))) return ( (n = { type: "tag", tagType: "start" }), e[1] && ((n.attributes = Qu(e[1])), (n.attributes["TIME-OFFSET"] = parseFloat( n.attributes["TIME-OFFSET"] )), (n.attributes.PRECISE = /YES/.test( n.attributes.PRECISE ))), void i.trigger("data", n) ); if ((e = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(t))) return ( (n = { type: "tag", tagType: "cue-out-cont" }), e[1] ? (n.data = e[1]) : (n.data = ""), void i.trigger("data", n) ); if ((e = /^#EXT-X-CUE-OUT:(.*)?$/.exec(t))) return ( (n = { type: "tag", tagType: "cue-out" }), e[1] ? (n.data = e[1]) : (n.data = ""), void i.trigger("data", n) ); if ((e = /^#EXT-X-CUE-IN:(.*)?$/.exec(t))) return ( (n = { type: "tag", tagType: "cue-in" }), e[1] ? (n.data = e[1]) : (n.data = ""), void i.trigger("data", n) ); if ((e = /^#EXT-X-SKIP:(.*)$/.exec(t)) && e[1]) return ( ((n = { type: "tag", tagType: "skip" }).attributes = Qu( e[1] )), n.attributes.hasOwnProperty("SKIPPED-SEGMENTS") && (n.attributes["SKIPPED-SEGMENTS"] = parseInt( n.attributes["SKIPPED-SEGMENTS"], 10 )), n.attributes.hasOwnProperty( "RECENTLY-REMOVED-DATERANGES" ) && (n.attributes["RECENTLY-REMOVED-DATERANGES"] = n.attributes["RECENTLY-REMOVED-DATERANGES"].split( Vu )), void i.trigger("data", n) ); if ((e = /^#EXT-X-PART:(.*)$/.exec(t)) && e[1]) return ( ((n = { type: "tag", tagType: "part" }).attributes = Qu( e[1] )), ["DURATION"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = parseFloat(n.attributes[t])); }), ["INDEPENDENT", "GAP"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = /YES/.test(n.attributes[t])); }), n.attributes.hasOwnProperty("BYTERANGE") && (n.attributes.byterange = Wu(n.attributes.BYTERANGE)), void i.trigger("data", n) ); if ((e = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(t)) && e[1]) return ( ((n = { type: "tag", tagType: "server-control" }).attributes = Qu(e[1])), ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach( function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = parseFloat(n.attributes[t])); } ), ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach( function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = /YES/.test(n.attributes[t])); } ), void i.trigger("data", n) ); if ((e = /^#EXT-X-PART-INF:(.*)$/.exec(t)) && e[1]) return ( ((n = { type: "tag", tagType: "part-inf" }).attributes = Qu( e[1] )), ["PART-TARGET"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = parseFloat(n.attributes[t])); }), void i.trigger("data", n) ); if ((e = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(t)) && e[1]) return ( ((n = { type: "tag", tagType: "preload-hint" }).attributes = Qu(e[1])), ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function ( t ) { if (n.attributes.hasOwnProperty(t)) { n.attributes[t] = parseInt(n.attributes[t], 10); var e = "BYTERANGE-LENGTH" === t ? "length" : "offset"; (n.attributes.byterange = n.attributes.byterange || {}), (n.attributes.byterange[e] = n.attributes[t]), delete n.attributes[t]; } }), void i.trigger("data", n) ); if ((e = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(t)) && e[1]) return ( ((n = { type: "tag", tagType: "rendition-report" }).attributes = Qu(e[1])), ["LAST-MSN", "LAST-PART"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = parseInt(n.attributes[t], 10)); }), void i.trigger("data", n) ); if ((e = /^#EXT-X-DATERANGE:(.*)$/.exec(t)) && e[1]) { ((n = { type: "tag", tagType: "daterange" }).attributes = Qu( e[1] )), ["ID", "CLASS"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = String(n.attributes[t])); }), ["START-DATE", "END-DATE"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = new Date(n.attributes[t])); }), ["DURATION", "PLANNED-DURATION"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = parseFloat(n.attributes[t])); }), ["END-ON-NEXT"].forEach(function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = /YES/i.test(n.attributes[t])); }), ["SCTE35-CMD", " SCTE35-OUT", "SCTE35-IN"].forEach( function (t) { n.attributes.hasOwnProperty(t) && (n.attributes[t] = n.attributes[t].toString(16)); } ); var l = /^X-([A-Z]+-)+[A-Z]+$/; for (var d in n.attributes) if (l.test(d)) { var c = /[0-9A-Fa-f]{6}/g.test(n.attributes[d]), u = /^\d+(\.\d+)?$/.test(n.attributes[d]); n.attributes[d] = c ? n.attributes[d].toString(16) : u ? parseFloat(n.attributes[d]) : String(n.attributes[d]); } i.trigger("data", n); } else if ((e = /^#EXT-X-INDEPENDENT-SEGMENTS/.exec(t))) i.trigger("data", { type: "tag", tagType: "independent-segments" }); else { if ((e = /^#EXT-X-CONTENT-STEERING:(.*)$/.exec(t))) return ( ((n = { type: "tag", tagType: "content-steering" }).attributes = Qu(e[1])), void i.trigger("data", n) ); i.trigger("data", { type: "tag", data: t.slice(4) }); } } } } else i.trigger("data", { type: "comment", text: t.slice(1) }); }) : this.trigger("data", { type: "uri", uri: t })); } }, { key: "addParser", value: function (t) { var e = this, n = t.expression, i = t.customType, r = t.dataParser, a = t.segment; "function" != typeof r && (r = function (t) { return t; }), this.customParsers.push(function (t) { if (n.exec(t)) return e.trigger("data", { type: "custom", data: r(t), customType: i, segment: a }), !0; }); } }, { key: "addTagMapper", value: function (t) { var e = t.expression, n = t.map; this.tagMappers.push(function (t) { return e.test(t) ? n(t) : t; }); } } ]) ); })(Hu), Ju = function (t) { var e = {}; return ( Object.keys(t).forEach(function (n) { var i; e[ ((i = n), i.toLowerCase().replace(/-(\w)/g, function (t) { return t[1].toUpperCase(); })) ] = t[n]; }), e ); }, Zu = function (t) { var e = t.serverControl, n = t.targetDuration, i = t.partTargetDuration; if (e) { var r = "#EXT-X-SERVER-CONTROL", a = "holdBack", s = "partHoldBack", o = n && 3 * n, l = i && 2 * i; n && !e.hasOwnProperty(a) && ((e[a] = o), this.trigger("info", { message: "".concat(r, " defaulting HOLD-BACK to targetDuration * 3 (").concat(o, ").") })), o && e[a] < o && (this.trigger("warn", { message: "" .concat(r, " clamping HOLD-BACK (") .concat(e[a], ") to targetDuration * 3 (") .concat(o, ")") }), (e[a] = o)), i && !e.hasOwnProperty(s) && ((e[s] = 3 * i), this.trigger("info", { message: "".concat(r, " defaulting PART-HOLD-BACK to partTargetDuration * 3 (").concat(e[s], ").") })), i && e[s] < l && (this.trigger("warn", { message: "" .concat(r, " clamping PART-HOLD-BACK (") .concat(e[s], ") to partTargetDuration * 2 (") .concat(l, ").") }), (e[s] = l)); } }, th = (function (t) { function e() { var t; f(this, e), ((t = n(this, e)).lineStream = new qu()), (t.parseStream = new Xu()), t.lineStream.pipe(t.parseStream), (t.lastProgramDateTime = null); var i, r, a = t, s = [], o = {}, l = !1, d = function () { }, c = { AUDIO: {}, VIDEO: {}, "CLOSED-CAPTIONS": {}, SUBTITLES: {} }, u = 0; t.manifest = { allowCache: !0, discontinuityStarts: [], dateRanges: [], segments: [] }; var h = 0, p = 0, m = {}; return ( t.on("end", function () { o.uri || (!o.parts && !o.preloadHints) || (!o.map && i && (o.map = i), !o.key && r && (o.key = r), o.timeline || "number" != typeof u || (o.timeline = u), (t.manifest.preloadSegment = o)); }), t.parseStream.on("data", function (t) { var e, n; ({ tag: function () { ( ({ version: function () { t.version && (this.manifest.version = t.version); }, "allow-cache": function () { (this.manifest.allowCache = t.allowed), "allowed" in t || (this.trigger("info", { message: "defaulting allowCache to YES" }), (this.manifest.allowCache = !0)); }, byterange: function () { var e = {}; "length" in t && ((o.byterange = e), (e.length = t.length), "offset" in t || (t.offset = h)), "offset" in t && ((o.byterange = e), (e.offset = t.offset)), (h = e.offset + e.length); }, endlist: function () { this.manifest.endList = !0; }, inf: function () { "mediaSequence" in this.manifest || ((this.manifest.mediaSequence = 0), this.trigger("info", { message: "defaulting media sequence to zero" })), "discontinuitySequence" in this.manifest || ((this.manifest.discontinuitySequence = 0), this.trigger("info", { message: "defaulting discontinuity sequence to zero" })), t.title && (o.title = t.title), t.duration > 0 && (o.duration = t.duration), 0 === t.duration && ((o.duration = 0.01), this.trigger("info", { message: "updating zero segment duration to a small value" })), (this.manifest.segments = s); }, key: function () { if (t.attributes) if ("NONE" !== t.attributes.METHOD) if (t.attributes.URI) { if ("com.apple.streamingkeydelivery" === t.attributes.KEYFORMAT) return ( (this.manifest.contentProtection = this.manifest.contentProtection || {}), void (this.manifest.contentProtection["com.apple.fps.1_0"] = { attributes: t.attributes }) ); if ("com.microsoft.playready" === t.attributes.KEYFORMAT) return ( (this.manifest.contentProtection = this.manifest.contentProtection || {}), void (this.manifest.contentProtection["com.microsoft.playready"] = { uri: t.attributes.URI }) ); if ( "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" === t.attributes.KEYFORMAT ) { return -1 === ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"].indexOf( t.attributes.METHOD ) ? void this.trigger("warn", { message: "invalid key method provided for Widevine" }) : ("SAMPLE-AES-CENC" === t.attributes.METHOD && this.trigger("warn", { message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead" }), "data:text/plain;base64," !== t.attributes.URI.substring(0, 23) ? void this.trigger("warn", { message: "invalid key URI provided for Widevine" }) : t.attributes.KEYID && "0x" === t.attributes.KEYID.substring(0, 2) ? ((this.manifest.contentProtection = this.manifest.contentProtection || {}), void (this.manifest.contentProtection[ "com.widevine.alpha" ] = { attributes: { schemeIdUri: t.attributes.KEYFORMAT, keyId: t.attributes.KEYID.substring(2) }, pssh: Ku(t.attributes.URI.split(",")[1]) })) : void this.trigger("warn", { message: "invalid key ID provided for Widevine" })); } t.attributes.METHOD || this.trigger("warn", { message: "defaulting key method to AES-128" }), (r = { method: t.attributes.METHOD || "AES-128", uri: t.attributes.URI }), void 0 !== t.attributes.IV && (r.iv = t.attributes.IV); } else this.trigger("warn", { message: "ignoring key declaration without URI" }); else r = null; else this.trigger("warn", { message: "ignoring key declaration without attribute list" }); }, "media-sequence": function () { isFinite(t.number) ? (this.manifest.mediaSequence = t.number) : this.trigger("warn", { message: "ignoring invalid media sequence: " + t.number }); }, "discontinuity-sequence": function () { isFinite(t.number) ? ((this.manifest.discontinuitySequence = t.number), (u = t.number)) : this.trigger("warn", { message: "ignoring invalid discontinuity sequence: " + t.number }); }, "playlist-type": function () { /VOD|EVENT/.test(t.playlistType) ? (this.manifest.playlistType = t.playlistType) : this.trigger("warn", { message: "ignoring unknown playlist type: " + t.playlist }); }, map: function () { (i = {}), t.uri && (i.uri = t.uri), t.byterange && (i.byterange = t.byterange), r && (i.key = r); }, "stream-inf": function () { (this.manifest.playlists = s), (this.manifest.mediaGroups = this.manifest.mediaGroups || c), t.attributes ? (o.attributes || (o.attributes = {}), Yu(o.attributes, t.attributes)) : this.trigger("warn", { message: "ignoring empty stream-inf attributes" }); }, media: function () { if ( ((this.manifest.mediaGroups = this.manifest.mediaGroups || c), t.attributes && t.attributes.TYPE && t.attributes["GROUP-ID"] && t.attributes.NAME) ) { var i = this.manifest.mediaGroups[t.attributes.TYPE]; (i[t.attributes["GROUP-ID"]] = i[t.attributes["GROUP-ID"]] || {}), (e = i[t.attributes["GROUP-ID"]]), (n = { default: /yes/i.test(t.attributes.DEFAULT) }).default ? (n.autoselect = !0) : (n.autoselect = /yes/i.test(t.attributes.AUTOSELECT)), t.attributes.LANGUAGE && (n.language = t.attributes.LANGUAGE), t.attributes.URI && (n.uri = t.attributes.URI), t.attributes["INSTREAM-ID"] && (n.instreamId = t.attributes["INSTREAM-ID"]), t.attributes.CHARACTERISTICS && (n.characteristics = t.attributes.CHARACTERISTICS), t.attributes.FORCED && (n.forced = /yes/i.test(t.attributes.FORCED)), (e[t.attributes.NAME] = n); } else this.trigger("warn", { message: "ignoring incomplete or missing media group" }); }, discontinuity: function () { (u += 1), (o.discontinuity = !0), this.manifest.discontinuityStarts.push(s.length); }, "program-date-time": function () { void 0 === this.manifest.dateTimeString && ((this.manifest.dateTimeString = t.dateTimeString), (this.manifest.dateTimeObject = t.dateTimeObject)), (o.dateTimeString = t.dateTimeString), (o.dateTimeObject = t.dateTimeObject); var e = this.lastProgramDateTime; (this.lastProgramDateTime = new Date(t.dateTimeString).getTime()), null === e && this.manifest.segments.reduceRight(function (t, e) { return (e.programDateTime = t - 1e3 * e.duration), e.programDateTime; }, this.lastProgramDateTime); }, targetduration: function () { !isFinite(t.duration) || t.duration < 0 ? this.trigger("warn", { message: "ignoring invalid target duration: " + t.duration }) : ((this.manifest.targetDuration = t.duration), Zu.call(this, this.manifest)); }, start: function () { t.attributes && !isNaN(t.attributes["TIME-OFFSET"]) ? (this.manifest.start = { timeOffset: t.attributes["TIME-OFFSET"], precise: t.attributes.PRECISE }) : this.trigger("warn", { message: "ignoring start declaration without appropriate attribute list" }); }, "cue-out": function () { o.cueOut = t.data; }, "cue-out-cont": function () { o.cueOutCont = t.data; }, "cue-in": function () { o.cueIn = t.data; }, skip: function () { (this.manifest.skip = Ju(t.attributes)), this.warnOnMissingAttributes_("#EXT-X-SKIP", t.attributes, ["SKIPPED-SEGMENTS"]); }, part: function () { var e = this; l = !0; var n = this.manifest.segments.length, i = Ju(t.attributes); (o.parts = o.parts || []), o.parts.push(i), i.byterange && (i.byterange.hasOwnProperty("offset") || (i.byterange.offset = p), (p = i.byterange.offset + i.byterange.length)); var r = o.parts.length - 1; this.warnOnMissingAttributes_( "#EXT-X-PART #".concat(r, " for segment #").concat(n), t.attributes, ["URI", "DURATION"] ), this.manifest.renditionReports && this.manifest.renditionReports.forEach(function (t, n) { t.hasOwnProperty("lastPart") || e.trigger("warn", { message: "#EXT-X-RENDITION-REPORT #".concat( n, " lacks required attribute(s): LAST-PART" ) }); }); }, "server-control": function () { var e = (this.manifest.serverControl = Ju(t.attributes)); e.hasOwnProperty("canBlockReload") || ((e.canBlockReload = !1), this.trigger("info", { message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false" })), Zu.call(this, this.manifest), e.canSkipDateranges && !e.hasOwnProperty("canSkipUntil") && this.trigger("warn", { message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set" }); }, "preload-hint": function () { var e = this.manifest.segments.length, n = Ju(t.attributes), i = n.type && "PART" === n.type; (o.preloadHints = o.preloadHints || []), o.preloadHints.push(n), n.byterange && (n.byterange.hasOwnProperty("offset") || ((n.byterange.offset = i ? p : 0), i && (p = n.byterange.offset + n.byterange.length))); var r = o.preloadHints.length - 1; if ( (this.warnOnMissingAttributes_( "#EXT-X-PRELOAD-HINT #".concat(r, " for segment #").concat(e), t.attributes, ["TYPE", "URI"] ), n.type) ) for (var a = 0; a < o.preloadHints.length - 1; a++) { var s = o.preloadHints[a]; s.type && s.type === n.type && this.trigger("warn", { message: "#EXT-X-PRELOAD-HINT #" .concat(r, " for segment #") .concat(e, " has the same TYPE ") .concat(n.type, " as preload hint #") .concat(a) }); } }, "rendition-report": function () { var e = Ju(t.attributes); (this.manifest.renditionReports = this.manifest.renditionReports || []), this.manifest.renditionReports.push(e); var n = this.manifest.renditionReports.length - 1, i = ["LAST-MSN", "URI"]; l && i.push("LAST-PART"), this.warnOnMissingAttributes_( "#EXT-X-RENDITION-REPORT #".concat(n), t.attributes, i ); }, "part-inf": function () { (this.manifest.partInf = Ju(t.attributes)), this.warnOnMissingAttributes_("#EXT-X-PART-INF", t.attributes, ["PART-TARGET"]), this.manifest.partInf.partTarget && (this.manifest.partTargetDuration = this.manifest.partInf.partTarget), Zu.call(this, this.manifest); }, daterange: function () { this.manifest.dateRanges.push(Ju(t.attributes)); var e = this.manifest.dateRanges.length - 1; this.warnOnMissingAttributes_("#EXT-X-DATERANGE #".concat(e), t.attributes, [ "ID", "START-DATE" ]); var n = this.manifest.dateRanges[e]; n.endDate && n.startDate && new Date(n.endDate) < new Date(n.startDate) && this.trigger("warn", { message: "EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE" }), n.duration && n.duration < 0 && this.trigger("warn", { message: "EXT-X-DATERANGE DURATION must not be negative" }), n.plannedDuration && n.plannedDuration < 0 && this.trigger("warn", { message: "EXT-X-DATERANGE PLANNED-DURATION must not be negative" }); var i = !!n.endOnNext; if ( (i && !n.class && this.trigger("warn", { message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute" }), i && (n.duration || n.endDate) && this.trigger("warn", { message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes" }), n.duration && n.endDate) ) { var r = n.startDate.getTime() + 1e3 * n.duration; this.manifest.dateRanges[e].endDate = new Date(r); } if (m[n.id]) { for (var a in m[n.id]) if (n[a] && JSON.stringify(m[n.id][a]) !== JSON.stringify(n[a])) { this.trigger("warn", { message: "EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values" }); break; } var s = this.manifest.dateRanges.findIndex(function (t) { return t.id === n.id; }); (this.manifest.dateRanges[s] = Yu(this.manifest.dateRanges[s], n)), (m[n.id] = Yu(m[n.id], n)), this.manifest.dateRanges.pop(); } else m[n.id] = n; }, "independent-segments": function () { this.manifest.independentSegments = !0; }, "content-steering": function () { (this.manifest.contentSteering = Ju(t.attributes)), this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING", t.attributes, [ "SERVER-URI" ]); } })[t.tagType] || d ).call(a); }, uri: function () { (o.uri = t.uri), s.push(o), this.manifest.targetDuration && !("duration" in o) && (this.trigger("warn", { message: "defaulting segment duration to the target duration" }), (o.duration = this.manifest.targetDuration)), r && (o.key = r), (o.timeline = u), i && (o.map = i), (p = 0), null !== this.lastProgramDateTime && ((o.programDateTime = this.lastProgramDateTime), (this.lastProgramDateTime += 1e3 * o.duration)), (o = {}); }, comment: function () { }, custom: function () { t.segment ? ((o.custom = o.custom || {}), (o.custom[t.customType] = t.data)) : ((this.manifest.custom = this.manifest.custom || {}), (this.manifest.custom[t.customType] = t.data)); } })[t.type].call(a); }), t ); } return ( y(e, t), m(e, [ { key: "warnOnMissingAttributes_", value: function (t, e, n) { var i = []; n.forEach(function (t) { e.hasOwnProperty(t) || i.push(t); }), i.length && this.trigger("warn", { message: "".concat(t, " lacks required attribute(s): ").concat(i.join(", ")) }); } }, { key: "push", value: function (t) { this.lineStream.push(t); } }, { key: "end", value: function () { this.lineStream.push("\n"), this.manifest.dateRanges.length && null === this.lastProgramDateTime && this.trigger("warn", { message: "A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag" }), (this.lastProgramDateTime = null), this.trigger("end"); } }, { key: "addParser", value: function (t) { this.parseStream.addParser(t); } }, { key: "addTagMapper", value: function (t) { this.parseStream.addTagMapper(t); } } ]) ); })(Hu), eh = function (t) { return ( !( !(function (t) { return null == t; })(t) && !(function (t) { return zu(t) && t != +t; })(t) && "" !== t ) || (!(Uu(t) || zu(t) || Ou(t)) && (!( !Vo(t) || !(function (t) { if (null == t) return !0; if ( Cl(t) && (Ho(t) || "string" == typeof t || "function" == typeof t.splice || Nl(t) || ql(t) || Ul(t)) ) return !t.length; var e = ic(t); if ("[object Map]" == e || "[object Set]" == e) return !t.size; if (Il(t)) return !Zl(t).length; for (var n in t) if (Mu.call(t, n)) return !1; return !0; })(t) ) || !t)) ); }; function nh(t) { if (t) { var e = (t || "0x").slice(2); e = (1 & e.length ? "0" : "") + e; for (var n = new Uint8Array(e.length / 2), i = 0; i < e.length / 2; i++) n[i] = parseInt(e.slice(2 * i, 2 * i + 2), 16); return n; } } !(function (t, e) { !(function (e) { function n(t) { return parseInt(t) === t; } function i(t) { if (!n(t.length)) return !1; for (var e = 0; e < t.length; e++) if (!n(t[e]) || t[e] < 0 || t[e] > 255) return !1; return !0; } function r(t, e) { if (t.buffer && "Uint8Array" === t.name) return e && (t = t.slice ? t.slice() : Array.prototype.slice.call(t)), t; if (Array.isArray(t)) { if (!i(t)) throw new Error("Array contains invalid value: " + t); return new Uint8Array(t); } if (n(t.length) && i(t)) return new Uint8Array(t); throw new Error("unsupported array-like object"); } function a(t) { return new Uint8Array(t); } function s(t, e, n, i, r) { (null == i && null == r) || (t = t.slice ? t.slice(i, r) : Array.prototype.slice.call(t, i, r)), e.set(t, n); } var o = { toBytes: function (t) { var e = [], n = 0; for (t = encodeURI(t); n < t.length;) { var i = t.charCodeAt(n++); 37 === i ? (e.push(parseInt(t.substr(n, 2), 16)), (n += 2)) : e.push(i); } return r(e); }, fromBytes: function (t) { for (var e = [], n = 0; n < t.length;) { var i = t[n]; i < 128 ? (e.push(String.fromCharCode(i)), n++) : i > 191 && i < 224 ? (e.push(String.fromCharCode(((31 & i) << 6) | (63 & t[n + 1]))), (n += 2)) : (e.push(String.fromCharCode(((15 & i) << 12) | ((63 & t[n + 1]) << 6) | (63 & t[n + 2]))), (n += 3)); } return e.join(""); } }, l = (function () { var t = "0123456789abcdef"; return { toBytes: function (t) { for (var e = [], n = 0; n < t.length; n += 2) e.push(parseInt(t.substr(n, 2), 16)); return e; }, fromBytes: function (e) { for (var n = [], i = 0; i < e.length; i++) { var r = e[i]; n.push(t[(240 & r) >> 4] + t[15 & r]); } return n.join(""); } }; })(), d = { 16: 10, 24: 12, 32: 14 }, c = [ 1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145 ], u = [ 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22 ], h = [ 82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125 ], p = [ 3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986 ], f = [ 2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766 ], m = [ 1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126 ], g = [ 1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436 ], y = [ 1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890 ], A = [ 1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935 ], v = [ 2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600 ], b = [ 4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480 ], E = [ 0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795 ], w = [ 0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855 ], x = [ 0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150 ], S = [ 0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925 ]; function _(t) { for (var e = [], n = 0; n < t.length; n += 4) e.push((t[n] << 24) | (t[n + 1] << 16) | (t[n + 2] << 8) | t[n + 3]); return e; } var T = function t(e) { if (!(this instanceof t)) throw Error("AES must be instanitated with `new`"); Object.defineProperty(this, "key", { value: r(e, !0) }), this._prepare(); }; (T.prototype._prepare = function () { var t = d[this.key.length]; if (null == t) throw new Error("invalid key size (must be 16, 24 or 32 bytes)"); (this._Ke = []), (this._Kd = []); for (var e = 0; e <= t; e++) this._Ke.push([0, 0, 0, 0]), this._Kd.push([0, 0, 0, 0]); var n, i = 4 * (t + 1), r = this.key.length / 4, a = _(this.key); for (e = 0; e < r; e++) (n = e >> 2), (this._Ke[n][e % 4] = a[e]), (this._Kd[t - n][e % 4] = a[e]); for (var s, o = 0, l = r; l < i;) { if ( ((s = a[r - 1]), (a[0] ^= (u[(s >> 16) & 255] << 24) ^ (u[(s >> 8) & 255] << 16) ^ (u[255 & s] << 8) ^ u[(s >> 24) & 255] ^ (c[o] << 24)), (o += 1), 8 != r) ) for (e = 1; e < r; e++) a[e] ^= a[e - 1]; else { for (e = 1; e < r / 2; e++) a[e] ^= a[e - 1]; (s = a[r / 2 - 1]), (a[r / 2] ^= u[255 & s] ^ (u[(s >> 8) & 255] << 8) ^ (u[(s >> 16) & 255] << 16) ^ (u[(s >> 24) & 255] << 24)); for (e = r / 2 + 1; e < r; e++) a[e] ^= a[e - 1]; } for (e = 0; e < r && l < i;) (h = l >> 2), (p = l % 4), (this._Ke[h][p] = a[e]), (this._Kd[t - h][p] = a[e++]), l++; } for (var h = 1; h < t; h++) for (var p = 0; p < 4; p++) (s = this._Kd[h][p]), (this._Kd[h][p] = E[(s >> 24) & 255] ^ w[(s >> 16) & 255] ^ x[(s >> 8) & 255] ^ S[255 & s]); }), (T.prototype.encrypt = function (t) { if (16 != t.length) throw new Error("invalid plaintext size (must be 16 bytes)"); for (var e = this._Ke.length - 1, n = [0, 0, 0, 0], i = _(t), r = 0; r < 4; r++) i[r] ^= this._Ke[0][r]; for (var s = 1; s < e; s++) { for (r = 0; r < 4; r++) n[r] = p[(i[r] >> 24) & 255] ^ f[(i[(r + 1) % 4] >> 16) & 255] ^ m[(i[(r + 2) % 4] >> 8) & 255] ^ g[255 & i[(r + 3) % 4]] ^ this._Ke[s][r]; i = n.slice(); } var o, l = a(16); for (r = 0; r < 4; r++) (o = this._Ke[e][r]), (l[4 * r] = 255 & (u[(i[r] >> 24) & 255] ^ (o >> 24))), (l[4 * r + 1] = 255 & (u[(i[(r + 1) % 4] >> 16) & 255] ^ (o >> 16))), (l[4 * r + 2] = 255 & (u[(i[(r + 2) % 4] >> 8) & 255] ^ (o >> 8))), (l[4 * r + 3] = 255 & (u[255 & i[(r + 3) % 4]] ^ o)); return l; }), (T.prototype.decrypt = function (t) { if (16 != t.length) throw new Error("invalid ciphertext size (must be 16 bytes)"); for (var e = this._Kd.length - 1, n = [0, 0, 0, 0], i = _(t), r = 0; r < 4; r++) i[r] ^= this._Kd[0][r]; for (var s = 1; s < e; s++) { for (r = 0; r < 4; r++) n[r] = y[(i[r] >> 24) & 255] ^ A[(i[(r + 3) % 4] >> 16) & 255] ^ v[(i[(r + 2) % 4] >> 8) & 255] ^ b[255 & i[(r + 1) % 4]] ^ this._Kd[s][r]; i = n.slice(); } var o, l = a(16); for (r = 0; r < 4; r++) (o = this._Kd[e][r]), (l[4 * r] = 255 & (h[(i[r] >> 24) & 255] ^ (o >> 24))), (l[4 * r + 1] = 255 & (h[(i[(r + 3) % 4] >> 16) & 255] ^ (o >> 16))), (l[4 * r + 2] = 255 & (h[(i[(r + 2) % 4] >> 8) & 255] ^ (o >> 8))), (l[4 * r + 3] = 255 & (h[255 & i[(r + 1) % 4]] ^ o)); return l; }); var k = function t(e) { if (!(this instanceof t)) throw Error("AES must be instanitated with `new`"); (this.description = "Electronic Code Block"), (this.name = "ecb"), (this._aes = new T(e)); }; (k.prototype.encrypt = function (t) { if ((t = r(t)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)"); for (var e = a(t.length), n = a(16), i = 0; i < t.length; i += 16) s(t, n, 0, i, i + 16), s((n = this._aes.encrypt(n)), e, i); return e; }), (k.prototype.decrypt = function (t) { if ((t = r(t)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)"); for (var e = a(t.length), n = a(16), i = 0; i < t.length; i += 16) s(t, n, 0, i, i + 16), s((n = this._aes.decrypt(n)), e, i); return e; }); var C = function t(e, n) { if (!(this instanceof t)) throw Error("AES must be instanitated with `new`"); if (((this.description = "Cipher Block Chaining"), (this.name = "cbc"), n)) { if (16 != n.length) throw new Error("invalid initialation vector size (must be 16 bytes)"); } else n = a(16); (this._lastCipherblock = r(n, !0)), (this._aes = new T(e)); }; (C.prototype.encrypt = function (t) { if ((t = r(t)).length % 16 != 0) throw new Error("invalid plaintext size (must be multiple of 16 bytes)"); for (var e = a(t.length), n = a(16), i = 0; i < t.length; i += 16) { s(t, n, 0, i, i + 16); for (var o = 0; o < 16; o++) n[o] ^= this._lastCipherblock[o]; (this._lastCipherblock = this._aes.encrypt(n)), s(this._lastCipherblock, e, i); } return e; }), (C.prototype.decrypt = function (t) { if ((t = r(t)).length % 16 != 0) throw new Error("invalid ciphertext size (must be multiple of 16 bytes)"); for (var e = a(t.length), n = a(16), i = 0; i < t.length; i += 16) { s(t, n, 0, i, i + 16), (n = this._aes.decrypt(n)); for (var o = 0; o < 16; o++) e[i + o] = n[o] ^ this._lastCipherblock[o]; s(t, this._lastCipherblock, 0, i, i + 16); } return e; }); var L = function t(e, n, i) { if (!(this instanceof t)) throw Error("AES must be instanitated with `new`"); if (((this.description = "Cipher Feedback"), (this.name = "cfb"), n)) { if (16 != n.length) throw new Error("invalid initialation vector size (must be 16 size)"); } else n = a(16); i || (i = 1), (this.segmentSize = i), (this._shiftRegister = r(n, !0)), (this._aes = new T(e)); }; (L.prototype.encrypt = function (t) { if (t.length % this.segmentSize != 0) throw new Error("invalid plaintext size (must be segmentSize bytes)"); for (var e, n = r(t, !0), i = 0; i < n.length; i += this.segmentSize) { e = this._aes.encrypt(this._shiftRegister); for (var a = 0; a < this.segmentSize; a++) n[i + a] ^= e[a]; s(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), s(n, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return n; }), (L.prototype.decrypt = function (t) { if (t.length % this.segmentSize != 0) throw new Error("invalid ciphertext size (must be segmentSize bytes)"); for (var e, n = r(t, !0), i = 0; i < n.length; i += this.segmentSize) { e = this._aes.encrypt(this._shiftRegister); for (var a = 0; a < this.segmentSize; a++) n[i + a] ^= e[a]; s(this._shiftRegister, this._shiftRegister, 0, this.segmentSize), s(t, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return n; }); var I = function t(e, n) { if (!(this instanceof t)) throw Error("AES must be instanitated with `new`"); if (((this.description = "Output Feedback"), (this.name = "ofb"), n)) { if (16 != n.length) throw new Error("invalid initialation vector size (must be 16 bytes)"); } else n = a(16); (this._lastPrecipher = r(n, !0)), (this._lastPrecipherIndex = 16), (this._aes = new T(e)); }; (I.prototype.encrypt = function (t) { for (var e = r(t, !0), n = 0; n < e.length; n++) 16 === this._lastPrecipherIndex && ((this._lastPrecipher = this._aes.encrypt(this._lastPrecipher)), (this._lastPrecipherIndex = 0)), (e[n] ^= this._lastPrecipher[this._lastPrecipherIndex++]); return e; }), (I.prototype.decrypt = I.prototype.encrypt); var R = function t(e) { if (!(this instanceof t)) throw Error("Counter must be instanitated with `new`"); 0 === e || e || (e = 1), "number" == typeof e ? ((this._counter = a(16)), this.setValue(e)) : this.setBytes(e); }; (R.prototype.setValue = function (t) { if ("number" != typeof t || parseInt(t) != t) throw new Error("invalid counter value (must be an integer)"); if (t > Number.MAX_SAFE_INTEGER) throw new Error("integer value out of safe range"); for (var e = 15; e >= 0; --e) (this._counter[e] = t % 256), (t = parseInt(t / 256)); }), (R.prototype.setBytes = function (t) { if (16 != (t = r(t, !0)).length) throw new Error("invalid counter bytes size (must be 16 bytes)"); this._counter = t; }), (R.prototype.increment = function () { for (var t = 15; t >= 0; t--) { if (255 !== this._counter[t]) { this._counter[t]++; break; } this._counter[t] = 0; } }); var D = function t(e, n) { if (!(this instanceof t)) throw Error("AES must be instanitated with `new`"); (this.description = "Counter"), (this.name = "ctr"), n instanceof R || (n = new R(n)), (this._counter = n), (this._remainingCounter = null), (this._remainingCounterIndex = 16), (this._aes = new T(e)); }; (D.prototype.encrypt = function (t) { for (var e = r(t, !0), n = 0; n < e.length; n++) 16 === this._remainingCounterIndex && ((this._remainingCounter = this._aes.encrypt(this._counter._counter)), (this._remainingCounterIndex = 0), this._counter.increment()), (e[n] ^= this._remainingCounter[this._remainingCounterIndex++]); return e; }), (D.prototype.decrypt = D.prototype.encrypt); var B = { AES: T, Counter: R, ModeOfOperation: { ecb: k, cbc: C, cfb: L, ofb: I, ctr: D }, utils: { hex: l, utf8: o }, padding: { pkcs7: { pad: function (t) { var e = 16 - ((t = r(t, !0)).length % 16), n = a(t.length + e); s(t, n); for (var i = t.length; i < n.length; i++) n[i] = e; return n; }, strip: function (t) { if ((t = r(t, !0)).length < 16) throw new Error("PKCS#7 invalid length"); var e = t[t.length - 1]; if (e > 16) throw new Error("PKCS#7 padding byte out of range"); for (var n = t.length - e, i = 0; i < e; i++) if (t[n + i] !== e) throw new Error("PKCS#7 invalid padding byte"); var o = a(n); return s(t, o, 0, 0, n), o; } } }, _arrayTest: { coerceArray: r, createArray: a, copyArray: s } }; t.exports = B; })(); })({ exports: {} }); var ih = "PLAYLIST_LOADED", rh = "FIRST_VIDEO_FRAME", ah = "MANIFEST_PARSED", sh = "RESOLUTION_CHANGED", oh = "RESOLUTION_SWITCHING", lh = "LEVEL_SWITCHING", dh = "LEVEL_CHANGED", ch = "LOADING", uh = "SEEK", hh = "CANPLAY", ph = "PLAY", fh = "PAUSE", mh = "PLAYING", gh = "ENDED", yh = "ERROR", Ah = "VOLUMECHANGE", vh = "DURATIONCHANGE", bh = (function () { return m( function t(e) { var n = this, i = e.emitter, r = e.logger, a = e.key, s = e.iv; f(this, t), g(this, "key", ""), g(this, "iv", ""), g( this, "generateMediaSrc", (function () { var t = p( d().mark(function t(e) { var i, r, a, s; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if ((i = e.src)) { t.next = 4; break; } throw ( (n.emitter.emit("error", { fatal: !0, src: i, type: "networkError", error: { message: "视频参数有误" } }), new Error("参数src不能为空")) ); case 4: if (!Pu(i) || !i.startsWith("http")) { t.next = 22; break; } return (n.url = i), (a = Eh(i)), (t.next = 9), n.fetchMediaSrc(i); case 9: if ((s = t.sent)) { t.next = 12; break; } return t.abrupt("return"); case 12: if ("JSON" !== s.type) { t.next = 18; break; } return (t.next = 15), n.m3u8Generater(s.data); case 15: (r = t.sent), (t.next = 19); break; case 18: r = s.data; case 19: return (t.next = 21), n.m3u8ToBase64(r, a); case 21: return t.abrupt("return", t.sent); case 22: if (!wh(i)) { t.next = 26; break; } (r = i), (t.next = 42); break; case 26: if (!Vo(i)) { t.next = 32; break; } return (t.next = 29), n.m3u8Generater(i); case 29: (r = t.sent), (t.next = 42); break; case 32: return (t.prev = 32), (t.next = 35), n.m3u8Generater(JSON.parse(i)); case 35: (r = t.sent), (t.next = 42); break; case 38: (t.prev = 38), (t.t0 = t.catch(32)), n.logger.error("src数据有误", t.t0), n.emitter.emit("error", { fatal: !0 }); case 42: return (t.next = 44), n.m3u8ToBase64(r); case 44: return t.abrupt("return", t.sent); case 45: case "end": return t.stop(); } }, t, null, [[32, 38]] ); }) ); return function (e) { return t.apply(this, arguments); }; })() ), (this.emitter = i), (this.logger = r || console), (this.key = a), (this.iv = s), (this.url = ""); }, [ { key: "m3u8ToBase64", value: ((o = p( d().mark(function t(e) { var n, i, r; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return ( (n = new th()).push(e), n.end(), (i = n.manifest), this.logger.log("parsedManifest", i), (r = "data:application/vnd.apple.mpegurl;charset=UTF-8;base64,".concat( btoa(e) )), t.abrupt("return", r) ); case 8: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return o.apply(this, arguments); }) }, { key: "fetchM3u8Json", value: ((s = p( d().mark(function t(e) { var n; return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return ( (t.next = 2), fetch(e).then(function (t) { return t.json(); }) ); case 2: return (n = t.sent), t.abrupt("return", n); case 4: case "end": return t.stop(); } }, t); }) )), function (t) { return s.apply(this, arguments); }) }, { key: "fetchMediaSrc", value: ((a = p( d().mark(function t(e) { var n, i, r, a = this; return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return ( (t.next = 2), fetch(e) .then(function (t) { return t.text(); }) .catch(function (t) { a.logger.error("fetchMediaSrc", t), a.emitter.emit("error", { fatal: !0 }); }) ); case 2: if ((n = t.sent)) { t.next = 5; break; } return t.abrupt("return"); case 5: if (!wh(n)) { t.next = 12; break; } return ( (i = n.split("\n")), (r = Eh(e)), (n = i .map(function (t) { return t.startsWith("http") ? t : (t = t.replace("\r", "")).endsWith(".ts") || t.endsWith(".m3u8") ? "".concat(r).concat(t) : t; }) .join("\n")), t.abrupt("return", { type: "M3U8", data: n }) ); case 12: return t.abrupt("return", { type: "JSON", data: JSON.parse(n) }); case 13: case "end": return t.stop(); } }, t); }) )), function (t) { return a.apply(this, arguments); }) }, { key: "m3u8Generater", value: ((r = p( d().mark(function t(e) { var n, i, r, a, s, o, l, c, u, h, p, f, m, g, y, A, v, b, E, w, x, S, _, T, k, C, L; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (((n = this.url), e)) { t.next = 5; break; } return ( this.emitter.emit("error", { fatal: !0, src: n, type: "networkError", response: e, error: { message: "视频资源不存在" } }), this.logger.error("视频资源不存在>>".concat(n)), t.abrupt("return") ); case 5: if ( ((i = e.VERSION), (r = e.TARGETDURATION), (a = e.SEQUENCE), (s = e.TYPE), (o = e.EXTINF), (l = e.PREFIX_PATH), (c = e.TS_START), (u = e.TS_END), (h = e.TS_NAME), (p = e.TS_LIST), (f = e.TS_LAST_TIME), (m = e.IV), (g = e.KEY), (y = "#EXTM3U\n#EXT-X-VERSION:" .concat(i, "\n#EXT-X-TARGETDURATION:") .concat(r, "\n#EXT-X-MEDIA-SEQUENCE:") .concat(a, "\n#EXT-X-PLAYLIST-TYPE:") .concat(s, "\n")), g ? (y += m ? '#EXT-X-KEY:METHOD=AES-128,URI="data:application/octet-stream;base64,' .concat(g, '",IV=') .concat(m, "\n") : '#EXT-X-KEY:METHOD=AES-128,URI="data:application/octet-stream;base64,'.concat( g, '"\n' )) : this.key && this.iv && (y += '#EXT-X-KEY:METHOD=AES-128,URI="data:application/octet-stream;base64,' .concat(this.key, '",IV=') .concat(this.iv, "\n")), (A = []), null != p && p.length) ) for (v = 0; v < p.length; v++) (b = p[v]), (E = b.name), (w = b.time), (x = "".concat(l).concat(E)), A.push("#EXTINF:".concat(w, ",")), A.push(x); else if (!eh(c) && !eh(u)) for ( S = c.toString().length, _ = Number(c), T = Number(u), k = _; k <= T; k++ ) (C = k.toString().padStart(S, 0)), (L = "".concat(l).concat(h.replace("{num}", C))), A.push("#EXTINF:".concat(k == T ? f : o, ",")), A.push(L); return ( 0 == A.length && (this.emitter.emit("error", { fatal: !0, src: n, type: "networkError", response: e, error: { message: "视频数据错误" } }), this.logger.error("视频数据错误>>".concat(n))), (y += A.join("\n")), (y += "\n"), (y += "#EXT-X-ENDLIST"), this.logger.log("m3u8Text", y), t.abrupt("return", y) ); case 16: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return r.apply(this, arguments); }) }, { key: "getPlaylist", value: ((i = p( d().mark(function t(e) { var n, i, r, a; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if ((n = e.src)) { t.next = 3; break; } return t.abrupt("return"); case 3: if (!Pu(n) || !n.startsWith("http")) { t.next = 16; break; } return (this.url = n), (t.next = 7), this.fetchMediaSrc(n); case 7: if ((i = t.sent)) { t.next = 10; break; } return t.abrupt("return"); case 10: if (((r = i.type), (a = i.data), "M3U8" !== r)) { t.next = 15; break; } return (t.next = 14), this.getPlaylistByM3u8(a); case 14: return t.abrupt("return", t.sent); case 15: return t.abrupt("return", this.getPlaylistByJson(a)); case 16: if (!wh(n)) { t.next = 22; break; } return (t.next = 19), this.getPlaylistByM3u8(n); case 19: return t.abrupt("return", t.sent); case 22: if (!Vo(n)) { t.next = 28; break; } return (t.next = 25), this.getPlaylistByJson(n); case 25: return t.abrupt("return", t.sent); case 28: return ( (t.prev = 28), (t.next = 31), this.getPlaylistByJson(JSON.parse(n)) ); case 31: return t.abrupt("return", t.sent); case 34: (t.prev = 34), (t.t0 = t.catch(28)), this.logger.error("src数据有误", t.t0), this.emitter.emit("error", { fatal: !0 }); case 38: case "end": return t.stop(); } }, t, this, [[28, 34]] ); }) )), function (t) { return i.apply(this, arguments); }) }, { key: "getPlaylistByJson", value: ((n = p( d().mark(function t(e) { var n, i, r, a, s, o, l, c, u, h, p, f, m, g, y, A, v, b, E, w, x, S, _, T, k, C; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (((n = { playlist: [], duration: 0 }), e)) { t.next = 5; break; } return ( this.emitter.emit("error", { fatal: !0, src: this.url, type: "networkError", response: e, error: { message: "视频资源不存在" } }), this.logger.error("视频资源不存在>>".concat(this.url)), t.abrupt("return", n) ); case 5: if ( (e.VERSION, e.TARGETDURATION, e.SEQUENCE, e.TYPE, (i = e.EXTINF), (r = e.PREFIX_PATH), (a = e.TS_START), (s = e.TS_END), (o = e.TS_NAME), (l = e.TS_LAST_TIME), (c = e.IV), (u = e.KEY), (h = e.TS_LIST), (p = xh(u || this.key)), (f = nh(c || this.iv)), null != h && h.length) ) for (m = 0; m < h.length; m++) (g = h[m]), (y = g.name), (A = g.time), (v = "".concat(r).concat(y)), (b = { url: v, key: p, iv: f, startTime: n.duration, duration: Number(A) }), n.playlist.push(b), (n.duration += b.duration); else if (!eh(a) && !eh(s)) for ( E = a.toString().length, w = Number(a), x = Number(s), S = w; S <= x; S++ ) (_ = S.toString().padStart(E, 0)), (T = "".concat(r).concat(o.replace("{num}", _))), (k = Number(S == x ? l : i)), (C = { url: T, key: p, iv: f, duration: k, startTime: n.duration }), n.playlist.push(C), (n.duration += k); return ( 0 == n.playlist.length && (this.emitter.emit("error", { fatal: !0, src: this.url, type: "networkError", response: e, error: { message: "视频数据错误" } }), this.logger.error("视频数据错误>>".concat(this.url))), this.logger.log("getPlaylist", n), t.abrupt("return", n) ); case 12: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return n.apply(this, arguments); }) }, { key: "getPlaylistByM3u8", value: ((e = p( d().mark(function t(e) { var n, i, r, a, s, o, l, c, u, h, p, f, m, g = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (e) { t.next = 2; break; } return t.abrupt("return"); case 2: if ( ((s = new th()).push(e), s.end(), (o = s.manifest), this.logger.log("getPlaylistByM3u8", o), null == o || null === (n = o.playlists) || void 0 === n || !n.length) ) { t.next = 10; break; } return ( (l = o.playlists .sort(function (t, e) { return ( e.attributes.RESOLUTION.height - t.attributes.RESOLUTION.height ); }) .map(function (t) { var e = t.uri, n = t.attributes.RESOLUTION; return { url: e, name: "".concat(n.height, "P") }; })), t.abrupt("return", { levels: l }) ); case 10: if (null != o && null !== (i = o.segments) && void 0 !== i && i.length) { t.next = 12; break; } return t.abrupt("return"); case 12: if ( !(h = null === (r = o.segments[0].key) || void 0 === r ? void 0 : r.uri) ) { t.next = 26; break; } if (!h.startsWith("data:application/octet-stream;")) { t.next = 18; break; } (c = xh(h)), (t.next = 23); break; case 18: return ( !h.startsWith("http") && h.endsWith(".key") && ((p = Eh(this.url)), (h = "".concat(p).concat(h))), (t.next = 21), fetch(h) .then(function (t) { return t.arrayBuffer(); }) .catch(function (t) { g.logger.error("获取视频加密key数据失败", h), g.emitter.emit("error", { fatal: !0, error: { message: "获取视频加密key数据失败" } }); }) ); case 21: (f = t.sent), (c = h.includes("http") ? new Uint8Array(f) : xh(h)); case 23: (u = new Uint8Array(o.segments[0].key.iv.buffer)), (t.next = 27); break; case 26: this.key && this.iv && ((c = "data:application/octet-stream;base64,".concat(this.key)), (u = nh(this.iv))); case 27: return ( (m = { duration: 0, playlist: [] }), null == o || null === (a = o.segments) || void 0 === a || a.forEach(function (t) { var e = t.uri, n = t.duration; t.key; var i = { key: c, iv: u, duration: n, url: e, startTime: m.duration }; m.playlist.push(i), (m.duration += n); }), t.abrupt("return", m) ); case 30: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return e.apply(this, arguments); }) }, { key: "getResolution", value: ((t = p( d().mark(function t(e) { var n, i, r, a, s, o = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return ( (t.prev = 0), (t.next = 3), fetch(e) .then( (function () { var t = p( d().mark(function t(e) { return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return t.abrupt( "return", e.text() ); case 1: case "end": return t.stop(); } }, t); }) ); return function (e) { return t.apply(this, arguments); }; })() ) .catch(function (t) { o.logger.error("fetchMediaSrc", t), o.emitter.emit("error", { fatal: !0 }); }) ); case 3: if (((n = t.sent), n)) { t.next = 7; break; } return t.abrupt("return"); case 7: if ( ((i = new th()).push(n), i.end(), (r = i.manifest), this.logger.log("getResolution", r), r.playlists) ) { t.next = 14; break; } return t.abrupt("return"); case 14: return ( (a = Eh(e)), (s = r.playlists .sort(function (t, e) { return ( e.attributes.RESOLUTION.height - t.attributes.RESOLUTION.height ); }) .map(function (t) { var e = t.uri, n = t.attributes.RESOLUTION; return { url: e.startsWith("http") ? e : "".concat(a).concat(e), name: "".concat(n.height, "P") }; })), t.abrupt("return", s) ); case 19: (t.prev = 19), (t.t0 = t.catch(0)), console.warn("getResolution::", t.t0); case 22: case "end": return t.stop(); } }, t, this, [[0, 19]] ); }) )), function (e) { return t.apply(this, arguments); }) } ] ); var t, e, n, i, r, a, s, o; })(); function Eh(t) { var e = t.lastIndexOf("/"); return t.slice(0, e + 1); } function wh(t) { return Pu(t) && t.startsWith("#EXTM3U"); } function xh(t) { if (t) { for ( var e = t.replace(/^data:application\/octet-stream;base64,/, ""), n = window.atob(e), i = new Uint8Array(n.length), r = 0; r < n.length; ++r ) i[r] = n.charCodeAt(r); return i; } } var Sh = ["pause", "rolling", "top-left", "top-right", "bottom-left", "bottom-right"]; function _h(t) { var e = document.createElement("style"); document.head.appendChild(e); var n = e.sheet; n.insertRule( "\n @keyframes rollingAnimation {\n 0% {\n transform: translateX(120%);\n }\n 100% {\n transform: translateX(-220%);\n }\n }\n ", n.cssRules.length ); var i = t.el, r = t.adList, a = t.player; if (r) { var s = Sh.map(function (t) { return r.findLast(function (e) { return e.adType === t; }); }).filter(function (t) { return null == t ? void 0 : t.adType; }), o = document.querySelector(i), l = null; (l = a.$emitter), s.forEach(function (t) { "pause" !== t.adType && d(t, o); }), l.on("pause", function () { var t, e = (null === (t = a.dplayer) || void 0 === t ? void 0 : t.video) || a.video; console.log("暂停::", null == e ? void 0 : e.currentTime), s.forEach(function (t) { if ("pause" === t.adType) { if (0 === (null == e ? void 0 : e.currentTime)) return; d(t, o); } }); }), l.on("play", function () { o.querySelectorAll(".advertisement").forEach(function (t) { "pause" === t.getAttribute("data-show-on") && t.remove(); }); }); } function d(t, e) { var n = document.createElement("div"); if ((n.classList.add("advertisement"), (n.style.position = "absolute"), "pause" === t.adType)) (n.style.top = "50%"), (n.style.left = "50%"), (n.style.transform = "translate(-50%, -50%)"); else switch (t.adType) { case "top-left": (n.style.top = "0"), (n.style.left = "0"); break; case "top-right": (n.style.top = "0px"), (n.style.right = "0"); break; case "bottom-left": (n.style.bottom = "10%"), (n.style.left = "0"); break; case "bottom-right": (n.style.bottom = "10%"), (n.style.right = "0"); break; default: (n.style.bottom = "0px"), (n.style.right = "0"); } n.setAttribute("data-show-on", t.adType), (n.style.margin = "auto"), (n.style.height = "25%"), (n.style.zIndex = "98"), (n.style.fontSize = t.fontSize + "px"), (n.style.fontColor = t.fontColor), "pause" !== t.adType && (n.style.maxWidth = "25%"), "rolling" === t.adType ? ((n.style.animation = "rollingAnimation 20s linear infinite"), (n.style.height = "30px"), (n.style.top = "3px"), (n.style.margin = "0"), (n.style.padding = "0"), (n.style.maxWidth = ""), (n.style.zIndex = "99"), n.addEventListener("mouseenter", function () { n.style.animationPlayState = "paused"; }), n.addEventListener("mouseleave", function () { n.style.animationPlayState = "running"; })) : (n.style.animation = "none"), "pause" === t.adType && ((n.style.margin = "0"), (n.style.height = "80%"), (n.style.width = "50%")), n.insertAdjacentHTML( "beforeend", '\n\n ' ) .concat( t.image && "rolling" !== t.adType ? '\n 广告图片') : "", "\n \n " ) .concat( t.text ? '

') .concat(t.text || "", "

") : "", "\n
\n" ) ), n.addEventListener("click", function (t) { t.stopPropagation(); }), (e.style.overflow = "hidden"), e.appendChild(n); } } var Th = "M3U8", kh = (function () { return m( function t(e) { var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; f(this, t), g(this, "version", "1.3.0"), g(this, "playerType", Th), (this.el = e), (this.eventList = []), (this.options = Object.assign({}, n, { playerType: this.playerType })), console.log("options", n); var i = new To({ debug: n.debug }); (this.$logger = i), i.log("VideoPlayerClass init", e, this.options); var r = So(); (this.$emitter = r), (this.$reporter = new ju({ logger: i, emitter: r })), this.options.prefixAd && this.options.prefixAd.list ? this.playAd() : this.createPlayer(this.options), i.log("VideoPlayer::created::version", this.version); }, [ { key: "getReportInfo", value: function () { var t = R(); return ( (t.player = "DPlayer"), (t.playerType = this.playerType), (t.events = this.$reporter.reports), t ); } }, { key: "playAd", value: ((n = p( d().mark(function t() { var e, n, i, r, a, s, o, l, c, u, h = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if ( ((n = this.options.prefixAd), (i = n.list), (r = void 0 === i ? [] : i), (a = n.time), (s = void 0 === a ? 5 : a), null == this.adCountdown && (this.adCountdown = s), console.log("list::", r), r.length) ) { t.next = 6; break; } return this.createPlayer(this.options), t.abrupt("return"); case 6: return ( (o = r.shift()), (t.next = 9), this.createPlayer({ src: o.src, autoplay: !0, muted: !0, isAD: !0 }) ); case 9: null !== (e = this.dplayer) && void 0 !== e && e.video && (F || ((this.dplayer.video.muted = !0), setTimeout(function () { h.dplayer.play(); }, 1e3))), ((l = document.createElement("a")).style.opacity = "100%"), (l.style.width = "100%"), (l.style.height = "100%"), (l.style.position = "absolute"), (l.style.top = "0"), (l.target = "_blank"), (l.href = o.link), (c = document.createElement("span")), ((u = document.querySelector(this.el)).style.position = "relative"), (c.style.padding = "3px 5px"), (c.style.display = "flex"), (c.style.justifyContent = "center"), (c.style.alignItems = "center"), (c.style.margin = "10px"), (c.style.height = "30px"), (c.style.borderRadius = "10px"), (c.style.background = "grey"), c.addEventListener( "click", p( d().mark(function t() { return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (!(h.adCountdown > 0)) { t.next = 3; break; } return ( h.$emitter.emit("skip-ads", !1), t.abrupt("return") ); case 3: (r.length = 0), h.$emitter.emit("skip-ads", !0), h.createPlayer(h.options); case 6: case "end": return t.stop(); } }, t); }) ) ), (c.style.color = "white"), (c.style.zIndex = "99999"), (c.style.position = "absolute"), (c.style.top = "0"), (c.style.right = "0"), (c.style.cursor = "pointer"), (c.className = "close-button"), F && ((c.style.top = "-45px"), (u.style.overflow = "visible")), u.append(c), u.append(l), this.$emitter.on("ended", function () { h.$logger.log("ad::ended"), (h.dplayer.events.events.error = []), h.playAd(); }), console.log("adTimer::", this.adTimer), this.adTimer && clearInterval(this.adTimer), (c.innerText = "".concat( this.adCountdown > 0 ? this.adCountdown + "s | " : "", "跳过广告" )), (this.adTimer = setInterval(function () { (h.adCountdown -= 1), (c.innerText = "".concat( h.adCountdown > 0 ? h.adCountdown + "s | " : "", "跳过广告" )), h.adCountdown <= 0 && clearInterval(h.adTimer); }, 1e3)); case 45: case "end": return t.stop(); } }, t, this ); }) )), function () { return n.apply(this, arguments); }) }, { key: "createPlayer", value: ((e = p( d().mark(function t(e) { var n, i, r, a, s, o = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return (t.next = 2), this.destroy(); case 2: return ( (n = this.el), e.isAD && this.$emitter.on("error", function (t) { o.$logger.log("ad::error", t), o.playAd(); }), this.$emitter.on("*", function (t, e) { o.$logger.log("reporter::", t, e), o.$reporter.add({ event: t }); }), (i = new bh({ emitter: this.$emitter, logger: this.$logger })), (t.next = 8), i.getResolution(e.src) ); case 8: (r = t.sent), this.$logger.log("getResolution", r), (a = { container: document.querySelector("".concat(n)), autoplay: e.autoplay, loop: e.loop, video: { url: e.src, pic: e.poster, type: "customHls", customType: { customHls: function (t, e) { if (!P && xo.isSupported()) { console.log("Hls.isSupported"); var n = new xo(); n.loadSource(t.src), n.attachMedia(t); } } } } }), e.muted && (a.volume = 0), r && (r.length > 1 ? ((a.video.quality = r), (a.video.defaultQuality = 0)) : (a.video.url = r[0].url)), (this.dplayer = new j(a)), (e.controls && !e.isAD) || (document.querySelector(".dplayer-controller-mask").remove(), document.querySelector(".dplayer-controller").remove()), (s = document.querySelector(".dplayer-play-icon")) && ((s.style.display = "inline-block"), (document.querySelector( ".dplayer-controller" ).style.zIndex = 100)), this.initDPlayerEvnets(this.dplayer), e.isAD || (this.$logger.log("renderAdvertisement", this.el, this.options), _h({ el: this.el, adList: this.options.adList, player: this })); case 20: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return e.apply(this, arguments); }) }, { key: "initDPlayerEvnets", value: function (t) { var e = this; if ((console.log("initDPlayerEvnets", t, this.eventList), t)) { [ "canplay", "canplaythrough", "durationchange", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "volumechange", "waiting", "fullscreen" ].forEach(function (n) { t.on(n, function (t) { e.$emitter.emit(n, t); }); }), this.eventList.forEach(function (t) { e.$emitter.on(t.eventType, t.cb); }); } } }, { key: "getVideo", value: function () { if (this.dplayer) return this.dplayer.video; } }, { key: "on", value: function (t, e) { if (!t || !tl(e)) throw new Error("on方法参数有误"); this.eventList.push({ eventType: t, cb: e }); } }, { key: "off", value: function (t, e) { if (!t || !tl(e)) throw new Error("on方法参数有误"); var n = Du(this.eventList, ["cb", e]); n >= 0 && this.eventList.splice(n, 1); } }, { key: "destroy", value: ((t = p( d().mark(function t() { var e; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: this.$emitter.all.clear(), null === (e = this.dplayer) || void 0 === e || e.destroy(), clearInterval(this.adTimer), this.$logger.log("destroy"); case 4: case "end": return t.stop(); } }, t, this ); }) )), function () { return t.apply(this, arguments); }) } ] ); var t, e, n; })(); g(kh, "isSupported", function () { return !F; }), g(kh, "getPlayerType", function () { return Th; }), g(kh, "getDevice", function () { return I; }); !(function (t) { var e, n, r = ((e = new Date()), (n = 4), { setLogLevel: function (t) { n = t == this.debug ? 1 : t == this.info ? 2 : t == this.warn ? 3 : (this.error, 4); }, debug: function (t, i) { void 0 === console.debug && (console.debug = console.log), 1 >= n && console.debug("[" + r.getDurationString(new Date() - e, 1e3) + "]", "[" + t + "]", i); }, log: function (t, e) { this.debug(t.msg); }, info: function (t, i) { 2 >= n && console.info("[" + r.getDurationString(new Date() - e, 1e3) + "]", "[" + t + "]", i); }, warn: function (t, i) { 3 >= n && console.warn("[" + r.getDurationString(new Date() - e, 1e3) + "]", "[" + t + "]", i); }, error: function (t, i) { 4 >= n && console.error("[" + r.getDurationString(new Date() - e, 1e3) + "]", "[" + t + "]", i); } }); (r.getDurationString = function (t, e) { var n; function i(t, e) { for (var n = ("" + t).split("."); n[0].length < e;) n[0] = "0" + n[0]; return n.join("."); } t < 0 ? ((n = !0), (t = -t)) : (n = !1); var r = t / (e || 1), a = Math.floor(r / 3600); r -= 3600 * a; var s = Math.floor(r / 60), o = 1e3 * (r -= 60 * s); return ( (o -= 1e3 * (r = Math.floor(r))), (o = Math.floor(o)), (n ? "-" : "") + a + ":" + i(s, 2) + ":" + i(r, 2) + "." + i(o, 3) ); }), (r.printRanges = function (t) { var e = t.length; if (e > 0) { for (var n = "", i = 0; i < e; i++) i > 0 && (n += ","), (n += "[" + r.getDurationString(t.start(i)) + "," + r.getDurationString(t.end(i)) + "]"); return n; } return "(empty)"; }), (t.Log = r); var a = function (t) { if (!(t instanceof ArrayBuffer)) throw "Needs an array buffer"; (this.buffer = t), (this.dataview = new DataView(t)), (this.position = 0); }; (a.prototype.getPosition = function () { return this.position; }), (a.prototype.getEndPosition = function () { return this.buffer.byteLength; }), (a.prototype.getLength = function () { return this.buffer.byteLength; }), (a.prototype.seek = function (t) { var e = Math.max(0, Math.min(this.buffer.byteLength, t)); return (this.position = isNaN(e) || !isFinite(e) ? 0 : e), !0; }), (a.prototype.isEos = function () { return this.getPosition() >= this.getEndPosition(); }), (a.prototype.readAnyInt = function (t, e) { var n = 0; if (this.position + t <= this.buffer.byteLength) { switch (t) { case 1: n = e ? this.dataview.getInt8(this.position) : this.dataview.getUint8(this.position); break; case 2: n = e ? this.dataview.getInt16(this.position) : this.dataview.getUint16(this.position); break; case 3: if (e) throw "No method for reading signed 24 bits values"; (n = this.dataview.getUint8(this.position) << 16), (n |= this.dataview.getUint8(this.position + 1) << 8), (n |= this.dataview.getUint8(this.position + 2)); break; case 4: n = e ? this.dataview.getInt32(this.position) : this.dataview.getUint32(this.position); break; case 8: if (e) throw "No method for reading signed 64 bits values"; (n = this.dataview.getUint32(this.position) << 32), (n |= this.dataview.getUint32(this.position + 4)); break; default: throw "readInt method not implemented for size: " + t; } return (this.position += t), n; } throw "Not enough bytes in buffer"; }), (a.prototype.readUint8 = function () { return this.readAnyInt(1, !1); }), (a.prototype.readUint16 = function () { return this.readAnyInt(2, !1); }), (a.prototype.readUint24 = function () { return this.readAnyInt(3, !1); }), (a.prototype.readUint32 = function () { return this.readAnyInt(4, !1); }), (a.prototype.readUint64 = function () { return this.readAnyInt(8, !1); }), (a.prototype.readString = function (t) { if (this.position + t <= this.buffer.byteLength) { for (var e = "", n = 0; n < t; n++) e += String.fromCharCode(this.readUint8()); return e; } throw "Not enough bytes in buffer"; }), (a.prototype.readCString = function () { for (var t = []; ;) { var e = this.readUint8(); if (0 === e) break; t.push(e); } return String.fromCharCode.apply(null, t); }), (a.prototype.readInt8 = function () { return this.readAnyInt(1, !0); }), (a.prototype.readInt16 = function () { return this.readAnyInt(2, !0); }), (a.prototype.readInt32 = function () { return this.readAnyInt(4, !0); }), (a.prototype.readInt64 = function () { return this.readAnyInt(8, !1); }), (a.prototype.readUint8Array = function (t) { for (var e = new Uint8Array(t), n = 0; n < t; n++) e[n] = this.readUint8(); return e; }), (a.prototype.readInt16Array = function (t) { for (var e = new Int16Array(t), n = 0; n < t; n++) e[n] = this.readInt16(); return e; }), (a.prototype.readUint16Array = function (t) { for (var e = new Int16Array(t), n = 0; n < t; n++) e[n] = this.readUint16(); return e; }), (a.prototype.readUint32Array = function (t) { for (var e = new Uint32Array(t), n = 0; n < t; n++) e[n] = this.readUint32(); return e; }), (a.prototype.readInt32Array = function (t) { for (var e = new Int32Array(t), n = 0; n < t; n++) e[n] = this.readInt32(); return e; }), (t.MP4BoxStream = a); var s = function t(e, n, i) { (this._byteOffset = n || 0), e instanceof ArrayBuffer ? (this.buffer = e) : "object" == u(e) ? ((this.dataView = e), n && (this._byteOffset += n)) : (this.buffer = new ArrayBuffer(e || 0)), (this.position = 0), (this.endianness = null == i ? t.LITTLE_ENDIAN : i); }; ((s.prototype = {}).getPosition = function () { return this.position; }), (s.prototype._realloc = function (t) { if (this._dynamicSize) { var e = this._byteOffset + this.position + t, n = this._buffer.byteLength; if (e <= n) e > this._byteLength && (this._byteLength = e); else { for (n < 1 && (n = 1); e > n;) n *= 2; var i = new ArrayBuffer(n), r = new Uint8Array(this._buffer); new Uint8Array(i, 0, r.length).set(r), (this.buffer = i), (this._byteLength = e); } } }), (s.prototype._trimAlloc = function () { if (this._byteLength != this._buffer.byteLength) { var t = new ArrayBuffer(this._byteLength), e = new Uint8Array(t), n = new Uint8Array(this._buffer, 0, e.length); e.set(n), (this.buffer = t); } }), (s.BIG_ENDIAN = !1), (s.LITTLE_ENDIAN = !0), (s.prototype._byteLength = 0), Object.defineProperty(s.prototype, "byteLength", { get: function () { return this._byteLength - this._byteOffset; } }), Object.defineProperty(s.prototype, "buffer", { get: function () { return this._trimAlloc(), this._buffer; }, set: function (t) { (this._buffer = t), (this._dataView = new DataView(this._buffer, this._byteOffset)), (this._byteLength = this._buffer.byteLength); } }), Object.defineProperty(s.prototype, "byteOffset", { get: function () { return this._byteOffset; }, set: function (t) { (this._byteOffset = t), (this._dataView = new DataView(this._buffer, this._byteOffset)), (this._byteLength = this._buffer.byteLength); } }), Object.defineProperty(s.prototype, "dataView", { get: function () { return this._dataView; }, set: function (t) { (this._byteOffset = t.byteOffset), (this._buffer = t.buffer), (this._dataView = new DataView(this._buffer, this._byteOffset)), (this._byteLength = this._byteOffset + t.byteLength); } }), (s.prototype.seek = function (t) { var e = Math.max(0, Math.min(this.byteLength, t)); this.position = isNaN(e) || !isFinite(e) ? 0 : e; }), (s.prototype.isEof = function () { return this.position >= this._byteLength; }), (s.prototype.mapUint8Array = function (t) { this._realloc(1 * t); var e = new Uint8Array(this._buffer, this.byteOffset + this.position, t); return (this.position += 1 * t), e; }), (s.prototype.readInt32Array = function (t, e) { t = null == t ? this.byteLength - this.position / 4 : t; var n = new Int32Array(t); return ( s.memcpy(n.buffer, 0, this.buffer, this.byteOffset + this.position, t * n.BYTES_PER_ELEMENT), s.arrayToNative(n, null == e ? this.endianness : e), (this.position += n.byteLength), n ); }), (s.prototype.readInt16Array = function (t, e) { t = null == t ? this.byteLength - this.position / 2 : t; var n = new Int16Array(t); return ( s.memcpy(n.buffer, 0, this.buffer, this.byteOffset + this.position, t * n.BYTES_PER_ELEMENT), s.arrayToNative(n, null == e ? this.endianness : e), (this.position += n.byteLength), n ); }), (s.prototype.readInt8Array = function (t) { t = null == t ? this.byteLength - this.position : t; var e = new Int8Array(t); return ( s.memcpy(e.buffer, 0, this.buffer, this.byteOffset + this.position, t * e.BYTES_PER_ELEMENT), (this.position += e.byteLength), e ); }), (s.prototype.readUint32Array = function (t, e) { t = null == t ? this.byteLength - this.position / 4 : t; var n = new Uint32Array(t); return ( s.memcpy(n.buffer, 0, this.buffer, this.byteOffset + this.position, t * n.BYTES_PER_ELEMENT), s.arrayToNative(n, null == e ? this.endianness : e), (this.position += n.byteLength), n ); }), (s.prototype.readUint16Array = function (t, e) { t = null == t ? this.byteLength - this.position / 2 : t; var n = new Uint16Array(t); return ( s.memcpy(n.buffer, 0, this.buffer, this.byteOffset + this.position, t * n.BYTES_PER_ELEMENT), s.arrayToNative(n, null == e ? this.endianness : e), (this.position += n.byteLength), n ); }), (s.prototype.readUint8Array = function (t) { t = null == t ? this.byteLength - this.position : t; var e = new Uint8Array(t); return ( s.memcpy(e.buffer, 0, this.buffer, this.byteOffset + this.position, t * e.BYTES_PER_ELEMENT), (this.position += e.byteLength), e ); }), (s.prototype.readFloat64Array = function (t, e) { t = null == t ? this.byteLength - this.position / 8 : t; var n = new Float64Array(t); return ( s.memcpy(n.buffer, 0, this.buffer, this.byteOffset + this.position, t * n.BYTES_PER_ELEMENT), s.arrayToNative(n, null == e ? this.endianness : e), (this.position += n.byteLength), n ); }), (s.prototype.readFloat32Array = function (t, e) { t = null == t ? this.byteLength - this.position / 4 : t; var n = new Float32Array(t); return ( s.memcpy(n.buffer, 0, this.buffer, this.byteOffset + this.position, t * n.BYTES_PER_ELEMENT), s.arrayToNative(n, null == e ? this.endianness : e), (this.position += n.byteLength), n ); }), (s.prototype.readInt32 = function (t) { var e = this._dataView.getInt32(this.position, null == t ? this.endianness : t); return (this.position += 4), e; }), (s.prototype.readInt16 = function (t) { var e = this._dataView.getInt16(this.position, null == t ? this.endianness : t); return (this.position += 2), e; }), (s.prototype.readInt8 = function () { var t = this._dataView.getInt8(this.position); return (this.position += 1), t; }), (s.prototype.readUint32 = function (t) { var e = this._dataView.getUint32(this.position, null == t ? this.endianness : t); return (this.position += 4), e; }), (s.prototype.readUint16 = function (t) { var e = this._dataView.getUint16(this.position, null == t ? this.endianness : t); return (this.position += 2), e; }), (s.prototype.readUint8 = function () { var t = this._dataView.getUint8(this.position); return (this.position += 1), t; }), (s.prototype.readFloat32 = function (t) { var e = this._dataView.getFloat32(this.position, null == t ? this.endianness : t); return (this.position += 4), e; }), (s.prototype.readFloat64 = function (t) { var e = this._dataView.getFloat64(this.position, null == t ? this.endianness : t); return (this.position += 8), e; }), (s.endianness = new Int8Array(new Int16Array([1]).buffer)[0] > 0), (s.memcpy = function (t, e, n, i, r) { var a = new Uint8Array(t, e, r), s = new Uint8Array(n, i, r); a.set(s); }), (s.arrayToNative = function (t, e) { return e == this.endianness ? t : this.flipArrayEndianness(t); }), (s.nativeToEndian = function (t, e) { return this.endianness == e ? t : this.flipArrayEndianness(t); }), (s.flipArrayEndianness = function (t) { for ( var e = new Uint8Array(t.buffer, t.byteOffset, t.byteLength), n = 0; n < t.byteLength; n += t.BYTES_PER_ELEMENT ) for (var i = n + t.BYTES_PER_ELEMENT - 1, r = n; i > r; i--, r++) { var a = e[r]; (e[r] = e[i]), (e[i] = a); } return t; }), (s.prototype.failurePosition = 0), (String.fromCharCodeUint8 = function (t) { for (var e = [], n = 0; n < t.length; n++) e[n] = t[n]; return String.fromCharCode.apply(null, e); }), (s.prototype.readString = function (t, e) { return null == e || "ASCII" == e ? String.fromCharCodeUint8.apply(null, [this.mapUint8Array(null == t ? this.byteLength - this.position : t)]) : new TextDecoder(e).decode(this.mapUint8Array(t)); }), (s.prototype.readCString = function (t) { var e = this.byteLength - this.position, n = new Uint8Array(this._buffer, this._byteOffset + this.position), i = e; null != t && (i = Math.min(t, e)); for (var r = 0; r < i && 0 !== n[r]; r++); var a = String.fromCharCodeUint8.apply(null, [this.mapUint8Array(r)]); return null != t ? (this.position += i - r) : r != e && (this.position += 1), a; }); var o = Math.pow(2, 32); (s.prototype.readInt64 = function () { return this.readInt32() * o + this.readUint32(); }), (s.prototype.readUint64 = function () { return this.readUint32() * o + this.readUint32(); }), (s.prototype.readInt64 = function () { return this.readUint32() * o + this.readUint32(); }), (s.prototype.readUint24 = function () { return (this.readUint8() << 16) + (this.readUint8() << 8) + this.readUint8(); }), (t.DataStream = s), (s.prototype.save = function (t) { var e = new Blob([this.buffer]); if (!window.URL || !URL.createObjectURL) throw "DataStream.save: Can't create object URL."; var n = window.URL.createObjectURL(e), i = document.createElement("a"); document.body.appendChild(i), i.setAttribute("href", n), i.setAttribute("download", t), i.setAttribute("target", "_self"), i.click(), window.URL.revokeObjectURL(n); }), (s.prototype._dynamicSize = !0), Object.defineProperty(s.prototype, "dynamicSize", { get: function () { return this._dynamicSize; }, set: function (t) { t || this._trimAlloc(), (this._dynamicSize = t); } }), (s.prototype.shift = function (t) { var e = new ArrayBuffer(this._byteLength - t), n = new Uint8Array(e), i = new Uint8Array(this._buffer, t, n.length); n.set(i), (this.buffer = e), (this.position -= t); }), (s.prototype.writeInt32Array = function (t, e) { if ( (this._realloc(4 * t.length), t instanceof Int32Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapInt32Array(t.length, e); else for (var n = 0; n < t.length; n++) this.writeInt32(t[n], e); }), (s.prototype.writeInt16Array = function (t, e) { if ( (this._realloc(2 * t.length), t instanceof Int16Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapInt16Array(t.length, e); else for (var n = 0; n < t.length; n++) this.writeInt16(t[n], e); }), (s.prototype.writeInt8Array = function (t) { if ( (this._realloc(1 * t.length), t instanceof Int8Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapInt8Array(t.length); else for (var e = 0; e < t.length; e++) this.writeInt8(t[e]); }), (s.prototype.writeUint32Array = function (t, e) { if ( (this._realloc(4 * t.length), t instanceof Uint32Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapUint32Array(t.length, e); else for (var n = 0; n < t.length; n++) this.writeUint32(t[n], e); }), (s.prototype.writeUint16Array = function (t, e) { if ( (this._realloc(2 * t.length), t instanceof Uint16Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapUint16Array(t.length, e); else for (var n = 0; n < t.length; n++) this.writeUint16(t[n], e); }), (s.prototype.writeUint8Array = function (t) { if ( (this._realloc(1 * t.length), t instanceof Uint8Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapUint8Array(t.length); else for (var e = 0; e < t.length; e++) this.writeUint8(t[e]); }), (s.prototype.writeFloat64Array = function (t, e) { if ( (this._realloc(8 * t.length), t instanceof Float64Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapFloat64Array(t.length, e); else for (var n = 0; n < t.length; n++) this.writeFloat64(t[n], e); }), (s.prototype.writeFloat32Array = function (t, e) { if ( (this._realloc(4 * t.length), t instanceof Float32Array && this.byteOffset + (this.position % t.BYTES_PER_ELEMENT) === 0) ) s.memcpy(this._buffer, this.byteOffset + this.position, t.buffer, 0, t.byteLength), this.mapFloat32Array(t.length, e); else for (var n = 0; n < t.length; n++) this.writeFloat32(t[n], e); }), (s.prototype.writeInt32 = function (t, e) { this._realloc(4), this._dataView.setInt32(this.position, t, null == e ? this.endianness : e), (this.position += 4); }), (s.prototype.writeInt16 = function (t, e) { this._realloc(2), this._dataView.setInt16(this.position, t, null == e ? this.endianness : e), (this.position += 2); }), (s.prototype.writeInt8 = function (t) { this._realloc(1), this._dataView.setInt8(this.position, t), (this.position += 1); }), (s.prototype.writeUint32 = function (t, e) { this._realloc(4), this._dataView.setUint32(this.position, t, null == e ? this.endianness : e), (this.position += 4); }), (s.prototype.writeUint16 = function (t, e) { this._realloc(2), this._dataView.setUint16(this.position, t, null == e ? this.endianness : e), (this.position += 2); }), (s.prototype.writeUint8 = function (t) { this._realloc(1), this._dataView.setUint8(this.position, t), (this.position += 1); }), (s.prototype.writeFloat32 = function (t, e) { this._realloc(4), this._dataView.setFloat32(this.position, t, null == e ? this.endianness : e), (this.position += 4); }), (s.prototype.writeFloat64 = function (t, e) { this._realloc(8), this._dataView.setFloat64(this.position, t, null == e ? this.endianness : e), (this.position += 8); }), (s.prototype.writeUCS2String = function (t, e, n) { null == n && (n = t.length); for (var i = 0; i < t.length && i < n; i++) this.writeUint16(t.charCodeAt(i), e); for (; i < n; i++) this.writeUint16(0); }), (s.prototype.writeString = function (t, e, n) { var i = 0; if (null == e || "ASCII" == e) if (null != n) { var r = Math.min(t.length, n); for (i = 0; i < r; i++) this.writeUint8(t.charCodeAt(i)); for (; i < n; i++) this.writeUint8(0); } else for (i = 0; i < t.length; i++) this.writeUint8(t.charCodeAt(i)); else this.writeUint8Array(new TextEncoder(e).encode(t.substring(0, n))); }), (s.prototype.writeCString = function (t, e) { var n = 0; if (null != e) { var i = Math.min(t.length, e); for (n = 0; n < i; n++) this.writeUint8(t.charCodeAt(n)); for (; n < e; n++) this.writeUint8(0); } else { for (n = 0; n < t.length; n++) this.writeUint8(t.charCodeAt(n)); this.writeUint8(0); } }), (s.prototype.writeStruct = function (t, e) { for (var n = 0; n < t.length; n += 2) { var i = t[n + 1]; this.writeType(i, e[t[n]], e); } }), (s.prototype.writeType = function (t, e, n) { var i; if ("function" == typeof t) return t(this, e); if ("object" == u(t) && !(t instanceof Array)) return t.set(this, e, n); var r = null, a = "ASCII", o = this.position; switch ( ("string" == typeof t && /:/.test(t) && ((i = t.split(":")), (t = i[0]), (r = parseInt(i[1]))), "string" == typeof t && /,/.test(t) && ((i = t.split(",")), (t = i[0]), (a = parseInt(i[1]))), t) ) { case "uint8": this.writeUint8(e); break; case "int8": this.writeInt8(e); break; case "uint16": this.writeUint16(e, this.endianness); break; case "int16": this.writeInt16(e, this.endianness); break; case "uint32": this.writeUint32(e, this.endianness); break; case "int32": this.writeInt32(e, this.endianness); break; case "float32": this.writeFloat32(e, this.endianness); break; case "float64": this.writeFloat64(e, this.endianness); break; case "uint16be": this.writeUint16(e, s.BIG_ENDIAN); break; case "int16be": this.writeInt16(e, s.BIG_ENDIAN); break; case "uint32be": this.writeUint32(e, s.BIG_ENDIAN); break; case "int32be": this.writeInt32(e, s.BIG_ENDIAN); break; case "float32be": this.writeFloat32(e, s.BIG_ENDIAN); break; case "float64be": this.writeFloat64(e, s.BIG_ENDIAN); break; case "uint16le": this.writeUint16(e, s.LITTLE_ENDIAN); break; case "int16le": this.writeInt16(e, s.LITTLE_ENDIAN); break; case "uint32le": this.writeUint32(e, s.LITTLE_ENDIAN); break; case "int32le": this.writeInt32(e, s.LITTLE_ENDIAN); break; case "float32le": this.writeFloat32(e, s.LITTLE_ENDIAN); break; case "float64le": this.writeFloat64(e, s.LITTLE_ENDIAN); break; case "cstring": this.writeCString(e, r); break; case "string": this.writeString(e, a, r); break; case "u16string": this.writeUCS2String(e, this.endianness, r); break; case "u16stringle": this.writeUCS2String(e, s.LITTLE_ENDIAN, r); break; case "u16stringbe": this.writeUCS2String(e, s.BIG_ENDIAN, r); break; default: if (3 == t.length) { for (var l = t[1], d = 0; d < e.length; d++) this.writeType(l, e[d]); break; } this.writeStruct(t, e); } null != r && ((this.position = o), this._realloc(r), (this.position = o + r)); }), (s.prototype.writeUint64 = function (t) { var e = Math.floor(t / o); this.writeUint32(e), this.writeUint32(4294967295 & t); }), (s.prototype.writeUint24 = function (t) { this.writeUint8((16711680 & t) >> 16), this.writeUint8((65280 & t) >> 8), this.writeUint8(255 & t); }), (s.prototype.adjustUint32 = function (t, e) { var n = this.position; this.seek(t), this.writeUint32(e), this.seek(n); }), (s.prototype.mapInt32Array = function (t, e) { this._realloc(4 * t); var n = new Int32Array(this._buffer, this.byteOffset + this.position, t); return s.arrayToNative(n, null == e ? this.endianness : e), (this.position += 4 * t), n; }), (s.prototype.mapInt16Array = function (t, e) { this._realloc(2 * t); var n = new Int16Array(this._buffer, this.byteOffset + this.position, t); return s.arrayToNative(n, null == e ? this.endianness : e), (this.position += 2 * t), n; }), (s.prototype.mapInt8Array = function (t) { this._realloc(1 * t); var e = new Int8Array(this._buffer, this.byteOffset + this.position, t); return (this.position += 1 * t), e; }), (s.prototype.mapUint32Array = function (t, e) { this._realloc(4 * t); var n = new Uint32Array(this._buffer, this.byteOffset + this.position, t); return s.arrayToNative(n, null == e ? this.endianness : e), (this.position += 4 * t), n; }), (s.prototype.mapUint16Array = function (t, e) { this._realloc(2 * t); var n = new Uint16Array(this._buffer, this.byteOffset + this.position, t); return s.arrayToNative(n, null == e ? this.endianness : e), (this.position += 2 * t), n; }), (s.prototype.mapFloat64Array = function (t, e) { this._realloc(8 * t); var n = new Float64Array(this._buffer, this.byteOffset + this.position, t); return s.arrayToNative(n, null == e ? this.endianness : e), (this.position += 8 * t), n; }), (s.prototype.mapFloat32Array = function (t, e) { this._realloc(4 * t); var n = new Float32Array(this._buffer, this.byteOffset + this.position, t); return s.arrayToNative(n, null == e ? this.endianness : e), (this.position += 4 * t), n; }); var l = function (t) { (this.buffers = []), (this.bufferIndex = -1), t && (this.insertBuffer(t), (this.bufferIndex = 0)); }; ((l.prototype = new s(new ArrayBuffer(), 0, s.BIG_ENDIAN)).initialized = function () { var t; return ( this.bufferIndex > -1 || (this.buffers.length > 0 ? 0 === (t = this.buffers[0]).fileStart ? ((this.buffer = t), (this.bufferIndex = 0), r.debug("MultiBufferStream", "Stream ready for parsing"), !0) : (r.warn("MultiBufferStream", "The first buffer should have a fileStart of 0"), this.logBufferLevel(), !1) : (r.warn("MultiBufferStream", "No buffer to start parsing from"), this.logBufferLevel(), !1)) ); }), (ArrayBuffer.concat = function (t, e) { r.debug("ArrayBuffer", "Trying to create a new buffer of size: " + (t.byteLength + e.byteLength)); var n = new Uint8Array(t.byteLength + e.byteLength); return n.set(new Uint8Array(t), 0), n.set(new Uint8Array(e), t.byteLength), n.buffer; }), (l.prototype.reduceBuffer = function (t, e, n) { var i; return ( (i = new Uint8Array(n)).set(new Uint8Array(t, e, n)), (i.buffer.fileStart = t.fileStart + e), (i.buffer.usedBytes = 0), i.buffer ); }), (l.prototype.insertBuffer = function (t) { for (var e = !0, n = 0; n < this.buffers.length; n++) { var i = this.buffers[n]; if (t.fileStart <= i.fileStart) { if (t.fileStart === i.fileStart) { if (t.byteLength > i.byteLength) { this.buffers.splice(n, 1), n--; continue; } r.warn( "MultiBufferStream", "Buffer (fileStart: " + t.fileStart + " - Length: " + t.byteLength + ") already appended, ignoring" ); } else t.fileStart + t.byteLength <= i.fileStart || (t = this.reduceBuffer(t, 0, i.fileStart - t.fileStart)), r.debug( "MultiBufferStream", "Appending new buffer (fileStart: " + t.fileStart + " - Length: " + t.byteLength + ")" ), this.buffers.splice(n, 0, t), 0 === n && (this.buffer = t); e = !1; break; } if (t.fileStart < i.fileStart + i.byteLength) { var a = i.fileStart + i.byteLength - t.fileStart, s = t.byteLength - a; if (!(s > 0)) { e = !1; break; } t = this.reduceBuffer(t, a, s); } } e && (r.debug( "MultiBufferStream", "Appending new buffer (fileStart: " + t.fileStart + " - Length: " + t.byteLength + ")" ), this.buffers.push(t), 0 === n && (this.buffer = t)); }), (l.prototype.logBufferLevel = function (t) { var e, n, i, a, s, o = [], l = ""; for (i = 0, a = 0, e = 0; e < this.buffers.length; e++) (n = this.buffers[e]), 0 === e ? ((s = {}), o.push(s), (s.start = n.fileStart), (s.end = n.fileStart + n.byteLength), (l += "[" + s.start + "-")) : s.end === n.fileStart ? (s.end = n.fileStart + n.byteLength) : (((s = {}).start = n.fileStart), (l += o[o.length - 1].end - 1 + "], [" + s.start + "-"), (s.end = n.fileStart + n.byteLength), o.push(s)), (i += n.usedBytes), (a += n.byteLength); o.length > 0 && (l += s.end - 1 + "]"); var d = t ? r.info : r.debug; 0 === this.buffers.length ? d("MultiBufferStream", "No more buffer in memory") : d( "MultiBufferStream", this.buffers.length + " stored buffer(s) (" + i + "/" + a + " bytes), continuous ranges: " + l ); }), (l.prototype.cleanBuffers = function () { var t, e; for (t = 0; t < this.buffers.length; t++) (e = this.buffers[t]).usedBytes === e.byteLength && (r.debug("MultiBufferStream", "Removing buffer #" + t), this.buffers.splice(t, 1), t--); }), (l.prototype.mergeNextBuffer = function () { var t; if (this.bufferIndex + 1 < this.buffers.length) { if ((t = this.buffers[this.bufferIndex + 1]).fileStart === this.buffer.fileStart + this.buffer.byteLength) { var e = this.buffer.byteLength, n = this.buffer.usedBytes, i = this.buffer.fileStart; return ( (this.buffers[this.bufferIndex] = ArrayBuffer.concat(this.buffer, t)), (this.buffer = this.buffers[this.bufferIndex]), this.buffers.splice(this.bufferIndex + 1, 1), (this.buffer.usedBytes = n), (this.buffer.fileStart = i), r.debug( "ISOFile", "Concatenating buffer for box parsing (length: " + e + "->" + this.buffer.byteLength + ")" ), !0 ); } return !1; } return !1; }), (l.prototype.findPosition = function (t, e, n) { var i, a = null, s = -1; for (i = !0 === t ? 0 : this.bufferIndex; i < this.buffers.length && (a = this.buffers[i]).fileStart <= e;) (s = i), n && (a.fileStart + a.byteLength <= e ? (a.usedBytes = a.byteLength) : (a.usedBytes = e - a.fileStart), this.logBufferLevel()), i++; return -1 !== s && (a = this.buffers[s]).fileStart + a.byteLength >= e ? (r.debug("MultiBufferStream", "Found position in existing buffer #" + s), s) : -1; }), (l.prototype.findEndContiguousBuf = function (t) { var e, n, i, r = void 0 !== t ? t : this.bufferIndex; if (((n = this.buffers[r]), this.buffers.length > r + 1)) for ( e = r + 1; e < this.buffers.length && (i = this.buffers[e]).fileStart === n.fileStart + n.byteLength; e++ ) n = i; return n.fileStart + n.byteLength; }), (l.prototype.getEndFilePositionAfter = function (t) { var e = this.findPosition(!0, t, !1); return -1 !== e ? this.findEndContiguousBuf(e) : t; }), (l.prototype.addUsedBytes = function (t) { (this.buffer.usedBytes += t), this.logBufferLevel(); }), (l.prototype.setAllUsedBytes = function () { (this.buffer.usedBytes = this.buffer.byteLength), this.logBufferLevel(); }), (l.prototype.seek = function (t, e, n) { var i; return -1 !== (i = this.findPosition(e, t, n)) ? ((this.buffer = this.buffers[i]), (this.bufferIndex = i), (this.position = t - this.buffer.fileStart), r.debug("MultiBufferStream", "Repositioning parser at buffer position: " + this.position), !0) : (r.debug("MultiBufferStream", "Position " + t + " not found in buffered data"), !1); }), (l.prototype.getPosition = function () { if (-1 === this.bufferIndex || null === this.buffers[this.bufferIndex]) throw "Error accessing position in the MultiBufferStream"; return this.buffers[this.bufferIndex].fileStart + this.position; }), (l.prototype.getLength = function () { return this.byteLength; }), (l.prototype.getEndPosition = function () { if (-1 === this.bufferIndex || null === this.buffers[this.bufferIndex]) throw "Error accessing position in the MultiBufferStream"; return this.buffers[this.bufferIndex].fileStart + this.byteLength; }), (t.MultiBufferStream = l); var d = function () { var t = []; (t[3] = "ES_Descriptor"), (t[4] = "DecoderConfigDescriptor"), (t[5] = "DecoderSpecificInfo"), (t[6] = "SLConfigDescriptor"), (this.getDescriptorName = function (e) { return t[e]; }); var e = this, n = {}; return ( (this.parseOneDescriptor = function (e) { var i, a, s, o = 0; for (i = e.readUint8(), s = e.readUint8(); 128 & s;) (o = (127 & s) << 7), (s = e.readUint8()); return ( (o += 127 & s), r.debug( "MPEG4DescriptorParser", "Found " + (t[i] || "Descriptor " + i) + ", size " + o + " at position " + e.getPosition() ), (a = t[i] ? new n[t[i]](o) : new n.Descriptor(o)).parse(e), a ); }), (n.Descriptor = function (t, e) { (this.tag = t), (this.size = e), (this.descs = []); }), (n.Descriptor.prototype.parse = function (t) { this.data = t.readUint8Array(this.size); }), (n.Descriptor.prototype.findDescriptor = function (t) { for (var e = 0; e < this.descs.length; e++) if (this.descs[e].tag == t) return this.descs[e]; return null; }), (n.Descriptor.prototype.parseRemainingDescriptors = function (t) { for (var n = t.position; t.position < n + this.size;) { var i = e.parseOneDescriptor(t); this.descs.push(i); } }), (n.ES_Descriptor = function (t) { n.Descriptor.call(this, 3, t); }), (n.ES_Descriptor.prototype = new n.Descriptor()), (n.ES_Descriptor.prototype.parse = function (t) { if ( ((this.ES_ID = t.readUint16()), (this.flags = t.readUint8()), (this.size -= 3), 128 & this.flags ? ((this.dependsOn_ES_ID = t.readUint16()), (this.size -= 2)) : (this.dependsOn_ES_ID = 0), 64 & this.flags) ) { var e = t.readUint8(); (this.URL = t.readString(e)), (this.size -= e + 1); } else this.URL = ""; 32 & this.flags ? ((this.OCR_ES_ID = t.readUint16()), (this.size -= 2)) : (this.OCR_ES_ID = 0), this.parseRemainingDescriptors(t); }), (n.ES_Descriptor.prototype.getOTI = function (t) { var e = this.findDescriptor(4); return e ? e.oti : 0; }), (n.ES_Descriptor.prototype.getAudioConfig = function (t) { var e = this.findDescriptor(4); if (!e) return null; var n = e.findDescriptor(5); if (n && n.data) { var i = (248 & n.data[0]) >> 3; return 31 === i && n.data.length >= 2 && (i = 32 + ((7 & n.data[0]) << 3) + ((224 & n.data[1]) >> 5)), i; } return null; }), (n.DecoderConfigDescriptor = function (t) { n.Descriptor.call(this, 4, t); }), (n.DecoderConfigDescriptor.prototype = new n.Descriptor()), (n.DecoderConfigDescriptor.prototype.parse = function (t) { (this.oti = t.readUint8()), (this.streamType = t.readUint8()), (this.bufferSize = t.readUint24()), (this.maxBitrate = t.readUint32()), (this.avgBitrate = t.readUint32()), (this.size -= 13), this.parseRemainingDescriptors(t); }), (n.DecoderSpecificInfo = function (t) { n.Descriptor.call(this, 5, t); }), (n.DecoderSpecificInfo.prototype = new n.Descriptor()), (n.SLConfigDescriptor = function (t) { n.Descriptor.call(this, 6, t); }), (n.SLConfigDescriptor.prototype = new n.Descriptor()), this ); }; t.MPEG4DescriptorParser = d; var c = { ERR_INVALID_DATA: -1, ERR_NOT_ENOUGH_DATA: 0, OK: 1, BASIC_BOXES: ["mdat", "idat", "free", "skip", "meco", "strk"], FULL_BOXES: ["hmhd", "nmhd", "iods", "xml ", "bxml", "ipro", "mere"], CONTAINER_BOXES: [ ["moov", ["trak", "pssh"]], ["trak"], ["edts"], ["mdia"], ["minf"], ["dinf"], ["stbl", ["sgpd", "sbgp"]], ["mvex", ["trex"]], ["moof", ["traf"]], ["traf", ["trun", "sgpd", "sbgp"]], ["vttc"], ["tref"], ["iref"], ["mfra", ["tfra"]], ["meco"], ["hnti"], ["hinf"], ["strk"], ["strd"], ["sinf"], ["rinf"], ["schi"], ["trgr"], ["udta", ["kind"]], ["iprp", ["ipma"]], ["ipco"], ["grpl"], ["j2kH"], ["etyp", ["tyco"]] ], boxCodes: [], fullBoxCodes: [], containerBoxCodes: [], sampleEntryCodes: {}, sampleGroupEntryCodes: [], trackGroupTypes: [], UUIDBoxes: {}, UUIDs: [], initialize: function () { (c.FullBox.prototype = new c.Box()), (c.ContainerBox.prototype = new c.Box()), (c.SampleEntry.prototype = new c.Box()), (c.TrackGroupTypeBox.prototype = new c.FullBox()), c.BASIC_BOXES.forEach(function (t) { c.createBoxCtor(t); }), c.FULL_BOXES.forEach(function (t) { c.createFullBoxCtor(t); }), c.CONTAINER_BOXES.forEach(function (t) { c.createContainerBoxCtor(t[0], null, t[1]); }); }, Box: function (t, e, n) { (this.type = t), (this.size = e), (this.uuid = n); }, FullBox: function (t, e, n) { c.Box.call(this, t, e, n), (this.flags = 0), (this.version = 0); }, ContainerBox: function (t, e, n) { c.Box.call(this, t, e, n), (this.boxes = []); }, SampleEntry: function (t, e, n, i) { c.ContainerBox.call(this, t, e), (this.hdr_size = n), (this.start = i); }, SampleGroupEntry: function (t) { this.grouping_type = t; }, TrackGroupTypeBox: function (t, e) { c.FullBox.call(this, t, e); }, createBoxCtor: function (t, e) { c.boxCodes.push(t), (c[t + "Box"] = function (e) { c.Box.call(this, t, e); }), (c[t + "Box"].prototype = new c.Box()), e && (c[t + "Box"].prototype.parse = e); }, createFullBoxCtor: function (t, e) { (c[t + "Box"] = function (e) { c.FullBox.call(this, t, e); }), (c[t + "Box"].prototype = new c.FullBox()), (c[t + "Box"].prototype.parse = function (t) { this.parseFullHeader(t), e && e.call(this, t); }); }, addSubBoxArrays: function (t) { if (t) { this.subBoxNames = t; for (var e = t.length, n = 0; n < e; n++) this[t[n] + "s"] = []; } }, createContainerBoxCtor: function (t, e, n) { (c[t + "Box"] = function (e) { c.ContainerBox.call(this, t, e), c.addSubBoxArrays.call(this, n); }), (c[t + "Box"].prototype = new c.ContainerBox()), e && (c[t + "Box"].prototype.parse = e); }, createMediaSampleEntryCtor: function (t, e, n) { (c.sampleEntryCodes[t] = []), (c[t + "SampleEntry"] = function (t, e) { c.SampleEntry.call(this, t, e), c.addSubBoxArrays.call(this, n); }), (c[t + "SampleEntry"].prototype = new c.SampleEntry()), e && (c[t + "SampleEntry"].prototype.parse = e); }, createSampleEntryCtor: function (t, e, n, i) { c.sampleEntryCodes[t].push(e), (c[e + "SampleEntry"] = function (n) { c[t + "SampleEntry"].call(this, e, n), c.addSubBoxArrays.call(this, i); }), (c[e + "SampleEntry"].prototype = new c[t + "SampleEntry"]()), n && (c[e + "SampleEntry"].prototype.parse = n); }, createEncryptedSampleEntryCtor: function (t, e, n) { c.createSampleEntryCtor.call(this, t, e, n, ["sinf"]); }, createSampleGroupCtor: function (t, e) { (c[t + "SampleGroupEntry"] = function (e) { c.SampleGroupEntry.call(this, t, e); }), (c[t + "SampleGroupEntry"].prototype = new c.SampleGroupEntry()), e && (c[t + "SampleGroupEntry"].prototype.parse = e); }, createTrackGroupCtor: function (t, e) { (c[t + "TrackGroupTypeBox"] = function (e) { c.TrackGroupTypeBox.call(this, t, e); }), (c[t + "TrackGroupTypeBox"].prototype = new c.TrackGroupTypeBox()), e && (c[t + "TrackGroupTypeBox"].prototype.parse = e); }, createUUIDBox: function (t, e, n, i) { c.UUIDs.push(t), (c.UUIDBoxes[t] = function (i) { e ? c.FullBox.call(this, "uuid", i, t) : n ? c.ContainerBox.call(this, "uuid", i, t) : c.Box.call(this, "uuid", i, t); }), (c.UUIDBoxes[t].prototype = e ? new c.FullBox() : n ? new c.ContainerBox() : new c.Box()), i && (c.UUIDBoxes[t].prototype.parse = e ? function (t) { this.parseFullHeader(t), i && i.call(this, t); } : i); } }; c.initialize(), (c.TKHD_FLAG_ENABLED = 1), (c.TKHD_FLAG_IN_MOVIE = 2), (c.TKHD_FLAG_IN_PREVIEW = 4), (c.TFHD_FLAG_BASE_DATA_OFFSET = 1), (c.TFHD_FLAG_SAMPLE_DESC = 2), (c.TFHD_FLAG_SAMPLE_DUR = 8), (c.TFHD_FLAG_SAMPLE_SIZE = 16), (c.TFHD_FLAG_SAMPLE_FLAGS = 32), (c.TFHD_FLAG_DUR_EMPTY = 65536), (c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF = 131072), (c.TRUN_FLAGS_DATA_OFFSET = 1), (c.TRUN_FLAGS_FIRST_FLAG = 4), (c.TRUN_FLAGS_DURATION = 256), (c.TRUN_FLAGS_SIZE = 512), (c.TRUN_FLAGS_FLAGS = 1024), (c.TRUN_FLAGS_CTS_OFFSET = 2048), (c.Box.prototype.add = function (t) { return this.addBox(new c[t + "Box"]()); }), (c.Box.prototype.addBox = function (t) { return this.boxes.push(t), this[t.type + "s"] ? this[t.type + "s"].push(t) : (this[t.type] = t), t; }), (c.Box.prototype.set = function (t, e) { return (this[t] = e), this; }), (c.Box.prototype.addEntry = function (t, e) { var n = e || "entries"; return this[n] || (this[n] = []), this[n].push(t), this; }), (t.BoxParser = c), (c.parseUUID = function (t) { return c.parseHex16(t); }), (c.parseHex16 = function (t) { for (var e = "", n = 0; n < 16; n++) { var i = t.readUint8().toString(16); e += 1 === i.length ? "0" + i : i; } return e; }), (c.parseOneBox = function (t, e, n) { var i, a, s, o = t.getPosition(), l = 0; if (t.getEndPosition() - o < 8) return ( r.debug("BoxParser", "Not enough data in stream to parse the type and size of the box"), { code: c.ERR_NOT_ENOUGH_DATA } ); if (n && n < 8) return ( r.debug("BoxParser", "Not enough bytes left in the parent box to parse a new box"), { code: c.ERR_NOT_ENOUGH_DATA } ); var d = t.readUint32(), u = t.readString(4), h = u; if ( (r.debug("BoxParser", "Found box of type '" + u + "' and size " + d + " at position " + o), (l = 8), "uuid" == u) ) { if (t.getEndPosition() - t.getPosition() < 16 || n - l < 16) return ( t.seek(o), r.debug("BoxParser", "Not enough bytes left in the parent box to parse a UUID box"), { code: c.ERR_NOT_ENOUGH_DATA } ); (l += 16), (h = s = c.parseUUID(t)); } if (1 == d) { if (t.getEndPosition() - t.getPosition() < 8 || (n && n - l < 8)) return ( t.seek(o), r.warn("BoxParser", 'Not enough data in stream to parse the extended size of the "' + u + '" box'), { code: c.ERR_NOT_ENOUGH_DATA } ); (d = t.readUint64()), (l += 8); } else if (0 === d) if (n) d = n; else if ("mdat" !== u) return ( r.error("BoxParser", "Unlimited box size not supported for type: '" + u + "'"), (i = new c.Box(u, d)), { code: c.OK, box: i, size: i.size } ); return 0 !== d && d < l ? (r.error("BoxParser", "Box of type " + u + " has an invalid size " + d + " (too small to be a box)"), { code: c.ERR_NOT_ENOUGH_DATA, type: u, size: d, hdr_size: l, start: o }) : 0 !== d && n && d > n ? (r.error("BoxParser", "Box of type '" + u + "' has a size " + d + " greater than its container size " + n), { code: c.ERR_NOT_ENOUGH_DATA, type: u, size: d, hdr_size: l, start: o }) : 0 !== d && o + d > t.getEndPosition() ? (t.seek(o), r.info("BoxParser", "Not enough data in stream to parse the entire '" + u + "' box"), { code: c.ERR_NOT_ENOUGH_DATA, type: u, size: d, hdr_size: l, start: o }) : e ? { code: c.OK, type: u, size: d, hdr_size: l, start: o } : (c[u + "Box"] ? (i = new c[u + "Box"](d)) : "uuid" !== u ? (r.warn("BoxParser", "Unknown box type: '" + u + "'"), ((i = new c.Box(u, d)).has_unparsed_data = !0)) : c.UUIDBoxes[s] ? (i = new c.UUIDBoxes[s](d)) : (r.warn("BoxParser", "Unknown uuid type: '" + s + "'"), ((i = new c.Box(u, d)).uuid = s), (i.has_unparsed_data = !0)), (i.hdr_size = l), (i.start = o), i.write === c.Box.prototype.write && "mdat" !== i.type && (r.info( "BoxParser", "'" + h + "' box writing not yet implemented, keeping unparsed data in memory for later write" ), i.parseDataAndRewind(t)), i.parse(t), (a = t.getPosition() - (i.start + i.size)) < 0 ? (r.warn( "BoxParser", "Parsing of box '" + h + "' did not read the entire indicated box data size (missing " + -a + " bytes), seeking forward" ), t.seek(i.start + i.size)) : a > 0 && (r.error( "BoxParser", "Parsing of box '" + h + "' read " + a + " more bytes than the indicated box data size, seeking backwards" ), 0 !== i.size && t.seek(i.start + i.size)), { code: c.OK, box: i, size: i.size }); }), (c.Box.prototype.parse = function (t) { "mdat" != this.type ? (this.data = t.readUint8Array(this.size - this.hdr_size)) : 0 === this.size ? t.seek(t.getEndPosition()) : t.seek(this.start + this.size); }), (c.Box.prototype.parseDataAndRewind = function (t) { (this.data = t.readUint8Array(this.size - this.hdr_size)), (t.position -= this.size - this.hdr_size); }), (c.FullBox.prototype.parseDataAndRewind = function (t) { this.parseFullHeader(t), (this.data = t.readUint8Array(this.size - this.hdr_size)), (this.hdr_size -= 4), (t.position -= this.size - this.hdr_size); }), (c.FullBox.prototype.parseFullHeader = function (t) { (this.version = t.readUint8()), (this.flags = t.readUint24()), (this.hdr_size += 4); }), (c.FullBox.prototype.parse = function (t) { this.parseFullHeader(t), (this.data = t.readUint8Array(this.size - this.hdr_size)); }), (c.ContainerBox.prototype.parse = function (t) { for (var e, n; t.getPosition() < this.start + this.size;) { if ((e = c.parseOneBox(t, !1, this.size - (t.getPosition() - this.start))).code !== c.OK) return; if (((n = e.box), this.boxes.push(n), this.subBoxNames && -1 != this.subBoxNames.indexOf(n.type))) this[this.subBoxNames[this.subBoxNames.indexOf(n.type)] + "s"].push(n); else { var i = "uuid" !== n.type ? n.type : n.uuid; this[i] ? r.warn("Box of type " + i + " already stored in field of this type") : (this[i] = n); } } }), (c.Box.prototype.parseLanguage = function (t) { this.language = t.readUint16(); var e = []; (e[0] = (this.language >> 10) & 31), (e[1] = (this.language >> 5) & 31), (e[2] = 31 & this.language), (this.languageString = String.fromCharCode(e[0] + 96, e[1] + 96, e[2] + 96)); }), (c.SAMPLE_ENTRY_TYPE_VISUAL = "Visual"), (c.SAMPLE_ENTRY_TYPE_AUDIO = "Audio"), (c.SAMPLE_ENTRY_TYPE_HINT = "Hint"), (c.SAMPLE_ENTRY_TYPE_METADATA = "Metadata"), (c.SAMPLE_ENTRY_TYPE_SUBTITLE = "Subtitle"), (c.SAMPLE_ENTRY_TYPE_SYSTEM = "System"), (c.SAMPLE_ENTRY_TYPE_TEXT = "Text"), (c.SampleEntry.prototype.parseHeader = function (t) { t.readUint8Array(6), (this.data_reference_index = t.readUint16()), (this.hdr_size += 8); }), (c.SampleEntry.prototype.parse = function (t) { this.parseHeader(t), (this.data = t.readUint8Array(this.size - this.hdr_size)); }), (c.SampleEntry.prototype.parseDataAndRewind = function (t) { this.parseHeader(t), (this.data = t.readUint8Array(this.size - this.hdr_size)), (this.hdr_size -= 8), (t.position -= this.size - this.hdr_size); }), (c.SampleEntry.prototype.parseFooter = function (t) { c.ContainerBox.prototype.parse.call(this, t); }), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_HINT), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SYSTEM), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_TEXT), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, function (t) { var e; this.parseHeader(t), t.readUint16(), t.readUint16(), t.readUint32Array(3), (this.width = t.readUint16()), (this.height = t.readUint16()), (this.horizresolution = t.readUint32()), (this.vertresolution = t.readUint32()), t.readUint32(), (this.frame_count = t.readUint16()), (e = Math.min(31, t.readUint8())), (this.compressorname = t.readString(e)), e < 31 && t.readString(31 - e), (this.depth = t.readUint16()), t.readUint16(), this.parseFooter(t); }), c.createMediaSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, function (t) { this.parseHeader(t), t.readUint32Array(2), (this.channel_count = t.readUint16()), (this.samplesize = t.readUint16()), t.readUint16(), t.readUint16(), (this.samplerate = t.readUint32() / 65536), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "avc1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "avc2"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "avc3"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "avc4"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "av01"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "dav1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "hvc1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "hev1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "hvt1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "lhe1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "dvh1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "dvhe"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "vvc1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "vvi1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "vvs1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "vvcN"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "vp08"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "vp09"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "avs3"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "j2ki"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "mjp2"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "mjpg"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "uncv"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "mp4a"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "ac-3"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "ac-4"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "ec-3"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "Opus"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "mha1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "mha2"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "mhm1"), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "mhm2"), c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_VISUAL, "encv"), c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_AUDIO, "enca"), c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE, "encu"), c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SYSTEM, "encs"), c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_TEXT, "enct"), c.createEncryptedSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA, "encm"), c.createBoxCtor("a1lx", function (t) { var e = 16 * (1 + (1 & (1 & t.readUint8()))); this.layer_size = []; for (var n = 0; n < 3; n++) this.layer_size[n] = 16 == e ? t.readUint16() : t.readUint32(); }), c.createBoxCtor("a1op", function (t) { this.op_index = t.readUint8(); }), c.createFullBoxCtor("auxC", function (t) { this.aux_type = t.readCString(); var e = this.size - this.hdr_size - (this.aux_type.length + 1); this.aux_subtype = t.readUint8Array(e); }), c.createBoxCtor("av1C", function (t) { var e = t.readUint8(); if ((e >> 7) & !1) r.error("av1C marker problem"); else if (((this.version = 127 & e), 1 === this.version)) if ( ((e = t.readUint8()), (this.seq_profile = (e >> 5) & 7), (this.seq_level_idx_0 = 31 & e), (e = t.readUint8()), (this.seq_tier_0 = (e >> 7) & 1), (this.high_bitdepth = (e >> 6) & 1), (this.twelve_bit = (e >> 5) & 1), (this.monochrome = (e >> 4) & 1), (this.chroma_subsampling_x = (e >> 3) & 1), (this.chroma_subsampling_y = (e >> 2) & 1), (this.chroma_sample_position = 3 & e), (e = t.readUint8()), (this.reserved_1 = (e >> 5) & 7), 0 === this.reserved_1) ) { if ( ((this.initial_presentation_delay_present = (e >> 4) & 1), 1 === this.initial_presentation_delay_present) ) this.initial_presentation_delay_minus_one = 15 & e; else if (((this.reserved_2 = 15 & e), 0 !== this.reserved_2)) return void r.error("av1C reserved_2 parsing problem"); var n = this.size - this.hdr_size - 4; this.configOBUs = t.readUint8Array(n); } else r.error("av1C reserved_1 parsing problem"); else r.error("av1C version " + this.version + " not supported"); }), c.createBoxCtor("avcC", function (t) { var e, n; for ( this.configurationVersion = t.readUint8(), this.AVCProfileIndication = t.readUint8(), this.profile_compatibility = t.readUint8(), this.AVCLevelIndication = t.readUint8(), this.lengthSizeMinusOne = 3 & t.readUint8(), this.nb_SPS_nalus = 31 & t.readUint8(), n = this.size - this.hdr_size - 6, this.SPS = [], e = 0; e < this.nb_SPS_nalus; e++ ) (this.SPS[e] = {}), (this.SPS[e].length = t.readUint16()), (this.SPS[e].nalu = t.readUint8Array(this.SPS[e].length)), (n -= 2 + this.SPS[e].length); for (this.nb_PPS_nalus = t.readUint8(), n--, this.PPS = [], e = 0; e < this.nb_PPS_nalus; e++) (this.PPS[e] = {}), (this.PPS[e].length = t.readUint16()), (this.PPS[e].nalu = t.readUint8Array(this.PPS[e].length)), (n -= 2 + this.PPS[e].length); n > 0 && (this.ext = t.readUint8Array(n)); }), c.createBoxCtor("btrt", function (t) { (this.bufferSizeDB = t.readUint32()), (this.maxBitrate = t.readUint32()), (this.avgBitrate = t.readUint32()); }), c.createFullBoxCtor("ccst", function (t) { var e = t.readUint8(); (this.all_ref_pics_intra = !(128 & ~e)), (this.intra_pred_used = !(64 & ~e)), (this.max_ref_per_pic = (63 & e) >> 2), t.readUint24(); }), c.createBoxCtor("cdef", function (t) { var e; for ( this.channel_count = t.readUint16(), this.channel_indexes = [], this.channel_types = [], this.channel_associations = [], e = 0; e < this.channel_count; e++ ) this.channel_indexes.push(t.readUint16()), this.channel_types.push(t.readUint16()), this.channel_associations.push(t.readUint16()); }), c.createBoxCtor("clap", function (t) { (this.cleanApertureWidthN = t.readUint32()), (this.cleanApertureWidthD = t.readUint32()), (this.cleanApertureHeightN = t.readUint32()), (this.cleanApertureHeightD = t.readUint32()), (this.horizOffN = t.readUint32()), (this.horizOffD = t.readUint32()), (this.vertOffN = t.readUint32()), (this.vertOffD = t.readUint32()); }), c.createBoxCtor("clli", function (t) { (this.max_content_light_level = t.readUint16()), (this.max_pic_average_light_level = t.readUint16()); }), c.createFullBoxCtor("cmex", function (t) { 1 & this.flags && (this.pos_x = t.readInt32()), 2 & this.flags && (this.pos_y = t.readInt32()), 4 & this.flags && (this.pos_z = t.readInt32()), 8 & this.flags && (0 == this.version ? 16 & this.flags ? ((this.quat_x = t.readInt32()), (this.quat_y = t.readInt32()), (this.quat_z = t.readInt32())) : ((this.quat_x = t.readInt16()), (this.quat_y = t.readInt16()), (this.quat_z = t.readInt16())) : this.version), 32 & this.flags && (this.id = t.readUint32()); }), c.createFullBoxCtor("cmin", function (t) { (this.focal_length_x = t.readInt32()), (this.principal_point_x = t.readInt32()), (this.principal_point_y = t.readInt32()), 1 & this.flags && ((this.focal_length_y = t.readInt32()), (this.skew_factor = t.readInt32())); }), c.createBoxCtor("cmpd", function (t) { for ( this.component_count = t.readUint16(), this.component_types = [], this.component_type_urls = [], i = 0; i < this.component_count; i++ ) { var e = t.readUint16(); this.component_types.push(e), e >= 32768 && this.component_type_urls.push(t.readCString()); } }), c.createFullBoxCtor("co64", function (t) { var e, n; if (((e = t.readUint32()), (this.chunk_offsets = []), 0 === this.version)) for (n = 0; n < e; n++) this.chunk_offsets.push(t.readUint64()); }), c.createFullBoxCtor("CoLL", function (t) { (this.maxCLL = t.readUint16()), (this.maxFALL = t.readUint16()); }), c.createBoxCtor("colr", function (t) { if (((this.colour_type = t.readString(4)), "nclx" === this.colour_type)) { (this.colour_primaries = t.readUint16()), (this.transfer_characteristics = t.readUint16()), (this.matrix_coefficients = t.readUint16()); var e = t.readUint8(); this.full_range_flag = e >> 7; } else ("rICC" === this.colour_type || "prof" === this.colour_type) && (this.ICC_profile = t.readUint8Array(this.size - 4)); }), c.createFullBoxCtor("cprt", function (t) { this.parseLanguage(t), (this.notice = t.readCString()); }), c.createFullBoxCtor("cslg", function (t) { 0 === this.version && ((this.compositionToDTSShift = t.readInt32()), (this.leastDecodeToDisplayDelta = t.readInt32()), (this.greatestDecodeToDisplayDelta = t.readInt32()), (this.compositionStartTime = t.readInt32()), (this.compositionEndTime = t.readInt32())); }), c.createFullBoxCtor("ctts", function (t) { var e, n; if (((e = t.readUint32()), (this.sample_counts = []), (this.sample_offsets = []), 0 === this.version)) for (n = 0; n < e; n++) { this.sample_counts.push(t.readUint32()); var i = t.readInt32(); i < 0 && r.warn("BoxParser", "ctts box uses negative values without using version 1"), this.sample_offsets.push(i); } else if (1 == this.version) for (n = 0; n < e; n++) this.sample_counts.push(t.readUint32()), this.sample_offsets.push(t.readInt32()); }), c.createBoxCtor("dac3", function (t) { var e = t.readUint8(), n = t.readUint8(), i = t.readUint8(); (this.fscod = e >> 6), (this.bsid = (e >> 1) & 31), (this.bsmod = ((1 & e) << 2) | ((n >> 6) & 3)), (this.acmod = (n >> 3) & 7), (this.lfeon = (n >> 2) & 1), (this.bit_rate_code = (3 & n) | ((i >> 5) & 7)); }), c.createBoxCtor("dec3", function (t) { var e = t.readUint16(); (this.data_rate = e >> 3), (this.num_ind_sub = 7 & e), (this.ind_subs = []); for (var n = 0; n < this.num_ind_sub + 1; n++) { var i = {}; this.ind_subs.push(i); var r = t.readUint8(), a = t.readUint8(), s = t.readUint8(); (i.fscod = r >> 6), (i.bsid = (r >> 1) & 31), (i.bsmod = ((1 & r) << 4) | ((a >> 4) & 15)), (i.acmod = (a >> 1) & 7), (i.lfeon = 1 & a), (i.num_dep_sub = (s >> 1) & 15), i.num_dep_sub > 0 && (i.chan_loc = ((1 & s) << 8) | t.readUint8()); } }), c.createFullBoxCtor("dfLa", function (t) { var e = [], n = [ "STREAMINFO", "PADDING", "APPLICATION", "SEEKTABLE", "VORBIS_COMMENT", "CUESHEET", "PICTURE", "RESERVED" ]; for (this.parseFullHeader(t); ;) { var i = t.readUint8(), r = Math.min(127 & i, n.length - 1); if ( (r ? t.readUint8Array(t.readUint24()) : (t.readUint8Array(13), (this.samplerate = t.readUint32() >> 12), t.readUint8Array(20)), e.push(n[r]), 128 & i) ) break; } this.numMetadataBlocks = e.length + " (" + e.join(", ") + ")"; }), c.createBoxCtor("dimm", function (t) { this.bytessent = t.readUint64(); }), c.createBoxCtor("dmax", function (t) { this.time = t.readUint32(); }), c.createBoxCtor("dmed", function (t) { this.bytessent = t.readUint64(); }), c.createBoxCtor("dOps", function (t) { if ( ((this.Version = t.readUint8()), (this.OutputChannelCount = t.readUint8()), (this.PreSkip = t.readUint16()), (this.InputSampleRate = t.readUint32()), (this.OutputGain = t.readInt16()), (this.ChannelMappingFamily = t.readUint8()), 0 !== this.ChannelMappingFamily) ) { (this.StreamCount = t.readUint8()), (this.CoupledCount = t.readUint8()), (this.ChannelMapping = []); for (var e = 0; e < this.OutputChannelCount; e++) this.ChannelMapping[e] = t.readUint8(); } }), c.createFullBoxCtor("dref", function (t) { var e, n; this.entries = []; for (var i = t.readUint32(), r = 0; r < i; r++) { if ((e = c.parseOneBox(t, !1, this.size - (t.getPosition() - this.start))).code !== c.OK) return; (n = e.box), this.entries.push(n); } }), c.createBoxCtor("drep", function (t) { this.bytessent = t.readUint64(); }), c.createFullBoxCtor("elng", function (t) { this.extended_language = t.readString(this.size - this.hdr_size); }), c.createFullBoxCtor("elst", function (t) { this.entries = []; for (var e = t.readUint32(), n = 0; n < e; n++) { var i = {}; this.entries.push(i), 1 === this.version ? ((i.segment_duration = t.readUint64()), (i.media_time = t.readInt64())) : ((i.segment_duration = t.readUint32()), (i.media_time = t.readInt32())), (i.media_rate_integer = t.readInt16()), (i.media_rate_fraction = t.readInt16()); } }), c.createFullBoxCtor("emsg", function (t) { 1 == this.version ? ((this.timescale = t.readUint32()), (this.presentation_time = t.readUint64()), (this.event_duration = t.readUint32()), (this.id = t.readUint32()), (this.scheme_id_uri = t.readCString()), (this.value = t.readCString())) : ((this.scheme_id_uri = t.readCString()), (this.value = t.readCString()), (this.timescale = t.readUint32()), (this.presentation_time_delta = t.readUint32()), (this.event_duration = t.readUint32()), (this.id = t.readUint32())); var e = this.size - this.hdr_size - (16 + (this.scheme_id_uri.length + 1) + (this.value.length + 1)); 1 == this.version && (e -= 4), (this.message_data = t.readUint8Array(e)); }), (c.createEntityToGroupCtor = function (t, e) { (c[t + "Box"] = function (e) { c.FullBox.call(this, t, e); }), (c[t + "Box"].prototype = new c.FullBox()), (c[t + "Box"].prototype.parse = function (t) { if ((this.parseFullHeader(t), e)) e.call(this, t); else for ( this.group_id = t.readUint32(), this.num_entities_in_group = t.readUint32(), this.entity_ids = [], i = 0; i < this.num_entities_in_group; i++ ) { var n = t.readUint32(); this.entity_ids.push(n); } }); }), c.createEntityToGroupCtor("aebr"), c.createEntityToGroupCtor("afbr"), c.createEntityToGroupCtor("albc"), c.createEntityToGroupCtor("altr"), c.createEntityToGroupCtor("brst"), c.createEntityToGroupCtor("dobr"), c.createEntityToGroupCtor("eqiv"), c.createEntityToGroupCtor("favc"), c.createEntityToGroupCtor("fobr"), c.createEntityToGroupCtor("iaug"), c.createEntityToGroupCtor("pano"), c.createEntityToGroupCtor("slid"), c.createEntityToGroupCtor("ster"), c.createEntityToGroupCtor("tsyn"), c.createEntityToGroupCtor("wbbr"), c.createEntityToGroupCtor("prgr"), c.createFullBoxCtor("esds", function (t) { var e = t.readUint8Array(this.size - this.hdr_size); if (((this.data = e), void 0 !== d)) { var n = new d(); this.esd = n.parseOneDescriptor(new s(e.buffer, 0, s.BIG_ENDIAN)); } }), c.createBoxCtor("fiel", function (t) { (this.fieldCount = t.readUint8()), (this.fieldOrdering = t.readUint8()); }), c.createBoxCtor("frma", function (t) { this.data_format = t.readString(4); }), c.createBoxCtor("ftyp", function (t) { var e = this.size - this.hdr_size; (this.major_brand = t.readString(4)), (this.minor_version = t.readUint32()), (e -= 8), (this.compatible_brands = []); for (var n = 0; e >= 4;) (this.compatible_brands[n] = t.readString(4)), (e -= 4), n++; }), c.createFullBoxCtor("hdlr", function (t) { 0 === this.version && (t.readUint32(), (this.handler = t.readString(4)), t.readUint32Array(3), (this.name = t.readString(this.size - this.hdr_size - 20)), "\0" === this.name[this.name.length - 1] && (this.name = this.name.slice(0, -1))); }), c.createBoxCtor("hvcC", function (t) { var e, n, i, r; (this.configurationVersion = t.readUint8()), (r = t.readUint8()), (this.general_profile_space = r >> 6), (this.general_tier_flag = (32 & r) >> 5), (this.general_profile_idc = 31 & r), (this.general_profile_compatibility = t.readUint32()), (this.general_constraint_indicator = t.readUint8Array(6)), (this.general_level_idc = t.readUint8()), (this.min_spatial_segmentation_idc = 4095 & t.readUint16()), (this.parallelismType = 3 & t.readUint8()), (this.chroma_format_idc = 3 & t.readUint8()), (this.bit_depth_luma_minus8 = 7 & t.readUint8()), (this.bit_depth_chroma_minus8 = 7 & t.readUint8()), (this.avgFrameRate = t.readUint16()), (r = t.readUint8()), (this.constantFrameRate = r >> 6), (this.numTemporalLayers = (13 & r) >> 3), (this.temporalIdNested = (4 & r) >> 2), (this.lengthSizeMinusOne = 3 & r), (this.nalu_arrays = []); var a = t.readUint8(); for (e = 0; e < a; e++) { var s = []; this.nalu_arrays.push(s), (r = t.readUint8()), (s.completeness = (128 & r) >> 7), (s.nalu_type = 63 & r); var o = t.readUint16(); for (n = 0; n < o; n++) { var l = {}; s.push(l), (i = t.readUint16()), (l.data = t.readUint8Array(i)); } } }), c.createFullBoxCtor("iinf", function (t) { var e; 0 === this.version ? (this.entry_count = t.readUint16()) : (this.entry_count = t.readUint32()), (this.item_infos = []); for (var n = 0; n < this.entry_count; n++) { if ((e = c.parseOneBox(t, !1, this.size - (t.getPosition() - this.start))).code !== c.OK) return; "infe" !== e.box.type && r.error("BoxParser", "Expected 'infe' box, got " + e.box.type), (this.item_infos[n] = e.box); } }), c.createFullBoxCtor("iloc", function (t) { var e; (e = t.readUint8()), (this.offset_size = (e >> 4) & 15), (this.length_size = 15 & e), (e = t.readUint8()), (this.base_offset_size = (e >> 4) & 15), 1 === this.version || 2 === this.version ? (this.index_size = 15 & e) : (this.index_size = 0), (this.items = []); var n = 0; if (this.version < 2) n = t.readUint16(); else { if (2 !== this.version) throw "version of iloc box not supported"; n = t.readUint32(); } for (var i = 0; i < n; i++) { var r = {}; if ((this.items.push(r), this.version < 2)) r.item_ID = t.readUint16(); else { if (2 !== this.version) throw "version of iloc box not supported"; r.item_ID = t.readUint16(); } switch ( (1 === this.version || 2 === this.version ? (r.construction_method = 15 & t.readUint16()) : (r.construction_method = 0), (r.data_reference_index = t.readUint16()), this.base_offset_size) ) { case 0: r.base_offset = 0; break; case 4: r.base_offset = t.readUint32(); break; case 8: r.base_offset = t.readUint64(); break; default: throw "Error reading base offset size"; } var a = t.readUint16(); r.extents = []; for (var s = 0; s < a; s++) { var o = {}; if ((r.extents.push(o), 1 === this.version || 2 === this.version)) switch (this.index_size) { case 0: o.extent_index = 0; break; case 4: o.extent_index = t.readUint32(); break; case 8: o.extent_index = t.readUint64(); break; default: throw "Error reading extent index"; } switch (this.offset_size) { case 0: o.extent_offset = 0; break; case 4: o.extent_offset = t.readUint32(); break; case 8: o.extent_offset = t.readUint64(); break; default: throw "Error reading extent index"; } switch (this.length_size) { case 0: o.extent_length = 0; break; case 4: o.extent_length = t.readUint32(); break; case 8: o.extent_length = t.readUint64(); break; default: throw "Error reading extent index"; } } } }), c.createBoxCtor("imir", function (t) { var e = t.readUint8(); (this.reserved = e >> 7), (this.axis = 1 & e); }), c.createFullBoxCtor("infe", function (t) { if ( ((0 !== this.version && 1 !== this.version) || ((this.item_ID = t.readUint16()), (this.item_protection_index = t.readUint16()), (this.item_name = t.readCString()), (this.content_type = t.readCString()), (this.content_encoding = t.readCString())), 1 === this.version) ) return ( (this.extension_type = t.readString(4)), r.warn("BoxParser", "Cannot parse extension type"), void t.seek(this.start + this.size) ); this.version >= 2 && (2 === this.version ? (this.item_ID = t.readUint16()) : 3 === this.version && (this.item_ID = t.readUint32()), (this.item_protection_index = t.readUint16()), (this.item_type = t.readString(4)), (this.item_name = t.readCString()), "mime" === this.item_type ? ((this.content_type = t.readCString()), (this.content_encoding = t.readCString())) : "uri " === this.item_type && (this.item_uri_type = t.readCString())); }), c.createFullBoxCtor("ipma", function (t) { var e, n; for (entry_count = t.readUint32(), this.associations = [], e = 0; e < entry_count; e++) { var i = {}; this.associations.push(i), this.version < 1 ? (i.id = t.readUint16()) : (i.id = t.readUint32()); var r = t.readUint8(); for (i.props = [], n = 0; n < r; n++) { var a = t.readUint8(), s = {}; i.props.push(s), (s.essential = (128 & a) >> 7 == 1), 1 & this.flags ? (s.property_index = ((127 & a) << 8) | t.readUint8()) : (s.property_index = 127 & a); } } }), c.createFullBoxCtor("iref", function (t) { var e, n; for (this.references = []; t.getPosition() < this.start + this.size;) { if ((e = c.parseOneBox(t, !0, this.size - (t.getPosition() - this.start))).code !== c.OK) return; (n = 0 === this.version ? new c.SingleItemTypeReferenceBox(e.type, e.size, e.hdr_size, e.start) : new c.SingleItemTypeReferenceBoxLarge(e.type, e.size, e.hdr_size, e.start)).write === c.Box.prototype.write && "mdat" !== n.type && (r.warn( "BoxParser", n.type + " box writing not yet implemented, keeping unparsed data in memory for later write" ), n.parseDataAndRewind(t)), n.parse(t), this.references.push(n); } }), c.createBoxCtor("irot", function (t) { this.angle = 3 & t.readUint8(); }), c.createFullBoxCtor("ispe", function (t) { (this.image_width = t.readUint32()), (this.image_height = t.readUint32()); }), c.createFullBoxCtor("kind", function (t) { (this.schemeURI = t.readCString()), (this.value = t.readCString()); }), c.createFullBoxCtor("leva", function (t) { var e = t.readUint8(); this.levels = []; for (var n = 0; n < e; n++) { var i = {}; (this.levels[n] = i), (i.track_ID = t.readUint32()); var a = t.readUint8(); switch (((i.padding_flag = a >> 7), (i.assignment_type = 127 & a), i.assignment_type)) { case 0: i.grouping_type = t.readString(4); break; case 1: (i.grouping_type = t.readString(4)), (i.grouping_type_parameter = t.readUint32()); break; case 2: case 3: break; case 4: i.sub_track_id = t.readUint32(); break; default: r.warn("BoxParser", "Unknown leva assignement type"); } } }), c.createBoxCtor("lsel", function (t) { this.layer_id = t.readUint16(); }), c.createBoxCtor("maxr", function (t) { (this.period = t.readUint32()), (this.bytes = t.readUint32()); }), c.createBoxCtor("mdcv", function (t) { (this.display_primaries = []), (this.display_primaries[0] = {}), (this.display_primaries[0].x = t.readUint16()), (this.display_primaries[0].y = t.readUint16()), (this.display_primaries[1] = {}), (this.display_primaries[1].x = t.readUint16()), (this.display_primaries[1].y = t.readUint16()), (this.display_primaries[2] = {}), (this.display_primaries[2].x = t.readUint16()), (this.display_primaries[2].y = t.readUint16()), (this.white_point = {}), (this.white_point.x = t.readUint16()), (this.white_point.y = t.readUint16()), (this.max_display_mastering_luminance = t.readUint32()), (this.min_display_mastering_luminance = t.readUint32()); }), c.createFullBoxCtor("mdhd", function (t) { 1 == this.version ? ((this.creation_time = t.readUint64()), (this.modification_time = t.readUint64()), (this.timescale = t.readUint32()), (this.duration = t.readUint64())) : ((this.creation_time = t.readUint32()), (this.modification_time = t.readUint32()), (this.timescale = t.readUint32()), (this.duration = t.readUint32())), this.parseLanguage(t), t.readUint16(); }), c.createFullBoxCtor("mehd", function (t) { 1 & this.flags && (r.warn("BoxParser", "mehd box incorrectly uses flags set to 1, converting version to 1"), (this.version = 1)), 1 == this.version ? (this.fragment_duration = t.readUint64()) : (this.fragment_duration = t.readUint32()); }), c.createFullBoxCtor("meta", function (t) { (this.boxes = []), c.ContainerBox.prototype.parse.call(this, t); }), c.createFullBoxCtor("mfhd", function (t) { this.sequence_number = t.readUint32(); }), c.createFullBoxCtor("mfro", function (t) { this._size = t.readUint32(); }), c.createFullBoxCtor("mvhd", function (t) { 1 == this.version ? ((this.creation_time = t.readUint64()), (this.modification_time = t.readUint64()), (this.timescale = t.readUint32()), (this.duration = t.readUint64())) : ((this.creation_time = t.readUint32()), (this.modification_time = t.readUint32()), (this.timescale = t.readUint32()), (this.duration = t.readUint32())), (this.rate = t.readUint32()), (this.volume = t.readUint16() >> 8), t.readUint16(), t.readUint32Array(2), (this.matrix = t.readUint32Array(9)), t.readUint32Array(6), (this.next_track_id = t.readUint32()); }), c.createBoxCtor("npck", function (t) { this.packetssent = t.readUint32(); }), c.createBoxCtor("nump", function (t) { this.packetssent = t.readUint64(); }), c.createFullBoxCtor("padb", function (t) { var e = t.readUint32(); this.padbits = []; for (var n = 0; n < Math.floor((e + 1) / 2); n++) this.padbits = t.readUint8(); }), c.createBoxCtor("pasp", function (t) { (this.hSpacing = t.readUint32()), (this.vSpacing = t.readUint32()); }), c.createBoxCtor("payl", function (t) { this.text = t.readString(this.size - this.hdr_size); }), c.createBoxCtor("payt", function (t) { this.payloadID = t.readUint32(); var e = t.readUint8(); this.rtpmap_string = t.readString(e); }), c.createFullBoxCtor("pdin", function (t) { var e = (this.size - this.hdr_size) / 8; (this.rate = []), (this.initial_delay = []); for (var n = 0; n < e; n++) (this.rate[n] = t.readUint32()), (this.initial_delay[n] = t.readUint32()); }), c.createFullBoxCtor("pitm", function (t) { 0 === this.version ? (this.item_id = t.readUint16()) : (this.item_id = t.readUint32()); }), c.createFullBoxCtor("pixi", function (t) { var e; for (this.num_channels = t.readUint8(), this.bits_per_channels = [], e = 0; e < this.num_channels; e++) this.bits_per_channels[e] = t.readUint8(); }), c.createBoxCtor("pmax", function (t) { this.bytes = t.readUint32(); }), c.createFullBoxCtor("prdi", function (t) { if (((this.step_count = t.readUint16()), (this.item_count = []), 2 & this.flags)) for (var e = 0; e < this.step_count; e++) this.item_count[e] = t.readUint16(); }), c.createFullBoxCtor("prft", function (t) { (this.ref_track_id = t.readUint32()), (this.ntp_timestamp = t.readUint64()), 0 === this.version ? (this.media_time = t.readUint32()) : (this.media_time = t.readUint64()); }), c.createFullBoxCtor("pssh", function (t) { if (((this.system_id = c.parseHex16(t)), this.version > 0)) { var e = t.readUint32(); this.kid = []; for (var n = 0; n < e; n++) this.kid[n] = c.parseHex16(t); } var i = t.readUint32(); i > 0 && (this.data = t.readUint8Array(i)); }), c.createFullBoxCtor("clef", function (t) { (this.width = t.readUint32()), (this.height = t.readUint32()); }), c.createFullBoxCtor("enof", function (t) { (this.width = t.readUint32()), (this.height = t.readUint32()); }), c.createFullBoxCtor("prof", function (t) { (this.width = t.readUint32()), (this.height = t.readUint32()); }), c.createContainerBoxCtor("tapt", null, ["clef", "prof", "enof"]), c.createBoxCtor("rtp ", function (t) { (this.descriptionformat = t.readString(4)), (this.sdptext = t.readString(this.size - this.hdr_size - 4)); }), c.createFullBoxCtor("saio", function (t) { 1 & this.flags && ((this.aux_info_type = t.readUint32()), (this.aux_info_type_parameter = t.readUint32())); var e = t.readUint32(); this.offset = []; for (var n = 0; n < e; n++) 0 === this.version ? (this.offset[n] = t.readUint32()) : (this.offset[n] = t.readUint64()); }), c.createFullBoxCtor("saiz", function (t) { 1 & this.flags && ((this.aux_info_type = t.readUint32()), (this.aux_info_type_parameter = t.readUint32())), (this.default_sample_info_size = t.readUint8()); var e = t.readUint32(); if (((this.sample_info_size = []), 0 === this.default_sample_info_size)) for (var n = 0; n < e; n++) this.sample_info_size[n] = t.readUint8(); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA, "mett", function (t) { this.parseHeader(t), (this.content_encoding = t.readCString()), (this.mime_format = t.readCString()), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA, "metx", function (t) { this.parseHeader(t), (this.content_encoding = t.readCString()), (this.namespace = t.readCString()), (this.schema_location = t.readCString()), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE, "sbtt", function (t) { this.parseHeader(t), (this.content_encoding = t.readCString()), (this.mime_format = t.readCString()), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE, "stpp", function (t) { this.parseHeader(t), (this.namespace = t.readCString()), (this.schema_location = t.readCString()), (this.auxiliary_mime_types = t.readCString()), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE, "stxt", function (t) { this.parseHeader(t), (this.content_encoding = t.readCString()), (this.mime_format = t.readCString()), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_SUBTITLE, "tx3g", function (t) { this.parseHeader(t), (this.displayFlags = t.readUint32()), (this.horizontal_justification = t.readInt8()), (this.vertical_justification = t.readInt8()), (this.bg_color_rgba = t.readUint8Array(4)), (this.box_record = t.readInt16Array(4)), (this.style_record = t.readUint8Array(12)), this.parseFooter(t); }), c.createSampleEntryCtor(c.SAMPLE_ENTRY_TYPE_METADATA, "wvtt", function (t) { this.parseHeader(t), this.parseFooter(t); }), c.createSampleGroupCtor("alst", function (t) { var e, n = t.readUint16(); for (this.first_output_sample = t.readUint16(), this.sample_offset = [], e = 0; e < n; e++) this.sample_offset[e] = t.readUint32(); var i = this.description_length - 4 - 4 * n; for (this.num_output_samples = [], this.num_total_samples = [], e = 0; e < i / 4; e++) (this.num_output_samples[e] = t.readUint16()), (this.num_total_samples[e] = t.readUint16()); }), c.createSampleGroupCtor("avll", function (t) { (this.layerNumber = t.readUint8()), (this.accurateStatisticsFlag = t.readUint8()), (this.avgBitRate = t.readUint16()), (this.avgFrameRate = t.readUint16()); }), c.createSampleGroupCtor("avss", function (t) { (this.subSequenceIdentifier = t.readUint16()), (this.layerNumber = t.readUint8()); var e = t.readUint8(); (this.durationFlag = e >> 7), (this.avgRateFlag = (e >> 6) & 1), this.durationFlag && (this.duration = t.readUint32()), this.avgRateFlag && ((this.accurateStatisticsFlag = t.readUint8()), (this.avgBitRate = t.readUint16()), (this.avgFrameRate = t.readUint16())), (this.dependency = []); for (var n = t.readUint8(), i = 0; i < n; i++) { var r = {}; this.dependency.push(r), (r.subSeqDirectionFlag = t.readUint8()), (r.layerNumber = t.readUint8()), (r.subSequenceIdentifier = t.readUint16()); } }), c.createSampleGroupCtor("dtrt", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("mvif", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("prol", function (t) { this.roll_distance = t.readInt16(); }), c.createSampleGroupCtor("rap ", function (t) { var e = t.readUint8(); (this.num_leading_samples_known = e >> 7), (this.num_leading_samples = 127 & e); }), c.createSampleGroupCtor("rash", function (t) { if ( ((this.operation_point_count = t.readUint16()), this.description_length !== 2 + (1 === this.operation_point_count ? 2 : 6 * this.operation_point_count) + 9) ) r.warn("BoxParser", "Mismatch in " + this.grouping_type + " sample group length"), (this.data = t.readUint8Array(this.description_length - 2)); else { if (1 === this.operation_point_count) this.target_rate_share = t.readUint16(); else { (this.target_rate_share = []), (this.available_bitrate = []); for (var e = 0; e < this.operation_point_count; e++) (this.available_bitrate[e] = t.readUint32()), (this.target_rate_share[e] = t.readUint16()); } (this.maximum_bitrate = t.readUint32()), (this.minimum_bitrate = t.readUint32()), (this.discard_priority = t.readUint8()); } }), c.createSampleGroupCtor("roll", function (t) { this.roll_distance = t.readInt16(); }), (c.SampleGroupEntry.prototype.parse = function (t) { r.warn("BoxParser", "Unknown Sample Group type: " + this.grouping_type), (this.data = t.readUint8Array(this.description_length)); }), c.createSampleGroupCtor("scif", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("scnm", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("seig", function (t) { this.reserved = t.readUint8(); var e = t.readUint8(); (this.crypt_byte_block = e >> 4), (this.skip_byte_block = 15 & e), (this.isProtected = t.readUint8()), (this.Per_Sample_IV_Size = t.readUint8()), (this.KID = c.parseHex16(t)), (this.constant_IV_size = 0), (this.constant_IV = 0), 1 === this.isProtected && 0 === this.Per_Sample_IV_Size && ((this.constant_IV_size = t.readUint8()), (this.constant_IV = t.readUint8Array(this.constant_IV_size))); }), c.createSampleGroupCtor("stsa", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("sync", function (t) { var e = t.readUint8(); this.NAL_unit_type = 63 & e; }), c.createSampleGroupCtor("tele", function (t) { var e = t.readUint8(); this.level_independently_decodable = e >> 7; }), c.createSampleGroupCtor("tsas", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("tscl", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createSampleGroupCtor("vipr", function (t) { r.warn("BoxParser", "Sample Group type: " + this.grouping_type + " not fully parsed"); }), c.createFullBoxCtor("sbgp", function (t) { (this.grouping_type = t.readString(4)), 1 === this.version ? (this.grouping_type_parameter = t.readUint32()) : (this.grouping_type_parameter = 0), (this.entries = []); for (var e = t.readUint32(), n = 0; n < e; n++) { var i = {}; this.entries.push(i), (i.sample_count = t.readInt32()), (i.group_description_index = t.readInt32()); } }), c.createFullBoxCtor("schm", function (t) { (this.scheme_type = t.readString(4)), (this.scheme_version = t.readUint32()), 1 & this.flags && (this.scheme_uri = t.readString(this.size - this.hdr_size - 8)); }), c.createBoxCtor("sdp ", function (t) { this.sdptext = t.readString(this.size - this.hdr_size); }), c.createFullBoxCtor("sdtp", function (t) { var e, n = this.size - this.hdr_size; (this.is_leading = []), (this.sample_depends_on = []), (this.sample_is_depended_on = []), (this.sample_has_redundancy = []); for (var i = 0; i < n; i++) (e = t.readUint8()), (this.is_leading[i] = e >> 6), (this.sample_depends_on[i] = (e >> 4) & 3), (this.sample_is_depended_on[i] = (e >> 2) & 3), (this.sample_has_redundancy[i] = 3 & e); }), c.createFullBoxCtor("senc"), c.createFullBoxCtor("sgpd", function (t) { (this.grouping_type = t.readString(4)), r.debug("BoxParser", "Found Sample Groups of type " + this.grouping_type), 1 === this.version ? (this.default_length = t.readUint32()) : (this.default_length = 0), this.version >= 2 && (this.default_group_description_index = t.readUint32()), (this.entries = []); for (var e = t.readUint32(), n = 0; n < e; n++) { var i; (i = c[this.grouping_type + "SampleGroupEntry"] ? new c[this.grouping_type + "SampleGroupEntry"](this.grouping_type) : new c.SampleGroupEntry(this.grouping_type)), this.entries.push(i), 1 === this.version && 0 === this.default_length ? (i.description_length = t.readUint32()) : (i.description_length = this.default_length), i.write === c.SampleGroupEntry.prototype.write && (r.info( "BoxParser", "SampleGroup for type " + this.grouping_type + " writing not yet implemented, keeping unparsed data in memory for later write" ), (i.data = t.readUint8Array(i.description_length)), (t.position -= i.description_length)), i.parse(t); } }), c.createFullBoxCtor("sidx", function (t) { (this.reference_ID = t.readUint32()), (this.timescale = t.readUint32()), 0 === this.version ? ((this.earliest_presentation_time = t.readUint32()), (this.first_offset = t.readUint32())) : ((this.earliest_presentation_time = t.readUint64()), (this.first_offset = t.readUint64())), t.readUint16(), (this.references = []); for (var e = t.readUint16(), n = 0; n < e; n++) { var i = {}; this.references.push(i); var r = t.readUint32(); (i.reference_type = (r >> 31) & 1), (i.referenced_size = 2147483647 & r), (i.subsegment_duration = t.readUint32()), (r = t.readUint32()), (i.starts_with_SAP = (r >> 31) & 1), (i.SAP_type = (r >> 28) & 7), (i.SAP_delta_time = 268435455 & r); } }), (c.SingleItemTypeReferenceBox = function (t, e, n, i) { c.Box.call(this, t, e), (this.hdr_size = n), (this.start = i); }), (c.SingleItemTypeReferenceBox.prototype = new c.Box()), (c.SingleItemTypeReferenceBox.prototype.parse = function (t) { this.from_item_ID = t.readUint16(); var e = t.readUint16(); this.references = []; for (var n = 0; n < e; n++) (this.references[n] = {}), (this.references[n].to_item_ID = t.readUint16()); }), (c.SingleItemTypeReferenceBoxLarge = function (t, e, n, i) { c.Box.call(this, t, e), (this.hdr_size = n), (this.start = i); }), (c.SingleItemTypeReferenceBoxLarge.prototype = new c.Box()), (c.SingleItemTypeReferenceBoxLarge.prototype.parse = function (t) { this.from_item_ID = t.readUint32(); var e = t.readUint16(); this.references = []; for (var n = 0; n < e; n++) (this.references[n] = {}), (this.references[n].to_item_ID = t.readUint32()); }), c.createFullBoxCtor("SmDm", function (t) { (this.primaryRChromaticity_x = t.readUint16()), (this.primaryRChromaticity_y = t.readUint16()), (this.primaryGChromaticity_x = t.readUint16()), (this.primaryGChromaticity_y = t.readUint16()), (this.primaryBChromaticity_x = t.readUint16()), (this.primaryBChromaticity_y = t.readUint16()), (this.whitePointChromaticity_x = t.readUint16()), (this.whitePointChromaticity_y = t.readUint16()), (this.luminanceMax = t.readUint32()), (this.luminanceMin = t.readUint32()); }), c.createFullBoxCtor("smhd", function (t) { (this.balance = t.readUint16()), t.readUint16(); }), c.createFullBoxCtor("ssix", function (t) { this.subsegments = []; for (var e = t.readUint32(), n = 0; n < e; n++) { var i = {}; this.subsegments.push(i), (i.ranges = []); for (var r = t.readUint32(), a = 0; a < r; a++) { var s = {}; i.ranges.push(s), (s.level = t.readUint8()), (s.range_size = t.readUint24()); } } }), c.createFullBoxCtor("stco", function (t) { var e; if (((e = t.readUint32()), (this.chunk_offsets = []), 0 === this.version)) for (var n = 0; n < e; n++) this.chunk_offsets.push(t.readUint32()); }), c.createFullBoxCtor("stdp", function (t) { var e = (this.size - this.hdr_size) / 2; this.priority = []; for (var n = 0; n < e; n++) this.priority[n] = t.readUint16(); }), c.createFullBoxCtor("sthd"), c.createFullBoxCtor("stri", function (t) { (this.switch_group = t.readUint16()), (this.alternate_group = t.readUint16()), (this.sub_track_id = t.readUint32()); var e = (this.size - this.hdr_size - 8) / 4; this.attribute_list = []; for (var n = 0; n < e; n++) this.attribute_list[n] = t.readUint32(); }), c.createFullBoxCtor("stsc", function (t) { var e, n; if ( ((e = t.readUint32()), (this.first_chunk = []), (this.samples_per_chunk = []), (this.sample_description_index = []), 0 === this.version) ) for (n = 0; n < e; n++) this.first_chunk.push(t.readUint32()), this.samples_per_chunk.push(t.readUint32()), this.sample_description_index.push(t.readUint32()); }), c.createFullBoxCtor("stsd", function (t) { var e, n, i, a; for (this.entries = [], i = t.readUint32(), e = 1; e <= i; e++) { if ((n = c.parseOneBox(t, !0, this.size - (t.getPosition() - this.start))).code !== c.OK) return; c[n.type + "SampleEntry"] ? (((a = new c[n.type + "SampleEntry"](n.size)).hdr_size = n.hdr_size), (a.start = n.start)) : (r.warn("BoxParser", "Unknown sample entry type: " + n.type), (a = new c.SampleEntry(n.type, n.size, n.hdr_size, n.start))), a.write === c.SampleEntry.prototype.write && (r.info( "BoxParser", "SampleEntry " + a.type + " box writing not yet implemented, keeping unparsed data in memory for later write" ), a.parseDataAndRewind(t)), a.parse(t), this.entries.push(a); } }), c.createFullBoxCtor("stsg", function (t) { this.grouping_type = t.readUint32(); var e = t.readUint16(); this.group_description_index = []; for (var n = 0; n < e; n++) this.group_description_index[n] = t.readUint32(); }), c.createFullBoxCtor("stsh", function (t) { var e, n; if ( ((e = t.readUint32()), (this.shadowed_sample_numbers = []), (this.sync_sample_numbers = []), 0 === this.version) ) for (n = 0; n < e; n++) this.shadowed_sample_numbers.push(t.readUint32()), this.sync_sample_numbers.push(t.readUint32()); }), c.createFullBoxCtor("stss", function (t) { var e, n; if (((n = t.readUint32()), 0 === this.version)) for (this.sample_numbers = [], e = 0; e < n; e++) this.sample_numbers.push(t.readUint32()); }), c.createFullBoxCtor("stsz", function (t) { var e; if (((this.sample_sizes = []), 0 === this.version)) for (this.sample_size = t.readUint32(), this.sample_count = t.readUint32(), e = 0; e < this.sample_count; e++) 0 === this.sample_size ? this.sample_sizes.push(t.readUint32()) : (this.sample_sizes[e] = this.sample_size); }), c.createFullBoxCtor("stts", function (t) { var e, n, i; if (((e = t.readUint32()), (this.sample_counts = []), (this.sample_deltas = []), 0 === this.version)) for (n = 0; n < e; n++) this.sample_counts.push(t.readUint32()), (i = t.readInt32()) < 0 && (r.warn( "BoxParser", "File uses negative stts sample delta, using value 1 instead, sync may be lost!" ), (i = 1)), this.sample_deltas.push(i); }), c.createFullBoxCtor("stvi", function (t) { var e = t.readUint32(); (this.single_view_allowed = 3 & e), (this.stereo_scheme = t.readUint32()); var n, i, r = t.readUint32(); for (this.stereo_indication_type = t.readString(r), this.boxes = []; t.getPosition() < this.start + this.size;) { if ((n = c.parseOneBox(t, !1, this.size - (t.getPosition() - this.start))).code !== c.OK) return; (i = n.box), this.boxes.push(i), (this[i.type] = i); } }), c.createBoxCtor("styp", function (t) { c.ftypBox.prototype.parse.call(this, t); }), c.createFullBoxCtor("stz2", function (t) { var e, n; if (((this.sample_sizes = []), 0 === this.version)) if ( ((this.reserved = t.readUint24()), (this.field_size = t.readUint8()), (n = t.readUint32()), 4 === this.field_size) ) for (e = 0; e < n; e += 2) { var i = t.readUint8(); (this.sample_sizes[e] = (i >> 4) & 15), (this.sample_sizes[e + 1] = 15 & i); } else if (8 === this.field_size) for (e = 0; e < n; e++) this.sample_sizes[e] = t.readUint8(); else if (16 === this.field_size) for (e = 0; e < n; e++) this.sample_sizes[e] = t.readUint16(); else r.error("BoxParser", "Error in length field in stz2 box"); }), c.createFullBoxCtor("subs", function (t) { var e, n, i, r; for (i = t.readUint32(), this.entries = [], e = 0; e < i; e++) { var a = {}; if (((this.entries[e] = a), (a.sample_delta = t.readUint32()), (a.subsamples = []), (r = t.readUint16()) > 0)) for (n = 0; n < r; n++) { var s = {}; a.subsamples.push(s), 1 == this.version ? (s.size = t.readUint32()) : (s.size = t.readUint16()), (s.priority = t.readUint8()), (s.discardable = t.readUint8()), (s.codec_specific_parameters = t.readUint32()); } } }), c.createFullBoxCtor("tenc", function (t) { if ((t.readUint8(), 0 === this.version)) t.readUint8(); else { var e = t.readUint8(); (this.default_crypt_byte_block = (e >> 4) & 15), (this.default_skip_byte_block = 15 & e); } (this.default_isProtected = t.readUint8()), (this.default_Per_Sample_IV_Size = t.readUint8()), (this.default_KID = c.parseHex16(t)), 1 === this.default_isProtected && 0 === this.default_Per_Sample_IV_Size && ((this.default_constant_IV_size = t.readUint8()), (this.default_constant_IV = t.readUint8Array(this.default_constant_IV_size))); }), c.createFullBoxCtor("tfdt", function (t) { 1 == this.version ? (this.baseMediaDecodeTime = t.readUint64()) : (this.baseMediaDecodeTime = t.readUint32()); }), c.createFullBoxCtor("tfhd", function (t) { var e = 0; (this.track_id = t.readUint32()), this.size - this.hdr_size > e && this.flags & c.TFHD_FLAG_BASE_DATA_OFFSET ? ((this.base_data_offset = t.readUint64()), (e += 8)) : (this.base_data_offset = 0), this.size - this.hdr_size > e && this.flags & c.TFHD_FLAG_SAMPLE_DESC ? ((this.default_sample_description_index = t.readUint32()), (e += 4)) : (this.default_sample_description_index = 0), this.size - this.hdr_size > e && this.flags & c.TFHD_FLAG_SAMPLE_DUR ? ((this.default_sample_duration = t.readUint32()), (e += 4)) : (this.default_sample_duration = 0), this.size - this.hdr_size > e && this.flags & c.TFHD_FLAG_SAMPLE_SIZE ? ((this.default_sample_size = t.readUint32()), (e += 4)) : (this.default_sample_size = 0), this.size - this.hdr_size > e && this.flags & c.TFHD_FLAG_SAMPLE_FLAGS ? ((this.default_sample_flags = t.readUint32()), (e += 4)) : (this.default_sample_flags = 0); }), c.createFullBoxCtor("tfra", function (t) { (this.track_ID = t.readUint32()), t.readUint24(); var e = t.readUint8(); (this.length_size_of_traf_num = (e >> 4) & 3), (this.length_size_of_trun_num = (e >> 2) & 3), (this.length_size_of_sample_num = 3 & e), (this.entries = []); for (var n = t.readUint32(), i = 0; i < n; i++) 1 === this.version ? ((this.time = t.readUint64()), (this.moof_offset = t.readUint64())) : ((this.time = t.readUint32()), (this.moof_offset = t.readUint32())), (this.traf_number = t["readUint" + 8 * (this.length_size_of_traf_num + 1)]()), (this.trun_number = t["readUint" + 8 * (this.length_size_of_trun_num + 1)]()), (this.sample_number = t["readUint" + 8 * (this.length_size_of_sample_num + 1)]()); }), c.createFullBoxCtor("tkhd", function (t) { 1 == this.version ? ((this.creation_time = t.readUint64()), (this.modification_time = t.readUint64()), (this.track_id = t.readUint32()), t.readUint32(), (this.duration = t.readUint64())) : ((this.creation_time = t.readUint32()), (this.modification_time = t.readUint32()), (this.track_id = t.readUint32()), t.readUint32(), (this.duration = t.readUint32())), t.readUint32Array(2), (this.layer = t.readInt16()), (this.alternate_group = t.readInt16()), (this.volume = t.readInt16() >> 8), t.readUint16(), (this.matrix = t.readInt32Array(9)), (this.width = t.readUint32()), (this.height = t.readUint32()); }), c.createBoxCtor("tmax", function (t) { this.time = t.readUint32(); }), c.createBoxCtor("tmin", function (t) { this.time = t.readUint32(); }), c.createBoxCtor("totl", function (t) { this.bytessent = t.readUint32(); }), c.createBoxCtor("tpay", function (t) { this.bytessent = t.readUint32(); }), c.createBoxCtor("tpyl", function (t) { this.bytessent = t.readUint64(); }), (c.TrackGroupTypeBox.prototype.parse = function (t) { this.parseFullHeader(t), (this.track_group_id = t.readUint32()); }), c.createTrackGroupCtor("msrc"), (c.TrackReferenceTypeBox = function (t, e, n, i) { c.Box.call(this, t, e), (this.hdr_size = n), (this.start = i); }), (c.TrackReferenceTypeBox.prototype = new c.Box()), (c.TrackReferenceTypeBox.prototype.parse = function (t) { this.track_ids = t.readUint32Array((this.size - this.hdr_size) / 4); }), (c.trefBox.prototype.parse = function (t) { for (var e, n; t.getPosition() < this.start + this.size;) { if ((e = c.parseOneBox(t, !0, this.size - (t.getPosition() - this.start))).code !== c.OK) return; (n = new c.TrackReferenceTypeBox(e.type, e.size, e.hdr_size, e.start)).write === c.Box.prototype.write && "mdat" !== n.type && (r.info( "BoxParser", "TrackReference " + n.type + " box writing not yet implemented, keeping unparsed data in memory for later write" ), n.parseDataAndRewind(t)), n.parse(t), this.boxes.push(n); } }), c.createFullBoxCtor("trep", function (t) { for (this.track_ID = t.readUint32(), this.boxes = []; t.getPosition() < this.start + this.size;) { if (((ret = c.parseOneBox(t, !1, this.size - (t.getPosition() - this.start))), ret.code !== c.OK)) return; (box = ret.box), this.boxes.push(box); } }), c.createFullBoxCtor("trex", function (t) { (this.track_id = t.readUint32()), (this.default_sample_description_index = t.readUint32()), (this.default_sample_duration = t.readUint32()), (this.default_sample_size = t.readUint32()), (this.default_sample_flags = t.readUint32()); }), c.createBoxCtor("trpy", function (t) { this.bytessent = t.readUint64(); }), c.createFullBoxCtor("trun", function (t) { var e = 0; if ( ((this.sample_count = t.readUint32()), (e += 4), this.size - this.hdr_size > e && this.flags & c.TRUN_FLAGS_DATA_OFFSET ? ((this.data_offset = t.readInt32()), (e += 4)) : (this.data_offset = 0), this.size - this.hdr_size > e && this.flags & c.TRUN_FLAGS_FIRST_FLAG ? ((this.first_sample_flags = t.readUint32()), (e += 4)) : (this.first_sample_flags = 0), (this.sample_duration = []), (this.sample_size = []), (this.sample_flags = []), (this.sample_composition_time_offset = []), this.size - this.hdr_size > e) ) for (var n = 0; n < this.sample_count; n++) this.flags & c.TRUN_FLAGS_DURATION && (this.sample_duration[n] = t.readUint32()), this.flags & c.TRUN_FLAGS_SIZE && (this.sample_size[n] = t.readUint32()), this.flags & c.TRUN_FLAGS_FLAGS && (this.sample_flags[n] = t.readUint32()), this.flags & c.TRUN_FLAGS_CTS_OFFSET && (0 === this.version ? (this.sample_composition_time_offset[n] = t.readUint32()) : (this.sample_composition_time_offset[n] = t.readInt32())); }), c.createFullBoxCtor("tsel", function (t) { this.switch_group = t.readUint32(); var e = (this.size - this.hdr_size - 4) / 4; this.attribute_list = []; for (var n = 0; n < e; n++) this.attribute_list[n] = t.readUint32(); }), c.createFullBoxCtor("txtC", function (t) { this.config = t.readCString(); }), c.createBoxCtor("tyco", function (t) { var e = (this.size - this.hdr_size) / 4; this.compatible_brands = []; for (var n = 0; n < e; n++) this.compatible_brands[n] = t.readString(4); }), c.createFullBoxCtor("udes", function (t) { (this.lang = t.readCString()), (this.name = t.readCString()), (this.description = t.readCString()), (this.tags = t.readCString()); }), c.createFullBoxCtor("uncC", function (t) { var e; for ( this.profile = t.readUint32(), this.component_count = t.readUint16(), this.component_index = [], this.component_bit_depth_minus_one = [], this.component_format = [], this.component_align_size = [], e = 0; e < this.component_count; e++ ) this.component_index.push(t.readUint16()), this.component_bit_depth_minus_one.push(t.readUint8()), this.component_format.push(t.readUint8()), this.component_align_size.push(t.readUint8()); (this.sampling_type = t.readUint8()), (this.interleave_type = t.readUint8()), (this.block_size = t.readUint8()); var n = t.readUint8(); (this.component_little_endian = (n >> 7) & 1), (this.block_pad_lsb = (n >> 6) & 1), (this.block_little_endian = (n >> 5) & 1), (this.block_reversed = (n >> 4) & 1), (this.pad_unknown = (n >> 3) & 1), (this.pixel_size = t.readUint8()), (this.row_align_size = t.readUint32()), (this.tile_align_size = t.readUint32()), (this.num_tile_cols_minus_one = t.readUint32()), (this.num_tile_rows_minus_one = t.readUint32()); }), c.createFullBoxCtor("url ", function (t) { 1 !== this.flags && (this.location = t.readCString()); }), c.createFullBoxCtor("urn ", function (t) { (this.name = t.readCString()), this.size - this.hdr_size - this.name.length - 1 > 0 && (this.location = t.readCString()); }), c.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66", !0, !1, function (t) { this.LiveServerManifest = t .readString(this.size - this.hdr_size) .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); }), c.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3", !0, !1, function (t) { this.system_id = c.parseHex16(t); var e = t.readUint32(); e > 0 && (this.data = t.readUint8Array(e)); }), c.createUUIDBox("a2394f525a9b4f14a2446c427c648df4", !0, !1), c.createUUIDBox("8974dbce7be74c5184f97148f9882554", !0, !1, function (t) { (this.default_AlgorithmID = t.readUint24()), (this.default_IV_size = t.readUint8()), (this.default_KID = c.parseHex16(t)); }), c.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f", !0, !1, function (t) { (this.fragment_count = t.readUint8()), (this.entries = []); for (var e = 0; e < this.fragment_count; e++) { var n = {}, i = 0, r = 0; 1 === this.version ? ((i = t.readUint64()), (r = t.readUint64())) : ((i = t.readUint32()), (r = t.readUint32())), (n.absolute_time = i), (n.absolute_duration = r), this.entries.push(n); } }), c.createUUIDBox("6d1d9b0542d544e680e2141daff757b2", !0, !1, function (t) { 1 === this.version ? ((this.absolute_time = t.readUint64()), (this.duration = t.readUint64())) : ((this.absolute_time = t.readUint32()), (this.duration = t.readUint32())); }), c.createFullBoxCtor("vmhd", function (t) { (this.graphicsmode = t.readUint16()), (this.opcolor = t.readUint16Array(3)); }), c.createFullBoxCtor("vpcC", function (t) { var e; 1 === this.version ? ((this.profile = t.readUint8()), (this.level = t.readUint8()), (e = t.readUint8()), (this.bitDepth = e >> 4), (this.chromaSubsampling = (e >> 1) & 7), (this.videoFullRangeFlag = 1 & e), (this.colourPrimaries = t.readUint8()), (this.transferCharacteristics = t.readUint8()), (this.matrixCoefficients = t.readUint8()), (this.codecIntializationDataSize = t.readUint16()), (this.codecIntializationData = t.readUint8Array(this.codecIntializationDataSize))) : ((this.profile = t.readUint8()), (this.level = t.readUint8()), (e = t.readUint8()), (this.bitDepth = (e >> 4) & 15), (this.colorSpace = 15 & e), (e = t.readUint8()), (this.chromaSubsampling = (e >> 4) & 15), (this.transferFunction = (e >> 1) & 7), (this.videoFullRangeFlag = 1 & e), (this.codecIntializationDataSize = t.readUint16()), (this.codecIntializationData = t.readUint8Array(this.codecIntializationDataSize))); }), c.createBoxCtor("vttC", function (t) { this.text = t.readString(this.size - this.hdr_size); }), c.createFullBoxCtor("vvcC", function (t) { var e, n, i = { held_bits: void 0, num_held_bits: 0, stream_read_1_bytes: function (t) { (this.held_bits = t.readUint8()), (this.num_held_bits = 8); }, stream_read_2_bytes: function (t) { (this.held_bits = t.readUint16()), (this.num_held_bits = 16); }, extract_bits: function (t) { var e = (this.held_bits >> (this.num_held_bits - t)) & ((1 << t) - 1); return (this.num_held_bits -= t), e; } }; if ( (i.stream_read_1_bytes(t), i.extract_bits(5), (this.lengthSizeMinusOne = i.extract_bits(2)), (this.ptl_present_flag = i.extract_bits(1)), this.ptl_present_flag) ) { if ( (i.stream_read_2_bytes(t), (this.ols_idx = i.extract_bits(9)), (this.num_sublayers = i.extract_bits(3)), (this.constant_frame_rate = i.extract_bits(2)), (this.chroma_format_idc = i.extract_bits(2)), i.stream_read_1_bytes(t), (this.bit_depth_minus8 = i.extract_bits(3)), i.extract_bits(5), i.stream_read_2_bytes(t), i.extract_bits(2), (this.num_bytes_constraint_info = i.extract_bits(6)), (this.general_profile_idc = i.extract_bits(7)), (this.general_tier_flag = i.extract_bits(1)), (this.general_level_idc = t.readUint8()), i.stream_read_1_bytes(t), (this.ptl_frame_only_constraint_flag = i.extract_bits(1)), (this.ptl_multilayer_enabled_flag = i.extract_bits(1)), (this.general_constraint_info = new Uint8Array(this.num_bytes_constraint_info)), this.num_bytes_constraint_info) ) { for (e = 0; e < this.num_bytes_constraint_info - 1; e++) { var r = i.extract_bits(6); i.stream_read_1_bytes(t); var a = i.extract_bits(2); this.general_constraint_info[e] = (r << 2) | a; } this.general_constraint_info[this.num_bytes_constraint_info - 1] = i.extract_bits(6); } else i.extract_bits(6); if (this.num_sublayers > 1) { for ( i.stream_read_1_bytes(t), this.ptl_sublayer_present_mask = 0, n = this.num_sublayers - 2; n >= 0; --n ) { var s = i.extract_bits(1); this.ptl_sublayer_present_mask |= s << n; } for (n = this.num_sublayers; n <= 8 && this.num_sublayers > 1; ++n) i.extract_bits(1); for (this.sublayer_level_idc = [], n = this.num_sublayers - 2; n >= 0; --n) this.ptl_sublayer_present_mask & (1 << n) && (this.sublayer_level_idc[n] = t.readUint8()); } if ( ((this.ptl_num_sub_profiles = t.readUint8()), (this.general_sub_profile_idc = []), this.ptl_num_sub_profiles) ) for (e = 0; e < this.ptl_num_sub_profiles; e++) this.general_sub_profile_idc.push(t.readUint32()); (this.max_picture_width = t.readUint16()), (this.max_picture_height = t.readUint16()), (this.avg_frame_rate = t.readUint16()); } this.nalu_arrays = []; var o = t.readUint8(); for (e = 0; e < o; e++) { var l = []; this.nalu_arrays.push(l), i.stream_read_1_bytes(t), (l.completeness = i.extract_bits(1)), i.extract_bits(2), (l.nalu_type = i.extract_bits(5)); var d = 1; for (13 != l.nalu_type && 12 != l.nalu_type && (d = t.readUint16()), n = 0; n < d; n++) { var c = t.readUint16(); l.push({ data: t.readUint8Array(c), length: c }); } } }), c.createFullBoxCtor("vvnC", function (t) { var e = strm.readUint8(); this.lengthSizeMinusOne = 3 & e; }), (c.SampleEntry.prototype.isVideo = function () { return !1; }), (c.SampleEntry.prototype.isAudio = function () { return !1; }), (c.SampleEntry.prototype.isSubtitle = function () { return !1; }), (c.SampleEntry.prototype.isMetadata = function () { return !1; }), (c.SampleEntry.prototype.isHint = function () { return !1; }), (c.SampleEntry.prototype.getCodec = function () { return this.type.replace(".", ""); }), (c.SampleEntry.prototype.getWidth = function () { return ""; }), (c.SampleEntry.prototype.getHeight = function () { return ""; }), (c.SampleEntry.prototype.getChannelCount = function () { return ""; }), (c.SampleEntry.prototype.getSampleRate = function () { return ""; }), (c.SampleEntry.prototype.getSampleSize = function () { return ""; }), (c.VisualSampleEntry.prototype.isVideo = function () { return !0; }), (c.VisualSampleEntry.prototype.getWidth = function () { return this.width; }), (c.VisualSampleEntry.prototype.getHeight = function () { return this.height; }), (c.AudioSampleEntry.prototype.isAudio = function () { return !0; }), (c.AudioSampleEntry.prototype.getChannelCount = function () { return this.channel_count; }), (c.AudioSampleEntry.prototype.getSampleRate = function () { return this.samplerate; }), (c.AudioSampleEntry.prototype.getSampleSize = function () { return this.samplesize; }), (c.SubtitleSampleEntry.prototype.isSubtitle = function () { return !0; }), (c.MetadataSampleEntry.prototype.isMetadata = function () { return !0; }), (c.decimalToHex = function (t, e) { var n = Number(t).toString(16); for (e = null == e ? (e = 2) : e; n.length < e;) n = "0" + n; return n; }), (c.avc1SampleEntry.prototype.getCodec = c.avc2SampleEntry.prototype.getCodec = c.avc3SampleEntry.prototype.getCodec = c.avc4SampleEntry.prototype.getCodec = function () { var t = c.SampleEntry.prototype.getCodec.call(this); return this.avcC ? t + "." + c.decimalToHex(this.avcC.AVCProfileIndication) + c.decimalToHex(this.avcC.profile_compatibility) + c.decimalToHex(this.avcC.AVCLevelIndication) : t; }), (c.hev1SampleEntry.prototype.getCodec = c.hvc1SampleEntry.prototype.getCodec = function () { var t, e = c.SampleEntry.prototype.getCodec.call(this); if (this.hvcC) { switch (((e += "."), this.hvcC.general_profile_space)) { case 0: e += ""; break; case 1: e += "A"; break; case 2: e += "B"; break; case 3: e += "C"; } (e += this.hvcC.general_profile_idc), (e += "."); var n = this.hvcC.general_profile_compatibility, i = 0; for (t = 0; t < 32 && ((i |= 1 & n), 31 != t); t++) (i <<= 1), (n >>= 1); (e += c.decimalToHex(i, 0)), (e += "."), 0 === this.hvcC.general_tier_flag ? (e += "L") : (e += "H"), (e += this.hvcC.general_level_idc); var r = !1, a = ""; for (t = 5; t >= 0; t--) (this.hvcC.general_constraint_indicator[t] || r) && ((a = "." + c.decimalToHex(this.hvcC.general_constraint_indicator[t], 0) + a), (r = !0)); e += a; } return e; }), (c.vvc1SampleEntry.prototype.getCodec = c.vvi1SampleEntry.prototype.getCodec = function () { var t, e = c.SampleEntry.prototype.getCodec.call(this); if (this.vvcC) { (e += "." + this.vvcC.general_profile_idc), this.vvcC.general_tier_flag ? (e += ".H") : (e += ".L"), (e += this.vvcC.general_level_idc); var n = ""; if (this.vvcC.general_constraint_info) { var i, r = [], a = 0; for ( a |= this.vvcC.ptl_frame_only_constraint << 7, a |= this.vvcC.ptl_multilayer_enabled << 6, t = 0; t < this.vvcC.general_constraint_info.length; ++t ) (a |= (this.vvcC.general_constraint_info[t] >> 2) & 63), r.push(a), a && (i = t), (a = (this.vvcC.general_constraint_info[t] >> 2) & 3); if (void 0 === i) n = ".CA"; else { n = ".C"; var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", o = 0, l = 0; for (t = 0; t <= i; ++t) for (o = (o << 8) | r[t], l += 8; l >= 5;) { (n += s[(o >> (l - 5)) & 31]), (o &= (1 << (l -= 5)) - 1); } l && (n += s[31 & (o <<= 5 - l)]); } } e += n; } return e; }), (c.mp4aSampleEntry.prototype.getCodec = function () { var t = c.SampleEntry.prototype.getCodec.call(this); if (this.esds && this.esds.esd) { var e = this.esds.esd.getOTI(), n = this.esds.esd.getAudioConfig(); return t + "." + c.decimalToHex(e) + (n ? "." + n : ""); } return t; }), (c.stxtSampleEntry.prototype.getCodec = function () { var t = c.SampleEntry.prototype.getCodec.call(this); return this.mime_format ? t + "." + this.mime_format : t; }), (c.vp08SampleEntry.prototype.getCodec = c.vp09SampleEntry.prototype.getCodec = function () { var t = c.SampleEntry.prototype.getCodec.call(this), e = this.vpcC.level; 0 == e && (e = "00"); var n = this.vpcC.bitDepth; return 8 == n && (n = "08"), t + ".0" + this.vpcC.profile + "." + e + "." + n; }), (c.av01SampleEntry.prototype.getCodec = function () { var t, e = c.SampleEntry.prototype.getCodec.call(this), n = this.av1C.seq_level_idx_0; return ( n < 10 && (n = "0" + n), 2 === this.av1C.seq_profile && 1 === this.av1C.high_bitdepth ? (t = 1 === this.av1C.twelve_bit ? "12" : "10") : this.av1C.seq_profile <= 2 && (t = 1 === this.av1C.high_bitdepth ? "10" : "08"), e + "." + this.av1C.seq_profile + "." + n + (this.av1C.seq_tier_0 ? "H" : "M") + "." + t ); }), (c.Box.prototype.writeHeader = function (t, e) { (this.size += 8), this.size > o && (this.size += 8), "uuid" === this.type && (this.size += 16), r.debug( "BoxWriter", "Writing box " + this.type + " of size: " + this.size + " at position " + t.getPosition() + (e || "") ), this.size > o ? t.writeUint32(1) : ((this.sizePosition = t.getPosition()), t.writeUint32(this.size)), t.writeString(this.type, null, 4), "uuid" === this.type && t.writeUint8Array(this.uuid), this.size > o && t.writeUint64(this.size); }), (c.FullBox.prototype.writeHeader = function (t) { (this.size += 4), c.Box.prototype.writeHeader.call(this, t, " v=" + this.version + " f=" + this.flags), t.writeUint8(this.version), t.writeUint24(this.flags); }), (c.Box.prototype.write = function (t) { "mdat" === this.type ? this.data && ((this.size = this.data.length), this.writeHeader(t), t.writeUint8Array(this.data)) : ((this.size = this.data ? this.data.length : 0), this.writeHeader(t), this.data && t.writeUint8Array(this.data)); }), (c.ContainerBox.prototype.write = function (t) { (this.size = 0), this.writeHeader(t); for (var e = 0; e < this.boxes.length; e++) this.boxes[e] && (this.boxes[e].write(t), (this.size += this.boxes[e].size)); r.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), t.adjustUint32(this.sizePosition, this.size); }), (c.TrackReferenceTypeBox.prototype.write = function (t) { (this.size = 4 * this.track_ids.length), this.writeHeader(t), t.writeUint32Array(this.track_ids); }), (c.avcCBox.prototype.write = function (t) { var e; for (this.size = 7, e = 0; e < this.SPS.length; e++) this.size += 2 + this.SPS[e].length; for (e = 0; e < this.PPS.length; e++) this.size += 2 + this.PPS[e].length; for ( this.ext && (this.size += this.ext.length), this.writeHeader(t), t.writeUint8(this.configurationVersion), t.writeUint8(this.AVCProfileIndication), t.writeUint8(this.profile_compatibility), t.writeUint8(this.AVCLevelIndication), t.writeUint8(this.lengthSizeMinusOne + 252), t.writeUint8(this.SPS.length + 224), e = 0; e < this.SPS.length; e++ ) t.writeUint16(this.SPS[e].length), t.writeUint8Array(this.SPS[e].nalu); for (t.writeUint8(this.PPS.length), e = 0; e < this.PPS.length; e++) t.writeUint16(this.PPS[e].length), t.writeUint8Array(this.PPS[e].nalu); this.ext && t.writeUint8Array(this.ext); }), (c.co64Box.prototype.write = function (t) { var e; for ( this.version = 0, this.flags = 0, this.size = 4 + 8 * this.chunk_offsets.length, this.writeHeader(t), t.writeUint32(this.chunk_offsets.length), e = 0; e < this.chunk_offsets.length; e++ ) t.writeUint64(this.chunk_offsets[e]); }), (c.cslgBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 20), this.writeHeader(t), t.writeInt32(this.compositionToDTSShift), t.writeInt32(this.leastDecodeToDisplayDelta), t.writeInt32(this.greatestDecodeToDisplayDelta), t.writeInt32(this.compositionStartTime), t.writeInt32(this.compositionEndTime); }), (c.cttsBox.prototype.write = function (t) { var e; for ( this.version = 0, this.flags = 0, this.size = 4 + 8 * this.sample_counts.length, this.writeHeader(t), t.writeUint32(this.sample_counts.length), e = 0; e < this.sample_counts.length; e++ ) t.writeUint32(this.sample_counts[e]), 1 === this.version ? t.writeInt32(this.sample_offsets[e]) : t.writeUint32(this.sample_offsets[e]); }), (c.drefBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 4), this.writeHeader(t), t.writeUint32(this.entries.length); for (var e = 0; e < this.entries.length; e++) this.entries[e].write(t), (this.size += this.entries[e].size); r.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), t.adjustUint32(this.sizePosition, this.size); }), (c.elngBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = this.extended_language.length), this.writeHeader(t), t.writeString(this.extended_language); }), (c.elstBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 4 + 12 * this.entries.length), this.writeHeader(t), t.writeUint32(this.entries.length); for (var e = 0; e < this.entries.length; e++) { var n = this.entries[e]; t.writeUint32(n.segment_duration), t.writeInt32(n.media_time), t.writeInt16(n.media_rate_integer), t.writeInt16(n.media_rate_fraction); } }), (c.emsgBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 16 + this.message_data.length + (this.scheme_id_uri.length + 1) + (this.value.length + 1)), this.writeHeader(t), t.writeCString(this.scheme_id_uri), t.writeCString(this.value), t.writeUint32(this.timescale), t.writeUint32(this.presentation_time_delta), t.writeUint32(this.event_duration), t.writeUint32(this.id), t.writeUint8Array(this.message_data); }), (c.ftypBox.prototype.write = function (t) { (this.size = 8 + 4 * this.compatible_brands.length), this.writeHeader(t), t.writeString(this.major_brand, null, 4), t.writeUint32(this.minor_version); for (var e = 0; e < this.compatible_brands.length; e++) t.writeString(this.compatible_brands[e], null, 4); }), (c.hdlrBox.prototype.write = function (t) { (this.size = 20 + this.name.length + 1), (this.version = 0), (this.flags = 0), this.writeHeader(t), t.writeUint32(0), t.writeString(this.handler, null, 4), t.writeUint32(0), t.writeUint32(0), t.writeUint32(0), t.writeCString(this.name); }), (c.hvcCBox.prototype.write = function (t) { var e, n; for (this.size = 23, e = 0; e < this.nalu_arrays.length; e++) for (this.size += 3, n = 0; n < this.nalu_arrays[e].length; n++) this.size += 2 + this.nalu_arrays[e][n].data.length; for ( this.writeHeader(t), t.writeUint8(this.configurationVersion), t.writeUint8( (this.general_profile_space << (6 + this.general_tier_flag)) << (5 + this.general_profile_idc) ), t.writeUint32(this.general_profile_compatibility), t.writeUint8Array(this.general_constraint_indicator), t.writeUint8(this.general_level_idc), t.writeUint16(this.min_spatial_segmentation_idc + (15 << 24)), t.writeUint8(this.parallelismType + 252), t.writeUint8(this.chroma_format_idc + 252), t.writeUint8(this.bit_depth_luma_minus8 + 248), t.writeUint8(this.bit_depth_chroma_minus8 + 248), t.writeUint16(this.avgFrameRate), t.writeUint8( (this.constantFrameRate << 6) + (this.numTemporalLayers << 3) + (this.temporalIdNested << 2) + this.lengthSizeMinusOne ), t.writeUint8(this.nalu_arrays.length), e = 0; e < this.nalu_arrays.length; e++ ) for ( t.writeUint8((this.nalu_arrays[e].completeness << 7) + this.nalu_arrays[e].nalu_type), t.writeUint16(this.nalu_arrays[e].length), n = 0; n < this.nalu_arrays[e].length; n++ ) t.writeUint16(this.nalu_arrays[e][n].data.length), t.writeUint8Array(this.nalu_arrays[e][n].data); }), (c.kindBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = this.schemeURI.length + 1 + (this.value.length + 1)), this.writeHeader(t), t.writeCString(this.schemeURI), t.writeCString(this.value); }), (c.mdhdBox.prototype.write = function (t) { (this.size = 20), (this.flags = 0), (this.version = 0), this.writeHeader(t), t.writeUint32(this.creation_time), t.writeUint32(this.modification_time), t.writeUint32(this.timescale), t.writeUint32(this.duration), t.writeUint16(this.language), t.writeUint16(0); }), (c.mehdBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 4), this.writeHeader(t), t.writeUint32(this.fragment_duration); }), (c.mfhdBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 4), this.writeHeader(t), t.writeUint32(this.sequence_number); }), (c.mvhdBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 96), this.writeHeader(t), t.writeUint32(this.creation_time), t.writeUint32(this.modification_time), t.writeUint32(this.timescale), t.writeUint32(this.duration), t.writeUint32(this.rate), t.writeUint16(this.volume << 8), t.writeUint16(0), t.writeUint32(0), t.writeUint32(0), t.writeUint32Array(this.matrix), t.writeUint32(0), t.writeUint32(0), t.writeUint32(0), t.writeUint32(0), t.writeUint32(0), t.writeUint32(0), t.writeUint32(this.next_track_id); }), (c.SampleEntry.prototype.writeHeader = function (t) { (this.size = 8), c.Box.prototype.writeHeader.call(this, t), t.writeUint8(0), t.writeUint8(0), t.writeUint8(0), t.writeUint8(0), t.writeUint8(0), t.writeUint8(0), t.writeUint16(this.data_reference_index); }), (c.SampleEntry.prototype.writeFooter = function (t) { for (var e = 0; e < this.boxes.length; e++) this.boxes[e].write(t), (this.size += this.boxes[e].size); r.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), t.adjustUint32(this.sizePosition, this.size); }), (c.SampleEntry.prototype.write = function (t) { this.writeHeader(t), t.writeUint8Array(this.data), (this.size += this.data.length), r.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), t.adjustUint32(this.sizePosition, this.size); }), (c.VisualSampleEntry.prototype.write = function (t) { this.writeHeader(t), (this.size += 70), t.writeUint16(0), t.writeUint16(0), t.writeUint32(0), t.writeUint32(0), t.writeUint32(0), t.writeUint16(this.width), t.writeUint16(this.height), t.writeUint32(this.horizresolution), t.writeUint32(this.vertresolution), t.writeUint32(0), t.writeUint16(this.frame_count), t.writeUint8(Math.min(31, this.compressorname.length)), t.writeString(this.compressorname, null, 31), t.writeUint16(this.depth), t.writeInt16(-1), this.writeFooter(t); }), (c.AudioSampleEntry.prototype.write = function (t) { this.writeHeader(t), (this.size += 20), t.writeUint32(0), t.writeUint32(0), t.writeUint16(this.channel_count), t.writeUint16(this.samplesize), t.writeUint16(0), t.writeUint16(0), t.writeUint32(this.samplerate << 16), this.writeFooter(t); }), (c.stppSampleEntry.prototype.write = function (t) { this.writeHeader(t), (this.size += this.namespace.length + 1 + this.schema_location.length + 1 + this.auxiliary_mime_types.length + 1), t.writeCString(this.namespace), t.writeCString(this.schema_location), t.writeCString(this.auxiliary_mime_types), this.writeFooter(t); }), (c.SampleGroupEntry.prototype.write = function (t) { t.writeUint8Array(this.data); }), (c.sbgpBox.prototype.write = function (t) { (this.version = 1), (this.flags = 0), (this.size = 12 + 8 * this.entries.length), this.writeHeader(t), t.writeString(this.grouping_type, null, 4), t.writeUint32(this.grouping_type_parameter), t.writeUint32(this.entries.length); for (var e = 0; e < this.entries.length; e++) { var n = this.entries[e]; t.writeInt32(n.sample_count), t.writeInt32(n.group_description_index); } }), (c.sgpdBox.prototype.write = function (t) { var e, n; for (this.flags = 0, this.size = 12, e = 0; e < this.entries.length; e++) (n = this.entries[e]), 1 === this.version && (0 === this.default_length && (this.size += 4), (this.size += n.data.length)); for ( this.writeHeader(t), t.writeString(this.grouping_type, null, 4), 1 === this.version && t.writeUint32(this.default_length), this.version >= 2 && t.writeUint32(this.default_sample_description_index), t.writeUint32(this.entries.length), e = 0; e < this.entries.length; e++ ) (n = this.entries[e]), 1 === this.version && 0 === this.default_length && t.writeUint32(n.description_length), n.write(t); }), (c.sidxBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 20 + 12 * this.references.length), this.writeHeader(t), t.writeUint32(this.reference_ID), t.writeUint32(this.timescale), t.writeUint32(this.earliest_presentation_time), t.writeUint32(this.first_offset), t.writeUint16(0), t.writeUint16(this.references.length); for (var e = 0; e < this.references.length; e++) { var n = this.references[e]; t.writeUint32((n.reference_type << 31) | n.referenced_size), t.writeUint32(n.subsegment_duration), t.writeUint32((n.starts_with_SAP << 31) | (n.SAP_type << 28) | n.SAP_delta_time); } }), (c.smhdBox.prototype.write = function (t) { (this.version = 0), (this.flags = 1), (this.size = 4), this.writeHeader(t), t.writeUint16(this.balance), t.writeUint16(0); }), (c.stcoBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 4 + 4 * this.chunk_offsets.length), this.writeHeader(t), t.writeUint32(this.chunk_offsets.length), t.writeUint32Array(this.chunk_offsets); }), (c.stscBox.prototype.write = function (t) { var e; for ( this.version = 0, this.flags = 0, this.size = 4 + 12 * this.first_chunk.length, this.writeHeader(t), t.writeUint32(this.first_chunk.length), e = 0; e < this.first_chunk.length; e++ ) t.writeUint32(this.first_chunk[e]), t.writeUint32(this.samples_per_chunk[e]), t.writeUint32(this.sample_description_index[e]); }), (c.stsdBox.prototype.write = function (t) { var e; for ( this.version = 0, this.flags = 0, this.size = 0, this.writeHeader(t), t.writeUint32(this.entries.length), this.size += 4, e = 0; e < this.entries.length; e++ ) this.entries[e].write(t), (this.size += this.entries[e].size); r.debug("BoxWriter", "Adjusting box " + this.type + " with new size " + this.size), t.adjustUint32(this.sizePosition, this.size); }), (c.stshBox.prototype.write = function (t) { var e; for ( this.version = 0, this.flags = 0, this.size = 4 + 8 * this.shadowed_sample_numbers.length, this.writeHeader(t), t.writeUint32(this.shadowed_sample_numbers.length), e = 0; e < this.shadowed_sample_numbers.length; e++ ) t.writeUint32(this.shadowed_sample_numbers[e]), t.writeUint32(this.sync_sample_numbers[e]); }), (c.stssBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 4 + 4 * this.sample_numbers.length), this.writeHeader(t), t.writeUint32(this.sample_numbers.length), t.writeUint32Array(this.sample_numbers); }), (c.stszBox.prototype.write = function (t) { var e, n = !0; if (((this.version = 0), (this.flags = 0), this.sample_sizes.length > 0)) for (e = 0; e + 1 < this.sample_sizes.length;) { if (this.sample_sizes[e + 1] !== this.sample_sizes[0]) { n = !1; break; } e++; } else n = !1; (this.size = 8), n || (this.size += 4 * this.sample_sizes.length), this.writeHeader(t), n ? t.writeUint32(this.sample_sizes[0]) : t.writeUint32(0), t.writeUint32(this.sample_sizes.length), n || t.writeUint32Array(this.sample_sizes); }), (c.sttsBox.prototype.write = function (t) { var e; for ( this.version = 0, this.flags = 0, this.size = 4 + 8 * this.sample_counts.length, this.writeHeader(t), t.writeUint32(this.sample_counts.length), e = 0; e < this.sample_counts.length; e++ ) t.writeUint32(this.sample_counts[e]), t.writeUint32(this.sample_deltas[e]); }), (c.tfdtBox.prototype.write = function (t) { var e = Math.pow(2, 32) - 1; (this.version = this.baseMediaDecodeTime > e ? 1 : 0), (this.flags = 0), (this.size = 4), 1 === this.version && (this.size += 4), this.writeHeader(t), 1 === this.version ? t.writeUint64(this.baseMediaDecodeTime) : t.writeUint32(this.baseMediaDecodeTime); }), (c.tfhdBox.prototype.write = function (t) { (this.version = 0), (this.size = 4), this.flags & c.TFHD_FLAG_BASE_DATA_OFFSET && (this.size += 8), this.flags & c.TFHD_FLAG_SAMPLE_DESC && (this.size += 4), this.flags & c.TFHD_FLAG_SAMPLE_DUR && (this.size += 4), this.flags & c.TFHD_FLAG_SAMPLE_SIZE && (this.size += 4), this.flags & c.TFHD_FLAG_SAMPLE_FLAGS && (this.size += 4), this.writeHeader(t), t.writeUint32(this.track_id), this.flags & c.TFHD_FLAG_BASE_DATA_OFFSET && t.writeUint64(this.base_data_offset), this.flags & c.TFHD_FLAG_SAMPLE_DESC && t.writeUint32(this.default_sample_description_index), this.flags & c.TFHD_FLAG_SAMPLE_DUR && t.writeUint32(this.default_sample_duration), this.flags & c.TFHD_FLAG_SAMPLE_SIZE && t.writeUint32(this.default_sample_size), this.flags & c.TFHD_FLAG_SAMPLE_FLAGS && t.writeUint32(this.default_sample_flags); }), (c.tkhdBox.prototype.write = function (t) { (this.version = 0), (this.size = 80), this.writeHeader(t), t.writeUint32(this.creation_time), t.writeUint32(this.modification_time), t.writeUint32(this.track_id), t.writeUint32(0), t.writeUint32(this.duration), t.writeUint32(0), t.writeUint32(0), t.writeInt16(this.layer), t.writeInt16(this.alternate_group), t.writeInt16(this.volume << 8), t.writeUint16(0), t.writeInt32Array(this.matrix), t.writeUint32(this.width), t.writeUint32(this.height); }), (c.trexBox.prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = 20), this.writeHeader(t), t.writeUint32(this.track_id), t.writeUint32(this.default_sample_description_index), t.writeUint32(this.default_sample_duration), t.writeUint32(this.default_sample_size), t.writeUint32(this.default_sample_flags); }), (c.trunBox.prototype.write = function (t) { (this.version = 0), (this.size = 4), this.flags & c.TRUN_FLAGS_DATA_OFFSET && (this.size += 4), this.flags & c.TRUN_FLAGS_FIRST_FLAG && (this.size += 4), this.flags & c.TRUN_FLAGS_DURATION && (this.size += 4 * this.sample_duration.length), this.flags & c.TRUN_FLAGS_SIZE && (this.size += 4 * this.sample_size.length), this.flags & c.TRUN_FLAGS_FLAGS && (this.size += 4 * this.sample_flags.length), this.flags & c.TRUN_FLAGS_CTS_OFFSET && (this.size += 4 * this.sample_composition_time_offset.length), this.writeHeader(t), t.writeUint32(this.sample_count), this.flags & c.TRUN_FLAGS_DATA_OFFSET && ((this.data_offset_position = t.getPosition()), t.writeInt32(this.data_offset)), this.flags & c.TRUN_FLAGS_FIRST_FLAG && t.writeUint32(this.first_sample_flags); for (var e = 0; e < this.sample_count; e++) this.flags & c.TRUN_FLAGS_DURATION && t.writeUint32(this.sample_duration[e]), this.flags & c.TRUN_FLAGS_SIZE && t.writeUint32(this.sample_size[e]), this.flags & c.TRUN_FLAGS_FLAGS && t.writeUint32(this.sample_flags[e]), this.flags & c.TRUN_FLAGS_CTS_OFFSET && (0 === this.version ? t.writeUint32(this.sample_composition_time_offset[e]) : t.writeInt32(this.sample_composition_time_offset[e])); }), (c["url Box"].prototype.write = function (t) { (this.version = 0), this.location ? ((this.flags = 0), (this.size = this.location.length + 1)) : ((this.flags = 1), (this.size = 0)), this.writeHeader(t), this.location && t.writeCString(this.location); }), (c["urn Box"].prototype.write = function (t) { (this.version = 0), (this.flags = 0), (this.size = this.name.length + 1 + (this.location ? this.location.length + 1 : 0)), this.writeHeader(t), t.writeCString(this.name), this.location && t.writeCString(this.location); }), (c.vmhdBox.prototype.write = function (t) { (this.version = 0), (this.flags = 1), (this.size = 8), this.writeHeader(t), t.writeUint16(this.graphicsmode), t.writeUint16Array(this.opcolor); }), (c.cttsBox.prototype.unpack = function (t) { var e, n, i; for (i = 0, e = 0; e < this.sample_counts.length; e++) for (n = 0; n < this.sample_counts[e]; n++) (t[i].pts = t[i].dts + this.sample_offsets[e]), i++; }), (c.sttsBox.prototype.unpack = function (t) { var e, n, i; for (i = 0, e = 0; e < this.sample_counts.length; e++) for (n = 0; n < this.sample_counts[e]; n++) (t[i].dts = 0 === i ? 0 : t[i - 1].dts + this.sample_deltas[e]), i++; }), (c.stcoBox.prototype.unpack = function (t) { var e; for (e = 0; e < this.chunk_offsets.length; e++) t[e].offset = this.chunk_offsets[e]; }), (c.stscBox.prototype.unpack = function (t) { var e, n, i, r, a; for (r = 0, a = 0, e = 0; e < this.first_chunk.length; e++) for (n = 0; n < (e + 1 < this.first_chunk.length ? this.first_chunk[e + 1] : 1 / 0); n++) for (a++, i = 0; i < this.samples_per_chunk[e]; i++) { if (!t[r]) return; (t[r].description_index = this.sample_description_index[e]), (t[r].chunk_index = a), r++; } }), (c.stszBox.prototype.unpack = function (t) { var e; for (e = 0; e < this.sample_sizes.length; e++) t[e].size = this.sample_sizes[e]; }), (c.DIFF_BOXES_PROP_NAMES = [ "boxes", "entries", "references", "subsamples", "items", "item_infos", "extents", "associations", "subsegments", "ranges", "seekLists", "seekPoints", "esd", "levels" ]), (c.DIFF_PRIMITIVE_ARRAY_PROP_NAMES = [ "compatible_brands", "matrix", "opcolor", "sample_counts", "sample_counts", "sample_deltas", "first_chunk", "samples_per_chunk", "sample_sizes", "chunk_offsets", "sample_offsets", "sample_description_index", "sample_duration" ]), (c.boxEqualFields = function (t, e) { if (t && !e) return !1; var n; for (n in t) if ( !( c.DIFF_BOXES_PROP_NAMES.indexOf(n) > -1 || t[n] instanceof c.Box || e[n] instanceof c.Box || void 0 === t[n] || void 0 === e[n] || "function" == typeof t[n] || "function" == typeof e[n] || (t.subBoxNames && t.subBoxNames.indexOf(n.slice(0, 4)) > -1) || (e.subBoxNames && e.subBoxNames.indexOf(n.slice(0, 4)) > -1) || "data" === n || "start" === n || "size" === n || "creation_time" === n || "modification_time" === n || c.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(n) > -1 || t[n] === e[n] ) ) return !1; return !0; }), (c.boxEqual = function (t, e) { if (!c.boxEqualFields(t, e)) return !1; for (var n = 0; n < c.DIFF_BOXES_PROP_NAMES.length; n++) { var i = c.DIFF_BOXES_PROP_NAMES[n]; if (t[i] && e[i] && !c.boxEqual(t[i], e[i])) return !1; } return !0; }); var h = function () { }; h.prototype.parseSample = function (t) { var e, n = {}; n.resources = []; var i = new a(t.data.buffer); if (t.subsamples && 0 !== t.subsamples.length) { if (((n.documentString = i.readString(t.subsamples[0].size)), t.subsamples.length > 1)) for (e = 1; e < t.subsamples.length; e++) n.resources[e] = i.readUint8Array(t.subsamples[e].size); } else n.documentString = i.readString(t.data.length); return ( "undefined" != typeof DOMParser && (n.document = new DOMParser().parseFromString(n.documentString, "application/xml")), n ); }; var p = function () { }; (p.prototype.parseSample = function (t) { return new a(t.data.buffer).readString(t.data.length); }), (p.prototype.parseConfig = function (t) { var e = new a(t.buffer); return e.readUint32(), e.readCString(); }), (t.XMLSubtitlein4Parser = h), (t.Textin4Parser = p); var f = function (t) { (this.stream = t || new l()), (this.boxes = []), (this.mdats = []), (this.moofs = []), (this.isProgressive = !1), (this.moovStartFound = !1), (this.onMoovStart = null), (this.moovStartSent = !1), (this.onReady = null), (this.readySent = !1), (this.onSegment = null), (this.onSamples = null), (this.onError = null), (this.sampleListBuilt = !1), (this.fragmentedTracks = []), (this.extractedTracks = []), (this.isFragmentationInitialized = !1), (this.sampleProcessingStarted = !1), (this.nextMoofNumber = 0), (this.itemListBuilt = !1), (this.onSidx = null), (this.sidxSent = !1); }; (f.prototype.setSegmentOptions = function (t, e, n) { var i = this.getTrackById(t); if (i) { var r = {}; this.fragmentedTracks.push(r), (r.id = t), (r.user = e), (r.trak = i), (i.nextSample = 0), (r.segmentStream = null), (r.nb_samples = 1e3), (r.rapAlignement = !0), n && (n.nbSamples && (r.nb_samples = n.nbSamples), n.rapAlignement && (r.rapAlignement = n.rapAlignement)); } }), (f.prototype.unsetSegmentOptions = function (t) { for (var e = -1, n = 0; n < this.fragmentedTracks.length; n++) { this.fragmentedTracks[n].id == t && (e = n); } e > -1 && this.fragmentedTracks.splice(e, 1); }), (f.prototype.setExtractionOptions = function (t, e, n) { var i = this.getTrackById(t); if (i) { var r = {}; this.extractedTracks.push(r), (r.id = t), (r.user = e), (r.trak = i), (i.nextSample = 0), (r.nb_samples = 1e3), (r.samples = []), n && n.nbSamples && (r.nb_samples = n.nbSamples); } }), (f.prototype.unsetExtractionOptions = function (t) { for (var e = -1, n = 0; n < this.extractedTracks.length; n++) { this.extractedTracks[n].id == t && (e = n); } e > -1 && this.extractedTracks.splice(e, 1); }), (f.prototype.parse = function () { var t, e; if (!this.restoreParsePosition || this.restoreParsePosition()) for (; ;) { if (this.hasIncompleteMdat && this.hasIncompleteMdat()) { if (this.processIncompleteMdat()) continue; return; } if ( (this.saveParsePosition && this.saveParsePosition(), (t = c.parseOneBox(this.stream, false)).code === c.ERR_NOT_ENOUGH_DATA) ) { if (this.processIncompleteBox) { if (this.processIncompleteBox(t)) continue; return; } return; } var n; switch (((n = "uuid" !== (e = t.box).type ? e.type : e.uuid), this.boxes.push(e), n)) { case "mdat": this.mdats.push(e); break; case "moof": this.moofs.push(e); break; case "moov": (this.moovStartFound = !0), 0 === this.mdats.length && (this.isProgressive = !0); default: void 0 !== this[n] && r.warn("ISOFile", "Duplicate Box of type: " + n + ", overriding previous occurrence"), (this[n] = e); } this.updateUsedBytes && this.updateUsedBytes(e, t); } }), (f.prototype.checkBuffer = function (t) { if (null == t) throw "Buffer must be defined and non empty"; if (void 0 === t.fileStart) throw "Buffer must have a fileStart property"; return 0 === t.byteLength ? (r.warn("ISOFile", "Ignoring empty buffer (fileStart: " + t.fileStart + ")"), this.stream.logBufferLevel(), !1) : (r.info("ISOFile", "Processing buffer (fileStart: " + t.fileStart + ")"), (t.usedBytes = 0), this.stream.insertBuffer(t), this.stream.logBufferLevel(), !!this.stream.initialized() || (r.warn("ISOFile", "Not ready to start parsing"), !1)); }), (f.prototype.appendBuffer = function (t, e) { var n; if (this.checkBuffer(t)) return ( this.parse(), this.moovStartFound && !this.moovStartSent && ((this.moovStartSent = !0), this.onMoovStart && this.onMoovStart()), this.moov ? (this.sampleListBuilt || (this.buildSampleLists(), (this.sampleListBuilt = !0)), this.updateSampleLists(), this.onReady && !this.readySent && ((this.readySent = !0), this.onReady(this.getInfo())), this.processSamples(e), this.nextSeekPosition ? ((n = this.nextSeekPosition), (this.nextSeekPosition = void 0)) : (n = this.nextParsePosition), this.stream.getEndFilePositionAfter && (n = this.stream.getEndFilePositionAfter(n))) : (n = this.nextParsePosition ? this.nextParsePosition : 0), this.sidx && this.onSidx && !this.sidxSent && (this.onSidx(this.sidx), (this.sidxSent = !0)), this.meta && (this.flattenItemInfo && !this.itemListBuilt && (this.flattenItemInfo(), (this.itemListBuilt = !0)), this.processItems && this.processItems(this.onItem)), this.stream.cleanBuffers && (r.info( "ISOFile", "Done processing buffer (fileStart: " + t.fileStart + ") - next buffer to fetch should have a fileStart position of " + n ), this.stream.logBufferLevel(), this.stream.cleanBuffers(), this.stream.logBufferLevel(!0), r.info("ISOFile", "Sample data size in memory: " + this.getAllocatedSampleDataSize())), n ); }), (f.prototype.getInfo = function () { var t, e, n, i, r, a, s = {}, o = new Date("1904-01-01T00:00:00Z").getTime(); if (this.moov) for ( s.hasMoov = !0, s.duration = this.moov.mvhd.duration, s.timescale = this.moov.mvhd.timescale, s.isFragmented = null != this.moov.mvex, s.isFragmented && this.moov.mvex.mehd && (s.fragment_duration = this.moov.mvex.mehd.fragment_duration), s.isProgressive = this.isProgressive, s.hasIOD = null != this.moov.iods, s.brands = [], s.brands.push(this.ftyp.major_brand), s.brands = s.brands.concat(this.ftyp.compatible_brands), s.created = new Date(o + 1e3 * this.moov.mvhd.creation_time), s.modified = new Date(o + 1e3 * this.moov.mvhd.modification_time), s.tracks = [], s.audioTracks = [], s.videoTracks = [], s.subtitleTracks = [], s.metadataTracks = [], s.hintTracks = [], s.otherTracks = [], t = 0; t < this.moov.traks.length; t++ ) { if ( ((a = (n = this.moov.traks[t]).mdia.minf.stbl.stsd.entries[0]), (i = {}), s.tracks.push(i), (i.id = n.tkhd.track_id), (i.name = n.mdia.hdlr.name), (i.references = []), n.tref) ) for (e = 0; e < n.tref.boxes.length; e++) (r = {}), i.references.push(r), (r.type = n.tref.boxes[e].type), (r.track_ids = n.tref.boxes[e].track_ids); n.edts && (i.edits = n.edts.elst.entries), (i.created = new Date(o + 1e3 * n.tkhd.creation_time)), (i.modified = new Date(o + 1e3 * n.tkhd.modification_time)), (i.movie_duration = n.tkhd.duration), (i.movie_timescale = s.timescale), (i.layer = n.tkhd.layer), (i.alternate_group = n.tkhd.alternate_group), (i.volume = n.tkhd.volume), (i.matrix = n.tkhd.matrix), (i.track_width = n.tkhd.width / 65536), (i.track_height = n.tkhd.height / 65536), (i.timescale = n.mdia.mdhd.timescale), (i.cts_shift = n.mdia.minf.stbl.cslg), (i.duration = n.mdia.mdhd.duration), (i.samples_duration = n.samples_duration), (i.codec = a.getCodec()), (i.kind = n.udta && n.udta.kinds.length ? n.udta.kinds[0] : { schemeURI: "", value: "" }), (i.language = n.mdia.elng ? n.mdia.elng.extended_language : n.mdia.mdhd.languageString), (i.nb_samples = n.samples.length), (i.size = n.samples_size), (i.bitrate = (8 * i.size * i.timescale) / i.samples_duration), a.isAudio() ? ((i.type = "audio"), s.audioTracks.push(i), (i.audio = {}), (i.audio.sample_rate = a.getSampleRate()), (i.audio.channel_count = a.getChannelCount()), (i.audio.sample_size = a.getSampleSize())) : a.isVideo() ? ((i.type = "video"), s.videoTracks.push(i), (i.video = {}), (i.video.width = a.getWidth()), (i.video.height = a.getHeight())) : a.isSubtitle() ? ((i.type = "subtitles"), s.subtitleTracks.push(i)) : a.isHint() ? ((i.type = "metadata"), s.hintTracks.push(i)) : a.isMetadata() ? ((i.type = "metadata"), s.metadataTracks.push(i)) : ((i.type = "metadata"), s.otherTracks.push(i)); } else s.hasMoov = !1; if (((s.mime = ""), s.hasMoov && s.tracks)) { for ( s.videoTracks && s.videoTracks.length > 0 ? (s.mime += 'video/mp4; codecs="') : s.audioTracks && s.audioTracks.length > 0 ? (s.mime += 'audio/mp4; codecs="') : (s.mime += 'application/mp4; codecs="'), t = 0; t < s.tracks.length; t++ ) 0 !== t && (s.mime += ","), (s.mime += s.tracks[t].codec); (s.mime += '"; profiles="'), (s.mime += this.ftyp.compatible_brands.join()), (s.mime += '"'); } return s; }), (f.prototype.setNextSeekPositionFromSample = function (t) { t && (this.nextSeekPosition ? (this.nextSeekPosition = Math.min(t.offset + t.alreadyRead, this.nextSeekPosition)) : (this.nextSeekPosition = t.offset + t.alreadyRead)); }), (f.prototype.processSamples = function (t) { var e, n; if (this.sampleProcessingStarted) { if (this.isFragmentationInitialized && null !== this.onSegment) for (e = 0; e < this.fragmentedTracks.length; e++) { var i = this.fragmentedTracks[e]; for (n = i.trak; n.nextSample < n.samples.length && this.sampleProcessingStarted;) { r.debug("ISOFile", "Creating media fragment on track #" + i.id + " for sample " + n.nextSample); var a = this.createFragment(i.id, n.nextSample, i.segmentStream); if (!a) break; if ( ((i.segmentStream = a), n.nextSample++, (n.nextSample % i.nb_samples == 0 || t || n.nextSample >= n.samples.length) && (r.info( "ISOFile", "Sending fragmented data on track #" + i.id + " for samples [" + Math.max(0, n.nextSample - i.nb_samples) + "," + (n.nextSample - 1) + "]" ), r.info("ISOFile", "Sample data size in memory: " + this.getAllocatedSampleDataSize()), this.onSegment && this.onSegment( i.id, i.user, i.segmentStream.buffer, n.nextSample, t || n.nextSample >= n.samples.length ), (i.segmentStream = null), i !== this.fragmentedTracks[e])) ) break; } } if (null !== this.onSamples) for (e = 0; e < this.extractedTracks.length; e++) { var s = this.extractedTracks[e]; for (n = s.trak; n.nextSample < n.samples.length && this.sampleProcessingStarted;) { r.debug("ISOFile", "Exporting on track #" + s.id + " sample #" + n.nextSample); var o = this.getSample(n, n.nextSample); if (!o) { this.setNextSeekPositionFromSample(n.samples[n.nextSample]); break; } if ( (n.nextSample++, s.samples.push(o), (n.nextSample % s.nb_samples == 0 || n.nextSample >= n.samples.length) && (r.debug("ISOFile", "Sending samples on track #" + s.id + " for sample " + n.nextSample), this.onSamples && this.onSamples(s.id, s.user, s.samples), (s.samples = []), s !== this.extractedTracks[e])) ) break; } } } }), (f.prototype.getBox = function (t) { var e = this.getBoxes(t, !0); return e.length ? e[0] : null; }), (f.prototype.getBoxes = function (t, e) { var n = []; return f._sweep.call(this, t, n, e), n; }), (f._sweep = function (t, e, n) { for (var i in (this.type && this.type == t && e.push(this), this.boxes)) { if (e.length && n) return; f._sweep.call(this.boxes[i], t, e, n); } }), (f.prototype.getTrackSamplesInfo = function (t) { var e = this.getTrackById(t); return e ? e.samples : void 0; }), (f.prototype.getTrackSample = function (t, e) { var n = this.getTrackById(t); return this.getSample(n, e); }), (f.prototype.releaseUsedSamples = function (t, e) { var n = 0, i = this.getTrackById(t); i.lastValidSample || (i.lastValidSample = 0); for (var a = i.lastValidSample; a < e; a++) n += this.releaseSample(i, a); r.info( "ISOFile", "Track #" + t + " released samples up to " + e + " (released size: " + n + ", remaining: " + this.samplesDataSize + ")" ), (i.lastValidSample = e); }), (f.prototype.start = function () { (this.sampleProcessingStarted = !0), this.processSamples(!1); }), (f.prototype.stop = function () { this.sampleProcessingStarted = !1; }), (f.prototype.flush = function () { r.info("ISOFile", "Flushing remaining samples"), this.updateSampleLists(), this.processSamples(!0), this.stream.cleanBuffers(), this.stream.logBufferLevel(!0); }), (f.prototype.seekTrack = function (t, e, n) { var i, a, s, o, l = 0, d = 0; if (0 === n.samples.length) return ( r.info( "ISOFile", "No sample in track, cannot seek! Using time " + r.getDurationString(0, 1) + " and offset: 0" ), { offset: 0, time: 0 } ); for (i = 0; i < n.samples.length; i++) { if (((a = n.samples[i]), 0 === i)) (d = 0), (o = a.timescale); else if (a.cts > t * a.timescale) { d = i - 1; break; } e && a.is_sync && (l = i); } for ( e && (d = l), t = n.samples[d].cts, n.nextSample = d; n.samples[d].alreadyRead === n.samples[d].size && n.samples[d + 1]; ) d++; return ( (s = n.samples[d].offset + n.samples[d].alreadyRead), r.info( "ISOFile", "Seeking to " + (e ? "RAP" : "") + " sample #" + n.nextSample + " on track " + n.tkhd.track_id + ", time " + r.getDurationString(t, o) + " and offset: " + s ), { offset: s, time: t / o } ); }), (f.prototype.getTrackDuration = function (t) { var e; return t.samples ? ((e = t.samples[t.samples.length - 1]).cts + e.duration) / e.timescale : 1 / 0; }), (f.prototype.seek = function (t, e) { var n, i, a, s = this.moov, o = { offset: 1 / 0, time: 1 / 0 }; if (this.moov) { for (a = 0; a < s.traks.length; a++) (n = s.traks[a]), t > this.getTrackDuration(n) || ((i = this.seekTrack(t, e, n)).offset < o.offset && (o.offset = i.offset), i.time < o.time && (o.time = i.time)); return ( r.info( "ISOFile", "Seeking at time " + r.getDurationString(o.time, 1) + " needs a buffer with a fileStart position of " + o.offset ), o.offset === 1 / 0 ? (o = { offset: this.nextParsePosition, time: 0 }) : (o.offset = this.stream.getEndFilePositionAfter(o.offset)), r.info("ISOFile", "Adjusted seek position (after checking data already in buffer): " + o.offset), o ); } throw "Cannot seek: moov not received!"; }), (f.prototype.equal = function (t) { for (var e = 0; e < this.boxes.length && e < t.boxes.length;) { var n = this.boxes[e], i = t.boxes[e]; if (!c.boxEqual(n, i)) return !1; e++; } return !0; }), (t.ISOFile = f), (f.prototype.lastBoxStartPosition = 0), (f.prototype.parsingMdat = null), (f.prototype.nextParsePosition = 0), (f.prototype.discardMdatData = !1), (f.prototype.processIncompleteBox = function (t) { var e; return "mdat" === t.type ? ((e = new c[t.type + "Box"](t.size)), (this.parsingMdat = e), this.boxes.push(e), this.mdats.push(e), (e.start = t.start), (e.hdr_size = t.hdr_size), this.stream.addUsedBytes(e.hdr_size), (this.lastBoxStartPosition = e.start + e.size), this.stream.seek(e.start + e.size, !1, this.discardMdatData) ? ((this.parsingMdat = null), !0) : (this.moovStartFound ? (this.nextParsePosition = this.stream.findEndContiguousBuf()) : (this.nextParsePosition = e.start + e.size), !1)) : ("moov" === t.type && ((this.moovStartFound = !0), 0 === this.mdats.length && (this.isProgressive = !0)), !!this.stream.mergeNextBuffer && this.stream.mergeNextBuffer() ? ((this.nextParsePosition = this.stream.getEndPosition()), !0) : (t.type ? this.moovStartFound ? (this.nextParsePosition = this.stream.getEndPosition()) : (this.nextParsePosition = this.stream.getPosition() + t.size) : (this.nextParsePosition = this.stream.getEndPosition()), !1)); }), (f.prototype.hasIncompleteMdat = function () { return null !== this.parsingMdat; }), (f.prototype.processIncompleteMdat = function () { var t; return ( (t = this.parsingMdat), this.stream.seek(t.start + t.size, !1, this.discardMdatData) ? (r.debug("ISOFile", "Found 'mdat' end in buffered data"), (this.parsingMdat = null), !0) : ((this.nextParsePosition = this.stream.findEndContiguousBuf()), !1) ); }), (f.prototype.restoreParsePosition = function () { return this.stream.seek(this.lastBoxStartPosition, !0, this.discardMdatData); }), (f.prototype.saveParsePosition = function () { this.lastBoxStartPosition = this.stream.getPosition(); }), (f.prototype.updateUsedBytes = function (t, e) { this.stream.addUsedBytes && ("mdat" === t.type ? (this.stream.addUsedBytes(t.hdr_size), this.discardMdatData && this.stream.addUsedBytes(t.size - t.hdr_size)) : this.stream.addUsedBytes(t.size)); }), (f.prototype.add = c.Box.prototype.add), (f.prototype.addBox = c.Box.prototype.addBox), (f.prototype.init = function (t) { var e = t || {}; this.add("ftyp") .set("major_brand", (e.brands && e.brands[0]) || "iso4") .set("minor_version", 0) .set("compatible_brands", e.brands || ["iso4"]); var n = this.add("moov"); return ( n .add("mvhd") .set("timescale", e.timescale || 600) .set("rate", e.rate || 65536) .set("creation_time", 0) .set("modification_time", 0) .set("duration", e.duration || 0) .set("volume", e.width ? 0 : 256) .set("matrix", [65536, 0, 0, 0, 65536, 0, 0, 0, 1073741824]) .set("next_track_id", 1), n.add("mvex"), this ); }), (f.prototype.addTrack = function (t) { this.moov || this.init(t); var e = t || {}; (e.width = e.width || 320), (e.height = e.height || 320), (e.id = e.id || this.moov.mvhd.next_track_id), (e.type = e.type || "avc1"); var n = this.moov.add("trak"); (this.moov.mvhd.next_track_id = e.id + 1), n .add("tkhd") .set("flags", c.TKHD_FLAG_ENABLED | c.TKHD_FLAG_IN_MOVIE | c.TKHD_FLAG_IN_PREVIEW) .set("creation_time", 0) .set("modification_time", 0) .set("track_id", e.id) .set("duration", e.duration || 0) .set("layer", e.layer || 0) .set("alternate_group", 0) .set("volume", 1) .set("matrix", [0, 0, 0, 0, 0, 0, 0, 0, 0]) .set("width", e.width << 16) .set("height", e.height << 16); var i = n.add("mdia"); i .add("mdhd") .set("creation_time", 0) .set("modification_time", 0) .set("timescale", e.timescale || 1) .set("duration", e.media_duration || 0) .set("language", e.language || "und"), i .add("hdlr") .set("handler", e.hdlr || "vide") .set("name", e.name || "Track created with MP4Box.js"), i.add("elng").set("extended_language", e.language || "fr-FR"); var r = i.add("minf"); if (void 0 !== c[e.type + "SampleEntry"]) { var s = new c[e.type + "SampleEntry"](); s.data_reference_index = 1; var o = ""; for (var l in c.sampleEntryCodes) for (var d = c.sampleEntryCodes[l], u = 0; u < d.length; u++) if (d.indexOf(e.type) > -1) { o = l; break; } switch (o) { case "Visual": if ( (r.add("vmhd").set("graphicsmode", 0).set("opcolor", [0, 0, 0]), s .set("width", e.width) .set("height", e.height) .set("horizresolution", 72 << 16) .set("vertresolution", 72 << 16) .set("frame_count", 1) .set("compressorname", e.type + " Compressor") .set("depth", 24), e.avcDecoderConfigRecord) ) { var h = new c.avcCBox(); h.parse(new a(e.avcDecoderConfigRecord)), s.addBox(h); } else if (e.hevcDecoderConfigRecord) { var p = new c.hvcCBox(); p.parse(new a(e.hevcDecoderConfigRecord)), s.addBox(p); } break; case "Audio": r.add("smhd").set("balance", e.balance || 0), s .set("channel_count", e.channel_count || 2) .set("samplesize", e.samplesize || 16) .set("samplerate", e.samplerate || 65536); break; case "Hint": r.add("hmhd"); break; case "Subtitle": if ((r.add("sthd"), "stpp" === e.type)) s.set("namespace", e.namespace || "nonamespace") .set("schema_location", e.schema_location || "") .set("auxiliary_mime_types", e.auxiliary_mime_types || ""); break; default: r.add("nmhd"); } e.description && s.addBox(e.description), e.description_boxes && e.description_boxes.forEach(function (t) { s.addBox(t); }), r.add("dinf").add("dref").addEntry(new c["url Box"]().set("flags", 1)); var f = r.add("stbl"); return ( f.add("stsd").addEntry(s), f.add("stts").set("sample_counts", []).set("sample_deltas", []), f.add("stsc").set("first_chunk", []).set("samples_per_chunk", []).set("sample_description_index", []), f.add("stco").set("chunk_offsets", []), f.add("stsz").set("sample_sizes", []), this.moov.mvex .add("trex") .set("track_id", e.id) .set("default_sample_description_index", e.default_sample_description_index || 1) .set("default_sample_duration", e.default_sample_duration || 0) .set("default_sample_size", e.default_sample_size || 0) .set("default_sample_flags", e.default_sample_flags || 0), this.buildTrakSampleLists(n), e.id ); } }), (c.Box.prototype.computeSize = function (t) { var e = t || new s(); (e.endianness = s.BIG_ENDIAN), this.write(e); }), (f.prototype.addSample = function (t, e, n) { var i = n || {}, r = {}, a = this.getTrackById(t); if (null !== a) { (r.number = a.samples.length), (r.track_id = a.tkhd.track_id), (r.timescale = a.mdia.mdhd.timescale), (r.description_index = i.sample_description_index ? i.sample_description_index - 1 : 0), (r.description = a.mdia.minf.stbl.stsd.entries[r.description_index]), (r.data = e), (r.size = e.byteLength), (r.alreadyRead = r.size), (r.duration = i.duration || 1), (r.cts = i.cts || 0), (r.dts = i.dts || 0), (r.is_sync = i.is_sync || !1), (r.is_leading = i.is_leading || 0), (r.depends_on = i.depends_on || 0), (r.is_depended_on = i.is_depended_on || 0), (r.has_redundancy = i.has_redundancy || 0), (r.degradation_priority = i.degradation_priority || 0), (r.offset = 0), (r.subsamples = i.subsamples), a.samples.push(r), (a.samples_size += r.size), (a.samples_duration += r.duration), void 0 === a.first_dts && (a.first_dts = i.dts), this.processSamples(); var s = this.createSingleSampleMoof(r); return ( this.addBox(s), s.computeSize(), (s.trafs[0].truns[0].data_offset = s.size + 8), (this.add("mdat").data = new Uint8Array(e)), r ); } }), (f.prototype.createSingleSampleMoof = function (t) { var e = 0; e = t.is_sync ? 1 << 25 : 65536; var n = new c.moofBox(); n.add("mfhd").set("sequence_number", this.nextMoofNumber), this.nextMoofNumber++; var i = n.add("traf"), r = this.getTrackById(t.track_id); return ( i.add("tfhd").set("track_id", t.track_id).set("flags", c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF), i.add("tfdt").set("baseMediaDecodeTime", t.dts - (r.first_dts || 0)), i .add("trun") .set( "flags", c.TRUN_FLAGS_DATA_OFFSET | c.TRUN_FLAGS_DURATION | c.TRUN_FLAGS_SIZE | c.TRUN_FLAGS_FLAGS | c.TRUN_FLAGS_CTS_OFFSET ) .set("data_offset", 0) .set("first_sample_flags", 0) .set("sample_count", 1) .set("sample_duration", [t.duration]) .set("sample_size", [t.size]) .set("sample_flags", [e]) .set("sample_composition_time_offset", [t.cts - t.dts]), n ); }), (f.prototype.lastMoofIndex = 0), (f.prototype.samplesDataSize = 0), (f.prototype.resetTables = function () { var t, e, n, i, r, a; for ( this.initial_duration = this.moov.mvhd.duration, this.moov.mvhd.duration = 0, t = 0; t < this.moov.traks.length; t++ ) { ((e = this.moov.traks[t]).tkhd.duration = 0), (e.mdia.mdhd.duration = 0), ((e.mdia.minf.stbl.stco || e.mdia.minf.stbl.co64).chunk_offsets = []), ((n = e.mdia.minf.stbl.stsc).first_chunk = []), (n.samples_per_chunk = []), (n.sample_description_index = []), ((e.mdia.minf.stbl.stsz || e.mdia.minf.stbl.stz2).sample_sizes = []), ((i = e.mdia.minf.stbl.stts).sample_counts = []), (i.sample_deltas = []), (r = e.mdia.minf.stbl.ctts) && ((r.sample_counts = []), (r.sample_offsets = [])), (a = e.mdia.minf.stbl.stss); var s = e.mdia.minf.stbl.boxes.indexOf(a); -1 != s && (e.mdia.minf.stbl.boxes[s] = null); } }), (f.initSampleGroups = function (t, e, n, i, r) { var a, s, o, l; function d(t, e, n) { (this.grouping_type = t), (this.grouping_type_parameter = e), (this.sbgp = n), (this.last_sample_in_run = -1), (this.entry_index = -1); } for ( e && (e.sample_groups_info = []), t.sample_groups_info || (t.sample_groups_info = []), s = 0; s < n.length; s++ ) { for ( l = n[s].grouping_type + "/" + n[s].grouping_type_parameter, o = new d(n[s].grouping_type, n[s].grouping_type_parameter, n[s]), e && (e.sample_groups_info[l] = o), t.sample_groups_info[l] || (t.sample_groups_info[l] = o), a = 0; a < i.length; a++ ) i[a].grouping_type === n[s].grouping_type && ((o.description = i[a]), (o.description.used = !0)); if (r) for (a = 0; a < r.length; a++) r[a].grouping_type === n[s].grouping_type && ((o.fragment_description = r[a]), (o.fragment_description.used = !0), (o.is_fragment = !0)); } if (e) { if (r) for (s = 0; s < r.length; s++) !r[s].used && r[s].version >= 2 && ((l = r[s].grouping_type + "/0"), ((o = new d(r[s].grouping_type, 0)).is_fragment = !0), e.sample_groups_info[l] || (e.sample_groups_info[l] = o)); } else for (s = 0; s < i.length; s++) !i[s].used && i[s].version >= 2 && ((l = i[s].grouping_type + "/0"), (o = new d(i[s].grouping_type, 0)), t.sample_groups_info[l] || (t.sample_groups_info[l] = o)); }), (f.setSampleGroupProperties = function (t, e, n, i) { var r, a; for (r in ((e.sample_groups = []), i)) { var s; if ( ((e.sample_groups[r] = {}), (e.sample_groups[r].grouping_type = i[r].grouping_type), (e.sample_groups[r].grouping_type_parameter = i[r].grouping_type_parameter), n >= i[r].last_sample_in_run && (i[r].last_sample_in_run < 0 && (i[r].last_sample_in_run = 0), i[r].entry_index++, i[r].entry_index <= i[r].sbgp.entries.length - 1 && (i[r].last_sample_in_run += i[r].sbgp.entries[i[r].entry_index].sample_count)), i[r].entry_index <= i[r].sbgp.entries.length - 1 ? (e.sample_groups[r].group_description_index = i[r].sbgp.entries[i[r].entry_index].group_description_index) : (e.sample_groups[r].group_description_index = -1), 0 !== e.sample_groups[r].group_description_index) ) (s = i[r].fragment_description ? i[r].fragment_description : i[r].description), e.sample_groups[r].group_description_index > 0 ? ((a = e.sample_groups[r].group_description_index > 65535 ? (e.sample_groups[r].group_description_index >> 16) - 1 : e.sample_groups[r].group_description_index - 1), s && a >= 0 && (e.sample_groups[r].description = s.entries[a])) : s && s.version >= 2 && s.default_group_description_index > 0 && (e.sample_groups[r].description = s.entries[s.default_group_description_index - 1]); } }), (f.process_sdtp = function (t, e, n) { e && (t ? ((e.is_leading = t.is_leading[n]), (e.depends_on = t.sample_depends_on[n]), (e.is_depended_on = t.sample_is_depended_on[n]), (e.has_redundancy = t.sample_has_redundancy[n])) : ((e.is_leading = 0), (e.depends_on = 0), (e.is_depended_on = 0), (e.has_redundancy = 0))); }), (f.prototype.buildSampleLists = function () { var t, e; for (t = 0; t < this.moov.traks.length; t++) (e = this.moov.traks[t]), this.buildTrakSampleLists(e); }), (f.prototype.buildTrakSampleLists = function (t) { var e, n, i, r, a, s, o, l, d, c, u, h, p, m, g, y, A, v, b, E, w, x, S, _; if ( ((t.samples = []), (t.samples_duration = 0), (t.samples_size = 0), (n = t.mdia.minf.stbl.stco || t.mdia.minf.stbl.co64), (i = t.mdia.minf.stbl.stsc), (r = t.mdia.minf.stbl.stsz || t.mdia.minf.stbl.stz2), (a = t.mdia.minf.stbl.stts), (s = t.mdia.minf.stbl.ctts), (o = t.mdia.minf.stbl.stss), (l = t.mdia.minf.stbl.stsd), (d = t.mdia.minf.stbl.subs), (h = t.mdia.minf.stbl.stdp), (c = t.mdia.minf.stbl.sbgps), (u = t.mdia.minf.stbl.sgpds), (v = -1), (b = -1), (E = -1), (w = -1), (x = 0), (S = 0), (_ = 0), f.initSampleGroups(t, null, c, u), void 0 !== r) ) { for (e = 0; e < r.sample_sizes.length; e++) { var T = {}; (T.number = e), (T.track_id = t.tkhd.track_id), (T.timescale = t.mdia.mdhd.timescale), (T.alreadyRead = 0), (t.samples[e] = T), (T.size = r.sample_sizes[e]), (t.samples_size += T.size), 0 === e ? ((m = 1), (p = 0), (T.chunk_index = m), (T.chunk_run_index = p), (A = i.samples_per_chunk[p]), (y = 0), (g = p + 1 < i.first_chunk.length ? i.first_chunk[p + 1] - 1 : 1 / 0)) : e < A ? ((T.chunk_index = m), (T.chunk_run_index = p)) : (m++, (T.chunk_index = m), (y = 0), m <= g || (g = ++p + 1 < i.first_chunk.length ? i.first_chunk[p + 1] - 1 : 1 / 0), (T.chunk_run_index = p), (A += i.samples_per_chunk[p])), (T.description_index = i.sample_description_index[T.chunk_run_index] - 1), (T.description = l.entries[T.description_index]), (T.offset = n.chunk_offsets[T.chunk_index - 1] + y), (y += T.size), e > v && (b++, v < 0 && (v = 0), (v += a.sample_counts[b])), e > 0 ? ((t.samples[e - 1].duration = a.sample_deltas[b]), (t.samples_duration += t.samples[e - 1].duration), (T.dts = t.samples[e - 1].dts + t.samples[e - 1].duration)) : (T.dts = 0), s ? (e >= E && (w++, E < 0 && (E = 0), (E += s.sample_counts[w])), (T.cts = t.samples[e].dts + s.sample_offsets[w])) : (T.cts = T.dts), o ? (e == o.sample_numbers[x] - 1 ? ((T.is_sync = !0), x++) : ((T.is_sync = !1), (T.degradation_priority = 0)), d && d.entries[S].sample_delta + _ == e + 1 && ((T.subsamples = d.entries[S].subsamples), (_ += d.entries[S].sample_delta), S++)) : (T.is_sync = !0), f.process_sdtp(t.mdia.minf.stbl.sdtp, T, T.number), (T.degradation_priority = h ? h.priority[e] : 0), d && d.entries[S].sample_delta + _ == e && ((T.subsamples = d.entries[S].subsamples), (_ += d.entries[S].sample_delta)), (c.length > 0 || u.length > 0) && f.setSampleGroupProperties(t, T, e, t.sample_groups_info); } e > 0 && ((t.samples[e - 1].duration = Math.max(t.mdia.mdhd.duration - t.samples[e - 1].dts, 0)), (t.samples_duration += t.samples[e - 1].duration)); } }), (f.prototype.updateSampleLists = function () { var t, e, n, i, r, a, s, o, l, d, u, h, p, m, g; if (void 0 !== this.moov) for (; this.lastMoofIndex < this.moofs.length;) if (((l = this.moofs[this.lastMoofIndex]), this.lastMoofIndex++, "moof" == l.type)) for (d = l, t = 0; t < d.trafs.length; t++) { for ( u = d.trafs[t], h = this.getTrackById(u.tfhd.track_id), p = this.getTrexById(u.tfhd.track_id), i = u.tfhd.flags & c.TFHD_FLAG_SAMPLE_DESC ? u.tfhd.default_sample_description_index : p ? p.default_sample_description_index : 1, r = u.tfhd.flags & c.TFHD_FLAG_SAMPLE_DUR ? u.tfhd.default_sample_duration : p ? p.default_sample_duration : 0, a = u.tfhd.flags & c.TFHD_FLAG_SAMPLE_SIZE ? u.tfhd.default_sample_size : p ? p.default_sample_size : 0, s = u.tfhd.flags & c.TFHD_FLAG_SAMPLE_FLAGS ? u.tfhd.default_sample_flags : p ? p.default_sample_flags : 0, u.sample_number = 0, u.sbgps.length > 0 && f.initSampleGroups(h, u, u.sbgps, h.mdia.minf.stbl.sgpds, u.sgpds), e = 0; e < u.truns.length; e++ ) { var y = u.truns[e]; for (n = 0; n < y.sample_count; n++) { ((m = {}).moof_number = this.lastMoofIndex), (m.number_in_traf = u.sample_number), u.sample_number++, (m.number = h.samples.length), (u.first_sample_index = h.samples.length), h.samples.push(m), (m.track_id = h.tkhd.track_id), (m.timescale = h.mdia.mdhd.timescale), (m.description_index = i - 1), (m.description = h.mdia.minf.stbl.stsd.entries[m.description_index]), (m.size = a), y.flags & c.TRUN_FLAGS_SIZE && (m.size = y.sample_size[n]), (h.samples_size += m.size), (m.duration = r), y.flags & c.TRUN_FLAGS_DURATION && (m.duration = y.sample_duration[n]), (h.samples_duration += m.duration), h.first_traf_merged || n > 0 ? (m.dts = h.samples[h.samples.length - 2].dts + h.samples[h.samples.length - 2].duration) : (u.tfdt ? (m.dts = u.tfdt.baseMediaDecodeTime) : (m.dts = 0), (h.first_traf_merged = !0)), (m.cts = m.dts), y.flags & c.TRUN_FLAGS_CTS_OFFSET && (m.cts = m.dts + y.sample_composition_time_offset[n]), (g = s), y.flags & c.TRUN_FLAGS_FLAGS ? (g = y.sample_flags[n]) : 0 === n && y.flags & c.TRUN_FLAGS_FIRST_FLAG && (g = y.first_sample_flags), (m.is_sync = !((g >> 16) & 1)), (m.is_leading = (g >> 26) & 3), (m.depends_on = (g >> 24) & 3), (m.is_depended_on = (g >> 22) & 3), (m.has_redundancy = (g >> 20) & 3), (m.degradation_priority = 65535 & g); var A = !!(u.tfhd.flags & c.TFHD_FLAG_BASE_DATA_OFFSET), v = !!(u.tfhd.flags & c.TFHD_FLAG_DEFAULT_BASE_IS_MOOF), b = !!(y.flags & c.TRUN_FLAGS_DATA_OFFSET), E = 0; (E = A ? u.tfhd.base_data_offset : v || 0 === e ? d.start : o), (m.offset = 0 === e && 0 === n ? (b ? E + y.data_offset : E) : o), (o = m.offset + m.size), (u.sbgps.length > 0 || u.sgpds.length > 0 || h.mdia.minf.stbl.sbgps.length > 0 || h.mdia.minf.stbl.sgpds.length > 0) && f.setSampleGroupProperties(h, m, m.number_in_traf, u.sample_groups_info); } } if (u.subs) { h.has_fragment_subsamples = !0; var w = u.first_sample_index; for (e = 0; e < u.subs.entries.length; e++) (w += u.subs.entries[e].sample_delta), ((m = h.samples[w - 1]).subsamples = u.subs.entries[e].subsamples); } } }), (f.prototype.getSample = function (t, e) { var n, i = t.samples[e]; if (!this.moov) return null; if (i.data) { if (i.alreadyRead == i.size) return i; } else (i.data = new Uint8Array(i.size)), (i.alreadyRead = 0), (this.samplesDataSize += i.size), r.debug( "ISOFile", "Allocating sample #" + e + " on track #" + t.tkhd.track_id + " of size " + i.size + " (total: " + this.samplesDataSize + ")" ); for (; ;) { var a = this.stream.findPosition(!0, i.offset + i.alreadyRead, !1); if (!(a > -1)) return null; var o = (n = this.stream.buffers[a]).byteLength - (i.offset + i.alreadyRead - n.fileStart); if (i.size - i.alreadyRead <= o) return ( r.debug( "ISOFile", "Getting sample #" + e + " data (alreadyRead: " + i.alreadyRead + " offset: " + (i.offset + i.alreadyRead - n.fileStart) + " read size: " + (i.size - i.alreadyRead) + " full size: " + i.size + ")" ), s.memcpy( i.data.buffer, i.alreadyRead, n, i.offset + i.alreadyRead - n.fileStart, i.size - i.alreadyRead ), (n.usedBytes += i.size - i.alreadyRead), this.stream.logBufferLevel(), (i.alreadyRead = i.size), i ); if (0 === o) return null; r.debug( "ISOFile", "Getting sample #" + e + " partial data (alreadyRead: " + i.alreadyRead + " offset: " + (i.offset + i.alreadyRead - n.fileStart) + " read size: " + o + " full size: " + i.size + ")" ), s.memcpy(i.data.buffer, i.alreadyRead, n, i.offset + i.alreadyRead - n.fileStart, o), (i.alreadyRead += o), (n.usedBytes += o), this.stream.logBufferLevel(); } }), (f.prototype.releaseSample = function (t, e) { var n = t.samples[e]; return n.data ? ((this.samplesDataSize -= n.size), (n.data = null), (n.alreadyRead = 0), n.size) : 0; }), (f.prototype.getAllocatedSampleDataSize = function () { return this.samplesDataSize; }), (f.prototype.getCodecs = function () { var t, e = ""; for (t = 0; t < this.moov.traks.length; t++) { t > 0 && (e += ","), (e += this.moov.traks[t].mdia.minf.stbl.stsd.entries[0].getCodec()); } return e; }), (f.prototype.getTrexById = function (t) { var e; if (!this.moov || !this.moov.mvex) return null; for (e = 0; e < this.moov.mvex.trexs.length; e++) { var n = this.moov.mvex.trexs[e]; if (n.track_id == t) return n; } return null; }), (f.prototype.getTrackById = function (t) { if (void 0 === this.moov) return null; for (var e = 0; e < this.moov.traks.length; e++) { var n = this.moov.traks[e]; if (n.tkhd.track_id == t) return n; } return null; }), (f.prototype.items = []), (f.prototype.itemsDataSize = 0), (f.prototype.flattenItemInfo = function () { var t, e, n, i = this.items, a = this.meta; if (null != a && void 0 !== a.hdlr && void 0 !== a.iinf) { for (t = 0; t < a.iinf.item_infos.length; t++) ((n = {}).id = a.iinf.item_infos[t].item_ID), (i[n.id] = n), (n.ref_to = []), (n.name = a.iinf.item_infos[t].item_name), a.iinf.item_infos[t].protection_index > 0 && (n.protection = a.ipro.protections[a.iinf.item_infos[t].protection_index - 1]), a.iinf.item_infos[t].item_type ? (n.type = a.iinf.item_infos[t].item_type) : (n.type = "mime"), (n.content_type = a.iinf.item_infos[t].content_type), (n.content_encoding = a.iinf.item_infos[t].content_encoding); if (a.iloc) for (t = 0; t < a.iloc.items.length; t++) { var s = a.iloc.items[t]; switch ( ((n = i[s.item_ID]), 0 !== s.data_reference_index && (r.warn("Item storage with reference to other files: not supported"), (n.source = a.dinf.boxes[s.data_reference_index - 1])), s.construction_method) ) { case 0: break; case 1: case 2: r.warn("Item storage with construction_method : not supported"); } for (n.extents = [], n.size = 0, e = 0; e < s.extents.length; e++) (n.extents[e] = {}), (n.extents[e].offset = s.extents[e].extent_offset + s.base_offset), (n.extents[e].length = s.extents[e].extent_length), (n.extents[e].alreadyRead = 0), (n.size += n.extents[e].length); } if ((a.pitm && (i[a.pitm.item_id].primary = !0), a.iref)) for (t = 0; t < a.iref.references.length; t++) { var o = a.iref.references[t]; for (e = 0; e < o.references.length; e++) i[o.from_item_ID].ref_to.push({ type: o.type, id: o.references[e] }); } if (a.iprp) for (var l = 0; l < a.iprp.ipmas.length; l++) { var d = a.iprp.ipmas[l]; for (t = 0; t < d.associations.length; t++) { var c = d.associations[t]; for ( void 0 === (n = i[c.id]).properties && ((n.properties = {}), (n.properties.boxes = [])), e = 0; e < c.props.length; e++ ) { var u = c.props[e]; if (u.property_index > 0 && u.property_index - 1 < a.iprp.ipco.boxes.length) { var h = a.iprp.ipco.boxes[u.property_index - 1]; (n.properties[h.type] = h), n.properties.boxes.push(h); } } } } } }), (f.prototype.getItem = function (t) { var e, n; if (!this.meta) return null; if (!(n = this.items[t]).data && n.size) (n.data = new Uint8Array(n.size)), (n.alreadyRead = 0), (this.itemsDataSize += n.size), r.debug( "ISOFile", "Allocating item #" + t + " of size " + n.size + " (total: " + this.itemsDataSize + ")" ); else if (n.alreadyRead === n.size) return n; for (var i = 0; i < n.extents.length; i++) { var a = n.extents[i]; if (a.alreadyRead !== a.length) { var o = this.stream.findPosition(!0, a.offset + a.alreadyRead, !1); if (!(o > -1)) return null; var l = (e = this.stream.buffers[o]).byteLength - (a.offset + a.alreadyRead - e.fileStart); if (!(a.length - a.alreadyRead <= l)) return ( r.debug( "ISOFile", "Getting item #" + t + " extent #" + i + " partial data (alreadyRead: " + a.alreadyRead + " offset: " + (a.offset + a.alreadyRead - e.fileStart) + " read size: " + l + " full extent size: " + a.length + " full item size: " + n.size + ")" ), s.memcpy(n.data.buffer, n.alreadyRead, e, a.offset + a.alreadyRead - e.fileStart, l), (a.alreadyRead += l), (n.alreadyRead += l), (e.usedBytes += l), this.stream.logBufferLevel(), null ); r.debug( "ISOFile", "Getting item #" + t + " extent #" + i + " data (alreadyRead: " + a.alreadyRead + " offset: " + (a.offset + a.alreadyRead - e.fileStart) + " read size: " + (a.length - a.alreadyRead) + " full extent size: " + a.length + " full item size: " + n.size + ")" ), s.memcpy( n.data.buffer, n.alreadyRead, e, a.offset + a.alreadyRead - e.fileStart, a.length - a.alreadyRead ), (e.usedBytes += a.length - a.alreadyRead), this.stream.logBufferLevel(), (n.alreadyRead += a.length - a.alreadyRead), (a.alreadyRead = a.length); } } return n.alreadyRead === n.size ? n : null; }), (f.prototype.releaseItem = function (t) { var e = this.items[t]; if (e.data) { (this.itemsDataSize -= e.size), (e.data = null), (e.alreadyRead = 0); for (var n = 0; n < e.extents.length; n++) { e.extents[n].alreadyRead = 0; } return e.size; } return 0; }), (f.prototype.processItems = function (t) { for (var e in this.items) { var n = this.items[e]; this.getItem(n.id), t && !n.sent && (t(n), (n.sent = !0), (n.data = null)); } }), (f.prototype.hasItem = function (t) { for (var e in this.items) { var n = this.items[e]; if (n.name === t) return n.id; } return -1; }), (f.prototype.getMetaHandler = function () { return this.meta ? this.meta.hdlr.handler : null; }), (f.prototype.getPrimaryItem = function () { return this.meta && this.meta.pitm ? this.getItem(this.meta.pitm.item_id) : null; }), (f.prototype.itemToFragmentedTrackFile = function (t) { var e = t || {}, n = null; if (null == (n = e.itemId ? this.getItem(e.itemId) : this.getPrimaryItem())) return null; var i = new f(); i.discardMdatData = !1; var r = { type: n.type, description_boxes: n.properties.boxes }; n.properties.ispe && ((r.width = n.properties.ispe.image_width), (r.height = n.properties.ispe.image_height)); var a = i.addTrack(r); return a ? (i.addSample(a, n.data), i) : null; }), (f.prototype.write = function (t) { for (var e = 0; e < this.boxes.length; e++) this.boxes[e].write(t); }), (f.prototype.createFragment = function (t, e, n) { var i = this.getTrackById(t), a = this.getSample(i, e); if (null == a) return this.setNextSeekPositionFromSample(i.samples[e]), null; var o = n || new s(); o.endianness = s.BIG_ENDIAN; var l = this.createSingleSampleMoof(a); l.write(o), (l.trafs[0].truns[0].data_offset = l.size + 8), r.debug("MP4Box", "Adjusting data_offset with new value " + l.trafs[0].truns[0].data_offset), o.adjustUint32(l.trafs[0].truns[0].data_offset_position, l.trafs[0].truns[0].data_offset); var d = new c.mdatBox(); return (d.data = a.data), d.write(o), o; }), (f.writeInitializationSegment = function (t, e, n, i) { var a; r.debug("ISOFile", "Generating initialization segment"); var o = new s(); (o.endianness = s.BIG_ENDIAN), t.write(o); var l = e.add("mvex"); for (n && l.add("mehd").set("fragment_duration", n), a = 0; a < e.traks.length; a++) l.add("trex") .set("track_id", e.traks[a].tkhd.track_id) .set("default_sample_description_index", 1) .set("default_sample_duration", i) .set("default_sample_size", 0) .set("default_sample_flags", 65536); return e.write(o), o.buffer; }), (f.prototype.save = function (t) { var e = new s(); (e.endianness = s.BIG_ENDIAN), this.write(e), e.save(t); }), (f.prototype.getBuffer = function () { var t = new s(); return (t.endianness = s.BIG_ENDIAN), this.write(t), t.buffer; }), (f.prototype.initializeSegmentation = function () { var t, e, n, i; for ( null === this.onSegment && r.warn("MP4Box", "No segmentation callback set!"), this.isFragmentationInitialized || ((this.isFragmentationInitialized = !0), (this.nextMoofNumber = 0), this.resetTables()), e = [], t = 0; t < this.fragmentedTracks.length; t++ ) { var a = new c.moovBox(); (a.mvhd = this.moov.mvhd), a.boxes.push(a.mvhd), (n = this.getTrackById(this.fragmentedTracks[t].id)), a.boxes.push(n), a.traks.push(n), ((i = {}).id = n.tkhd.track_id), (i.user = this.fragmentedTracks[t].user), (i.buffer = f.writeInitializationSegment( this.ftyp, a, this.moov.mvex && this.moov.mvex.mehd ? this.moov.mvex.mehd.fragment_duration : void 0, this.moov.traks[t].samples.length > 0 ? this.moov.traks[t].samples[0].duration : 0 )), e.push(i); } return e; }), (c.Box.prototype.printHeader = function (t) { (this.size += 8), this.size > o && (this.size += 8), "uuid" === this.type && (this.size += 16), t.log(t.indent + "size:" + this.size), t.log(t.indent + "type:" + this.type); }), (c.FullBox.prototype.printHeader = function (t) { (this.size += 4), c.Box.prototype.printHeader.call(this, t), t.log(t.indent + "version:" + this.version), t.log(t.indent + "flags:" + this.flags); }), (c.Box.prototype.print = function (t) { this.printHeader(t); }), (c.ContainerBox.prototype.print = function (t) { this.printHeader(t); for (var e = 0; e < this.boxes.length; e++) if (this.boxes[e]) { var n = t.indent; (t.indent += " "), this.boxes[e].print(t), (t.indent = n); } }), (f.prototype.print = function (t) { t.indent = ""; for (var e = 0; e < this.boxes.length; e++) this.boxes[e] && this.boxes[e].print(t); }), (c.mvhdBox.prototype.print = function (t) { c.FullBox.prototype.printHeader.call(this, t), t.log(t.indent + "creation_time: " + this.creation_time), t.log(t.indent + "modification_time: " + this.modification_time), t.log(t.indent + "timescale: " + this.timescale), t.log(t.indent + "duration: " + this.duration), t.log(t.indent + "rate: " + this.rate), t.log(t.indent + "volume: " + (this.volume >> 8)), t.log(t.indent + "matrix: " + this.matrix.join(", ")), t.log(t.indent + "next_track_id: " + this.next_track_id); }), (c.tkhdBox.prototype.print = function (t) { c.FullBox.prototype.printHeader.call(this, t), t.log(t.indent + "creation_time: " + this.creation_time), t.log(t.indent + "modification_time: " + this.modification_time), t.log(t.indent + "track_id: " + this.track_id), t.log(t.indent + "duration: " + this.duration), t.log(t.indent + "volume: " + (this.volume >> 8)), t.log(t.indent + "matrix: " + this.matrix.join(", ")), t.log(t.indent + "layer: " + this.layer), t.log(t.indent + "alternate_group: " + this.alternate_group), t.log(t.indent + "width: " + this.width), t.log(t.indent + "height: " + this.height); }); var m = { createFile: function (t, e) { var n = void 0 === t || t, i = new f(e); return (i.discardMdatData = !n), i; } }; t.createFile = m.createFile; })({}); var Ch, Lh, Ih = function () { var t; self.onmessage = function (e) { "start" === e.data.event && (self.clearInterval(t), (t = self.setInterval(function () { self.postMessage({}); }, 16.6))), "stop" === e.data.event && self.clearInterval(t); }; }, Rh = new Map(), Dh = 1; ((Ch = new Blob(["(".concat(Ih.toString(), ")()")])), (Lh = URL.createObjectURL(Ch)), new Worker(Lh)).onmessage = function () { Dh += 1; var t, e = (function (t, e) { var n = ("undefined" != typeof Symbol && t[Symbol.iterator]) || t["@@iterator"]; if (!n) { if (Array.isArray(t) || (n = w(t)) || e) { n && (t = n); var i = 0, r = function () { }; return { s: r, n: function () { return i >= t.length ? { done: !0 } : { done: !1, value: t[i++] }; }, e: function (t) { throw t; }, f: r }; } throw new TypeError( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ); } var a, s = !0, o = !1; return { s: function () { n = n.call(t); }, n: function () { var t = n.next(); return (s = t.done), t; }, e: function (t) { (o = !0), (a = t); }, f: function () { try { s || null == n.return || n.return(); } finally { if (o) throw a; } } }; })(Rh.entries()); try { for (e.s(); !(t = e.n()).done;) { var n = b(t.value, 2), i = n[0], r = n[1]; Dh % i == 0 && r.forEach(function (t) { return t(); }); } } catch (t) { e.e(t); } finally { e.f(); } }; var Bh = new To(), Ph = m(function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.emitter, i = e.logger; f(this, t), g(this, "Logger", Bh), g(this, "Emitter", void 0), n && (this.Emitter = n), i && (this.Logger = i); }), Uh = (function (t) { function e(t) { var i, r = t.emitter, a = t.Player; return ( f(this, e), ((i = n(this, e, [{ emitter: r }])).Player = a), (i.TimerController = a.TimerController), (i.Canvas = a.Canvas), (i.seekTime = null), (i.decodedTime = 0), (i.videoFrames = []), i.Emitter.on(mh, i.playing.bind(i)), i.Emitter.on("videoFrame", i.onVideoFrame.bind(i)), i.Emitter.on("decodeSeek", function (t) { i.Logger.log("decodeSeek", t, i.seekTime), i.seekTime === t && (i.seekTime = null); }), i ); } return ( y(e, t), m(e, [ { key: "seek", value: function (t) { var e = 1e6 * t, n = this.videoFrames.findIndex(function (t) { var n = t.timestamp, i = t.duration; return e >= n && e < n + (i || 5e4); }); if (n >= 0) { for (var i = 0; i < n; i++) { var r, a = this.videoFrames.shift(); a.close ? a.close() : null === (r = a.imageBitmap) || void 0 === r || r.close(); } return this.Logger.log("onSeek::找到视频帧"), void this.Emitter.emit(hh, "video"); } (this.seekTime = t), this.cleanVideoFrames(), this.Player.WorkerController.seek(t); } }, { key: "playing", value: ((a = p( d().mark(function t(e) { var n; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return (t.next = 2), this.tick(1e6 * this.Player.currentTime); case 2: if ((n = t.sent)) { t.next = 5; break; } return t.abrupt("return"); case 5: if (!n.imageBitmap) { t.next = 10; break; } return (t.next = 8), this.Canvas.drawImage(n); case 8: t.next = 12; break; case 10: return (t.next = 12), this.Canvas.draw(n); case 12: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return a.apply(this, arguments); }) }, { key: "onVideoFrame", value: function (t) { if (null == this.seekTime) { this.videoFrames.push(t); var e = (t.timestamp + t.duration) / 1e6; if (((this.decodedTime = e), !this.Player.videoReady)) { var n = Math.min(1.9, this.Player.duration - this.Player.currentTime); e - this.Player.currentTime >= n && this.Emitter.emit(hh, "video"); } } else { var i; t.close ? t.close() : null === (i = t.imageBitmap) || void 0 === i || i.close(); } } }, { key: "tick", value: ((r = p( d().mark(function t(e) { var n, i, r, a, s; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (0 != this.videoFrames.length) { t.next = 3; break; } return this.Emitter.emit(ch, "video"), t.abrupt("return"); case 3: if ( ((n = this.videoFrames[0]), (i = n.timestamp), (r = n.duration), !(e < i)) ) { t.next = 7; break; } return t.abrupt("return"); case 7: if (!(e > i + r)) { t.next = 12; break; } (this.missCount = (this.missCount || 0) + 1), this.Logger.warn("tick::该帧时间已过", e, i, this.missCount); try { (s = this.videoFrames.shift()).close ? s.close() : null === (a = s.imageBitmap) || void 0 === a || a.close(); } catch (t) { this.Logger.warn("tick::error::", e, i, t); } return t.abrupt("return", this.tick(e)); case 12: return t.abrupt("return", this.videoFrames.shift()); case 13: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return r.apply(this, arguments); }) }, { key: "cleanVideoFrames", value: ((i = p( d().mark(function t() { var e, n, i; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (0 != (e = this.videoFrames.length)) { t.next = 3; break; } return t.abrupt("return"); case 3: for (; e > 0;) (i = this.videoFrames.shift()).close ? i.close() : null === (n = i.imageBitmap) || void 0 === n || n.close(), e--; (this.decodedTime = 0), console.log("cleanVideoFrames", this.videoFrames.length); case 6: case "end": return t.stop(); } }, t, this ); }) )), function () { return i.apply(this, arguments); }) }, { key: "destroy", value: function () { clearInterval(this.onPlayTimer), this.cleanVideoFrames(), (this.Player = null), (this.FrameController = null), (this.TimerController = null), (this.Canvas = null); } } ]) ); var i, r, a; })(Ph), Fh = new WeakMap(), Oh = new WeakMap(), Mh = new WeakMap(), Nh = new WeakMap(), zh = new WeakMap(), Gh = new WeakMap(), jh = new WeakMap(), Hh = new WeakMap(), Yh = new WeakMap(), $h = new WeakMap(), Kh = new WeakMap(), qh = new WeakMap(), Vh = new WeakSet(), Wh = (function (t) { function i(t) { var s, o, l, c = t.Player, u = t.emitter; return ( f(this, i), (s = n(this, i, [{ emitter: u }])), S((o = s), (l = Vh)), l.add(o), _(s, Fh, []), _(s, Oh, null), _(s, Mh, null), _(s, Nh, null), _(s, zh, !1), _(s, Gh, 0), _(s, jh, 0), _(s, Hh, 0), _(s, Yh, null), _(s, $h, 1), _(s, Kh, !1), _(s, qh, {}), g(s, "isFirstPlay", !0), g(s, "temp3", 0), (s.Player = c), s.Emitter.on( "demux-audio", (function () { var t = p( d().mark(function t(n) { var i, o; return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return (t.next = 2), e(Vh, s, Qh).call(s, n.aacData.buffer); case 2: if ( ((i = t.sent), (o = { decodedBuffer: i, duration: n.duration, startTime: n.startTime, reallyStartTime: n.reallyStartTime }), r(Fh, s).push(o), !( null !== r(Nh, s) && r(Nh, s) >= n.startTime && r(Nh, s) < n.startTime + n.duration )) ) { t.next = 9; break; } return ( a(jh, s, r(Nh, s) - n.startTime), s.Emitter.emit(hh, "audio"), t.abrupt("return") ); case 9: !s.Player.audioReady && o.startTime >= s.currentTime && s.currentTime < o.startTime + o.duration && (s.Logger.log("audio::正常播放恢复", s.currentTime, s.paused), s.Emitter.emit(hh, "audio")); case 10: case "end": return t.stop(); } }, t); }) ); return function (e) { return t.apply(this, arguments); }; })() ), s.Emitter.on(uh, function (t) { var e; if (r(Fh, s)) { s.pause(), (s.temp3 = 0), r(Mh, s) && ((r(Mh, s).onended = null), r(Mh, s).stop()), a(Nh, s, t), a(Hh, s, t - ((null === (e = r(Oh, s)) || void 0 === e ? void 0 : e.currentTime) || 0)); var n = r(qh, s) || {}, i = n.startTime, o = n.duration; i <= t && t < i + o ? (a(jh, s, r(Nh, s) - i), s.Emitter.emit(hh, "audio")) : r(Fh, s).forEach(function (e, n) { if (e) { var i = e.startTime, o = e.duration; e.decodedBuffer && i <= t && t < i + o && (a(jh, s, r(Nh, s) - i), s.Emitter.emit(hh, "audio")); } }), a(Fh, s, []); } }), s ); } return ( y(i, t), m(i, [ { key: "play", value: ((s = p( d().mark(function t() { var n, i, s = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if ( (r(Oh, this) || (a(Oh, this, new AudioContext()), a(Yh, this, r(Oh, this).createGain())), r(Kh, this) || !r(Oh, this).currentTime || !this.paused) ) { t.next = 5; break; } if (null !== r(Nh, this)) { t.next = 5; break; } return r(Oh, this).resume(), t.abrupt("return"); case 5: if (!(this.currentTime >= this.Player.duration - 1)) { t.next = 8; break; } return this.Emitter.emit(gh), t.abrupt("return"); case 8: if (e(Vh, this, Xh).call(this)) { t.next = 10; break; } return t.abrupt("return"); case 10: this.isFirstPlay && (this.muted = this.Player.config.muted), (this.isFirstPlay = !1), r(Mh, this).start(0, r(jh, this)), (i = ((null === (n = r(Oh, this)) || void 0 === n ? void 0 : n.currentTime) || 0) + r(Hh, this)), (this.temp3 = i - r(qh, this).reallyStartTime), this.paused && r(Oh, this).resume(), a(jh, this, 0), a(zh, this, !0), a(Kh, this, !1), (r(Mh, this).onended = p( d().mark(function t() { return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (!r(Nh, s) && 0 !== r(Nh, s)) { t.next = 2; break; } return t.abrupt("return"); case 2: return (t.next = 4), s.play(); case 4: case "end": return t.stop(); } }, t); }) )), a(Nh, this, null); case 21: case "end": return t.stop(); } }, t, this ); }) )), function () { return s.apply(this, arguments); }) }, { key: "pause", value: function () { var t; "running" === (null === (t = r(Oh, this)) || void 0 === t ? void 0 : t.state) && r(Oh, this) .suspend() .then(function () { }); } }, { key: "reset", value: function () { var t; null === (t = r(Oh, this)) || void 0 === t || t.close(), a(Oh, this, null), a(Yh, this, null), a(Nh, this, null), a(jh, this, 0), a(Hh, this, 0), a(Kh, this, !1); } }, { key: "paused", get: function () { return !r(Oh, this) || "suspended" === r(Oh, this).state; } }, { key: "muted", get: function () { var t; return r(Yh, this) ? 0 === (null === (t = r(Yh, this)) || void 0 === t || null === (t = t.gain) || void 0 === t ? void 0 : t.value) : this.Player.config.muted; }, set: function (t) { var e; null !== (e = r(Yh, this)) && void 0 !== e && e.gain ? (r(Yh, this).gain.value = t ? 0 : 1) : (this.Player.config.muted = t); } }, { key: "currentTime", get: function () { var t; return r(Nh, this) ? r(Nh, this) : ((null === (t = r(Oh, this)) || void 0 === t ? void 0 : t.currentTime) || 0) + r(Hh, this) - this.temp3; } }, { key: "destroy", value: function () { var t, e; r(Fh, this).forEach(function (t) { null != t && t.decodedBuffer && (t.decodedBuffer = null); }), a(Fh, this, []), this.pause(), null === (t = r(Oh, this)) || void 0 === t || t.close(), null === (e = r(Yh, this)) || void 0 === e || e.disconnect(); } } ]) ); var s; })(Ph); function Qh(t) { var e = this; return new Promise(function (n, i) { var a = r(Oh, e) || new AudioContext(), s = t; a.decodeAudioData(s) .then(function (t) { n(t); }) .catch(function (t) { i(t); }); }); } function Xh() { if (r(Fh, this).length) { var t = r(Fh, this).shift(); if ((a(qh, this, t), t)) return ( a(Gh, this, t.startTime + t.duration), a(Mh, this, r(Oh, this).createBufferSource()), (r(Mh, this).buffer = t.decodedBuffer), r(Mh, this).connect(r(Yh, this)), r(Yh, this).connect(r(Oh, this).destination), !0 ); this.paused || (a(Kh, this, !0), this.Emitter.emit(ch, "audio")); } else this.Emitter.emit(ch, "audio"); } var Jh = (function () { return m( function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.canvas, i = e.width, r = e.height, a = e.emitter; if ((f(this, t), !n)) throw new Error("缺少canvas参数"); (this.Emitter = a), (this.width = i), (this.height = r), console.log("canvas init", i, r), (this.canvas = n), (this.canvas.width = 1280), (this.canvas.height = 960), (this.canvas.style.width = "100%"), (this.ctx = this.canvas.getContext("2d")); }, [ { key: "draw", value: ((r = p( d().mark(function t(e) { var n, i; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (e) { t.next = 2; break; } return t.abrupt("return"); case 2: return ( (n = e.displayWidth), (i = e.displayHeight), (n == this.canvas.width && i == this.canvas.height) || this.config({ width: n, height: i }), this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.drawImage(e, 0, 0, n, i), (t.next = 9), e.close() ); case 9: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return r.apply(this, arguments); }) }, { key: "getImageBitmap", value: ((i = p( d().mark(function t(e) { var n, i, r, a; return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (e) { t.next = 2; break; } return t.abrupt("return"); case 2: return ( console.time("getImageBitmap".concat(e.timestamp)), (n = e.displayWidth), (i = e.displayHeight), (r = new OffscreenCanvas(n, i)).getContext("2d").drawImage(e, 0, 0, n, i), (t.next = 10), createImageBitmap(r) ); case 10: return ( (a = t.sent), console.timeEnd("getImageBitmap".concat(e.timestamp)), t.abrupt("return", a) ); case 13: case "end": return t.stop(); } }, t); }) )), function (t) { return i.apply(this, arguments); }) }, { key: "drawVideoFrameAppendBody", value: ((n = p( d().mark(function t(e) { var n, i, r, a; return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (e) { t.next = 2; break; } return t.abrupt("return"); case 2: return ( (n = e.displayWidth), (i = e.displayHeight), (r = document.createElement("canvas")), (a = r.getContext("2d")), (r.width = n), (r.height = i), console.time("drawImage"), a.clearRect(0, 0, r.width, r.height), (r.style.width = "10%"), (r.style.border = "1px solid blue"), a.drawImage(e, 0, 0, n, i), console.timeEnd("drawImage"), document.getElementById("videoFrame").append(r), (t.next = 17), e.close() ); case 17: case "end": return t.stop(); } }, t); }) )), function (t) { return n.apply(this, arguments); }) }, { key: "drawImage", value: ((e = p( d().mark(function t(e) { var n, i, r; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (e) { t.next = 2; break; } return t.abrupt("return"); case 2: return ( (n = e.imageBitmap), (i = n.width), (r = n.height), (i == this.canvas.width && r == this.canvas.height) || this.config({ width: i, height: r }), this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.drawImage(n, 0, 0, i, r), (t.next = 10), n.close() ); case 10: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return e.apply(this, arguments); }) }, { key: "drawImageAppendBody", value: ((t = p( d().mark(function t(e) { var n, i, r, a, s; return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (e) { t.next = 2; break; } return t.abrupt("return"); case 2: return ( (n = e.imageBitmap), (i = n.width), (r = n.height), (a = document.createElement("canvas")), (s = a.getContext("2d")), (a.width = i), (a.height = r), console.time("drawImage"), s.clearRect(0, 0, a.width, a.height), (a.style.width = "10%"), console.log("imageBitmap", n), s.drawImage(n, 0, 0, i, r), (s.fillStyle = "red"), (s.font = "250px serif"), s.fillText("".concat(e.timestamp / 1e6), 200, 240), (t.next = 19), n.close() ); case 19: console.timeEnd("drawImage"), document.body.append(a); case 21: case "end": return t.stop(); } }, t); }) )), function (e) { return t.apply(this, arguments); }) }, { key: "config", value: function (t) { var e = t.width, n = t.height; console.log("canvas::config::width: ".concat(e, ", height: ").concat(n)), (this.canvas.width = e), (this.canvas.height = n), this.updateCanvasStyle(), this.Emitter.emit(sh); } }, { key: "updateCanvasStyle", value: function () { var t = this.canvas; t.width / t.height > this.width / this.height ? ((this.canvas.style.width = "100%"), (this.canvas.style.height = "auto")) : ((this.canvas.style.width = "auto"), (this.canvas.style.height = "100%")); } }, { key: "drawImageBySrc", value: function (t) { var e = this; if (t) { var n = new Image(); (n.src = t), (n.onload = function () { var t = n.width, i = n.height; e.config({ width: t, height: i }), e.ctx.drawImage(n, 0, 0, t, i), (n = null); }), (n.onerror = function () { console.warn("视频封面加载失败"); }); } } }, { key: "destroy", value: function () { (this.ctx = null), this.canvas.remove(), (this.canvas = null); } } ] ); var t, e, n, i, r; })(), Zh = (function (t) { function e() { var t, i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; f(this, e), (t = n(this, e, [{ emitter: i.emitter }])); var r = i.duration, a = void 0 === r ? 0 : r; return ( (t._currentTime = 0), (t.startTime = 0), (t.duration = 1e6 * a || 1 / 0), (t.waiting = !1), (t.paused = !0), (t.raf = null), t ); } return ( y(e, t), m(e, [ { key: "seek", value: function (t) { this.Logger.log("timer::onSeek", this.currentTime, t), this.stopTime(), (this.startTime = performance.now()), (this._currentTime = 1e6 * t); } }, { key: "reset", value: function () { this.Logger.log("timer::reset"), (this._currentTime = 0), (this.startTime = 0), (this.waiting = !1), (this.paused = !0); } }, { key: "run", value: function () { this.stopTime(), this.Emitter.emit(ph), (this.paused = !1), (this.waiting = !1), (this.startTime = performance.now()), this.updateTime(); } }, { key: "stop", value: function () { (this.paused = !0), this.Logger.warn("stop", this._currentTime), this.stopTime(); } }, { key: "stopTime", value: function () { (this.waiting = !0), this.Logger.warn("stopTime", this._currentTime, this.raf), cancelAnimationFrame(this.raf), (this.raf = null); } }, { key: "updateTime", value: function () { if (this.waiting) return ( this.Logger.warn("updateTime::waiting", this.waiting, this._currentTime), void this.stopTime() ); var t = performance.now(), e = 1e3 * (t - this.startTime); if ( ((this._currentTime += e), (this.startTime = t), this.Emitter.emit(mh, this._currentTime), this._currentTime >= this.duration) ) return ( this.Logger.log("playend::", this.currentTime, this.duration), this.Emitter.emit(gh), void this.stop() ); this.raf = requestAnimationFrame(this.updateTime.bind(this)); } }, { key: "currentTime", get: function () { return this._currentTime / 1e6; }, set: function (t) { this._currentTime = 1e6 * t; } }, { key: "ended", get: function () { return this._currentTime >= this.duration; } }, { key: "progress", get: function () { } } ]) ); })(Ph), tp = (function (e) { function i(e) { var r, a = e.emitter, s = e.Player; f(this, i), ((r = n(this, i, [{ emitter: a }])).Player = s); var o = "./worker/PlayerWorker.js"; if (s.config.workerUrl) { o = s.config.workerUrl; var l = location.pathname; if (l.includes(".")) { var d = l.lastIndexOf("/"); l = l.substring(0, d); } var c = l.endsWith("/") ? l : l + "/", u = new URL(o, location.origin + c).href; r.Logger.log("workerUrl::config:format", u), (r.worker = new Worker(u)); } else r.worker = new Worker( new URL( o, "undefined" == typeof document && "undefined" == typeof location ? require("url").pathToFileURL(__filename).href : "undefined" == typeof document ? location.href : (t && t.src) || new URL("VideoPlayer.1.3.0.umd.cjs", document.baseURI).href ), { type: "module" } ); return ( r.Logger.log("workerUrl", o), r.worker.addEventListener("error", function (t) { r.Logger.error("worker::error", t), r.Emitter.emit(yh, { fatal: !0, src: s.config.workerUrl, type: "workerError", data: "null", error: { message: "player worker error: 请检查workerUrl是否有误" } }); }), r.worker.addEventListener("message", function (t) { var e = t.data; r.workerHandler(e); }), r.Emitter.on(ih, function (t) { r.worker.postMessage({ event: ih, data: t }); }), r.Emitter.on(mh, function () { r.worker.postMessage({ event: mh, data: r.Player.currentTime }); }), r.Emitter.on(ph, function () { r.worker.postMessage({ event: ph, data: r.Player.currentTime }); }), r ); } return ( y(i, e), m(i, [ { key: "init", value: function (t) { this.worker.postMessage({ event: "init", data: t }); } }, { key: "workerHandler", value: function () { var t, e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, n = e.event, i = e.data; switch (n) { case hh: case rh: case "videoFrame": case "decodeSeek": case "demux-audio": this.Emitter.emit(n, i); break; case "log": (t = this.Logger).log.apply(t, ["worker::"].concat(E(i))); } } }, { key: "changePlaylist", value: function (t) { this.worker.postMessage({ event: oh, data: t }); } }, { key: "seek", value: function (t) { this.worker.postMessage({ event: uh, data: t }); } }, { key: "destroy", value: function () { this.worker.terminate(); } } ]) ); })(Ph), ep = [], np = []; !(function (t, e) { if (t && "undefined" != typeof document) { var n, i = !0 === e.prepend ? "prepend" : "append", r = !0 === e.singleTag, a = "string" == typeof e.container ? document.querySelector(e.container) : document.getElementsByTagName("head")[0]; if (r) { var s = ep.indexOf(a); -1 === s && ((s = ep.push(a) - 1), (np[s] = {})), (n = np[s] && np[s][i] ? np[s][i] : (np[s][i] = o())); } else n = o(); 65279 === t.charCodeAt(0) && (t = t.substring(1)), n.styleSheet ? (n.styleSheet.cssText += t) : n.appendChild(document.createTextNode(t)); } function o() { var t = document.createElement("style"); if ((t.setAttribute("type", "text/css"), e.attributes)) for (var n = Object.keys(e.attributes), r = 0; r < n.length; r++) t.setAttribute(n[r], e.attributes[n[r]]); var s = "prepend" === i ? "afterbegin" : "beforeend"; return a.insertAdjacentElement(s, t), t; } })( '@font-face {\n font-family: "iconfont"; /* Project id 4258961 */\n src: url(\'data:font/woff2;base64,d09GMgABAAAAAAicAAsAAAAAETQAAAhOAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACEQgqTDI81ATYCJAM0CxwABCAFhGcHgUAbfw5RlDBSEtlXCeZmG6TvwTAGNqlQoUt5pIz0i3+ka4P/x/3YuW/bF0NcOqGT8AjREqWSaFoqqZFFk+cNj9v6d6ANRm/WbvP8TYzLxGr4URM3a0WZya4avaiGqyguIsYDz81+83kaeEKBJBIlEmYBh4X7xO758dYZA5Nr2W7LSYGSLbLQrXCVgRKqZ0psYqkEOP7VUQDO//1e/bUu6wKa2QB/1H11zv1RsSqqoGwfDei9RQbwAHdGkKI0C9uMWWoSwSyKt6c/+hgECqsGkpTa1Fzg1xAWFsDcsJlC2VxNcSEBvI5S3hAjGZG4HhqjHgRYJzkGXKQfrxfrgReYEMHOslmPKAC7XNbH9dIGsQHgLsS88TrQ5gYCcGBxZXINZu0Vl4PFFC1Ubb0zgHYBx7Pa9dzV4hrrmuFa5Pr0cMLjelEEXq3thDGuTkZdV8wt7UJ4QpiIf/IARnJBwvFSlVIhg1KAVuGAu5rs1SohdsPKABGwFkByYGMACcDGApIA6wTEAZsBiAe2CJAU2CcUosL7hEKU+KyDFMDqwfvnaqGO2/YDLAGuINkBWPgh4DnqiA238RTTGnUeGcVckbGw594GcYPyCtySh1BLRgYA+fm1uCIXwQWFpHmvgNoWOxDqyHOKMJS7ajuAuY5g9KHVntwFQJUZUASIHb0XhtSiCR532IFekBilPOKmps5xiyz0g9wPJi8jQ06zdsB/SDbygDezDkEXZPC74+FoAoWrW/8kw2AlGux+3dcjQN0H9gIh9eUo/3LZ8naQdYJ0yKf43OLueRlh7rLZzFdQYhbQBtRVnM5A3ba1VPkknXDn5WahJZEQcRJshuyG3opSKZkkt2YPiSDetafH3uIT93pHlBGjdmXEmZud81sbaDTYVrthutyDkDfazQR+en0Tm+hz1DSdGPDGyT2Nuq2dFH8rfQmaIPFh0KcJ+U/JQwJcxcKPUslha3GYCfIzIiUHdlQZYh2zTO43htwihQv29nuN6Ow0Vn9MOReG8rsHjz0on2ChfgjsHuQpN/O3DLH9RxFpOL9muwm/0yfiPaaHOor2livpxOVRHv1P/NJeOmWEJTYX7QIBwv45nP9BdxTEq9rRT/JR3UNqf09O4QFqvWz7zPkZxHvXyoYcT+wxMDemnOk5coO5mp+86Jf+EotDjVMa+kCCHINQ+fk80AUFe1yoURiVC5u22yEctve8eQn3PH+bg4faYwIh+6nX7AS158UahTC5cOigHUKjbQeNIMetzYpYfEzHHYsLCsc2O4xDdodDqItx7NMeDia/a0wmOBzt0V07z9EuwyGN7EIWuLE62OtCpbn9CLUPHbLBKGxLCAGHPIAwj0tl8Keuhw61y7C2uW4C7mEvgfDDIQKE/g92Bl3seB7ucUnBmdMCBcVUzBCNwdjpOqVgZE7zmZg1+f6e2dhzTB9/C5td3HZy1kSfiO+wIkw2XLTXP1zVfdWW6QJeOmn+764Dq3RVvNRJW8zn39eXTKq/k37cxzfybIdqb5QPTU7FmdHeEcmLxjtihCJxRMa6AxnrE4c/j9hJ9QrsRekz/r/68v9bx4e/aLzzPUIx5VeqZ59f86c+D99J9Q7sTTX0H9nZbzSIDoJwYDbMIYoJIJipnNSJgqT8deL5IFucLQjEtwkyHp7T3vjHPplOtm+3sf38sraW+Dt6Q/s40wJYt/r3PNgPXUa7gC9+BWpDj2RlRXGRpZwNdg6OdrqcoqbGJnItTijPyxNTyzXx/1CtNc44W9zRl2F6PinPJHPVBjF3uW55Ht1eB8T646HXQ+2hz0OPifRl/1kHLzWCh6YDM1nZ8/nnly5FyPVkxY1f/FT1Mz77BWRm7hurPUt9bhTVsctid8Uuj90vwa7yVpne5OLxJKh/nAu683HoyosBa+A8GInMhdcEXDyf5uPjzerhQ8zGALVEKwFHY5Q2VaiXkeCiUgcYO98I9DwbJRoPjTvmgQnTNT7lvmU+lO+GvDz/5QHL/JcF7C4MvRF2Q+ZdkmODgyKD9uamLI/VI7pYHYJsdnYbGT8yqNt9442fT/x8ktdtHN1FIVFL8EZbRqAabc8R3Xv0PBkkdMijq/pVRcs7hB79dpd2OKIdHbohK2/5OxPSCRuXX0OuLa/U3kYDgttWaJPuO+XoN2dnSjdVoJ9jVAroXbHvF1yE/ZP94YvZXgdDQP0fgPhhrFS2q/VujNQ3Mu966RmXBtrTCgCAmyQXA05UbALE93OkvkHas42Sm2kv/5cGpDW4Adf6d0+UDtpsbsa/fmvdf/7933n5fpI6HtOz0ogzj8DdSsZ0nBtvI+k7iEEUPxSHwLR1jEogw6PYqd0NeCNk1C41bgMFHwZbR2O7G/PgHc78bTLeUWaZ1ABwqoBx4BEwnxWU1kGCgI2swoIRR5c68KQU58C0ZmRJq6VZpnEPHAIOAo+Ai1lBtwcgQcC3rMJWID9daTowDDORhIUsQPIrkWIDx1KCsKRrzSYLrTRh6nLpSJO5GA5ErVA1qxNIljQNsYe5rBC3WCiEMnEMot1fjaRpDuFNXAlpsCiKLBa+r1JJqfZQGDgGDGNCIljivAUQ+SorFjPgsKihLfXPl41UyIpGMDnSdWoTc8iltSPUFFQO9ASUdepyJW3NyhTCWUhNQSQwEWByXHtXk2ju5SB49UYlSAYWCkU93Ly+lDQU5Yoq5seZPzjK365b9sXqwOTkFZQoVaZchUpVqtXQVltp2mwwkST7m7nIVMyWtkjICp5gC7zMnDW2ZVCUZyZlvXf+3ziK8srPyLrzhNVMykqK2cLKYvY3A8dXevHnhrSVxf3NnANgOrkDuz1pjih41nfjaaISAAA=\') format(\'woff2\'),\n url(\'data:font/woff;base64,d09GRgABAAAAAAroAAsAAAAAETQAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAARAAAAGA8ik1PY21hcAAAAYgAAAC4AAACQvCwPtFnbHlmAAACQAAABjcAAAmMZjPOPmhlYWQAAAh4AAAAMQAAADYnuuaYaGhlYQAACKwAAAAgAAAAJAfdA45obXR4AAAIzAAAABYAAAA0NAH//mxvY2EAAAjkAAAAHAAAABwP/hJAbWF4cAAACQAAAAAfAAAAIAElAKFuYW1lAAAJIAAAAUAAAAJnEKM8sHBvc3QAAApgAAAAhQAAAMBzHFineJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGFhYJzAwMrAwNTJdIaBgaEfQjO+ZjBi5ACKMrAyM2AFAWmuKQwHnpW+qmdu+N/AwMB8hwFIMjCiKGICAH9HDVh4nOWSMQ6CQBBF/wIiKoUxxngID2cDJTa0kFBDYSw42g/hBlT4lyEx0SM4m7fJ/OzsbOYvgA2AUNxEBLgXHHx0Ut2ih9gveoS78hOOUgLmLFmzY89paMbHPAPMpFVsV63w2lc41Z+1LriuCwik7vSOWPdG2CLFQR0THY5/6v8v0mV/fjJmhuYG5oZ3iqWhWYKV4d1lbWi+YGt4x9kZ3nX2hqYPTobvNTSGHMFYGP43jA8DyRuCY0SKeJyNVWuIW0UUnkcyc99zk3tz03uzyc1jc9PddBM3m02q1a6vbq0v6qJtRRBbof5oq11a/LMI9YVWqahUofpDBX9UF0rBZ3EVHyhdsSJCqwXBx4/+KAqK1P6QzXom2d1itdUQzj1zzpyZ+b5zZg6KITR/lj5FDRSgUXQL2oEQLhWZ663CjXar3boCN6Miy+IKSDeNRxqtZlTFRc44GF2vARPSIJuVclSRjm4kB9kYw6mev4bbXlqu1w1tgywKPNpbNofxZXtNxzGPq0QQ4gTOO5rvaqT9d+NRNZfUOnWuxfg30rF3VnOy6lHXdzA5CFZ2omud0Vxfm3F8lxASgJOcc32gOYHWyS8Y+fHeKkrS136XW/juUc131NnetkQ91jO+pwWONtMzUgXBT/J1hu6jOsqgNppAkwg5SyTU/8FPfIm78DxaW1GZL5Dgps/jh+HmaOqCfFai50xnRs3CyR4zXNc4oRBDIS75yXRm1UCCWLAKQnGyw2YlIYpkQtr3zqpOmmCux9i33fGMmswpM0AywfiMHEtSuiQyI6ZAzOleUKAuLQSBxdnHzu0CrM4CfRh/iDGxqBzPSDoXzhcH0uj8/Pwb9Gt6E/JRHl0FVQYcCclJKiEhSgqAvNFEM6J1XEqMtIGJGoYplRrmFg6BhO6UMSxlezWu4D81jWmnXirV66WXToGqLcsX1rwQHjp0BD+xXWfhkL5xozmQtJmxbZvBhatnLDD0aW5CsehNlMQ/qZc6r0XDn8QJDQNa87JzaI+Pmwc6x/a7A2kupqZsVegD7v799pCuuVNTrmYMOCjWxfLzApaVcGv+G005YhJADrsM0MC30QIMzYgv2lPnOS6Gbqu9XNjEWbd+/TpBDO4mXL5p8+YvxYC0Dg4NDS5aL73i8osCnYT59oAYf+OzN9eIAZsrCl//3a8/rgEzLBbd07r07opYbnNV5cNPvrgP6p/KS0CnyTcohS5D44C83Wp4LsesGDXHZLJWEy8dBzTFCOC3VmFAA+gSroWjOu66Q5zgrBSPmq1GiD2YWaFoi1HyjXkk5ZYtCmd22lM6pt/v+8nJz1XfM03PV0+oKhVeWn36aUOQtuGXjKoUeGaL/EA0SIj20jbjyrrjSQjGKOm/ohAtZcy9bqQ0okzzVNpRYsou/Oou7ajcryoFWsJ2BLC5aADdDNjkEWUu5XUGfL2M9SB2M7lgjP4PXvKb7hfNiWxfX3bChB0vaTYPKozZnqf0Vyr9Rr9v5tPpTvJimCfNoq9P7Ny+fecEYDUveeDxB65TPM9mTOm/c+ud/UCYUdi0if4P6ACV9ECTaRAcofJIolRIjCQwmp7Gt03fRjbMvU42LLx5f9CX4c1TkQMVPwRzS4twywmX1XGi3fIcWQCyGAQUA13MbR1IxOhYKhemvsAoME+eNIP7hDgpBnPipFUVYhD0nBR7cil8IBXumKsIoTxE0MPcmvv9nBsPn4uC1MCZfqFvke9RFqF4sYZlo4L3snuqkULDgwywUgE6DcO3xA3F0qbCajUkn0rZOazyg9xhBt+miWqIPwxXrAg7V4ZV9gzr8TL/K72L2lDjNdgKVoL2tri4fMHLgFamP4Jdx7CsCoAJegvKguwJ7c77ln04iKLgsG3ha+zwh6tXkhjmmWw2w3GMrLyanJ5bkXTUQ0oU4HymrBxSnc4j1+4uYkLGCWaZtTeuzTAMOsHF3TJNFpxpTwzRB5GCEtCrS2gF9OvVaC1aj25H96D70aNoP+RFNhHZNLi3oC0ppUWlcmGlfWEFkHWbG7xxvDuCdwqGlb8P/9VLd5BYLE7pEzFNUTT+FhO6LvSPeMqyUtZrapBMBsmdeuh5oVcwyr5f9ketwWx2MPtQolYo1ApHnJFyudn/lRqY2eXLs2aguh9rfdk+zauGAuSzei6f05fVizbI641CMW8EI/2JguFPxlgM/gdiis65voEZtq7bivCE8G5VnYzjZJ43lsGty79rZqJMJnpbhIP5/OC+ZGm4VBoedyqtKGo5ml5dVdU1b9V23TD09FU1bIJ82zBNIxhvmIY/fsq0LLPvhhYWRt8N3dr8iD5Lx5COkIpZt2zScBvoo3OqlUxa5KyJ7+3coeiCXi90BTQXUvwX6KWTiAB4nGNgZGBgAGLW8J118fw2Xxm4WRhA4JFfoC+M/v//fwMLA3MjkMvBwAQSBQAjSQrvAAAAeJxjYGRgYG7438AQw8Lw/z8DAwsDA1AEBfACAHXkBHR4nGNhYGBggeP//yEYWQwTAwCTVgQxAAAAAAAAAJgBNAGaAhgChgL+AxIDXAOKA9QEqgTGeJxjYGRgYOBlmMrAxwACTEDMBYQMDP/BfAYAGXgBxwB4nIWRPW7CQBCFn8GQBJQoSqQ0aVYpKBLJ/JRIqVCgp6AHs+ZHttdaL0jUOU2OkBPkCOloc4pIedhDA0W82tlv3r6ZHckA7rCHh/K75y7ZwyWzkiu4wKNwlfqTsE9+Fq6hiZ5wnfqrcAMveBNusmPGDp5/xayFd2EPt/gQruAGn8JV6l/CPvlbuIYH/AjXqf8KNzDxroWbaHnhwOqp03M126lVaNLIpO54jvViE0/tqTzRNl+ZVHWDzlEa6VTbY5t8u+g5F6nImkQNeavj2KjMmrUOXbB0Luu325HoQWgSDGChMYVjnENhhh3jCiEMUkRFdGf5mO4FNohZaf91T+i2yKkfcoUuAnTOXCO60sJ5Ok2OLV/rUXV0K27LmoQ0lFrNSWKy4g883K2phNQDLIuqDH20uaITf1DMkPwB2JNvV3icbUxLDsIgFGRqK7S2Gg/Cxot4BlJAq/RBSkjk9mLrwoWzmW+GVWxDx/5jQIUdajTYg0OgRYcDegw4srNNzsVxMYZkvC8TPX8T8wqKtIg+kb5ayzdB7crSWyu+ipqgUjT9Y6JbnkiOPmQRinGJLqfo19Vcis85d17p0tXBqczYG/CnMGsAAAA=\') format(\'woff\'),\n url(\'data:font/ttf;base64,AAEAAAALAIAAAwAwR1NVQiCLJXoAAAE4AAAAVE9TLzI8ik1PAAABjAAAAGBjbWFw8LA+0QAAAiAAAAJCZ2x5ZmYzzj4AAASAAAAJjGhlYWQnuuaYAAAA4AAAADZoaGVhB90DjgAAALwAAAAkaG10eDQB//4AAAHsAAAANGxvY2EP/hJAAAAEZAAAABxtYXhwASUAoQAAARgAAAAgbmFtZRCjPLAAAA4MAAACZ3Bvc3RzHFinAAAQdAAAAMAAAQAAA4D/gABcBAD//wAABAAAAQAAAAAAAAAAAAAAAAAAAA0AAQAAAAEAAAVXuX5fDzz1AAsEAAAAAADiTlFNAAAAAOJOUU3///+ABAADgQAAAAgAAgAAAAAAAAABAAAADQCVAA4AAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAQEAAGQAAUAAAKJAswAAACPAokCzAAAAesAMgEIAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAwOZ16n8DgP+AAAAD3ACAAAAAAQAAAAAAAAAAAAAAAAACBAAAAAQAAAAEAAAABAD//wQA//8EAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAUAAAADAAAALAAAAAQAAAGiAAEAAAAAAJwAAwABAAAALAADAAoAAAGiAAQAcAAAABIAEAADAALmduaE5o7mnOam5vnokep///8AAOZ15oTmjeab5qbm+eiR6n7//wAAAAAAAAAAAAAAAAAAAAAAAQASABQAFAAWABgAGAAYABgAAAACAAEACQAFAAYAAwAEAAcADAALAAoACAAAAQYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAAAAoAAAAAAAAAAMAADmdQAA5nUAAAACAADmdgAA5nYAAAABAADmhAAA5oQAAAAJAADmjQAA5o0AAAAFAADmjgAA5o4AAAAGAADmmwAA5psAAAADAADmnAAA5pwAAAAEAADmpgAA5qYAAAAHAADm+QAA5vkAAAAMAADokQAA6JEAAAALAADqfgAA6n4AAAAKAADqfwAA6n8AAAAIAAAAAAAAAJgBNAGaAhgChgL+AxIDXAOKA9QEqgTGAAQAAP/3A44DDAAaADUAUQBtAAABIyIGFBY7ATI3Njc2PQE0JiIGHQEnJiIGFBcBMzI2NCYrASIHBgcGHQEUFjI2PQEXFjI2NCclJicmKwEiBhQWOwEHBhQWMj8BFRQWMjY9AS4BNxYXFjsBMjY0JisBNzY0JiIPATU0JiIGHQEeAQE6iQ0TEw3VCQIPAgITGhO3ChkUCgI3iQ0TEw3VCQIPAgITGhPICR4SCv4vBwoEB9cNExMNickKEx0JyBQZEwECqAcKBAbWDRMTDYm8ChQZCrwTGRQCAgIaFBkTAgcKBAbWDRMTDYm+ChMaCv4gFBkTAgcKBAfVDRMTDYnJCBIZCvMPAgITGRTIChkTCcmJDRMTDdUCCc0PAgITGRS7ChoTCryJDRMTDdUDCAAAAAAEAAD/9QONAwsAGwA3AFIAcQAAEzI2PQEXFjI2NC8BMzI2NCYrASIHBgcGHQEUFgUiBh0BJyYiBhQfASMiBhQWOwEyNzY3Nj0BNiYlBzU0JiIGHQEUFxYXFjsBMjY0JisBNzY0JgYBNDUVJicmKwEiBhQWOwEHBhQWMj8BFRQWMjY9AScmlQ0TvAkdEwq8hwwUFAzWCAIMCAIUAuINE8kJGhMJyYkMFBQM1ggCDwIDARL+BskTGRQCCAoEBtYMFBQMickJExcCAQcLBAbYDBQUDIm8CRIeCLwTGhMCAQH1FAyJvAgSGQq8ExkUAgYMBAjWDBTqFAyJyQkTGgnJExkUAggKBAbYDBQiyYcMFBQM1ggCDwIDFBkTyQoZEwEBwAEBAg4DAxQZE7wKGRMJvIcMFBQM1gUEAAAD////swPSA00AGQAgAEEAAAEiBwYPASMiBhURFBY7ARcWFxYzMjY1ETQmAy8BIxEzNwE3Ni4BBg8BJy4BBw4BHwEHBhYXFjMyPwEXFjMyNz4BJwH7CgoGCuafIy8vI5/mCgYKChggIUWaH66uuQGKbAsGHy0LV1cNKRIQBgxrawwHDxQLGw5XVw0cChQRCA4DTQMCBcMvI/6pJjHDBQIDHxoDLhYd/QCAGQE0mf7NlBQpFwcPe3sQCQ8LKRSUlBAtCwoUe3sUCgwpEwAE////swPsA00AGQAgADgAUQAAASIHBg8BIyIGFREUFjsBFxYXFjMyNjURNCYDLwEjETM3JSYGBwYWFx4BFAYHDgEXHgEyNjc+ATQmByYGBwYWFx4BFRQGBw4BFx4BMjY3PgE0JgH7CgoGCuafIy8vI5/mCgYKChggIUWaH66uuQFmECgPEAITSVBQSQ8CDAcUERQHWGFhzg8pDxACEyotLSoPAgwHFBEUBzk9PANNAwIFwy8j/qkmMcMFAgMfGgMuFh39AIAZATSZcRACExApD0azxrRFDykQBwgIB1Dc8OFFEAITDykPJmc2OWMnDygQBwkJBzGLm40AAAADAAAAAAOrAtcAFQA6AEYAAAE3NjIWFAcBBiImND8BJy4BPgIWFwUVFAYiJjURNDY7ATc+AR4BFREUDgEmLwEuAT4CFh8BEQcGIwUmNDYyHwEWFAYiJwMAYgwjGQz/AAwjGQxiYggHBhAXFgj+DRkkGRkSccoJGRYNDRYZCdYJCQMPFhcJkJAMDwI3DBkjDCsMGSMMAbxiDBkjDP8ADBkjDGJiCBYXEAYHCEnVEhkZEgEAEhmhCAIKFQz9qgwVCgIIqwcVFxMIBAhzAaRzCsgMIxkMKwwjGQwAAAAAAwAAAAADuQLXABQAKQBOAAABJjQ2MhcWFxYHBgcGIiY0Nz4BNCYHLgE+AhYXHgEUBgcGIiY0Nz4BJgUVFAYiJjURNDY7ATc+AR4BFREUDgEmLwEuAT4CFh8BEQcGIwLxCxkiDVIdHBwdUg0jGQwwNDSoCAYGEBYWCCQnJyQMJBkNIBcX/hIZJBkZEnHKCRkWDQ0WGQnWCQkDDxYXCZCQDA8CcQ0iGQtScGxscFIMGSMNMH2IfUgIFhYQBgYIJF5mXiQNGSQMIVhYA9USGRkSAQASGaEIAgoVDP2qDBUKAgirBxUXEwgECHMBpHMKAAAAAgAAAAADAAKrAAMABwAAJTMRIyERMxEBAKurAVWrVQJW/aoCVgAAAAQAAP/2A6ADCwAJABMAIAAtAAAlIyImNRE0NjsBJREUBi8BETc2FhMmND8BNjIWFA8BBiIDNjIfARYUBiIvASY0AQDNFR4fFcwBABoN2dkNGm8PD9kPKh4P2Q4rDw8qD9kPHioP2Q+AHhUBmRUfbf0nDw8IggIAgwcO/fMPKg/ZDx4qD9kPATEPD9kPKh4P2Q4rAAABAAD/7QO1At8AHQAABSIuAT0BNCYrASImNRE0NjMhMhYVERQGIyEiDwEGAVEFDAgOCnsfKysfAsUfKysf/rAJB6gHEwYMB2sKDysfAcAfLCwf/kAfKwaRBgAAAAIAAP/wA2ADEAAVAC4AAAERFAYnJSYrASImNRE0NjsBMjclNhYTFAYHBiY9ATQ/AT4BNCYvASY9ATQ2Fx4BAoAfEP69DhCwGiYmGrAQDgFDEB/gQjgCBAEHGx0dGwcBBAI4QgLq/SwSEwmuCCYaASAbJQiuCRP+hER0IgECAkYCAQYbR0xHGwYBAkYCAgEidAAAAAAOAAD/gAQAA4EACAARABoAIwAsADUAPgBHAFAAWQBnAHYAhQCUAAAlMjY0JiIGFBYHFjI2NCYiBhQHFjI2NCYiBhQjFjI2NCYiBhQnFjI2NCYiBhQnFjI2NCYiBhQnFjI2NCYiBhQ3FjI2NCYiBhQ3FjI2NCYiBhQ3FjI2NCYiBhQXHgEzMjY0JiMiBgcGFBceATI2NzY0JiciBgcGFBceATI2NzY0JiMiBgcGFBceATI2NzY0JiciBgcGFANtAgQEBQMDigQKCAgKB7UGDwsLDwvBBxUODhUOqQkaEhIaEnALHxYWHxYhDCUZGSUZNQ4qHR0qHYIRLiEhLiG5EzMlJTQk0AkaDR0oKB0NGgkUwgocHRwKFisfDxwKFpILHiAeCxgvIhAeCxhKDCEiIAwaMyQRIQwZcQQGBAQGBJkECAsHBwtWBgwQCwsQCA8WDw8WVAkTGxMTG5YMGCAXFyC4DRsmGxsmtg8fKiAgKo0SIzEjIzFGEyc2JiY2EwoLKzsrCwoWO2wLDAwLF0EuAQ0LF0G2DA0NDBpGMg0MGUbmDQ4ODRxLNgEPDBxLAAEAAP/BA5IDPwALAAAJAQYmNRE0NhcBFhQDhf0JDhISDgL3DQFu/lsICw8DSg8LCP5bCBQAAAAAAAASAN4AAQAAAAAAAAATAAAAAQAAAAAAAQAIABMAAQAAAAAAAgAHABsAAQAAAAAAAwAIACIAAQAAAAAABAAIACoAAQAAAAAABQALADIAAQAAAAAABgAIAD0AAQAAAAAACgArAEUAAQAAAAAACwATAHAAAwABBAkAAAAmAIMAAwABBAkAAQAQAKkAAwABBAkAAgAOALkAAwABBAkAAwAQAMcAAwABBAkABAAQANcAAwABBAkABQAWAOcAAwABBAkABgAQAP0AAwABBAkACgBWAQ0AAwABBAkACwAmAWNDcmVhdGVkIGJ5IGljb25mb250aWNvbmZvbnRSZWd1bGFyaWNvbmZvbnRpY29uZm9udFZlcnNpb24gMS4waWNvbmZvbnRHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AGkAYwBvAG4AZgBvAG4AdABSAGUAZwB1AGwAYQByAGkAYwBvAG4AZgBvAG4AdABpAGMAbwBuAGYAbwBuAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG4AZgBvAG4AdABHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQEOABFmdWxsc2NyZWVuLXNocmluaxFmdWxsc2NyZWVuLWV4cGFuZAhzb3VuZE9mZgdzb3VuZE9uCXNvdW5kLW9mZghzb3VuZC1vbgVwYXVzZQxqaW5neWluLWNvcHkIcGluZ2x1bjIPc29vdW5kLW1pbi1mdWxsB2xvYWRpbmcEcGxheQAA\') format(\'truetype\');\n}\n\n.iconfont {\n font-family: "iconfont" !important;\n font-size: 16px;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-fullscreen-shrink:before {\n content: "\\e676";\n}\n\n.icon-fullscreen-expand:before {\n content: "\\e675";\n}\n\n.icon-soundOff:before {\n content: "\\e69b";\n}\n\n.icon-soundOn:before {\n content: "\\e69c";\n}\n\n.icon-sound-off:before {\n content: "\\e68d";\n}\n\n.icon-sound-on:before {\n content: "\\e68e";\n}\n\n.icon-pause:before {\n content: "\\e6a6";\n}\n\n.icon-jingyin-copy:before {\n content: "\\ea7f";\n}\n\n.icon-pinglun2:before {\n content: "\\e684";\n}\n\n.icon-soound-min-full:before {\n content: "\\ea7e";\n}\n\n.icon-loading:before {\n content: "\\e891";\n}\n\n.icon-play:before {\n content: "\\e6f9";\n}\n.jy-player {\n background-color: #000;\n position: relative;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n}\n.jy-player .player-controller {\n position: absolute;\n bottom: -100%;\n left: 0;\n width: 100%;\n z-index: 999;\n padding: 10px;\n background-color: rgba(0, 0, 0, 0.5);\n color: #eee;\n transition: bottom 0.3s;\n}\n.jy-player .player-controller .progress {\n position: relative;\n height: 4px;\n background-color: rgba(255, 255, 255, 0.4);\n cursor: pointer;\n overflow: visible;\n --percent: 0;\n}\n.jy-player .player-controller .progress::before {\n content: "";\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: var(--percent, 0);\n background-color: rgba(255, 255, 255, 0.8);\n transition: all 200ms;\n}\n.jy-player .player-controller .progress::after {\n content: "";\n display: none;\n position: absolute;\n top: 50%;\n left: var(--percent, 0);\n height: 10px;\n width: 10px;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n background-color: #ffffff;\n transition: all 200ms;\n}\n.jy-player .player-controller .progress:hover::after {\n display: block;\n}\n.jy-player .player-controller .controller-row {\n margin-top: 10px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.jy-player .player-controller .controller-row > div {\n display: flex;\n align-items: center;\n}\n.jy-player .player-controller .iconfont {\n font-size: 24px;\n cursor: pointer;\n}\n.jy-player .player-controller .iconfont + .iconfont {\n margin-left: 10px;\n}\n.jy-player .player-controller .video-time {\n margin-left: 10px;\n}\n.jy-player .player-center {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #eee;\n z-index: 10;\n}\n.jy-player .player-center .icon-loading {\n display: block;\n font-size: 48px;\n animation: rotateInfinite 1.2s infinite linear;\n}\n.jy-player .player-center .error-text {\n display: none;\n padding: 15px;\n border-radius: 5px;\n background-color: rgba(0, 0, 0, 0.5);\n}\n.jy-player .player-center .icon-play,\n.jy-player .player-center .icon-pause {\n display: none;\n opacity: 0.6;\n font-size: 64px !important;\n cursor: pointer;\n}\n.jy-player .player-center.loading .icon-play,\n.jy-player .player-center.loading .icon-pause {\n display: none !important;\n}\n.jy-player.active .player-center .icon-pause,\n.jy-player.active .player-center .icon-play {\n display: block;\n}\n.jy-player.active .player-controller {\n display: block;\n bottom: 0;\n}\n@keyframes rotateInfinite {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n', {} ); var ip = { exports: {} }; !(function (t, e) { t.exports = (function (t) { function e(i) { if (n[i]) return n[i].exports; var r = (n[i] = { i: i, l: !1, exports: {} }); return t[i].call(r.exports, r, r.exports, e), (r.l = !0), r.exports; } var n = {}; return ( (e.m = t), (e.c = n), (e.i = function (t) { return t; }), (e.d = function (t, n, i) { e.o(t, n) || Object.defineProperty(t, n, { configurable: !1, enumerable: !0, get: i }); }), (e.n = function (t) { var n = t && t.__esModule ? function () { return t.default; } : function () { return t; }; return e.d(n, "a", n), n; }), (e.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e); }), (e.p = ""), e((e.s = 5)) ); })([ function (t, e, n) { function i() { var t = {}, e = !1, n = 0, r = arguments.length; for ( "[object Boolean]" === Object.prototype.toString.call(arguments[0]) && ((e = arguments[0]), n++); n < r; n++ ) !(function (n) { for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e && "[object Object]" === Object.prototype.toString.call(n[r]) ? (t[r] = i(!0, t[r], n[r])) : (t[r] = n[r])); })(arguments[n]); return t; } e.a = i; }, function (t, e) { !(function () { var e = "undefined" != typeof window && void 0 !== window.document ? window.document : {}, n = void 0 !== t && t.exports, i = (function () { for ( var t, n = [ [ "requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror" ], [ "webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror" ], [ "webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror" ], [ "mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror" ], [ "msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError" ] ], i = 0, r = n.length, a = {}; i < r; i++ ) if ((t = n[i]) && t[1] in e) { for (i = 0; i < t.length; i++) a[n[0][i]] = t[i]; return a; } return !1; })(), r = { change: i.fullscreenchange, error: i.fullscreenerror }, a = { request: function (t, n) { return new Promise( function (r, a) { var s = function () { this.off("change", s), r(); }.bind(this); this.on("change", s); var o = (t = t || e.documentElement)[i.requestFullscreen](n); o instanceof Promise && o.then(s).catch(a); }.bind(this) ); }, exit: function () { return new Promise( function (t, n) { if (this.isFullscreen) { var r = function () { this.off("change", r), t(); }.bind(this); this.on("change", r); var a = e[i.exitFullscreen](); a instanceof Promise && a.then(r).catch(n); } else t(); }.bind(this) ); }, toggle: function (t, e) { return this.isFullscreen ? this.exit() : this.request(t, e); }, onchange: function (t) { this.on("change", t); }, onerror: function (t) { this.on("error", t); }, on: function (t, n) { var i = r[t]; i && e.addEventListener(i, n, !1); }, off: function (t, n) { var i = r[t]; i && e.removeEventListener(i, n, !1); }, raw: i }; i ? (Object.defineProperties(a, { isFullscreen: { get: function () { return Boolean(e[i.fullscreenElement]); } }, element: { enumerable: !0, get: function () { return e[i.fullscreenElement]; } }, isEnabled: { enumerable: !0, get: function () { return Boolean(e[i.fullscreenEnabled]); } } }), n ? (t.exports = a) : (window.screenfull = a)) : n ? (t.exports = { isEnabled: !1 }) : (window.screenfull = { isEnabled: !1 }); })(); }, function (t, e, n) { function i(t, e) { (t.style.position = e.position), (t.style.left = e.left), (t.style.top = e.top), (t.style.width = e.width), (t.style.height = e.height); } function r(t) { var e = t.element; e && (e.classList.remove(t.options.fullscreenClass), (t.options.teleport || t.options.pageOnly) && (t.options.teleport && c && (c.insertBefore(e, d), c.removeChild(d)), e.__styleCache && i(e, e.__styleCache))); } var a = n(1), s = n.n(a), o = n(0), l = { callback: function () { }, fullscreenClass: "fullscreen", pageOnly: !1, teleport: !1 }, d = void 0, c = void 0, u = { options: null, element: null, isFullscreen: !1, isEnabled: s.a.isEnabled, toggle: function (t, e, n) { return void 0 === n ? this.isFullscreen ? this.exit() : this.request(t, e) : n ? this.request(t, e) : this.exit(); }, request: function (t, e) { var a = this; if (this.isFullscreen) return Promise.resolve(); if ( (t || (t = document.body), (this.options = n.i(o.a)({}, l, e)), t === document.body && (this.options.teleport = !1), s.a.isEnabled || (this.options.pageOnly = !0), t.classList.add(this.options.fullscreenClass), this.options.teleport || this.options.pageOnly) ) { var u = t.style, h = u.position, p = u.left, f = u.top, m = u.width, g = u.height; (t.__styleCache = { position: h, left: p, top: f, width: m, height: g }), i(t, { position: "fixed", left: "0", top: "0", width: "100%", height: "100%" }); } if ( (this.options.teleport && (c = t.parentNode) && ((d = document.createComment("fullscreen-token")), c.insertBefore(d, t), document.body.appendChild(t)), this.options.pageOnly) ) { var y = function t(e) { "Escape" === e.key && (document.removeEventListener("keyup", t), a.exit()); }; return ( (this.isFullscreen = !0), (this.element = t), document.removeEventListener("keyup", y), document.addEventListener("keyup", y), this.options.callback && this.options.callback(this.isFullscreen), Promise.resolve() ); } var A = function e() { s.a.isFullscreen || (s.a.off("change", e), r(a)), (a.isFullscreen = s.a.isFullscreen), a.options.teleport ? (a.element = t || null) : (a.element = s.a.element), a.options.callback && a.options.callback(s.a.isFullscreen); }; return s.a.on("change", A), s.a.request(this.options.teleport ? document.body : t); }, exit: function () { return this.isFullscreen ? this.options.pageOnly ? (r(this), (this.isFullscreen = !1), (this.element = null), this.options.callback && this.options.callback(this.isFullscreen), Promise.resolve()) : s.a.exit() : Promise.resolve(); } }; (u.support = u.isEnabled), (u.getState = function () { return u.isFullscreen; }), (u.enter = u.request), (e.a = u); }, function (t, e, n) { function i(t, e) { var n = {}; for (var i in t) e.indexOf(i) >= 0 || (Object.prototype.hasOwnProperty.call(t, i) && (n[i] = t[i])); return n; } var r = n(2), a = n(0), s = function (t, e) { var s = function () { var t = void 0, s = { teleport: e.modifiers.teleport, pageOnly: e.modifiers.pageOnly }; if (e.value) if ("string" == typeof e.value) t = e.value; else { var o = e.value, l = o.target, d = i(o, ["target"]); (t = l), (s = n.i(a.a)(s, d)); } "string" == typeof t && (t = document.querySelector(t)), r.a.toggle(t, s); }; t._onClickFullScreen && t.removeEventListener("click", t._onClickFullScreen), t.addEventListener("click", s), (t._onClickFullScreen = s); }; e.a = s; }, function (t, e, n) { var i = n(7)(n(6), n(8), null, null); t.exports = i.exports; }, function (t, e, n) { Object.defineProperty(e, "__esModule", { value: !0 }); var i = n(4), r = n.n(i), a = n(2), s = n(3), o = n(1), l = n.n(o), d = n(0); n.d(e, "screenfull", function () { return l.a; }), n.d(e, "api", function () { return a.a; }), n.d(e, "directive", function () { return s.a; }), n.d(e, "component", function () { return r.a; }), (e.default = { install: function (t) { var e = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).name || "fullscreen"; t.component(e, n.i(d.a)(r.a, { name: e })), (t.prototype["$" + e] = a.a), t.directive(e, s.a); } }); }, function (t, e, n) { Object.defineProperty(e, "__esModule", { value: !0 }); var i = n(1), r = n.n(i); e.default = { props: { value: { type: Boolean, default: !1 }, fullscreen: { type: Boolean, default: !1 }, exitOnClickWrapper: { type: Boolean, default: !0 }, fullscreenClass: { type: String, default: "fullscreen" }, pageOnly: { type: Boolean, default: !1 }, teleport: { type: Boolean, default: !1 } }, data: function () { return { isFullscreen: !1, isEnabled: !1 }; }, computed: { support: function () { return this.isEnabled; }, isPageOnly: function () { return this.pageOnly || !r.a.isEnabled; }, wrapperStyle: function () { return (this.isPageOnly || this.teleport) && this.isFullscreen ? { position: "fixed", left: "0", top: "0", width: "100%", height: "100%" } : void 0; } }, methods: { toggle: function (t) { void 0 === t ? (this.isFullscreen ? this.exit() : this.request()) : t ? this.request() : this.exit(); }, request: function () { if ( (this.isPageOnly ? ((this.isFullscreen = !0), this.onChangeFullScreen(), document.removeEventListener("keyup", this.keypressCallback), document.addEventListener("keyup", this.keypressCallback)) : (r.a.off("change", this.fullScreenCallback), r.a.on("change", this.fullScreenCallback), r.a.request(this.teleport ? document.body : this.$el)), this.teleport) ) { if (this.$el.parentNode === document.body) return; (this.__parentNode = this.$el.parentNode), (this.__token = document.createComment("fullscreen-token")), this.__parentNode.insertBefore(this.__token, this.$el), document.body.appendChild(this.$el); } }, exit: function () { this.isFullscreen && (this.isPageOnly ? ((this.isFullscreen = !1), this.onChangeFullScreen(), document.removeEventListener("keyup", this.keypressCallback)) : r.a.exit()); }, shadeClick: function (t) { t.target === this.$el && this.exitOnClickWrapper && this.exit(); }, fullScreenCallback: function () { r.a.isFullscreen || r.a.off("change", this.fullScreenCallback), (this.isFullscreen = r.a.isFullscreen), this.onChangeFullScreen(); }, keypressCallback: function (t) { "Escape" === t.key && this.exit(); }, onChangeFullScreen: function () { this.isFullscreen || (this.teleport && this.__parentNode && (this.__parentNode.insertBefore(this.$el, this.__token), this.__parentNode.removeChild(this.__token))), this.$emit("change", this.isFullscreen), this.$emit("update:fullscreen", this.isFullscreen), this.$emit("input", this.isFullscreen); }, enter: function () { this.request(); }, getState: function () { return this.isFullscreen; } }, watch: { value: function (t) { t !== this.isFullscreen && (t ? this.request() : this.exit()); }, fullscreen: function (t) { t !== this.isFullscreen && (t ? this.request() : this.exit()); } }, created: function () { this.isEnabled = r.a.isEnabled; } }; }, function (t, e) { t.exports = function (t, e, n, i) { var r, a = (t = t || {}), s = u(t.default); ("object" !== s && "function" !== s) || ((r = t), (a = t.default)); var o = "function" == typeof a ? a.options : a; if ((e && ((o.render = e.render), (o.staticRenderFns = e.staticRenderFns)), n && (o._scopeId = n), i)) { var l = Object.create(o.computed || null); Object.keys(i).forEach(function (t) { var e = i[t]; l[t] = function () { return e; }; }), (o.computed = l); } return { esModule: r, exports: a, options: o }; }; }, function (t, e) { t.exports = { render: function () { var t, e = this, n = e.$createElement; return (e._self._c || n)( "div", e._b( { ref: "wrapper", class: ((t = {}), (t[e.fullscreenClass] = e.isFullscreen), t), style: e.wrapperStyle, on: { click: function (t) { return e.shadeClick(t); } } }, "div", e.$attrs, !1 ), [e._t("default")], 2 ); }, staticRenderFns: [] }; } ]); })(ip); var rp = ip.exports, ap = function (t) { t = Math.round(t); var e = Math.floor(t % 60), n = Math.floor((t / 60) % 60), i = Math.floor(t / 3600), r = "".concat(n, ":").concat(e.toString().padStart(2, "0")); return i && (r = "".concat(i, ":").concat(r)), r; }, sp = (function (t) { function e(t) { var i, r = t.container, a = t.emitter, s = t.Player; if ((f(this, e), g((i = n(this, e, [{ emitter: a }])), "fullscreen", !1), !r)) throw new Error("container不能为空"); return (i.container = r), (i.Player = s), i.init(), i.registryEvents(), i; } return ( y(e, t), m(e, [ { key: "init", value: function () { var t = this; if ( ((this.loadingEl = document.createElement("span")), this.loadingEl.classList.add("iconfont", "icon-loading"), (this.playerCenter = document.createElement("span")), this.playerCenter.classList.add("player-center", "loading"), this.playerCenter.append(this.loadingEl), (this.errorText = document.createElement("span")), this.errorText.classList.add("error-text"), this.playerCenter.append(this.errorText), this.container.append(this.playerCenter), this.Player.config.controls) ) { (this.controllerWrap = document.createElement("div")), this.controllerWrap.classList.add("player-controller"), (this.progressBar = document.createElement("div")), this.progressBar.classList.add("progress"), this.progressBar.addEventListener("click", function (e) { e.stopPropagation(); var n = e.offsetX, i = e.target.offsetWidth, r = n / i, a = Math.floor(t.Player.duration * r); t.Logger.log("progressBar", n, i, a, r), (t.Player.currentTime = a); var s = t.Player, o = s.currentTime, l = s.duration; t.updateProgress({ currentTime: o, duration: l }); }), (this.progressHandler = document.createElement("div")), this.progressHandler.classList.add("progress-handler"), this.progressBar.append(this.progressHandler), this.controllerWrap.append(this.progressBar), (this.playBtn = document.createElement("span")), this.playBtn.classList.add("iconfont", "icon-play"); var e = function (e) { if ((e.stopPropagation(), t.Player.ended)) { var n = t.Player; n.currentTime; var i = n.duration; return ( t.updatePlayTime({ currentTime: 0, duration: i }), t.updateProgress({ currentTime: 0, duration: i }), void t.Player.play() ); } t.Player.paused ? t.Player.play() : t.Player.pause(); }; (this.centerPlayBtn = this.playBtn.cloneNode()), this.playerCenter.append(this.centerPlayBtn), this.centerPlayBtn.addEventListener("click", e), this.playBtn.addEventListener("click", e), (this.timeView = document.createElement("span")), this.timeView.classList.add("video-time"); var n = document.createElement("div"); n.append(this.playBtn), n.append(this.timeView), (this.muteBtn = document.createElement("span")), this.muteBtn.classList.add("iconfont", "icon-sound-on"), this.muteBtn.addEventListener("click", function (e) { e.stopPropagation(), (t.Player.muted = !t.Player.muted); }), (this.resolutionBtn = document.createElement("span")), this.resolutionBtn.classList.add("video-resolution"), (this.fullscreenBtn = document.createElement("span")), this.fullscreenBtn.classList.add("iconfont", "icon-fullscreen-expand"), this.fullscreenBtn.addEventListener("click", function (e) { e.stopPropagation(), t.toggleFullscreen(); }); var i = document.createElement("div"); i.append(this.muteBtn), i.append(this.fullscreenBtn); var r = document.createElement("div"); r.classList.add("controller-row"), r.append(n), r.append(i), this.controllerWrap.append(r), this.container.append(this.controllerWrap); } } }, { key: "registryEvents", value: function () { var t = this; this.Emitter.on("canplay", function () { t.Logger.log("MediaController::canplay"), (t.loadingEl.style.display = "none"), (t.errorText.style.display = "none"), t.playerCenter.classList.remove("loading"); }), this.Emitter.on("loading", function () { t.Logger.log("MediaController::loading"), (t.loadingEl.style.display = "block"), t.playerCenter.classList.add("loading"); }), this.Emitter.on("error", function (e) { var n, i; if ( (t.Logger.log("MediaController::error", e), Gu(null == e ? void 0 : e.fatal) || (null != e && e.fatal)) ) { var r = null !== (n = null == e || null === (i = e.error) || void 0 === i ? void 0 : i.message) && void 0 !== n ? n : "视频播放失败"; (t.errorText.innerText = r), (t.errorText.style.display = "block"), (t.loadingEl.style.display = "none"); } }), this.Player.config.controls && (this.Emitter.on("DURATIONCHANGE", function () { var e = t.Player, n = e.currentTime, i = e.duration; t.updatePlayTime({ currentTime: n, duration: i }); }), this.Emitter.on("play", function () { t.togglePlayStyle(), t.timer && clearInterval(t.timer), (t.timer = setInterval(function () { var e = t.Player, n = e.currentTime, i = e.duration; t.updatePlayTime({ currentTime: n, duration: i }), t.updateProgress({ currentTime: n, duration: i }); }, 1e3)); }), this.Emitter.on("pause", function () { t.togglePlayStyle(), clearInterval(t.timer); }), this.Emitter.on("ended", function () { t.togglePlayStyle(), clearInterval(t.timer); var e = t.Player; e.currentTime; var n = e.duration; t.updatePlayTime({ currentTime: n, duration: n }), t.updateProgress({ currentTime: n, duration: n }); }), this.Emitter.on("VOLUMECHANGE", this.toggleMutedStyle.bind(this))); } }, { key: "updateProgress", value: function (t) { var e = t.currentTime, n = t.duration, i = (function (t) { var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0; return Math.round(t * Math.pow(10, e + 2)) / Math.pow(10, e) + "%"; })(Math.min(e / n, 1), 2); this.progressBar.style.setProperty("--percent", i); } }, { key: "updatePlayTime", value: function (t) { var e = t.currentTime, n = t.duration; this.timeView.innerText = "".concat(ap(e), " / ").concat(ap(n)); } }, { key: "toggleMutedStyle", value: function () { this.Player.muted ? (this.muteBtn.classList.remove("icon-sound-on"), this.muteBtn.classList.add("icon-sound-off")) : (this.muteBtn.classList.remove("icon-sound-off"), this.muteBtn.classList.add("icon-sound-on")); } }, { key: "togglePlayStyle", value: function () { this.Player.paused || this.Player.ended ? (this.playBtn.classList.remove("icon-pause"), this.playBtn.classList.add("icon-play"), this.centerPlayBtn.classList.remove("icon-pause"), this.centerPlayBtn.classList.add("icon-play")) : (this.playBtn.classList.remove("icon-play"), this.playBtn.classList.add("icon-pause"), this.centerPlayBtn.classList.remove("icon-play"), this.centerPlayBtn.classList.add("icon-pause")); } }, { key: "toggleFullscreen", value: ((i = p( d().mark(function t() { var e, n, i, r = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return ( this.Logger.log("toggleFullscreen"), (e = this.container), this.fullscreen || ((n = e.style.zIndex), (i = window.scrollY)), (t.next = 5), rp.api.toggle(e, { callback: function (t) { (r.fullscreen = t), !rp.api.isEnabled && zIndex && (e.style.zIndex = t ? zIndex : n), t || Gu(i) || window.scrollTo(0, i), t ? (r.fullscreenBtn.classList.remove( "icon-fullscreen-expand" ), r.fullscreenBtn.classList.add( "icon-fullscreen-shrink" )) : (r.fullscreenBtn.classList.remove( "icon-fullscreen-shrink" ), r.fullscreenBtn.classList.add( "icon-fullscreen-expand" )); } }) ); case 5: case "end": return t.stop(); } }, t, this ); }) )), function () { return i.apply(this, arguments); }) } ]) ); var i; })(Ph), op = (function (t) { function e(t) { var i, r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; f(this, e); var a = So(); g((i = n(this, e, [{ emitter: a }])), "config", { src: "", poster: "", autoplay: !0, loop: !1, autoDecode: !0, muted: !1, maxBufferLength: 10, debug: !1, workerUrl: "" }), i.init(r), (i.container = document.getElementById(t)), i.container.classList.add("jy-player", "active"), i.Logger.config({ prefix: "[media-player]::", debug: r.debug }), i.Logger.log("new MediaPlayer", t, i.container, r, i.config), (i.WorkerController = new tp({ emitter: a, Player: i })), i.WorkerController.init({ debug: r.debug, device: I, isMobile: B, isIphone: P }), (i.TimerController = new Zh({ emitter: a, Player: i })), (i.Loader = new bh({ emitter: a, logger: i.Logger })); var s = document.createElement("canvas"); return ( i.container.insertBefore(s, i.container.children[0]), (i.Canvas = new Jh({ canvas: s, emitter: a, width: i.container.offsetWidth, height: i.container.offsetHeight })), i.drawPoster(i.config.poster), (i.VideoController = new Uh({ emitter: a, Player: i })), (i.AudioController = new Wh({ emitter: a, Player: i, muted: r.muted })), (i.MediaController = new sp({ container: i.container, emitter: a, Player: i })), i.registerEvents(), i.getPlayList(), i ); } return ( y(e, t), m(e, [ { key: "init", value: ((s = p( d().mark(function t(e) { return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: (this.levels = []), (this.currentLevel = null), (this._nextLevel = null), (this.duration = 0), (this.destroyed = !1), (this.videoReady = !1), (this.audioReady = !0), (this.loading = !0), (this.seeked = !1), (this.paused = !0), (this.ended = !1), (this.autoplay = e.autoplay), Object.assign(this.config, e); case 13: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return s.apply(this, arguments); }) }, { key: "getPlayList", value: ((a = p( d().mark(function t() { var e, n, i, r, a, s; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: return (t.next = 2), this.Loader.getPlaylist({ src: this.config.src }); case 2: if ((e = t.sent)) { t.next = 5; break; } return t.abrupt("return"); case 5: if (((n = e.playlist), (i = e.duration), !(r = e.levels))) { t.next = 18; break; } return ( (this.levels = r), this.Emitter.emit(ah, jc(r, 5)), (this.currentLevel = 0), (this._nextLevel = 0), (a = r[this.currentLevel].url), (t.next = 14), this.Loader.getPlaylist({ src: a }) ); case 14: (s = t.sent), (i = s.duration), (n = s.playlist), (r[this.currentLevel].playlist = s.playlist); case 18: (this.duration = i), console.log("getPlayList", i), this.Emitter.emit(vh, i), this.Emitter.emit(ih, n); case 22: case "end": return t.stop(); } }, t, this ); }) )), function () { return a.apply(this, arguments); }) }, { key: "registerEvents", value: function () { var t = this; (this.addEventListener = function (e, n) { var i, r = "error" === e ? e : e.toUpperCase(); t.Emitter.on(r, function (a) { (r === i && r === mh) || ((i = r), n({ type: e, target: t, data: a })); }); }), (this.removeEventListener = this.Emitter.off), ["PLAY", "PAUSE", "SEEKED", "WAITING", "VOLUMECHANGE", "ERROR"].forEach(function (e) { t.Emitter.on(e, function (n) { return t.Emitter.emit(e.toLocaleLowerCase(), n); }); }), this.Emitter.on(rh, this.onFirstVideoFrame.bind(this)), this.Emitter.on(ch, this.onLoading.bind(this)), this.Emitter.on(hh, this.onCanplay.bind(this)), this.Emitter.on(gh, this.onEnded.bind(this)), this.Emitter.on(sh, function () { t.Logger.log(sh, t._nextLevel, t.currentLevel), t._nextLevel != t.currentLevel && ((t.currentLevel = t._nextLevel), t.Emitter.emit(dh, t.levels[t.currentLevel].name)); }), (this.containerClickHandler = function () { t.Logger.log("containerClickHandler::"), t.container.classList.toggle("active"); }), this.container.addEventListener("click", this.containerClickHandler), this.container.addEventListener("touchmove", function (t) { t.stopPropagation(), t.preventDefault(); }), document.addEventListener("visibilitychange", this.visibilityHandler.bind(this)); } }, { key: "removeEvents", value: function () { this.Emitter.all.clear(), this.container.removeEventListener("click", this.containerClickHandler), B && document.removeEventListener("visibilitychange", this.visibilityHandler); } }, { key: "visibilityHandler", value: function () { if ((this.Logger.log("visibilitychange", document.hidden), document.hidden)) { if (this.paused) return; this.pause(); } } }, { key: "togglePlay", value: function () { this.Logger.log("togglePlay", this.paused), this.paused ? this.play() : this.pause(); } }, { key: "onFirstVideoFrame", value: function (t) { this.config.poster ? t.close() : this.Canvas.draw(t); } }, { key: "onEnded", value: function () { if ( (this.Logger.log("onEnded"), (this.ended = !0), this.TimerController.stop(), this.AudioController.pause(), this.loop) ) return this.Emitter.emit("ended", { type: "ended", target: this }), void this.seek(0); (this.paused = !0), this.Emitter.emit("ended", { type: "ended", target: this }), this.Emitter.emit("pause", { type: "pause", target: this }); } }, { key: "play", value: function () { this.ended ? this.replay() : this.paused || this.loading ? ((this.paused = !1), this.config.autoDecode || (this.Logger.warn("未开始解码"), this.startDecode()), this.Logger.log("play()::paused:".concat(this.paused)), this.videoReady && this.audioReady ? ((this.loading = !1), this.AudioController.play(), this.TimerController.run()) : this.Logger.warn("音视频尚未就绪", this.loading, this.videoReady, this.audioReady)) : this.Logger.warn("当前视频已在播放中"); } }, { key: "replay", value: function () { this.Logger.log("replay::", this.paused, this.loading), this.TimerController.reset(), this.AudioController.reset(), (this.ended = !1), this.seek(0); } }, { key: "pause", value: function () { var t, e; (this.paused = !0), null === (t = this.TimerController) || void 0 === t || t.stop(), null === (e = this.AudioController) || void 0 === e || e.pause(), this.Emitter.emit(fh); } }, { key: "onLoading", value: function (t) { this.Logger.warn(ch, t, this.currentTime, this.TimerController.currentTime), (this.loading = !0), "video" == t ? (this.videoReady = !1) : (this.audioReady = !1), this.AudioController.pause(), this.TimerController.stopTime(), this.Emitter.emit("loading"); } }, { key: "onCanplay", value: function (t) { if ( ("video" == t ? (this.videoReady = !0) : (this.audioReady = !0), this.Logger.warn( hh, t, "videoReady:".concat(this.videoReady, ", audioReady:").concat(this.audioReady), this.autoplay ), this.videoReady && this.audioReady) ) { if ((this.Emitter.emit("canplay"), this.seeked || this.currentTime || !this.paused)) return ( this.Logger.log("onCanplay::play()", this.seeked, this.paused), (this.seeked = !1), void this.play() ); this.autoplay && (this.Logger.warn("onCanplay::autoplay"), this.play()); } } }, { key: "seek", value: function (t) { (this.seeked = !0), (this.loading = !0), (this.videoReady = !1), (this.audioReady = !1), this.Emitter.emit("loading"), t < this.duration ? (this.ended = !1) : (this.ended = !0), this.TimerController.seek(t), this.VideoController.seek(t), this.Emitter.emit(uh, t); } }, { key: "startDecode", value: function () { this.config.autoDecode = !0; } }, { key: "changeLevel", value: ((r = p( d().mark(function t(e) { var n, i, r; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (((n = this.levels[e]), (i = n.playlist))) { t.next = 8; break; } return (t.next = 5), this.Loader.getPlaylist({ src: n.url }); case 5: (r = t.sent), (i = r.playlist), (n.playlist = r.playlist); case 8: this.WorkerController.changePlaylist(i), this.Emitter.emit(oh, i), this.Emitter.emit(lh, e); case 11: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return r.apply(this, arguments); }) }, { key: "currentTime", get: function () { var t; return this.ended ? this.duration : null === (t = this.AudioController) || void 0 === t ? void 0 : t.currentTime; }, set: function (t) { this.seek(t); } }, { key: "nextLevel", set: function (t) { this.levels.length && this.currentLevel !== t && this._nextLevel !== t && ((this._nextLevel = t), this.changeLevel(t)); } }, { key: "buffered", get: function () { return this.VideoController.decodedTime; } }, { key: "muted", get: function () { var t; return null === (t = this.AudioController) || void 0 === t ? void 0 : t.muted; }, set: function (t) { (this.AudioController.muted = t), this.Emitter.emit(Ah); } }, { key: "loop", get: function () { return this.config.loop; }, set: function (t) { Uu(t) && (this.config.loop = t); } }, { key: "drawPoster", value: function (t) { if (t) try { this.Canvas.drawImageBySrc(t); } catch (t) { this.Logger.warn("drawPoster", t); } } }, { key: "destroy", value: ((i = p( d().mark(function t() { var e, n, i, r; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: (this.destroyed = !0), this.pause(), this.removeEvents(), null === (e = this.WorkerController) || void 0 === e || e.destroy(), null === (n = this.AudioController) || void 0 === n || n.destroy(), null === (i = this.VideoController) || void 0 === i || i.destroy(), null === (r = this.Canvas) || void 0 === r || r.destroy(), (this.TimerController = null), (this.Loader = null), (this.VideoController = null), (this.AudioController = null); case 11: case "end": return t.stop(); } }, t, this ); }) )), function () { return i.apply(this, arguments); }) } ]) ); var i, r, a, s; })(Ph), lp = (function () { return m( function t(e) { var n = this, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; f(this, t), g(this, "version", "1.3.0"), g(this, "playerType", N), (this.el = e), (this.eventList = []), (this.options = Object.assign({}, i, { playerType: this.playerType })), console.log("options", this.el, i); var r = new To({ debug: i.debug }); (this.$logger = r), r.log("VideoPlayerClass init", e, this.options); var a = So(); (this.$emitter = a), (this.$reporter = new ju({ logger: r, emitter: a })), a.on("*", function (t, e) { r.log("reporter::", t, e), n.$reporter.add({ event: t }); }), this.options.prefixAd && this.options.prefixAd.list ? this.playAd() : this.createPlayer(this.options), r.log("VideoPlayer::created::version", this.version); }, [ { key: "getReportInfo", value: function () { var t = R(); return ( (t.version = this.version), (t.player = "JYPlayer"), (t.playerType = this.playerType), (t.events = this.$reporter.reports), t ); } }, { key: "playAd", value: ((n = p( d().mark(function t() { var e, n, i, r, a, s, o, c, u, h = this; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if ( ((e = this.options.prefixAd), (n = e.list), (i = void 0 === n ? [] : n), (r = e.time), (a = void 0 === r ? 5 : r), null == this.adCountdown && (this.adCountdown = a), console.log("list::", i), i.length) ) { t.next = 6; break; } return this.createPlayer(this.options), t.abrupt("return"); case 6: return ( (s = i.shift()), (t.next = 9), this.createPlayer( l( l({}, this.options), {}, { src: s.src, autoplay: !0, muted: !0, isAD: !0, controls: !1 } ) ) ); case 9: ((o = document.createElement("a")).style.opacity = "100%"), (o.style.width = "100%"), (o.style.height = "100%"), (o.style.position = "absolute"), (o.style.top = "0"), (o.target = "_blank"), (o.href = s.link), (c = document.createElement("span")), ((u = document.querySelector(this.el)).style.position = "relative"), (c.style.padding = "3px 5px"), (c.style.display = "flex"), (c.style.justifyContent = "center"), (c.style.alignItems = "center"), (c.style.margin = "10px"), (c.style.height = "30px"), (c.style.borderRadius = "10px"), (c.style.background = "grey"), c.addEventListener( "click", p( d().mark(function t() { return d().wrap(function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (!(h.adCountdown > 0)) { t.next = 4; break; } return ( console.log("skip-ads::click"), h.$emitter.emit("skip-ads", !1), t.abrupt("return") ); case 4: (i.length = 0), h.$emitter.emit("skip-ads", !0), h.createPlayer(h.options); case 7: case "end": return t.stop(); } }, t); }) ) ), (c.style.color = "white"), (c.style.zIndex = "99999"), (c.style.position = "absolute"), (c.style.top = "0"), (c.style.right = "0"), (c.style.cursor = "pointer"), (c.className = "close-button"), u.append(c), u.append(o), this.player.addEventListener("ended", function () { h.$logger.log("ad::ended"), h.playAd(); }), this.player.addEventListener("error", function (t) { h.$logger.log("ad::error", t), h.playAd(); }), console.log("adTimer::", this.adTimer), this.adTimer && clearInterval(this.adTimer), (c.innerText = "".concat( this.adCountdown > 0 ? this.adCountdown + "s | " : "", "跳过广告" )), this.$emitter.on("play", function () { h.adTimer = setInterval(function () { (h.adCountdown -= 1), (c.innerText = "".concat( h.adCountdown > 0 ? h.adCountdown + "s | " : "", "跳过广告" )), h.adCountdown <= 0 && clearInterval(h.adTimer); }, 1e3); }); case 44: case "end": return t.stop(); } }, t, this ); }) )), function () { return n.apply(this, arguments); }) }, { key: "createPlayer", value: ((e = p( d().mark(function t(e) { var n; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: (n = this.el), this.destroy(), console.log("createPlayer::", n, e), (this.player = new op(n.replace("#", ""), e)), this.initPlayerEvnets(this.player), e.isAD || (console.log("renderAdvertisement", this.el, this.options), _h({ el: this.el, adList: this.options.adList, player: this })); case 6: case "end": return t.stop(); } }, t, this ); }) )), function (t) { return e.apply(this, arguments); }) }, { key: "initPlayerEvnets", value: function (t) { var e = this; if (t) { [ "canplay", "canplaythrough", "durationchange", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "volumechange", "waiting", "fullscreen" ].forEach(function (n) { t.Emitter.on(n, function (t) { e.$emitter.emit(n, t); }); }), this.eventList.forEach(function (t) { e.$emitter.on(t.eventType, t.cb); }); } } }, { key: "startDecode", value: function () { this.player.startDecode && this.player.startDecode(); } }, { key: "getVideo", value: function () { return null; } }, { key: "on", value: function (t, e) { if (!t || !tl(e)) throw new Error("on方法参数有误"); this.$emitter.on(t, e), this.eventList.push({ eventType: t, cb: e }); } }, { key: "off", value: function (t, e) { if (!t || !tl(e)) throw new Error("on方法参数有误"); this.$emitter.off(t, e); var n = Du(this.eventList, ["cb", e]); n >= 0 && this.eventList.splice(n, 1); } }, { key: "destroy", value: ((t = p( d().mark(function t() { var e, n; return d().wrap( function (t) { for (; ;) switch ((t.prev = t.next)) { case 0: if (this.player) { t.next = 2; break; } return t.abrupt("return"); case 2: this.$emitter.all.clear(), null === (e = this.player) || void 0 === e || e.destroy(), null === (n = this.$reporter) || void 0 === n || n.destroy(), clearInterval(this.adTimer), (document.querySelector(this.el).innerHTML = ""), this.$logger.log("destroy", this.app); case 8: case "end": return t.stop(); } }, t, this ); }) )), function () { return t.apply(this, arguments); }) } ] ); var t, e, n; })(), dp = m(function t(e, n) { var i; if ( (f(this, t), g(this, "version", "1.3.0"), g(this, "playerType", M), (this.playerType = n.playerType || z()), console.log("this.playerType", this.playerType), this.playerType === N) ) i = new lp(e, n); else i = new kh(e, n); return i; }); return ( g(dp, "getPlayerType", z), g(dp, "isSupported", function () { return z() != M; }), g(dp, "getDevice", function () { return I; }), dp ); });