boss-web-player-sdk 1.1.0

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/dist/index.js ADDED
@@ -0,0 +1,2827 @@
1
+ import { c as e, t, u as n } from "./src-4MqtK4Qy.js";
2
+ import { createContext as r, createElement as i, forwardRef as a, useCallback as o, useContext as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
3
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
4
+ import { createRoot as ee } from "react-dom/client";
5
+ //#region ../ui-controls/src/ErrorScreen.tsx
6
+ function te({ title: e = "Something Went Wrong", subtitle: t = "We encountered an error while playing this video.\nPlease try again.", onRetry: n }) {
7
+ return /* @__PURE__ */ m(f, { children: [
8
+ /* @__PURE__ */ p("div", {
9
+ style: {
10
+ width: 80,
11
+ height: 80,
12
+ borderRadius: "50%",
13
+ background: "rgba(255,255,255,0.08)",
14
+ display: "flex",
15
+ alignItems: "center",
16
+ justifyContent: "center",
17
+ flexShrink: 0
18
+ },
19
+ children: /* @__PURE__ */ m("svg", {
20
+ width: "36",
21
+ height: "36",
22
+ viewBox: "0 0 24 24",
23
+ fill: "none",
24
+ stroke: "rgba(255,255,255,0.85)",
25
+ strokeWidth: "2",
26
+ strokeLinecap: "round",
27
+ strokeLinejoin: "round",
28
+ children: [
29
+ /* @__PURE__ */ p("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
30
+ /* @__PURE__ */ p("line", {
31
+ x1: "12",
32
+ y1: "9",
33
+ x2: "12",
34
+ y2: "13"
35
+ }),
36
+ /* @__PURE__ */ p("line", {
37
+ x1: "12",
38
+ y1: "17",
39
+ x2: "12.01",
40
+ y2: "17"
41
+ })
42
+ ]
43
+ })
44
+ }),
45
+ /* @__PURE__ */ m("div", {
46
+ style: {
47
+ textAlign: "center",
48
+ padding: "0 24px"
49
+ },
50
+ children: [/* @__PURE__ */ p("p", {
51
+ style: {
52
+ color: "#ffffff",
53
+ fontSize: 22,
54
+ fontWeight: 700,
55
+ margin: "0 0 8px",
56
+ letterSpacing: "-0.2px"
57
+ },
58
+ children: e
59
+ }), /* @__PURE__ */ p("p", {
60
+ style: {
61
+ color: "rgba(255,255,255,0.5)",
62
+ fontSize: 14,
63
+ margin: 0,
64
+ lineHeight: 1.6,
65
+ whiteSpace: "pre-line"
66
+ },
67
+ children: t
68
+ })]
69
+ }),
70
+ /* @__PURE__ */ m("button", {
71
+ onClick: n,
72
+ style: {
73
+ display: "flex",
74
+ alignItems: "center",
75
+ gap: 10,
76
+ background: "#ffffff",
77
+ color: "#09090e",
78
+ border: "none",
79
+ borderRadius: 10,
80
+ padding: "14px 32px",
81
+ fontSize: 16,
82
+ fontWeight: 700,
83
+ cursor: "pointer",
84
+ letterSpacing: "-0.1px"
85
+ },
86
+ children: [/* @__PURE__ */ m("svg", {
87
+ width: "20",
88
+ height: "20",
89
+ viewBox: "0 0 24 24",
90
+ fill: "none",
91
+ stroke: "currentColor",
92
+ strokeWidth: "2.5",
93
+ strokeLinecap: "round",
94
+ strokeLinejoin: "round",
95
+ children: [/* @__PURE__ */ p("polyline", { points: "1 4 1 10 7 10" }), /* @__PURE__ */ p("path", { d: "M3.51 15a9 9 0 1 0 .49-3.51" })]
96
+ }), "Retry Now"]
97
+ })
98
+ ] });
99
+ }
100
+ //#endregion
101
+ //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs
102
+ var ne = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), re = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), h = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ie = (e) => {
103
+ let t = h(e);
104
+ return t.charAt(0).toUpperCase() + t.slice(1);
105
+ }, ae = {
106
+ xmlns: "http://www.w3.org/2000/svg",
107
+ width: 24,
108
+ height: 24,
109
+ viewBox: "0 0 24 24",
110
+ fill: "none",
111
+ stroke: "currentColor",
112
+ strokeWidth: 2,
113
+ strokeLinecap: "round",
114
+ strokeLinejoin: "round"
115
+ }, oe = (e) => {
116
+ for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
117
+ return !1;
118
+ }, se = r({}), ce = () => s(se), le = a(({ color: e, size: t, strokeWidth: n, absoluteStrokeWidth: r, className: a = "", children: o, iconNode: s, ...c }, l) => {
119
+ let { size: u = 24, strokeWidth: d = 2, absoluteStrokeWidth: f = !1, color: p = "currentColor", className: m = "" } = ce() ?? {}, ee = r ?? f ? Number(n ?? d) * 24 / Number(t ?? u) : n ?? d;
120
+ return i("svg", {
121
+ ref: l,
122
+ ...ae,
123
+ width: t ?? u ?? ae.width,
124
+ height: t ?? u ?? ae.height,
125
+ stroke: e ?? p,
126
+ strokeWidth: ee,
127
+ className: ne("lucide", m, a),
128
+ ...!o && !oe(c) && { "aria-hidden": "true" },
129
+ ...c
130
+ }, [...s.map(([e, t]) => i(e, t)), ...Array.isArray(o) ? o : [o]]);
131
+ }), g = (e, t) => {
132
+ let n = a(({ className: n, ...r }, a) => i(le, {
133
+ ref: a,
134
+ iconNode: t,
135
+ className: ne(`lucide-${re(ie(e))}`, `lucide-${e}`, n),
136
+ ...r
137
+ }));
138
+ return n.displayName = ie(e), n;
139
+ }, ue = g("airplay", [["path", {
140
+ d: "M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",
141
+ key: "ns4c3b"
142
+ }], ["path", {
143
+ d: "m12 15 5 6H7Z",
144
+ key: "14qnn2"
145
+ }]]), de = g("captions", [["rect", {
146
+ width: "18",
147
+ height: "14",
148
+ x: "3",
149
+ y: "5",
150
+ rx: "2",
151
+ ry: "2",
152
+ key: "12ruh7"
153
+ }], ["path", {
154
+ d: "M7 15h4M15 15h2M7 11h2M13 11h4",
155
+ key: "1ueiar"
156
+ }]]), fe = g("cast", [
157
+ ["path", {
158
+ d: "M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",
159
+ key: "3zrzxg"
160
+ }],
161
+ ["path", {
162
+ d: "M2 12a9 9 0 0 1 8 8",
163
+ key: "g6cvee"
164
+ }],
165
+ ["path", {
166
+ d: "M2 16a5 5 0 0 1 4 4",
167
+ key: "1y1dii"
168
+ }],
169
+ ["line", {
170
+ x1: "2",
171
+ x2: "2.01",
172
+ y1: "20",
173
+ y2: "20",
174
+ key: "xu2jvo"
175
+ }]
176
+ ]), _ = g("check", [["path", {
177
+ d: "M20 6 9 17l-5-5",
178
+ key: "1gmf2c"
179
+ }]]), pe = g("chevron-left", [["path", {
180
+ d: "m15 18-6-6 6-6",
181
+ key: "1wnfg3"
182
+ }]]), me = g("gauge", [["path", {
183
+ d: "m12 14 4-4",
184
+ key: "9kzdfg"
185
+ }], ["path", {
186
+ d: "M3.34 19a10 10 0 1 1 17.32 0",
187
+ key: "19p75a"
188
+ }]]), he = g("languages", [
189
+ ["path", {
190
+ d: "m5 8 6 6",
191
+ key: "1wu5hv"
192
+ }],
193
+ ["path", {
194
+ d: "m4 14 6-6 2-3",
195
+ key: "1k1g8d"
196
+ }],
197
+ ["path", {
198
+ d: "M2 5h12",
199
+ key: "or177f"
200
+ }],
201
+ ["path", {
202
+ d: "M7 2h1",
203
+ key: "1t2jsx"
204
+ }],
205
+ ["path", {
206
+ d: "m22 22-5-10-5 10",
207
+ key: "don7ne"
208
+ }],
209
+ ["path", {
210
+ d: "M14 18h6",
211
+ key: "1m8k6r"
212
+ }]
213
+ ]), ge = g("list-video", [
214
+ ["path", {
215
+ d: "M21 5H3",
216
+ key: "1fi0y6"
217
+ }],
218
+ ["path", {
219
+ d: "M10 12H3",
220
+ key: "1ulcyk"
221
+ }],
222
+ ["path", {
223
+ d: "M10 19H3",
224
+ key: "108z41"
225
+ }],
226
+ ["path", {
227
+ d: "M15 12.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997a1 1 0 0 1-1.517-.86z",
228
+ key: "ms4nik"
229
+ }]
230
+ ]), _e = g("maximize", [
231
+ ["path", {
232
+ d: "M8 3H5a2 2 0 0 0-2 2v3",
233
+ key: "1dcmit"
234
+ }],
235
+ ["path", {
236
+ d: "M21 8V5a2 2 0 0 0-2-2h-3",
237
+ key: "1e4gt3"
238
+ }],
239
+ ["path", {
240
+ d: "M3 16v3a2 2 0 0 0 2 2h3",
241
+ key: "wsl5sc"
242
+ }],
243
+ ["path", {
244
+ d: "M16 21h3a2 2 0 0 0 2-2v-3",
245
+ key: "18trek"
246
+ }]
247
+ ]), ve = g("minimize", [
248
+ ["path", {
249
+ d: "M8 3v3a2 2 0 0 1-2 2H3",
250
+ key: "hohbtr"
251
+ }],
252
+ ["path", {
253
+ d: "M21 8h-3a2 2 0 0 1-2-2V3",
254
+ key: "5jw1f3"
255
+ }],
256
+ ["path", {
257
+ d: "M3 16h3a2 2 0 0 1 2 2v3",
258
+ key: "198tvr"
259
+ }],
260
+ ["path", {
261
+ d: "M16 21v-3a2 2 0 0 1 2-2h3",
262
+ key: "ph8mxp"
263
+ }]
264
+ ]), ye = g("pause", [["rect", {
265
+ x: "14",
266
+ y: "3",
267
+ width: "5",
268
+ height: "18",
269
+ rx: "1",
270
+ key: "kaeet6"
271
+ }], ["rect", {
272
+ x: "5",
273
+ y: "3",
274
+ width: "5",
275
+ height: "18",
276
+ rx: "1",
277
+ key: "1wsw3u"
278
+ }]]), be = g("picture-in-picture", [
279
+ ["path", {
280
+ d: "M2 10h6V4",
281
+ key: "zwrco"
282
+ }],
283
+ ["path", {
284
+ d: "m2 4 6 6",
285
+ key: "ug085t"
286
+ }],
287
+ ["path", {
288
+ d: "M21 10V7a2 2 0 0 0-2-2h-7",
289
+ key: "git5jr"
290
+ }],
291
+ ["path", {
292
+ d: "M3 14v2a2 2 0 0 0 2 2h3",
293
+ key: "1f7fh3"
294
+ }],
295
+ ["rect", {
296
+ x: "12",
297
+ y: "14",
298
+ width: "10",
299
+ height: "7",
300
+ rx: "1",
301
+ key: "1wjs3o"
302
+ }]
303
+ ]), xe = g("play", [["path", {
304
+ d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
305
+ key: "10ikf1"
306
+ }]]), Se = g("rotate-ccw", [["path", {
307
+ d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
308
+ key: "1357e3"
309
+ }], ["path", {
310
+ d: "M3 3v5h5",
311
+ key: "1xhq8a"
312
+ }]]), Ce = g("rotate-cw", [["path", {
313
+ d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",
314
+ key: "1p45f6"
315
+ }], ["path", {
316
+ d: "M21 3v5h-5",
317
+ key: "1q7to0"
318
+ }]]), we = g("signal", [
319
+ ["path", {
320
+ d: "M2 20h.01",
321
+ key: "4haj6o"
322
+ }],
323
+ ["path", {
324
+ d: "M7 20v-4",
325
+ key: "j294jx"
326
+ }],
327
+ ["path", {
328
+ d: "M12 20v-8",
329
+ key: "i3yub9"
330
+ }],
331
+ ["path", {
332
+ d: "M17 20V8",
333
+ key: "1tkaf5"
334
+ }],
335
+ ["path", {
336
+ d: "M22 4v16",
337
+ key: "sih9yq"
338
+ }]
339
+ ]), Te = g("volume-1", [["path", {
340
+ d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
341
+ key: "uqj9uw"
342
+ }], ["path", {
343
+ d: "M16 9a5 5 0 0 1 0 6",
344
+ key: "1q6k2b"
345
+ }]]), Ee = g("volume-2", [
346
+ ["path", {
347
+ d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
348
+ key: "uqj9uw"
349
+ }],
350
+ ["path", {
351
+ d: "M16 9a5 5 0 0 1 0 6",
352
+ key: "1q6k2b"
353
+ }],
354
+ ["path", {
355
+ d: "M19.364 18.364a9 9 0 0 0 0-12.728",
356
+ key: "ijwkga"
357
+ }]
358
+ ]), De = g("volume-x", [
359
+ ["path", {
360
+ d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
361
+ key: "uqj9uw"
362
+ }],
363
+ ["line", {
364
+ x1: "22",
365
+ x2: "16",
366
+ y1: "9",
367
+ y2: "15",
368
+ key: "1ewh16"
369
+ }],
370
+ ["line", {
371
+ x1: "16",
372
+ x2: "22",
373
+ y1: "9",
374
+ y2: "15",
375
+ key: "5ykzw1"
376
+ }]
377
+ ]), Oe = g("volume", [["path", {
378
+ d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
379
+ key: "uqj9uw"
380
+ }]]), ke = 1e4, Ae = (e) => {
381
+ let t = e.match(/#EXT-X-TITLE:(.+)/);
382
+ if (t?.[1]?.trim()) return t[1].trim();
383
+ let n = e.match(/#EXT-X-SESSION-DATA:[^\n]*DATA-ID="[^"]*title[^"]*"[^\n]*VALUE="([^"]+)"/i);
384
+ return n?.[1]?.trim() ? n[1].trim() : null;
385
+ }, je = (e) => {
386
+ if (!e || e.length < 10 || e[0] !== 73 || e[1] !== 68 || e[2] !== 51) return null;
387
+ let t = e[3], n = (e[6] & 127) << 21 | (e[7] & 127) << 14 | (e[8] & 127) << 7 | e[9] & 127, r = Math.min(10 + n, e.length), i = 10;
388
+ for (; i + 10 <= r;) {
389
+ let n = String.fromCharCode(e[i], e[i + 1], e[i + 2], e[i + 3]), a = t >= 4 ? (e[i + 4] & 127) << 21 | (e[i + 5] & 127) << 14 | (e[i + 6] & 127) << 7 | e[i + 7] & 127 : e[i + 4] << 24 | e[i + 5] << 16 | e[i + 6] << 8 | e[i + 7];
390
+ if (a <= 0 || i + 10 + a > r) break;
391
+ if (n === "TIT2") {
392
+ let t = e[i + 10], n = e.slice(i + 11, i + 10 + a), r = (t === 1 || t === 2 ? new TextDecoder("utf-16").decode(n) : new TextDecoder(t === 3 ? "utf-8" : "latin1").decode(n)).replace(/\0/g, "").trim();
393
+ if (r) return r;
394
+ }
395
+ i += 10 + a;
396
+ }
397
+ return null;
398
+ }, Me = ({ size: e = 20 }) => /* @__PURE__ */ m("svg", {
399
+ width: e,
400
+ height: e,
401
+ viewBox: "0 0 24 24",
402
+ fill: "none",
403
+ stroke: "currentColor",
404
+ strokeWidth: "2",
405
+ strokeLinecap: "round",
406
+ strokeLinejoin: "round",
407
+ children: [
408
+ /* @__PURE__ */ p("rect", {
409
+ x: "2",
410
+ y: "5",
411
+ width: "20",
412
+ height: "14",
413
+ rx: "3"
414
+ }),
415
+ /* @__PURE__ */ p("path", { d: "M7 9v6M7 12h3M10 9v6" }),
416
+ /* @__PURE__ */ p("path", { d: "M14 9h1.5a3 3 0 0 1 0 6H14z" })
417
+ ]
418
+ }), Ne = (e) => {
419
+ let t = e.replace("#", "");
420
+ return t.length === 6 ? `${parseInt(t.substring(0, 2), 16)}, ${parseInt(t.substring(2, 4), 16)}, ${parseInt(t.substring(4, 6), 16)}` : t.length === 3 ? `${parseInt(t[0] + t[0], 16)}, ${parseInt(t[1] + t[1], 16)}, ${parseInt(t[2] + t[2], 16)}` : "99, 102, 241";
421
+ }, v = {
422
+ en: "English",
423
+ eng: "English",
424
+ fr: "French",
425
+ fre: "French",
426
+ fra: "French",
427
+ es: "Spanish",
428
+ spa: "Spanish",
429
+ de: "German",
430
+ ger: "German",
431
+ deu: "German",
432
+ it: "Italian",
433
+ ita: "Italian",
434
+ pt: "Portuguese",
435
+ por: "Portuguese",
436
+ ja: "Japanese",
437
+ zh: "Chinese",
438
+ ko: "Korean",
439
+ ru: "Russian",
440
+ ar: "Arabic",
441
+ hi: "Hindi",
442
+ ta: "Tamil",
443
+ tam: "Tamil"
444
+ }, Pe = (e) => {
445
+ if (!e) return null;
446
+ let t = e.trim().toLowerCase(), n = t.match(/^(en|eng|fr|fre|fra|es|spa|de|ger|deu|it|ita|pt|por|ja|zh|ko|ru|ar|hi|ta|tam)/);
447
+ if (n && v[n[0]]) return v[n[0]];
448
+ for (let [e, n] of Object.entries(v)) if (t.includes(e)) return n;
449
+ return /english|anglais|ingles/i.test(t) ? "English" : /french|français/i.test(t) ? "French" : /spanish|español/i.test(t) ? "Spanish" : /german|deutsch/i.test(t) ? "German" : /italian|italiano/i.test(t) ? "Italian" : /portuguese|português/i.test(t) ? "Portuguese" : /japanese|nihongo/i.test(t) ? "Japanese" : /chinese|中文/i.test(t) ? "Chinese" : /korean|한국어/i.test(t) ? "Korean" : /tamil|தமிழ்/i.test(t) ? "Tamil" : /russian|русский/i.test(t) ? "Russian" : /arabic|العربية/i.test(t) ? "Arabic" : /hindi|हिन्दी/i.test(t) ? "Hindi" : null;
450
+ }, y = (e) => {
451
+ if (e.lang) {
452
+ let t = Pe(e.lang);
453
+ if (t) return t;
454
+ }
455
+ if (e.label) {
456
+ let t = e.label.trim(), n = t.split(/[#\d\.\s\-_/|:]+/).filter(Boolean);
457
+ for (let e = n.length - 1; e >= 0; --e) {
458
+ let t = Pe(n[e]);
459
+ if (t) return t;
460
+ }
461
+ let r = t.replace(/^[#\d\.\s]+/, "").trim();
462
+ return Pe(r) || r;
463
+ }
464
+ return "Unknown";
465
+ }, Fe = (e) => {
466
+ let t = /* @__PURE__ */ new Set();
467
+ return e.filter((e) => {
468
+ let n = `${y(e).toLowerCase()}|${(e.lang || "").trim().toLowerCase()}`;
469
+ return t.has(n) ? !1 : (t.add(n), !0);
470
+ });
471
+ }, Ie = (e) => {
472
+ let t = (e ?? "").split(":").map(Number);
473
+ return (t[0] || 0) * 3600 + (t[1] || 0) * 60 + (t[2] || 0);
474
+ }, Le = ({ src: r, autoplay: i = !1, muted: a = !1, chapters: s = [], keyMoments: ee, subtitles: ne = [], watermark: re, themeColor: h = "#6366f1", drmConfig: ie, firebaseConfig: ae, onAnalyticsEvent: oe, onAdBreakChange: se, onKeyMomentsLoaded: ce, enableControls: le = !0, enableChromecast: g, enableKeyMoments: v, enableSubtitles: Pe, enableQuality: Le, enablePlaybackSpeed: Re, enablePiP: ze, enableFullscreen: Be = !0, autoFullscreen: Ve = !1, watchProgressInterval: He = 30, subtitleStyle: Ue = {}, resolvedEntitlement: We, licenseKey: Ge, title: Ke, chaptersDisplayMode: qe = "strip", volumeControlType: Je = "slider", urlTransformer: b, pauseAdOnTabSwitch: Ye = !0, enableSkipAd: Xe = !1, skipAdAfterSeconds: Ze = 5, overlayAdUrl: Qe, adTrackingUrl: $e, sources: x, activeSourceIndex: et = 0, onSourceChange: tt, initialTime: nt, onTimeUpdate: rt }) => {
475
+ let it = b ?? ((e) => e), S = u(null), at = u(null), ot = u(!1), C = u(null), st = u(0), ct = u(null), w = u(null), lt = u(null), ut = u(null), dt = u(!1), T = u(!1), E = u(null), D = u(null), ft = u(null), pt = u(() => {}), O = u(null), mt = u(null), ht = u(null), gt = u(null), _t = u(null), k = u(null), vt = u(null), yt = u(x), bt = u(tt), xt = u(!1), [St, Ct] = d(!1), wt = u(!1), Tt = u(null), [Et, Dt] = d(null);
476
+ c(() => {
477
+ let e = S.current;
478
+ if (!e) return;
479
+ let t = new ResizeObserver((e) => {
480
+ for (let t of e) Ct(t.contentRect.width <= 768);
481
+ });
482
+ return t.observe(e), Ct(e.getBoundingClientRect().width <= 768), () => t.disconnect();
483
+ }, []);
484
+ let [A, Ot] = d(null), kt = We ?? null, j = kt != null, M = kt?.features ?? {}, At = j ? !!(M.drm_protection && !Ge) : !1, N = {
485
+ enableSubtitles: j ? !!M.subtitle_support : typeof Pe == "boolean" ? Pe : !0,
486
+ enableChromecast: j ? !!M.chromecast : typeof g == "boolean" ? g : !0,
487
+ enableKeyMoments: j ? !!M.key_moments : typeof v == "boolean" ? v : !0,
488
+ enableQuality: j ? !!M.multiple_resolution : typeof Le == "boolean" ? Le : !0,
489
+ enablePlaybackSpeed: j ? !!M.playback_speed : typeof Re == "boolean" ? Re : !0,
490
+ enablePiP: j ? !!M.picture_in_picture : typeof ze == "boolean" ? ze : !0,
491
+ allowAirplay: j ? !!M.airplay : !1,
492
+ allowMultipleAudio: j ? !!M.multiple_audio : !0,
493
+ m3u8_playback: j ? !!M.m3u8_playback : !0,
494
+ drm_protection: j ? !!M.drm_protection : !1
495
+ }, [jt, Mt] = d(!1), [Nt, Pt] = d(0), [Ft, It] = d(!1), [P, Lt] = d(0), [Rt, zt] = d(0), [Bt, Vt] = d(1), [Ht, Ut] = d(!1), [Wt, Gt] = d(!1), [Kt, qt] = d(!1), [F, Jt] = d(!1), [Yt, Xt] = d(!1), Zt = St || (Kt || F) && Yt, [Qt, $t] = d(!1), [en, tn] = d(!1), [I, nn] = d([]), L = u([]), rn = u(/* @__PURE__ */ new Set()), [an, on] = d(/* @__PURE__ */ new Set()), [sn, cn] = d(r);
496
+ sn !== r && (cn(r), on(/* @__PURE__ */ new Set()));
497
+ let ln = u(null), un = u(!1), [dn, fn] = d([]), [pn, mn] = d(null), hn = u([]), gn = u(null), _n = u(/* @__PURE__ */ new Set()), [vn, yn] = d([]), bn = u([]), xn = l(() => I.reduce((e, t) => e + (t.endTime - t.startTime), 0), [I]), Sn = Rt > 0 ? Math.max(0, Rt - xn) : 0, R = I.length > 0 && Sn > 0 ? Sn : Rt, z = o((e) => {
498
+ let t = e;
499
+ for (let n of I) e >= n.endTime ? t -= n.endTime - n.startTime : e >= n.startTime && (t -= e - n.startTime);
500
+ return Math.max(0, t);
501
+ }, [I]), B = o((e) => {
502
+ let t = e;
503
+ for (let e of I) t >= e.startTime && (t += e.endTime - e.startTime);
504
+ return t;
505
+ }, [I]), [Cn, wn] = d([]), [Tn, En] = d({
506
+ id: -1,
507
+ height: 0,
508
+ width: 0,
509
+ bitrate: 0,
510
+ label: "Auto"
511
+ }), [Dn, On] = d(""), [V, kn] = d("off"), [An, jn] = d(Fe(ne)), [Mn, Nn] = d([]), [Pn, Fn] = d(0);
512
+ c(() => {
513
+ if (A) {
514
+ let e = A.subtitles.getTracks();
515
+ jn(Fe([...ne, ...e.filter((e) => !ne.some((t) => t.id === e.id))]));
516
+ } else jn(Fe(ne));
517
+ }, [ne.map((e) => e.id).join(","), A]);
518
+ let [In, Ln] = d({
519
+ chapter: null,
520
+ index: -1
521
+ }), [H, Rn] = d(ee || s || []), [U, W] = d("none"), [zn, Bn] = d(1), [G, Vn] = d(!1), [Hn, Un] = d({}), [Wn, K] = d(""), [Gn, Kn] = d(null), qn = u(!1), Jn = JSON.stringify(H.map((e) => ({
522
+ title: e.title,
523
+ startTime: e.startTime
524
+ })));
525
+ c(() => {
526
+ Rn(ee || s || []);
527
+ }, [(ee || s || []).map((e) => `${e.startTime}:${e.title}`).join(",")]), c(() => {
528
+ if (!r || !H || H.length === 0) return;
529
+ Un({});
530
+ let e = document.createElement("video");
531
+ e.muted = !0, e.preload = "metadata", e.crossOrigin = "anonymous", e.style.cssText = "position:fixed;top:0;left:0;width:10px;height:10px;opacity:0.01;pointer-events:none;z-index:-9999;", document.body.appendChild(e);
532
+ let t = null, i = r.includes(".m3u8"), a = document.createElement("canvas");
533
+ a.width = 160, a.height = 90;
534
+ let o = a.getContext("2d"), s = 0, c = !1, l = () => {
535
+ if (s >= H.length) {
536
+ f();
537
+ return;
538
+ }
539
+ let t = H[s].startTime;
540
+ e.currentTime = t === 0 ? .01 : t;
541
+ }, u = () => {
542
+ if (o && e.readyState >= 2) {
543
+ o.drawImage(e, 0, 0, a.width, a.height);
544
+ let t = a.toDataURL("image/jpeg", .8);
545
+ Un((e) => ({
546
+ ...e,
547
+ [s]: t
548
+ })), s++, l();
549
+ } else setTimeout(u, 100);
550
+ }, d = () => {
551
+ c || (c = !0, l());
552
+ };
553
+ e.addEventListener("seeked", u), e.addEventListener("canplay", d), i && n.isSupported() ? (t = new n({
554
+ enableWorker: !1,
555
+ maxBufferLength: 5,
556
+ xhrSetup: (e, t) => {
557
+ let n = ie?.authToken;
558
+ try {
559
+ let r = it(t), i = new URL(r, window.location.origin);
560
+ n && i.searchParams.set("token", n), e.open("GET", i.toString(), !0);
561
+ } catch (e) {
562
+ console.error("[WebVideoPlayer tempHls] xhrSetup error:", e);
563
+ }
564
+ }
565
+ }), t.loadSource(it(r)), t.attachMedia(e)) : e.src = r, e.readyState >= 2 && d();
566
+ let f = () => {
567
+ e.removeEventListener("seeked", u), e.removeEventListener("canplay", d), t && t.destroy(), document.body.contains(e) && document.body.removeChild(e);
568
+ };
569
+ return f;
570
+ }, [r, Jn]);
571
+ let [q, Yn] = d(null), [Xn, Zn] = d(null), Qn = u(!1), [$n, er] = d(!1), [tr, nr] = d(!1), [rr, ir] = d(null), [ar, or] = d(null), [sr, cr] = d(0), [lr, ur] = d(0), [dr, fr] = d(null), [pr, mr] = d(null), [J, hr] = d(null);
572
+ c(() => {
573
+ if (ft.current && !ft.current.querySelector("google-cast-launcher")) {
574
+ let e = document.createElement("google-cast-launcher");
575
+ e.style.cursor = "pointer", e.style.width = "100%", e.style.height = "100%", e.style.display = "block", ft.current.appendChild(e);
576
+ }
577
+ }, []), c(() => {
578
+ if (!A) {
579
+ er(!1), nr(!1), ir(null);
580
+ return;
581
+ }
582
+ let e = (e) => er(e), t = () => {
583
+ let e = A.getVideoElement(), t = !!e?.webkitCurrentPlaybackTargetIsWireless;
584
+ nr(t), ir(t ? e.webkitCurrentPlaybackTargetName || "AirPlay device" : null);
585
+ };
586
+ e(A.casting.isAirPlayAvailable()), t();
587
+ let n = A.getVideoElement(), r = (t) => {
588
+ e(t.availability === "available");
589
+ }, i = () => {
590
+ t();
591
+ };
592
+ return "webkitShowPlaybackTargetPicker" in n && (n.addEventListener("webkitplaybacktargetavailabilitychanged", r), n.addEventListener("webkitcurrentplaybacktargetiswirelesschanged", i)), () => {
593
+ "webkitShowPlaybackTargetPicker" in n && (n.removeEventListener("webkitplaybacktargetavailabilitychanged", r), n.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged", i));
594
+ };
595
+ }, [A]);
596
+ let [gr, _r] = d(""), [vr, yr] = d(!0), [Y, br] = d(!1), xr = u(null), Sr = u(!1), Cr = u(!1), wr = u("none"), Tr = u(ne), Er = () => {
597
+ yr(!0), xr.current && window.clearTimeout(xr.current);
598
+ let e = wt.current ? 3500 : 1e4;
599
+ xr.current = window.setTimeout(() => {
600
+ Sr.current && wr.current === "none" && yr(!1);
601
+ }, e);
602
+ }, Dr = o((e) => {
603
+ k.current &&= (clearTimeout(k.current), null);
604
+ let t = yt.current, n = t?.[e]?.label ?? "This format", r = t?.[0]?.label ?? "default";
605
+ vt.current = null, Kn(`${n} isn't supported on this device. Switched to ${r}.`), window.setTimeout(() => Kn(null), 4e3), bt.current?.(0);
606
+ }, []);
607
+ c(() => {
608
+ if (!S.current) return;
609
+ let o = document.createElement("video");
610
+ o.muted = !0, o.preload = "metadata", o.crossOrigin = "anonymous", o.style.cssText = "display:none;position:absolute;pointer-events:none;", document.body.appendChild(o), w.current = o;
611
+ let s = r.includes(".m3u8");
612
+ if (s && n.isSupported()) {
613
+ let e = new n({
614
+ enableWorker: !1,
615
+ maxBufferLength: 5,
616
+ xhrSetup: (e, t) => {
617
+ let n = ie?.authToken;
618
+ try {
619
+ let r = it(t), i = new URL(r, window.location.origin);
620
+ n && i.searchParams.set("token", n), e.open("GET", i.toString(), !0);
621
+ } catch (e) {
622
+ console.error("[WebVideoPlayer hiddenHls] xhrSetup error:", e);
623
+ }
624
+ }
625
+ });
626
+ e.loadSource(it(r)), e.attachMedia(o), lt.current = e, e.on(n.Events.MANIFEST_LOADED, (e, t) => {
627
+ if (Ke) return;
628
+ let n = Ae(t?.networkDetails?.responseText ?? "");
629
+ n && _r(n);
630
+ }), e.on(n.Events.FRAG_PARSING_METADATA, (e, t) => {
631
+ if (!(Ke || gr)) for (let e of t?.samples ?? []) {
632
+ let t = je(e.data);
633
+ if (t) {
634
+ _r(t);
635
+ break;
636
+ }
637
+ }
638
+ });
639
+ } else s && o.canPlayType("application/vnd.apple.mpegurl"), o.src = r;
640
+ o.addEventListener("seeked", () => {
641
+ let e = ct.current;
642
+ if (!e) return;
643
+ let t = e.getContext("2d");
644
+ t && o.readyState >= 2 && (t.drawImage(o, 0, 0, e.width, e.height), fr(e.toDataURL("image/jpeg", .82)));
645
+ });
646
+ let c;
647
+ if (ae) {
648
+ let t = new e(ae);
649
+ at.current = t, c = t.createCallback();
650
+ }
651
+ if (At) return;
652
+ let l = new t({
653
+ container: S.current,
654
+ src: r,
655
+ autoplay: i,
656
+ muted: a,
657
+ keyMoments: H,
658
+ subtitles: ne,
659
+ drm: {
660
+ watermarkText: re,
661
+ allowedDomains: [
662
+ "localhost",
663
+ "127.0.0.1",
664
+ window.location.hostname
665
+ ],
666
+ ...ie
667
+ },
668
+ analyticsCallback: (e) => {
669
+ c?.(e), oe && oe(e);
670
+ },
671
+ watchProgressInterval: He * 1e3,
672
+ themeColor: h,
673
+ urlTransformer: b
674
+ });
675
+ l.on("keymomentsloaded", (e) => {
676
+ Rn(e), ce && ce(e);
677
+ }), l.on("chaptersloaded", (e) => {
678
+ Rn(e), ce && ce(e);
679
+ }), l.on("play", () => {
680
+ It(!0), tn(!1);
681
+ }), l.on("pause", () => It(!1)), l.on("ended", () => {
682
+ It(!1), tn(!0);
683
+ });
684
+ let u = () => {
685
+ O.current && (O.current.style.opacity = "1");
686
+ }, d = () => {
687
+ requestAnimationFrame(() => {
688
+ requestAnimationFrame(() => {
689
+ O.current && (O.current.style.opacity = "0");
690
+ });
691
+ });
692
+ }, f = (e) => {
693
+ T.current = !0;
694
+ let t = ht.current ?? e + .5;
695
+ ht.current = null, E.current = t, u(), l.seek(t), D.current && window.clearTimeout(D.current), D.current = window.setTimeout(() => {
696
+ T.current = !1, E.current = null, D.current = null, d();
697
+ }, 3e3);
698
+ };
699
+ if (mt.current = f, l.on("timeupdate", (e) => {
700
+ if (!T.current) {
701
+ let t = L.current.find((t) => rn.current.has(t.startTime) && e >= t.startTime - .5 && e < t.endTime);
702
+ if (t) {
703
+ f(t.endTime);
704
+ return;
705
+ }
706
+ }
707
+ if (T.current && E.current !== null) if (e >= E.current - 2) T.current = !1, E.current = null, D.current &&= (window.clearTimeout(D.current), null), L.current.some((t) => e >= t.startTime && e < t.endTime) || d();
708
+ else return;
709
+ Lt(e);
710
+ let t = l.getDuration();
711
+ if (zt(t), !xt.current && nt && nt > 0 && t > 0 && nt < t && (xt.current = !0, l.seek(nt)), rt?.(e), hn.current.length > 0) if (gn.current) {
712
+ let t = gn.current;
713
+ (e >= t.startTimeSeconds + t.durationSeconds || e < t.startTimeSeconds) && (mn(null), gn.current = null);
714
+ } else {
715
+ let t = hn.current.find((t) => e >= t.startTimeSeconds && e < t.startTimeSeconds + t.durationSeconds && !_n.current.has(t.availId));
716
+ t && (mn(t), gn.current = t, t.impressionBeacons.forEach((e) => {
717
+ fetch(e, { mode: "no-cors" }).catch(() => {});
718
+ }));
719
+ }
720
+ let n = l.keyMoments.getCurrentMoment(e);
721
+ if (Ln({
722
+ chapter: n.keyMoment,
723
+ index: n.index
724
+ }), "mediaSession" in navigator && navigator.mediaSession.setPositionState) {
725
+ let t = l.getDuration(), n = L.current.find((t) => e >= t.startTime && e < t.endTime);
726
+ if (n) {
727
+ let t = n.endTime - n.startTime, r = Math.max(0, e - n.startTime);
728
+ if (t > 0) try {
729
+ navigator.mediaSession.setPositionState({
730
+ duration: t,
731
+ playbackRate: 1,
732
+ position: Math.min(r, t)
733
+ });
734
+ } catch {}
735
+ } else {
736
+ let n = L.current.reduce((e, t) => e + (t.endTime - t.startTime), 0), r = t > 0 ? Math.max(0, t - n) : 0, i = e;
737
+ for (let t of L.current) e >= t.endTime ? i -= t.endTime - t.startTime : e >= t.startTime && (i -= e - t.startTime);
738
+ i = Math.max(0, i);
739
+ let a = L.current.length > 0 && r > 0 ? r : t;
740
+ if (a > 0) try {
741
+ navigator.mediaSession.setPositionState({
742
+ duration: a,
743
+ playbackRate: 1,
744
+ position: Math.min(i, a)
745
+ });
746
+ } catch {}
747
+ }
748
+ }
749
+ }), l.on("qualitylevels", (e) => {
750
+ wn(e);
751
+ }), l.on("qualitychange", (e) => {
752
+ En(e);
753
+ }), l.on("buffering", (e) => {
754
+ if (Gt(e), !e && (k.current &&= (clearTimeout(k.current), null), vt.current = null, _t.current !== null)) {
755
+ let e = _t.current;
756
+ _t.current = null, l.seek(e);
757
+ }
758
+ }), l.on("adbreakchange", (e) => {
759
+ if (l.analytics.setAdBreak(e, l.getVideoElement()), se && se(e), e) {
760
+ let e = l.getCurrentTime(), t = L.current.find((t) => e >= t.startTime && e < t.endTime);
761
+ if (t && rn.current.has(t.startTime)) {
762
+ u(), T.current || f(t.endTime);
763
+ return;
764
+ }
765
+ t && (ln.current = t.startTime), br(!0), W("none");
766
+ } else if (ln.current !== null && (rn.current.add(ln.current), on(new Set(rn.current)), ln.current = null), br(!1), ht.current !== null) {
767
+ let e = ht.current;
768
+ ht.current = null, T.current = !0, E.current = e, l.seek(e), D.current && window.clearTimeout(D.current), D.current = window.setTimeout(() => {
769
+ T.current = !1, E.current = null, D.current = null;
770
+ }, 3e3);
771
+ }
772
+ }), l.on("adbreaksloaded", (e) => {
773
+ L.current = e, nn(e);
774
+ }), l.on("volumechange", (e) => {
775
+ Vt(e.volume), Ut(e.muted);
776
+ }), l.on("pipchange", (e) => {
777
+ $t(e);
778
+ }), l.on("error", () => {
779
+ Mt(!0), Gt(!1);
780
+ }), l.on("unsupportedcodec", () => {
781
+ let e = vt.current;
782
+ e && e.targetIdx !== 0 && (yt.current?.length ?? 0) > 1 && Dr(e.targetIdx);
783
+ }), l.subtitles.onSubtitleChange((e) => {
784
+ On(e);
785
+ }), l.on("subtitlesloaded", (e) => {
786
+ if (!N.enableSubtitles) return;
787
+ jn(Fe([...e]));
788
+ let t = e.find((e) => e.isDefault);
789
+ t && (l.subtitles.setActiveTrack(t.id), kn(t.id));
790
+ }), l.on("audiotracksloaded", (e) => {
791
+ Nn(e), Fn(e[0]?.id ?? 0);
792
+ }), l.on("audiotrackchange", (e) => {
793
+ Fn(e);
794
+ }), l.casting.onCastStateChange((e, t) => {
795
+ if (e) {
796
+ Qn.current = l.isMuted(), l.pause();
797
+ let e = l.getVideoElement();
798
+ e.muted = !0, Yn(t);
799
+ } else {
800
+ let e = l.casting.getRemoteState();
801
+ e && e.currentTime > 0 && l.seek(e.currentTime);
802
+ let t = l.getVideoElement();
803
+ t.muted = Qn.current, Yn(null), Zn(null);
804
+ }
805
+ }), l.casting.onRemoteStateChange((e) => {
806
+ Zn(e);
807
+ }), Vt(l.getVolume()), Ut(l.isMuted()), "mediaSession" in navigator) try {
808
+ navigator.mediaSession.setActionHandler("seekto", (e) => {
809
+ if (e.seekTime == null || Cr.current) return;
810
+ let t = e.seekTime;
811
+ for (let e of L.current) t >= e.startTime && (t += e.endTime - e.startTime);
812
+ gt.current?.(t);
813
+ });
814
+ } catch {}
815
+ Ot(l);
816
+ let p = vt.current;
817
+ p && p.targetIdx !== 0 && (k.current && clearTimeout(k.current), k.current = setTimeout(() => {
818
+ k.current = null, !l.getBufferedRanges().some((e) => e.end > e.start) && Dr(p.targetIdx);
819
+ }, ke)), Ve && S.current && (ot.current = !0, S.current.requestFullscreen().catch(() => {
820
+ ot.current = !1;
821
+ }));
822
+ let m = () => {
823
+ let e = document, t = !!(document.fullscreenElement || e.webkitFullscreenElement);
824
+ qt(t), t || Jt(!1);
825
+ let n = l.getVideoElement();
826
+ l.analytics.track(t ? "fullscreen_enter" : "fullscreen_exit", n);
827
+ };
828
+ document.addEventListener("fullscreenchange", m), document.addEventListener("webkitfullscreenchange", m);
829
+ let ee = (e) => {
830
+ let t = document.activeElement;
831
+ if (!(t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.getAttribute("contenteditable") === "true" || t.getAttribute("role") === "slider"))) {
832
+ switch (e.key.toLowerCase()) {
833
+ case " ":
834
+ case "k":
835
+ if (e.preventDefault(), l.getVideoElement().paused) l.play();
836
+ else {
837
+ l.pause();
838
+ try {
839
+ let e = l.getVideoElement();
840
+ e && !e.paused && e.pause();
841
+ } catch {}
842
+ if (w.current && !w.current.paused) try {
843
+ w.current.pause();
844
+ } catch {}
845
+ }
846
+ break;
847
+ case "arrowleft":
848
+ case "j":
849
+ if (e.preventDefault(), !Cr.current) {
850
+ let e = l.getCurrentTime(), t = e;
851
+ for (let n of L.current) e >= n.endTime ? t -= n.endTime - n.startTime : e >= n.startTime && (t -= e - n.startTime);
852
+ let n = Math.max(0, t - 10);
853
+ for (let e of L.current) n >= e.startTime && (n += e.endTime - e.startTime);
854
+ l.seek(n);
855
+ }
856
+ break;
857
+ case "arrowright":
858
+ case "l":
859
+ if (e.preventDefault(), !Cr.current) {
860
+ let e = l.getCurrentTime(), t = L.current.reduce((e, t) => e + (t.endTime - t.startTime), 0), n = Math.max(0, l.getDuration() - t), r = e;
861
+ for (let t of L.current) e >= t.endTime ? r -= t.endTime - t.startTime : e >= t.startTime && (r -= e - t.startTime);
862
+ let i = Math.min(n, r + 10);
863
+ for (let e of L.current) i >= e.startTime && (i += e.endTime - e.startTime);
864
+ gt.current?.(i);
865
+ }
866
+ break;
867
+ case "arrowup":
868
+ e.preventDefault(), l.setVolume(l.getVolume() + .1);
869
+ break;
870
+ case "arrowdown":
871
+ e.preventDefault(), l.setVolume(l.getVolume() - .1);
872
+ break;
873
+ case "m":
874
+ e.preventDefault(), l.setMute(!l.isMuted());
875
+ break;
876
+ case "f":
877
+ e.preventDefault(), pt.current();
878
+ break;
879
+ case "p":
880
+ e.preventDefault(), Cr.current || l.togglePictureInPicture();
881
+ break;
882
+ case "c":
883
+ if (e.preventDefault(), N.enableSubtitles && !Cr.current) if (l.subtitles.getActiveTrackId() !== "off") l.subtitles.setActiveTrack("off"), kn("off");
884
+ else {
885
+ let e = Tr.current;
886
+ e && e.length > 0 && (l.subtitles.setActiveTrack(e[0].id), kn(e[0].id));
887
+ }
888
+ break;
889
+ default: return;
890
+ }
891
+ Er();
892
+ }
893
+ };
894
+ return document.addEventListener("keydown", ee), Er(), () => {
895
+ if (l.destroy(), at.current?.destroy(), at.current = null, document.body.style.overflow = "", document.body.style.touchAction = "", document.removeEventListener("fullscreenchange", m), document.removeEventListener("webkitfullscreenchange", m), document.removeEventListener("keydown", ee), xr.current && window.clearTimeout(xr.current), D.current &&= (window.clearTimeout(D.current), null), k.current &&= (clearTimeout(k.current), null), O.current && (O.current.style.opacity = "0"), "mediaSession" in navigator) try {
896
+ navigator.mediaSession.setActionHandler("seekto", null);
897
+ } catch {}
898
+ lt.current &&= (lt.current.destroy(), null), w.current &&= (document.body.removeChild(w.current), null), xt.current = !1;
899
+ };
900
+ }, [
901
+ r,
902
+ re,
903
+ Nt
904
+ ]), c(() => {
905
+ if (A) {
906
+ A.keyMoments.setKeyMoments(H);
907
+ let e = S.current?.querySelector("video");
908
+ if (e) {
909
+ let t = A.keyMoments.getCurrentMoment(e.currentTime);
910
+ Ln({
911
+ chapter: t.keyMoment,
912
+ index: t.index
913
+ });
914
+ }
915
+ }
916
+ }, [Jn, A]), c(() => {
917
+ let e = (e) => {
918
+ U !== "none" && (e.target.closest(".sdk-menu-container") || W("none"));
919
+ };
920
+ return document.addEventListener("click", e), () => {
921
+ document.removeEventListener("click", e);
922
+ };
923
+ }, [U]), c(() => {
924
+ Sr.current = Ft;
925
+ }, [Ft]), c(() => {
926
+ Cr.current = Y;
927
+ }, [Y]), c(() => {
928
+ wr.current = U;
929
+ }, [U]), c(() => {
930
+ Tr.current = An;
931
+ }, [An]), c(() => {
932
+ wt.current = St;
933
+ }, [St]), c(() => {
934
+ L.current = I;
935
+ }, [I]), c(() => {
936
+ hn.current = dn;
937
+ }, [dn]), c(() => {
938
+ gn.current = pn;
939
+ }, [pn]), c(() => {
940
+ bn.current = vn;
941
+ }, [vn]), c(() => {
942
+ yt.current = x;
943
+ }, [x]), c(() => {
944
+ bt.current = tt;
945
+ }, [tt]), c(() => {
946
+ rn.current = /* @__PURE__ */ new Set(), ln.current = null, un.current = !1, ht.current = null, mn(null), gn.current = null, _n.current = /* @__PURE__ */ new Set(), Mt(!1);
947
+ }, [r]), c(() => {
948
+ fn([]), Qe && fetch(Qe).then((e) => e.json()).then((e) => {
949
+ let t = /* @__PURE__ */ new Set(), n = [];
950
+ for (let r of e.nonLinearAvails ?? []) {
951
+ if (t.has(r.availId)) continue;
952
+ t.add(r.availId);
953
+ let e = r.nonLinearAdsList?.[0], i = e?.nonLinearAdList?.[0];
954
+ if (!i?.staticResource) continue;
955
+ let a = (e?.trackingEvents ?? []).filter((e) => e.eventType === "impression").flatMap((e) => e.beaconUrls ?? []), o = {};
956
+ try {
957
+ o = JSON.parse(i.adParameters ?? "{}");
958
+ } catch {}
959
+ let s = o.position ?? "bottom_center";
960
+ n.push({
961
+ availId: r.availId,
962
+ startTimeSeconds: Ie(r.startTime ?? ""),
963
+ durationSeconds: Ie(i.minSuggestedDuration ?? "00:00:15"),
964
+ imageUrl: i.staticResource,
965
+ imageWidth: parseInt(i.width ?? "320", 10),
966
+ imageHeight: parseInt(i.height ?? "50", 10),
967
+ title: i.adTitle ?? "",
968
+ clickThrough: i.clickThrough ?? "",
969
+ clickTrackingUrl: i.clickTracking ?? "",
970
+ impressionBeacons: a,
971
+ position: s,
972
+ dismissible: o.dismissible === !0
973
+ });
974
+ }
975
+ fn(n);
976
+ }).catch(() => {});
977
+ }, [Qe, r]), c(() => {
978
+ yn([]), $e && fetch($e).then((e) => e.json()).then((e) => {
979
+ yn((e.avails ?? []).map((e) => {
980
+ let t = e.ads?.[0]?.skipOffset ?? null, n = !!t;
981
+ return {
982
+ startTimeSeconds: e.startTimeInSeconds ?? 0,
983
+ durationSeconds: e.durationInSeconds ?? 0,
984
+ skippable: n,
985
+ skipOffsetSeconds: n ? Ie(t) : 0
986
+ };
987
+ }));
988
+ }).catch(() => {});
989
+ }, [$e, r]), c(() => {
990
+ if (!A || vn.length === 0) return;
991
+ let e = vn.map((e) => ({
992
+ startTime: e.startTimeSeconds,
993
+ endTime: e.startTimeSeconds + e.durationSeconds
994
+ }));
995
+ A.setAdBreaks(e);
996
+ }, [A, vn]), c(() => {
997
+ if (!A) return;
998
+ let e = () => {
999
+ document.hidden ? Ye && Cr.current && (A.pause(), un.current = !0) : un.current &&= (A.play(), !1);
1000
+ };
1001
+ return document.addEventListener("visibilitychange", e), () => {
1002
+ document.removeEventListener("visibilitychange", e);
1003
+ };
1004
+ }, [A, Ye]);
1005
+ let Or = () => {
1006
+ Er();
1007
+ }, kr = () => {
1008
+ Ve && !ot.current && S.current && (ot.current = !0, S.current.requestFullscreen().catch(() => {}));
1009
+ }, Ar = () => {
1010
+ if (A) {
1011
+ if (q) {
1012
+ A.casting.remotePlayPause(), Er();
1013
+ return;
1014
+ }
1015
+ if (en) X(0), kr(), A.play(), tn(!1);
1016
+ else if (Ft) {
1017
+ A.pause();
1018
+ try {
1019
+ let e = A.getVideoElement?.();
1020
+ e && !e.paused && e.pause();
1021
+ } catch {}
1022
+ if (S.current && S.current.querySelectorAll("video").forEach((e) => {
1023
+ try {
1024
+ e.pause();
1025
+ } catch {}
1026
+ }), w.current && !w.current.paused) try {
1027
+ w.current.pause();
1028
+ } catch {}
1029
+ } else kr(), A.play();
1030
+ Er();
1031
+ }
1032
+ }, jr = (e) => {
1033
+ if (!C.current || !A || R === 0) return 0;
1034
+ let t = C.current.getBoundingClientRect();
1035
+ return B(Math.max(0, Math.min(1, (e.clientX - t.left) / t.width)) * R);
1036
+ }, Mr = (e) => {
1037
+ if (!A || Y) return;
1038
+ dt.current = !0, hr(jr(e));
1039
+ let t = (e) => {
1040
+ if (!dt.current || !C.current) return;
1041
+ let t = C.current.getBoundingClientRect(), n = B(Math.max(0, Math.min(1, (e.clientX - t.left) / t.width)) * R);
1042
+ hr(n), or(e.clientX - t.left), ur(n), w.current && (w.current.currentTime = n), Er();
1043
+ }, n = (e) => {
1044
+ if (dt.current = !1, C.current) {
1045
+ let t = C.current.getBoundingClientRect();
1046
+ X(B(Math.max(0, Math.min(1, (e.clientX - t.left) / t.width)) * R));
1047
+ }
1048
+ hr(null), or(null), fr(null), mr(null), document.removeEventListener("mousemove", t), document.removeEventListener("mouseup", n);
1049
+ };
1050
+ document.addEventListener("mousemove", t), document.addEventListener("mouseup", n);
1051
+ }, X = (e) => {
1052
+ if (!A) return;
1053
+ if (q) {
1054
+ A.casting.remoteSeek(e);
1055
+ return;
1056
+ }
1057
+ let t = Math.max(0, Rt > 0 ? Math.min(e, Rt) : e), n = A.getCurrentTime();
1058
+ if (t > n && L.current.length > 0) {
1059
+ let e = L.current.filter((e) => e.startTime > n && e.startTime < t && !rn.current.has(e.startTime)).sort((e, t) => e.startTime - t.startTime);
1060
+ if (e.length > 0) {
1061
+ ht.current = t;
1062
+ let n = e[e.length - 1].startTime;
1063
+ T.current = !0, E.current = n, Lt(n), O.current && (O.current.style.opacity = "0"), A.seek(n), D.current && window.clearTimeout(D.current), D.current = window.setTimeout(() => {
1064
+ T.current = !1, E.current = null, D.current = null, O.current && (O.current.style.opacity = "0");
1065
+ }, 3e3);
1066
+ return;
1067
+ }
1068
+ }
1069
+ ht.current = null, T.current = !0, E.current = t, Lt(t), O.current && (O.current.style.opacity = "0"), A.seek(t), D.current && window.clearTimeout(D.current), D.current = window.setTimeout(() => {
1070
+ T.current = !1, E.current = null, D.current = null, O.current && (O.current.style.opacity = "0");
1071
+ }, 3e3);
1072
+ };
1073
+ gt.current = X;
1074
+ let Nr = () => {
1075
+ if (!A) return;
1076
+ if (q) {
1077
+ A.casting.remoteSetMute(!(Xn?.isMuted ?? !1));
1078
+ return;
1079
+ }
1080
+ let e = !Ht;
1081
+ A.setMute(e), Ut(e);
1082
+ }, Pr = (e) => {
1083
+ A && (A.setPlaybackRate(e), Bn(e), W("none"), K(`Playback speed: ${e === 1 ? "Normal" : `${e}x`}`));
1084
+ }, Fr = (e) => {
1085
+ if (!A) return;
1086
+ A.setQuality(e);
1087
+ let t = Cn.find((t) => t.id === e);
1088
+ t && (En(t), K(`Quality: ${t.label}`)), W("none");
1089
+ }, Ir = (e) => {
1090
+ if (A) if (A.subtitles.setActiveTrack(e), kn(e), W("none"), e === "off") K("Captions off");
1091
+ else {
1092
+ let t = An.find((t) => t.id === e);
1093
+ K(`Captions: ${t ? y(t) : "on"}`);
1094
+ }
1095
+ }, Lr = (e) => {
1096
+ A && (k.current &&= (clearTimeout(k.current), null), Kn(null), vt.current === null && (_t.current = A.getCurrentTime()), vt.current = { targetIdx: e }, W("none"), K(`Source: ${x?.[e]?.label ?? ""}`), tt?.(e));
1097
+ }, Rr = (e) => {
1098
+ X(e), W("none");
1099
+ }, zr = () => {
1100
+ A && A.togglePictureInPicture();
1101
+ }, Br = () => {
1102
+ if (!S.current) return;
1103
+ let e = S.current, t = document, n = e, r = !!(document.fullscreenElement || t.webkitFullscreenElement), i = () => {
1104
+ Jt(!0), qt(!0), document.body.style.overflow = "hidden", document.body.style.touchAction = "none", A?.analytics.track("fullscreen_enter", A.getVideoElement());
1105
+ }, a = () => {
1106
+ Jt(!1), qt(!1), document.body.style.overflow = "", document.body.style.touchAction = "", A?.analytics.track("fullscreen_exit", A.getVideoElement());
1107
+ };
1108
+ if (r || F) Xt(!1), document.fullscreenElement ? document.exitFullscreen() : t.webkitFullscreenElement ? t.webkitExitFullscreen?.() : a();
1109
+ else {
1110
+ Xt(wt.current);
1111
+ let t = e.requestFullscreen?.bind(e) ?? n.webkitRequestFullscreen?.bind(n);
1112
+ t ? t().catch(i) : i();
1113
+ }
1114
+ };
1115
+ c(() => {
1116
+ pt.current = Br;
1117
+ });
1118
+ let Vr = () => {
1119
+ if (!Y) return;
1120
+ let e = I.find((e) => P >= e.startTime && P < e.endTime);
1121
+ e && mt.current?.(e.endTime);
1122
+ }, Hr = () => {
1123
+ gn.current && _n.current.add(gn.current.availId), mn(null), gn.current = null;
1124
+ }, Ur = (e) => {
1125
+ e.clickTrackingUrl && fetch(e.clickTrackingUrl, { mode: "no-cors" }).catch(() => {}), e.clickThrough && window.open(e.clickThrough, "_blank", "noopener,noreferrer");
1126
+ }, Wr = () => {
1127
+ A && (q ? A.casting.stopCasting() : A.casting.requestSession(r, P));
1128
+ }, Gr = () => {
1129
+ if (!A) return;
1130
+ let e = A.getVideoElement();
1131
+ if (tr) {
1132
+ A.casting.stopAirPlay(e);
1133
+ return;
1134
+ }
1135
+ typeof e.webkitShowPlaybackTargetPicker == "function" || A.casting.isAirPlayAvailable() ? A.casting.requestAirPlaySession(e) : console.warn("[PlayerSDK AirPlay] AirPlay is not available on this device.");
1136
+ }, Kr = (e) => {
1137
+ if (!C.current || R === 0 || !A || Y) return;
1138
+ let t = C.current.getBoundingClientRect();
1139
+ st.current = t.width, cr(Math.max(192 / 2, Math.min(e.clientX - t.left, t.width - 192 / 2)));
1140
+ let n = B(Math.max(0, Math.min(1, (e.clientX - t.left) / t.width)) * R);
1141
+ or(e.clientX - t.left), ur(n), ut.current && window.clearTimeout(ut.current), ut.current = window.setTimeout(() => {
1142
+ w.current && (w.current.currentTime = n);
1143
+ }, 100), mr(A.keyMoments.getCurrentMoment(n).keyMoment);
1144
+ }, qr = (e) => {
1145
+ if (!C.current || R === 0) return 0;
1146
+ let t = C.current.getBoundingClientRect();
1147
+ return B(Math.max(0, Math.min(1, (e.clientX - t.left) / t.width)) * R);
1148
+ }, Jr = (e) => {
1149
+ if (!A || Y || R === 0) return;
1150
+ e.preventDefault(), dt.current = !0, hr(qr(e.touches[0]));
1151
+ let t = (e) => {
1152
+ if (!dt.current || !C.current) return;
1153
+ let t = e.touches[0], n = C.current.getBoundingClientRect(), r = B(Math.max(0, Math.min(1, (t.clientX - n.left) / n.width)) * R);
1154
+ hr(r), ur(r), Er();
1155
+ }, n = (e) => {
1156
+ if (dt.current = !1, C.current && e.changedTouches[0]) {
1157
+ let t = e.changedTouches[0], n = C.current.getBoundingClientRect();
1158
+ X(B(Math.max(0, Math.min(1, (t.clientX - n.left) / n.width)) * R));
1159
+ }
1160
+ hr(null), document.removeEventListener("touchmove", t), document.removeEventListener("touchend", n);
1161
+ };
1162
+ document.addEventListener("touchmove", t, { passive: !1 }), document.addEventListener("touchend", n);
1163
+ }, Yr = () => {
1164
+ or(null), fr(null), mr(null), ut.current && window.clearTimeout(ut.current);
1165
+ }, Z = (e) => {
1166
+ if (isNaN(e) || e < 0) return "00:00";
1167
+ let t = Math.floor(e), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60), i = t % 60, a = (e) => String(e).padStart(2, "0");
1168
+ return n > 0 ? `${a(n)}:${a(r)}:${a(i)}` : `${a(r)}:${a(i)}`;
1169
+ };
1170
+ c(() => {
1171
+ qn.current && K(Ft ? "Playing" : "Paused");
1172
+ }, [Ft]), c(() => {
1173
+ qn.current && K(Ht ? "Muted" : "Unmuted");
1174
+ }, [Ht]), c(() => {
1175
+ qn.current = !0;
1176
+ }, []), c(() => {
1177
+ let e = (e) => {
1178
+ e.key === "Escape" && wr.current !== "none" && (e.preventDefault(), W("none"));
1179
+ };
1180
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
1181
+ }, []);
1182
+ let Xr = q ? !(Xn?.isPaused ?? !0) : Ft, Q = q ? Xn?.currentTime ?? 0 : P, Zr = q ? Xn?.duration ?? 0 : R, Qr = q ? Xn?.volumeLevel ?? 1 : Bt, $r = q ? Xn?.isMuted ?? !1 : Ht, ei = o((e) => {
1183
+ if (Y || e.target.closest(".sdk-mobile-ctrl")) return;
1184
+ let t = Date.now(), n = S.current?.getBoundingClientRect(), r = e.clientX - (n?.left ?? 0), i = Tt.current;
1185
+ if (i && t - i.time < 300) {
1186
+ Tt.current = null;
1187
+ let e = r < (n?.width ?? 0) / 2, t = e ? -10 : 10;
1188
+ X(B(Math.max(0, Math.min(R, z(Q) + t)))), Dt(e ? "left" : "right"), window.setTimeout(() => Dt(null), 700), Er();
1189
+ } else Tt.current = {
1190
+ time: t,
1191
+ x: r
1192
+ }, vr ? (yr(!1), xr.current && window.clearTimeout(xr.current)) : Er();
1193
+ }, [
1194
+ Y,
1195
+ R,
1196
+ z,
1197
+ Q,
1198
+ B,
1199
+ X,
1200
+ vr
1201
+ ]), ti = () => p($r || Qr === 0 ? De : Qr < .3 ? Oe : Qr < .7 ? Te : Ee, { size: 18 }), $ = (e) => (t) => {
1202
+ t.key === "Enter" || t.key === " " ? (t.preventDefault(), e()) : t.key === "Escape" && (t.preventDefault(), W("none"));
1203
+ }, ni = (e) => (t) => {
1204
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e());
1205
+ }, ri = (e) => {
1206
+ if (!Y) if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
1207
+ e.preventDefault();
1208
+ let t = e.key === "ArrowLeft" ? -5 : 5;
1209
+ X(B(Math.max(0, Math.min(R, z(Q) + t))));
1210
+ } else e.key === "Home" ? (e.preventDefault(), X(B(0))) : e.key === "End" && (e.preventDefault(), X(B(R)));
1211
+ }, ii = (e) => {
1212
+ W(U === e ? "none" : e);
1213
+ }, ai = o((e) => {
1214
+ if (!e) return;
1215
+ e.style.left = "";
1216
+ let t = S.current;
1217
+ if (!t) return;
1218
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = n.right - (r.right - 8), a = r.left + 8 - n.left;
1219
+ i > 0 ? e.style.left = `calc(50% - ${Math.ceil(i)}px)` : a > 0 && (e.style.left = `calc(50% + ${Math.ceil(a)}px)`);
1220
+ }, []);
1221
+ return /* @__PURE__ */ m("div", {
1222
+ ref: S,
1223
+ role: "region",
1224
+ "aria-label": Ke || gr ? `${Ke || gr} video player` : "Video player",
1225
+ className: `sdk-player-container ${vr ? "controls-active" : ""} ${F ? "sdk-fs-simulated" : ""}`,
1226
+ onMouseMove: Or,
1227
+ onTouchStart: Zt ? void 0 : Er,
1228
+ onMouseLeave: () => {},
1229
+ style: {
1230
+ border: F ? "none" : "1px solid rgba(255, 255, 255, 0.08)",
1231
+ "--sdk-theme-color": h,
1232
+ "--sdk-theme-color-rgb": Ne(h)
1233
+ },
1234
+ children: [
1235
+ /* @__PURE__ */ p("canvas", {
1236
+ ref: ct,
1237
+ width: 160,
1238
+ height: 90,
1239
+ style: {
1240
+ display: "none",
1241
+ position: "absolute",
1242
+ pointerEvents: "none"
1243
+ },
1244
+ "aria-hidden": "true"
1245
+ }),
1246
+ /* @__PURE__ */ p("div", {
1247
+ role: "status",
1248
+ "aria-live": "polite",
1249
+ "aria-atomic": "true",
1250
+ className: "sdk-sr-only",
1251
+ children: Wn
1252
+ }),
1253
+ /* @__PURE__ */ p("div", {
1254
+ ref: O,
1255
+ style: {
1256
+ opacity: 0,
1257
+ position: "absolute",
1258
+ inset: 0,
1259
+ background: "#000",
1260
+ zIndex: 100,
1261
+ pointerEvents: "none",
1262
+ willChange: "opacity"
1263
+ },
1264
+ "aria-hidden": "true"
1265
+ }),
1266
+ /* @__PURE__ */ p("div", {
1267
+ className: `sdk-spinner-overlay ${Wt ? "active" : ""}`,
1268
+ "aria-hidden": "true",
1269
+ children: /* @__PURE__ */ p("div", { className: "sdk-spinner" })
1270
+ }),
1271
+ jt && /* @__PURE__ */ p("div", {
1272
+ style: {
1273
+ position: "absolute",
1274
+ inset: 0,
1275
+ zIndex: 50,
1276
+ background: "rgba(9,9,14,0.96)",
1277
+ display: "flex",
1278
+ flexDirection: "column",
1279
+ alignItems: "center",
1280
+ justifyContent: "center",
1281
+ gap: 20,
1282
+ padding: "0 24px"
1283
+ },
1284
+ children: /* @__PURE__ */ p(te, { onRetry: () => {
1285
+ Mt(!1), Pt((e) => e + 1);
1286
+ } })
1287
+ }),
1288
+ Gn && /* @__PURE__ */ p("div", {
1289
+ style: {
1290
+ position: "absolute",
1291
+ top: 16,
1292
+ left: "50%",
1293
+ transform: "translateX(-50%)",
1294
+ background: "rgba(0,0,0,0.82)",
1295
+ color: "#fff",
1296
+ fontSize: 13,
1297
+ fontWeight: 500,
1298
+ padding: "8px 16px",
1299
+ borderRadius: 8,
1300
+ zIndex: 80,
1301
+ pointerEvents: "none",
1302
+ whiteSpace: "nowrap",
1303
+ backdropFilter: "blur(8px)",
1304
+ border: "1px solid rgba(255,255,255,0.12)"
1305
+ },
1306
+ children: Gn
1307
+ }),
1308
+ N.enableSubtitles && Dn && V !== "off" && /* @__PURE__ */ p("div", {
1309
+ className: "sdk-subtitles-overlay",
1310
+ children: /* @__PURE__ */ p("span", {
1311
+ className: "sdk-subtitles-text",
1312
+ style: {
1313
+ fontSize: Ue.size === "small" ? "14px" : Ue.size === "large" ? "24px" : "18px",
1314
+ color: Ue.color ?? "#ffffff",
1315
+ background: Ue.background === "none" ? "transparent" : Ue.background === "solid" ? "rgba(0, 0, 0, 0.92)" : "rgba(15, 23, 42, 0.78)",
1316
+ border: Ue.background === "none" ? "none" : "1px solid rgba(255,255,255,0.08)",
1317
+ backdropFilter: Ue.background === "none" ? "none" : "blur(8px)"
1318
+ },
1319
+ dangerouslySetInnerHTML: { __html: Dn }
1320
+ })
1321
+ }),
1322
+ pn && /* @__PURE__ */ m("div", {
1323
+ className: `sdk-overlay-ad sdk-overlay-ad--${pn.position}`,
1324
+ role: "complementary",
1325
+ "aria-label": "Advertisement",
1326
+ children: [/* @__PURE__ */ m("div", {
1327
+ className: "sdk-overlay-ad-topbar",
1328
+ children: [/* @__PURE__ */ p("span", {
1329
+ className: "sdk-overlay-ad-label",
1330
+ children: "Ad"
1331
+ }), pn.dismissible && /* @__PURE__ */ p("button", {
1332
+ className: "sdk-overlay-ad-close",
1333
+ onClick: Hr,
1334
+ "aria-label": "Close advertisement",
1335
+ children: "✕"
1336
+ })]
1337
+ }), /* @__PURE__ */ p("img", {
1338
+ src: pn.imageUrl,
1339
+ width: pn.imageWidth,
1340
+ height: pn.imageHeight,
1341
+ alt: pn.title || "Advertisement",
1342
+ className: "sdk-overlay-ad-img",
1343
+ onClick: () => Ur(pn)
1344
+ })]
1345
+ }),
1346
+ Y && (() => {
1347
+ let e = I.find((e) => P >= e.startTime && P < e.endTime), t = e ? Math.max(0, e.endTime - P) : 0, n = e ? P - e.startTime : 0, r = vn.find((e) => P >= e.startTimeSeconds && P < e.startTimeSeconds + e.durationSeconds), i = r ? r.skippable : Xe, a = r ? r.skipOffsetSeconds : Ze, o = i && n >= a, s = Math.ceil(a - n);
1348
+ return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("div", {
1349
+ className: "sdk-ad-countdown",
1350
+ role: "timer",
1351
+ "aria-label": `Advertisement — ${Z(t)} remaining`,
1352
+ "aria-live": "off",
1353
+ children: [
1354
+ /* @__PURE__ */ p("span", {
1355
+ className: "sdk-ad-countdown-label",
1356
+ "aria-hidden": "true",
1357
+ children: "Ad"
1358
+ }),
1359
+ /* @__PURE__ */ p("span", {
1360
+ className: "sdk-ad-countdown-sep",
1361
+ "aria-hidden": "true",
1362
+ children: "·"
1363
+ }),
1364
+ /* @__PURE__ */ p("span", {
1365
+ className: "sdk-ad-countdown-time",
1366
+ "aria-hidden": "true",
1367
+ children: Z(t)
1368
+ })
1369
+ ]
1370
+ }), i && /* @__PURE__ */ p("button", {
1371
+ className: `sdk-skip-ad-btn ${o ? "sdk-skip-ad-btn--ready" : ""}`,
1372
+ onClick: o ? Vr : void 0,
1373
+ disabled: !o,
1374
+ "aria-label": o ? "Skip advertisement" : `Skip advertisement available in ${s} seconds`,
1375
+ "aria-disabled": !o,
1376
+ children: o ? "Skip Ad ›" : `Skip in ${s}s`
1377
+ })] });
1378
+ })(),
1379
+ At && /* @__PURE__ */ p("div", {
1380
+ style: {
1381
+ position: "absolute",
1382
+ inset: 0,
1383
+ display: "flex",
1384
+ alignItems: "center",
1385
+ justifyContent: "center",
1386
+ background: "rgba(0,0,0,0.72)",
1387
+ color: "#fff",
1388
+ zIndex: 60
1389
+ },
1390
+ children: /* @__PURE__ */ m("div", {
1391
+ style: {
1392
+ maxWidth: 480,
1393
+ textAlign: "center",
1394
+ padding: 24
1395
+ },
1396
+ children: [/* @__PURE__ */ p("h3", {
1397
+ style: { margin: "0 0 8px" },
1398
+ children: "Playback restricted"
1399
+ }), /* @__PURE__ */ p("p", {
1400
+ style: { margin: 0 },
1401
+ children: "Your account is missing a required license key. Please contact your administrator."
1402
+ })]
1403
+ })
1404
+ }),
1405
+ (q || tr) && /* @__PURE__ */ p("div", { className: "sdk-cast-bg" }),
1406
+ Zt && /* @__PURE__ */ m("div", {
1407
+ className: `sdk-mobile-overlay ${vr ? "active" : ""}`,
1408
+ onClick: ei,
1409
+ children: [Et && /* @__PURE__ */ p("div", {
1410
+ className: `sdk-mobile-doubletap ${Et}`,
1411
+ children: /* @__PURE__ */ m("div", {
1412
+ className: "sdk-mobile-doubletap-icon",
1413
+ children: [p(Et === "left" ? Se : Ce, { size: 26 }), /* @__PURE__ */ p("span", {
1414
+ className: "sdk-mobile-doubletap-label",
1415
+ children: "10s"
1416
+ })]
1417
+ })
1418
+ }), le && /* @__PURE__ */ m(f, { children: [
1419
+ /* @__PURE__ */ m("div", {
1420
+ className: "sdk-mobile-header sdk-mobile-ctrl",
1421
+ children: [/* @__PURE__ */ m("div", {
1422
+ className: "sdk-mobile-header-left",
1423
+ children: [(Kt || F) && /* @__PURE__ */ p("button", {
1424
+ className: "sdk-mobile-back-btn",
1425
+ onClick: Br,
1426
+ "aria-label": "Exit fullscreen",
1427
+ children: /* @__PURE__ */ p(pe, {
1428
+ size: 22,
1429
+ "aria-hidden": "true"
1430
+ })
1431
+ }), (Ke || gr) && /* @__PURE__ */ p("div", {
1432
+ className: "sdk-mobile-title",
1433
+ children: Ke || gr
1434
+ })]
1435
+ }), /* @__PURE__ */ m("div", {
1436
+ className: "sdk-mobile-header-actions",
1437
+ children: [
1438
+ N.enablePiP && /* @__PURE__ */ p("button", {
1439
+ className: "sdk-mobile-hdr-btn",
1440
+ onClick: () => {
1441
+ Y || zr();
1442
+ },
1443
+ style: { color: Qt ? h : "" },
1444
+ "aria-label": Qt ? "Exit picture-in-picture" : "Enter picture-in-picture",
1445
+ "aria-pressed": Qt,
1446
+ children: /* @__PURE__ */ p(be, {
1447
+ size: 20,
1448
+ "aria-hidden": "true"
1449
+ })
1450
+ }),
1451
+ N.enableChromecast && !Y && /* @__PURE__ */ p("button", {
1452
+ className: "sdk-mobile-hdr-btn",
1453
+ onClick: Wr,
1454
+ title: q ? `Casting to ${q} — tap to disconnect` : "Cast to device",
1455
+ "aria-label": q ? `Stop casting to ${q}` : "Cast to device",
1456
+ "aria-pressed": !!q,
1457
+ style: { color: q ? "#3b82f6" : "" },
1458
+ children: /* @__PURE__ */ p(fe, {
1459
+ size: 20,
1460
+ fill: q ? "currentColor" : "none",
1461
+ "aria-hidden": "true"
1462
+ })
1463
+ }),
1464
+ N.allowAirplay && $n && /* @__PURE__ */ p("button", {
1465
+ className: "sdk-mobile-hdr-btn",
1466
+ onClick: Gr,
1467
+ "aria-label": tr ? `Stop AirPlay to ${rr || "device"}` : "AirPlay to device",
1468
+ "aria-pressed": tr,
1469
+ style: { color: tr ? h : "" },
1470
+ children: /* @__PURE__ */ p(ue, {
1471
+ size: 20,
1472
+ "aria-hidden": "true"
1473
+ })
1474
+ })
1475
+ ]
1476
+ })]
1477
+ }),
1478
+ /* @__PURE__ */ m("div", {
1479
+ className: "sdk-mobile-center-controls sdk-mobile-ctrl",
1480
+ children: [
1481
+ !Y && /* @__PURE__ */ m("button", {
1482
+ className: "sdk-mobile-seek-btn",
1483
+ onClick: () => X(B(Math.max(0, z(Q) - 10))),
1484
+ "aria-label": "Rewind 10 seconds",
1485
+ children: [/* @__PURE__ */ p(Se, {
1486
+ size: 22,
1487
+ "aria-hidden": "true"
1488
+ }), /* @__PURE__ */ p("span", {
1489
+ className: "sdk-mobile-seek-label",
1490
+ "aria-hidden": "true",
1491
+ children: "10"
1492
+ })]
1493
+ }),
1494
+ /* @__PURE__ */ p("button", {
1495
+ className: "sdk-mobile-play-btn",
1496
+ onClick: Ar,
1497
+ "aria-label": en ? "Replay" : Xr ? "Pause" : "Play",
1498
+ children: en ? /* @__PURE__ */ p(Se, {
1499
+ size: 38,
1500
+ "aria-hidden": "true"
1501
+ }) : Xr ? /* @__PURE__ */ p(ye, {
1502
+ size: 38,
1503
+ fill: "currentColor",
1504
+ "aria-hidden": "true"
1505
+ }) : /* @__PURE__ */ p(xe, {
1506
+ size: 38,
1507
+ fill: "currentColor",
1508
+ style: { marginLeft: "3px" },
1509
+ "aria-hidden": "true"
1510
+ })
1511
+ }),
1512
+ !Y && /* @__PURE__ */ m("button", {
1513
+ className: "sdk-mobile-seek-btn",
1514
+ onClick: () => X(B(Math.min(R, z(Q) + 10))),
1515
+ "aria-label": "Skip forward 10 seconds",
1516
+ children: [/* @__PURE__ */ p(Ce, {
1517
+ size: 22,
1518
+ "aria-hidden": "true"
1519
+ }), /* @__PURE__ */ p("span", {
1520
+ className: "sdk-mobile-seek-label",
1521
+ "aria-hidden": "true",
1522
+ children: "10"
1523
+ })]
1524
+ })
1525
+ ]
1526
+ }),
1527
+ /* @__PURE__ */ m("div", {
1528
+ className: "sdk-mobile-bottom-bar sdk-mobile-ctrl",
1529
+ children: [
1530
+ N.enableKeyMoments && G && H.length > 0 && /* @__PURE__ */ p("div", {
1531
+ className: "sdk-mobile-chapters-scroll",
1532
+ children: H.map((e, t) => {
1533
+ let n = In.index === t;
1534
+ return /* @__PURE__ */ m("div", {
1535
+ role: "button",
1536
+ tabIndex: 0,
1537
+ className: `sdk-mobile-chapter-card${n ? " active" : ""}`,
1538
+ style: { borderColor: n ? h : void 0 },
1539
+ "aria-label": `${e.title}, ${Z(e.startTime)}${n ? ", current chapter" : ""}`,
1540
+ "aria-current": n ? "true" : void 0,
1541
+ onClick: () => {
1542
+ X(e.startTime);
1543
+ },
1544
+ onKeyDown: ni(() => X(e.startTime)),
1545
+ children: [/* @__PURE__ */ m("div", {
1546
+ className: "sdk-mobile-chapter-thumb",
1547
+ children: [Hn[t] || e.thumbnail ? /* @__PURE__ */ p("img", {
1548
+ src: Hn[t] || e.thumbnail,
1549
+ alt: "",
1550
+ "aria-hidden": "true",
1551
+ style: {
1552
+ width: "100%",
1553
+ height: "100%",
1554
+ objectFit: "cover",
1555
+ display: "block"
1556
+ }
1557
+ }) : /* @__PURE__ */ p(ge, {
1558
+ size: 16,
1559
+ "aria-hidden": "true",
1560
+ style: { color: n ? h : "rgba(255,255,255,0.3)" }
1561
+ }), /* @__PURE__ */ p("span", {
1562
+ className: "sdk-mobile-chapter-time-badge",
1563
+ "aria-hidden": "true",
1564
+ children: Z(e.startTime)
1565
+ })]
1566
+ }), /* @__PURE__ */ p("div", {
1567
+ className: "sdk-mobile-chapter-title",
1568
+ style: { color: n ? h : void 0 },
1569
+ children: e.title
1570
+ })]
1571
+ }, t);
1572
+ })
1573
+ }),
1574
+ /* @__PURE__ */ p("div", {
1575
+ ref: C,
1576
+ role: Y ? void 0 : "slider",
1577
+ "aria-label": Y ? void 0 : "Seek",
1578
+ "aria-valuemin": Y ? void 0 : 0,
1579
+ "aria-valuemax": Y ? void 0 : Math.round(R),
1580
+ "aria-valuenow": Y ? void 0 : Math.round(z(J === null ? P : J)),
1581
+ "aria-valuetext": Y ? void 0 : `${Z(z(J === null ? P : J))} of ${Z(R)}`,
1582
+ tabIndex: Y ? void 0 : 0,
1583
+ className: `sdk-seekbar-container sdk-mobile-seekbar${Y ? " sdk-ad-mode" : ""}`,
1584
+ onMouseDown: Y ? void 0 : Mr,
1585
+ onMouseMove: Y ? void 0 : Kr,
1586
+ onMouseLeave: Y ? void 0 : Yr,
1587
+ onTouchStart: Y ? void 0 : Jr,
1588
+ onKeyDown: Y ? void 0 : ri,
1589
+ style: {
1590
+ pointerEvents: Y ? "none" : void 0,
1591
+ touchAction: "none"
1592
+ },
1593
+ children: Y ? /* @__PURE__ */ p("div", {
1594
+ className: "sdk-ad-progress-fill",
1595
+ style: { width: (() => {
1596
+ let e = I.find((e) => P >= e.startTime && P < e.endTime);
1597
+ return e ? `${(P - e.startTime) / (e.endTime - e.startTime) * 100}%` : "0%";
1598
+ })() }
1599
+ }) : /* @__PURE__ */ m(f, { children: [
1600
+ /* @__PURE__ */ p("div", {
1601
+ className: "sdk-seekbar-buffered",
1602
+ style: { width: `${Rt ? (A && A.getBufferedRanges()[0]?.end || 0) / Rt * 100 : 0}%` }
1603
+ }),
1604
+ R > 0 && I.filter((e) => !an.has(e.startTime)).map((e, t) => /* @__PURE__ */ p("div", {
1605
+ className: "sdk-seekbar-adbreak",
1606
+ style: {
1607
+ left: `${z(e.startTime) / R * 100}%`,
1608
+ width: "3px"
1609
+ }
1610
+ }, t)),
1611
+ /* @__PURE__ */ p("div", {
1612
+ className: "sdk-seekbar-progress",
1613
+ style: {
1614
+ width: q ? `${Zr > 0 ? Q / Zr * 100 : 0}%` : `${R ? z(J === null ? P : J) / R * 100 : 0}%`,
1615
+ background: "#ffffff",
1616
+ boxShadow: "none"
1617
+ },
1618
+ children: /* @__PURE__ */ p("div", {
1619
+ className: "sdk-seekbar-handle",
1620
+ style: {
1621
+ opacity: 1,
1622
+ transform: "scale(1)"
1623
+ }
1624
+ })
1625
+ }),
1626
+ N.enableKeyMoments && H.map((e, t) => R === 0 ? null : /* @__PURE__ */ p("div", {
1627
+ className: "sdk-seekbar-chapter-marker sdk-desktop-chapter-dot",
1628
+ style: { left: `${z(e.startTime) / R * 100}%` }
1629
+ }, t))
1630
+ ] })
1631
+ }),
1632
+ /* @__PURE__ */ m("div", {
1633
+ className: "sdk-mobile-controls-row",
1634
+ children: [!Y && /* @__PURE__ */ p("span", {
1635
+ className: "sdk-time-display",
1636
+ children: q ? `${Z(Q)} / ${Z(Zr)}` : `${Z(z(J === null ? P : J))} / ${Z(R)}`
1637
+ }), /* @__PURE__ */ m("div", {
1638
+ className: "sdk-mobile-bottom-icons",
1639
+ children: [
1640
+ N.enableKeyMoments && H.length > 0 && !Y && /* @__PURE__ */ p("button", {
1641
+ className: `sdk-mobile-icon-btn${G ? " active" : ""}`,
1642
+ onClick: () => {
1643
+ Vn(!G);
1644
+ },
1645
+ "aria-label": G ? "Hide chapters" : "Show chapters",
1646
+ "aria-pressed": G,
1647
+ children: /* @__PURE__ */ p(ge, {
1648
+ size: 18,
1649
+ "aria-hidden": "true"
1650
+ })
1651
+ }),
1652
+ N.enableSubtitles && !Y && /* @__PURE__ */ m("div", {
1653
+ className: "sdk-menu-container",
1654
+ children: [/* @__PURE__ */ p("button", {
1655
+ className: `sdk-mobile-icon-btn${V === "off" ? "" : " active"}`,
1656
+ onClick: () => {
1657
+ ii("subtitles");
1658
+ },
1659
+ "aria-label": "Captions",
1660
+ "aria-haspopup": "listbox",
1661
+ "aria-expanded": U === "subtitles",
1662
+ children: /* @__PURE__ */ p(de, {
1663
+ size: 18,
1664
+ "aria-hidden": "true"
1665
+ })
1666
+ }), U === "subtitles" && /* @__PURE__ */ m("div", {
1667
+ ref: ai,
1668
+ className: "sdk-dropup-menu",
1669
+ role: "listbox",
1670
+ "aria-label": "Captions",
1671
+ children: [
1672
+ /* @__PURE__ */ p("div", {
1673
+ className: "sdk-dropup-header",
1674
+ "aria-hidden": "true",
1675
+ children: "Subtitles"
1676
+ }),
1677
+ /* @__PURE__ */ m("div", {
1678
+ role: "option",
1679
+ "aria-selected": V === "off",
1680
+ tabIndex: 0,
1681
+ className: `sdk-dropup-item ${V === "off" ? "active" : ""}`,
1682
+ onClick: () => Ir("off"),
1683
+ onKeyDown: $(() => Ir("off")),
1684
+ children: [/* @__PURE__ */ p("span", { children: "Off" }), V === "off" && /* @__PURE__ */ p(_, {
1685
+ size: 12,
1686
+ "aria-hidden": "true"
1687
+ })]
1688
+ }),
1689
+ An.map((e) => /* @__PURE__ */ m("div", {
1690
+ role: "option",
1691
+ "aria-selected": V === e.id,
1692
+ tabIndex: 0,
1693
+ className: `sdk-dropup-item ${V === e.id ? "active" : ""}`,
1694
+ onClick: () => Ir(e.id),
1695
+ onKeyDown: $(() => Ir(e.id)),
1696
+ children: [/* @__PURE__ */ p("span", { children: y(e) }), V === e.id && /* @__PURE__ */ p(_, {
1697
+ size: 12,
1698
+ "aria-hidden": "true"
1699
+ })]
1700
+ }, e.id))
1701
+ ]
1702
+ })]
1703
+ }),
1704
+ N.allowMultipleAudio && Mn.length > 1 && !Y && /* @__PURE__ */ m("div", {
1705
+ className: "sdk-menu-container",
1706
+ children: [/* @__PURE__ */ p("button", {
1707
+ className: `sdk-mobile-icon-btn${U === "audio" ? " active" : ""}`,
1708
+ onClick: () => {
1709
+ ii("audio");
1710
+ },
1711
+ "aria-label": "Audio track",
1712
+ "aria-haspopup": "listbox",
1713
+ "aria-expanded": U === "audio",
1714
+ children: /* @__PURE__ */ p(he, {
1715
+ size: 18,
1716
+ "aria-hidden": "true"
1717
+ })
1718
+ }), U === "audio" && /* @__PURE__ */ m("div", {
1719
+ ref: ai,
1720
+ className: "sdk-dropup-menu",
1721
+ role: "listbox",
1722
+ "aria-label": "Audio track",
1723
+ children: [/* @__PURE__ */ p("div", {
1724
+ className: "sdk-dropup-header",
1725
+ "aria-hidden": "true",
1726
+ children: "Audio Track"
1727
+ }), Mn.map((e) => /* @__PURE__ */ m("div", {
1728
+ role: "option",
1729
+ "aria-selected": Pn === e.id,
1730
+ tabIndex: 0,
1731
+ className: `sdk-dropup-item ${Pn === e.id ? "active" : ""}`,
1732
+ onClick: () => {
1733
+ A?.setAudioTrack(e.id), Fn(e.id), W("none"), K(`Audio: ${y(e)}`);
1734
+ },
1735
+ onKeyDown: $(() => {
1736
+ A?.setAudioTrack(e.id), Fn(e.id), W("none"), K(`Audio: ${y(e)}`);
1737
+ }),
1738
+ children: [/* @__PURE__ */ p("span", { children: y(e) }), Pn === e.id && /* @__PURE__ */ p(_, {
1739
+ size: 12,
1740
+ "aria-hidden": "true"
1741
+ })]
1742
+ }, e.id))]
1743
+ })]
1744
+ }),
1745
+ N.enablePlaybackSpeed && !Y && /* @__PURE__ */ m("div", {
1746
+ className: "sdk-menu-container",
1747
+ children: [/* @__PURE__ */ p("button", {
1748
+ className: `sdk-mobile-icon-btn${U === "speed" ? " active" : ""}`,
1749
+ onClick: () => {
1750
+ ii("speed");
1751
+ },
1752
+ "aria-label": "Playback speed",
1753
+ "aria-haspopup": "listbox",
1754
+ "aria-expanded": U === "speed",
1755
+ children: /* @__PURE__ */ p(me, {
1756
+ size: 18,
1757
+ "aria-hidden": "true"
1758
+ })
1759
+ }), U === "speed" && /* @__PURE__ */ m("div", {
1760
+ ref: ai,
1761
+ className: "sdk-dropup-menu",
1762
+ role: "listbox",
1763
+ "aria-label": "Playback speed",
1764
+ children: [/* @__PURE__ */ p("div", {
1765
+ className: "sdk-dropup-header",
1766
+ "aria-hidden": "true",
1767
+ children: "Speed"
1768
+ }), [
1769
+ .5,
1770
+ .75,
1771
+ 1,
1772
+ 1.25,
1773
+ 1.5,
1774
+ 2
1775
+ ].map((e) => /* @__PURE__ */ m("div", {
1776
+ role: "option",
1777
+ "aria-selected": zn === e,
1778
+ tabIndex: 0,
1779
+ className: `sdk-dropup-item ${zn === e ? "active" : ""}`,
1780
+ onClick: () => Pr(e),
1781
+ onKeyDown: $(() => Pr(e)),
1782
+ children: [/* @__PURE__ */ p("span", { children: e === 1 ? "Normal" : `${e}x` }), zn === e && /* @__PURE__ */ p(_, {
1783
+ size: 12,
1784
+ "aria-hidden": "true"
1785
+ })]
1786
+ }, e))]
1787
+ })]
1788
+ }),
1789
+ N.enableQuality && !Y && /* @__PURE__ */ m("div", {
1790
+ className: "sdk-menu-container",
1791
+ children: [/* @__PURE__ */ p("button", {
1792
+ className: `sdk-mobile-icon-btn${Tn.id === -1 ? "" : " active"}`,
1793
+ onClick: () => {
1794
+ ii("quality");
1795
+ },
1796
+ "aria-label": "Video quality",
1797
+ "aria-haspopup": "listbox",
1798
+ "aria-expanded": U === "quality",
1799
+ children: /* @__PURE__ */ p(Me, {
1800
+ size: 18,
1801
+ "aria-hidden": "true"
1802
+ })
1803
+ }), U === "quality" && /* @__PURE__ */ m("div", {
1804
+ ref: ai,
1805
+ className: "sdk-dropup-menu large",
1806
+ role: "listbox",
1807
+ "aria-label": "Video quality",
1808
+ children: [/* @__PURE__ */ p("div", {
1809
+ className: "sdk-dropup-header",
1810
+ "aria-hidden": "true",
1811
+ children: "Quality"
1812
+ }), Cn.map((e) => /* @__PURE__ */ m("div", {
1813
+ role: "option",
1814
+ "aria-selected": Tn.id === e.id,
1815
+ tabIndex: 0,
1816
+ className: `sdk-dropup-item ${Tn.id === e.id ? "active" : ""}`,
1817
+ onClick: () => Fr(e.id),
1818
+ onKeyDown: $(() => Fr(e.id)),
1819
+ children: [/* @__PURE__ */ p("span", { children: e.label }), Tn.id === e.id && /* @__PURE__ */ p(_, {
1820
+ size: 12,
1821
+ "aria-hidden": "true"
1822
+ })]
1823
+ }, e.id))]
1824
+ })]
1825
+ }),
1826
+ x && x.length > 1 && !Y && /* @__PURE__ */ m("div", {
1827
+ className: "sdk-menu-container",
1828
+ children: [/* @__PURE__ */ p("button", {
1829
+ className: `sdk-mobile-icon-btn${U === "sources" ? " active" : ""}`,
1830
+ onClick: () => {
1831
+ ii("sources");
1832
+ },
1833
+ "aria-label": "Select source",
1834
+ "aria-haspopup": "listbox",
1835
+ "aria-expanded": U === "sources",
1836
+ children: /* @__PURE__ */ p(we, {
1837
+ size: 18,
1838
+ "aria-hidden": "true"
1839
+ })
1840
+ }), U === "sources" && /* @__PURE__ */ m("div", {
1841
+ ref: ai,
1842
+ className: "sdk-dropup-menu",
1843
+ role: "listbox",
1844
+ "aria-label": "Select source",
1845
+ children: [/* @__PURE__ */ p("div", {
1846
+ className: "sdk-dropup-header",
1847
+ "aria-hidden": "true",
1848
+ children: "Source"
1849
+ }), x.map((e, t) => /* @__PURE__ */ m("div", {
1850
+ role: "option",
1851
+ "aria-selected": et === t,
1852
+ tabIndex: 0,
1853
+ className: `sdk-dropup-item ${et === t ? "active" : ""}`,
1854
+ onClick: () => Lr(t),
1855
+ onKeyDown: $(() => Lr(t)),
1856
+ children: [/* @__PURE__ */ p("span", { children: e.label }), et === t && /* @__PURE__ */ p(_, {
1857
+ size: 12,
1858
+ "aria-hidden": "true"
1859
+ })]
1860
+ }, t))]
1861
+ })]
1862
+ }),
1863
+ /* @__PURE__ */ p("button", {
1864
+ className: "sdk-mobile-icon-btn",
1865
+ onClick: Br,
1866
+ "aria-label": Kt || F ? "Exit fullscreen" : "Enter fullscreen",
1867
+ "aria-pressed": Kt || F,
1868
+ children: p(Kt ? ve : _e, {
1869
+ size: 18,
1870
+ "aria-hidden": "true"
1871
+ })
1872
+ })
1873
+ ]
1874
+ })]
1875
+ })
1876
+ ]
1877
+ })
1878
+ ] })]
1879
+ }),
1880
+ !Zt && /* @__PURE__ */ m("div", {
1881
+ className: "sdk-controls-overlay",
1882
+ onClick: (e) => {
1883
+ Y || e.target.closest(".sdk-desktop-header") || e.target.closest(".sdk-desktop-center-controls") || e.target.closest(".sdk-desktop-bottom") || Ar();
1884
+ },
1885
+ children: [/* @__PURE__ */ m("div", {
1886
+ className: "sdk-desktop-header",
1887
+ children: [/* @__PURE__ */ m("div", {
1888
+ className: "sdk-desktop-header-left",
1889
+ children: [(Kt || F) && /* @__PURE__ */ p("button", {
1890
+ className: "sdk-desktop-back-btn",
1891
+ onClick: (e) => {
1892
+ e.stopPropagation(), Br();
1893
+ },
1894
+ "aria-label": "Exit fullscreen",
1895
+ children: /* @__PURE__ */ p(pe, {
1896
+ size: 22,
1897
+ "aria-hidden": "true"
1898
+ })
1899
+ }), (Ke || gr) && /* @__PURE__ */ p("span", {
1900
+ className: "sdk-desktop-title",
1901
+ children: Ke || gr
1902
+ })]
1903
+ }), /* @__PURE__ */ m("div", {
1904
+ className: "sdk-desktop-header-right",
1905
+ children: [
1906
+ N.enableChromecast && !Y && /* @__PURE__ */ p("button", {
1907
+ className: "sdk-desktop-hdr-btn",
1908
+ onClick: (e) => {
1909
+ e.stopPropagation(), Wr();
1910
+ },
1911
+ title: q ? `Casting to ${q} — click to disconnect` : "Cast to device",
1912
+ "aria-label": q ? `Stop casting to ${q}` : "Cast to device",
1913
+ "aria-pressed": !!q,
1914
+ style: { color: q ? "#3b82f6" : "" },
1915
+ children: /* @__PURE__ */ p(fe, {
1916
+ size: 20,
1917
+ fill: q ? "currentColor" : "none",
1918
+ "aria-hidden": "true"
1919
+ })
1920
+ }),
1921
+ q && /* @__PURE__ */ m("span", {
1922
+ className: "sdk-cast-indicator",
1923
+ "aria-hidden": "true",
1924
+ children: [/* @__PURE__ */ p(fe, {
1925
+ size: 10,
1926
+ fill: "currentColor",
1927
+ "aria-hidden": "true"
1928
+ }), q]
1929
+ }),
1930
+ N.allowAirplay && $n && /* @__PURE__ */ p("button", {
1931
+ className: "sdk-desktop-hdr-btn",
1932
+ onClick: (e) => {
1933
+ e.stopPropagation(), Gr();
1934
+ },
1935
+ title: tr ? `AirPlay to ${rr || "device"} — click to disconnect` : "AirPlay to device",
1936
+ "aria-label": tr ? `Stop AirPlay to ${rr || "device"}` : "AirPlay to device",
1937
+ "aria-pressed": tr,
1938
+ style: { color: tr ? h : "" },
1939
+ children: /* @__PURE__ */ p(ue, {
1940
+ size: 20,
1941
+ "aria-hidden": "true"
1942
+ })
1943
+ })
1944
+ ]
1945
+ })]
1946
+ }), le && /* @__PURE__ */ m(f, { children: [
1947
+ /* @__PURE__ */ m("div", {
1948
+ className: "sdk-desktop-center-controls",
1949
+ style: { pointerEvents: "none" },
1950
+ children: [
1951
+ !Y && /* @__PURE__ */ p("button", {
1952
+ className: "sdk-desktop-seek-btn",
1953
+ style: { pointerEvents: "auto" },
1954
+ onClick: (e) => {
1955
+ e.stopPropagation(), X(B(Math.max(0, z(Q) - 10)));
1956
+ },
1957
+ title: "Rewind 10s",
1958
+ "aria-label": "Rewind 10 seconds",
1959
+ children: /* @__PURE__ */ m("div", {
1960
+ style: {
1961
+ position: "relative",
1962
+ display: "flex",
1963
+ alignItems: "center",
1964
+ justifyContent: "center"
1965
+ },
1966
+ children: [/* @__PURE__ */ p(Se, {
1967
+ size: 30,
1968
+ "aria-hidden": "true"
1969
+ }), /* @__PURE__ */ p("span", {
1970
+ className: "sdk-desktop-seek-label",
1971
+ "aria-hidden": "true",
1972
+ children: "10"
1973
+ })]
1974
+ })
1975
+ }),
1976
+ /* @__PURE__ */ p("button", {
1977
+ className: "sdk-desktop-play-btn",
1978
+ style: { pointerEvents: "auto" },
1979
+ onClick: (e) => {
1980
+ e.stopPropagation(), Ar();
1981
+ },
1982
+ title: en ? "Replay" : Xr ? "Pause" : "Play",
1983
+ "aria-label": en ? "Replay" : Xr ? "Pause" : "Play",
1984
+ children: en ? /* @__PURE__ */ p(Se, {
1985
+ size: 38,
1986
+ "aria-hidden": "true"
1987
+ }) : Xr ? /* @__PURE__ */ p(ye, {
1988
+ size: 38,
1989
+ fill: "currentColor",
1990
+ "aria-hidden": "true"
1991
+ }) : /* @__PURE__ */ p(xe, {
1992
+ size: 38,
1993
+ fill: "currentColor",
1994
+ style: { marginLeft: "4px" },
1995
+ "aria-hidden": "true"
1996
+ })
1997
+ }),
1998
+ !Y && /* @__PURE__ */ p("button", {
1999
+ className: "sdk-desktop-seek-btn",
2000
+ style: { pointerEvents: "auto" },
2001
+ onClick: (e) => {
2002
+ e.stopPropagation(), X(B(Math.min(R, z(Q) + 10)));
2003
+ },
2004
+ title: "Forward 10s",
2005
+ "aria-label": "Skip forward 10 seconds",
2006
+ children: /* @__PURE__ */ m("div", {
2007
+ style: {
2008
+ position: "relative",
2009
+ display: "flex",
2010
+ alignItems: "center",
2011
+ justifyContent: "center"
2012
+ },
2013
+ children: [/* @__PURE__ */ p(Ce, {
2014
+ size: 30,
2015
+ "aria-hidden": "true"
2016
+ }), /* @__PURE__ */ p("span", {
2017
+ className: "sdk-desktop-seek-label",
2018
+ "aria-hidden": "true",
2019
+ children: "10"
2020
+ })]
2021
+ })
2022
+ })
2023
+ ]
2024
+ }),
2025
+ N.enableKeyMoments && G && H.length > 0 && qe === "panel" && /* @__PURE__ */ m("div", {
2026
+ className: "sdk-chapters-panel",
2027
+ onClick: (e) => e.stopPropagation(),
2028
+ children: [/* @__PURE__ */ p("div", {
2029
+ className: "sdk-chapters-panel-header",
2030
+ children: /* @__PURE__ */ p("span", {
2031
+ className: "sdk-chapters-panel-title",
2032
+ children: "Chapters"
2033
+ })
2034
+ }), /* @__PURE__ */ p("div", {
2035
+ className: "sdk-chapters-panel-list",
2036
+ children: H.map((e, t) => {
2037
+ let n = In.index === t;
2038
+ return /* @__PURE__ */ m("div", {
2039
+ role: "button",
2040
+ tabIndex: 0,
2041
+ className: `sdk-chapters-panel-item${n ? " active" : ""}`,
2042
+ "aria-label": `${e.title}, ${Z(e.startTime)}${n ? ", current chapter" : ""}`,
2043
+ "aria-current": n ? "true" : void 0,
2044
+ onClick: () => Rr(e.startTime),
2045
+ onKeyDown: ni(() => Rr(e.startTime)),
2046
+ children: [/* @__PURE__ */ p("div", {
2047
+ className: "sdk-chapters-panel-thumb",
2048
+ children: Hn[t] || e.thumbnail ? /* @__PURE__ */ p("img", {
2049
+ src: Hn[t] || e.thumbnail,
2050
+ alt: "",
2051
+ "aria-hidden": "true",
2052
+ style: {
2053
+ width: "100%",
2054
+ height: "100%",
2055
+ objectFit: "cover",
2056
+ display: "block"
2057
+ }
2058
+ }) : /* @__PURE__ */ p(ge, {
2059
+ size: 18,
2060
+ "aria-hidden": "true",
2061
+ style: { color: "rgba(255,255,255,0.3)" }
2062
+ })
2063
+ }), /* @__PURE__ */ m("div", {
2064
+ className: "sdk-chapters-panel-info",
2065
+ children: [
2066
+ /* @__PURE__ */ p("div", {
2067
+ className: "sdk-chapters-panel-item-title",
2068
+ children: e.title
2069
+ }),
2070
+ e.description && /* @__PURE__ */ p("div", {
2071
+ className: "sdk-chapters-panel-item-desc",
2072
+ children: e.description
2073
+ }),
2074
+ /* @__PURE__ */ p("div", {
2075
+ className: "sdk-chapters-panel-item-time",
2076
+ "aria-hidden": "true",
2077
+ children: Z(e.startTime)
2078
+ })
2079
+ ]
2080
+ })]
2081
+ }, t);
2082
+ })
2083
+ })]
2084
+ }),
2085
+ /* @__PURE__ */ m("div", {
2086
+ className: "sdk-desktop-bottom",
2087
+ children: [
2088
+ N.enableKeyMoments && G && H.length > 0 && qe === "strip" && /* @__PURE__ */ p("div", {
2089
+ className: "sdk-desktop-chapters-strip",
2090
+ children: H.map((e, t) => {
2091
+ let n = In.index === t;
2092
+ return /* @__PURE__ */ m("div", {
2093
+ role: "button",
2094
+ tabIndex: 0,
2095
+ className: `sdk-desktop-chapter-card${n ? " active" : ""}`,
2096
+ "aria-label": `${e.title}, ${Z(e.startTime)}${n ? ", current chapter" : ""}`,
2097
+ "aria-current": n ? "true" : void 0,
2098
+ onClick: (t) => {
2099
+ t.stopPropagation(), Rr(e.startTime);
2100
+ },
2101
+ onKeyDown: ni(() => Rr(e.startTime)),
2102
+ children: [
2103
+ /* @__PURE__ */ p("div", {
2104
+ className: "sdk-desktop-chapter-thumb",
2105
+ children: Hn[t] || e.thumbnail ? /* @__PURE__ */ p("img", {
2106
+ src: Hn[t] || e.thumbnail,
2107
+ alt: "",
2108
+ "aria-hidden": "true",
2109
+ style: {
2110
+ width: "100%",
2111
+ height: "100%",
2112
+ objectFit: "cover",
2113
+ display: "block"
2114
+ }
2115
+ }) : /* @__PURE__ */ p(ge, {
2116
+ size: 18,
2117
+ "aria-hidden": "true",
2118
+ style: { color: "rgba(255,255,255,0.35)" }
2119
+ })
2120
+ }),
2121
+ /* @__PURE__ */ p("div", {
2122
+ className: "sdk-desktop-chapter-title",
2123
+ children: e.title
2124
+ }),
2125
+ /* @__PURE__ */ p("div", {
2126
+ className: "sdk-desktop-chapter-time",
2127
+ "aria-hidden": "true",
2128
+ children: Z(e.startTime)
2129
+ })
2130
+ ]
2131
+ }, t);
2132
+ })
2133
+ }),
2134
+ /* @__PURE__ */ p("div", {
2135
+ ref: C,
2136
+ role: Y ? void 0 : "slider",
2137
+ "aria-label": Y ? void 0 : "Seek",
2138
+ "aria-valuemin": Y ? void 0 : 0,
2139
+ "aria-valuemax": Y ? void 0 : Math.round(R),
2140
+ "aria-valuenow": Y ? void 0 : Math.round(z(J === null ? P : J)),
2141
+ "aria-valuetext": Y ? void 0 : `${Z(z(J === null ? P : J))} of ${Z(R)}`,
2142
+ tabIndex: Y ? void 0 : 0,
2143
+ className: `sdk-seekbar-container sdk-desktop-seekbar${Y ? " sdk-ad-mode" : ""}`,
2144
+ onMouseDown: Y ? void 0 : Mr,
2145
+ onMouseMove: Y ? void 0 : Kr,
2146
+ onMouseLeave: Y ? void 0 : Yr,
2147
+ onTouchStart: Y ? void 0 : Jr,
2148
+ onKeyDown: Y ? void 0 : ri,
2149
+ style: { pointerEvents: Y ? "none" : void 0 },
2150
+ children: Y ? /* @__PURE__ */ p("div", {
2151
+ className: "sdk-ad-progress-fill",
2152
+ style: { width: (() => {
2153
+ let e = I.find((e) => P >= e.startTime && P < e.endTime);
2154
+ return e ? `${(P - e.startTime) / (e.endTime - e.startTime) * 100}%` : "0%";
2155
+ })() }
2156
+ }) : /* @__PURE__ */ m(f, { children: [
2157
+ /* @__PURE__ */ p("div", {
2158
+ className: "sdk-seekbar-buffered",
2159
+ style: { width: `${Rt ? (A && A.getBufferedRanges()[0]?.end || 0) / Rt * 100 : 0}%` }
2160
+ }),
2161
+ R > 0 && I.filter((e) => !an.has(e.startTime)).map((e, t) => /* @__PURE__ */ p("div", {
2162
+ className: "sdk-seekbar-adbreak",
2163
+ style: {
2164
+ left: `${z(e.startTime) / R * 100}%`,
2165
+ width: "3px"
2166
+ }
2167
+ }, t)),
2168
+ /* @__PURE__ */ p("div", {
2169
+ className: "sdk-seekbar-progress",
2170
+ style: {
2171
+ width: q ? `${Zr > 0 ? Q / Zr * 100 : 0}%` : `${R ? z(J === null ? P : J) / R * 100 : 0}%`,
2172
+ background: "#ffffff",
2173
+ boxShadow: "none"
2174
+ },
2175
+ children: /* @__PURE__ */ p("div", { className: "sdk-seekbar-handle" })
2176
+ }),
2177
+ N.enableKeyMoments && H.map((e, t) => R === 0 ? null : /* @__PURE__ */ p("div", {
2178
+ className: "sdk-seekbar-chapter-marker sdk-desktop-chapter-dot",
2179
+ style: { left: `${z(e.startTime) / R * 100}%` }
2180
+ }, t)),
2181
+ ar !== null && dr && /* @__PURE__ */ m("div", {
2182
+ className: "sdk-thumbnail-tooltip",
2183
+ style: { left: `${sr}px` },
2184
+ children: [
2185
+ /* @__PURE__ */ p("div", {
2186
+ className: "sdk-thumbnail-preview",
2187
+ children: /* @__PURE__ */ p("img", {
2188
+ src: dr,
2189
+ alt: "preview",
2190
+ style: {
2191
+ width: "100%",
2192
+ height: "100%",
2193
+ objectFit: "cover",
2194
+ borderRadius: "8px",
2195
+ display: "block"
2196
+ }
2197
+ })
2198
+ }),
2199
+ pr && /* @__PURE__ */ p("div", {
2200
+ className: "sdk-thumbnail-chapter-name",
2201
+ children: pr.title
2202
+ }),
2203
+ /* @__PURE__ */ p("div", {
2204
+ className: "sdk-thumbnail-time-label",
2205
+ children: Z(z(lr))
2206
+ })
2207
+ ]
2208
+ })
2209
+ ] })
2210
+ }),
2211
+ /* @__PURE__ */ m("div", {
2212
+ className: "sdk-desktop-controls-row",
2213
+ children: [/* @__PURE__ */ m("div", {
2214
+ className: "sdk-desktop-left-controls",
2215
+ children: [!Y && /* @__PURE__ */ p("div", {
2216
+ className: "sdk-time-display",
2217
+ children: q ? `${Z(Q)} / ${Z(Zr)}` : `${Z(z(J === null ? P : J))} / ${Z(R)}`
2218
+ }), Je === "slider" && /* @__PURE__ */ m("div", {
2219
+ className: "sdk-volume-control",
2220
+ children: [/* @__PURE__ */ p("button", {
2221
+ className: "sdk-desktop-icon-btn",
2222
+ onClick: (e) => {
2223
+ e.stopPropagation(), Nr();
2224
+ },
2225
+ title: $r ? "Unmute" : "Mute",
2226
+ "aria-label": $r ? "Unmute" : "Mute",
2227
+ "aria-pressed": $r,
2228
+ children: ti()
2229
+ }), /* @__PURE__ */ p("input", {
2230
+ type: "range",
2231
+ className: "sdk-volume-slider",
2232
+ min: 0,
2233
+ max: 1,
2234
+ step: .02,
2235
+ value: $r ? 0 : Qr,
2236
+ "aria-label": "Volume",
2237
+ "aria-valuetext": $r ? "Muted" : `${Math.round(Qr * 100)}%`,
2238
+ style: { "--vol-pct": Math.round(($r ? 0 : Qr) * 100) },
2239
+ onChange: (e) => {
2240
+ let t = parseFloat(e.target.value);
2241
+ q ? (A?.casting.remoteSetVolume(t), t > 0 && A?.casting.remoteSetMute(!1)) : (A?.setVolume(t), t > 0 && Ht && A?.setMute(!1));
2242
+ },
2243
+ onClick: (e) => e.stopPropagation()
2244
+ })]
2245
+ })]
2246
+ }), /* @__PURE__ */ m("div", {
2247
+ className: "sdk-desktop-right-icons",
2248
+ children: [
2249
+ N.enableKeyMoments && H.length > 0 && !Y && /* @__PURE__ */ p("button", {
2250
+ className: `sdk-desktop-icon-btn${G ? " active" : ""}`,
2251
+ onClick: (e) => {
2252
+ e.stopPropagation(), Vn(!G);
2253
+ },
2254
+ title: "Key Moments",
2255
+ "aria-label": G ? "Hide chapters" : "Show chapters",
2256
+ "aria-pressed": G,
2257
+ children: /* @__PURE__ */ p(ge, {
2258
+ size: 20,
2259
+ "aria-hidden": "true"
2260
+ })
2261
+ }),
2262
+ N.enableSubtitles && !Y && /* @__PURE__ */ m("div", {
2263
+ className: "sdk-menu-container",
2264
+ children: [/* @__PURE__ */ p("button", {
2265
+ className: `sdk-desktop-icon-btn${V === "off" ? "" : " active"}`,
2266
+ onClick: (e) => {
2267
+ e.stopPropagation(), ii("subtitles");
2268
+ },
2269
+ title: "Captions",
2270
+ "aria-label": "Captions",
2271
+ "aria-haspopup": "listbox",
2272
+ "aria-expanded": U === "subtitles",
2273
+ children: /* @__PURE__ */ p(de, {
2274
+ size: 20,
2275
+ "aria-hidden": "true"
2276
+ })
2277
+ }), U === "subtitles" && /* @__PURE__ */ m("div", {
2278
+ ref: ai,
2279
+ className: "sdk-dropup-menu",
2280
+ role: "listbox",
2281
+ "aria-label": "Captions",
2282
+ children: [
2283
+ /* @__PURE__ */ p("div", {
2284
+ className: "sdk-dropup-header",
2285
+ "aria-hidden": "true",
2286
+ children: "Subtitles"
2287
+ }),
2288
+ /* @__PURE__ */ m("div", {
2289
+ role: "option",
2290
+ "aria-selected": V === "off",
2291
+ tabIndex: 0,
2292
+ className: `sdk-dropup-item ${V === "off" ? "active" : ""}`,
2293
+ onClick: () => Ir("off"),
2294
+ onKeyDown: $(() => Ir("off")),
2295
+ children: [/* @__PURE__ */ p("span", { children: "Off" }), V === "off" && /* @__PURE__ */ p(_, {
2296
+ size: 12,
2297
+ "aria-hidden": "true"
2298
+ })]
2299
+ }),
2300
+ An.map((e) => /* @__PURE__ */ m("div", {
2301
+ role: "option",
2302
+ "aria-selected": V === e.id,
2303
+ tabIndex: 0,
2304
+ className: `sdk-dropup-item ${V === e.id ? "active" : ""}`,
2305
+ onClick: () => Ir(e.id),
2306
+ onKeyDown: $(() => Ir(e.id)),
2307
+ children: [/* @__PURE__ */ p("span", { children: y(e) }), V === e.id && /* @__PURE__ */ p(_, {
2308
+ size: 12,
2309
+ "aria-hidden": "true"
2310
+ })]
2311
+ }, e.id))
2312
+ ]
2313
+ })]
2314
+ }),
2315
+ N.allowMultipleAudio && Mn.length > 1 && !Y && /* @__PURE__ */ m("div", {
2316
+ className: "sdk-menu-container",
2317
+ children: [/* @__PURE__ */ p("button", {
2318
+ className: `sdk-desktop-icon-btn${U === "audio" ? " active" : ""}`,
2319
+ onClick: (e) => {
2320
+ e.stopPropagation(), ii("audio");
2321
+ },
2322
+ title: "Audio Track",
2323
+ "aria-label": "Audio track",
2324
+ "aria-haspopup": "listbox",
2325
+ "aria-expanded": U === "audio",
2326
+ children: /* @__PURE__ */ p(he, {
2327
+ size: 20,
2328
+ "aria-hidden": "true"
2329
+ })
2330
+ }), U === "audio" && /* @__PURE__ */ m("div", {
2331
+ ref: ai,
2332
+ className: "sdk-dropup-menu",
2333
+ role: "listbox",
2334
+ "aria-label": "Audio track",
2335
+ children: [/* @__PURE__ */ p("div", {
2336
+ className: "sdk-dropup-header",
2337
+ "aria-hidden": "true",
2338
+ children: "Audio Track"
2339
+ }), Mn.map((e) => /* @__PURE__ */ m("div", {
2340
+ role: "option",
2341
+ "aria-selected": Pn === e.id,
2342
+ tabIndex: 0,
2343
+ className: `sdk-dropup-item ${Pn === e.id ? "active" : ""}`,
2344
+ onClick: () => {
2345
+ A?.setAudioTrack(e.id), Fn(e.id), W("none"), K(`Audio: ${y(e)}`);
2346
+ },
2347
+ onKeyDown: $(() => {
2348
+ A?.setAudioTrack(e.id), Fn(e.id), W("none"), K(`Audio: ${y(e)}`);
2349
+ }),
2350
+ children: [/* @__PURE__ */ p("span", { children: y(e) }), Pn === e.id && /* @__PURE__ */ p(_, {
2351
+ size: 12,
2352
+ "aria-hidden": "true"
2353
+ })]
2354
+ }, e.id))]
2355
+ })]
2356
+ }),
2357
+ N.enablePlaybackSpeed && !Y && /* @__PURE__ */ m("div", {
2358
+ className: "sdk-menu-container",
2359
+ children: [/* @__PURE__ */ p("button", {
2360
+ className: `sdk-desktop-icon-btn${U === "speed" ? " active" : ""}`,
2361
+ onClick: (e) => {
2362
+ e.stopPropagation(), ii("speed");
2363
+ },
2364
+ title: "Playback Speed",
2365
+ "aria-label": "Playback speed",
2366
+ "aria-haspopup": "listbox",
2367
+ "aria-expanded": U === "speed",
2368
+ children: /* @__PURE__ */ p(me, {
2369
+ size: 20,
2370
+ "aria-hidden": "true"
2371
+ })
2372
+ }), U === "speed" && /* @__PURE__ */ m("div", {
2373
+ ref: ai,
2374
+ className: "sdk-dropup-menu",
2375
+ role: "listbox",
2376
+ "aria-label": "Playback speed",
2377
+ children: [/* @__PURE__ */ p("div", {
2378
+ className: "sdk-dropup-header",
2379
+ "aria-hidden": "true",
2380
+ children: "Speed"
2381
+ }), [
2382
+ .5,
2383
+ .75,
2384
+ 1,
2385
+ 1.25,
2386
+ 1.5,
2387
+ 2
2388
+ ].map((e) => /* @__PURE__ */ m("div", {
2389
+ role: "option",
2390
+ "aria-selected": zn === e,
2391
+ tabIndex: 0,
2392
+ className: `sdk-dropup-item ${zn === e ? "active" : ""}`,
2393
+ onClick: () => Pr(e),
2394
+ onKeyDown: $(() => Pr(e)),
2395
+ children: [/* @__PURE__ */ p("span", { children: e === 1 ? "Normal" : `${e}x` }), zn === e && /* @__PURE__ */ p(_, {
2396
+ size: 12,
2397
+ "aria-hidden": "true"
2398
+ })]
2399
+ }, e))]
2400
+ })]
2401
+ }),
2402
+ N.enableQuality && !Y && /* @__PURE__ */ m("div", {
2403
+ className: "sdk-menu-container",
2404
+ children: [/* @__PURE__ */ p("button", {
2405
+ className: `sdk-desktop-icon-btn${Tn.id === -1 ? "" : " active"}`,
2406
+ onClick: (e) => {
2407
+ e.stopPropagation(), ii("quality");
2408
+ },
2409
+ title: "Quality",
2410
+ "aria-label": "Video quality",
2411
+ "aria-haspopup": "listbox",
2412
+ "aria-expanded": U === "quality",
2413
+ children: /* @__PURE__ */ p(Me, {
2414
+ size: 20,
2415
+ "aria-hidden": "true"
2416
+ })
2417
+ }), U === "quality" && /* @__PURE__ */ m("div", {
2418
+ ref: ai,
2419
+ className: "sdk-dropup-menu large",
2420
+ role: "listbox",
2421
+ "aria-label": "Video quality",
2422
+ children: [/* @__PURE__ */ p("div", {
2423
+ className: "sdk-dropup-header",
2424
+ "aria-hidden": "true",
2425
+ children: "Quality"
2426
+ }), Cn.map((e) => /* @__PURE__ */ m("div", {
2427
+ role: "option",
2428
+ "aria-selected": Tn.id === e.id,
2429
+ tabIndex: 0,
2430
+ className: `sdk-dropup-item ${Tn.id === e.id ? "active" : ""}`,
2431
+ onClick: () => Fr(e.id),
2432
+ onKeyDown: $(() => Fr(e.id)),
2433
+ children: [/* @__PURE__ */ p("span", { children: e.label }), Tn.id === e.id && /* @__PURE__ */ p(_, {
2434
+ size: 12,
2435
+ "aria-hidden": "true"
2436
+ })]
2437
+ }, e.id))]
2438
+ })]
2439
+ }),
2440
+ x && x.length > 1 && !Y && /* @__PURE__ */ m("div", {
2441
+ className: "sdk-menu-container",
2442
+ children: [/* @__PURE__ */ p("button", {
2443
+ className: `sdk-desktop-icon-btn${U === "sources" ? " active" : ""}`,
2444
+ onClick: (e) => {
2445
+ e.stopPropagation(), ii("sources");
2446
+ },
2447
+ title: "Select Source",
2448
+ "aria-label": "Select source",
2449
+ "aria-haspopup": "listbox",
2450
+ "aria-expanded": U === "sources",
2451
+ children: /* @__PURE__ */ p(we, {
2452
+ size: 20,
2453
+ "aria-hidden": "true"
2454
+ })
2455
+ }), U === "sources" && /* @__PURE__ */ m("div", {
2456
+ ref: ai,
2457
+ className: "sdk-dropup-menu",
2458
+ role: "listbox",
2459
+ "aria-label": "Select source",
2460
+ children: [/* @__PURE__ */ p("div", {
2461
+ className: "sdk-dropup-header",
2462
+ "aria-hidden": "true",
2463
+ children: "Source"
2464
+ }), x.map((e, t) => /* @__PURE__ */ m("div", {
2465
+ role: "option",
2466
+ "aria-selected": et === t,
2467
+ tabIndex: 0,
2468
+ className: `sdk-dropup-item ${et === t ? "active" : ""}`,
2469
+ onClick: () => Lr(t),
2470
+ onKeyDown: $(() => Lr(t)),
2471
+ children: [/* @__PURE__ */ p("span", { children: e.label }), et === t && /* @__PURE__ */ p(_, {
2472
+ size: 12,
2473
+ "aria-hidden": "true"
2474
+ })]
2475
+ }, t))]
2476
+ })]
2477
+ }),
2478
+ N.enablePiP && !Y && /* @__PURE__ */ p("button", {
2479
+ className: `sdk-desktop-icon-btn${Qt ? " active" : ""}`,
2480
+ onClick: (e) => {
2481
+ e.stopPropagation(), zr();
2482
+ },
2483
+ title: "Picture-in-Picture",
2484
+ "aria-label": Qt ? "Exit picture-in-picture" : "Enter picture-in-picture",
2485
+ "aria-pressed": Qt,
2486
+ children: /* @__PURE__ */ p(be, {
2487
+ size: 20,
2488
+ "aria-hidden": "true"
2489
+ })
2490
+ }),
2491
+ Je === "button" && /* @__PURE__ */ p("button", {
2492
+ className: "sdk-desktop-icon-btn",
2493
+ onClick: (e) => {
2494
+ e.stopPropagation(), Nr();
2495
+ },
2496
+ title: $r ? "Unmute" : "Mute",
2497
+ "aria-label": $r ? "Unmute" : "Mute",
2498
+ "aria-pressed": $r,
2499
+ children: ti()
2500
+ }),
2501
+ Be && /* @__PURE__ */ p("button", {
2502
+ className: "sdk-desktop-icon-btn",
2503
+ onClick: (e) => {
2504
+ e.stopPropagation(), Br();
2505
+ },
2506
+ title: Kt || F ? "Exit fullscreen" : "Fullscreen",
2507
+ "aria-label": Kt || F ? "Exit fullscreen" : "Enter fullscreen",
2508
+ "aria-pressed": Kt || F,
2509
+ children: p(Kt ? ve : _e, {
2510
+ size: 20,
2511
+ "aria-hidden": "true"
2512
+ })
2513
+ })
2514
+ ]
2515
+ })]
2516
+ })
2517
+ ]
2518
+ })
2519
+ ] })]
2520
+ })
2521
+ ]
2522
+ });
2523
+ }, Re = "https://dev-api.go-boss.com";
2524
+ function ze(e) {
2525
+ return {
2526
+ "x-player-key": e,
2527
+ "Content-Type": "application/json"
2528
+ };
2529
+ }
2530
+ async function Be(e, t = Re) {
2531
+ let n = await fetch(`${t}/api/player/sdk/init`, {
2532
+ method: "POST",
2533
+ headers: ze(e),
2534
+ body: JSON.stringify({})
2535
+ });
2536
+ if (!n.ok) throw Error(`SDK init failed: ${n.status}`);
2537
+ let r = await n.json();
2538
+ return console.log("[SDK] Init response:", r), r;
2539
+ }
2540
+ async function Ve(e, t, n, r = Re) {
2541
+ let i = await fetch(`${r}/api/player/sdk/session/start`, {
2542
+ method: "POST",
2543
+ headers: ze(e),
2544
+ body: JSON.stringify({
2545
+ sessionId: t,
2546
+ videoId: n
2547
+ })
2548
+ });
2549
+ if (!i.ok) throw Error(`Session start failed: ${i.status}`);
2550
+ let a = await i.json().catch(() => null);
2551
+ console.log("[SDK] Session start response:", a);
2552
+ }
2553
+ async function He(e, t, n, r, i = Re) {
2554
+ let a = {
2555
+ sessionId: t,
2556
+ currentTime: n,
2557
+ duration: r
2558
+ };
2559
+ console.log("[SDK] Heartbeat request:", a);
2560
+ let o = await fetch(`${i}/api/player/sdk/session/heartbeat`, {
2561
+ method: "POST",
2562
+ headers: ze(e),
2563
+ body: JSON.stringify(a)
2564
+ });
2565
+ if (!o.ok) throw Error(`Heartbeat failed: ${o.status}`);
2566
+ let s = await o.json().catch(() => null);
2567
+ console.log("[SDK] Heartbeat response:", s);
2568
+ }
2569
+ async function Ue(e, t, n = Re) {
2570
+ let r = await fetch(`${n}/api/player/sdk/session/end`, {
2571
+ method: "POST",
2572
+ headers: ze(e),
2573
+ body: JSON.stringify({ sessionId: t })
2574
+ });
2575
+ if (!r.ok) throw Error(`Session end failed: ${r.status}`);
2576
+ let i = await r.json().catch(() => null);
2577
+ console.log("[SDK] Session end response:", i);
2578
+ }
2579
+ function We(e, t, n = Re) {
2580
+ fetch(`${n}/api/player/sdk/session/end`, {
2581
+ method: "POST",
2582
+ headers: ze(e),
2583
+ body: JSON.stringify({ sessionId: t }),
2584
+ keepalive: !0
2585
+ });
2586
+ }
2587
+ //#endregion
2588
+ //#region src/BossVideoPlayer.tsx
2589
+ var Ge = {
2590
+ subtitles: "subtitle_support",
2591
+ ads: "ad_support",
2592
+ chapterMarkers: "key_moments",
2593
+ playbackSpeed: "playback_speed",
2594
+ airplay: "airplay",
2595
+ chromecast: "chromecast",
2596
+ pictureInPicture: "picture_in_picture",
2597
+ multipleResolution: "multiple_resolution",
2598
+ multipleAudio: "multiple_audio",
2599
+ drmProtection: "drm_protection",
2600
+ screenRecordingPrevention: "screen_recording_prevention",
2601
+ signalStrength: "signal_strength"
2602
+ };
2603
+ function Ke(e) {
2604
+ let t = {
2605
+ m3u8_playback: !0,
2606
+ subtitle_support: !1,
2607
+ playback_speed: !1,
2608
+ airplay: !1,
2609
+ chromecast: !1,
2610
+ picture_in_picture: !1,
2611
+ multiple_resolution: !1,
2612
+ multiple_audio: !1,
2613
+ key_moments: !1,
2614
+ drm_protection: !1,
2615
+ screen_recording_prevention: !1,
2616
+ signal_strength: !1,
2617
+ ad_support: !1
2618
+ };
2619
+ for (let [n, r] of Object.entries(Ge)) n in e && (t[r] = e[n]);
2620
+ return t;
2621
+ }
2622
+ function qe(e) {
2623
+ if (!e) return (e) => e;
2624
+ let t = [];
2625
+ for (let n of e.split(",")) {
2626
+ let [e, r] = n.split("=");
2627
+ e?.trim() && r?.trim() && t.push({
2628
+ domain: e.trim(),
2629
+ proxyPath: r.trim()
2630
+ });
2631
+ }
2632
+ return (e) => {
2633
+ for (let { domain: n, proxyPath: r } of t) if (e.includes(n)) try {
2634
+ let t = new URL(e);
2635
+ return `${r}${t.pathname}${t.search}`;
2636
+ } catch {
2637
+ return e.replace(`https://${n}`, r);
2638
+ }
2639
+ return e;
2640
+ };
2641
+ }
2642
+ var Je = 3e4;
2643
+ function b({ playerKey: e, src: t, subtitles: n, licenseKey: r, themeColor: i = "#6366f1", firebaseConfig: a, proxyDomains: s, apiBaseUrl: l, adTrackingUrl: f, overlayAdUrl: ee, title: ne, watermark: re, autoplay: h = !1, muted: ie = !1, autoFullscreen: ae = !1, enableControls: oe = !0, enableSkipAd: se, skipAdAfterSeconds: ce, chaptersDisplayMode: le = "strip", volumeControlType: g = "slider", subtitleStyle: ue, drmConfig: de, onAnalyticsEvent: fe, onKeyMomentsLoaded: _, initialTime: pe, onTimeUpdate: me }) {
2644
+ let [he, ge] = d([]), [_e, ve] = d(0), ye = Array.isArray(t) ? t : [{
2645
+ label: "Default",
2646
+ url: t
2647
+ }], be = ye[_e]?.url ?? ye[0]?.url ?? "", [xe, Se] = d("loading"), [Ce, we] = d(null), [Te, Ee] = d(0), [De, Oe] = d("network"), ke = u(null), Ae = u(!1), je = u(""), Me = u(!1), Ne = u(!1), v = u(null), Pe = u(0), y = u(null), Fe = u({
2648
+ currentTime: 0,
2649
+ duration: 0
2650
+ }), Ie = u(() => {}), Re = be.split("/").filter(Boolean), ze = (Re[Re.length - 1] ?? "").replace(/\.m3u8.*$/, "") || "video", Ge = o(() => qe(s), [s])();
2651
+ c(() => {
2652
+ document.documentElement.style.setProperty("--accent-indigo", i);
2653
+ let e = i.replace("#", ""), t = "99, 102, 241";
2654
+ e.length === 6 && (t = `${parseInt(e.substring(0, 2), 16)}, ${parseInt(e.substring(2, 4), 16)}, ${parseInt(e.substring(4, 6), 16)}`), document.documentElement.style.setProperty("--accent-indigo-rgb", t);
2655
+ }, [i]), c(() => {
2656
+ let t = !1;
2657
+ return Be(e, l).then((e) => {
2658
+ if (t) return;
2659
+ ke.current = e;
2660
+ let { features: n, planTier: r } = e.result.data, i = {
2661
+ package: r,
2662
+ is_active: !0,
2663
+ features: Ke(n),
2664
+ limits: { streaming_minutes: 0 }
2665
+ };
2666
+ console.log("[SDK] Player key validated. Features:", i.features), we(i), Se("ready");
2667
+ }).catch((e) => {
2668
+ if (t) return;
2669
+ console.error("[SDK] Player key validation failed:", e);
2670
+ let n = e.message ?? "";
2671
+ Oe(/init failed: 4\d\d/.test(n) ? "auth" : "network"), Se("error");
2672
+ }), () => {
2673
+ t = !0, v.current &&= (clearTimeout(v.current), null), Pe.current = 0, y.current = null, Se("loading"), we(null), Me.current = !1, je.current = "";
2674
+ };
2675
+ }, [
2676
+ e,
2677
+ l,
2678
+ Te
2679
+ ]);
2680
+ let b = o(() => {
2681
+ v.current && (clearTimeout(v.current), v.current = null, y.current !== null && (Pe.current += Date.now() - y.current, y.current = null));
2682
+ }, []), Ye = o(() => {
2683
+ v.current &&= (clearTimeout(v.current), null), Pe.current = 0, y.current = null;
2684
+ }, []), Xe = o(() => {
2685
+ if (v.current || !je.current) return;
2686
+ y.current = Date.now();
2687
+ let t = Je - Pe.current;
2688
+ v.current = setTimeout(() => {
2689
+ v.current = null, Pe.current = 0, y.current = null;
2690
+ let { currentTime: t, duration: n } = Fe.current;
2691
+ console.log("[SDK] Heartbeat timer fired — 30s of real content elapsed"), He(e, je.current, t, n, l).catch((e) => console.warn("[SDK] Heartbeat failed:", e.message)), Ie.current();
2692
+ }, t);
2693
+ }, [e, l]);
2694
+ c(() => {
2695
+ Ie.current = Xe;
2696
+ }, [Xe]);
2697
+ let Ze = u(!0);
2698
+ c(() => {
2699
+ if (Ze.current) {
2700
+ Ze.current = !1;
2701
+ return;
2702
+ }
2703
+ Ne.current = !0, b();
2704
+ }, [_e, b]), c(() => {
2705
+ let t = () => {
2706
+ je.current && (Ye(), We(e, je.current, l));
2707
+ };
2708
+ return window.addEventListener("beforeunload", t), () => {
2709
+ window.removeEventListener("beforeunload", t), Ye();
2710
+ };
2711
+ }, [
2712
+ e,
2713
+ l,
2714
+ Ye
2715
+ ]);
2716
+ let Qe = o((t) => {
2717
+ let n = t;
2718
+ t.currentTime !== void 0 && (Fe.current = {
2719
+ currentTime: t.currentTime,
2720
+ duration: t.duration
2721
+ }), t.eventType === "session_start" && !Me.current && (Me.current = !0, je.current = typeof n.sessionId == "string" ? n.sessionId : "", Ve(e, je.current, ze, l).catch((e) => console.warn("[SDK] Session start failed:", e.message)), Ae.current || Xe()), t.eventType === "play" && Me.current && !Ae.current && !Ne.current && Xe(), t.eventType === "pause" && b(), t.eventType === "buffering_start" && b(), t.eventType === "buffering_end" && Me.current && !Ae.current && (Ne.current = !1, Xe()), t.eventType === "ended" && (Ye(), je.current && Ue(e, je.current).catch((e) => console.warn("[SDK] Session end failed:", e.message))), console.log("[SDK Analytics]", t), fe?.(t);
2722
+ }, [
2723
+ e,
2724
+ l,
2725
+ ze,
2726
+ Xe,
2727
+ b,
2728
+ Ye,
2729
+ fe
2730
+ ]), $e = o((e) => {
2731
+ Ae.current = e, e ? (b(), console.log("[SDK] Ad break started — heartbeat timer paused")) : (Me.current && Xe(), console.log("[SDK] Ad break ended — heartbeat timer resumed"));
2732
+ }, [b, Xe]), x = o((e) => {
2733
+ ge(e), _?.(e);
2734
+ }, [_]);
2735
+ if (xe === "loading") return /* @__PURE__ */ m("div", {
2736
+ style: {
2737
+ width: "100%",
2738
+ aspectRatio: "16 / 9",
2739
+ background: "#000",
2740
+ borderRadius: 8,
2741
+ display: "flex",
2742
+ alignItems: "center",
2743
+ justifyContent: "center"
2744
+ },
2745
+ children: [/* @__PURE__ */ p("style", { children: "@keyframes boss-sdk-spin{to{transform:rotate(360deg)}}" }), /* @__PURE__ */ p("div", { style: {
2746
+ width: 32,
2747
+ height: 32,
2748
+ borderRadius: "50%",
2749
+ border: "3px solid rgba(255,255,255,0.12)",
2750
+ borderTopColor: i,
2751
+ animation: "boss-sdk-spin 0.7s linear infinite"
2752
+ } })]
2753
+ });
2754
+ if (xe === "error") {
2755
+ let e = De === "auth";
2756
+ return /* @__PURE__ */ p("div", {
2757
+ style: {
2758
+ width: "100%",
2759
+ aspectRatio: "16 / 9",
2760
+ background: "#09090e",
2761
+ borderRadius: 8,
2762
+ display: "flex",
2763
+ alignItems: "center",
2764
+ justifyContent: "center",
2765
+ flexDirection: "column",
2766
+ gap: 20
2767
+ },
2768
+ children: /* @__PURE__ */ p(te, {
2769
+ title: e ? "Invalid Player Key" : "Something Went Wrong",
2770
+ subtitle: e ? "Your player key is invalid or expired.\nPlease check your configuration." : "We encountered an error while connecting.\nPlease try again.",
2771
+ onRetry: () => Ee((e) => e + 1)
2772
+ })
2773
+ });
2774
+ }
2775
+ return /* @__PURE__ */ p(Le, {
2776
+ src: be,
2777
+ sources: ye,
2778
+ activeSourceIndex: _e,
2779
+ onSourceChange: (e) => ve(e),
2780
+ subtitles: n,
2781
+ keyMoments: he,
2782
+ themeColor: i,
2783
+ firebaseConfig: a,
2784
+ resolvedEntitlement: Ce,
2785
+ licenseKey: r,
2786
+ title: ne,
2787
+ watermark: re,
2788
+ autoplay: h,
2789
+ muted: ie,
2790
+ autoFullscreen: ae,
2791
+ enableControls: oe,
2792
+ enableSkipAd: se,
2793
+ skipAdAfterSeconds: ce,
2794
+ chaptersDisplayMode: le,
2795
+ volumeControlType: g,
2796
+ subtitleStyle: ue,
2797
+ drmConfig: de,
2798
+ overlayAdUrl: ee,
2799
+ adTrackingUrl: f,
2800
+ urlTransformer: Ge,
2801
+ onAnalyticsEvent: Qe,
2802
+ onAdBreakChange: $e,
2803
+ onKeyMomentsLoaded: x,
2804
+ initialTime: pe,
2805
+ onTimeUpdate: me
2806
+ });
2807
+ }
2808
+ //#endregion
2809
+ //#region src/create-player.ts
2810
+ function Ye(e, t) {
2811
+ let n = ee(e), r = t;
2812
+ return n.render(i(b, r)), {
2813
+ update(e) {
2814
+ r = {
2815
+ ...r,
2816
+ ...e
2817
+ }, n.render(i(b, r));
2818
+ },
2819
+ destroy() {
2820
+ n.unmount();
2821
+ }
2822
+ };
2823
+ }
2824
+ //#endregion
2825
+ export { b as BossVideoPlayer, e as FirebaseAnalyticsProvider, t as VideoPlayerSDK, Le as WebVideoPlayer, Ye as createPlayer, Ue as endSession, Be as initSdk, He as sendHeartbeat, Ve as startSession };
2826
+
2827
+ //# sourceMappingURL=index.js.map