@glitchlab/react-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,24 +1,24 @@
1
1
  "use client";
2
- import { jsxs as g, jsx as t } from "react/jsx-runtime";
3
- import we, { useState as k, useRef as H, useCallback as M, useEffect as P, useImperativeHandle as Le, useMemo as K } from "react";
4
- import $ from "hls.js";
5
- function ae(e) {
6
- var n, s, r = "";
7
- if (typeof e == "string" || typeof e == "number") r += e;
2
+ import { jsxs as b, jsx as r } from "react/jsx-runtime";
3
+ import ct, { useState as v, useRef as $, useCallback as H, useEffect as T, useImperativeHandle as ut, useMemo as ce } from "react";
4
+ import Q from "hls.js";
5
+ function Be(e) {
6
+ var s, t, n = "";
7
+ if (typeof e == "string" || typeof e == "number") n += e;
8
8
  else if (typeof e == "object") if (Array.isArray(e)) {
9
- var l = e.length;
10
- for (n = 0; n < l; n++) e[n] && (s = ae(e[n])) && (r && (r += " "), r += s);
11
- } else for (s in e) e[s] && (r && (r += " "), r += s);
12
- return r;
9
+ var o = e.length;
10
+ for (s = 0; s < o; s++) e[s] && (t = Be(e[s])) && (n && (n += " "), n += t);
11
+ } else for (t in e) e[t] && (n && (n += " "), n += t);
12
+ return n;
13
13
  }
