@vindral/web-sdk 4.7.2 → 4.8.0-2-g31d0f7c0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CzQ6KH2E.js DELETED
@@ -1,4783 +0,0 @@
1
- import { n as e, t } from "./BsfwXDui.js";
2
- import { C as n, D as r, E as i, O as a, S as o, T as s, _ as c, b as l, g as u, h as ee, k as d, m as te, p as ne, t as re, v as ie, w as ae, x as oe, y as se } from "./BqvCHW1b.js";
3
- import { t as ce } from "./CuYn2z5X.js";
4
- import { i as f, n as p, r as m, t as h } from "./DSw1XhvD.js";
5
- import { c as le, n as ue, t as de } from "./D40eQS8l.js";
6
- import { n as fe, r as pe } from "./BaDhuUsA.js";
7
- import { C as me, S as he, _ as ge, a as _e, b as g, c as _, d as ve, f as ye, g as be, h as xe, i as v, l as Se, m as Ce, n as we, o as Te, p as Ee, r as y, s as De, t as Oe, u as b, v as ke, x as Ae, y as x } from "./BK-84KPi.js";
8
- import { t as S } from "./Tj9xPXja.js";
9
- import { t as je } from "./DQ5kuB8C.js";
10
- //#region ../../libs/utils/src/mediaMetadata.ts
11
- var Me = ({ title: e, subTitle: t = "Live stream", poster: n }) => {
12
- if (document.title = e, "mediaSession" in navigator) try {
13
- navigator.mediaSession.metadata = new MediaMetadata({
14
- title: e,
15
- artist: t,
16
- artwork: n ? [{ src: n }] : []
17
- });
18
- } catch (n) {
19
- navigator.mediaSession.metadata = new MediaMetadata({
20
- title: e,
21
- artist: t
22
- });
23
- }
24
- }, Ne = (e) => e === "mse" || e === "webcodecs" || e === "wasm";
25
- function Pe(e) {
26
- if (e === null || e === "auto") return;
27
- let t = e.split(",").filter(Ne);
28
- return t.length > 0 ? t : void 0;
29
- }
30
- function Fe(e) {
31
- if (e === "no-preference" || e === "prefer-hardware" || e === "prefer-software") return e;
32
- }
33
- //#endregion
34
- //#region ../../libs/player-next/src/components/VindralMenuButton.ts
35
- var Ie = document.createElement("template");
36
- Ie.innerHTML = "\n <style>\n :host([hidden]) {\n display: none;\n }\n </style>\n";
37
- var Le = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap(), Re = /* @__PURE__ */ new WeakMap(), ze = /* @__PURE__ */ new WeakMap(), Be = /* @__PURE__ */ new WeakMap(), Ve = /* @__PURE__ */ new WeakSet(), He = class extends v {
38
- constructor() {
39
- var e;
40
- super(), S(this, Ve), f(this, Le, void 0), f(this, C, void 0), f(this, Re, null), f(this, ze, (e) => {
41
- e.composedPath().includes(this) || this.hide();
42
- }), f(this, Be, () => {
43
- this.hide();
44
- }), (e = this.shadowRoot) == null || e.appendChild(Ie.content.cloneNode(!0));
45
- }
46
- connectedCallback() {
47
- var e, t, n, r, i;
48
- super.connectedCallback(), this.setAttribute("role", "button"), this.setAttribute("aria-haspopup", "listbox"), this.setAttribute("aria-expanded", String(((e = h(C, this)) == null ? void 0 : e.hidden) === !1));
49
- let a = (t = this.getAttribute("list-position")) == null ? "top" : t;
50
- (n = h(Le, this)) == null || n.setAttribute("list-position", a);
51
- let o = this.getRootNode(), s = [...(r = (i = this.shadowRoot) == null ? void 0 : i.querySelectorAll(":not(:defined)")) == null ? [] : r].filter((e) => e.localName.includes("-")).map((e) => customElements.whenDefined(e.localName));
52
- Promise.all(s).then(() => {
53
- if (o instanceof Document || o instanceof ShadowRoot) {
54
- var e;
55
- p(Re, this, o.querySelector("vindral-controller")), (e = h(Re, this)) == null || e.connectListener(this);
56
- }
57
- });
58
- }
59
- set listbox(e) {
60
- p(Le, this, e);
61
- }
62
- set listboxSlot(e) {
63
- p(C, this, e);
64
- }
65
- enable() {
66
- super.enable(), this.addEventListener("change", h(Be, this)), document.addEventListener("click", h(ze, this));
67
- }
68
- hide() {
69
- var e;
70
- !h(C, this) || (e = h(C, this)) != null && e.hidden || (h(C, this).hidden = !0, this.setAttribute("aria-expanded", "false"), this.dispatchEvent(new CustomEvent(x.UNLOCK_UI, {
71
- bubbles: !0,
72
- composed: !0
73
- })), this.focus());
74
- }
75
- handleClick(e) {
76
- h(C, this) && !e.composedPath().includes(h(C, this)) && m(Ve, this, Ue).call(this);
77
- }
78
- };
79
- function Ue() {
80
- var e;
81
- (e = h(C, this)) != null && e.hidden ? m(Ve, this, We).call(this) : this.hide();
82
- }
83
- function We() {
84
- var e, t;
85
- (e = h(C, this)) != null && e.hidden && (h(C, this).hidden = !1, this.setAttribute("aria-expanded", "true"), (t = h(Le, this)) == null || t.focus(), this.dispatchEvent(new CustomEvent(x.LOCK_UI, {
86
- bubbles: !0,
87
- composed: !0
88
- })));
89
- }
90
- //#endregion
91
- //#region ../../libs/player-next/src/components/AdvancedRenditionMenu.ts
92
- var Ge, Ke = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon icon-tabler icon-tabler-settings-filled\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"#2c3e50\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z\" stroke-width=\"0\" fill=\"currentColor\" />\n</svg>\n", qe = document.createElement("template");
93
- qe.innerHTML = `
94
- <style>
95
- :host {
96
- display: var(--rendition-menu-display);
97
- }
98
- </style>
99
-
100
- <slot name="button">${Ke}</slot>
101
- <slot name="listbox" hidden>
102
- <vindral-advanced-rendition-menu-list id="listbox" part="listbox"></vindral-advanced-rendition-menu-list>
103
- </slot>
104
- `;
105
- var Je = /* @__PURE__ */ new WeakSet(), Ye = class extends He {
106
- constructor() {
107
- var e, t, n;
108
- super(), S(this, Je), (e = this.shadowRoot) == null || e.appendChild(qe.content.cloneNode(!0)), this.listbox = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[part=listbox]"), this.listboxSlot = (n = this.shadowRoot) == null ? void 0 : n.querySelector("slot[name=listbox]");
109
- }
110
- connectedCallback() {
111
- super.connectedCallback(), m(Je, this, Xe).call(this), this.setAttribute("aria-label", "Quality");
112
- }
113
- attributeChangedCallback(e, t, n) {
114
- super.attributeChangedCallback(e, t, n), e === g.RENDITION_LEVELS && m(Je, this, Xe).call(this);
115
- }
116
- };
117
- Ge = Ye;
118
- function Xe() {
119
- let e = this.getAttribute(g.RENDITION_LEVELS);
120
- !e || e === "[]" ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
121
- }
122
- e(Ye, "observedAttributes", [...y(Ge, "observedAttributes", Ge), g.RENDITION_LEVELS]);
123
- //#endregion
124
- //#region ../../libs/player-next/src/components/AdvancedRenditionMenuList.ts
125
- var Ze = document.createElement("template");
126
- Ze.innerHTML = "\n <style>\n :host {\n font: inherit;\n cursor: default;\n padding: var(--padding-2) !important;\n padding-top: var(--padding-3) !important;\n border-radius: 0.25em;\n position: absolute;\n min-width: 220px !important;\n background: var(--bg-subtle);\n z-index: 1;\n overflow: auto;\n }\n\n :host([list-position=\"top\"]) {\n bottom: calc(100% + 0.5em);\n transform: translate(-50%);\n }\n\n :host([list-position=\"bottom\"]) {\n top: calc(100% + 0.5em);\n }\n\n :host::-webkit-scrollbar {\n width: 5px;\n padding-right: 5px;\n }\n\n :host::-webkit-scrollbar-thumb {\n background-color: var(--fg-extra-subtle);\n border-radius: 10px;\n border: 0;\n }\n\n :host::-webkit-scrollbar-track {\n border-radius: 10px;\n background-color: transparent;\n }\n\n .mode-toggle {\n display: flex;\n gap: var(--padding-1);\n margin-bottom: var(--padding-2);\n }\n\n .mode-btn {\n flex: 1;\n padding: var(--padding-1) var(--padding-2);\n border: none;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n cursor: pointer;\n background: var(--bg-component);\n color: var(--fg-default);\n transition: background 0.15s;\n }\n\n .mode-btn:hover {\n background: var(--bg-component-hover);\n }\n\n .mode-btn[data-active=\"true\"] {\n background: var(--accent);\n color: #ffffff;\n }\n\n .setting-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--padding-2);\n margin-bottom: var(--padding-2);\n padding: 0 var(--padding-1);\n }\n\n .setting-label {\n font-size: 10px;\n color: var(--fg-subtle);\n text-transform: uppercase;\n letter-spacing: 0.04em;\n }\n\n .setting-toggle-btn {\n border: none;\n border-radius: 999px;\n background: var(--bg-component);\n color: var(--fg-default);\n font-size: 10px;\n font-weight: 600;\n min-width: 44px;\n padding: 4px 10px;\n cursor: pointer;\n transition: background 0.15s;\n }\n\n .setting-toggle-btn[data-active=\"true\"] {\n background: var(--accent);\n color: #ffffff;\n }\n\n .setting-toggle-btn:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .quality-status-text {\n font-size: 10px;\n color: var(--fg-subtle);\n margin-bottom: var(--padding-2);\n padding: 0 var(--padding-1);\n font-style: italic;\n }\n\n .menu {\n display: grid;\n gap: var(--padding-1);\n }\n\n .menu-item {\n display: flex;\n align-items: center;\n gap: var(--padding-2);\n padding: var(--padding-2);\n border-radius: 4px;\n cursor: pointer;\n font-size: 13px;\n position: relative;\n }\n\n .menu-item:hover {\n background: var(--bg-component-hover);\n }\n\n .menu-item[data-selected=\"true\"] {\n background: var(--bg-component-active);\n border: 1px solid var(--fg-extra-subtle);\n }\n\n .menu-item[data-capped=\"true\"] {\n opacity: 0.5;\n }\n\n .menu-item:focus-visible {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n outline: 0;\n }\n\n .menu-item-info {\n display: flex;\n flex-direction: column;\n gap: 2px;\n }\n\n .menu-item-title {\n font-weight: 500;\n }\n\n .menu-item-subtitle {\n font-size: 10px;\n opacity: 0.6;\n }\n\n .current-label {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n color: var(--accent);\n margin-left: auto;\n display: none;\n }\n\n .menu-item[data-playing=\"true\"] .current-label {\n display: block;\n }\n </style>\n\n <slot>\n <div class=\"mode-toggle\">\n <button class=\"mode-btn\" data-mode=\"auto\">Auto (ABR)</button>\n <button class=\"mode-btn\" data-mode=\"fixed\">Fixed</button>\n </div>\n <div class=\"setting-row\">\n <span class=\"setting-label\">Size cap</span>\n <button id=\"size-cap-toggle\" class=\"setting-toggle-btn\" type=\"button\"></button>\n </div>\n <div class=\"quality-status-text\" id=\"quality-status-text\"></div>\n <div class=\"menu\" role=\"menu\" aria-label=\"Quality options\"></div>\n </slot>\n";
127
- var Qe = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakSet(), ct = class extends HTMLElement {
128
- constructor() {
129
- super(), S(this, w), f(this, Qe, []), f(this, $e, 2 ** 53 - 1), f(this, et, !1), f(this, tt, !0), f(this, nt, null), f(this, rt, null), f(this, it, []), f(this, at, null), f(this, ot, null), f(this, st, null), e(this, "handleEvent", (e) => {
130
- switch (e.type) {
131
- case "keydown":
132
- m(w, this, bt).call(this, e);
133
- break;
134
- }
135
- }), this.attachShadow({ mode: "open" }).appendChild(Ze.content.cloneNode(!0));
136
- }
137
- connectedCallback() {
138
- let e = this.getRootNode();
139
- if (e instanceof ShadowRoot) {
140
- var t;
141
- p(at, this, e.host.closest("vindral-controller")), (t = h(at, this)) == null || t.connectListener(this), m(w, this, mt).call(this), m(w, this, lt).call(this), m(w, this, ut).call(this), m(w, this, ht).call(this), p(ot, this, e.host), this.addEventListener("keydown", this);
142
- }
143
- }
144
- disconnectedCallback() {
145
- var e, t;
146
- (e = h(at, this)) == null || e.disconnectListener(this), (t = h(st, this)) == null || t.disconnect(), p(st, this, null), this.removeEventListener("keydown", this);
147
- }
148
- attributeChangedCallback(e, t, n) {
149
- t !== n && (e === g.RENDITION_LEVELS && n && (this.list = JSON.parse(n)), e === g.MAX_VIDEO_BITRATE && (this.maxVideoBitrate = n ? parseInt(n, 10) : 2 ** 53 - 1), e === g.ABR_ENABLED && (p(et, this, b(n, !1)), m(w, this, ft).call(this), m(w, this, _t).call(this)), e === g.RENDITION_LEVEL && n && (p(nt, this, JSON.parse(n)), m(w, this, _t).call(this)), e === g.SIZE_BASED_RESOLUTION_CAP_ENABLED && (p(tt, this, b(n, !0)), m(w, this, pt).call(this)));
150
- }
151
- set list(e) {
152
- p(Qe, this, e), m(w, this, ht).call(this);
153
- }
154
- set maxVideoBitrate(e) {
155
- p($e, this, e), m(w, this, _t).call(this);
156
- }
157
- get keysUsed() {
158
- return [
159
- "Enter",
160
- "Escape",
161
- "Tab",
162
- " ",
163
- "ArrowDown",
164
- "ArrowUp",
165
- "Home",
166
- "End"
167
- ];
168
- }
169
- focus() {
170
- var e;
171
- (e = h(rt, this)) == null || e.focus();
172
- }
173
- };
174
- function lt() {
175
- var e, t;
176
- let n = (e = this.shadowRoot) == null ? void 0 : e.querySelector("[data-mode=\"auto\"]"), r = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[data-mode=\"fixed\"]");
177
- n == null || n.addEventListener("click", () => {
178
- p(et, this, !0), m(w, this, ft).call(this), m(w, this, _t).call(this), this.dispatchEvent(new CustomEvent(x.SET_ABR_MODE, {
179
- bubbles: !0,
180
- composed: !0,
181
- detail: !0
182
- }));
183
- }), r == null || r.addEventListener("click", () => {
184
- let e = m(w, this, dt).call(this);
185
- e && this.dispatchEvent(new CustomEvent(x.SET_RENDITION, {
186
- bubbles: !0,
187
- composed: !0,
188
- detail: e
189
- })), p(et, this, !1), m(w, this, ft).call(this), m(w, this, _t).call(this), this.dispatchEvent(new CustomEvent(x.SET_ABR_MODE, {
190
- bubbles: !0,
191
- composed: !0,
192
- detail: !1
193
- }));
194
- }), m(w, this, ft).call(this);
195
- }
196
- function ut() {
197
- var e;
198
- let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#size-cap-toggle");
199
- t == null || t.addEventListener("click", () => {
200
- let e = !h(tt, this);
201
- p(tt, this, e), m(w, this, pt).call(this), this.dispatchEvent(new CustomEvent(x.SET_SIZE_BASED_RESOLUTION_CAP_MODE, {
202
- bubbles: !0,
203
- composed: !0,
204
- detail: e
205
- }));
206
- }), m(w, this, pt).call(this);
207
- }
208
- function dt() {
209
- let e = [...h(Qe, this)].sort((e, t) => {
210
- var n, r;
211
- return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
212
- });
213
- return e.find((e) => {
214
- var t;
215
- return ((t = e.video) == null ? void 0 : t.bitRate) && e.video.bitRate <= h($e, this);
216
- }) || e[e.length - 1] || null;
217
- }
218
- function ft() {
219
- var e, t, n;
220
- let r = (e = this.shadowRoot) == null ? void 0 : e.querySelector("[data-mode=\"auto\"]"), i = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[data-mode=\"fixed\"]"), a = (n = this.shadowRoot) == null ? void 0 : n.querySelector("#quality-status-text");
221
- r && i && (r.setAttribute("data-active", String(h(et, this))), i.setAttribute("data-active", String(!h(et, this)))), a && (a.textContent = h(et, this) ? "Select maximum allowed quality" : "Select specific quality (may cause buffering)"), m(w, this, pt).call(this);
222
- }
223
- function pt() {
224
- var e;
225
- let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#size-cap-toggle");
226
- t && (t.textContent = h(tt, this) ? "On" : "Off", t.setAttribute("aria-pressed", String(h(tt, this))), t.setAttribute("data-active", String(h(tt, this))), t.disabled = !h(et, this), t.title = h(et, this) ? "Toggle size-based resolution cap" : "Only available in Auto (ABR) mode");
227
- }
228
- function mt() {
229
- var e;
230
- (e = h(st, this)) == null || e.disconnect(), p(st, this, new IntersectionObserver((e) => {
231
- e.forEach((e) => {
232
- if (e.intersectionRatio === 1) {
233
- this.style.height = "auto";
234
- return;
235
- } else if (e.intersectionRatio > 0) {
236
- let t = e.intersectionRect.height, n = Math.max(0, t - 24);
237
- this.style.height = `${n}px`;
238
- } else this.style.height = "auto";
239
- });
240
- }, {
241
- root: h(at, this),
242
- threshold: 0
243
- })), h(st, this).observe(this);
244
- }
245
- function ht() {
246
- var e;
247
- let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".menu");
248
- t && (p(it, this, []), t.innerHTML = "", h(Qe, this).sort((e, t) => {
249
- var n, r;
250
- return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
251
- }).forEach((e) => {
252
- var n, r, i, a, o, s, c, l, u, ee;
253
- let d = document.createElement("div");
254
- d.setAttribute("role", "menuitem"), d.setAttribute("value", String((n = e.video) == null ? void 0 : n.height)), d.classList.add("menu-item"), d.tabIndex = -1;
255
- let te = document.createElement("div");
256
- te.className = "menu-item-info";
257
- let ne = document.createElement("span");
258
- ne.className = "menu-item-title", ne.textContent = e.video ? me(e.video) : "";
259
- let re = document.createElement("span");
260
- re.classList.add("menu-item-subtitle");
261
- let ie = m(w, this, gt).call(this, (r = e.video) == null ? void 0 : r.frameRate);
262
- re.textContent = `${he(((i = (a = e.video) == null ? void 0 : a.bitRate) == null ? 0 : i) + ((o = (s = e.audio) == null ? void 0 : s.bitRate) == null ? 0 : o))}, ${ie}fps`, te.appendChild(ne), te.appendChild(re), d.appendChild(te);
263
- let ae = document.createElement("span");
264
- ae.className = "current-label", ae.textContent = "Current", d.appendChild(ae), d.addEventListener("click", () => m(w, this, yt).call(this, e)), h(it, this).push({
265
- el: d,
266
- id: (c = (l = e.video) == null ? void 0 : l.id) == null ? -1 : c,
267
- bitrate: (u = (ee = e.video) == null ? void 0 : ee.bitRate) == null ? 0 : u
268
- }), t.appendChild(d);
269
- }), m(w, this, _t).call(this));
270
- }
271
- function gt(e) {
272
- return e ? e[0] % e[1] === 0 ? (e[0] / e[1]).toString() : (e[0] / e[1]).toFixed(2) : "";
273
- }
274
- function _t() {
275
- var e;
276
- let t = (e = h(nt, this)) == null || (e = e.video) == null ? void 0 : e.id, n = m(w, this, vt).call(this), r = n == null ? void 0 : n.id;
277
- p(rt, this, null), h(it, this).forEach((e) => {
278
- let n = e.id, i = e.bitrate;
279
- e.el.setAttribute("data-playing", String(n === t));
280
- let a = n === r;
281
- if (e.el.setAttribute("data-selected", String(a)), a ? (e.el.setAttribute("aria-selected", "true"), e.el.tabIndex = 0, p(rt, this, e.el)) : (e.el.removeAttribute("aria-selected"), e.el.tabIndex = -1), h(et, this)) {
282
- let t = i > h($e, this);
283
- e.el.setAttribute("data-capped", String(t));
284
- } else e.el.removeAttribute("data-capped");
285
- });
286
- }
287
- function vt() {
288
- let e = [...h(it, this)].sort((e, t) => t.bitrate - e.bitrate);
289
- return e.find((e) => e.bitrate <= h($e, this)) || e[e.length - 1];
290
- }
291
- function yt(e) {
292
- this.dispatchEvent(new Event("change", {
293
- bubbles: !0,
294
- composed: !0
295
- })), this.dispatchEvent(new CustomEvent(x.SET_RENDITION, {
296
- bubbles: !0,
297
- composed: !0,
298
- detail: e
299
- }));
300
- }
301
- function bt(e) {
302
- let { key: t, ctrlKey: n, altKey: r, metaKey: i } = e;
303
- if (!(n || r || i) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") {
304
- var a;
305
- (a = h(ot, this)) == null || a.hide();
306
- } else if (t === "Enter" || t === " ") {
307
- var o;
308
- (o = m(w, this, St).call(this)) == null || (o = o.el) == null || o.click();
309
- } else m(w, this, xt).call(this, e);
310
- }
311
- function xt(e) {
312
- var t;
313
- let { key: n } = e, r = h(it, this), i = (t = m(w, this, St).call(this)) == null ? r[0] : t;
314
- if (!i) return;
315
- let a = r.indexOf(i), o = Math.max(0, a);
316
- n === "ArrowDown" ? o++ : n === "ArrowUp" ? o-- : e.key === "Home" ? o = 0 : e.key === "End" && (o = r.length - 1), o < 0 && (o = r.length - 1), o > r.length - 1 && (o = 0);
317
- let s = r[o];
318
- s && (m(w, this, Ct).call(this, s.id), s.el.focus());
319
- }
320
- function St() {
321
- return h(it, this).find((e) => e.el.tabIndex === 0);
322
- }
323
- function Ct(e) {
324
- for (let t of h(it, this)) t.el.tabIndex = t.id === e ? 0 : -1;
325
- }
326
- e(ct, "observedAttributes", [
327
- g.RENDITION_LEVELS,
328
- g.MAX_VIDEO_BITRATE,
329
- g.ABR_ENABLED,
330
- g.RENDITION_LEVEL,
331
- g.SIZE_BASED_RESOLUTION_CAP_ENABLED
332
- ]);
333
- //#endregion
334
- //#region ../../libs/player-next/src/components/AirPlayButton.ts
335
- var wt, Tt = document.createElement("template"), Et = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" ><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M18 18a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-12a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3\" /><path d=\"M9 20h6l-3 -5z\" /></svg>\n";
336
- Tt.innerHTML = `
337
- <style>
338
- :host {
339
- display: var(--airplay-button-display);
340
- }
341
-
342
- :host(:not([${g.AIRPLAY_AVAILABLE}])) {
343
- display: none !important;
344
- }
345
-
346
- :host([${g.IS_AIRPLAYING}]) slot[name="exit"] {
347
- display: none !important;
348
- }
349
-
350
- :host(:not([${g.IS_AIRPLAYING}])) slot[name="enter"] {
351
- display: none !important;
352
- }
353
- </style>
354
-
355
- <slot name="icon">
356
- <slot name="enter">${Et}</slot>
357
- <slot name="exit">${Et}</slot>
358
- </slot>
359
- `;
360
- var Dt = /* @__PURE__ */ new WeakSet(), Ot = class extends v {
361
- constructor() {
362
- var e;
363
- super(), S(this, Dt), (e = this.shadowRoot) == null || e.appendChild(Tt.content.cloneNode(!0));
364
- }
365
- connectedCallback() {
366
- super.connectedCallback(), m(Dt, this, kt).call(this);
367
- }
368
- disconnectedCallback() {
369
- super.disconnectedCallback();
370
- }
371
- attributeChangedCallback(e, t, n) {
372
- super.attributeChangedCallback(e, t, n), e === g.IS_AIRPLAYING && m(Dt, this, kt).call(this);
373
- }
374
- set isAirPlaying(e) {
375
- e ? this.setAttribute(g.IS_AIRPLAYING, "") : this.removeAttribute(g.IS_AIRPLAYING);
376
- }
377
- get isAirPlaying() {
378
- return this.hasAttribute(g.IS_AIRPLAYING);
379
- }
380
- handleClick(e) {
381
- this.dispatchEvent(new CustomEvent(x.REQUEST_AIRPLAY, {
382
- bubbles: !0,
383
- composed: !0
384
- }));
385
- }
386
- };
387
- wt = Ot;
388
- function kt() {
389
- this.setAttribute("aria-label", this.isAirPlaying ? "Stop AirPlay" : "AirPlay");
390
- }
391
- e(Ot, "observedAttributes", [
392
- ...y(wt, "observedAttributes", wt),
393
- g.AIRPLAY_AVAILABLE,
394
- g.IS_AIRPLAYING
395
- ]);
396
- //#endregion
397
- //#region ../../libs/player-next/src/components/BufferingIcon.ts
398
- var At = document.createElement("template");
399
- At.innerHTML = `
400
- <style>
401
- :host {
402
- color: var(--fg-strong);
403
- }
404
-
405
- slot > svg {
406
- display: block;
407
- }
408
-
409
- :host(:not([${g.BUFFERING}])) {
410
- visibility: hidden !important;
411
- }
412
- </style>
413
-
414
- <slot name="icon">
415
- <svg width="24" height="24" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
416
- <style>
417
- .spinner-container {
418
- transform-origin: center;
419
- animation: rotate 2s linear infinite;
420
- }
421
- .spinner-circle {
422
- stroke-linecap: round;
423
- animation: dash 1.5s ease-in-out infinite;
424
- }
425
- @keyframes rotate {
426
- 100% {
427
- transform: rotate(360deg);
428
- }
429
- }
430
- @keyframes dash {
431
- 0% {
432
- stroke-dasharray: 0 150;
433
- stroke-dashoffset: 0;
434
- }
435
- 47.5% {
436
- stroke-dasharray: 42 150;
437
- stroke-dashoffset: -16;
438
- }
439
- 95%, 100% {
440
- stroke-dasharray: 42 150;
441
- stroke-dashoffset: -59;
442
- }
443
- }
444
- </style>
445
- <g class="spinner-container">
446
- <circle class="spinner-circle" cx="12" cy="12" r="9.5" fill="none" stroke-width="3"></circle>
447
- </g>
448
- </svg>
449
- </slot>
450
- `;
451
- var jt = /* @__PURE__ */ new WeakMap(), Mt = class extends HTMLElement {
452
- constructor() {
453
- super(), f(this, jt, null), this.attachShadow({ mode: "open" }).appendChild(At.content.cloneNode(!0));
454
- }
455
- connectedCallback() {
456
- var e;
457
- p(jt, this, this.closest("vindral-controller")), (e = h(jt, this)) == null || e.connectListener(this);
458
- }
459
- disconnectedCallback() {
460
- var e;
461
- (e = h(jt, this)) == null || e.disconnectListener(this);
462
- }
463
- };
464
- e(Mt, "observedAttributes", [g.BUFFERING]);
465
- //#endregion
466
- //#region ../../libs/player-next/src/components/BufferingOverlay.ts
467
- var Nt = document.createElement("template");
468
- Nt.innerHTML = `
469
- <style>
470
- :host {
471
- display: var(--buffering-overlay-display);
472
- align-items: center;
473
- justify-content: center;
474
- position: absolute;
475
- top: 0;
476
- bottom: 0;
477
- left: 0;
478
- right: 0;
479
- background-color: rgba(0, 0, 0, 0.3);
480
- transition: opacity 250ms;
481
- transition-delay: 1s;
482
- opacity: 1;
483
- pointer-events: none;
484
- z-index: 1;
485
- }
486
-
487
- #buffering-indicator {
488
- width: 40px;
489
- height: 40px;
490
- border-radius: 40px;
491
- background-color: var(--fg-strong);
492
- animation: scaleout 1s infinite ease-in-out;
493
- }
494
-
495
- @-webkit-keyframes scaleout {
496
- 0% {
497
- -webkit-transform: scale(0);
498
- }
499
- 100% {
500
- -webkit-transform: scale(1);
501
- opacity: 0;
502
- }
503
- }
504
-
505
- @keyframes scaleout {
506
- 0% {
507
- -webkit-transform: scale(0);
508
- transform: scale(0);
509
- }
510
- 100% {
511
- -webkit-transform: scale(1);
512
- transform: scale(1);
513
- opacity: 0;
514
- }
515
- }
516
-
517
- :host(:not([${g.BUFFERING}])) {
518
- transition-delay: 0s;
519
- opacity: 0 !important;
520
- }
521
- </style>
522
-
523
- <div id="buffering-indicator"></div>
524
- `;
525
- var Pt = /* @__PURE__ */ new WeakMap(), Ft = class extends HTMLElement {
526
- constructor() {
527
- super(), f(this, Pt, null), this.attachShadow({ mode: "open" }).appendChild(Nt.content.cloneNode(!0));
528
- }
529
- connectedCallback() {
530
- var e;
531
- p(Pt, this, this.closest("vindral-controller")), (e = h(Pt, this)) == null || e.connectListener(this);
532
- }
533
- disconnectedCallback() {
534
- var e;
535
- (e = h(Pt, this)) == null || e.disconnectListener(this);
536
- }
537
- };
538
- e(Ft, "observedAttributes", [g.BUFFERING]);
539
- //#endregion
540
- //#region ../../libs/player-next/src/components/CastButton.ts
541
- var It, Lt = document.createElement("template");
542
- Lt.innerHTML = `
543
- <style>
544
- :host {
545
- display: var(--cast-button-display);
546
- }
547
-
548
- google-cast-launcher {
549
- display: block;
550
- width: var(--button-icon-size);
551
- height: var(--button-icon-size);
552
- cursor: pointer;
553
- --connected-color: var(--fg-strong);
554
- --disconnected-color: var(--fg-strong);
555
- }
556
-
557
- :host(:active) google-cast-launcher {
558
- transform: scale(0.9);
559
- }
560
-
561
- :host(:not([${g.CAST_AVAILABLE}])) {
562
- display: none !important;
563
- }
564
- </style>
565
- `;
566
- var Rt = /* @__PURE__ */ new WeakSet(), zt = class extends v {
567
- constructor() {
568
- var e;
569
- super(), S(this, Rt), (e = this.shadowRoot) == null || e.appendChild(Lt.content.cloneNode(!0));
570
- }
571
- connectedCallback() {
572
- super.connectedCallback(), m(Rt, this, Bt).call(this);
573
- }
574
- disconnectedCallback() {
575
- super.disconnectedCallback();
576
- }
577
- attributeChangedCallback(e, t, n) {
578
- super.attributeChangedCallback(e, t, n), e === g.CAST_AVAILABLE && m(Rt, this, Vt).call(this), e === g.IS_CASTING && m(Rt, this, Bt).call(this);
579
- }
580
- set isCasting(e) {
581
- e ? this.setAttribute(g.IS_CASTING, "") : this.removeAttribute(g.IS_CASTING);
582
- }
583
- get isCasting() {
584
- return this.hasAttribute(g.IS_CASTING);
585
- }
586
- handleClick(e) {}
587
- };
588
- It = zt;
589
- function Bt() {
590
- this.setAttribute("aria-label", this.isCasting ? "Stop casting" : "Cast");
591
- }
592
- function Vt() {
593
- var e;
594
- if (!((e = this.shadowRoot) != null && e.querySelector("google-cast-launcher"))) {
595
- var t;
596
- let e = document.createElement("google-cast-launcher");
597
- (t = this.shadowRoot) == null || t.appendChild(e);
598
- }
599
- }
600
- e(zt, "observedAttributes", [
601
- ...y(It, "observedAttributes", It),
602
- g.CAST_AVAILABLE,
603
- g.IS_CASTING
604
- ]);
605
- //#endregion
606
- //#region ../../libs/player-next/src/components/CastOverlay.ts
607
- var Ht = document.createElement("template");
608
- Ht.innerHTML = `
609
- <style>
610
- :host {
611
- position: absolute;
612
- top: 0;
613
- left: 0;
614
- width: 100%;
615
- font-size: 20px;
616
- text-align: center;
617
- padding: 5% 0 !important;
618
- box-shadow: 0px 0px 20px black;
619
- background: rgba(0, 0, 0, 0.5);
620
- color: white;
621
- pointer-events: none;
622
- z-index: 1;
623
- transition: opacity 0.3s ease-in-out;
624
- }
625
-
626
- @media only screen and (max-width: 600px) {
627
- :host {
628
- font-size: 14px;
629
- }
630
- }
631
-
632
- :host(:not([${g.IS_CASTING}])) {
633
- display: none;
634
- }
635
-
636
- #text {
637
- margin: 0;
638
- padding: 0;
639
- }
640
- </style>
641
- <span id="text"></span>
642
- `;
643
- var Ut = /* @__PURE__ */ new WeakMap(), Wt = /* @__PURE__ */ new WeakMap(), Gt = class extends HTMLElement {
644
- constructor() {
645
- super(), f(this, Ut, null), f(this, Wt, null), this.attachShadow({ mode: "open" }).appendChild(Ht.content.cloneNode(!0));
646
- }
647
- connectedCallback() {
648
- var e, t;
649
- p(Ut, this, this.closest("vindral-controller")), (e = h(Ut, this)) == null || e.connectListener(this), p(Wt, this, (t = this.shadowRoot) == null ? void 0 : t.querySelector("#text"));
650
- }
651
- disconnectedCallback() {
652
- var e;
653
- (e = h(Ut, this)) == null || e.disconnectListener(this);
654
- }
655
- attributeChangedCallback(e, t, n) {
656
- t === n || !h(Wt, this) || e === "cast-receiver-name" && typeof n == "string" && (h(Wt, this).innerText = `Casting to ${n || "device"}`);
657
- }
658
- };
659
- e(Gt, "observedAttributes", [g.IS_CASTING, g.CAST_RECEIVER_NAME]);
660
- //#endregion
661
- //#region ../../libs/player-next/src/utils/elementUtils.ts
662
- function Kt(e = document) {
663
- let t = e == null ? void 0 : e.activeElement;
664
- if (!t) return null;
665
- if (t.shadowRoot) {
666
- let e = Kt(t.shadowRoot);
667
- return e == null ? t : e;
668
- }
669
- return t;
670
- }
671
- //#endregion
672
- //#region ../../libs/player-next/src/components/ChannelGridItem.ts
673
- var qt = document.createElement("template");
674
- qt.innerHTML = "\n <style>\n :host {\n position: relative;\n aspect-ratio: 16 / 9;\n object-fit: cover;\n cursor: pointer;\n border-radius: 6px;\n box-sizing: border-box !important;\n\n background-size: cover;\n background-position: center;\n\n transition-property: background-image;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 200ms;\n\n background-color: rgba(0, 0, 0, 0.5);\n background-blend-mode: multiply;\n -webkit-tap-highlight-color: transparent;\n }\n\n :host([aria-selected=\"true\"]) {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n background-color: rgba(0, 0, 0, 0);\n }\n\n :host(:focus),\n :host(:focus-visible) {\n outline: none;\n }\n\n :host([offline]) {\n display: var(--grid-item-offline-display);\n background-image: repeating-linear-gradient(-45deg, #3d3d3d 0, #3d3d3d 4px, #1c2024 4px, #1c2024 8px) !important;\n pointer-events: none;\n }\n\n :host::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(255, 255, 255, 0);\n transition: background 0.2s ease;\n }\n\n :host(:hover)::before {\n background: rgba(255, 255, 255, 0.1);\n }\n\n .channel-title {\n position: absolute;\n bottom: var(--padding-2);\n left: var(--padding-2);\n padding: var(--padding-1) var(--padding-2);\n color: white;\n font-size: 15px;\n font-weight: 500;\n text-overflow: ellipsis;\n border-radius: 4px;\n\n @container (max-width: 480px) {\n font-size: 13px;\n }\n }\n </style>\n <slot></slot>\n";
675
- var Jt = /* @__PURE__ */ new WeakMap(), Yt = class extends HTMLElement {
676
- constructor() {
677
- super(), f(this, Jt, void 0), e(this, "lastThumbnailUpdate", void 0);
678
- let t = this.attachShadow({ mode: "open" });
679
- p(Jt, this, document.createElement("span")), h(Jt, this).className = "channel-title", t.appendChild(h(Jt, this)), t.appendChild(qt.content.cloneNode(!0));
680
- }
681
- attributeChangedCallback(e, t, n) {
682
- if (t !== n) switch (e) {
683
- case "url":
684
- this.updateThumbnail();
685
- break;
686
- case "title":
687
- h(Jt, this).textContent = n;
688
- break;
689
- }
690
- }
691
- updateThumbnail() {
692
- let e = this.getAttribute("url"), t = this.hasAttribute("offline"), n = this.hasAttribute("visible");
693
- if (t || !e || !n || this.lastThumbnailUpdate && Date.now() - this.lastThumbnailUpdate < 1e4) return;
694
- let r = new URL(e), i = new Image(), a = this.getAttribute("authentication-token");
695
- a && r.searchParams.set("auth.token", a), r.searchParams.set("t", Date.now().toString()), i.src = r.toString(), i.onload = () => this.style.backgroundImage = `url(${r.toString()})`;
696
- }
697
- };
698
- e(Yt, "observedAttributes", [
699
- "url",
700
- "title",
701
- "offline",
702
- "authentication-token",
703
- "visible"
704
- ]);
705
- //#endregion
706
- //#region ../../libs/player-next/src/components/ChannelGrid.ts
707
- var Xt = document.createElement("template");
708
- Xt.innerHTML = "\n <style>\n :host {\n cursor: default;\n display: flex;\n flex-direction: column;\n box-sizing: border-box !important;\n border-radius: 4px;\n background-color: var(--bg-subtle);\n padding: var(--padding-2) !important;\n\n position: absolute;\n bottom: 0;\n right: 0;\n\n z-index: 5;\n width: 100%;\n max-height: 75%;\n\n @container (width < 768px) {\n padding: var(--padding-1) !important;\n }\n }\n\n :host([hidden]) {\n display: none;\n }\n\n .wrapper {\n overflow: auto;\n -ms-overflow-style: none;\n scrollbar-width: none;\n height: 100%;\n }\n\n .wrapper::-webkit-scrollbar {\n display: none;\n }\n\n slot#grid {\n display: grid;\n gap: var(--padding-2);\n grid-template-columns: repeat(4, minmax(0, 1fr));\n\n @container (width < 768px) {\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: var(--padding-1);\n }\n @container (width < 1024px) and (width >= 768px) {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n @container (width >= 1024px) {\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n }\n\n /* Smart TV */\n @media (width < 1024px) and (width >= 768px) and (-webkit-min-device-pixel-ratio: 2) {\n slot#grid {\n grid-template-columns: repeat(4, minmax(0, 1fr)) !important;\n }\n }\n\n :host([mode=\"list\"]) slot#grid {\n grid-template-columns: repeat(1, minmax(0, 1fr));\n }\n </style>\n\n <div class=\"wrapper\">\n <slot name=\"grid\" id=\"grid\"></slot>\n </div>\n";
709
- var Zt = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), en = /* @__PURE__ */ new WeakMap(), tn = /* @__PURE__ */ new WeakMap(), nn = /* @__PURE__ */ new WeakMap(), rn = /* @__PURE__ */ new WeakMap(), an = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakSet(), on = class extends HTMLElement {
710
- constructor() {
711
- super(), S(this, D), f(this, Zt, null), f(this, Qt, null), f(this, $t, []), f(this, T, []), f(this, E, void 0), f(this, en, void 0), f(this, tn, void 0), f(this, nn, void 0), f(this, rn, void 0), f(this, an, void 0), e(this, "handleEvent", (e) => {
712
- switch (e.type) {
713
- case "keydown":
714
- m(D, this, yn).call(this, e);
715
- break;
716
- }
717
- }), this.attachShadow({ mode: "open" }).appendChild(Xt.content.cloneNode(!0));
718
- }
719
- connectedCallback() {
720
- var e, t, n;
721
- p(Qt, this, this.closest("vindral-controller")), (e = h(Qt, this)) == null || e.connectListener(this), m(D, this, sn).call(this), (t = h(Zt, this)) == null || t.observe((n = this.shadowRoot) == null ? void 0 : n.querySelector(".wrapper")), m(D, this, pn).call(this), p(tn, this, window.setInterval(() => {
722
- m(D, this, _n).call(this);
723
- }, 1e4));
724
- }
725
- disconnectedCallback() {
726
- var e, t;
727
- clearInterval(h(tn, this)), m(D, this, Tn).call(this), this.removeEventListener("keydown", this), (e = h(Zt, this)) == null || e.disconnect(), (t = h(Qt, this)) == null || t.disconnectListener(this);
728
- }
729
- attributeChangedCallback(e, t, n) {
730
- if (t !== n) switch (e) {
731
- case g.CHANNEL_ID:
732
- m(D, this, gn).call(this, n);
733
- break;
734
- case g.CHANNELS:
735
- p($t, this, JSON.parse(n)), m(D, this, pn).call(this);
736
- break;
737
- case "authentication-token":
738
- p(en, this, n);
739
- break;
740
- }
741
- }
742
- get keysUsed() {
743
- return [
744
- "Enter",
745
- "Escape",
746
- "Tab",
747
- " ",
748
- "ArrowDown",
749
- "ArrowUp",
750
- "ArrowLeft",
751
- "ArrowRight",
752
- "Home",
753
- "End"
754
- ];
755
- }
756
- focus() {
757
- var e;
758
- let t = Kt();
759
- t && t !== this && !this.contains(t) && p(nn, this, t), (e = h(E, this)) == null || e.focus();
760
- }
761
- };
762
- function sn() {
763
- p(Zt, this, new IntersectionObserver((e) => {
764
- e.forEach((e) => {
765
- let { target: t, isIntersecting: n } = e;
766
- t instanceof Yt ? m(D, this, fn).call(this, t, n) : m(D, this, cn).call(this, n);
767
- });
768
- }, { root: h(Qt, this) }));
769
- }
770
- function cn(e) {
771
- e ? m(D, this, ln).call(this) : m(D, this, un).call(this);
772
- }
773
- function ln() {
774
- this.dispatchEvent(new CustomEvent(x.CHANNEL_GRID_OPENED, {
775
- bubbles: !0,
776
- composed: !0
777
- })), m(D, this, dn).call(this), this.addEventListener("keydown", this), h(E, this) && (h(E, this).tabIndex = 0);
778
- }
779
- function un() {
780
- m(D, this, Tn).call(this), h(E, this) && (h(E, this).tabIndex = -1), this.dispatchEvent(new CustomEvent(x.CHANNEL_GRID_CLOSED, {
781
- bubbles: !0,
782
- composed: !0
783
- })), m(D, this, Sn).call(this), this.removeEventListener("keydown", this);
784
- }
785
- function dn() {
786
- var e;
787
- m(D, this, Tn).call(this), p(an, this, () => {
788
- clearTimeout(h(rn, this)), p(rn, this, window.setTimeout(() => {
789
- m(D, this, wn).call(this) && this.focus(), m(D, this, Tn).call(this);
790
- }, 100));
791
- }), (e = this.parentElement) == null || e.addEventListener("scroll", h(an, this));
792
- }
793
- function fn(e, t) {
794
- t ? (e.setAttribute("visible", ""), (!e.lastThumbnailUpdate || Date.now() - e.lastThumbnailUpdate >= 1e4) && (e.updateThumbnail(), e.lastThumbnailUpdate = Date.now())) : e.removeAttribute("visible");
795
- }
796
- function pn() {
797
- var e;
798
- let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("slot[name=grid]"), n = new Map(h(T, this).map((e) => [e.id, e])), r = this.getAttribute("channel-id");
799
- p(T, this, h($t, this).map((e) => {
800
- var i;
801
- let a = n.get(e.channelId);
802
- if (a) return m(D, this, mn).call(this, a.element, e), a;
803
- let o = m(D, this, hn).call(this, e, r);
804
- return (i = h(Zt, this)) == null || i.observe(o.element), t.contains(o.element) || t.appendChild(o.element), o;
805
- })), n.forEach((e, t) => {
806
- if (!h($t, this).some((e) => e.channelId === t)) {
807
- var n;
808
- (n = h(Zt, this)) == null || n.unobserve(e.element), e.element.remove();
809
- }
810
- }), h(T, this).sort((e, t) => e.element.hasAttribute("offline") && !t.element.hasAttribute("offline") ? 1 : -1).forEach((e) => {
811
- t.contains(e.element) || t.appendChild(e.element);
812
- });
813
- }
814
- function mn(e, t) {
815
- t.isLive ? e.removeAttribute("offline") : e.setAttribute("offline", ""), e.setAttribute("url", t.thumbnailUrls[0] || ""), e.setAttribute("title", t.name);
816
- }
817
- function hn(e, t) {
818
- let n = document.createElement("vindral-channel-grid-item");
819
- return n.setAttribute("url", e.thumbnailUrls[0] || ""), n.setAttribute("title", e.name), h(en, this) && n.setAttribute("authentication-token", h(en, this)), e.isLive || n.setAttribute("offline", ""), e.channelId === t && (n.setAttribute("aria-selected", "true"), p(E, this, n)), n.tabIndex = -1, n.onclick = () => m(D, this, vn).call(this, e), {
820
- element: n,
821
- thumbnail: e.thumbnailUrls[0] || "",
822
- id: e.channelId
823
- };
824
- }
825
- function gn(e) {
826
- h(T, this).forEach((t) => {
827
- t.id === e ? (t.element.setAttribute("aria-selected", "true"), t.element.tabIndex = 0, p(E, this, t.element)) : (t.element.tabIndex = -1, t.element.setAttribute("aria-selected", "false"));
828
- });
829
- }
830
- function _n() {
831
- this.hasAttribute("hidden") || h(T, this).forEach((e) => e.element.updateThumbnail());
832
- }
833
- function vn(e) {
834
- var t;
835
- m(D, this, En).call(this), (t = h(Qt, this)) == null || t.setAttribute("channel-id", e.channelId);
836
- }
837
- function yn(e) {
838
- let { key: t, ctrlKey: n, altKey: r, metaKey: i } = e;
839
- if (!(n || r || i) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") m(D, this, En).call(this);
840
- else if (t === "Enter" || t === " ") {
841
- var a;
842
- (a = h(E, this)) == null || a.click();
843
- } else m(D, this, bn).call(this, e);
844
- }
845
- function bn(e) {
846
- if (!h(E, this)) return;
847
- let { key: t } = e, n = h(T, this).findIndex((e) => e.element === h(E, this)), r = h(E, this).getBoundingClientRect();
848
- switch (t) {
849
- case "ArrowUp":
850
- if (n = m(D, this, xn).call(this, r, -1, 0), n < 0) {
851
- m(D, this, En).call(this);
852
- return;
853
- }
854
- break;
855
- case "ArrowDown":
856
- n = m(D, this, xn).call(this, r, 1, 0);
857
- break;
858
- case "ArrowLeft":
859
- n = m(D, this, xn).call(this, r, 0, -1);
860
- break;
861
- case "ArrowRight":
862
- n = m(D, this, xn).call(this, r, 0, 1);
863
- break;
864
- case "Home":
865
- n = 0;
866
- break;
867
- case "End":
868
- n = h(T, this).length - 1;
869
- break;
870
- }
871
- if (n >= 0 && n < h(T, this).length) {
872
- let e = h(T, this)[n];
873
- if (!e) return;
874
- h(E, this).setAttribute("aria-selected", "false"), h(E, this).tabIndex = -1, p(E, this, e.element), h(E, this).setAttribute("aria-selected", "true"), h(E, this).tabIndex = 0, h(E, this).focus();
875
- }
876
- }
877
- function xn(e, t, n) {
878
- let r = -1, i = Infinity;
879
- return h(T, this).filter((e) => e.element.getBoundingClientRect().width > 0).forEach((a, o) => {
880
- let s = a.element.getBoundingClientRect(), c = t === 0 || t < 0 && s.top < e.top || t > 0 && s.top > e.top, l = n === 0 || n < 0 && s.left < e.left || n > 0 && s.left > e.left;
881
- if (c && l) {
882
- let t = Math.sqrt((s.top - e.top) ** 2 + (s.left - e.left) ** 2);
883
- t < i && (i = t, r = o);
884
- }
885
- }), r;
886
- }
887
- function Sn() {
888
- var e, t;
889
- if ((e = h(nn, this)) != null && e.isConnected) {
890
- h(nn, this).focus({ preventScroll: !0 });
891
- return;
892
- }
893
- (t = h(Qt, this)) == null || t.focus({ preventScroll: !0 });
894
- }
895
- function Cn(e) {
896
- return (e == null ? void 0 : e.localName) === "vindral-scroll-overlay";
897
- }
898
- function wn() {
899
- let e = this.parentElement;
900
- return e ? m(D, this, Cn).call(this, e) ? e.hasAttribute("open") : !this.hasAttribute("hidden") : !1;
901
- }
902
- function Tn() {
903
- if (h(rn, this) && (clearTimeout(h(rn, this)), p(rn, this, void 0)), h(an, this)) {
904
- var e;
905
- (e = this.parentElement) == null || e.removeEventListener("scroll", h(an, this)), p(an, this, void 0);
906
- }
907
- }
908
- function En() {
909
- let e = this.parentElement;
910
- if (m(D, this, Cn).call(this, e)) {
911
- e.open = !1;
912
- return;
913
- }
914
- e == null || e.removeAttribute("open");
915
- }
916
- e(on, "observedAttributes", [
917
- g.CHANNELS,
918
- g.CHANNEL_ID,
919
- g.AUTHENTICATION_TOKEN,
920
- "mode",
921
- "hidden"
922
- ]);
923
- //#endregion
924
- //#region ../../libs/player-next/src/components/ChannelGridButton.ts
925
- var Dn, On = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon icon-tabler icon-tabler-layout-grid\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" fill=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M4 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\" />\n <path d=\"M14 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\" />\n <path d=\"M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\" />\n <path d=\"M14 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z\" />\n</svg>\n", kn = document.createElement("template");
926
- kn.innerHTML = `
927
- <style>
928
- :host {
929
- display: var(--grid-button-display);
930
- cursor: pointer;
931
- flex-shrink: 0.5;
932
- color: var(--fg-strong);
933
- }
934
-
935
- :host([hidden]) {
936
- display: none;
937
- }
938
- </style>
939
- <slot name="button">${On}</slot>
940
- `;
941
- var O = /* @__PURE__ */ new WeakMap(), An = /* @__PURE__ */ new WeakMap(), jn = /* @__PURE__ */ new WeakMap(), k = /* @__PURE__ */ new WeakSet(), Mn = /* @__PURE__ */ new WeakMap(), Nn = /* @__PURE__ */ new WeakMap(), Pn = class extends v {
942
- constructor() {
943
- var e;
944
- super(), S(this, k), f(this, O, void 0), f(this, An, void 0), f(this, jn, (e) => {
945
- e.composedPath().includes(this) || m(k, this, Ln).call(this);
946
- }), f(this, Mn, () => m(k, this, zn).call(this, !0)), f(this, Nn, () => m(k, this, zn).call(this, !1)), (e = this.shadowRoot) == null || e.appendChild(kn.content.cloneNode(!0));
947
- }
948
- connectedCallback() {
949
- super.connectedCallback(), this.setAttribute("aria-haspopup", "listbox"), this.enable(), m(k, this, Rn).call(this);
950
- let e = this.getRootNode();
951
- if (e instanceof Document || e instanceof ShadowRoot) {
952
- var t;
953
- p(O, this, e.querySelector("vindral-channel-grid")), ((t = h(O, this).parentElement) == null ? void 0 : t.localName) === "vindral-scroll-overlay" && (h(O, this).hidden = !1, h(O, this).style.position = "relative", p(An, this, h(O, this).parentElement)), h(O, this).addEventListener(x.CHANNEL_GRID_OPENED, h(Mn, this)), h(O, this).addEventListener(x.CHANNEL_GRID_CLOSED, h(Nn, this));
954
- }
955
- m(k, this, zn).call(this);
956
- }
957
- disconnectedCallback() {
958
- var e, t;
959
- super.disconnectedCallback(), (e = h(O, this)) == null || e.removeEventListener(x.CHANNEL_GRID_OPENED, h(Mn, this)), (t = h(O, this)) == null || t.removeEventListener(x.CHANNEL_GRID_CLOSED, h(Nn, this));
960
- }
961
- attributeChangedCallback(e, t, n) {
962
- super.attributeChangedCallback(e, t, n), (e === g.CHANNEL_GROUP_ID || e === g.CHANNELS) && m(k, this, Rn).call(this);
963
- }
964
- enable() {
965
- super.enable(), document.addEventListener("click", h(jn, this));
966
- }
967
- handleClick(e) {
968
- m(k, this, Fn).call(this);
969
- }
970
- get isOpen() {
971
- var e;
972
- return h(An, this) ? h(An, this).hasAttribute("open") : !((e = h(O, this)) != null && e.hidden);
973
- }
974
- };
975
- Dn = Pn;
976
- function Fn() {
977
- this.getAttribute("aria-expanded") === "true" ? m(k, this, Ln).call(this) : m(k, this, In).call(this), m(k, this, zn).call(this);
978
- }
979
- function In() {
980
- if (h(An, this)) h(An, this).setAttribute("open", "");
981
- else {
982
- var e;
983
- if (!((e = h(O, this)) != null && e.hidden)) return;
984
- h(O, this).hidden = !1, h(O, this).focus();
985
- }
986
- }
987
- function Ln() {
988
- if (h(An, this)) h(An, this).open = !1;
989
- else {
990
- if (!h(O, this) || h(O, this).hidden) return;
991
- h(O, this).hidden = !0;
992
- }
993
- }
994
- function Rn() {
995
- this.getAttribute(g.CHANNEL_GROUP_ID) ? this.removeAttribute("hidden") : this.setAttribute("hidden", ""), this.hasAttribute(g.CHANNELS) ? this.removeAttribute("disabled") : this.setAttribute("disabled", "");
996
- }
997
- function zn(e = this.isOpen) {
998
- this.setAttribute("aria-expanded", String(e)), this.setAttribute("aria-label", e ? "Close channels" : "Channels");
999
- }
1000
- e(Pn, "observedAttributes", [
1001
- ...y(Dn, "observedAttributes", Dn),
1002
- g.CHANNEL_GROUP_ID,
1003
- g.CHANNELS,
1004
- "hidden"
1005
- ]);
1006
- //#endregion
1007
- //#region ../../libs/player-next/src/components/ControlBar.ts
1008
- var Bn = document.createElement("template");
1009
- Bn.innerHTML = "\n <style>\n :host {\n display: flex;\n width: 100%;\n align-items: center;\n }\n\n slot {\n display: flex;\n flex-grow: 1;\n align-items: center;\n }\n\n :host([content-center]) slot {\n justify-content: center;\n }\n\n slot[name=\"right\"] {\n justify-content: flex-end;\n }\n </style>\n\n <slot name=\"bar\">\n <slot></slot>\n <slot name=\"right\"></slot>\n </slot>\n";
1010
- var Vn = class extends HTMLElement {
1011
- constructor() {
1012
- super(), this.attachShadow({ mode: "open" }).appendChild(Bn.content.cloneNode(!0));
1013
- }
1014
- connectedCallback() {}
1015
- disconnectedCallback() {}
1016
- };
1017
- e(Vn, "observedAttributes", []);
1018
- //#endregion
1019
- //#region ../../libs/airplay-sender/src/AirPlaySender.ts
1020
- var Hn = class extends pe {
1021
- constructor(t) {
1022
- super(), e(this, "config", void 0), e(this, "hlsUrl", void 0), e(this, "element", void 0), e(this, "connectingTimeout", void 0), e(this, "castingAvailable", !1), e(this, "updateAuthenticationToken", (e) => {
1023
- this.config.authenticationToken = e, this.hlsUrl = this.getHlsUrl(), this.castingAvailable && (this.element.src = this.hlsUrl);
1024
- }), e(this, "unload", () => {
1025
- this.element && (this.element.removeEventListener("webkitplaybacktargetavailabilitychanged", this.onAirPlayAvailable), this.element.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged", this.onAirPlayPlaybackChanged), this.element.remove());
1026
- }), e(this, "onAirPlayAvailable", (e) => {
1027
- switch (e.availability) {
1028
- case "available":
1029
- this.castingAvailable = !0, this.element.src !== this.hlsUrl && this.checkHlsUrl(this.hlsUrl).then((e) => {
1030
- e && (this.element.src = this.hlsUrl, this.emit("available"));
1031
- });
1032
- break;
1033
- case "not-available":
1034
- this.castingAvailable = !1;
1035
- break;
1036
- default: break;
1037
- }
1038
- }), e(this, "onAirPlayPlaybackChanged", () => {
1039
- window.clearTimeout(this.connectingTimeout), this.element.webkitCurrentPlaybackTargetIsWireless ? (this.emit("connected"), this.element.style.display = "block", this.element.paused && this.element.play().catch(ce)) : (this.emit("disconnected"), this.element.pause(), this.element.src = "", this.element.src = this.hlsUrl, this.element.style.display = "none");
1040
- }), this.config = t, this.hlsUrl = this.getHlsUrl(), this.element = document.createElement("video"), this.element.style.position = "absolute", this.element.style.top = "0", this.element.style.bottom = "0", this.element.style.left = "0", this.element.style.right = "0", this.element.style.width = "100%", this.element.style.height = "100%", this.element.style.zIndex = "1001", this.element.style.display = "none", this.element.id = "vindral-airplay-element", this.element.slot = "overlay", this.element.playsInline = !0, this.element.controls = !0, this.element.preload = "metadata", this.element.addEventListener("webkitplaybacktargetavailabilitychanged", this.onAirPlayAvailable), this.element.addEventListener("webkitcurrentplaybacktargetiswirelesschanged", this.onAirPlayPlaybackChanged), this.config.container.appendChild(this.element);
1041
- }
1042
- get casting() {
1043
- return this.element.webkitCurrentPlaybackTargetIsWireless;
1044
- }
1045
- set channelId(e) {}
1046
- showPlaybackTargetPicker() {
1047
- "webkitShowPlaybackTargetPicker" in this.element && this.castingAvailable && (this.element.paused && (this.element.play().catch(ce), this.connectingTimeout = window.setTimeout(() => {
1048
- this.casting || (this.element.pause(), this.element.src = "", this.element.src = this.hlsUrl);
1049
- }, 3e4)), this.element.webkitShowPlaybackTargetPicker());
1050
- }
1051
- static isAirPlaySupported() {
1052
- return !!window.WebKitPlaybackTargetAvailabilityEvent;
1053
- }
1054
- getHlsUrl() {
1055
- let e = new URL(`/api/hls?channelId=${this.config.channelId}`, this.config.url);
1056
- return this.config.authenticationToken && e.searchParams.set("authenticationToken", this.config.authenticationToken), e.toString();
1057
- }
1058
- checkHlsUrl(e) {
1059
- return t(function* () {
1060
- try {
1061
- return (yield fetch(e, { method: "HEAD" })).ok;
1062
- } catch (e) {
1063
- return !1;
1064
- }
1065
- })();
1066
- }
1067
- }, Un = 28, Wn = ["::cue", "::-webkit-media-text-track-display"];
1068
- function Gn(e) {
1069
- let t = e.styleSheets[0];
1070
- if (!t) return [];
1071
- try {
1072
- return Array.from(t.cssRules).filter((e) => e instanceof CSSStyleRule && Wn.some((t) => e.selectorText.endsWith(t)));
1073
- } catch (e) {
1074
- return [];
1075
- }
1076
- }
1077
- var Kn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new WeakMap(), Jn = /* @__PURE__ */ new WeakMap(), Yn = /* @__PURE__ */ new WeakMap(), Xn = /* @__PURE__ */ new WeakMap(), Zn = /* @__PURE__ */ new WeakMap(), Qn = /* @__PURE__ */ new WeakMap(), $n = /* @__PURE__ */ new WeakMap(), er = class {
1078
- constructor(t) {
1079
- f(this, Kn, void 0), f(this, qn, null), f(this, Jn, null), f(this, Yn, null), f(this, Xn, !0), e(this, "observe", (e) => {
1080
- h(Yn, this) || (p(Yn, this, e), e.addEventListener("webkitpresentationmodechanged", h(Zn, this), !0), window.ResizeObserver && (p(qn, this, new ResizeObserver(() => h($n, this).call(this))), h(qn, this).observe(e)));
1081
- }), f(this, Zn, (e) => {
1082
- var t;
1083
- e.target instanceof HTMLMediaElement && h(Qn, this).call(this, ((t = ie(e.target)) == null ? "inline" : t) === "inline");
1084
- }), f(this, Qn, (e) => {
1085
- if (h(Xn, this) !== e) {
1086
- if (p(Xn, this, e), p(Jn, this, null), e) {
1087
- h($n, this).call(this);
1088
- return;
1089
- }
1090
- for (let e of h(Kn, this)) e.style.removeProperty("font-size");
1091
- }
1092
- }), e(this, "unload", () => {
1093
- var e, t;
1094
- (e = h(Yn, this)) == null || e.removeEventListener("webkitpresentationmodechanged", h(Zn, this), !0), (t = h(qn, this)) == null || t.disconnect(), p(qn, this, null), p(Yn, this, null), p(Xn, this, !0);
1095
- }), f(this, $n, () => {
1096
- if (!h(Xn, this) || h(Kn, this).length === 0 || !h(Yn, this)) return;
1097
- let { clientWidth: e, clientHeight: t } = h(Yn, this);
1098
- if (e <= 0 || t <= 0) return;
1099
- let n = ne(e, t, { max: Un });
1100
- if (n !== h(Jn, this)) {
1101
- p(Jn, this, n);
1102
- for (let e of h(Kn, this)) e.style.fontSize = n;
1103
- }
1104
- }), p(Kn, this, Gn(t));
1105
- }
1106
- }, tr = class n extends pe {
1107
- constructor(r) {
1108
- var i;
1109
- super(), i = this, e(this, "container", void 0), e(this, "unload", () => {
1110
- document.removeEventListener("webkitfullscreenchange", this.onChange), document.removeEventListener("mozfullscreenchange", this.onChange), document.removeEventListener("fullscreenchange", this.onChange), this.container.removeEventListener("webkitendfullscreen", this.onChange);
1111
- }), e(this, "request", t(function* () {
1112
- try {
1113
- yield i.requestFn();
1114
- } catch (e) {
1115
- throw i.onChange(), e;
1116
- }
1117
- })), e(this, "exit", t(function* () {
1118
- try {
1119
- yield i.exitFn();
1120
- } catch (e) {
1121
- throw i.onChange(), e;
1122
- }
1123
- })), e(this, "onChange", () => this.emit("on fullscreen change", this.isFullscreen())), e(this, "isFullscreen", () => se()), e(this, "isSupported", () => n.isFullscreenApiSupported(this.container) || !this.isInIframe()), e(this, "isFullscreenApiSupported", () => n.isFullscreenApiSupported(this.container)), e(this, "isInIframe", () => window.location !== window.parent.location), this.container = r, document.addEventListener("webkitfullscreenchange", this.onChange), document.addEventListener("mozfullscreenchange", this.onChange), document.addEventListener("fullscreenchange", this.onChange), this.container.addEventListener("webkitendfullscreen", this.onChange);
1124
- }
1125
- get requestFn() {
1126
- var e;
1127
- return (e = u(this.container)) == null ? (() => Promise.resolve()) : e;
1128
- }
1129
- get exitFn() {
1130
- if (n.isFullscreenApiSupported(this.container) && this.isFullscreen()) {
1131
- var e;
1132
- return (e = te(this.container)) == null ? (() => Promise.resolve()) : e;
1133
- }
1134
- return () => Promise.resolve();
1135
- }
1136
- };
1137
- e(tr, "isFullscreenApiSupported", (e) => l(e));
1138
- //#endregion
1139
- //#region ../../libs/player-next/src/PictureInPicture.ts
1140
- var nr = /* @__PURE__ */ new WeakMap(), rr = /* @__PURE__ */ new WeakMap(), ir = /* @__PURE__ */ new WeakMap(), ar = /* @__PURE__ */ new WeakMap(), or = /* @__PURE__ */ new WeakMap(), sr = /* @__PURE__ */ new WeakMap(), cr = /* @__PURE__ */ new WeakMap(), lr = /* @__PURE__ */ new WeakMap(), ur = /* @__PURE__ */ new WeakMap(), dr = class extends pe {
1141
- constructor(r) {
1142
- var a;
1143
- super(), a = this, e(this, "unload", () => {
1144
- this.element.removeEventListener("enterpictureinpicture", this.onChange), this.element.removeEventListener("leavepictureinpicture", this.onChange), this.element.removeEventListener("webkitpresentationmodechanged", this.onChange), n(this.element, !1);
1145
- }), e(this, "request", t(function* () {
1146
- try {
1147
- return yield h(nr, a).call(a);
1148
- } catch (e) {
1149
- throw a.onChange(), e;
1150
- }
1151
- })), e(this, "exit", t(function* () {
1152
- try {
1153
- return yield h(rr, a).call(a);
1154
- } catch (e) {
1155
- throw a.onChange(), e;
1156
- }
1157
- })), e(this, "onChange", () => {
1158
- this.emit("on picture in picture change", this.isPictureInPictureActive());
1159
- }), e(this, "isPictureInPictureActive", () => h(cr, this).call(this) || h(sr, this).call(this)), e(this, "isSupported", () => h(ur, this).call(this) || h(or, this).call(this)), f(this, nr, () => h(or, this).call(this) ? h(ir, this).call(this) : h(ur, this).call(this) ? h(lr, this).call(this, "picture-in-picture") : Promise.resolve()), f(this, rr, () => this.isPictureInPictureActive() ? h(or, this).call(this) ? h(ar, this).call(this) : h(ur, this).call(this) ? h(lr, this).call(this, "inline") : Promise.resolve() : Promise.resolve()), f(this, ir, t(function* () {
1160
- let e = c(a.element);
1161
- e && (yield e());
1162
- })), f(this, ar, t(function* () {
1163
- let e = ee();
1164
- e && (yield e());
1165
- })), f(this, or, () => s(this.element)), f(this, sr, () => oe()), f(this, cr, () => ie(this.element) === "picture-in-picture"), f(this, lr, (e) => (i(this.element) && ae(this.element, e), Promise.resolve())), f(this, ur, () => i(this.element)), this.element = r, this.element.addEventListener("enterpictureinpicture", this.onChange), this.element.addEventListener("leavepictureinpicture", this.onChange), this.element.addEventListener("webkitpresentationmodechanged", this.onChange), n(this.element, !0);
1166
- }
1167
- get videoElement() {
1168
- return this.element;
1169
- }
1170
- };
1171
- //#endregion
1172
- //#region ../../libs/player-next/src/timeshift/firstMediaPlaylistUrl.ts
1173
- function fr(e, t) {
1174
- let n = e.split("\n").map((e) => e.trim());
1175
- for (let e = 0; e < n.length; e++) {
1176
- var r;
1177
- if ((r = n[e]) != null && r.startsWith("#EXT-X-STREAM-INF")) for (let r = e + 1; r < n.length; r++) {
1178
- let e = n[r];
1179
- if (e && !e.startsWith("#")) return new URL(e, t).toString();
1180
- }
1181
- }
1182
- }
1183
- //#endregion
1184
- //#region ../../libs/player-next/src/timeshift/parseMediaPlaylistDuration.ts
1185
- function pr(e) {
1186
- let t = 0;
1187
- for (let n of e.split("\n")) {
1188
- let e = n.trim().match(/^#EXTINF:([\d.]+)/), r = e != null && e[1] ? Number.parseFloat(e[1]) : NaN;
1189
- Number.isFinite(r) && (t += r);
1190
- }
1191
- return t;
1192
- }
1193
- //#endregion
1194
- //#region ../../libs/player-next/src/timeshift/probeTimeshiftDuration.ts
1195
- var mr = 5e3;
1196
- function hr(e, t) {
1197
- return gr.apply(this, arguments);
1198
- }
1199
- function gr() {
1200
- return gr = t(function* (e, t, n = {}) {
1201
- let { signal: r, timeoutMs: i = mr } = n, a = new AbortController(), o = () => a.abort();
1202
- r && (r.aborted ? a.abort() : r.addEventListener("abort", o, { once: !0 }));
1203
- let s = setTimeout(o, i);
1204
- try {
1205
- let n = yield fetch(e, { signal: a.signal });
1206
- if (!n.ok) return;
1207
- let r = fr(yield n.text(), e);
1208
- if (!r) return;
1209
- let i = new URL(r);
1210
- i.searchParams.set("channelId", t.channelId), i.searchParams.set("from", t.from), t.authToken && i.searchParams.set("authToken", t.authToken);
1211
- let o = yield fetch(i.toString(), { signal: a.signal });
1212
- return o.ok ? pr(yield o.text()) : void 0;
1213
- } catch (e) {
1214
- return;
1215
- } finally {
1216
- clearTimeout(s), r == null || r.removeEventListener("abort", o);
1217
- }
1218
- }), gr.apply(this, arguments);
1219
- }
1220
- //#endregion
1221
- //#region ../../libs/player-next/src/timeshift/TimeshiftDurationSource.ts
1222
- var _r = /* @__PURE__ */ new WeakMap(), vr = /* @__PURE__ */ new WeakMap(), yr = /* @__PURE__ */ new WeakMap(), br = /* @__PURE__ */ new WeakMap(), xr = /* @__PURE__ */ new WeakMap(), Sr = /* @__PURE__ */ new WeakMap(), Cr = /* @__PURE__ */ new WeakMap(), wr = /* @__PURE__ */ new WeakMap(), Tr = /* @__PURE__ */ new WeakMap(), Er = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakSet(), Dr = class {
1223
- constructor({ onChange: e, probe: t = hr, now: n = () => performance.now() }) {
1224
- S(this, A), f(this, _r, void 0), f(this, vr, void 0), f(this, yr, void 0), f(this, br, void 0), f(this, xr, !0), f(this, Sr, !1), f(this, Cr, 0), f(this, wr, 0), f(this, Tr, 0), f(this, Er, null), p(_r, this, e), p(vr, this, t), p(yr, this, n);
1225
- }
1226
- start({ multivariantUrl: e, params: t, windowCapSeconds: n }) {
1227
- if (m(A, this, Or).call(this), !(n > 0)) {
1228
- h(_r, this).call(this, n);
1229
- return;
1230
- }
1231
- let r = new AbortController();
1232
- p(br, this, r);
1233
- let { signal: i } = r;
1234
- h(vr, this).call(this, e, t, { signal: i }).then((e) => {
1235
- if (!i.aborted) {
1236
- if (e === void 0) {
1237
- h(_r, this).call(this, n);
1238
- return;
1239
- }
1240
- p(wr, this, n), p(Cr, this, Math.min(Math.max(e, 0), n)), p(Tr, this, h(yr, this).call(this)), p(Sr, this, !0), m(A, this, kr).call(this), h(xr, this) && m(A, this, Ar).call(this);
1241
- }
1242
- });
1243
- }
1244
- setLive(e) {
1245
- p(xr, this, e), !(!h(br, this) || e) && (m(A, this, jr).call(this), m(A, this, kr).call(this));
1246
- }
1247
- applyLoadedDuration(e) {
1248
- m(A, this, Or).call(this), h(_r, this).call(this, Number.isNaN(e) ? 0 : e);
1249
- }
1250
- stop() {
1251
- m(A, this, Or).call(this);
1252
- }
1253
- };
1254
- function Or() {
1255
- var e;
1256
- (e = h(br, this)) == null || e.abort(), p(br, this, void 0), m(A, this, jr).call(this), p(Sr, this, !1);
1257
- }
1258
- function kr() {
1259
- if (!h(Sr, this)) return;
1260
- let e = h(Cr, this) + Math.max(0, (h(yr, this).call(this) - h(Tr, this)) / 1e3), t = Math.min(h(wr, this), e);
1261
- h(_r, this).call(this, t), t >= h(wr, this) && m(A, this, jr).call(this);
1262
- }
1263
- function Ar() {
1264
- h(Er, this) === null && p(Er, this, window.setInterval(() => m(A, this, kr).call(this), 1e3));
1265
- }
1266
- function jr() {
1267
- h(Er, this) !== null && (clearInterval(h(Er, this)), p(Er, this, null));
1268
- }
1269
- //#endregion
1270
- //#region ../../libs/player-next/src/utils/getVindralAttributes.ts
1271
- var Mr = (e) => {
1272
- var t;
1273
- let n = "observedAttributes" in e.constructor ? e.constructor.observedAttributes : void 0;
1274
- return !n && (t = e.nodeName) != null && t.includes("-") && (globalThis.customElements.upgrade(e), n = "observedAttributes" in e.constructor ? e.constructor.observedAttributes : void 0), Array.isArray(n) ? n.filter((e) => Ae.includes(e)) : [];
1275
- };
1276
- //#endregion
1277
- //#region ../../libs/player-next/src/utils/humanReadableTimeToSeconds.ts
1278
- function Nr(e) {
1279
- if (typeof e != "string") return NaN;
1280
- let t = [...e.matchAll(/(\d+(?:\.\d+)?)([hms])/gi)];
1281
- return t.length === 0 ? NaN : t.reduce((e, t) => {
1282
- var n, r;
1283
- let i = parseFloat((n = t[1]) == null ? "0" : n);
1284
- switch (((r = t[2]) == null ? "" : r).toLowerCase()) {
1285
- case "h": return e + i * 3600;
1286
- case "m": return e + i * 60;
1287
- case "s": return e + i;
1288
- default: return e;
1289
- }
1290
- }, 0);
1291
- }
1292
- //#endregion
1293
- //#region ../../libs/player-next/src/utils/timelineMarkers.ts
1294
- var Pr = fe.get().createContext("TimelineMarkers"), Fr = /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2})?(\.\d+)?$/, Ir = (e) => {
1295
- Pr.warn(`Timeline marker time "${e}" has no timezone and is interpreted in the viewer's local timezone, so it can land at a different position for viewers in other timezones. Provide an ISO 8601 time with an offset (e.g. "${e}Z") or epoch milliseconds.`);
1296
- }, Lr = (e) => {
1297
- if (typeof e == "number" && Number.isFinite(e)) return e;
1298
- if (typeof e == "string") {
1299
- let t = Date.parse(e);
1300
- return Number.isNaN(t) ? null : (Fr.test(e) && Ir(e), t);
1301
- }
1302
- if (e instanceof Date) {
1303
- let t = e.getTime();
1304
- return Number.isNaN(t) ? null : t;
1305
- }
1306
- return null;
1307
- }, Rr = (e) => {
1308
- if (typeof e != "object" || !e) return null;
1309
- let { time: t, label: n, type: r } = e, i = Lr(t);
1310
- if (i === null || typeof n != "string" || n.length === 0) return null;
1311
- let a = {
1312
- time: i,
1313
- label: n
1314
- };
1315
- return typeof r == "string" && r.length > 0 && (a.type = r), a;
1316
- }, zr = (e) => {
1317
- if (!Array.isArray(e)) return [];
1318
- let t = e.map(Rr).filter((e) => e !== null), n = e.length - t.length;
1319
- return n > 0 && Pr.warn(`Dropped ${n} invalid timeline marker(s). Each marker needs a non-empty "label" and a valid "time" (epoch milliseconds, a Date, or an ISO 8601 string).`), t;
1320
- }, Br = (e) => e ? zr(le(e)) : [], Vr = (e, t, n) => {
1321
- if (!Number.isFinite(n) || n <= 0) return null;
1322
- let r = 1 - (t - e) / (n * 1e3);
1323
- return r < 0 || r > 1 ? null : r;
1324
- }, Hr = class extends pe {
1325
- constructor(t) {
1326
- if (super(), e(this, "audioContext", void 0), e(this, "audioNode", void 0), e(this, "bufferLength", void 0), e(this, "animationFrameId", null), e(this, "canUseFloatTimeDomainData", void 0), e(this, "byteSampleBuffer", null), e(this, "floatSampleBuffer", null), e(this, "leftAnalyser", void 0), e(this, "rightAnalyser", void 0), e(this, "mediaElementSource", null), e(this, "update", () => {
1327
- let e = this.getDecibel(this.leftAnalyser, this.floatSampleBuffer || this.byteSampleBuffer), t = this.getDecibel(this.rightAnalyser, this.floatSampleBuffer || this.byteSampleBuffer);
1328
- this.emit("on decibel change", {
1329
- left: e,
1330
- right: t
1331
- }), this.animationFrameId = requestAnimationFrame(this.update);
1332
- }), this.source = t, t instanceof HTMLMediaElement) {
1333
- let e = new AudioContext();
1334
- this.mediaElementSource = e.createMediaElementSource(t), this.audioNode = e.createChannelSplitter(2), this.mediaElementSource.connect(this.audioNode), this.audioContext = e, this.mediaElementSource.connect(this.audioContext.destination);
1335
- } else this.audioNode = t, this.audioContext = this.audioNode.context;
1336
- this.leftAnalyser = this.audioNode.context.createAnalyser(), this.rightAnalyser = this.audioNode.context.createAnalyser(), this.audioNode.connect(this.leftAnalyser, 0), this.audioNode.connect(this.rightAnalyser, 1), this.canUseFloatTimeDomainData = typeof this.leftAnalyser.getFloatTimeDomainData == "function", this.leftAnalyser.fftSize = 1024, this.rightAnalyser.fftSize = 1024, this.bufferLength = this.leftAnalyser.fftSize, this.canUseFloatTimeDomainData ? this.floatSampleBuffer = new Float32Array(this.bufferLength) : this.byteSampleBuffer = new Uint8Array(this.bufferLength);
1337
- }
1338
- getDecibel(e, t) {
1339
- let n = 0;
1340
- if (t instanceof Float32Array) {
1341
- e.getFloatTimeDomainData(t);
1342
- for (let e = 0; e < t.length; e++) {
1343
- let r = t[e];
1344
- if (r) {
1345
- let e = r ** 2;
1346
- n = Math.max(e, n);
1347
- }
1348
- }
1349
- } else {
1350
- e.getByteTimeDomainData(t);
1351
- for (let e = 0; e < t.length; e++) {
1352
- let r = t[e];
1353
- if (r) {
1354
- let e = (r / 128 - 1) ** 2;
1355
- n = Math.max(e, n);
1356
- }
1357
- }
1358
- }
1359
- return 10 * Math.log10(n);
1360
- }
1361
- start() {
1362
- this.animationFrameId === null && (this.audioContext instanceof AudioContext && this.audioContext.state === "suspended" ? this.audioContext.resume().then(() => {
1363
- this.update();
1364
- }) : this.update());
1365
- }
1366
- stop() {
1367
- this.animationFrameId !== null && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = null);
1368
- }
1369
- unload() {
1370
- var e;
1371
- this.stop(), (e = this.mediaElementSource) == null || e.disconnect(), this.leftAnalyser.disconnect(), this.rightAnalyser.disconnect(), this.audioNode.disconnect();
1372
- }
1373
- get isMediaElementSource() {
1374
- return this.source instanceof HTMLMediaElement;
1375
- }
1376
- }, j = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), Ur = /* @__PURE__ */ new WeakMap(), Wr = /* @__PURE__ */ new WeakMap(), Gr = /* @__PURE__ */ new WeakMap(), Kr = /* @__PURE__ */ new WeakMap(), qr = /* @__PURE__ */ new WeakMap(), Jr = /* @__PURE__ */ new WeakMap(), Yr = /* @__PURE__ */ new WeakMap(), Xr = /* @__PURE__ */ new WeakMap(), Zr = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakSet(), Qr = /* @__PURE__ */ new WeakMap(), $r = /* @__PURE__ */ new WeakMap(), ei = /* @__PURE__ */ new WeakMap(), ti = /* @__PURE__ */ new WeakMap(), ni = class {
1377
- constructor(t, n) {
1378
- S(this, F), f(this, j, void 0), f(this, M, void 0), f(this, N, void 0), f(this, Ur, void 0), f(this, Wr, void 0), e(this, "userPaused", !0), f(this, Gr, void 0), f(this, Kr, void 0), f(this, qr, !1), f(this, Jr, !1), f(this, Yr, null), f(this, Xr, 0), f(this, Zr, !1), f(this, P, fe.get().createContext("HlsPlayer")), f(this, Qr, () => m(F, this, hi).call(this, !0)), f(this, $r, () => m(F, this, hi).call(this, !1)), f(this, ei, () => {
1379
- h(j, this).readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && !h(j, this).paused && m(F, this, hi).call(this, !1);
1380
- }), f(this, ti, () => {
1381
- h(j, this).readyState >= HTMLMediaElement.HAVE_FUTURE_DATA && m(F, this, hi).call(this, !1);
1382
- }), p(M, this, t), p(Kr, this, n == null ? void 0 : n.maxVideoBitRate), h(M, this).style.position = "absolute", h(M, this).style.top = "0", h(M, this).style.left = "0", h(M, this).style.width = "100%", h(M, this).style.height = "100%", h(M, this).style.opacity = "0", h(M, this).style.pointerEvents = "none", h(M, this).style.transition = "opacity 0.12s linear";
1383
- let r = document.createElement("video");
1384
- p(j, this, r), t.appendChild(h(j, this)), h(j, this).style.width = "100%", h(j, this).style.height = "100%", h(j, this).setAttribute("playsinline", ""), h(j, this).setAttribute("webkit-playsinline", ""), h(j, this).setAttribute("preload", "metadata"), m(F, this, pi).call(this), p(Zr, this, h(j, this).muted), (n == null ? void 0 : n.volume) !== void 0 && (this.volume = n.volume), (n == null ? void 0 : n.muted) !== void 0 && (this.muted = n.muted);
1385
- }
1386
- hide() {
1387
- p(qr, this, !0), p(Jr, this, !1), h(M, this).classList.remove("active"), h(M, this).style.opacity = "0", h(M, this).style.pointerEvents = "none", p(Yr, this, null);
1388
- }
1389
- play() {
1390
- var e = this;
1391
- return t(function* () {
1392
- try {
1393
- return h(N, e) ? (e.userPaused = !1, yield h(j, e).play()) : Promise.reject("HLS not initialized");
1394
- } catch (t) {
1395
- h(P, e).error("Failed to play timeshift video:", t);
1396
- }
1397
- })();
1398
- }
1399
- seek(e) {
1400
- var n = this;
1401
- return t(function* () {
1402
- if (h(P, n).debug("HlsPlayer seek to", e.time), !Number.isFinite(e.time)) {
1403
- p(Yr, n, null);
1404
- return;
1405
- }
1406
- if (p(Yr, n, e.time > .1 ? e.time : null), n.isActive() && h(N, n)) m(F, n, si).call(n, e.time);
1407
- else return m(F, n, ci).call(n, e);
1408
- })();
1409
- }
1410
- shouldIgnoreTimeupdate() {
1411
- if (h(Yr, this) == null) return !1;
1412
- let e = h(j, this).currentTime;
1413
- return !Number.isFinite(e) || e <= .1 ? !0 : (p(Yr, this, null), !1);
1414
- }
1415
- isPipSupported() {
1416
- return "pictureInPictureEnabled" in document && !h(j, this).disablePictureInPicture;
1417
- }
1418
- requestPictureInPicture() {
1419
- return h(j, this).requestPictureInPicture();
1420
- }
1421
- exitPictureInPicture() {
1422
- return document.pictureInPictureElement === h(j, this) ? document.exitPictureInPicture() : Promise.resolve();
1423
- }
1424
- isActive() {
1425
- return h(M, this).style.opacity === "1" || h(M, this).classList.contains("active");
1426
- }
1427
- cleanup() {
1428
- m(F, this, mi).call(this), m(F, this, oi).call(this), h(Gr, this) && (cancelAnimationFrame(h(Gr, this)), p(Gr, this, void 0)), p(Yr, this, null), h(j, this).remove();
1429
- }
1430
- addEventListener(e, t) {
1431
- h(j, this).addEventListener(e, t);
1432
- }
1433
- removeEventListener(e, t) {
1434
- h(j, this).removeEventListener(e, t);
1435
- }
1436
- dispatchEvent(e) {
1437
- return h(j, this).dispatchEvent(e);
1438
- }
1439
- setTimeshiftUrl(e) {
1440
- h(Wr, this) !== e && (h(P, this).debug("HLSPlayer Setting timeshift URL to", e), p(Wr, this, e));
1441
- }
1442
- get videoElement() {
1443
- return h(j, this);
1444
- }
1445
- pause() {
1446
- this.userPaused = !0, h(j, this).pause();
1447
- }
1448
- get paused() {
1449
- return h(j, this).paused;
1450
- }
1451
- set volume(e) {
1452
- h(j, this).volume = e;
1453
- }
1454
- get volume() {
1455
- return h(j, this).volume;
1456
- }
1457
- set muted(e) {
1458
- p(Zr, this, e), h(j, this).muted = e;
1459
- }
1460
- get muted() {
1461
- return h(Zr, this);
1462
- }
1463
- set currentTime(e) {
1464
- h(j, this).currentTime = e;
1465
- }
1466
- get currentTime() {
1467
- return h(j, this).currentTime;
1468
- }
1469
- get seeking() {
1470
- return h(j, this).seeking;
1471
- }
1472
- get duration() {
1473
- return h(j, this).duration;
1474
- }
1475
- get maxVideoBitRate() {
1476
- return h(Kr, this);
1477
- }
1478
- set maxVideoBitRate(e) {
1479
- p(Kr, this, e), e !== void 0 && h(N, this) && m(F, this, ii).call(this, e);
1480
- }
1481
- };
1482
- function ri() {
1483
- var e = this;
1484
- return t(function* () {
1485
- let { default: t } = yield import("./Ct8GqCxq.js");
1486
- if (p(Ur, e, t), !t.isSupported()) {
1487
- h(P, e).warn("HLS not supported");
1488
- return;
1489
- }
1490
- p(N, e, new t({
1491
- capLevelToPlayerSize: !0,
1492
- enableWorker: !0,
1493
- backBufferLength: 30,
1494
- maxBufferLength: 10,
1495
- maxMaxBufferLength: 30,
1496
- maxBufferSize: 3e7,
1497
- fragLoadingTimeOut: 2e4,
1498
- manifestLoadingTimeOut: 1e4,
1499
- fragLoadingRetryDelay: 1e3,
1500
- manifestLoadingRetryDelay: 1e3,
1501
- fragLoadingMaxRetry: 3,
1502
- manifestLoadingMaxRetry: 3,
1503
- abrEwmaDefaultEstimate: 2e6,
1504
- abrBandWidthFactor: .95,
1505
- abrBandWidthUpFactor: .85,
1506
- startFragPrefetch: !0,
1507
- testBandwidth: !1,
1508
- debug: !1
1509
- })), h(N, e).attachMedia(h(j, e)), h(N, e).on(t.Events.MEDIA_ATTACHED, () => h(P, e).debug("[HLS] media attached")), h(N, e).on(t.Events.MANIFEST_PARSED, () => h(P, e).debug("[HLS] manifest parsed")), h(N, e).on(t.Events.ERROR, (t, n) => {
1510
- h(P, e).error("[HLS] error:", n), n.fatal && m(F, e, ai).call(e, n);
1511
- }), h(N, e).on(t.Events.MANIFEST_PARSED, () => {
1512
- var t;
1513
- !h(Kr, e) || ((t = h(N, e)) == null ? void 0 : t.levels.length) === 0 || m(F, e, ii).call(e, h(Kr, e));
1514
- }), h(N, e).on(t.Events.LEVEL_SWITCHED, () => {
1515
- var t, n;
1516
- h(P, e).debug("Level switched:", (t = h(N, e)) == null ? void 0 : t.currentLevel, "max:", e.maxVideoBitRate, "autoLevelCapping:", (n = h(N, e)) == null ? void 0 : n.autoLevelCapping);
1517
- });
1518
- })();
1519
- }
1520
- function ii(e) {
1521
- if (!h(N, this)) {
1522
- h(P, this).warn("HLS not initialized, cannot set bitrate cap");
1523
- return;
1524
- }
1525
- let t = h(N, this).levels.map((e, t) => ({
1526
- i: t,
1527
- bitrate: e.bitrate
1528
- })).filter((t) => e >= t.bitrate * .8).map((e) => e.i).pop();
1529
- if (t === void 0) {
1530
- var n;
1531
- t = 0, h(P, this).debug("No level fits under bitrate cap: " + e + ", defaulting to lowest level: " + ((n = h(N, this).levels[0]) == null ? void 0 : n.bitrate));
1532
- }
1533
- let r = h(N, this).currentLevel;
1534
- h(N, this).autoLevelCapping = t, r !== t && (h(P, this).debug(`Current level ${r} exceeds cap ${t}, forcing immediate switch`), h(N, this).currentLevel = t);
1535
- }
1536
- function ai(e) {
1537
- if (!h(Ur, this)) {
1538
- h(P, this).error("Hls class not available for error handling");
1539
- return;
1540
- }
1541
- let t = h(Ur, this);
1542
- switch (e.type) {
1543
- case t.ErrorTypes.NETWORK_ERROR:
1544
- var n;
1545
- h(P, this).warn("[HLS] network error -> startLoad"), (n = h(N, this)) == null || n.startLoad();
1546
- break;
1547
- case t.ErrorTypes.MEDIA_ERROR:
1548
- var r;
1549
- h(P, this).warn("[HLS] media error -> recoverMediaError"), (r = h(N, this)) == null || r.recoverMediaError();
1550
- break;
1551
- default:
1552
- h(P, this).error("[HLS] fatal -> destroy"), m(F, this, oi).call(this);
1553
- break;
1554
- }
1555
- }
1556
- function oi() {
1557
- h(N, this) && (h(N, this).destroy(), p(N, this, void 0));
1558
- }
1559
- function si(e) {
1560
- if (!Number.isFinite(e)) {
1561
- p(Yr, this, null);
1562
- return;
1563
- }
1564
- let t = m(F, this, fi).call(this, h(j, this), e);
1565
- p(Yr, this, t > .1 ? t : null), h(Gr, this) && cancelAnimationFrame(h(Gr, this)), p(Gr, this, requestAnimationFrame(() => {
1566
- h(j, this).currentTime = t;
1567
- }));
1568
- }
1569
- function ci(e) {
1570
- var n = this;
1571
- return t(function* () {
1572
- var t;
1573
- let { time: r, playWhenReady: i = !0 } = e || {}, a = p(Xr, n, (t = h(Xr, n), ++t));
1574
- if (!h(Wr, n)) {
1575
- h(P, n).warn("No timeshift URL");
1576
- return;
1577
- }
1578
- if (!h(N, n) && (yield m(F, n, ri).call(n), !m(F, n, gi).call(n, a))) return;
1579
- p(qr, n, !1), p(Jr, n, !1), h(N, n) && (!h(N, n).url || h(N, n).url !== h(Wr, n)) && (h(P, n).debug("Loading timeshift URL", h(Wr, n)), h(N, n).loadSource(h(Wr, n)));
1580
- let o = n.muted;
1581
- h(j, n).muted = !0, yield m(F, n, li).call(n), m(F, n, gi).call(n, a) && (m(F, n, si).call(n, r), !(i && (yield n.play(), !m(F, n, gi).call(n, a))) && m(F, n, ui).call(n, o, a));
1582
- })();
1583
- }
1584
- function li() {
1585
- return h(j, this).duration && !Number.isNaN(h(j, this).duration) ? Promise.resolve() : new Promise((e) => {
1586
- h(P, this).debug("Waiting for duration...");
1587
- let t = () => {
1588
- h(P, this).debug("Duration loaded:", h(j, this).duration), h(j, this).removeEventListener("loadedmetadata", t), clearTimeout(n), e();
1589
- }, n = setTimeout(() => {
1590
- h(P, this).debug("Duration timeout, proceeding anyway"), h(j, this).removeEventListener("loadedmetadata", t), e();
1591
- }, 2e4);
1592
- h(j, this).addEventListener("loadedmetadata", t);
1593
- });
1594
- }
1595
- function ui(e, t) {
1596
- let n = HTMLMediaElement.HAVE_CURRENT_DATA, r = () => h(j, this).readyState >= n && h(j, this).videoWidth > 0 && h(j, this).videoHeight > 0, i = () => {
1597
- h(qr, this) || h(Jr, this) || !m(F, this, gi).call(this, t) || (p(Jr, this, !0), h(P, this).debug("Revealing timeshift video"), h(M, this).classList.add("active"), h(M, this).style.opacity = "1", h(M, this).style.pointerEvents = "auto", h(j, this).dispatchEvent(new CustomEvent("timeshiftready", { detail: { activationId: t } })), e || m(F, this, di).call(this, t));
1598
- }, a = () => {
1599
- h(qr, this) || h(Jr, this) || !m(F, this, gi).call(this, t) || r() && (s(), i());
1600
- }, o = !1, s = () => {
1601
- o || (o = !0, h(j, this).removeEventListener("canplay", a), h(j, this).removeEventListener("canplaythrough", a), h(j, this).removeEventListener("loadeddata", a), clearTimeout(c));
1602
- };
1603
- if (r()) {
1604
- i();
1605
- return;
1606
- }
1607
- h(j, this).addEventListener("canplay", a), h(j, this).addEventListener("canplaythrough", a), h(j, this).addEventListener("loadeddata", a);
1608
- let c = setTimeout(() => {
1609
- h(P, this).debug("Timeout reached, forcing reveal"), s(), i();
1610
- }, 2e3);
1611
- }
1612
- function di(e) {
1613
- let t = () => {
1614
- m(F, this, gi).call(this, e) && (h(j, this).muted = !1);
1615
- };
1616
- "requestVideoFrameCallback" in h(j, this) ? h(j, this).requestVideoFrameCallback(() => {
1617
- setTimeout(() => {
1618
- t();
1619
- }, 100);
1620
- }) : setTimeout(() => {
1621
- t();
1622
- }, 120);
1623
- }
1624
- function fi(e, t) {
1625
- let n = e.seekable;
1626
- if (!n || n.length === 0) return t;
1627
- let r = n.start(0), i = n.end(n.length - 1);
1628
- return h(P, this).debug("Clamped seekable:", Math.max(r, Math.min(t, i))), Math.max(r, Math.min(t, i));
1629
- }
1630
- function pi() {
1631
- for (let e of _i._) h(j, this).addEventListener(e, h(Qr, this));
1632
- for (let e of vi._) h(j, this).addEventListener(e, h($r, this));
1633
- h(j, this).addEventListener("timeupdate", h(ei, this)), h(j, this).addEventListener("progress", h(ti, this));
1634
- }
1635
- function mi() {
1636
- for (let e of _i._) h(j, this).removeEventListener(e, h(Qr, this));
1637
- for (let e of vi._) h(j, this).removeEventListener(e, h($r, this));
1638
- h(j, this).removeEventListener("timeupdate", h(ei, this)), h(j, this).removeEventListener("progress", h(ti, this));
1639
- }
1640
- function hi(e) {
1641
- let t = e && (h(j, this).readyState < HTMLMediaElement.HAVE_FUTURE_DATA || h(j, this).seeking || h(j, this).paused && !this.userPaused);
1642
- h(j, this).dispatchEvent(new CustomEvent(t ? "hlsbuffering" : "hlsnotbuffering", {
1643
- bubbles: !0,
1644
- composed: !0
1645
- }));
1646
- }
1647
- function gi(e) {
1648
- return h(Xr, this) === e;
1649
- }
1650
- var _i = { _: [
1651
- "waiting",
1652
- "seeking",
1653
- "stalled",
1654
- "loadstart"
1655
- ] }, vi = { _: [
1656
- "canplay",
1657
- "canplaythrough",
1658
- "seeked",
1659
- "loadeddata"
1660
- ] }, yi = class {
1661
- constructor(e) {
1662
- this.vindral = e;
1663
- }
1664
- get volume() {
1665
- return this.vindral.volume;
1666
- }
1667
- get muted() {
1668
- return this.vindral.muted;
1669
- }
1670
- play() {
1671
- var e = this;
1672
- return t(function* () {
1673
- var t;
1674
- return (t = e.vindral) == null || t.play(), Promise.resolve();
1675
- })();
1676
- }
1677
- pause() {
1678
- this.vindral.pause();
1679
- }
1680
- }, bi = document.createElement("template");
1681
- bi.innerHTML = "\n <style>\n :host {\n --value: 0;\n --range-thickness: var(--vindral-range-thickness, 4px);\n --range-hover-thickness: var(--vindral-range-hover-thickness, var(--range-thickness));\n --range-thumb-size: var(--vindral-range-thumb-size, 12px);\n --range-thumb-hover-size: var(--vindral-range-thumb-hover-size, var(--range-thumb-size));\n --range-fill-color: var(--vindral-range-fill-color, var(--fg-strong));\n --range-thumb-color: var(--vindral-range-thumb-color, var(--fg-strong));\n --_focus-box-shadow: none;\n height: calc(var(--button-icon-size) + 2 * var(--button-padding));\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0 !important;\n margin: 0;\n position: relative;\n cursor: pointer;\n touch-action: none;\n box-shadow: var(--_focus-visible-box-shadow, none);\n outline: 0;\n background: transparent;\n }\n\n :host > * {\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n transition-duration: 0.1s;\n }\n\n #range {\n -webkit-appearance: none;\n appearance: none;\n\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n margin: 0;\n padding: 0;\n\n background-color: #00000000;\n outline: none;\n z-index: 1;\n cursor: pointer;\n }\n\n #range-track {\n position: absolute;\n top: calc(50% - calc(var(--range-thickness) / 2));\n left: 1px;\n width: calc(100% - 2px);\n height: var(--range-thickness);\n background-color: rgb(255 255 255 / 0.2);\n overflow: hidden;\n cursor: pointer;\n transition-property: height, top;\n }\n\n @media (hover: hover) and (pointer: fine) {\n :host(:hover) #range-track {\n height: var(--range-hover-thickness);\n top: calc(50% - calc(var(--range-hover-thickness) / 2));\n }\n }\n\n #range-track::before {\n position: absolute;\n content: \"\";\n left: calc(-100%);\n top: 0;\n width: calc(100%);\n height: 100%;\n background: var(--range-fill-color);\n transition: background-color 300ms ease-out;\n transform-origin: 100% 0%;\n transform: translateX(calc(var(--value) * 100%)) scaleX(1.2);\n }\n\n #range::-webkit-slider-runnable-track {\n background: transparent;\n }\n\n #range::-moz-range-track {\n background: transparent;\n }\n\n #range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: var(--range-thumb-size);\n height: var(--range-thumb-size);\n border-radius: 50%;\n background: var(--range-thumb-color);\n cursor: pointer;\n z-index: 1;\n transition-property: width, height;\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n transition-duration: 0.1s;\n }\n\n #range::-moz-range-thumb {\n -moz-appearance: none;\n appearance: none;\n width: var(--range-thumb-size);\n height: var(--range-thumb-size);\n border-radius: 50%;\n background: var(--range-thumb-color);\n cursor: pointer;\n z-index: 1;\n border: none;\n transition-property: width, height;\n transition-timing-function: cubic-bezier(0.4, 0, 1, 1);\n transition-duration: 0.1s;\n }\n\n :host:has(#range:focus-visible) {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n }\n\n @media (hover: hover) and (pointer: fine) {\n :host(:hover) #range::-webkit-slider-thumb {\n width: var(--range-thumb-hover-size);\n height: var(--range-thumb-hover-size);\n }\n\n :host(:hover) #range::-moz-range-thumb {\n width: var(--range-thumb-hover-size);\n height: var(--range-thumb-hover-size);\n }\n }\n </style>\n\n <input type=\"range\" id=\"range\" min=\"0\" max=\"1\" step=\"any\" value=\"0\" />\n <div id=\"range-track\"></div>\n";
1682
- var xi = /* @__PURE__ */ new WeakMap(), Si = /* @__PURE__ */ new WeakMap(), Ci = class extends HTMLElement {
1683
- constructor() {
1684
- super(), f(this, xi, null), f(this, Si, void 0), e(this, "range", void 0), p(Si, this, this.attachShadow({ mode: "open" })), h(Si, this).appendChild(bi.content.cloneNode(!0)), this.range = h(Si, this).getElementById("range");
1685
- }
1686
- connectedCallback() {
1687
- var e;
1688
- p(xi, this, this.closest("vindral-controller")), (e = h(xi, this)) == null || e.connectListener(this), this.hasAttribute("disabled") || this.enable();
1689
- }
1690
- disconnectedCallback() {
1691
- var e;
1692
- (e = h(xi, this)) == null || e.disconnectListener(this);
1693
- }
1694
- attributeChangedCallback(e, t, n) {
1695
- t !== n && (e === "disabled" && n ? this.disable() : this.enable(), this.updateBar());
1696
- }
1697
- enable() {
1698
- this.addEventListener("input", this);
1699
- }
1700
- disable() {
1701
- this.range.removeEventListener("input", this);
1702
- }
1703
- handleEvent(e) {
1704
- e.type === "input" && this.updateBar();
1705
- }
1706
- updateBar() {
1707
- this.style.setProperty("--value", this.range.value);
1708
- }
1709
- get keysUsed() {
1710
- return [
1711
- "ArrowUp",
1712
- "ArrowRight",
1713
- "ArrowDown",
1714
- "ArrowLeft"
1715
- ];
1716
- }
1717
- };
1718
- e(Ci, "observedAttributes", ["disabled"]);
1719
- //#endregion
1720
- //#region ../../libs/player-next/src/components/Controller.ts
1721
- var wi = document.createElement("template");
1722
- wi.innerHTML = `
1723
- <style>
1724
- :host {
1725
- --fg-strong: var(--vindral-fg-strong, #eeeeee);
1726
- --fg-subtle: var(--vindral-fg-subtle, #b4b4b4);
1727
- --fg-extra-subtle: var(--vindral-fg-extra-subtle, #7b7b7b);
1728
- --bg-strong: var(--vindral-bg-strong, #111111);
1729
- --bg-subtle: var(--vindral-bg-subtle, #191919);
1730
- --bg-extra-subtle: var(--vindral-bg-extra-subtle, #222222);
1731
- --bg-component: var(--vindral-bg-component, #222222);
1732
- --bg-component-hover: var(--vindral-bg-component-hover, #2a2a2a);
1733
- --bg-component-active: var(--vindral-bg-component-active, #313131);
1734
- --accent: var(--vindral-accent, oklch(54.6% 0.245 262.881));
1735
-
1736
- --padding-1: var(--vindral-padding-1, 4px);
1737
- --padding-2: var(--vindral-padding-2, 8px);
1738
- --padding-3: var(--vindral-padding-3, 16px);
1739
- --padding-4: var(--vindral-padding-4, 24px);
1740
- --padding-5: var(--vindral-padding-5, 32px);
1741
- --padding-6: var(--vindral-padding-6, 40px);
1742
- --control-padding: var(--vindral-control-padding, var(--padding-1));
1743
-
1744
- --ui-font: var(
1745
- --vindral-ui-font,
1746
- -apple-system,
1747
- BlinkMacSystemFont,
1748
- "Segoe UI",
1749
- Roboto,
1750
- "Helvetica Neue",
1751
- Arial,
1752
- sans-serif
1753
- );
1754
-
1755
- --button-padding: var(--vindral-button-padding, var(--padding-2));
1756
- --button-icon-size: var(--vindral-button-icon-size, 24px);
1757
- --play-overlay-icon-size: var(--vindral-play-overlay-icon-size, 72px);
1758
-
1759
- --ui-display: var(--vindral-ui-display, flex);
1760
- --play-button-display: var(--vindral-play-button-display, flex);
1761
- --mute-button-display: var(--vindral-mute-button-display, flex);
1762
- --airplay-button-display: var(--vindral-airplay-button-display, flex);
1763
- --pip-button-display: var(--vindral-pip-button-display, flex);
1764
- --fullscreen-button-display: var(--vindral-fullscreen-button-display, flex);
1765
- --cast-button-display: var(--vindral-cast-button-display, flex);
1766
- --grid-button-display: var(--vindral-grid-button-display, flex);
1767
- --grid-item-offline-display: var(--vindral-grid-item-offline-display, flex);
1768
- --volume-range-display: var(--vindral-volume-range-display, flex);
1769
- --volume-meter-display: var(--vindral-volume-meter-display, flex);
1770
- --rendition-menu-display: var(--vindral-rendition-menu-display, flex);
1771
- --language-menu-display: var(--vindral-language-menu-display, flex);
1772
- --play-overlay-display: var(--vindral-play-overlay-display, flex);
1773
- --buffering-overlay-display: var(--vindral-buffering-overlay-display, flex);
1774
- --poster-overlay-display: var(--vindral-poster-overlay-display, flex);
1775
- --live-button-display: var(--vindral-live-button-display, flex);
1776
- --seek-bar-display: var(--vindral-seek-bar-display, flex);
1777
- --tooltip-display: var(--vindral-tooltip-display, block);
1778
- --debug-button-display: var(--vindral-debug-button-display, none);
1779
-
1780
- position: relative;
1781
- display: flex;
1782
- background-color: var(--bg-strong);
1783
- width: 100%;
1784
- container-type: inline-size;
1785
- overflow: hidden;
1786
- font-family: var(--ui-font);
1787
- }
1788
-
1789
- #ui {
1790
- position: absolute;
1791
- display: flex;
1792
- justify-content: space-between;
1793
- flex-direction: column;
1794
- top: 0;
1795
- bottom: 0;
1796
- left: 0;
1797
- right: 0;
1798
- transition: opacity 0.5s;
1799
- user-select: none;
1800
- pointer-events: none;
1801
- }
1802
-
1803
- #ui > * {
1804
- display: var(--ui-display);
1805
- }
1806
-
1807
- #ui > slot::slotted(*) {
1808
- pointer-events: auto;
1809
- z-index: 10;
1810
- box-sizing: border-box;
1811
- padding: var(--control-padding);
1812
- // Ensure the #ui element is above the video element on Safari
1813
- // and that we can layer things under, between, and above ui and video
1814
- }
1815
-
1816
- #video {
1817
- cursor: none;
1818
- display: flex;
1819
- width: 100%;
1820
- z-index: 0;
1821
- }
1822
-
1823
- /* Chrome sizes this box from the video height, which pads multi-line cues. Must match
1824
- ::cue (CaptionFontScaler updates both); the em lift replaces the inset that sizing gave us. */
1825
- #video video::-webkit-media-text-track-display {
1826
- font-size: 28px;
1827
- transform: translateY(calc(var(--vindral-subtitle-offset, 0px) - 0.5em)) !important;
1828
- }
1829
-
1830
- /* Chrome does not wrap cue text on its own, so a long line overflows and gets clipped. */
1831
- #video video::cue {
1832
- font-size: 28px;
1833
- background-color: rgba(0, 0, 0, 0.6);
1834
- white-space: pre-wrap;
1835
- }
1836
-
1837
- /* iOS Safari also paints the system caption window behind the cue; ::cue is the only background we want. */
1838
- #video video::-webkit-media-text-track-display-backdrop {
1839
- background-color: transparent;
1840
- }
1841
-
1842
- :host([user-interacting]) #video {
1843
- cursor: auto;
1844
- }
1845
-
1846
- #video > canvas {
1847
- object-fit: contain;
1848
- }
1849
-
1850
- slot#middle {
1851
- align-items: center;
1852
- justify-content: center;
1853
- flex-grow: 1;
1854
- }
1855
-
1856
- #top-bar::slotted(vindral-control-bar) {
1857
- background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
1858
- }
1859
-
1860
- #bottom-bar::slotted(vindral-control-bar) {
1861
- background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
1862
- }
1863
-
1864
- slot#bottom-bar {
1865
- flex-direction: column;
1866
- }
1867
-
1868
- :host(:focus-visible) {
1869
- outline: none;
1870
- }
1871
-
1872
- :host(
1873
- :not([${g.USER_INTERACTING}]
1874
- ):not([${g.PAUSED}]:not([${g.HIDE_UI_ON_PAUSE}])
1875
- ):not([${g.IS_CASTING}]
1876
- ):not([${g.MEDIA}="audio"])
1877
- )
1878
- #ui {
1879
- opacity: 0;
1880
- cursor: none;
1881
- pointer-events: none;
1882
- }
1883
-
1884
- :host(
1885
- :not([${g.USER_INTERACTING}]
1886
- ):not([${g.PAUSED}]:not([${g.HIDE_UI_ON_PAUSE}])
1887
- ):not([${g.IS_CASTING}]
1888
- ):not([${g.MEDIA}="audio"])
1889
- )
1890
- #ui > slot::slotted(*) {
1891
- pointer-events: none;
1892
- }
1893
-
1894
- :host([${g.FULLSCREEN}][${g.FULLSCREEN_FALLBACK}]) {
1895
- position: fixed !important;
1896
- inset: 0 !important;
1897
- margin: 0 !important;
1898
- box-sizing: border-box !important;
1899
- min-width: 0 !important;
1900
- max-width: none !important;
1901
- min-height: 0 !important;
1902
- max-height: none !important;
1903
- width: 100% !important;
1904
- height: 100% !important;
1905
- transform: none !important;
1906
- z-index: 1000 !important;
1907
- background: black;
1908
- top: 0;
1909
- left: 0;
1910
- right: 0;
1911
- bottom: 0;
1912
-
1913
- /* intentionally not !important */
1914
- object-fit: contain;
1915
- }
1916
-
1917
- :host([${g.MEDIA}="audio"]) {
1918
- min-height: 100px;
1919
- overflow: visible;
1920
- }
1921
- </style>
1922
-
1923
- <div id="video"></div>
1924
- <div id="time-shift-video"></div>
1925
-
1926
- <slot id="overlay" name="overlay"></slot>
1927
-
1928
- <div id="ui">
1929
- <slot id="top-bar" name="top-bar"></slot>
1930
- <slot id="middle" name="middle"></slot>
1931
- <slot id="bottom-bar"></slot>
1932
- <slot id="overlay-interactive" name="overlay-interactive"></slot>
1933
- </div>
1934
- `;
1935
- var Ti = [
1936
- "ArrowDown",
1937
- "ArrowLeft",
1938
- "ArrowRight",
1939
- "Tab",
1940
- "Enter",
1941
- " ",
1942
- "f",
1943
- "m"
1944
- ], Ei = /* @__PURE__ */ new WeakMap(), Di = /* @__PURE__ */ new WeakMap(), Oi = /* @__PURE__ */ new WeakMap(), ki = /* @__PURE__ */ new WeakMap(), Ai = /* @__PURE__ */ new WeakMap(), ji = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), Mi = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), Ni = /* @__PURE__ */ new WeakMap(), Pi = /* @__PURE__ */ new WeakMap(), Fi = /* @__PURE__ */ new WeakMap(), Ii = /* @__PURE__ */ new WeakMap(), Li = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), Ri = /* @__PURE__ */ new WeakMap(), zi = /* @__PURE__ */ new WeakMap(), Bi = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), Vi = /* @__PURE__ */ new WeakMap(), Hi = /* @__PURE__ */ new WeakMap(), Ui = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), Wi = /* @__PURE__ */ new WeakMap(), Gi = /* @__PURE__ */ new WeakMap(), Ki = /* @__PURE__ */ new WeakMap(), qi = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakSet(), Ji = /* @__PURE__ */ new WeakMap(), Yi = /* @__PURE__ */ new WeakMap(), Xi = /* @__PURE__ */ new WeakMap(), Zi = /* @__PURE__ */ new WeakMap(), Qi = /* @__PURE__ */ new WeakMap(), $i = /* @__PURE__ */ new WeakMap(), ea = /* @__PURE__ */ new WeakMap(), ta = /* @__PURE__ */ new WeakMap(), na = /* @__PURE__ */ new WeakMap(), ra = /* @__PURE__ */ new WeakMap(), ia = /* @__PURE__ */ new WeakMap(), aa = /* @__PURE__ */ new WeakMap(), oa = /* @__PURE__ */ new WeakMap(), sa = /* @__PURE__ */ new WeakMap(), ca = /* @__PURE__ */ new WeakMap(), la = /* @__PURE__ */ new WeakMap(), ua = /* @__PURE__ */ new WeakMap(), da = /* @__PURE__ */ new WeakMap(), fa = /* @__PURE__ */ new WeakMap(), pa = /* @__PURE__ */ new WeakMap(), ma = /* @__PURE__ */ new WeakMap(), ha = /* @__PURE__ */ new WeakMap(), ga = /* @__PURE__ */ new WeakMap(), _a = /* @__PURE__ */ new WeakMap(), va = /* @__PURE__ */ new WeakMap(), ya = /* @__PURE__ */ new WeakMap(), ba = /* @__PURE__ */ new WeakMap(), xa = /* @__PURE__ */ new WeakMap(), Sa = /* @__PURE__ */ new WeakMap(), Ca = /* @__PURE__ */ new WeakMap(), wa = /* @__PURE__ */ new WeakMap(), Ta = /* @__PURE__ */ new WeakMap(), Ea = /* @__PURE__ */ new WeakMap(), Da = /* @__PURE__ */ new WeakMap(), Oa = class extends HTMLElement {
1945
- constructor() {
1946
- var t;
1947
- super(), S(this, H), f(this, Ei, /* @__PURE__ */ new Map()), f(this, Di, 2e3), f(this, Oi, null), f(this, ki, new Dr({ onChange: (e) => m(H, this, U).call(this, g.DURATION, e.toString()) })), f(this, Ai, null), f(this, ji, void 0), f(this, I, void 0), f(this, L, void 0), f(this, Mi, void 0), f(this, R, void 0), f(this, Ni, we), f(this, Pi, void 0), f(this, Fi, void 0), f(this, Ii, void 0), f(this, Li, void 0), f(this, z, void 0), f(this, Ri, void 0), f(this, zi, void 0), f(this, Bi, void 0), f(this, B, void 0), f(this, Vi, void 0), f(this, Hi, void 0), f(this, Ui, void 0), f(this, V, void 0), f(this, Wi, null), f(this, Gi, !1), f(this, Ki, null), f(this, qi, void 0), f(this, Ji, (e) => {
1948
- let t = e.filter((e) => {
1949
- var t;
1950
- return (t = e.video) == null ? void 0 : t.width;
1951
- });
1952
- m(H, this, U).call(this, g.RENDITION_LEVELS, JSON.stringify(t));
1953
- }), f(this, Yi, (e) => {
1954
- m(H, this, U).call(this, g.RENDITION_LEVEL, JSON.stringify(e));
1955
- }), f(this, Xi, !1), f(this, Zi, (e) => {
1956
- let t = h(Xi, this);
1957
- p(Xi, this, !0);
1958
- try {
1959
- e();
1960
- } finally {
1961
- p(Xi, this, t);
1962
- }
1963
- }), f(this, Qi, (e) => {
1964
- h(Zi, this).call(this, () => {
1965
- switch (e) {
1966
- case "playing":
1967
- m(H, this, W).call(this, g.PAUSED), m(H, this, W).call(this, g.BUFFERING);
1968
- break;
1969
- case "paused":
1970
- m(H, this, U).call(this, g.PAUSED, ""), m(H, this, W).call(this, g.BUFFERING);
1971
- break;
1972
- case "buffering":
1973
- m(H, this, W).call(this, g.PAUSED), m(H, this, U).call(this, g.BUFFERING, "");
1974
- break;
1975
- default: break;
1976
- }
1977
- });
1978
- }), f(this, $i, (e) => {
1979
- h(Zi, this).call(this, () => {
1980
- m(H, this, U).call(this, g.VOLUME, e.volume.toString()), e.isMuted ? m(H, this, U).call(this, g.MUTED, "") : m(H, this, W).call(this, g.MUTED);
1981
- });
1982
- }), f(this, ea, ({ channelId: e }) => {
1983
- var t;
1984
- this.setAttribute(g.CHANNEL_ID, e), ((t = h(I, this)) == null ? void 0 : t.playbackState) !== "buffering" && m(H, this, W).call(this, g.BUFFERING);
1985
- }), f(this, ta, ({ channelId: e }) => {
1986
- var t;
1987
- h(Pi, this) !== e && this.setAttribute(g.CHANNEL_ID, e), ((t = h(I, this)) == null ? void 0 : t.playbackState) !== "buffering" && m(H, this, W).call(this, g.BUFFERING);
1988
- }), f(this, na, (e) => {
1989
- p(wa, this, Date.now()), m(H, this, U).call(this, g.CHANNELS, JSON.stringify(e));
1990
- }), f(this, ra, (e) => {
1991
- var t;
1992
- m(H, this, U).call(this, g.LANGUAGES, JSON.stringify(e)), (t = h(I, this)) != null && t.language && m(H, this, U).call(this, g.LANGUAGE, h(I, this).language);
1993
- }), f(this, ia, (e) => {
1994
- var t;
1995
- if (m(H, this, U).call(this, g.TEXT_TRACKS, JSON.stringify(e)), (t = h(I, this)) != null && t.textTrack) {
1996
- var n, r;
1997
- m(H, this, U).call(this, g.TEXT_TRACK, (n = (r = h(I, this)) == null ? void 0 : r.textTrack) == null ? "" : n);
1998
- }
1999
- }), f(this, aa, (e) => {
2000
- e != null && e.forVideo ? (m(H, this, U).call(this, g.NEEDS_USER_INPUT_VIDEO, ""), m(H, this, W).call(this, g.NEEDS_USER_INPUT_AUDIO)) : e != null && e.forAudio && (m(H, this, U).call(this, g.NEEDS_USER_INPUT_AUDIO, ""), m(H, this, W).call(this, g.NEEDS_USER_INPUT_VIDEO));
2001
- }), f(this, oa, (e) => {
2002
- e || m(H, this, W).call(this, g.BUFFERING), h(ki, this).setLive(e);
2003
- }), f(this, sa, (e) => {
2004
- var t, n;
2005
- let { urls: r, duration: i } = e;
2006
- if (!r[0] || !h(R, this)) return;
2007
- let a = new URL(r[0]);
2008
- a.searchParams.set("channelId", (t = h(Pi, this)) == null ? "" : t);
2009
- let o = this.getAttribute("authentication-token");
2010
- o && a.searchParams.set("authToken", o);
2011
- let s = Nr(i);
2012
- if (Number.isNaN(s)) {
2013
- h(V, this).error(`Invalid duration format: ${i}`);
2014
- return;
2015
- }
2016
- let c = Math.floor(Date.now() / 1e3), l = (/* @__PURE__ */ new Date((c - s) * 1e3)).toISOString();
2017
- a.searchParams.set("from", l);
2018
- let u = a.toString();
2019
- h(R, this).setTimeshiftUrl(u), h(ki, this).start({
2020
- multivariantUrl: u,
2021
- params: {
2022
- channelId: (n = h(Pi, this)) == null ? "" : n,
2023
- authToken: o == null ? void 0 : o,
2024
- from: l
2025
- },
2026
- windowCapSeconds: s
2027
- });
2028
- }), f(this, ca, () => {
2029
- m(H, this, W).call(this, g.PAUSED), m(H, this, W).call(this, g.BUFFERING);
2030
- }), f(this, la, () => {
2031
- m(H, this, U).call(this, g.PAUSED, ""), m(H, this, W).call(this, g.BUFFERING);
2032
- }), f(this, ua, () => {
2033
- h(xa, this).call(this), m(H, this, W).call(this, g.BUFFERING);
2034
- }), f(this, da, () => {
2035
- h(R, this) && h(ki, this).applyLoadedDuration(h(R, this).duration);
2036
- }), f(this, fa, () => {
2037
- var e, t;
2038
- if (!h(R, this) || h(R, this).seeking || (e = (t = h(R, this)).shouldIgnoreTimeupdate) != null && e.call(t)) return;
2039
- let n = h(R, this).currentTime;
2040
- n !== void 0 && m(H, this, U).call(this, g.TIMESHIFT_POSITION, n.toString());
2041
- }), f(this, pa, () => {
2042
- h(R, this) && (m(H, this, U).call(this, g.VOLUME, h(R, this).volume.toString()), h(R, this).muted ? m(H, this, U).call(this, g.MUTED, "") : m(H, this, W).call(this, g.MUTED));
2043
- }), f(this, ma, () => {
2044
- m(H, this, U).call(this, g.BUFFERING, "");
2045
- }), f(this, ha, () => {
2046
- m(H, this, W).call(this, g.BUFFERING);
2047
- }), f(this, ga, () => {
2048
- if (h(Gi, this)) {
2049
- if (h(L, this) !== h(R, this)) {
2050
- p(Gi, this, !1);
2051
- return;
2052
- }
2053
- p(Gi, this, !1), m(H, this, oo).call(this);
2054
- }
2055
- }), f(this, _a, 0), e(this, "handleEvent", (e) => {
2056
- switch (e.type) {
2057
- case "pointerdown":
2058
- p(_a, this, e.timeStamp);
2059
- break;
2060
- case "pointermove":
2061
- m(H, this, Ya).call(this, e);
2062
- break;
2063
- case "pointerup":
2064
- m(H, this, Xa).call(this, e);
2065
- break;
2066
- case "mouseleave":
2067
- m(H, this, io).call(this);
2068
- break;
2069
- case "dblclick":
2070
- m(H, this, Qa).call(this, e);
2071
- break;
2072
- case "mousemove":
2073
- m(H, this, $a).call(this, e);
2074
- break;
2075
- case "keydown":
2076
- h(ba, this).call(this, e);
2077
- break;
2078
- case "keyup":
2079
- m(H, this, io).call(this), h(ya, this).call(this, e);
2080
- break;
2081
- }
2082
- }), f(this, va, (e) => {
2083
- if (h(I, this) && (h(V, this).debug("Vindral event", { type: e.type }), e instanceof CustomEvent)) switch (e.type) {
2084
- case x.PLAY:
2085
- this.removeAttribute(g.PAUSED);
2086
- break;
2087
- case x.PAUSE:
2088
- this.setAttribute(g.PAUSED, "");
2089
- break;
2090
- case x.MUTE:
2091
- this.setAttribute(g.MUTED, "");
2092
- break;
2093
- case x.UNMUTE:
2094
- this.removeAttribute(g.MUTED);
2095
- break;
2096
- case x.LOCK_UI:
2097
- this.setAttribute(g.UI_LOCKED, "");
2098
- break;
2099
- case x.UNLOCK_UI:
2100
- this.removeAttribute(g.UI_LOCKED);
2101
- break;
2102
- case x.ENTER_FULLSCREEN:
2103
- this.setAttribute(g.FULLSCREEN, "");
2104
- break;
2105
- case x.EXIT_FULLSCREEN:
2106
- this.removeAttribute(g.FULLSCREEN);
2107
- break;
2108
- case x.SET_RENDITION:
2109
- {
2110
- let t = e.detail;
2111
- t.audio && (h(I, this).maxAudioBitRate = t.audio.bitRate), t.video && (h(I, this).maxVideoBitRate = t.video.bitRate, h(I, this).maxSize = t.video, this.setAttribute(g.MAX_VIDEO_BITRATE, String(t.video.bitRate)));
2112
- }
2113
- break;
2114
- case x.SET_ABR_MODE:
2115
- {
2116
- let t = e.detail;
2117
- t ? (h(I, this).abrEnabled = !0, this.setAttribute(g.ABR_ENABLED, "")) : (h(I, this).abrEnabled = !1, this.removeAttribute(g.ABR_ENABLED)), m(H, this, U).call(this, g.ABR_ENABLED, String(t));
2118
- }
2119
- break;
2120
- case x.SET_SIZE_BASED_RESOLUTION_CAP_MODE:
2121
- {
2122
- let t = e.detail;
2123
- this.setAttribute(g.SIZE_BASED_RESOLUTION_CAP_ENABLED, t ? "true" : "false");
2124
- }
2125
- break;
2126
- case x.CHANNEL_GRID_OPENED:
2127
- h(Wi, this) === null && m(H, this, to).call(this);
2128
- break;
2129
- case x.CHANNEL_GRID_CLOSED:
2130
- h(Wi, this) !== null && (clearTimeout(h(Wi, this)), p(Wi, this, null));
2131
- break;
2132
- case x.ENTER_PIP:
2133
- this.setAttribute(g.IS_PIP, "");
2134
- break;
2135
- case x.EXIT_PIP:
2136
- this.removeAttribute(g.IS_PIP);
2137
- break;
2138
- case x.REQUEST_AIRPLAY:
2139
- var t;
2140
- (t = h(Bi, this)) == null || t.showPlaybackTargetPicker();
2141
- break;
2142
- case x.SET_LANGUAGE:
2143
- _(e.detail) ? this.setAttribute(g.LANGUAGE, e.detail) : this.removeAttribute(g.LANGUAGE);
2144
- break;
2145
- case x.SET_TEXT_TRACK:
2146
- _(e.detail) ? this.setAttribute(g.TEXT_TRACK, e.detail) : this.removeAttribute(g.TEXT_TRACK);
2147
- break;
2148
- case x.REQUEST_USER_INPUT:
2149
- h(I, this).play(), h(I, this).muted = !1;
2150
- break;
2151
- case x.SET_VOLUME:
2152
- {
2153
- let t = e.detail;
2154
- h(I, this).muted && t > 0 ? (h(I, this).muted = !1, h(R, this) && (h(R, this).muted = !1)) : t === 0 && (h(I, this).muted = !0, h(R, this) && (h(R, this).muted = !0)), this.setAttribute(g.VOLUME, t.toString());
2155
- }
2156
- break;
2157
- case x.SEEK:
2158
- this.handleTimeShiftUpdate(String(e.detail));
2159
- break;
2160
- case x.GO_LIVE:
2161
- h(xa, this).call(this);
2162
- break;
2163
- case x.TOGGLE_DEBUG_PANEL:
2164
- this.hasAttribute(g.DEBUG_PANEL_OPEN) ? this.removeAttribute(g.DEBUG_PANEL_OPEN) : this.setAttribute(g.DEBUG_PANEL_OPEN, "");
2165
- break;
2166
- case x.SET_TARGET_BUFFER_TIME:
2167
- {
2168
- let t = Math.max(50, Math.min(Oe, e.detail));
2169
- this.setAttribute("target-buffer-time", String(t));
2170
- }
2171
- break;
2172
- }
2173
- }), f(this, ya, (e) => {
2174
- let { key: t } = e;
2175
- if (!Ti.includes(t)) {
2176
- this.removeEventListener("keyup", this);
2177
- return;
2178
- }
2179
- m(H, this, eo).call(this, e);
2180
- }), f(this, ba, (e) => {
2181
- let { metaKey: t, altKey: n, key: r } = e;
2182
- t || n || !Ti.includes(r) || this.addEventListener("keyup", this, { once: !0 });
2183
- }), f(this, xa, () => {
2184
- this.removeAttribute(g.TIMESHIFT_POSITION), this.handleTimeShiftUpdate(!1);
2185
- }), f(this, Sa, (e) => {
2186
- var t;
2187
- h(R, this) || m(H, this, Na).call(this), h(L, this) !== h(R, this) && (e && m(H, this, so).call(this), p(L, this, h(R, this)), m(H, this, ja).call(this), m(H, this, Ma).call(this), m(H, this, La).call(this), (t = h(I, this)) == null || t.pause(), p(Gi, this, e));
2188
- }), f(this, Ca, (e) => {
2189
- var t, n, r, i;
2190
- e && m(H, this, so).call(this), (t = h(R, this)) == null || t.hide(), p(L, this, h(Mi, this)), m(H, this, La).call(this), this.hasAttribute(g.PAUSED) ? (n = h(L, this)) == null || n.pause() : (r = h(L, this)) == null || r.play(), m(H, this, Fa).call(this), m(H, this, Aa).call(this), (i = h(R, this)) == null || i.pause(), e && (p(Gi, this, !1), setTimeout(() => {
2191
- m(H, this, oo).call(this);
2192
- }, 100));
2193
- }), e(this, "handleTimeShiftUpdate", (e) => {
2194
- let t = this.hasAttribute(g.IS_PIP);
2195
- if (e !== !1) {
2196
- var n;
2197
- h(Sa, this).call(this, t), (n = h(R, this)) == null || n.seek({
2198
- time: parseFloat(e),
2199
- playWhenReady: !this.hasAttribute(g.PAUSED)
2200
- });
2201
- return;
2202
- }
2203
- h(L, this) !== h(Mi, this) && h(Ca, this).call(this, t);
2204
- }), f(this, wa, null), f(this, Ta, () => {
2205
- var e;
2206
- let t = (e = h(I, this)) == null ? void 0 : e.currentRenditionLevel;
2207
- if (!(t != null && t.video)) return;
2208
- let n = o(t.video.width > t.video.height ? "landscape-primary" : "portrait-primary");
2209
- n && n.catch(() => {});
2210
- }), f(this, Ea, () => {
2211
- r();
2212
- }), f(this, Da, null);
2213
- let n = this.attachShadow({ mode: "open" });
2214
- n.appendChild(wi.content.cloneNode(!0));
2215
- let i = ye(this.getAttribute("log-level"));
2216
- p(V, this, fe.get().createContext("VindralController")), h(V, this).setLevel(i), p(ji, this, (t = this.shadowRoot) == null ? void 0 : t.querySelector("#time-shift-video")), p(qi, this, new er(n));
2217
- }
2218
- connectedCallback() {
2219
- var e = this;
2220
- return t(function* () {
2221
- b(e.getAttribute("auto-instance-enabled"), !0) && (yield m(H, e, ka).call(e));
2222
- for (let t of Object.values(x)) e.addEventListener(t, h(va, e));
2223
- window.PointerEvent ? (e.addEventListener("pointerdown", e), e.addEventListener("pointermove", e), e.addEventListener("pointerup", e)) : e.addEventListener("mousemove", e), e.addEventListener("mouseleave", e), e.addEventListener("keydown", e), e.addEventListener("resize", e), e.addEventListener("dblclick", e), h(Zi, e).call(e, () => e.connectListener(e)), m(H, e, qa).call(e), e.tabIndex = 0, e.focus({ preventScroll: !0 });
2224
- })();
2225
- }
2226
- disconnectedCallback() {
2227
- var e, t, n, r, i;
2228
- m(H, this, Ja).call(this), m(H, this, ho).call(this), h(qi, this).unload(), (e = h(I, this)) == null || e.unload(), (t = h(z, this)) == null || t.unload(), (n = h(Ri, this)) == null || n.unload(), (r = h(zi, this)) == null || r.unload(), (i = h(B, this)) == null || i.unload(), m(H, this, Pa).call(this);
2229
- for (let e of Object.values(x)) this.removeEventListener(e, h(va, this));
2230
- m(H, this, ja).call(this), h(Oi, this) && (clearTimeout(h(Oi, this)), p(Oi, this, null)), h(ki, this).stop(), this.disconnectListener(this);
2231
- }
2232
- attributeChangedCallback(e, t, n) {
2233
- if (t !== n) {
2234
- switch (h(V, this).debug("Attribute changed", {
2235
- name: e,
2236
- oldValue: t,
2237
- newValue: n
2238
- }), e) {
2239
- case "channel-id":
2240
- p(Pi, this, n), h(I, this) && n && (h(I, this).channelId = n, h(I, this).play(), m(H, this, U).call(this, g.BUFFERING, ""), m(H, this, U).call(this, g.CHANNEL_ID, n), m(H, this, U).call(this, g.POSTER_SRC, h(I, this).getThumbnailUrl()));
2241
- break;
2242
- case "channel-group-id":
2243
- p(Fi, this, n);
2244
- break;
2245
- case "url":
2246
- n && p(Ni, this, n);
2247
- break;
2248
- case "paused":
2249
- if (_(n)) {
2250
- if (!h(Xi, this)) {
2251
- var r;
2252
- (r = h(L, this)) == null || r.pause();
2253
- }
2254
- m(H, this, U).call(this, g.PAUSED, "");
2255
- } else if (m(H, this, W).call(this, g.NEEDS_USER_INPUT_VIDEO), m(H, this, W).call(this, g.PAUSED), !h(Xi, this)) {
2256
- var i;
2257
- (i = h(L, this)) == null || i.play();
2258
- }
2259
- break;
2260
- case "target-buffer-time":
2261
- if (n) {
2262
- let e = parseInt(n, 10);
2263
- Number.isNaN(e) || (h(I, this) && (h(I, this).targetBufferTime = e), m(H, this, U).call(this, g.TARGET_BUFFER_TIME, String(e)));
2264
- }
2265
- break;
2266
- case "min-buffer-time":
2267
- if (h(I, this) && _(n)) {
2268
- let e = be(n);
2269
- e !== void 0 && h(I, this).updateBufferTimeConfig({ minBufferTime: e });
2270
- }
2271
- break;
2272
- case "max-buffer-time":
2273
- if (h(I, this) && _(n)) {
2274
- let e = be(n);
2275
- e !== void 0 && h(I, this).updateBufferTimeConfig({ maxBufferTime: e });
2276
- }
2277
- break;
2278
- case g.DEBUG_PANEL_OPEN:
2279
- _(n) ? m(H, this, U).call(this, g.DEBUG_PANEL_OPEN, "") : m(H, this, W).call(this, g.DEBUG_PANEL_OPEN), m(H, this, po).call(this);
2280
- break;
2281
- case "user-interacting":
2282
- _(n) ? m(H, this, U).call(this, g.USER_INTERACTING, "") : m(H, this, W).call(this, g.USER_INTERACTING);
2283
- break;
2284
- case "muted":
2285
- if (h(I, this)) if (_(n)) {
2286
- var a;
2287
- if (h(Xi, this) || (h(I, this).muted = !0, h(R, this) && (h(R, this).muted = !0)), m(H, this, U).call(this, g.MUTED, ""), (a = h(B, this)) != null && a.isMediaElementSource) {
2288
- var o;
2289
- (o = h(B, this)) == null || o.stop(), m(H, this, U).call(this, g.VOLUME_LEVEL, JSON.stringify({
2290
- left: null,
2291
- right: null
2292
- }));
2293
- }
2294
- } else {
2295
- var s;
2296
- h(Xi, this) || (h(I, this).muted = !1, h(R, this) && (h(R, this).muted = !1), h(I, this).volume === 0 && (h(I, this).volume = .3)), m(H, this, W).call(this, g.MUTED), m(H, this, W).call(this, g.NEEDS_USER_INPUT_AUDIO), (s = h(B, this)) == null || s.start();
2297
- }
2298
- break;
2299
- case "ui-locked":
2300
- _(n) ? m(H, this, ro).call(this) : m(H, this, io).call(this);
2301
- break;
2302
- case "is-fullscreen":
2303
- _(n) ? m(H, this, co).call(this) : m(H, this, lo).call(this);
2304
- break;
2305
- case "abr-enabled":
2306
- {
2307
- let e = b(n == null ? null : n, !1);
2308
- h(I, this) && (h(I, this).abrEnabled = e, e && (h(I, this).sizeBasedResolutionCapEnabled = b(this.getAttribute(g.SIZE_BASED_RESOLUTION_CAP_ENABLED), !0))), e ? m(H, this, U).call(this, g.ABR_ENABLED, "") : m(H, this, W).call(this, g.ABR_ENABLED);
2309
- }
2310
- break;
2311
- case "size-based-resolution-cap-enabled":
2312
- {
2313
- let e = b(n == null ? null : n, !0);
2314
- h(I, this) && (h(I, this).sizeBasedResolutionCapEnabled = e), m(H, this, U).call(this, g.SIZE_BASED_RESOLUTION_CAP_ENABLED, e ? "true" : "false");
2315
- }
2316
- break;
2317
- case "max-video-bit-rate":
2318
- p(Ii, this, n), _(n) ? m(H, this, U).call(this, g.MAX_VIDEO_BITRATE, n) : m(H, this, W).call(this, g.MAX_VIDEO_BITRATE), h(R, this) && (h(R, this).maxVideoBitRate = n ? be(n) : void 0);
2319
- break;
2320
- case "max-initial-bit-rate":
2321
- p(Li, this, n), _(n) ? m(H, this, U).call(this, g.MAX_INITIAL_BITRATE, n) : m(H, this, W).call(this, g.MAX_INITIAL_BITRATE);
2322
- break;
2323
- case "is-pip":
2324
- _(n) ? m(H, this, oo).call(this) : m(H, this, so).call(this);
2325
- break;
2326
- case "is-airplaying":
2327
- if (_(n)) {
2328
- var c, l;
2329
- (c = h(I, this)) != null && c.mediaElement && (h(I, this).mediaElement.style.display = "hidden"), (l = h(I, this)) == null || l.pause();
2330
- } else {
2331
- var u;
2332
- (u = h(I, this)) != null && u.mediaElement && (h(I, this).mediaElement.style.display = "block");
2333
- }
2334
- break;
2335
- case "is-casting":
2336
- if (_(n)) {
2337
- var ee, d;
2338
- (ee = h(Ri, this)) != null && ee.isFullscreen() && m(H, this, lo).call(this), (d = h(I, this)) == null || d.pause();
2339
- } else if (!document.hidden) {
2340
- var te;
2341
- (te = h(I, this)) == null || te.play();
2342
- }
2343
- break;
2344
- case "cast-receiver-id":
2345
- p(Hi, this, n);
2346
- break;
2347
- case "cast-background":
2348
- p(Ui, this, n);
2349
- break;
2350
- case "language":
2351
- h(I, this) && (h(I, this).language = n, _(n) ? m(H, this, U).call(this, g.LANGUAGE, n) : m(H, this, W).call(this, g.LANGUAGE));
2352
- break;
2353
- case "text-track":
2354
- h(I, this) && (h(I, this).textTrack = n, _(n) ? m(H, this, U).call(this, g.TEXT_TRACK, n) : m(H, this, W).call(this, g.TEXT_TRACK));
2355
- break;
2356
- case "log-level":
2357
- _(n) && h(V, this).setLevel(ye(n));
2358
- break;
2359
- case "authentication-token":
2360
- if (_(n)) {
2361
- var ne, re;
2362
- (ne = h(I, this)) == null || ne.updateAuthenticationToken(n), (re = h(Bi, this)) == null || re.updateAuthenticationToken(n), m(H, this, U).call(this, g.AUTHENTICATION_TOKEN, n);
2363
- } else m(H, this, W).call(this, g.AUTHENTICATION_TOKEN);
2364
- break;
2365
- case "volume":
2366
- if (_(n)) {
2367
- let e = parseFloat(n);
2368
- h(R, this) && (h(R, this).volume = e), h(I, this) && (h(I, this).volume = e);
2369
- }
2370
- break;
2371
- case "timeshift-position":
2372
- _(n) ? m(H, this, U).call(this, g.TIMESHIFT_POSITION, n) : m(H, this, W).call(this, g.TIMESHIFT_POSITION);
2373
- break;
2374
- case "timeline-markers":
2375
- _(n) ? m(H, this, U).call(this, g.TIMELINE_MARKERS, n) : m(H, this, W).call(this, g.TIMELINE_MARKERS);
2376
- break;
2377
- case "drm-headers":
2378
- if (_(n)) {
2379
- let e = Ee(n);
2380
- if (e) {
2381
- var ie;
2382
- (ie = h(I, this)) == null || ie.drm.setHeaders(e);
2383
- } else h(V, this).warn("Invalid DRM headers format:", n);
2384
- }
2385
- break;
2386
- case "drm-queryparams":
2387
- if (_(n)) {
2388
- let e = Ee(n);
2389
- if (e) {
2390
- var ae;
2391
- (ae = h(I, this)) == null || ae.drm.setQueryParams(e);
2392
- } else h(V, this).warn("Invalid DRM query parameters format:", n);
2393
- }
2394
- break;
2395
- }
2396
- [
2397
- g.USER_INTERACTING,
2398
- g.PAUSED,
2399
- g.HIDE_UI_ON_PAUSE
2400
- ].includes(e) && m(H, this, ao).call(this);
2401
- }
2402
- }
2403
- connectListener(e) {
2404
- Mr(e).forEach((t) => {
2405
- let n = h(Ei, this).get(t);
2406
- switch (n ? n.push(e) : h(Ei, this).set(t, [e]), t) {
2407
- case g.PAUSED:
2408
- var r;
2409
- (((r = h(I, this)) == null ? void 0 : r.playbackState) === "paused" || this.hasAttribute(g.PAUSED)) && e.setAttribute(g.PAUSED, "");
2410
- break;
2411
- case g.MUTED:
2412
- var i;
2413
- ((i = h(I, this)) != null && i.muted || this.hasAttribute(g.MUTED)) && e.setAttribute(g.MUTED, "");
2414
- break;
2415
- case g.MAX_VIDEO_BITRATE:
2416
- h(Ii, this) && e.setAttribute(g.MAX_VIDEO_BITRATE, h(Ii, this));
2417
- break;
2418
- case g.SIZE_BASED_RESOLUTION_CAP_ENABLED:
2419
- {
2420
- var a, o;
2421
- let t = (a = (o = h(I, this)) == null ? void 0 : o.sizeBasedResolutionCapEnabled) == null ? b(this.getAttribute(g.SIZE_BASED_RESOLUTION_CAP_ENABLED), !0) : a;
2422
- e.setAttribute(g.SIZE_BASED_RESOLUTION_CAP_ENABLED, t ? "true" : "false");
2423
- }
2424
- break;
2425
- case g.CHANNEL_ID:
2426
- h(Pi, this) && e.setAttribute(g.CHANNEL_ID, h(Pi, this));
2427
- break;
2428
- case g.CHANNEL_GROUP_ID:
2429
- h(Fi, this) && e.setAttribute(g.CHANNEL_GROUP_ID, h(Fi, this));
2430
- break;
2431
- case g.AUTHENTICATION_TOKEN: {
2432
- let t = this.getAttribute("authentication-token");
2433
- t && e.setAttribute(g.AUTHENTICATION_TOKEN, t);
2434
- break;
2435
- }
2436
- case g.TIMELINE_MARKERS: {
2437
- let t = this.getAttribute(g.TIMELINE_MARKERS);
2438
- _(t) && e.setAttribute(g.TIMELINE_MARKERS, t);
2439
- break;
2440
- }
2441
- case g.DEBUG_PANEL_OPEN:
2442
- this.hasAttribute(g.DEBUG_PANEL_OPEN) && e.setAttribute(g.DEBUG_PANEL_OPEN, "");
2443
- break;
2444
- case g.TARGET_BUFFER_TIME: {
2445
- let t = this.getAttribute("target-buffer-time");
2446
- t && e.setAttribute(g.TARGET_BUFFER_TIME, t);
2447
- break;
2448
- }
2449
- case g.PLAYBACK_LATENCY: {
2450
- var s;
2451
- let t = (s = h(I, this)) == null ? void 0 : s.playbackLatency;
2452
- typeof t == "number" && e.setAttribute(g.PLAYBACK_LATENCY, String(t));
2453
- break;
2454
- }
2455
- case g.CONNECTION_STATE:
2456
- h(I, this) && e.setAttribute(g.CONNECTION_STATE, h(I, this).connectionState);
2457
- break;
2458
- case g.ABR_ENABLED:
2459
- h(I, this) ? e.setAttribute(g.ABR_ENABLED, String(h(I, this).abrEnabled)) : _(this.getAttribute(g.ABR_ENABLED)) ? e.setAttribute(g.ABR_ENABLED, this.getAttribute(g.ABR_ENABLED) || "") : e.removeAttribute(g.ABR_ENABLED);
2460
- break;
2461
- }
2462
- });
2463
- }
2464
- disconnectListener(e) {
2465
- Mr(e).forEach((t) => {
2466
- let n = h(Ei, this).get(t);
2467
- n && h(Ei, this).set(t, n.filter((t) => t !== e));
2468
- });
2469
- }
2470
- get instance() {
2471
- return h(I, this);
2472
- }
2473
- get fullscreen() {
2474
- return m(H, this, Ba).call(this);
2475
- }
2476
- get airPlay() {
2477
- return h(Bi, this);
2478
- }
2479
- get timelineMarkers() {
2480
- return Br(this.getAttribute(g.TIMELINE_MARKERS));
2481
- }
2482
- set timelineMarkers(e) {
2483
- let t = zr(e);
2484
- t.length === 0 ? this.removeAttribute(g.TIMELINE_MARKERS) : this.setAttribute(g.TIMELINE_MARKERS, JSON.stringify(t));
2485
- }
2486
- connect() {
2487
- m(H, this, ka).call(this);
2488
- }
2489
- };
2490
- function ka() {
2491
- var e = this;
2492
- return t(function* () {
2493
- var t, n;
2494
- if (!h(Pi, e)) return;
2495
- let r = h(L, e) === h(Mi, e);
2496
- h(ki, e).stop(), yield (t = h(I, e)) == null ? void 0 : t.unload(), r && p(L, e, void 0);
2497
- let i = e.hasAttribute(g.PAUSED), a = e.hasAttribute(g.MUTED), o = be(e.getAttribute(g.VOLUME)), s = typeof o == "number" ? Math.max(0, Math.min(1, o)) : o, c = xe(e.getAttribute(g.MEDIA)), l = e.getAttribute(g.TEXT_TRACK) || void 0, u = e.getAttribute("edge-url") || void 0, ee = e.getAttribute("authentication-token") || void 0, d = be(e.getAttribute("max-video-bit-rate")), te = be(e.getAttribute("max-initial-bit-rate")), ne = Ce(e.getAttribute("max-size")), ie = be(e.getAttribute("min-buffer-time")), ae = be(e.getAttribute("max-buffer-time")), oe = b(e.getAttribute("burst-enabled")), se = b(e.getAttribute("mse-enabled")), ce = b(e.getAttribute("mse-opus-enabled")), f = b(e.getAttribute("background-play-enabled")), le = b(e.getAttribute("ios-background-play-enabled")), ue = b(e.getAttribute("media-session-enabled")), de = b(e.getAttribute("ios-wake-lock-enabled")), fe = b(e.getAttribute("stream-to-media-element-enabled")), pe = b(e.getAttribute("ios-media-element-enabled")), me = b(e.getAttribute("abr-enabled"), !0), he = b(e.getAttribute("size-based-resolution-cap-enabled")), _e = b(e.getAttribute("telemetry-enabled")), v = ke(e.getAttribute("video-codecs")), we = ve(e.getAttribute("poster")), Te = Se(e.getAttribute("advanced")), y = ye(e.getAttribute("log-level")), De = {
2498
- headers: Ee(e.getAttribute("drm-headers")),
2499
- queryParams: Ee(e.getAttribute("drm-queryparams")),
2500
- widevine: {
2501
- videoRobustness: ge(e.getAttribute("drm-widevine-video-robustness")),
2502
- audioRobustness: ge(e.getAttribute("drm-widevine-audio-robustness"))
2503
- },
2504
- playready: {
2505
- videoRobustness: ge(e.getAttribute("drm-playready-video-robustness")),
2506
- audioRobustness: ge(e.getAttribute("drm-playready-audio-robustness"))
2507
- }
2508
- }, Oe = Fe(e.getAttribute("webcodecs-hardware-acceleration")), Ae = Pe(e.getAttribute("decoders")), x = b(e.getAttribute("offscreen-canvas-enabled")), S = b(e.getAttribute("webtransport-enabled")), je = b(e.getAttribute("unstable-webtransport-enabled")), Me = be(e.getAttribute("reconnect-retries")), Ne = Me === void 0 ? void 0 : (e) => e.reconnectRetries < Me, Ie = e.getAttribute("language") || void 0;
2509
- p(I, e, new re({
2510
- url: h(Ni, e),
2511
- channelId: h(Pi, e),
2512
- channelGroupId: h(Fi, e),
2513
- edgeUrl: u,
2514
- authenticationToken: ee,
2515
- muted: a,
2516
- volume: s,
2517
- media: c,
2518
- maxSize: ne,
2519
- maxVideoBitRate: d,
2520
- maxInitialBitRate: te,
2521
- minBufferTime: ie,
2522
- maxBufferTime: ae,
2523
- burstEnabled: oe,
2524
- mseEnabled: se,
2525
- mseOpusEnabled: ce,
2526
- backgroundPlayEnabled: f,
2527
- iosBackgroundPlayEnabled: le,
2528
- mediaSessionEnabled: ue,
2529
- iosWakeLockEnabled: de,
2530
- streamToMediaElementEnabled: fe,
2531
- iosMediaElementEnabled: pe,
2532
- abrEnabled: me,
2533
- sizeBasedResolutionCapEnabled: he,
2534
- telemetryEnabled: _e,
2535
- videoCodecs: v,
2536
- poster: we,
2537
- textTrack: l,
2538
- advanced: Te,
2539
- logLevel: y,
2540
- language: Ie,
2541
- drm: De,
2542
- webtransportEnabled: S,
2543
- unstableWebtransportEnabled: je,
2544
- webcodecsHardwareAcceleration: Oe,
2545
- decoders: Ae,
2546
- offscreenCanvasEnabled: x,
2547
- reconnectHandler: Ne
2548
- })), p(Mi, e, new yi(h(I, e))), h(L, e) || p(L, e, h(Mi, e)), m(H, e, Aa).call(e), p(Ai, e, (n = e.shadowRoot) == null ? void 0 : n.querySelector("#video")), h(Ai, e) && (h(I, e).attach(h(Ai, e)), h(qi, e).observe(h(Ai, e))), e.setAttribute(g.MEDIA, h(I, e).media);
2549
- let Le = h(I, e);
2550
- h(Zi, e).call(e, () => {
2551
- Le.muted && m(H, e, U).call(e, g.MUTED, ""), Le.abrEnabled ? m(H, e, U).call(e, g.ABR_ENABLED, "") : m(H, e, W).call(e, g.ABR_ENABLED), m(H, e, U).call(e, g.SIZE_BASED_RESOLUTION_CAP_ENABLED, Le.sizeBasedResolutionCapEnabled ? "true" : "false"), m(H, e, U).call(e, g.VOLUME, Le.volume.toString());
2552
- }), _(we) || m(H, e, U).call(e, g.POSTER_SRC, h(I, e).getThumbnailUrl());
2553
- let C = b(e.getAttribute(g.AIRPLAY_ENABLED), !1), Re = b(e.getAttribute(g.CAST_ENABLED), !0), ze = b(e.getAttribute(g.FULLSCREEN_ENABLED), !0), Be = b(e.getAttribute(g.PIP_ENABLED), !0), Ve = b(e.getAttribute(g.VU_METER_ENABLED), !1), He = b(e.getAttribute(g.TIMESHIFT_ENABLED), !1);
2554
- C && m(H, e, Ga).call(e, h(I, e)), Re && m(H, e, Va).call(e, h(I, e)), ze && m(H, e, Ra).call(e, h(I, e)), Be && m(H, e, Ia).call(e, h(I, e)), i || h(I, e).play(), Ve && m(H, e, Ka).call(e, h(I, e)), e.dispatchEvent(new CustomEvent("vindral-instance-ready", {
2555
- bubbles: !0,
2556
- composed: !0,
2557
- detail: h(I, e)
2558
- })), He && (m(H, e, Na).call(e), ze && m(H, e, za).call(e));
2559
- })();
2560
- }
2561
- function Aa() {
2562
- h(I, this) && (h(I, this).on("rendition levels", h(Ji, this)), h(I, this).on("rendition level", h(Yi, this)), h(I, this).on("playback state", h(Qi, this)), h(I, this).on("volume state", h($i, this)), h(I, this).on("channel switch failed", h(ea, this)), h(I, this).on("channel switch", h(ta, this)), h(I, this).on("channels", h(na, this)), h(I, this).on("languages", h(ra, this)), h(I, this).on("text tracks", h(ia, this)), h(I, this).on("needs user input", h(aa, this)), h(I, this).on("is live", h(oa, this)), h(I, this).on("timeshift info", h(sa, this)));
2563
- }
2564
- function ja() {
2565
- h(I, this) && (h(I, this).off("playback state", h(Qi, this)), h(I, this).off("volume state", h($i, this)), h(I, this).off("channel switch failed", h(ea, this)), h(I, this).off("channel switch", h(ta, this)), h(I, this).off("channels", h(na, this)), h(I, this).off("languages", h(ra, this)), h(I, this).off("text tracks", h(ia, this)), h(I, this).off("needs user input", h(aa, this)), h(I, this).off("is live", h(oa, this)), h(I, this).off("timeshift info", h(sa, this)));
2566
- }
2567
- function Ma() {
2568
- h(R, this) && (h(R, this).addEventListener("playing", h(ca, this)), h(R, this).addEventListener("pause", h(la, this)), h(R, this).addEventListener("ended", h(ua, this)), h(R, this).addEventListener("timeupdate", h(fa, this)), h(R, this).addEventListener("volumechange", h(pa, this)), h(R, this).addEventListener("hlsbuffering", h(ma, this)), h(R, this).addEventListener("hlsnotbuffering", h(ha, this)), h(R, this).addEventListener("timeshiftready", h(ga, this)));
2569
- }
2570
- function Na() {
2571
- var e, t, n, r;
2572
- let i = be(this.getAttribute(g.VOLUME)), a = i === void 0 ? (e = (t = h(L, this)) == null ? void 0 : t.volume) == null ? 1 : e : Math.max(0, Math.min(1, i)), o = b(this.getAttribute(g.MUTED), (n = (r = h(L, this)) == null ? void 0 : r.muted) == null ? !1 : n);
2573
- m(H, this, Pa).call(this), p(R, this, new ni(h(ji, this), {
2574
- volume: a,
2575
- muted: o,
2576
- maxVideoBitRate: h(Ii, this) ? parseInt(h(Ii, this), 10) : void 0
2577
- })), h(R, this).addEventListener("durationchange", h(da, this));
2578
- }
2579
- function Pa() {
2580
- h(R, this) && (m(H, this, Fa).call(this), h(R, this).removeEventListener("durationchange", h(da, this)), h(R, this).cleanup(), h(L, this) === h(R, this) && p(L, this, void 0), p(R, this, void 0));
2581
- }
2582
- function Fa() {
2583
- h(R, this) && (h(R, this).removeEventListener("playing", h(ca, this)), h(R, this).removeEventListener("pause", h(la, this)), h(R, this).removeEventListener("ended", h(ua, this)), h(R, this).removeEventListener("timeupdate", h(fa, this)), h(R, this).removeEventListener("volumechange", h(pa, this)), h(R, this).removeEventListener("hlsbuffering", h(ma, this)), h(R, this).removeEventListener("hlsnotbuffering", h(ha, this)), h(R, this).removeEventListener("timeshiftready", h(ga, this)));
2584
- }
2585
- function Ia(e) {
2586
- e.mediaElement instanceof HTMLVideoElement && (p(z, this, new dr(e.mediaElement)), h(z, this).isSupported() && (h(V, this).debug("PIP is supported"), m(H, this, U).call(this, g.PIP_AVAILABLE, "")), h(z, this).on("on picture in picture change", (e) => {
2587
- e ? m(H, this, U).call(this, g.IS_PIP, "") : m(H, this, W).call(this, g.IS_PIP);
2588
- }));
2589
- }
2590
- function La() {
2591
- var e;
2592
- if (!h(z, this)) return;
2593
- let t = null;
2594
- h(L, this) === h(R, this) && h(R, this) ? t = h(R, this).videoElement : ((e = h(I, this)) == null ? void 0 : e.mediaElement) instanceof HTMLVideoElement && (t = h(I, this).mediaElement), t && t !== h(z, this).videoElement && (h(V, this).debug("Updating PIP target to", h(L, this) === h(R, this) ? "HLS" : "Vindral"), h(z, this).unload(), p(z, this, new dr(t)), h(z, this).on("on picture in picture change", (e) => {
2595
- e ? m(H, this, U).call(this, g.IS_PIP, "") : m(H, this, W).call(this, g.IS_PIP);
2596
- }));
2597
- }
2598
- function Ra(e) {
2599
- let t = !tr.isFullscreenApiSupported(this) && tr.isFullscreenApiSupported(e.mediaElement) ? e.mediaElement : this;
2600
- p(Ri, this, new tr(t)), h(Ri, this).on("on fullscreen change", (e) => {
2601
- e ? m(H, this, U).call(this, g.FULLSCREEN, "") : m(H, this, W).call(this, g.FULLSCREEN);
2602
- });
2603
- }
2604
- function za() {
2605
- var e;
2606
- h(R, this) && (p(zi, this, !tr.isFullscreenApiSupported(this) && tr.isFullscreenApiSupported((e = h(R, this)) == null ? void 0 : e.videoElement) ? new tr(h(R, this).videoElement) : new tr(this)), h(zi, this).on("on fullscreen change", (e) => {
2607
- e ? m(H, this, U).call(this, g.FULLSCREEN, "") : m(H, this, W).call(this, g.FULLSCREEN);
2608
- }));
2609
- }
2610
- function Ba() {
2611
- return this.hasAttribute(g.TIMESHIFT_POSITION) ? h(zi, this) : h(Ri, this);
2612
- }
2613
- function Va(e) {
2614
- p(Vi, this, new je({
2615
- background: h(Ui, this),
2616
- receiverApplicationId: h(Hi, this),
2617
- options: e.getCastOptions()
2618
- })), h(Vi, this).on("devices available", m(H, this, Ha).bind(this)), h(Vi, this).on("connected", m(H, this, Ua).bind(this)), h(Vi, this).on("resumed", m(H, this, Ua).bind(this)), h(Vi, this).on("disconnected", m(H, this, Wa).bind(this)), h(Vi, this).init().catch((e) => {
2619
- h(V, this).warn("Failed to initialize CastSender", e);
2620
- });
2621
- }
2622
- function Ha(e) {
2623
- e ? m(H, this, U).call(this, g.CAST_AVAILABLE, "") : m(H, this, W).call(this, g.CAST_AVAILABLE);
2624
- }
2625
- function Ua() {
2626
- var e, t;
2627
- m(H, this, U).call(this, g.IS_CASTING, "");
2628
- let n = (e = (t = h(Vi, this)) == null ? void 0 : t.getReceiverName()) == null ? "device" : e;
2629
- m(H, this, U).call(this, g.CAST_RECEIVER_NAME, n);
2630
- }
2631
- function Wa() {
2632
- m(H, this, W).call(this, g.IS_CASTING), m(H, this, W).call(this, g.CAST_RECEIVER_NAME);
2633
- }
2634
- function Ga(e) {
2635
- var t;
2636
- (t = h(Bi, this)) == null || t.unload();
2637
- let n = e.getCastOptions();
2638
- p(Bi, this, new Hn({
2639
- url: n.url,
2640
- channelId: n.channelId,
2641
- authenticationToken: n.authenticationToken,
2642
- container: this
2643
- })), h(Bi, this).once("available", () => {
2644
- m(H, this, U).call(this, g.AIRPLAY_AVAILABLE, "");
2645
- }), h(Bi, this).on("connected", () => {
2646
- m(H, this, U).call(this, g.IS_AIRPLAYING, "");
2647
- }), h(Bi, this).on("disconnected", () => {
2648
- m(H, this, W).call(this, g.IS_AIRPLAYING);
2649
- });
2650
- }
2651
- function Ka(e) {
2652
- var t;
2653
- if ((t = h(B, this)) == null || t.unload(), !a()) {
2654
- if (e.audioNode) p(B, this, new Hr(e.audioNode));
2655
- else if (e.mediaElement instanceof HTMLMediaElement) p(B, this, new Hr(e.mediaElement));
2656
- else return;
2657
- h(B, this).on("on decibel change", (e) => {
2658
- m(H, this, U).call(this, g.VOLUME_LEVEL, JSON.stringify(e));
2659
- }), m(H, this, U).call(this, g.VOLUME_LEVEL, JSON.stringify({
2660
- left: null,
2661
- right: null
2662
- })), (!h(B, this).isMediaElementSource || !this.hasAttribute(g.MUTED)) && h(B, this).start();
2663
- }
2664
- }
2665
- function qa() {
2666
- let e = () => (customElements.get("vindral-debug-panel") || import("./XEQIIc9P.js").then((e) => e.n).then(({ registerDebugComponents: e }) => e()), this.setAttribute(g.DEBUG_PANEL_OPEN, ""), h(I, this));
2667
- window._vindralDebug = e, p(Ki, this, e);
2668
- }
2669
- function Ja() {
2670
- let e = window;
2671
- h(Ki, this) && e._vindralDebug === h(Ki, this) && delete e._vindralDebug, p(Ki, this, null);
2672
- }
2673
- function Ya(e) {
2674
- e.pointerType !== "mouse" && e.timeStamp - h(_a, this) < 250 || (m(H, this, ro).call(this), h(Oi, this) && clearTimeout(h(Oi, this)), e.target instanceof HTMLElement && ([this, h(Ai, this)].includes(e.target) || e.target.localName === "vindral-scroll-overlay") && m(H, this, io).call(this));
2675
- }
2676
- function Xa(e) {
2677
- let t = this.hasAttribute(g.USER_INTERACTING);
2678
- e.pointerType === "touch" && e.target instanceof HTMLElement ? [this, h(Ai, this)].includes(e.target) && t ? m(H, this, no).call(this) : m(H, this, io).call(this) : e.composedPath().some((e) => e instanceof HTMLElement && ["vindral-play-button"].includes(e == null ? void 0 : e.localName)) && m(H, this, io).call(this);
2679
- }
2680
- function Za(e) {
2681
- switch (e) {
2682
- case "dblclick-fullscreen": return b(this.getAttribute(g.DOUBLE_CLICK_FULLSCREEN_ENABLED), !0);
2683
- default: return !0;
2684
- }
2685
- }
2686
- function Qa(e) {
2687
- m(H, this, Za).call(this, "dblclick-fullscreen") && (!h(Ri, this) || e.target instanceof v || e.target instanceof He || e.target instanceof Ci || (this.hasAttribute(g.FULLSCREEN) ? this.removeAttribute(g.FULLSCREEN) : this.setAttribute(g.FULLSCREEN, "")));
2688
- }
2689
- function $a(e) {
2690
- this.hasAttribute(g.USER_INTERACTING) || m(H, this, io).call(this);
2691
- }
2692
- function eo(e) {
2693
- var t;
2694
- let { metaKey: n, altKey: r, key: i } = e;
2695
- if (n || r || !Ti.includes(i)) return;
2696
- let a = (t = e.target) == null ? void 0 : t.keysUsed;
2697
- if (!(Array.isArray(a) && a.includes(i)) && !e.composedPath().some((e) => {
2698
- let t = e == null ? void 0 : e.keysUsed;
2699
- return Array.isArray(t) && t.includes(i);
2700
- })) switch (i) {
2701
- case "f":
2702
- this.hasAttribute(g.FULLSCREEN) ? this.removeAttribute(g.FULLSCREEN) : this.setAttribute(g.FULLSCREEN, "");
2703
- break;
2704
- case "m":
2705
- this.hasAttribute(g.MUTED) ? this.removeAttribute(g.MUTED) : this.setAttribute(g.MUTED, "");
2706
- break;
2707
- case "ArrowDown":
2708
- var o;
2709
- (o = this.querySelector("vindral-scroll-overlay")) == null || o.setAttribute("open", "");
2710
- break;
2711
- }
2712
- }
2713
- function to() {
2714
- var e = this;
2715
- return t(function* () {
2716
- if (!h(I, e) || !h(Fi, e)) return;
2717
- let t = Date.now();
2718
- if (h(wa, e) && t - h(wa, e) < 1e4) h(V, e).debug("Skipping channel update, last update was less than 10 seconds ago.");
2719
- else {
2720
- p(wa, e, t);
2721
- let n = yield h(I, e).getApiClient().getChannels(h(Fi, e));
2722
- m(H, e, U).call(e, g.CHANNELS, JSON.stringify(n));
2723
- }
2724
- p(Wi, e, window.setTimeout(() => void m(H, e, to).call(e), 1e4));
2725
- })();
2726
- }
2727
- function no() {
2728
- !this.hasAttribute(g.USER_INTERACTING) || this.hasAttribute(g.UI_LOCKED) || (this.dispatchEvent(new CustomEvent("user-interacting", {
2729
- bubbles: !0,
2730
- composed: !0,
2731
- detail: { active: !1 }
2732
- })), this.removeAttribute(g.USER_INTERACTING));
2733
- }
2734
- function ro() {
2735
- this.hasAttribute(g.USER_INTERACTING) || requestAnimationFrame(() => {
2736
- this.setAttribute(g.USER_INTERACTING, ""), this.dispatchEvent(new CustomEvent("user-interacting", {
2737
- bubbles: !0,
2738
- composed: !0,
2739
- detail: { active: !0 }
2740
- }));
2741
- });
2742
- }
2743
- function io() {
2744
- m(H, this, ro).call(this), h(Oi, this) && clearTimeout(h(Oi, this)), h(Di, this) && p(Oi, this, self.setTimeout(() => {
2745
- m(H, this, no).call(this);
2746
- }, h(Di, this)));
2747
- }
2748
- function ao() {
2749
- var e;
2750
- let t = getComputedStyle(this).getPropertyValue("--vindral-subtitle-offset") || "0px";
2751
- (e = h(I, this)) == null || (e = e.mediaElement) == null || e.style.setProperty("--vindral-subtitle-offset", t);
2752
- }
2753
- function oo() {
2754
- var e;
2755
- m(H, this, La).call(this), m(H, this, uo).call(this), (e = h(z, this)) == null || e.request().catch((e) => {
2756
- h(V, this).warn("Failed to enter picture in picture:", e);
2757
- });
2758
- }
2759
- function so() {
2760
- var e;
2761
- (e = h(z, this)) == null || e.exit().catch((e) => {
2762
- h(V, this).warn("Failed to exit picture in picture:", e);
2763
- });
2764
- }
2765
- function co() {
2766
- let e = m(H, this, Ba).call(this);
2767
- if (!e) {
2768
- console.warn("No fullscreen target available"), this.setAttribute(g.FULLSCREEN_FALLBACK, ""), m(H, this, U).call(this, g.FULLSCREEN, "");
2769
- return;
2770
- }
2771
- e != null && e.isFullscreenApiSupported() ? (m(H, this, uo).call(this), e == null || e.request().then(() => {
2772
- h(Ta, this).call(this);
2773
- }).catch((e) => {
2774
- h(V, this).warn("Failed to enter fullscreen:", e);
2775
- })) : (this.setAttribute(g.FULLSCREEN_FALLBACK, ""), m(H, this, U).call(this, g.FULLSCREEN, ""));
2776
- }
2777
- function lo() {
2778
- let e = m(H, this, Ba).call(this);
2779
- e != null && e.isFullscreenApiSupported() ? e == null || e.exit().then(() => {
2780
- h(Ea, this).call(this);
2781
- }).catch((e) => {
2782
- h(V, this).warn("Failed to exit fullscreen:", e);
2783
- }) : (this.removeAttribute(g.FULLSCREEN_FALLBACK), m(H, this, W).call(this, g.FULLSCREEN));
2784
- }
2785
- function uo() {
2786
- h(I, this) && h(I, this).emitter.emit("ios-hack: reset size");
2787
- }
2788
- function fo() {
2789
- return this.hasAttribute(g.DEBUG_PANEL_OPEN);
2790
- }
2791
- function po() {
2792
- m(H, this, fo).call(this) ? m(H, this, mo).call(this) : m(H, this, ho).call(this);
2793
- }
2794
- function mo() {
2795
- h(Da, this) === null && (m(H, this, go).call(this), p(Da, this, window.setInterval(() => m(H, this, go).call(this), 1e3)));
2796
- }
2797
- function ho() {
2798
- h(Da, this) && (clearInterval(h(Da, this)), p(Da, this, null)), this.removeAttribute(g.DRIFT), m(H, this, W).call(this, g.DRIFT), m(H, this, W).call(this, g.PLAYBACK_LATENCY), m(H, this, W).call(this, g.CONNECTION_STATE);
2799
- }
2800
- function go() {
2801
- if (!h(I, this)) return;
2802
- try {
2803
- let e = h(I, this).getStatistics().drift;
2804
- if (typeof e == "number") {
2805
- let t = Math.round(e * 10) / 10;
2806
- m(H, this, U).call(this, g.DRIFT, String(t));
2807
- }
2808
- } catch (e) {}
2809
- let e = h(I, this).targetBufferTime;
2810
- typeof e == "number" && m(H, this, U).call(this, g.TARGET_BUFFER_TIME, String(e));
2811
- let t = h(I, this).playbackLatency;
2812
- typeof t == "number" ? m(H, this, U).call(this, g.PLAYBACK_LATENCY, String(t)) : m(H, this, W).call(this, g.PLAYBACK_LATENCY), m(H, this, U).call(this, g.CONNECTION_STATE, h(I, this).connectionState);
2813
- }
2814
- function U(e, t) {
2815
- var n;
2816
- (n = h(Ei, this).get(e)) == null || n.forEach((n) => n.setAttribute(e, t));
2817
- }
2818
- function W(e) {
2819
- var t;
2820
- (t = h(Ei, this).get(e)) == null || t.forEach((t) => t.removeAttribute(e));
2821
- }
2822
- e(Oa, "observedAttributes", [
2823
- ...Ae,
2824
- "url",
2825
- "edge-url",
2826
- "target-buffer-time",
2827
- "cast-receiver-id",
2828
- "cast-background",
2829
- "log-level",
2830
- "max-size",
2831
- "min-buffer-time",
2832
- "max-buffer-time",
2833
- "max-audio-bit-rate",
2834
- "max-initial-bit-rate",
2835
- "burst-enabled",
2836
- "mse-enabled",
2837
- "mse-opus-enabled",
2838
- "background-play-enabled",
2839
- "ios-background-play-enabled",
2840
- "media-session-enabled",
2841
- "ios-wake-lock-enabled",
2842
- "stream-to-media-element-enabled",
2843
- "ios-media-element-enabled",
2844
- "abr-enabled",
2845
- "size-based-resolution-cap-enabled",
2846
- "telemetry-enabled",
2847
- "video-codecs",
2848
- "poster",
2849
- "advanced",
2850
- "drm-headers",
2851
- "drm-queryparams",
2852
- "drm-widevine-video-robustness",
2853
- "drm-widevine-audio-robustness",
2854
- "drm-playready-video-robustness",
2855
- "drm-playready-audio-robustness",
2856
- "webtransport-enabled",
2857
- "unstable-webtransport-enabled",
2858
- "webcodecs-hardware-acceleration",
2859
- "decoders",
2860
- "offscreen-canvas-enabled",
2861
- "reconnect-retries",
2862
- "auto-instance-enabled",
2863
- "language"
2864
- ]);
2865
- //#endregion
2866
- //#region ../../libs/player-next/src/components/FullscreenButton.ts
2867
- var _o, vo = document.createElement("template");
2868
- vo.innerHTML = `
2869
- <style>
2870
- :host {
2871
- display: var(--fullscreen-button-display);
2872
- }
2873
-
2874
- :host([${g.FULLSCREEN}]) slot[name="enter"] {
2875
- display: none !important;
2876
- }
2877
-
2878
- :host(:not([${g.FULLSCREEN}])) slot[name="exit"] {
2879
- display: none !important;
2880
- }
2881
- </style>
2882
-
2883
- <slot name="icon">
2884
- <slot name="enter">
2885
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-maximize"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 8v-2a2 2 0 0 1 2 -2h2" /><path d="M4 16v2a2 2 0 0 0 2 2h2" /><path d="M16 4h2a2 2 0 0 1 2 2v2" /><path d="M16 20h2a2 2 0 0 0 2 -2v-2" /></svg>
2886
- </slot>
2887
- <slot name="exit">
2888
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-minimize"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 19v-2a2 2 0 0 1 2 -2h2" /><path d="M15 5v2a2 2 0 0 0 2 2h2" /><path d="M5 15h2a2 2 0 0 1 2 2v2" /><path d="M5 9h2a2 2 0 0 0 2 -2v-2" /></svg>
2889
- </slot>
2890
- </slot>
2891
- `;
2892
- var yo = class extends v {
2893
- constructor() {
2894
- var e;
2895
- super(), (e = this.shadowRoot) == null || e.appendChild(vo.content.cloneNode(!0));
2896
- }
2897
- connectedCallback() {
2898
- super.connectedCallback(), this.setAttribute("aria-label", this.isFullscreen ? "Exit fullscreen" : "Fullscreen");
2899
- }
2900
- disconnectedCallback() {
2901
- super.disconnectedCallback();
2902
- }
2903
- attributeChangedCallback(e, t, n) {
2904
- super.attributeChangedCallback(e, t, n), e === g.FULLSCREEN && this.setAttribute("aria-label", this.isFullscreen ? "Exit fullscreen" : "Fullscreen");
2905
- }
2906
- set isFullscreen(e) {
2907
- e ? this.setAttribute(g.FULLSCREEN, "") : this.removeAttribute(g.FULLSCREEN);
2908
- }
2909
- get isFullscreen() {
2910
- return this.hasAttribute(g.FULLSCREEN);
2911
- }
2912
- handleClick(e) {
2913
- let t = this.isFullscreen ? x.EXIT_FULLSCREEN : x.ENTER_FULLSCREEN;
2914
- this.dispatchEvent(new CustomEvent(t, {
2915
- bubbles: !0,
2916
- composed: !0
2917
- }));
2918
- }
2919
- };
2920
- _o = yo, e(yo, "observedAttributes", [...y(_o, "observedAttributes", _o), g.FULLSCREEN]);
2921
- //#endregion
2922
- //#region ../../libs/player-next/src/components/LanguageMenu.ts
2923
- var bo, xo = "\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M4 5h7\" /><path d=\"M9 3v2c0 4.418 -2.239 8 -5 8\" /><path d=\"M5 9c0 2.144 2.952 3.908 6.7 4\" /><path d=\"M12 20l4 -9l4 9\" /><path d=\"M19.1 18h-6.2\" /></svg>\n", So = document.createElement("template");
2924
- So.innerHTML = `
2925
- <style>
2926
- :host(:not([hidden])) {
2927
- display: var(--language-menu-display);
2928
- }
2929
- </style>
2930
-
2931
- <slot name="button">${xo}</slot>
2932
- <slot name="listbox" hidden>
2933
- <vindral-language-menu-list id="listbox" part="listbox"></vindral-language-menu-list>
2934
- </slot>
2935
- `;
2936
- var Co = /* @__PURE__ */ new WeakSet(), wo = class extends He {
2937
- constructor() {
2938
- var e, t, n;
2939
- super(), S(this, Co), (e = this.shadowRoot) == null || e.appendChild(So.content.cloneNode(!0)), this.listbox = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[part=listbox]"), this.listboxSlot = (n = this.shadowRoot) == null ? void 0 : n.querySelector("slot[name=listbox]");
2940
- }
2941
- connectedCallback() {
2942
- super.connectedCallback(), m(Co, this, To).call(this), this.setAttribute("aria-label", "Audio & Subtitles");
2943
- }
2944
- attributeChangedCallback(e, t, n) {
2945
- super.attributeChangedCallback(e, t, n), (e === g.LANGUAGES || e === g.TEXT_TRACKS) && m(Co, this, To).call(this);
2946
- }
2947
- };
2948
- bo = wo;
2949
- function To() {
2950
- let e = (e) => (e ? JSON.parse(e) : []).length < 2, t = e(this.getAttribute(g.LANGUAGES)), n = e(this.getAttribute(g.TEXT_TRACKS));
2951
- t && n ? this.setAttribute("hidden", "") : this.removeAttribute("hidden");
2952
- }
2953
- e(wo, "observedAttributes", [
2954
- ...y(bo, "observedAttributes", bo),
2955
- g.LANGUAGES,
2956
- g.TEXT_TRACKS
2957
- ]);
2958
- //#endregion
2959
- //#region ../../libs/player-next/src/components/LanguageMenuList.ts
2960
- var Eo = document.createElement("template");
2961
- Eo.innerHTML = `
2962
- <style>
2963
- :host {
2964
- font: inherit;
2965
- cursor: default;
2966
- padding: var(--padding-2) !important;
2967
- padding-top: var(--padding-3) !important;
2968
- border-radius: 0.25em;
2969
- position: absolute;
2970
- min-width: 140px !important;
2971
- background: var(--bg-subtle);
2972
- z-index: 1;
2973
- overflow: auto;
2974
- display: flex;
2975
- flex-direction: row;
2976
- gap: var(--padding-3);
2977
- }
2978
-
2979
- :host([list-position="top"]) {
2980
- bottom: calc(100% + 0.5em);
2981
- transform: translate(-50%);
2982
- }
2983
-
2984
- :host([list-position="bottom"]) {
2985
- top: calc(100% + 0.5em);
2986
- }
2987
-
2988
- :host::-webkit-scrollbar {
2989
- width: 5px;
2990
- padding-right: 5px;
2991
- }
2992
-
2993
- :host::-webkit-scrollbar-thumb {
2994
- background-color: var(--fg-extra-subtle);
2995
- border-radius: 10px;
2996
- border: 0;
2997
- }
2998
-
2999
- :host::-webkit-scrollbar-track {
3000
- border-radius: 10px;
3001
- background-color: transparent;
3002
- }
3003
-
3004
- .menu {
3005
- display: grid;
3006
- gap: var(--padding-1);
3007
- }
3008
-
3009
- .menu-container {
3010
- display: flex;
3011
- flex-direction: column;
3012
- flex: 1;
3013
- }
3014
-
3015
- [role="menuitem"] {
3016
- position: relative;
3017
- cursor: pointer;
3018
- display: flex;
3019
- align-items: center;
3020
- height: 44px;
3021
- padding: 0 var(--padding-3);
3022
- padding-left: var(--padding-6);
3023
- border-radius: 4px;
3024
- font-size: 14px;
3025
- }
3026
-
3027
- [role="menuitem"]:hover {
3028
- background: var(--bg-component-hover);
3029
- }
3030
-
3031
- [role="menuitem"][aria-selected="true"] {
3032
- background: var(--bg-component-active);
3033
- }
3034
-
3035
- [role="menuitem"][aria-selected="true"]::before {
3036
- content: url("data:image/svg+xml,%0A%20%20%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2078.369%2078.369%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M78.049%2019.015%2029.458%2067.606a1.094%201.094%200%200%201-1.548%200L.32%2040.015a1.094%201.094%200%200%201%200-1.547l6.704-6.704a1.095%201.095%200%200%201%201.548%200l20.113%2020.112%2041.113-41.113a1.095%201.095%200%200%201%201.548%200l6.703%206.704a1.094%201.094%200%200%201%200%201.548z%22%2F%3E%3C%2Fsvg%3E%0A");
3037
- position: absolute;
3038
- left: var(--padding-3);
3039
- top: calc(50% - 8px);
3040
- }
3041
-
3042
- [role="menuitem"]:focus-visible {
3043
- box-shadow: inset 0 0 0 2px var(--fg-strong);
3044
- outline: 0;
3045
- }
3046
-
3047
- .heading {
3048
- text-transform: uppercase;
3049
- margin-bottom: var(--padding-2);
3050
- padding: 0 var(--padding-3);
3051
- font-size: 11px;
3052
- font-weight: bold;
3053
- }
3054
-
3055
- :host([${g.LANGUAGES}="[]"]) #languages,
3056
- :host(:not([${g.LANGUAGES}])) #languages {
3057
- display: none;
3058
- }
3059
-
3060
- :host([${g.TEXT_TRACKS}="[]"]) #text-tracks,
3061
- :host(:not([${g.TEXT_TRACKS}])) #text-tracks {
3062
- display: none;
3063
- }
3064
- </style>
3065
-
3066
- <div id="languages" class="menu-container">
3067
- <div class="heading">Language</div>
3068
- <div class="menu"></div>
3069
- </div>
3070
- <div id="text-tracks" class="menu-container">
3071
- <div class="heading">Subtitles</div>
3072
- <div class="menu"></div>
3073
- </div>
3074
- `;
3075
- var Do = /* @__PURE__ */ new WeakMap(), Oo = /* @__PURE__ */ new WeakMap(), ko = /* @__PURE__ */ new WeakMap(), Ao = /* @__PURE__ */ new WeakMap(), jo = /* @__PURE__ */ new WeakMap(), Mo = /* @__PURE__ */ new WeakMap(), No = /* @__PURE__ */ new WeakMap(), Po = /* @__PURE__ */ new WeakMap(), Fo = /* @__PURE__ */ new WeakMap(), Io = /* @__PURE__ */ new WeakMap(), Lo = /* @__PURE__ */ new WeakMap(), Ro = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakSet(), zo = class extends HTMLElement {
3076
- constructor() {
3077
- super(), S(this, G), f(this, Do, []), f(this, Oo, []), f(this, ko, void 0), f(this, Ao, void 0), f(this, jo, []), f(this, Mo, []), f(this, No, null), f(this, Po, null), f(this, Fo, null), f(this, Io, null), f(this, Lo, null), f(this, Ro, null), e(this, "handleEvent", (e) => {
3078
- switch (e.type) {
3079
- case "keydown":
3080
- m(G, this, Jo).call(this, e);
3081
- break;
3082
- }
3083
- }), this.attachShadow({ mode: "open" }).appendChild(Eo.content.cloneNode(!0));
3084
- }
3085
- connectedCallback() {
3086
- let e = this.getRootNode();
3087
- if (e instanceof ShadowRoot) {
3088
- var t, n, r;
3089
- p(Fo, this, e.host.closest("vindral-controller")), (t = h(Fo, this)) == null || t.connectListener(this), p(No, this, (n = this.shadowRoot) == null ? void 0 : n.querySelector("#languages .menu")), p(Po, this, (r = this.shadowRoot) == null ? void 0 : r.querySelector("#text-tracks .menu")), m(G, this, Bo).call(this), m(G, this, Vo).call(this), p(Io, this, e.host), this.addEventListener("keydown", this);
3090
- }
3091
- }
3092
- disconnectedCallback() {
3093
- this.removeEventListener("keydown", this);
3094
- }
3095
- attributeChangedCallback(e, t, n) {
3096
- t !== n && (e === g.LANGUAGES && n && (this.languages = JSON.parse(n)), e === g.TEXT_TRACKS && n && (this.textTracks = JSON.parse(n)), e === g.LANGUAGE && (this.language = n), e === g.TEXT_TRACK && (this.textTrack = n));
3097
- }
3098
- set languages(e) {
3099
- p(Do, this, e), m(G, this, Uo).call(this), m(G, this, Go).call(this);
3100
- }
3101
- set textTracks(e) {
3102
- p(Oo, this, e), m(G, this, Ho).call(this), m(G, this, Ko).call(this);
3103
- }
3104
- set language(e) {
3105
- p(ko, this, e), m(G, this, Go).call(this);
3106
- }
3107
- set textTrack(e) {
3108
- p(Ao, this, e), m(G, this, Ko).call(this);
3109
- }
3110
- get keysUsed() {
3111
- return [
3112
- "Enter",
3113
- "Escape",
3114
- "Tab",
3115
- " ",
3116
- "ArrowDown",
3117
- "ArrowUp",
3118
- "ArrowLeft",
3119
- "ArrowRight",
3120
- "Home",
3121
- "End"
3122
- ];
3123
- }
3124
- focus() {
3125
- h(Lo, this) ? h(Lo, this).focus() : h(Ro, this) && h(Ro, this).focus();
3126
- }
3127
- };
3128
- function Bo() {
3129
- new IntersectionObserver((e) => {
3130
- e.forEach((e) => {
3131
- if (e.intersectionRatio !== 1) if (e.intersectionRatio > 0) {
3132
- let t = this.offsetHeight * e.intersectionRatio - 24;
3133
- this.style.height = `${t}px`;
3134
- } else this.style.height = "auto";
3135
- });
3136
- }, {
3137
- root: h(Fo, this),
3138
- threshold: 0
3139
- }).observe(this);
3140
- }
3141
- function Vo() {
3142
- h(No, this) && (m(G, this, Uo).call(this), m(G, this, Go).call(this)), h(Po, this) && (m(G, this, Ho).call(this), m(G, this, Ko).call(this));
3143
- }
3144
- function Ho() {
3145
- h(Po, this).innerHTML = "", p(Mo, this, []);
3146
- let e = m(G, this, Wo).call(this, "Off", "textTrack", void 0);
3147
- h(Po, this).appendChild(e), h(Mo, this).push({
3148
- element: e,
3149
- value: void 0
3150
- }), h(Oo, this).forEach((e) => {
3151
- let t = m(G, this, Wo).call(this, e, "textTrack", e);
3152
- h(Po, this).appendChild(t), h(Mo, this).push({
3153
- element: t,
3154
- value: e
3155
- });
3156
- }), m(G, this, Ko).call(this);
3157
- }
3158
- function Uo() {
3159
- h(No, this).innerHTML = "", p(jo, this, []), h(Do, this).forEach((e) => {
3160
- let t = m(G, this, Wo).call(this, e, "language", e);
3161
- h(No, this).appendChild(t), h(jo, this).push({
3162
- element: t,
3163
- value: e
3164
- });
3165
- }), m(G, this, Go).call(this);
3166
- }
3167
- function Wo(e, t, n) {
3168
- let r = document.createElement("div");
3169
- return r.setAttribute("role", "menuitem"), r.textContent = e, r.addEventListener("click", () => m(G, this, qo).call(this, n, t)), r;
3170
- }
3171
- function Go() {
3172
- h(Lo, this) && (h(Lo, this).removeAttribute("aria-selected"), h(Lo, this).tabIndex = -1);
3173
- let e = h(jo, this).find((e) => e.value === h(ko, this));
3174
- e && (e.element.setAttribute("aria-selected", "true"), e.element.tabIndex = 0, p(Lo, this, e.element));
3175
- }
3176
- function Ko() {
3177
- h(Ro, this) && (h(Ro, this).removeAttribute("aria-selected"), h(Ro, this).tabIndex = -1);
3178
- let e = h(Mo, this).find((e) => e.value === h(Ao, this));
3179
- if (e) e.element.setAttribute("aria-selected", "true"), e.element.tabIndex = 0, p(Ro, this, e.element);
3180
- else {
3181
- let e = h(Mo, this).find((e) => e.value === void 0);
3182
- e && (e.element.setAttribute("aria-selected", "true"), e.element.tabIndex = 0, p(Ro, this, e.element));
3183
- }
3184
- }
3185
- function qo(e, t) {
3186
- this.dispatchEvent(new Event("change", {
3187
- bubbles: !0,
3188
- composed: !0
3189
- }));
3190
- let n = t === "language" ? x.SET_LANGUAGE : x.SET_TEXT_TRACK;
3191
- this.dispatchEvent(new CustomEvent(n, {
3192
- bubbles: !0,
3193
- composed: !0,
3194
- detail: e
3195
- }));
3196
- }
3197
- function Jo(e) {
3198
- let { key: t, ctrlKey: n, altKey: r, metaKey: i } = e;
3199
- if (!(n || r || i) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") {
3200
- var a;
3201
- (a = h(Io, this)) == null || a.hide();
3202
- } else if (t === "Enter" || t === " ") {
3203
- var o;
3204
- (o = m(G, this, Zo).call(this)) == null || (o = o.element) == null || o.click();
3205
- } else m(G, this, Yo).call(this, e);
3206
- }
3207
- function Yo(e) {
3208
- var t;
3209
- let { key: n } = e, r = [...h(jo, this), ...h(Mo, this)], i = (t = m(G, this, Zo).call(this)) == null ? r[0] : t;
3210
- if (!i) return;
3211
- let a = r.indexOf(i), o = Math.max(0, a);
3212
- n === "ArrowDown" ? o++ : n === "ArrowUp" ? o-- : n === "ArrowLeft" ? o = m(G, this, Xo).call(this, a, "left") : n === "ArrowRight" ? o = m(G, this, Xo).call(this, a, "right") : e.key === "Home" ? o = 0 : e.key === "End" && (o = r.length - 1), o < 0 && (o = r.length - 1), o > r.length - 1 && (o = 0);
3213
- let s = r[o];
3214
- s && (m(G, this, Qo).call(this, s.value), s.element.focus());
3215
- }
3216
- function Xo(e, t) {
3217
- let n = h(jo, this).length, r = h(Mo, this).length;
3218
- return t === "left" ? e < n ? n + r - 1 : e - n - 1 : e >= n ? 0 : e + n;
3219
- }
3220
- function Zo() {
3221
- return [...h(jo, this), ...h(Mo, this)].find((e) => e.element.tabIndex === 0);
3222
- }
3223
- function Qo(e) {
3224
- for (let t of [...h(jo, this), ...h(Mo, this)]) t.element.tabIndex = t.value === e ? 0 : -1;
3225
- }
3226
- e(zo, "observedAttributes", [
3227
- g.LANGUAGES,
3228
- g.TEXT_TRACKS,
3229
- g.LANGUAGE,
3230
- g.TEXT_TRACK
3231
- ]);
3232
- //#endregion
3233
- //#region ../../libs/player-next/src/components/LiveButton.ts
3234
- var $o, es = document.createElement("template");
3235
- es.innerHTML = "\n <style>\n :host {\n display: var(--live-button-display, flex);\n color: var(--vindral-fg-strong, #eee);\n border: 1px solid transparent !important;\n font-size: 12px;\n font-weight: bold;\n cursor: pointer;\n transition: all 0.2s;\n min-width: 50px !important;\n text-align: center;\n align-items: center;\n justify-content: center;\n }\n\n .live-text {\n display: inline-block;\n vertical-align: middle;\n margin-left: 4px;\n }\n\n slot[name=\"icon\"] svg {\n width: 5px;\n height: 5px;\n flex-shrink: 0;\n }\n\n .live-dot {\n fill: var(--vindral-fg-subtle, #b4b4b4);\n transition: fill 0.2s;\n transform-origin: center;\n }\n\n /* Red pulsing dot when live */\n :host(:not([timeshift-position])) .live-dot {\n fill: #ff0000;\n animation: pulse-dot 2s ease-in-out infinite alternate;\n }\n\n @keyframes pulse-dot {\n 0% {\n opacity: 0.8;\n transform: scale(0.9);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n }\n\n :host([disabled]) {\n cursor: default;\n opacity: 1;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n </style>\n\n <slot name=\"icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"5\" height=\"5\" viewBox=\"0 0 5 5\" fill=\"currentColor\">\n <circle cx=\"2.5\" cy=\"2.5\" r=\"2.5\" class=\"live-dot\"/>\n </svg>\n</slot>\n <span class=\"live-text\">LIVE</span>\n";
3236
- var ts = class extends v {
3237
- constructor() {
3238
- var e;
3239
- super(), (e = this.shadowRoot) == null || e.appendChild(es.content.cloneNode(!0));
3240
- }
3241
- connectedCallback() {
3242
- super.connectedCallback(), this.updateState();
3243
- }
3244
- disconnectedCallback() {
3245
- super.disconnectedCallback();
3246
- }
3247
- attributeChangedCallback(e, t, n) {
3248
- super.attributeChangedCallback(e, t, n), (e === g.TIMESHIFT_POSITION || e === g.DURATION) && this.updateState();
3249
- }
3250
- updateState() {
3251
- if (!this.hasAttribute(g.DURATION)) {
3252
- this.setAttribute("hidden", ""), this.removeAttribute("aria-label"), this.removeAttribute("disabled");
3253
- return;
3254
- }
3255
- this.removeAttribute("hidden"), this.isLive ? (this.setAttribute("aria-label", "Currently live"), this.setAttribute("disabled", "")) : (this.setAttribute("aria-label", "Go live"), this.removeAttribute("disabled"));
3256
- }
3257
- get isLive() {
3258
- return !this.hasAttribute(g.TIMESHIFT_POSITION);
3259
- }
3260
- set isLive(e) {
3261
- e ? this.removeAttribute(g.TIMESHIFT_POSITION) : this.setAttribute(g.TIMESHIFT_POSITION, "");
3262
- }
3263
- handleClick(e) {
3264
- this.isLive || this.dispatchEvent(new CustomEvent(x.GO_LIVE, {
3265
- bubbles: !0,
3266
- composed: !0
3267
- }));
3268
- }
3269
- };
3270
- $o = ts, e(ts, "observedAttributes", [
3271
- ...y($o, "observedAttributes", $o),
3272
- g.TIMESHIFT_POSITION,
3273
- g.DURATION
3274
- ]);
3275
- //#endregion
3276
- //#region ../../libs/player-next/src/components/MuteButton.ts
3277
- var ns, rs = document.createElement("template");
3278
- rs.innerHTML = `
3279
- <style>
3280
- :host {
3281
- display: var(--mute-button-display);
3282
- }
3283
-
3284
- :host([${g.MUTED}]) slot[name="unmute"] {
3285
- display: none !important;
3286
- }
3287
-
3288
- :host(:not([${g.MUTED}])) slot[name="mute"] {
3289
- display: none !important;
3290
- }
3291
- </style>
3292
-
3293
- <slot name="icon">
3294
- <slot name="mute">
3295
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" <g fill="none" stroke="currentColor">
3296
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" clip-rule="evenodd" />
3297
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" />
3298
- </g></svg>
3299
- </slot>
3300
- <slot name="unmute">
3301
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" <g fill="none" stroke="currentColor">
3302
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.536 8.464a5 5 0 010 7.072m2.828-9.9a9 9 0 010 12.728M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" /></svg>
3303
- </slot>
3304
- </slot>
3305
- `;
3306
- var is = class extends v {
3307
- constructor() {
3308
- var e;
3309
- super(), (e = this.shadowRoot) == null || e.appendChild(rs.content.cloneNode(!0));
3310
- }
3311
- connectedCallback() {
3312
- super.connectedCallback(), this.setAttribute("aria-label", this.muted ? "Unmute" : "Mute");
3313
- }
3314
- disconnectedCallback() {
3315
- super.disconnectedCallback();
3316
- }
3317
- attributeChangedCallback(e, t, n) {
3318
- super.attributeChangedCallback(e, t, n), e === g.MUTED && this.setAttribute("aria-label", this.muted ? "Unmute" : "Mute");
3319
- }
3320
- set muted(e) {
3321
- e ? this.setAttribute(g.MUTED, "") : this.removeAttribute(g.MUTED);
3322
- }
3323
- get muted() {
3324
- return this.hasAttribute(g.MUTED);
3325
- }
3326
- handleClick(e) {
3327
- let t = this.muted ? x.UNMUTE : x.MUTE;
3328
- this.dispatchEvent(new CustomEvent(t, {
3329
- bubbles: !0,
3330
- composed: !0
3331
- }));
3332
- }
3333
- };
3334
- ns = is, e(is, "observedAttributes", [...y(ns, "observedAttributes", ns), g.MUTED]);
3335
- //#endregion
3336
- //#region ../../libs/player-next/src/components/PictureInPictureButton.ts
3337
- var as, os = document.createElement("template");
3338
- os.innerHTML = `
3339
- <style>
3340
- :host {
3341
- display: var(--pip-button-display);
3342
- }
3343
-
3344
- :host(:not([${g.PIP_AVAILABLE}])) {
3345
- display: none !important;
3346
- }
3347
- </style>
3348
- <slot name="icon">
3349
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M19 4a3 3 0 0 1 3 3v4a1 1 0 0 1 -2 0v-4a1 1 0 0 0 -1 -1h-14a1 1 0 0 0 -1 1v10a1 1 0 0 0 1 1h6a1 1 0 0 1 0 2h-6a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3z" /><path d="M20 13a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-5a2 2 0 0 1 -2 -2v-3a2 2 0 0 1 2 -2z" /></svg>
3350
- </slot>
3351
- `;
3352
- var ss = class extends v {
3353
- constructor() {
3354
- var e;
3355
- super(), (e = this.shadowRoot) == null || e.appendChild(os.content.cloneNode(!0));
3356
- }
3357
- connectedCallback() {
3358
- super.connectedCallback(), this.setAttribute("aria-label", this.isPictureInPictureActive ? "Exit picture-in-picture" : "Picture-in-picture");
3359
- }
3360
- disconnectedCallback() {
3361
- super.disconnectedCallback();
3362
- }
3363
- attributeChangedCallback(e, t, n) {
3364
- super.attributeChangedCallback(e, t, n), e === g.IS_PIP && this.setAttribute("aria-label", this.isPictureInPictureActive ? "Exit picture-in-picture" : "Picture-in-picture");
3365
- }
3366
- set isPictureInPictureActive(e) {
3367
- e ? this.setAttribute(g.IS_PIP, "") : this.removeAttribute(g.IS_PIP);
3368
- }
3369
- get isPictureInPictureActive() {
3370
- return this.hasAttribute(g.IS_PIP);
3371
- }
3372
- handleClick(e) {
3373
- let t = this.isPictureInPictureActive ? x.EXIT_PIP : x.ENTER_PIP;
3374
- this.dispatchEvent(new CustomEvent(t, {
3375
- bubbles: !0,
3376
- composed: !0
3377
- }));
3378
- }
3379
- };
3380
- as = ss, e(ss, "observedAttributes", [
3381
- ...y(as, "observedAttributes", as),
3382
- g.IS_PIP,
3383
- g.PIP_AVAILABLE
3384
- ]);
3385
- //#endregion
3386
- //#region ../../libs/player-next/src/components/PlayButton.ts
3387
- var cs, ls = document.createElement("template");
3388
- ls.innerHTML = `
3389
- <style>
3390
- :host {
3391
- display: var(--play-button-display);
3392
- }
3393
-
3394
- :host([${g.PAUSED}]) slot[name="pause"] {
3395
- display: none !important;
3396
- }
3397
-
3398
- :host(:not([${g.PAUSED}])) slot[name="play"] {
3399
- display: none !important;
3400
- }
3401
- </style>
3402
-
3403
- <slot name="icon">
3404
- <slot name="play">
3405
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z" /></svg>
3406
- </slot>
3407
- <slot name="pause">
3408
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z" /><path d="M17 4h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2z" /></svg>
3409
- </slot>
3410
- </slot>
3411
- `;
3412
- var us = class extends v {
3413
- constructor() {
3414
- var e;
3415
- super(), (e = this.shadowRoot) == null || e.appendChild(ls.content.cloneNode(!0));
3416
- }
3417
- connectedCallback() {
3418
- super.connectedCallback(), this.setAttribute("aria-label", this.paused ? "Play" : "Pause");
3419
- }
3420
- disconnectedCallback() {
3421
- super.disconnectedCallback();
3422
- }
3423
- attributeChangedCallback(e, t, n) {
3424
- super.attributeChangedCallback(e, t, n), e === g.PAUSED && this.setAttribute("aria-label", this.paused ? "Play" : "Pause");
3425
- }
3426
- set paused(e) {
3427
- e ? this.setAttribute(g.PAUSED, "") : this.removeAttribute(g.PAUSED);
3428
- }
3429
- get paused() {
3430
- return this.hasAttribute(g.PAUSED);
3431
- }
3432
- handleClick(e) {
3433
- let t = this.paused ? x.PLAY : x.PAUSE;
3434
- this.dispatchEvent(new CustomEvent(t, {
3435
- bubbles: !0,
3436
- composed: !0
3437
- }));
3438
- }
3439
- };
3440
- cs = us, e(us, "observedAttributes", [...y(cs, "observedAttributes", cs), g.PAUSED]);
3441
- //#endregion
3442
- //#region ../../libs/player-next/src/PlayerAttributes.ts
3443
- var K = {
3444
- TITLE: "title",
3445
- OFFLINE: "offline",
3446
- ADVANCED_RENDITION_MENU_ENABLED: "advanced-rendition-menu-enabled",
3447
- REFRESH_POSTER_ENABLED: "refresh-poster-enabled",
3448
- STREAM_POLL_ENABLED: "stream-poll-enabled"
3449
- }, ds = Object.values(K), fs = /* @__PURE__ */ new WeakMap(), ps = /* @__PURE__ */ new WeakMap(), ms = /* @__PURE__ */ new WeakMap(), hs = /* @__PURE__ */ new WeakMap(), gs = /* @__PURE__ */ new WeakMap(), _s = /* @__PURE__ */ new WeakMap(), vs = /* @__PURE__ */ new WeakMap(), ys = /* @__PURE__ */ new WeakSet(), bs = class extends pe {
3450
- constructor(e) {
3451
- super(), S(this, ys), f(this, fs, void 0), f(this, ps, void 0), f(this, ms, !1), f(this, hs, !1), f(this, gs, !0), f(this, _s, null), f(this, vs, null), p(ps, this, e), p(fs, this, new de({
3452
- publicEndpoint: e.url,
3453
- tokenFactory: () => e.authenticationToken
3454
- }));
3455
- }
3456
- start(e = 5e3) {
3457
- h(vs, this) && clearInterval(h(vs, this)), p(ms, this, !1), p(hs, this, !1), m(ys, this, ws).call(this), m(ys, this, xs).call(this), p(vs, this, window.setInterval(() => {
3458
- !h(hs, this) && !h(ps, this).infiniteReconnect && !h(_s, this) && h(gs, this) && p(_s, this, window.setTimeout(() => m(ys, this, Ss).call(this), 300 * 1e3)), !h(hs, this) && h(gs, this) && m(ys, this, xs).call(this);
3459
- }, e));
3460
- }
3461
- stop() {
3462
- m(ys, this, Cs).call(this), h(vs, this) && (window.clearInterval(h(vs, this)), p(vs, this, null));
3463
- }
3464
- };
3465
- function xs() {
3466
- var e = this;
3467
- return t(function* () {
3468
- if (h(ms, e)) return;
3469
- p(ms, e, !0);
3470
- let t = "Stream is offline", n = "Please stand by";
3471
- try {
3472
- let t = yield h(fs, e).getChannel(h(ps, e).channelId);
3473
- if (t.isLive) {
3474
- p(hs, e, !0), m(ys, e, ws).call(e), e.emit("live", t), p(ms, e, !1);
3475
- return;
3476
- }
3477
- } catch (e) {
3478
- ue(e) && (e.status === 403 || e.status === 401) && (t = "Forbidden", n = "You do not have permission to view this stream");
3479
- }
3480
- h(gs, e) && e.emit("error", {
3481
- title: t,
3482
- message: n
3483
- }), p(ms, e, !1);
3484
- })();
3485
- }
3486
- function Ss() {
3487
- this.stop(), p(gs, this, !1), this.emit("timeout");
3488
- }
3489
- function Cs() {
3490
- h(_s, this) && (window.clearTimeout(h(_s, this)), p(_s, this, null));
3491
- }
3492
- function ws() {
3493
- m(ys, this, Cs).call(this), p(gs, this, !0);
3494
- }
3495
- //#endregion
3496
- //#region ../../libs/player-next/src/utils/browser.ts
3497
- var Ts = /\/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune\//i, Es = navigator.userAgent.toLowerCase(), Ds = Ts.test(Es), Os = (e) => Oa.observedAttributes.includes(e), ks = `
3498
- <style>
3499
- :host {
3500
- container-type: inline-size;
3501
- position: relative;
3502
- overflow: hidden;
3503
- width: 100%;
3504
- display: flex;
3505
- justify-content: center;
3506
-
3507
- --vindral-volume-range-display: ${Ds ? "none" : "flex"};
3508
- --vindral-airplay-button-display: none;
3509
- --vindral-play-overlay-display: none;
3510
- --vindral-grid-item-offline-display: none;
3511
- --vindral-seek-bar-display: none;
3512
- }
3513
-
3514
- vindral-control-bar[slot="top-bar"] {
3515
- display: none;
3516
- }
3517
-
3518
- @container (max-width: 320px) {
3519
- vindral-controller {
3520
- --vindral-volume-range-display: none;
3521
- --vindral-control-padding: 0px;
3522
- --vindral-button-padding: 4px;
3523
- --vindral-play-overlay-icon-size: 40px;
3524
- }
3525
-
3526
- vindral-control-bar[slot="top-bar"] {
3527
- display: block;
3528
- }
3529
-
3530
- vindral-control-bar:not([slot="top-bar"]) vindral-rendition-levels-menu,
3531
- vindral-control-bar:not([slot="top-bar"]) vindral-advanced-rendition-menu,
3532
- vindral-control-bar:not([slot="top-bar"]) vindral-cast-button,
3533
- vindral-control-bar:not([slot="top-bar"]) vindral-airplay-button {
3534
- display: none;
3535
- }
3536
- }
3537
-
3538
- vindral-scroll-overlay {
3539
- z-index: 20;
3540
- // needs to be higher than bottom bar/UI
3541
- }
3542
-
3543
- :host([${K.OFFLINE}]) {
3544
- aspect-ratio: 16 / 9;
3545
- vindral-controller {
3546
- --vindral-ui-display: none;
3547
- --vindral-play-overlay-display: none;
3548
- }
3549
- }
3550
-
3551
- :host([${g.AIRPLAY_ENABLED}="false"]) {
3552
- --vindral-airplay-button-display: none;
3553
- }
3554
-
3555
- :host([${g.CAST_ENABLED}="false"]) {
3556
- --vindral-cast-button-display: none;
3557
- }
3558
-
3559
- :host([${g.FULLSCREEN_ENABLED}="false"]) {
3560
- --vindral-fullscreen-button-display: none;
3561
- }
3562
-
3563
- :host([${g.PIP_ENABLED}="false"]) {
3564
- --vindral-pip-button-display: none;
3565
- }
3566
-
3567
- :host([${g.TIMESHIFT_ENABLED}="false"]) {
3568
- --vindral-seek-bar-display: none;
3569
- --vindral-live-button-display: none;
3570
- }
3571
-
3572
- :host(:not([${g.CHANNEL_GROUP_ID}])) vindral-scroll-overlay {
3573
- display: none;
3574
- }
3575
-
3576
- :host([${g.MEDIA}="video"]) vindral-mute-button,
3577
- :host([${g.MEDIA}="video"]) vindral-volume-range {
3578
- display: none;
3579
- }
3580
-
3581
- /* Apply subtitle offset when the UI is visible (e.g. during user interaction
3582
- or when paused with the UI showing) so subtitles sit above the control bar. */
3583
- vindral-controller[user-interacting],
3584
- vindral-controller[paused]:not([hide-ui-on-pause]) {
3585
- --vindral-subtitle-offset: -48px;
3586
- }
3587
- </style>
3588
- `, As = (e) => {
3589
- let t = e ? "vindral-advanced-rendition-menu" : "vindral-rendition-levels-menu";
3590
- return `
3591
- ${ks}
3592
-
3593
- <vindral-controller>
3594
- <vindral-control-bar slot="top-bar">
3595
- <${t} list-position="bottom"></${t}>
3596
- <vindral-cast-button></vindral-cast-button>
3597
- <vindral-airplay-button></vindral-airplay-button>
3598
- </vindral-control-bar>
3599
- <vindral-seek-bar></vindral-seek-bar>
3600
- <vindral-control-bar>
3601
- <vindral-play-button></vindral-play-button>
3602
- <vindral-mute-button></vindral-mute-button>
3603
- <vindral-volume-range></vindral-volume-range>
3604
- <vindral-channel-grid-button slot="right"></vindral-channel-grid-button>
3605
- <vindral-language-menu slot="right"></vindral-language-menu>
3606
- <vindral-live-button id="live-button" slot="right"></vindral-live-button>
3607
- <${t} slot="right"></${t}>
3608
- <vindral-debug-button slot="right"></vindral-debug-button>
3609
- <vindral-pip-button slot="right"></vindral-pip-button>
3610
- <vindral-cast-button slot="right"></vindral-cast-button>
3611
- <vindral-airplay-button slot="right"></vindral-airplay-button>
3612
- <vindral-fullscreen-button slot="right"></vindral-fullscreen-button>
3613
- </vindral-control-bar>
3614
- <vindral-debug-panel slot="overlay"></vindral-debug-panel>
3615
- <vindral-scroll-overlay slot="overlay">
3616
- <vindral-channel-grid id="listbox" part="listbox"></vindral-channel-grid>
3617
- </vindral-scroll-overlay>
3618
- <vindral-cast-overlay slot="overlay"></vindral-cast-overlay>
3619
- <vindral-buffering-overlay slot="overlay"></vindral-buffering-overlay>
3620
- <vindral-user-input-play-overlay slot="overlay"></vindral-user-input-play-overlay>
3621
- <vindral-poster-overlay slot="overlay" disabled></vindral-poster-overlay>
3622
-
3623
- <vindral-center-overlay id="center-overlay" slot="overlay">
3624
- <vindral-message id="vindral-message" hidden></vindral-message>
3625
- <vindral-play-overlay id="play-overlay" hidden></vindral-play-overlay>
3626
- </vindral-center-overlay>
3627
- </vindral-controller>
3628
- `;
3629
- }, js = `
3630
- ${ks}
3631
-
3632
- <style>
3633
- #control-bar {
3634
- display: flex;
3635
- justify-content: center;
3636
- align-items: center;
3637
- gap: var(--padding-3);
3638
- }
3639
- </style>
3640
-
3641
- <vindral-controller>
3642
- <div id="control-bar" slot="middle">
3643
- <vindral-play-button></vindral-play-button>
3644
- <vindral-mute-button></vindral-mute-button>
3645
- <vindral-volume-range></vindral-volume-range>
3646
- <vindral-buffering-icon></vindral-buffering-icon>
3647
- </div>
3648
-
3649
- <vindral-center-overlay id="center-overlay" slot="overlay" disable-backdrop>
3650
- <vindral-message id="vindral-message" hidden></vindral-message>
3651
- <vindral-play-overlay id="play-overlay" hidden></vindral-play-overlay>
3652
- </vindral-center-overlay>
3653
- </vindral-controller>
3654
- `, Ms = document.createElement("template"), q = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), Ns = /* @__PURE__ */ new WeakMap(), Ps = /* @__PURE__ */ new WeakMap(), Fs = /* @__PURE__ */ new WeakMap(), Is = /* @__PURE__ */ new WeakMap(), Ls = /* @__PURE__ */ new WeakMap(), Rs = /* @__PURE__ */ new WeakMap(), zs = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), Bs = /* @__PURE__ */ new WeakMap(), Vs = /* @__PURE__ */ new WeakMap(), Hs = /* @__PURE__ */ new WeakMap(), Us = class extends HTMLElement {
3655
- constructor() {
3656
- super(), S(this, Y), f(this, q, void 0), f(this, J, void 0), f(this, Ns, void 0), f(this, Ps, void 0), f(this, Fs, void 0), f(this, Is, void 0), f(this, Ls, /* @__PURE__ */ new Set()), f(this, Rs, () => {
3657
- Array.from(this.attributes).forEach((e) => {
3658
- h(zs, this).call(this, e.name, e.value);
3659
- });
3660
- }), f(this, zs, (e, t) => {
3661
- Os(e) && (_(t) ? h(J, this).setAttribute(e, t) : h(J, this).removeAttribute(e));
3662
- }), f(this, Bs, () => {
3663
- Array.from(this.children).forEach((e) => {
3664
- h(Ls, this).add(e);
3665
- });
3666
- }), f(this, Vs, () => {
3667
- let e = h(J, this).instance;
3668
- e && (e.on("is live", (e) => {
3669
- e ? (this.removeAttribute(K.OFFLINE), m(Y, this, Xs).call(this)) : (this.setAttribute(K.OFFLINE, ""), m(Y, this, Ys).call(this, "Stream is offline", "Please stand by"));
3670
- }), e.on("channels", (e) => {
3671
- let t = h(J, this).getAttribute("channel-id"), n = e.find((e) => e.channelId === t);
3672
- n && m(Y, this, qs).call(this, n);
3673
- }), e.on("channel switch", ({ channelId: t }) => {
3674
- let n = e.channels.find((e) => e.channelId === t);
3675
- n && m(Y, this, qs).call(this, n);
3676
- }), e.on("error", (e) => {
3677
- if (e.code() === "connection_failed") {
3678
- m(Y, this, Ys).call(this, "Stream is offline", "Please stand by");
3679
- return;
3680
- }
3681
- e.isFatal() && (e.code() === "access_forbidden" ? m(Y, this, Ys).call(this, "Forbidden", "You do not have permission to view this stream") : e.code() === "connection_failed_will_not_attempt_again" ? m(Y, this, Ys).call(this, "Stream is offline", "Please stand by") : m(Y, this, Ys).call(this, "An error occurred", e.message), h(Ps, this).removeAttribute("hidden"), this.setAttribute(K.OFFLINE, ""), h(J, this).dispatchEvent(new CustomEvent(x.EXIT_FULLSCREEN)), h(J, this).dispatchEvent(new CustomEvent(x.EXIT_PIP)));
3682
- }));
3683
- }), f(this, Hs, () => {
3684
- h(J, this).connect(), h(Ps, this).setAttribute("hidden", ""), m(Y, this, Xs).call(this), h(J, this).focus();
3685
- }), p(q, this, this.attachShadow({ mode: "open" })), m(Y, this, Gs).call(this), p(J, this, h(q, this).querySelector("vindral-controller")), p(Ns, this, h(q, this).querySelector("#vindral-message")), p(Ps, this, h(q, this).querySelector("#play-overlay")), p(Fs, this, h(q, this).querySelector("#center-overlay"));
3686
- }
3687
- connectedCallback() {
3688
- this.setAttribute(K.OFFLINE, ""), h(J, this).addEventListener("vindral-instance-ready", h(Vs, this)), m(Y, this, Ks).call(this);
3689
- }
3690
- disconnectedCallback() {
3691
- var e;
3692
- h(J, this).removeEventListener("vindral-instance-ready", h(Vs, this)), h(Ps, this).removeEventListener("click", h(Hs, this)), (e = h(Is, this)) == null || e.stop();
3693
- }
3694
- attributeChangedCallback(e, t, n) {
3695
- if (t !== n) if (e === g.MEDIA || e === K.ADVANCED_RENDITION_MENU_ENABLED) m(Y, this, Gs).call(this);
3696
- else if (e === K.REFRESH_POSTER_ENABLED) {
3697
- let e = h(q, this).querySelector("vindral-poster-overlay");
3698
- e && (e.disabled = b(this.getAttribute(K.REFRESH_POSTER_ENABLED), !1) === !1);
3699
- } else h(zs, this).call(this, e, n);
3700
- }
3701
- get instance() {
3702
- return h(J, this).instance;
3703
- }
3704
- get airPlay() {
3705
- return h(J, this).airPlay;
3706
- }
3707
- get timelineMarkers() {
3708
- return h(J, this).timelineMarkers;
3709
- }
3710
- set timelineMarkers(e) {
3711
- h(J, this).timelineMarkers = e;
3712
- }
3713
- };
3714
- function Ws() {
3715
- let e = xe(this.getAttribute(g.MEDIA)), t = b(this.getAttribute(K.ADVANCED_RENDITION_MENU_ENABLED), !1);
3716
- return e === "audio" ? js : As(t);
3717
- }
3718
- function Gs() {
3719
- let e = h(q, this).hasChildNodes(), t = e ? h(J, this) : void 0, n = e ? h(Ps, this) : void 0;
3720
- this.isConnected && t && t.removeEventListener("vindral-instance-ready", h(Vs, this)), this.isConnected && n && h(Is, this) && n.removeEventListener("click", h(Hs, this)), Ms.innerHTML = m(Y, this, Ws).call(this);
3721
- let r = Ms.content.cloneNode(!0);
3722
- p(J, this, r.querySelector("vindral-controller")), p(Ns, this, r.querySelector("#vindral-message")), p(Ps, this, r.querySelector("#play-overlay")), p(Fs, this, r.querySelector("#center-overlay")), h(Bs, this).call(this), h(Ls, this).forEach((e) => {
3723
- h(J, this).appendChild(e);
3724
- }), h(Rs, this).call(this), h(q, this).innerHTML = "", h(q, this).appendChild(r), this.isConnected && (h(J, this).addEventListener("vindral-instance-ready", h(Vs, this)), h(Is, this) && h(Ps, this).addEventListener("click", h(Hs, this)));
3725
- }
3726
- function Ks() {
3727
- var e;
3728
- if (b(this.getAttribute(K.STREAM_POLL_ENABLED), !0) === !1) return;
3729
- let t = this.getAttribute("url") || "https://lb.cdn.vindral.com", n = this.getAttribute("channel-id"), r = (e = this.getAttribute("authentication-token")) == null ? void 0 : e, i = this.hasAttribute("infinite-reconnect");
3730
- if (!n) {
3731
- this.setAttribute(K.OFFLINE, ""), m(Y, this, Ys).call(this, "Invalid options", "Please enter a channel id to start the stream");
3732
- return;
3733
- }
3734
- p(Is, this, new bs({
3735
- url: t,
3736
- channelId: n,
3737
- authenticationToken: r,
3738
- infiniteReconnect: i
3739
- })), h(Is, this).on("live", (e) => {
3740
- h(J, this).connect(), this.removeAttribute("offline"), m(Y, this, Xs).call(this), m(Y, this, qs).call(this, e);
3741
- }), h(Is, this).on("timeout", () => {
3742
- m(Y, this, Xs).call(this), h(Ps, this).removeAttribute("hidden");
3743
- }), h(Is, this).on("error", (e) => {
3744
- this.setAttribute(K.OFFLINE, ""), m(Y, this, Ys).call(this, e.title, e.message);
3745
- }), h(Ps, this).addEventListener("click", h(Hs, this)), this.hasAttribute("paused") && h(Is, this).start();
3746
- }
3747
- function qs(e) {
3748
- var t, n, r;
3749
- let i = ve(this.getAttribute("title"), !1);
3750
- i && Me({
3751
- title: typeof i == "string" ? i : e.name,
3752
- poster: (t = (n = m(Y, this, Js).call(this)) == null ? (r = this.instance) == null ? void 0 : r.getThumbnailUrl() : n) == null ? e.thumbnailUrls[0] : t
3753
- });
3754
- }
3755
- function Js() {
3756
- let e = ve(this.getAttribute("poster"));
3757
- return _(e) ? e : void 0;
3758
- }
3759
- function Ys(e, t) {
3760
- h(Ns, this).setAttribute("title", e), h(Ns, this).setAttribute("description", t), h(Ns, this).removeAttribute("hidden");
3761
- let n = m(Y, this, Js).call(this);
3762
- n ? h(Fs, this).setAttribute("poster", n) : h(Fs, this).removeAttribute("poster"), h(Fs, this).setAttribute("backdrop", "");
3763
- }
3764
- function Xs() {
3765
- h(Ns, this).setAttribute("hidden", ""), h(Fs, this).removeAttribute("backdrop");
3766
- }
3767
- e(Us, "observedAttributes", [...Oa.observedAttributes, ...ds]);
3768
- //#endregion
3769
- //#region ../../libs/player-next/src/components/PosterOverlay.ts
3770
- var Zs = document.createElement("template");
3771
- Zs.innerHTML = `
3772
- <style>
3773
- :host {
3774
- display: var(--poster-overlay-display);
3775
- position: absolute;
3776
- top: 0;
3777
- left: 0;
3778
- max-width: 100%;
3779
- max-height: 100%;
3780
- min-width: 100% !important;
3781
- min-height: 100% !important;
3782
- background-repeat: no-repeat;
3783
- background-position: 50% 50%;
3784
- background-size: contain;
3785
- transition-property: background-image;
3786
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
3787
- transition-duration: 200ms;
3788
- }
3789
-
3790
- :host::before {
3791
- content: "";
3792
- position: absolute;
3793
- top: 0;
3794
- left: 0;
3795
- right: 0;
3796
- bottom: 0;
3797
- background: rgba(255, 255, 255, 0);
3798
- transition: background 0.2s ease;
3799
- }
3800
-
3801
- :host(:not([${g.PAUSED}])) {
3802
- display: none;
3803
- }
3804
- </style>
3805
- `;
3806
- var Qs = 6e3, $s = /* @__PURE__ */ new WeakMap(), ec = /* @__PURE__ */ new WeakMap(), tc = /* @__PURE__ */ new WeakMap(), nc = /* @__PURE__ */ new WeakMap(), rc = /* @__PURE__ */ new WeakSet(), ic = /* @__PURE__ */ new WeakMap(), ac = class extends HTMLElement {
3807
- constructor() {
3808
- super(), S(this, rc), f(this, $s, null), f(this, ec, null), f(this, tc, null), f(this, nc, () => {
3809
- !document.hidden && this.hasAttribute("intersecting") && this.paused && !this.disabled ? m(rc, this, oc).call(this) : m(rc, this, sc).call(this);
3810
- }), f(this, ic, (e) => {
3811
- e.forEach((e) => {
3812
- e.isIntersecting ? this.setAttribute("intersecting", "") : this.removeAttribute("intersecting");
3813
- });
3814
- }), this.attachShadow({ mode: "open" }).appendChild(Zs.content.cloneNode(!0));
3815
- }
3816
- connectedCallback() {
3817
- var e;
3818
- p($s, this, this.closest("vindral-controller")), (e = h($s, this)) == null || e.connectListener(this), document.addEventListener("visibilitychange", h(nc, this)), p(tc, this, new IntersectionObserver(h(ic, this))), h(tc, this).observe(this);
3819
- }
3820
- disconnectedCallback() {
3821
- var e, t;
3822
- (e = h($s, this)) == null || e.disconnectListener(this), document.removeEventListener("visibilitychange", h(nc, this)), (t = h(tc, this)) == null || t.disconnect(), p(tc, this, null), m(rc, this, sc).call(this);
3823
- }
3824
- attributeChangedCallback(e, t, n) {
3825
- t !== n && (e === g.POSTER_SRC && this.paused && !this.disabled && m(rc, this, cc).call(this), (e === g.PAUSED || e === "disabled" || e === "intersecting") && h(nc, this).call(this));
3826
- }
3827
- get disabled() {
3828
- return this.hasAttribute("disabled");
3829
- }
3830
- set disabled(e) {
3831
- e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3832
- }
3833
- get posterSrc() {
3834
- return this.getAttribute(g.POSTER_SRC);
3835
- }
3836
- get paused() {
3837
- return this.hasAttribute(g.PAUSED);
3838
- }
3839
- };
3840
- function oc() {
3841
- h(ec, this) === null && (m(rc, this, sc).call(this), p(ec, this, window.setInterval(() => m(rc, this, cc).call(this), Qs)));
3842
- }
3843
- function sc() {
3844
- h(ec, this) !== null && (clearInterval(h(ec, this)), p(ec, this, null)), this.style.backgroundImage = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAJCAQAAACRI2S5AAAAEElEQVR42mNkIAAYRxWAAQAG9gAKqv6+AwAAAABJRU5ErkJggg==')";
3845
- }
3846
- function cc() {
3847
- if (!this.posterSrc) return;
3848
- let e = new URL(this.posterSrc), t = new Image();
3849
- e.searchParams.set("t", Date.now().toString()), t.src = e.toString(), t.onload = () => this.style.backgroundImage = `url(${e.toString()})`;
3850
- }
3851
- e(ac, "observedAttributes", [
3852
- g.POSTER_SRC,
3853
- g.PAUSED,
3854
- "disabled",
3855
- "intersecting"
3856
- ]);
3857
- //#endregion
3858
- //#region ../../libs/player-next/src/components/RenditionLevelsMenu.ts
3859
- var lc, uc = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon icon-tabler icon-tabler-settings-filled\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"#2c3e50\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/>\n <path d=\"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z\" stroke-width=\"0\" fill=\"currentColor\" />\n</svg>\n", dc = document.createElement("template");
3860
- dc.innerHTML = `
3861
- <style>
3862
- :host {
3863
- display: var(--rendition-menu-display);
3864
- }
3865
- </style>
3866
-
3867
- <slot name="button">${uc}</slot>
3868
- <slot name="listbox" hidden>
3869
- <vindral-rendition-levels-menu-list id="listbox" part="listbox"></vindral-rendition-levels-menu-list>
3870
- </slot>
3871
- `;
3872
- var fc = /* @__PURE__ */ new WeakSet(), pc = class extends He {
3873
- constructor() {
3874
- var e, t, n;
3875
- super(), S(this, fc), (e = this.shadowRoot) == null || e.appendChild(dc.content.cloneNode(!0)), this.listbox = (t = this.shadowRoot) == null ? void 0 : t.querySelector("[part=listbox]"), this.listboxSlot = (n = this.shadowRoot) == null ? void 0 : n.querySelector("slot[name=listbox]");
3876
- }
3877
- connectedCallback() {
3878
- super.connectedCallback(), m(fc, this, mc).call(this), this.setAttribute("aria-label", "Quality");
3879
- }
3880
- attributeChangedCallback(e, t, n) {
3881
- super.attributeChangedCallback(e, t, n), e === g.RENDITION_LEVELS && m(fc, this, mc).call(this);
3882
- }
3883
- };
3884
- lc = pc;
3885
- function mc() {
3886
- let e = this.getAttribute(g.RENDITION_LEVELS);
3887
- !e || e === "[]" ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
3888
- }
3889
- e(pc, "observedAttributes", [...y(lc, "observedAttributes", lc), g.RENDITION_LEVELS]);
3890
- //#endregion
3891
- //#region ../../libs/player-next/src/components/RenditionLevelsMenuList.ts
3892
- var hc = document.createElement("template");
3893
- hc.innerHTML = "\n <style>\n :host {\n font: inherit;\n cursor: default;\n padding: var(--padding-2) !important;\n padding-top: var(--padding-3) !important;\n border-radius: 0.25em;\n position: absolute;\n min-width: 140px !important;\n background: var(--bg-subtle);\n z-index: 1;\n overflow: auto;\n }\n\n :host([list-position=\"top\"]) {\n bottom: calc(100% + 0.5em);\n transform: translate(-50%);\n }\n\n :host([list-position=\"bottom\"]) {\n top: calc(100% + 0.5em);\n }\n\n :host::-webkit-scrollbar {\n width: 5px;\n padding-right: 5px;\n }\n\n :host::-webkit-scrollbar-thumb {\n background-color: var(--fg-extra-subtle);\n border-radius: 10px;\n border: 0;\n }\n\n :host::-webkit-scrollbar-track {\n border-radius: 10px;\n background-color: transparent;\n }\n\n .menu {\n display: grid;\n gap: var(--padding-1);\n }\n\n [role=\"menuitem\"] {\n flex: 1;\n position: relative;\n cursor: pointer;\n display: flex;\n flex-direction: column;\n justify-content: center;\n height: 44px;\n padding: 0 var(--padding-5);\n border-radius: 4px;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: normal;\n white-space: nowrap;\n text-align: left;\n }\n\n [role=\"menuitem\"]:hover {\n background: var(--bg-component-hover);\n }\n\n [role=\"menuitem\"][aria-selected=\"true\"] {\n background: var(--bg-component-active);\n }\n\n [role=\"menuitem\"][aria-selected=\"true\"]::before {\n content: url(\"data:image/svg+xml,%0A%20%20%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20fill%3D%22%23fff%22%20viewBox%3D%220%200%2078.369%2078.369%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20d%3D%22M78.049%2019.015%2029.458%2067.606a1.094%201.094%200%200%201-1.548%200L.32%2040.015a1.094%201.094%200%200%201%200-1.547l6.704-6.704a1.095%201.095%200%200%201%201.548%200l20.113%2020.112%2041.113-41.113a1.095%201.095%200%200%201%201.548%200l6.703%206.704a1.094%201.094%200%200%201%200%201.548z%22%2F%3E%3C%2Fsvg%3E%0A\");\n position: absolute;\n left: calc(var(--padding-3) - var(--padding-1));\n top: calc(50% - 8px);\n }\n\n [role=\"menuitem\"]:focus-visible {\n box-shadow: inset 0 0 0 2px var(--fg-strong);\n outline: 0;\n }\n\n .menu-item-subtitle {\n font-size: 11px;\n opacity: 0.6;\n }\n\n .heading {\n text-transform: uppercase;\n margin-bottom: var(--padding-2);\n padding: 0 var(--padding-3);\n font-size: 11px;\n font-weight: bold;\n }\n </style>\n\n <slot>\n <div class=\"heading\">Max quality</div>\n <div class=\"menu\"></div>\n </slot>\n";
3894
- var gc = /* @__PURE__ */ new WeakMap(), _c = /* @__PURE__ */ new WeakMap(), vc = /* @__PURE__ */ new WeakMap(), yc = /* @__PURE__ */ new WeakMap(), bc = /* @__PURE__ */ new WeakMap(), xc = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), Sc = class extends HTMLElement {
3895
- constructor() {
3896
- super(), S(this, X), f(this, gc, []), f(this, _c, 2 ** 53 - 1), f(this, vc, null), f(this, yc, []), f(this, bc, null), f(this, xc, null), e(this, "handleEvent", (e) => {
3897
- switch (e.type) {
3898
- case "keydown":
3899
- m(X, this, Oc).call(this, e);
3900
- break;
3901
- }
3902
- }), this.attachShadow({ mode: "open" }).appendChild(hc.content.cloneNode(!0));
3903
- }
3904
- connectedCallback() {
3905
- let e = this.getRootNode();
3906
- if (e instanceof ShadowRoot) {
3907
- var t;
3908
- p(bc, this, e.host.closest("vindral-controller")), (t = h(bc, this)) == null || t.connectListener(this), m(X, this, Cc).call(this), m(X, this, wc).call(this), p(xc, this, e.host), this.addEventListener("keydown", this);
3909
- }
3910
- }
3911
- disconnectedCallback() {
3912
- var e;
3913
- (e = h(bc, this)) == null || e.disconnectListener(this), this.removeEventListener("keydown", this);
3914
- }
3915
- attributeChangedCallback(e, t, n) {
3916
- t !== n && (e === g.RENDITION_LEVELS && n && (this.list = JSON.parse(n)), e === g.MAX_VIDEO_BITRATE && n && (this.maxVideoBitrate = n ? parseInt(n, 10) : 2 ** 53 - 1));
3917
- }
3918
- set list(e) {
3919
- p(gc, this, e), m(X, this, wc).call(this);
3920
- }
3921
- set maxVideoBitrate(e) {
3922
- p(_c, this, e), m(X, this, Ec).call(this);
3923
- }
3924
- get keysUsed() {
3925
- return [
3926
- "Enter",
3927
- "Escape",
3928
- "Tab",
3929
- " ",
3930
- "ArrowDown",
3931
- "ArrowUp",
3932
- "Home",
3933
- "End"
3934
- ];
3935
- }
3936
- focus() {
3937
- var e;
3938
- (e = h(vc, this)) == null || e.focus();
3939
- }
3940
- };
3941
- function Cc() {
3942
- new IntersectionObserver((e) => {
3943
- e.forEach((e) => {
3944
- if (e.intersectionRatio !== 1) if (e.intersectionRatio > 0) {
3945
- let t = this.offsetHeight * e.intersectionRatio - 24;
3946
- this.style.height = `${t}px`;
3947
- } else this.style.height = "auto";
3948
- });
3949
- }, {
3950
- root: h(bc, this),
3951
- threshold: 0
3952
- }).observe(this);
3953
- }
3954
- function wc() {
3955
- var e;
3956
- let t = (e = this.shadowRoot) == null ? void 0 : e.querySelector(".menu");
3957
- t && (p(yc, this, []), t.innerHTML = "", h(gc, this).sort((e, t) => {
3958
- var n, r;
3959
- return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
3960
- }).forEach((e) => {
3961
- var n, r, i, a, o, s, c, l;
3962
- let u = document.createElement("div");
3963
- u.setAttribute("role", "menuitem"), u.setAttribute("value", String((n = e.video) == null ? void 0 : n.height)), u.classList.add("menu-item"), u.tabIndex = -1;
3964
- let ee = m(X, this, Tc).call(this, (r = e.video) == null ? void 0 : r.frameRate);
3965
- u.textContent = e.video ? me(e.video) : "";
3966
- let d = document.createElement("span");
3967
- d.classList.add("menu-item-subtitle"), d.textContent = `${he(((i = (a = e.video) == null ? void 0 : a.bitRate) == null ? 0 : i) + ((o = (s = e.audio) == null ? void 0 : s.bitRate) == null ? 0 : o))}, ${ee}p`, u.appendChild(d), u.addEventListener("click", () => m(X, this, Dc).call(this, e)), h(yc, this).push({
3968
- el: u,
3969
- id: (c = (l = e.video) == null ? void 0 : l.id) == null ? -1 : c
3970
- }), t.appendChild(u);
3971
- }), m(X, this, Ec).call(this));
3972
- }
3973
- function Tc(e) {
3974
- return e ? e[0] % e[1] === 0 ? (e[0] / e[1]).toString() : (e[0] / e[1]).toFixed(2) : "";
3975
- }
3976
- function Ec() {
3977
- h(vc, this) && (h(vc, this).removeAttribute("aria-selected"), h(vc, this).tabIndex = -1);
3978
- let e = h(gc, this).sort((e, t) => {
3979
- var n, r;
3980
- return (n = e.video) != null && n.bitRate && (r = t.video) != null && r.bitRate ? t.video.bitRate - e.video.bitRate : 0;
3981
- }), t = h(gc, this).filter((e) => {
3982
- var t;
3983
- return ((t = e.video) == null ? void 0 : t.bitRate) && e.video.bitRate <= h(_c, this);
3984
- })[0] || e[e.length - 1];
3985
- if (t) {
3986
- let e = h(yc, this).find((e) => {
3987
- var n;
3988
- return e.id === ((n = t.video) == null ? void 0 : n.id);
3989
- });
3990
- e && (e.el.tabIndex = 0, e.el.setAttribute("aria-selected", "true"), p(vc, this, e.el));
3991
- }
3992
- }
3993
- function Dc(e) {
3994
- this.dispatchEvent(new Event("change", {
3995
- bubbles: !0,
3996
- composed: !0
3997
- })), this.dispatchEvent(new CustomEvent(x.SET_RENDITION, {
3998
- bubbles: !0,
3999
- composed: !0,
4000
- detail: e
4001
- }));
4002
- }
4003
- function Oc(e) {
4004
- let { key: t, ctrlKey: n, altKey: r, metaKey: i } = e;
4005
- if (!(n || r || i) && this.keysUsed.includes(t)) if (e.preventDefault(), e.stopPropagation(), t === "Tab" || t === "Escape") {
4006
- var a;
4007
- (a = h(xc, this)) == null || a.hide();
4008
- } else if (t === "Enter" || t === " ") {
4009
- var o;
4010
- (o = m(X, this, Ac).call(this)) == null || (o = o.el) == null || o.click();
4011
- } else m(X, this, kc).call(this, e);
4012
- }
4013
- function kc(e) {
4014
- var t;
4015
- let { key: n } = e, r = h(yc, this), i = (t = m(X, this, Ac).call(this)) == null ? r[0] : t;
4016
- if (!i) return;
4017
- let a = r.indexOf(i), o = Math.max(0, a);
4018
- n === "ArrowDown" ? o++ : n === "ArrowUp" ? o-- : e.key === "Home" ? o = 0 : e.key === "End" && (o = r.length - 1), o < 0 && (o = r.length - 1), o > r.length - 1 && (o = 0);
4019
- let s = r[o];
4020
- s && (m(X, this, jc).call(this, s.id), s.el.focus());
4021
- }
4022
- function Ac() {
4023
- return h(yc, this).find((e) => e.el.tabIndex === 0);
4024
- }
4025
- function jc(e) {
4026
- for (let t of h(yc, this)) t.el.tabIndex = t.id === e ? 0 : -1;
4027
- }
4028
- e(Sc, "observedAttributes", [g.RENDITION_LEVELS, g.MAX_VIDEO_BITRATE]);
4029
- //#endregion
4030
- //#region ../../libs/player-next/src/components/ScrollOverlay.ts
4031
- var Mc = document.createElement("template");
4032
- Mc.innerHTML = `
4033
- <style>
4034
- :host {
4035
- --scroll-overlay-offset: var(--vindral-scroll-overlay-offset, 0px);
4036
-
4037
- position: absolute;
4038
- top: 0;
4039
- width: 100%;
4040
- height: 100%;
4041
- overflow-y: scroll !important;
4042
- pointer-events: none !important;
4043
- display: block;
4044
- transition: background-color 0.5s ease-in-out;
4045
- -ms-overflow-style: none;
4046
- scrollbar-width: none;
4047
- }
4048
-
4049
- :host([snap]) {
4050
- scroll-snap-type: y mandatory;
4051
- scroll-behavior: smooth;
4052
- }
4053
-
4054
- :host([snap-touch]) {
4055
- scroll-snap-type: y mandatory;
4056
- scroll-behavior: smooth;
4057
- pointer-events: auto !important;
4058
- }
4059
-
4060
- :host([open]) #scroll-area {
4061
- width: 100%;
4062
- cursor: pointer;
4063
- }
4064
-
4065
- :host([open]) {
4066
- background-color: rgba(0, 0, 0, 0.5);
4067
- }
4068
-
4069
- :host::-webkit-scrollbar {
4070
- display: none;
4071
- }
4072
-
4073
- #scroll-area {
4074
- margin: 0 auto;
4075
- width: 1px;
4076
- height: calc(100% - var(--scroll-overlay-offset));
4077
- pointer-events: auto;
4078
- scroll-snap-align: start;
4079
- min-height: 1px;
4080
- -webkit-tap-highlight-color: transparent;
4081
- }
4082
-
4083
- slot#content {
4084
- display: flex;
4085
- margin: 0 auto;
4086
- width: 100%;
4087
- pointer-events: auto;
4088
- scroll-snap-align: start;
4089
- flex-direction: column;
4090
- }
4091
-
4092
- :host(:not([${g.USER_INTERACTING}])) {
4093
- overflow: hidden !important;
4094
- }
4095
- </style>
4096
-
4097
- <div id="scroll-area"></div>
4098
- <slot id="content"></slot>
4099
- `;
4100
- var Nc = /* @__PURE__ */ new WeakMap(), Pc = /* @__PURE__ */ new WeakMap(), Fc = /* @__PURE__ */ new WeakMap(), Ic = /* @__PURE__ */ new WeakMap(), Lc = /* @__PURE__ */ new WeakMap(), Rc = /* @__PURE__ */ new WeakMap(), zc = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakSet(), Bc = /* @__PURE__ */ new WeakMap(), Vc = class extends HTMLElement {
4101
- constructor() {
4102
- super(), S(this, Z), f(this, Nc, null), f(this, Pc, null), f(this, Fc, !1), f(this, Ic, !1), f(this, Lc, !1), f(this, Rc, () => {
4103
- this.open && (this.open = !1);
4104
- }), f(this, zc, null), e(this, "handleEvent", (e) => {
4105
- switch (e.type) {
4106
- case "touchstart":
4107
- m(Z, this, Uc).call(this, e);
4108
- break;
4109
- case "touchmove":
4110
- m(Z, this, Wc).call(this, e);
4111
- break;
4112
- case "touchend":
4113
- m(Z, this, Gc).call(this, e);
4114
- break;
4115
- }
4116
- }), f(this, Bc, () => {
4117
- let e = h(Lc, this);
4118
- if (this.scrollTop === 0) {
4119
- m(Z, this, $c).call(this, e);
4120
- return;
4121
- }
4122
- if (!e && !m(Z, this, Kc).call(this)) {
4123
- m(Z, this, Zc).call(this), m(Z, this, $c).call(this);
4124
- return;
4125
- }
4126
- !this.visible && this.scrollTop > 0 && !h(Fc, this) ? m(Z, this, el).call(this) : !h(Fc, this) && m(Z, this, Jc).call(this) && (this.open || (this.open = !0), e && !this.hasAttribute("snap-touch") && this.setAttribute("snap-touch", ""));
4127
- }), this.attachShadow({ mode: "open" }).appendChild(Mc.content.cloneNode(!0));
4128
- }
4129
- connectedCallback() {
4130
- let e = this.getRootNode();
4131
- if (e instanceof Document || e instanceof ShadowRoot) {
4132
- var t, n, r;
4133
- p(Nc, this, e.querySelector("vindral-controller")), (t = h(Nc, this)) == null || t.connectListener(this), p(Pc, this, (n = this.shadowRoot) == null ? void 0 : n.querySelector("#scroll-area")), (r = h(Pc, this)) == null || r.addEventListener("click", h(Rc, this));
4134
- let s = this.hasAttribute("touch-enabled");
4135
- if (p(Lc, this, d() && s), !h(Lc, this)) this.setAttribute("snap", "");
4136
- else {
4137
- var i, a, o;
4138
- (i = h(Nc, this)) == null || i.addEventListener("touchstart", this, { passive: !0 }), (a = h(Nc, this)) == null || a.addEventListener("touchmove", this, { passive: !1 }), (o = h(Nc, this)) == null || o.addEventListener("touchend", this, { passive: !0 });
4139
- }
4140
- this.addEventListener("scroll", h(Bc, this));
4141
- }
4142
- }
4143
- disconnectedCallback() {
4144
- var e, t, n, r, i;
4145
- (e = h(Pc, this)) == null || e.removeEventListener("click", h(Rc, this)), this.removeEventListener("scroll", h(Bc, this)), (t = h(Nc, this)) == null || t.removeEventListener("touchstart", this), (n = h(Nc, this)) == null || n.removeEventListener("touchmove", this), (r = h(Nc, this)) == null || r.removeEventListener("touchend", this), (i = h(Nc, this)) == null || i.disconnectListener(this);
4146
- }
4147
- attributeChangedCallback(e, t, n) {
4148
- if (t !== n && (e === g.USER_INTERACTING && n === null && m(Z, this, qc).call(this) && setTimeout(() => {
4149
- this.open = !1;
4150
- }, 300), e === "open")) if (n !== null) {
4151
- var r;
4152
- p(Fc, this, !1), this.scrollTop > 0 && m(Z, this, el).call(this), this.scrollTo({
4153
- top: (r = h(Pc, this)) == null ? void 0 : r.clientHeight,
4154
- behavior: "smooth"
4155
- });
4156
- } else m(Z, this, Qc).call(this);
4157
- }
4158
- set open(e) {
4159
- if (e) {
4160
- this.setAttribute("open", "");
4161
- return;
4162
- }
4163
- let t = this.hasAttribute("open"), n = this.visible || m(Z, this, qc).call(this);
4164
- t ? this.removeAttribute("open") : n ? m(Z, this, Qc).call(this) : (p(Fc, this, !1), this.removeAttribute("snap-touch"));
4165
- }
4166
- get open() {
4167
- return this.hasAttribute("open");
4168
- }
4169
- set visible(e) {
4170
- e ? this.setAttribute("visible", "") : this.removeAttribute("visible");
4171
- }
4172
- get visible() {
4173
- return this.hasAttribute("visible");
4174
- }
4175
- };
4176
- function Hc() {
4177
- return m(Z, this, Kc).call(this) || m(Z, this, Xc).call(this) || m(Z, this, qc).call(this);
4178
- }
4179
- function Uc(e) {
4180
- let t = e.touches[0];
4181
- t && (p(Ic, this, m(Z, this, Hc).call(this)), h(Ic, this) && (p(Fc, this, !1), p(zc, this, t.clientY)));
4182
- }
4183
- function Wc(e) {
4184
- if (!(!h(Ic, this) || h(zc, this) === null || this.hasAttribute("snap-touch") && this.open) && (e.preventDefault(), e.touches[0])) {
4185
- let t = e.touches[0].clientY, n = h(zc, this) - t;
4186
- this.scrollTop = Math.max(0, n);
4187
- }
4188
- }
4189
- function Gc(e) {
4190
- h(Ic, this) && !h(Fc, this) && m(Z, this, qc).call(this) && (!this.hasAttribute("snap-touch") || !this.open) && (this.open = !0), p(zc, this, null), p(Ic, this, !1);
4191
- }
4192
- function Kc() {
4193
- return this.hasAttribute(g.USER_INTERACTING);
4194
- }
4195
- function qc() {
4196
- return this.scrollTop > 0;
4197
- }
4198
- function Jc() {
4199
- var e;
4200
- return Math.round(this.scrollTop) === this.scrollHeight - this.clientHeight || Math.round(this.scrollTop) === ((e = h(Pc, this)) == null ? void 0 : e.clientHeight);
4201
- }
4202
- function Yc() {
4203
- var e;
4204
- let t = (e = h(Pc, this)) == null ? void 0 : e.clientHeight;
4205
- return !t || this.clientHeight <= 0 ? 0 : Math.max(this.clientHeight - t, 0);
4206
- }
4207
- function Xc() {
4208
- let e = getComputedStyle(this), t = Number.parseFloat(e.getPropertyValue("--vindral-scroll-overlay-offset"));
4209
- return Number.isNaN(t) ? m(Z, this, Yc).call(this) > 0 : t > 0;
4210
- }
4211
- function Zc() {
4212
- let e = this.style.scrollBehavior;
4213
- this.style.scrollBehavior = "auto", this.scrollTo({
4214
- top: 0,
4215
- behavior: "auto"
4216
- }), this.style.scrollBehavior = e;
4217
- }
4218
- function Qc() {
4219
- p(Fc, this, !0), this.removeAttribute("snap-touch"), m(Z, this, tl).call(this), this.scrollTo({
4220
- top: 0,
4221
- behavior: "smooth"
4222
- });
4223
- }
4224
- function $c(e = !1) {
4225
- this.open = !1, e && this.removeAttribute("snap-touch"), p(Fc, this, !1), m(Z, this, tl).call(this);
4226
- }
4227
- function el() {
4228
- this.visible || (this.visible = !0, this.dispatchEvent(new CustomEvent(x.LOCK_UI, {
4229
- bubbles: !0,
4230
- composed: !0
4231
- })));
4232
- }
4233
- function tl() {
4234
- this.visible && (this.visible = !1, this.dispatchEvent(new CustomEvent(x.UNLOCK_UI, {
4235
- bubbles: !0,
4236
- composed: !0
4237
- })));
4238
- }
4239
- e(Vc, "observedAttributes", [
4240
- g.USER_INTERACTING,
4241
- "open",
4242
- "touch-enabled"
4243
- ]);
4244
- //#endregion
4245
- //#region ../../libs/player-next/src/components/SeekBar.ts
4246
- var nl = 1e3, rl = 8, il = document.createElement("template");
4247
- il.innerHTML = `
4248
- <style>
4249
- :host {
4250
- --buffered: 0;
4251
- --vindral-range-thickness: 3px;
4252
- --vindral-range-hover-thickness: 5px;
4253
- --vindral-range-thumb-size: 10px;
4254
- --vindral-range-thumb-hover-size: 15px;
4255
- --vindral-range-fill-color: linear-gradient(
4256
- 90deg,
4257
- #03a9f4 0%,
4258
- #03a9f4 calc(100% - min(20%, 150px)),
4259
- #b3e5fc 100%
4260
- );
4261
- --vindral-range-thumb-color: #03a9f4;
4262
- display: var(--seek-bar-display);
4263
- position: relative;
4264
- }
4265
-
4266
- :host([data-no-duration]) {
4267
- display: none;
4268
- }
4269
-
4270
- #hover-preview {
4271
- position: absolute;
4272
- background-color: rgba(255, 255, 255, 0.6);
4273
- opacity: 0;
4274
- pointer-events: none;
4275
- z-index: 1;
4276
- }
4277
-
4278
- #time-tooltip {
4279
- ${_e}
4280
- position: absolute;
4281
- bottom: 100%;
4282
- left: 50%;
4283
- transform: translateX(-50%) translateY(-8px);
4284
- opacity: 0;
4285
- pointer-events: none;
4286
- transition: opacity 0.2s;
4287
- z-index: 10;
4288
- }
4289
-
4290
- @media (hover: none) {
4291
- #time-tooltip {
4292
- display: none;
4293
- }
4294
- }
4295
-
4296
- #markers {
4297
- position: absolute;
4298
- top: 0;
4299
- left: 0;
4300
- width: 100%;
4301
- height: 100%;
4302
- pointer-events: none;
4303
- z-index: 2;
4304
- }
4305
-
4306
- .marker {
4307
- position: absolute;
4308
- top: calc(50% - var(--vindral-seek-bar-marker-size, 6px) / 2);
4309
- width: var(--vindral-seek-bar-marker-size, 6px);
4310
- height: var(--vindral-seek-bar-marker-size, 6px);
4311
- border-radius: 50%;
4312
- transform: translateX(-50%);
4313
- background: var(--vindral-seek-bar-marker-color, #ffffff);
4314
- }
4315
- </style>
4316
-
4317
- <div id="buffered-track"></div>
4318
- <div id="hover-preview"></div>
4319
- <div id="markers"></div>
4320
- <div id="time-tooltip"></div>
4321
- `;
4322
- var Q = /* @__PURE__ */ new WeakMap(), al = /* @__PURE__ */ new WeakMap(), ol = /* @__PURE__ */ new WeakMap(), sl = /* @__PURE__ */ new WeakMap(), cl = /* @__PURE__ */ new WeakMap(), ll = /* @__PURE__ */ new WeakMap(), ul = /* @__PURE__ */ new WeakMap(), dl = /* @__PURE__ */ new WeakMap(), fl = /* @__PURE__ */ new WeakMap(), pl = /* @__PURE__ */ new WeakMap(), ml = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakSet(), hl = /* @__PURE__ */ new WeakMap(), gl = /* @__PURE__ */ new WeakMap(), _l = /* @__PURE__ */ new WeakMap(), vl = /* @__PURE__ */ new WeakMap(), yl = /* @__PURE__ */ new WeakMap(), bl = /* @__PURE__ */ new WeakMap(), xl = class extends Ci {
4323
- constructor() {
4324
- var e, t, n, r;
4325
- super(), S(this, $), f(this, Q, void 0), f(this, al, void 0), f(this, ol, void 0), f(this, sl, void 0), f(this, cl, []), f(this, ll, null), f(this, ul, !1), f(this, dl, null), f(this, fl, null), f(this, pl, !1), f(this, ml, !1), f(this, hl, (e) => {
4326
- if (!m($, this, wl).call(this) || m($, this, Tl).call(this)) {
4327
- e.preventDefault();
4328
- return;
4329
- }
4330
- p(ul, this, !0), p(fl, this, e.pointerId);
4331
- try {
4332
- this.setPointerCapture(e.pointerId);
4333
- } catch (e) {}
4334
- m($, this, Nl).call(this, e);
4335
- }), f(this, gl, (e) => {
4336
- if (!(!m($, this, wl).call(this) || m($, this, Tl).call(this))) {
4337
- if (h(dl, this) && (cancelAnimationFrame(h(dl, this)), p(dl, this, null)), h(ul, this) && e.pointerId === h(fl, this)) {
4338
- e.preventDefault(), m($, this, Nl).call(this, e);
4339
- return;
4340
- }
4341
- p(dl, this, requestAnimationFrame(() => {
4342
- var t;
4343
- if (e.pointerType !== "mouse" || h(ul, this) || !this.duration) {
4344
- h(ol, this).style.opacity = "0", p(dl, this, null);
4345
- return;
4346
- }
4347
- let n = m($, this, Ml).call(this, e.clientX), r = m($, this, Al).call(this, n), i = (t = r == null ? void 0 : r.position) == null ? n : t;
4348
- if (m($, this, Fl).call(this, i, r), i > this.range.valueAsNumber) {
4349
- let e = this.range.valueAsNumber * 100, t = (i - this.range.valueAsNumber) * 100;
4350
- h(ol, this).style.transform = `translateX(${e}%) scaleX(${t / 100})`, h(ol, this).style.opacity = "1";
4351
- } else h(ol, this).style.opacity = "0";
4352
- p(dl, this, null);
4353
- }));
4354
- }
4355
- }), f(this, _l, (e) => {
4356
- if (e.pointerId === h(fl, this)) {
4357
- try {
4358
- this.releasePointerCapture(e.pointerId);
4359
- } catch (e) {}
4360
- p(ul, this, !1), p(fl, this, null), e.pointerType !== "mouse" && (h(al, this).style.opacity = "0"), h(ml, this) && m($, this, Rl).call(this) && (p(pl, this, !1), p(ml, this, !1));
4361
- }
4362
- }), f(this, vl, () => {
4363
- this.duration && !m($, this, Tl).call(this) && (h(al, this).style.opacity = "1");
4364
- }), f(this, yl, () => {
4365
- h(al, this).style.opacity = "0", h(ol, this).style.opacity = "0";
4366
- }), f(this, bl, (e) => {
4367
- if (m($, this, Tl).call(this) || !h(Q, this) || h(Q, this) <= 0 || !Number.isFinite(h(Q, this))) return;
4368
- let t = m($, this, Sl).call(this);
4369
- if (t <= 0) return;
4370
- let n = this.range.valueAsNumber * t, r = n;
4371
- switch (e.preventDefault(), e.key) {
4372
- case "ArrowLeft":
4373
- r = Math.max(0, n - 5);
4374
- break;
4375
- case "ArrowRight":
4376
- if (m($, this, Rl).call(this)) return;
4377
- r = Math.min(t, n + 5);
4378
- break;
4379
- case "Home":
4380
- r = 0;
4381
- break;
4382
- case "End":
4383
- if (m($, this, Rl).call(this)) return;
4384
- r = t;
4385
- break;
4386
- default: return;
4387
- }
4388
- let i = Math.min(r / t, 1);
4389
- m($, this, Pl).call(this, i);
4390
- }), (e = this.shadowRoot) == null || e.appendChild(il.content.cloneNode(!0)), p(al, this, (t = this.shadowRoot) == null ? void 0 : t.getElementById("time-tooltip")), p(ol, this, (n = this.shadowRoot) == null ? void 0 : n.getElementById("hover-preview")), p(sl, this, (r = this.shadowRoot) == null ? void 0 : r.getElementById("markers")), this.addEventListener("pointerdown", h(hl, this)), this.addEventListener("pointermove", h(gl, this)), this.addEventListener("pointerup", h(_l, this)), this.addEventListener("pointercancel", h(_l, this)), this.addEventListener("mouseenter", h(vl, this)), this.addEventListener("mouseleave", h(yl, this));
4391
- }
4392
- connectedCallback() {
4393
- super.connectedCallback(), this.setAttribute("aria-label", "Seek video position"), this.setAttribute("role", "slider"), m($, this, jl).call(this), this.addEventListener("keydown", h(bl, this)), m($, this, Rl).call(this) && (this.range.value = "1", m($, this, jl).call(this)), m($, this, El).call(this), m($, this, Ol).call(this);
4394
- }
4395
- disconnectedCallback() {
4396
- super.disconnectedCallback(), m($, this, kl).call(this), this.removeEventListener("pointerdown", h(hl, this)), this.removeEventListener("pointermove", h(gl, this)), this.removeEventListener("pointerup", h(_l, this)), this.removeEventListener("pointercancel", h(_l, this)), this.removeEventListener("mouseenter", h(vl, this)), this.removeEventListener("mouseleave", h(yl, this)), this.removeEventListener("keydown", h(bl, this)), p(fl, this, null);
4397
- }
4398
- attributeChangedCallback(e, t, n) {
4399
- if (super.attributeChangedCallback(e, t, n), t !== n) switch (e) {
4400
- case g.TIMESHIFT_POSITION:
4401
- if (m($, this, Rl).call(this)) {
4402
- h(ul, this) ? p(ml, this, !0) : (p(pl, this, !1), p(ml, this, !1)), this.range.value = "1", m($, this, jl).call(this);
4403
- return;
4404
- }
4405
- if (h(Q, this)) {
4406
- p(ml, this, !1);
4407
- let e = Math.max(parseFloat(n) / h(Q, this), 0);
4408
- this.range.value = e.toString(), m($, this, jl).call(this);
4409
- }
4410
- break;
4411
- case g.DURATION:
4412
- p(Q, this, parseFloat(n) || 0), m($, this, jl).call(this), m($, this, El).call(this), m($, this, Ol).call(this);
4413
- break;
4414
- case g.TIMELINE_MARKERS:
4415
- p(cl, this, Br(n)), m($, this, El).call(this), m($, this, Ol).call(this);
4416
- break;
4417
- }
4418
- }
4419
- get keysUsed() {
4420
- return [
4421
- ...super.keysUsed,
4422
- "Home",
4423
- "End"
4424
- ];
4425
- }
4426
- get duration() {
4427
- return h(Q, this);
4428
- }
4429
- set duration(e) {
4430
- this.setAttribute(g.DURATION, e.toString());
4431
- }
4432
- };
4433
- function Sl() {
4434
- return h(Q, this) ? h(Q, this) : 1;
4435
- }
4436
- function Cl() {
4437
- let e = h(Q, this);
4438
- return e !== void 0 && e > 0 && Number.isFinite(e) ? e : void 0;
4439
- }
4440
- function wl() {
4441
- return m($, this, Cl).call(this) !== void 0;
4442
- }
4443
- function Tl() {
4444
- return h(pl, this);
4445
- }
4446
- function El() {
4447
- var e;
4448
- let t = Date.now(), n = (e = h(Q, this)) == null ? 0 : e, r = h(sl, this).children, i = 0;
4449
- for (let e of h(cl, this)) {
4450
- let a = Vr(e.time, t, n);
4451
- if (a === null) continue;
4452
- let o = r[i];
4453
- o || (o = document.createElement("div"), o.className = "marker", h(sl, this).appendChild(o)), o.style.left = `${a * 100}%`, o.dataset.label = e.label, e.type ? o.dataset.type = e.type : delete o.dataset.type, i++;
4454
- }
4455
- for (; h(sl, this).children.length > i;) {
4456
- var a;
4457
- (a = h(sl, this).lastElementChild) == null || a.remove();
4458
- }
4459
- }
4460
- function Dl() {
4461
- let e = m($, this, Cl).call(this);
4462
- if (e === void 0) return !1;
4463
- let t = Date.now() - e * 1e3;
4464
- return h(cl, this).some((e) => e.time >= t);
4465
- }
4466
- function Ol() {
4467
- this.isConnected && m($, this, Dl).call(this) ? h(ll, this) === null && p(ll, this, window.setInterval(() => {
4468
- m($, this, El).call(this), m($, this, Ol).call(this);
4469
- }, nl)) : m($, this, kl).call(this);
4470
- }
4471
- function kl() {
4472
- h(ll, this) !== null && (window.clearInterval(h(ll, this)), p(ll, this, null));
4473
- }
4474
- function Al(e) {
4475
- if (h(cl, this).length === 0 || !h(Q, this)) return null;
4476
- let t = this.getBoundingClientRect().width;
4477
- if (!t) return null;
4478
- let n = rl / t, r = Date.now(), i = null;
4479
- for (let t of h(cl, this)) {
4480
- let a = Vr(t.time, r, h(Q, this));
4481
- if (a === null) continue;
4482
- let o = Math.abs(a - e);
4483
- o > n || (!i || o < Math.abs(i.position - e)) && (i = {
4484
- position: a,
4485
- marker: t
4486
- });
4487
- }
4488
- return i;
4489
- }
4490
- function jl() {
4491
- let e = m($, this, Sl).call(this);
4492
- !h(Q, this) || h(Q, this) <= 0 || !Number.isFinite(h(Q, this)) ? this.setAttribute("data-no-duration", "") : this.removeAttribute("data-no-duration"), h(ul, this) || (this.updateBar(), this.setAttribute("aria-valuetext", `${m($, this, zl).call(this, this.range.valueAsNumber * e)} of ${m($, this, zl).call(this, e)}`), !h(ul, this) && !m($, this, Tl).call(this) && m($, this, Ll).call(this, this.range.valueAsNumber));
4493
- }
4494
- function Ml(e) {
4495
- let t = this.getBoundingClientRect(), n = (e - t.left) / t.width;
4496
- return Math.max(0, Math.min(1, n));
4497
- }
4498
- function Nl(e) {
4499
- var t;
4500
- let n = m($, this, Ml).call(this, e.clientX), r = m($, this, Al).call(this, n), i = (t = r == null ? void 0 : r.position) == null ? n : t;
4501
- m($, this, Fl).call(this, i, r), h(ul, this) || (h(al, this).style.opacity = "1"), m($, this, Pl).call(this, i);
4502
- }
4503
- function Pl(e) {
4504
- if (m($, this, Tl).call(this) || m($, this, Ll).call(this, e)) return;
4505
- let t = e * m($, this, Sl).call(this);
4506
- this.range.value = e.toString(), this.updateBar(), m($, this, Il).call(this, t);
4507
- }
4508
- function Fl(e, t) {
4509
- if (!h(Q, this) || !Number.isFinite(h(Q, this))) return;
4510
- let n = e * h(Q, this), r = h(Q, this) - n, i = `-${m($, this, zl).call(this, r)}`;
4511
- h(al, this).textContent = t ? `${t.marker.label}: ${i}` : i, h(al, this).style.left = `${Math.min(Math.max(e * 100, 2), 98)}%`;
4512
- }
4513
- function Il(e) {
4514
- this.dispatchEvent(new CustomEvent("seek", {
4515
- bubbles: !0,
4516
- composed: !0,
4517
- detail: e
4518
- }));
4519
- }
4520
- function Ll(e) {
4521
- return h(pl, this) || m($, this, Rl).call(this) || e < .999 ? !1 : (p(pl, this, !0), p(ml, this, !1), this.dispatchEvent(new CustomEvent(x.GO_LIVE, {
4522
- bubbles: !0,
4523
- composed: !0
4524
- })), !0);
4525
- }
4526
- function Rl() {
4527
- return !this.hasAttribute(g.TIMESHIFT_POSITION);
4528
- }
4529
- function zl(e) {
4530
- let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
4531
- return h(Q, this) && h(Q, this) >= 3600 ? `${t}:${n.toString().padStart(2, "0")}:${r.toString().padStart(2, "0")}` : `${n}:${r.toString().padStart(2, "0")}`;
4532
- }
4533
- e(xl, "observedAttributes", [
4534
- ...Ci.observedAttributes,
4535
- g.TIMESHIFT_POSITION,
4536
- g.DURATION,
4537
- g.TIMELINE_MARKERS
4538
- ]);
4539
- //#endregion
4540
- //#region ../../libs/player-next/src/components/UserInputPlayOverlay.ts
4541
- var Bl = document.createElement("template");
4542
- Bl.innerHTML = `
4543
- <style>
4544
- :host {
4545
- display: var(--play-overlay-display);
4546
- align-items: center;
4547
- justify-content: center;
4548
- position: absolute;
4549
- top: 0;
4550
- bottom: 0;
4551
- left: 0;
4552
- right: 0;
4553
- z-index: 1;
4554
- pointer-events: none;
4555
- }
4556
-
4557
- :host([hidden]) {
4558
- display: none;
4559
- }
4560
-
4561
- /* Make icon slots clickable */
4562
- slot[name="play"],
4563
- slot[name="unmute"] {
4564
- color: var(--fg-strong);
4565
- pointer-events: auto;
4566
- cursor: pointer;
4567
- }
4568
-
4569
- :host(:focus-visible) svg {
4570
- box-shadow: inset 0 0 0 2px var(--fg-strong);
4571
- outline: 0;
4572
- }
4573
-
4574
- :host(:active) svg {
4575
- scale: 0.9;
4576
- }
4577
-
4578
- slot > svg {
4579
- width: var(--play-overlay-icon-size);
4580
- height: var(--play-overlay-icon-size);
4581
- }
4582
-
4583
- :host(:not([${g.NEEDS_USER_INPUT_VIDEO}]):not([${g.PAUSED}])) slot[name="play"] {
4584
- display: none !important;
4585
- }
4586
-
4587
- :host([${g.PAUSED}]) slot[name="unmute"],
4588
- :host(:not([${g.NEEDS_USER_INPUT_AUDIO}])) slot[name="unmute"] {
4589
- display: none !important;
4590
- }
4591
- </style>
4592
-
4593
- <slot name="icon">
4594
- <slot name="play">
4595
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z" /></svg>
4596
- </slot>
4597
- <slot name="unmute">
4598
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><g fill="none" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z" clip-rule="evenodd" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2" /></g></svg>
4599
- </slot>
4600
- </slot>
4601
- `;
4602
- var Vl = /* @__PURE__ */ new WeakMap(), Hl = /* @__PURE__ */ new WeakMap(), Ul = /* @__PURE__ */ new WeakMap(), Wl = /* @__PURE__ */ new WeakMap(), Gl = class extends HTMLElement {
4603
- constructor() {
4604
- super(), f(this, Vl, null), f(this, Hl, () => {
4605
- this.dispatchEvent(new CustomEvent(x.REQUEST_USER_INPUT, {
4606
- bubbles: !0,
4607
- composed: !0
4608
- }));
4609
- }), f(this, Ul, (e) => {
4610
- let { key: t } = e;
4611
- if (!this.keysUsed.includes(t)) {
4612
- this.removeEventListener("keyup", h(Ul, this));
4613
- return;
4614
- }
4615
- this.dispatchEvent(new CustomEvent(x.REQUEST_USER_INPUT, {
4616
- bubbles: !0,
4617
- composed: !0
4618
- }));
4619
- }), f(this, Wl, (e) => {
4620
- let { metaKey: t, altKey: n, key: r } = e;
4621
- if (t || n || !this.keysUsed.includes(r)) {
4622
- this.removeEventListener("keyup", h(Ul, this));
4623
- return;
4624
- }
4625
- this.addEventListener("keyup", h(Ul, this), { once: !0 });
4626
- }), this.attachShadow({ mode: "open" }).appendChild(Bl.content.cloneNode(!0));
4627
- }
4628
- get keysUsed() {
4629
- return ["Enter", " "];
4630
- }
4631
- connectedCallback() {
4632
- var e;
4633
- p(Vl, this, this.closest("vindral-controller")), (e = h(Vl, this)) == null || e.connectListener(this), this.setAttribute("aria-label", "Play"), this.setAttribute("role", "button"), this.enable();
4634
- }
4635
- enable() {
4636
- this.addEventListener("click", h(Hl, this)), this.addEventListener("keydown", h(Wl, this)), this.tabIndex = 0;
4637
- }
4638
- disable() {
4639
- this.removeEventListener("click", h(Hl, this)), this.removeEventListener("keydown", h(Wl, this)), this.removeEventListener("keyup", h(Ul, this)), this.tabIndex = -1;
4640
- }
4641
- disconnectedCallback() {
4642
- var e;
4643
- (e = h(Vl, this)) == null || e.disconnectListener(this), this.disable();
4644
- }
4645
- };
4646
- e(Gl, "observedAttributes", [
4647
- "hidden",
4648
- g.NEEDS_USER_INPUT_VIDEO,
4649
- g.NEEDS_USER_INPUT_AUDIO,
4650
- g.PAUSED
4651
- ]);
4652
- //#endregion
4653
- //#region ../../libs/player-next/src/components/VindralCenterOverlay.ts
4654
- var Kl = document.createElement("template");
4655
- Kl.innerHTML = "\n <style>\n :host {\n position: absolute;\n inset: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 16px;\n pointer-events: none;\n z-index: 1;\n }\n\n :host::before {\n content: \"\";\n position: absolute;\n inset: 0;\n z-index: -1;\n background-color: rgba(0, 0, 0, 0.3);\n background-image: var(--_backdrop-image, none);\n background-repeat: no-repeat;\n background-position: 50% 50%;\n background-size: contain;\n pointer-events: none;\n opacity: 0;\n transition: opacity 100ms;\n }\n\n :host([backdrop]:not([disable-backdrop]))::before {\n opacity: 1;\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host::before {\n transition: none;\n }\n }\n </style>\n\n <slot></slot>\n";
4656
- var ql = class extends HTMLElement {
4657
- constructor() {
4658
- super(), this.attachShadow({ mode: "open" }).appendChild(Kl.content.cloneNode(!0));
4659
- }
4660
- attributeChangedCallback(e, t, n) {
4661
- t !== n && e === "poster" && this.style.setProperty("--_backdrop-image", n ? `url("${n}")` : "none");
4662
- }
4663
- };
4664
- e(ql, "observedAttributes", [
4665
- "backdrop",
4666
- "poster",
4667
- "disable-backdrop"
4668
- ]);
4669
- //#endregion
4670
- //#region ../../libs/player-next/src/components/VindralMessage.ts
4671
- var Jl = document.createElement("template");
4672
- Jl.innerHTML = "\n <style>\n :host {\n display: flex;\n flex-direction: column;\n align-items: center;\n max-width: 90%;\n color: var(--fg-strong);\n font-size: 20px;\n pointer-events: none;\n opacity: 1;\n transition:\n opacity 100ms,\n display 100ms allow-discrete;\n }\n\n :host([hidden]) {\n display: none;\n opacity: 0;\n }\n\n @starting-style {\n :host(:not([hidden])) {\n opacity: 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host {\n transition: none;\n }\n }\n\n #title,\n #description {\n text-align: center;\n text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);\n margin: 0;\n }\n\n #title {\n margin-bottom: var(--padding-2);\n }\n\n @container (max-width: 600px) {\n :host {\n font-size: 15px;\n }\n }\n\n @container (max-width: 400px) {\n :host {\n font-size: 12px;\n }\n #title {\n margin-bottom: 0;\n }\n }\n\n @container (max-width: 150px) {\n :host {\n font-size: 10px;\n }\n #title,\n #description {\n font-size: 1.2em;\n margin: 0;\n }\n }\n </style>\n\n <h1 id=\"title\"></h1>\n <p id=\"description\"></p>\n";
4673
- var Yl = /* @__PURE__ */ new WeakMap(), Xl = /* @__PURE__ */ new WeakMap(), Zl = class extends HTMLElement {
4674
- constructor() {
4675
- super(), f(this, Yl, void 0), f(this, Xl, void 0);
4676
- let e = this.attachShadow({ mode: "open" });
4677
- e.appendChild(Jl.content.cloneNode(!0)), p(Yl, this, e.querySelector("#title")), p(Xl, this, e.querySelector("#description"));
4678
- }
4679
- connectedCallback() {
4680
- this.hasAttribute("role") || (this.setAttribute("role", "alert"), this.setAttribute("aria-atomic", "true"));
4681
- }
4682
- attributeChangedCallback(e, t, n) {
4683
- t !== n && (e === "title" ? h(Yl, this).textContent = n : e === "description" && (h(Xl, this).textContent = n));
4684
- }
4685
- };
4686
- e(Zl, "observedAttributes", [
4687
- "title",
4688
- "description",
4689
- "hidden"
4690
- ]);
4691
- //#endregion
4692
- //#region ../../libs/player-next/src/components/VindralPlayOverlay.ts
4693
- var Ql = document.createElement("template");
4694
- Ql.innerHTML = "\n <style>\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n opacity: 1;\n transition:\n opacity 100ms,\n display 100ms allow-discrete;\n }\n\n :host([hidden]) {\n display: none;\n opacity: 0;\n }\n\n @starting-style {\n :host(:not([hidden])) {\n opacity: 0;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n :host {\n transition: none;\n }\n }\n\n :host(:focus-visible) {\n outline: none;\n outline: 0;\n }\n\n :host(:focus-visible) svg {\n outline: 0;\n }\n\n :host(:where(:focus)) svg {\n box-shadow: none;\n outline: 0;\n }\n\n :host(:active) svg {\n scale: 0.9;\n }\n\n slot#play {\n color: var(--fg-strong);\n pointer-events: auto;\n cursor: pointer;\n }\n\n slot#play > svg {\n width: var(--play-overlay-icon-size);\n height: var(--play-overlay-icon-size);\n }\n </style>\n\n <slot id=\"play\" name=\"icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z\" /></svg>\n</slot>\n";
4695
- var $l = /* @__PURE__ */ new WeakMap(), eu = class extends HTMLElement {
4696
- constructor() {
4697
- super(), f(this, $l, null), this.attachShadow({ mode: "open" }).appendChild(Ql.content.cloneNode(!0));
4698
- }
4699
- connectedCallback() {
4700
- var e;
4701
- p($l, this, this.closest("vindral-controller")), (e = h($l, this)) == null || e.connectListener(this), this.setAttribute("aria-label", "Play"), this.setAttribute("role", "button"), this.tabIndex = 0;
4702
- }
4703
- disconnectedCallback() {
4704
- var e;
4705
- (e = h($l, this)) == null || e.disconnectListener(this);
4706
- }
4707
- attributeChangedCallback(e, t, n) {
4708
- t !== n && e === "hidden" && !_(n) && this.focus();
4709
- }
4710
- };
4711
- e(eu, "observedAttributes", ["hidden"]);
4712
- //#endregion
4713
- //#region ../../libs/player-next/src/components/VolumeRange.ts
4714
- var tu, nu = "Volume", ru = document.createElement("template");
4715
- ru.innerHTML = `
4716
- <style>
4717
- :host {
4718
- display: var(--volume-range-display);
4719
- width: 80px;
4720
- }
4721
-
4722
- @media (hover: hover) and (pointer: fine) {
4723
- :host(:hover) {
4724
- background: rgba(255, 255, 255, 0.15);
4725
- }
4726
- }
4727
-
4728
- :host(:active) {
4729
- background: rgba(255, 255, 255, 0.25);
4730
- }
4731
-
4732
- ${Te}
4733
-
4734
- #range:focus-visible ~ .tooltip {
4735
- opacity: 1;
4736
- visibility: visible;
4737
- transition-delay: 0s;
4738
- }
4739
- </style>
4740
- <span class="tooltip" aria-hidden="true">${nu}</span>
4741
- `;
4742
- var iu = (e) => `${Math.round(e * 100)}%`, au = /* @__PURE__ */ new WeakMap(), ou = /* @__PURE__ */ new WeakMap(), su = /* @__PURE__ */ new WeakMap(), cu = class extends Ci {
4743
- constructor() {
4744
- var e, t;
4745
- super(), f(this, au, void 0), f(this, ou, void 0), f(this, su, () => {
4746
- let e = this.range.valueAsNumber;
4747
- this.dispatchEvent(new CustomEvent(x.SET_VOLUME, {
4748
- bubbles: !0,
4749
- composed: !0,
4750
- detail: e
4751
- }));
4752
- }), (e = this.shadowRoot) == null || e.appendChild(ru.content.cloneNode(!0)), p(au, this, (t = this.shadowRoot) == null ? void 0 : t.querySelector(".tooltip"));
4753
- }
4754
- connectedCallback() {
4755
- super.connectedCallback(), this.range.addEventListener("input", h(su, this)), this.range.setAttribute("aria-label", nu), p(ou, this, De(this, h(au, this)));
4756
- }
4757
- disconnectedCallback() {
4758
- var e;
4759
- super.disconnectedCallback(), this.range.removeEventListener("input", h(su, this)), (e = h(ou, this)) == null || e.call(this);
4760
- }
4761
- attributeChangedCallback(e, t, n) {
4762
- super.attributeChangedCallback(e, t, n), (e === g.MUTED || e === g.VOLUME) && (this.range.valueAsNumber = this.muted ? 0 : parseFloat(this.volume), this.range.setAttribute("aria-valuetext", iu(this.range.valueAsNumber)), this.updateBar());
4763
- }
4764
- get volume() {
4765
- var e;
4766
- return (e = this.getAttribute(g.VOLUME)) == null ? "1" : e;
4767
- }
4768
- get muted() {
4769
- return this.hasAttribute(g.MUTED);
4770
- }
4771
- };
4772
- tu = cu, e(cu, "observedAttributes", [
4773
- ...y(tu, "observedAttributes", tu),
4774
- g.MUTED,
4775
- g.VOLUME
4776
- ]);
4777
- //#endregion
4778
- //#region ../../libs/player-next/src/registerComponents.ts
4779
- function lu() {
4780
- customElements.define("vindral-controller", Oa), customElements.define("vindral-control-bar", Vn), customElements.define("vindral-advanced-rendition-menu", Ye), customElements.define("vindral-advanced-rendition-menu-list", ct), customElements.define("vindral-play-button", us), customElements.define("vindral-mute-button", is), customElements.define("vindral-buffering-overlay", Ft), customElements.define("vindral-scroll-overlay", Vc), customElements.define("vindral-play-overlay", eu), customElements.define("vindral-user-input-play-overlay", Gl), customElements.define("vindral-fullscreen-button", yo), customElements.define("vindral-rendition-levels-menu", pc), customElements.define("vindral-rendition-levels-menu-list", Sc), customElements.define("vindral-channel-grid-button", Pn), customElements.define("vindral-channel-grid", on), customElements.define("vindral-channel-grid-item", Yt), customElements.define("vindral-pip-button", ss), customElements.define("vindral-airplay-button", Ot), customElements.define("vindral-cast-button", zt), customElements.define("vindral-cast-overlay", Gt), customElements.define("vindral-buffering-icon", Mt), customElements.define("vindral-language-menu", wo), customElements.define("vindral-language-menu-list", zo), customElements.define("vindral-center-overlay", ql), customElements.define("vindral-message", Zl), customElements.define("vindral-volume-range", cu), customElements.define("vindral-poster-overlay", ac), customElements.define("vindral-player", Us), customElements.define("vindral-seek-bar", xl), customElements.define("vindral-live-button", ts);
4781
- }
4782
- //#endregion
4783
- export { lu as t };