@glitchlab/vue-video-player 1.4.0 → 1.5.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.mjs CHANGED
@@ -1,27 +1,27 @@
1
- import { defineComponent as S, ref as k, onMounted as be, watch as R, onBeforeUnmount as ne, openBlock as i, createElementBlock as v, normalizeClass as y, renderSlot as Ee, createElementVNode as l, computed as N, createVNode as U, toDisplayString as O, Fragment as oe, renderList as ae, createCommentVNode as T, createBlock as j, normalizeStyle as ge, unref as ee, withCtx as Se } from "vue";
2
- import J from "hls.js";
3
- function xe(t, o, s) {
1
+ import { defineComponent as I, ref as y, onMounted as He, watch as R, onBeforeUnmount as ne, openBlock as d, createElementBlock as f, normalizeClass as w, renderSlot as Fe, createElementVNode as r, computed as T, createVNode as Z, toDisplayString as U, Fragment as ie, renderList as ue, createCommentVNode as M, createBlock as z, normalizeStyle as re, withDirectives as We, vShow as ze, unref as te, withCtx as Ye } from "vue";
2
+ import ee from "hls.js";
3
+ function Ve(t, a, n) {
4
4
  const e = t == null ? void 0 : t.trim();
5
5
  if (e) return e;
6
- if (o) {
6
+ if (a) {
7
7
  try {
8
- const a = new Intl.DisplayNames(void 0, { type: "language" }).of(o);
9
- if (a && a !== o) return a;
8
+ const o = new Intl.DisplayNames(void 0, { type: "language" }).of(a);
9
+ if (o && o !== a) return o;
10
10
  } catch {
11
11
  }
12
- return o;
12
+ return a;
13
13
  }
14
- return `Audio ${s + 1}`;
14
+ return `Audio ${n + 1}`;
15
15
  }
16
- const He = {
16
+ const Ke = {
17
17
  index: -1,
18
18
  height: 0,
19
19
  label: "Auto"
20
20
  };
21
- function Ae(t, o) {
22
- return t > 0 ? `${t}p` : `Level ${o + 1}`;
21
+ function Xe(t, a) {
22
+ return t > 0 ? `${t}p` : `Level ${a + 1}`;
23
23
  }
24
- const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "poster"], Ve = /* @__PURE__ */ S({
24
+ const Je = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "poster"], Ge = /* @__PURE__ */ I({
25
25
  __name: "HLSPlayer",
26
26
  props: {
27
27
  src: {},
@@ -38,110 +38,110 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
38
38
  audioTrackIndex: { default: -1 },
39
39
  qualityLevelIndex: { default: -1 }
40
40
  },
41
- emits: ["play", "pause", "audio-tracks", "quality-levels", "current-level"],
42
- setup(t, { expose: o, emit: s }) {
43
- const e = t, f = s, a = k(null), w = k(null);
44
- let m, $;
45
- const E = globalThis.window !== void 0 && J.isSupported(), _ = (u) => !!e.isHls || E && u.endsWith(".m3u8");
46
- function A() {
47
- $ == null || $(), $ = void 0, m == null || m(), m = void 0, w.value && (w.value.destroy(), w.value = null);
48
- const u = a.value;
49
- if (u) {
50
- for (u.pause(), u.removeAttribute("src"); u.firstChild; ) u.firstChild.remove();
51
- u.load(), f("audio-tracks", []), f("quality-levels", []), f("current-level", -1);
41
+ emits: ["play", "pause", "ended", "audio-tracks", "quality-levels", "current-level"],
42
+ setup(t, { expose: a, emit: n }) {
43
+ const e = t, c = n, o = y(null), h = y(null);
44
+ let g, E;
45
+ const _ = globalThis.window !== void 0 && ee.isSupported(), $ = (p) => !!e.isHls || _ && p.endsWith(".m3u8");
46
+ function S() {
47
+ E == null || E(), E = void 0, g == null || g(), g = void 0, h.value && (h.value.destroy(), h.value = null);
48
+ const p = o.value;
49
+ if (p) {
50
+ for (p.pause(), p.removeAttribute("src"); p.firstChild; ) p.firstChild.remove();
51
+ p.load(), c("audio-tracks", []), c("quality-levels", []), c("current-level", -1);
52
52
  }
53
53
  }
54
- function b(u) {
55
- var W, M, Z;
56
- const C = a.value;
57
- if (!C || !u) return;
58
- A();
54
+ function b(p) {
55
+ var Y, A, J;
56
+ const x = o.value;
57
+ if (!x || !p) return;
58
+ S();
59
59
  const B = () => {
60
- e.autoPlay && C.play().catch(() => {
60
+ e.autoPlay && x.play().catch(() => {
61
61
  });
62
62
  };
63
- if (_(u)) {
64
- const g = new J(e.hlsConfig);
65
- w.value = g;
66
- const P = () => {
67
- const I = g.audioTracks.map((H, z) => ({
68
- index: z,
69
- label: xe(H.name, H.lang, z),
70
- lang: H.lang || void 0
63
+ if ($(p)) {
64
+ const k = new ee(e.hlsConfig);
65
+ h.value = k;
66
+ const N = () => {
67
+ const H = k.audioTracks.map((V, O) => ({
68
+ index: O,
69
+ label: Ve(V.name, V.lang, O),
70
+ lang: V.lang || void 0
71
71
  }));
72
- f("audio-tracks", I);
73
- }, V = () => {
74
- const I = g.levels.map((H, z) => ({
75
- index: z,
76
- height: H.height || 0,
77
- label: Ae(H.height || 0, z)
72
+ c("audio-tracks", H);
73
+ }, D = () => {
74
+ const H = k.levels.map((V, O) => ({
75
+ index: O,
76
+ height: V.height || 0,
77
+ label: Xe(V.height || 0, O)
78
78
  }));
79
- f("quality-levels", I);
79
+ c("quality-levels", H);
80
80
  };
81
- g.on(J.Events.MANIFEST_PARSED, B), g.on(J.Events.MANIFEST_PARSED, V), g.on(J.Events.LEVELS_UPDATED, V), g.on(J.Events.LEVEL_SWITCHED, (I, H) => {
82
- f("current-level", H.level);
83
- }), g.on(J.Events.AUDIO_TRACKS_UPDATED, P), g.on(J.Events.AUDIO_TRACK_SWITCHED, P), g.on(J.Events.ERROR, (I, H) => {
84
- H.fatal && (g.destroy(), w.value = null);
85
- }), g.attachMedia(C), g.loadSource(u);
81
+ k.on(ee.Events.MANIFEST_PARSED, B), k.on(ee.Events.MANIFEST_PARSED, D), k.on(ee.Events.LEVELS_UPDATED, D), k.on(ee.Events.LEVEL_SWITCHED, (H, V) => {
82
+ c("current-level", V.level);
83
+ }), k.on(ee.Events.AUDIO_TRACKS_UPDATED, N), k.on(ee.Events.AUDIO_TRACK_SWITCHED, N), k.on(ee.Events.ERROR, (H, V) => {
84
+ V.fatal && (k.destroy(), h.value = null);
85
+ }), k.attachMedia(x), k.loadSource(p);
86
86
  } else {
87
- C.src = u, C.load(), C.addEventListener("loadedmetadata", B, { once: !0 }), $ = () => {
88
- C.removeEventListener("loadedmetadata", B);
87
+ x.src = p, x.load(), x.addEventListener("loadedmetadata", B, { once: !0 }), E = () => {
88
+ x.removeEventListener("loadedmetadata", B);
89
89
  };
90
- const g = C.audioTracks;
91
- if (g) {
92
- const P = () => {
93
- const V = [];
94
- for (let I = 0; I < g.length; I++) {
95
- const H = g[I];
96
- V.push({
97
- index: I,
98
- label: xe(H.label, H.language, I),
99
- lang: H.language || void 0
90
+ const k = x.audioTracks;
91
+ if (k) {
92
+ const N = () => {
93
+ const D = [];
94
+ for (let H = 0; H < k.length; H++) {
95
+ const V = k[H];
96
+ D.push({
97
+ index: H,
98
+ label: Ve(V.label, V.language, H),
99
+ lang: V.language || void 0
100
100
  });
101
101
  }
102
- f("audio-tracks", V);
102
+ c("audio-tracks", D);
103
103
  };
104
- (W = g.addEventListener) == null || W.call(g, "addtrack", P), (M = g.addEventListener) == null || M.call(g, "removetrack", P), (Z = g.addEventListener) == null || Z.call(g, "change", P), g.length > 0 && P(), m = () => {
105
- var V, I, H;
106
- (V = g.removeEventListener) == null || V.call(g, "addtrack", P), (I = g.removeEventListener) == null || I.call(g, "removetrack", P), (H = g.removeEventListener) == null || H.call(g, "change", P);
104
+ (Y = k.addEventListener) == null || Y.call(k, "addtrack", N), (A = k.addEventListener) == null || A.call(k, "removetrack", N), (J = k.addEventListener) == null || J.call(k, "change", N), k.length > 0 && N(), g = () => {
105
+ var D, H, V;
106
+ (D = k.removeEventListener) == null || D.call(k, "addtrack", N), (H = k.removeEventListener) == null || H.call(k, "removetrack", N), (V = k.removeEventListener) == null || V.call(k, "change", N);
107
107
  };
108
108
  }
109
109
  }
110
110
  }
111
- function h(u) {
112
- var W;
113
- if (u == null || u < 0) return;
114
- const C = w.value;
115
- if (C) {
116
- C.audioTrack !== u && (C.audioTrack = u);
111
+ function m(p) {
112
+ var Y;
113
+ if (p == null || p < 0) return;
114
+ const x = h.value;
115
+ if (x) {
116
+ x.audioTrack !== p && (x.audioTrack = p);
117
117
  return;
118
118
  }
119
- const B = (W = a.value) == null ? void 0 : W.audioTracks;
119
+ const B = (Y = o.value) == null ? void 0 : Y.audioTracks;
120
120
  if (B)
121
- for (let M = 0; M < B.length; M++)
122
- B[M].enabled = M === u;
121
+ for (let A = 0; A < B.length; A++)
122
+ B[A].enabled = A === p;
123
123
  }
124
- function x(u) {
125
- if (u == null) return;
126
- const C = w.value;
127
- C && C.currentLevel !== u && (C.currentLevel = u);
124
+ function C(p) {
125
+ if (p == null) return;
126
+ const x = h.value;
127
+ x && x.currentLevel !== p && (x.currentLevel = p);
128
128
  }
129
- return be(() => {
129
+ return He(() => {
130
130
  e.src && b(e.src);
131
131
  }), R(
132
132
  () => e.src,
133
- (u) => {
134
- u && b(u);
133
+ (p) => {
134
+ p && b(p);
135
135
  }
136
136
  ), R(
137
137
  () => e.audioTrackIndex,
138
- (u) => h(u)
138
+ (p) => m(p)
139
139
  ), R(
140
140
  () => e.qualityLevelIndex,
141
- (u) => x(u)
142
- ), ne(A), o({ videoEl: a }), (u, C) => (i(), v("video", {
141
+ (p) => C(p)
142
+ ), ne(S), a({ videoEl: o }), (p, x) => (d(), f("video", {
143
143
  ref_key: "videoEl",
144
- ref: a,
144
+ ref: o,
145
145
  muted: t.muted,
146
146
  loop: t.loop,
147
147
  controls: t.controls,
@@ -149,22 +149,23 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
149
149
  playsinline: t.playsInline,
150
150
  preload: t.preload,
151
151
  poster: t.poster,
152
- class: y(e.class),
153
- onPlay: C[0] || (C[0] = (B) => f("play")),
154
- onPause: C[1] || (C[1] = (B) => f("pause"))
152
+ class: w(e.class),
153
+ onPlay: x[0] || (x[0] = (B) => c("play")),
154
+ onPause: x[1] || (x[1] = (B) => c("pause")),
155
+ onEnded: x[2] || (x[2] = (B) => c("ended"))
155
156
  }, [
156
- Ee(u.$slots, "default")
157
- ], 42, Be));
157
+ Fe(p.$slots, "default")
158
+ ], 42, Je));
158
159
  }
159
- }), qe = { name: "IconAudio" }, De = /* @__PURE__ */ S({
160
- ...qe,
160
+ }), et = { name: "IconAudio" }, tt = /* @__PURE__ */ I({
161
+ ...et,
161
162
  props: {
162
163
  class: {}
163
164
  },
164
165
  setup(t) {
165
- const o = t;
166
- return (s, e) => (i(), v("svg", {
167
- class: y(["gvp-icon", o.class]),
166
+ const a = t;
167
+ return (n, e) => (d(), f("svg", {
168
+ class: w(["gvp-icon", a.class]),
168
169
  width: "16",
169
170
  height: "16",
170
171
  viewBox: "0 0 24 24",
@@ -172,13 +173,13 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
172
173
  xmlns: "http://www.w3.org/2000/svg",
173
174
  "aria-hidden": "true"
174
175
  }, [...e[0] || (e[0] = [
175
- l("path", {
176
+ r("path", {
176
177
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
177
178
  stroke: "currentColor",
178
179
  "stroke-width": "1.5",
179
180
  "stroke-linejoin": "round"
180
181
  }, null, -1),
181
- l("path", {
182
+ r("path", {
182
183
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",
183
184
  stroke: "currentColor",
184
185
  "stroke-width": "1.5",
@@ -186,15 +187,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
186
187
  }, null, -1)
187
188
  ])], 2));
188
189
  }
189
- }), Re = { name: "IconChevron" }, Le = /* @__PURE__ */ S({
190
- ...Re,
190
+ }), nt = { name: "IconChevron" }, Re = /* @__PURE__ */ I({
191
+ ...nt,
191
192
  props: {
192
193
  class: {}
193
194
  },
194
195
  setup(t) {
195
- const o = t;
196
- return (s, e) => (i(), v("svg", {
197
- class: y(["gvp-icon", o.class]),
196
+ const a = t;
197
+ return (n, e) => (d(), f("svg", {
198
+ class: w(["gvp-icon", a.class]),
198
199
  width: "12",
199
200
  height: "12",
200
201
  viewBox: "0 0 24 24",
@@ -202,7 +203,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
202
203
  xmlns: "http://www.w3.org/2000/svg",
203
204
  "aria-hidden": "true"
204
205
  }, [...e[0] || (e[0] = [
205
- l("path", {
206
+ r("path", {
206
207
  d: "M6 9L12 15L18 9",
207
208
  stroke: "currentColor",
208
209
  "stroke-width": "2",
@@ -211,80 +212,80 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
211
212
  }, null, -1)
212
213
  ])], 2));
213
214
  }
214
- }), Fe = ["aria-expanded"], Ne = { class: "gvp-audio-label" }, Oe = {
215
+ }), lt = ["aria-expanded"], at = { class: "gvp-audio-label" }, ot = {
215
216
  key: 0,
216
217
  class: "gvp-audio-menu",
217
218
  role: "listbox",
218
219
  "aria-label": "Audio tracks"
219
- }, Ue = ["aria-selected", "onClick"], Ze = /* @__PURE__ */ S({
220
+ }, st = ["aria-selected", "onClick"], rt = /* @__PURE__ */ I({
220
221
  __name: "AudioTrackSwitcher",
221
222
  props: {
222
223
  tracks: {},
223
224
  activeIndex: {}
224
225
  },
225
226
  emits: ["select"],
226
- setup(t, { emit: o }) {
227
- const s = t, e = o, f = k(!1), a = k(null), w = N(
228
- () => s.tracks.find((_) => _.index === s.activeIndex) ?? s.tracks[0]
227
+ setup(t, { emit: a }) {
228
+ const n = t, e = a, c = y(!1), o = y(null), h = T(
229
+ () => n.tracks.find(($) => $.index === n.activeIndex) ?? n.tracks[0]
229
230
  );
230
- function m(_) {
231
- a.value && !a.value.contains(_.target) && (f.value = !1);
231
+ function g($) {
232
+ o.value && !o.value.contains($.target) && (c.value = !1);
232
233
  }
233
- function $(_) {
234
- _.key === "Escape" && (f.value = !1);
234
+ function E($) {
235
+ $.key === "Escape" && (c.value = !1);
235
236
  }
236
- R(f, (_) => {
237
- _ ? (document.addEventListener("mousedown", m), document.addEventListener("keydown", $)) : (document.removeEventListener("mousedown", m), document.removeEventListener("keydown", $));
237
+ R(c, ($) => {
238
+ $ ? (document.addEventListener("mousedown", g), document.addEventListener("keydown", E)) : (document.removeEventListener("mousedown", g), document.removeEventListener("keydown", E));
238
239
  }), ne(() => {
239
- document.removeEventListener("mousedown", m), document.removeEventListener("keydown", $);
240
+ document.removeEventListener("mousedown", g), document.removeEventListener("keydown", E);
240
241
  });
241
- function E(_) {
242
- e("select", _), f.value = !1;
242
+ function _($) {
243
+ e("select", $), c.value = !1;
243
244
  }
244
- return (_, A) => {
245
+ return ($, S) => {
245
246
  var b;
246
- return i(), v("div", {
247
+ return d(), f("div", {
247
248
  ref_key: "rootEl",
248
- ref: a,
249
+ ref: o,
249
250
  class: "gvp-audio"
250
251
  }, [
251
- l("button", {
252
+ r("button", {
252
253
  type: "button",
253
254
  class: "gvp-audio-btn",
254
255
  "aria-haspopup": "listbox",
255
- "aria-expanded": f.value,
256
+ "aria-expanded": c.value,
256
257
  "aria-label": "Audio track",
257
- onClick: A[0] || (A[0] = (h) => f.value = !f.value)
258
+ onClick: S[0] || (S[0] = (m) => c.value = !c.value)
258
259
  }, [
259
- U(De),
260
- l("span", Ne, O((b = w.value) == null ? void 0 : b.label), 1),
261
- U(Le)
262
- ], 8, Fe),
263
- f.value ? (i(), v("ul", Oe, [
264
- (i(!0), v(oe, null, ae(t.tracks, (h) => (i(), v("li", {
265
- key: h.index
260
+ Z(tt),
261
+ r("span", at, U((b = h.value) == null ? void 0 : b.label), 1),
262
+ Z(Re)
263
+ ], 8, lt),
264
+ c.value ? (d(), f("ul", ot, [
265
+ (d(!0), f(ie, null, ue(t.tracks, (m) => (d(), f("li", {
266
+ key: m.index
266
267
  }, [
267
- l("button", {
268
+ r("button", {
268
269
  type: "button",
269
270
  role: "option",
270
- "aria-selected": h.index === t.activeIndex,
271
- class: y(["gvp-audio-menu-item", { "is-active": h.index === t.activeIndex }]),
272
- onClick: (x) => E(h.index)
273
- }, O(h.label), 11, Ue)
271
+ "aria-selected": m.index === t.activeIndex,
272
+ class: w(["gvp-audio-menu-item", { "is-active": m.index === t.activeIndex }]),
273
+ onClick: (C) => _(m.index)
274
+ }, U(m.label), 11, st)
274
275
  ]))), 128))
275
- ])) : T("", !0)
276
+ ])) : M("", !0)
276
277
  ], 512);
277
278
  };
278
279
  }
279
- }), je = { name: "IconSpeed" }, $e = /* @__PURE__ */ S({
280
- ...je,
280
+ }), it = { name: "IconSpeed" }, Oe = /* @__PURE__ */ I({
281
+ ...it,
281
282
  props: {
282
283
  class: {}
283
284
  },
284
285
  setup(t) {
285
- const o = t;
286
- return (s, e) => (i(), v("svg", {
287
- class: y(["gvp-icon", o.class]),
286
+ const a = t;
287
+ return (n, e) => (d(), f("svg", {
288
+ class: w(["gvp-icon", a.class]),
288
289
  width: "16",
289
290
  height: "16",
290
291
  viewBox: "0 0 24 24",
@@ -292,12 +293,12 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
292
293
  xmlns: "http://www.w3.org/2000/svg",
293
294
  "aria-hidden": "true"
294
295
  }, [...e[0] || (e[0] = [
295
- l("path", {
296
+ r("path", {
296
297
  d: "M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",
297
298
  stroke: "currentColor",
298
299
  "stroke-width": "1.5"
299
300
  }, null, -1),
300
- l("path", {
301
+ r("path", {
301
302
  d: "M12 8V12L14.5 14.5",
302
303
  stroke: "currentColor",
303
304
  "stroke-width": "1.5",
@@ -306,72 +307,72 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
306
307
  }, null, -1)
307
308
  ])], 2));
308
309
  }
309
- }), Qe = ["aria-expanded"], We = { class: "gvp-speed-label" }, ze = {
310
+ }), ut = ["aria-expanded"], ct = { class: "gvp-speed-label" }, dt = {
310
311
  key: 0,
311
312
  class: "gvp-speed-menu",
312
313
  role: "listbox",
313
314
  "aria-label": "Playback speed"
314
- }, Ye = ["aria-selected", "onClick"], Ke = /* @__PURE__ */ S({
315
+ }, vt = ["aria-selected", "onClick"], pt = /* @__PURE__ */ I({
315
316
  __name: "SpeedSwitcher",
316
317
  props: {
317
318
  speed: {}
318
319
  },
319
320
  emits: ["select"],
320
- setup(t, { emit: o }) {
321
- const s = [0.5, 0.75, 1, 1.25, 1.5, 2], e = o, f = k(!1), a = k(null);
322
- function w(E) {
323
- a.value && !a.value.contains(E.target) && (f.value = !1);
321
+ setup(t, { emit: a }) {
322
+ const n = [0.5, 0.75, 1, 1.25, 1.5, 2], e = a, c = y(!1), o = y(null);
323
+ function h(_) {
324
+ o.value && !o.value.contains(_.target) && (c.value = !1);
324
325
  }
325
- function m(E) {
326
- E.key === "Escape" && (f.value = !1);
326
+ function g(_) {
327
+ _.key === "Escape" && (c.value = !1);
327
328
  }
328
- R(f, (E) => {
329
- E ? (document.addEventListener("mousedown", w), document.addEventListener("keydown", m)) : (document.removeEventListener("mousedown", w), document.removeEventListener("keydown", m));
329
+ R(c, (_) => {
330
+ _ ? (document.addEventListener("mousedown", h), document.addEventListener("keydown", g)) : (document.removeEventListener("mousedown", h), document.removeEventListener("keydown", g));
330
331
  }), ne(() => {
331
- document.removeEventListener("mousedown", w), document.removeEventListener("keydown", m);
332
+ document.removeEventListener("mousedown", h), document.removeEventListener("keydown", g);
332
333
  });
333
- function $(E) {
334
- e("select", E), f.value = !1;
334
+ function E(_) {
335
+ e("select", _), c.value = !1;
335
336
  }
336
- return (E, _) => (i(), v("div", {
337
+ return (_, $) => (d(), f("div", {
337
338
  ref_key: "rootEl",
338
- ref: a,
339
+ ref: o,
339
340
  class: "gvp-speed"
340
341
  }, [
341
- l("button", {
342
+ r("button", {
342
343
  type: "button",
343
344
  class: "gvp-speed-btn",
344
345
  "aria-haspopup": "listbox",
345
- "aria-expanded": f.value,
346
+ "aria-expanded": c.value,
346
347
  "aria-label": "`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",
347
- onClick: _[0] || (_[0] = (A) => f.value = !f.value)
348
+ onClick: $[0] || ($[0] = (S) => c.value = !c.value)
348
349
  }, [
349
- U($e),
350
- l("span", We, O(t.speed === 1 ? "1×" : `${t.speed}×`), 1),
351
- U(Le)
352
- ], 8, Qe),
353
- f.value ? (i(), v("ul", ze, [
354
- (i(), v(oe, null, ae(s, (A) => l("li", { key: A }, [
355
- l("button", {
350
+ Z(Oe),
351
+ r("span", ct, U(t.speed === 1 ? "1×" : `${t.speed}×`), 1),
352
+ Z(Re)
353
+ ], 8, ut),
354
+ c.value ? (d(), f("ul", dt, [
355
+ (d(), f(ie, null, ue(n, (S) => r("li", { key: S }, [
356
+ r("button", {
356
357
  type: "button",
357
358
  role: "option",
358
- "aria-selected": A === t.speed,
359
- class: y(["gvp-speed-menu-item", { "is-active": A === t.speed }]),
360
- onClick: (b) => $(A)
361
- }, O(A === 1 ? "Normal" : `${A}×`), 11, Ye)
359
+ "aria-selected": S === t.speed,
360
+ class: w(["gvp-speed-menu-item", { "is-active": S === t.speed }]),
361
+ onClick: (b) => E(S)
362
+ }, U(S === 1 ? "Normal" : `${S}×`), 11, vt)
362
363
  ])), 64))
363
- ])) : T("", !0)
364
+ ])) : M("", !0)
364
365
  ], 512));
365
366
  }
366
- }), Je = { name: "IconCaptions" }, Pe = /* @__PURE__ */ S({
367
- ...Je,
367
+ }), ft = { name: "IconCaptions" }, Ue = /* @__PURE__ */ I({
368
+ ...ft,
368
369
  props: {
369
370
  class: {}
370
371
  },
371
372
  setup(t) {
372
- const o = t;
373
- return (s, e) => (i(), v("svg", {
374
- class: y(["gvp-icon", o.class]),
373
+ const a = t;
374
+ return (n, e) => (d(), f("svg", {
375
+ class: w(["gvp-icon", a.class]),
375
376
  width: "18",
376
377
  height: "18",
377
378
  viewBox: "0 0 24 24",
@@ -379,7 +380,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
379
380
  xmlns: "http://www.w3.org/2000/svg",
380
381
  "aria-hidden": "true"
381
382
  }, [...e[0] || (e[0] = [
382
- l("rect", {
383
+ r("rect", {
383
384
  x: "2",
384
385
  y: "5",
385
386
  width: "20",
@@ -388,7 +389,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
388
389
  stroke: "currentColor",
389
390
  "stroke-width": "1.5"
390
391
  }, null, -1),
391
- l("path", {
392
+ r("path", {
392
393
  d: "M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",
393
394
  stroke: "currentColor",
394
395
  "stroke-width": "1.5",
@@ -396,120 +397,120 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
396
397
  }, null, -1)
397
398
  ])], 2));
398
399
  }
399
- }), Xe = ["aria-expanded", "aria-pressed"], Ge = {
400
+ }), mt = ["aria-expanded", "aria-pressed"], ht = {
400
401
  key: 0,
401
402
  class: "gvp-captions-menu",
402
403
  role: "listbox",
403
404
  "aria-label": "Captions"
404
- }, et = ["aria-selected"], tt = ["aria-selected", "onClick"], nt = /* @__PURE__ */ S({
405
+ }, gt = ["aria-selected"], kt = ["aria-selected", "onClick"], yt = /* @__PURE__ */ I({
405
406
  __name: "CaptionsSwitcher",
406
407
  props: {
407
408
  video: {}
408
409
  },
409
410
  setup(t) {
410
- const o = t, s = k([]), e = k(-1), f = k(!1), a = k(null);
411
- function w(b) {
412
- const h = [];
413
- for (let u = 0; u < b.length; u++) {
414
- const C = b[u];
415
- (C.kind === "subtitles" || C.kind === "captions") && h.push({ index: u, label: C.label || C.language || `Track ${u + 1}` });
411
+ const a = t, n = y([]), e = y(-1), c = y(!1), o = y(null);
412
+ function h(b) {
413
+ const m = [];
414
+ for (let p = 0; p < b.length; p++) {
415
+ const x = b[p];
416
+ (x.kind === "subtitles" || x.kind === "captions") && m.push({ index: p, label: x.label || x.language || `Track ${p + 1}` });
416
417
  }
417
- s.value = h;
418
- let x = -1;
419
- for (let u = 0; u < b.length; u++)
420
- if (b[u].mode === "showing") {
421
- x = u;
418
+ n.value = m;
419
+ let C = -1;
420
+ for (let p = 0; p < b.length; p++)
421
+ if (b[p].mode === "showing") {
422
+ C = p;
422
423
  break;
423
424
  }
424
- e.value = x;
425
+ e.value = C;
425
426
  }
426
- let m = null;
427
- R(() => o.video, (b) => {
428
- if (m == null || m(), m = null, !b) {
429
- s.value = [], e.value = -1;
427
+ let g = null;
428
+ R(() => a.video, (b) => {
429
+ if (g == null || g(), g = null, !b) {
430
+ n.value = [], e.value = -1;
430
431
  return;
431
432
  }
432
- const h = b.textTracks;
433
- w(h);
434
- const x = () => w(h);
435
- typeof h.addEventListener == "function" && (h.addEventListener("addtrack", x), h.addEventListener("removetrack", x), h.addEventListener("change", x), m = () => {
436
- h.removeEventListener("addtrack", x), h.removeEventListener("removetrack", x), h.removeEventListener("change", x);
433
+ const m = b.textTracks;
434
+ h(m);
435
+ const C = () => h(m);
436
+ typeof m.addEventListener == "function" && (m.addEventListener("addtrack", C), m.addEventListener("removetrack", C), m.addEventListener("change", C), g = () => {
437
+ m.removeEventListener("addtrack", C), m.removeEventListener("removetrack", C), m.removeEventListener("change", C);
437
438
  });
438
439
  }, { immediate: !0 }), ne(() => {
439
- m == null || m(), document.removeEventListener("mousedown", $), document.removeEventListener("keydown", E);
440
+ g == null || g(), document.removeEventListener("mousedown", E), document.removeEventListener("keydown", _);
440
441
  });
441
- function $(b) {
442
- a.value && !a.value.contains(b.target) && (f.value = !1);
443
- }
444
442
  function E(b) {
445
- b.key === "Escape" && (f.value = !1);
443
+ o.value && !o.value.contains(b.target) && (c.value = !1);
444
+ }
445
+ function _(b) {
446
+ b.key === "Escape" && (c.value = !1);
446
447
  }
447
- R(f, (b) => {
448
- b ? (document.addEventListener("mousedown", $), document.addEventListener("keydown", E)) : (document.removeEventListener("mousedown", $), document.removeEventListener("keydown", E));
448
+ R(c, (b) => {
449
+ b ? (document.addEventListener("mousedown", E), document.addEventListener("keydown", _)) : (document.removeEventListener("mousedown", E), document.removeEventListener("keydown", _));
449
450
  });
450
- function _() {
451
- if (!o.video) return;
452
- const b = o.video.textTracks;
453
- for (let h = 0; h < b.length; h++) b[h].mode = "hidden";
454
- e.value = -1, f.value = !1;
451
+ function $() {
452
+ if (!a.video) return;
453
+ const b = a.video.textTracks;
454
+ for (let m = 0; m < b.length; m++) b[m].mode = "hidden";
455
+ e.value = -1, c.value = !1;
455
456
  }
456
- function A(b) {
457
- if (!o.video) return;
458
- const h = o.video.textTracks;
459
- for (let x = 0; x < h.length; x++)
460
- h[x].mode = x === b ? "showing" : "hidden";
461
- e.value = b, f.value = !1;
457
+ function S(b) {
458
+ if (!a.video) return;
459
+ const m = a.video.textTracks;
460
+ for (let C = 0; C < m.length; C++)
461
+ m[C].mode = C === b ? "showing" : "hidden";
462
+ e.value = b, c.value = !1;
462
463
  }
463
- return (b, h) => s.value.length > 0 ? (i(), v("div", {
464
+ return (b, m) => n.value.length > 0 ? (d(), f("div", {
464
465
  key: 0,
465
466
  ref_key: "rootEl",
466
- ref: a,
467
+ ref: o,
467
468
  class: "gvp-captions"
468
469
  }, [
469
- l("button", {
470
+ r("button", {
470
471
  type: "button",
471
- class: y(["gvp-captions-btn", { "is-active": e.value >= 0 }]),
472
+ class: w(["gvp-captions-btn", { "is-active": e.value >= 0 }]),
472
473
  "aria-haspopup": "listbox",
473
- "aria-expanded": f.value,
474
+ "aria-expanded": c.value,
474
475
  "aria-pressed": e.value >= 0,
475
476
  "aria-label": "Captions",
476
- onClick: h[0] || (h[0] = (x) => f.value = !f.value)
477
+ onClick: m[0] || (m[0] = (C) => c.value = !c.value)
477
478
  }, [
478
- U(Pe)
479
- ], 10, Xe),
480
- f.value ? (i(), v("ul", Ge, [
481
- l("li", null, [
482
- l("button", {
479
+ Z(Ue)
480
+ ], 10, mt),
481
+ c.value ? (d(), f("ul", ht, [
482
+ r("li", null, [
483
+ r("button", {
483
484
  type: "button",
484
485
  role: "option",
485
486
  "aria-selected": e.value === -1,
486
- class: y(["gvp-captions-menu-item", { "is-active": e.value === -1 }]),
487
- onClick: _
488
- }, " Off ", 10, et)
487
+ class: w(["gvp-captions-menu-item", { "is-active": e.value === -1 }]),
488
+ onClick: $
489
+ }, " Off ", 10, gt)
489
490
  ]),
490
- (i(!0), v(oe, null, ae(s.value, (x) => (i(), v("li", {
491
- key: x.index
491
+ (d(!0), f(ie, null, ue(n.value, (C) => (d(), f("li", {
492
+ key: C.index
492
493
  }, [
493
- l("button", {
494
+ r("button", {
494
495
  type: "button",
495
496
  role: "option",
496
- "aria-selected": x.index === e.value,
497
- class: y(["gvp-captions-menu-item", { "is-active": x.index === e.value }]),
498
- onClick: (u) => A(x.index)
499
- }, O(x.label), 11, tt)
497
+ "aria-selected": C.index === e.value,
498
+ class: w(["gvp-captions-menu-item", { "is-active": C.index === e.value }]),
499
+ onClick: (p) => S(C.index)
500
+ }, U(C.label), 11, kt)
500
501
  ]))), 128))
501
- ])) : T("", !0)
502
- ], 512)) : T("", !0);
502
+ ])) : M("", !0)
503
+ ], 512)) : M("", !0);
503
504
  }
504
- }), lt = { name: "IconPause" }, ot = /* @__PURE__ */ S({
505
- ...lt,
505
+ }), wt = { name: "IconPause" }, bt = /* @__PURE__ */ I({
506
+ ...wt,
506
507
  props: {
507
508
  class: {}
508
509
  },
509
510
  setup(t) {
510
- const o = t;
511
- return (s, e) => (i(), v("svg", {
512
- class: y(["gvp-icon", o.class]),
511
+ const a = t;
512
+ return (n, e) => (d(), f("svg", {
513
+ class: w(["gvp-icon", a.class]),
513
514
  width: "16",
514
515
  height: "16",
515
516
  viewBox: "0 0 24 24",
@@ -517,7 +518,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
517
518
  xmlns: "http://www.w3.org/2000/svg",
518
519
  "aria-hidden": "true"
519
520
  }, [...e[0] || (e[0] = [
520
- l("rect", {
521
+ r("rect", {
521
522
  x: "6",
522
523
  y: "5",
523
524
  width: "4",
@@ -525,7 +526,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
525
526
  rx: "1",
526
527
  fill: "currentColor"
527
528
  }, null, -1),
528
- l("rect", {
529
+ r("rect", {
529
530
  x: "14",
530
531
  y: "5",
531
532
  width: "4",
@@ -535,15 +536,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
535
536
  }, null, -1)
536
537
  ])], 2));
537
538
  }
538
- }), at = { name: "IconPlaySolid" }, st = /* @__PURE__ */ S({
539
- ...at,
539
+ }), Ct = { name: "IconPlaySolid" }, xt = /* @__PURE__ */ I({
540
+ ...Ct,
540
541
  props: {
541
542
  class: {}
542
543
  },
543
544
  setup(t) {
544
- const o = t;
545
- return (s, e) => (i(), v("svg", {
546
- class: y(["gvp-icon", o.class]),
545
+ const a = t;
546
+ return (n, e) => (d(), f("svg", {
547
+ class: w(["gvp-icon", a.class]),
547
548
  width: "16",
548
549
  height: "16",
549
550
  viewBox: "0 0 24 24",
@@ -551,21 +552,77 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
551
552
  xmlns: "http://www.w3.org/2000/svg",
552
553
  "aria-hidden": "true"
553
554
  }, [...e[0] || (e[0] = [
554
- l("path", {
555
+ r("path", {
555
556
  d: "M7 5.5V18.5C7 19.2659 7.84856 19.7261 8.4899 19.3071L19.0801 12.4014C19.6644 12.0204 19.6644 11.9796 19.0801 11.5986L8.4899 4.69288C7.84856 4.27388 7 4.73408 7 5.5Z",
556
557
  fill: "currentColor"
557
558
  }, null, -1)
558
559
  ])], 2));
559
560
  }
560
- }), it = { name: "IconVolumeHigh" }, rt = /* @__PURE__ */ S({
561
- ...it,
561
+ }), Lt = { name: "IconPrev" }, Et = /* @__PURE__ */ I({
562
+ ...Lt,
562
563
  props: {
563
564
  class: {}
564
565
  },
565
566
  setup(t) {
566
- const o = t;
567
- return (s, e) => (i(), v("svg", {
568
- class: y(["gvp-icon", o.class]),
567
+ const a = t;
568
+ return (n, e) => (d(), f("svg", {
569
+ class: w(["gvp-icon", a.class]),
570
+ width: "16",
571
+ height: "16",
572
+ viewBox: "0 0 24 24",
573
+ fill: "none",
574
+ xmlns: "http://www.w3.org/2000/svg",
575
+ "aria-hidden": "true"
576
+ }, [...e[0] || (e[0] = [
577
+ r("path", {
578
+ d: "M16.5 18.5V5.5C16.5 4.73408 15.6514 4.27388 15.0101 4.69288L6.91993 9.98432C6.33563 10.3653 6.33563 11.0347 6.91993 11.4157L15.0101 16.7071C15.6514 17.1261 16.5 16.6659 16.5 15.9V18.5Z",
579
+ fill: "currentColor"
580
+ }, null, -1),
581
+ r("path", {
582
+ d: "M6 5V19",
583
+ stroke: "currentColor",
584
+ "stroke-width": "2",
585
+ "stroke-linecap": "round"
586
+ }, null, -1)
587
+ ])], 2));
588
+ }
589
+ }), _t = { name: "IconNext" }, $t = /* @__PURE__ */ I({
590
+ ..._t,
591
+ props: {
592
+ class: {}
593
+ },
594
+ setup(t) {
595
+ const a = t;
596
+ return (n, e) => (d(), f("svg", {
597
+ class: w(["gvp-icon", a.class]),
598
+ width: "16",
599
+ height: "16",
600
+ viewBox: "0 0 24 24",
601
+ fill: "none",
602
+ xmlns: "http://www.w3.org/2000/svg",
603
+ "aria-hidden": "true"
604
+ }, [...e[0] || (e[0] = [
605
+ r("path", {
606
+ d: "M7.5 5.5V18.5C7.5 19.2659 8.34856 19.7261 8.98990 19.3071L17.0801 14.0157C17.6644 13.6347 17.6644 12.9653 17.0801 12.5843L8.98990 7.29288C8.34856 6.87388 7.5 7.33408 7.5 8.1V5.5Z",
607
+ fill: "currentColor"
608
+ }, null, -1),
609
+ r("path", {
610
+ d: "M18 5V19",
611
+ stroke: "currentColor",
612
+ "stroke-width": "2",
613
+ "stroke-linecap": "round"
614
+ }, null, -1)
615
+ ])], 2));
616
+ }
617
+ }), Pt = { name: "IconVolumeHigh" }, Mt = /* @__PURE__ */ I({
618
+ ...Pt,
619
+ props: {
620
+ class: {}
621
+ },
622
+ setup(t) {
623
+ const a = t;
624
+ return (n, e) => (d(), f("svg", {
625
+ class: w(["gvp-icon", a.class]),
569
626
  width: "18",
570
627
  height: "18",
571
628
  viewBox: "0 0 24 24",
@@ -573,13 +630,13 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
573
630
  xmlns: "http://www.w3.org/2000/svg",
574
631
  "aria-hidden": "true"
575
632
  }, [...e[0] || (e[0] = [
576
- l("path", {
633
+ r("path", {
577
634
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
578
635
  stroke: "currentColor",
579
636
  "stroke-width": "1.5",
580
637
  "stroke-linejoin": "round"
581
638
  }, null, -1),
582
- l("path", {
639
+ r("path", {
583
640
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",
584
641
  stroke: "currentColor",
585
642
  "stroke-width": "1.5",
@@ -587,15 +644,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
587
644
  }, null, -1)
588
645
  ])], 2));
589
646
  }
590
- }), ut = { name: "IconVolumeLow" }, ct = /* @__PURE__ */ S({
591
- ...ut,
647
+ }), Tt = { name: "IconVolumeLow" }, It = /* @__PURE__ */ I({
648
+ ...Tt,
592
649
  props: {
593
650
  class: {}
594
651
  },
595
652
  setup(t) {
596
- const o = t;
597
- return (s, e) => (i(), v("svg", {
598
- class: y(["gvp-icon", o.class]),
653
+ const a = t;
654
+ return (n, e) => (d(), f("svg", {
655
+ class: w(["gvp-icon", a.class]),
599
656
  width: "18",
600
657
  height: "18",
601
658
  viewBox: "0 0 24 24",
@@ -603,13 +660,13 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
603
660
  xmlns: "http://www.w3.org/2000/svg",
604
661
  "aria-hidden": "true"
605
662
  }, [...e[0] || (e[0] = [
606
- l("path", {
663
+ r("path", {
607
664
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
608
665
  stroke: "currentColor",
609
666
  "stroke-width": "1.5",
610
667
  "stroke-linejoin": "round"
611
668
  }, null, -1),
612
- l("path", {
669
+ r("path", {
613
670
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",
614
671
  stroke: "currentColor",
615
672
  "stroke-width": "1.5",
@@ -617,15 +674,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
617
674
  }, null, -1)
618
675
  ])], 2));
619
676
  }
620
- }), dt = { name: "IconVolumeMuted" }, vt = /* @__PURE__ */ S({
621
- ...dt,
677
+ }), St = { name: "IconVolumeMuted" }, Nt = /* @__PURE__ */ I({
678
+ ...St,
622
679
  props: {
623
680
  class: {}
624
681
  },
625
682
  setup(t) {
626
- const o = t;
627
- return (s, e) => (i(), v("svg", {
628
- class: y(["gvp-icon", o.class]),
683
+ const a = t;
684
+ return (n, e) => (d(), f("svg", {
685
+ class: w(["gvp-icon", a.class]),
629
686
  width: "18",
630
687
  height: "18",
631
688
  viewBox: "0 0 24 24",
@@ -633,13 +690,13 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
633
690
  xmlns: "http://www.w3.org/2000/svg",
634
691
  "aria-hidden": "true"
635
692
  }, [...e[0] || (e[0] = [
636
- l("path", {
693
+ r("path", {
637
694
  d: "M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",
638
695
  stroke: "currentColor",
639
696
  "stroke-width": "1.5",
640
697
  "stroke-linejoin": "round"
641
698
  }, null, -1),
642
- l("path", {
699
+ r("path", {
643
700
  d: "M16 9L22 15M22 9L16 15",
644
701
  stroke: "currentColor",
645
702
  "stroke-width": "1.5",
@@ -647,15 +704,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
647
704
  }, null, -1)
648
705
  ])], 2));
649
706
  }
650
- }), pt = { name: "IconQuality" }, ft = /* @__PURE__ */ S({
651
- ...pt,
707
+ }), At = { name: "IconQuality" }, Ht = /* @__PURE__ */ I({
708
+ ...At,
652
709
  props: {
653
710
  class: {}
654
711
  },
655
712
  setup(t) {
656
- const o = t;
657
- return (s, e) => (i(), v("svg", {
658
- class: y(["gvp-icon", o.class]),
713
+ const a = t;
714
+ return (n, e) => (d(), f("svg", {
715
+ class: w(["gvp-icon", a.class]),
659
716
  width: "16",
660
717
  height: "16",
661
718
  viewBox: "0 0 24 24",
@@ -663,12 +720,12 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
663
720
  xmlns: "http://www.w3.org/2000/svg",
664
721
  "aria-hidden": "true"
665
722
  }, [...e[0] || (e[0] = [
666
- l("path", {
723
+ r("path", {
667
724
  d: "M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",
668
725
  stroke: "currentColor",
669
726
  "stroke-width": "1.5"
670
727
  }, null, -1),
671
- l("path", {
728
+ r("path", {
672
729
  d: "M3 12C3 12.6 3.08 13.18 3.23 13.73L4.6 14.5C4.86 14.65 5.02 14.94 5 15.24C4.98 15.58 4.96 15.92 5.07 16.24C5.18 16.56 5.39 16.83 5.62 17.08C5.83 17.3 6.13 17.4 6.42 17.36L7.99 17.13C8.28 17.09 8.57 17.21 8.74 17.45C9.07 17.93 9.49 18.34 9.97 18.66C10.21 18.83 10.34 19.11 10.31 19.4L10.13 20.97C10.1 21.26 10.21 21.55 10.43 21.74C10.91 22.16 11.45 22 12 22C12.55 22 13.09 22.16 13.57 21.74C13.79 21.55 13.9 21.26 13.87 20.97L13.69 19.4C13.66 19.11 13.79 18.83 14.03 18.66",
673
730
  stroke: "currentColor",
674
731
  "stroke-width": "1.5",
@@ -676,15 +733,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
676
733
  }, null, -1)
677
734
  ])], 2));
678
735
  }
679
- }), mt = { name: "IconPiP" }, Me = /* @__PURE__ */ S({
680
- ...mt,
736
+ }), Bt = { name: "IconPiP" }, Ze = /* @__PURE__ */ I({
737
+ ...Bt,
681
738
  props: {
682
739
  class: {}
683
740
  },
684
741
  setup(t) {
685
- const o = t;
686
- return (s, e) => (i(), v("svg", {
687
- class: y(["gvp-icon", o.class]),
742
+ const a = t;
743
+ return (n, e) => (d(), f("svg", {
744
+ class: w(["gvp-icon", a.class]),
688
745
  width: "18",
689
746
  height: "18",
690
747
  viewBox: "0 0 24 24",
@@ -692,7 +749,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
692
749
  xmlns: "http://www.w3.org/2000/svg",
693
750
  "aria-hidden": "true"
694
751
  }, [...e[0] || (e[0] = [
695
- l("rect", {
752
+ r("rect", {
696
753
  x: "2",
697
754
  y: "4",
698
755
  width: "20",
@@ -701,7 +758,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
701
758
  stroke: "currentColor",
702
759
  "stroke-width": "1.5"
703
760
  }, null, -1),
704
- l("rect", {
761
+ r("rect", {
705
762
  x: "12",
706
763
  y: "12",
707
764
  width: "8",
@@ -711,15 +768,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
711
768
  }, null, -1)
712
769
  ])], 2));
713
770
  }
714
- }), ht = { name: "IconFullscreen" }, gt = /* @__PURE__ */ S({
715
- ...ht,
771
+ }), Vt = { name: "IconFullscreen" }, qt = /* @__PURE__ */ I({
772
+ ...Vt,
716
773
  props: {
717
774
  class: {}
718
775
  },
719
776
  setup(t) {
720
- const o = t;
721
- return (s, e) => (i(), v("svg", {
722
- class: y(["gvp-icon", o.class]),
777
+ const a = t;
778
+ return (n, e) => (d(), f("svg", {
779
+ class: w(["gvp-icon", a.class]),
723
780
  width: "18",
724
781
  height: "18",
725
782
  viewBox: "0 0 24 24",
@@ -727,7 +784,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
727
784
  xmlns: "http://www.w3.org/2000/svg",
728
785
  "aria-hidden": "true"
729
786
  }, [...e[0] || (e[0] = [
730
- l("path", {
787
+ r("path", {
731
788
  d: "M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",
732
789
  stroke: "currentColor",
733
790
  "stroke-width": "1.75",
@@ -736,15 +793,15 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
736
793
  }, null, -1)
737
794
  ])], 2));
738
795
  }
739
- }), kt = { name: "IconFullscreenExit" }, yt = /* @__PURE__ */ S({
740
- ...kt,
796
+ }), Dt = { name: "IconFullscreenExit" }, Ft = /* @__PURE__ */ I({
797
+ ...Dt,
741
798
  props: {
742
799
  class: {}
743
800
  },
744
801
  setup(t) {
745
- const o = t;
746
- return (s, e) => (i(), v("svg", {
747
- class: y(["gvp-icon", o.class]),
802
+ const a = t;
803
+ return (n, e) => (d(), f("svg", {
804
+ class: w(["gvp-icon", a.class]),
748
805
  width: "18",
749
806
  height: "18",
750
807
  viewBox: "0 0 24 24",
@@ -752,7 +809,7 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
752
809
  xmlns: "http://www.w3.org/2000/svg",
753
810
  "aria-hidden": "true"
754
811
  }, [...e[0] || (e[0] = [
755
- l("path", {
812
+ r("path", {
756
813
  d: "M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",
757
814
  stroke: "currentColor",
758
815
  "stroke-width": "1.75",
@@ -762,37 +819,128 @@ const Be = ["muted", "loop", "controls", "autoplay", "playsinline", "preload", "
762
819
  ])], 2));
763
820
  }
764
821
  });
765
- function _e(t) {
822
+ function Ae(t) {
766
823
  if (!Number.isFinite(t) || t < 0) return "--:--";
767
- const o = Math.floor(t), s = Math.floor(o / 3600), e = Math.floor(o % 3600 / 60), a = (o % 60).toString().padStart(2, "0");
768
- if (s > 0) {
769
- const w = e.toString().padStart(2, "0");
770
- return `${s}:${w}:${a}`;
824
+ const a = Math.floor(t), n = Math.floor(a / 3600), e = Math.floor(a % 3600 / 60), o = (a % 60).toString().padStart(2, "0");
825
+ if (n > 0) {
826
+ const h = e.toString().padStart(2, "0");
827
+ return `${n}:${h}:${o}`;
828
+ }
829
+ return `${e}:${o}`;
830
+ }
831
+ function qe(t) {
832
+ const a = t.trim().split(":");
833
+ if (a.length < 2 || a.length > 3) return NaN;
834
+ const n = a.map(Number);
835
+ return n.some((e) => !Number.isFinite(e)) ? NaN : n.length === 3 ? n[0] * 3600 + n[1] * 60 + n[2] : n[0] * 60 + n[1];
836
+ }
837
+ function Rt(t, a) {
838
+ try {
839
+ return new URL(t, a).href;
840
+ } catch {
841
+ return t;
842
+ }
843
+ }
844
+ function Ot(t, a) {
845
+ const n = [], e = t.replace(/\r/g, "").split(`
846
+ `);
847
+ for (let c = 0; c < e.length; c++) {
848
+ const o = e[c].indexOf("-->");
849
+ if (o === -1) continue;
850
+ const h = qe(e[c].slice(0, o)), g = qe(e[c].slice(o + 3));
851
+ if (!Number.isFinite(h) || !Number.isFinite(g)) continue;
852
+ const E = (e[c + 1] ?? "").trim();
853
+ if (!E) continue;
854
+ const _ = E.indexOf("#xywh=");
855
+ let $ = E, S = 0, b = 0, m = 0, C = 0;
856
+ if (_ !== -1) {
857
+ $ = E.slice(0, _);
858
+ const p = E.slice(_ + 6).split(",").map(Number);
859
+ p.length === 4 && p.every(Number.isFinite) && ([S, b, m, C] = p);
860
+ }
861
+ n.push({ start: h, end: g, url: Rt($, a), x: S, y: b, w: m, h: C });
862
+ }
863
+ return n.sort((c, o) => c.start - o.start), n;
864
+ }
865
+ function Ut(t) {
866
+ return {
867
+ cues: t,
868
+ cueAt(a) {
869
+ if (t.length === 0) return null;
870
+ let n = 0, e = t.length - 1, c = t[0];
871
+ for (; n <= e; ) {
872
+ const o = n + e >> 1, h = t[o];
873
+ if (a < h.start)
874
+ e = o - 1;
875
+ else if (a > h.end)
876
+ c = h, n = o + 1;
877
+ else
878
+ return h;
879
+ }
880
+ return c;
881
+ }
882
+ };
883
+ }
884
+ function De(t) {
885
+ const a = t.trim().split(":");
886
+ if (a.length < 2 || a.length > 3) return NaN;
887
+ const n = a.map(Number);
888
+ return n.some((e) => !Number.isFinite(e)) ? NaN : n.length === 3 ? n[0] * 3600 + n[1] * 60 + n[2] : n[0] * 60 + n[1];
889
+ }
890
+ function Zt(t) {
891
+ const a = [], n = t.replace(/\r/g, "").split(`
892
+ `);
893
+ for (let e = 0; e < n.length; e++) {
894
+ const c = n[e].indexOf("-->");
895
+ if (c === -1) continue;
896
+ const o = De(n[e].slice(0, c)), h = De(n[e].slice(c + 3));
897
+ if (!Number.isFinite(o) || !Number.isFinite(h)) continue;
898
+ const g = (n[e + 1] ?? "").trim();
899
+ g && a.push({ start: o, end: h, title: g });
771
900
  }
772
- return `${e}:${a}`;
901
+ return a.sort((e, c) => e.start - c.start), a;
902
+ }
903
+ function jt(t, a) {
904
+ const n = t.filter((e) => Number.isFinite(e.start) && e.start >= 0 && e.title).sort((e, c) => e.start - c.start);
905
+ return n.map((e, c) => {
906
+ var o;
907
+ return {
908
+ start: e.start,
909
+ end: Number.isFinite(e.end) ? e.end : ((o = n[c + 1]) == null ? void 0 : o.start) ?? a,
910
+ title: e.title
911
+ };
912
+ });
913
+ }
914
+ function Qt(t, a) {
915
+ for (const n of t)
916
+ if (a >= n.start && a < n.end) return n;
917
+ return null;
773
918
  }
774
- const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], Ct = { class: "gvp-seek" }, xt = { class: "gvp-seek-track" }, _t = ["value", "disabled", "aria-valuemax", "aria-valuenow"], Et = {
919
+ const Wt = { class: "gvp-controls-row" }, zt = ["disabled"], Yt = ["aria-label", "aria-pressed"], Kt = ["disabled"], Xt = {
920
+ key: 1,
921
+ class: "gvp-seek-preview-chapter"
922
+ }, Jt = { class: "gvp-seek-preview-time" }, Gt = ["value", "disabled", "aria-valuemax", "aria-valuenow"], en = {
775
923
  class: "gvp-time",
776
924
  "aria-live": "off"
777
- }, Lt = ["aria-expanded", "aria-label"], $t = { class: "gvp-speed-label" }, Pt = {
925
+ }, tn = ["aria-expanded", "aria-label"], nn = { class: "gvp-speed-label" }, ln = {
778
926
  key: 0,
779
927
  class: "gvp-speed-menu",
780
928
  role: "listbox",
781
929
  "aria-label": "Playback speed"
782
- }, Mt = ["aria-selected", "onClick"], Tt = ["aria-expanded", "aria-label"], It = { class: "gvp-quality-label" }, St = {
930
+ }, an = ["aria-selected", "onClick"], on = ["aria-expanded", "aria-label"], sn = { class: "gvp-quality-label" }, rn = {
783
931
  key: 0,
784
932
  class: "gvp-quality-menu",
785
933
  role: "listbox",
786
934
  "aria-label": "Quality"
787
- }, Ht = ["aria-selected"], At = ["aria-selected", "onClick"], Bt = ["aria-expanded", "aria-pressed"], Vt = {
935
+ }, un = ["aria-selected"], cn = ["aria-selected", "onClick"], dn = ["aria-expanded", "aria-pressed"], vn = {
788
936
  key: 0,
789
937
  class: "gvp-captions-menu",
790
938
  role: "listbox",
791
939
  "aria-label": "Captions"
792
- }, qt = ["aria-selected"], Dt = ["aria-selected", "onClick"], Rt = ["aria-label", "aria-pressed"], Ft = {
940
+ }, pn = ["aria-selected"], fn = ["aria-selected", "onClick"], mn = ["aria-label", "aria-pressed"], hn = {
793
941
  key: 0,
794
942
  class: "gvp-volume-slider-wrap"
795
- }, Nt = { class: "gvp-volume-track" }, Ot = ["value", "aria-valuenow"], Ut = ["aria-label", "aria-pressed"], Zt = ["aria-label", "aria-pressed"], jt = 3e3, Qt = /* @__PURE__ */ S({
943
+ }, gn = { class: "gvp-volume-track" }, kn = ["value", "aria-valuenow"], yn = ["aria-label", "aria-pressed"], wn = ["aria-label", "aria-pressed"], bn = 3e3, Cn = /* @__PURE__ */ I({
796
944
  __name: "ControlBar",
797
945
  props: {
798
946
  video: {},
@@ -801,423 +949,531 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
801
949
  onTogglePlay: {},
802
950
  qualityLevels: { default: () => [] },
803
951
  currentLevel: { default: -1 },
804
- selectedLevel: { default: -1 }
952
+ selectedLevel: { default: -1 },
953
+ thumbnails: {},
954
+ chapters: {},
955
+ hasPrev: { type: Boolean, default: !1 },
956
+ hasNext: { type: Boolean, default: !1 }
805
957
  },
806
- emits: ["select-level"],
807
- setup(t, { emit: o }) {
808
- const s = (() => {
958
+ emits: ["select-level", "prev", "next"],
959
+ setup(t, { emit: a }) {
960
+ const n = (() => {
809
961
  if (typeof navigator > "u") return !1;
810
- const n = navigator.userAgent;
811
- return /iPad|iPhone|iPod/.test(n) || n.includes("Mac") && navigator.maxTouchPoints > 1;
812
- })(), e = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), f = [0.5, 0.75, 1, 1.25, 1.5, 2], a = t, w = o, m = k(!0);
813
- let $ = null;
814
- function E() {
815
- $ !== null && (clearTimeout($), $ = null);
816
- }
962
+ const l = navigator.userAgent;
963
+ return /iPad|iPhone|iPod/.test(l) || l.includes("Mac") && navigator.maxTouchPoints > 1;
964
+ })(), e = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), c = [0.5, 0.75, 1, 1.25, 1.5, 2], o = t, h = a, g = y(!0);
965
+ let E = null;
817
966
  function _() {
818
- E(), a.isPlaying && ($ = setTimeout(() => {
819
- m.value = !1;
820
- }, jt));
967
+ E !== null && (clearTimeout(E), E = null);
968
+ }
969
+ function $() {
970
+ _(), o.isPlaying && (E = setTimeout(() => {
971
+ g.value = !1;
972
+ }, bn));
821
973
  }
822
- function A() {
823
- m.value = !0, _();
974
+ function S() {
975
+ g.value = !0, $();
824
976
  }
825
- R(() => a.isPlaying, (n) => {
826
- n ? _() : (E(), m.value = !0);
827
- }, { immediate: !0 }), R(() => a.container, (n) => {
828
- if (!n) return;
829
- const r = () => A();
830
- n.addEventListener("mousemove", r), n.addEventListener("touchstart", r), n.addEventListener("focusin", r);
977
+ R(() => o.isPlaying, (l) => {
978
+ l ? $() : (_(), g.value = !0);
979
+ }, { immediate: !0 }), R(() => o.container, (l) => {
980
+ if (!l) return;
981
+ const s = () => S();
982
+ l.addEventListener("mousemove", s), l.addEventListener("touchstart", s), l.addEventListener("focusin", s);
831
983
  }, { immediate: !0 });
832
- const b = k(0), h = k(0), x = k(0);
833
- R(() => a.video, (n) => {
834
- if (!n) return;
835
- const r = () => {
836
- b.value = n.currentTime;
837
- }, p = () => {
838
- h.value = Number.isFinite(n.duration) ? n.duration : 0;
984
+ const b = y(0), m = y(0), C = y(0);
985
+ R(() => o.video, (l) => {
986
+ if (!l) return;
987
+ const s = () => {
988
+ b.value = l.currentTime;
989
+ }, i = () => {
990
+ m.value = Number.isFinite(l.duration) ? l.duration : 0;
839
991
  }, L = () => {
840
- const q = n.buffered;
841
- if (!q || q.length === 0) {
842
- x.value = 0;
992
+ const F = l.buffered;
993
+ if (!F || F.length === 0) {
994
+ C.value = 0;
843
995
  return;
844
996
  }
845
- let Ce = q.end(q.length - 1);
846
- for (let ie = 0; ie < q.length; ie++)
847
- if (q.start(ie) <= n.currentTime && n.currentTime <= q.end(ie)) {
848
- Ce = q.end(ie);
997
+ let Be = F.end(F.length - 1);
998
+ for (let ye = 0; ye < F.length; ye++)
999
+ if (F.start(ye) <= l.currentTime && l.currentTime <= F.end(ye)) {
1000
+ Be = F.end(ye);
849
1001
  break;
850
1002
  }
851
- x.value = Ce;
1003
+ C.value = Be;
852
1004
  };
853
- r(), p(), L(), n.addEventListener("timeupdate", r), n.addEventListener("durationchange", p), n.addEventListener("loadedmetadata", p), n.addEventListener("progress", L), n.addEventListener("timeupdate", L);
1005
+ s(), i(), L(), l.addEventListener("timeupdate", s), l.addEventListener("durationchange", i), l.addEventListener("loadedmetadata", i), l.addEventListener("progress", L), l.addEventListener("timeupdate", L);
854
1006
  }, { immediate: !0 });
855
- const u = () => h.value > 0, C = () => u() ? b.value / h.value * 100 : 0, B = () => u() ? x.value / h.value * 100 : 0;
856
- function W(n) {
857
- const r = a.video;
858
- if (!r || !u()) return;
859
- const p = Number(n.target.value) / 100 * h.value;
860
- r.currentTime = p, b.value = p;
1007
+ const p = () => m.value > 0, x = () => p() ? b.value / m.value * 100 : 0, B = () => p() ? C.value / m.value * 100 : 0;
1008
+ function Y(l) {
1009
+ const s = o.video;
1010
+ if (!s || !p()) return;
1011
+ const i = Number(l.target.value) / 100 * m.value;
1012
+ s.currentTime = i, b.value = i;
1013
+ }
1014
+ const A = y(null), J = y(null), k = y(0), N = y(0), D = y(!1);
1015
+ R(() => o.thumbnails, (l) => {
1016
+ if (A.value = null, !l) return;
1017
+ let s = !1;
1018
+ fetch(l).then((i) => i.ok ? i.text() : Promise.reject(new Error("fetch failed"))).then((i) => {
1019
+ if (s) return;
1020
+ const L = Ot(i, new URL(l, location.href).href);
1021
+ A.value = L.length > 0 ? Ut(L) : null;
1022
+ }).catch(() => {
1023
+ s || (A.value = null);
1024
+ }), ne(() => {
1025
+ s = !0;
1026
+ });
1027
+ }, { immediate: !0 });
1028
+ function H(l) {
1029
+ const s = J.value;
1030
+ if (!s || !p()) return;
1031
+ const i = s.getBoundingClientRect(), L = Math.min(Math.max(l.clientX - i.left, 0), i.width);
1032
+ N.value = L, k.value = L / i.width * m.value, D.value = !0;
1033
+ }
1034
+ function V() {
1035
+ D.value = !1;
861
1036
  }
862
- const M = k(1), Z = k(!1);
863
- R(() => a.video, (n) => {
864
- if (!n) return;
865
- const r = () => {
866
- M.value = n.volume, Z.value = n.muted;
1037
+ const O = T(
1038
+ () => {
1039
+ var l;
1040
+ return D.value ? ((l = A.value) == null ? void 0 : l.cueAt(k.value)) ?? null : null;
1041
+ }
1042
+ ), me = T(() => {
1043
+ const l = O.value;
1044
+ return l !== null && l.w > 0 && l.h > 0;
1045
+ }), Pe = T(() => {
1046
+ var L;
1047
+ const l = O.value, s = ((L = J.value) == null ? void 0 : L.clientWidth) ?? 0;
1048
+ if (!me.value || !l || s === 0) return N.value;
1049
+ const i = l.w / 2;
1050
+ return Math.min(Math.max(N.value, i), s - i);
1051
+ }), oe = y([]);
1052
+ R(() => o.chapters, (l) => {
1053
+ if (oe.value = [], typeof l != "string" || !l) return;
1054
+ let s = !1;
1055
+ fetch(l).then((i) => i.ok ? i.text() : Promise.reject(new Error("fetch failed"))).then((i) => {
1056
+ s || (oe.value = Zt(i));
1057
+ }).catch(() => {
1058
+ s || (oe.value = []);
1059
+ }), ne(() => {
1060
+ s = !0;
1061
+ });
1062
+ }, { immediate: !0 });
1063
+ const ce = T(() => typeof o.chapters == "string" ? oe.value : Array.isArray(o.chapters) ? jt(o.chapters, m.value) : []), de = T(
1064
+ () => D.value ? Qt(ce.value, k.value) : null
1065
+ ), K = y(1), q = y(!1);
1066
+ R(() => o.video, (l) => {
1067
+ if (!l) return;
1068
+ const s = () => {
1069
+ K.value = l.volume, q.value = l.muted;
867
1070
  };
868
- r(), n.addEventListener("volumechange", r);
1071
+ s(), l.addEventListener("volumechange", s);
869
1072
  }, { immediate: !0 });
870
- function g() {
871
- a.video && (a.video.muted = !a.video.muted);
1073
+ function Me() {
1074
+ o.video && (o.video.muted = !o.video.muted);
872
1075
  }
873
- function P(n) {
874
- const r = a.video;
875
- if (!r) return;
876
- const p = Number(n.target.value) / 100;
877
- r.volume = p, p > 0 && r.muted && (r.muted = !1);
1076
+ function Te(l) {
1077
+ const s = o.video;
1078
+ if (!s) return;
1079
+ const i = Number(l.target.value) / 100;
1080
+ s.volume = i, i > 0 && s.muted && (s.muted = !1);
878
1081
  }
879
- const V = k(1), I = k(!1), H = k(null);
880
- R(() => a.video, (n) => {
881
- if (!n) return;
882
- const r = () => {
883
- V.value = n.playbackRate;
1082
+ const X = y(1), le = y(!1), we = y(null);
1083
+ R(() => o.video, (l) => {
1084
+ if (!l) return;
1085
+ const s = () => {
1086
+ X.value = l.playbackRate;
884
1087
  };
885
- r(), n.addEventListener("ratechange", r);
1088
+ s(), l.addEventListener("ratechange", s);
886
1089
  }, { immediate: !0 });
887
- function z(n) {
888
- a.video && (a.video.playbackRate = n), V.value = n, I.value = !1;
1090
+ function Ie(l) {
1091
+ o.video && (o.video.playbackRate = l), X.value = l, le.value = !1;
889
1092
  }
890
- const X = k(!1), re = k(null), ke = N(() => a.qualityLevels.length >= 2), Q = N(
891
- () => [...a.qualityLevels].sort((n, r) => r.height - n.height)
892
- ), te = N(
893
- () => a.qualityLevels.find((n) => n.index === a.currentLevel)
894
- ), se = N(() => {
895
- if (a.selectedLevel < 0)
896
- return te.value ? `Auto (${te.value.label})` : "Auto";
897
- const n = a.qualityLevels.find((r) => r.index === a.selectedLevel);
898
- return (n == null ? void 0 : n.label) ?? "Auto";
1093
+ const ae = y(!1), Q = y(null), he = T(() => o.qualityLevels.length >= 2), be = T(
1094
+ () => [...o.qualityLevels].sort((l, s) => s.height - l.height)
1095
+ ), ve = T(
1096
+ () => o.qualityLevels.find((l) => l.index === o.currentLevel)
1097
+ ), Ce = T(() => {
1098
+ if (o.selectedLevel < 0)
1099
+ return ve.value ? `Auto (${ve.value.label})` : "Auto";
1100
+ const l = o.qualityLevels.find((s) => s.index === o.selectedLevel);
1101
+ return (l == null ? void 0 : l.label) ?? "Auto";
899
1102
  });
900
- function ue(n) {
901
- w("select-level", n), X.value = !1;
1103
+ function se(l) {
1104
+ h("select-level", l), ae.value = !1;
902
1105
  }
903
- const le = k([]), F = k(-1), Y = k(!1), ce = k(null);
904
- function de(n) {
905
- const r = [];
906
- for (let L = 0; L < n.length; L++) {
907
- const q = n[L];
908
- (q.kind === "subtitles" || q.kind === "captions") && r.push({ index: L, label: q.label || q.language || `Track ${L + 1}` });
1106
+ const pe = y([]), W = y(-1), G = y(!1), xe = y(null);
1107
+ function ge(l) {
1108
+ const s = [];
1109
+ for (let L = 0; L < l.length; L++) {
1110
+ const F = l[L];
1111
+ (F.kind === "subtitles" || F.kind === "captions") && s.push({ index: L, label: F.label || F.language || `Track ${L + 1}` });
909
1112
  }
910
- le.value = r;
911
- let p = -1;
912
- for (let L = 0; L < n.length; L++)
913
- if (n[L].mode === "showing") {
914
- p = L;
1113
+ pe.value = s;
1114
+ let i = -1;
1115
+ for (let L = 0; L < l.length; L++)
1116
+ if (l[L].mode === "showing") {
1117
+ i = L;
915
1118
  break;
916
1119
  }
917
- F.value = p;
1120
+ W.value = i;
918
1121
  }
919
- R(() => a.video, (n) => {
920
- if (!n) {
921
- le.value = [], F.value = -1;
1122
+ R(() => o.video, (l) => {
1123
+ if (!l) {
1124
+ pe.value = [], W.value = -1;
922
1125
  return;
923
1126
  }
924
- const r = n.textTracks;
925
- de(r);
926
- const p = () => de(r);
927
- typeof r.addEventListener == "function" && (r.addEventListener("addtrack", p), r.addEventListener("removetrack", p), r.addEventListener("change", p));
1127
+ const s = l.textTracks;
1128
+ ge(s);
1129
+ const i = () => ge(s);
1130
+ typeof s.addEventListener == "function" && (s.addEventListener("addtrack", i), s.addEventListener("removetrack", i), s.addEventListener("change", i));
928
1131
  }, { immediate: !0 });
929
- function ve(n) {
930
- var p;
931
- const r = (p = a.video) == null ? void 0 : p.textTracks;
932
- if (r) {
933
- for (let L = 0; L < r.length; L++) r[L].mode = L === n ? "showing" : "hidden";
934
- F.value = n, Y.value = !1;
1132
+ function Le(l) {
1133
+ var i;
1134
+ const s = (i = o.video) == null ? void 0 : i.textTracks;
1135
+ if (s) {
1136
+ for (let L = 0; L < s.length; L++) s[L].mode = L === l ? "showing" : "hidden";
1137
+ W.value = l, G.value = !1;
935
1138
  }
936
1139
  }
937
- function pe() {
938
- var r;
939
- const n = (r = a.video) == null ? void 0 : r.textTracks;
940
- if (n) {
941
- for (let p = 0; p < n.length; p++) n[p].mode = "hidden";
942
- F.value = -1, Y.value = !1;
1140
+ function u() {
1141
+ var s;
1142
+ const l = (s = o.video) == null ? void 0 : s.textTracks;
1143
+ if (l) {
1144
+ for (let i = 0; i < l.length; i++) l[i].mode = "hidden";
1145
+ W.value = -1, G.value = !1;
943
1146
  }
944
1147
  }
945
- const c = k(!1), d = typeof document < "u" && !!document.pictureInPictureEnabled;
946
- R(() => a.video, (n) => {
947
- n && (n.addEventListener("enterpictureinpicture", () => {
948
- c.value = !0;
949
- }), n.addEventListener("leavepictureinpicture", () => {
950
- c.value = !1;
1148
+ const v = y(!1), P = typeof document < "u" && !!document.pictureInPictureEnabled;
1149
+ R(() => o.video, (l) => {
1150
+ l && (l.addEventListener("enterpictureinpicture", () => {
1151
+ v.value = !0;
1152
+ }), l.addEventListener("leavepictureinpicture", () => {
1153
+ v.value = !1;
951
1154
  }));
952
1155
  }, { immediate: !0 });
953
- function D() {
954
- a.video && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
955
- }) : a.video.requestPictureInPicture().catch(() => {
1156
+ function fe() {
1157
+ o.video && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
1158
+ }) : o.video.requestPictureInPicture().catch(() => {
956
1159
  }));
957
1160
  }
958
- const K = k(!1), fe = typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
959
- function me() {
1161
+ const j = y(!1), Ee = typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
1162
+ function Se() {
960
1163
  return document.fullscreenElement ?? document.webkitFullscreenElement ?? null;
961
1164
  }
962
- function ye(n) {
963
- const r = n.requestFullscreen ?? n.webkitRequestFullscreen;
964
- return r ? r.call(n) : Promise.reject(new Error("unsupported"));
1165
+ function _e(l) {
1166
+ const s = l.requestFullscreen ?? l.webkitRequestFullscreen;
1167
+ return s ? s.call(l) : Promise.reject(new Error("unsupported"));
965
1168
  }
966
- function he() {
967
- const n = document.exitFullscreen ?? document.webkitExitFullscreen;
968
- return n ? n.call(document) : Promise.reject(new Error("unsupported"));
1169
+ function ke() {
1170
+ const l = document.exitFullscreen ?? document.webkitExitFullscreen;
1171
+ return l ? l.call(document) : Promise.reject(new Error("unsupported"));
969
1172
  }
970
- function G() {
971
- K.value = me() === a.container;
1173
+ function $e() {
1174
+ j.value = Se() === o.container;
972
1175
  }
973
- be(() => {
974
- document.addEventListener("fullscreenchange", G), document.addEventListener("webkitfullscreenchange", G);
1176
+ He(() => {
1177
+ document.addEventListener("fullscreenchange", $e), document.addEventListener("webkitfullscreenchange", $e);
975
1178
  }), ne(() => {
976
- E(), document.removeEventListener("fullscreenchange", G), document.removeEventListener("webkitfullscreenchange", G);
1179
+ _(), document.removeEventListener("fullscreenchange", $e), document.removeEventListener("webkitfullscreenchange", $e);
977
1180
  });
978
- function Te() {
979
- var n, r;
1181
+ function je() {
1182
+ var l, s;
980
1183
  if (e) {
981
- (r = (n = a.video) == null ? void 0 : n.webkitEnterFullscreen) == null || r.call(n);
1184
+ (s = (l = o.video) == null ? void 0 : l.webkitEnterFullscreen) == null || s.call(l);
982
1185
  return;
983
1186
  }
984
- K.value ? he().catch(() => {
985
- }) : a.container && ye(a.container).catch(() => {
1187
+ j.value ? ke().catch(() => {
1188
+ }) : o.container && _e(o.container).catch(() => {
986
1189
  });
987
1190
  }
988
- const Ie = fe || e && a.video !== null && typeof a.video.webkitEnterFullscreen == "function";
989
- function we(n, r) {
990
- function p(q) {
991
- r.value && !r.value.contains(q.target) && (n.value = !1);
1191
+ const Qe = Ee || e && o.video !== null && typeof o.video.webkitEnterFullscreen == "function";
1192
+ function Ne(l, s) {
1193
+ function i(F) {
1194
+ s.value && !s.value.contains(F.target) && (l.value = !1);
992
1195
  }
993
- function L(q) {
994
- q.key === "Escape" && (n.value = !1);
1196
+ function L(F) {
1197
+ F.key === "Escape" && (l.value = !1);
995
1198
  }
996
- R(n, (q) => {
997
- q ? (document.addEventListener("mousedown", p), document.addEventListener("keydown", L)) : (document.removeEventListener("mousedown", p), document.removeEventListener("keydown", L));
1199
+ R(l, (F) => {
1200
+ F ? (document.addEventListener("mousedown", i), document.addEventListener("keydown", L)) : (document.removeEventListener("mousedown", i), document.removeEventListener("keydown", L));
998
1201
  }), ne(() => {
999
- document.removeEventListener("mousedown", p), document.removeEventListener("keydown", L);
1202
+ document.removeEventListener("mousedown", i), document.removeEventListener("keydown", L);
1000
1203
  });
1001
1204
  }
1002
- return we(I, H), we(Y, ce), we(X, re), (n, r) => (i(), v("div", {
1205
+ return Ne(le, we), Ne(G, xe), Ne(ae, Q), (l, s) => (d(), f("div", {
1003
1206
  role: "toolbar",
1004
1207
  "aria-label": "Video controls",
1005
- class: y(["gvp-controls", !m.value && "is-hidden"]),
1006
- onMouseenter: E,
1007
- onMouseleave: _
1208
+ class: w(["gvp-controls", !g.value && "is-hidden"]),
1209
+ onMouseenter: _,
1210
+ onMouseleave: $
1008
1211
  }, [
1009
- l("div", wt, [
1010
- l("button", {
1212
+ r("div", Wt, [
1213
+ t.hasPrev || t.hasNext ? (d(), f("button", {
1214
+ key: 0,
1215
+ type: "button",
1216
+ class: "gvp-ctrl-btn",
1217
+ "aria-label": "Previous video",
1218
+ disabled: !t.hasPrev,
1219
+ onClick: s[0] || (s[0] = (i) => h("prev"))
1220
+ }, [
1221
+ Z(Et)
1222
+ ], 8, zt)) : M("", !0),
1223
+ r("button", {
1011
1224
  type: "button",
1012
1225
  class: "gvp-ctrl-btn",
1013
1226
  "aria-label": t.isPlaying ? "Pause" : "Play",
1014
1227
  "aria-pressed": t.isPlaying,
1015
- onClick: r[0] || (r[0] = //@ts-ignore
1016
- (...p) => t.onTogglePlay && t.onTogglePlay(...p))
1228
+ onClick: s[1] || (s[1] = //@ts-ignore
1229
+ (...i) => t.onTogglePlay && t.onTogglePlay(...i))
1017
1230
  }, [
1018
- t.isPlaying ? (i(), j(ot, { key: 0 })) : (i(), j(st, { key: 1 }))
1019
- ], 8, bt),
1020
- l("div", Ct, [
1021
- l("div", xt, [
1022
- l("div", {
1231
+ t.isPlaying ? (d(), z(bt, { key: 0 })) : (d(), z(xt, { key: 1 }))
1232
+ ], 8, Yt),
1233
+ t.hasPrev || t.hasNext ? (d(), f("button", {
1234
+ key: 1,
1235
+ type: "button",
1236
+ class: "gvp-ctrl-btn",
1237
+ "aria-label": "Next video",
1238
+ disabled: !t.hasNext,
1239
+ onClick: s[2] || (s[2] = (i) => h("next"))
1240
+ }, [
1241
+ Z($t)
1242
+ ], 8, Kt)) : M("", !0),
1243
+ r("div", {
1244
+ class: "gvp-seek",
1245
+ onPointermove: H,
1246
+ onPointerleave: V
1247
+ }, [
1248
+ r("div", {
1249
+ ref_key: "seekTrackEl",
1250
+ ref: J,
1251
+ class: "gvp-seek-track"
1252
+ }, [
1253
+ r("div", {
1023
1254
  class: "gvp-seek-buffered",
1024
- style: ge({ width: `${B()}%` })
1255
+ style: re({ width: `${B()}%` })
1025
1256
  }, null, 4),
1026
- l("div", {
1257
+ r("div", {
1027
1258
  class: "gvp-seek-progress",
1028
- style: ge({ width: `${C()}%` })
1029
- }, null, 4)
1030
- ]),
1031
- l("input", {
1259
+ style: re({ width: `${x()}%` })
1260
+ }, null, 4),
1261
+ p() ? (d(!0), f(ie, { key: 0 }, ue(ce.value, (i) => We((d(), f("div", {
1262
+ key: `${i.start}-${i.title}`,
1263
+ class: "gvp-seek-chapter-tick",
1264
+ style: re({ left: `${i.start / m.value * 100}%` })
1265
+ }, null, 4)), [
1266
+ [ze, i.start > 0 && i.start < m.value]
1267
+ ])), 128)) : M("", !0)
1268
+ ], 512),
1269
+ D.value && p() ? (d(), f("div", {
1270
+ key: 0,
1271
+ class: w(["gvp-seek-preview", { "has-thumb": me.value }]),
1272
+ style: re({ left: `${Pe.value}px` })
1273
+ }, [
1274
+ me.value && O.value ? (d(), f("div", {
1275
+ key: 0,
1276
+ class: "gvp-seek-preview-thumb",
1277
+ style: re({
1278
+ width: `${O.value.w}px`,
1279
+ height: `${O.value.h}px`,
1280
+ backgroundImage: `url(${JSON.stringify(O.value.url)})`,
1281
+ backgroundPosition: `-${O.value.x}px -${O.value.y}px`
1282
+ })
1283
+ }, null, 4)) : M("", !0),
1284
+ de.value ? (d(), f("span", Xt, U(de.value.title), 1)) : M("", !0),
1285
+ r("span", Jt, U(te(Ae)(k.value)), 1)
1286
+ ], 6)) : M("", !0),
1287
+ r("input", {
1032
1288
  type: "range",
1033
1289
  class: "gvp-seek-input",
1034
1290
  min: 0,
1035
1291
  max: 100,
1036
1292
  step: 0.1,
1037
- value: C(),
1038
- disabled: !u(),
1293
+ value: x(),
1294
+ disabled: !p(),
1039
1295
  "aria-label": "Seek",
1040
1296
  "aria-valuemin": 0,
1041
- "aria-valuemax": Math.floor(h.value),
1297
+ "aria-valuemax": Math.floor(m.value),
1042
1298
  "aria-valuenow": Math.floor(b.value),
1043
- onInput: W
1044
- }, null, 40, _t)
1045
- ]),
1046
- l("span", Et, O(ee(_e)(b.value)) + " / " + O(ee(_e)(h.value)), 1),
1047
- l("div", {
1299
+ onInput: Y
1300
+ }, null, 40, Gt)
1301
+ ], 32),
1302
+ r("span", en, U(te(Ae)(b.value)) + " / " + U(te(Ae)(m.value)), 1),
1303
+ r("div", {
1048
1304
  ref_key: "speedRootEl",
1049
- ref: H,
1305
+ ref: we,
1050
1306
  class: "gvp-speed"
1051
1307
  }, [
1052
- l("button", {
1308
+ r("button", {
1053
1309
  type: "button",
1054
1310
  class: "gvp-ctrl-btn gvp-speed-btn",
1055
1311
  "aria-haspopup": "listbox",
1056
- "aria-expanded": I.value,
1057
- "aria-label": `Playback speed: ${V.value === 1 ? "1×" : V.value + "×"}`,
1058
- onClick: r[1] || (r[1] = (p) => I.value = !I.value)
1312
+ "aria-expanded": le.value,
1313
+ "aria-label": `Playback speed: ${X.value === 1 ? "1×" : X.value + "×"}`,
1314
+ onClick: s[3] || (s[3] = (i) => le.value = !le.value)
1059
1315
  }, [
1060
- U($e),
1061
- l("span", $t, O(V.value === 1 ? "1×" : `${V.value}×`), 1)
1062
- ], 8, Lt),
1063
- I.value ? (i(), v("ul", Pt, [
1064
- (i(), v(oe, null, ae(f, (p) => l("li", { key: p }, [
1065
- l("button", {
1316
+ Z(Oe),
1317
+ r("span", nn, U(X.value === 1 ? "1×" : `${X.value}×`), 1)
1318
+ ], 8, tn),
1319
+ le.value ? (d(), f("ul", ln, [
1320
+ (d(), f(ie, null, ue(c, (i) => r("li", { key: i }, [
1321
+ r("button", {
1066
1322
  type: "button",
1067
1323
  role: "option",
1068
- "aria-selected": p === V.value,
1069
- class: y(["gvp-speed-menu-item", { "is-active": p === V.value }]),
1070
- onClick: (L) => z(p)
1071
- }, O(p === 1 ? "Normal" : `${p}×`), 11, Mt)
1324
+ "aria-selected": i === X.value,
1325
+ class: w(["gvp-speed-menu-item", { "is-active": i === X.value }]),
1326
+ onClick: (L) => Ie(i)
1327
+ }, U(i === 1 ? "Normal" : `${i}×`), 11, an)
1072
1328
  ])), 64))
1073
- ])) : T("", !0)
1329
+ ])) : M("", !0)
1074
1330
  ], 512),
1075
- ke.value ? (i(), v("div", {
1076
- key: 0,
1331
+ he.value ? (d(), f("div", {
1332
+ key: 2,
1077
1333
  ref_key: "qualityRootEl",
1078
- ref: re,
1334
+ ref: Q,
1079
1335
  class: "gvp-quality"
1080
1336
  }, [
1081
- l("button", {
1337
+ r("button", {
1082
1338
  type: "button",
1083
1339
  class: "gvp-ctrl-btn gvp-quality-btn",
1084
1340
  "aria-haspopup": "listbox",
1085
- "aria-expanded": X.value,
1086
- "aria-label": `Quality: ${se.value}`,
1087
- onClick: r[2] || (r[2] = (p) => X.value = !X.value)
1341
+ "aria-expanded": ae.value,
1342
+ "aria-label": `Quality: ${Ce.value}`,
1343
+ onClick: s[4] || (s[4] = (i) => ae.value = !ae.value)
1088
1344
  }, [
1089
- U(ft),
1090
- l("span", It, O(se.value), 1)
1091
- ], 8, Tt),
1092
- X.value ? (i(), v("ul", St, [
1093
- l("li", null, [
1094
- l("button", {
1345
+ Z(Ht),
1346
+ r("span", sn, U(Ce.value), 1)
1347
+ ], 8, on),
1348
+ ae.value ? (d(), f("ul", rn, [
1349
+ r("li", null, [
1350
+ r("button", {
1095
1351
  type: "button",
1096
1352
  role: "option",
1097
1353
  "aria-selected": t.selectedLevel < 0,
1098
- class: y(["gvp-quality-menu-item", { "is-active": t.selectedLevel < 0 }]),
1099
- onClick: r[3] || (r[3] = (p) => ue(ee(He).index))
1100
- }, O(te.value ? `Auto (${te.value.label})` : "Auto"), 11, Ht)
1354
+ class: w(["gvp-quality-menu-item", { "is-active": t.selectedLevel < 0 }]),
1355
+ onClick: s[5] || (s[5] = (i) => se(te(Ke).index))
1356
+ }, U(ve.value ? `Auto (${ve.value.label})` : "Auto"), 11, un)
1101
1357
  ]),
1102
- (i(!0), v(oe, null, ae(Q.value, (p) => (i(), v("li", {
1103
- key: p.index
1358
+ (d(!0), f(ie, null, ue(be.value, (i) => (d(), f("li", {
1359
+ key: i.index
1104
1360
  }, [
1105
- l("button", {
1361
+ r("button", {
1106
1362
  type: "button",
1107
1363
  role: "option",
1108
- "aria-selected": p.index === t.selectedLevel,
1109
- class: y(["gvp-quality-menu-item", { "is-active": p.index === t.selectedLevel }]),
1110
- onClick: (L) => ue(p.index)
1111
- }, O(p.label), 11, At)
1364
+ "aria-selected": i.index === t.selectedLevel,
1365
+ class: w(["gvp-quality-menu-item", { "is-active": i.index === t.selectedLevel }]),
1366
+ onClick: (L) => se(i.index)
1367
+ }, U(i.label), 11, cn)
1112
1368
  ]))), 128))
1113
- ])) : T("", !0)
1114
- ], 512)) : T("", !0),
1115
- le.value.length > 0 ? (i(), v("div", {
1116
- key: 1,
1369
+ ])) : M("", !0)
1370
+ ], 512)) : M("", !0),
1371
+ pe.value.length > 0 ? (d(), f("div", {
1372
+ key: 3,
1117
1373
  ref_key: "captionsRootEl",
1118
- ref: ce,
1374
+ ref: xe,
1119
1375
  class: "gvp-captions"
1120
1376
  }, [
1121
- l("button", {
1377
+ r("button", {
1122
1378
  type: "button",
1123
- class: y(["gvp-ctrl-btn", F.value >= 0 && "is-active"]),
1379
+ class: w(["gvp-ctrl-btn", W.value >= 0 && "is-active"]),
1124
1380
  "aria-haspopup": "listbox",
1125
- "aria-expanded": Y.value,
1381
+ "aria-expanded": G.value,
1126
1382
  "aria-label": "Captions",
1127
- "aria-pressed": F.value >= 0,
1128
- onClick: r[4] || (r[4] = (p) => Y.value = !Y.value)
1383
+ "aria-pressed": W.value >= 0,
1384
+ onClick: s[6] || (s[6] = (i) => G.value = !G.value)
1129
1385
  }, [
1130
- U(Pe)
1131
- ], 10, Bt),
1132
- Y.value ? (i(), v("ul", Vt, [
1133
- l("li", null, [
1134
- l("button", {
1386
+ Z(Ue)
1387
+ ], 10, dn),
1388
+ G.value ? (d(), f("ul", vn, [
1389
+ r("li", null, [
1390
+ r("button", {
1135
1391
  type: "button",
1136
1392
  role: "option",
1137
- "aria-selected": F.value === -1,
1138
- class: y(["gvp-captions-menu-item", { "is-active": F.value === -1 }]),
1139
- onClick: pe
1140
- }, "Off", 10, qt)
1393
+ "aria-selected": W.value === -1,
1394
+ class: w(["gvp-captions-menu-item", { "is-active": W.value === -1 }]),
1395
+ onClick: u
1396
+ }, "Off", 10, pn)
1141
1397
  ]),
1142
- (i(!0), v(oe, null, ae(le.value, (p) => (i(), v("li", {
1143
- key: p.index
1398
+ (d(!0), f(ie, null, ue(pe.value, (i) => (d(), f("li", {
1399
+ key: i.index
1144
1400
  }, [
1145
- l("button", {
1401
+ r("button", {
1146
1402
  type: "button",
1147
1403
  role: "option",
1148
- "aria-selected": p.index === F.value,
1149
- class: y(["gvp-captions-menu-item", { "is-active": p.index === F.value }]),
1150
- onClick: (L) => ve(p.index)
1151
- }, O(p.label), 11, Dt)
1404
+ "aria-selected": i.index === W.value,
1405
+ class: w(["gvp-captions-menu-item", { "is-active": i.index === W.value }]),
1406
+ onClick: (L) => Le(i.index)
1407
+ }, U(i.label), 11, fn)
1152
1408
  ]))), 128))
1153
- ])) : T("", !0)
1154
- ], 512)) : T("", !0),
1155
- l("div", {
1156
- class: y(["gvp-volume", !ee(s) && "is-expandable"])
1409
+ ])) : M("", !0)
1410
+ ], 512)) : M("", !0),
1411
+ r("div", {
1412
+ class: w(["gvp-volume", !te(n) && "is-expandable"])
1157
1413
  }, [
1158
- l("button", {
1414
+ r("button", {
1159
1415
  type: "button",
1160
1416
  class: "gvp-ctrl-btn",
1161
- "aria-label": Z.value ? "Unmute" : "Mute",
1162
- "aria-pressed": Z.value,
1163
- onClick: g
1417
+ "aria-label": q.value ? "Unmute" : "Mute",
1418
+ "aria-pressed": q.value,
1419
+ onClick: Me
1164
1420
  }, [
1165
- Z.value || M.value === 0 ? (i(), j(vt, { key: 0 })) : M.value < 0.5 ? (i(), j(ct, { key: 1 })) : (i(), j(rt, { key: 2 }))
1166
- ], 8, Rt),
1167
- ee(s) ? T("", !0) : (i(), v("div", Ft, [
1168
- l("div", Nt, [
1169
- l("div", {
1421
+ q.value || K.value === 0 ? (d(), z(Nt, { key: 0 })) : K.value < 0.5 ? (d(), z(It, { key: 1 })) : (d(), z(Mt, { key: 2 }))
1422
+ ], 8, mn),
1423
+ te(n) ? M("", !0) : (d(), f("div", hn, [
1424
+ r("div", gn, [
1425
+ r("div", {
1170
1426
  class: "gvp-volume-fill",
1171
- style: ge({ width: `${Z.value ? 0 : Math.round(M.value * 100)}%` })
1427
+ style: re({ width: `${q.value ? 0 : Math.round(K.value * 100)}%` })
1172
1428
  }, null, 4)
1173
1429
  ]),
1174
- l("input", {
1430
+ r("input", {
1175
1431
  type: "range",
1176
1432
  class: "gvp-volume-input",
1177
1433
  min: 0,
1178
1434
  max: 100,
1179
1435
  step: 1,
1180
- value: Z.value ? 0 : Math.round(M.value * 100),
1436
+ value: q.value ? 0 : Math.round(K.value * 100),
1181
1437
  "aria-label": "Volume",
1182
1438
  "aria-valuemin": 0,
1183
1439
  "aria-valuemax": 100,
1184
- "aria-valuenow": Z.value ? 0 : Math.round(M.value * 100),
1185
- onInput: P
1186
- }, null, 40, Ot)
1440
+ "aria-valuenow": q.value ? 0 : Math.round(K.value * 100),
1441
+ onInput: Te
1442
+ }, null, 40, kn)
1187
1443
  ]))
1188
1444
  ], 2),
1189
- ee(d) ? (i(), v("button", {
1190
- key: 2,
1445
+ te(P) ? (d(), f("button", {
1446
+ key: 4,
1191
1447
  type: "button",
1192
- class: y(["gvp-ctrl-btn", c.value && "is-active"]),
1193
- "aria-label": c.value ? "Exit picture-in-picture" : "Picture-in-picture",
1194
- "aria-pressed": c.value,
1195
- onClick: D
1448
+ class: w(["gvp-ctrl-btn", v.value && "is-active"]),
1449
+ "aria-label": v.value ? "Exit picture-in-picture" : "Picture-in-picture",
1450
+ "aria-pressed": v.value,
1451
+ onClick: fe
1196
1452
  }, [
1197
- U(Me)
1198
- ], 10, Ut)) : T("", !0),
1199
- ee(Ie) ? (i(), v("button", {
1200
- key: 3,
1453
+ Z(Ze)
1454
+ ], 10, yn)) : M("", !0),
1455
+ te(Qe) ? (d(), f("button", {
1456
+ key: 5,
1201
1457
  type: "button",
1202
- class: y(["gvp-ctrl-btn", K.value && "is-active"]),
1203
- "aria-label": K.value ? "Exit fullscreen" : "Enter fullscreen",
1204
- "aria-pressed": K.value,
1205
- onClick: Te
1458
+ class: w(["gvp-ctrl-btn", j.value && "is-active"]),
1459
+ "aria-label": j.value ? "Exit fullscreen" : "Enter fullscreen",
1460
+ "aria-pressed": j.value,
1461
+ onClick: je
1206
1462
  }, [
1207
- K.value ? (i(), j(yt, { key: 0 })) : (i(), j(gt, { key: 1 }))
1208
- ], 10, Zt)) : T("", !0)
1463
+ j.value ? (d(), z(Ft, { key: 0 })) : (d(), z(qt, { key: 1 }))
1464
+ ], 10, wn)) : M("", !0)
1209
1465
  ])
1210
1466
  ], 34));
1211
1467
  }
1212
- }), Wt = { name: "IconDesktop" }, zt = /* @__PURE__ */ S({
1213
- ...Wt,
1468
+ }), xn = { name: "IconDesktop" }, Ln = /* @__PURE__ */ I({
1469
+ ...xn,
1214
1470
  props: {
1215
1471
  class: {}
1216
1472
  },
1217
1473
  setup(t) {
1218
- const o = t;
1219
- return (s, e) => (i(), v("svg", {
1220
- class: y(["gvp-icon", o.class]),
1474
+ const a = t;
1475
+ return (n, e) => (d(), f("svg", {
1476
+ class: w(["gvp-icon", a.class]),
1221
1477
  width: "20",
1222
1478
  height: "20",
1223
1479
  viewBox: "0 0 24 24",
@@ -1225,26 +1481,26 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
1225
1481
  xmlns: "http://www.w3.org/2000/svg",
1226
1482
  "aria-hidden": "true"
1227
1483
  }, [...e[0] || (e[0] = [
1228
- l("path", {
1484
+ r("path", {
1229
1485
  d: "M14 2H10C6.72077 2 5.08116 2 3.91891 2.81382C3.48891 3.1149 3.1149 3.48891 2.81382 3.91891C2 5.08116 2 6.72077 2 10C2 13.2792 2 14.9188 2.81382 16.0811C3.1149 16.5111 3.48891 16.8851 3.91891 17.1862C5.08116 18 6.72077 18 10 18H14C17.2792 18 18.9188 18 20.0811 17.1862C20.5111 16.8851 20.8851 16.5111 21.1862 16.0811C22 14.9188 22 13.2792 22 10C22 6.72077 22 5.08116 21.1862 3.91891C20.8851 3.48891 20.5111 3.1149 20.0811 2.81382C18.9188 2 17.2792 2 14 2Z",
1230
1486
  stroke: "currentColor",
1231
1487
  "stroke-width": "1.5",
1232
1488
  "stroke-linecap": "round"
1233
1489
  }, null, -1),
1234
- l("path", {
1490
+ r("path", {
1235
1491
  d: "M11 15H13",
1236
1492
  stroke: "currentColor",
1237
1493
  "stroke-width": "1.5",
1238
1494
  "stroke-linecap": "round",
1239
1495
  "stroke-linejoin": "round"
1240
1496
  }, null, -1),
1241
- l("path", {
1497
+ r("path", {
1242
1498
  d: "M14.5 22L14.1845 21.5811C13.4733 20.6369 13.2969 19.1944 13.7468 18M9.5 22L9.8155 21.5811C10.5267 20.6369 10.7031 19.1944 10.2532 18",
1243
1499
  stroke: "currentColor",
1244
1500
  "stroke-width": "1.5",
1245
1501
  "stroke-linecap": "round"
1246
1502
  }, null, -1),
1247
- l("path", {
1503
+ r("path", {
1248
1504
  d: "M7 22H17",
1249
1505
  stroke: "currentColor",
1250
1506
  "stroke-width": "1.5",
@@ -1252,15 +1508,15 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
1252
1508
  }, null, -1)
1253
1509
  ])], 2));
1254
1510
  }
1255
- }), Yt = { name: "IconMobile" }, Kt = /* @__PURE__ */ S({
1256
- ...Yt,
1511
+ }), En = { name: "IconMobile" }, _n = /* @__PURE__ */ I({
1512
+ ...En,
1257
1513
  props: {
1258
1514
  class: {}
1259
1515
  },
1260
1516
  setup(t) {
1261
- const o = t;
1262
- return (s, e) => (i(), v("svg", {
1263
- class: y(["gvp-icon", o.class]),
1517
+ const a = t;
1518
+ return (n, e) => (d(), f("svg", {
1519
+ class: w(["gvp-icon", a.class]),
1264
1520
  width: "20",
1265
1521
  height: "20",
1266
1522
  viewBox: "0 0 24 24",
@@ -1268,20 +1524,20 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
1268
1524
  xmlns: "http://www.w3.org/2000/svg",
1269
1525
  "aria-hidden": "true"
1270
1526
  }, [...e[0] || (e[0] = [
1271
- l("path", {
1527
+ r("path", {
1272
1528
  d: "M5 9C5 5.70017 5 4.05025 6.02513 3.02513C7.05025 2 8.70017 2 12 2C15.2998 2 16.9497 2 17.9749 3.02513C19 4.05025 19 5.70017 19 9V15C19 18.2998 19 19.9497 17.9749 20.9749C16.9497 22 15.2998 22 12 22C8.70017 22 7.05025 22 6.02513 20.9749C5 19.9497 5 18.2998 5 15V9Z",
1273
1529
  stroke: "currentColor",
1274
1530
  "stroke-width": "2",
1275
1531
  "stroke-linecap": "round"
1276
1532
  }, null, -1),
1277
- l("path", {
1533
+ r("path", {
1278
1534
  d: "M11 19H13",
1279
1535
  stroke: "currentColor",
1280
1536
  "stroke-width": "2",
1281
1537
  "stroke-linecap": "round",
1282
1538
  "stroke-linejoin": "round"
1283
1539
  }, null, -1),
1284
- l("path", {
1540
+ r("path", {
1285
1541
  d: "M9 2L9.089 2.53402C9.28188 3.69129 9.37832 4.26993 9.77519 4.62204C10.1892 4.98934 10.7761 5 12 5C13.2239 5 13.8108 4.98934 14.2248 4.62204C14.6217 4.26993 14.7181 3.69129 14.911 2.53402L15 2",
1286
1542
  stroke: "currentColor",
1287
1543
  "stroke-width": "2",
@@ -1289,15 +1545,15 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
1289
1545
  }, null, -1)
1290
1546
  ])], 2));
1291
1547
  }
1292
- }), Jt = { name: "IconPlay" }, Xt = /* @__PURE__ */ S({
1293
- ...Jt,
1548
+ }), $n = { name: "IconPlay" }, Pn = /* @__PURE__ */ I({
1549
+ ...$n,
1294
1550
  props: {
1295
1551
  class: {}
1296
1552
  },
1297
1553
  setup(t) {
1298
- const o = t;
1299
- return (s, e) => (i(), v("svg", {
1300
- class: y(["gvp-icon", o.class]),
1554
+ const a = t;
1555
+ return (n, e) => (d(), f("svg", {
1556
+ class: w(["gvp-icon", a.class]),
1301
1557
  width: "22",
1302
1558
  height: "22",
1303
1559
  viewBox: "0 0 16 16",
@@ -1305,21 +1561,21 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
1305
1561
  xmlns: "http://www.w3.org/2000/svg",
1306
1562
  "aria-hidden": "true"
1307
1563
  }, [...e[0] || (e[0] = [
1308
- l("path", {
1564
+ r("path", {
1309
1565
  d: "M5.3335 11.45V4.54997C5.3335 4.36108 5.40016 4.20275 5.5335 4.07497C5.66683 3.94719 5.82238 3.8833 6.00016 3.8833C6.05572 3.8833 6.11405 3.89163 6.17516 3.9083C6.23627 3.92497 6.29461 3.94997 6.35016 3.9833L11.7835 7.4333C11.8835 7.49997 11.9585 7.5833 12.0085 7.6833C12.0585 7.7833 12.0835 7.88886 12.0835 7.99997C12.0835 8.11108 12.0585 8.21663 12.0085 8.31663C11.9585 8.41663 11.8835 8.49997 11.7835 8.56663L6.35016 12.0166C6.29461 12.05 6.23627 12.075 6.17516 12.0916C6.11405 12.1083 6.05572 12.1166 6.00016 12.1166C5.82238 12.1166 5.66683 12.0527 5.5335 11.925C5.40016 11.7972 5.3335 11.6389 5.3335 11.45Z",
1310
1566
  fill: "currentColor"
1311
1567
  }, null, -1)
1312
1568
  ])], 2));
1313
1569
  }
1314
- }), Gt = { name: "IconX" }, en = /* @__PURE__ */ S({
1315
- ...Gt,
1570
+ }), Mn = { name: "IconX" }, Tn = /* @__PURE__ */ I({
1571
+ ...Mn,
1316
1572
  props: {
1317
1573
  class: {}
1318
1574
  },
1319
1575
  setup(t) {
1320
- const o = t;
1321
- return (s, e) => (i(), v("svg", {
1322
- class: y(["gvp-icon", o.class]),
1576
+ const a = t;
1577
+ return (n, e) => (d(), f("svg", {
1578
+ class: w(["gvp-icon", a.class]),
1323
1579
  width: "14",
1324
1580
  height: "14",
1325
1581
  viewBox: "0 0 14 14",
@@ -1327,87 +1583,90 @@ const wt = { class: "gvp-controls-row" }, bt = ["aria-label", "aria-pressed"], C
1327
1583
  xmlns: "http://www.w3.org/2000/svg",
1328
1584
  "aria-hidden": "true"
1329
1585
  }, [...e[0] || (e[0] = [
1330
- l("path", {
1586
+ r("path", {
1331
1587
  d: "M6.94994 5.53594L12.1929 0.292938C12.5834 -0.0975275 13.2165 -0.0975279 13.6069 0.292938C13.9974 0.683403 13.9974 1.31647 13.6069 1.70694L8.36394 6.94994L13.6069 12.1929C13.9974 12.5834 13.9974 13.2165 13.6069 13.6069C13.2165 13.9974 12.5834 13.9974 12.1929 13.6069L6.94994 8.36394L1.70694 13.6069C1.31647 13.9974 0.683403 13.9974 0.292938 13.6069C-0.0975279 13.2165 -0.0975277 12.5834 0.292938 12.1929L5.53594 6.94994L0.292938 1.70694C-0.0975279 1.31647 -0.0975279 0.683403 0.292938 0.292938C0.683403 -0.0975279 1.31647 -0.0975277 1.70694 0.292938L6.94994 5.53594Z",
1332
1588
  fill: "currentColor"
1333
1589
  }, null, -1)
1334
1590
  ])], 2));
1335
1591
  }
1336
1592
  });
1337
- function tn(t) {
1593
+ function In(t) {
1338
1594
  if (!t) return null;
1339
1595
  if (/^[A-Za-z0-9_-]{11}$/.test(t)) return t;
1340
- let o;
1596
+ let a;
1341
1597
  try {
1342
- o = new URL(t);
1598
+ a = new URL(t);
1343
1599
  } catch {
1344
1600
  return null;
1345
1601
  }
1346
- const s = o.hostname.replace(/^www\./, "");
1347
- if (s === "youtu.be") {
1348
- const e = o.pathname.slice(1).split("/")[0];
1602
+ const n = a.hostname.replace(/^www\./, "");
1603
+ if (n === "youtu.be") {
1604
+ const e = a.pathname.slice(1).split("/")[0];
1349
1605
  return /^[A-Za-z0-9_-]{11}$/.test(e) ? e : null;
1350
1606
  }
1351
- if (s === "youtube.com" || s === "m.youtube.com" || s === "music.youtube.com" || s === "youtube-nocookie.com") {
1352
- const e = o.searchParams.get("v");
1607
+ if (n === "youtube.com" || n === "m.youtube.com" || n === "music.youtube.com" || n === "youtube-nocookie.com") {
1608
+ const e = a.searchParams.get("v");
1353
1609
  if (e && /^[A-Za-z0-9_-]{11}$/.test(e)) return e;
1354
- const f = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1355
- o.pathname
1610
+ const c = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1611
+ a.pathname
1356
1612
  );
1357
- if (f) return f[1];
1613
+ if (c) return c[1];
1358
1614
  }
1359
1615
  return null;
1360
1616
  }
1361
- function nn(t) {
1617
+ function Sn(t) {
1362
1618
  try {
1363
- const o = new URL(t), s = o.searchParams.get("t") ?? o.searchParams.get("start");
1364
- if (!s) return null;
1365
- if (/^\d+s?$/.test(s)) return Number.parseInt(s, 10);
1366
- const e = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(s);
1619
+ const a = new URL(t), n = a.searchParams.get("t") ?? a.searchParams.get("start");
1620
+ if (!n) return null;
1621
+ if (/^\d+s?$/.test(n)) return Number.parseInt(n, 10);
1622
+ const e = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(n);
1367
1623
  if (e) {
1368
- const f = Number.parseInt(e[1] ?? "0", 10), a = Number.parseInt(e[2] ?? "0", 10), w = Number.parseInt(e[3] ?? "0", 10), m = f * 3600 + a * 60 + w;
1369
- return m > 0 ? m : null;
1624
+ const c = Number.parseInt(e[1] ?? "0", 10), o = Number.parseInt(e[2] ?? "0", 10), h = Number.parseInt(e[3] ?? "0", 10), g = c * 3600 + o * 60 + h;
1625
+ return g > 0 ? g : null;
1370
1626
  }
1371
1627
  } catch {
1372
1628
  }
1373
1629
  return null;
1374
1630
  }
1375
- function ln(t, o = {}) {
1631
+ function Nn(t, a = {}) {
1376
1632
  const {
1377
- autoPlay: s = !1,
1633
+ autoPlay: n = !1,
1378
1634
  muted: e = !0,
1379
- loop: f = !1,
1380
- controls: a = !0,
1381
- startSeconds: w
1382
- } = o, m = new URLSearchParams({
1635
+ loop: c = !1,
1636
+ controls: o = !0,
1637
+ startSeconds: h
1638
+ } = a, g = new URLSearchParams({
1383
1639
  rel: "0",
1384
1640
  modestbranding: "1",
1385
1641
  playsinline: "1",
1386
- controls: a ? "1" : "0"
1642
+ controls: o ? "1" : "0"
1387
1643
  });
1388
- return s ? (m.set("autoplay", "1"), m.set("mute", "1")) : e && m.set("mute", "1"), f && (m.set("loop", "1"), m.set("playlist", t)), w && w > 0 && m.set("start", String(w)), `https://www.youtube-nocookie.com/embed/${t}?${m.toString()}`;
1644
+ return n ? (g.set("autoplay", "1"), g.set("mute", "1")) : e && g.set("mute", "1"), c && (g.set("loop", "1"), g.set("playlist", t)), h && h > 0 && g.set("start", String(h)), `https://www.youtube-nocookie.com/embed/${t}?${g.toString()}`;
1389
1645
  }
1390
- const on = ["src"], an = {
1646
+ const An = ["src"], Hn = {
1391
1647
  key: 2,
1392
1648
  class: "gvp-vignette"
1393
- }, sn = {
1649
+ }, Bn = {
1394
1650
  key: 3,
1395
1651
  class: "gvp-toggle"
1396
- }, rn = { class: "gvp-toggle-pill" }, un = ["aria-pressed"], cn = ["aria-pressed"], dn = ["aria-label", "aria-pressed"], vn = ["aria-label"], pn = {
1652
+ }, Vn = { class: "gvp-toggle-pill" }, qn = ["aria-pressed"], Dn = ["aria-pressed"], Fn = ["aria-label", "aria-pressed"], Rn = ["aria-label"], On = {
1397
1653
  key: 10,
1398
1654
  class: "gvp-play-wrap"
1399
- }, fn = {
1655
+ }, Un = {
1400
1656
  key: 0,
1401
1657
  class: "gvp-tooltip",
1402
1658
  role: "tooltip"
1403
- }, mn = {
1659
+ }, Zn = {
1404
1660
  key: 12,
1405
1661
  class: "gvp-bottom-fade"
1406
- }, kn = /* @__PURE__ */ S({
1662
+ }, Wn = /* @__PURE__ */ I({
1407
1663
  __name: "VideoPlayer",
1408
1664
  props: {
1409
1665
  src: {},
1410
1666
  poster: {},
1667
+ playlist: {},
1668
+ defaultIndex: { default: 0 },
1669
+ autoAdvance: { type: Boolean, default: !0 },
1411
1670
  showDeviceToggle: { type: Boolean, default: !0 },
1412
1671
  defaultDevice: { default: "desktop" },
1413
1672
  hoverPlay: { type: Boolean, default: !1 },
@@ -1420,299 +1679,360 @@ const on = ["src"], an = {
1420
1679
  aspectRatio: {},
1421
1680
  hlsConfig: {},
1422
1681
  isHls: { type: Boolean },
1682
+ thumbnails: {},
1683
+ chapters: {},
1423
1684
  class: { default: "" },
1424
1685
  closable: { type: Boolean, default: !1 }
1425
1686
  },
1426
- emits: ["close", "play", "pause"],
1427
- setup(t, { emit: o }) {
1428
- const s = t, e = o, f = k(null), a = k(s.defaultDevice), w = k(!1), m = k(!1), $ = k(null), E = k([]), _ = k(-1), A = k([]), b = k(-1), h = k(-1), x = k(1), u = k(!1), C = k(!1), B = k(null), W = typeof document < "u" && !!document.pictureInPictureEnabled, M = N(
1429
- () => s.controls === !0 || s.controls === "custom"
1430
- ), Z = N(() => s.controls === "native"), g = N(() => tn(s.src)), P = N(() => g.value !== null), V = N(
1431
- () => g.value ? ln(g.value, {
1432
- autoPlay: s.autoPlay,
1433
- muted: s.muted,
1434
- loop: s.loop,
1435
- controls: M.value ? !0 : Z.value,
1436
- startSeconds: nn(s.src)
1687
+ emits: ["close", "play", "pause", "ended", "time-update", "seeked", "volume-change", "milestone", "error", "playlist-change"],
1688
+ setup(t, { emit: a }) {
1689
+ const n = t, e = a, c = y(null), o = y(n.defaultDevice), h = y(!1), g = y(!1), E = y(null), _ = y([]), $ = y(-1), S = y([]), b = y(-1), m = y(-1), C = y(1), p = y(!1), x = y(!1), B = y(null), Y = typeof document < "u" && !!document.pictureInPictureEnabled, A = T(
1690
+ () => n.controls === !0 || n.controls === "custom"
1691
+ ), J = T(() => n.controls === "native"), k = T(
1692
+ () => Array.isArray(n.playlist) && n.playlist.length > 0
1693
+ ), N = y(
1694
+ k.value ? Math.min(Math.max(n.defaultIndex, 0), n.playlist.length - 1) : 0
1695
+ ), D = T(
1696
+ () => k.value ? n.playlist[Math.min(N.value, n.playlist.length - 1)] : null
1697
+ ), H = T(() => {
1698
+ var u;
1699
+ return ((u = D.value) == null ? void 0 : u.src) ?? n.src ?? "";
1700
+ }), V = T(() => {
1701
+ var u;
1702
+ return ((u = D.value) == null ? void 0 : u.poster) ?? n.poster;
1703
+ }), O = T(
1704
+ () => {
1705
+ var u;
1706
+ return ((u = D.value) == null ? void 0 : u.thumbnails) ?? n.thumbnails;
1707
+ }
1708
+ ), me = T(
1709
+ () => {
1710
+ var u;
1711
+ return ((u = D.value) == null ? void 0 : u.chapters) ?? n.chapters;
1712
+ }
1713
+ ), Pe = T(() => k.value && N.value > 0), oe = T(
1714
+ () => k.value && N.value < n.playlist.length - 1
1715
+ );
1716
+ let ce = !1;
1717
+ function de(u, v = !1) {
1718
+ if (!k.value) return;
1719
+ const P = Math.min(Math.max(u, 0), n.playlist.length - 1);
1720
+ P !== N.value && (ce = v, N.value = P, e("playlist-change", P, n.playlist[P]));
1721
+ }
1722
+ const K = T(() => In(H.value)), q = T(() => K.value !== null), Me = T(
1723
+ () => K.value ? Nn(K.value, {
1724
+ autoPlay: n.autoPlay,
1725
+ muted: n.muted,
1726
+ loop: n.loop,
1727
+ controls: A.value ? !0 : J.value,
1728
+ startSeconds: Sn(H.value)
1437
1729
  }) : null
1438
1730
  );
1439
- function I(c) {
1440
- E.value = c, _.value = -1;
1731
+ function Te(u) {
1732
+ _.value = u, $.value = -1;
1441
1733
  }
1442
- function H(c) {
1443
- A.value = c, h.value = -1;
1734
+ function X(u) {
1735
+ S.value = u, m.value = -1;
1444
1736
  }
1445
- const z = N(
1446
- () => !P.value && E.value.length > 1
1447
- ), X = N(
1737
+ const le = T(
1738
+ () => !q.value && _.value.length > 1
1739
+ ), we = T(
1448
1740
  () => {
1449
- var c;
1450
- return _.value >= 0 ? _.value : ((c = E.value[0]) == null ? void 0 : c.index) ?? -1;
1741
+ var u;
1742
+ return $.value >= 0 ? $.value : ((u = _.value[0]) == null ? void 0 : u.index) ?? -1;
1451
1743
  }
1452
- ), re = N(
1744
+ ), Ie = T(
1453
1745
  () => {
1454
- var c, d;
1455
- return a.value === "mobile" ? ((c = s.aspectRatio) == null ? void 0 : c.mobile) ?? "9/16" : ((d = s.aspectRatio) == null ? void 0 : d.desktop) ?? "16/9";
1746
+ var u, v;
1747
+ return o.value === "mobile" ? ((u = n.aspectRatio) == null ? void 0 : u.mobile) ?? "9/16" : ((v = n.aspectRatio) == null ? void 0 : v.desktop) ?? "16/9";
1456
1748
  }
1457
- ), ke = N(
1749
+ ), ae = T(
1458
1750
  () => {
1459
- var c, d;
1460
- return a.value === "mobile" ? ((c = s.frameMaxWidth) == null ? void 0 : c.mobile) ?? "420px" : ((d = s.frameMaxWidth) == null ? void 0 : d.desktop) ?? "960px";
1751
+ var u, v;
1752
+ return o.value === "mobile" ? ((u = n.frameMaxWidth) == null ? void 0 : u.mobile) ?? "420px" : ((v = n.frameMaxWidth) == null ? void 0 : v.desktop) ?? "960px";
1461
1753
  }
1462
- ), Q = N(() => {
1463
- var c;
1464
- return ((c = f.value) == null ? void 0 : c.videoEl) ?? null;
1754
+ ), Q = T(() => {
1755
+ var u;
1756
+ return ((u = c.value) == null ? void 0 : u.videoEl) ?? null;
1465
1757
  });
1466
- async function te() {
1467
- const c = Q.value;
1468
- if (c)
1758
+ async function he() {
1759
+ const u = Q.value;
1760
+ if (u)
1469
1761
  try {
1470
- c.readyState < 2 && c.load();
1471
- const d = c.play();
1472
- $.value = d, await d, w.value = !0;
1762
+ u.readyState < 2 && u.load();
1763
+ const v = u.play();
1764
+ E.value = v, await v, h.value = !0;
1473
1765
  } catch {
1474
- w.value = !1;
1766
+ h.value = !1;
1475
1767
  } finally {
1476
- $.value = null;
1768
+ E.value = null;
1477
1769
  }
1478
1770
  }
1479
- async function se() {
1480
- const c = Q.value;
1481
- if (c) {
1482
- if ($.value)
1771
+ async function be() {
1772
+ const u = Q.value;
1773
+ if (u) {
1774
+ if (E.value)
1483
1775
  try {
1484
- await $.value;
1776
+ await E.value;
1485
1777
  } catch {
1486
1778
  }
1487
- c.pause();
1779
+ u.pause();
1488
1780
  }
1489
1781
  }
1490
- async function ue() {
1491
- !s.hoverPlay || P.value || await te();
1782
+ async function ve() {
1783
+ !n.hoverPlay || q.value || await he();
1784
+ }
1785
+ async function Ce() {
1786
+ !n.hoverPlay || q.value || (await be(), h.value = !1);
1492
1787
  }
1493
- async function le() {
1494
- !s.hoverPlay || P.value || (await se(), w.value = !1);
1788
+ async function se() {
1789
+ const u = Q.value;
1790
+ u && (u.paused ? await he() : (await be(), h.value = !1));
1495
1791
  }
1496
- async function F() {
1497
- const c = Q.value;
1498
- c && (c.paused ? await te() : (await se(), w.value = !1));
1792
+ function pe() {
1793
+ h.value = !1, e("ended"), k.value && n.autoAdvance && oe.value && de(N.value + 1, !0);
1499
1794
  }
1500
- function Y() {
1501
- m.value = !0, ue();
1795
+ R(H, () => {
1796
+ ce && (ce = !1, he());
1797
+ });
1798
+ function W() {
1799
+ g.value = !0, ve();
1502
1800
  }
1503
- function ce() {
1504
- m.value = !1, le();
1801
+ function G() {
1802
+ g.value = !1, Ce();
1505
1803
  }
1506
- function de(c) {
1507
- x.value = c;
1508
- const d = Q.value;
1509
- d && (d.playbackRate = c);
1804
+ function xe(u) {
1805
+ C.value = u;
1806
+ const v = Q.value;
1807
+ v && (v.playbackRate = u);
1510
1808
  }
1511
- R(Q, (c) => {
1512
- c && (c.addEventListener("ratechange", () => {
1513
- x.value = c.playbackRate;
1514
- }), c.addEventListener("enterpictureinpicture", () => {
1515
- u.value = !0;
1516
- }), c.addEventListener("leavepictureinpicture", () => {
1517
- u.value = !1;
1518
- }));
1809
+ R(Q, (u) => {
1810
+ if (!u) return;
1811
+ u.addEventListener("ratechange", () => {
1812
+ C.value = u.playbackRate;
1813
+ }), u.addEventListener("enterpictureinpicture", () => {
1814
+ p.value = !0;
1815
+ }), u.addEventListener("leavepictureinpicture", () => {
1816
+ p.value = !1;
1817
+ });
1818
+ const v = /* @__PURE__ */ new Set();
1819
+ u.addEventListener("timeupdate", () => {
1820
+ const P = u.duration;
1821
+ if (e("time-update", u.currentTime, Number.isFinite(P) ? P : 0), !Number.isFinite(P) || P <= 0) return;
1822
+ const fe = u.currentTime / P * 100;
1823
+ for (const j of [25, 50, 75, 100])
1824
+ fe >= j && !v.has(j) && (v.add(j), e("milestone", j));
1825
+ }), u.addEventListener("seeked", () => {
1826
+ e("seeked", u.currentTime);
1827
+ }), u.addEventListener("volumechange", () => {
1828
+ e("volume-change", u.volume, u.muted);
1829
+ }), u.addEventListener("error", () => {
1830
+ e("error");
1831
+ });
1519
1832
  });
1520
- function ve() {
1521
- const c = Q.value;
1522
- c && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
1523
- }) : c.requestPictureInPicture().catch(() => {
1833
+ function ge() {
1834
+ const u = Q.value;
1835
+ u && (document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
1836
+ }) : u.requestPictureInPicture().catch(() => {
1524
1837
  }));
1525
1838
  }
1526
- function pe(c) {
1527
- var K, fe, me;
1528
- const d = Q.value;
1529
- if (!(!d || !C.value && !((K = B.value) != null && K.contains(document.activeElement)) || c.target.tagName === "INPUT" && c.key !== " "))
1530
- switch (c.key) {
1839
+ function Le(u) {
1840
+ var fe, j, Ee;
1841
+ const v = Q.value;
1842
+ if (!(!v || !x.value && !((fe = B.value) != null && fe.contains(document.activeElement)) || u.target.tagName === "INPUT" && u.key !== " "))
1843
+ switch (u.key) {
1531
1844
  case " ":
1532
1845
  case "k":
1533
- c.preventDefault(), F();
1846
+ u.preventDefault(), se();
1534
1847
  break;
1535
1848
  case "ArrowLeft":
1536
- c.preventDefault(), d.currentTime = Math.max(0, d.currentTime - 5);
1849
+ u.preventDefault(), v.currentTime = Math.max(0, v.currentTime - 5);
1537
1850
  break;
1538
1851
  case "ArrowRight":
1539
- c.preventDefault(), d.currentTime = Math.min(d.duration || 0, d.currentTime + 5);
1852
+ u.preventDefault(), v.currentTime = Math.min(v.duration || 0, v.currentTime + 5);
1540
1853
  break;
1541
1854
  case "ArrowUp":
1542
- c.preventDefault(), d.volume = Math.min(1, d.volume + 0.1), d.muted && (d.muted = !1);
1855
+ u.preventDefault(), v.volume = Math.min(1, v.volume + 0.1), v.muted && (v.muted = !1);
1543
1856
  break;
1544
1857
  case "ArrowDown":
1545
- c.preventDefault(), d.volume = Math.max(0, d.volume - 0.1);
1858
+ u.preventDefault(), v.volume = Math.max(0, v.volume - 0.1);
1546
1859
  break;
1547
1860
  case "m":
1548
- d.muted = !d.muted;
1861
+ v.muted = !v.muted;
1549
1862
  break;
1550
1863
  case "f": {
1551
- const ye = document.fullscreenElement ?? document.webkitFullscreenElement ?? null, he = ((fe = B.value) == null ? void 0 : fe.requestFullscreen) ?? ((me = B.value) == null ? void 0 : me.webkitRequestFullscreen), G = document.exitFullscreen ?? document.webkitExitFullscreen;
1552
- ye === B.value ? G == null || G.call(document).catch(() => {
1553
- }) : he && B.value && he.call(B.value).catch(() => {
1864
+ const Se = document.fullscreenElement ?? document.webkitFullscreenElement ?? null, _e = ((j = B.value) == null ? void 0 : j.requestFullscreen) ?? ((Ee = B.value) == null ? void 0 : Ee.webkitRequestFullscreen), ke = document.exitFullscreen ?? document.webkitExitFullscreen;
1865
+ Se === B.value ? ke == null || ke.call(document).catch(() => {
1866
+ }) : _e && B.value && _e.call(B.value).catch(() => {
1554
1867
  });
1555
1868
  break;
1556
1869
  }
1557
1870
  case "p":
1558
- W && ve();
1871
+ Y && ge();
1559
1872
  break;
1560
1873
  }
1561
1874
  }
1562
- return be(() => {
1563
- document.addEventListener("keydown", pe);
1875
+ return He(() => {
1876
+ document.addEventListener("keydown", Le);
1564
1877
  }), ne(() => {
1565
- document.removeEventListener("keydown", pe);
1566
- }), (c, d) => (i(), v("div", {
1878
+ document.removeEventListener("keydown", Le);
1879
+ }), (u, v) => (d(), f("div", {
1567
1880
  ref_key: "rootEl",
1568
1881
  ref: B,
1569
- class: y(["gvp-root", s.class]),
1570
- style: ge({ width: ke.value, aspectRatio: re.value }),
1571
- onMouseenter: d[10] || (d[10] = (D) => {
1572
- C.value = !0, Y();
1882
+ class: w(["gvp-root", n.class]),
1883
+ style: re({ width: ae.value, aspectRatio: Ie.value }),
1884
+ onMouseenter: v[12] || (v[12] = (P) => {
1885
+ x.value = !0, W();
1573
1886
  }),
1574
- onMouseleave: d[11] || (d[11] = (D) => {
1575
- C.value = !1, ce();
1887
+ onMouseleave: v[13] || (v[13] = (P) => {
1888
+ x.value = !1, G();
1576
1889
  })
1577
1890
  }, [
1578
- P.value ? (i(), v("iframe", {
1891
+ q.value ? (d(), f("iframe", {
1579
1892
  key: 0,
1580
1893
  class: "gvp-video gvp-youtube",
1581
- src: V.value ?? void 0,
1894
+ src: Me.value ?? void 0,
1582
1895
  title: "YouTube video player",
1583
1896
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
1584
1897
  allowfullscreen: "",
1585
1898
  referrerpolicy: "strict-origin-when-cross-origin"
1586
- }, null, 8, on)) : (i(), j(Ve, {
1587
- key: 1,
1899
+ }, null, 8, An)) : (d(), z(Ge, {
1588
1900
  ref_key: "hlsPlayerRef",
1589
- ref: f,
1590
- controls: Z.value,
1901
+ ref: c,
1902
+ key: H.value,
1903
+ controls: J.value,
1591
1904
  "hls-config": t.hlsConfig,
1592
1905
  "is-hls": t.isHls,
1593
1906
  loop: t.loop,
1594
1907
  muted: t.muted,
1595
1908
  "auto-play": t.autoPlay,
1596
- "audio-track-index": _.value,
1597
- "quality-level-index": h.value,
1909
+ "audio-track-index": $.value,
1910
+ "quality-level-index": m.value,
1598
1911
  "plays-inline": !0,
1599
- poster: t.poster,
1600
- src: t.src,
1912
+ poster: V.value,
1913
+ src: H.value,
1601
1914
  class: "gvp-video",
1602
1915
  preload: "metadata",
1603
- onAudioTracks: I,
1604
- onQualityLevels: H,
1605
- onCurrentLevel: d[0] || (d[0] = (D) => b.value = D),
1606
- onPause: d[1] || (d[1] = (D) => {
1607
- w.value = !1, e("pause");
1916
+ onAudioTracks: Te,
1917
+ onQualityLevels: X,
1918
+ onCurrentLevel: v[0] || (v[0] = (P) => b.value = P),
1919
+ onEnded: pe,
1920
+ onPause: v[1] || (v[1] = (P) => {
1921
+ h.value = !1, e("pause");
1608
1922
  }),
1609
- onPlay: d[2] || (d[2] = (D) => {
1610
- w.value = !0, e("play");
1923
+ onPlay: v[2] || (v[2] = (P) => {
1924
+ h.value = !0, e("play");
1611
1925
  })
1612
1926
  }, {
1613
- default: Se(() => [
1614
- Ee(c.$slots, "default")
1927
+ default: Ye(() => [
1928
+ Fe(u.$slots, "default")
1615
1929
  ]),
1616
1930
  _: 3
1617
1931
  }, 8, ["controls", "hls-config", "is-hls", "loop", "muted", "auto-play", "audio-track-index", "quality-level-index", "poster", "src"])),
1618
- P.value ? T("", !0) : (i(), v("div", an)),
1619
- t.showDeviceToggle ? (i(), v("div", sn, [
1620
- l("div", rn, [
1621
- l("button", {
1622
- "aria-pressed": a.value === "desktop",
1623
- class: y(["gvp-toggle-btn", { "is-active": a.value === "desktop" }]),
1932
+ q.value ? M("", !0) : (d(), f("div", Hn)),
1933
+ t.showDeviceToggle ? (d(), f("div", Bn, [
1934
+ r("div", Vn, [
1935
+ r("button", {
1936
+ "aria-pressed": o.value === "desktop",
1937
+ class: w(["gvp-toggle-btn", { "is-active": o.value === "desktop" }]),
1624
1938
  "aria-label": "Desktop view",
1625
1939
  type: "button",
1626
- onClick: d[3] || (d[3] = (D) => a.value = "desktop")
1940
+ onClick: v[3] || (v[3] = (P) => o.value = "desktop")
1627
1941
  }, [
1628
- U(zt)
1629
- ], 10, un),
1630
- d[12] || (d[12] = l("div", { class: "gvp-toggle-divider" }, null, -1)),
1631
- l("button", {
1632
- "aria-pressed": a.value === "mobile",
1633
- class: y(["gvp-toggle-btn", { "is-active": a.value === "mobile" }]),
1942
+ Z(Ln)
1943
+ ], 10, qn),
1944
+ v[14] || (v[14] = r("div", { class: "gvp-toggle-divider" }, null, -1)),
1945
+ r("button", {
1946
+ "aria-pressed": o.value === "mobile",
1947
+ class: w(["gvp-toggle-btn", { "is-active": o.value === "mobile" }]),
1634
1948
  "aria-label": "Mobile view",
1635
1949
  type: "button",
1636
- onClick: d[4] || (d[4] = (D) => a.value = "mobile")
1950
+ onClick: v[4] || (v[4] = (P) => o.value = "mobile")
1637
1951
  }, [
1638
- U(Kt)
1639
- ], 10, cn)
1952
+ Z(_n)
1953
+ ], 10, Dn)
1640
1954
  ])
1641
- ])) : T("", !0),
1642
- t.closable ? (i(), v("button", {
1955
+ ])) : M("", !0),
1956
+ t.closable ? (d(), f("button", {
1643
1957
  key: 4,
1644
1958
  "aria-label": "Close",
1645
1959
  class: "gvp-close",
1646
1960
  type: "button",
1647
- onClick: d[5] || (d[5] = (D) => e("close"))
1961
+ onClick: v[5] || (v[5] = (P) => e("close"))
1648
1962
  }, [
1649
- U(en)
1650
- ])) : T("", !0),
1651
- z.value && !M.value ? (i(), j(Ze, {
1963
+ Z(Tn)
1964
+ ])) : M("", !0),
1965
+ le.value && !A.value ? (d(), z(rt, {
1652
1966
  key: 5,
1653
- tracks: E.value,
1654
- "active-index": X.value,
1655
- onSelect: d[6] || (d[6] = (D) => _.value = D)
1656
- }, null, 8, ["tracks", "active-index"])) : T("", !0),
1657
- !P.value && !M.value ? (i(), j(Ke, {
1967
+ tracks: _.value,
1968
+ "active-index": we.value,
1969
+ onSelect: v[6] || (v[6] = (P) => $.value = P)
1970
+ }, null, 8, ["tracks", "active-index"])) : M("", !0),
1971
+ !q.value && !A.value ? (d(), z(pt, {
1658
1972
  key: 6,
1659
- speed: x.value,
1660
- onSelect: de
1661
- }, null, 8, ["speed"])) : T("", !0),
1662
- !P.value && !M.value ? (i(), j(nt, {
1973
+ speed: C.value,
1974
+ onSelect: xe
1975
+ }, null, 8, ["speed"])) : M("", !0),
1976
+ !q.value && !A.value ? (d(), z(yt, {
1663
1977
  key: 7,
1664
1978
  video: Q.value
1665
- }, null, 8, ["video"])) : T("", !0),
1666
- !P.value && ee(W) && !M.value ? (i(), v("button", {
1979
+ }, null, 8, ["video"])) : M("", !0),
1980
+ !q.value && te(Y) && !A.value ? (d(), f("button", {
1667
1981
  key: 8,
1668
1982
  type: "button",
1669
- class: y(["gvp-pip-btn", { "is-active": u.value }]),
1670
- "aria-label": u.value ? "Exit picture-in-picture" : "Picture-in-picture",
1671
- "aria-pressed": u.value,
1672
- onClick: ve
1983
+ class: w(["gvp-pip-btn", { "is-active": p.value }]),
1984
+ "aria-label": p.value ? "Exit picture-in-picture" : "Picture-in-picture",
1985
+ "aria-pressed": p.value,
1986
+ onClick: ge
1673
1987
  }, [
1674
- U(Me)
1675
- ], 10, dn)) : T("", !0),
1676
- !P.value && M.value ? (i(), v("button", {
1988
+ Z(Ze)
1989
+ ], 10, Fn)) : M("", !0),
1990
+ !q.value && A.value ? (d(), f("button", {
1677
1991
  key: 9,
1678
1992
  type: "button",
1679
1993
  class: "gvp-click-layer",
1680
- "aria-label": w.value ? "Pause" : "Play",
1681
- onClick: F
1682
- }, null, 8, vn)) : T("", !0),
1683
- !P.value && !M.value && !w.value ? (i(), v("div", pn, [
1684
- l("button", {
1994
+ "aria-label": h.value ? "Pause" : "Play",
1995
+ onClick: se
1996
+ }, null, 8, Rn)) : M("", !0),
1997
+ !q.value && !A.value && !h.value ? (d(), f("div", On, [
1998
+ r("button", {
1685
1999
  "aria-label": "Play",
1686
2000
  class: "gvp-play",
1687
2001
  type: "button",
1688
- onClick: F,
1689
- onMouseenter: d[7] || (d[7] = (D) => m.value = !0),
1690
- onMouseleave: d[8] || (d[8] = (D) => m.value = !1)
2002
+ onClick: se,
2003
+ onMouseenter: v[7] || (v[7] = (P) => g.value = !0),
2004
+ onMouseleave: v[8] || (v[8] = (P) => g.value = !1)
1691
2005
  }, [
1692
- U(Xt),
1693
- t.tooltipText && m.value ? (i(), v("span", fn, O(t.tooltipText), 1)) : T("", !0)
2006
+ Z(Pn),
2007
+ t.tooltipText && g.value ? (d(), f("span", Un, U(t.tooltipText), 1)) : M("", !0)
1694
2008
  ], 32)
1695
- ])) : T("", !0),
1696
- !P.value && M.value ? (i(), j(Qt, {
2009
+ ])) : M("", !0),
2010
+ !q.value && A.value ? (d(), z(Cn, {
1697
2011
  key: 11,
1698
2012
  video: Q.value,
1699
- "is-playing": w.value,
2013
+ "is-playing": h.value,
1700
2014
  container: B.value,
1701
- "on-toggle-play": F,
1702
- "quality-levels": A.value,
2015
+ "on-toggle-play": se,
2016
+ "quality-levels": S.value,
1703
2017
  "current-level": b.value,
1704
- "selected-level": h.value,
1705
- onSelectLevel: d[9] || (d[9] = (D) => h.value = D)
1706
- }, null, 8, ["video", "is-playing", "container", "quality-levels", "current-level", "selected-level"])) : T("", !0),
1707
- !P.value && !M.value ? (i(), v("div", mn)) : T("", !0)
2018
+ "selected-level": m.value,
2019
+ thumbnails: O.value,
2020
+ chapters: me.value,
2021
+ "has-prev": Pe.value,
2022
+ "has-next": oe.value,
2023
+ onSelectLevel: v[9] || (v[9] = (P) => m.value = P),
2024
+ onPrev: v[10] || (v[10] = (P) => de(N.value - 1, !0)),
2025
+ onNext: v[11] || (v[11] = (P) => de(N.value + 1, !0))
2026
+ }, null, 8, ["video", "is-playing", "container", "quality-levels", "current-level", "selected-level", "thumbnails", "chapters", "has-prev", "has-next"])) : M("", !0),
2027
+ !q.value && !A.value ? (d(), f("div", Zn)) : M("", !0)
1708
2028
  ], 38));
1709
2029
  }
1710
2030
  });
1711
2031
  export {
1712
- Ve as HLSPlayer,
1713
- kn as VueVideoPlayer,
1714
- tn as parseYouTubeId,
1715
- nn as parseYouTubeStart,
1716
- ln as youTubeEmbedUrl
2032
+ Ge as HLSPlayer,
2033
+ Wn as VueVideoPlayer,
2034
+ In as parseYouTubeId,
2035
+ Sn as parseYouTubeStart,
2036
+ Nn as youTubeEmbedUrl
1717
2037
  };
1718
2038
  //# sourceMappingURL=index.mjs.map