14
- function I() {
15
- for (var e, n, s = 0, r = "", l = arguments.length; s < l; s++) (e = arguments[s]) && (n = ae(e)) && (r && (r += " "), r += n);
16
- return r;
14
+ function D() {
15
+ for (var e, s, t = 0, n = "", o = arguments.length; t < o; t++) (e = arguments[t]) && (s = Be(e)) && (n && (n += " "), n += s);
16
+ return n;
17
17
  }
18
- const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e }) => /* @__PURE__ */ g(
18
+ const Se = "gvp-icon", S = (e) => e ? `${Se} ${e}` : Se, dt = ({ className: e }) => /* @__PURE__ */ b(
19
19
  "svg",
20
20
  {
21
- className: x(e),
21
+ className: S(e),
22
22
  width: "20",
23
23
  height: "20",
24
24
  viewBox: "0 0 24 24",
@@ -26,7 +26,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
26
26
  xmlns: "http://www.w3.org/2000/svg",
27
27
  "aria-hidden": "true",
28
28
  children: [
29
- /* @__PURE__ */ t(
29
+ /* @__PURE__ */ r(
30
30
  "path",
31
31
  {
32
32
  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",
@@ -35,7 +35,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
35
35
  strokeLinecap: "round"
36
36
  }
37
37
  ),
38
- /* @__PURE__ */ t(
38
+ /* @__PURE__ */ r(
39
39
  "path",
40
40
  {
41
41
  d: "M11 15H13",
@@ -45,7 +45,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
45
45
  strokeLinejoin: "round"
46
46
  }
47
47
  ),
48
- /* @__PURE__ */ t(
48
+ /* @__PURE__ */ r(
49
49
  "path",
50
50
  {
51
51
  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",
@@ -54,13 +54,13 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
54
54
  strokeLinecap: "round"
55
55
  }
56
56
  ),
57
- /* @__PURE__ */ t("path", { d: "M7 22H17", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
57
+ /* @__PURE__ */ r("path", { d: "M7 22H17", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
58
58
  ]
59
59
  }
60
- ), Ee = ({ className: e }) => /* @__PURE__ */ g(
60
+ ), ht = ({ className: e }) => /* @__PURE__ */ b(
61
61
  "svg",
62
62
  {
63
- className: x(e),
63
+ className: S(e),
64
64
  width: "20",
65
65
  height: "20",
66
66
  viewBox: "0 0 24 24",
@@ -68,7 +68,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
68
68
  xmlns: "http://www.w3.org/2000/svg",
69
69
  "aria-hidden": "true",
70
70
  children: [
71
- /* @__PURE__ */ t(
71
+ /* @__PURE__ */ r(
72
72
  "path",
73
73
  {
74
74
  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",
@@ -77,7 +77,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
77
77
  strokeLinecap: "round"
78
78
  }
79
79
  ),
80
- /* @__PURE__ */ t(
80
+ /* @__PURE__ */ r(
81
81
  "path",
82
82
  {
83
83
  d: "M11 19H13",
@@ -87,7 +87,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
87
87
  strokeLinejoin: "round"
88
88
  }
89
89
  ),
90
- /* @__PURE__ */ t(
90
+ /* @__PURE__ */ r(
91
91
  "path",
92
92
  {
93
93
  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",
@@ -98,17 +98,17 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
98
98
  )
99
99
  ]
100
100
  }
101
- ), xe = ({ className: e }) => /* @__PURE__ */ t(
101
+ ), mt = ({ className: e }) => /* @__PURE__ */ r(
102
102
  "svg",
103
103
  {
104
- className: x(e),
104
+ className: S(e),
105
105
  width: "14",
106
106
  height: "14",
107
107
  viewBox: "0 0 14 14",
108
108
  fill: "none",
109
109
  xmlns: "http://www.w3.org/2000/svg",
110
110
  "aria-hidden": "true",
111
- children: /* @__PURE__ */ t(
111
+ children: /* @__PURE__ */ r(
112
112
  "path",
113
113
  {
114
114
  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",
@@ -116,17 +116,17 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
116
116
  }
117
117
  )
118
118
  }
119
- ), Ne = ({ className: e }) => /* @__PURE__ */ t(
119
+ ), pt = ({ className: e }) => /* @__PURE__ */ r(
120
120
  "svg",
121
121
  {
122
- className: x(e),
122
+ className: S(e),
123
123
  width: "22",
124
124
  height: "22",
125
125
  viewBox: "0 0 16 16",
126
126
  fill: "none",
127
127
  xmlns: "http://www.w3.org/2000/svg",
128
128
  "aria-hidden": "true",
129
- children: /* @__PURE__ */ t(
129
+ children: /* @__PURE__ */ r(
130
130
  "path",
131
131
  {
132
132
  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",
@@ -134,10 +134,10 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
134
134
  }
135
135
  )
136
136
  }
137
- ), Me = ({ className: e }) => /* @__PURE__ */ g(
137
+ ), ft = ({ className: e }) => /* @__PURE__ */ b(
138
138
  "svg",
139
139
  {
140
- className: x(e),
140
+ className: S(e),
141
141
  width: "16",
142
142
  height: "16",
143
143
  viewBox: "0 0 24 24",
@@ -145,7 +145,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
145
145
  xmlns: "http://www.w3.org/2000/svg",
146
146
  "aria-hidden": "true",
147
147
  children: [
148
- /* @__PURE__ */ t(
148
+ /* @__PURE__ */ r(
149
149
  "path",
150
150
  {
151
151
  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",
@@ -154,7 +154,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
154
154
  strokeLinejoin: "round"
155
155
  }
156
156
  ),
157
- /* @__PURE__ */ t(
157
+ /* @__PURE__ */ r(
158
158
  "path",
159
159
  {
160
160
  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",
@@ -165,17 +165,17 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
165
165
  )
166
166
  ]
167
167
  }
168
- ), Pe = ({ className: e }) => /* @__PURE__ */ t(
168
+ ), gt = ({ className: e }) => /* @__PURE__ */ r(
169
169
  "svg",
170
170
  {
171
- className: x(e),
171
+ className: S(e),
172
172
  width: "16",
173
173
  height: "16",
174
174
  viewBox: "0 0 24 24",
175
175
  fill: "none",
176
176
  xmlns: "http://www.w3.org/2000/svg",
177
177
  "aria-hidden": "true",
178
- children: /* @__PURE__ */ t(
178
+ children: /* @__PURE__ */ r(
179
179
  "path",
180
180
  {
181
181
  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",
@@ -183,10 +183,10 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
183
183
  }
184
184
  )
185
185
  }
186
- ), Te = ({ className: e }) => /* @__PURE__ */ g(
186
+ ), vt = ({ className: e }) => /* @__PURE__ */ b(
187
187
  "svg",
188
188
  {
189
- className: x(e),
189
+ className: S(e),
190
190
  width: "16",
191
191
  height: "16",
192
192
  viewBox: "0 0 24 24",
@@ -194,14 +194,14 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
194
194
  xmlns: "http://www.w3.org/2000/svg",
195
195
  "aria-hidden": "true",
196
196
  children: [
197
- /* @__PURE__ */ t("rect", { x: "6", y: "5", width: "4", height: "14", rx: "1", fill: "currentColor" }),
198
- /* @__PURE__ */ t("rect", { x: "14", y: "5", width: "4", height: "14", rx: "1", fill: "currentColor" })
197
+ /* @__PURE__ */ r("rect", { x: "6", y: "5", width: "4", height: "14", rx: "1", fill: "currentColor" }),
198
+ /* @__PURE__ */ r("rect", { x: "14", y: "5", width: "4", height: "14", rx: "1", fill: "currentColor" })
199
199
  ]
200
200
  }
201
- ), Ie = ({ className: e }) => /* @__PURE__ */ g(
201
+ ), bt = ({ className: e }) => /* @__PURE__ */ b(
202
202
  "svg",
203
203
  {
204
- className: x(e),
204
+ className: S(e),
205
205
  width: "18",
206
206
  height: "18",
207
207
  viewBox: "0 0 24 24",
@@ -209,7 +209,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
209
209
  xmlns: "http://www.w3.org/2000/svg",
210
210
  "aria-hidden": "true",
211
211
  children: [
212
- /* @__PURE__ */ t(
212
+ /* @__PURE__ */ r(
213
213
  "path",
214
214
  {
215
215
  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",
@@ -218,7 +218,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
218
218
  strokeLinejoin: "round"
219
219
  }
220
220
  ),
221
- /* @__PURE__ */ t(
221
+ /* @__PURE__ */ r(
222
222
  "path",
223
223
  {
224
224
  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",
@@ -229,10 +229,10 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
229
229
  )
230
230
  ]
231
231
  }
232
- ), Se = ({ className: e }) => /* @__PURE__ */ g(
232
+ ), kt = ({ className: e }) => /* @__PURE__ */ b(
233
233
  "svg",
234
234
  {
235
- className: x(e),
235
+ className: S(e),
236
236
  width: "18",
237
237
  height: "18",
238
238
  viewBox: "0 0 24 24",
@@ -240,7 +240,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
240
240
  xmlns: "http://www.w3.org/2000/svg",
241
241
  "aria-hidden": "true",
242
242
  children: [
243
- /* @__PURE__ */ t(
243
+ /* @__PURE__ */ r(
244
244
  "path",
245
245
  {
246
246
  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",
@@ -249,7 +249,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
249
249
  strokeLinejoin: "round"
250
250
  }
251
251
  ),
252
- /* @__PURE__ */ t(
252
+ /* @__PURE__ */ r(
253
253
  "path",
254
254
  {
255
255
  d: "M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",
@@ -260,10 +260,10 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
260
260
  )
261
261
  ]
262
262
  }
263
- ), He = ({ className: e }) => /* @__PURE__ */ g(
263
+ ), wt = ({ className: e }) => /* @__PURE__ */ b(
264
264
  "svg",
265
265
  {
266
- className: x(e),
266
+ className: S(e),
267
267
  width: "18",
268
268
  height: "18",
269
269
  viewBox: "0 0 24 24",
@@ -271,7 +271,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
271
271
  xmlns: "http://www.w3.org/2000/svg",
272
272
  "aria-hidden": "true",
273
273
  children: [
274
- /* @__PURE__ */ t(
274
+ /* @__PURE__ */ r(
275
275
  "path",
276
276
  {
277
277
  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",
@@ -280,7 +280,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
280
280
  strokeLinejoin: "round"
281
281
  }
282
282
  ),
283
- /* @__PURE__ */ t(
283
+ /* @__PURE__ */ r(
284
284
  "path",
285
285
  {
286
286
  d: "M16 9L22 15M22 9L16 15",
@@ -291,17 +291,17 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
291
291
  )
292
292
  ]
293
293
  }
294
- ), Ve = ({ className: e }) => /* @__PURE__ */ t(
294
+ ), Ct = ({ className: e }) => /* @__PURE__ */ r(
295
295
  "svg",
296
296
  {
297
- className: x(e),
297
+ className: S(e),
298
298
  width: "18",
299
299
  height: "18",
300
300
  viewBox: "0 0 24 24",
301
301
  fill: "none",
302
302
  xmlns: "http://www.w3.org/2000/svg",
303
303
  "aria-hidden": "true",
304
- children: /* @__PURE__ */ t(
304
+ children: /* @__PURE__ */ r(
305
305
  "path",
306
306
  {
307
307
  d: "M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",
@@ -312,17 +312,17 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
312
312
  }
313
313
  )
314
314
  }
315
- ), Ae = ({ className: e }) => /* @__PURE__ */ t(
315
+ ), Lt = ({ className: e }) => /* @__PURE__ */ r(
316
316
  "svg",
317
317
  {
318
- className: x(e),
318
+ className: S(e),
319
319
  width: "18",
320
320
  height: "18",
321
321
  viewBox: "0 0 24 24",
322
322
  fill: "none",
323
323
  xmlns: "http://www.w3.org/2000/svg",
324
324
  "aria-hidden": "true",
325
- children: /* @__PURE__ */ t(
325
+ children: /* @__PURE__ */ r(
326
326
  "path",
327
327
  {
328
328
  d: "M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",
@@ -333,10 +333,10 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
333
333
  }
334
334
  )
335
335
  }
336
- ), De = ({ className: e }) => /* @__PURE__ */ g(
336
+ ), Et = ({ className: e }) => /* @__PURE__ */ b(
337
337
  "svg",
338
338
  {
339
- className: x(e),
339
+ className: S(e),
340
340
  width: "18",
341
341
  height: "18",
342
342
  viewBox: "0 0 24 24",
@@ -344,14 +344,14 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
344
344
  xmlns: "http://www.w3.org/2000/svg",
345
345
  "aria-hidden": "true",
346
346
  children: [
347
- /* @__PURE__ */ t("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }),
348
- /* @__PURE__ */ t("rect", { x: "12", y: "12", width: "8", height: "5", rx: "1", fill: "currentColor" })
347
+ /* @__PURE__ */ r("rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", stroke: "currentColor", strokeWidth: "1.5" }),
348
+ /* @__PURE__ */ r("rect", { x: "12", y: "12", width: "8", height: "5", rx: "1", fill: "currentColor" })
349
349
  ]
350
350
  }
351
- ), Be = ({ className: e }) => /* @__PURE__ */ g(
351
+ ), xt = ({ className: e }) => /* @__PURE__ */ b(
352
352
  "svg",
353
353
  {
354
- className: x(e),
354
+ className: S(e),
355
355
  width: "18",
356
356
  height: "18",
357
357
  viewBox: "0 0 24 24",
@@ -359,14 +359,14 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
359
359
  xmlns: "http://www.w3.org/2000/svg",
360
360
  "aria-hidden": "true",
361
361
  children: [
362
- /* @__PURE__ */ t("rect", { x: "2", y: "5", width: "20", height: "14", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
363
- /* @__PURE__ */ t("path", { d: "M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
362
+ /* @__PURE__ */ r("rect", { x: "2", y: "5", width: "20", height: "14", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
363
+ /* @__PURE__ */ r("path", { d: "M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
364
364
  ]
365
365
  }
366
- ), $e = ({ className: e }) => /* @__PURE__ */ g(
366
+ ), Nt = ({ className: e }) => /* @__PURE__ */ b(
367
367
  "svg",
368
368
  {
369
- className: x(e),
369
+ className: S(e),
370
370
  width: "16",
371
371
  height: "16",
372
372
  viewBox: "0 0 24 24",
@@ -374,7 +374,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
374
374
  xmlns: "http://www.w3.org/2000/svg",
375
375
  "aria-hidden": "true",
376
376
  children: [
377
- /* @__PURE__ */ t(
377
+ /* @__PURE__ */ r(
378
378
  "path",
379
379
  {
380
380
  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",
@@ -382,7 +382,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
382
382
  strokeWidth: "1.5"
383
383
  }
384
384
  ),
385
- /* @__PURE__ */ t(
385
+ /* @__PURE__ */ r(
386
386
  "path",
387
387
  {
388
388
  d: "M12 8V12L14.5 14.5",
@@ -394,10 +394,10 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
394
394
  )
395
395
  ]
396
396
  }
397
- ), We = ({ className: e }) => /* @__PURE__ */ g(
397
+ ), yt = ({ className: e }) => /* @__PURE__ */ b(
398
398
  "svg",
399
399
  {
400
- className: x(e),
400
+ className: S(e),
401
401
  width: "16",
402
402
  height: "16",
403
403
  viewBox: "0 0 24 24",
@@ -405,7 +405,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
405
405
  xmlns: "http://www.w3.org/2000/svg",
406
406
  "aria-hidden": "true",
407
407
  children: [
408
- /* @__PURE__ */ t(
408
+ /* @__PURE__ */ r(
409
409
  "path",
410
410
  {
411
411
  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",
@@ -413,7 +413,7 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
413
413
  strokeWidth: "1.5"
414
414
  }
415
415
  ),
416
- /* @__PURE__ */ t(
416
+ /* @__PURE__ */ r(
417
417
  "path",
418
418
  {
419
419
  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",
@@ -424,17 +424,17 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
424
424
  )
425
425
  ]
426
426
  }
427
- ), Re = ({ className: e }) => /* @__PURE__ */ t(
427
+ ), Mt = ({ className: e }) => /* @__PURE__ */ r(
428
428
  "svg",
429
429
  {
430
- className: x(e),
430
+ className: S(e),
431
431
  width: "12",
432
432
  height: "12",
433
433
  viewBox: "0 0 24 24",
434
434
  fill: "none",
435
435
  xmlns: "http://www.w3.org/2000/svg",
436
436
  "aria-hidden": "true",
437
- children: /* @__PURE__ */ t(
437
+ children: /* @__PURE__ */ r(
438
438
  "path",
439
439
  {
440
440
  d: "M6 9L12 15L18 9",
@@ -445,27 +445,157 @@ const ne = "gvp-icon", x = (e) => e ? `${ne} ${e}` : ne, ye = ({ className: e })
445
445
  }
446
446
  )
447
447
  }
448
+ ), Tt = ({ className: e }) => /* @__PURE__ */ b(
449
+ "svg",
450
+ {
451
+ className: S(e),
452
+ width: "16",
453
+ height: "16",
454
+ viewBox: "0 0 24 24",
455
+ fill: "none",
456
+ xmlns: "http://www.w3.org/2000/svg",
457
+ "aria-hidden": "true",
458
+ children: [
459
+ /* @__PURE__ */ r(
460
+ "path",
461
+ {
462
+ 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",
463
+ fill: "currentColor"
464
+ }
465
+ ),
466
+ /* @__PURE__ */ r("path", { d: "M6 5V19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })
467
+ ]
468
+ }
469
+ ), Pt = ({ className: e }) => /* @__PURE__ */ b(
470
+ "svg",
471
+ {
472
+ className: S(e),
473
+ width: "16",
474
+ height: "16",
475
+ viewBox: "0 0 24 24",
476
+ fill: "none",
477
+ xmlns: "http://www.w3.org/2000/svg",
478
+ "aria-hidden": "true",
479
+ children: [
480
+ /* @__PURE__ */ r(
481
+ "path",
482
+ {
483
+ 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",
484
+ fill: "currentColor"
485
+ }
486
+ ),
487
+ /* @__PURE__ */ r("path", { d: "M18 5V19", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })
488
+ ]
489
+ }
448
490
  );
449
- function re(e) {
491
+ function ke(e) {
450
492
  if (!Number.isFinite(e) || e < 0) return "--:--";
451
- const n = Math.floor(e), s = Math.floor(n / 3600), r = Math.floor(n % 3600 / 60), i = (n % 60).toString().padStart(2, "0");
452
- if (s > 0) {
453
- const u = r.toString().padStart(2, "0");
454
- return `${s}:${u}:${i}`;
493
+ const s = Math.floor(e), t = Math.floor(s / 3600), n = Math.floor(s % 3600 / 60), i = (s % 60).toString().padStart(2, "0");
494
+ if (t > 0) {
495
+ const a = n.toString().padStart(2, "0");
496
+ return `${t}:${a}:${i}`;
455
497
  }
456
- return `${r}:${i}`;
498
+ return `${n}:${i}`;
457
499
  }
458
- const _e = {
500
+ const It = {
459
501
  index: -1
460
502
  };
461
- function je(e, n) {
462
- return e > 0 ? `${e}p` : `Level ${n + 1}`;
503
+ function St(e, s) {
504
+ return e > 0 ? `${e}p` : `Level ${s + 1}`;
505
+ }
506
+ function Ve(e) {
507
+ const s = e.trim().split(":");
508
+ if (s.length < 2 || s.length > 3) return NaN;
509
+ const t = s.map(Number);
510
+ return t.some((n) => !Number.isFinite(n)) ? NaN : t.length === 3 ? t[0] * 3600 + t[1] * 60 + t[2] : t[0] * 60 + t[1];
511
+ }
512
+ function Vt(e, s) {
513
+ try {
514
+ return new URL(e, s).href;
515
+ } catch {
516
+ return e;
517
+ }
518
+ }
519
+ function Ht(e, s) {
520
+ const t = [], n = e.replace(/\r/g, "").split(`
521
+ `);
522
+ for (let o = 0; o < n.length; o++) {
523
+ const i = n[o].indexOf("-->");
524
+ if (i === -1) continue;
525
+ const a = Ve(n[o].slice(0, i)), c = Ve(n[o].slice(i + 3));
526
+ if (!Number.isFinite(a) || !Number.isFinite(c)) continue;
527
+ const p = (n[o + 1] ?? "").trim();
528
+ if (!p) continue;
529
+ const u = p.indexOf("#xywh=");
530
+ let E = p, x = 0, l = 0, d = 0, C = 0;
531
+ if (u !== -1) {
532
+ E = p.slice(0, u);
533
+ const w = p.slice(u + 6).split(",").map(Number);
534
+ w.length === 4 && w.every(Number.isFinite) && ([x, l, d, C] = w);
535
+ }
536
+ t.push({ start: a, end: c, url: Vt(E, s), x, y: l, w: d, h: C });
537
+ }
538
+ return t.sort((o, i) => o.start - i.start), t;
539
+ }
540
+ function At(e) {
541
+ return {
542
+ cues: e,
543
+ cueAt(s) {
544
+ if (e.length === 0) return null;
545
+ let t = 0, n = e.length - 1, o = e[0];
546
+ for (; t <= n; ) {
547
+ const i = t + n >> 1, a = e[i];
548
+ if (s < a.start)
549
+ n = i - 1;
550
+ else if (s > a.end)
551
+ o = a, t = i + 1;
552
+ else
553
+ return a;
554
+ }
555
+ return o;
556
+ }
557
+ };
463
558
  }
464
- const se = (() => {
559
+ function He(e) {
560
+ const s = e.trim().split(":");
561
+ if (s.length < 2 || s.length > 3) return NaN;
562
+ const t = s.map(Number);
563
+ return t.some((n) => !Number.isFinite(n)) ? NaN : t.length === 3 ? t[0] * 3600 + t[1] * 60 + t[2] : t[0] * 60 + t[1];
564
+ }
565
+ function $t(e) {
566
+ const s = [], t = e.replace(/\r/g, "").split(`
567
+ `);
568
+ for (let n = 0; n < t.length; n++) {
569
+ const o = t[n].indexOf("-->");
570
+ if (o === -1) continue;
571
+ const i = He(t[n].slice(0, o)), a = He(t[n].slice(o + 3));
572
+ if (!Number.isFinite(i) || !Number.isFinite(a)) continue;
573
+ const c = (t[n + 1] ?? "").trim();
574
+ c && s.push({ start: i, end: a, title: c });
575
+ }
576
+ return s.sort((n, o) => n.start - o.start), s;
577
+ }
578
+ function Bt(e, s) {
579
+ const t = e.filter((n) => Number.isFinite(n.start) && n.start >= 0 && n.title).sort((n, o) => n.start - o.start);
580
+ return t.map((n, o) => {
581
+ var i;
582
+ return {
583
+ start: n.start,
584
+ end: Number.isFinite(n.end) ? n.end : ((i = t[o + 1]) == null ? void 0 : i.start) ?? s,
585
+ title: n.title
586
+ };
587
+ });
588
+ }
589
+ function Dt(e, s) {
590
+ for (const t of e)
591
+ if (s >= t.start && s < t.end) return t;
592
+ return null;
593
+ }
594
+ const Ae = (() => {
465
595
  if (typeof navigator > "u") return !1;
466
596
  const e = navigator.userAgent;
467
597
  return /iPad|iPhone|iPod/.test(e) || e.includes("Mac") && navigator.maxTouchPoints > 1;
468
- })(), G = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), Ue = 3e3, j = {
598
+ })(), be = typeof navigator > "u" ? !1 : /iPhone|iPod/.test(navigator.userAgent), Wt = 3e3, K = {
469
599
  isSupported() {
470
600
  return typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled);
471
601
  },
@@ -473,8 +603,8 @@ const se = (() => {
473
603
  return typeof document > "u" ? null : document.fullscreenElement ?? document.webkitFullscreenElement ?? null;
474
604
  },
475
605
  request(e) {
476
- const n = e.requestFullscreen ?? e.webkitRequestFullscreen;
477
- return n ? n.call(e) : Promise.reject(new Error("Fullscreen not supported"));
606
+ const s = e.requestFullscreen ?? e.webkitRequestFullscreen;
607
+ return s ? s.call(e) : Promise.reject(new Error("Fullscreen not supported"));
478
608
  },
479
609
  exit() {
480
610
  const e = document.exitFullscreen ?? document.webkitExitFullscreen;
@@ -485,243 +615,378 @@ const se = (() => {
485
615
  document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e);
486
616
  };
487
617
  }
488
- }, Ze = ({
618
+ }, Rt = ({
489
619
  video: e,
490
- isPlaying: n,
491
- container: s,
492
- onTogglePlay: r,
493
- qualityLevels: l = [],
620
+ isPlaying: s,
621
+ container: t,
622
+ onTogglePlay: n,
623
+ qualityLevels: o = [],
494
624
  currentLevel: i = -1,
495
- selectedLevel: u = -1,
496
- onSelectLevel: c
625
+ selectedLevel: a = -1,
626
+ onSelectLevel: c,
627
+ thumbnails: p,
628
+ chapters: u,
629
+ hasPrev: E = !1,
630
+ hasNext: x = !1,
631
+ onPrev: l,
632
+ onNext: d
497
633
  }) => {
498
- const [p, d] = k(!0), C = H(null), b = M(() => {
499
- C.current !== null && (clearTimeout(C.current), C.current = null);
500
- }, []), o = M(() => {
501
- b(), n && (C.current = setTimeout(() => d(!1), Ue));
502
- }, [b, n]), a = M(() => {
503
- d(!0), o();
504
- }, [o]);
505
- return P(() => {
506
- if (!n) {
507
- b(), d(!0);
634
+ const [C, w] = v(!0), P = $(null), N = H(() => {
635
+ P.current !== null && (clearTimeout(P.current), P.current = null);
636
+ }, []), R = H(() => {
637
+ N(), s && (P.current = setTimeout(() => w(!1), Wt));
638
+ }, [N, s]), f = H(() => {
639
+ w(!0), R();
640
+ }, [R]);
641
+ return T(() => {
642
+ if (!s) {
643
+ N(), w(!0);
508
644
  return;
509
645
  }
510
- return o(), b;
511
- }, [n, o, b]), P(() => {
512
- if (!s) return;
513
- const m = () => a();
514
- return s.addEventListener("mousemove", m), s.addEventListener("touchstart", m), s.addEventListener("focusin", m), () => {
515
- s.removeEventListener("mousemove", m), s.removeEventListener("touchstart", m), s.removeEventListener("focusin", m);
646
+ return R(), N;
647
+ }, [s, R, N]), T(() => {
648
+ if (!t) return;
649
+ const g = () => f();
650
+ return t.addEventListener("mousemove", g), t.addEventListener("touchstart", g), t.addEventListener("focusin", g), () => {
651
+ t.removeEventListener("mousemove", g), t.removeEventListener("touchstart", g), t.removeEventListener("focusin", g);
516
652
  };
517
- }, [s, a]), P(() => {
518
- if (!s || !e) return;
519
- const m = (f) => {
520
- if (!(!s.contains(document.activeElement) || f.target.tagName === "INPUT" && f.key !== " "))
521
- switch (f.key) {
653
+ }, [t, f]), T(() => {
654
+ if (!t || !e) return;
655
+ const g = (k) => {
656
+ if (!(!t.contains(document.activeElement) || k.target.tagName === "INPUT" && k.key !== " "))
657
+ switch (k.key) {
522
658
  case " ":
523
659
  case "k":
524
- f.preventDefault(), r(), a();
660
+ k.preventDefault(), n(), f();
525
661
  break;
526
662
  case "ArrowLeft":
527
- f.preventDefault(), e.currentTime = Math.max(0, e.currentTime - 5), a();
663
+ k.preventDefault(), e.currentTime = Math.max(0, e.currentTime - 5), f();
528
664
  break;
529
665
  case "ArrowRight":
530
- f.preventDefault(), e.currentTime = Math.min(e.duration || 0, e.currentTime + 5), a();
666
+ k.preventDefault(), e.currentTime = Math.min(e.duration || 0, e.currentTime + 5), f();
531
667
  break;
532
668
  case "ArrowUp":
533
- f.preventDefault(), e.volume = Math.min(1, e.volume + 0.1), e.muted && (e.muted = !1), a();
669
+ k.preventDefault(), e.volume = Math.min(1, e.volume + 0.1), e.muted && (e.muted = !1), f();
534
670
  break;
535
671
  case "ArrowDown":
536
- f.preventDefault(), e.volume = Math.max(0, e.volume - 0.1), a();
672
+ k.preventDefault(), e.volume = Math.max(0, e.volume - 0.1), f();
537
673
  break;
538
674
  case "m":
539
- e.muted = !e.muted, a();
675
+ e.muted = !e.muted, f();
540
676
  break;
541
677
  case "f":
542
- j.element() === s ? j.exit().catch(() => {
543
- }) : j.request(s).catch(() => {
544
- }), a();
678
+ K.element() === t ? K.exit().catch(() => {
679
+ }) : K.request(t).catch(() => {
680
+ }), f();
545
681
  break;
546
682
  case "p":
547
683
  document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
548
684
  }) : document.pictureInPictureEnabled && e.requestPictureInPicture().catch(() => {
549
- }), a();
685
+ }), f();
550
686
  break;
551
687
  }
552
688
  };
553
- return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
554
- }, [s, e, r, a]), /* @__PURE__ */ t(
689
+ return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
690
+ }, [t, e, n, f]), /* @__PURE__ */ r(
555
691
  "div",
556
692
  {
557
693
  role: "toolbar",
558
694
  "aria-label": "Video controls",
559
- className: I("gvp-controls", !p && "is-hidden"),
560
- onMouseEnter: b,
561
- onMouseLeave: o,
562
- children: /* @__PURE__ */ g("div", { className: "gvp-controls-row", children: [
563
- /* @__PURE__ */ t(Oe, { isPlaying: n, onToggle: r }),
564
- /* @__PURE__ */ t(qe, { video: e }),
565
- /* @__PURE__ */ t(Fe, { video: e }),
566
- /* @__PURE__ */ t(ze, { video: e }),
567
- /* @__PURE__ */ t(
568
- Ke,
695
+ className: D("gvp-controls", !C && "is-hidden"),
696
+ onMouseEnter: N,
697
+ onMouseLeave: R,
698
+ children: /* @__PURE__ */ b("div", { className: "gvp-controls-row", children: [
699
+ (E || x) && /* @__PURE__ */ r(
700
+ "button",
701
+ {
702
+ type: "button",
703
+ className: "gvp-ctrl-btn",
704
+ "aria-label": "Previous video",
705
+ disabled: !E,
706
+ onClick: l,
707
+ children: /* @__PURE__ */ r(Tt, {})
708
+ }
709
+ ),
710
+ /* @__PURE__ */ r(Ft, { isPlaying: s, onToggle: n }),
711
+ (E || x) && /* @__PURE__ */ r(
712
+ "button",
713
+ {
714
+ type: "button",
715
+ className: "gvp-ctrl-btn",
716
+ "aria-label": "Next video",
717
+ disabled: !x,
718
+ onClick: d,
719
+ children: /* @__PURE__ */ r(Pt, {})
720
+ }
721
+ ),
722
+ /* @__PURE__ */ r(
723
+ Ot,
569
724
  {
570
- levels: l,
725
+ video: e,
726
+ thumbnails: p,
727
+ chapters: u
728
+ }
729
+ ),
730
+ /* @__PURE__ */ r(Zt, { video: e }),
731
+ /* @__PURE__ */ r(zt, { video: e }),
732
+ /* @__PURE__ */ r(
733
+ Yt,
734
+ {
735
+ levels: o,
571
736
  currentLevel: i,
572
- selectedLevel: u,
737
+ selectedLevel: a,
573
738
  onSelect: c
574
739
  }
575
740
  ),
576
- /* @__PURE__ */ t(Je, { video: e }),
577
- /* @__PURE__ */ t(Qe, { video: e }),
578
- /* @__PURE__ */ t(Xe, { video: e }),
579
- /* @__PURE__ */ t(Ge, { container: s, video: e })
741
+ /* @__PURE__ */ r(Kt, { video: e }),
742
+ /* @__PURE__ */ r(qt, { video: e }),
743
+ /* @__PURE__ */ r(Jt, { video: e }),
744
+ /* @__PURE__ */ r(Xt, { container: t, video: e })
580
745
  ] })
581
746
  }
582
747
  );
583
748
  };
584
- function ee(e, n, s) {
585
- P(() => {
749
+ function we(e, s, t) {
750
+ T(() => {
586
751
  if (!e) return;
587
- const r = (i) => {
588
- n.current && !n.current.contains(i.target) && s();
589
- }, l = (i) => {
590
- i.key === "Escape" && s();
752
+ const n = (i) => {
753
+ s.current && !s.current.contains(i.target) && t();
754
+ }, o = (i) => {
755
+ i.key === "Escape" && t();
591
756
  };
592
- return document.addEventListener("mousedown", r), document.addEventListener("keydown", l), () => {
593
- document.removeEventListener("mousedown", r), document.removeEventListener("keydown", l);
757
+ return document.addEventListener("mousedown", n), document.addEventListener("keydown", o), () => {
758
+ document.removeEventListener("mousedown", n), document.removeEventListener("keydown", o);
594
759
  };
595
- }, [e, n, s]);
760
+ }, [e, s, t]);
596
761
  }
597
- const Oe = ({
762
+ const Ft = ({
598
763
  isPlaying: e,
599
- onToggle: n
600
- }) => /* @__PURE__ */ t(
764
+ onToggle: s
765
+ }) => /* @__PURE__ */ r(
601
766
  "button",
602
767
  {
603
768
  type: "button",
604
769
  className: "gvp-ctrl-btn",
605
770
  "aria-label": e ? "Pause" : "Play",
606
771
  "aria-pressed": e,
607
- onClick: n,
608
- children: e ? /* @__PURE__ */ t(Te, {}) : /* @__PURE__ */ t(Pe, {})
772
+ onClick: s,
773
+ children: e ? /* @__PURE__ */ r(vt, {}) : /* @__PURE__ */ r(gt, {})
609
774
  }
610
- ), qe = ({ video: e }) => {
611
- const [n, s] = k(0), [r, l] = k(0), [i, u] = k(0);
612
- P(() => {
775
+ );
776
+ function Ut(e) {
777
+ const [s, t] = v(null);
778
+ return T(() => {
779
+ if (!e) {
780
+ t(null);
781
+ return;
782
+ }
783
+ let n = !1;
784
+ return fetch(e).then((o) => o.ok ? o.text() : Promise.reject(new Error("fetch failed"))).then((o) => {
785
+ if (n) return;
786
+ const i = Ht(o, new URL(e, location.href).href);
787
+ t(i.length > 0 ? At(i) : null);
788
+ }).catch(() => {
789
+ n || t(null);
790
+ }), () => {
791
+ n = !0;
792
+ };
793
+ }, [e]), s;
794
+ }
795
+ function jt(e, s) {
796
+ const [t, n] = v([]), o = typeof e == "string";
797
+ return T(() => {
798
+ if (!o || !e) {
799
+ n([]);
800
+ return;
801
+ }
802
+ let i = !1;
803
+ return fetch(e).then((a) => a.ok ? a.text() : Promise.reject(new Error("fetch failed"))).then((a) => {
804
+ i || n($t(a));
805
+ }).catch(() => {
806
+ i || n([]);
807
+ }), () => {
808
+ i = !0;
809
+ };
810
+ }, [o, e]), o ? t : Array.isArray(e) ? Bt(e, s) : [];
811
+ }
812
+ const Ot = ({ video: e, thumbnails: s, chapters: t }) => {
813
+ var f;
814
+ const [n, o] = v(0), [i, a] = v(0), [c, p] = v(0), [u, E] = v(null), x = $(null), l = Ut(s), d = jt(t, i);
815
+ T(() => {
613
816
  if (!e) return;
614
- const b = () => s(e.currentTime), o = () => l(Number.isFinite(e.duration) ? e.duration : 0), a = () => {
615
- const m = e.buffered;
616
- if (!m || m.length === 0) {
617
- u(0);
817
+ const g = () => o(e.currentTime), k = () => a(Number.isFinite(e.duration) ? e.duration : 0), y = () => {
818
+ const V = e.buffered;
819
+ if (!V || V.length === 0) {
820
+ p(0);
618
821
  return;
619
822
  }
620
- let f = m.end(m.length - 1);
621
- for (let w = 0; w < m.length; w++)
622
- if (m.start(w) <= e.currentTime && e.currentTime <= m.end(w)) {
623
- f = m.end(w);
823
+ let O = V.end(V.length - 1);
824
+ for (let U = 0; U < V.length; U++)
825
+ if (V.start(U) <= e.currentTime && e.currentTime <= V.end(U)) {
826
+ O = V.end(U);
624
827
  break;
625
828
  }
626
- u(f);
829
+ p(O);
627
830
  };
628
- return b(), o(), a(), e.addEventListener("timeupdate", b), e.addEventListener("durationchange", o), e.addEventListener("loadedmetadata", o), e.addEventListener("progress", a), e.addEventListener("timeupdate", a), () => {
629
- e.removeEventListener("timeupdate", b), e.removeEventListener("durationchange", o), e.removeEventListener("loadedmetadata", o), e.removeEventListener("progress", a), e.removeEventListener("timeupdate", a);
831
+ return g(), k(), y(), e.addEventListener("timeupdate", g), e.addEventListener("durationchange", k), e.addEventListener("loadedmetadata", k), e.addEventListener("progress", y), e.addEventListener("timeupdate", y), () => {
832
+ e.removeEventListener("timeupdate", g), e.removeEventListener("durationchange", k), e.removeEventListener("loadedmetadata", k), e.removeEventListener("progress", y), e.removeEventListener("timeupdate", y);
630
833
  };
631
834
  }, [e]);
632
- const c = r > 0, p = c ? n / r * 100 : 0, d = c ? i / r * 100 : 0, C = (b) => {
633
- if (!e || !c) return;
634
- const o = Number(b.target.value) / 100 * r;
635
- e.currentTime = o, s(o);
835
+ const C = i > 0, w = C ? n / i * 100 : 0, P = C ? c / i * 100 : 0, N = (g) => {
836
+ if (!e || !C) return;
837
+ const k = Number(g.target.value) / 100 * i;
838
+ e.currentTime = k, o(k);
839
+ }, R = (g) => {
840
+ const k = x.current;
841
+ if (!k || !C) return;
842
+ const y = k.getBoundingClientRect(), V = Math.min(Math.max(g - y.left, 0), y.width);
843
+ E({ time: V / y.width * i, x: V });
636
844
  };
637
- return /* @__PURE__ */ g("div", { className: "gvp-seek", children: [
638
- /* @__PURE__ */ g("div", { className: "gvp-seek-track", children: [
639
- /* @__PURE__ */ t(
640
- "div",
641
- {
642
- className: "gvp-seek-buffered",
643
- style: { width: `${d}%` }
644
- }
645
- ),
646
- /* @__PURE__ */ t(
647
- "div",
648
- {
649
- className: "gvp-seek-progress",
650
- style: { width: `${p}%` }
651
- }
652
- )
653
- ] }),
654
- /* @__PURE__ */ t(
655
- "input",
845
+ return (
846
+ // Pointer handlers live on the wrapper, not `.gvp-seek-track`: the
847
+ // transparent range <input> is layered on top of the track and would
848
+ // otherwise swallow every pointer event before it reached the track.
849
+ /* @__PURE__ */ b(
850
+ "div",
656
851
  {
657
- type: "range",
658
- className: "gvp-seek-input",
659
- min: 0,
660
- max: 100,
661
- step: 0.1,
662
- value: p,
663
- onChange: C,
664
- disabled: !c,
665
- "aria-label": "Seek",
666
- "aria-valuemin": 0,
667
- "aria-valuemax": Math.floor(r),
668
- "aria-valuenow": Math.floor(n)
852
+ className: "gvp-seek",
853
+ onPointerMove: (g) => R(g.clientX),
854
+ onPointerLeave: () => E(null),
855
+ children: [
856
+ /* @__PURE__ */ b("div", { className: "gvp-seek-track", ref: x, children: [
857
+ /* @__PURE__ */ r(
858
+ "div",
859
+ {
860
+ className: "gvp-seek-buffered",
861
+ style: { width: `${P}%` }
862
+ }
863
+ ),
864
+ /* @__PURE__ */ r(
865
+ "div",
866
+ {
867
+ className: "gvp-seek-progress",
868
+ style: { width: `${w}%` }
869
+ }
870
+ ),
871
+ C && d.map(
872
+ (g) => g.start > 0 && g.start < i && /* @__PURE__ */ r(
873
+ "div",
874
+ {
875
+ className: "gvp-seek-chapter-tick",
876
+ style: { left: `${g.start / i * 100}%` }
877
+ },
878
+ `${g.start}-${g.title}`
879
+ )
880
+ )
881
+ ] }),
882
+ u && /* @__PURE__ */ r(
883
+ _t,
884
+ {
885
+ hover: u,
886
+ track: l,
887
+ chapters: d,
888
+ trackWidth: ((f = x.current) == null ? void 0 : f.clientWidth) ?? 0
889
+ }
890
+ ),
891
+ /* @__PURE__ */ r(
892
+ "input",
893
+ {
894
+ type: "range",
895
+ className: "gvp-seek-input",
896
+ min: 0,
897
+ max: 100,
898
+ step: 0.1,
899
+ value: w,
900
+ onChange: N,
901
+ disabled: !C,
902
+ "aria-label": "Seek",
903
+ "aria-valuemin": 0,
904
+ "aria-valuemax": Math.floor(i),
905
+ "aria-valuenow": Math.floor(n)
906
+ }
907
+ )
908
+ ]
669
909
  }
670
910
  )
671
- ] });
672
- }, Fe = ({ video: e }) => {
673
- const [n, s] = k(0), [r, l] = k(0);
674
- return P(() => {
911
+ );
912
+ }, _t = ({ hover: e, track: s, chapters: t, trackWidth: n }) => {
913
+ const o = (s == null ? void 0 : s.cueAt(e.time)) ?? null, i = o !== null && o.w > 0 && o.h > 0, a = Dt(t, e.time), p = (i ? o.w : 0) / 2, u = n > 0 ? Math.min(Math.max(e.x, p), n - p) : e.x;
914
+ return /* @__PURE__ */ b(
915
+ "div",
916
+ {
917
+ className: D("gvp-seek-preview", i && "has-thumb"),
918
+ style: { left: `${u}px` },
919
+ children: [
920
+ i && /* @__PURE__ */ r(
921
+ "div",
922
+ {
923
+ className: "gvp-seek-preview-thumb",
924
+ style: {
925
+ width: `${o.w}px`,
926
+ height: `${o.h}px`,
927
+ backgroundImage: `url(${JSON.stringify(o.url)})`,
928
+ backgroundPosition: `-${o.x}px -${o.y}px`
929
+ }
930
+ }
931
+ ),
932
+ a && /* @__PURE__ */ r("span", { className: "gvp-seek-preview-chapter", children: a.title }),
933
+ /* @__PURE__ */ r("span", { className: "gvp-seek-preview-time", children: ke(e.time) })
934
+ ]
935
+ }
936
+ );
937
+ }, Zt = ({ video: e }) => {
938
+ const [s, t] = v(0), [n, o] = v(0);
939
+ return T(() => {
675
940
  if (!e) return;
676
- const i = () => s(e.currentTime), u = () => l(Number.isFinite(e.duration) ? e.duration : 0);
677
- return i(), u(), e.addEventListener("timeupdate", i), e.addEventListener("durationchange", u), e.addEventListener("loadedmetadata", u), () => {
678
- e.removeEventListener("timeupdate", i), e.removeEventListener("durationchange", u), e.removeEventListener("loadedmetadata", u);
941
+ const i = () => t(e.currentTime), a = () => o(Number.isFinite(e.duration) ? e.duration : 0);
942
+ return i(), a(), e.addEventListener("timeupdate", i), e.addEventListener("durationchange", a), e.addEventListener("loadedmetadata", a), () => {
943
+ e.removeEventListener("timeupdate", i), e.removeEventListener("durationchange", a), e.removeEventListener("loadedmetadata", a);
679
944
  };
680
- }, [e]), /* @__PURE__ */ g("span", { className: "gvp-time", "aria-live": "off", children: [
681
- re(n),
945
+ }, [e]), /* @__PURE__ */ b("span", { className: "gvp-time", "aria-live": "off", children: [
946
+ ke(s),
682
947
  " / ",
683
- re(r)
948
+ ke(n)
684
949
  ] });
685
- }, Qe = ({ video: e }) => {
686
- const [n, s] = k(1), [r, l] = k(!1);
687
- P(() => {
950
+ }, qt = ({ video: e }) => {
951
+ const [s, t] = v(1), [n, o] = v(!1);
952
+ T(() => {
688
953
  if (!e) return;
689
- const d = () => {
690
- s(e.volume), l(e.muted);
954
+ const u = () => {
955
+ t(e.volume), o(e.muted);
691
956
  };
692
- return d(), e.addEventListener("volumechange", d), () => e.removeEventListener("volumechange", d);
957
+ return u(), e.addEventListener("volumechange", u), () => e.removeEventListener("volumechange", u);
693
958
  }, [e]);
694
959
  const i = () => {
695
960
  e && (e.muted = !e.muted);
696
- }, u = (d) => {
961
+ }, a = (u) => {
697
962
  if (!e) return;
698
- const C = Number(d.target.value) / 100;
699
- e.volume = C, C > 0 && e.muted && (e.muted = !1);
963
+ const E = Number(u.target.value) / 100;
964
+ e.volume = E, E > 0 && e.muted && (e.muted = !1);
700
965
  };
701
- let c = Ie;
702
- r || n === 0 ? c = He : n < 0.5 && (c = Se);
703
- const p = r ? 0 : Math.round(n * 100);
704
- return /* @__PURE__ */ g("div", { className: I("gvp-volume", !se && "is-expandable"), children: [
705
- /* @__PURE__ */ t(
966
+ let c = bt;
967
+ n || s === 0 ? c = wt : s < 0.5 && (c = kt);
968
+ const p = n ? 0 : Math.round(s * 100);
969
+ return /* @__PURE__ */ b("div", { className: D("gvp-volume", !Ae && "is-expandable"), children: [
970
+ /* @__PURE__ */ r(
706
971
  "button",
707
972
  {
708
973
  type: "button",
709
974
  className: "gvp-ctrl-btn",
710
- "aria-label": r ? "Unmute" : "Mute",
711
- "aria-pressed": r,
975
+ "aria-label": n ? "Unmute" : "Mute",
976
+ "aria-pressed": n,
712
977
  onClick: i,
713
- children: /* @__PURE__ */ t(c, {})
978
+ children: /* @__PURE__ */ r(c, {})
714
979
  }
715
980
  ),
716
- !se && /* @__PURE__ */ g("div", { className: "gvp-volume-slider-wrap", children: [
717
- /* @__PURE__ */ t("div", { className: "gvp-volume-track", children: /* @__PURE__ */ t(
981
+ !Ae && /* @__PURE__ */ b("div", { className: "gvp-volume-slider-wrap", children: [
982
+ /* @__PURE__ */ r("div", { className: "gvp-volume-track", children: /* @__PURE__ */ r(
718
983
  "div",
719
984
  {
720
985
  className: "gvp-volume-fill",
721
986
  style: { width: `${p}%` }
722
987
  }
723
988
  ) }),
724
- /* @__PURE__ */ t(
989
+ /* @__PURE__ */ r(
725
990
  "input",
726
991
  {
727
992
  type: "range",
@@ -730,7 +995,7 @@ const Oe = ({
730
995
  max: 100,
731
996
  step: 1,
732
997
  value: p,
733
- onChange: u,
998
+ onChange: a,
734
999
  "aria-label": "Volume",
735
1000
  "aria-valuemin": 0,
736
1001
  "aria-valuemax": 100,
@@ -739,686 +1004,773 @@ const Oe = ({
739
1004
  )
740
1005
  ] })
741
1006
  ] });
742
- }, Ye = [0.5, 0.75, 1, 1.25, 1.5, 2], ze = ({ video: e }) => {
743
- const [n, s] = k(1), [r, l] = k(!1), i = H(null);
744
- P(() => {
1007
+ }, Qt = [0.5, 0.75, 1, 1.25, 1.5, 2], zt = ({ video: e }) => {
1008
+ const [s, t] = v(1), [n, o] = v(!1), i = $(null);
1009
+ T(() => {
745
1010
  if (!e) return;
746
- const d = () => s(e.playbackRate);
747
- return d(), e.addEventListener("ratechange", d), () => e.removeEventListener("ratechange", d);
1011
+ const u = () => t(e.playbackRate);
1012
+ return u(), e.addEventListener("ratechange", u), () => e.removeEventListener("ratechange", u);
748
1013
  }, [e]);
749
- const u = M(() => l(!1), []);
750
- ee(r, i, u);
751
- const c = (d) => {
752
- e && (e.playbackRate = d), s(d), l(!1);
753
- }, p = n === 1 ? "1×" : `${n}×`;
754
- return /* @__PURE__ */ g("div", { className: "gvp-speed", ref: i, children: [
755
- /* @__PURE__ */ g(
1014
+ const a = H(() => o(!1), []);
1015
+ we(n, i, a);
1016
+ const c = (u) => {
1017
+ e && (e.playbackRate = u), t(u), o(!1);
1018
+ }, p = s === 1 ? "1×" : `${s}×`;
1019
+ return /* @__PURE__ */ b("div", { className: "gvp-speed", ref: i, children: [
1020
+ /* @__PURE__ */ b(
756
1021
  "button",
757
1022
  {
758
1023
  type: "button",
759
1024
  className: "gvp-ctrl-btn gvp-speed-btn",
760
1025
  "aria-haspopup": "listbox",
761
- "aria-expanded": r,
1026
+ "aria-expanded": n,
762
1027
  "aria-label": `Playback speed: ${p}`,
763
- onClick: () => l((d) => !d),
1028
+ onClick: () => o((u) => !u),
764
1029
  children: [
765
- /* @__PURE__ */ t($e, {}),
766
- /* @__PURE__ */ t("span", { className: "gvp-speed-label", children: p })
1030
+ /* @__PURE__ */ r(Nt, {}),
1031
+ /* @__PURE__ */ r("span", { className: "gvp-speed-label", children: p })
767
1032
  ]
768
1033
  }
769
1034
  ),
770
- r && // NOSONAR: typescript:S6819
771
- /* @__PURE__ */ t("ul", { className: "gvp-speed-menu", role: "listbox", "aria-label": "Playback speed", children: Ye.map((d) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1035
+ n && // NOSONAR: typescript:S6819
1036
+ /* @__PURE__ */ r("ul", { className: "gvp-speed-menu", role: "listbox", "aria-label": "Playback speed", children: Qt.map((u) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
772
1037
  "button",
773
1038
  {
774
1039
  type: "button",
775
1040
  role: "option",
776
- "aria-selected": d === n,
777
- className: I("gvp-speed-menu-item", d === n && "is-active"),
778
- onClick: () => c(d),
779
- children: d === 1 ? "Normal" : `${d}×`
1041
+ "aria-selected": u === s,
1042
+ className: D("gvp-speed-menu-item", u === s && "is-active"),
1043
+ onClick: () => c(u),
1044
+ children: u === 1 ? "Normal" : `${u}×`
780
1045
  }
781
- ) }, d)) })
1046
+ ) }, u)) })
782
1047
  ] });
783
- }, Ke = ({ levels: e, currentLevel: n, selectedLevel: s, onSelect: r }) => {
784
- const [l, i] = k(!1), u = H(null), c = M(() => i(!1), []);
785
- if (ee(l, u, c), e.length < 2) return null;
786
- const p = (o) => {
787
- r == null || r(o), i(!1);
788
- }, d = [...e].sort((o, a) => a.height - o.height), C = e.find((o) => o.index === n);
789
- let b;
790
- if (s < 0)
791
- b = C ? `Auto (${C.label})` : "Auto";
1048
+ }, Yt = ({ levels: e, currentLevel: s, selectedLevel: t, onSelect: n }) => {
1049
+ const [o, i] = v(!1), a = $(null), c = H(() => i(!1), []);
1050
+ if (we(o, a, c), e.length < 2) return null;
1051
+ const p = (l) => {
1052
+ n == null || n(l), i(!1);
1053
+ }, u = [...e].sort((l, d) => d.height - l.height), E = e.find((l) => l.index === s);
1054
+ let x;
1055
+ if (t < 0)
1056
+ x = E ? `Auto (${E.label})` : "Auto";
792
1057
  else {
793
- const o = e.find((a) => a.index === s);
794
- b = (o == null ? void 0 : o.label) ?? "Auto";
1058
+ const l = e.find((d) => d.index === t);
1059
+ x = (l == null ? void 0 : l.label) ?? "Auto";
795
1060
  }
796
- return /* @__PURE__ */ g("div", { className: "gvp-quality", ref: u, children: [
797
- /* @__PURE__ */ g(
1061
+ return /* @__PURE__ */ b("div", { className: "gvp-quality", ref: a, children: [
1062
+ /* @__PURE__ */ b(
798
1063
  "button",
799
1064
  {
800
1065
  type: "button",
801
1066
  className: "gvp-ctrl-btn gvp-quality-btn",
802
1067
  "aria-haspopup": "listbox",
803
- "aria-expanded": l,
804
- "aria-label": `Quality: ${b}`,
805
- onClick: () => i((o) => !o),
1068
+ "aria-expanded": o,
1069
+ "aria-label": `Quality: ${x}`,
1070
+ onClick: () => i((l) => !l),
806
1071
  children: [
807
- /* @__PURE__ */ t(We, {}),
808
- /* @__PURE__ */ t("span", { className: "gvp-quality-label", children: b })
1072
+ /* @__PURE__ */ r(yt, {}),
1073
+ /* @__PURE__ */ r("span", { className: "gvp-quality-label", children: x })
809
1074
  ]
810
1075
  }
811
1076
  ),
812
- l && // NOSONAR: typescript:S6819
813
- /* @__PURE__ */ g("ul", { className: "gvp-quality-menu", role: "listbox", "aria-label": "Quality", children: [
814
- /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1077
+ o && // NOSONAR: typescript:S6819
1078
+ /* @__PURE__ */ b("ul", { className: "gvp-quality-menu", role: "listbox", "aria-label": "Quality", children: [
1079
+ /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
815
1080
  "button",
816
1081
  {
817
1082
  type: "button",
818
1083
  role: "option",
819
- "aria-selected": s < 0,
820
- className: I(
1084
+ "aria-selected": t < 0,
1085
+ className: D(
821
1086
  "gvp-quality-menu-item",
822
- s < 0 && "is-active"
1087
+ t < 0 && "is-active"
823
1088
  ),
824
- onClick: () => p(_e.index),
825
- children: C ? `Auto (${C.label})` : "Auto"
1089
+ onClick: () => p(It.index),
1090
+ children: E ? `Auto (${E.label})` : "Auto"
826
1091
  }
827
1092
  ) }),
828
- d.map((o) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1093
+ u.map((l) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
829
1094
  "button",
830
1095
  {
831
1096
  type: "button",
832
1097
  role: "option",
833
- "aria-selected": o.index === s,
834
- className: I(
1098
+ "aria-selected": l.index === t,
1099
+ className: D(
835
1100
  "gvp-quality-menu-item",
836
- o.index === s && "is-active"
1101
+ l.index === t && "is-active"
837
1102
  ),
838
- onClick: () => p(o.index),
839
- children: o.label
1103
+ onClick: () => p(l.index),
1104
+ children: l.label
840
1105
  }
841
- ) }, o.index))
1106
+ ) }, l.index))
842
1107
  ] })
843
1108
  ] });
844
- }, Je = ({ video: e }) => {
845
- const [n, s] = k([]), [r, l] = k(-1), [i, u] = k(!1), c = H(null), p = M((o) => {
846
- const a = [];
847
- for (let f = 0; f < o.length; f++) {
848
- const w = o[f];
849
- (w.kind === "subtitles" || w.kind === "captions") && a.push({ index: f, label: w.label || w.language || `Track ${f + 1}`, language: w.language });
1109
+ }, Kt = ({ video: e }) => {
1110
+ const [s, t] = v([]), [n, o] = v(-1), [i, a] = v(!1), c = $(null), p = H((l) => {
1111
+ const d = [];
1112
+ for (let w = 0; w < l.length; w++) {
1113
+ const P = l[w];
1114
+ (P.kind === "subtitles" || P.kind === "captions") && d.push({ index: w, label: P.label || P.language || `Track ${w + 1}`, language: P.language });
850
1115
  }
851
- s(a);
852
- let m = -1;
853
- for (let f = 0; f < o.length; f++)
854
- if (o[f].mode === "showing") {
855
- m = f;
1116
+ t(d);
1117
+ let C = -1;
1118
+ for (let w = 0; w < l.length; w++)
1119
+ if (l[w].mode === "showing") {
1120
+ C = w;
856
1121
  break;
857
1122
  }
858
- l(m);
1123
+ o(C);
859
1124
  }, []);
860
- P(() => {
1125
+ T(() => {
861
1126
  if (!e) {
862
- s([]), l(-1);
1127
+ t([]), o(-1);
863
1128
  return;
864
1129
  }
865
- const o = e.textTracks;
866
- p(o);
867
- const a = () => p(o);
868
- if (typeof o.addEventListener == "function")
869
- return o.addEventListener("addtrack", a), o.addEventListener("removetrack", a), o.addEventListener("change", a), () => {
870
- o.removeEventListener("addtrack", a), o.removeEventListener("removetrack", a), o.removeEventListener("change", a);
1130
+ const l = e.textTracks;
1131
+ p(l);
1132
+ const d = () => p(l);
1133
+ if (typeof l.addEventListener == "function")
1134
+ return l.addEventListener("addtrack", d), l.addEventListener("removetrack", d), l.addEventListener("change", d), () => {
1135
+ l.removeEventListener("addtrack", d), l.removeEventListener("removetrack", d), l.removeEventListener("change", d);
871
1136
  };
872
1137
  }, [e, p]);
873
- const d = M(() => u(!1), []);
874
- ee(i, c, d);
875
- const C = (o) => {
1138
+ const u = H(() => a(!1), []);
1139
+ we(i, c, u);
1140
+ const E = (l) => {
876
1141
  if (!e) return;
877
- const a = e.textTracks;
878
- for (let m = 0; m < a.length; m++)
879
- a[m].mode = m === o ? "showing" : "hidden";
880
- l(o), u(!1);
881
- }, b = () => {
1142
+ const d = e.textTracks;
1143
+ for (let C = 0; C < d.length; C++)
1144
+ d[C].mode = C === l ? "showing" : "hidden";
1145
+ o(l), a(!1);
1146
+ }, x = () => {
882
1147
  if (!e) return;
883
- const o = e.textTracks;
884
- for (let a = 0; a < o.length; a++) o[a].mode = "hidden";
885
- l(-1), u(!1);
1148
+ const l = e.textTracks;
1149
+ for (let d = 0; d < l.length; d++) l[d].mode = "hidden";
1150
+ o(-1), a(!1);
886
1151
  };
887
- return n.length === 0 ? null : /* @__PURE__ */ g("div", { className: "gvp-captions", ref: c, children: [
888
- /* @__PURE__ */ t(
1152
+ return s.length === 0 ? null : /* @__PURE__ */ b("div", { className: "gvp-captions", ref: c, children: [
1153
+ /* @__PURE__ */ r(
889
1154
  "button",
890
1155
  {
891
1156
  type: "button",
892
- className: I("gvp-ctrl-btn", r >= 0 && "is-active"),
1157
+ className: D("gvp-ctrl-btn", n >= 0 && "is-active"),
893
1158
  "aria-haspopup": "listbox",
894
1159
  "aria-expanded": i,
895
1160
  "aria-label": "Captions",
896
- "aria-pressed": r >= 0,
897
- onClick: () => u((o) => !o),
898
- children: /* @__PURE__ */ t(Be, {})
1161
+ "aria-pressed": n >= 0,
1162
+ onClick: () => a((l) => !l),
1163
+ children: /* @__PURE__ */ r(xt, {})
899
1164
  }
900
1165
  ),
901
1166
  i && // NOSONAR: typescript:S6819
902
- /* @__PURE__ */ g("ul", { className: "gvp-captions-menu", role: "listbox", "aria-label": "Captions", children: [
903
- /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1167
+ /* @__PURE__ */ b("ul", { className: "gvp-captions-menu", role: "listbox", "aria-label": "Captions", children: [
1168
+ /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
904
1169
  "button",
905
1170
  {
906
1171
  type: "button",
907
1172
  role: "option",
908
- "aria-selected": r === -1,
909
- className: I("gvp-captions-menu-item", r === -1 && "is-active"),
910
- onClick: b,
1173
+ "aria-selected": n === -1,
1174
+ className: D("gvp-captions-menu-item", n === -1 && "is-active"),
1175
+ onClick: x,
911
1176
  children: "Off"
912
1177
  }
913
1178
  ) }),
914
- n.map((o) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1179
+ s.map((l) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
915
1180
  "button",
916
1181
  {
917
1182
  type: "button",
918
1183
  role: "option",
919
- "aria-selected": o.index === r,
920
- className: I("gvp-captions-menu-item", o.index === r && "is-active"),
921
- onClick: () => C(o.index),
922
- children: o.label
1184
+ "aria-selected": l.index === n,
1185
+ className: D("gvp-captions-menu-item", l.index === n && "is-active"),
1186
+ onClick: () => E(l.index),
1187
+ children: l.label
923
1188
  }
924
- ) }, o.index))
1189
+ ) }, l.index))
925
1190
  ] })
926
1191
  ] });
927
- }, Xe = ({ video: e }) => {
928
- const [n, s] = k(!1);
929
- if (P(() => {
1192
+ }, Jt = ({ video: e }) => {
1193
+ const [s, t] = v(!1), [n, o] = v(!1);
1194
+ if (T(() => {
1195
+ o(!0);
1196
+ }, []), T(() => {
930
1197
  if (!e) return;
931
- const l = () => s(!0), i = () => s(!1);
932
- return e.addEventListener("enterpictureinpicture", l), e.addEventListener("leavepictureinpicture", i), () => {
933
- e.removeEventListener("enterpictureinpicture", l), e.removeEventListener("leavepictureinpicture", i);
1198
+ const a = () => t(!0), c = () => t(!1);
1199
+ return e.addEventListener("enterpictureinpicture", a), e.addEventListener("leavepictureinpicture", c), () => {
1200
+ e.removeEventListener("enterpictureinpicture", a), e.removeEventListener("leavepictureinpicture", c);
934
1201
  };
935
- }, [e]), !document.pictureInPictureEnabled) return null;
936
- const r = () => {
1202
+ }, [e]), !n || !document.pictureInPictureEnabled) return null;
1203
+ const i = () => {
937
1204
  document.pictureInPictureElement ? document.exitPictureInPicture().catch(() => {
938
1205
  }) : e == null || e.requestPictureInPicture().catch(() => {
939
1206
  });
940
1207
  };
941
- return /* @__PURE__ */ t(
1208
+ return /* @__PURE__ */ r(
942
1209
  "button",
943
1210
  {
944
1211
  type: "button",
945
- className: I("gvp-ctrl-btn", n && "is-active"),
946
- "aria-label": n ? "Exit picture-in-picture" : "Picture-in-picture",
947
- "aria-pressed": n,
948
- onClick: r,
949
- children: /* @__PURE__ */ t(De, {})
1212
+ className: D("gvp-ctrl-btn", s && "is-active"),
1213
+ "aria-label": s ? "Exit picture-in-picture" : "Picture-in-picture",
1214
+ "aria-pressed": s,
1215
+ onClick: i,
1216
+ children: /* @__PURE__ */ r(Et, {})
950
1217
  }
951
1218
  );
952
- }, Ge = ({ container: e, video: n }) => {
953
- const [s, r] = k(!1);
954
- return P(() => {
955
- if (G) return;
956
- const p = () => r(j.element() === e);
957
- return p(), j.onChange(p);
958
- }, [e]), j.isSupported() || G && n !== null && typeof n.webkitEnterFullscreen == "function" ? /* @__PURE__ */ t(
1219
+ }, Xt = ({ container: e, video: s }) => {
1220
+ const [t, n] = v(!1);
1221
+ return T(() => {
1222
+ if (be) return;
1223
+ const p = () => n(K.element() === e);
1224
+ return p(), K.onChange(p);
1225
+ }, [e]), K.isSupported() || be && s !== null && typeof s.webkitEnterFullscreen == "function" ? /* @__PURE__ */ r(
959
1226
  "button",
960
1227
  {
961
1228
  type: "button",
962
1229
  className: "gvp-ctrl-btn",
963
- "aria-label": s ? "Exit fullscreen" : "Enter fullscreen",
964
- "aria-pressed": s,
1230
+ "aria-label": t ? "Exit fullscreen" : "Enter fullscreen",
1231
+ "aria-pressed": t,
965
1232
  onClick: () => {
966
1233
  var p;
967
- if (G) {
968
- (p = n == null ? void 0 : n.webkitEnterFullscreen) == null || p.call(n);
1234
+ if (be) {
1235
+ (p = s == null ? void 0 : s.webkitEnterFullscreen) == null || p.call(s);
969
1236
  return;
970
1237
  }
971
- s ? j.exit().catch(() => {
972
- }) : e && j.request(e).catch(() => {
1238
+ t ? K.exit().catch(() => {
1239
+ }) : e && K.request(e).catch(() => {
973
1240
  });
974
1241
  },
975
- children: /* @__PURE__ */ t(s ? Ae : Ve, {})
1242
+ children: /* @__PURE__ */ r(t ? Lt : Ct, {})
976
1243
  }
977
1244
  ) : null;
978
1245
  };
979
- function oe(e, n, s) {
980
- const r = e == null ? void 0 : e.trim();
981
- if (r) return r;
982
- if (n) {
1246
+ function $e(e, s, t) {
1247
+ const n = e == null ? void 0 : e.trim();
1248
+ if (n) return n;
1249
+ if (s) {
983
1250
  try {
984
- const i = new Intl.DisplayNames(void 0, { type: "language" }).of(n);
985
- if (i && i !== n) return i;
1251
+ const i = new Intl.DisplayNames(void 0, { type: "language" }).of(s);
1252
+ if (i && i !== s) return i;
986
1253
  } catch {
987
1254
  }
988
- return n;
1255
+ return s;
989
1256
  }
990
- return `Audio ${s + 1}`;
1257
+ return `Audio ${t + 1}`;
991
1258
  }
992
- const le = we.forwardRef(
1259
+ const De = ct.forwardRef(
993
1260
  ({
994
1261
  src: e,
995
- hlsConfig: n,
996
- isHls: s,
997
- autoPlay: r,
998
- children: l,
1262
+ hlsConfig: s,
1263
+ isHls: t,
1264
+ autoPlay: n,
1265
+ children: o,
999
1266
  onAudioTracks: i,
1000
- audioTrackIndex: u,
1267
+ audioTrackIndex: a,
1001
1268
  onQualityLevels: c,
1002
1269
  onCurrentLevel: p,
1003
- qualityLevelIndex: d,
1004
- ...C
1005
- }, b) => {
1006
- const o = H(null), a = H(null), m = H(i);
1007
- m.current = i;
1008
- const f = H(c);
1009
- f.current = c;
1010
- const w = H(p);
1011
- w.current = p, Le(b, () => o.current);
1012
- const U = globalThis.window !== void 0 && $.isSupported(), V = !!s || U && typeof e == "string" && e.endsWith(".m3u8");
1013
- return P(() => {
1014
- var F, Z, q;
1270
+ qualityLevelIndex: u,
1271
+ ...E
1272
+ }, x) => {
1273
+ const l = $(null), d = $(null), C = $(i);
1274
+ C.current = i;
1275
+ const w = $(c);
1276
+ w.current = c;
1277
+ const P = $(p);
1278
+ P.current = p, ut(x, () => l.current);
1279
+ const N = globalThis.window !== void 0 && Q.isSupported(), R = !!t || N && typeof e == "string" && e.endsWith(".m3u8");
1280
+ return T(() => {
1281
+ var U, ne, re;
1015
1282
  if (!e) return;
1016
- const v = o.current;
1017
- if (!v) return;
1018
- const S = (h) => {
1019
- var L;
1020
- (L = m.current) == null || L.call(m, h);
1021
- }, T = (h) => {
1022
- var L;
1023
- (L = f.current) == null || L.call(f, h);
1024
- }, D = (h) => {
1025
- var L;
1026
- (L = w.current) == null || L.call(w, h);
1027
- }, W = () => {
1028
- r && v.play().catch(() => {
1283
+ const f = l.current;
1284
+ if (!f) return;
1285
+ const g = (h) => {
1286
+ var M;
1287
+ (M = C.current) == null || M.call(C, h);
1288
+ }, k = (h) => {
1289
+ var M;
1290
+ (M = w.current) == null || M.call(w, h);
1291
+ }, y = (h) => {
1292
+ var M;
1293
+ (M = P.current) == null || M.call(P, h);
1294
+ }, V = () => {
1295
+ n && f.play().catch(() => {
1029
1296
  });
1030
1297
  };
1031
- for (a.current && (a.current.destroy(), a.current = null), v.pause(), v.removeAttribute("src"); v.firstChild; ) v.firstChild.remove();
1032
- S([]), T([]), D(-1);
1033
- let R;
1034
- if (V) {
1035
- const h = new $(n);
1036
- a.current = h;
1037
- const L = () => {
1038
- const N = h.audioTracks.map((y, _) => ({
1039
- index: _,
1040
- label: oe(y.name, y.lang, _),
1041
- lang: y.lang || void 0
1298
+ for (d.current && (d.current.destroy(), d.current = null), f.pause(), f.removeAttribute("src"); f.firstChild; ) f.firstChild.remove();
1299
+ g([]), k([]), y(-1);
1300
+ let O;
1301
+ if (R) {
1302
+ const h = new Q(s);
1303
+ d.current = h;
1304
+ const M = () => {
1305
+ const I = h.audioTracks.map((L, z) => ({
1306
+ index: z,
1307
+ label: $e(L.name, L.lang, z),
1308
+ lang: L.lang || void 0
1042
1309
  }));
1043
- S(N);
1044
- }, B = () => {
1045
- const N = h.levels.map((y, _) => ({
1046
- index: _,
1047
- height: y.height || 0,
1048
- label: je(y.height || 0, _)
1310
+ g(I);
1311
+ }, W = () => {
1312
+ const I = h.levels.map((L, z) => ({
1313
+ index: z,
1314
+ height: L.height || 0,
1315
+ label: St(L.height || 0, z)
1049
1316
  }));
1050
- T(N);
1317
+ k(I);
1051
1318
  };
1052
- h.on($.Events.MANIFEST_PARSED, W), h.on($.Events.MANIFEST_PARSED, B), h.on($.Events.LEVELS_UPDATED, B), h.on($.Events.LEVEL_SWITCHED, (N, y) => {
1053
- D(y.level);
1054
- }), h.on($.Events.AUDIO_TRACKS_UPDATED, L), h.on($.Events.AUDIO_TRACK_SWITCHED, L), h.on($.Events.ERROR, (N, y) => {
1055
- y.fatal && (h.destroy(), a.current = null);
1056
- }), h.attachMedia(v), h.loadSource(e);
1319
+ h.on(Q.Events.MANIFEST_PARSED, V), h.on(Q.Events.MANIFEST_PARSED, W), h.on(Q.Events.LEVELS_UPDATED, W), h.on(Q.Events.LEVEL_SWITCHED, (I, L) => {
1320
+ y(L.level);
1321
+ }), h.on(Q.Events.AUDIO_TRACKS_UPDATED, M), h.on(Q.Events.AUDIO_TRACK_SWITCHED, M), h.on(Q.Events.ERROR, (I, L) => {
1322
+ L.fatal && (h.destroy(), d.current = null);
1323
+ }), h.attachMedia(f), h.loadSource(e);
1057
1324
  } else {
1058
- v.src = e, v.load(), v.addEventListener("loadedmetadata", W, { once: !0 });
1059
- const h = v.audioTracks;
1325
+ f.src = e, f.load(), f.addEventListener("loadedmetadata", V, { once: !0 });
1326
+ const h = f.audioTracks;
1060
1327
  if (h) {
1061
- const L = () => {
1062
- const B = [];
1063
- for (let N = 0; N < h.length; N++) {
1064
- const y = h[N];
1065
- B.push({
1066
- index: N,
1067
- label: oe(y.label, y.language, N),
1068
- lang: y.language || void 0
1328
+ const M = () => {
1329
+ const W = [];
1330
+ for (let I = 0; I < h.length; I++) {
1331
+ const L = h[I];
1332
+ W.push({
1333
+ index: I,
1334
+ label: $e(L.label, L.language, I),
1335
+ lang: L.language || void 0
1069
1336
  });
1070
1337
  }
1071
- S(B);
1338
+ g(W);
1072
1339
  };
1073
- (F = h.addEventListener) == null || F.call(h, "addtrack", L), (Z = h.addEventListener) == null || Z.call(h, "removetrack", L), (q = h.addEventListener) == null || q.call(h, "change", L), h.length > 0 && L(), R = () => {
1074
- var B, N, y;
1075
- (B = h.removeEventListener) == null || B.call(h, "addtrack", L), (N = h.removeEventListener) == null || N.call(h, "removetrack", L), (y = h.removeEventListener) == null || y.call(h, "change", L);
1340
+ (U = h.addEventListener) == null || U.call(h, "addtrack", M), (ne = h.addEventListener) == null || ne.call(h, "removetrack", M), (re = h.addEventListener) == null || re.call(h, "change", M), h.length > 0 && M(), O = () => {
1341
+ var W, I, L;
1342
+ (W = h.removeEventListener) == null || W.call(h, "addtrack", M), (I = h.removeEventListener) == null || I.call(h, "removetrack", M), (L = h.removeEventListener) == null || L.call(h, "change", M);
1076
1343
  };
1077
1344
  }
1078
1345
  }
1079
1346
  return () => {
1080
- for (v.removeEventListener("loadedmetadata", W), R == null || R(), a.current && (a.current.destroy(), a.current = null), v.pause(), v.removeAttribute("src"); v.firstChild; ) v.firstChild.remove();
1081
- v.load(), S([]), T([]), D(-1);
1347
+ for (f.removeEventListener("loadedmetadata", V), O == null || O(), d.current && (d.current.destroy(), d.current = null), f.pause(), f.removeAttribute("src"); f.firstChild; ) f.firstChild.remove();
1348
+ f.load(), g([]), k([]), y(-1);
1082
1349
  };
1083
- }, [e, V, n, r]), P(() => {
1084
- if (d == null) return;
1085
- const v = a.current;
1086
- v && v.currentLevel !== d && (v.currentLevel = d);
1087
- }, [d]), P(() => {
1088
- var T;
1089
- if (u == null || u < 0) return;
1090
- const v = a.current;
1091
- if (v) {
1092
- v.audioTrack !== u && (v.audioTrack = u);
1350
+ }, [e, R, s, n]), T(() => {
1351
+ if (u == null) return;
1352
+ const f = d.current;
1353
+ f && f.currentLevel !== u && (f.currentLevel = u);
1354
+ }, [u]), T(() => {
1355
+ var k;
1356
+ if (a == null || a < 0) return;
1357
+ const f = d.current;
1358
+ if (f) {
1359
+ f.audioTrack !== a && (f.audioTrack = a);
1093
1360
  return;
1094
1361
  }
1095
- const S = (T = o.current) == null ? void 0 : T.audioTracks;
1096
- if (S)
1097
- for (let D = 0; D < S.length; D++)
1098
- S[D].enabled = D === u;
1099
- }, [u]), // Captions are the consumer's responsibility — pass <track> elements as children.
1362
+ const g = (k = l.current) == null ? void 0 : k.audioTracks;
1363
+ if (g)
1364
+ for (let y = 0; y < g.length; y++)
1365
+ g[y].enabled = y === a;
1366
+ }, [a]), // Captions are the consumer's responsibility — pass <track> elements as children.
1100
1367
  // NOSONAR: typescript:S4084
1101
- /* @__PURE__ */ t("video", { ref: o, ...C, children: l });
1368
+ /* @__PURE__ */ r("video", { ref: l, ...E, children: o });
1102
1369
  }
1103
1370
  );
1104
- le.displayName = "HLSPlayer";
1105
- function et(e) {
1371
+ De.displayName = "HLSPlayer";
1372
+ function Gt(e) {
1106
1373
  if (!e) return null;
1107
1374
  if (/^[A-Za-z0-9_-]{11}$/.test(e)) return e;
1108
- let n;
1375
+ let s;
1109
1376
  try {
1110
- n = new URL(e);
1377
+ s = new URL(e);
1111
1378
  } catch {
1112
1379
  return null;
1113
1380
  }
1114
- const s = n.hostname.replace(/^www\./, "");
1115
- if (s === "youtu.be") {
1116
- const r = n.pathname.slice(1).split("/")[0];
1117
- return /^[A-Za-z0-9_-]{11}$/.test(r) ? r : null;
1381
+ const t = s.hostname.replace(/^www\./, "");
1382
+ if (t === "youtu.be") {
1383
+ const n = s.pathname.slice(1).split("/")[0];
1384
+ return /^[A-Za-z0-9_-]{11}$/.test(n) ? n : null;
1118
1385
  }
1119
- if (s === "youtube.com" || s === "m.youtube.com" || s === "music.youtube.com" || s === "youtube-nocookie.com") {
1120
- const r = n.searchParams.get("v");
1121
- if (r && /^[A-Za-z0-9_-]{11}$/.test(r)) return r;
1122
- const l = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1123
- n.pathname
1386
+ if (t === "youtube.com" || t === "m.youtube.com" || t === "music.youtube.com" || t === "youtube-nocookie.com") {
1387
+ const n = s.searchParams.get("v");
1388
+ if (n && /^[A-Za-z0-9_-]{11}$/.test(n)) return n;
1389
+ const o = /^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(
1390
+ s.pathname
1124
1391
  );
1125
- if (l) return l[1];
1392
+ if (o) return o[1];
1126
1393
  }
1127
1394
  return null;
1128
1395
  }
1129
- function tt(e) {
1396
+ function en(e) {
1130
1397
  try {
1131
- const n = new URL(e), s = n.searchParams.get("t") ?? n.searchParams.get("start");
1132
- if (!s) return null;
1133
- if (/^\d+s?$/.test(s)) return Number.parseInt(s, 10);
1134
- const r = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(s);
1135
- if (r) {
1136
- const l = Number.parseInt(r[1] ?? "0", 10), i = Number.parseInt(r[2] ?? "0", 10), u = Number.parseInt(r[3] ?? "0", 10), c = l * 3600 + i * 60 + u;
1398
+ const s = new URL(e), t = s.searchParams.get("t") ?? s.searchParams.get("start");
1399
+ if (!t) return null;
1400
+ if (/^\d+s?$/.test(t)) return Number.parseInt(t, 10);
1401
+ const n = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(t);
1402
+ if (n) {
1403
+ const o = Number.parseInt(n[1] ?? "0", 10), i = Number.parseInt(n[2] ?? "0", 10), a = Number.parseInt(n[3] ?? "0", 10), c = o * 3600 + i * 60 + a;
1137
1404
  return c > 0 ? c : null;
1138
1405
  }
1139
1406
  } catch {
1140
1407
  }
1141
1408
  return null;
1142
1409
  }
1143
- function nt(e, n = {}) {
1144
- const { autoPlay: s = !1, muted: r = !0, loop: l = !1, controls: i = !0, startSeconds: u } = n, c = new URLSearchParams({
1410
+ function tn(e, s = {}) {
1411
+ const { autoPlay: t = !1, muted: n = !0, loop: o = !1, controls: i = !0, startSeconds: a } = s, c = new URLSearchParams({
1145
1412
  rel: "0",
1146
1413
  modestbranding: "1",
1147
1414
  playsinline: "1",
1148
1415
  controls: i ? "1" : "0"
1149
1416
  });
1150
- return s ? (c.set("autoplay", "1"), c.set("mute", "1")) : r && c.set("mute", "1"), l && (c.set("loop", "1"), c.set("playlist", e)), u && u > 0 && c.set("start", String(u)), `https://www.youtube-nocookie.com/embed/${e}?${c.toString()}`;
1417
+ return t ? (c.set("autoplay", "1"), c.set("mute", "1")) : n && c.set("mute", "1"), o && (c.set("loop", "1"), c.set("playlist", e)), a && a > 0 && c.set("start", String(a)), `https://www.youtube-nocookie.com/embed/${e}?${c.toString()}`;
1151
1418
  }
1152
- const rt = ({
1419
+ const nn = ({
1153
1420
  tracks: e,
1154
- activeIndex: n,
1155
- onSelect: s
1421
+ activeIndex: s,
1422
+ onSelect: t
1156
1423
  }) => {
1157
- const [r, l] = k(!1), i = H(null);
1158
- P(() => {
1159
- if (!r) return;
1160
- const c = (d) => {
1161
- i.current && !i.current.contains(d.target) && l(!1);
1162
- }, p = (d) => {
1163
- d.key === "Escape" && l(!1);
1424
+ const [n, o] = v(!1), i = $(null);
1425
+ T(() => {
1426
+ if (!n) return;
1427
+ const c = (u) => {
1428
+ i.current && !i.current.contains(u.target) && o(!1);
1429
+ }, p = (u) => {
1430
+ u.key === "Escape" && o(!1);
1164
1431
  };
1165
1432
  return document.addEventListener("mousedown", c), document.addEventListener("keydown", p), () => {
1166
1433
  document.removeEventListener("mousedown", c), document.removeEventListener("keydown", p);
1167
1434
  };
1168
- }, [r]);
1169
- const u = e.find((c) => c.index === n) ?? e[0];
1170
- return /* @__PURE__ */ g("div", { className: "gvp-audio", ref: i, children: [
1171
- /* @__PURE__ */ g(
1435
+ }, [n]);
1436
+ const a = e.find((c) => c.index === s) ?? e[0];
1437
+ return /* @__PURE__ */ b("div", { className: "gvp-audio", ref: i, children: [
1438
+ /* @__PURE__ */ b(
1172
1439
  "button",
1173
1440
  {
1174
1441
  type: "button",
1175
1442
  className: "gvp-audio-btn",
1176
1443
  "aria-haspopup": "listbox",
1177
- "aria-expanded": r,
1444
+ "aria-expanded": n,
1178
1445
  "aria-label": "Audio track",
1179
- onClick: () => l((c) => !c),
1446
+ onClick: () => o((c) => !c),
1180
1447
  children: [
1181
- /* @__PURE__ */ t(Me, {}),
1182
- /* @__PURE__ */ t("span", { className: "gvp-audio-label", children: u == null ? void 0 : u.label }),
1183
- /* @__PURE__ */ t(Re, {})
1448
+ /* @__PURE__ */ r(ft, {}),
1449
+ /* @__PURE__ */ r("span", { className: "gvp-audio-label", children: a == null ? void 0 : a.label }),
1450
+ /* @__PURE__ */ r(Mt, {})
1184
1451
  ]
1185
1452
  }
1186
1453
  ),
1187
- r && // A native <select> can't be styled to sit inside the player overlay
1454
+ n && // A native <select> can't be styled to sit inside the player overlay
1188
1455
  // (it renders the OS dropdown chrome), so this is a custom listbox with
1189
1456
  // full keyboard + ARIA support.
1190
1457
  // NOSONAR: typescript:S6819
1191
- /* @__PURE__ */ t("ul", { className: "gvp-audio-menu", role: "listbox", "aria-label": "Audio tracks", children: e.map((c) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(
1458
+ /* @__PURE__ */ r("ul", { className: "gvp-audio-menu", role: "listbox", "aria-label": "Audio tracks", children: e.map((c) => /* @__PURE__ */ r("li", { children: /* @__PURE__ */ r(
1192
1459
  "button",
1193
1460
  {
1194
1461
  type: "button",
1195
1462
  role: "option",
1196
- "aria-selected": c.index === n,
1197
- className: I(
1463
+ "aria-selected": c.index === s,
1464
+ className: D(
1198
1465
  "gvp-audio-menu-item",
1199
- c.index === n && "is-active"
1466
+ c.index === s && "is-active"
1200
1467
  ),
1201
1468
  onClick: () => {
1202
- s(c.index), l(!1);
1469
+ t(c.index), o(!1);
1203
1470
  },
1204
1471
  children: c.label
1205
1472
  }
1206
1473
  ) }, c.index)) })
1207
1474
  ] });
1208
- }, lt = ({
1475
+ }, an = ({
1209
1476
  src: e,
1210
- poster: n,
1211
- showDeviceToggle: s = !0,
1212
- defaultDevice: r = "desktop",
1213
- hoverPlay: l = !1,
1477
+ poster: s,
1478
+ showDeviceToggle: t = !0,
1479
+ defaultDevice: n = "desktop",
1480
+ hoverPlay: o = !1,
1214
1481
  tooltipText: i,
1215
- onClose: u,
1482
+ onClose: a,
1216
1483
  className: c = "",
1217
1484
  muted: p = !0,
1218
- loop: d = !1,
1219
- controls: C = !0,
1220
- autoPlay: b = !1,
1221
- frameMaxWidth: o,
1222
- aspectRatio: a,
1223
- hlsConfig: m,
1224
- children: f
1485
+ loop: u = !1,
1486
+ controls: E = !0,
1487
+ autoPlay: x = !1,
1488
+ frameMaxWidth: l,
1489
+ aspectRatio: d,
1490
+ hlsConfig: C,
1491
+ thumbnails: w,
1492
+ chapters: P,
1493
+ playlist: N,
1494
+ defaultIndex: R = 0,
1495
+ autoAdvance: f = !0,
1496
+ onPlaylistChange: g,
1497
+ onPlay: k,
1498
+ onPause: y,
1499
+ onEnded: V,
1500
+ onTimeUpdate: O,
1501
+ onSeeked: U,
1502
+ onVolumeChange: ne,
1503
+ onMilestone: re,
1504
+ onError: h,
1505
+ children: M
1225
1506
  }) => {
1226
- const w = H(null), U = H(null), [V, v] = k(r), [S, T] = k(!1), [D, W] = k(!1), [R, F] = k([]), [Z, q] = k(-1), [h, L] = k([]), [B, N] = k(-1), [y, _] = k(-1), [ie, ce] = k(null), [ue, de] = k(null), he = M((E) => {
1227
- w.current = E, de(E);
1228
- }, []), O = C === !0 || C === "custom", J = C === "native", Q = K(() => et(e), [e]), A = Q !== null, pe = K(() => V === "mobile" ? (a == null ? void 0 : a.mobile) ?? "9/16" : (a == null ? void 0 : a.desktop) ?? "16/9", [V, a]), me = K(() => V === "mobile" ? (o == null ? void 0 : o.mobile) ?? "420px" : (o == null ? void 0 : o.desktop) ?? "960px", [V, o]), fe = K(
1229
- () => Q ? nt(Q, {
1230
- autoPlay: b,
1507
+ const W = $(null), I = $(null), [L, z] = v(n), [ue, J] = v(!1), [We, se] = v(!1), [de, Re] = v([]), [he, Ce] = v(-1), [Fe, Ue] = v([]), [je, Oe] = v(-1), [Le, Ee] = v(-1), [_e, Ze] = v(null), [me, qe] = v(null), Qe = H((m) => {
1508
+ W.current = m, qe(m);
1509
+ }, []), Z = $({
1510
+ onPlay: k,
1511
+ onPause: y,
1512
+ onEnded: V,
1513
+ onTimeUpdate: O,
1514
+ onSeeked: U,
1515
+ onVolumeChange: ne,
1516
+ onMilestone: re,
1517
+ onError: h
1518
+ });
1519
+ Z.current = {
1520
+ onPlay: k,
1521
+ onPause: y,
1522
+ onEnded: V,
1523
+ onTimeUpdate: O,
1524
+ onSeeked: U,
1525
+ onVolumeChange: ne,
1526
+ onMilestone: re,
1527
+ onError: h
1528
+ };
1529
+ const ee = E === !0 || E === "custom", pe = E === "native", Y = Array.isArray(N) && N.length > 0, ze = Y ? Math.min(Math.max(R, 0), N.length - 1) : 0, [q, Ye] = v(ze), F = Y ? N[Math.min(q, N.length - 1)] : null, X = (F == null ? void 0 : F.src) ?? e ?? "", Ke = (F == null ? void 0 : F.poster) ?? s, Je = (F == null ? void 0 : F.thumbnails) ?? w, Xe = (F == null ? void 0 : F.chapters) ?? P, fe = $(!1), oe = H(
1530
+ (m, A = !1) => {
1531
+ if (!Y) return;
1532
+ const G = Math.min(Math.max(m, 0), N.length - 1);
1533
+ G !== q && (fe.current = A, Ye(G), g == null || g(G, N[G]));
1534
+ },
1535
+ [Y, N, q, g]
1536
+ ), Ge = Y && q > 0, ge = Y && q < ((N == null ? void 0 : N.length) ?? 0) - 1, ie = ce(() => Gt(X), [X]), j = ie !== null, et = ce(() => L === "mobile" ? (d == null ? void 0 : d.mobile) ?? "9/16" : (d == null ? void 0 : d.desktop) ?? "16/9", [L, d]), tt = ce(() => L === "mobile" ? (l == null ? void 0 : l.mobile) ?? "420px" : (l == null ? void 0 : l.desktop) ?? "960px", [L, l]), nt = ce(
1537
+ () => ie ? tn(ie, {
1538
+ autoPlay: x,
1231
1539
  muted: p,
1232
- loop: d,
1540
+ loop: u,
1233
1541
  // Custom controls can't drive an iframe, so YouTube falls
1234
1542
  // back to its own controls in that mode.
1235
- controls: O ? !0 : J,
1236
- startSeconds: tt(e)
1543
+ controls: ee ? !0 : pe,
1544
+ startSeconds: en(X)
1237
1545
  }) : null,
1238
- [Q, e, b, p, d, O, J]
1239
- ), ge = M((E) => {
1240
- F(E), q(-1);
1241
- }, []), ve = M((E) => {
1242
- L(E), _(-1);
1243
- }, []), Y = M(async () => {
1244
- const E = w.current;
1245
- if (E) {
1246
- if (U.current)
1546
+ [ie, X, x, p, u, ee, pe]
1547
+ ), rt = H((m) => {
1548
+ Re(m), Ce(-1);
1549
+ }, []), st = H((m) => {
1550
+ Ue(m), Ee(-1);
1551
+ }, []), ae = H(async () => {
1552
+ const m = W.current;
1553
+ if (m) {
1554
+ if (I.current)
1247
1555
  try {
1248
- await U.current;
1556
+ await I.current;
1249
1557
  } catch {
1250
1558
  }
1251
- E.pause();
1559
+ m.pause();
1252
1560
  }
1253
- }, []), z = M(async () => {
1254
- const E = w.current;
1255
- if (E)
1561
+ }, []), te = H(async () => {
1562
+ const m = W.current;
1563
+ if (m)
1256
1564
  try {
1257
- E.readyState < 2 && E.load();
1258
- const te = E.play();
1259
- U.current = te, await te, T(!0);
1565
+ m.readyState < 2 && m.load();
1566
+ const A = m.play();
1567
+ I.current = A, await A, J(!0);
1260
1568
  } catch {
1261
- T(!1);
1569
+ J(!1);
1262
1570
  } finally {
1263
- U.current = null;
1571
+ I.current = null;
1264
1572
  }
1265
- }, []), ke = M(() => {
1266
- !l || A || z();
1267
- }, [l, A, z]), be = M(() => {
1268
- !l || A || Y().then(() => T(!1));
1269
- }, [l, A, Y]), X = M(async () => {
1270
- const E = w.current;
1271
- E && (E.paused ? await z() : (await Y(), T(!1)));
1272
- }, [z, Y]), Ce = !A && R.length > 1;
1573
+ }, []), ot = H(() => {
1574
+ !o || j || te();
1575
+ }, [o, j, te]), it = H(() => {
1576
+ !o || j || ae().then(() => J(!1));
1577
+ }, [o, j, ae]), ve = H(async () => {
1578
+ const m = W.current;
1579
+ m && (m.paused ? await te() : (await ae(), J(!1)));
1580
+ }, [te, ae]), at = H(() => {
1581
+ var m, A;
1582
+ J(!1), (A = (m = Z.current).onEnded) == null || A.call(m), Y && f && ge && oe(q + 1, !0);
1583
+ }, [Y, f, ge, oe, q]);
1584
+ T(() => {
1585
+ const m = me;
1586
+ if (!m) return;
1587
+ const A = /* @__PURE__ */ new Set(), G = () => {
1588
+ var Me, Te, Pe, Ie;
1589
+ const B = m.duration;
1590
+ if ((Te = (Me = Z.current).onTimeUpdate) == null || Te.call(Me, m.currentTime, Number.isFinite(B) ? B : 0), !Number.isFinite(B) || B <= 0) return;
1591
+ const _ = m.currentTime / B * 100;
1592
+ for (const le of [25, 50, 75, 100])
1593
+ _ >= le && !A.has(le) && (A.add(le), (Ie = (Pe = Z.current).onMilestone) == null || Ie.call(Pe, le));
1594
+ }, xe = () => {
1595
+ var B, _;
1596
+ return (_ = (B = Z.current).onSeeked) == null ? void 0 : _.call(B, m.currentTime);
1597
+ }, Ne = () => {
1598
+ var B, _;
1599
+ return (_ = (B = Z.current).onVolumeChange) == null ? void 0 : _.call(B, m.volume, m.muted);
1600
+ }, ye = () => {
1601
+ var B, _;
1602
+ return (_ = (B = Z.current).onError) == null ? void 0 : _.call(B);
1603
+ };
1604
+ return m.addEventListener("timeupdate", G), m.addEventListener("seeked", xe), m.addEventListener("volumechange", Ne), m.addEventListener("error", ye), () => {
1605
+ m.removeEventListener("timeupdate", G), m.removeEventListener("seeked", xe), m.removeEventListener("volumechange", Ne), m.removeEventListener("error", ye);
1606
+ };
1607
+ }, [me]), T(() => {
1608
+ fe.current && (fe.current = !1, te());
1609
+ }, [X, te]);
1610
+ const lt = !j && de.length > 1;
1273
1611
  return (
1274
1612
  // The mouse handlers are a progressive enhancement (hoverPlay + tooltip).
1275
1613
  // Keyboard/click users reach the same actions via the inner <button> elements,
1276
1614
  // so the outer container is intentionally non-interactive at the role level.
1277
1615
  // NOSONAR: typescript:S6848
1278
- /* @__PURE__ */ g(
1616
+ /* @__PURE__ */ b(
1279
1617
  "div",
1280
1618
  {
1281
- ref: ce,
1282
- className: I("gvp-root", c),
1283
- style: { width: me, aspectRatio: pe },
1619
+ ref: Ze,
1620
+ className: D("gvp-root", c),
1621
+ style: { width: tt, aspectRatio: et },
1284
1622
  onMouseEnter: () => {
1285
- W(!0), ke();
1623
+ se(!0), ot();
1286
1624
  },
1287
1625
  onMouseLeave: () => {
1288
- W(!1), be();
1626
+ se(!1), it();
1289
1627
  },
1290
1628
  children: [
1291
- A ? /* @__PURE__ */ t(
1629
+ j ? /* @__PURE__ */ r(
1292
1630
  "iframe",
1293
1631
  {
1294
1632
  className: "gvp-video gvp-youtube",
1295
- src: fe ?? void 0,
1633
+ src: nt ?? void 0,
1296
1634
  title: "YouTube video player",
1297
1635
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
1298
1636
  allowFullScreen: !0,
1299
1637
  referrerPolicy: "strict-origin-when-cross-origin"
1300
1638
  }
1301
- ) : /* @__PURE__ */ t(
1302
- le,
1639
+ ) : /* @__PURE__ */ r(
1640
+ De,
1303
1641
  {
1304
- ref: he,
1305
- src: e,
1306
- poster: n,
1642
+ ref: Qe,
1643
+ src: X,
1644
+ poster: Ke,
1307
1645
  muted: p,
1308
- loop: d,
1646
+ loop: u,
1309
1647
  playsInline: !0,
1310
1648
  preload: "metadata",
1311
- controls: J,
1312
- autoPlay: b,
1313
- hlsConfig: m,
1649
+ controls: pe,
1650
+ autoPlay: x,
1651
+ hlsConfig: C,
1314
1652
  className: "gvp-video",
1315
- onPlay: () => T(!0),
1316
- onPause: () => T(!1),
1317
- onAudioTracks: ge,
1318
- audioTrackIndex: Z,
1319
- onQualityLevels: ve,
1320
- onCurrentLevel: N,
1321
- qualityLevelIndex: y,
1322
- children: f
1323
- }
1653
+ onPlay: () => {
1654
+ var m, A;
1655
+ J(!0), (A = (m = Z.current).onPlay) == null || A.call(m);
1656
+ },
1657
+ onPause: () => {
1658
+ var m, A;
1659
+ J(!1), (A = (m = Z.current).onPause) == null || A.call(m);
1660
+ },
1661
+ onEnded: at,
1662
+ onAudioTracks: rt,
1663
+ audioTrackIndex: he,
1664
+ onQualityLevels: st,
1665
+ onCurrentLevel: Oe,
1666
+ qualityLevelIndex: Le,
1667
+ children: M
1668
+ },
1669
+ X
1324
1670
  ),
1325
- !A && /* @__PURE__ */ t("div", { className: "gvp-vignette" }),
1326
- s && /* @__PURE__ */ t("div", { className: "gvp-toggle", children: /* @__PURE__ */ g("div", { className: "gvp-toggle-pill", children: [
1327
- /* @__PURE__ */ t(
1671
+ !j && /* @__PURE__ */ r("div", { className: "gvp-vignette" }),
1672
+ t && /* @__PURE__ */ r("div", { className: "gvp-toggle", children: /* @__PURE__ */ b("div", { className: "gvp-toggle-pill", children: [
1673
+ /* @__PURE__ */ r(
1328
1674
  "button",
1329
1675
  {
1330
1676
  type: "button",
1331
- onClick: () => v("desktop"),
1332
- className: I(
1677
+ onClick: () => z("desktop"),
1678
+ className: D(
1333
1679
  "gvp-toggle-btn",
1334
- V === "desktop" && "is-active"
1680
+ L === "desktop" && "is-active"
1335
1681
  ),
1336
1682
  "aria-label": "Desktop view",
1337
- "aria-pressed": V === "desktop",
1338
- children: /* @__PURE__ */ t(ye, {})
1683
+ "aria-pressed": L === "desktop",
1684
+ children: /* @__PURE__ */ r(dt, {})
1339
1685
  }
1340
1686
  ),
1341
- /* @__PURE__ */ t("div", { className: "gvp-toggle-divider" }),
1342
- /* @__PURE__ */ t(
1687
+ /* @__PURE__ */ r("div", { className: "gvp-toggle-divider" }),
1688
+ /* @__PURE__ */ r(
1343
1689
  "button",
1344
1690
  {
1345
1691
  type: "button",
1346
- onClick: () => v("mobile"),
1347
- className: I(
1692
+ onClick: () => z("mobile"),
1693
+ className: D(
1348
1694
  "gvp-toggle-btn",
1349
- V === "mobile" && "is-active"
1695
+ L === "mobile" && "is-active"
1350
1696
  ),
1351
1697
  "aria-label": "Mobile view",
1352
- "aria-pressed": V === "mobile",
1353
- children: /* @__PURE__ */ t(Ee, {})
1698
+ "aria-pressed": L === "mobile",
1699
+ children: /* @__PURE__ */ r(ht, {})
1354
1700
  }
1355
1701
  )
1356
1702
  ] }) }),
1357
- u && /* @__PURE__ */ t(
1703
+ a && /* @__PURE__ */ r(
1358
1704
  "button",
1359
1705
  {
1360
1706
  type: "button",
1361
- onClick: u,
1707
+ onClick: a,
1362
1708
  className: "gvp-close",
1363
1709
  "aria-label": "Close",
1364
- children: /* @__PURE__ */ t(xe, {})
1710
+ children: /* @__PURE__ */ r(mt, {})
1365
1711
  }
1366
1712
  ),
1367
- Ce && /* @__PURE__ */ t(
1368
- rt,
1713
+ lt && /* @__PURE__ */ r(
1714
+ nn,
1369
1715
  {
1370
- tracks: R,
1371
- activeIndex: Z >= 0 ? Z : R[0].index,
1372
- onSelect: q
1716
+ tracks: de,
1717
+ activeIndex: he >= 0 ? he : de[0].index,
1718
+ onSelect: Ce
1373
1719
  }
1374
1720
  ),
1375
- !A && O && /* @__PURE__ */ t(
1721
+ !j && ee && /* @__PURE__ */ r(
1376
1722
  "button",
1377
1723
  {
1378
1724
  type: "button",
1379
1725
  className: "gvp-click-layer",
1380
- onClick: () => void X(),
1381
- "aria-label": S ? "Pause" : "Play"
1726
+ onClick: () => void ve(),
1727
+ "aria-label": ue ? "Pause" : "Play"
1382
1728
  }
1383
1729
  ),
1384
- !A && !O && !S && /* @__PURE__ */ t("div", { className: "gvp-play-wrap", children: /* @__PURE__ */ g(
1730
+ !j && !ee && !ue && /* @__PURE__ */ r("div", { className: "gvp-play-wrap", children: /* @__PURE__ */ b(
1385
1731
  "button",
1386
1732
  {
1387
1733
  type: "button",
1388
- onClick: () => void X(),
1389
- onMouseEnter: () => W(!0),
1390
- onMouseLeave: () => W(!1),
1734
+ onClick: () => void ve(),
1735
+ onMouseEnter: () => se(!0),
1736
+ onMouseLeave: () => se(!1),
1391
1737
  className: "gvp-play",
1392
1738
  "aria-label": "Play",
1393
1739
  children: [
1394
- /* @__PURE__ */ t(Ne, {}),
1395
- i && D && /* @__PURE__ */ t("span", { className: "gvp-tooltip", role: "tooltip", children: i })
1740
+ /* @__PURE__ */ r(pt, {}),
1741
+ i && We && /* @__PURE__ */ r("span", { className: "gvp-tooltip", role: "tooltip", children: i })
1396
1742
  ]
1397
1743
  }
1398
1744
  ) }),
1399
- !A && O && /* @__PURE__ */ t(
1400
- Ze,
1745
+ !j && ee && /* @__PURE__ */ r(
1746
+ Rt,
1401
1747
  {
1402
- video: ue,
1403
- isPlaying: S,
1404
- container: ie,
1405
- onTogglePlay: () => void X(),
1406
- qualityLevels: h,
1407
- currentLevel: B,
1408
- selectedLevel: y,
1409
- onSelectLevel: _
1748
+ video: me,
1749
+ isPlaying: ue,
1750
+ container: _e,
1751
+ onTogglePlay: () => void ve(),
1752
+ qualityLevels: Fe,
1753
+ currentLevel: je,
1754
+ selectedLevel: Le,
1755
+ onSelectLevel: Ee,
1756
+ thumbnails: Je,
1757
+ chapters: Xe,
1758
+ hasPrev: Ge,
1759
+ hasNext: ge,
1760
+ onPrev: () => oe(q - 1, !0),
1761
+ onNext: () => oe(q + 1, !0)
1410
1762
  }
1411
1763
  ),
1412
- !A && !O && /* @__PURE__ */ t("div", { className: "gvp-bottom-fade" })
1764
+ !j && !ee && /* @__PURE__ */ r("div", { className: "gvp-bottom-fade" })
1413
1765
  ]
1414
1766
  }
1415
1767
  )
1416
1768
  );
1417
1769
  };
1418
1770
  export {
1419
- lt as ReactVideoPlayer,
1420
- et as parseYouTubeId,
1421
- tt as parseYouTubeStart,
1422
- nt as youTubeEmbedUrl
1771
+ an as ReactVideoPlayer,
1772
+ Gt as parseYouTubeId,
1773
+ en as parseYouTubeStart,
1774
+ tn as youTubeEmbedUrl
1423
1775
  };
1424
1776
  //# sourceMappingURL=index.mjs.map