UNPKG

shaka-video-element

Version:

Custom element (web component) for Shaka Player

1,429 lines (1,428 loc) 1.33 MB
var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // ../../node_modules/shaka-player/dist/shaka-player.compiled.js var require_shaka_player_compiled = __commonJS({ "../../node_modules/shaka-player/dist/shaka-player.compiled.js"(exports) { (function() { var innerGlobal = typeof window != "undefined" ? window : global; var exportTo = {}; (function(window2, global2, module2) { var p; function ba(a) { var b = 0; return function() { return b < a.length ? { done: false, value: a[b++] } : { done: true }; }; } var ca = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) { if (a == Array.prototype || a == Object.prototype) return a; a[b] = c.value; return a; }; function ea(a) { a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window2 && window2, "object" == typeof self && self, "object" == typeof global2 && global2]; for (var b = 0; b < a.length; ++b) { var c = a[b]; if (c && c.Math == Math) return c; } throw Error("Cannot find global object"); } var fa = ea(this); function ha(a, b) { if (b) a: { var c = fa; a = a.split("."); for (var d = 0; d < a.length - 1; d++) { var e = a[d]; if (!(e in c)) break a; c = c[e]; } a = a[a.length - 1]; d = c[a]; b = b(d); b != d && null != b && ca(c, a, { configurable: true, writable: true, value: b }); } } ha("Symbol", function(a) { function b(f) { if (this instanceof b) throw new TypeError("Symbol is not a constructor"); return new c(d + (f || "") + "_" + e++, f); } function c(f, g) { this.g = f; ca(this, "description", { configurable: true, writable: true, value: g }); } if (a) return a; c.prototype.toString = function() { return this.g; }; var d = "jscomp_symbol_" + (1e9 * Math.random() >>> 0) + "_", e = 0; return b; }); ha("Symbol.iterator", function(a) { if (a) return a; a = Symbol("Symbol.iterator"); for (var b = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), c = 0; c < b.length; c++) { var d = fa[b[c]]; "function" === typeof d && "function" != typeof d.prototype[a] && ca(d.prototype, a, { configurable: true, writable: true, value: function() { return ia(ba(this)); } }); } return a; }); function ia(a) { a = { next: a }; a[Symbol.iterator] = function() { return this; }; return a; } function t(a) { var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator]; if (b) return b.call(a); if ("number" == typeof a.length) return { next: ba(a) }; throw Error(String(a) + " is not an iterable or ArrayLike"); } function x(a) { if (!(a instanceof Array)) { a = t(a); for (var b, c = []; !(b = a.next()).done; ) c.push(b.value); a = c; } return a; } var ja = "function" == typeof Object.create ? Object.create : function(a) { function b() { } b.prototype = a; return new b(); }, ka; if ("function" == typeof Object.setPrototypeOf) ka = Object.setPrototypeOf; else { var la; a: { var ma = { a: true }, na = {}; try { na.__proto__ = ma; la = na.a; break a; } catch (a) { } la = false; } ka = la ? function(a, b) { a.__proto__ = b; if (a.__proto__ !== b) throw new TypeError(a + " is not extensible"); return a; } : null; } var oa = ka; function pa(a, b) { a.prototype = ja(b.prototype); a.prototype.constructor = a; if (oa) oa(a, b); else for (var c in b) if ("prototype" != c) if (Object.defineProperties) { var d = Object.getOwnPropertyDescriptor(b, c); d && Object.defineProperty(a, c, d); } else a[c] = b[c]; a.xm = b.prototype; } function ta() { this.o = false; this.l = null; this.h = void 0; this.g = 1; this.j = this.m = 0; this.A = this.i = null; } function ua(a) { if (a.o) throw new TypeError("Generator is already running"); a.o = true; } ta.prototype.s = function(a) { this.h = a; }; function va(a, b) { a.i = { Ph: b, ai: true }; a.g = a.m || a.j; } ta.prototype.return = function(a) { this.i = { return: a }; this.g = this.j; }; function F(a, b, c) { a.g = c; return { value: b }; } ta.prototype.u = function(a) { this.g = a; }; function G(a) { a.g = 0; } function wa(a, b, c) { a.m = b; void 0 != c && (a.j = c); } function xa(a, b) { a.m = 0; a.j = b || 0; } function za(a, b, c) { a.g = b; a.m = c || 0; } function Aa(a, b) { a.m = b || 0; b = a.i.Ph; a.i = null; return b; } function Ba(a) { a.A = [a.i]; a.m = 0; a.j = 0; } function Da(a, b) { var c = a.A.splice(0)[0]; (c = a.i = a.i || c) ? c.ai ? a.g = a.m || a.j : void 0 != c.u && a.j < c.u ? (a.g = c.u, a.i = null) : a.g = a.j : a.g = b; } function Ea(a) { this.g = new ta(); this.h = a; } function Ha(a, b) { ua(a.g); var c = a.g.l; if (c) return Ia(a, "return" in c ? c["return"] : function(d) { return { value: d, done: true }; }, b, a.g.return); a.g.return(b); return Ka(a); } function Ia(a, b, c, d) { try { var e = b.call(a.g.l, c); if (!(e instanceof Object)) throw new TypeError("Iterator result " + e + " is not an object"); if (!e.done) return a.g.o = false, e; var f = e.value; } catch (g) { return a.g.l = null, va(a.g, g), Ka(a); } a.g.l = null; d.call(a.g, f); return Ka(a); } function Ka(a) { for (; a.g.g; ) try { var b = a.h(a.g); if (b) return a.g.o = false, { value: b.value, done: false }; } catch (c) { a.g.h = void 0, va(a.g, c); } a.g.o = false; if (a.g.i) { b = a.g.i; a.g.i = null; if (b.ai) throw b.Ph; return { value: b.return, done: true }; } return { value: void 0, done: true }; } function La(a) { this.next = function(b) { ua(a.g); a.g.l ? b = Ia(a, a.g.l.next, b, a.g.s) : (a.g.s(b), b = Ka(a)); return b; }; this.throw = function(b) { ua(a.g); a.g.l ? b = Ia(a, a.g.l["throw"], b, a.g.s) : (va(a.g, b), b = Ka(a)); return b; }; this.return = function(b) { return Ha(a, b); }; this[Symbol.iterator] = function() { return this; }; } function Ma(a) { function b(d) { return a.next(d); } function c(d) { return a.throw(d); } return new Promise(function(d, e) { function f(g) { g.done ? d(g.value) : Promise.resolve(g.value).then(b, c).then(f, e); } f(a.next()); }); } function Q(a) { return Ma(new La(new Ea(a))); } function Oa() { for (var a = Number(this), b = [], c = a; c < arguments.length; c++) b[c - a] = arguments[c]; return b; } ha("Promise", function(a) { function b(g) { this.h = 0; this.i = void 0; this.g = []; this.o = false; var h = this.j(); try { g(h.resolve, h.reject); } catch (k2) { h.reject(k2); } } function c() { this.g = null; } function d(g) { return g instanceof b ? g : new b(function(h) { h(g); }); } if (a) return a; c.prototype.h = function(g) { if (null == this.g) { this.g = []; var h = this; this.i(function() { h.l(); }); } this.g.push(g); }; var e = fa.setTimeout; c.prototype.i = function(g) { e(g, 0); }; c.prototype.l = function() { for (; this.g && this.g.length; ) { var g = this.g; this.g = []; for (var h = 0; h < g.length; ++h) { var k2 = g[h]; g[h] = null; try { k2(); } catch (l) { this.j(l); } } } this.g = null; }; c.prototype.j = function(g) { this.i(function() { throw g; }); }; b.prototype.j = function() { function g(l) { return function(m) { k2 || (k2 = true, l.call(h, m)); }; } var h = this, k2 = false; return { resolve: g(this.F), reject: g(this.l) }; }; b.prototype.F = function(g) { if (g === this) this.l(new TypeError("A Promise cannot resolve to itself")); else if (g instanceof b) this.H(g); else { a: switch (typeof g) { case "object": var h = null != g; break a; case "function": h = true; break a; default: h = false; } h ? this.C(g) : this.m(g); } }; b.prototype.C = function(g) { var h = void 0; try { h = g.then; } catch (k2) { this.l(k2); return; } "function" == typeof h ? this.I(h, g) : this.m(g); }; b.prototype.l = function(g) { this.s(2, g); }; b.prototype.m = function(g) { this.s(1, g); }; b.prototype.s = function(g, h) { if (0 != this.h) throw Error("Cannot settle(" + g + ", " + h + "): Promise already settled in state" + this.h); this.h = g; this.i = h; 2 === this.h && this.G(); this.A(); }; b.prototype.G = function() { var g = this; e(function() { if (g.B()) { var h = fa.console; "undefined" !== typeof h && h.error(g.i); } }, 1); }; b.prototype.B = function() { if (this.o) return false; var g = fa.CustomEvent, h = fa.Event, k2 = fa.dispatchEvent; if ("undefined" === typeof k2) return true; "function" === typeof g ? g = new g("unhandledrejection", { cancelable: true }) : "function" === typeof h ? g = new h("unhandledrejection", { cancelable: true }) : (g = fa.document.createEvent("CustomEvent"), g.initCustomEvent("unhandledrejection", false, true, g)); g.promise = this; g.reason = this.i; return k2(g); }; b.prototype.A = function() { if (null != this.g) { for (var g = 0; g < this.g.length; ++g) f.h(this.g[g]); this.g = null; } }; var f = new c(); b.prototype.H = function(g) { var h = this.j(); g.Je(h.resolve, h.reject); }; b.prototype.I = function(g, h) { var k2 = this.j(); try { g.call(h, k2.resolve, k2.reject); } catch (l) { k2.reject(l); } }; b.prototype.then = function(g, h) { function k2(q, r) { return "function" == typeof q ? function(u) { try { l(q(u)); } catch (w) { m(w); } } : r; } var l, m, n = new b(function(q, r) { l = q; m = r; }); this.Je(k2(g, l), k2(h, m)); return n; }; b.prototype.catch = function(g) { return this.then(void 0, g); }; b.prototype.Je = function(g, h) { function k2() { switch (l.h) { case 1: g(l.i); break; case 2: h(l.i); break; default: throw Error("Unexpected state: " + l.h); } } var l = this; null == this.g ? f.h(k2) : this.g.push(k2); this.o = true; }; b.resolve = d; b.reject = function(g) { return new b(function(h, k2) { k2(g); }); }; b.race = function(g) { return new b(function(h, k2) { for (var l = t(g), m = l.next(); !m.done; m = l.next()) d(m.value).Je(h, k2); }); }; b.all = function(g) { var h = t(g), k2 = h.next(); return k2.done ? d([]) : new b(function(l, m) { function n(u) { return function(w) { q[u] = w; r--; 0 == r && l(q); }; } var q = [], r = 0; do q.push(void 0), r++, d(k2.value).Je(n(q.length - 1), m), k2 = h.next(); while (!k2.done); }); }; return b; }); function Pa(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } ha("WeakMap", function(a) { function b(k2) { this.g = (h += Math.random() + 1).toString(); if (k2) { k2 = t(k2); for (var l; !(l = k2.next()).done; ) l = l.value, this.set(l[0], l[1]); } } function c() { } function d(k2) { var l = typeof k2; return "object" === l && null !== k2 || "function" === l; } function e(k2) { if (!Pa(k2, g)) { var l = new c(); ca(k2, g, { value: l }); } } function f(k2) { var l = Object[k2]; l && (Object[k2] = function(m) { if (m instanceof c) return m; Object.isExtensible(m) && e(m); return l(m); }); } if (function() { if (!a || !Object.seal) return false; try { var k2 = Object.seal({}), l = Object.seal({}), m = new a([[k2, 2], [l, 3]]); if (2 != m.get(k2) || 3 != m.get(l)) return false; m.delete(k2); m.set(l, 4); return !m.has(k2) && 4 == m.get(l); } catch (n) { return false; } }()) return a; var g = "$jscomp_hidden_" + Math.random(); f("freeze"); f("preventExtensions"); f("seal"); var h = 0; b.prototype.set = function(k2, l) { if (!d(k2)) throw Error("Invalid WeakMap key"); e(k2); if (!Pa(k2, g)) throw Error("WeakMap key fail: " + k2); k2[g][this.g] = l; return this; }; b.prototype.get = function(k2) { return d(k2) && Pa(k2, g) ? k2[g][this.g] : void 0; }; b.prototype.has = function(k2) { return d(k2) && Pa( k2, g ) && Pa(k2[g], this.g); }; b.prototype.delete = function(k2) { return d(k2) && Pa(k2, g) && Pa(k2[g], this.g) ? delete k2[g][this.g] : false; }; return b; }); ha("Map", function(a) { function b() { var h = {}; return h.sc = h.next = h.head = h; } function c(h, k2) { var l = h[1]; return ia(function() { if (l) { for (; l.head != h[1]; ) l = l.sc; for (; l.next != l.head; ) return l = l.next, { done: false, value: k2(l) }; l = null; } return { done: true, value: void 0 }; }); } function d(h, k2) { var l = k2 && typeof k2; "object" == l || "function" == l ? f.has(k2) ? l = f.get(k2) : (l = "" + ++g, f.set(k2, l)) : l = "p_" + k2; var m = h[0][l]; if (m && Pa(h[0], l)) for (h = 0; h < m.length; h++) { var n = m[h]; if (k2 !== k2 && n.key !== n.key || k2 === n.key) return { id: l, list: m, index: h, entry: n }; } return { id: l, list: m, index: -1, entry: void 0 }; } function e(h) { this[0] = {}; this[1] = b(); this.size = 0; if (h) { h = t(h); for (var k2; !(k2 = h.next()).done; ) k2 = k2.value, this.set(k2[0], k2[1]); } } if (function() { if (!a || "function" != typeof a || !a.prototype.entries || "function" != typeof Object.seal) return false; try { var h = Object.seal({ x: 4 }), k2 = new a(t([[h, "s"]])); if ("s" != k2.get(h) || 1 != k2.size || k2.get({ x: 4 }) || k2.set({ x: 4 }, "t") != k2 || 2 != k2.size) return false; var l = k2.entries(), m = l.next(); if (m.done || m.value[0] != h || "s" != m.value[1]) return false; m = l.next(); return m.done || 4 != m.value[0].x || "t" != m.value[1] || !l.next().done ? false : true; } catch (n) { return false; } }()) return a; var f = /* @__PURE__ */ new WeakMap(); e.prototype.set = function(h, k2) { h = 0 === h ? 0 : h; var l = d(this, h); l.list || (l.list = this[0][l.id] = []); l.entry ? l.entry.value = k2 : (l.entry = { next: this[1], sc: this[1].sc, head: this[1], key: h, value: k2 }, l.list.push(l.entry), this[1].sc.next = l.entry, this[1].sc = l.entry, this.size++); return this; }; e.prototype.delete = function(h) { h = d(this, h); return h.entry && h.list ? (h.list.splice(h.index, 1), h.list.length || delete this[0][h.id], h.entry.sc.next = h.entry.next, h.entry.next.sc = h.entry.sc, h.entry.head = null, this.size--, true) : false; }; e.prototype.clear = function() { this[0] = {}; this[1] = this[1].sc = b(); this.size = 0; }; e.prototype.has = function(h) { return !!d(this, h).entry; }; e.prototype.get = function(h) { return (h = d(this, h).entry) && h.value; }; e.prototype.entries = function() { return c(this, function(h) { return [h.key, h.value]; }); }; e.prototype.keys = function() { return c(this, function(h) { return h.key; }); }; e.prototype.values = function() { return c(this, function(h) { return h.value; }); }; e.prototype.forEach = function(h, k2) { for (var l = this.entries(), m; !(m = l.next()).done; ) m = m.value, h.call(k2, m[1], m[0], this); }; e.prototype[Symbol.iterator] = e.prototype.entries; var g = 0; return e; }); ha("Set", function(a) { function b(c) { this.g = /* @__PURE__ */ new Map(); if (c) { c = t(c); for (var d; !(d = c.next()).done; ) this.add(d.value); } this.size = this.g.size; } if (function() { if (!a || "function" != typeof a || !a.prototype.entries || "function" != typeof Object.seal) return false; try { var c = Object.seal({ x: 4 }), d = new a(t([c])); if (!d.has(c) || 1 != d.size || d.add(c) != d || 1 != d.size || d.add({ x: 4 }) != d || 2 != d.size) return false; var e = d.entries(), f = e.next(); if (f.done || f.value[0] != c || f.value[1] != c) return false; f = e.next(); return f.done || f.value[0] == c || 4 != f.value[0].x || f.value[1] != f.value[0] ? false : e.next().done; } catch (g) { return false; } }()) return a; b.prototype.add = function(c) { c = 0 === c ? 0 : c; this.g.set(c, c); this.size = this.g.size; return this; }; b.prototype.delete = function(c) { c = this.g.delete(c); this.size = this.g.size; return c; }; b.prototype.clear = function() { this.g.clear(); this.size = 0; }; b.prototype.has = function(c) { return this.g.has(c); }; b.prototype.entries = function() { return this.g.entries(); }; b.prototype.values = function() { return this.g.values(); }; b.prototype.keys = b.prototype.values; b.prototype[Symbol.iterator] = b.prototype.values; b.prototype.forEach = function(c, d) { var e = this; this.g.forEach(function(f) { return c.call(d, f, f, e); }); }; return b; }); function Qa(a, b) { a instanceof String && (a += ""); var c = 0, d = false, e = { next: function() { if (!d && c < a.length) { var f = c++; return { value: b(f, a[f]), done: false }; } d = true; return { done: true, value: void 0 }; } }; e[Symbol.iterator] = function() { return e; }; return e; } ha("Array.prototype.values", function(a) { return a ? a : function() { return Qa(this, function(b, c) { return c; }); }; }); ha("Array.from", function(a) { return a ? a : function(b, c, d) { c = null != c ? c : function(h) { return h; }; var e = [], f = "undefined" != typeof Symbol && Symbol.iterator && b[Symbol.iterator]; if ("function" == typeof f) { b = f.call(b); for (var g = 0; !(f = b.next()).done; ) e.push(c.call(d, f.value, g++)); } else for (f = b.length, g = 0; g < f; g++) e.push(c.call(d, b[g], g)); return e; }; }); ha("Array.prototype.keys", function(a) { return a ? a : function() { return Qa(this, function(b) { return b; }); }; }); ha("Object.is", function(a) { return a ? a : function(b, c) { return b === c ? 0 !== b || 1 / b === 1 / c : b !== b && c !== c; }; }); ha("Array.prototype.includes", function(a) { return a ? a : function(b, c) { var d = this; d instanceof String && (d = String(d)); var e = d.length; c = c || 0; for (0 > c && (c = Math.max(c + e, 0)); c < e; c++) { var f = d[c]; if (f === b || Object.is(f, b)) return true; } return false; }; }); function Ra(a, b, c) { if (null == a) throw new TypeError("The 'this' value for String.prototype." + c + " must not be null or undefined"); if (b instanceof RegExp) throw new TypeError("First argument to String.prototype." + c + " must not be a regular expression"); return a + ""; } ha("String.prototype.includes", function(a) { return a ? a : function(b, c) { return -1 !== Ra(this, b, "includes").indexOf(b, c || 0); }; }); ha("String.fromCodePoint", function(a) { return a ? a : function(b) { for (var c = "", d = 0; d < arguments.length; d++) { var e = Number(arguments[d]); if (0 > e || 1114111 < e || e !== Math.floor(e)) throw new RangeError("invalid_code_point " + e); 65535 >= e ? c += String.fromCharCode(e) : (e -= 65536, c += String.fromCharCode(e >>> 10 & 1023 | 55296), c += String.fromCharCode(e & 1023 | 56320)); } return c; }; }); function Sa(a, b, c) { a instanceof String && (a = String(a)); for (var d = a.length, e = 0; e < d; e++) { var f = a[e]; if (b.call(c, f, e, a)) return { Yh: e, v: f }; } return { Yh: -1, v: void 0 }; } ha("Array.prototype.findIndex", function(a) { return a ? a : function(b, c) { return Sa(this, b, c).Yh; }; }); ha("WeakSet", function(a) { function b(c) { this.g = /* @__PURE__ */ new WeakMap(); if (c) { c = t(c); for (var d; !(d = c.next()).done; ) this.add(d.value); } } if (function() { if (!a || !Object.seal) return false; try { var c = Object.seal({}), d = Object.seal({}), e = new a([c]); if (!e.has(c) || e.has(d)) return false; e.delete(c); e.add(d); return !e.has(c) && e.has(d); } catch (f) { return false; } }()) return a; b.prototype.add = function(c) { this.g.set(c, true); return this; }; b.prototype.has = function(c) { return this.g.has(c); }; b.prototype.delete = function(c) { return this.g.delete(c); }; return b; }); ha("Array.prototype.find", function(a) { return a ? a : function(b, c) { return Sa(this, b, c).v; }; }); ha("String.prototype.startsWith", function(a) { return a ? a : function(b, c) { var d = Ra(this, b, "startsWith"), e = d.length, f = b.length; c = Math.max(0, Math.min(c | 0, d.length)); for (var g = 0; g < f && c < e; ) if (d[c++] != b[g++]) return false; return g >= f; }; }); ha("Object.entries", function(a) { return a ? a : function(b) { var c = [], d; for (d in b) Pa(b, d) && c.push([d, b[d]]); return c; }; }); var Ta = "function" == typeof Object.assign ? Object.assign : function(a, b) { for (var c = 1; c < arguments.length; c++) { var d = arguments[c]; if (d) for (var e in d) Pa(d, e) && (a[e] = d[e]); } return a; }; ha("Object.assign", function(a) { return a || Ta; }); ha("Promise.prototype.finally", function(a) { return a ? a : function(b) { return this.then(function(c) { return Promise.resolve(b()).then(function() { return c; }); }, function(c) { return Promise.resolve(b()).then(function() { throw c; }); }); }; }); ha("Array.prototype.entries", function(a) { return a ? a : function() { return Qa(this, function(b, c) { return [b, c]; }); }; }); ha("Number.isNaN", function(a) { return a ? a : function(b) { return "number" === typeof b && isNaN(b); }; }); ha("String.prototype.repeat", function(a) { return a ? a : function(b) { var c = Ra(this, null, "repeat"); if (0 > b || 1342177279 < b) throw new RangeError("Invalid count value"); b |= 0; for (var d = ""; b; ) if (b & 1 && (d += c), b >>>= 1) c += c; return d; }; }); ha("Number.EPSILON", function() { return Math.pow(2, -52); }); ha("Number.MAX_SAFE_INTEGER", function() { return 9007199254740991; }); ha("Number.isFinite", function(a) { return a ? a : function(b) { return "number" !== typeof b ? false : !isNaN(b) && Infinity !== b && -Infinity !== b; }; }); ha("Object.values", function(a) { return a ? a : function(b) { var c = [], d; for (d in b) Pa(b, d) && c.push(b[d]); return c; }; }); ha("Math.log2", function(a) { return a ? a : function(b) { return Math.log(b) / Math.LN2; }; }); ha("String.prototype.endsWith", function(a) { return a ? a : function(b, c) { var d = Ra(this, b, "endsWith"); void 0 === c && (c = d.length); c = Math.max(0, Math.min(c | 0, d.length)); for (var e = b.length; 0 < e && 0 < c; ) if (d[--c] != b[--e]) return false; return 0 >= e; }; }); ha("Math.trunc", function(a) { return a ? a : function(b) { b = Number(b); if (isNaN(b) || Infinity === b || -Infinity === b || 0 === b) return b; var c = Math.floor(Math.abs(b)); return 0 > b ? -c : c; }; }); var Ua = this || self; function T(a, b) { a = a.split("."); var c = Ua; a[0] in c || "undefined" == typeof c.execScript || c.execScript("var " + a[0]); for (var d; a.length && (d = a.shift()); ) a.length || void 0 === b ? c[d] && c[d] !== Object.prototype[d] ? c = c[d] : c = c[d] = {} : c[d] = b; } ; function Va(a) { this.g = Math.exp(Math.log(0.5) / a); this.i = this.h = 0; } Va.prototype.sample = function(a, b) { var c = Math.pow(this.g, a); b = b * (1 - c) + c * this.h; isNaN(b) || (this.h = b, this.i += a); }; function Wa(a) { return a.h / (1 - Math.pow(a.g, a.i)); } ; function Xa() { this.h = new Va(2); this.j = new Va(5); this.g = 0; this.i = 128e3; this.l = 16e3; } Xa.prototype.configure = function(a) { this.i = a.minTotalBytes; this.l = a.minBytes; this.h.g = Math.exp(Math.log(0.5) / a.fastHalfLife); this.j.g = Math.exp(Math.log(0.5) / a.slowHalfLife); }; Xa.prototype.sample = function(a, b) { if (!(b < this.l)) { var c = 8e3 * b / a; a /= 1e3; this.g += b; this.h.sample(a, c); this.j.sample(a, c); } }; Xa.prototype.getBandwidthEstimate = function(a) { return this.g < this.i ? a : Math.min(Wa(this.h), Wa(this.j)); }; function Ya() { } function ab() { } function bb() { } function cb(a) { var b = Oa.apply(1, arguments); db.has(a) || (db.add(a), bb.apply(Ya, x(b))); } function eb() { } function fb() { } function gb() { } var db = /* @__PURE__ */ new Set(); window2.console && ((/* @__PURE__ */ new Map()).set(1, function() { return console.error.apply(console, x(Oa.apply(0, arguments))); }).set(2, function() { return console.warn.apply(console, x(Oa.apply(0, arguments))); }).set(3, function() { return console.info.apply(console, x(Oa.apply(0, arguments))); }).set(4, function() { return console.log.apply(console, x(Oa.apply(0, arguments))); }).set(5, function() { return console.debug.apply(console, x(Oa.apply(0, arguments))); }).set(6, function() { return console.debug.apply(console, x(Oa.apply(0, arguments))); }), bb = function() { return console.warn.apply(console, x(Oa.apply(0, arguments))); }, ab = function() { console.error.apply(console, x(Oa.apply(0, arguments))); }); function hb() { this.g = /* @__PURE__ */ new Map(); } p = hb.prototype; p.push = function(a, b) { this.g.has(a) ? this.g.get(a).push(b) : this.g.set(a, [b]); }; p.get = function(a) { return this.g.has(a) ? this.g.get(a).slice() : null; }; p.remove = function(a, b) { if (this.g.has(a)) { var c = this.g.get(a).filter(function(d) { return d != b; }); this.g.set(a, c); c.length || this.g.delete(a); } }; p.forEach = function(a) { this.g.forEach(function(b, c) { a(c, b); }); }; p.size = function() { return this.g.size; }; p.keys = function() { return Array.from(this.g.keys()); }; function jb() { this.g = new hb(); } p = jb.prototype; p.release = function() { this.Qa(); this.g = null; }; p.D = function(a, b, c, d) { this.g && (a = new kb(a, b, c, d), this.g.push(b, a)); }; p.za = function(a, b, c, d) { function e(g) { f.Ja(a, b, e); c(g); } var f = this; this.D(a, b, e, d); }; p.Ja = function(a, b, c) { if (this.g) { var d = this.g.get(b) || []; d = t(d); for (var e = d.next(); !e.done; e = d.next()) e = e.value, e.target != a || c != e.listener && c || (e.Ja(), this.g.remove(b, e)); } }; p.Qa = function() { if (this.g) { for (var a = [], b = t(this.g.g.values()), c = b.next(); !c.done; c = b.next()) a.push.apply(a, x(c.value)); a = t(a); for (b = a.next(); !b.done; b = a.next()) b.value.Ja(); this.g.g.clear(); } }; T("shaka.util.EventManager", jb); jb.prototype.removeAll = jb.prototype.Qa; jb.prototype.unlisten = jb.prototype.Ja; jb.prototype.listenOnce = jb.prototype.za; jb.prototype.listen = jb.prototype.D; jb.prototype.release = jb.prototype.release; function kb(a, b, c, d) { this.target = a; this.type = b; this.listener = c; this.g = lb(a, d); this.target.addEventListener(b, c, this.g); } kb.prototype.Ja = function() { this.target.removeEventListener(this.type, this.listener, this.g); this.listener = this.target = null; this.g = false; }; function lb(a, b) { if (void 0 == b) return false; if ("boolean" == typeof b) return b; var c = /* @__PURE__ */ new Set(["passive", "capture"]); Object.keys(b).filter(function(d) { return !c.has(d); }); return nb(a) ? b : b.capture || false; } function nb(a) { var b = ob; if (void 0 == b) { b = false; try { var c = {}, d = { get: function() { b = true; return false; } }; Object.defineProperty(c, "passive", d); Object.defineProperty(c, "capture", d); d = function() { }; a.addEventListener("test", d, c); a.removeEventListener("test", d, c); } catch (e) { b = false; } ob = b; } return b || false; } var ob = void 0; T("shaka.config.AutoShowText", { NEVER: 0, ALWAYS: 1, IF_PREFERRED_TEXT_LANGUAGE: 2, IF_SUBTITLES_MAY_BE_NEEDED: 3 }); function pb(a) { this.h = a; this.g = void 0; } pb.prototype.value = function() { void 0 === this.g && (this.g = this.h()); return this.g; }; function rb() { return sb.value(); } var tb = null, ub = null, sb = new pb(function() { var a = void 0; tb && (a = tb()); !a && ub && (a = ub()); return a; }); function vb(a, b) { this.g = a; this.h = b; } vb.prototype.toString = function() { return "v" + this.g + "." + this.h; }; function wb(a, b) { var c = new vb(5, 0), d = xb, e = d.g, f = c.h - e.h; (0 < (c.g - e.g || f) ? d.i : d.h)(d.g, c, a, b); } function yb(a, b, c, d) { bb([c, "has been deprecated and will be removed in", b, ". We are currently at version", a, ". Additional information:", d].join(" ")); } function zb(a, b, c, d) { ab([c, "has been deprecated and has been removed in", b, ". We are now at version", a, ". Additional information:", d].join(" ")); } var xb = null; var Ab = RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"); function Bb(a) { var b; a instanceof Bb ? (Cb(this, a.ac), this.bd = a.bd, Db(this, a.Cb), Eb(this, a.sd), this.mb = a.mb, Fb(this, a.g.clone()), this.Mc = a.Mc) : a && (b = String(a).match(Ab)) ? (Cb(this, b[1] || "", true), this.bd = Gb(b[2] || ""), Db(this, b[3] || "", true), Eb(this, b[4]), this.mb = Gb(b[5] || "", true), Fb(this, b[6] || "", true), this.Mc = Gb(b[7] || "")) : this.g = new Hb(null); } p = Bb.prototype; p.ac = ""; p.bd = ""; p.Cb = ""; p.sd = null; p.mb = ""; p.Mc = ""; p.toString = function() { var a = [], b = this.ac; b && a.push(Ib(b, Jb, true), ":"); if (b = this.Cb) { a.push("//"); var c = this.bd; c && a.push(Ib(c, Jb, true), "@"); a.push(encodeURIComponent(b).replace(/%25([0-9a-fA-F]{2})/g, "%$1")); b = this.sd; null != b && a.push(":", String(b)); } if (b = this.mb) this.Cb && "/" != b.charAt(0) && a.push("/"), a.push(Ib(b, "/" == b.charAt(0) ? Kb : Lb, true)); (b = this.g.toString()) && a.push("?", b); (b = this.Mc) && a.push("#", Ib(b, Mb)); return a.join(""); }; p.resolve = function(a) { var b = this.clone(); "data" === b.ac && (b = new Bb()); var c = !!a.ac; c ? Cb(b, a.ac) : c = !!a.bd; c ? b.bd = a.bd : c = !!a.Cb; c ? Db(b, a.Cb) : c = null != a.sd; var d = a.mb; if (c) Eb(b, a.sd); else if (c = !!a.mb) { if ("/" != d.charAt(0)) if (this.Cb && !this.mb) d = "/" + d; else { var e = b.mb.lastIndexOf("/"); -1 != e && (d = b.mb.substr(0, e + 1) + d); } if (".." == d || "." == d) d = ""; else if (-1 != d.indexOf("./") || -1 != d.indexOf("/.")) { e = 0 == d.lastIndexOf("/", 0); d = d.split("/"); for (var f = [], g = 0; g < d.length; ) { var h = d[g++]; "." == h ? e && g == d.length && f.push("") : ".." == h ? ((1 < f.length || 1 == f.length && "" != f[0]) && f.pop(), e && g == d.length && f.push("")) : (f.push(h), e = true); } d = f.join("/"); } } c ? b.mb = d : c = "" !== a.g.toString(); c ? Fb(b, a.g.clone()) : c = !!a.Mc; c && (b.Mc = a.Mc); return b; }; p.clone = function() { return new Bb(this); }; function Cb(a, b, c) { a.ac = c ? Gb(b, true) : b; a.ac && (a.ac = a.ac.replace(/:$/, "")); } function Db(a, b, c) { a.Cb = c ? Gb(b, true) : b; } function Eb(a, b) { if (b) { b = Number(b); if (isNaN(b) || 0 > b) throw Error("Bad port number " + b); a.sd = b; } else a.sd = null; } function Fb(a, b, c) { b instanceof Hb ? a.g = b : (c || (b = Ib(b, Nb)), a.g = new Hb(b)); } function Gb(a, b) { return a ? b ? decodeURI(a) : decodeURIComponent(a) : ""; } function Ib(a, b, c) { return null != a ? (a = encodeURI(a).replace(b, Ob), c && (a = a.replace(/%25([0-9a-fA-F]{2})/g, "%$1")), a) : null; } function Ob(a) { a = a.charCodeAt(0); return "%" + (a >> 4 & 15).toString(16) + (a & 15).toString(16); } var Jb = /[#\/\?@]/g, Lb = /[#\?:]/g, Kb = /[#\?]/g, Nb = /[#\?@]/g, Mb = /#/g; function Hb(a) { this.g = a || null; } function Pb(a) { if (!a.fb && (a.fb = /* @__PURE__ */ new Map(), a.Id = 0, a.g)) for (var b = a.g.split("&"), c = 0; c < b.length; c++) { var d = b[c].indexOf("="), e = null; if (0 <= d) { var f = b[c].substring(0, d); e = b[c].substring(d + 1); } else f = b[c]; f = decodeURIComponent(f.replace(/\+/g, " ")); e = e || ""; a.add(f, decodeURIComponent(e.replace(/\+/g, " "))); } } p = Hb.prototype; p.fb = null; p.Id = null; function Qb(a) { Pb(a); return a.Id; } p.add = function(a, b) { Pb(this); this.g = null; var c = this.fb.has(a) ? this.fb.get(a) : null; c || this.fb.set(a, c = []); c.push(b); this.Id++; return this; }; p.set = function(a, b) { Pb(this); this.g = null; this.fb.has(a) ? this.fb.set(a, [b]) : this.add(a, b); return this; }; p.get = function(a) { Pb(this); return this.fb.get(a) || []; }; p.toString = function() { if (this.g) return this.g; if (!this.fb || !this.fb.size) return ""; for (var a = [], b = t(this.fb.keys()), c = b.next(); !c.done; c = b.next()) { var d = c.value; c = encodeURIComponent(d); d = this.fb.get(d); for (var e = 0; e < d.length; e++) { var f = c; "" !== d[e] && (f += "=" + encodeURIComponent(d[e])); a.push(f); } } return this.g = a.join("&"); }; p.clone = function() { var a = new Hb(); a.g = this.g; if (this.fb) { for (var b = /* @__PURE__ */ new Map(), c = t(this.fb), d = c.next(); !d.done; d = c.next()) { var e = t(d.value); d = e.next().value; e = e.next().value; b.set(d, e.concat()); } a.fb = b; a.Id = this.Id; } return a; }; function Rb() { } function Sb(a, b) { if (!a && !b) return true; if (!a || !b || a.byteLength != b.byteLength) return false; if ((ArrayBuffer.isView(a) ? a.buffer : a) == (ArrayBuffer.isView(b) ? b.buffer : b) && (a.byteOffset || 0) == (b.byteOffset || 0)) return true; var c = Tb(a); b = Tb(b); for (var d = 0; d < a.byteLength; d++) if (c[d] != b[d]) return false; return true; } function Ub(a) { return ArrayBuffer.isView(a) ? 0 == a.byteOffset && a.byteLength == a.buffer.byteLength ? a.buffer : new Uint8Array(a).buffer : a; } function Tb(a, b, c) { c = void 0 === c ? Infinity : c; return Vb(a, void 0 === b ? 0 : b, c, Uint8Array); } function Xb(a, b, c) { c = void 0 === c ? Infinity : c; return Vb(a, void 0 === b ? 0 : b, c, Uint16Array); } function Yb(a, b, c) { c = void 0 === c ? Infinity : c; return Vb(a, void 0 === b ? 0 : b, c, DataView); } function Vb(a, b, c, d) { var e = ArrayBuffer.isView(a) ? a.buffer : a, f = 1; "BYTES_PER_ELEMENT" in d && (f = d.BYTES_PER_ELEMENT); var g = ((a.byteOffset || 0) + a.byteLength) / f; a = Math.floor(Math.max(0, Math.min(((a.byteOffset || 0) + b) / f, g))); return new d(e, a, Math.floor(Math.min(a + Math.max(c, 0), g)) - a); } T("shaka.util.BufferUtils", Rb); Rb.toDataView = Yb; Rb.toUint16 = Xb; Rb.toUint8 = Tb; Rb.toArrayBuffer = Ub; Rb.equal = Sb; function U(a, b, c) { var d = Oa.apply(3, arguments); this.severity = a; this.category = b; this.code = c; this.data = d; this.handled = false; this.message = "Shaka Error " + this.code; if (Zb) try { throw Error(this.message || "Shaka Error"); } catch (e) { this.stack = e.stack; } } U.prototype.toString = function() { return "shaka.util.Error " + JSON.stringify(this, null, " "); }; T("shaka.util.Error", U); var Zb = true; U.Severity = { RECOVERABLE: 1, CRITICAL: 2 }; U.Category = { NETWORK: 1, TEXT: 2, MEDIA: 3, MANIFEST: 4, STREAMING: 5, DRM: 6, PLAYER: 7, CAST: 8, STORAGE: 9, ADS: 10 }; U.Code = { UNSUPPORTED_SCHEME: 1e3, BAD_HTTP_STATUS: 1001, HTTP_ERROR: 1002, TIMEOUT: 1003, MALFORMED_DATA_URI: 1004, REQUEST_FILTER_ERROR: 1006, RESPONSE_FILTER_ERROR: 1007, MALFORMED_TEST_URI: 1008, UNEXPECTED_TEST_REQUEST: 1009, ATTEMPTS_EXHAUSTED: 1010, SEGMENT_MISSING: 1011, INVALID_TEXT_HEADER: 2e3, INVALID_TEXT_CUE: 2001, UNABLE_TO_DETECT_ENCODING: 2003, BAD_ENCODING: 2004, INVALID_XML: 2005, INVALID_MP4_TTML: 2007, INVALID_MP4_VTT: 2008, UNABLE_TO_EXTRACT_CUE_START_TIME: 2009, INVALID_MP4_CEA: 2010, TEXT_COULD_NOT_GUESS_MIME_TYPE: 2011, CANNOT_ADD_EXTERNAL_T