UNPKG

@uploadcare/uc-video

Version:

Uploadcare's UCVideo solution for adaptive bitrate streaming

1,588 lines (1,587 loc) 1.25 MB
var sn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function cr(s) { return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s; } function rm(s) { if (Object.prototype.hasOwnProperty.call(s, "__esModule")) return s; var e = s.default; if (typeof e == "function") { var t = function i() { var r = !1; try { r = this instanceof i; } catch { } return r ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments); }; t.prototype = e.prototype; } else t = {}; return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(s).forEach(function(i) { var r = Object.getOwnPropertyDescriptor(s, i); Object.defineProperty(t, i, r.get ? r : { enumerable: !0, get: function() { return s[i]; } }); }), t; } var ca, Wu; function Dn() { if (Wu) return ca; Wu = 1; var s; return typeof window < "u" ? s = window : typeof sn < "u" ? s = sn : typeof self < "u" ? s = self : s = {}, ca = s, ca; } var nm = /* @__PURE__ */ Dn(); const D = /* @__PURE__ */ cr(nm), am = {}, om = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: am }, Symbol.toStringTag, { value: "Module" })), um = /* @__PURE__ */ rm(om); var da, Xu; function Cc() { if (Xu) return da; Xu = 1; var s = typeof sn < "u" ? sn : typeof window < "u" ? window : {}, e = um, t; return typeof document < "u" ? t = document : (t = s["__GLOBAL_DOCUMENT_CACHE@4"], t || (t = s["__GLOBAL_DOCUMENT_CACHE@4"] = e)), da = t, da; } var lm = /* @__PURE__ */ Cc(); const se = /* @__PURE__ */ cr(lm); var Vr = { exports: {} }, ha = { exports: {} }, Ku; function cm() { return Ku || (Ku = 1, function(s) { function e() { return s.exports = e = Object.assign ? Object.assign.bind() : function(t) { for (var i = 1; i < arguments.length; i++) { var r = arguments[i]; for (var n in r) ({}).hasOwnProperty.call(r, n) && (t[n] = r[n]); } return t; }, s.exports.__esModule = !0, s.exports.default = s.exports, e.apply(null, arguments); } s.exports = e, s.exports.__esModule = !0, s.exports.default = s.exports; }(ha)), ha.exports; } var fa, Yu; function dm() { if (Yu) return fa; Yu = 1, fa = e; var s = Object.prototype.toString; function e(t) { if (!t) return !1; var i = s.call(t); return i === "[object Function]" || typeof t == "function" && i !== "[object RegExp]" || typeof window < "u" && // IE8 and below (t === window.setTimeout || t === window.alert || t === window.confirm || t === window.prompt); } return fa; } var pa, Qu; function hm() { if (Qu) return pa; Qu = 1; function s(r, n) { var a = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"]; if (a) return (a = a.call(r)).next.bind(a); if (Array.isArray(r) || (a = e(r)) || n) { a && (r = a); var u = 0; return function() { return u >= r.length ? { done: !0 } : { done: !1, value: r[u++] }; }; } throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); } function e(r, n) { if (r) { if (typeof r == "string") return t(r, n); var a = Object.prototype.toString.call(r).slice(8, -1); if (a === "Object" && r.constructor && (a = r.constructor.name), a === "Map" || a === "Set") return Array.from(r); if (a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)) return t(r, n); } } function t(r, n) { (n == null || n > r.length) && (n = r.length); for (var a = 0, u = new Array(n); a < n; a++) u[a] = r[a]; return u; } var i = /* @__PURE__ */ function() { function r() { this.typeToInterceptorsMap_ = /* @__PURE__ */ new Map(), this.enabled_ = !1; } var n = r.prototype; return n.getIsEnabled = function() { return this.enabled_; }, n.enable = function() { this.enabled_ = !0; }, n.disable = function() { this.enabled_ = !1; }, n.reset = function() { this.typeToInterceptorsMap_ = /* @__PURE__ */ new Map(), this.enabled_ = !1; }, n.addInterceptor = function(u, c) { this.typeToInterceptorsMap_.has(u) || this.typeToInterceptorsMap_.set(u, /* @__PURE__ */ new Set()); var f = this.typeToInterceptorsMap_.get(u); return f.has(c) ? !1 : (f.add(c), !0); }, n.removeInterceptor = function(u, c) { var f = this.typeToInterceptorsMap_.get(u); return f && f.has(c) ? (f.delete(c), !0) : !1; }, n.clearInterceptorsByType = function(u) { var c = this.typeToInterceptorsMap_.get(u); return c ? (this.typeToInterceptorsMap_.delete(u), this.typeToInterceptorsMap_.set(u, /* @__PURE__ */ new Set()), !0) : !1; }, n.clear = function() { return this.typeToInterceptorsMap_.size ? (this.typeToInterceptorsMap_ = /* @__PURE__ */ new Map(), !0) : !1; }, n.getForType = function(u) { return this.typeToInterceptorsMap_.get(u) || /* @__PURE__ */ new Set(); }, n.execute = function(u, c) { for (var f = this.getForType(u), g = s(f), y; !(y = g()).done; ) { var I = y.value; try { c = I(c); } catch { } } return c; }, r; }(); return pa = i, pa; } var ma, Ju; function fm() { if (Ju) return ma; Ju = 1; var s = /* @__PURE__ */ function() { function t() { this.maxAttempts_ = 1, this.delayFactor_ = 0.1, this.fuzzFactor_ = 0.1, this.initialDelay_ = 1e3, this.enabled_ = !1; } var i = t.prototype; return i.getIsEnabled = function() { return this.enabled_; }, i.enable = function() { this.enabled_ = !0; }, i.disable = function() { this.enabled_ = !1; }, i.reset = function() { this.maxAttempts_ = 1, this.delayFactor_ = 0.1, this.fuzzFactor_ = 0.1, this.initialDelay_ = 1e3, this.enabled_ = !1; }, i.getMaxAttempts = function() { return this.maxAttempts_; }, i.setMaxAttempts = function(n) { this.maxAttempts_ = n; }, i.getDelayFactor = function() { return this.delayFactor_; }, i.setDelayFactor = function(n) { this.delayFactor_ = n; }, i.getFuzzFactor = function() { return this.fuzzFactor_; }, i.setFuzzFactor = function(n) { this.fuzzFactor_ = n; }, i.getInitialDelay = function() { return this.initialDelay_; }, i.setInitialDelay = function(n) { this.initialDelay_ = n; }, i.createRetry = function(n) { var a = n === void 0 ? {} : n, u = a.maxAttempts, c = a.delayFactor, f = a.fuzzFactor, g = a.initialDelay; return new e({ maxAttempts: u || this.maxAttempts_, delayFactor: c || this.delayFactor_, fuzzFactor: f || this.fuzzFactor_, initialDelay: g || this.initialDelay_ }); }, t; }(), e = /* @__PURE__ */ function() { function t(r) { this.maxAttempts_ = r.maxAttempts, this.delayFactor_ = r.delayFactor, this.fuzzFactor_ = r.fuzzFactor, this.currentDelay_ = r.initialDelay, this.currentAttempt_ = 1; } var i = t.prototype; return i.moveToNextAttempt = function() { this.currentAttempt_++; var n = this.currentDelay_ * this.delayFactor_; this.currentDelay_ = this.currentDelay_ + n; }, i.shouldRetry = function() { return this.currentAttempt_ < this.maxAttempts_; }, i.getCurrentDelay = function() { return this.currentDelay_; }, i.getCurrentMinPossibleDelay = function() { return (1 - this.fuzzFactor_) * this.currentDelay_; }, i.getCurrentMaxPossibleDelay = function() { return (1 + this.fuzzFactor_) * this.currentDelay_; }, i.getCurrentFuzzedDelay = function() { var n = this.getCurrentMinPossibleDelay(), a = this.getCurrentMaxPossibleDelay(); return n + Math.random() * (a - n); }, t; }(); return ma = s, ma; } var ga, Zu; function pm() { if (Zu) return ga; Zu = 1; var s = /* @__PURE__ */ Dn(), e = function(r, n) { return n === void 0 && (n = !1), function(a, u, c) { if (a) { r(a); return; } if (u.statusCode >= 400 && u.statusCode <= 599) { var f = c; if (n) if (s.TextDecoder) { var g = t(u.headers && u.headers["content-type"]); try { f = new TextDecoder(g).decode(c); } catch { } } else f = String.fromCharCode.apply(null, new Uint8Array(c)); r({ cause: f }); return; } r(null, c); }; }; function t(i) { return i === void 0 && (i = ""), i.toLowerCase().split(";").reduce(function(r, n) { var a = n.split("="), u = a[0], c = a[1]; return u.trim() === "charset" ? c.trim() : r; }, "utf-8"); } return ga = e, ga; } var el; function mm() { if (el) return Vr.exports; el = 1; var s = /* @__PURE__ */ Dn(), e = /* @__PURE__ */ cm(), t = /* @__PURE__ */ dm(), i = /* @__PURE__ */ hm(), r = /* @__PURE__ */ fm(); f.httpHandler = /* @__PURE__ */ pm(), f.requestInterceptorsStorage = new i(), f.responseInterceptorsStorage = new i(), f.retryManager = new r(); /** * @license * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/> * Copyright (c) 2014 David Björklund * Available under the MIT license * <https://github.com/kesla/parse-headers/blob/master/LICENCE> */ var n = function(R) { var T = {}; return R && R.trim().split(` `).forEach(function(P) { var F = P.indexOf(":"), N = P.slice(0, F).trim().toLowerCase(), L = P.slice(F + 1).trim(); typeof T[N] > "u" ? T[N] = L : Array.isArray(T[N]) ? T[N].push(L) : T[N] = [T[N], L]; }), T; }; Vr.exports = f, Vr.exports.default = f, f.XMLHttpRequest = s.XMLHttpRequest || I, f.XDomainRequest = "withCredentials" in new f.XMLHttpRequest() ? f.XMLHttpRequest : s.XDomainRequest, a(["get", "put", "post", "patch", "head", "delete"], function(C) { f[C === "delete" ? "del" : C] = function(R, T, P) { return T = c(R, T, P), T.method = C.toUpperCase(), g(T); }; }); function a(C, R) { for (var T = 0; T < C.length; T++) R(C[T]); } function u(C) { for (var R in C) if (C.hasOwnProperty(R)) return !1; return !0; } function c(C, R, T) { var P = C; return t(R) ? (T = R, typeof C == "string" && (P = { uri: C })) : P = e({}, R, { uri: C }), P.callback = T, P; } function f(C, R, T) { return R = c(C, R, T), g(R); } function g(C) { if (typeof C.callback > "u") throw new Error("callback argument missing"); if (C.requestType && f.requestInterceptorsStorage.getIsEnabled()) { var R = { uri: C.uri || C.url, headers: C.headers || {}, body: C.body, metadata: C.metadata || {}, retry: C.retry, timeout: C.timeout }, T = f.requestInterceptorsStorage.execute(C.requestType, R); C.uri = T.uri, C.headers = T.headers, C.body = T.body, C.metadata = T.metadata, C.retry = T.retry, C.timeout = T.timeout; } var P = !1, F = function(Z, J, te) { P || (P = !0, C.callback(Z, J, te)); }; function N() { U.readyState === 4 && !f.responseInterceptorsStorage.getIsEnabled() && setTimeout(O, 0); } function L() { var X = void 0; if (U.response ? X = U.response : X = U.responseText || y(U), Q) try { X = JSON.parse(X); } catch { } return X; } function z(X) { if (clearTimeout(ie), clearTimeout(C.retryTimeout), X instanceof Error || (X = new Error("" + (X || "Unknown XMLHttpRequest Error"))), X.statusCode = 0, !Y && f.retryManager.getIsEnabled() && C.retry && C.retry.shouldRetry()) { C.retryTimeout = setTimeout(function() { C.retry.moveToNextAttempt(), C.xhr = U, g(C); }, C.retry.getCurrentFuzzedDelay()); return; } if (C.requestType && f.responseInterceptorsStorage.getIsEnabled()) { var Z = { headers: re.headers || {}, body: re.body, responseUrl: U.responseURL, responseType: U.responseType }, J = f.responseInterceptorsStorage.execute(C.requestType, Z); re.body = J.body, re.headers = J.headers; } return F(X, re); } function O() { if (!Y) { var X; clearTimeout(ie), clearTimeout(C.retryTimeout), C.useXDR && U.status === void 0 ? X = 200 : X = U.status === 1223 ? 204 : U.status; var Z = re, J = null; if (X !== 0 ? (Z = { body: L(), statusCode: X, method: E, headers: {}, url: v, rawRequest: U }, U.getAllResponseHeaders && (Z.headers = n(U.getAllResponseHeaders()))) : J = new Error("Internal XMLHttpRequest Error"), C.requestType && f.responseInterceptorsStorage.getIsEnabled()) { var te = { headers: Z.headers || {}, body: Z.body, responseUrl: U.responseURL, responseType: U.responseType }, ee = f.responseInterceptorsStorage.execute(C.requestType, te); Z.body = ee.body, Z.headers = ee.headers; } return F(J, Z, Z.body); } } var U = C.xhr || null; U || (C.cors || C.useXDR ? U = new f.XDomainRequest() : U = new f.XMLHttpRequest()); var V, Y, v = U.url = C.uri || C.url, E = U.method = C.method || "GET", q = C.body || C.data, j = U.headers = C.headers || {}, H = !!C.sync, Q = !1, ie, re = { body: void 0, headers: {}, statusCode: 0, method: E, url: v, rawRequest: U }; if ("json" in C && C.json !== !1 && (Q = !0, j.accept || j.Accept || (j.Accept = "application/json"), E !== "GET" && E !== "HEAD" && (j["content-type"] || j["Content-Type"] || (j["Content-Type"] = "application/json"), q = JSON.stringify(C.json === !0 ? q : C.json))), U.onreadystatechange = N, U.onload = O, U.onerror = z, U.onprogress = function() { }, U.onabort = function() { Y = !0, clearTimeout(C.retryTimeout); }, U.ontimeout = z, U.open(E, v, !H, C.username, C.password), H || (U.withCredentials = !!C.withCredentials), !H && C.timeout > 0 && (ie = setTimeout(function() { if (!Y) { Y = !0, U.abort("timeout"); var X = new Error("XMLHttpRequest timeout"); X.code = "ETIMEDOUT", z(X); } }, C.timeout)), U.setRequestHeader) for (V in j) j.hasOwnProperty(V) && U.setRequestHeader(V, j[V]); else if (C.headers && !u(C.headers)) throw new Error("Headers cannot be set on an XDomainRequest object"); return "responseType" in C && (U.responseType = C.responseType), "beforeSend" in C && typeof C.beforeSend == "function" && C.beforeSend(U), U.send(q || null), U; } function y(C) { try { if (C.responseType === "document") return C.responseXML; var R = C.responseXML && C.responseXML.documentElement.nodeName === "parsererror"; if (C.responseType === "" && !R) return C.responseXML; } catch { } return null; } function I() { } return Vr.exports; } var gm = /* @__PURE__ */ mm(); const Ac = /* @__PURE__ */ cr(gm); var _a = { exports: {} }, ya, tl; function _m() { if (tl) return ya; tl = 1; var s = /* @__PURE__ */ Cc(), e = Object.create || /* @__PURE__ */ function() { function v() { } return function(E) { if (arguments.length !== 1) throw new Error("Object.create shim only accepts one parameter."); return v.prototype = E, new v(); }; }(); function t(v, E) { this.name = "ParsingError", this.code = v.code, this.message = E || v.message; } t.prototype = e(Error.prototype), t.prototype.constructor = t, t.Errors = { BadSignature: { code: 0, message: "Malformed WebVTT signature." }, BadTimeStamp: { code: 1, message: "Malformed time stamp." } }; function i(v) { function E(j, H, Q, ie) { return (j | 0) * 3600 + (H | 0) * 60 + (Q | 0) + (ie | 0) / 1e3; } var q = v.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/); return q ? q[3] ? E(q[1], q[2], q[3].replace(":", ""), q[4]) : q[1] > 59 ? E(q[1], q[2], 0, q[4]) : E(0, q[1], q[2], q[4]) : null; } function r() { this.values = e(null); } r.prototype = { // Only accept the first assignment to any key. set: function(v, E) { !this.get(v) && E !== "" && (this.values[v] = E); }, // Return the value for a key, or a default value. // If 'defaultKey' is passed then 'dflt' is assumed to be an object with // a number of possible default values as properties where 'defaultKey' is // the key of the property that will be chosen; otherwise it's assumed to be // a single value. get: function(v, E, q) { return q ? this.has(v) ? this.values[v] : E[q] : this.has(v) ? this.values[v] : E; }, // Check whether we have a value for a key. has: function(v) { return v in this.values; }, // Accept a setting if its one of the given alternatives. alt: function(v, E, q) { for (var j = 0; j < q.length; ++j) if (E === q[j]) { this.set(v, E); break; } }, // Accept a setting if its a valid (signed) integer. integer: function(v, E) { /^-?\d+$/.test(E) && this.set(v, parseInt(E, 10)); }, // Accept a setting if its a valid percentage. percent: function(v, E) { return E.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (E = parseFloat(E), E >= 0 && E <= 100) ? (this.set(v, E), !0) : !1; } }; function n(v, E, q, j) { var H = j ? v.split(j) : [v]; for (var Q in H) if (typeof H[Q] == "string") { var ie = H[Q].split(q); if (ie.length === 2) { var re = ie[0].trim(), X = ie[1].trim(); E(re, X); } } } function a(v, E, q) { var j = v; function H() { var re = i(v); if (re === null) throw new t( t.Errors.BadTimeStamp, "Malformed timestamp: " + j ); return v = v.replace(/^[^\sa-zA-Z-]+/, ""), re; } function Q(re, X) { var Z = new r(); n(re, function(J, te) { switch (J) { case "region": for (var ee = q.length - 1; ee >= 0; ee--) if (q[ee].id === te) { Z.set(J, q[ee].region); break; } break; case "vertical": Z.alt(J, te, ["rl", "lr"]); break; case "line": var fe = te.split(","), me = fe[0]; Z.integer(J, me), Z.percent(J, me) && Z.set("snapToLines", !1), Z.alt(J, me, ["auto"]), fe.length === 2 && Z.alt("lineAlign", fe[1], ["start", "center", "end"]); break; case "position": fe = te.split(","), Z.percent(J, fe[0]), fe.length === 2 && Z.alt("positionAlign", fe[1], ["start", "center", "end"]); break; case "size": Z.percent(J, te); break; case "align": Z.alt(J, te, ["start", "center", "end", "left", "right"]); break; } }, /:/, /\s/), X.region = Z.get("region", null), X.vertical = Z.get("vertical", ""); try { X.line = Z.get("line", "auto"); } catch { } X.lineAlign = Z.get("lineAlign", "start"), X.snapToLines = Z.get("snapToLines", !0), X.size = Z.get("size", 100); try { X.align = Z.get("align", "center"); } catch { X.align = Z.get("align", "middle"); } try { X.position = Z.get("position", "auto"); } catch { X.position = Z.get("position", { start: 0, left: 0, center: 50, middle: 50, end: 100, right: 100 }, X.align); } X.positionAlign = Z.get("positionAlign", { start: "start", left: "start", center: "center", middle: "center", end: "end", right: "end" }, X.align); } function ie() { v = v.replace(/^\s+/, ""); } if (ie(), E.startTime = H(), ie(), v.substr(0, 3) !== "-->") throw new t( t.Errors.BadTimeStamp, "Malformed time stamp (time stamps must be separated by '-->'): " + j ); v = v.substr(3), ie(), E.endTime = H(), ie(), Q(v, E); } var u = s.createElement && s.createElement("textarea"), c = { c: "span", i: "i", b: "b", u: "u", ruby: "ruby", rt: "rt", v: "span", lang: "span" }, f = { white: "rgba(255,255,255,1)", lime: "rgba(0,255,0,1)", cyan: "rgba(0,255,255,1)", red: "rgba(255,0,0,1)", yellow: "rgba(255,255,0,1)", magenta: "rgba(255,0,255,1)", blue: "rgba(0,0,255,1)", black: "rgba(0,0,0,1)" }, g = { v: "title", lang: "lang" }, y = { rt: "ruby" }; function I(v, E) { function q() { if (!E) return null; function me(he) { return E = E.substr(he.length), he; } var _e = E.match(/^([^<]*)(<[^>]*>?)?/); return me(_e[1] ? _e[1] : _e[2]); } function j(me) { return u.innerHTML = me, me = u.textContent, u.textContent = "", me; } function H(me, _e) { return !y[_e.localName] || y[_e.localName] === me.localName; } function Q(me, _e) { var he = c[me]; if (!he) return null; var Ke = v.document.createElement(he), Je = g[me]; return Je && _e && (Ke[Je] = _e.trim()), Ke; } for (var ie = v.document.createElement("div"), re = ie, X, Z = []; (X = q()) !== null; ) { if (X[0] === "<") { if (X[1] === "/") { Z.length && Z[Z.length - 1] === X.substr(2).replace(">", "") && (Z.pop(), re = re.parentNode); continue; } var J = i(X.substr(1, X.length - 2)), te; if (J) { te = v.document.createProcessingInstruction("timestamp", J), re.appendChild(te); continue; } var ee = X.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/); if (!ee || (te = Q(ee[1], ee[3]), !te) || !H(re, te)) continue; if (ee[2]) { var fe = ee[2].split("."); fe.forEach(function(me) { var _e = /^bg_/.test(me), he = _e ? me.slice(3) : me; if (f.hasOwnProperty(he)) { var Ke = _e ? "background-color" : "color", Je = f[he]; te.style[Ke] = Je; } }), te.className = fe.join(" "); } Z.push(ee[1]), re.appendChild(te), re = te; continue; } re.appendChild(v.document.createTextNode(j(X))); } return ie; } var C = [ [1470, 1470], [1472, 1472], [1475, 1475], [1478, 1478], [1488, 1514], [1520, 1524], [1544, 1544], [1547, 1547], [1549, 1549], [1563, 1563], [1566, 1610], [1645, 1647], [1649, 1749], [1765, 1766], [1774, 1775], [1786, 1805], [1807, 1808], [1810, 1839], [1869, 1957], [1969, 1969], [1984, 2026], [2036, 2037], [2042, 2042], [2048, 2069], [2074, 2074], [2084, 2084], [2088, 2088], [2096, 2110], [2112, 2136], [2142, 2142], [2208, 2208], [2210, 2220], [8207, 8207], [64285, 64285], [64287, 64296], [64298, 64310], [64312, 64316], [64318, 64318], [64320, 64321], [64323, 64324], [64326, 64449], [64467, 64829], [64848, 64911], [64914, 64967], [65008, 65020], [65136, 65140], [65142, 65276], [67584, 67589], [67592, 67592], [67594, 67637], [67639, 67640], [67644, 67644], [67647, 67669], [67671, 67679], [67840, 67867], [67872, 67897], [67903, 67903], [67968, 68023], [68030, 68031], [68096, 68096], [68112, 68115], [68117, 68119], [68121, 68147], [68160, 68167], [68176, 68184], [68192, 68223], [68352, 68405], [68416, 68437], [68440, 68466], [68472, 68479], [68608, 68680], [126464, 126467], [126469, 126495], [126497, 126498], [126500, 126500], [126503, 126503], [126505, 126514], [126516, 126519], [126521, 126521], [126523, 126523], [126530, 126530], [126535, 126535], [126537, 126537], [126539, 126539], [126541, 126543], [126545, 126546], [126548, 126548], [126551, 126551], [126553, 126553], [126555, 126555], [126557, 126557], [126559, 126559], [126561, 126562], [126564, 126564], [126567, 126570], [126572, 126578], [126580, 126583], [126585, 126588], [126590, 126590], [126592, 126601], [126603, 126619], [126625, 126627], [126629, 126633], [126635, 126651], [1114109, 1114109] ]; function R(v) { for (var E = 0; E < C.length; E++) { var q = C[E]; if (v >= q[0] && v <= q[1]) return !0; } return !1; } function T(v) { var E = [], q = "", j; if (!v || !v.childNodes) return "ltr"; function H(re, X) { for (var Z = X.childNodes.length - 1; Z >= 0; Z--) re.push(X.childNodes[Z]); } function Q(re) { if (!re || !re.length) return null; var X = re.pop(), Z = X.textContent || X.innerText; if (Z) { var J = Z.match(/^.*(\n|\r)/); return J ? (re.length = 0, J[0]) : Z; } if (X.tagName === "ruby") return Q(re); if (X.childNodes) return H(re, X), Q(re); } for (H(E, v); q = Q(E); ) for (var ie = 0; ie < q.length; ie++) if (j = q.charCodeAt(ie), R(j)) return "rtl"; return "ltr"; } function P(v) { if (typeof v.line == "number" && (v.snapToLines || v.line >= 0 && v.line <= 100)) return v.line; if (!v.track || !v.track.textTrackList || !v.track.textTrackList.mediaElement) return -1; for (var E = v.track, q = E.textTrackList, j = 0, H = 0; H < q.length && q[H] !== E; H++) q[H].mode === "showing" && j++; return ++j * -1; } function F() { } F.prototype.applyStyles = function(v, E) { E = E || this.div; for (var q in v) v.hasOwnProperty(q) && (E.style[q] = v[q]); }, F.prototype.formatStyle = function(v, E) { return v === 0 ? 0 : v + E; }; function N(v, E, q) { F.call(this), this.cue = E, this.cueDiv = I(v, E.text); var j = { color: "rgba(255, 255, 255, 1)", backgroundColor: "rgba(0, 0, 0, 0.8)", position: "relative", left: 0, right: 0, top: 0, bottom: 0, display: "inline", writingMode: E.vertical === "" ? "horizontal-tb" : E.vertical === "lr" ? "vertical-lr" : "vertical-rl", unicodeBidi: "plaintext" }; this.applyStyles(j, this.cueDiv), this.div = v.document.createElement("div"), j = { direction: T(this.cueDiv), writingMode: E.vertical === "" ? "horizontal-tb" : E.vertical === "lr" ? "vertical-lr" : "vertical-rl", unicodeBidi: "plaintext", textAlign: E.align === "middle" ? "center" : E.align, font: q.font, whiteSpace: "pre-line", position: "absolute" }, this.applyStyles(j), this.div.appendChild(this.cueDiv); var H = 0; switch (E.positionAlign) { case "start": case "line-left": H = E.position; break; case "center": H = E.position - E.size / 2; break; case "end": case "line-right": H = E.position - E.size; break; } E.vertical === "" ? this.applyStyles({ left: this.formatStyle(H, "%"), width: this.formatStyle(E.size, "%") }) : this.applyStyles({ top: this.formatStyle(H, "%"), height: this.formatStyle(E.size, "%") }), this.move = function(Q) { this.applyStyles({ top: this.formatStyle(Q.top, "px"), bottom: this.formatStyle(Q.bottom, "px"), left: this.formatStyle(Q.left, "px"), right: this.formatStyle(Q.right, "px"), height: this.formatStyle(Q.height, "px"), width: this.formatStyle(Q.width, "px") }); }; } N.prototype = e(F.prototype), N.prototype.constructor = N; function L(v) { var E, q, j, H; if (v.div) { q = v.div.offsetHeight, j = v.div.offsetWidth, H = v.div.offsetTop; var Q = (Q = v.div.childNodes) && (Q = Q[0]) && Q.getClientRects && Q.getClientRects(); v = v.div.getBoundingClientRect(), E = Q ? Math.max(Q[0] && Q[0].height || 0, v.height / Q.length) : 0; } this.left = v.left, this.right = v.right, this.top = v.top || H, this.height = v.height || q, this.bottom = v.bottom || H + (v.height || q), this.width = v.width || j, this.lineHeight = E !== void 0 ? E : v.lineHeight; } L.prototype.move = function(v, E) { switch (E = E !== void 0 ? E : this.lineHeight, v) { case "+x": this.left += E, this.right += E; break; case "-x": this.left -= E, this.right -= E; break; case "+y": this.top += E, this.bottom += E; break; case "-y": this.top -= E, this.bottom -= E; break; } }, L.prototype.overlaps = function(v) { return this.left < v.right && this.right > v.left && this.top < v.bottom && this.bottom > v.top; }, L.prototype.overlapsAny = function(v) { for (var E = 0; E < v.length; E++) if (this.overlaps(v[E])) return !0; return !1; }, L.prototype.within = function(v) { return this.top >= v.top && this.bottom <= v.bottom && this.left >= v.left && this.right <= v.right; }, L.prototype.overlapsOppositeAxis = function(v, E) { switch (E) { case "+x": return this.left < v.left; case "-x": return this.right > v.right; case "+y": return this.top < v.top; case "-y": return this.bottom > v.bottom; } }, L.prototype.intersectPercentage = function(v) { var E = Math.max(0, Math.min(this.right, v.right) - Math.max(this.left, v.left)), q = Math.max(0, Math.min(this.bottom, v.bottom) - Math.max(this.top, v.top)), j = E * q; return j / (this.height * this.width); }, L.prototype.toCSSCompatValues = function(v) { return { top: this.top - v.top, bottom: v.bottom - this.bottom, left: this.left - v.left, right: v.right - this.right, height: this.height, width: this.width }; }, L.getSimpleBoxPosition = function(v) { var E = v.div ? v.div.offsetHeight : v.tagName ? v.offsetHeight : 0, q = v.div ? v.div.offsetWidth : v.tagName ? v.offsetWidth : 0, j = v.div ? v.div.offsetTop : v.tagName ? v.offsetTop : 0; v = v.div ? v.div.getBoundingClientRect() : v.tagName ? v.getBoundingClientRect() : v; var H = { left: v.left, right: v.right, top: v.top || j, height: v.height || E, bottom: v.bottom || j + (v.height || E), width: v.width || q }; return H; }; function z(v, E, q, j) { function H(he, Ke) { for (var Je, $e = new L(he), Ze = 1, Tt = 0; Tt < Ke.length; Tt++) { for (; he.overlapsOppositeAxis(q, Ke[Tt]) || he.within(q) && he.overlapsAny(j); ) he.move(Ke[Tt]); if (he.within(q)) return he; var Ye = he.intersectPercentage(q); Ze > Ye && (Je = new L(he), Ze = Ye), he = new L($e); } return Je || $e; } var Q = new L(E), ie = E.cue, re = P(ie), X = []; if (ie.snapToLines) { var Z; switch (ie.vertical) { case "": X = ["+y", "-y"], Z = "height"; break; case "rl": X = ["+x", "-x"], Z = "width"; break; case "lr": X = ["-x", "+x"], Z = "width"; break; } var J = Q.lineHeight, te = J * Math.round(re), ee = q[Z] + J, fe = X[0]; Math.abs(te) > ee && (te = te < 0 ? -1 : 1, te *= Math.ceil(ee / J) * J), re < 0 && (te += ie.vertical === "" ? q.height : q.width, X = X.reverse()), Q.move(fe, te); } else { var me = Q.lineHeight / q.height * 100; switch (ie.lineAlign) { case "center": re -= me / 2; break; case "end": re -= me; break; } switch (ie.vertical) { case "": E.applyStyles({ top: E.formatStyle(re, "%") }); break; case "rl": E.applyStyles({ left: E.formatStyle(re, "%") }); break; case "lr": E.applyStyles({ right: E.formatStyle(re, "%") }); break; } X = ["+y", "-x", "+x", "-y"], Q = new L(E); } var _e = H(Q, X); E.move(_e.toCSSCompatValues(q)); } function O() { } O.StringDecoder = function() { return { decode: function(v) { if (!v) return ""; if (typeof v != "string") throw new Error("Error - expected string data."); return decodeURIComponent(encodeURIComponent(v)); } }; }, O.convertCueToDOMTree = function(v, E) { return !v || !E ? null : I(v, E); }; var U = 0.05, V = "sans-serif", Y = "1.5%"; return O.processCues = function(v, E, q) { if (!v || !E || !q) return null; for (; q.firstChild; ) q.removeChild(q.firstChild); var j = v.document.createElement("div"); j.style.position = "absolute", j.style.left = "0", j.style.right = "0", j.style.top = "0", j.style.bottom = "0", j.style.margin = Y, q.appendChild(j); function H(J) { for (var te = 0; te < J.length; te++) if (J[te].hasBeenReset || !J[te].displayState) return !0; return !1; } if (!H(E)) { for (var Q = 0; Q < E.length; Q++) j.appendChild(E[Q].displayState); return; } var ie = [], re = L.getSimpleBoxPosition(j), X = Math.round(re.height * U * 100) / 100, Z = { font: X + "px " + V }; (function() { for (var J, te, ee = 0; ee < E.length; ee++) te = E[ee], J = new N(v, te, Z), j.appendChild(J.div), z(v, J, re, ie), te.displayState = J.div, ie.push(L.getSimpleBoxPosition(J)); })(); }, O.Parser = function(v, E, q) { q || (q = E, E = {}), E || (E = {}), this.window = v, this.vttjs = E, this.state = "INITIAL", this.buffer = "", this.decoder = q || new TextDecoder("utf8"), this.regionList = []; }, O.Parser.prototype = { // If the error is a ParsingError then report it to the consumer if // possible. If it's not a ParsingError then throw it like normal. reportOrThrowError: function(v) { if (v instanceof t) this.onparsingerror && this.onparsingerror(v); else throw v; }, parse: function(v) { var E = this; v && (E.buffer += E.decoder.decode(v, { stream: !0 })); function q() { for (var J = E.buffer, te = 0; te < J.length && J[te] !== "\r" && J[te] !== ` `; ) ++te; var ee = J.substr(0, te); return J[te] === "\r" && ++te, J[te] === ` ` && ++te, E.buffer = J.substr(te), ee; } function j(J) { var te = new r(); if (n(J, function(fe, me) { switch (fe) { case "id": te.set(fe, me); break; case "width": te.percent(fe, me); break; case "lines": te.integer(fe, me); break; case "regionanchor": case "viewportanchor": var _e = me.split(","); if (_e.length !== 2) break; var he = new r(); if (he.percent("x", _e[0]), he.percent("y", _e[1]), !he.has("x") || !he.has("y")) break; te.set(fe + "X", he.get("x")), te.set(fe + "Y", he.get("y")); break; case "scroll": te.alt(fe, me, ["up"]); break; } }, /=/, /\s/), te.has("id")) { var ee = new (E.vttjs.VTTRegion || E.window.VTTRegion)(); ee.width = te.get("width", 100), ee.lines = te.get("lines", 3), ee.regionAnchorX = te.get("regionanchorX", 0), ee.regionAnchorY = te.get("regionanchorY", 100), ee.viewportAnchorX = te.get("viewportanchorX", 0), ee.viewportAnchorY = te.get("viewportanchorY", 100), ee.scroll = te.get("scroll", ""), E.onregion && E.onregion(ee), E.regionList.push({ id: te.get("id"), region: ee }); } } function H(J) { var te = new r(); n(J, function(ee, fe) { switch (ee) { case "MPEGT": te.integer(ee + "S", fe); break; case "LOCA": te.set(ee + "L", i(fe)); break; } }, /[^\d]:/, /,/), E.ontimestampmap && E.ontimestampmap({ MPEGTS: te.get("MPEGTS"), LOCAL: te.get("LOCAL") }); } function Q(J) { J.match(/X-TIMESTAMP-MAP/) ? n(J, function(te, ee) { switch (te) { case "X-TIMESTAMP-MAP": H(ee); break; } }, /=/) : n(J, function(te, ee) { switch (te) { case "Region": j(ee); break; } }, /:/); } try { var ie; if (E.state === "INITIAL") { if (!/\r\n|\n/.test(E.buffer)) return this; ie = q(); var re = ie.match(/^WEBVTT([ \t].*)?$/); if (!re || !re[0]) throw new t(t.Errors.BadSignature); E.state = "HEADER"; } for (var X = !1; E.buffer; ) { if (!/\r\n|\n/.test(E.buffer)) return this; switch (X ? X = !1 : ie = q(), E.state) { case "HEADER": /:/.test(ie) ? Q(ie) : ie || (E.state = "ID"); continue; case "NOTE": ie || (E.state = "ID"); continue; case "ID": if (/^NOTE($|[ \t])/.test(ie)) { E.state = "NOTE"; break; } if (!ie) continue; E.cue = new (E.vttjs.VTTCue || E.window.VTTCue)(0, 0, ""); try { E.cue.align = "center"; } catch { E.cue.align = "middle"; } if (E.state = "CUE", ie.indexOf("-->") === -1) { E.cue.id = ie; continue; } // Process line as start of a cue. /*falls through*/ case "CUE": try { a(ie, E.cue, E.regionList); } catch (J) { E.reportOrThrowError(J), E.cue = null, E.state = "BADCUE"; continue; } E.state = "CUETEXT"; continue; case "CUETEXT": var Z = ie.indexOf("-->") !== -1; if (!ie || Z && (X = !0)) { E.oncue && E.oncue(E.cue), E.cue = null, E.state = "ID"; continue; } E.cue.text && (E.cue.text += ` `), E.cue.text += ie.replace(/\u2028/g, ` `).replace(/u2029/g, ` `); continue; case "BADCUE": ie || (E.state = "ID"); continue; } } } catch (J) { E.reportOrThrowError(J), E.state === "CUETEXT" && E.cue && E.oncue && E.oncue(E.cue), E.cue = null, E.state = E.state === "INITIAL" ? "BADWEBVTT" : "BADCUE"; } return this; }, flush: function() { var v = this; try { if (v.buffer += v.decoder.decode(), (v.cue || v.state === "HEADER") && (v.buffer += ` `, v.parse()), v.state === "INITIAL") throw new t(t.Errors.BadSignature); } catch (E) { v.reportOrThrowError(E); } return v.onflush && v.onflush(), this; } }, ya = O, ya; } var Ta, il; function ym() { if (il) return Ta; il = 1; var s = "auto", e = { "": 1, lr: 1, rl: 1 }, t = { start: 1, center: 1, end: 1, left: 1, right: 1, auto: 1, "line-left": 1, "line-right": 1 }; function i(a) { if (typeof a != "string") return !1; var u = e[a.toLowerCase()]; return u ? a.toLowerCase() : !1; } function r(a) { if (typeof a != "string") return !1; var u = t[a.toLowerCase()]; return u ? a.toLowerCase() : !1; } function n(a, u, c) { this.hasBeenReset = !1; var f = "", g = !1, y = a, I = u, C = c, R = null, T = "", P = !0, F = "auto", N = "start", L = "auto", z = "auto", O = 100, U = "center"; Object.defineProperties(this, { id: { enumerable: !0, get: function() { return f; }, set: function(V) { f = "" + V; } }, pauseOnExit: { enumerable: !0, get: function() { return g; }, set: function(V) { g = !!V; } }, startTime: { enumerable: !0, get: function() { return y; }, set: function(V) { if (typeof V != "number") throw new TypeError("Start time must be set to a number."); y = V, this.hasBeenReset = !0; } }, endTime: { enumerable: !0, get: function() { return I; }, set: function(V) { if (typeof V != "number") throw new TypeError("End time must be set to a number."); I = V, this.hasBeenReset = !0; } }, text: { enumerable: !0, get: function() { return C; }, set: function(V) { C = "" + V, this.hasBeenReset = !0; } }, region: { enumerable: !0, get: function() { return R; }, set: function(V) { R = V, this.hasBeenReset = !0; } }, vertical: { enumerable: !0, get: function() { return T; }, set: function(V) { var Y = i(V); if (Y === !1) throw new SyntaxError("Vertical: an invalid or illegal direction string was specified."); T = Y, this.hasBeenReset = !0; } }, snapToLines: { enumerable: !0, get: function() { return P; }, set: function(V) { P = !!V, this.hasBeenReset = !0; } }, line: { enumerable: !0, get: function() { return F; }, set: function(V) { if (typeof V != "number" && V !== s) throw new SyntaxError("Line: an invalid number or illegal string was specified."); F = V, this.hasBeenReset = !0; } }, lineAlign: { enumerable: !0, get: function() { return N; }, set: function(V) { var Y = r(V); Y ? (N = Y, this.hasBeenReset = !0) : console.warn("lineAlign: an invalid or illegal string was specified."); } }, position: { enumerable: !0, get: function() { return L; }, set: function(V) { if (V < 0 || V > 100) throw new Error("Position must be between 0 and 100."); L = V, this.hasBeenReset = !0; } }, positionAlign: { enumerable: !0, get: function() { return z; }, set: function(V) { var Y = r(V); Y ? (z = Y, this.hasBeenReset = !0) : console.warn("positionAlign: an invalid or illegal string was specified."); } }, size: { enumerable: !0, get: function() { return O; }, set: function(V) { if (V < 0 || V > 100) throw new Error("Size must be between 0 and 100."); O = V, this.hasBeenReset = !0; } }, align: { enumerable: !0, get: function() { return U; }, set: function(V) { var Y = r(V); if (!Y) throw new SyntaxError("align: an invalid or illegal alignment string was specified."); U = Y, this.hasBeenReset = !0; } } }), this.displayState = void 0; } return n.prototype.getCueAsHTML = function() { return WebVTT.convertCueToDOMTree(window, this.text); }, Ta = n, Ta; } var va, sl; function Tm() { if (sl) return va; sl = 1; var s = { "": !0, up: !0 }; function e(r) { if (typeof r != "string") return !1; var n = s[r.toLowerCase()]; return n ? r.toLowerCase() : !1; } function t(r) { return typeof r == "number" && r >= 0 && r <= 100; } function i() { var r = 100, n = 3, a = 0, u = 100, c = 0, f = 100, g = ""; Object.defineProperties(this, { width: { enumerable: !0, get: function() { return r; }, set: function(y) { if (!t(y)) throw new Error("Width must be between 0 and 100."); r = y; } }, lines: { enumerable: !0, get: function() { return n; }, set: function(y) { if (typeof y != "number") throw new TypeError("Lines must be set to a number."); n = y; } }, regionAnchorY: { enumerable: !0, get: function() { return u; }, set: function(y) { if (!t(y)) throw new Error("RegionAnchorX must be between 0 and 100."); u = y; } }, regionAnchorX: { enumerable: !0, get: function() { return a; }, set: function(y) { if (!t(y)) throw new Error("RegionAnchorY must be between 0 and 100."); a = y; } }, viewportAnchorY: { enumerable: !0, get: function() { return f; }, set: function(y) { if (!t(y)) throw new Error("ViewportAnchorY must be between 0 and 100."); f = y; } }, viewportAnchorX: { enumerable: !0, get: function() { return c; }, set: function(y) { if (!t(y)) throw new Error("ViewportAnchorX must be between 0 and 100."); c = y; } }, scroll: { enumerable: !0, get: function() { return g; }, set: function(y) { var I = e(y); I === !1 ? console.warn("Scroll: an invalid or illegal string was specified.") : g = I; } } }); } return va = i, va; } var rl; function vm() { if (rl) return _a.exports; rl = 1; var s = /* @__PURE__ */ Dn(), e = _a.exports = { WebVTT: /* @__PURE__ */ _m(), VTTCue: /* @__PURE__ */ ym(), VTTRegion: /* @__PURE__ */ Tm() }; s.vttjs = e, s.WebVTT = e.WebVTT; var t = e.VTTCue, i = e.VTTRegion, r = s.VTTCue, n = s.VTTRegion; return e.shim = function() { s.VTTCue = t, s.VTTRegion = i; }, e.restore = function() { s.VTTCue = r, s.VTTRegion = n; }, s.VTTCue || e.shim(), _a.exports; } var bm = /* @__PURE__ */ vm(); const nl = /* @__PURE__ */ cr(bm); function qe() { return qe = Object.assign ? Object.assign.bind() : function(s) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var i in t) ({}).hasOwnProperty.call(t, i) && (s[i] = t[i]); } return s; }, qe.apply(null, arguments); } var al = "https://example.com", wn = function(e, t) { if (/^[a-z]+:/i.test(t)) return t; /^data:/.test(e) && (e = D.location && D.location.href || ""); var i = /^\/\//.test(e), r = !D.location && !/\/\//i.test(e); e = new D.URL(e, D.location || al); var n = new URL(t, e); return r ? n.href.slice(al.length) : i ? n.href.slice(n.protocol.length) : n.href; }, vo = /* @__PURE__ */ function() { function s() { this.listeners = {}; } var e = s.prototype; return e.on = function(i, r) { this.listeners[i] || (this.listeners[i] = []), this.listeners[i].push(r); }, e.off = function(i, r) { if (!this.listeners[i]) return !1; var n = this.listeners[i].indexOf(r); return this.listeners[i] = this.listeners[i].slice(0), this.listeners[i].splice(n, 1), n > -1; }, e.trigger = function(i) { var r = this.listeners[i]; if (r) if (arguments.length === 2) for (var n = r.length, a = 0; a < n; ++a) r[a].call(this, arguments[1]); else for (var u = Array.prototype.slice.call(arguments, 1), c = r.length, f = 0; f < c; ++f) r[f].apply(this, u); }, e.dispose = function() { this.listeners = {}; }, e.pipe = function(i) { this.on("data", function(r) { i.push(r); }); }, s; }(), xm = function(e) { return D.atob ? D.atob(e) : Buffer.from(e, "base64").toString("binary"); }; function Dc(s) { for (var e = xm(s), t = new Uint8Array(e.length), i = 0; i < e.length; i++) t[i] = e.charCodeAt(i); return t; } /*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */ class Sm extends vo { constructor() { super(), this.buffer = ""; } /** * Add new data to be parsed. * * @param {string} data the text to process */ push(e) { let t; for (this.buffer += e, t = this.buffer.indexOf(` `); t > -1; t = this.buffer.indexOf(` `)) this.trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1); } } const Em = " ", ba = function(s) { const e = /([0-9.]*)?@?([0-9.]*)?/.exec(s || ""), t = {}; return e[1] && (t.length = parseInt(e[1], 10)), e[2] && (t.offset = parseInt(e[2], 10)), t; }, Cm = function() { const