strataplayer 1.2.21 → 1.2.23
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/core/StrataCore.d.ts +5 -0
- package/dist/strataplayer.cjs.js +12 -12
- package/dist/strataplayer.cjs.js.map +1 -1
- package/dist/strataplayer.es.js +728 -687
- package/dist/strataplayer.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/strataplayer.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var Si = Object.defineProperty;
|
|
2
2
|
var Ci = (s, t, i) => t in s ? Si(s, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : s[t] = i;
|
|
3
|
-
var
|
|
4
|
-
import Me, { useState as M, useEffect as
|
|
3
|
+
var E = (s, t, i) => Ci(s, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import Me, { useState as M, useEffect as K, useRef as W, useLayoutEffect as Be, useMemo as Ce, useSyncExternalStore as Ni, useCallback as Ve } from "react";
|
|
5
5
|
import { createRoot as Mi } from "react-dom/client";
|
|
6
6
|
import { jsxs as c, jsx as e, Fragment as Q } from "react/jsx-runtime";
|
|
7
7
|
import { createPortal as Ti } from "react-dom";
|
|
8
8
|
class zi {
|
|
9
9
|
constructor() {
|
|
10
|
-
|
|
10
|
+
E(this, "events");
|
|
11
11
|
this.events = /* @__PURE__ */ new Map();
|
|
12
12
|
}
|
|
13
13
|
on(t, i) {
|
|
@@ -18,12 +18,12 @@ class zi {
|
|
|
18
18
|
const o = this.events.get(t);
|
|
19
19
|
o && this.events.set(
|
|
20
20
|
t,
|
|
21
|
-
o.filter((
|
|
21
|
+
o.filter((r) => r !== i)
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
emit(t, i) {
|
|
25
25
|
const o = this.events.get(t);
|
|
26
|
-
o && o.forEach((
|
|
26
|
+
o && o.forEach((r) => r(i));
|
|
27
27
|
}
|
|
28
28
|
destroy() {
|
|
29
29
|
this.events.clear();
|
|
@@ -31,8 +31,8 @@ class zi {
|
|
|
31
31
|
}
|
|
32
32
|
class Ii {
|
|
33
33
|
constructor(t) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
E(this, "state");
|
|
35
|
+
E(this, "listeners");
|
|
36
36
|
this.state = t, this.listeners = /* @__PURE__ */ new Set();
|
|
37
37
|
}
|
|
38
38
|
get() {
|
|
@@ -40,7 +40,7 @@ class Ii {
|
|
|
40
40
|
}
|
|
41
41
|
setState(t) {
|
|
42
42
|
const i = this.state, o = typeof t == "function" ? t(i) : t;
|
|
43
|
-
this.state = { ...i, ...o }, this.listeners.forEach((
|
|
43
|
+
this.state = { ...i, ...o }, this.listeners.forEach((r) => r(this.state, i));
|
|
44
44
|
}
|
|
45
45
|
subscribe(t) {
|
|
46
46
|
return this.listeners.add(t), () => this.listeners.delete(t);
|
|
@@ -49,13 +49,13 @@ class Ii {
|
|
|
49
49
|
this.listeners.clear();
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
class
|
|
52
|
+
class Fi {
|
|
53
53
|
constructor(t) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
E(this, "context", null);
|
|
55
|
+
E(this, "source", null);
|
|
56
|
+
E(this, "gainNode", null);
|
|
57
|
+
E(this, "video");
|
|
58
|
+
E(this, "isInitialized", !1);
|
|
59
59
|
this.video = t;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -82,48 +82,48 @@ const it = (s) => {
|
|
|
82
82
|
if (isNaN(s)) return "00:00";
|
|
83
83
|
const t = Math.floor(s / 3600), i = Math.floor(s % 3600 / 60), o = Math.floor(s % 60);
|
|
84
84
|
return t > 0 ? `${t}:${i.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}` : `${i}:${o.toString().padStart(2, "0")}`;
|
|
85
|
-
},
|
|
85
|
+
}, Ri = async (s, t = 3, i = 2e4) => {
|
|
86
86
|
for (let o = 0; o < t; o++) {
|
|
87
|
-
const
|
|
87
|
+
const r = new AbortController(), u = setTimeout(() => r.abort(), i);
|
|
88
88
|
try {
|
|
89
|
-
const h = await fetch(s, { signal:
|
|
89
|
+
const h = await fetch(s, { signal: r.signal });
|
|
90
90
|
if (clearTimeout(u), !h.ok) throw new Error(`HTTP ${h.status}`);
|
|
91
91
|
return await h.text();
|
|
92
92
|
} catch (h) {
|
|
93
93
|
if (clearTimeout(u), o === t - 1) throw h;
|
|
94
|
-
await new Promise((
|
|
94
|
+
await new Promise((p) => setTimeout(p, 1e3));
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
throw new Error("Failed");
|
|
98
|
-
},
|
|
98
|
+
}, Pi = async (s, t, i = 2e4) => {
|
|
99
99
|
try {
|
|
100
|
-
const
|
|
100
|
+
const r = (await Ri(s, 3, i)).split(`
|
|
101
101
|
`), u = [];
|
|
102
|
-
let h = null,
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
let
|
|
106
|
-
return
|
|
102
|
+
let h = null, p = null;
|
|
103
|
+
const b = s.substring(0, s.lastIndexOf("/") + 1), g = (m) => {
|
|
104
|
+
const x = m.split(":");
|
|
105
|
+
let f = 0;
|
|
106
|
+
return x.length === 3 ? (f += parseFloat(x[0]) * 3600, f += parseFloat(x[1]) * 60, f += parseFloat(x[2])) : (f += parseFloat(x[0]) * 60, f += parseFloat(x[1])), f;
|
|
107
107
|
};
|
|
108
|
-
for (let m of
|
|
108
|
+
for (let m of r)
|
|
109
109
|
if (m = m.trim(), m.includes("-->")) {
|
|
110
|
-
const
|
|
111
|
-
h =
|
|
112
|
-
} else if (h !== null &&
|
|
113
|
-
let [
|
|
114
|
-
!
|
|
115
|
-
let S = 0,
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
|
|
110
|
+
const x = m.split("-->");
|
|
111
|
+
h = g(x[0].trim()), p = g(x[1].trim());
|
|
112
|
+
} else if (h !== null && p !== null && m.length > 0) {
|
|
113
|
+
let [x, f] = m.split("#");
|
|
114
|
+
!x.match(/^https?:\/\//) && !x.startsWith("data:") && (x = b + x);
|
|
115
|
+
let S = 0, L = 0, U = 0, H = 0;
|
|
116
|
+
if (f && f.startsWith("xywh=")) {
|
|
117
|
+
const _ = f.replace("xywh=", "").split(",");
|
|
118
|
+
_.length === 4 && (S = parseInt(_[0]), L = parseInt(_[1]), U = parseInt(_[2]), H = parseInt(_[3]));
|
|
119
119
|
}
|
|
120
|
-
U > 0 && H > 0 && u.push({ start: h, end:
|
|
120
|
+
U > 0 && H > 0 && u.push({ start: h, end: p, url: x, x: S, y: L, w: U, h: H }), h = null, p = null;
|
|
121
121
|
}
|
|
122
122
|
return u;
|
|
123
123
|
} catch {
|
|
124
124
|
return t({ type: "warning", message: "Failed to load thumbnails", duration: 4e3 }), [];
|
|
125
125
|
}
|
|
126
|
-
},
|
|
126
|
+
}, Ei = () => {
|
|
127
127
|
if (!(typeof document > "u")) {
|
|
128
128
|
if (!document.getElementById("strata-fonts")) {
|
|
129
129
|
const s = document.createElement("link");
|
|
@@ -138,7 +138,7 @@ const it = (s) => {
|
|
|
138
138
|
s.src = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1", document.head.appendChild(s);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
},
|
|
141
|
+
}, at = {
|
|
142
142
|
useNative: !1,
|
|
143
143
|
fixCapitalization: !1,
|
|
144
144
|
backgroundOpacity: 50,
|
|
@@ -149,7 +149,7 @@ const it = (s) => {
|
|
|
149
149
|
isBold: !1,
|
|
150
150
|
textColor: "#ffffff",
|
|
151
151
|
verticalOffset: 40
|
|
152
|
-
}, Jt = "strata-settings",
|
|
152
|
+
}, Jt = "strata-settings", Z = {
|
|
153
153
|
isPlaying: !1,
|
|
154
154
|
isBuffering: !1,
|
|
155
155
|
isLive: !1,
|
|
@@ -171,7 +171,7 @@ const it = (s) => {
|
|
|
171
171
|
subtitleTracks: [],
|
|
172
172
|
currentSubtitle: -1,
|
|
173
173
|
subtitleOffset: 0,
|
|
174
|
-
subtitleSettings:
|
|
174
|
+
subtitleSettings: at,
|
|
175
175
|
activeCues: [],
|
|
176
176
|
viewMode: "normal",
|
|
177
177
|
notifications: [],
|
|
@@ -194,87 +194,87 @@ const it = (s) => {
|
|
|
194
194
|
let t = {};
|
|
195
195
|
if (!s.disablePersistence && typeof window < "u")
|
|
196
196
|
try {
|
|
197
|
-
const
|
|
198
|
-
|
|
197
|
+
const r = localStorage.getItem(Jt);
|
|
198
|
+
r && (t = JSON.parse(r));
|
|
199
199
|
} catch {
|
|
200
200
|
}
|
|
201
201
|
const i = {
|
|
202
|
-
...
|
|
202
|
+
...at,
|
|
203
203
|
...t.subtitleSettings || {},
|
|
204
204
|
...s.subtitleSettings || {}
|
|
205
|
-
}, o = s.videoFit ?? (s.autoSize ? "cover" : void 0) ?? t.videoFit ??
|
|
205
|
+
}, o = s.videoFit ?? (s.autoSize ? "cover" : void 0) ?? t.videoFit ?? Z.videoFit;
|
|
206
206
|
return {
|
|
207
|
-
...
|
|
207
|
+
...Z,
|
|
208
208
|
...t,
|
|
209
209
|
// Load saved first
|
|
210
210
|
// Override with config if present (not undefined)
|
|
211
|
-
volume: s.volume ?? t.volume ??
|
|
212
|
-
isMuted: s.muted ?? t.isMuted ??
|
|
213
|
-
playbackRate: s.playbackRate ?? t.playbackRate ??
|
|
214
|
-
audioGain: s.audioGain ?? t.audioGain ??
|
|
215
|
-
theme: s.theme ?? t.theme ??
|
|
216
|
-
themeColor: s.themeColor ?? t.themeColor ??
|
|
217
|
-
iconSize: s.iconSize ?? t.iconSize ??
|
|
211
|
+
volume: s.volume ?? t.volume ?? Z.volume,
|
|
212
|
+
isMuted: s.muted ?? t.isMuted ?? Z.isMuted,
|
|
213
|
+
playbackRate: s.playbackRate ?? t.playbackRate ?? Z.playbackRate,
|
|
214
|
+
audioGain: s.audioGain ?? t.audioGain ?? Z.audioGain,
|
|
215
|
+
theme: s.theme ?? t.theme ?? Z.theme,
|
|
216
|
+
themeColor: s.themeColor ?? t.themeColor ?? Z.themeColor,
|
|
217
|
+
iconSize: s.iconSize ?? t.iconSize ?? Z.iconSize,
|
|
218
218
|
subtitleSettings: i,
|
|
219
219
|
// Config overrides state for these visual modes
|
|
220
|
-
isAutoSized: s.autoSize ??
|
|
220
|
+
isAutoSized: s.autoSize ?? Z.isAutoSized,
|
|
221
221
|
videoFit: o,
|
|
222
|
-
brightness: s.brightness ?? t.brightness ??
|
|
223
|
-
isLive: s.isLive ?? t.isLive ??
|
|
224
|
-
isLooping: s.loop ?? t.isLooping ??
|
|
222
|
+
brightness: s.brightness ?? t.brightness ?? Z.brightness,
|
|
223
|
+
isLive: s.isLive ?? t.isLive ?? Z.isLive,
|
|
224
|
+
isLooping: s.loop ?? t.isLooping ?? Z.isLooping,
|
|
225
225
|
sourceStatuses: {}
|
|
226
226
|
// Never persist statuses
|
|
227
227
|
};
|
|
228
228
|
};
|
|
229
|
-
class
|
|
229
|
+
class Li {
|
|
230
230
|
constructor(t = {}, i) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
E(this, "video");
|
|
232
|
+
E(this, "container", null);
|
|
233
|
+
E(this, "events");
|
|
234
|
+
E(this, "store");
|
|
235
|
+
E(this, "plugins", /* @__PURE__ */ new Map());
|
|
236
|
+
E(this, "audioEngine");
|
|
237
|
+
E(this, "config");
|
|
238
|
+
E(this, "resizeObserver", null);
|
|
239
239
|
// Retry Logic
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
E(this, "retryCount", 0);
|
|
241
|
+
E(this, "maxRetries", 5);
|
|
242
|
+
E(this, "retryTimer", null);
|
|
243
|
+
E(this, "currentSource", null);
|
|
244
|
+
E(this, "currentSrc", "");
|
|
245
245
|
// Track configs from setSources are stored here to lazy load
|
|
246
|
-
|
|
246
|
+
E(this, "trackConfigs", []);
|
|
247
247
|
// Download Control
|
|
248
|
-
|
|
248
|
+
E(this, "activeDownloads", /* @__PURE__ */ new Map());
|
|
249
249
|
// Cast
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
250
|
+
E(this, "castInitialized", !1);
|
|
251
|
+
E(this, "boundCueChange");
|
|
252
|
+
E(this, "boundFullscreenChange");
|
|
253
|
+
Ei(), this.config = t, this.config.autoOrientation = this.config.autoOrientation ?? !0, this.config.fetchTimeout = this.config.fetchTimeout ?? 3e4, this.config.centerControls = this.config.centerControls ?? !0, this.config.gestureSeek = this.config.gestureSeek ?? !1, this.video = i || document.createElement("video"), this.video.crossOrigin = "anonymous", this.video.preload = "auto", t.playsInline !== !1 && (this.video.playsInline = !0), this.events = new zi();
|
|
254
254
|
const o = Kt(t);
|
|
255
|
-
this.store = new Ii(o), this.audioEngine = new
|
|
256
|
-
const
|
|
257
|
-
if (this.store.setState({ isFullscreen:
|
|
258
|
-
const
|
|
255
|
+
this.store = new Ii(o), this.audioEngine = new Fi(this.video), this.boundCueChange = this.handleCueChange.bind(this), this.boundFullscreenChange = () => {
|
|
256
|
+
const r = document, u = !!(r.fullscreenElement || r.webkitFullscreenElement || r.mozFullScreenElement || r.msFullscreenElement);
|
|
257
|
+
if (this.store.setState({ isFullscreen: u }), this.emit("resize"), this.emit(u ? "fullscreen" : "fullscreen_exit"), u && this.config.autoOrientation && screen.orientation && "lock" in screen.orientation) {
|
|
258
|
+
const p = this.video.videoWidth > this.video.videoHeight ? "landscape" : "portrait";
|
|
259
259
|
try {
|
|
260
|
-
screen.orientation.lock(
|
|
260
|
+
screen.orientation.lock(p).catch(() => {
|
|
261
261
|
});
|
|
262
262
|
} catch {
|
|
263
263
|
}
|
|
264
|
-
} else !
|
|
265
|
-
}, this.video.volume = o.volume, this.video.muted = o.isMuted, this.video.playbackRate = o.playbackRate, this.video.loop = o.isLooping, this.video.style.filter = `brightness(${o.brightness})`, o.audioGain > 1 && this.audioEngine.setGain(o.audioGain), this.video.style.objectFit = o.videoFit, this.initVideoListeners(), this.initMediaSession(), this.initCast(), t.disablePersistence || this.store.subscribe((
|
|
264
|
+
} else !u && screen.orientation && "unlock" in screen.orientation && screen.orientation.unlock();
|
|
265
|
+
}, this.video.volume = o.volume, this.video.muted = o.isMuted, this.video.playbackRate = o.playbackRate, this.video.loop = o.isLooping, this.video.style.filter = `brightness(${o.brightness})`, o.audioGain > 1 && this.audioEngine.setGain(o.audioGain), this.video.style.objectFit = o.videoFit, this.initVideoListeners(), this.initMediaSession(), this.initCast(), t.disablePersistence || this.store.subscribe((r) => {
|
|
266
266
|
const u = {
|
|
267
|
-
volume:
|
|
268
|
-
isMuted:
|
|
269
|
-
playbackRate:
|
|
270
|
-
subtitleSettings:
|
|
271
|
-
iconSize:
|
|
272
|
-
themeColor:
|
|
273
|
-
theme:
|
|
274
|
-
isLive:
|
|
275
|
-
isLooping:
|
|
276
|
-
brightness:
|
|
277
|
-
videoFit:
|
|
267
|
+
volume: r.volume,
|
|
268
|
+
isMuted: r.isMuted,
|
|
269
|
+
playbackRate: r.playbackRate,
|
|
270
|
+
subtitleSettings: r.subtitleSettings,
|
|
271
|
+
iconSize: r.iconSize,
|
|
272
|
+
themeColor: r.themeColor,
|
|
273
|
+
theme: r.theme,
|
|
274
|
+
isLive: r.isLive,
|
|
275
|
+
isLooping: r.isLooping,
|
|
276
|
+
brightness: r.brightness,
|
|
277
|
+
videoFit: r.videoFit
|
|
278
278
|
};
|
|
279
279
|
localStorage.setItem(Jt, JSON.stringify(u));
|
|
280
280
|
});
|
|
@@ -337,7 +337,7 @@ class $i {
|
|
|
337
337
|
return this.events.emit(t, i);
|
|
338
338
|
}
|
|
339
339
|
initVideoListeners() {
|
|
340
|
-
const t = (
|
|
340
|
+
const t = (r) => this.store.setState(r);
|
|
341
341
|
[
|
|
342
342
|
"abort",
|
|
343
343
|
"canplay",
|
|
@@ -361,9 +361,9 @@ class $i {
|
|
|
361
361
|
"timeupdate",
|
|
362
362
|
"volumechange",
|
|
363
363
|
"waiting"
|
|
364
|
-
].forEach((
|
|
365
|
-
this.video.addEventListener(
|
|
366
|
-
switch (this.emit(`video:${
|
|
364
|
+
].forEach((r) => {
|
|
365
|
+
this.video.addEventListener(r, (u) => {
|
|
366
|
+
switch (this.emit(`video:${r}`, u), r === "play" && this.emit("play"), r === "pause" && this.emit("pause"), r === "ended" && this.emit("ended"), r === "error" && this.emit("error", this.video.error), r === "seeked" && this.emit("seek"), r) {
|
|
367
367
|
case "play":
|
|
368
368
|
t({ isPlaying: !0 }), "mediaSession" in navigator && (navigator.mediaSession.playbackState = "playing"), this.updateMediaSessionPosition();
|
|
369
369
|
break;
|
|
@@ -421,7 +421,7 @@ class $i {
|
|
|
421
421
|
t({ isPip: !0 }), this.emit("pip", !0);
|
|
422
422
|
}), this.video.addEventListener("leavepictureinpicture", () => {
|
|
423
423
|
t({ isPip: !1 }), this.emit("pip", !1);
|
|
424
|
-
}), document.addEventListener(
|
|
424
|
+
}), ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"].forEach((r) => document.addEventListener(r, this.boundFullscreenChange));
|
|
425
425
|
}
|
|
426
426
|
updateSourceStatus(t) {
|
|
427
427
|
const i = this.store.get().currentSourceIndex;
|
|
@@ -446,9 +446,9 @@ class $i {
|
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
448
|
updateMediaSessionMetadata() {
|
|
449
|
-
var o,
|
|
449
|
+
var o, r;
|
|
450
450
|
if (!("mediaSession" in navigator)) return;
|
|
451
|
-
const t = ((o = this.currentSource) == null ? void 0 : o.name) || ((
|
|
451
|
+
const t = ((o = this.currentSource) == null ? void 0 : o.name) || ((r = this.currentSource) == null ? void 0 : r.url.split("/").pop()) || "Video", i = [];
|
|
452
452
|
this.config.poster && i.push({ src: this.config.poster, sizes: "512x512", type: "image/jpeg" }), i.push({ src: "logo.png", sizes: "512x512", type: "image/png" }), navigator.mediaSession.metadata = new MediaMetadata({
|
|
453
453
|
title: t,
|
|
454
454
|
artist: "StrataPlayer",
|
|
@@ -466,8 +466,8 @@ class $i {
|
|
|
466
466
|
position: Math.max(0, Math.min(i, t))
|
|
467
467
|
// Ensure within [0, duration]
|
|
468
468
|
});
|
|
469
|
-
} catch (
|
|
470
|
-
console.warn("MediaSession Position Error:",
|
|
469
|
+
} catch (r) {
|
|
470
|
+
console.warn("MediaSession Position Error:", r);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
triggerError(t, i = !1) {
|
|
@@ -477,14 +477,14 @@ class $i {
|
|
|
477
477
|
const i = this.video.error, o = t || (i == null ? void 0 : i.message) || (i ? `Code ${i.code}` : "Unknown Error");
|
|
478
478
|
if (this.removeNotification("retry"), this.emit("video:error", i), this.retryCount < this.maxRetries) {
|
|
479
479
|
this.retryCount++;
|
|
480
|
-
const
|
|
480
|
+
const r = Math.pow(2, this.retryCount - 1) * 1500;
|
|
481
481
|
this.notify({
|
|
482
482
|
id: "retry",
|
|
483
483
|
type: "loading",
|
|
484
484
|
// Cleaned up formatting with newline
|
|
485
485
|
message: `Error: ${o}.
|
|
486
486
|
Retrying (${this.retryCount}/${this.maxRetries})`
|
|
487
|
-
}), console.warn(`[StrataPlayer] Error: ${o}. Retrying in ${
|
|
487
|
+
}), console.warn(`[StrataPlayer] Error: ${o}. Retrying in ${r}ms...`), this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = setTimeout(() => {
|
|
488
488
|
if (this.currentSource) {
|
|
489
489
|
this.load(this.currentSource, this.trackConfigs, !0);
|
|
490
490
|
const u = this.store.get().currentTime;
|
|
@@ -495,11 +495,11 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
495
495
|
this.video.addEventListener("canplay", h);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
},
|
|
498
|
+
}, r);
|
|
499
499
|
} else {
|
|
500
500
|
this.removeNotification("retry");
|
|
501
|
-
const
|
|
502
|
-
this.store.setState({ error:
|
|
501
|
+
const r = `Failed to play after ${this.maxRetries} attempts: ${o}`;
|
|
502
|
+
this.store.setState({ error: r }), this.emit("error", r), this.updateSourceStatus("error");
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
updateBuffer() {
|
|
@@ -513,27 +513,27 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
513
513
|
}
|
|
514
514
|
updateSubtitleTrackState(t, i) {
|
|
515
515
|
this.store.setState((o) => {
|
|
516
|
-
const
|
|
517
|
-
return
|
|
516
|
+
const r = [...o.subtitleTracks];
|
|
517
|
+
return r[t] && (r[t] = { ...r[t], ...i }), { subtitleTracks: r };
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
520
|
// --- Utility ---
|
|
521
|
-
async fetchWithRetry(t, i = 3, o,
|
|
521
|
+
async fetchWithRetry(t, i = 3, o, r) {
|
|
522
522
|
const u = o ?? this.config.fetchTimeout ?? 3e4;
|
|
523
523
|
for (let h = 0; h < i; h++) {
|
|
524
|
-
const
|
|
524
|
+
const p = r ? null : new AbortController(), b = r || (p == null ? void 0 : p.signal), g = setTimeout(() => p == null ? void 0 : p.abort(), u);
|
|
525
525
|
try {
|
|
526
|
-
const m = await fetch(t, { signal:
|
|
527
|
-
if (clearTimeout(
|
|
526
|
+
const m = await fetch(t, { signal: b });
|
|
527
|
+
if (clearTimeout(g), !m.ok) throw new Error(`HTTP ${m.status}`);
|
|
528
528
|
return m;
|
|
529
529
|
} catch (m) {
|
|
530
|
-
if (clearTimeout(
|
|
530
|
+
if (clearTimeout(g), r != null && r.aborted) throw new Error("Aborted");
|
|
531
531
|
if (h === i - 1) throw m;
|
|
532
532
|
if (m.name === "AbortError") {
|
|
533
|
-
if (
|
|
533
|
+
if (r != null && r.aborted) throw m;
|
|
534
534
|
console.warn(`Fetch timeout (${u}ms) for ${t}`);
|
|
535
535
|
}
|
|
536
|
-
await new Promise((
|
|
536
|
+
await new Promise((x) => setTimeout(x, 1e3 * Math.pow(2, h)));
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
throw new Error("Fetch failed");
|
|
@@ -552,8 +552,8 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
552
552
|
// Enhanced Format Duration: Days, Hours, Minutes, Seconds
|
|
553
553
|
formatDuration(t) {
|
|
554
554
|
if (!isFinite(t) || t <= 0) return "";
|
|
555
|
-
const i = Math.floor(t / 1e3), o = Math.floor(i / (3600 * 24)),
|
|
556
|
-
return o > 0 &&
|
|
555
|
+
const i = Math.floor(t / 1e3), o = Math.floor(i / (3600 * 24)), r = Math.floor(i % (3600 * 24) / 3600), u = Math.floor(i % 3600 / 60), h = i % 60, p = [];
|
|
556
|
+
return o > 0 && p.push(`${o}d`), r > 0 && p.push(`${r}h`), u > 0 && p.push(`${u}m`), p.push(`${h}s`), p.join(" ");
|
|
557
557
|
}
|
|
558
558
|
// --- Core Methods ---
|
|
559
559
|
attach(t) {
|
|
@@ -568,26 +568,54 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
568
568
|
setSources(t, i = []) {
|
|
569
569
|
this.store.setState({ sources: t }), this.trackConfigs = i, t.length > 0 && this.load(t[0], i);
|
|
570
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Updates text tracks at runtime without reloading the video source.
|
|
573
|
+
* Useful for changing subtitles dynamically.
|
|
574
|
+
*/
|
|
575
|
+
setTextTracks(t) {
|
|
576
|
+
this.trackConfigs = t;
|
|
577
|
+
const i = this.store.get().currentSubtitle, o = this.store.get().subtitleTracks[i], r = t.map((u, h) => {
|
|
578
|
+
const p = this.store.get().subtitleTracks.find((b) => b.src === u.src && b.label === u.label);
|
|
579
|
+
return {
|
|
580
|
+
...u,
|
|
581
|
+
index: h,
|
|
582
|
+
status: p ? p.status : "idle",
|
|
583
|
+
isDefault: !!u.default
|
|
584
|
+
};
|
|
585
|
+
});
|
|
586
|
+
if (this.store.setState({ subtitleTracks: r }), o) {
|
|
587
|
+
const u = r.findIndex((h) => h.src === o.src && h.label === o.label);
|
|
588
|
+
if (u !== -1)
|
|
589
|
+
this.store.setState({ currentSubtitle: u });
|
|
590
|
+
else {
|
|
591
|
+
const h = r.findIndex((p) => p.default);
|
|
592
|
+
h !== -1 ? this.setSubtitle(h) : this.setSubtitle(-1);
|
|
593
|
+
}
|
|
594
|
+
} else {
|
|
595
|
+
const u = r.findIndex((h) => h.default);
|
|
596
|
+
u !== -1 && this.setSubtitle(u);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
571
599
|
switchSource(t) {
|
|
572
600
|
const i = this.store.get().sources;
|
|
573
601
|
if (t >= 0 && t < i.length) {
|
|
574
|
-
const o = this.video.currentTime,
|
|
602
|
+
const o = this.video.currentTime, r = !this.video.paused;
|
|
575
603
|
this.load(i[t], this.trackConfigs);
|
|
576
604
|
const u = () => {
|
|
577
|
-
this.video.currentTime = o,
|
|
605
|
+
this.video.currentTime = o, r && this.video.play(), this.video.removeEventListener("canplay", u);
|
|
578
606
|
};
|
|
579
607
|
this.video.addEventListener("canplay", u);
|
|
580
608
|
}
|
|
581
609
|
}
|
|
582
610
|
load(t, i = [], o = !1) {
|
|
583
611
|
this.retryTimer && clearTimeout(this.retryTimer);
|
|
584
|
-
const
|
|
585
|
-
o || (this.retryCount = 0, this.store.setState({ error: null }), this.removeNotification("retry")), this.currentSrc =
|
|
586
|
-
const h = this.store.get().sources.findIndex((
|
|
587
|
-
...
|
|
588
|
-
index:
|
|
612
|
+
const r = typeof t == "string" ? { url: t, type: "auto" } : t;
|
|
613
|
+
o || (this.retryCount = 0, this.store.setState({ error: null }), this.removeNotification("retry")), this.currentSrc = r.url, this.currentSource = r, this.trackConfigs = i;
|
|
614
|
+
const h = this.store.get().sources.findIndex((x) => x.url === r.url), p = i.map((x, f) => ({
|
|
615
|
+
...x,
|
|
616
|
+
index: f,
|
|
589
617
|
status: "idle",
|
|
590
|
-
isDefault: !!
|
|
618
|
+
isDefault: !!x.default
|
|
591
619
|
}));
|
|
592
620
|
this.store.setState({
|
|
593
621
|
isBuffering: !0,
|
|
@@ -597,21 +625,21 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
597
625
|
audioTracks: [],
|
|
598
626
|
currentAudioTrack: -1,
|
|
599
627
|
// Reset audio track
|
|
600
|
-
subtitleTracks:
|
|
628
|
+
subtitleTracks: p,
|
|
601
629
|
currentSubtitle: -1,
|
|
602
630
|
currentSourceIndex: h
|
|
603
631
|
}), this.updateMediaSessionMetadata();
|
|
604
|
-
let
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
for (;
|
|
608
|
-
|
|
609
|
-
const m =
|
|
610
|
-
m !== -1 && this.setSubtitle(m), (
|
|
632
|
+
let b = r.type || "auto";
|
|
633
|
+
b === "auto" && (r.url.includes(".m3u8") ? b = "hls" : r.url.includes(".mpd") ? b = "dash" : r.url.includes(".flv") || r.url.includes(".ts") ? b = "mpegts" : r.url.startsWith("magnet:") || r.url.includes(".torrent") ? b = "webtorrent" : b = "mp4"), this.events.emit("load", { url: r.url, type: b });
|
|
634
|
+
const g = this.video.getElementsByTagName("track");
|
|
635
|
+
for (; g.length > 0; )
|
|
636
|
+
g[0].remove();
|
|
637
|
+
const m = p.findIndex((x) => x.default);
|
|
638
|
+
m !== -1 && this.setSubtitle(m), (b === "mp4" || b === "webm" || b === "ogg") && (this.video.src = r.url);
|
|
611
639
|
}
|
|
612
640
|
// Wrapper for external subtitle API
|
|
613
641
|
loadSubtitle(t, i = "Subtitle") {
|
|
614
|
-
const o = this.store.get().subtitleTracks.length,
|
|
642
|
+
const o = this.store.get().subtitleTracks.length, r = {
|
|
615
643
|
src: t,
|
|
616
644
|
label: i,
|
|
617
645
|
srcLang: "user",
|
|
@@ -622,25 +650,25 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
622
650
|
isDefault: !0
|
|
623
651
|
};
|
|
624
652
|
this.store.setState((u) => ({
|
|
625
|
-
subtitleTracks: [...u.subtitleTracks,
|
|
653
|
+
subtitleTracks: [...u.subtitleTracks, r]
|
|
626
654
|
})), this.setSubtitle(o);
|
|
627
655
|
}
|
|
628
656
|
addTextTrack(t, i) {
|
|
629
657
|
const o = new FileReader();
|
|
630
|
-
o.onload = (
|
|
631
|
-
var
|
|
632
|
-
if (!((
|
|
633
|
-
let u =
|
|
658
|
+
o.onload = (r) => {
|
|
659
|
+
var b;
|
|
660
|
+
if (!((b = r.target) != null && b.result)) return;
|
|
661
|
+
let u = r.target.result;
|
|
634
662
|
u = this.convertToVTT(u);
|
|
635
|
-
const h = new Blob([u], { type: "text/vtt" }),
|
|
636
|
-
this.loadSubtitle(
|
|
663
|
+
const h = new Blob([u], { type: "text/vtt" }), p = URL.createObjectURL(h);
|
|
664
|
+
this.loadSubtitle(p, i), this.notify({ type: "success", message: "Subtitle uploaded", duration: 3e3 });
|
|
637
665
|
}, o.onerror = () => {
|
|
638
666
|
this.notify({ type: "error", message: "Failed to read file", duration: 3e3 });
|
|
639
667
|
}, o.readAsText(t);
|
|
640
668
|
}
|
|
641
|
-
addTextTrackInternal(t, i, o = "",
|
|
669
|
+
addTextTrackInternal(t, i, o = "", r = !1) {
|
|
642
670
|
const u = document.createElement("track");
|
|
643
|
-
u.kind = "subtitles", u.label = i, u.src = t, u.srclang = o,
|
|
671
|
+
u.kind = "subtitles", u.label = i, u.src = t, u.srclang = o, r && (u.default = !0), this.video.appendChild(u);
|
|
644
672
|
}
|
|
645
673
|
play() {
|
|
646
674
|
return this.video.play();
|
|
@@ -679,29 +707,40 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
679
707
|
this.store.get().controlsVisible !== t && (this.store.setState({ controlsVisible: t }), this.emit("control", t));
|
|
680
708
|
}
|
|
681
709
|
async toggleFullscreen() {
|
|
682
|
-
if (this.container)
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
710
|
+
if (!this.container) return;
|
|
711
|
+
const t = document, i = this.container;
|
|
712
|
+
if (t.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement) {
|
|
713
|
+
t.exitFullscreen ? await t.exitFullscreen().catch(() => {
|
|
714
|
+
}) : t.webkitExitFullscreen ? t.webkitExitFullscreen() : t.mozCancelFullScreen ? t.mozCancelFullScreen() : t.msExitFullscreen && t.msExitFullscreen();
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
if (this.store.get().isWebFullscreen) {
|
|
718
|
+
this.toggleWebFullscreen();
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
try {
|
|
722
|
+
if (i.requestFullscreen)
|
|
723
|
+
await i.requestFullscreen();
|
|
724
|
+
else if (i.webkitRequestFullscreen)
|
|
725
|
+
i.webkitRequestFullscreen();
|
|
726
|
+
else if (i.mozRequestFullScreen)
|
|
727
|
+
i.mozRequestFullScreen();
|
|
728
|
+
else if (i.msRequestFullscreen)
|
|
729
|
+
i.msRequestFullscreen();
|
|
730
|
+
else if (this.video && this.video.webkitEnterFullscreen)
|
|
731
|
+
this.video.webkitEnterFullscreen();
|
|
732
|
+
else
|
|
733
|
+
throw new Error("Native fullscreen API not supported");
|
|
734
|
+
} catch (r) {
|
|
735
|
+
console.warn("Native fullscreen failed, falling back to Web Fullscreen", r), this.toggleWebFullscreen();
|
|
697
736
|
}
|
|
698
737
|
}
|
|
699
738
|
toggleWebFullscreen() {
|
|
700
|
-
const t = this.store.get().isWebFullscreen;
|
|
701
|
-
|
|
702
|
-
});
|
|
703
|
-
const
|
|
704
|
-
this.store.setState({ isWebFullscreen:
|
|
739
|
+
const t = this.store.get().isWebFullscreen, i = document;
|
|
740
|
+
(i.fullscreenElement || i.webkitFullscreenElement || i.mozFullScreenElement || i.msFullscreenElement) && (i.exitFullscreen ? i.exitFullscreen().catch(() => {
|
|
741
|
+
}) : i.webkitExitFullscreen ? i.webkitExitFullscreen() : i.mozCancelFullScreen ? i.mozCancelFullScreen() : i.msExitFullscreen && i.msExitFullscreen());
|
|
742
|
+
const o = !t;
|
|
743
|
+
this.store.setState({ isWebFullscreen: o }), typeof document < "u" && (document.body.style.overflow = o ? "hidden" : ""), this.emit("webfullscreen", o);
|
|
705
744
|
}
|
|
706
745
|
togglePip() {
|
|
707
746
|
document.pictureInPictureElement ? document.exitPictureInPicture() : this.video !== document.pictureInPictureElement && this.video.requestPictureInPicture && this.video.requestPictureInPicture();
|
|
@@ -713,8 +752,8 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
713
752
|
if (i) {
|
|
714
753
|
i.drawImage(this.video, 0, 0, t.width, t.height);
|
|
715
754
|
try {
|
|
716
|
-
const o = t.toDataURL("image/png"),
|
|
717
|
-
|
|
755
|
+
const o = t.toDataURL("image/png"), r = document.createElement("a");
|
|
756
|
+
r.download = `screenshot-${(/* @__PURE__ */ new Date()).toISOString()}.png`, r.href = o, r.click(), this.notify({ type: "success", message: "Screenshot saved", duration: 2e3 });
|
|
718
757
|
} catch {
|
|
719
758
|
this.notify({ type: "error", message: "Failed to take screenshot", duration: 3e3 });
|
|
720
759
|
}
|
|
@@ -732,8 +771,8 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
732
771
|
[t]: !i[t]
|
|
733
772
|
};
|
|
734
773
|
this.store.setState({ flipState: o });
|
|
735
|
-
const
|
|
736
|
-
this.video.style.transform = `scale(${
|
|
774
|
+
const r = o.horizontal ? -1 : 1, u = o.vertical ? -1 : 1;
|
|
775
|
+
this.video.style.transform = `scale(${r}, ${u})`;
|
|
737
776
|
}
|
|
738
777
|
setAspectRatio(t) {
|
|
739
778
|
this.store.setState({ aspectRatio: t }), this.updateAspectRatio(), t !== "default" && this.notify({ type: "info", message: `Aspect Ratio: ${t}`, duration: 2e3 });
|
|
@@ -752,13 +791,13 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
752
791
|
this.video.style.width = "100%", this.video.style.height = "100%", this.video.style.objectFit = i;
|
|
753
792
|
return;
|
|
754
793
|
}
|
|
755
|
-
const [o,
|
|
756
|
-
if (!o || !
|
|
757
|
-
const u = o /
|
|
794
|
+
const [o, r] = t.split(":").map(Number);
|
|
795
|
+
if (!o || !r) return;
|
|
796
|
+
const u = o / r, h = this.container.getBoundingClientRect();
|
|
758
797
|
if (h.width === 0 || h.height === 0) return;
|
|
759
|
-
const
|
|
760
|
-
let
|
|
761
|
-
|
|
798
|
+
const p = h.width / h.height;
|
|
799
|
+
let b, g;
|
|
800
|
+
p > u ? (g = h.height, b = g * u) : (b = h.width, g = b / u), this.video.style.width = `${b}px`, this.video.style.height = `${g}px`, this.video.style.objectFit = "fill";
|
|
762
801
|
}
|
|
763
802
|
initCast() {
|
|
764
803
|
const t = window, i = () => {
|
|
@@ -796,8 +835,8 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
796
835
|
try {
|
|
797
836
|
const i = t.cast.framework.CastContext.getInstance().getCurrentSession();
|
|
798
837
|
if (!i) return;
|
|
799
|
-
const o = new t.chrome.cast.media.MediaInfo(this.currentSrc, this.currentSrc.includes(".m3u8") ? "application/x-mpegurl" : "video/mp4"),
|
|
800
|
-
i.loadMedia(
|
|
838
|
+
const o = new t.chrome.cast.media.MediaInfo(this.currentSrc, this.currentSrc.includes(".m3u8") ? "application/x-mpegurl" : "video/mp4"), r = new t.chrome.cast.media.LoadRequest(o);
|
|
839
|
+
i.loadMedia(r).then(() => {
|
|
801
840
|
this.notify({ type: "success", message: "Casting...", duration: 3e3 });
|
|
802
841
|
}).catch((u) => console.error("Cast load error", u));
|
|
803
842
|
} catch (i) {
|
|
@@ -809,10 +848,10 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
809
848
|
this.store.setState({ activeCues: [] });
|
|
810
849
|
return;
|
|
811
850
|
}
|
|
812
|
-
const o = Array.from(this.video.textTracks).filter((
|
|
851
|
+
const o = Array.from(this.video.textTracks).filter((r) => r.kind === "subtitles" || r.kind === "captions").find((r) => r.mode === "showing" || r.mode === "hidden");
|
|
813
852
|
if (o && o.activeCues) {
|
|
814
|
-
const
|
|
815
|
-
this.store.setState({ activeCues:
|
|
853
|
+
const r = Array.from(o.activeCues).map((u) => u.text);
|
|
854
|
+
this.store.setState({ activeCues: r });
|
|
816
855
|
} else
|
|
817
856
|
this.store.setState({ activeCues: [] });
|
|
818
857
|
}
|
|
@@ -824,18 +863,18 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
824
863
|
if (o.status === "idle" || o.status === "error") {
|
|
825
864
|
this.updateSubtitleTrackState(t, { status: "loading" });
|
|
826
865
|
try {
|
|
827
|
-
let
|
|
828
|
-
|
|
829
|
-
const
|
|
830
|
-
this.addTextTrackInternal(
|
|
866
|
+
let p = await (await this.fetchWithRetry(o.src)).text();
|
|
867
|
+
p = this.convertToVTT(p);
|
|
868
|
+
const b = new Blob([p], { type: "text/vtt" }), g = URL.createObjectURL(b);
|
|
869
|
+
this.addTextTrackInternal(g, o.label, o.srcLang, !1), this.updateSubtitleTrackState(t, { status: "success" });
|
|
831
870
|
} catch (h) {
|
|
832
871
|
this.updateSubtitleTrackState(t, { status: "error" }), console.error("Failed to load subtitle", h);
|
|
833
872
|
return;
|
|
834
873
|
}
|
|
835
874
|
}
|
|
836
|
-
const
|
|
837
|
-
let u =
|
|
838
|
-
if (u || (u =
|
|
875
|
+
const r = Array.from(this.video.textTracks);
|
|
876
|
+
let u = r.find((h) => h.label === o.label && h.language === o.srcLang);
|
|
877
|
+
if (u || (u = r.find((h) => h.label === o.label)), u) {
|
|
839
878
|
const h = this.store.get().subtitleSettings;
|
|
840
879
|
u.mode = h.useNative ? "showing" : "hidden", u.addEventListener("cuechange", this.boundCueChange), this.handleCueChange();
|
|
841
880
|
}
|
|
@@ -843,20 +882,20 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
843
882
|
updateSubtitleSettings(t) {
|
|
844
883
|
const o = { ...this.store.get().subtitleSettings, ...t };
|
|
845
884
|
if (this.store.setState({ subtitleSettings: o }), t.useNative !== void 0) {
|
|
846
|
-
const
|
|
847
|
-
if (
|
|
848
|
-
const h = this.store.get().subtitleTracks[
|
|
849
|
-
|
|
885
|
+
const r = this.store.get().currentSubtitle;
|
|
886
|
+
if (r !== -1) {
|
|
887
|
+
const h = this.store.get().subtitleTracks[r], p = Array.from(this.video.textTracks).find((b) => b.label === h.label && b.language === h.srcLang);
|
|
888
|
+
p && (p.mode = t.useNative ? "showing" : "hidden");
|
|
850
889
|
}
|
|
851
890
|
}
|
|
852
891
|
}
|
|
853
892
|
resetSubtitleSettings() {
|
|
854
|
-
this.store.setState({ subtitleSettings:
|
|
893
|
+
this.store.setState({ subtitleSettings: at }), this.updateSubtitleSettings({ useNative: !1 });
|
|
855
894
|
}
|
|
856
895
|
setSubtitleOffset(t) {
|
|
857
896
|
const i = this.store.get().subtitleOffset, o = t - i;
|
|
858
|
-
Math.abs(o) < 1e-3 || (Array.from(this.video.textTracks).forEach((
|
|
859
|
-
(
|
|
897
|
+
Math.abs(o) < 1e-3 || (Array.from(this.video.textTracks).forEach((r) => {
|
|
898
|
+
(r.mode === "showing" || r.mode === "hidden") && r.cues && Array.from(r.cues).forEach((u) => {
|
|
860
899
|
u.startTime += o, u.endTime += o;
|
|
861
900
|
});
|
|
862
901
|
}), this.store.setState({ subtitleOffset: t }), this.notify({ type: "info", message: `Subtitle Offset: ${t > 0 ? "+" : ""}${t.toFixed(1)}s`, duration: 1500 }));
|
|
@@ -866,10 +905,10 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
866
905
|
t && this.activeDownloads.has(t) ? ((i = this.activeDownloads.get(t)) == null || i.abort(), this.activeDownloads.delete(t), this.notify({ type: "info", message: "Download cancelled", duration: 2e3 }), this.removeNotification(t)) : t || this.activeDownloads.size > 0 && (this.activeDownloads.forEach((o) => o.abort()), this.activeDownloads.clear(), this.notify({ type: "info", message: "All downloads cancelled", duration: 2e3 }));
|
|
867
906
|
}
|
|
868
907
|
async download(t = {}) {
|
|
869
|
-
var h,
|
|
908
|
+
var h, p, b;
|
|
870
909
|
const i = ((h = this.currentSource) == null ? void 0 : h.url) || this.video.src;
|
|
871
910
|
if (!i) return;
|
|
872
|
-
if (i.includes(".m3u8") || ((
|
|
911
|
+
if (i.includes(".m3u8") || ((p = this.currentSource) == null ? void 0 : p.type) === "hls") {
|
|
873
912
|
this.downloadHls(i, t.format || "ts");
|
|
874
913
|
return;
|
|
875
914
|
}
|
|
@@ -877,9 +916,9 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
877
916
|
this.notify({ type: "warning", message: "Stream download not supported in browser.", duration: 4e3 });
|
|
878
917
|
return;
|
|
879
918
|
}
|
|
880
|
-
const o = Math.random().toString(36).substr(2, 9),
|
|
881
|
-
this.activeDownloads.set(o,
|
|
882
|
-
const u =
|
|
919
|
+
const o = Math.random().toString(36).substr(2, 9), r = new AbortController();
|
|
920
|
+
this.activeDownloads.set(o, r);
|
|
921
|
+
const u = r.signal;
|
|
883
922
|
this.notify({
|
|
884
923
|
id: o,
|
|
885
924
|
type: "loading",
|
|
@@ -891,34 +930,34 @@ Retrying (${this.retryCount}/${this.maxRetries})`
|
|
|
891
930
|
}
|
|
892
931
|
});
|
|
893
932
|
try {
|
|
894
|
-
const
|
|
895
|
-
if (!
|
|
896
|
-
const m =
|
|
933
|
+
const g = await this.fetchWithRetry(i, 3, void 0, u);
|
|
934
|
+
if (!g.body) throw new Error("No body");
|
|
935
|
+
const m = g.body.getReader(), x = g.headers.get("Content-Length"), f = x ? parseInt(x, 10) : 0;
|
|
897
936
|
let S = 0;
|
|
898
|
-
const
|
|
899
|
-
let
|
|
937
|
+
const L = [], U = Date.now(), H = [];
|
|
938
|
+
let _ = 0;
|
|
900
939
|
for (; ; ) {
|
|
901
|
-
const { done:
|
|
902
|
-
if (
|
|
903
|
-
if (
|
|
940
|
+
const { done: pe, value: k } = await m.read();
|
|
941
|
+
if (pe) break;
|
|
942
|
+
if (L.push(k), S += k.length, f) {
|
|
904
943
|
const j = Date.now();
|
|
905
|
-
if (j -
|
|
906
|
-
|
|
907
|
-
const D = Math.round(S /
|
|
944
|
+
if (j - _ > 800 || S === f) {
|
|
945
|
+
_ = j;
|
|
946
|
+
const D = Math.round(S / f * 100);
|
|
908
947
|
for (H.push({ time: j, loaded: S }); H.length > 0 && j - H[0].time > 5e3; )
|
|
909
948
|
H.shift();
|
|
910
949
|
let T = "", n = 0;
|
|
911
950
|
if (H.length > 1) {
|
|
912
|
-
const X = H[0],
|
|
913
|
-
ne > 0 && (n =
|
|
951
|
+
const X = H[0], G = H[H.length - 1], ne = G.time - X.time, ae = G.loaded - X.loaded;
|
|
952
|
+
ne > 0 && (n = ae / ne);
|
|
914
953
|
} else {
|
|
915
954
|
const X = j - U;
|
|
916
955
|
X > 0 && (n = S / X);
|
|
917
956
|
}
|
|
918
957
|
if (n > 0) {
|
|
919
|
-
const
|
|
958
|
+
const G = (f - S) / n;
|
|
920
959
|
T = `
|
|
921
|
-
${this.formatDuration(
|
|
960
|
+
${this.formatDuration(G)} remaining`;
|
|
922
961
|
}
|
|
923
962
|
this.notify({
|
|
924
963
|
id: o,
|
|
@@ -934,8 +973,8 @@ ${this.formatDuration(_)} remaining`;
|
|
|
934
973
|
}
|
|
935
974
|
}
|
|
936
975
|
}
|
|
937
|
-
const
|
|
938
|
-
|
|
976
|
+
const v = new Blob(L), Y = window.URL.createObjectURL(v), q = document.createElement("a");
|
|
977
|
+
q.style.display = "none", q.href = Y, q.download = ((b = i.split("/").pop()) == null ? void 0 : b.split("?")[0]) || "video.mp4", document.body.appendChild(q), q.click(), window.URL.revokeObjectURL(Y), document.body.removeChild(q), this.notify({ id: o, type: "success", message: "Saved!", duration: 3e3 });
|
|
939
978
|
} catch {
|
|
940
979
|
u.aborted ? this.removeNotification(o) : (this.notify({ id: o, type: "error", message: "Download failed.", duration: 4e3 }), window.open(i, "_blank"));
|
|
941
980
|
} finally {
|
|
@@ -944,9 +983,9 @@ ${this.formatDuration(_)} remaining`;
|
|
|
944
983
|
}
|
|
945
984
|
async downloadHls(t, i) {
|
|
946
985
|
var h;
|
|
947
|
-
const o = Math.random().toString(36).substr(2, 9),
|
|
948
|
-
this.activeDownloads.set(o,
|
|
949
|
-
const u =
|
|
986
|
+
const o = Math.random().toString(36).substr(2, 9), r = new AbortController();
|
|
987
|
+
this.activeDownloads.set(o, r);
|
|
988
|
+
const u = r.signal;
|
|
950
989
|
this.notify({
|
|
951
990
|
id: o,
|
|
952
991
|
type: "loading",
|
|
@@ -955,10 +994,10 @@ ${this.formatDuration(_)} remaining`;
|
|
|
955
994
|
action: { label: "Cancel", onClick: () => this.cancelDownload(o) }
|
|
956
995
|
});
|
|
957
996
|
try {
|
|
958
|
-
let
|
|
959
|
-
if (
|
|
997
|
+
let p = await this.fetchWithRetry(t, 3, void 0, u), b = await p.text(), g = t.substring(0, t.lastIndexOf("/") + 1);
|
|
998
|
+
if (b.includes("#EXT-X-STREAM-INF")) {
|
|
960
999
|
this.notify({ id: o, type: "loading", message: "Selecting best quality", progress: 0 });
|
|
961
|
-
const k =
|
|
1000
|
+
const k = b.split(`
|
|
962
1001
|
`);
|
|
963
1002
|
let j = 0, D = "";
|
|
964
1003
|
for (let T = 0; T < k.length; T++)
|
|
@@ -966,29 +1005,29 @@ ${this.formatDuration(_)} remaining`;
|
|
|
966
1005
|
const n = k[T].match(/BANDWIDTH=(\d+)/);
|
|
967
1006
|
if (n) {
|
|
968
1007
|
const X = parseInt(n[1]);
|
|
969
|
-
let
|
|
970
|
-
|
|
1008
|
+
let G = (h = k[T + 1]) == null ? void 0 : h.trim();
|
|
1009
|
+
G && !G.startsWith("#") && X > j && (j = X, D = G);
|
|
971
1010
|
}
|
|
972
1011
|
}
|
|
973
|
-
D && (D.startsWith("http") || (D =
|
|
1012
|
+
D && (D.startsWith("http") || (D = g + D), p = await this.fetchWithRetry(D, 3, void 0, u), b = await p.text(), g = D.substring(0, D.lastIndexOf("/") + 1));
|
|
974
1013
|
}
|
|
975
|
-
if (
|
|
1014
|
+
if (b.includes("#EXT-X-KEY"))
|
|
976
1015
|
throw new Error("Encrypted HLS streams are not supported for download.");
|
|
977
|
-
const m =
|
|
978
|
-
`),
|
|
1016
|
+
const m = b.split(`
|
|
1017
|
+
`), x = [];
|
|
979
1018
|
for (let k of m)
|
|
980
|
-
k = k.trim(), k && !k.startsWith("#") && (k.startsWith("http") ?
|
|
981
|
-
if (
|
|
982
|
-
let
|
|
1019
|
+
k = k.trim(), k && !k.startsWith("#") && (k.startsWith("http") ? x.push(k) : x.push(g + k));
|
|
1020
|
+
if (x.length === 0) throw new Error("No segments found.");
|
|
1021
|
+
let f = i === "mp4" ? "mp4" : "ts", S = i === "mp4" ? "video/mp4" : "video/mp2t", L = null, U = null, H = [];
|
|
983
1022
|
if ("showSaveFilePicker" in window)
|
|
984
1023
|
try {
|
|
985
|
-
|
|
986
|
-
suggestedName: `video.${
|
|
1024
|
+
L = await window.showSaveFilePicker({
|
|
1025
|
+
suggestedName: `video.${f}`,
|
|
987
1026
|
types: [{
|
|
988
1027
|
description: i === "mp4" ? "MPEG-4 Video" : "MPEG Transport Stream",
|
|
989
|
-
accept: { [S]: [`.${
|
|
1028
|
+
accept: { [S]: [`.${f}`] }
|
|
990
1029
|
}]
|
|
991
|
-
}), U = await
|
|
1030
|
+
}), U = await L.createWritable();
|
|
992
1031
|
} catch (k) {
|
|
993
1032
|
if (k.name === "AbortError") {
|
|
994
1033
|
this.removeNotification(o), this.notify({ type: "info", message: "Download cancelled", duration: 2e3 }), this.activeDownloads.delete(o);
|
|
@@ -996,44 +1035,44 @@ ${this.formatDuration(_)} remaining`;
|
|
|
996
1035
|
}
|
|
997
1036
|
console.warn("File System API cancelled or failed, falling back to memory", k);
|
|
998
1037
|
}
|
|
999
|
-
let
|
|
1000
|
-
const Y = Date.now(),
|
|
1001
|
-
let
|
|
1002
|
-
for (let k = 0; k <
|
|
1038
|
+
let v = !1;
|
|
1039
|
+
const Y = Date.now(), q = [];
|
|
1040
|
+
let pe = 0;
|
|
1041
|
+
for (let k = 0; k < x.length && !u.aborted; k++) {
|
|
1003
1042
|
const j = Date.now();
|
|
1004
|
-
if (j -
|
|
1005
|
-
|
|
1006
|
-
const X = Math.round((k + 1) /
|
|
1007
|
-
for (
|
|
1008
|
-
|
|
1009
|
-
let
|
|
1010
|
-
if (
|
|
1011
|
-
const ne =
|
|
1043
|
+
if (j - pe > 800 || k === 0 || k === x.length - 1) {
|
|
1044
|
+
pe = j;
|
|
1045
|
+
const X = Math.round((k + 1) / x.length * 100);
|
|
1046
|
+
for (q.push({ time: j, count: k + 1 }); q.length > 0 && j - q[0].time > 5e3; )
|
|
1047
|
+
q.shift();
|
|
1048
|
+
let G = "";
|
|
1049
|
+
if (q.length > 1) {
|
|
1050
|
+
const ne = q[0], ae = q[q.length - 1], be = ae.time - ne.time, ge = ae.count - ne.count;
|
|
1012
1051
|
if (be > 0 && ge > 0) {
|
|
1013
|
-
const Te = be / ge, je = (
|
|
1014
|
-
|
|
1052
|
+
const Te = be / ge, je = (x.length - (k + 1)) * Te;
|
|
1053
|
+
G = `
|
|
1015
1054
|
${this.formatDuration(je)} remaining`;
|
|
1016
1055
|
}
|
|
1017
1056
|
} else if (k > 0) {
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1057
|
+
const ae = (j - Y) / k, ge = (x.length - k) * ae;
|
|
1058
|
+
G = `
|
|
1020
1059
|
${this.formatDuration(ge)} remaining`;
|
|
1021
1060
|
}
|
|
1022
1061
|
this.notify({
|
|
1023
1062
|
id: o,
|
|
1024
1063
|
type: "loading",
|
|
1025
1064
|
// Cleaned string
|
|
1026
|
-
message: `Downloading segment ${k + 1}/${
|
|
1065
|
+
message: `Downloading segment ${k + 1}/${x.length}${G}`,
|
|
1027
1066
|
progress: X,
|
|
1028
1067
|
action: { label: "Cancel", onClick: () => this.cancelDownload(o) }
|
|
1029
1068
|
});
|
|
1030
1069
|
}
|
|
1031
|
-
const T = await (await this.fetchWithRetry(
|
|
1032
|
-
k === 0 && new Uint8Array(T.slice(0, 4))[0] === 71 && (
|
|
1070
|
+
const T = await (await this.fetchWithRetry(x[k], 3, void 0, u)).arrayBuffer();
|
|
1071
|
+
k === 0 && new Uint8Array(T.slice(0, 4))[0] === 71 && (v = !0, i === "mp4" && (this.notify({
|
|
1033
1072
|
type: "info",
|
|
1034
1073
|
message: "Stream is MPEG-TS. Downloading as .ts to prevent corruption.",
|
|
1035
1074
|
duration: 5e3
|
|
1036
|
-
}),
|
|
1075
|
+
}), f = "ts", S = "video/mp2t"));
|
|
1037
1076
|
const n = new Blob([T]);
|
|
1038
1077
|
U ? await U.write(n) : H.push(n);
|
|
1039
1078
|
}
|
|
@@ -1045,18 +1084,18 @@ ${this.formatDuration(ge)} remaining`;
|
|
|
1045
1084
|
this.notify({ id: o, type: "loading", message: "Stitching video", progress: 100 });
|
|
1046
1085
|
const k = new Blob(H, { type: S }), j = window.URL.createObjectURL(k), D = document.createElement("a");
|
|
1047
1086
|
D.style.display = "none", D.href = j;
|
|
1048
|
-
const T = i === "mp4" &&
|
|
1087
|
+
const T = i === "mp4" && v ? "ts" : f;
|
|
1049
1088
|
D.download = `video.${T}`, document.body.appendChild(D), D.click(), window.URL.revokeObjectURL(j), document.body.removeChild(D), this.notify({ id: o, type: "success", message: "Saved!", duration: 3e3 });
|
|
1050
1089
|
}
|
|
1051
|
-
} catch (
|
|
1052
|
-
u.aborted ? this.removeNotification(o) : this.notify({ id: o, type: "error", message: `Download failed: ${
|
|
1090
|
+
} catch (p) {
|
|
1091
|
+
u.aborted ? this.removeNotification(o) : this.notify({ id: o, type: "error", message: `Download failed: ${p.message}`, duration: 4e3 });
|
|
1053
1092
|
} finally {
|
|
1054
1093
|
this.activeDownloads.delete(o);
|
|
1055
1094
|
}
|
|
1056
1095
|
}
|
|
1057
1096
|
notify(t) {
|
|
1058
1097
|
const i = t.id || Math.random().toString(36).substr(2, 9), o = { ...t, id: i };
|
|
1059
|
-
return this.store.setState((
|
|
1098
|
+
return this.store.setState((r) => r.notifications.find((h) => h.id === i) ? { notifications: r.notifications.map((h) => h.id === i ? o : h) } : { notifications: [...r.notifications, o] }), t.duration && setTimeout(() => this.removeNotification(i), t.duration), i;
|
|
1060
1099
|
}
|
|
1061
1100
|
removeNotification(t) {
|
|
1062
1101
|
const i = this.store.get().notifications;
|
|
@@ -1069,15 +1108,15 @@ ${this.formatDuration(ge)} remaining`;
|
|
|
1069
1108
|
}));
|
|
1070
1109
|
}
|
|
1071
1110
|
destroy() {
|
|
1072
|
-
this.retryTimer && clearTimeout(this.retryTimer), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.activeDownloads.forEach((
|
|
1073
|
-
const
|
|
1074
|
-
for (;
|
|
1075
|
-
this.emit("destroy"), this.events.destroy(), this.store.destroy(), this.plugins.forEach((
|
|
1111
|
+
this.retryTimer && clearTimeout(this.retryTimer), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.activeDownloads.forEach((o) => o.abort()), this.activeDownloads.clear(), this.store.get().isWebFullscreen && typeof document < "u" && (document.body.style.overflow = ""), ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"].forEach((o) => document.removeEventListener(o, this.boundFullscreenChange)), this.video.pause(), this.video.src = "";
|
|
1112
|
+
const i = this.video.getElementsByTagName("track");
|
|
1113
|
+
for (; i.length > 0; ) i[0].remove();
|
|
1114
|
+
this.emit("destroy"), this.events.destroy(), this.store.destroy(), this.plugins.forEach((o) => o.destroy && o.destroy()), this.plugins.clear(), this.video.remove(), this.audioEngine.destroy();
|
|
1076
1115
|
}
|
|
1077
1116
|
}
|
|
1078
1117
|
const st = (s, t = 200) => {
|
|
1079
|
-
const [i, o] = M(s), [
|
|
1080
|
-
return
|
|
1118
|
+
const [i, o] = M(s), [r, u] = M(!1);
|
|
1119
|
+
return K(() => {
|
|
1081
1120
|
if (s)
|
|
1082
1121
|
o(!0), requestAnimationFrame(() => {
|
|
1083
1122
|
requestAnimationFrame(() => {
|
|
@@ -1091,18 +1130,18 @@ const st = (s, t = 200) => {
|
|
|
1091
1130
|
}, t);
|
|
1092
1131
|
return () => clearTimeout(h);
|
|
1093
1132
|
}
|
|
1094
|
-
}, [s, t]), { isMounted: i, isVisible:
|
|
1133
|
+
}, [s, t]), { isMounted: i, isVisible: r };
|
|
1095
1134
|
}, y = ({
|
|
1096
1135
|
className: s,
|
|
1097
1136
|
children: t,
|
|
1098
1137
|
fill: i = "none",
|
|
1099
1138
|
strokeWidth: o = 2,
|
|
1100
|
-
viewBox:
|
|
1139
|
+
viewBox: r = "0 0 24 24"
|
|
1101
1140
|
}) => /* @__PURE__ */ e(
|
|
1102
1141
|
"svg",
|
|
1103
1142
|
{
|
|
1104
1143
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1105
|
-
viewBox:
|
|
1144
|
+
viewBox: r,
|
|
1106
1145
|
fill: i,
|
|
1107
1146
|
stroke: "currentColor",
|
|
1108
1147
|
strokeWidth: o,
|
|
@@ -1118,7 +1157,7 @@ const st = (s, t = 200) => {
|
|
|
1118
1157
|
/* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1119
1158
|
/* @__PURE__ */ e("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1120
1159
|
/* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1121
|
-
] }),
|
|
1160
|
+
] }), $i = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1122
1161
|
/* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1123
1162
|
/* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1124
1163
|
] }), Ut = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
@@ -1168,10 +1207,10 @@ const st = (s, t = 200) => {
|
|
|
1168
1207
|
/* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
|
|
1169
1208
|
/* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
|
|
1170
1209
|
/* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
|
|
1171
|
-
] }),
|
|
1210
|
+
] }), qi = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1172
1211
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1173
1212
|
/* @__PURE__ */ e("polyline", { points: "12 6 12 12 16 14" })
|
|
1174
|
-
] }),
|
|
1213
|
+
] }), Gi = ({ className: s }) => /* @__PURE__ */ e(y, { className: s, children: /* @__PURE__ */ e("path", { d: "M5 12h14" }) }), _i = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1175
1214
|
/* @__PURE__ */ e("path", { d: "M5 12h14" }),
|
|
1176
1215
|
/* @__PURE__ */ e("path", { d: "M12 5v14" })
|
|
1177
1216
|
] }), Zt = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
@@ -1230,11 +1269,11 @@ const st = (s, t = 200) => {
|
|
|
1230
1269
|
] }), ti = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1231
1270
|
/* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
|
|
1232
1271
|
/* @__PURE__ */ e("path", { d: "m6 6 12 12" })
|
|
1233
|
-
] }),
|
|
1272
|
+
] }), rs = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1234
1273
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1235
1274
|
/* @__PURE__ */ e("path", { d: "M12 16v-4" }),
|
|
1236
1275
|
/* @__PURE__ */ e("path", { d: "M12 8h.01" })
|
|
1237
|
-
] }),
|
|
1276
|
+
] }), as = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1238
1277
|
/* @__PURE__ */ e("rect", { width: "20", height: "8", x: "2", y: "2", rx: "2", ry: "2" }),
|
|
1239
1278
|
/* @__PURE__ */ e("rect", { width: "20", height: "8", x: "2", y: "14", rx: "2", ry: "2" }),
|
|
1240
1279
|
/* @__PURE__ */ e("line", { x1: "6", x2: "6.01", y1: "6", y2: "6" }),
|
|
@@ -1258,7 +1297,7 @@ const st = (s, t = 200) => {
|
|
|
1258
1297
|
/* @__PURE__ */ e("path", { d: "M1.42 9a16 16 0 0 1 21.16 0" }),
|
|
1259
1298
|
/* @__PURE__ */ e("path", { d: "M8.53 16.11a6 6 0 0 1 6.95 0" }),
|
|
1260
1299
|
/* @__PURE__ */ e("line", { x1: "12", x2: "12.01", y1: "20", y2: "20" })
|
|
1261
|
-
] }),
|
|
1300
|
+
] }), rt = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1262
1301
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1263
1302
|
/* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
|
|
1264
1303
|
/* @__PURE__ */ e("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
|
|
@@ -1268,12 +1307,12 @@ const st = (s, t = 200) => {
|
|
|
1268
1307
|
/* @__PURE__ */ e("path", { d: "M12 20v-8" }),
|
|
1269
1308
|
/* @__PURE__ */ e("path", { d: "M17 20V8" }),
|
|
1270
1309
|
/* @__PURE__ */ e("path", { d: "M22 20V4" })
|
|
1271
|
-
] }),
|
|
1310
|
+
] }), fs = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1272
1311
|
/* @__PURE__ */ e("path", { d: "M21 7v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }),
|
|
1273
1312
|
/* @__PURE__ */ e("path", { d: "M16 2v4" }),
|
|
1274
1313
|
/* @__PURE__ */ e("path", { d: "M8 2v4" }),
|
|
1275
1314
|
/* @__PURE__ */ e("path", { d: "M3 12h18" })
|
|
1276
|
-
] }),
|
|
1315
|
+
] }), ps = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1277
1316
|
/* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
|
|
1278
1317
|
/* @__PURE__ */ e("path", { d: "m21 21-4.3-4.3" })
|
|
1279
1318
|
] }), ii = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
@@ -1285,7 +1324,7 @@ const st = (s, t = 200) => {
|
|
|
1285
1324
|
/* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" }),
|
|
1286
1325
|
/* @__PURE__ */ e("path", { d: "M12 18h.01" }),
|
|
1287
1326
|
/* @__PURE__ */ e("path", { d: "M12 12v4" })
|
|
1288
|
-
] }),
|
|
1327
|
+
] }), qt = ({ className: s }) => /* @__PURE__ */ c(y, { className: s, children: [
|
|
1289
1328
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "5" }),
|
|
1290
1329
|
/* @__PURE__ */ e("path", { d: "M12 1v2" }),
|
|
1291
1330
|
/* @__PURE__ */ e("path", { d: "M12 21v2" }),
|
|
@@ -1299,13 +1338,13 @@ const st = (s, t = 200) => {
|
|
|
1299
1338
|
/* @__PURE__ */ e("rect", { width: "18", height: "7", x: "3", y: "3", rx: "1" }),
|
|
1300
1339
|
/* @__PURE__ */ e("rect", { width: "9", height: "7", x: "3", y: "14", rx: "1" }),
|
|
1301
1340
|
/* @__PURE__ */ e("rect", { width: "5", height: "7", x: "16", y: "14", rx: "1" })
|
|
1302
|
-
] }),
|
|
1341
|
+
] }), Gt = ({ className: s }) => /* @__PURE__ */ c("div", { className: `relative flex items-center justify-center ${s}`, children: [
|
|
1303
1342
|
/* @__PURE__ */ c(y, { className: "w-full h-full", children: [
|
|
1304
1343
|
/* @__PURE__ */ e("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
1305
1344
|
/* @__PURE__ */ e("path", { d: "M3 3v5h5" })
|
|
1306
1345
|
] }),
|
|
1307
1346
|
/* @__PURE__ */ e("span", { className: "absolute inset-0 flex items-center justify-center text-[32%] font-bold select-none mt-[1px]", children: "10" })
|
|
1308
|
-
] }),
|
|
1347
|
+
] }), _t = ({ className: s }) => /* @__PURE__ */ c("div", { className: `relative flex items-center justify-center ${s}`, children: [
|
|
1309
1348
|
/* @__PURE__ */ c(y, { className: "w-full h-full", children: [
|
|
1310
1349
|
/* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
1311
1350
|
/* @__PURE__ */ e("path", { d: "M21 3v5h-5" })
|
|
@@ -1347,8 +1386,8 @@ const st = (s, t = 200) => {
|
|
|
1347
1386
|
"button",
|
|
1348
1387
|
{
|
|
1349
1388
|
onClick: (o) => {
|
|
1350
|
-
var
|
|
1351
|
-
o.stopPropagation(), (
|
|
1389
|
+
var r;
|
|
1390
|
+
o.stopPropagation(), (r = t.action) == null || r.onClick();
|
|
1352
1391
|
},
|
|
1353
1392
|
className: "text-zinc-500 hover:text-zinc-200 transition-colors p-1 -mt-1.5 -mr-1.5",
|
|
1354
1393
|
title: t.action.label,
|
|
@@ -1358,8 +1397,8 @@ const st = (s, t = 200) => {
|
|
|
1358
1397
|
] }) }) : /* @__PURE__ */ c("div", { className: "flex items-start gap-2.5", children: [
|
|
1359
1398
|
t.type === "loading" && /* @__PURE__ */ e(De, { className: "w-3.5 h-3.5 animate-spin text-[var(--accent)] shrink-0 mt-0.5" }),
|
|
1360
1399
|
t.type === "success" && /* @__PURE__ */ e(He, { className: "w-3.5 h-3.5 text-emerald-500 shrink-0 mt-0.5" }),
|
|
1361
|
-
t.type === "error" && /* @__PURE__ */ e(
|
|
1362
|
-
t.type === "warning" && /* @__PURE__ */ e(
|
|
1400
|
+
t.type === "error" && /* @__PURE__ */ e(rt, { className: "w-3.5 h-3.5 text-red-500 shrink-0 mt-0.5" }),
|
|
1401
|
+
t.type === "warning" && /* @__PURE__ */ e(rt, { className: "w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5" }),
|
|
1363
1402
|
t.type === "info" && /* @__PURE__ */ e("div", { className: "w-1.5 h-1.5 rounded-full bg-[var(--accent)] mt-1.5 shrink-0" }),
|
|
1364
1403
|
/* @__PURE__ */ c("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
|
|
1365
1404
|
/* @__PURE__ */ e("span", { className: "text-xs font-medium leading-snug break-words text-zinc-200 whitespace-pre-wrap", children: t.message }),
|
|
@@ -1367,8 +1406,8 @@ const st = (s, t = 200) => {
|
|
|
1367
1406
|
"button",
|
|
1368
1407
|
{
|
|
1369
1408
|
onClick: (o) => {
|
|
1370
|
-
var
|
|
1371
|
-
o.stopPropagation(), (
|
|
1409
|
+
var r;
|
|
1410
|
+
o.stopPropagation(), (r = t.action) == null || r.onClick();
|
|
1372
1411
|
},
|
|
1373
1412
|
className: "mt-1 self-start text-[10px] font-bold text-[var(--accent)] hover:text-white transition-colors uppercase tracking-wider",
|
|
1374
1413
|
children: t.action.label
|
|
@@ -1405,7 +1444,7 @@ const st = (s, t = 200) => {
|
|
|
1405
1444
|
style: {
|
|
1406
1445
|
bottom: `${t.verticalOffset}px`
|
|
1407
1446
|
},
|
|
1408
|
-
children: s.map((o,
|
|
1447
|
+
children: s.map((o, r) => /* @__PURE__ */ e(
|
|
1409
1448
|
"div",
|
|
1410
1449
|
{
|
|
1411
1450
|
className: "mb-1 inline-block max-w-[80%]",
|
|
@@ -1430,11 +1469,11 @@ const st = (s, t = 200) => {
|
|
|
1430
1469
|
}
|
|
1431
1470
|
)
|
|
1432
1471
|
},
|
|
1433
|
-
|
|
1472
|
+
r
|
|
1434
1473
|
))
|
|
1435
1474
|
}
|
|
1436
1475
|
);
|
|
1437
|
-
}, Oe = ({ content: s }) => typeof s == "string" ? s.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: s } }) : /* @__PURE__ */ e("span", { children: s }) : /* @__PURE__ */ e(Q, { children: s }), le = ({ label: s, checked: t, onChange: i, icon: o, tooltip:
|
|
1476
|
+
}, Oe = ({ content: s }) => typeof s == "string" ? s.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: s } }) : /* @__PURE__ */ e("span", { children: s }) : /* @__PURE__ */ e(Q, { children: s }), le = ({ label: s, checked: t, onChange: i, icon: o, tooltip: r }) => /* @__PURE__ */ c(
|
|
1438
1477
|
"div",
|
|
1439
1478
|
{
|
|
1440
1479
|
className: "flex items-center justify-between py-2.5 px-3 hover:bg-white/5 group transition-colors",
|
|
@@ -1444,7 +1483,7 @@ const st = (s, t = 200) => {
|
|
|
1444
1483
|
o && /* @__PURE__ */ e("span", { className: "text-zinc-500 group-hover:text-zinc-400 transition-colors flex items-center justify-center w-4 h-4", children: /* @__PURE__ */ e(Oe, { content: o }) }),
|
|
1445
1484
|
/* @__PURE__ */ c("div", { className: "flex flex-col", children: [
|
|
1446
1485
|
/* @__PURE__ */ e("span", { className: "text-sm text-zinc-300 font-medium group-hover:text-white transition-colors flex items-center", children: /* @__PURE__ */ e(Oe, { content: s }) }),
|
|
1447
|
-
|
|
1486
|
+
r && /* @__PURE__ */ e("span", { className: "text-[10px] text-zinc-500", children: r })
|
|
1448
1487
|
] })
|
|
1449
1488
|
] }),
|
|
1450
1489
|
/* @__PURE__ */ e(
|
|
@@ -1472,7 +1511,7 @@ const st = (s, t = 200) => {
|
|
|
1472
1511
|
)
|
|
1473
1512
|
]
|
|
1474
1513
|
}
|
|
1475
|
-
), xe = ({ label: s, value: t, min: i, max: o, step:
|
|
1514
|
+
), xe = ({ label: s, value: t, min: i, max: o, step: r, onChange: u, formatValue: h, icon: p }) => /* @__PURE__ */ c(
|
|
1476
1515
|
"div",
|
|
1477
1516
|
{
|
|
1478
1517
|
className: "py-2.5 px-3 hover:bg-white/5 group transition-colors",
|
|
@@ -1480,7 +1519,7 @@ const st = (s, t = 200) => {
|
|
|
1480
1519
|
children: [
|
|
1481
1520
|
/* @__PURE__ */ c("div", { className: "flex justify-between items-center mb-2", children: [
|
|
1482
1521
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-3", children: [
|
|
1483
|
-
|
|
1522
|
+
p && /* @__PURE__ */ e("span", { className: "text-zinc-500 group-hover:text-zinc-400 transition-colors flex items-center justify-center w-4 h-4", children: /* @__PURE__ */ e(Oe, { content: p }) }),
|
|
1484
1523
|
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: s })
|
|
1485
1524
|
] }),
|
|
1486
1525
|
/* @__PURE__ */ e(
|
|
@@ -1499,9 +1538,9 @@ const st = (s, t = 200) => {
|
|
|
1499
1538
|
type: "range",
|
|
1500
1539
|
min: i,
|
|
1501
1540
|
max: o,
|
|
1502
|
-
step:
|
|
1541
|
+
step: r,
|
|
1503
1542
|
value: t,
|
|
1504
|
-
onChange: (
|
|
1543
|
+
onChange: (b) => u(parseFloat(b.target.value)),
|
|
1505
1544
|
className: "w-full h-1.5 appearance-none cursor-pointer focus:outline-none focus:ring-2 strata-range-input",
|
|
1506
1545
|
style: {
|
|
1507
1546
|
borderRadius: "var(--radius-full)",
|
|
@@ -1530,14 +1569,14 @@ const st = (s, t = 200) => {
|
|
|
1530
1569
|
] })
|
|
1531
1570
|
]
|
|
1532
1571
|
}
|
|
1533
|
-
), ws = ({ label: s, value: t, options: i, onChange: o, icon:
|
|
1572
|
+
), ws = ({ label: s, value: t, options: i, onChange: o, icon: r }) => /* @__PURE__ */ c(
|
|
1534
1573
|
"div",
|
|
1535
1574
|
{
|
|
1536
1575
|
className: "py-2.5 px-3 hover:bg-white/5 group transition-colors",
|
|
1537
1576
|
style: { borderRadius: "var(--radius)" },
|
|
1538
1577
|
children: [
|
|
1539
1578
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-3 mb-2", children: [
|
|
1540
|
-
|
|
1579
|
+
r && /* @__PURE__ */ e("span", { className: "text-zinc-500 group-hover:text-zinc-400 transition-colors flex items-center justify-center w-4 h-4", children: /* @__PURE__ */ e(Oe, { content: r }) }),
|
|
1541
1580
|
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: s })
|
|
1542
1581
|
] }),
|
|
1543
1582
|
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
@@ -1555,7 +1594,7 @@ const st = (s, t = 200) => {
|
|
|
1555
1594
|
] })
|
|
1556
1595
|
]
|
|
1557
1596
|
}
|
|
1558
|
-
),
|
|
1597
|
+
), fe = ({ title: s, children: t }) => /* @__PURE__ */ c("div", { className: "py-2", children: [
|
|
1559
1598
|
s && /* @__PURE__ */ e("h4", { className: "px-3 text-[10px] font-bold text-[var(--accent)] uppercase tracking-wider mb-1 mt-2", children: s }),
|
|
1560
1599
|
/* @__PURE__ */ e("div", { className: "space-y-0.5", children: t })
|
|
1561
1600
|
] }), lt = ({
|
|
@@ -1563,18 +1602,18 @@ const st = (s, t = 200) => {
|
|
|
1563
1602
|
onClose: t,
|
|
1564
1603
|
align: i = "right",
|
|
1565
1604
|
maxHeight: o,
|
|
1566
|
-
className:
|
|
1605
|
+
className: r
|
|
1567
1606
|
}) => {
|
|
1568
|
-
const u = W(null), h = W(null), [
|
|
1607
|
+
const u = W(null), h = W(null), [p, b] = M("auto"), g = i === "center" ? "left-1/2 -translate-x-1/2 origin-bottom" : "right-0 origin-bottom-right";
|
|
1569
1608
|
Be(() => {
|
|
1570
1609
|
if (!h.current) return;
|
|
1571
|
-
const
|
|
1572
|
-
h.current &&
|
|
1573
|
-
},
|
|
1574
|
-
return
|
|
1610
|
+
const x = () => {
|
|
1611
|
+
h.current && b(h.current.offsetHeight);
|
|
1612
|
+
}, f = new ResizeObserver(x);
|
|
1613
|
+
return f.observe(h.current), x(), () => f.disconnect();
|
|
1575
1614
|
}, []);
|
|
1576
1615
|
const m = {
|
|
1577
|
-
height:
|
|
1616
|
+
height: p === "auto" ? "auto" : `${p + 14}px`,
|
|
1578
1617
|
// + padding
|
|
1579
1618
|
maxHeight: o ? `${o}px` : void 0
|
|
1580
1619
|
};
|
|
@@ -1582,11 +1621,11 @@ const st = (s, t = 200) => {
|
|
|
1582
1621
|
"div",
|
|
1583
1622
|
{
|
|
1584
1623
|
ref: u,
|
|
1585
|
-
className: `absolute bottom-full mb-4 ${
|
|
1624
|
+
className: `absolute bottom-full mb-4 ${g} bg-[var(--bg-panel)] backdrop-blur-xl border-[length:var(--border-width)] border-white/10 shadow-2xl overflow-hidden w-[300px] max-w-[calc(100vw-32px)] text-sm z-50 ring-1 ring-white/5 font-[family-name:var(--font-main)] flex flex-col p-1.5 transition-[height,opacity,transform] duration-300 ease-out ${r}`,
|
|
1586
1625
|
style: { ...m, borderRadius: "var(--radius-lg)" },
|
|
1587
|
-
onClick: (
|
|
1588
|
-
onMouseDown: (
|
|
1589
|
-
onTouchStart: (
|
|
1626
|
+
onClick: (x) => x.stopPropagation(),
|
|
1627
|
+
onMouseDown: (x) => x.stopPropagation(),
|
|
1628
|
+
onTouchStart: (x) => x.stopPropagation(),
|
|
1590
1629
|
children: /* @__PURE__ */ e(
|
|
1591
1630
|
"div",
|
|
1592
1631
|
{
|
|
@@ -1606,12 +1645,12 @@ const st = (s, t = 200) => {
|
|
|
1606
1645
|
className: t,
|
|
1607
1646
|
dangerouslySetInnerHTML: { __html: s }
|
|
1608
1647
|
}
|
|
1609
|
-
) : /* @__PURE__ */ e("span", { className: t, children: s }) : /* @__PURE__ */ e("span", { className: t, children: s }),
|
|
1648
|
+
) : /* @__PURE__ */ e("span", { className: t, children: s }) : /* @__PURE__ */ e("span", { className: t, children: s }), P = ({
|
|
1610
1649
|
label: s,
|
|
1611
1650
|
value: t,
|
|
1612
1651
|
active: i,
|
|
1613
1652
|
onClick: o,
|
|
1614
|
-
hasSubmenu:
|
|
1653
|
+
hasSubmenu: r,
|
|
1615
1654
|
icon: u,
|
|
1616
1655
|
rightIcon: h
|
|
1617
1656
|
}) => /* @__PURE__ */ c(
|
|
@@ -1643,11 +1682,11 @@ const st = (s, t = 200) => {
|
|
|
1643
1682
|
),
|
|
1644
1683
|
h,
|
|
1645
1684
|
i && /* @__PURE__ */ e(He, { className: "w-4 h-4 text-[var(--accent)] shrink-0" }),
|
|
1646
|
-
|
|
1685
|
+
r && /* @__PURE__ */ e("span", { className: "text-xs group-hover:translate-x-0.5 transition-transform text-zinc-500 shrink-0", children: "›" })
|
|
1647
1686
|
] })
|
|
1648
1687
|
]
|
|
1649
1688
|
}
|
|
1650
|
-
),
|
|
1689
|
+
), ee = ({
|
|
1651
1690
|
label: s,
|
|
1652
1691
|
onBack: t,
|
|
1653
1692
|
rightAction: i
|
|
@@ -1676,15 +1715,15 @@ const st = (s, t = 200) => {
|
|
|
1676
1715
|
onClose: t,
|
|
1677
1716
|
title: i,
|
|
1678
1717
|
maxHeight: o,
|
|
1679
|
-
className:
|
|
1718
|
+
className: r
|
|
1680
1719
|
}) => {
|
|
1681
|
-
const [u, h] = M([]),
|
|
1682
|
-
h((
|
|
1683
|
-
},
|
|
1684
|
-
|
|
1720
|
+
const [u, h] = M([]), p = u.length > 0 ? u[u.length - 1] : null, b = p ? p.children || [] : s, g = p ? p.html : i || "Menu", m = () => {
|
|
1721
|
+
h((f) => f.slice(0, -1));
|
|
1722
|
+
}, x = (f) => {
|
|
1723
|
+
f.children && h((S) => [...S, f]);
|
|
1685
1724
|
};
|
|
1686
|
-
return /* @__PURE__ */ e(lt, { onClose: t, maxHeight: o, className:
|
|
1687
|
-
u.length > 0 ? /* @__PURE__ */ e(
|
|
1725
|
+
return /* @__PURE__ */ e(lt, { onClose: t, maxHeight: o, className: r, children: /* @__PURE__ */ c("div", { className: "animate-in fade-in slide-in-from-right-4 duration-200", children: [
|
|
1726
|
+
u.length > 0 ? /* @__PURE__ */ e(ee, { label: g || "Menu", onBack: m }) : i && /* @__PURE__ */ e(
|
|
1688
1727
|
"div",
|
|
1689
1728
|
{
|
|
1690
1729
|
className: "px-3 py-2 mb-1 border-b border-white/5 font-bold text-zinc-400 uppercase text-[11px] tracking-wider flex justify-between items-center bg-white/5 sticky top-0 z-10 backdrop-blur-md",
|
|
@@ -1692,44 +1731,44 @@ const st = (s, t = 200) => {
|
|
|
1692
1731
|
children: /* @__PURE__ */ e("span", { children: i })
|
|
1693
1732
|
}
|
|
1694
1733
|
),
|
|
1695
|
-
/* @__PURE__ */ e("div", { className: "pb-1", children:
|
|
1734
|
+
/* @__PURE__ */ e("div", { className: "pb-1", children: b.map((f, S) => f.separator ? /* @__PURE__ */ e(me, {}, S) : f.isLabel ? /* @__PURE__ */ e(
|
|
1696
1735
|
"div",
|
|
1697
1736
|
{
|
|
1698
1737
|
className: "px-3 py-1.5 text-[10px] font-bold text-zinc-500 uppercase tracking-wider select-none",
|
|
1699
|
-
children: /* @__PURE__ */ e(Ne, { content:
|
|
1738
|
+
children: /* @__PURE__ */ e(Ne, { content: f.html || "" })
|
|
1700
1739
|
},
|
|
1701
1740
|
S
|
|
1702
|
-
) :
|
|
1741
|
+
) : f.range ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
|
|
1703
1742
|
xe,
|
|
1704
1743
|
{
|
|
1705
|
-
label:
|
|
1706
|
-
icon:
|
|
1707
|
-
value:
|
|
1708
|
-
min:
|
|
1709
|
-
max:
|
|
1710
|
-
step:
|
|
1711
|
-
onChange: (
|
|
1712
|
-
formatValue:
|
|
1744
|
+
label: f.html,
|
|
1745
|
+
icon: f.icon,
|
|
1746
|
+
value: f.value ?? f.min ?? 0,
|
|
1747
|
+
min: f.min ?? 0,
|
|
1748
|
+
max: f.max ?? 100,
|
|
1749
|
+
step: f.step ?? 1,
|
|
1750
|
+
onChange: (L) => f.onRange && f.onRange(L),
|
|
1751
|
+
formatValue: f.formatValue
|
|
1713
1752
|
}
|
|
1714
|
-
) }, S) :
|
|
1753
|
+
) }, S) : f.switch !== void 0 ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
|
|
1715
1754
|
le,
|
|
1716
1755
|
{
|
|
1717
|
-
label:
|
|
1718
|
-
icon:
|
|
1719
|
-
checked:
|
|
1720
|
-
tooltip:
|
|
1721
|
-
onChange: (
|
|
1756
|
+
label: f.html,
|
|
1757
|
+
icon: f.icon,
|
|
1758
|
+
checked: f.switch,
|
|
1759
|
+
tooltip: f.tooltip,
|
|
1760
|
+
onChange: (L) => f.onSwitch && f.onSwitch(f, L)
|
|
1722
1761
|
}
|
|
1723
1762
|
) }, S) : /* @__PURE__ */ e(Me.Fragment, { children: /* @__PURE__ */ e(
|
|
1724
|
-
|
|
1763
|
+
P,
|
|
1725
1764
|
{
|
|
1726
|
-
label:
|
|
1727
|
-
icon:
|
|
1728
|
-
value:
|
|
1729
|
-
active:
|
|
1730
|
-
hasSubmenu: !!
|
|
1765
|
+
label: f.html,
|
|
1766
|
+
icon: f.icon,
|
|
1767
|
+
value: f.currentLabel || f.value,
|
|
1768
|
+
active: f.active,
|
|
1769
|
+
hasSubmenu: !!f.children,
|
|
1731
1770
|
onClick: () => {
|
|
1732
|
-
|
|
1771
|
+
f.children ? x(f) : f.onClick ? (f.onClick(f), !f.switch && !f.range && t()) : f.click && (f.click(f), t());
|
|
1733
1772
|
}
|
|
1734
1773
|
}
|
|
1735
1774
|
) }, S)) })
|
|
@@ -1739,27 +1778,27 @@ const st = (s, t = 200) => {
|
|
|
1739
1778
|
current: t,
|
|
1740
1779
|
onSelect: i,
|
|
1741
1780
|
onUpload: o,
|
|
1742
|
-
onClose:
|
|
1781
|
+
onClose: r,
|
|
1743
1782
|
settings: u,
|
|
1744
1783
|
onSettingsChange: h,
|
|
1745
|
-
onReset:
|
|
1746
|
-
offset:
|
|
1747
|
-
onOffsetChange:
|
|
1784
|
+
onReset: p,
|
|
1785
|
+
offset: b,
|
|
1786
|
+
onOffsetChange: g,
|
|
1748
1787
|
maxHeight: m,
|
|
1749
|
-
animationClass:
|
|
1788
|
+
animationClass: x
|
|
1750
1789
|
}) => {
|
|
1751
|
-
const [
|
|
1752
|
-
(
|
|
1753
|
-
) : s, [s,
|
|
1790
|
+
const [f, S] = M("main"), [L, U] = M(""), H = W(null), _ = Ce(() => L ? s.filter(
|
|
1791
|
+
(v) => v.label.toLowerCase().includes(L.toLowerCase()) || v.srcLang && v.srcLang.toLowerCase().includes(L.toLowerCase())
|
|
1792
|
+
) : s, [s, L]);
|
|
1754
1793
|
return /* @__PURE__ */ c(
|
|
1755
1794
|
lt,
|
|
1756
1795
|
{
|
|
1757
|
-
onClose:
|
|
1796
|
+
onClose: r,
|
|
1758
1797
|
align: "right",
|
|
1759
1798
|
maxHeight: m,
|
|
1760
|
-
className:
|
|
1799
|
+
className: x,
|
|
1761
1800
|
children: [
|
|
1762
|
-
|
|
1801
|
+
f === "main" && /* @__PURE__ */ c("div", { className: "animate-in slide-in-from-left-4 fade-in duration-200 flex flex-col h-full", children: [
|
|
1763
1802
|
/* @__PURE__ */ e(
|
|
1764
1803
|
"div",
|
|
1765
1804
|
{
|
|
@@ -1770,13 +1809,13 @@ const st = (s, t = 200) => {
|
|
|
1770
1809
|
),
|
|
1771
1810
|
/* @__PURE__ */ c("div", { className: "px-1.5 pb-2 shrink-0", children: [
|
|
1772
1811
|
/* @__PURE__ */ e(
|
|
1773
|
-
|
|
1812
|
+
P,
|
|
1774
1813
|
{
|
|
1775
1814
|
label: "Upload Subtitle",
|
|
1776
1815
|
icon: /* @__PURE__ */ e(Hi, { className: "w-4 h-4" }),
|
|
1777
1816
|
onClick: () => {
|
|
1778
|
-
var
|
|
1779
|
-
return (
|
|
1817
|
+
var v;
|
|
1818
|
+
return (v = H.current) == null ? void 0 : v.click();
|
|
1780
1819
|
}
|
|
1781
1820
|
}
|
|
1782
1821
|
),
|
|
@@ -1787,14 +1826,14 @@ const st = (s, t = 200) => {
|
|
|
1787
1826
|
accept: ".vtt,.srt",
|
|
1788
1827
|
ref: H,
|
|
1789
1828
|
className: "hidden",
|
|
1790
|
-
onChange: (
|
|
1829
|
+
onChange: (v) => {
|
|
1791
1830
|
var Y;
|
|
1792
|
-
(Y =
|
|
1831
|
+
(Y = v.target.files) != null && Y[0] && o(v.target.files[0]);
|
|
1793
1832
|
}
|
|
1794
1833
|
}
|
|
1795
1834
|
),
|
|
1796
1835
|
/* @__PURE__ */ e(
|
|
1797
|
-
|
|
1836
|
+
P,
|
|
1798
1837
|
{
|
|
1799
1838
|
label: "Customize",
|
|
1800
1839
|
icon: /* @__PURE__ */ e(Zt, { className: "w-4 h-4" }),
|
|
@@ -1804,12 +1843,12 @@ const st = (s, t = 200) => {
|
|
|
1804
1843
|
),
|
|
1805
1844
|
/* @__PURE__ */ e("div", { className: "h-px bg-white/5 mx-2 my-1" }),
|
|
1806
1845
|
/* @__PURE__ */ e(
|
|
1807
|
-
|
|
1846
|
+
P,
|
|
1808
1847
|
{
|
|
1809
1848
|
label: "Off",
|
|
1810
1849
|
active: t === -1,
|
|
1811
1850
|
onClick: () => {
|
|
1812
|
-
i(-1),
|
|
1851
|
+
i(-1), r();
|
|
1813
1852
|
}
|
|
1814
1853
|
}
|
|
1815
1854
|
),
|
|
@@ -1819,44 +1858,44 @@ const st = (s, t = 200) => {
|
|
|
1819
1858
|
{
|
|
1820
1859
|
type: "text",
|
|
1821
1860
|
placeholder: "Search subtitles...",
|
|
1822
|
-
value:
|
|
1823
|
-
onChange: (
|
|
1861
|
+
value: L,
|
|
1862
|
+
onChange: (v) => U(v.target.value),
|
|
1824
1863
|
className: "w-full bg-zinc-800/50 border border-white/10 rounded-md py-1.5 pl-8 pr-3 text-xs text-zinc-200 focus:outline-none focus:border-white/20 transition-colors"
|
|
1825
1864
|
}
|
|
1826
1865
|
),
|
|
1827
|
-
/* @__PURE__ */ e(
|
|
1866
|
+
/* @__PURE__ */ e(ps, { className: "w-3.5 h-3.5 text-zinc-500 absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" })
|
|
1828
1867
|
] })
|
|
1829
1868
|
] }),
|
|
1830
1869
|
/* @__PURE__ */ c("div", { className: "overflow-y-auto hide-scrollbar flex-1", children: [
|
|
1831
|
-
|
|
1870
|
+
_.map((v) => {
|
|
1832
1871
|
let Y = null;
|
|
1833
|
-
return
|
|
1834
|
-
|
|
1872
|
+
return v.status === "loading" ? Y = /* @__PURE__ */ e(De, { className: "w-3.5 h-3.5 animate-spin text-[var(--accent)]" }) : v.status === "error" ? Y = /* @__PURE__ */ e(bs, { className: "w-3.5 h-3.5 text-red-500" }) : v.status === "success" && (Y = /* @__PURE__ */ e(ii, { className: "w-3.5 h-3.5 text-emerald-500" })), /* @__PURE__ */ e(
|
|
1873
|
+
P,
|
|
1835
1874
|
{
|
|
1836
|
-
label:
|
|
1837
|
-
value:
|
|
1838
|
-
active: t ===
|
|
1875
|
+
label: v.label,
|
|
1876
|
+
value: v.srcLang,
|
|
1877
|
+
active: t === v.index,
|
|
1839
1878
|
rightIcon: Y,
|
|
1840
1879
|
onClick: () => {
|
|
1841
|
-
i(
|
|
1880
|
+
i(v.index), r();
|
|
1842
1881
|
}
|
|
1843
1882
|
},
|
|
1844
|
-
|
|
1883
|
+
v.index
|
|
1845
1884
|
);
|
|
1846
1885
|
}),
|
|
1847
|
-
|
|
1886
|
+
_.length === 0 && L && /* @__PURE__ */ e("div", { className: "px-4 py-3 text-center text-xs text-zinc-500", children: "No results found" })
|
|
1848
1887
|
] })
|
|
1849
1888
|
] }),
|
|
1850
|
-
|
|
1889
|
+
f === "customize" && /* @__PURE__ */ c("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
|
|
1851
1890
|
/* @__PURE__ */ e(
|
|
1852
|
-
|
|
1891
|
+
ee,
|
|
1853
1892
|
{
|
|
1854
1893
|
label: "Customize",
|
|
1855
1894
|
onBack: () => S("main"),
|
|
1856
1895
|
rightAction: /* @__PURE__ */ e(
|
|
1857
1896
|
"button",
|
|
1858
1897
|
{
|
|
1859
|
-
onClick:
|
|
1898
|
+
onClick: p,
|
|
1860
1899
|
className: "p-1.5 text-zinc-400 hover:text-white transition-colors rounded-md hover:bg-white/10",
|
|
1861
1900
|
title: "Reset All",
|
|
1862
1901
|
children: /* @__PURE__ */ e(Ji, { className: "w-4 h-4" })
|
|
@@ -1865,41 +1904,41 @@ const st = (s, t = 200) => {
|
|
|
1865
1904
|
}
|
|
1866
1905
|
),
|
|
1867
1906
|
/* @__PURE__ */ c("div", { className: "pb-1", children: [
|
|
1868
|
-
/* @__PURE__ */ e(
|
|
1907
|
+
/* @__PURE__ */ e(fe, { children: /* @__PURE__ */ e(
|
|
1869
1908
|
le,
|
|
1870
1909
|
{
|
|
1871
1910
|
label: "Native Video Subtitle",
|
|
1872
1911
|
checked: u.useNative,
|
|
1873
|
-
onChange: (
|
|
1912
|
+
onChange: (v) => h({ useNative: v })
|
|
1874
1913
|
}
|
|
1875
1914
|
) }),
|
|
1876
1915
|
!u.useNative && /* @__PURE__ */ c(Q, { children: [
|
|
1877
|
-
/* @__PURE__ */ c(
|
|
1916
|
+
/* @__PURE__ */ c(fe, { title: "Sync & Position", children: [
|
|
1878
1917
|
/* @__PURE__ */ c("div", { className: "py-2.5 px-3 rounded-lg hover:bg-white/5 group transition-colors", children: [
|
|
1879
1918
|
/* @__PURE__ */ e("div", { className: "flex justify-between items-center mb-2", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-3", children: [
|
|
1880
|
-
/* @__PURE__ */ e(
|
|
1919
|
+
/* @__PURE__ */ e(qi, { className: "w-4 h-4 text-zinc-500 group-hover:text-zinc-400 transition-colors" }),
|
|
1881
1920
|
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: "Sync Offset" })
|
|
1882
1921
|
] }) }),
|
|
1883
1922
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
|
|
1884
1923
|
/* @__PURE__ */ e(
|
|
1885
1924
|
"button",
|
|
1886
1925
|
{
|
|
1887
|
-
onClick: () =>
|
|
1926
|
+
onClick: () => g(Math.round((b - 0.1) * 10) / 10),
|
|
1888
1927
|
className: "w-8 h-8 flex items-center justify-center bg-zinc-800 rounded-lg hover:bg-zinc-700 text-zinc-300 transition-colors active:scale-95",
|
|
1889
|
-
children: /* @__PURE__ */ e(
|
|
1928
|
+
children: /* @__PURE__ */ e(Gi, { className: "w-4 h-4" })
|
|
1890
1929
|
}
|
|
1891
1930
|
),
|
|
1892
1931
|
/* @__PURE__ */ c("div", { className: "flex-1 bg-zinc-900 border border-white/5 rounded-lg h-8 flex items-center justify-center text-xs font-mono font-medium text-[var(--accent)]", children: [
|
|
1893
|
-
|
|
1894
|
-
(
|
|
1932
|
+
b > 0 ? "+" : "",
|
|
1933
|
+
(b == null ? void 0 : b.toFixed(1)) || "0.0",
|
|
1895
1934
|
"s"
|
|
1896
1935
|
] }),
|
|
1897
1936
|
/* @__PURE__ */ e(
|
|
1898
1937
|
"button",
|
|
1899
1938
|
{
|
|
1900
|
-
onClick: () =>
|
|
1939
|
+
onClick: () => g(Math.round((b + 0.1) * 10) / 10),
|
|
1901
1940
|
className: "w-8 h-8 flex items-center justify-center bg-zinc-800 rounded-lg hover:bg-zinc-700 text-zinc-300 transition-colors active:scale-95",
|
|
1902
|
-
children: /* @__PURE__ */ e(
|
|
1941
|
+
children: /* @__PURE__ */ e(_i, { className: "w-4 h-4" })
|
|
1903
1942
|
}
|
|
1904
1943
|
)
|
|
1905
1944
|
] })
|
|
@@ -1913,12 +1952,12 @@ const st = (s, t = 200) => {
|
|
|
1913
1952
|
min: 0,
|
|
1914
1953
|
max: 200,
|
|
1915
1954
|
step: 5,
|
|
1916
|
-
onChange: (
|
|
1917
|
-
formatValue: (
|
|
1955
|
+
onChange: (v) => h({ verticalOffset: v }),
|
|
1956
|
+
formatValue: (v) => `${v}px`
|
|
1918
1957
|
}
|
|
1919
1958
|
)
|
|
1920
1959
|
] }),
|
|
1921
|
-
/* @__PURE__ */ c(
|
|
1960
|
+
/* @__PURE__ */ c(fe, { title: "Appearance", children: [
|
|
1922
1961
|
/* @__PURE__ */ e(
|
|
1923
1962
|
xe,
|
|
1924
1963
|
{
|
|
@@ -1928,8 +1967,8 @@ const st = (s, t = 200) => {
|
|
|
1928
1967
|
min: 50,
|
|
1929
1968
|
max: 200,
|
|
1930
1969
|
step: 10,
|
|
1931
|
-
onChange: (
|
|
1932
|
-
formatValue: (
|
|
1970
|
+
onChange: (v) => h({ textSize: v }),
|
|
1971
|
+
formatValue: (v) => `${v}%`
|
|
1933
1972
|
}
|
|
1934
1973
|
),
|
|
1935
1974
|
/* @__PURE__ */ c("div", { className: "py-2.5 px-3 rounded-lg hover:bg-white/5 group transition-colors", children: [
|
|
@@ -1945,17 +1984,17 @@ const st = (s, t = 200) => {
|
|
|
1945
1984
|
"#ff00ff",
|
|
1946
1985
|
"#ff0000",
|
|
1947
1986
|
"#00ff00"
|
|
1948
|
-
].map((
|
|
1987
|
+
].map((v) => /* @__PURE__ */ e(
|
|
1949
1988
|
"button",
|
|
1950
1989
|
{
|
|
1951
|
-
onClick: () => h({ textColor:
|
|
1952
|
-
className: `w-6 h-6 rounded-full border border-white/10 transition-transform hover:scale-110 ${u.textColor ===
|
|
1990
|
+
onClick: () => h({ textColor: v }),
|
|
1991
|
+
className: `w-6 h-6 rounded-full border border-white/10 transition-transform hover:scale-110 ${u.textColor === v ? "ring-2 scale-110" : ""}`,
|
|
1953
1992
|
style: {
|
|
1954
|
-
backgroundColor:
|
|
1993
|
+
backgroundColor: v,
|
|
1955
1994
|
"--tw-ring-color": "var(--accent)"
|
|
1956
1995
|
}
|
|
1957
1996
|
},
|
|
1958
|
-
|
|
1997
|
+
v
|
|
1959
1998
|
)),
|
|
1960
1999
|
/* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/10 mx-1" }),
|
|
1961
2000
|
/* @__PURE__ */ e("div", { className: "relative w-6 h-6 rounded-full overflow-hidden ring-1 ring-white/20 cursor-pointer", children: /* @__PURE__ */ e(
|
|
@@ -1963,7 +2002,7 @@ const st = (s, t = 200) => {
|
|
|
1963
2002
|
{
|
|
1964
2003
|
type: "color",
|
|
1965
2004
|
value: u.textColor,
|
|
1966
|
-
onChange: (
|
|
2005
|
+
onChange: (v) => h({ textColor: v.target.value }),
|
|
1967
2006
|
className: "absolute inset-[-4px] w-[150%] h-[150%] cursor-pointer p-0 border-0"
|
|
1968
2007
|
}
|
|
1969
2008
|
) })
|
|
@@ -1981,8 +2020,8 @@ const st = (s, t = 200) => {
|
|
|
1981
2020
|
{ label: "Depressed", value: "depressed" },
|
|
1982
2021
|
{ label: "Drop Shadow", value: "shadow" }
|
|
1983
2022
|
],
|
|
1984
|
-
onChange: (
|
|
1985
|
-
textStyle:
|
|
2023
|
+
onChange: (v) => h({
|
|
2024
|
+
textStyle: v
|
|
1986
2025
|
})
|
|
1987
2026
|
}
|
|
1988
2027
|
),
|
|
@@ -1993,7 +2032,7 @@ const st = (s, t = 200) => {
|
|
|
1993
2032
|
label: "Bold",
|
|
1994
2033
|
icon: /* @__PURE__ */ e(Ki, { className: "w-4 h-4" }),
|
|
1995
2034
|
checked: u.isBold,
|
|
1996
|
-
onChange: (
|
|
2035
|
+
onChange: (v) => h({ isBold: v })
|
|
1997
2036
|
}
|
|
1998
2037
|
),
|
|
1999
2038
|
/* @__PURE__ */ e(
|
|
@@ -2002,12 +2041,12 @@ const st = (s, t = 200) => {
|
|
|
2002
2041
|
label: "Fix Caps",
|
|
2003
2042
|
icon: /* @__PURE__ */ e(Zi, { className: "w-4 h-4" }),
|
|
2004
2043
|
checked: u.fixCapitalization,
|
|
2005
|
-
onChange: (
|
|
2044
|
+
onChange: (v) => h({ fixCapitalization: v })
|
|
2006
2045
|
}
|
|
2007
2046
|
)
|
|
2008
2047
|
] })
|
|
2009
2048
|
] }),
|
|
2010
|
-
/* @__PURE__ */ c(
|
|
2049
|
+
/* @__PURE__ */ c(fe, { title: "Background", children: [
|
|
2011
2050
|
/* @__PURE__ */ e(
|
|
2012
2051
|
xe,
|
|
2013
2052
|
{
|
|
@@ -2017,8 +2056,8 @@ const st = (s, t = 200) => {
|
|
|
2017
2056
|
min: 0,
|
|
2018
2057
|
max: 100,
|
|
2019
2058
|
step: 5,
|
|
2020
|
-
onChange: (
|
|
2021
|
-
formatValue: (
|
|
2059
|
+
onChange: (v) => h({ backgroundOpacity: v }),
|
|
2060
|
+
formatValue: (v) => `${v}%`
|
|
2022
2061
|
}
|
|
2023
2062
|
),
|
|
2024
2063
|
/* @__PURE__ */ e(
|
|
@@ -2027,7 +2066,7 @@ const st = (s, t = 200) => {
|
|
|
2027
2066
|
label: "Blur Background",
|
|
2028
2067
|
icon: /* @__PURE__ */ e(es, { className: "w-4 h-4" }),
|
|
2029
2068
|
checked: u.backgroundBlur,
|
|
2030
|
-
onChange: (
|
|
2069
|
+
onChange: (v) => h({ backgroundBlur: v })
|
|
2031
2070
|
}
|
|
2032
2071
|
),
|
|
2033
2072
|
u.backgroundBlur && /* @__PURE__ */ e(
|
|
@@ -2038,8 +2077,8 @@ const st = (s, t = 200) => {
|
|
|
2038
2077
|
min: 0,
|
|
2039
2078
|
max: 20,
|
|
2040
2079
|
step: 1,
|
|
2041
|
-
onChange: (
|
|
2042
|
-
formatValue: (
|
|
2080
|
+
onChange: (v) => h({ backgroundBlurAmount: v }),
|
|
2081
|
+
formatValue: (v) => `${v}px`
|
|
2043
2082
|
}
|
|
2044
2083
|
)
|
|
2045
2084
|
] })
|
|
@@ -2049,88 +2088,88 @@ const st = (s, t = 200) => {
|
|
|
2049
2088
|
]
|
|
2050
2089
|
}
|
|
2051
2090
|
);
|
|
2052
|
-
}, nt = ({ content: s }) => typeof s == "string" ? s.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: s } }) : /* @__PURE__ */ e("span", { children: s }) : /* @__PURE__ */ e(Q, { children: s }), ks = ({ x: s, y: t, items: i, onClose: o, containerWidth:
|
|
2053
|
-
const h = W(null), [
|
|
2091
|
+
}, nt = ({ content: s }) => typeof s == "string" ? s.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: s } }) : /* @__PURE__ */ e("span", { children: s }) : /* @__PURE__ */ e(Q, { children: s }), ks = ({ x: s, y: t, items: i, onClose: o, containerWidth: r, containerHeight: u }) => {
|
|
2092
|
+
const h = W(null), [p, b] = M({
|
|
2054
2093
|
top: t,
|
|
2055
2094
|
left: s,
|
|
2056
2095
|
opacity: 0
|
|
2057
2096
|
});
|
|
2058
2097
|
return Be(() => {
|
|
2059
2098
|
if (!h.current) return;
|
|
2060
|
-
const
|
|
2061
|
-
let
|
|
2062
|
-
s + m >
|
|
2063
|
-
let
|
|
2064
|
-
S < 10 && (S = 10), S +
|
|
2099
|
+
const g = h.current.getBoundingClientRect(), m = g.width, x = g.height;
|
|
2100
|
+
let f = s, S = t;
|
|
2101
|
+
s + m > r - 10 && (f = s - m), f < 10 && (f = 10), f + m > r && (f = Math.max(10, r - m - 10)), t + x > u - 10 && (S = t - x);
|
|
2102
|
+
let L = u - 20;
|
|
2103
|
+
S < 10 && (S = 10), S + x > u - 10 && (S = Math.max(10, u - x - 10)), b({
|
|
2065
2104
|
top: S,
|
|
2066
|
-
left:
|
|
2067
|
-
maxHeight:
|
|
2105
|
+
left: f,
|
|
2106
|
+
maxHeight: L,
|
|
2068
2107
|
opacity: 1
|
|
2069
2108
|
});
|
|
2070
|
-
}, [s, t, i,
|
|
2071
|
-
const
|
|
2109
|
+
}, [s, t, i, r, u]), K(() => {
|
|
2110
|
+
const g = (m) => {
|
|
2072
2111
|
h.current && !h.current.contains(m.target) && o();
|
|
2073
2112
|
};
|
|
2074
|
-
return document.addEventListener("mousedown",
|
|
2113
|
+
return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
|
|
2075
2114
|
}, [o]), /* @__PURE__ */ e(
|
|
2076
2115
|
"div",
|
|
2077
2116
|
{
|
|
2078
2117
|
ref: h,
|
|
2079
2118
|
className: "absolute z-50 min-w-[200px] bg-[var(--bg-panel)] backdrop-blur-xl border-[length:var(--border-width)] border-white/10 shadow-2xl p-1.5 font-[family-name:var(--font-main)] overflow-y-auto hide-scrollbar flex flex-col",
|
|
2080
2119
|
style: {
|
|
2081
|
-
top:
|
|
2082
|
-
left:
|
|
2083
|
-
maxHeight:
|
|
2084
|
-
opacity:
|
|
2120
|
+
top: p.top,
|
|
2121
|
+
left: p.left,
|
|
2122
|
+
maxHeight: p.maxHeight,
|
|
2123
|
+
opacity: p.opacity,
|
|
2085
2124
|
borderRadius: "var(--radius-lg)"
|
|
2086
2125
|
},
|
|
2087
|
-
onClick: (
|
|
2088
|
-
onMouseDown: (
|
|
2089
|
-
onTouchStart: (
|
|
2090
|
-
children: i.map((
|
|
2126
|
+
onClick: (g) => g.stopPropagation(),
|
|
2127
|
+
onMouseDown: (g) => g.stopPropagation(),
|
|
2128
|
+
onTouchStart: (g) => g.stopPropagation(),
|
|
2129
|
+
children: i.map((g, m) => g.separator ? /* @__PURE__ */ e("div", { className: "h-0 border-t border-white/10 mx-2 my-1.5" }, m) : g.isLabel ? /* @__PURE__ */ e("div", { className: "px-3 py-1.5 text-[10px] font-bold text-zinc-500 uppercase tracking-wider select-none", children: /* @__PURE__ */ e(nt, { content: g.html || "" }) }, m) : /* @__PURE__ */ c(Me.Fragment, { children: [
|
|
2091
2130
|
/* @__PURE__ */ c(
|
|
2092
2131
|
"button",
|
|
2093
2132
|
{
|
|
2094
2133
|
onClick: () => {
|
|
2095
|
-
|
|
2134
|
+
g.disabled || (g.click ? g.click(o) : g.onClick && g.onClick(o));
|
|
2096
2135
|
},
|
|
2097
|
-
disabled:
|
|
2136
|
+
disabled: g.disabled,
|
|
2098
2137
|
className: "w-full text-left px-3 py-2.5 flex items-center justify-between hover:bg-white/10 focus:bg-white/10 focus:outline-none transition-colors text-sm text-zinc-200 disabled:opacity-50 disabled:cursor-not-allowed group my-0.5",
|
|
2099
2138
|
style: { borderRadius: "var(--radius)" },
|
|
2100
2139
|
children: [
|
|
2101
2140
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
2102
|
-
|
|
2103
|
-
/* @__PURE__ */ e("span", { className: `flex items-center font-medium truncate ${
|
|
2141
|
+
g.icon && /* @__PURE__ */ e("span", { className: "text-zinc-400 w-4 h-4 flex items-center justify-center shrink-0 group-hover:text-zinc-300 transition-colors", children: /* @__PURE__ */ e(nt, { content: g.icon }) }),
|
|
2142
|
+
/* @__PURE__ */ e("span", { className: `flex items-center font-medium truncate ${g.checked ? "text-[var(--accent)]" : ""}`, children: /* @__PURE__ */ e(nt, { content: g.html || "" }) })
|
|
2104
2143
|
] }),
|
|
2105
|
-
|
|
2144
|
+
g.checked && /* @__PURE__ */ e(He, { className: "w-4 h-4 text-[var(--accent)] shrink-0 ml-2" })
|
|
2106
2145
|
]
|
|
2107
2146
|
}
|
|
2108
2147
|
),
|
|
2109
|
-
|
|
2148
|
+
g.showBorder && /* @__PURE__ */ e("div", { className: "h-0 border-t border-white/10 mx-2 my-1" })
|
|
2110
2149
|
] }, m))
|
|
2111
2150
|
}
|
|
2112
2151
|
);
|
|
2113
2152
|
}, Ss = ({ player: s, onClose: t }) => {
|
|
2114
2153
|
const [i, o] = M({});
|
|
2115
|
-
return
|
|
2116
|
-
const
|
|
2117
|
-
var
|
|
2154
|
+
return K(() => {
|
|
2155
|
+
const r = () => {
|
|
2156
|
+
var b;
|
|
2118
2157
|
if (!s.video) return;
|
|
2119
|
-
const h = s.video,
|
|
2158
|
+
const h = s.video, p = h.getVideoPlaybackQuality ? h.getVideoPlaybackQuality() : null;
|
|
2120
2159
|
o({
|
|
2121
2160
|
"Player Size": `${h.offsetWidth} x ${h.offsetHeight}`,
|
|
2122
2161
|
"Video Resolution": `${h.videoWidth} x ${h.videoHeight}`,
|
|
2123
2162
|
"Current Time": `${h.currentTime.toFixed(3)}s`,
|
|
2124
2163
|
Duration: `${h.duration.toFixed(3)}s`,
|
|
2125
2164
|
Volume: `${Math.round(h.volume * 100)}%`,
|
|
2126
|
-
"Dropped Frames":
|
|
2165
|
+
"Dropped Frames": p ? p.droppedVideoFrames : "N/A",
|
|
2127
2166
|
Buffer: h.buffered.length > 0 ? `${(h.buffered.end(h.buffered.length - 1) - h.currentTime).toFixed(2)}s` : "0s",
|
|
2128
|
-
Engine: ((
|
|
2167
|
+
Engine: ((b = s.store.get().sources[s.store.get().currentSourceIndex]) == null ? void 0 : b.type) || "native",
|
|
2129
2168
|
URL: h.currentSrc
|
|
2130
2169
|
});
|
|
2131
2170
|
};
|
|
2132
|
-
|
|
2133
|
-
const u = setInterval(
|
|
2171
|
+
r();
|
|
2172
|
+
const u = setInterval(r, 1e3);
|
|
2134
2173
|
return () => clearInterval(u);
|
|
2135
2174
|
}, [s]), /* @__PURE__ */ e("div", { className: "absolute inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200", children: /* @__PURE__ */ c(
|
|
2136
2175
|
"div",
|
|
@@ -2142,8 +2181,8 @@ const st = (s, t = 200) => {
|
|
|
2142
2181
|
/* @__PURE__ */ e(
|
|
2143
2182
|
"button",
|
|
2144
2183
|
{
|
|
2145
|
-
onClick: (
|
|
2146
|
-
|
|
2184
|
+
onClick: (r) => {
|
|
2185
|
+
r.stopPropagation(), t();
|
|
2147
2186
|
},
|
|
2148
2187
|
className: "absolute top-3 right-3 p-1.5 text-zinc-400 hover:text-white hover:bg-white/10 rounded-full transition-colors",
|
|
2149
2188
|
children: /* @__PURE__ */ e(ti, { className: "w-4 h-4" })
|
|
@@ -2151,10 +2190,10 @@ const st = (s, t = 200) => {
|
|
|
2151
2190
|
),
|
|
2152
2191
|
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-white mb-4 uppercase tracking-wider border-b border-white/10 pb-2", children: "Video Statistics" })
|
|
2153
2192
|
] }),
|
|
2154
|
-
/* @__PURE__ */ e("div", { className: "overflow-y-auto hide-scrollbar p-5 pt-0 space-y-2.5 flex-1 min-h-0", children: Object.entries(i).map(([
|
|
2155
|
-
/* @__PURE__ */ e("span", { className: "text-zinc-500 font-bold shrink-0", children:
|
|
2193
|
+
/* @__PURE__ */ e("div", { className: "overflow-y-auto hide-scrollbar p-5 pt-0 space-y-2.5 flex-1 min-h-0", children: Object.entries(i).map(([r, u]) => /* @__PURE__ */ c("div", { className: "flex flex-col sm:flex-row sm:justify-between sm:items-center gap-1", children: [
|
|
2194
|
+
/* @__PURE__ */ e("span", { className: "text-zinc-500 font-bold shrink-0", children: r }),
|
|
2156
2195
|
/* @__PURE__ */ e("span", { className: "text-zinc-200 truncate select-all font-medium bg-white/5 px-1.5 py-0.5 rounded break-all text-right", title: String(u), children: String(u) })
|
|
2157
|
-
] },
|
|
2196
|
+
] }, r)) })
|
|
2158
2197
|
]
|
|
2159
2198
|
}
|
|
2160
2199
|
) });
|
|
@@ -2179,30 +2218,30 @@ const Ns = [
|
|
|
2179
2218
|
{ label: "Hacker", value: "hacker", color: "#22c55e" }
|
|
2180
2219
|
], Qt = ({ content: s, className: t, style: i }) => typeof s == "string" ? s.trim().startsWith("<") ? /* @__PURE__ */ e("div", { className: t, style: i, dangerouslySetInnerHTML: { __html: s } }) : /* @__PURE__ */ e("div", { className: t, style: i, children: s }) : /* @__PURE__ */ e("div", { className: t, style: i, children: s }), Yt = (s) => {
|
|
2181
2220
|
var Dt, Ot;
|
|
2182
|
-
const { src: t, type: i, sources: o, poster:
|
|
2221
|
+
const { src: t, type: i, sources: o, poster: r, autoPlay: u, thumbnails: h, textTracks: p, plugins: b, onGetInstance: g, ...m } = s, x = m.screenshot ?? !1, f = m.pip ?? !0, S = m.setting ?? !0, L = m.fullscreen ?? !0, U = m.fullscreenWeb ?? !1, H = m.lock ?? !1, _ = m.fastForward ?? !0, v = m.flip ?? !0, Y = m.aspectRatio ?? !0, q = m.hotKey ?? !0, pe = m.backdrop ?? !0, k = m.gestureSeek ?? !1, j = m.centerControls ?? !0, D = m.fetchTimeout ?? 3e4;
|
|
2183
2222
|
m.autoOrientation;
|
|
2184
|
-
const T = W(null), [n, X] = M(null), [
|
|
2223
|
+
const T = W(null), [n, X] = M(null), [G, ne] = M(!1), [ae, be] = M(0), [ge, Te] = M(0), [We, je] = M(!1), ct = Ce(() => Kt(m), []), a = Ni(
|
|
2185
2224
|
Ve((d) => n ? n.store.subscribe(d) : () => {
|
|
2186
2225
|
}, [n]),
|
|
2187
2226
|
() => n ? n.store.get() : ct,
|
|
2188
2227
|
() => ct
|
|
2189
|
-
), si = Ce(() => Cs(
|
|
2190
|
-
|
|
2191
|
-
const [oe, ht] = M({ x: 0, y: 0, visible: !1 }), [ni, mt] = M(!1),
|
|
2192
|
-
(V || B ||
|
|
2193
|
-
}, [V, B,
|
|
2194
|
-
|
|
2228
|
+
), si = Ce(() => Cs(a.themeColor), [a.themeColor]), [V, dt] = M(!1), [B, ut] = M(!1), [J, A] = M("main"), [$, Ue] = M(null), qe = W(null);
|
|
2229
|
+
$ && (qe.current = $);
|
|
2230
|
+
const [oe, ht] = M({ x: 0, y: 0, visible: !1 }), [ni, mt] = M(!1), ft = st(V, 300), pt = st(B, 300), ze = st(!!$, 300), z = Ve(() => {
|
|
2231
|
+
(V || B || $ || oe.visible) && (dt(!1), ut(!1), Ue(null), ht((d) => ({ ...d, visible: !1 })));
|
|
2232
|
+
}, [V, B, $, oe.visible]);
|
|
2233
|
+
K(() => {
|
|
2195
2234
|
const d = (w) => {
|
|
2196
|
-
(V || B ||
|
|
2235
|
+
(V || B || $ || oe.visible) && z();
|
|
2197
2236
|
};
|
|
2198
|
-
return (V || B ||
|
|
2237
|
+
return (V || B || $ || oe.visible) && (document.addEventListener("click", d), document.addEventListener("touchstart", d)), () => {
|
|
2199
2238
|
document.removeEventListener("click", d), document.removeEventListener("touchstart", d);
|
|
2200
2239
|
};
|
|
2201
|
-
}, [V, B,
|
|
2202
|
-
const [
|
|
2240
|
+
}, [V, B, $, oe.visible, z]);
|
|
2241
|
+
const [Ge, Ie] = M(!1), [Fe, _e] = M(0), [oi, bt] = M(!1), [ri, gt] = M(!1), [Re, ve] = M(!1), [vt, Xe] = M(!1), [xt, wt] = M([]), [yt, kt] = M(null), [ai, li] = M(0), [ce, St] = M(null), [ue, Pe] = M(null), [Ts, Ct] = M(null), [Qe, Nt] = M(!1), Ye = W(null), Mt = W(1), we = W(null), Ee = W(null), Tt = W(0), zt = W(0), It = W(0), te = W(null), ye = W(!1), ke = W(null), de = W(null), Je = W(null), Ke = W(null), Se = W(null);
|
|
2203
2242
|
Be(() => {
|
|
2204
2243
|
n && T.current && n.attach(T.current);
|
|
2205
|
-
}, [n,
|
|
2244
|
+
}, [n, a.isWebFullscreen]), Be(() => {
|
|
2206
2245
|
if (!T.current) return;
|
|
2207
2246
|
(() => {
|
|
2208
2247
|
T.current && (be(T.current.clientHeight), Te(T.current.clientWidth));
|
|
@@ -2214,36 +2253,38 @@ const Ns = [
|
|
|
2214
2253
|
return w.observe(T.current), () => {
|
|
2215
2254
|
w.disconnect();
|
|
2216
2255
|
};
|
|
2217
|
-
}, [
|
|
2256
|
+
}, [a.isWebFullscreen]), K(() => {
|
|
2218
2257
|
if (je("ontouchstart" in window || navigator.maxTouchPoints > 0), !T.current) return;
|
|
2219
|
-
const d = new
|
|
2220
|
-
return
|
|
2258
|
+
const d = new Li({ ...m, poster: r });
|
|
2259
|
+
return b && b.length > 0 && b.forEach((w) => d.use(w)), d.attach(T.current), X(d), g && g(d), () => {
|
|
2221
2260
|
d.destroy(), X(null);
|
|
2222
2261
|
};
|
|
2223
|
-
}, []),
|
|
2262
|
+
}, []), K(() => {
|
|
2224
2263
|
if (!n) return;
|
|
2225
2264
|
const d = {};
|
|
2226
|
-
m.theme !== void 0 && m.theme !==
|
|
2227
|
-
}, [n, m.theme, m.themeColor, m.iconSize, m.volume, m.muted, m.brightness, m.videoFit]),
|
|
2265
|
+
m.theme !== void 0 && m.theme !== a.theme && (d.theme = m.theme), m.themeColor !== void 0 && m.themeColor !== a.themeColor && (d.themeColor = m.themeColor), m.iconSize !== void 0 && m.iconSize !== a.iconSize && (d.iconSize = m.iconSize), m.brightness !== void 0 && Math.abs(m.brightness - a.brightness) > 0.05 && n.setBrightness(m.brightness), m.videoFit !== void 0 && m.videoFit !== a.videoFit && n.setVideoFit(m.videoFit), Object.keys(d).length > 0 && n.setAppearance(d), m.volume !== void 0 && Math.abs(m.volume - a.volume) > 0.01 && n.setVolume(m.volume), m.muted !== void 0 && m.muted !== a.isMuted && (m.muted ? n.video.muted = !0 : n.video.muted = !1);
|
|
2266
|
+
}, [n, m.theme, m.themeColor, m.iconSize, m.volume, m.muted, m.brightness, m.videoFit]), K(() => {
|
|
2228
2267
|
if (!n) return;
|
|
2229
|
-
const d =
|
|
2268
|
+
const d = p || [];
|
|
2230
2269
|
o && o.length > 0 ? (ne(!1), n.setSources(o, d)) : t && (ne(!1), n.setSources([{ url: t, type: i || "auto" }], d));
|
|
2231
|
-
}, [t, i, o,
|
|
2270
|
+
}, [t, i, o, n]), K(() => {
|
|
2271
|
+
!n || !p || n.setTextTracks(p);
|
|
2272
|
+
}, [p, n]), K(() => {
|
|
2232
2273
|
n && u && n.play().catch(() => {
|
|
2233
2274
|
n.pause(), n.store.setState({ isPlaying: !1, isBuffering: !1 }), n.notify({ type: "warning", message: "Autoplay blocked by browser. Click play to start.", duration: 5e3 });
|
|
2234
2275
|
});
|
|
2235
|
-
}, [n, u]),
|
|
2236
|
-
|
|
2237
|
-
}, [
|
|
2238
|
-
h && n ?
|
|
2239
|
-
}, [h, n, D]),
|
|
2240
|
-
|
|
2276
|
+
}, [n, u]), K(() => {
|
|
2277
|
+
a.isPlaying && !G && ne(!0);
|
|
2278
|
+
}, [a.isPlaying, G]), K(() => {
|
|
2279
|
+
h && n ? Pi(h, n.notify.bind(n), D).then((d) => wt(d)) : wt([]);
|
|
2280
|
+
}, [h, n, D]), K(() => (ue && (Se.current && clearTimeout(Se.current), Se.current = setTimeout(() => {
|
|
2281
|
+
Pe(null);
|
|
2241
2282
|
}, 600)), () => {
|
|
2242
2283
|
Se.current && clearTimeout(Se.current);
|
|
2243
|
-
}), [ue]),
|
|
2284
|
+
}), [ue]), K(() => {
|
|
2244
2285
|
const d = (w) => {
|
|
2245
2286
|
var N;
|
|
2246
|
-
if (!n || !
|
|
2287
|
+
if (!n || !q || ((N = document.activeElement) == null ? void 0 : N.tagName) === "INPUT") return;
|
|
2247
2288
|
switch (w.key.toLowerCase()) {
|
|
2248
2289
|
case " ":
|
|
2249
2290
|
case "k":
|
|
@@ -2273,18 +2314,18 @@ const Ns = [
|
|
|
2273
2314
|
}
|
|
2274
2315
|
};
|
|
2275
2316
|
return window.addEventListener("keydown", d), () => window.removeEventListener("keydown", d);
|
|
2276
|
-
}, [n,
|
|
2277
|
-
const
|
|
2278
|
-
n && (n.setControlsVisible(!0), de.current && clearTimeout(de.current), !(V || B ||
|
|
2279
|
-
!
|
|
2317
|
+
}, [n, q]);
|
|
2318
|
+
const Ft = () => {
|
|
2319
|
+
n && (n.setControlsVisible(!0), de.current && clearTimeout(de.current), !(V || B || $) && (de.current = setTimeout(() => {
|
|
2320
|
+
!a.isPlaying || V || B || $ || n.setControlsVisible(!1);
|
|
2280
2321
|
}, 2500)));
|
|
2281
2322
|
};
|
|
2282
|
-
|
|
2283
|
-
n && (!V && !B &&
|
|
2284
|
-
}, [V, B,
|
|
2285
|
-
const
|
|
2286
|
-
if (!(!
|
|
2287
|
-
if (V || B ||
|
|
2323
|
+
K(() => {
|
|
2324
|
+
n && (!V && !B && !$ && a.isPlaying ? Ft() : (V || B || $) && (n.setControlsVisible(!0), de.current && clearTimeout(de.current)));
|
|
2325
|
+
}, [V, B, $, a.isPlaying, n]);
|
|
2326
|
+
const Rt = Ve(() => {
|
|
2327
|
+
if (!(!_ || !n || !a.isPlaying || a.isLocked)) {
|
|
2328
|
+
if (V || B || $) {
|
|
2288
2329
|
z();
|
|
2289
2330
|
return;
|
|
2290
2331
|
}
|
|
@@ -2292,85 +2333,85 @@ const Ns = [
|
|
|
2292
2333
|
n.video.playbackRate = 2, Nt(!0);
|
|
2293
2334
|
}, 500);
|
|
2294
2335
|
}
|
|
2295
|
-
}, [
|
|
2336
|
+
}, [_, n, a.isPlaying, a.isLocked, V, B, $]), Ze = Ve(() => {
|
|
2296
2337
|
Ye.current && clearTimeout(Ye.current), Qe && n && (n.video.playbackRate = Mt.current, Nt(!1));
|
|
2297
2338
|
}, [Qe, n]), ci = (d) => {
|
|
2298
|
-
if (
|
|
2339
|
+
if (Rt(), V || B || $) {
|
|
2299
2340
|
z();
|
|
2300
2341
|
return;
|
|
2301
2342
|
}
|
|
2302
|
-
|
|
2343
|
+
a.isLocked || (we.current = d.touches[0].clientX, Ee.current = d.touches[0].clientY, Tt.current = a.currentTime, zt.current = a.volume, It.current = a.brightness, ye.current = !1, te.current = null);
|
|
2303
2344
|
}, di = (d) => {
|
|
2304
|
-
var
|
|
2305
|
-
if (
|
|
2306
|
-
const w = d.touches[0].clientX, C = d.touches[0].clientY, N = w - we.current,
|
|
2307
|
-
if (!te.current && (Math.abs(N) > 10 || Math.abs(
|
|
2308
|
-
if (ye.current = !0, Ze(), Math.abs(N) > Math.abs(
|
|
2345
|
+
var re, l;
|
|
2346
|
+
if (a.isLocked || !n || we.current === null || Ee.current === null) return;
|
|
2347
|
+
const w = d.touches[0].clientX, C = d.touches[0].clientY, N = w - we.current, R = C - Ee.current;
|
|
2348
|
+
if (!te.current && (Math.abs(N) > 10 || Math.abs(R) > 10))
|
|
2349
|
+
if (ye.current = !0, Ze(), Math.abs(N) > Math.abs(R))
|
|
2309
2350
|
k && (te.current = "seek", Ie(!0));
|
|
2310
2351
|
else {
|
|
2311
|
-
const
|
|
2312
|
-
we.current <
|
|
2352
|
+
const F = T.current ? T.current.clientWidth / 2 : window.innerWidth / 2;
|
|
2353
|
+
we.current < F ? (te.current = "brightness", Xe(!0)) : (te.current = "volume", ve(!0));
|
|
2313
2354
|
}
|
|
2314
|
-
if (te.current === "seek" && T.current &&
|
|
2315
|
-
const
|
|
2316
|
-
|
|
2355
|
+
if (te.current === "seek" && T.current && a.duration) {
|
|
2356
|
+
const F = T.current.getBoundingClientRect(), O = N / F.width, I = Math.max(0, Math.min(a.duration, Tt.current + O * a.duration));
|
|
2357
|
+
_e(I);
|
|
2317
2358
|
} else if (te.current === "volume") {
|
|
2318
|
-
const O = -(
|
|
2359
|
+
const O = -(R / (((re = T.current) == null ? void 0 : re.clientHeight) || 300)) * 1.5;
|
|
2319
2360
|
n.setVolume(Math.max(0, Math.min(1, zt.current + O)));
|
|
2320
2361
|
} else if (te.current === "brightness") {
|
|
2321
|
-
const O = -(
|
|
2362
|
+
const O = -(R / (((l = T.current) == null ? void 0 : l.clientHeight) || 300)) * 1.5;
|
|
2322
2363
|
n.setBrightness(Math.max(0, Math.min(2, It.current + O)));
|
|
2323
2364
|
}
|
|
2324
2365
|
}, ui = (d) => {
|
|
2325
|
-
Ze(), te.current === "seek" ? (n == null || n.seek(
|
|
2366
|
+
Ze(), te.current === "seek" ? (n == null || n.seek(Fe), Ie(!1)) : te.current === "volume" ? ve(!1) : te.current === "brightness" && Xe(!1), ye.current = !1, te.current = null, we.current = null, Ee.current = null;
|
|
2326
2367
|
}, et = (d) => {
|
|
2327
|
-
if (!Je.current || !
|
|
2368
|
+
if (!Je.current || !a.duration) return 0;
|
|
2328
2369
|
const w = Je.current.getBoundingClientRect(), C = "touches" in d ? d.touches[0].clientX : d.clientX;
|
|
2329
|
-
return Math.max(0, Math.min(1, (C - w.left) / w.width)) *
|
|
2330
|
-
},
|
|
2331
|
-
if (d.stopPropagation(),
|
|
2332
|
-
(V || B ||
|
|
2333
|
-
const w = (N) =>
|
|
2370
|
+
return Math.max(0, Math.min(1, (C - w.left) / w.width)) * a.duration;
|
|
2371
|
+
}, Pt = (d) => {
|
|
2372
|
+
if (d.stopPropagation(), a.isLocked) return;
|
|
2373
|
+
(V || B || $) && z(), Ie(!0), _e(et(d));
|
|
2374
|
+
const w = (N) => _e(et(N)), C = (N) => {
|
|
2334
2375
|
n == null || n.seek(et(N)), Ie(!1), document.removeEventListener("mousemove", w), document.removeEventListener("touchmove", w), document.removeEventListener("mouseup", C), document.removeEventListener("touchend", C);
|
|
2335
2376
|
};
|
|
2336
2377
|
document.addEventListener("mousemove", w), document.addEventListener("touchmove", w), document.addEventListener("mouseup", C), document.addEventListener("touchend", C);
|
|
2337
|
-
},
|
|
2378
|
+
}, Et = (d) => {
|
|
2338
2379
|
if (!Ke.current) return 0;
|
|
2339
2380
|
const w = Ke.current.getBoundingClientRect(), C = "touches" in d ? d.touches[0].clientX : d.clientX;
|
|
2340
2381
|
return Math.max(0, Math.min(1, (C - w.left) / w.width));
|
|
2341
|
-
},
|
|
2342
|
-
if (d.stopPropagation(), !n ||
|
|
2343
|
-
bt(!0), n.setVolume(
|
|
2344
|
-
const w = (N) => n.setVolume(
|
|
2382
|
+
}, Lt = (d) => {
|
|
2383
|
+
if (d.stopPropagation(), !n || a.isLocked) return;
|
|
2384
|
+
bt(!0), n.setVolume(Et(d));
|
|
2385
|
+
const w = (N) => n.setVolume(Et(N)), C = () => {
|
|
2345
2386
|
bt(!1), document.removeEventListener("mousemove", w), document.removeEventListener("touchmove", w), document.removeEventListener("mouseup", C), document.removeEventListener("touchend", C);
|
|
2346
2387
|
};
|
|
2347
2388
|
document.addEventListener("mousemove", w), document.addEventListener("touchmove", w), document.addEventListener("mouseup", C), document.addEventListener("touchend", C);
|
|
2348
2389
|
}, hi = (d) => {
|
|
2349
|
-
if (!
|
|
2350
|
-
const w = d.currentTarget.getBoundingClientRect(), C = (d.clientX - w.left) / w.width, N = C *
|
|
2351
|
-
li(C * 100), kt(N), xt.length > 0 && St(xt.find((
|
|
2352
|
-
},
|
|
2353
|
-
!n ||
|
|
2390
|
+
if (!a.duration || a.isLive) return;
|
|
2391
|
+
const w = d.currentTarget.getBoundingClientRect(), C = (d.clientX - w.left) / w.width, N = C * a.duration;
|
|
2392
|
+
li(C * 100), kt(N), xt.length > 0 && St(xt.find((R) => N >= R.start && N < R.end) || null);
|
|
2393
|
+
}, Le = (d) => {
|
|
2394
|
+
!n || a.isLocked || (n.skip(d === "forward" ? 10 : -10), Ct(d), setTimeout(() => Ct(null), 300));
|
|
2354
2395
|
}, mi = (d) => {
|
|
2355
2396
|
if (!n) return;
|
|
2356
2397
|
if (ye.current) {
|
|
2357
2398
|
ye.current = !1;
|
|
2358
2399
|
return;
|
|
2359
2400
|
}
|
|
2360
|
-
if (V || B ||
|
|
2401
|
+
if (V || B || $ || oe.visible) {
|
|
2361
2402
|
z();
|
|
2362
2403
|
return;
|
|
2363
2404
|
}
|
|
2364
|
-
if (
|
|
2365
|
-
!
|
|
2366
|
-
}, 2500),
|
|
2367
|
-
const w = d.currentTarget.getBoundingClientRect(), C = d.clientX - w.left, N = w.width,
|
|
2368
|
-
ke.current ? (clearTimeout(ke.current), ke.current = null, C < N * 0.35 ? (
|
|
2405
|
+
if (Re && ve(!1), vt && Xe(!1), n.setControlsVisible(!0), de.current && clearTimeout(de.current), de.current = setTimeout(() => {
|
|
2406
|
+
!a.isPlaying || V || B || $ || n.setControlsVisible(!1);
|
|
2407
|
+
}, 2500), a.isLocked) return;
|
|
2408
|
+
const w = d.currentTarget.getBoundingClientRect(), C = d.clientX - w.left, N = w.width, R = Date.now();
|
|
2409
|
+
ke.current ? (clearTimeout(ke.current), ke.current = null, C < N * 0.35 ? (Le("rewind"), Pe({ type: "rewind", id: R })) : C > N * 0.65 ? (Le("forward"), Pe({ type: "forward", id: R })) : n.toggleFullscreen()) : ke.current = setTimeout(() => {
|
|
2369
2410
|
n.togglePlay(), ke.current = null;
|
|
2370
2411
|
}, 250);
|
|
2371
|
-
},
|
|
2412
|
+
}, fi = (d) => {
|
|
2372
2413
|
var C;
|
|
2373
|
-
if (d.preventDefault(), d.stopPropagation(),
|
|
2414
|
+
if (d.preventDefault(), d.stopPropagation(), a.isLocked) return;
|
|
2374
2415
|
z();
|
|
2375
2416
|
const w = (C = T.current) == null ? void 0 : C.getBoundingClientRect();
|
|
2376
2417
|
w && requestAnimationFrame(() => {
|
|
@@ -2380,14 +2421,14 @@ const Ns = [
|
|
|
2380
2421
|
y: d.clientY - w.top
|
|
2381
2422
|
});
|
|
2382
2423
|
});
|
|
2383
|
-
},
|
|
2384
|
-
if (d.stopPropagation(), z(),
|
|
2424
|
+
}, pi = (d) => {
|
|
2425
|
+
if (d.stopPropagation(), z(), Re) {
|
|
2385
2426
|
ve(!1);
|
|
2386
2427
|
return;
|
|
2387
2428
|
}
|
|
2388
2429
|
We ? ve(!0) : n == null || n.toggleMute();
|
|
2389
|
-
}, bi =
|
|
2390
|
-
switch (
|
|
2430
|
+
}, bi = a.isMuted || a.volume === 0 ? Ut : a.volume < 0.5 ? $i : jt, $e = Math.max(100, ae - 120), gi = () => {
|
|
2431
|
+
switch (a.iconSize) {
|
|
2391
2432
|
case "small":
|
|
2392
2433
|
return "w-4 h-4";
|
|
2393
2434
|
case "large":
|
|
@@ -2396,7 +2437,7 @@ const Ns = [
|
|
|
2396
2437
|
return "w-5 h-5";
|
|
2397
2438
|
}
|
|
2398
2439
|
}, vi = () => {
|
|
2399
|
-
switch (
|
|
2440
|
+
switch (a.iconSize) {
|
|
2400
2441
|
case "small":
|
|
2401
2442
|
return "p-2 min-w-[32px] min-h-[32px]";
|
|
2402
2443
|
case "large":
|
|
@@ -2405,7 +2446,7 @@ const Ns = [
|
|
|
2405
2446
|
return "p-2.5 min-w-[36px] min-h-[36px]";
|
|
2406
2447
|
}
|
|
2407
2448
|
}, ie = gi(), se = vi(), he = (() => {
|
|
2408
|
-
switch (
|
|
2449
|
+
switch (a.iconSize) {
|
|
2409
2450
|
case "small":
|
|
2410
2451
|
return {
|
|
2411
2452
|
playBtn: "w-14 h-14",
|
|
@@ -2428,7 +2469,7 @@ const Ns = [
|
|
|
2428
2469
|
skipIcon: "w-6 h-6"
|
|
2429
2470
|
};
|
|
2430
2471
|
}
|
|
2431
|
-
})(), xi = !
|
|
2472
|
+
})(), xi = !a.isLocked && (a.controlsVisible || !a.isPlaying || V || B || $ || oe.visible), $t = ri || oi || Re, Ae = pe ? "backdrop-blur-xl bg-black/80" : "bg-black/95", At = Ce(() => {
|
|
2432
2473
|
const d = [
|
|
2433
2474
|
{ id: "play", position: "left", index: 10, isBuiltIn: !0 },
|
|
2434
2475
|
{ id: "volume", position: "left", index: 20, isBuiltIn: !0 },
|
|
@@ -2441,11 +2482,11 @@ const Ns = [
|
|
|
2441
2482
|
{ id: "fullscreenWeb", position: "right", index: 110, isBuiltIn: !0 },
|
|
2442
2483
|
{ id: "fullscreen", position: "right", index: 120, isBuiltIn: !0 }
|
|
2443
2484
|
];
|
|
2444
|
-
m.controls && m.controls.forEach((
|
|
2445
|
-
const
|
|
2446
|
-
|
|
2485
|
+
m.controls && m.controls.forEach((R) => {
|
|
2486
|
+
const re = d.find((l) => l.id === R.id);
|
|
2487
|
+
re ? Object.assign(re, R) : d.push(R);
|
|
2447
2488
|
});
|
|
2448
|
-
const w =
|
|
2489
|
+
const w = a.sources[a.currentSourceIndex] || { url: t || "", type: i || "auto" }, C = w.type === "hls" || w.url.includes(".m3u8"), N = d.find((R) => R.id === "download");
|
|
2449
2490
|
return N && (C ? (N.children = [
|
|
2450
2491
|
{ html: "Download Format", isLabel: !0 },
|
|
2451
2492
|
{
|
|
@@ -2460,11 +2501,11 @@ const Ns = [
|
|
|
2460
2501
|
icon: /* @__PURE__ */ e(Zt, { className: "w-3.5 h-3.5" }),
|
|
2461
2502
|
onClick: () => n == null ? void 0 : n.download({ format: "mp4" })
|
|
2462
2503
|
}
|
|
2463
|
-
], N.onClick = void 0) : (N.children = void 0, N.onClick = (
|
|
2464
|
-
}, [m.controls,
|
|
2465
|
-
var w, C, N,
|
|
2504
|
+
], N.onClick = void 0) : (N.children = void 0, N.onClick = (R) => R.download())), d.filter((R) => !(R.id === "screenshot" && !x || R.id === "pip" && !f || R.id === "settings" && !S || R.id === "fullscreen" && !L || R.id === "fullscreenWeb" && !U)).sort((R, re) => R.index - re.index);
|
|
2505
|
+
}, [m.controls, x, f, S, L, U, a.currentSourceIndex, a.sources, t, i]), Vt = (d) => {
|
|
2506
|
+
var w, C, N, R, re;
|
|
2466
2507
|
if (!d.isBuiltIn) {
|
|
2467
|
-
const l = d.id || `ctrl-${d.index}`,
|
|
2508
|
+
const l = d.id || `ctrl-${d.index}`, F = $ === l, O = F || ze.isMounted && qe.current === l;
|
|
2468
2509
|
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
2469
2510
|
/* @__PURE__ */ e(
|
|
2470
2511
|
"button",
|
|
@@ -2473,12 +2514,12 @@ const Ns = [
|
|
|
2473
2514
|
onTouchStart: (I) => I.stopPropagation(),
|
|
2474
2515
|
onClick: (I) => {
|
|
2475
2516
|
if (I.stopPropagation(), d.children) {
|
|
2476
|
-
const tt =
|
|
2517
|
+
const tt = F;
|
|
2477
2518
|
z(), tt || Ue(l);
|
|
2478
2519
|
} else
|
|
2479
2520
|
z(), d.click ? d.click(n) : d.onClick && d.onClick(n);
|
|
2480
2521
|
},
|
|
2481
|
-
className: `strata-control-btn transition-colors focus:outline-none flex items-center justify-center ${se} ${
|
|
2522
|
+
className: `strata-control-btn transition-colors focus:outline-none flex items-center justify-center ${se} ${F ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"} ${d.className || ""}`,
|
|
2482
2523
|
style: { borderRadius: "var(--radius)", ...d.style },
|
|
2483
2524
|
title: d.tooltip,
|
|
2484
2525
|
children: /* @__PURE__ */ e(Qt, { content: d.html || "" })
|
|
@@ -2489,7 +2530,7 @@ const Ns = [
|
|
|
2489
2530
|
{
|
|
2490
2531
|
items: d.children,
|
|
2491
2532
|
onClose: z,
|
|
2492
|
-
maxHeight:
|
|
2533
|
+
maxHeight: $e,
|
|
2493
2534
|
className: `strata-backdrop ${Ae} ${ze.isVisible ? "opacity-100 translate-y-0 scale-100 animate-in fade-in zoom-in-95 duration-300" : "opacity-0 translate-y-2 scale-95 duration-300"}`
|
|
2494
2535
|
}
|
|
2495
2536
|
)
|
|
@@ -2499,7 +2540,7 @@ const Ns = [
|
|
|
2499
2540
|
case "play":
|
|
2500
2541
|
return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
|
|
2501
2542
|
l.stopPropagation(), z(), n == null || n.togglePlay();
|
|
2502
|
-
}, className: `strata-control-btn text-zinc-300 hover:text-white transition-colors hover:bg-white/10 focus:outline-none ${se}`, style: { borderRadius: "var(--radius)" }, children:
|
|
2543
|
+
}, className: `strata-control-btn text-zinc-300 hover:text-white transition-colors hover:bg-white/10 focus:outline-none ${se}`, style: { borderRadius: "var(--radius)" }, children: a.isPlaying ? /* @__PURE__ */ e(Wt, { className: `${ie} fill-current` }) : /* @__PURE__ */ e(Ht, { className: `${ie} fill-current` }) }, "play");
|
|
2503
2544
|
case "volume":
|
|
2504
2545
|
return /* @__PURE__ */ c(
|
|
2505
2546
|
"div",
|
|
@@ -2512,49 +2553,49 @@ const Ns = [
|
|
|
2512
2553
|
window.matchMedia("(hover: hover)").matches && gt(!1);
|
|
2513
2554
|
},
|
|
2514
2555
|
children: [
|
|
2515
|
-
/* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick:
|
|
2516
|
-
/* @__PURE__ */ e("div", { className: `relative h-8 flex items-center transition-all duration-300 ease-out overflow-hidden ${
|
|
2517
|
-
/* @__PURE__ */ e("div", { className: "w-full h-1 bg-white/20 overflow-hidden", style: { borderRadius: "var(--radius-full)" }, children: /* @__PURE__ */ e("div", { className: "h-full bg-white", style: { width: `${(
|
|
2518
|
-
/* @__PURE__ */ e("div", { className: "absolute h-3 w-3 bg-white shadow-md top-1/2 -translate-y-1/2 pointer-events-none", style: { left: `calc(${(
|
|
2556
|
+
/* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: pi, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 focus:outline-none ${se}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(bi, { className: ie }) }),
|
|
2557
|
+
/* @__PURE__ */ e("div", { className: `relative h-8 flex items-center transition-all duration-300 ease-out overflow-hidden ${$t ? "w-28 opacity-100 ml-1" : "w-0 opacity-0"}`, children: /* @__PURE__ */ c("div", { ref: Ke, className: "relative w-full h-full flex items-center cursor-pointer px-2", onMouseDown: Lt, onTouchStart: Lt, children: [
|
|
2558
|
+
/* @__PURE__ */ e("div", { className: "w-full h-1 bg-white/20 overflow-hidden", style: { borderRadius: "var(--radius-full)" }, children: /* @__PURE__ */ e("div", { className: "h-full bg-white", style: { width: `${(a.isMuted ? 0 : a.volume) * 100}%`, borderRadius: "var(--radius-full)" } }) }),
|
|
2559
|
+
/* @__PURE__ */ e("div", { className: "absolute h-3 w-3 bg-white shadow-md top-1/2 -translate-y-1/2 pointer-events-none", style: { left: `calc(${(a.isMuted ? 0 : a.volume) * 100}% * 0.85 + 4px)`, borderRadius: "var(--radius-full)" } })
|
|
2519
2560
|
] }) }),
|
|
2520
|
-
|
|
2561
|
+
$t && /* @__PURE__ */ e("div", { className: "strata-tooltip absolute bottom-full mb-2 px-1.5 py-0.5 rounded text-[10px] font-bold font-mono shadow-lg pointer-events-none whitespace-nowrap z-50 transform -translate-x-1/2", style: { left: `calc(52px + ${(a.isMuted ? 0 : a.volume) * 80}px)` }, children: a.isMuted ? "0%" : `${Math.round(a.volume * 100)}%` })
|
|
2521
2562
|
]
|
|
2522
2563
|
},
|
|
2523
2564
|
"volume"
|
|
2524
2565
|
);
|
|
2525
2566
|
case "time":
|
|
2526
|
-
return m.isLive ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2 px-2 py-0.5 rounded-md border border-white/10", style: { backgroundColor: `${
|
|
2527
|
-
/* @__PURE__ */ e("div", { className: "w-2 h-2 rounded-full animate-pulse", style: { backgroundColor:
|
|
2528
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold tracking-wider", style: { color:
|
|
2567
|
+
return m.isLive ? /* @__PURE__ */ c("div", { className: "flex items-center gap-2 px-2 py-0.5 rounded-md border border-white/10", style: { backgroundColor: `${a.themeColor}1a`, borderColor: `${a.themeColor}33` }, children: [
|
|
2568
|
+
/* @__PURE__ */ e("div", { className: "w-2 h-2 rounded-full animate-pulse", style: { backgroundColor: a.themeColor } }),
|
|
2569
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold tracking-wider", style: { color: a.themeColor }, children: "LIVE" })
|
|
2529
2570
|
] }, "live") : /* @__PURE__ */ c("div", { className: "text-xs font-medium text-zinc-400 font-mono select-none hidden sm:block tabular-nums", children: [
|
|
2530
|
-
it(
|
|
2571
|
+
it(Ge ? Fe : a.currentTime),
|
|
2531
2572
|
" ",
|
|
2532
2573
|
/* @__PURE__ */ e("span", { className: "text-zinc-600", children: "/" }),
|
|
2533
2574
|
" ",
|
|
2534
|
-
it(
|
|
2575
|
+
it(a.duration)
|
|
2535
2576
|
] }, "time");
|
|
2536
2577
|
case "subtitle":
|
|
2537
2578
|
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
2538
2579
|
/* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
|
|
2539
2580
|
l.stopPropagation();
|
|
2540
|
-
const
|
|
2541
|
-
z(),
|
|
2581
|
+
const F = B;
|
|
2582
|
+
z(), F || ut(!0);
|
|
2542
2583
|
}, className: `strata-control-btn transition-colors focus:outline-none ${se} ${B ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Oi, { className: ie }) }),
|
|
2543
|
-
|
|
2584
|
+
pt.isMounted && /* @__PURE__ */ e(
|
|
2544
2585
|
ys,
|
|
2545
2586
|
{
|
|
2546
|
-
tracks:
|
|
2547
|
-
current:
|
|
2587
|
+
tracks: a.subtitleTracks,
|
|
2588
|
+
current: a.currentSubtitle,
|
|
2548
2589
|
onSelect: (l) => n == null ? void 0 : n.setSubtitle(l),
|
|
2549
2590
|
onUpload: (l) => n == null ? void 0 : n.addTextTrack(l, l.name),
|
|
2550
2591
|
onClose: z,
|
|
2551
|
-
settings:
|
|
2592
|
+
settings: a.subtitleSettings,
|
|
2552
2593
|
onSettingsChange: (l) => n == null ? void 0 : n.updateSubtitleSettings(l),
|
|
2553
2594
|
onReset: () => n == null ? void 0 : n.resetSubtitleSettings(),
|
|
2554
|
-
offset:
|
|
2595
|
+
offset: a.subtitleOffset,
|
|
2555
2596
|
onOffsetChange: (l) => n == null ? void 0 : n.setSubtitleOffset(l),
|
|
2556
|
-
maxHeight:
|
|
2557
|
-
animationClass: `strata-backdrop ${Ae} ${
|
|
2597
|
+
maxHeight: $e,
|
|
2598
|
+
animationClass: `strata-backdrop ${Ae} ${pt.isVisible ? "opacity-100 translate-y-0 scale-100 animate-in fade-in zoom-in-95 duration-300" : "opacity-0 translate-y-2 scale-95 duration-300"}`
|
|
2558
2599
|
}
|
|
2559
2600
|
)
|
|
2560
2601
|
] }, "subtitle");
|
|
@@ -2568,19 +2609,19 @@ const Ns = [
|
|
|
2568
2609
|
}, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${se}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Di, { className: ie }) }, "pip");
|
|
2569
2610
|
case "download":
|
|
2570
2611
|
if (d.children) {
|
|
2571
|
-
const l =
|
|
2612
|
+
const l = $ === "download-menu", F = l || ze.isMounted && qe.current === "download-menu";
|
|
2572
2613
|
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
2573
2614
|
/* @__PURE__ */ e("button", { onMouseDown: (O) => O.stopPropagation(), onTouchStart: (O) => O.stopPropagation(), onClick: (O) => {
|
|
2574
2615
|
O.stopPropagation();
|
|
2575
2616
|
const I = l;
|
|
2576
2617
|
z(), I || Ue("download-menu");
|
|
2577
2618
|
}, className: `strata-control-btn transition-colors hidden sm:block focus:outline-none ${se} ${l ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(ot, { className: ie }) }),
|
|
2578
|
-
|
|
2619
|
+
F && /* @__PURE__ */ e(
|
|
2579
2620
|
Xt,
|
|
2580
2621
|
{
|
|
2581
2622
|
items: d.children,
|
|
2582
2623
|
onClose: z,
|
|
2583
|
-
maxHeight:
|
|
2624
|
+
maxHeight: $e,
|
|
2584
2625
|
className: `strata-backdrop ${Ae} ${ze.isVisible ? "opacity-100 translate-y-0 scale-100 animate-in fade-in zoom-in-95 duration-300" : "opacity-0 translate-y-2 scale-95 duration-300"}`
|
|
2585
2626
|
}
|
|
2586
2627
|
)
|
|
@@ -2592,40 +2633,40 @@ const Ns = [
|
|
|
2592
2633
|
case "fullscreen":
|
|
2593
2634
|
return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
|
|
2594
2635
|
l.stopPropagation(), z(), n == null || n.toggleFullscreen();
|
|
2595
|
-
}, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 rounded-lg transition-transform focus:outline-none ${se}`, style: { borderRadius: "var(--radius)" }, children:
|
|
2636
|
+
}, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 rounded-lg transition-transform focus:outline-none ${se}`, style: { borderRadius: "var(--radius)" }, children: a.isFullscreen || a.isWebFullscreen ? /* @__PURE__ */ e(Vi, { className: ie }) : /* @__PURE__ */ e(Ai, { className: ie }) }, "fs");
|
|
2596
2637
|
case "fullscreenWeb":
|
|
2597
2638
|
return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
|
|
2598
2639
|
l.stopPropagation(), z(), n == null || n.toggleWebFullscreen();
|
|
2599
|
-
}, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 hidden sm:block focus:outline-none ${se} ${
|
|
2640
|
+
}, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 hidden sm:block focus:outline-none ${se} ${a.isWebFullscreen ? "text-[var(--accent)]" : ""}`, style: { borderRadius: "var(--radius)" }, title: "Web Fullscreen", children: /* @__PURE__ */ e(ns, { className: ie }) }, "fsw");
|
|
2600
2641
|
case "settings":
|
|
2601
2642
|
return /* @__PURE__ */ c("div", { className: "relative", children: [
|
|
2602
2643
|
/* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
|
|
2603
2644
|
l.stopPropagation();
|
|
2604
|
-
const
|
|
2605
|
-
z(),
|
|
2645
|
+
const F = V;
|
|
2646
|
+
z(), F || (dt(!0), A("main"));
|
|
2606
2647
|
}, className: `strata-control-btn transition-all duration-300 focus:outline-none ${se} ${V ? "rotate-90 text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Bi, { className: ie }) }),
|
|
2607
|
-
|
|
2648
|
+
ft.isMounted && /* @__PURE__ */ e(lt, { onClose: z, align: "right", maxHeight: $e, className: `strata-backdrop ${Ae} ${ft.isVisible ? "opacity-100 translate-y-0 scale-100 animate-in fade-in zoom-in-95 duration-300" : "opacity-0 translate-y-2 scale-95 duration-300"}`, children: /* @__PURE__ */ c("div", { className: "w-full", children: [
|
|
2608
2649
|
J === "main" && /* @__PURE__ */ c("div", { className: "animate-in slide-in-from-left-4 fade-in duration-200", children: [
|
|
2609
2650
|
/* @__PURE__ */ e("div", { className: "px-3 py-2 mb-1 border-b border-white/5 font-bold text-zinc-400 uppercase text-[11px] tracking-wider flex justify-between items-center bg-white/5 sticky top-0 z-10 backdrop-blur-md", style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e("span", { children: "Settings" }) }),
|
|
2610
|
-
|
|
2611
|
-
/* @__PURE__ */ e(
|
|
2651
|
+
a.sources.length > 1 && /* @__PURE__ */ c(Q, { children: [
|
|
2652
|
+
/* @__PURE__ */ e(P, { label: "Source", icon: /* @__PURE__ */ e(as, { className: "w-4 h-4" }), value: ((w = a.sources[a.currentSourceIndex]) == null ? void 0 : w.name) || `Source ${a.currentSourceIndex + 1}`, onClick: () => A("sources"), hasSubmenu: !0 }),
|
|
2612
2653
|
/* @__PURE__ */ e(me, {})
|
|
2613
2654
|
] }),
|
|
2614
|
-
/* @__PURE__ */ e(
|
|
2615
|
-
/* @__PURE__ */ e(
|
|
2616
|
-
/* @__PURE__ */ e(
|
|
2655
|
+
/* @__PURE__ */ e(P, { label: "Quality", icon: /* @__PURE__ */ e(ms, { className: "w-4 h-4" }), value: a.currentQuality === -1 ? "Auto" : `${(C = a.qualityLevels[a.currentQuality]) == null ? void 0 : C.height}p`, onClick: () => A("quality"), hasSubmenu: !0 }),
|
|
2656
|
+
/* @__PURE__ */ e(P, { label: "Speed", icon: /* @__PURE__ */ e(ds, { className: "w-4 h-4" }), value: `${a.playbackRate}x`, onClick: () => A("speed"), hasSubmenu: !0 }),
|
|
2657
|
+
/* @__PURE__ */ e(P, { label: "Audio", icon: /* @__PURE__ */ e(us, { className: "w-4 h-4" }), value: ((N = a.audioTracks[a.currentAudioTrack]) == null ? void 0 : N.label) || "Default", onClick: () => A("audio"), hasSubmenu: !0 }),
|
|
2617
2658
|
/* @__PURE__ */ e(me, {}),
|
|
2618
|
-
/* @__PURE__ */ e(
|
|
2619
|
-
Y && /* @__PURE__ */ e(
|
|
2620
|
-
|
|
2621
|
-
/* @__PURE__ */ e(
|
|
2659
|
+
/* @__PURE__ */ e(P, { label: "Video Fit", icon: /* @__PURE__ */ e(gs, { className: "w-4 h-4" }), value: a.videoFit === "none" ? "Default" : a.videoFit.charAt(0).toUpperCase() + a.videoFit.slice(1), onClick: () => A("videofit"), hasSubmenu: !0 }),
|
|
2660
|
+
Y && /* @__PURE__ */ e(P, { label: "Aspect Ratio", icon: /* @__PURE__ */ e(ls, { className: "w-4 h-4" }), value: a.aspectRatio, onClick: () => A("ratio"), hasSubmenu: !0 }),
|
|
2661
|
+
v && /* @__PURE__ */ e(P, { label: "Flip", icon: /* @__PURE__ */ e(fs, { className: "w-4 h-4" }), value: a.flipState.horizontal ? "H" : a.flipState.vertical ? "V" : "Normal", onClick: () => A("flip"), hasSubmenu: !0 }),
|
|
2662
|
+
/* @__PURE__ */ e(P, { label: "Audio Boost", icon: /* @__PURE__ */ e(cs, { className: "w-4 h-4" }), value: a.audioGain > 1 ? `${a.audioGain}x` : "Off", onClick: () => A("boost"), hasSubmenu: !0 }),
|
|
2622
2663
|
/* @__PURE__ */ e(me, {}),
|
|
2623
|
-
/* @__PURE__ */ e(
|
|
2624
|
-
/* @__PURE__ */ e(
|
|
2664
|
+
/* @__PURE__ */ e(P, { label: "Watch Party", icon: /* @__PURE__ */ e(Ui, { className: "w-4 h-4" }), onClick: () => A("party"), hasSubmenu: !0 }),
|
|
2665
|
+
/* @__PURE__ */ e(P, { label: "Cast to Device", icon: /* @__PURE__ */ e(ji, { className: "w-4 h-4" }), onClick: () => {
|
|
2625
2666
|
n == null || n.requestCast(), z();
|
|
2626
2667
|
} }),
|
|
2627
2668
|
m.settings && m.settings.length > 0 && /* @__PURE__ */ e(me, {}),
|
|
2628
|
-
(
|
|
2669
|
+
(R = m.settings) == null ? void 0 : R.map((l, F) => l.switch !== void 0 ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
|
|
2629
2670
|
le,
|
|
2630
2671
|
{
|
|
2631
2672
|
label: l.html,
|
|
@@ -2636,32 +2677,32 @@ const Ns = [
|
|
|
2636
2677
|
l.onSwitch && l.onSwitch(l, O);
|
|
2637
2678
|
}
|
|
2638
2679
|
}
|
|
2639
|
-
) }, `cust-${
|
|
2640
|
-
|
|
2680
|
+
) }, `cust-${F}`) : /* @__PURE__ */ e(
|
|
2681
|
+
P,
|
|
2641
2682
|
{
|
|
2642
2683
|
label: l.html,
|
|
2643
2684
|
icon: l.icon,
|
|
2644
2685
|
value: l.currentLabel || l.value,
|
|
2645
2686
|
hasSubmenu: !!l.children,
|
|
2646
2687
|
onClick: () => {
|
|
2647
|
-
l.children ? A(`custom-${
|
|
2688
|
+
l.children ? A(`custom-${F}`) : (l.click ? l.click(l) : l.onClick && l.onClick(l), z());
|
|
2648
2689
|
}
|
|
2649
2690
|
},
|
|
2650
|
-
`cust-${
|
|
2691
|
+
`cust-${F}`
|
|
2651
2692
|
)),
|
|
2652
2693
|
/* @__PURE__ */ e(me, {}),
|
|
2653
|
-
/* @__PURE__ */ e(
|
|
2694
|
+
/* @__PURE__ */ e(P, { label: "Appearance", icon: /* @__PURE__ */ e(ei, { className: "w-4 h-4" }), onClick: () => A("appearance"), hasSubmenu: !0 })
|
|
2654
2695
|
] }),
|
|
2655
2696
|
J.startsWith("custom-") && (() => {
|
|
2656
2697
|
var O;
|
|
2657
|
-
const l = parseInt(J.split("-")[1]),
|
|
2658
|
-
return !
|
|
2659
|
-
/* @__PURE__ */ e(
|
|
2660
|
-
|
|
2698
|
+
const l = parseInt(J.split("-")[1]), F = (O = m.settings) == null ? void 0 : O[l];
|
|
2699
|
+
return !F || !F.children ? null : /* @__PURE__ */ c("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
|
|
2700
|
+
/* @__PURE__ */ e(ee, { label: F.html || "Menu", onBack: () => A("main") }),
|
|
2701
|
+
F.children.map((I, tt) => /* @__PURE__ */ c(Me.Fragment, { children: [
|
|
2661
2702
|
I.separator && /* @__PURE__ */ e(me, {}),
|
|
2662
2703
|
I.switch !== void 0 && /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(le, { label: I.html, checked: I.switch, onChange: (ki) => I.onSwitch && I.onSwitch(I, ki) }) }),
|
|
2663
2704
|
!I.separator && I.switch === void 0 && /* @__PURE__ */ e(
|
|
2664
|
-
|
|
2705
|
+
P,
|
|
2665
2706
|
{
|
|
2666
2707
|
label: I.html,
|
|
2667
2708
|
icon: I.icon,
|
|
@@ -2677,74 +2718,74 @@ const Ns = [
|
|
|
2677
2718
|
})(),
|
|
2678
2719
|
["speed", "quality", "audio", "boost", "party", "appearance", "sources", "flip", "ratio", "videofit"].includes(J) && /* @__PURE__ */ c("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
|
|
2679
2720
|
J === "sources" && /* @__PURE__ */ c(Q, { children: [
|
|
2680
|
-
/* @__PURE__ */ e(
|
|
2681
|
-
|
|
2682
|
-
const O =
|
|
2721
|
+
/* @__PURE__ */ e(ee, { label: "Select Source", onBack: () => A("main") }),
|
|
2722
|
+
a.sources.map((l, F) => {
|
|
2723
|
+
const O = a.sourceStatuses[F], I = O === "success" ? /* @__PURE__ */ e(hs, { className: "w-3.5 h-3.5 text-emerald-500" }) : O === "error" ? /* @__PURE__ */ e(rt, { className: "w-3.5 h-3.5 text-red-500" }) : null;
|
|
2683
2724
|
return /* @__PURE__ */ e(
|
|
2684
|
-
|
|
2725
|
+
P,
|
|
2685
2726
|
{
|
|
2686
|
-
label: l.name || `Source ${
|
|
2727
|
+
label: l.name || `Source ${F + 1}`,
|
|
2687
2728
|
value: l.type,
|
|
2688
|
-
active:
|
|
2729
|
+
active: a.currentSourceIndex === F,
|
|
2689
2730
|
rightIcon: I,
|
|
2690
|
-
onClick: () => n == null ? void 0 : n.switchSource(
|
|
2731
|
+
onClick: () => n == null ? void 0 : n.switchSource(F)
|
|
2691
2732
|
},
|
|
2692
|
-
|
|
2733
|
+
F
|
|
2693
2734
|
);
|
|
2694
2735
|
})
|
|
2695
2736
|
] }),
|
|
2696
2737
|
J === "speed" && /* @__PURE__ */ c(Q, { children: [
|
|
2697
|
-
/* @__PURE__ */ e(
|
|
2698
|
-
[0.5, 1, 1.5, 2].map((l) => /* @__PURE__ */ e(
|
|
2738
|
+
/* @__PURE__ */ e(ee, { label: "Speed", onBack: () => A("main") }),
|
|
2739
|
+
[0.5, 1, 1.5, 2].map((l) => /* @__PURE__ */ e(P, { label: `${l}x`, active: a.playbackRate === l, onClick: () => n.video.playbackRate = l }, l))
|
|
2699
2740
|
] }),
|
|
2700
2741
|
J === "quality" && /* @__PURE__ */ c(Q, { children: [
|
|
2701
|
-
/* @__PURE__ */ e(
|
|
2702
|
-
/* @__PURE__ */ e(
|
|
2703
|
-
|
|
2742
|
+
/* @__PURE__ */ e(ee, { label: "Quality", onBack: () => A("main") }),
|
|
2743
|
+
/* @__PURE__ */ e(P, { label: "Auto", active: a.currentQuality === -1, onClick: () => n == null ? void 0 : n.setQuality(-1) }),
|
|
2744
|
+
a.qualityLevels.map((l) => /* @__PURE__ */ e(P, { label: `${l.height}p`, value: `${Math.round(l.bitrate / 1e3)}k`, active: a.currentQuality === l.index, onClick: () => n == null ? void 0 : n.setQuality(l.index) }, l.index))
|
|
2704
2745
|
] }),
|
|
2705
2746
|
J === "audio" && /* @__PURE__ */ c(Q, { children: [
|
|
2706
|
-
/* @__PURE__ */ e(
|
|
2707
|
-
|
|
2708
|
-
|
|
2747
|
+
/* @__PURE__ */ e(ee, { label: "Audio Track", onBack: () => A("main") }),
|
|
2748
|
+
a.audioTracks.length === 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 text-zinc-500 text-xs text-center", children: "No tracks available" }),
|
|
2749
|
+
a.audioTracks.map((l) => /* @__PURE__ */ e(P, { label: l.label, value: l.language, active: a.currentAudioTrack === l.index, onClick: () => n == null ? void 0 : n.setAudioTrack(l.index) }, l.index))
|
|
2709
2750
|
] }),
|
|
2710
2751
|
J === "boost" && /* @__PURE__ */ c(Q, { children: [
|
|
2711
|
-
/* @__PURE__ */ e(
|
|
2712
|
-
[1, 1.5, 2, 3].map((l) => /* @__PURE__ */ e(
|
|
2752
|
+
/* @__PURE__ */ e(ee, { label: "Audio Boost", onBack: () => A("main") }),
|
|
2753
|
+
[1, 1.5, 2, 3].map((l) => /* @__PURE__ */ e(P, { label: l === 1 ? "Off" : `${l}x`, active: a.audioGain === l, onClick: () => n == null ? void 0 : n.setAudioGain(l) }, l))
|
|
2713
2754
|
] }),
|
|
2714
2755
|
J === "flip" && /* @__PURE__ */ c(Q, { children: [
|
|
2715
|
-
/* @__PURE__ */ e(
|
|
2756
|
+
/* @__PURE__ */ e(ee, { label: "Video Flip", onBack: () => A("main") }),
|
|
2716
2757
|
/* @__PURE__ */ c("div", { className: "p-2 space-y-1", children: [
|
|
2717
|
-
/* @__PURE__ */ e(le, { label: "Horizontal Flip", checked:
|
|
2718
|
-
/* @__PURE__ */ e(le, { label: "Vertical Flip", checked:
|
|
2758
|
+
/* @__PURE__ */ e(le, { label: "Horizontal Flip", checked: a.flipState.horizontal, onChange: () => n == null ? void 0 : n.setFlip("horizontal") }),
|
|
2759
|
+
/* @__PURE__ */ e(le, { label: "Vertical Flip", checked: a.flipState.vertical, onChange: () => n == null ? void 0 : n.setFlip("vertical") })
|
|
2719
2760
|
] })
|
|
2720
2761
|
] }),
|
|
2721
2762
|
J === "ratio" && /* @__PURE__ */ c(Q, { children: [
|
|
2722
|
-
/* @__PURE__ */ e(
|
|
2723
|
-
/* @__PURE__ */ e("div", { className: "max-h-[250px] overflow-y-auto hide-scrollbar", children: ["default", "16:9", "4:3", "21:9", "18:9", "1:1", "9:16"].map((l) => /* @__PURE__ */ e(
|
|
2763
|
+
/* @__PURE__ */ e(ee, { label: "Aspect Ratio", onBack: () => A("main") }),
|
|
2764
|
+
/* @__PURE__ */ e("div", { className: "max-h-[250px] overflow-y-auto hide-scrollbar", children: ["default", "16:9", "4:3", "21:9", "18:9", "1:1", "9:16"].map((l) => /* @__PURE__ */ e(P, { label: l === "default" ? "Default" : l.replace(":", " : "), active: a.aspectRatio === l, onClick: () => n == null ? void 0 : n.setAspectRatio(l) }, l)) })
|
|
2724
2765
|
] }),
|
|
2725
2766
|
J === "videofit" && /* @__PURE__ */ c(Q, { children: [
|
|
2726
|
-
/* @__PURE__ */ e(
|
|
2727
|
-
/* @__PURE__ */ e(
|
|
2728
|
-
/* @__PURE__ */ e(
|
|
2729
|
-
/* @__PURE__ */ e(
|
|
2730
|
-
/* @__PURE__ */ e(
|
|
2767
|
+
/* @__PURE__ */ e(ee, { label: "Video Fit", onBack: () => A("main") }),
|
|
2768
|
+
/* @__PURE__ */ e(P, { label: "Contain (Default)", value: "Fit", active: a.videoFit === "contain", onClick: () => n == null ? void 0 : n.setVideoFit("contain") }),
|
|
2769
|
+
/* @__PURE__ */ e(P, { label: "Cover", value: "Zoom", active: a.videoFit === "cover", onClick: () => n == null ? void 0 : n.setVideoFit("cover") }),
|
|
2770
|
+
/* @__PURE__ */ e(P, { label: "Fill", value: "Stretch", active: a.videoFit === "fill", onClick: () => n == null ? void 0 : n.setVideoFit("fill") }),
|
|
2771
|
+
/* @__PURE__ */ e(P, { label: "None", value: "Original", active: a.videoFit === "none", onClick: () => n == null ? void 0 : n.setVideoFit("none") })
|
|
2731
2772
|
] }),
|
|
2732
2773
|
J === "party" && /* @__PURE__ */ c(Q, { children: [
|
|
2733
|
-
/* @__PURE__ */ e(
|
|
2774
|
+
/* @__PURE__ */ e(ee, { label: "Watch Party", onBack: () => A("main") }),
|
|
2734
2775
|
/* @__PURE__ */ c("div", { className: "p-4 space-y-3", children: [
|
|
2735
2776
|
/* @__PURE__ */ e("p", { className: "text-xs text-zinc-400 leading-relaxed", children: "Create a synchronized room on WatchParty.me to watch together." }),
|
|
2736
|
-
/* @__PURE__ */ e("a", { href: `https://www.watchparty.me/create?video=${encodeURIComponent(((
|
|
2777
|
+
/* @__PURE__ */ e("a", { href: `https://www.watchparty.me/create?video=${encodeURIComponent(((re = a.sources[a.currentSourceIndex]) == null ? void 0 : re.url) || t || "")}`, target: "_blank", rel: "noopener noreferrer", className: "flex items-center justify-center w-full py-2.5 bg-[var(--accent)] hover:opacity-90 text-white font-medium transition-opacity text-xs", style: { borderRadius: "var(--radius)" }, children: "Create Room" })
|
|
2737
2778
|
] })
|
|
2738
2779
|
] }),
|
|
2739
2780
|
J === "appearance" && /* @__PURE__ */ c(Q, { children: [
|
|
2740
|
-
/* @__PURE__ */ e(
|
|
2781
|
+
/* @__PURE__ */ e(ee, { label: "Appearance", onBack: () => A("main") }),
|
|
2741
2782
|
/* @__PURE__ */ c("div", { className: "pb-1", children: [
|
|
2742
2783
|
/* @__PURE__ */ e("div", { className: "px-1 pt-1", children: /* @__PURE__ */ e(
|
|
2743
2784
|
xe,
|
|
2744
2785
|
{
|
|
2745
2786
|
label: "Brightness",
|
|
2746
|
-
icon: /* @__PURE__ */ e(
|
|
2747
|
-
value:
|
|
2787
|
+
icon: /* @__PURE__ */ e(qt, { className: "w-4 h-4" }),
|
|
2788
|
+
value: a.brightness,
|
|
2748
2789
|
min: 0,
|
|
2749
2790
|
max: 2,
|
|
2750
2791
|
step: 0.1,
|
|
@@ -2752,14 +2793,14 @@ const Ns = [
|
|
|
2752
2793
|
formatValue: (l) => `${Math.round(l * 100)}%`
|
|
2753
2794
|
}
|
|
2754
2795
|
) }),
|
|
2755
|
-
/* @__PURE__ */ e(
|
|
2756
|
-
/* @__PURE__ */ e(
|
|
2757
|
-
/* @__PURE__ */ c(
|
|
2758
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-6 gap-2 px-3", children: Ns.map((l) => /* @__PURE__ */ e("button", { title: l.label, onClick: () => n == null ? void 0 : n.setAppearance({ themeColor: l.value }), className: `w-6 h-6 transition-transform hover:scale-110 ${
|
|
2796
|
+
/* @__PURE__ */ e(fe, { title: "Theme", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2 px-3", children: Ms.map((l) => /* @__PURE__ */ e("button", { onClick: () => n == null ? void 0 : n.setAppearance({ theme: l.value, themeColor: l.color }), className: `py-2 text-xs font-bold uppercase tracking-wide transition-colors border-[length:var(--border-width)] border-white/10 ${a.theme === l.value ? "bg-[var(--accent)] text-white" : "bg-white/5 text-zinc-400 hover:text-white"}`, style: { borderRadius: "var(--radius)" }, children: l.label }, l.value)) }) }),
|
|
2797
|
+
/* @__PURE__ */ e(fe, { title: "Icon Size", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-1 px-3", children: ["small", "medium", "large"].map((l) => /* @__PURE__ */ e("button", { onClick: () => n == null ? void 0 : n.setAppearance({ iconSize: l }), className: `py-1.5 text-xs font-medium transition-colors ${a.iconSize === l ? "bg-white text-black" : "bg-white/5 text-zinc-400 hover:text-zinc-200"}`, style: { borderRadius: "var(--radius)" }, children: l.charAt(0).toUpperCase() + l.slice(1) }, l)) }) }),
|
|
2798
|
+
/* @__PURE__ */ c(fe, { title: "Theme Color", children: [
|
|
2799
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-6 gap-2 px-3", children: Ns.map((l) => /* @__PURE__ */ e("button", { title: l.label, onClick: () => n == null ? void 0 : n.setAppearance({ themeColor: l.value }), className: `w-6 h-6 transition-transform hover:scale-110 ${a.themeColor === l.value ? "ring-2 ring-white scale-110" : "ring-1 ring-white/10"}`, style: { backgroundColor: l.value, borderRadius: "var(--radius-full)" }, children: a.themeColor === l.value && /* @__PURE__ */ e(He, { className: "w-3 h-3 text-white mx-auto stroke-[3]" }) }, l.value)) }),
|
|
2759
2800
|
/* @__PURE__ */ e("div", { className: "px-3 pt-4", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-3 bg-white/5 p-2 hover:bg-white/10 transition-colors group", style: { borderRadius: "var(--radius)" }, children: [
|
|
2760
|
-
/* @__PURE__ */ e("div", { className: "relative w-6 h-6 overflow-hidden ring-1 ring-white/20", style: { borderRadius: "var(--radius-full)" }, children: /* @__PURE__ */ e("input", { type: "color", value:
|
|
2801
|
+
/* @__PURE__ */ e("div", { className: "relative w-6 h-6 overflow-hidden ring-1 ring-white/20", style: { borderRadius: "var(--radius-full)" }, children: /* @__PURE__ */ e("input", { type: "color", value: a.themeColor, onChange: (l) => n == null ? void 0 : n.setAppearance({ themeColor: l.target.value }), className: "absolute inset-[-4px] w-[150%] h-[150%] cursor-pointer p-0 border-0" }) }),
|
|
2761
2802
|
/* @__PURE__ */ e("span", { className: "text-xs text-zinc-400 font-medium group-hover:text-zinc-200", children: "Custom Color" }),
|
|
2762
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-mono text-zinc-500 ml-auto uppercase", children:
|
|
2803
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-mono text-zinc-500 ml-auto uppercase", children: a.themeColor })
|
|
2763
2804
|
] }) })
|
|
2764
2805
|
] })
|
|
2765
2806
|
] })
|
|
@@ -2776,7 +2817,7 @@ const Ns = [
|
|
|
2776
2817
|
{ html: "Playback", isLabel: !0 },
|
|
2777
2818
|
{
|
|
2778
2819
|
html: "Loop",
|
|
2779
|
-
checked:
|
|
2820
|
+
checked: a.isLooping,
|
|
2780
2821
|
onClick: () => n == null ? void 0 : n.toggleLoop()
|
|
2781
2822
|
},
|
|
2782
2823
|
{ separator: !0 },
|
|
@@ -2787,19 +2828,19 @@ const Ns = [
|
|
|
2787
2828
|
{ separator: !0 },
|
|
2788
2829
|
// Aspect Ratio Group
|
|
2789
2830
|
{ html: "Aspect Ratio", isLabel: !0 },
|
|
2790
|
-
{ html: "Default", checked:
|
|
2791
|
-
{ html: "16:9", checked:
|
|
2792
|
-
{ html: "21:9", checked:
|
|
2831
|
+
{ html: "Default", checked: a.aspectRatio === "default", onClick: () => n == null ? void 0 : n.setAspectRatio("default") },
|
|
2832
|
+
{ html: "16:9", checked: a.aspectRatio === "16:9", onClick: () => n == null ? void 0 : n.setAspectRatio("16:9") },
|
|
2833
|
+
{ html: "21:9", checked: a.aspectRatio === "21:9", onClick: () => n == null ? void 0 : n.setAspectRatio("21:9") },
|
|
2793
2834
|
{ separator: !0 },
|
|
2794
2835
|
// Video Fit Group
|
|
2795
2836
|
{ html: "Video Fit", isLabel: !0 },
|
|
2796
|
-
{ html: "Contain", checked:
|
|
2797
|
-
{ html: "Cover", checked:
|
|
2837
|
+
{ html: "Contain", checked: a.videoFit === "contain", onClick: () => n == null ? void 0 : n.setVideoFit("contain") },
|
|
2838
|
+
{ html: "Cover", checked: a.videoFit === "cover", onClick: () => n == null ? void 0 : n.setVideoFit("cover") },
|
|
2798
2839
|
{ separator: !0 },
|
|
2799
2840
|
// Stats
|
|
2800
2841
|
{
|
|
2801
2842
|
html: "Video Info",
|
|
2802
|
-
icon: /* @__PURE__ */ e(
|
|
2843
|
+
icon: /* @__PURE__ */ e(rs, { className: "w-3.5 h-3.5" }),
|
|
2803
2844
|
onClick: () => mt(!0)
|
|
2804
2845
|
},
|
|
2805
2846
|
{ separator: !0 }
|
|
@@ -2816,27 +2857,27 @@ const Ns = [
|
|
|
2816
2857
|
/* @__PURE__ */ e("path", { d: "m6 6 12 12" })
|
|
2817
2858
|
] }) })
|
|
2818
2859
|
}), d;
|
|
2819
|
-
}, [m.contextmenu,
|
|
2860
|
+
}, [m.contextmenu, a.aspectRatio, a.isLooping, a.videoFit, n]), yi = a.isWebFullscreen, Bt = /* @__PURE__ */ c(
|
|
2820
2861
|
"div",
|
|
2821
2862
|
{
|
|
2822
2863
|
id: m.id,
|
|
2823
2864
|
ref: T,
|
|
2824
2865
|
className: `group bg-black overflow-hidden select-none font-[family-name:var(--font-main)] outline-none text-zinc-100 strata-player-reset flex items-center justify-center ${yi ? "fixed inset-0 z-[2147483647] w-screen h-screen rounded-none" : "relative w-full h-full rounded-[var(--radius-player)]"} ${m.container || ""}`,
|
|
2825
|
-
style: { touchAction: "manipulation", "--accent":
|
|
2826
|
-
onMouseMove:
|
|
2866
|
+
style: { touchAction: "manipulation", "--accent": a.themeColor, "--accent-contrast": si },
|
|
2867
|
+
onMouseMove: Ft,
|
|
2827
2868
|
onMouseLeave: () => {
|
|
2828
|
-
|
|
2869
|
+
a.isPlaying && !V && !B && !$ && n && n.setControlsVisible(!1);
|
|
2829
2870
|
},
|
|
2830
|
-
onMouseDown:
|
|
2871
|
+
onMouseDown: Rt,
|
|
2831
2872
|
onMouseUp: Ze,
|
|
2832
2873
|
onTouchStart: ci,
|
|
2833
2874
|
onTouchMove: di,
|
|
2834
2875
|
onTouchEnd: ui,
|
|
2835
|
-
onContextMenu:
|
|
2876
|
+
onContextMenu: fi,
|
|
2836
2877
|
tabIndex: 0,
|
|
2837
2878
|
role: "region",
|
|
2838
2879
|
"aria-label": "Video Player",
|
|
2839
|
-
"data-theme":
|
|
2880
|
+
"data-theme": a.theme,
|
|
2840
2881
|
children: [
|
|
2841
2882
|
/* @__PURE__ */ e("style", { children: `
|
|
2842
2883
|
[data-theme="default"] {
|
|
@@ -2936,7 +2977,7 @@ const Ns = [
|
|
|
2936
2977
|
[data-theme="pixel"] .strata-backdrop { backdrop-filter: none; background: #000; }
|
|
2937
2978
|
[data-theme="hacker"] .strata-backdrop { backdrop-filter: none; background: #000; }
|
|
2938
2979
|
` }),
|
|
2939
|
-
|
|
2980
|
+
a.theme === "hacker" && /* @__PURE__ */ e("div", { className: "strata-scanlines" }),
|
|
2940
2981
|
!n && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-zinc-950 z-50", children: /* @__PURE__ */ e(De, { className: "w-10 h-10 text-[var(--accent)] animate-spin" }) }),
|
|
2941
2982
|
n && /* @__PURE__ */ c(Q, { children: [
|
|
2942
2983
|
(Dt = m.layers) == null ? void 0 : Dt.map((d, w) => /* @__PURE__ */ e(
|
|
@@ -2948,8 +2989,8 @@ const Ns = [
|
|
|
2948
2989
|
},
|
|
2949
2990
|
w
|
|
2950
2991
|
)),
|
|
2951
|
-
/* @__PURE__ */ e(vs, { notifications:
|
|
2952
|
-
/* @__PURE__ */ e(xs, { cues:
|
|
2992
|
+
/* @__PURE__ */ e(vs, { notifications: a.notifications }),
|
|
2993
|
+
/* @__PURE__ */ e(xs, { cues: a.activeCues, settings: a.subtitleSettings }),
|
|
2953
2994
|
/* @__PURE__ */ e(
|
|
2954
2995
|
"div",
|
|
2955
2996
|
{
|
|
@@ -2960,11 +3001,11 @@ const Ns = [
|
|
|
2960
3001
|
tabIndex: -1
|
|
2961
3002
|
}
|
|
2962
3003
|
),
|
|
2963
|
-
|
|
3004
|
+
r && !G && /* @__PURE__ */ e(
|
|
2964
3005
|
"div",
|
|
2965
3006
|
{
|
|
2966
3007
|
className: "absolute inset-0 bg-cover bg-center z-[5] pointer-events-none strata-poster",
|
|
2967
|
-
style: { backgroundImage: `url(${
|
|
3008
|
+
style: { backgroundImage: `url(${r})` }
|
|
2968
3009
|
}
|
|
2969
3010
|
),
|
|
2970
3011
|
oe.visible && /* @__PURE__ */ e(
|
|
@@ -2975,7 +3016,7 @@ const Ns = [
|
|
|
2975
3016
|
items: wi,
|
|
2976
3017
|
onClose: z,
|
|
2977
3018
|
containerWidth: ge,
|
|
2978
|
-
containerHeight:
|
|
3019
|
+
containerHeight: ae
|
|
2979
3020
|
}
|
|
2980
3021
|
),
|
|
2981
3022
|
ni && n && /* @__PURE__ */ e(Ss, { player: n, onClose: () => mt(!1) }),
|
|
@@ -2983,23 +3024,23 @@ const Ns = [
|
|
|
2983
3024
|
/* @__PURE__ */ e(os, { className: "w-4 h-4 text-[var(--accent)] fill-current" }),
|
|
2984
3025
|
/* @__PURE__ */ e("span", { className: "text-xs font-bold tracking-wider", children: "2x Speed" })
|
|
2985
3026
|
] }),
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
/* @__PURE__ */ e("div", { className: "w-32 h-1.5 bg-white/20 rounded-full overflow-hidden", children: /* @__PURE__ */ e("div", { className: "h-full bg-[var(--accent)]", style: { width: `${
|
|
3027
|
+
Re && /* @__PURE__ */ c("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-black/60 backdrop-blur-md p-6 rounded-2xl flex flex-col items-center gap-4 z-40 animate-in fade-in zoom-in duration-200 pointer-events-none", children: [
|
|
3028
|
+
a.isMuted || a.volume === 0 ? /* @__PURE__ */ e(Ut, { className: "w-10 h-10 text-white/80" }) : /* @__PURE__ */ e(jt, { className: "w-10 h-10 text-white/80" }),
|
|
3029
|
+
/* @__PURE__ */ e("div", { className: "w-32 h-1.5 bg-white/20 rounded-full overflow-hidden", children: /* @__PURE__ */ e("div", { className: "h-full bg-[var(--accent)]", style: { width: `${a.isMuted ? 0 : a.volume * 100}%` } }) }),
|
|
2989
3030
|
/* @__PURE__ */ c("span", { className: "text-xl font-bold font-mono", children: [
|
|
2990
|
-
Math.round(
|
|
3031
|
+
Math.round(a.volume * 100),
|
|
2991
3032
|
"%"
|
|
2992
3033
|
] })
|
|
2993
3034
|
] }),
|
|
2994
3035
|
vt && /* @__PURE__ */ c("div", { className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-black/60 backdrop-blur-md p-6 rounded-2xl flex flex-col items-center gap-4 z-40 animate-in fade-in zoom-in duration-200 pointer-events-none", children: [
|
|
2995
|
-
/* @__PURE__ */ e(
|
|
2996
|
-
/* @__PURE__ */ e("div", { className: "w-32 h-1.5 bg-white/20 rounded-full overflow-hidden", children: /* @__PURE__ */ e("div", { className: "h-full bg-[var(--accent)]", style: { width: `${Math.min(100,
|
|
3036
|
+
/* @__PURE__ */ e(qt, { className: "w-10 h-10 text-white/80" }),
|
|
3037
|
+
/* @__PURE__ */ e("div", { className: "w-32 h-1.5 bg-white/20 rounded-full overflow-hidden", children: /* @__PURE__ */ e("div", { className: "h-full bg-[var(--accent)]", style: { width: `${Math.min(100, a.brightness * 100)}%` } }) }),
|
|
2997
3038
|
/* @__PURE__ */ c("span", { className: "text-xl font-bold font-mono", children: [
|
|
2998
|
-
Math.round(
|
|
3039
|
+
Math.round(a.brightness * 100),
|
|
2999
3040
|
"%"
|
|
3000
3041
|
] })
|
|
3001
3042
|
] }),
|
|
3002
|
-
H && We &&
|
|
3043
|
+
H && We && a.controlsVisible && /* @__PURE__ */ e(
|
|
3003
3044
|
"button",
|
|
3004
3045
|
{
|
|
3005
3046
|
onMouseDown: (d) => d.stopPropagation(),
|
|
@@ -3007,43 +3048,43 @@ const Ns = [
|
|
|
3007
3048
|
onClick: (d) => {
|
|
3008
3049
|
d.stopPropagation(), n.toggleLock();
|
|
3009
3050
|
},
|
|
3010
|
-
className: `absolute left-4 md:left-6 bottom-24 md:bottom-28 z-50 p-3 rounded-full bg-black/50 backdrop-blur-md border border-white/10 text-white transition-all active:scale-95 ${
|
|
3011
|
-
children:
|
|
3051
|
+
className: `absolute left-4 md:left-6 bottom-24 md:bottom-28 z-50 p-3 rounded-full bg-black/50 backdrop-blur-md border border-white/10 text-white transition-all active:scale-95 ${a.isLocked ? "text-[var(--accent)] bg-white/10" : "hover:bg-white/10"}`,
|
|
3052
|
+
children: a.isLocked ? /* @__PURE__ */ e(is, { className: "w-5 h-5" }) : /* @__PURE__ */ e(ss, { className: "w-5 h-5" })
|
|
3012
3053
|
}
|
|
3013
3054
|
),
|
|
3014
3055
|
ue && /* @__PURE__ */ e(
|
|
3015
3056
|
"div",
|
|
3016
3057
|
{
|
|
3017
3058
|
className: `absolute top-0 bottom-0 flex items-center justify-center w-[35%] z-20 bg-white/5 backdrop-blur-[1px] animate-out fade-out duration-500 fill-mode-forwards pointer-events-none ${ue.type === "rewind" ? "left-0 rounded-r-[4rem]" : "right-0 rounded-l-[4rem]"}`,
|
|
3018
|
-
onAnimationEnd: () =>
|
|
3059
|
+
onAnimationEnd: () => Pe(null),
|
|
3019
3060
|
children: /* @__PURE__ */ c("div", { className: "flex flex-col items-center text-white drop-shadow-lg", children: [
|
|
3020
|
-
ue.type === "rewind" ? /* @__PURE__ */ e(
|
|
3061
|
+
ue.type === "rewind" ? /* @__PURE__ */ e(Gt, { className: "w-12 h-12 animate-pulse" }) : /* @__PURE__ */ e(_t, { className: "w-12 h-12 animate-pulse" }),
|
|
3021
3062
|
/* @__PURE__ */ e("span", { className: "font-bold text-sm mt-2 font-mono", children: ue.type === "rewind" ? "-10s" : "+10s" })
|
|
3022
3063
|
] })
|
|
3023
3064
|
},
|
|
3024
3065
|
ue.id
|
|
3025
3066
|
),
|
|
3026
|
-
|
|
3027
|
-
|
|
3067
|
+
a.isBuffering && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ e(De, { className: "w-12 h-12 text-[var(--accent)] animate-spin drop-shadow-lg" }) }),
|
|
3068
|
+
a.error && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center z-30 bg-black/90 backdrop-blur-md animate-in fade-in", children: /* @__PURE__ */ c("div", { className: "flex flex-col items-center gap-4 text-red-500 p-8 max-w-md text-center", children: [
|
|
3028
3069
|
/* @__PURE__ */ e("span", { className: "text-5xl mb-2", children: "⚠️" }),
|
|
3029
3070
|
/* @__PURE__ */ e("h3", { className: "text-xl font-bold text-white", children: "Playback Error" }),
|
|
3030
|
-
/* @__PURE__ */ e("p", { className: "text-zinc-400 text-sm", children:
|
|
3031
|
-
/* @__PURE__ */ e("button", { onClick: () => n.load(n.store.get().sources[n.store.get().currentSourceIndex] || { url: t || "", type: i || "auto" },
|
|
3071
|
+
/* @__PURE__ */ e("p", { className: "text-zinc-400 text-sm", children: a.error }),
|
|
3072
|
+
/* @__PURE__ */ e("button", { onClick: () => n.load(n.store.get().sources[n.store.get().currentSourceIndex] || { url: t || "", type: i || "auto" }, p), className: "px-6 py-2 bg-[var(--accent)] text-white font-medium rounded-full hover:opacity-90 transition-opacity mt-4 shadow-lg", children: "Try Again" })
|
|
3032
3073
|
] }) }),
|
|
3033
|
-
j && !
|
|
3074
|
+
j && !a.isLocked && (!a.isPlaying && !a.isBuffering && !a.error || a.controlsVisible) && !a.isBuffering ? /* @__PURE__ */ e(
|
|
3034
3075
|
"div",
|
|
3035
3076
|
{
|
|
3036
|
-
className: `absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300 pointer-events-none ${
|
|
3077
|
+
className: `absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300 pointer-events-none ${a.controlsVisible || !a.isPlaying ? "opacity-100" : "opacity-0"}`,
|
|
3037
3078
|
children: /* @__PURE__ */ c("div", { className: "flex items-center gap-8 md:gap-16 pointer-events-auto", children: [
|
|
3038
3079
|
/* @__PURE__ */ e("button", { onMouseDown: (d) => d.stopPropagation(), onTouchStart: (d) => d.stopPropagation(), onClick: (d) => {
|
|
3039
|
-
d.stopPropagation(), z(),
|
|
3040
|
-
}, className: `group flex items-center justify-center rounded-full bg-black/40 hover:bg-black/60 border border-white/10 transition-all duration-300 active:scale-125 active:opacity-80 text-white/90 focus:outline-none backdrop-blur-sm ${he.skipBtn}`, children: /* @__PURE__ */ e(
|
|
3080
|
+
d.stopPropagation(), z(), Le("rewind");
|
|
3081
|
+
}, className: `group flex items-center justify-center rounded-full bg-black/40 hover:bg-black/60 border border-white/10 transition-all duration-300 active:scale-125 active:opacity-80 text-white/90 focus:outline-none backdrop-blur-sm ${he.skipBtn}`, children: /* @__PURE__ */ e(Gt, { className: he.skipIcon }) }),
|
|
3041
3082
|
/* @__PURE__ */ e("button", { onMouseDown: (d) => d.stopPropagation(), onTouchStart: (d) => d.stopPropagation(), onClick: (d) => {
|
|
3042
3083
|
d.stopPropagation(), z(), n.togglePlay();
|
|
3043
|
-
}, className: `group relative flex items-center justify-center rounded-full bg-white/10 hover:bg-[var(--accent)] border border-white/10 shadow-2xl transition-all duration-300 active:scale-90 active:opacity-80 focus:outline-none backdrop-blur-md ${he.playBtn}`, children:
|
|
3084
|
+
}, className: `group relative flex items-center justify-center rounded-full bg-white/10 hover:bg-[var(--accent)] border border-white/10 shadow-2xl transition-all duration-300 active:scale-90 active:opacity-80 focus:outline-none backdrop-blur-md ${he.playBtn}`, children: a.isPlaying ? /* @__PURE__ */ e(Wt, { className: `${he.playIcon} text-white fill-current` }) : /* @__PURE__ */ e(Ht, { className: `${he.playIcon} text-white ml-1 fill-current` }) }),
|
|
3044
3085
|
/* @__PURE__ */ e("button", { onMouseDown: (d) => d.stopPropagation(), onTouchStart: (d) => d.stopPropagation(), onClick: (d) => {
|
|
3045
|
-
d.stopPropagation(), z(),
|
|
3046
|
-
}, className: `group flex items-center justify-center rounded-full bg-black/40 hover:bg-black/60 border border-white/10 transition-all duration-300 active:scale-125 active:opacity-80 text-white/90 focus:outline-none backdrop-blur-sm ${he.skipBtn}`, children: /* @__PURE__ */ e(
|
|
3086
|
+
d.stopPropagation(), z(), Le("forward");
|
|
3087
|
+
}, className: `group flex items-center justify-center rounded-full bg-black/40 hover:bg-black/60 border border-white/10 transition-all duration-300 active:scale-125 active:opacity-80 text-white/90 focus:outline-none backdrop-blur-sm ${he.skipBtn}`, children: /* @__PURE__ */ e(_t, { className: he.skipIcon }) })
|
|
3047
3088
|
] })
|
|
3048
3089
|
}
|
|
3049
3090
|
) : null,
|
|
@@ -3052,7 +3093,7 @@ const Ns = [
|
|
|
3052
3093
|
{
|
|
3053
3094
|
className: `absolute inset-x-0 bottom-0 z-30 transition-all duration-300 px-4 md:px-6 py-4 bg-gradient-to-t from-black/90 via-black/50 to-transparent ${xi ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4 pointer-events-none"}`,
|
|
3054
3095
|
onClick: (d) => {
|
|
3055
|
-
(V || B ||
|
|
3096
|
+
(V || B || $) && z(), d.target === d.currentTarget && ve(!1), d.stopPropagation();
|
|
3056
3097
|
},
|
|
3057
3098
|
children: [
|
|
3058
3099
|
!m.isLive && /* @__PURE__ */ c(
|
|
@@ -3064,24 +3105,24 @@ const Ns = [
|
|
|
3064
3105
|
onMouseLeave: () => {
|
|
3065
3106
|
kt(null), St(null);
|
|
3066
3107
|
},
|
|
3067
|
-
onMouseDown:
|
|
3068
|
-
onTouchStart:
|
|
3108
|
+
onMouseDown: Pt,
|
|
3109
|
+
onTouchStart: Pt,
|
|
3069
3110
|
children: [
|
|
3070
|
-
(Ot = m.highlight) == null ? void 0 : Ot.map((d, w) => /* @__PURE__ */ e("div", { className: "absolute top-1/2 -translate-y-1/2 w-1.5 h-1.5 bg-yellow-400 rounded-full z-10 pointer-events-none", style: { left: `${d.time /
|
|
3071
|
-
yt !== null && /* @__PURE__ */ c("div", { className: "absolute bottom-full mb-1.5 flex flex-col items-center transform -translate-x-1/2 z-40 pointer-events-none transition-opacity duration-150", style: { left: `clamp(70px, ${
|
|
3111
|
+
(Ot = m.highlight) == null ? void 0 : Ot.map((d, w) => /* @__PURE__ */ e("div", { className: "absolute top-1/2 -translate-y-1/2 w-1.5 h-1.5 bg-yellow-400 rounded-full z-10 pointer-events-none", style: { left: `${d.time / a.duration * 100}%` }, title: d.text }, w)),
|
|
3112
|
+
yt !== null && /* @__PURE__ */ c("div", { className: "absolute bottom-full mb-1.5 flex flex-col items-center transform -translate-x-1/2 z-40 pointer-events-none transition-opacity duration-150", style: { left: `clamp(70px, ${ai}%, calc(100% - 70px))` }, children: [
|
|
3072
3113
|
ce && /* @__PURE__ */ e("div", { className: "bg-black/90 border border-white/10 shadow-2xl overflow-hidden backdrop-blur-sm", style: { width: `${ce.w * 0.5}px`, height: `${ce.h * 0.5}px`, borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e("div", { style: { backgroundImage: `url("${ce.url}")`, width: `${ce.w}px`, height: `${ce.h}px`, backgroundPosition: `-${ce.x}px -${ce.y}px`, backgroundRepeat: "no-repeat", transform: "scale(0.5)", transformOrigin: "top left" } }) }),
|
|
3073
3114
|
/* @__PURE__ */ e("div", { className: "strata-tooltip px-2 py-0.5 text-[11px] font-bold font-mono shadow-lg tabular-nums mt-1", children: it(yt) })
|
|
3074
3115
|
] }),
|
|
3075
3116
|
/* @__PURE__ */ c("div", { className: "w-full h-1 bg-white/20 overflow-hidden relative backdrop-blur-sm border-[length:var(--border-width)] border-white/10", style: { borderRadius: "var(--radius-full)" }, children: [
|
|
3076
|
-
|
|
3077
|
-
/* @__PURE__ */ e("div", { className: "absolute left-0 top-0 bottom-0 bg-[var(--accent)]", style: { width: `${(
|
|
3117
|
+
a.duration > 0 && a.buffered.map((d, w) => /* @__PURE__ */ e("div", { className: "absolute top-0 bottom-0 bg-white/20", style: { left: `${d.start / a.duration * 100}%`, width: `${(d.end - d.start) / a.duration * 100}%` } }, w)),
|
|
3118
|
+
/* @__PURE__ */ e("div", { className: "absolute left-0 top-0 bottom-0 bg-[var(--accent)]", style: { width: `${(Ge ? Fe : a.currentTime) / a.duration * 100}%` } })
|
|
3078
3119
|
] }),
|
|
3079
3120
|
/* @__PURE__ */ e(
|
|
3080
3121
|
"div",
|
|
3081
3122
|
{
|
|
3082
3123
|
className: "absolute top-1/2 -translate-y-1/2 -translate-x-1/2 w-3.5 h-3.5 bg-white shadow-md scale-0 group-hover/slider:scale-100 transition-transform duration-100 z-10",
|
|
3083
3124
|
style: {
|
|
3084
|
-
left: `${(
|
|
3125
|
+
left: `${(Ge ? Fe : a.currentTime) / a.duration * 100}%`,
|
|
3085
3126
|
borderRadius: "var(--radius-full)"
|
|
3086
3127
|
}
|
|
3087
3128
|
}
|
|
@@ -3100,8 +3141,8 @@ const Ns = [
|
|
|
3100
3141
|
]
|
|
3101
3142
|
}
|
|
3102
3143
|
);
|
|
3103
|
-
return
|
|
3104
|
-
},
|
|
3144
|
+
return a.isWebFullscreen && typeof document < "u" ? Ti(Bt, document.body) : Bt;
|
|
3145
|
+
}, Ls = (s, t) => {
|
|
3105
3146
|
const i = Mi(s);
|
|
3106
3147
|
return i.render(Me.createElement(Yt, t)), {
|
|
3107
3148
|
unmount: () => {
|
|
@@ -3113,8 +3154,8 @@ const Ns = [
|
|
|
3113
3154
|
};
|
|
3114
3155
|
};
|
|
3115
3156
|
export {
|
|
3116
|
-
|
|
3157
|
+
Li as StrataCore,
|
|
3117
3158
|
Yt as StrataPlayer,
|
|
3118
|
-
|
|
3159
|
+
Ls as mountStrataPlayer
|
|
3119
3160
|
};
|
|
3120
3161
|
//# sourceMappingURL=strataplayer.es.js.map
|