strataplayer 1.2.18 → 1.2.20

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.
@@ -1,46 +1,46 @@
1
- var li = Object.defineProperty;
2
- var ci = (i, t, n) => t in i ? li(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
3
- var M = (i, t, n) => ci(i, typeof t != "symbol" ? t + "" : t, n);
4
- import ce, { useState as S, useEffect as j, useRef as A, useLayoutEffect as ve, useMemo as fe, useSyncExternalStore as di, useCallback as be } from "react";
5
- import { createRoot as ui } from "react-dom/client";
6
- import { jsxs as d, jsx as e, Fragment as B } from "react/jsx-runtime";
7
- import { createPortal as hi } from "react-dom";
8
- class pi {
1
+ var mi = Object.defineProperty;
2
+ var fi = (n, t, i) => t in n ? mi(n, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[t] = i;
3
+ var R = (n, t, i) => fi(n, typeof t != "symbol" ? t + "" : t, i);
4
+ import ke, { useState as N, useEffect as Q, useRef as U, useLayoutEffect as Ee, useMemo as xe, useSyncExternalStore as bi, useCallback as $e } from "react";
5
+ import { createRoot as gi } from "react-dom/client";
6
+ import { jsxs as d, jsx as e, Fragment as _ } from "react/jsx-runtime";
7
+ import { createPortal as vi } from "react-dom";
8
+ class xi {
9
9
  constructor() {
10
- M(this, "events");
10
+ R(this, "events");
11
11
  this.events = /* @__PURE__ */ new Map();
12
12
  }
13
- on(t, n) {
13
+ on(t, i) {
14
14
  var o;
15
- return this.events.has(t) || this.events.set(t, []), (o = this.events.get(t)) == null || o.push(n), () => this.off(t, n);
15
+ return this.events.has(t) || this.events.set(t, []), (o = this.events.get(t)) == null || o.push(i), () => this.off(t, i);
16
16
  }
17
- off(t, n) {
17
+ off(t, i) {
18
18
  const o = this.events.get(t);
19
19
  o && this.events.set(
20
20
  t,
21
- o.filter((l) => l !== n)
21
+ o.filter((r) => r !== i)
22
22
  );
23
23
  }
24
- emit(t, n) {
24
+ emit(t, i) {
25
25
  const o = this.events.get(t);
26
- o && o.forEach((l) => l(n));
26
+ o && o.forEach((r) => r(i));
27
27
  }
28
28
  destroy() {
29
29
  this.events.clear();
30
30
  }
31
31
  }
32
- class mi {
32
+ class wi {
33
33
  constructor(t) {
34
- M(this, "state");
35
- M(this, "listeners");
34
+ R(this, "state");
35
+ R(this, "listeners");
36
36
  this.state = t, this.listeners = /* @__PURE__ */ new Set();
37
37
  }
38
38
  get() {
39
39
  return this.state;
40
40
  }
41
41
  setState(t) {
42
- const n = this.state, o = typeof t == "function" ? t(n) : t;
43
- this.state = { ...n, ...o }, this.listeners.forEach((l) => l(this.state, n));
42
+ const i = this.state, o = typeof t == "function" ? t(i) : t;
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 mi {
49
49
  this.listeners.clear();
50
50
  }
51
51
  }
52
- class fi {
52
+ class yi {
53
53
  constructor(t) {
54
- M(this, "context", null);
55
- M(this, "source", null);
56
- M(this, "gainNode", null);
57
- M(this, "video");
58
- M(this, "isInitialized", !1);
54
+ R(this, "context", null);
55
+ R(this, "source", null);
56
+ R(this, "gainNode", null);
57
+ R(this, "video");
58
+ R(this, "isInitialized", !1);
59
59
  this.video = t;
60
60
  }
61
61
  /**
@@ -66,8 +66,8 @@ class fi {
66
66
  this.context = new AudioContext(), this.gainNode = this.context.createGain();
67
67
  try {
68
68
  this.source = this.context.createMediaElementSource(this.video), this.source.connect(this.gainNode), this.gainNode.connect(this.context.destination), this.isInitialized = !0;
69
- } catch (n) {
70
- console.warn("StrataPlayer: Failed to initialize AudioEngine", n);
69
+ } catch (i) {
70
+ console.warn("StrataPlayer: Failed to initialize AudioEngine", i);
71
71
  }
72
72
  }
73
73
  }
@@ -78,67 +78,67 @@ class fi {
78
78
  this.context && this.context.close(), this.isInitialized = !1;
79
79
  }
80
80
  }
81
- const Be = (i) => {
82
- if (isNaN(i)) return "00:00";
83
- const t = Math.floor(i / 3600), n = Math.floor(i % 3600 / 60), o = Math.floor(i % 60);
84
- return t > 0 ? `${t}:${n.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}` : `${n}:${o.toString().padStart(2, "0")}`;
85
- }, bi = async (i, t = 3, n = 2e4) => {
81
+ const Je = (n) => {
82
+ if (isNaN(n)) return "00:00";
83
+ const t = Math.floor(n / 3600), i = Math.floor(n % 3600 / 60), o = Math.floor(n % 60);
84
+ return t > 0 ? `${t}:${i.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}` : `${i}:${o.toString().padStart(2, "0")}`;
85
+ }, ki = async (n, t = 3, i = 2e4) => {
86
86
  for (let o = 0; o < t; o++) {
87
- const l = new AbortController(), u = setTimeout(() => l.abort(), n);
87
+ const r = new AbortController(), h = setTimeout(() => r.abort(), i);
88
88
  try {
89
- const h = await fetch(i, { signal: l.signal });
90
- if (clearTimeout(u), !h.ok) throw new Error(`HTTP ${h.status}`);
91
- return await h.text();
92
- } catch (h) {
93
- if (clearTimeout(u), o === t - 1) throw h;
94
- await new Promise((v) => setTimeout(v, 1e3));
89
+ const u = await fetch(n, { signal: r.signal });
90
+ if (clearTimeout(h), !u.ok) throw new Error(`HTTP ${u.status}`);
91
+ return await u.text();
92
+ } catch (u) {
93
+ if (clearTimeout(h), o === t - 1) throw u;
94
+ await new Promise((f) => setTimeout(f, 1e3));
95
95
  }
96
96
  }
97
97
  throw new Error("Failed");
98
- }, gi = async (i, t, n = 2e4) => {
98
+ }, Si = async (n, t, i = 2e4) => {
99
99
  try {
100
- const l = (await bi(i, 3, n)).split(`
101
- `), u = [];
102
- let h = null, v = null;
103
- const w = i.substring(0, i.lastIndexOf("/") + 1), b = (p) => {
104
- const y = p.split(":");
100
+ const r = (await ki(n, 3, i)).split(`
101
+ `), h = [];
102
+ let u = null, f = null;
103
+ const g = n.substring(0, n.lastIndexOf("/") + 1), x = (p) => {
104
+ const w = p.split(":");
105
105
  let m = 0;
106
- return y.length === 3 ? (m += parseFloat(y[0]) * 3600, m += parseFloat(y[1]) * 60, m += parseFloat(y[2])) : (m += parseFloat(y[0]) * 60, m += parseFloat(y[1])), m;
106
+ return w.length === 3 ? (m += parseFloat(w[0]) * 3600, m += parseFloat(w[1]) * 60, m += parseFloat(w[2])) : (m += parseFloat(w[0]) * 60, m += parseFloat(w[1])), m;
107
107
  };
108
- for (let p of l)
108
+ for (let p of r)
109
109
  if (p = p.trim(), p.includes("-->")) {
110
- const y = p.split("-->");
111
- h = b(y[0].trim()), v = b(y[1].trim());
112
- } else if (h !== null && v !== null && p.length > 0) {
113
- let [y, m] = p.split("#");
114
- !y.match(/^https?:\/\//) && !y.startsWith("data:") && (y = w + y);
115
- let T = 0, $ = 0, g = 0, Q = 0;
110
+ const w = p.split("-->");
111
+ u = x(w[0].trim()), f = x(w[1].trim());
112
+ } else if (u !== null && f !== null && p.length > 0) {
113
+ let [w, m] = p.split("#");
114
+ !w.match(/^https?:\/\//) && !w.startsWith("data:") && (w = g + w);
115
+ let T = 0, I = 0, O = 0, Y = 0;
116
116
  if (m && m.startsWith("xywh=")) {
117
- const X = m.replace("xywh=", "").split(",");
118
- X.length === 4 && (T = parseInt(X[0]), $ = parseInt(X[1]), g = parseInt(X[2]), Q = parseInt(X[3]));
117
+ const W = m.replace("xywh=", "").split(",");
118
+ W.length === 4 && (T = parseInt(W[0]), I = parseInt(W[1]), O = parseInt(W[2]), Y = parseInt(W[3]));
119
119
  }
120
- g > 0 && Q > 0 && u.push({ start: h, end: v, url: y, x: T, y: $, w: g, h: Q }), h = null, v = null;
120
+ O > 0 && Y > 0 && h.push({ start: u, end: f, url: w, x: T, y: I, w: O, h: Y }), u = null, f = null;
121
121
  }
122
- return u;
122
+ return h;
123
123
  } catch {
124
124
  return t({ type: "warning", message: "Failed to load thumbnails", duration: 4e3 }), [];
125
125
  }
126
- }, vi = () => {
126
+ }, Ci = () => {
127
127
  if (!(typeof document > "u")) {
128
128
  if (!document.getElementById("strata-fonts")) {
129
- const i = document.createElement("link");
130
- i.rel = "preconnect", i.href = "https://fonts.googleapis.com", document.head.appendChild(i);
129
+ const n = document.createElement("link");
130
+ n.rel = "preconnect", n.href = "https://fonts.googleapis.com", document.head.appendChild(n);
131
131
  const t = document.createElement("link");
132
132
  t.rel = "preconnect", t.href = "https://fonts.gstatic.com", t.crossOrigin = "anonymous", document.head.appendChild(t);
133
- const n = document.createElement("link");
134
- n.id = "strata-fonts", n.rel = "stylesheet", n.href = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Press+Start+2P&family=Cinzel:wght@400;600;700&display=swap", document.head.appendChild(n);
133
+ const i = document.createElement("link");
134
+ i.id = "strata-fonts", i.rel = "stylesheet", i.href = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Press+Start+2P&family=Cinzel:wght@400;600;700&display=swap", document.head.appendChild(i);
135
135
  }
136
136
  if (!document.querySelector('script[src*="cast_sender.js"]') && !window.cast) {
137
- const i = document.createElement("script");
138
- i.src = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1", document.head.appendChild(i);
137
+ const n = document.createElement("script");
138
+ n.src = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1", document.head.appendChild(n);
139
139
  }
140
140
  }
141
- }, je = {
141
+ }, tt = {
142
142
  useNative: !1,
143
143
  fixCapitalization: !1,
144
144
  backgroundOpacity: 50,
@@ -149,7 +149,7 @@ const Be = (i) => {
149
149
  isBold: !1,
150
150
  textColor: "#ffffff",
151
151
  verticalOffset: 40
152
- }, Et = "strata-settings", D = {
152
+ }, Ht = "strata-settings", te = {
153
153
  isPlaying: !1,
154
154
  isBuffering: !1,
155
155
  isLive: !1,
@@ -171,7 +171,7 @@ const Be = (i) => {
171
171
  subtitleTracks: [],
172
172
  currentSubtitle: -1,
173
173
  subtitleOffset: 0,
174
- subtitleSettings: je,
174
+ subtitleSettings: tt,
175
175
  activeCues: [],
176
176
  viewMode: "normal",
177
177
  notifications: [],
@@ -188,86 +188,89 @@ const Be = (i) => {
188
188
  isAutoSized: !1,
189
189
  isLooping: !1,
190
190
  controlsVisible: !0
191
- }, Ft = (i = {}) => {
191
+ }, Wt = (n = {}) => {
192
192
  let t = {};
193
- if (!i.disablePersistence && typeof window < "u")
193
+ if (!n.disablePersistence && typeof window < "u")
194
194
  try {
195
- const o = localStorage.getItem(Et);
195
+ const o = localStorage.getItem(Ht);
196
196
  o && (t = JSON.parse(o));
197
197
  } catch {
198
198
  }
199
- const n = {
200
- ...je,
199
+ const i = {
200
+ ...tt,
201
201
  ...t.subtitleSettings || {},
202
- ...i.subtitleSettings || {}
202
+ ...n.subtitleSettings || {}
203
203
  };
204
204
  return {
205
- ...D,
205
+ ...te,
206
206
  ...t,
207
207
  // Load saved first
208
208
  // Override with config if present (not undefined)
209
- volume: i.volume ?? t.volume ?? D.volume,
210
- isMuted: i.muted ?? t.isMuted ?? D.isMuted,
211
- playbackRate: i.playbackRate ?? t.playbackRate ?? D.playbackRate,
212
- audioGain: i.audioGain ?? t.audioGain ?? D.audioGain,
213
- theme: i.theme ?? t.theme ?? D.theme,
214
- themeColor: i.themeColor ?? t.themeColor ?? D.themeColor,
215
- iconSize: i.iconSize ?? t.iconSize ?? D.iconSize,
216
- subtitleSettings: n,
209
+ volume: n.volume ?? t.volume ?? te.volume,
210
+ isMuted: n.muted ?? t.isMuted ?? te.isMuted,
211
+ playbackRate: n.playbackRate ?? t.playbackRate ?? te.playbackRate,
212
+ audioGain: n.audioGain ?? t.audioGain ?? te.audioGain,
213
+ theme: n.theme ?? t.theme ?? te.theme,
214
+ themeColor: n.themeColor ?? t.themeColor ?? te.themeColor,
215
+ iconSize: n.iconSize ?? t.iconSize ?? te.iconSize,
216
+ subtitleSettings: i,
217
217
  // Config overrides state for these visual modes
218
- isAutoSized: i.autoSize ?? D.isAutoSized,
219
- isLive: i.isLive ?? t.isLive ?? D.isLive,
220
- isLooping: i.loop ?? t.isLooping ?? D.isLooping,
218
+ isAutoSized: n.autoSize ?? te.isAutoSized,
219
+ isLive: n.isLive ?? t.isLive ?? te.isLive,
220
+ isLooping: n.loop ?? t.isLooping ?? te.isLooping,
221
221
  sourceStatuses: {}
222
222
  // Never persist statuses
223
223
  };
224
224
  };
225
- class xi {
226
- constructor(t = {}, n) {
227
- M(this, "video");
228
- M(this, "container", null);
229
- M(this, "events");
230
- M(this, "store");
231
- M(this, "plugins", /* @__PURE__ */ new Map());
232
- M(this, "audioEngine");
233
- M(this, "config");
234
- M(this, "resizeObserver", null);
225
+ class Ni {
226
+ constructor(t = {}, i) {
227
+ R(this, "video");
228
+ R(this, "container", null);
229
+ R(this, "events");
230
+ R(this, "store");
231
+ R(this, "plugins", /* @__PURE__ */ new Map());
232
+ R(this, "audioEngine");
233
+ R(this, "config");
234
+ R(this, "resizeObserver", null);
235
235
  // Retry Logic
236
- M(this, "retryCount", 0);
237
- M(this, "maxRetries", 5);
238
- M(this, "retryTimer", null);
239
- M(this, "currentSource", null);
240
- M(this, "currentSrc", "");
241
- M(this, "currentTracks", []);
236
+ R(this, "retryCount", 0);
237
+ R(this, "maxRetries", 5);
238
+ R(this, "retryTimer", null);
239
+ R(this, "currentSource", null);
240
+ R(this, "currentSrc", "");
241
+ // Track configs from setSources are stored here to lazy load
242
+ R(this, "trackConfigs", []);
243
+ // Download Control
244
+ R(this, "currentDownloadController", null);
242
245
  // Cast
243
- M(this, "castInitialized", !1);
244
- M(this, "boundCueChange");
245
- M(this, "boundFullscreenChange");
246
- vi(), 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 = n || document.createElement("video"), this.video.crossOrigin = "anonymous", t.playsInline !== !1 && (this.video.playsInline = !0), this.events = new pi();
247
- const o = Ft(t);
248
- this.store = new mi(o), this.audioEngine = new fi(this.video), this.boundCueChange = this.handleCueChange.bind(this), this.boundFullscreenChange = () => {
249
- const l = !!document.fullscreenElement;
250
- if (this.store.setState({ isFullscreen: l }), this.emit("resize"), this.emit(l ? "fullscreen" : "fullscreen_exit"), l && this.config.autoOrientation && screen.orientation && "lock" in screen.orientation) {
251
- const h = this.video.videoWidth > this.video.videoHeight ? "landscape" : "portrait";
246
+ R(this, "castInitialized", !1);
247
+ R(this, "boundCueChange");
248
+ R(this, "boundFullscreenChange");
249
+ Ci(), 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", t.playsInline !== !1 && (this.video.playsInline = !0), this.events = new xi();
250
+ const o = Wt(t);
251
+ this.store = new wi(o), this.audioEngine = new yi(this.video), this.boundCueChange = this.handleCueChange.bind(this), this.boundFullscreenChange = () => {
252
+ const r = !!document.fullscreenElement;
253
+ if (this.store.setState({ isFullscreen: r }), this.emit("resize"), this.emit(r ? "fullscreen" : "fullscreen_exit"), r && this.config.autoOrientation && screen.orientation && "lock" in screen.orientation) {
254
+ const u = this.video.videoWidth > this.video.videoHeight ? "landscape" : "portrait";
252
255
  try {
253
- screen.orientation.lock(h).catch(() => {
256
+ screen.orientation.lock(u).catch(() => {
254
257
  });
255
258
  } catch {
256
259
  }
257
- } else !l && screen.orientation && "unlock" in screen.orientation && screen.orientation.unlock();
258
- }, this.video.volume = o.volume, this.video.muted = o.isMuted, this.video.playbackRate = o.playbackRate, this.video.loop = o.isLooping, o.audioGain > 1 && this.audioEngine.setGain(o.audioGain), o.isAutoSized && (this.video.style.objectFit = "cover"), this.initVideoListeners(), this.initMediaSession(), this.initCast(), t.disablePersistence || this.store.subscribe((l) => {
259
- const u = {
260
- volume: l.volume,
261
- isMuted: l.isMuted,
262
- playbackRate: l.playbackRate,
263
- subtitleSettings: l.subtitleSettings,
264
- iconSize: l.iconSize,
265
- themeColor: l.themeColor,
266
- theme: l.theme,
267
- isLive: l.isLive,
268
- isLooping: l.isLooping
260
+ } else !r && screen.orientation && "unlock" in screen.orientation && screen.orientation.unlock();
261
+ }, this.video.volume = o.volume, this.video.muted = o.isMuted, this.video.playbackRate = o.playbackRate, this.video.loop = o.isLooping, o.audioGain > 1 && this.audioEngine.setGain(o.audioGain), o.isAutoSized && (this.video.style.objectFit = "cover"), this.initVideoListeners(), this.initMediaSession(), this.initCast(), t.disablePersistence || this.store.subscribe((r) => {
262
+ const h = {
263
+ volume: r.volume,
264
+ isMuted: r.isMuted,
265
+ playbackRate: r.playbackRate,
266
+ subtitleSettings: r.subtitleSettings,
267
+ iconSize: r.iconSize,
268
+ themeColor: r.themeColor,
269
+ theme: r.theme,
270
+ isLive: r.isLive,
271
+ isLooping: r.isLooping
269
272
  };
270
- localStorage.setItem(Et, JSON.stringify(u));
273
+ localStorage.setItem(Ht, JSON.stringify(h));
271
274
  });
272
275
  }
273
276
  // --- Instance Properties ---
@@ -318,14 +321,14 @@ class xi {
318
321
  this.skip(-t);
319
322
  }
320
323
  // --- Event API ---
321
- on(t, n) {
322
- return this.events.on(t, n);
324
+ on(t, i) {
325
+ return this.events.on(t, i);
323
326
  }
324
- off(t, n) {
325
- return this.events.off(t, n);
327
+ off(t, i) {
328
+ return this.events.off(t, i);
326
329
  }
327
- emit(t, n) {
328
- return this.events.emit(t, n);
330
+ emit(t, i) {
331
+ return this.events.emit(t, i);
329
332
  }
330
333
  initVideoListeners() {
331
334
  const t = (o) => this.store.setState(o);
@@ -353,8 +356,8 @@ class xi {
353
356
  "volumechange",
354
357
  "waiting"
355
358
  ].forEach((o) => {
356
- this.video.addEventListener(o, (l) => {
357
- switch (this.emit(`video:${o}`, l), o === "play" && this.emit("play"), o === "pause" && this.emit("pause"), o === "ended" && this.emit("ended"), o === "error" && this.emit("error", this.video.error), o === "seeked" && this.emit("seek"), o) {
359
+ this.video.addEventListener(o, (r) => {
360
+ switch (this.emit(`video:${o}`, r), o === "play" && this.emit("play"), o === "pause" && this.emit("pause"), o === "ended" && this.emit("ended"), o === "error" && this.emit("error", this.video.error), o === "seeked" && this.emit("seek"), o) {
358
361
  case "play":
359
362
  t({ isPlaying: !0 }), "mediaSession" in navigator && (navigator.mediaSession.playbackState = "playing"), this.updateMediaSessionPosition();
360
363
  break;
@@ -412,151 +415,174 @@ class xi {
412
415
  t({ isPip: !0 }), this.emit("pip", !0);
413
416
  }), this.video.addEventListener("leavepictureinpicture", () => {
414
417
  t({ isPip: !1 }), this.emit("pip", !1);
415
- }), document.addEventListener("fullscreenchange", this.boundFullscreenChange), this.video.textTracks.addEventListener("addtrack", this.updateSubtitles.bind(this)), this.video.textTracks.addEventListener("removetrack", this.updateSubtitles.bind(this));
418
+ }), document.addEventListener("fullscreenchange", this.boundFullscreenChange);
416
419
  }
417
420
  updateSourceStatus(t) {
418
- const n = this.store.get().currentSourceIndex;
419
- n !== -1 && this.store.setState((o) => ({
420
- sourceStatuses: { ...o.sourceStatuses, [n]: t }
421
+ const i = this.store.get().currentSourceIndex;
422
+ i !== -1 && this.store.setState((o) => ({
423
+ sourceStatuses: { ...o.sourceStatuses, [i]: t }
421
424
  }));
422
425
  }
423
426
  // --- Media Session API ---
424
427
  initMediaSession() {
425
428
  if (!("mediaSession" in navigator)) return;
426
429
  const t = navigator.mediaSession;
427
- t.setActionHandler("play", () => this.play()), t.setActionHandler("pause", () => this.pause()), t.setActionHandler("seekbackward", (n) => this.skip(n.seekOffset ? -n.seekOffset : -10)), t.setActionHandler("seekforward", (n) => this.skip(n.seekOffset || 10)), t.setActionHandler("seekto", (n) => {
428
- n.seekTime !== void 0 && this.seek(n.seekTime);
430
+ t.setActionHandler("play", () => this.play()), t.setActionHandler("pause", () => this.pause()), t.setActionHandler("seekbackward", (i) => this.skip(i.seekOffset ? -i.seekOffset : -10)), t.setActionHandler("seekforward", (i) => this.skip(i.seekOffset || 10)), t.setActionHandler("seekto", (i) => {
431
+ i.seekTime !== void 0 && this.seek(i.seekTime);
429
432
  }), t.setActionHandler("stop", () => {
430
433
  this.pause(), this.seek(0);
431
434
  }), t.setActionHandler("previoustrack", () => {
432
- const n = this.store.get().currentSourceIndex;
433
- n > 0 && this.switchSource(n - 1);
435
+ const i = this.store.get().currentSourceIndex;
436
+ i > 0 && this.switchSource(i - 1);
434
437
  }), t.setActionHandler("nexttrack", () => {
435
- const n = this.store.get().currentSourceIndex, o = this.store.get().sources.length;
436
- n < o - 1 && this.switchSource(n + 1);
438
+ const i = this.store.get().currentSourceIndex, o = this.store.get().sources.length;
439
+ i < o - 1 && this.switchSource(i + 1);
437
440
  });
438
441
  }
439
442
  updateMediaSessionMetadata() {
440
- var o, l;
443
+ var o, r;
441
444
  if (!("mediaSession" in navigator)) return;
442
- const t = ((o = this.currentSource) == null ? void 0 : o.name) || ((l = this.currentSource) == null ? void 0 : l.url.split("/").pop()) || "Video", n = [];
443
- this.config.poster && n.push({ src: this.config.poster, sizes: "512x512", type: "image/jpeg" }), n.push({ src: "logo.png", sizes: "512x512", type: "image/png" }), navigator.mediaSession.metadata = new MediaMetadata({
445
+ const t = ((o = this.currentSource) == null ? void 0 : o.name) || ((r = this.currentSource) == null ? void 0 : r.url.split("/").pop()) || "Video", i = [];
446
+ 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({
444
447
  title: t,
445
448
  artist: "StrataPlayer",
446
- artwork: n
449
+ artwork: i
447
450
  });
448
451
  }
449
452
  updateMediaSessionPosition() {
450
453
  if (!("mediaSession" in navigator)) return;
451
- const t = this.video.duration, n = this.video.currentTime, o = this.video.playbackRate;
452
- if (!isNaN(t) && isFinite(t) && !isNaN(n))
454
+ const t = this.video.duration, i = this.video.currentTime, o = this.video.playbackRate;
455
+ if (!isNaN(t) && isFinite(t) && !isNaN(i))
453
456
  try {
454
457
  navigator.mediaSession.setPositionState({
455
458
  duration: Math.max(0, t),
456
459
  playbackRate: o,
457
- position: Math.max(0, Math.min(n, t))
460
+ position: Math.max(0, Math.min(i, t))
458
461
  // Ensure within [0, duration]
459
462
  });
460
- } catch (l) {
461
- console.warn("MediaSession Position Error:", l);
463
+ } catch (r) {
464
+ console.warn("MediaSession Position Error:", r);
462
465
  }
463
466
  }
464
- triggerError(t, n = !1) {
465
- n ? this.handleError(t) : this.notify({ type: "warning", message: `Warning: ${t}`, duration: 5e3 });
467
+ triggerError(t, i = !1) {
468
+ i ? this.handleError(t) : this.notify({ type: "warning", message: `Warning: ${t}`, duration: 5e3 });
466
469
  }
467
470
  handleError(t) {
468
- const n = this.video.error, o = t || (n == null ? void 0 : n.message) || (n ? `Code ${n.code}` : "Unknown Error");
469
- if (this.removeNotification("retry"), this.emit("video:error", n), this.retryCount < this.maxRetries) {
471
+ const i = this.video.error, o = t || (i == null ? void 0 : i.message) || (i ? `Code ${i.code}` : "Unknown Error");
472
+ if (this.removeNotification("retry"), this.emit("video:error", i), this.retryCount < this.maxRetries) {
470
473
  this.retryCount++;
471
- const l = Math.pow(2, this.retryCount - 1) * 1500;
474
+ const r = Math.pow(2, this.retryCount - 1) * 1500;
472
475
  this.notify({
473
476
  id: "retry",
474
477
  type: "loading",
475
- message: `Error: ${o}. Retrying (${this.retryCount}/${this.maxRetries})...`
476
- }), console.warn(`[StrataPlayer] Error: ${o}. Retrying in ${l}ms...`), this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = setTimeout(() => {
478
+ // Cleaned up formatting with newline
479
+ message: `Error: ${o}.
480
+ Retrying (${this.retryCount}/${this.maxRetries})`
481
+ }), console.warn(`[StrataPlayer] Error: ${o}. Retrying in ${r}ms...`), this.retryTimer && clearTimeout(this.retryTimer), this.retryTimer = setTimeout(() => {
477
482
  if (this.currentSource) {
478
- this.load(this.currentSource, this.currentTracks, !0);
479
- const u = this.store.get().currentTime;
480
- if (u > 0) {
481
- const h = () => {
482
- this.video.currentTime = u, this.video.removeEventListener("canplay", h);
483
+ this.load(this.currentSource, this.trackConfigs, !0);
484
+ const h = this.store.get().currentTime;
485
+ if (h > 0) {
486
+ const u = () => {
487
+ this.video.currentTime = h, this.video.removeEventListener("canplay", u);
483
488
  };
484
- this.video.addEventListener("canplay", h);
489
+ this.video.addEventListener("canplay", u);
485
490
  }
486
491
  }
487
- }, l);
492
+ }, r);
488
493
  } else {
489
494
  this.removeNotification("retry");
490
- const l = `Failed to play after ${this.maxRetries} attempts: ${o}`;
491
- this.store.setState({ error: l }), this.emit("error", l), this.updateSourceStatus("error");
495
+ const r = `Failed to play after ${this.maxRetries} attempts: ${o}`;
496
+ this.store.setState({ error: r }), this.emit("error", r), this.updateSourceStatus("error");
492
497
  }
493
498
  }
494
499
  updateBuffer() {
495
500
  const t = [];
496
- for (let n = 0; n < this.video.buffered.length; n++)
501
+ for (let i = 0; i < this.video.buffered.length; i++)
497
502
  t.push({
498
- start: this.video.buffered.start(n),
499
- end: this.video.buffered.end(n)
503
+ start: this.video.buffered.start(i),
504
+ end: this.video.buffered.end(i)
500
505
  });
501
506
  this.store.setState({ buffered: t });
502
507
  }
503
- updateSubtitles() {
504
- setTimeout(() => {
505
- const t = Array.from(this.video.textTracks).filter((o) => o.kind === "subtitles" || o.kind === "captions").map((o, l) => ({
506
- label: o.label || o.language || `Track ${l + 1}`,
507
- language: o.language,
508
- index: l
509
- }));
510
- this.store.setState({ subtitleTracks: t });
511
- const n = this.store.get();
512
- n.currentSubtitle !== -1 && t.length > 0 && n.currentSubtitle < t.length && this.setSubtitle(n.currentSubtitle);
513
- }, 50);
508
+ updateSubtitleTrackState(t, i) {
509
+ this.store.setState((o) => {
510
+ const r = [...o.subtitleTracks];
511
+ return r[t] && (r[t] = { ...r[t], ...i }), { subtitleTracks: r };
512
+ });
514
513
  }
515
514
  // --- Utility ---
516
- async fetchWithRetry(t, n = 3, o) {
517
- const l = o ?? this.config.fetchTimeout ?? 3e4;
518
- for (let u = 0; u < n; u++) {
519
- const h = new AbortController(), v = setTimeout(() => h.abort(), l);
515
+ async fetchWithRetry(t, i = 3, o, r) {
516
+ const h = o ?? this.config.fetchTimeout ?? 3e4;
517
+ for (let u = 0; u < i; u++) {
518
+ const f = r ? null : new AbortController(), g = r || (f == null ? void 0 : f.signal), x = setTimeout(() => f == null ? void 0 : f.abort(), h);
520
519
  try {
521
- const w = await fetch(t, { signal: h.signal });
522
- if (clearTimeout(v), !w.ok) throw new Error(`HTTP ${w.status}`);
523
- return w;
524
- } catch (w) {
525
- if (clearTimeout(v), u === n - 1) throw w;
526
- w.name === "AbortError" && console.warn(`Fetch timeout (${l}ms) for ${t}`), await new Promise((b) => setTimeout(b, 1e3 * Math.pow(2, u)));
520
+ const p = await fetch(t, { signal: g });
521
+ if (clearTimeout(x), !p.ok) throw new Error(`HTTP ${p.status}`);
522
+ return p;
523
+ } catch (p) {
524
+ if (clearTimeout(x), r != null && r.aborted) throw new Error("Aborted");
525
+ if (u === i - 1) throw p;
526
+ if (p.name === "AbortError") {
527
+ if (r != null && r.aborted) throw p;
528
+ console.warn(`Fetch timeout (${h}ms) for ${t}`);
529
+ }
530
+ await new Promise((w) => setTimeout(w, 1e3 * Math.pow(2, u)));
527
531
  }
528
532
  }
529
533
  throw new Error("Fetch failed");
530
534
  }
535
+ // Helper to ensure subtitle content is VTT
536
+ convertToVTT(t) {
537
+ let i = t.trim();
538
+ if (!i.startsWith("WEBVTT")) {
539
+ let o = i.replace(/(\d+:\d{2}:\d{2}),(\d{3})/g, "$1.$2");
540
+ return o = o.replace(/(\d{2}:\d{2}),(\d{3})/g, "$1.$2"), `WEBVTT
541
+
542
+ ` + o;
543
+ }
544
+ return i;
545
+ }
546
+ // Enhanced Format Duration: Days, Hours, Minutes, Seconds
547
+ formatDuration(t) {
548
+ if (!isFinite(t) || t <= 0) return "";
549
+ const i = Math.floor(t / 1e3), o = Math.floor(i / (3600 * 24)), r = Math.floor(i % (3600 * 24) / 3600), h = Math.floor(i % 3600 / 60), u = i % 60, f = [];
550
+ return o > 0 && f.push(`${o}d`), r > 0 && f.push(`${r}h`), h > 0 && f.push(`${h}m`), f.push(`${u}s`), f.join(" ");
551
+ }
531
552
  // --- Core Methods ---
532
553
  attach(t) {
533
- this.resizeObserver && this.resizeObserver.disconnect(), this.container = t, this.container.appendChild(this.video), this.video.style.width = "100%", this.video.style.height = "100%", this.video.style.objectFit = this.store.get().isAutoSized ? "cover" : "contain", this.video.style.backgroundColor = "black", this.updateAspectRatio(), this.resizeObserver = new ResizeObserver((n) => {
534
- for (const o of n)
554
+ this.resizeObserver && this.resizeObserver.disconnect(), this.container = t, this.container.appendChild(this.video), this.video.style.width = "100%", this.video.style.height = "100%", this.video.style.objectFit = this.store.get().isAutoSized ? "cover" : "contain", this.video.style.backgroundColor = "black", this.updateAspectRatio(), this.resizeObserver = new ResizeObserver((i) => {
555
+ for (const o of i)
535
556
  this.emit("resize", { width: o.contentRect.width, height: o.contentRect.height }), this.updateAspectRatio();
536
557
  }), this.resizeObserver.observe(this.container), this.emit("ready");
537
558
  }
538
559
  use(t) {
539
560
  this.plugins.has(t.name) || (t.init(this), this.plugins.set(t.name, t));
540
561
  }
541
- setSources(t, n = []) {
542
- this.store.setState({ sources: t }), this.currentTracks = n, t.length > 0 && this.load(t[0], n);
562
+ setSources(t, i = []) {
563
+ this.store.setState({ sources: t }), this.trackConfigs = i, t.length > 0 && this.load(t[0], i);
543
564
  }
544
565
  switchSource(t) {
545
- const n = this.store.get().sources;
546
- if (t >= 0 && t < n.length) {
547
- const o = this.video.currentTime, l = !this.video.paused;
548
- this.load(n[t], this.currentTracks);
549
- const u = () => {
550
- this.video.currentTime = o, l && this.video.play(), this.video.removeEventListener("canplay", u);
566
+ const i = this.store.get().sources;
567
+ if (t >= 0 && t < i.length) {
568
+ const o = this.video.currentTime, r = !this.video.paused;
569
+ this.load(i[t], this.trackConfigs);
570
+ const h = () => {
571
+ this.video.currentTime = o, r && this.video.play(), this.video.removeEventListener("canplay", h);
551
572
  };
552
- this.video.addEventListener("canplay", u);
573
+ this.video.addEventListener("canplay", h);
553
574
  }
554
575
  }
555
- load(t, n = [], o = !1) {
576
+ load(t, i = [], o = !1) {
556
577
  this.retryTimer && clearTimeout(this.retryTimer);
557
- const l = typeof t == "string" ? { url: t, type: "auto" } : t;
558
- o || (this.retryCount = 0, this.store.setState({ error: null }), this.removeNotification("retry")), this.currentSrc = l.url, this.currentSource = l, this.currentTracks = n;
559
- const h = this.store.get().sources.findIndex((b) => b.url === l.url);
578
+ const r = typeof t == "string" ? { url: t, type: "auto" } : t;
579
+ o || (this.retryCount = 0, this.store.setState({ error: null }), this.removeNotification("retry")), this.currentSrc = r.url, this.currentSource = r, this.trackConfigs = i;
580
+ const u = this.store.get().sources.findIndex((w) => w.url === r.url), f = i.map((w, m) => ({
581
+ ...w,
582
+ index: m,
583
+ status: "idle",
584
+ isDefault: !!w.default
585
+ }));
560
586
  this.store.setState({
561
587
  isBuffering: !0,
562
588
  qualityLevels: [],
@@ -565,47 +591,50 @@ class xi {
565
591
  audioTracks: [],
566
592
  currentAudioTrack: -1,
567
593
  // Reset audio track
568
- // subtitleTracks and currentSubtitle are purposely preserved
569
- currentSourceIndex: h
594
+ subtitleTracks: f,
595
+ currentSubtitle: -1,
596
+ currentSourceIndex: u
570
597
  }), this.updateMediaSessionMetadata();
571
- let v = l.type || "auto";
572
- v === "auto" && (l.url.includes(".m3u8") ? v = "hls" : l.url.includes(".mpd") ? v = "dash" : l.url.includes(".flv") || l.url.includes(".ts") ? v = "mpegts" : l.url.startsWith("magnet:") || l.url.includes(".torrent") ? v = "webtorrent" : v = "mp4"), this.events.emit("load", { url: l.url, type: v });
573
- const w = this.video.getElementsByTagName("track");
574
- for (; w.length > 0; )
575
- w[0].remove();
576
- n.length > 0 && n.forEach((b) => {
577
- this.fetchWithRetry(b.src).then(() => {
578
- this.addTextTrackInternal(b.src, b.label, b.srcLang, b.default);
579
- }).catch((p) => {
580
- this.notify({ type: "warning", message: `Failed to load subtitle: ${b.label}`, duration: 4e3 });
581
- });
582
- }), (v === "mp4" || v === "webm" || v === "ogg") && (this.video.src = l.url);
598
+ let g = r.type || "auto";
599
+ g === "auto" && (r.url.includes(".m3u8") ? g = "hls" : r.url.includes(".mpd") ? g = "dash" : r.url.includes(".flv") || r.url.includes(".ts") ? g = "mpegts" : r.url.startsWith("magnet:") || r.url.includes(".torrent") ? g = "webtorrent" : g = "mp4"), this.events.emit("load", { url: r.url, type: g });
600
+ const x = this.video.getElementsByTagName("track");
601
+ for (; x.length > 0; )
602
+ x[0].remove();
603
+ const p = f.findIndex((w) => w.default);
604
+ p !== -1 && this.setSubtitle(p), (g === "mp4" || g === "webm" || g === "ogg") && (this.video.src = r.url);
583
605
  }
584
606
  // Wrapper for external subtitle API
585
- loadSubtitle(t, n = "Subtitle") {
586
- this.addTextTrackInternal(t, n, void 0, !0);
607
+ loadSubtitle(t, i = "Subtitle") {
608
+ const o = this.store.get().subtitleTracks.length, r = {
609
+ src: t,
610
+ label: i,
611
+ srcLang: "user",
612
+ default: !0,
613
+ kind: "subtitles",
614
+ index: o,
615
+ status: "idle",
616
+ isDefault: !0
617
+ };
618
+ this.store.setState((h) => ({
619
+ subtitleTracks: [...h.subtitleTracks, r]
620
+ })), this.setSubtitle(o);
587
621
  }
588
- addTextTrack(t, n) {
622
+ addTextTrack(t, i) {
589
623
  const o = new FileReader();
590
- o.onload = (l) => {
591
- var w;
592
- if (!((w = l.target) != null && w.result)) return;
593
- let u = l.target.result;
594
- (t.name.toLowerCase().endsWith(".srt") || !u.trim().startsWith("WEBVTT")) && (u = u.replace(/(\d{2}:\d{2}:\d{2}),(\d{3})/g, "$1.$2"), u.trim().startsWith("WEBVTT") || (u = `WEBVTT
595
-
596
- ` + u));
597
- const h = new Blob([u], { type: "text/vtt" }), v = URL.createObjectURL(h);
598
- this.addTextTrackInternal(v, n, "user", !0), setTimeout(() => {
599
- const p = this.store.get().subtitleTracks.findIndex((y) => y.label === n);
600
- p !== -1 && (this.setSubtitle(p), this.notify({ type: "success", message: "Subtitle uploaded", duration: 3e3 }));
601
- }, 200);
624
+ o.onload = (r) => {
625
+ var g;
626
+ if (!((g = r.target) != null && g.result)) return;
627
+ let h = r.target.result;
628
+ h = this.convertToVTT(h);
629
+ const u = new Blob([h], { type: "text/vtt" }), f = URL.createObjectURL(u);
630
+ this.loadSubtitle(f, i), this.notify({ type: "success", message: "Subtitle uploaded", duration: 3e3 });
602
631
  }, o.onerror = () => {
603
632
  this.notify({ type: "error", message: "Failed to read file", duration: 3e3 });
604
633
  }, o.readAsText(t);
605
634
  }
606
- addTextTrackInternal(t, n, o = "", l = !1) {
607
- const u = document.createElement("track");
608
- u.kind = "subtitles", u.label = n, u.src = t, u.srclang = o, l && (u.default = !0), this.video.appendChild(u), this.updateSubtitles();
635
+ addTextTrackInternal(t, i, o = "", r = !1) {
636
+ const h = document.createElement("track");
637
+ h.kind = "subtitles", h.label = i, h.src = t, h.srclang = o, r && (h.default = !0), this.video.appendChild(h);
609
638
  }
610
639
  play() {
611
640
  return this.video.play();
@@ -618,15 +647,15 @@ class xi {
618
647
  }
619
648
  seek(t) {
620
649
  if (isNaN(t)) return;
621
- const n = Math.max(0, Math.min(t, this.video.duration));
622
- this.store.setState({ currentTime: n }), this.video.currentTime = n;
650
+ const i = Math.max(0, Math.min(t, this.video.duration));
651
+ this.store.setState({ currentTime: i }), this.video.currentTime = i;
623
652
  }
624
653
  skip(t) {
625
654
  this.seek(this.video.currentTime + t);
626
655
  }
627
656
  setVolume(t) {
628
- const n = Math.max(0, Math.min(t, 1));
629
- this.video.volume = n, n > 0 && this.video.muted && (this.video.muted = !1), n === 0 && (this.video.muted = !0);
657
+ const i = Math.max(0, Math.min(t, 1));
658
+ this.video.volume = i, i > 0 && this.video.muted && (this.video.muted = !1), i === 0 && (this.video.muted = !0);
630
659
  }
631
660
  toggleMute() {
632
661
  this.video.muted = !this.video.muted;
@@ -665,8 +694,8 @@ class xi {
665
694
  const t = this.store.get().isWebFullscreen;
666
695
  document.fullscreenElement && document.exitFullscreen().catch(() => {
667
696
  });
668
- const n = !t;
669
- this.store.setState({ isWebFullscreen: n }), typeof document < "u" && (document.body.style.overflow = n ? "hidden" : ""), this.emit("webfullscreen", n);
697
+ const i = !t;
698
+ this.store.setState({ isWebFullscreen: i }), typeof document < "u" && (document.body.style.overflow = i ? "hidden" : ""), this.emit("webfullscreen", i);
670
699
  }
671
700
  togglePip() {
672
701
  document.pictureInPictureElement ? document.exitPictureInPicture() : this.video !== document.pictureInPictureElement && this.video.requestPictureInPicture && this.video.requestPictureInPicture();
@@ -674,12 +703,12 @@ class xi {
674
703
  screenshot() {
675
704
  const t = document.createElement("canvas");
676
705
  t.width = this.video.videoWidth, t.height = this.video.videoHeight;
677
- const n = t.getContext("2d");
678
- if (n) {
679
- n.drawImage(this.video, 0, 0, t.width, t.height);
706
+ const i = t.getContext("2d");
707
+ if (i) {
708
+ i.drawImage(this.video, 0, 0, t.width, t.height);
680
709
  try {
681
- const o = t.toDataURL("image/png"), l = document.createElement("a");
682
- l.download = `screenshot-${(/* @__PURE__ */ new Date()).toISOString()}.png`, l.href = o, l.click(), this.notify({ type: "success", message: "Screenshot saved", duration: 2e3 });
710
+ const o = t.toDataURL("image/png"), r = document.createElement("a");
711
+ r.download = `screenshot-${(/* @__PURE__ */ new Date()).toISOString()}.png`, r.href = o, r.click(), this.notify({ type: "success", message: "Screenshot saved", duration: 2e3 });
683
712
  } catch {
684
713
  this.notify({ type: "error", message: "Failed to take screenshot", duration: 3e3 });
685
714
  }
@@ -692,34 +721,34 @@ class xi {
692
721
  this.video.loop = !this.video.loop, this.store.setState({ isLooping: this.video.loop }), this.notify({ type: "info", message: `Loop: ${this.video.loop ? "On" : "Off"}`, duration: 1500 });
693
722
  }
694
723
  setFlip(t) {
695
- const n = this.store.get().flipState, o = {
696
- ...n,
697
- [t]: !n[t]
724
+ const i = this.store.get().flipState, o = {
725
+ ...i,
726
+ [t]: !i[t]
698
727
  };
699
728
  this.store.setState({ flipState: o });
700
- const l = o.horizontal ? -1 : 1, u = o.vertical ? -1 : 1;
701
- this.video.style.transform = `scale(${l}, ${u})`;
729
+ const r = o.horizontal ? -1 : 1, h = o.vertical ? -1 : 1;
730
+ this.video.style.transform = `scale(${r}, ${h})`;
702
731
  }
703
732
  setAspectRatio(t) {
704
733
  this.store.setState({ aspectRatio: t }), this.updateAspectRatio(), t !== "default" && this.notify({ type: "info", message: `Aspect Ratio: ${t}`, duration: 2e3 });
705
734
  }
706
735
  updateAspectRatio() {
707
736
  if (!this.container) return;
708
- const { aspectRatio: t, isAutoSized: n } = this.store.get();
737
+ const { aspectRatio: t, isAutoSized: i } = this.store.get();
709
738
  if (t === "default") {
710
- this.video.style.width = "100%", this.video.style.height = "100%", this.video.style.objectFit = n ? "cover" : "contain";
739
+ this.video.style.width = "100%", this.video.style.height = "100%", this.video.style.objectFit = i ? "cover" : "contain";
711
740
  return;
712
741
  }
713
- const [o, l] = t.split(":").map(Number);
714
- if (!o || !l) return;
715
- const u = o / l, h = this.container.getBoundingClientRect();
716
- if (h.width === 0 || h.height === 0) return;
717
- const v = h.width / h.height;
718
- let w, b;
719
- v > u ? (b = h.height, w = b * u) : (w = h.width, b = w / u), this.video.style.width = `${w}px`, this.video.style.height = `${b}px`, this.video.style.objectFit = "fill";
742
+ const [o, r] = t.split(":").map(Number);
743
+ if (!o || !r) return;
744
+ const h = o / r, u = this.container.getBoundingClientRect();
745
+ if (u.width === 0 || u.height === 0) return;
746
+ const f = u.width / u.height;
747
+ let g, x;
748
+ f > h ? (x = u.height, g = x * h) : (g = u.width, x = g / h), this.video.style.width = `${g}px`, this.video.style.height = `${x}px`, this.video.style.objectFit = "fill";
720
749
  }
721
750
  initCast() {
722
- const t = window, n = () => {
751
+ const t = window, i = () => {
723
752
  if (!this.castInitialized)
724
753
  try {
725
754
  t.cast && t.cast.framework && t.chrome && t.chrome.cast && (t.cast.framework.CastContext.getInstance().setOptions({
@@ -730,8 +759,8 @@ class xi {
730
759
  console.warn("Cast Init Error or already initialized", o);
731
760
  }
732
761
  };
733
- t.cast && t.cast.framework ? n() : t.__onGCastApiAvailable = (o) => {
734
- o && n();
762
+ t.cast && t.cast.framework ? i() : t.__onGCastApiAvailable = (o) => {
763
+ o && i();
735
764
  };
736
765
  }
737
766
  requestCast() {
@@ -740,8 +769,8 @@ class xi {
740
769
  try {
741
770
  this.castInitialized || this.initCast(), t.cast.framework.CastContext.getInstance().requestSession().then(() => {
742
771
  this.loadMediaToCast();
743
- }).catch((n) => {
744
- n !== "cancel" && this.notify({ type: "error", message: "Cast failed: " + n, duration: 3e3 });
772
+ }).catch((i) => {
773
+ i !== "cancel" && this.notify({ type: "error", message: "Cast failed: " + i, duration: 3e3 });
745
774
  });
746
775
  } catch {
747
776
  this.notify({ type: "warning", message: "Cast not available yet", duration: 3e3 });
@@ -752,199 +781,372 @@ class xi {
752
781
  loadMediaToCast() {
753
782
  const t = window;
754
783
  try {
755
- const n = t.cast.framework.CastContext.getInstance().getCurrentSession();
756
- if (!n) return;
757
- const o = new t.chrome.cast.media.MediaInfo(this.currentSrc, this.currentSrc.includes(".m3u8") ? "application/x-mpegurl" : "video/mp4"), l = new t.chrome.cast.media.LoadRequest(o);
758
- n.loadMedia(l).then(() => {
784
+ const i = t.cast.framework.CastContext.getInstance().getCurrentSession();
785
+ if (!i) return;
786
+ 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);
787
+ i.loadMedia(r).then(() => {
759
788
  this.notify({ type: "success", message: "Casting...", duration: 3e3 });
760
- }).catch((u) => console.error("Cast load error", u));
761
- } catch (n) {
762
- console.error("Failed to load media into Cast session", n);
789
+ }).catch((h) => console.error("Cast load error", h));
790
+ } catch (i) {
791
+ console.error("Failed to load media into Cast session", i);
763
792
  }
764
793
  }
765
794
  handleCueChange() {
766
- const t = this.store.get();
767
- if (t.currentSubtitle === -1) {
795
+ if (this.store.get().currentSubtitle === -1) {
768
796
  this.store.setState({ activeCues: [] });
769
797
  return;
770
798
  }
771
- const o = Array.from(this.video.textTracks).filter((l) => l.kind === "subtitles" || l.kind === "captions")[t.currentSubtitle];
799
+ const o = Array.from(this.video.textTracks).filter((r) => r.kind === "subtitles" || r.kind === "captions").find((r) => r.mode === "showing" || r.mode === "hidden");
772
800
  if (o && o.activeCues) {
773
- const l = Array.from(o.activeCues).map((u) => u.text);
774
- this.store.setState({ activeCues: l });
801
+ const r = Array.from(o.activeCues).map((h) => h.text);
802
+ this.store.setState({ activeCues: r });
775
803
  } else
776
804
  this.store.setState({ activeCues: [] });
777
805
  }
778
- setSubtitle(t) {
779
- if (Array.from(this.video.textTracks).forEach((n) => {
780
- n.removeEventListener("cuechange", this.boundCueChange), n.mode = "hidden";
781
- }), this.store.setState({ currentSubtitle: t, subtitleOffset: 0, activeCues: [] }), t !== -1) {
782
- const o = Array.from(this.video.textTracks).filter((l) => l.kind === "subtitles" || l.kind === "captions")[t];
783
- if (o) {
784
- const l = this.store.get().subtitleSettings;
785
- o.mode = l.useNative ? "showing" : "hidden", o.addEventListener("cuechange", this.boundCueChange), this.handleCueChange();
806
+ async setSubtitle(t) {
807
+ const o = this.store.get().subtitleTracks[t];
808
+ if (Array.from(this.video.textTracks).forEach((u) => {
809
+ u.removeEventListener("cuechange", this.boundCueChange), u.mode = "disabled";
810
+ }), this.store.setState({ currentSubtitle: t, subtitleOffset: 0, activeCues: [] }), t === -1 || !o) return;
811
+ if (o.status === "idle" || o.status === "error") {
812
+ this.updateSubtitleTrackState(t, { status: "loading" });
813
+ try {
814
+ let f = await (await this.fetchWithRetry(o.src)).text();
815
+ f = this.convertToVTT(f);
816
+ const g = new Blob([f], { type: "text/vtt" }), x = URL.createObjectURL(g);
817
+ this.addTextTrackInternal(x, o.label, o.srcLang, !1), this.updateSubtitleTrackState(t, { status: "success" });
818
+ } catch (u) {
819
+ this.updateSubtitleTrackState(t, { status: "error" }), console.error("Failed to load subtitle", u);
820
+ return;
786
821
  }
787
822
  }
823
+ const r = Array.from(this.video.textTracks);
824
+ let h = r.find((u) => u.label === o.label && u.language === o.srcLang);
825
+ if (h || (h = r.find((u) => u.label === o.label)), h) {
826
+ const u = this.store.get().subtitleSettings;
827
+ h.mode = u.useNative ? "showing" : "hidden", h.addEventListener("cuechange", this.boundCueChange), this.handleCueChange();
828
+ }
788
829
  }
789
830
  updateSubtitleSettings(t) {
790
831
  const o = { ...this.store.get().subtitleSettings, ...t };
791
- this.store.setState({ subtitleSettings: o }), t.useNative !== void 0 && this.setSubtitle(this.store.get().currentSubtitle);
832
+ if (this.store.setState({ subtitleSettings: o }), t.useNative !== void 0) {
833
+ const r = this.store.get().currentSubtitle;
834
+ if (r !== -1) {
835
+ const u = this.store.get().subtitleTracks[r], f = Array.from(this.video.textTracks).find((g) => g.label === u.label && g.language === u.srcLang);
836
+ f && (f.mode = t.useNative ? "showing" : "hidden");
837
+ }
838
+ }
792
839
  }
793
840
  resetSubtitleSettings() {
794
- this.store.setState({ subtitleSettings: je }), this.setSubtitle(this.store.get().currentSubtitle);
841
+ this.store.setState({ subtitleSettings: tt }), this.updateSubtitleSettings({ useNative: !1 });
795
842
  }
796
843
  setSubtitleOffset(t) {
797
- const n = this.store.get().subtitleOffset, o = t - n;
798
- Math.abs(o) < 1e-3 || (Array.from(this.video.textTracks).forEach((l) => {
799
- (l.mode === "showing" || l.mode === "hidden") && l.cues && Array.from(l.cues).forEach((u) => {
800
- u.startTime += o, u.endTime += o;
844
+ const i = this.store.get().subtitleOffset, o = t - i;
845
+ Math.abs(o) < 1e-3 || (Array.from(this.video.textTracks).forEach((r) => {
846
+ (r.mode === "showing" || r.mode === "hidden") && r.cues && Array.from(r.cues).forEach((h) => {
847
+ h.startTime += o, h.endTime += o;
801
848
  });
802
849
  }), this.store.setState({ subtitleOffset: t }), this.notify({ type: "info", message: `Subtitle Offset: ${t > 0 ? "+" : ""}${t.toFixed(1)}s`, duration: 1500 }));
803
850
  }
804
- async download() {
805
- var o;
806
- if (!this.video.src) return;
807
- const t = this.video.src;
808
- if (t.includes("blob:") || t.includes(".m3u8")) {
851
+ cancelDownload() {
852
+ this.currentDownloadController && (this.currentDownloadController.abort(), this.currentDownloadController = null, this.notify({ type: "info", message: "Download cancelled", duration: 2e3 }));
853
+ }
854
+ async download(t = {}) {
855
+ var h, u, f;
856
+ const i = ((h = this.currentSource) == null ? void 0 : h.url) || this.video.src;
857
+ if (!i) return;
858
+ if (i.includes(".m3u8") || ((u = this.currentSource) == null ? void 0 : u.type) === "hls") {
859
+ this.downloadHls(i, t.format || "ts");
860
+ return;
861
+ }
862
+ if (i.startsWith("blob:")) {
809
863
  this.notify({ type: "warning", message: "Stream download not supported in browser.", duration: 4e3 });
810
864
  return;
811
865
  }
812
- const n = this.notify({ type: "loading", message: "Preparing download...", progress: 0 });
866
+ this.currentDownloadController && this.currentDownloadController.abort(), this.currentDownloadController = new AbortController();
867
+ const o = this.currentDownloadController.signal, r = this.notify({
868
+ type: "loading",
869
+ message: "Preparing download",
870
+ // Removed ...
871
+ progress: 0,
872
+ action: {
873
+ label: "Cancel",
874
+ onClick: () => this.cancelDownload()
875
+ }
876
+ });
813
877
  try {
814
- const l = await this.fetchWithRetry(t);
815
- if (!l.body) throw new Error("No body");
816
- const u = l.body.getReader(), h = l.headers.get("Content-Length"), v = h ? parseInt(h, 10) : 0;
817
- let w = 0;
818
- const b = [];
878
+ const g = await this.fetchWithRetry(i, 3, void 0, o);
879
+ if (!g.body) throw new Error("No body");
880
+ const x = g.body.getReader(), p = g.headers.get("Content-Length"), w = p ? parseInt(p, 10) : 0;
881
+ let m = 0;
882
+ const T = [], I = Date.now(), O = [];
819
883
  for (; ; ) {
820
- const { done: T, value: $ } = await u.read();
821
- if (T) break;
822
- if (b.push($), w += $.length, v) {
823
- const g = Math.round(w / v * 100);
824
- this.notify({ id: n, type: "loading", message: `Downloading... ${g}%`, progress: g });
884
+ const { done: H, value: k } = await x.read();
885
+ if (H) break;
886
+ if (T.push(k), m += k.length, w) {
887
+ const q = Date.now(), $ = Math.round(m / w * 100);
888
+ for (O.push({ time: q, loaded: m }); O.length > 0 && q - O[0].time > 5e3; )
889
+ O.shift();
890
+ let j = "", Z = 0;
891
+ if (O.length > 1) {
892
+ const P = O[0], s = O[O.length - 1], ie = s.time - P.time, ne = s.loaded - P.loaded;
893
+ ie > 0 && (Z = ne / ie);
894
+ } else {
895
+ const P = q - I;
896
+ P > 0 && (Z = m / P);
897
+ }
898
+ if (Z > 0) {
899
+ const s = (w - m) / Z;
900
+ j = `
901
+ ${this.formatDuration(s)} remaining`;
902
+ }
903
+ this.notify({
904
+ id: r,
905
+ type: "loading",
906
+ // Cleaned string
907
+ message: `${j}`,
908
+ progress: $,
909
+ action: {
910
+ label: "Cancel",
911
+ onClick: () => this.cancelDownload()
912
+ }
913
+ });
825
914
  }
826
915
  }
827
- const p = new Blob(b), y = window.URL.createObjectURL(p), m = document.createElement("a");
828
- m.style.display = "none", m.href = y, m.download = ((o = t.split("/").pop()) == null ? void 0 : o.split("?")[0]) || "video.mp4", document.body.appendChild(m), m.click(), window.URL.revokeObjectURL(y), document.body.removeChild(m), this.notify({ id: n, type: "success", message: "Saved!", duration: 3e3 });
916
+ const Y = new Blob(T), W = window.URL.createObjectURL(Y), b = document.createElement("a");
917
+ b.style.display = "none", b.href = W, b.download = ((f = i.split("/").pop()) == null ? void 0 : f.split("?")[0]) || "video.mp4", document.body.appendChild(b), b.click(), window.URL.revokeObjectURL(W), document.body.removeChild(b), this.notify({ id: r, type: "success", message: "Saved!", duration: 3e3 });
829
918
  } catch {
830
- this.notify({ id: n, type: "error", message: "Download failed.", duration: 4e3 }), window.open(t, "_blank");
919
+ o.aborted ? this.removeNotification(r) : (this.notify({ id: r, type: "error", message: "Download failed.", duration: 4e3 }), window.open(i, "_blank"));
920
+ } finally {
921
+ this.currentDownloadController = null;
922
+ }
923
+ }
924
+ async downloadHls(t, i) {
925
+ var h;
926
+ this.currentDownloadController && this.currentDownloadController.abort(), this.currentDownloadController = new AbortController();
927
+ const o = this.currentDownloadController.signal, r = this.notify({
928
+ type: "loading",
929
+ message: "Analyzing HLS stream",
930
+ // Removed ...
931
+ progress: 0,
932
+ action: { label: "Cancel", onClick: () => this.cancelDownload() }
933
+ });
934
+ try {
935
+ let u = await this.fetchWithRetry(t, 3, void 0, o), f = await u.text(), g = t.substring(0, t.lastIndexOf("/") + 1);
936
+ if (f.includes("#EXT-X-STREAM-INF")) {
937
+ this.notify({ id: r, type: "loading", message: "Selecting best quality", progress: 0 });
938
+ const k = f.split(`
939
+ `);
940
+ let q = 0, $ = "";
941
+ for (let j = 0; j < k.length; j++)
942
+ if (k[j].includes("#EXT-X-STREAM-INF")) {
943
+ const Z = k[j].match(/BANDWIDTH=(\d+)/);
944
+ if (Z) {
945
+ const P = parseInt(Z[1]);
946
+ let s = (h = k[j + 1]) == null ? void 0 : h.trim();
947
+ s && !s.startsWith("#") && P > q && (q = P, $ = s);
948
+ }
949
+ }
950
+ $ && ($.startsWith("http") || ($ = g + $), u = await this.fetchWithRetry($, 3, void 0, o), f = await u.text(), g = $.substring(0, $.lastIndexOf("/") + 1));
951
+ }
952
+ if (f.includes("#EXT-X-KEY"))
953
+ throw new Error("Encrypted HLS streams are not supported for download.");
954
+ const x = f.split(`
955
+ `), p = [];
956
+ for (let k of x)
957
+ k = k.trim(), k && !k.startsWith("#") && (k.startsWith("http") ? p.push(k) : p.push(g + k));
958
+ if (p.length === 0) throw new Error("No segments found.");
959
+ let w = i === "mp4" ? "mp4" : "ts", m = i === "mp4" ? "video/mp4" : "video/mp2t", T = null, I = null, O = [];
960
+ if ("showSaveFilePicker" in window)
961
+ try {
962
+ T = await window.showSaveFilePicker({
963
+ suggestedName: `video.${w}`,
964
+ types: [{
965
+ description: i === "mp4" ? "MPEG-4 Video" : "MPEG Transport Stream",
966
+ accept: { [m]: [`.${w}`] }
967
+ }]
968
+ }), I = await T.createWritable();
969
+ } catch (k) {
970
+ if (k.name === "AbortError") {
971
+ this.removeNotification(r), this.notify({ type: "info", message: "Download cancelled", duration: 2e3 }), this.currentDownloadController = null;
972
+ return;
973
+ }
974
+ console.warn("File System API cancelled or failed, falling back to memory", k);
975
+ }
976
+ let W = !1;
977
+ const b = Date.now(), H = [];
978
+ for (let k = 0; k < p.length && !o.aborted; k++) {
979
+ const q = Math.round((k + 1) / p.length * 100), $ = Date.now();
980
+ for (H.push({ time: $, count: k + 1 }); H.length > 0 && $ - H[0].time > 5e3; )
981
+ H.shift();
982
+ let j = "";
983
+ if (H.length > 1) {
984
+ const ie = H[0], ne = H[H.length - 1], le = ne.time - ie.time, ce = ne.count - ie.count;
985
+ if (le > 0 && ce > 0) {
986
+ const Se = le / ce, Ce = (p.length - (k + 1)) * Se;
987
+ j = `
988
+ ${this.formatDuration(Ce)} remaining`;
989
+ }
990
+ } else if (k > 0) {
991
+ const ne = ($ - b) / k, ce = (p.length - k) * ne;
992
+ j = `
993
+ ${this.formatDuration(ce)} remaining`;
994
+ }
995
+ this.notify({
996
+ id: r,
997
+ type: "loading",
998
+ // Cleaned string
999
+ message: `Downloading segment ${k + 1}/${p.length}${j}`,
1000
+ progress: q,
1001
+ action: { label: "Cancel", onClick: () => this.cancelDownload() }
1002
+ });
1003
+ const P = await (await this.fetchWithRetry(p[k], 3, void 0, o)).arrayBuffer();
1004
+ k === 0 && new Uint8Array(P.slice(0, 4))[0] === 71 && (W = !0, i === "mp4" && (this.notify({
1005
+ type: "info",
1006
+ message: "Stream is MPEG-TS. Downloading as .ts to prevent corruption.",
1007
+ duration: 5e3
1008
+ }), w = "ts", m = "video/mp2t"));
1009
+ const s = new Blob([P]);
1010
+ I ? await I.write(s) : O.push(s);
1011
+ }
1012
+ if (o.aborted)
1013
+ throw I && await I.abort(), new Error("Aborted");
1014
+ if (I)
1015
+ await I.close(), this.notify({ id: r, type: "success", message: "Download complete!", duration: 3e3 });
1016
+ else {
1017
+ this.notify({ id: r, type: "loading", message: "Stitching video", progress: 100 });
1018
+ const k = new Blob(O, { type: m }), q = window.URL.createObjectURL(k), $ = document.createElement("a");
1019
+ $.style.display = "none", $.href = q;
1020
+ const j = i === "mp4" && W ? "ts" : w;
1021
+ $.download = `video.${j}`, document.body.appendChild($), $.click(), window.URL.revokeObjectURL(q), document.body.removeChild($), this.notify({ id: r, type: "success", message: "Saved!", duration: 3e3 });
1022
+ }
1023
+ } catch (u) {
1024
+ o.aborted ? this.removeNotification(r) : this.notify({ id: r, type: "error", message: `Download failed: ${u.message}`, duration: 4e3 });
1025
+ } finally {
1026
+ this.currentDownloadController = null;
831
1027
  }
832
1028
  }
833
1029
  notify(t) {
834
- const n = t.id || Math.random().toString(36).substr(2, 9), o = { ...t, id: n };
835
- return this.store.setState({ notifications: [o] }), t.duration && setTimeout(() => this.removeNotification(n), t.duration), n;
1030
+ const i = t.id || Math.random().toString(36).substr(2, 9), o = { ...t, id: i };
1031
+ return this.store.setState((r) => r.notifications.find((u) => u.id === i) ? { notifications: r.notifications.map((u) => u.id === i ? o : u) } : { notifications: [...r.notifications, o] }), t.duration && setTimeout(() => this.removeNotification(i), t.duration), i;
836
1032
  }
837
1033
  removeNotification(t) {
838
- const n = this.store.get().notifications;
839
- this.store.setState({ notifications: n.filter((o) => o.id !== t) });
1034
+ const i = this.store.get().notifications;
1035
+ this.store.setState({ notifications: i.filter((o) => o.id !== t) });
840
1036
  }
841
1037
  setAppearance(t) {
842
- this.store.setState((n) => ({
843
- ...n,
1038
+ this.store.setState((i) => ({
1039
+ ...i,
844
1040
  ...t
845
1041
  }));
846
1042
  }
847
1043
  destroy() {
848
- this.retryTimer && clearTimeout(this.retryTimer), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.store.get().isWebFullscreen && typeof document < "u" && (document.body.style.overflow = ""), document.removeEventListener("fullscreenchange", this.boundFullscreenChange), this.video.pause(), this.video.src = "";
1044
+ this.retryTimer && clearTimeout(this.retryTimer), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), this.currentDownloadController && this.currentDownloadController.abort(), this.store.get().isWebFullscreen && typeof document < "u" && (document.body.style.overflow = ""), document.removeEventListener("fullscreenchange", this.boundFullscreenChange), this.video.pause(), this.video.src = "";
849
1045
  const t = this.video.getElementsByTagName("track");
850
1046
  for (; t.length > 0; ) t[0].remove();
851
- this.emit("destroy"), this.events.destroy(), this.store.destroy(), this.plugins.forEach((n) => n.destroy && n.destroy()), this.plugins.clear(), this.video.remove(), this.audioEngine.destroy();
1047
+ this.emit("destroy"), this.events.destroy(), this.store.destroy(), this.plugins.forEach((i) => i.destroy && i.destroy()), this.plugins.clear(), this.video.remove(), this.audioEngine.destroy();
852
1048
  }
853
1049
  }
854
- const Ve = (i, t = 200) => {
855
- const [n, o] = S(i), [l, u] = S(!1);
856
- return j(() => {
857
- if (i)
1050
+ const Ke = (n, t = 200) => {
1051
+ const [i, o] = N(n), [r, h] = N(!1);
1052
+ return Q(() => {
1053
+ if (n)
858
1054
  o(!0), requestAnimationFrame(() => {
859
1055
  requestAnimationFrame(() => {
860
- u(!0);
1056
+ h(!0);
861
1057
  });
862
1058
  });
863
1059
  else {
864
- u(!1);
865
- const h = setTimeout(() => {
1060
+ h(!1);
1061
+ const u = setTimeout(() => {
866
1062
  o(!1);
867
1063
  }, t);
868
- return () => clearTimeout(h);
1064
+ return () => clearTimeout(u);
869
1065
  }
870
- }, [i, t]), { isMounted: n, isVisible: l };
871
- }, x = ({ className: i, children: t, fill: n = "none", strokeWidth: o = 2, viewBox: l = "0 0 24 24" }) => /* @__PURE__ */ e(
1066
+ }, [n, t]), { isMounted: i, isVisible: r };
1067
+ }, y = ({
1068
+ className: n,
1069
+ children: t,
1070
+ fill: i = "none",
1071
+ strokeWidth: o = 2,
1072
+ viewBox: r = "0 0 24 24"
1073
+ }) => /* @__PURE__ */ e(
872
1074
  "svg",
873
1075
  {
874
1076
  xmlns: "http://www.w3.org/2000/svg",
875
- viewBox: l,
876
- fill: n,
1077
+ viewBox: r,
1078
+ fill: i,
877
1079
  stroke: "currentColor",
878
1080
  strokeWidth: o,
879
1081
  strokeLinecap: "round",
880
1082
  strokeLinejoin: "round",
881
- className: i,
1083
+ className: n,
882
1084
  children: t
883
1085
  }
884
- ), zt = ({ className: i }) => /* @__PURE__ */ e(x, { className: i, children: /* @__PURE__ */ e("polygon", { points: "5 3 19 12 5 21 5 3" }) }), It = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1086
+ ), Et = ({ className: n }) => /* @__PURE__ */ e(y, { className: n, children: /* @__PURE__ */ e("polygon", { points: "5 3 19 12 5 21 5 3" }) }), Ft = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
885
1087
  /* @__PURE__ */ e("rect", { width: "4", height: "16", x: "6", y: "4", rx: "1" }),
886
1088
  /* @__PURE__ */ e("rect", { width: "4", height: "16", x: "14", y: "4", rx: "1" })
887
- ] }), wi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1089
+ ] }), Mi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
888
1090
  /* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
889
1091
  /* @__PURE__ */ e("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
890
1092
  /* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
891
- ] }), yi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1093
+ ] }), Ti = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
892
1094
  /* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
893
1095
  /* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
894
- ] }), ki = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1096
+ ] }), zi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
895
1097
  /* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
896
1098
  /* @__PURE__ */ e("line", { x1: "23", x2: "17", y1: "9", y2: "15" }),
897
1099
  /* @__PURE__ */ e("line", { x1: "17", x2: "23", y1: "9", y2: "15" })
898
- ] }), Si = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1100
+ ] }), Ii = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
899
1101
  /* @__PURE__ */ e("path", { d: "M8 3H5a2 2 0 0 0-2 2v3" }),
900
1102
  /* @__PURE__ */ e("path", { d: "M21 8V5a2 2 0 0 0-2-2h-3" }),
901
1103
  /* @__PURE__ */ e("path", { d: "M3 16v3a2 2 0 0 0 2 2h3" }),
902
1104
  /* @__PURE__ */ e("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
903
- ] }), Ci = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1105
+ ] }), Ri = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
904
1106
  /* @__PURE__ */ e("path", { d: "M8 3v3a2 2 0 0 1-2 2H3" }),
905
1107
  /* @__PURE__ */ e("path", { d: "M21 8h-3a2 2 0 0 1-2-2V3" }),
906
1108
  /* @__PURE__ */ e("path", { d: "M3 16h3a2 2 0 0 1 2 2v3" }),
907
1109
  /* @__PURE__ */ e("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
908
- ] }), Ni = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1110
+ ] }), Pi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
909
1111
  /* @__PURE__ */ e("path", { d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.09a2 2 0 0 1-1-1.74v-.47a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" }),
910
1112
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" })
911
- ] }), We = ({ className: i }) => /* @__PURE__ */ e(x, { className: i, children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" }) }), Mi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1113
+ ] }), Be = ({ className: n }) => /* @__PURE__ */ e(y, { className: n, children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" }) }), Li = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
912
1114
  /* @__PURE__ */ e("path", { d: "M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4" }),
913
1115
  /* @__PURE__ */ e("rect", { x: "12", y: "13", width: "10", height: "7", rx: "2" })
914
- ] }), Ti = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1116
+ ] }), $i = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
915
1117
  /* @__PURE__ */ e("rect", { width: "18", height: "14", x: "3", y: "5", rx: "2", ry: "2" }),
916
1118
  /* @__PURE__ */ e("path", { d: "M7 15h4" }),
917
1119
  /* @__PURE__ */ e("path", { d: "M15 15h2" }),
918
1120
  /* @__PURE__ */ e("path", { d: "M7 11h2" }),
919
1121
  /* @__PURE__ */ e("path", { d: "M13 11h4" })
920
- ] }), zi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1122
+ ] }), Ze = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
921
1123
  /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
922
1124
  /* @__PURE__ */ e("polyline", { points: "7 10 12 15 17 10" }),
923
1125
  /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
924
- ] }), Ii = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1126
+ ] }), Ei = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
925
1127
  /* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
926
1128
  /* @__PURE__ */ e("polyline", { points: "17 8 12 3 7 8" }),
927
1129
  /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
928
- ] }), Ri = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1130
+ ] }), Fi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
929
1131
  /* @__PURE__ */ e("path", { d: "m12 19-7-7 7-7" }),
930
1132
  /* @__PURE__ */ e("path", { d: "M19 12H5" })
931
- ] }), He = ({ className: i }) => /* @__PURE__ */ e(x, { className: i, children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }), Pi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1133
+ ] }), Fe = ({ className: n }) => /* @__PURE__ */ e(y, { className: n, children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }), Ai = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
932
1134
  /* @__PURE__ */ e("path", { d: "M2 16.1A5 5 0 0 1 5.9 20" }),
933
1135
  /* @__PURE__ */ e("path", { d: "M2 12.05A9 9 0 0 1 9.95 20" }),
934
1136
  /* @__PURE__ */ e("path", { d: "M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6" }),
935
1137
  /* @__PURE__ */ e("line", { x1: "2", x2: "2.01", y1: "20", y2: "20" })
936
- ] }), Li = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1138
+ ] }), Bi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
937
1139
  /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
938
1140
  /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
939
1141
  /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
940
1142
  /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
941
- ] }), $i = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1143
+ ] }), Vi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
942
1144
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
943
1145
  /* @__PURE__ */ e("polyline", { points: "12 6 12 12 16 14" })
944
- ] }), Ei = ({ className: i }) => /* @__PURE__ */ e(x, { className: i, children: /* @__PURE__ */ e("path", { d: "M5 12h14" }) }), Fi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1146
+ ] }), Di = ({ className: n }) => /* @__PURE__ */ e(y, { className: n, children: /* @__PURE__ */ e("path", { d: "M5 12h14" }) }), Oi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
945
1147
  /* @__PURE__ */ e("path", { d: "M5 12h14" }),
946
1148
  /* @__PURE__ */ e("path", { d: "M12 5v14" })
947
- ] }), Ai = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1149
+ ] }), jt = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
948
1150
  /* @__PURE__ */ e("path", { d: "M4 21v-7" }),
949
1151
  /* @__PURE__ */ e("path", { d: "M4 10V3" }),
950
1152
  /* @__PURE__ */ e("path", { d: "M12 21v-9" }),
@@ -954,128 +1156,193 @@ const Ve = (i, t = 200) => {
954
1156
  /* @__PURE__ */ e("path", { d: "M1 14h6" }),
955
1157
  /* @__PURE__ */ e("path", { d: "M9 8h6" }),
956
1158
  /* @__PURE__ */ e("path", { d: "M17 16h6" })
957
- ] }), Bi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1159
+ ] }), Hi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
958
1160
  /* @__PURE__ */ e("polyline", { points: "4 7 4 4 20 4 20 7" }),
959
1161
  /* @__PURE__ */ e("line", { x1: "9", x2: "15", y1: "20", y2: "20" }),
960
1162
  /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "4", y2: "20" })
961
- ] }), At = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1163
+ ] }), Ut = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
962
1164
  /* @__PURE__ */ e("circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor" }),
963
1165
  /* @__PURE__ */ e("circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor" }),
964
1166
  /* @__PURE__ */ e("circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor" }),
965
1167
  /* @__PURE__ */ e("circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor" }),
966
1168
  /* @__PURE__ */ e("path", { d: "M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z" })
967
- ] }), Vi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1169
+ ] }), Wi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
968
1170
  /* @__PURE__ */ e("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
969
1171
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "3" })
970
- ] }), Oi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1172
+ ] }), ji = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
971
1173
  /* @__PURE__ */ e("polyline", { points: "8 18 12 22 16 18" }),
972
1174
  /* @__PURE__ */ e("polyline", { points: "8 6 12 2 16 6" }),
973
1175
  /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "2", y2: "22" })
974
- ] }), Hi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1176
+ ] }), Ui = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
975
1177
  /* @__PURE__ */ e("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
976
1178
  /* @__PURE__ */ e("path", { d: "M3 3v5h5" })
977
- ] }), ji = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1179
+ ] }), Gi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
978
1180
  /* @__PURE__ */ e("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
979
1181
  /* @__PURE__ */ e("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
980
- ] }), Wi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1182
+ ] }), _i = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
981
1183
  /* @__PURE__ */ e("path", { d: "m3 17 4-10 4 10" }),
982
1184
  /* @__PURE__ */ e("path", { d: "M4 13h6" }),
983
1185
  /* @__PURE__ */ e("path", { d: "M15 12h4.5a2.5 2.5 0 0 1 0 5H15V7h4a2.5 2.5 0 0 1 0 5h-4" })
984
- ] }), Di = ({ className: i }) => /* @__PURE__ */ e(x, { className: i, children: /* @__PURE__ */ e("path", { d: "M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z" }) }), _i = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1186
+ ] }), qi = ({ className: n }) => /* @__PURE__ */ e(y, { className: n, children: /* @__PURE__ */ e("path", { d: "M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z" }) }), Xi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
985
1187
  /* @__PURE__ */ e("path", { d: "M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z" }),
986
1188
  /* @__PURE__ */ e("circle", { cx: "12", cy: "13", r: "3" })
987
- ] }), Gi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1189
+ ] }), Qi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
988
1190
  /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
989
1191
  /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
990
- ] }), Ui = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1192
+ ] }), Ji = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
991
1193
  /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
992
1194
  /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 9.9-1" })
993
- ] }), qi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1195
+ ] }), Ki = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
994
1196
  /* @__PURE__ */ e("rect", { width: "20", height: "14", x: "2", y: "3", rx: "2" }),
995
1197
  /* @__PURE__ */ e("line", { x1: "8", x2: "16", y1: "21", y2: "21" }),
996
1198
  /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "17", y2: "21" })
997
- ] }), Qi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1199
+ ] }), Yi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
998
1200
  /* @__PURE__ */ e("polygon", { points: "13 19 22 12 13 5 13 19" }),
999
1201
  /* @__PURE__ */ e("polygon", { points: "2 19 11 12 2 5 2 19" })
1000
- ] }), Xi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1202
+ ] }), Gt = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1001
1203
  /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
1002
1204
  /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
1003
- ] }), Ji = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1205
+ ] }), Zi = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1004
1206
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
1005
1207
  /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
1006
1208
  /* @__PURE__ */ e("path", { d: "M12 8h.01" })
1007
- ] }), Ki = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1209
+ ] }), en = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1008
1210
  /* @__PURE__ */ e("rect", { width: "20", height: "8", x: "2", y: "2", rx: "2", ry: "2" }),
1009
1211
  /* @__PURE__ */ e("rect", { width: "20", height: "8", x: "2", y: "14", rx: "2", ry: "2" }),
1010
1212
  /* @__PURE__ */ e("line", { x1: "6", x2: "6.01", y1: "6", y2: "6" }),
1011
1213
  /* @__PURE__ */ e("line", { x1: "6", x2: "6.01", y1: "18", y2: "18" })
1012
- ] }), Yi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1013
- /* @__PURE__ */ e("polygon", { points: "12 2 2 7 12 12 22 7 12 2" }),
1014
- /* @__PURE__ */ e("polyline", { points: "2 17 12 22 22 17" }),
1015
- /* @__PURE__ */ e("polyline", { points: "2 12 12 17 22 12" })
1016
- ] }), Zi = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1214
+ ] }), tn = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1017
1215
  /* @__PURE__ */ e("path", { d: "M6 2v14a2 2 0 0 0 2 2h14" }),
1018
1216
  /* @__PURE__ */ e("path", { d: "M18 22V8a2 2 0 0 0-2-2H2" })
1019
- ] }), en = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1217
+ ] }), nn = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1020
1218
  /* @__PURE__ */ e("rect", { width: "16", height: "20", x: "4", y: "2", rx: "2" }),
1021
1219
  /* @__PURE__ */ e("circle", { cx: "12", cy: "14", r: "4" }),
1022
1220
  /* @__PURE__ */ e("line", { x1: "12", x2: "12.01", y1: "6", y2: "6" })
1023
- ] }), tn = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1221
+ ] }), sn = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1024
1222
  /* @__PURE__ */ e("path", { d: "m12 14 4-4" }),
1025
1223
  /* @__PURE__ */ e("path", { d: "M3.34 19a10 10 0 1 1 17.32 0" })
1026
- ] }), nn = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1224
+ ] }), on = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1027
1225
  /* @__PURE__ */ e("path", { d: "M9 18V5l12-2v13" }),
1028
1226
  /* @__PURE__ */ e("circle", { cx: "6", cy: "18", r: "3" }),
1029
1227
  /* @__PURE__ */ e("circle", { cx: "18", cy: "16", r: "3" })
1030
- ] }), sn = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1031
- /* @__PURE__ */ e("polyline", { points: "16 16 12 20 8 16" }),
1032
- /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "20", y2: "10" }),
1033
- /* @__PURE__ */ e("path", { d: "M12 4a8 8 0 0 1 8 8" }),
1034
- /* @__PURE__ */ e("path", { d: "M20 4v8" }),
1035
- /* @__PURE__ */ e("path", { d: "M4 4v8" }),
1036
- /* @__PURE__ */ e("path", { d: "M4 12a8 8 0 0 1 8-8" })
1037
- ] }), on = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1228
+ ] }), rn = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1038
1229
  /* @__PURE__ */ e("path", { d: "M5 12.55a11 11 0 0 1 14.08 0" }),
1039
1230
  /* @__PURE__ */ e("path", { d: "M1.42 9a16 16 0 0 1 21.16 0" }),
1040
1231
  /* @__PURE__ */ e("path", { d: "M8.53 16.11a6 6 0 0 1 6.95 0" }),
1041
1232
  /* @__PURE__ */ e("line", { x1: "12", x2: "12.01", y1: "20", y2: "20" })
1042
- ] }), rn = ({ className: i }) => /* @__PURE__ */ d(x, { className: i, children: [
1233
+ ] }), et = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1043
1234
  /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
1044
1235
  /* @__PURE__ */ e("line", { x1: "12", x2: "12", y1: "8", y2: "12" }),
1045
1236
  /* @__PURE__ */ e("line", { x1: "12", x2: "12.01", y1: "16", y2: "16" })
1046
- ] }), Rt = ({ className: i }) => /* @__PURE__ */ d("div", { className: `relative flex items-center justify-center ${i}`, children: [
1047
- /* @__PURE__ */ d(x, { className: "w-full h-full", children: [
1237
+ ] }), an = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1238
+ /* @__PURE__ */ e("path", { d: "M2 20h.01" }),
1239
+ /* @__PURE__ */ e("path", { d: "M7 20v-4" }),
1240
+ /* @__PURE__ */ e("path", { d: "M12 20v-8" }),
1241
+ /* @__PURE__ */ e("path", { d: "M17 20V8" }),
1242
+ /* @__PURE__ */ e("path", { d: "M22 20V4" })
1243
+ ] }), ln = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1244
+ /* @__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" }),
1245
+ /* @__PURE__ */ e("path", { d: "M16 2v4" }),
1246
+ /* @__PURE__ */ e("path", { d: "M8 2v4" }),
1247
+ /* @__PURE__ */ e("path", { d: "M3 12h18" })
1248
+ ] }), cn = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1249
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
1250
+ /* @__PURE__ */ e("path", { d: "m21 21-4.3-4.3" })
1251
+ ] }), _t = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1252
+ /* @__PURE__ */ e("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
1253
+ /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" }),
1254
+ /* @__PURE__ */ e("path", { d: "m9 15 2 2 4-4" })
1255
+ ] }), dn = ({ className: n }) => /* @__PURE__ */ d(y, { className: n, children: [
1256
+ /* @__PURE__ */ e("path", { d: "M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z" }),
1257
+ /* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" }),
1258
+ /* @__PURE__ */ e("path", { d: "M12 18h.01" }),
1259
+ /* @__PURE__ */ e("path", { d: "M12 12v4" })
1260
+ ] }), At = ({ className: n }) => /* @__PURE__ */ d("div", { className: `relative flex items-center justify-center ${n}`, children: [
1261
+ /* @__PURE__ */ d(y, { className: "w-full h-full", children: [
1048
1262
  /* @__PURE__ */ e("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
1049
1263
  /* @__PURE__ */ e("path", { d: "M3 3v5h5" })
1050
1264
  ] }),
1051
1265
  /* @__PURE__ */ e("span", { className: "absolute inset-0 flex items-center justify-center text-[32%] font-bold select-none mt-[1px]", children: "10" })
1052
- ] }), Pt = ({ className: i }) => /* @__PURE__ */ d("div", { className: `relative flex items-center justify-center ${i}`, children: [
1053
- /* @__PURE__ */ d(x, { className: "w-full h-full", children: [
1266
+ ] }), Bt = ({ className: n }) => /* @__PURE__ */ d("div", { className: `relative flex items-center justify-center ${n}`, children: [
1267
+ /* @__PURE__ */ d(y, { className: "w-full h-full", children: [
1054
1268
  /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
1055
1269
  /* @__PURE__ */ e("path", { d: "M21 3v5h-5" })
1056
1270
  ] }),
1057
1271
  /* @__PURE__ */ e("span", { className: "absolute inset-0 flex items-center justify-center text-[32%] font-bold select-none mt-[1px]", children: "10" })
1058
- ] }), an = ({ notifications: i }) => /* @__PURE__ */ e("div", { className: "absolute top-4 left-4 z-25 flex flex-col gap-2 pointer-events-none font-sans max-w-[85%] md:max-w-[320px]", children: i.map((t) => /* @__PURE__ */ d(
1059
- "div",
1060
- {
1061
- className: `
1062
- bg-zinc-950/90 backdrop-blur-md border border-white/10 text-white px-3 py-2 rounded-lg shadow-xl text-xs font-medium flex items-start gap-2.5 animate-in slide-in-from-left-2 fade-in duration-300 pointer-events-auto
1063
- w-fit max-w-full
1064
- ${t.type === "error" ? "border-red-500/50 text-red-100" : ""}
1065
- ${t.type === "warning" ? "border-amber-500/50 text-amber-100" : ""}
1066
- `,
1067
- children: [
1068
- t.type === "loading" && /* @__PURE__ */ e(He, { className: "w-3.5 h-3.5 animate-spin text-[var(--accent)] shrink-0 mt-0.5" }),
1069
- /* @__PURE__ */ d("div", { className: "flex flex-col gap-1 min-w-0", children: [
1070
- /* @__PURE__ */ e("span", { className: "break-words line-clamp-4 leading-relaxed whitespace-pre-wrap", children: t.message }),
1071
- typeof t.progress == "number" && /* @__PURE__ */ e("div", { className: "h-0.5 w-full bg-white/10 rounded-full overflow-hidden mt-1.5", children: /* @__PURE__ */ e("div", { className: "h-full bg-[var(--accent)] transition-all duration-300", style: { width: `${t.progress}%` } }) })
1272
+ ] }), un = ({
1273
+ notifications: n
1274
+ }) => /* @__PURE__ */ e("div", { className: "absolute top-4 left-4 z-[100] flex flex-col gap-2 pointer-events-none font-sans max-w-[85%] md:max-w-[280px]", children: n.map((t) => {
1275
+ const i = typeof t.progress == "number";
1276
+ return /* @__PURE__ */ e(
1277
+ "div",
1278
+ {
1279
+ className: `
1280
+ relative overflow-hidden bg-zinc-950/80 backdrop-blur-xl border border-white/10 text-zinc-100 shadow-2xl rounded-lg pointer-events-auto
1281
+ animate-in slide-in-from-left-4 fade-in duration-300
1282
+ ${i ? "w-64" : "w-auto max-w-full px-3 py-2.5"}
1283
+ `,
1284
+ style: { borderRadius: "var(--radius)" },
1285
+ children: i ? /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
1286
+ /* @__PURE__ */ e("div", { className: "w-7 h-7 rounded-full bg-white/10 flex items-center justify-center text-[var(--accent)] shrink-0", children: /* @__PURE__ */ e(Ze, { className: "w-3.5 h-3.5" }) }),
1287
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 pt-0.5", children: [
1288
+ /* @__PURE__ */ d("div", { className: "flex justify-between items-baseline mb-1", children: [
1289
+ /* @__PURE__ */ e("span", { className: "text-xs font-bold text-white tracking-tight", children: "Downloading" }),
1290
+ /* @__PURE__ */ d("span", { className: "text-[10px] font-mono text-zinc-400", children: [
1291
+ t.progress,
1292
+ "%"
1293
+ ] })
1294
+ ] }),
1295
+ /* @__PURE__ */ e("p", { className: "text-[10px] text-zinc-400 mb-2 leading-tight whitespace-pre-wrap", children: t.message.replace(/Downloading\.\.\. \d+%/, "").trim() || "Processing..." }),
1296
+ /* @__PURE__ */ e("div", { className: "h-0.5 w-full bg-white/10 rounded-full overflow-hidden", children: /* @__PURE__ */ e(
1297
+ "div",
1298
+ {
1299
+ className: "h-full bg-[var(--accent)] transition-all duration-300 ease-out",
1300
+ style: { width: `${t.progress}%` }
1301
+ }
1302
+ ) })
1303
+ ] }),
1304
+ t.action && /* @__PURE__ */ e(
1305
+ "button",
1306
+ {
1307
+ onClick: (o) => {
1308
+ var r;
1309
+ o.stopPropagation(), (r = t.action) == null || r.onClick();
1310
+ },
1311
+ className: "text-zinc-500 hover:text-zinc-200 transition-colors p-1 -mt-1.5 -mr-1.5",
1312
+ title: t.action.label,
1313
+ children: /* @__PURE__ */ e(Gt, { className: "w-3.5 h-3.5" })
1314
+ }
1315
+ )
1316
+ ] }) }) : /* @__PURE__ */ d("div", { className: "flex items-start gap-2.5", children: [
1317
+ t.type === "loading" && /* @__PURE__ */ e(Fe, { className: "w-3.5 h-3.5 animate-spin text-[var(--accent)] shrink-0 mt-0.5" }),
1318
+ t.type === "success" && /* @__PURE__ */ e(Be, { className: "w-3.5 h-3.5 text-emerald-500 shrink-0 mt-0.5" }),
1319
+ t.type === "error" && /* @__PURE__ */ e(et, { className: "w-3.5 h-3.5 text-red-500 shrink-0 mt-0.5" }),
1320
+ t.type === "warning" && /* @__PURE__ */ e(et, { className: "w-3.5 h-3.5 text-amber-500 shrink-0 mt-0.5" }),
1321
+ t.type === "info" && /* @__PURE__ */ e("div", { className: "w-1.5 h-1.5 rounded-full bg-[var(--accent)] mt-1.5 shrink-0" }),
1322
+ /* @__PURE__ */ d("div", { className: "flex flex-col gap-0.5 min-w-0", children: [
1323
+ /* @__PURE__ */ e("span", { className: "text-xs font-medium leading-snug break-words text-zinc-200 whitespace-pre-wrap", children: t.message }),
1324
+ t.action && /* @__PURE__ */ e(
1325
+ "button",
1326
+ {
1327
+ onClick: (o) => {
1328
+ var r;
1329
+ o.stopPropagation(), (r = t.action) == null || r.onClick();
1330
+ },
1331
+ className: "mt-1 self-start text-[10px] font-bold text-[var(--accent)] hover:text-white transition-colors uppercase tracking-wider",
1332
+ children: t.action.label
1333
+ }
1334
+ )
1335
+ ] })
1072
1336
  ] })
1073
- ]
1074
- },
1075
- t.id
1076
- )) }), ln = ({ cues: i, settings: t }) => {
1077
- if (t.useNative || i.length === 0) return null;
1078
- const n = () => {
1337
+ },
1338
+ t.id
1339
+ );
1340
+ }) }), hn = ({
1341
+ cues: n,
1342
+ settings: t
1343
+ }) => {
1344
+ if (t.useNative || n.length === 0) return null;
1345
+ const i = () => {
1079
1346
  switch (t.textStyle) {
1080
1347
  case "outline":
1081
1348
  return "0px 0px 4px black, 0px 0px 4px black";
@@ -1096,7 +1363,7 @@ const Ve = (i, t = 200) => {
1096
1363
  style: {
1097
1364
  bottom: `${t.verticalOffset}px`
1098
1365
  },
1099
- children: i.map((o, l) => /* @__PURE__ */ e(
1366
+ children: n.map((o, r) => /* @__PURE__ */ e(
1100
1367
  "div",
1101
1368
  {
1102
1369
  className: "mb-1 inline-block max-w-[80%]",
@@ -1105,8 +1372,9 @@ const Ve = (i, t = 200) => {
1105
1372
  color: t.textColor,
1106
1373
  fontWeight: t.isBold ? "bold" : "normal",
1107
1374
  textTransform: t.fixCapitalization ? "capitalize" : "none",
1108
- textShadow: n(),
1109
- lineHeight: 1.4
1375
+ textShadow: i(),
1376
+ lineHeight: 1.4,
1377
+ whiteSpace: "pre-line"
1110
1378
  },
1111
1379
  children: /* @__PURE__ */ e(
1112
1380
  "span",
@@ -1120,27 +1388,27 @@ const Ve = (i, t = 200) => {
1120
1388
  }
1121
1389
  )
1122
1390
  },
1123
- l
1391
+ r
1124
1392
  ))
1125
1393
  }
1126
1394
  );
1127
- }, xe = ({ content: i }) => typeof i == "string" ? i.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: i } }) : /* @__PURE__ */ e("span", { children: i }) : /* @__PURE__ */ e(B, { children: i }), q = ({ label: i, checked: t, onChange: n, icon: o, tooltip: l }) => /* @__PURE__ */ d(
1395
+ }, Ae = ({ content: n }) => typeof n == "string" ? n.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: n } }) : /* @__PURE__ */ e("span", { children: n }) : /* @__PURE__ */ e(_, { children: n }), oe = ({ label: n, checked: t, onChange: i, icon: o, tooltip: r }) => /* @__PURE__ */ d(
1128
1396
  "div",
1129
1397
  {
1130
1398
  className: "flex items-center justify-between py-2.5 px-3 hover:bg-white/5 group transition-colors",
1131
1399
  style: { borderRadius: "var(--radius)" },
1132
1400
  children: [
1133
1401
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
1134
- 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(xe, { content: o }) }),
1402
+ 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(Ae, { content: o }) }),
1135
1403
  /* @__PURE__ */ d("div", { className: "flex flex-col", children: [
1136
- /* @__PURE__ */ e("span", { className: "text-sm text-zinc-300 font-medium group-hover:text-white transition-colors flex items-center", children: /* @__PURE__ */ e(xe, { content: i }) }),
1137
- l && /* @__PURE__ */ e("span", { className: "text-[10px] text-zinc-500", children: l })
1404
+ /* @__PURE__ */ e("span", { className: "text-sm text-zinc-300 font-medium group-hover:text-white transition-colors flex items-center", children: /* @__PURE__ */ e(Ae, { content: n }) }),
1405
+ r && /* @__PURE__ */ e("span", { className: "text-[10px] text-zinc-500", children: r })
1138
1406
  ] })
1139
1407
  ] }),
1140
1408
  /* @__PURE__ */ e(
1141
1409
  "button",
1142
1410
  {
1143
- onClick: () => n(!t),
1411
+ onClick: () => i(!t),
1144
1412
  className: `w-11 h-6 shrink-0 transition-colors relative focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-zinc-900 ${t ? "bg-[var(--accent)]" : "bg-zinc-700"}`,
1145
1413
  style: {
1146
1414
  "--tw-ring-color": "var(--accent)",
@@ -1162,7 +1430,7 @@ const Ve = (i, t = 200) => {
1162
1430
  )
1163
1431
  ]
1164
1432
  }
1165
- ), le = ({ label: i, value: t, min: n, max: o, step: l, onChange: u, formatValue: h, icon: v }) => /* @__PURE__ */ d(
1433
+ ), we = ({ label: n, value: t, min: i, max: o, step: r, onChange: h, formatValue: u, icon: f }) => /* @__PURE__ */ d(
1166
1434
  "div",
1167
1435
  {
1168
1436
  className: "py-2.5 px-3 hover:bg-white/5 group transition-colors",
@@ -1170,15 +1438,15 @@ const Ve = (i, t = 200) => {
1170
1438
  children: [
1171
1439
  /* @__PURE__ */ d("div", { className: "flex justify-between items-center mb-2", children: [
1172
1440
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
1173
- v && /* @__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(xe, { content: v }) }),
1174
- /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: i })
1441
+ f && /* @__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(Ae, { content: f }) }),
1442
+ /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: n })
1175
1443
  ] }),
1176
1444
  /* @__PURE__ */ e(
1177
1445
  "span",
1178
1446
  {
1179
1447
  className: "text-[10px] font-mono font-medium text-zinc-300 bg-white/10 px-1.5 py-0.5 tabular-nums",
1180
1448
  style: { borderRadius: "var(--radius-sm)" },
1181
- children: h ? h(t) : t
1449
+ children: u ? u(t) : t
1182
1450
  }
1183
1451
  )
1184
1452
  ] }),
@@ -1187,15 +1455,15 @@ const Ve = (i, t = 200) => {
1187
1455
  "input",
1188
1456
  {
1189
1457
  type: "range",
1190
- min: n,
1458
+ min: i,
1191
1459
  max: o,
1192
- step: l,
1460
+ step: r,
1193
1461
  value: t,
1194
- onChange: (w) => u(parseFloat(w.target.value)),
1462
+ onChange: (g) => h(parseFloat(g.target.value)),
1195
1463
  className: "w-full h-1.5 appearance-none cursor-pointer focus:outline-none focus:ring-2 strata-range-input",
1196
1464
  style: {
1197
1465
  borderRadius: "var(--radius-full)",
1198
- background: `linear-gradient(to right, var(--accent) 0%, var(--accent) ${(t - n) / (o - n) * 100}%, #3f3f46 ${(t - n) / (o - n) * 100}%, #3f3f46 100%)`,
1466
+ background: `linear-gradient(to right, var(--accent) 0%, var(--accent) ${(t - i) / (o - i) * 100}%, #3f3f46 ${(t - i) / (o - i) * 100}%, #3f3f46 100%)`,
1199
1467
  "--tw-ring-color": "var(--accent)"
1200
1468
  }
1201
1469
  }
@@ -1220,61 +1488,91 @@ const Ve = (i, t = 200) => {
1220
1488
  ] })
1221
1489
  ]
1222
1490
  }
1223
- ), cn = ({ label: i, value: t, options: n, onChange: o, icon: l }) => /* @__PURE__ */ d(
1491
+ ), pn = ({ label: n, value: t, options: i, onChange: o, icon: r }) => /* @__PURE__ */ d(
1224
1492
  "div",
1225
1493
  {
1226
1494
  className: "py-2.5 px-3 hover:bg-white/5 group transition-colors",
1227
1495
  style: { borderRadius: "var(--radius)" },
1228
1496
  children: [
1229
1497
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3 mb-2", children: [
1230
- l && /* @__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(xe, { content: l }) }),
1231
- /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: i })
1498
+ 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(Ae, { content: r }) }),
1499
+ /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: n })
1232
1500
  ] }),
1233
1501
  /* @__PURE__ */ d("div", { className: "relative", children: [
1234
1502
  /* @__PURE__ */ e(
1235
1503
  "select",
1236
1504
  {
1237
1505
  value: t,
1238
- onChange: (u) => o(u.target.value),
1506
+ onChange: (h) => o(h.target.value),
1239
1507
  className: "w-full bg-zinc-800 border-[length:var(--border-width)] border-white/10 px-3 py-2 text-sm text-zinc-200 focus:outline-none focus:ring-2 appearance-none hover:bg-zinc-700 transition-colors cursor-pointer",
1240
1508
  style: { "--tw-ring-color": "var(--accent)", borderRadius: "var(--radius)" },
1241
- children: n.map((u) => /* @__PURE__ */ e("option", { value: u.value, children: u.label }, u.value))
1509
+ children: i.map((h) => /* @__PURE__ */ e("option", { value: h.value, children: h.label }, h.value))
1242
1510
  }
1243
1511
  ),
1244
1512
  /* @__PURE__ */ e("div", { className: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none text-zinc-400", children: /* @__PURE__ */ e("svg", { width: "10", height: "6", viewBox: "0 0 10 6", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ e("path", { d: "M1 1L5 5L9 1", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })
1245
1513
  ] })
1246
1514
  ]
1247
1515
  }
1248
- ), te = ({ title: i, children: t }) => /* @__PURE__ */ d("div", { className: "py-2", children: [
1249
- i && /* @__PURE__ */ e("h4", { className: "px-3 text-[10px] font-bold text-[var(--accent)] uppercase tracking-wider mb-1 mt-2", children: i }),
1516
+ ), me = ({ title: n, children: t }) => /* @__PURE__ */ d("div", { className: "py-2", children: [
1517
+ n && /* @__PURE__ */ e("h4", { className: "px-3 text-[10px] font-bold text-[var(--accent)] uppercase tracking-wider mb-1 mt-2", children: n }),
1250
1518
  /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t })
1251
- ] }), De = ({ children: i, onClose: t, align: n = "right", maxHeight: o, className: l }) => {
1252
- const u = A(null), h = A(null), [v, w] = S("auto"), b = n === "center" ? "left-1/2 -translate-x-1/2 origin-bottom" : "right-0 origin-bottom-right";
1253
- ve(() => {
1254
- if (!h.current) return;
1255
- const y = () => {
1256
- h.current && w(h.current.offsetHeight);
1257
- }, m = new ResizeObserver(y);
1258
- return m.observe(h.current), y(), () => m.disconnect();
1519
+ ] }), it = ({
1520
+ children: n,
1521
+ onClose: t,
1522
+ align: i = "right",
1523
+ maxHeight: o,
1524
+ className: r
1525
+ }) => {
1526
+ const h = U(null), u = U(null), [f, g] = N("auto"), x = i === "center" ? "left-1/2 -translate-x-1/2 origin-bottom" : "right-0 origin-bottom-right";
1527
+ Ee(() => {
1528
+ if (!u.current) return;
1529
+ const w = () => {
1530
+ u.current && g(u.current.offsetHeight);
1531
+ }, m = new ResizeObserver(w);
1532
+ return m.observe(u.current), w(), () => m.disconnect();
1259
1533
  }, []);
1260
1534
  const p = {
1261
- height: v === "auto" ? "auto" : `${v + 14}px`,
1535
+ height: f === "auto" ? "auto" : `${f + 14}px`,
1262
1536
  // + padding
1263
1537
  maxHeight: o ? `${o}px` : void 0
1264
1538
  };
1265
1539
  return /* @__PURE__ */ e(
1266
1540
  "div",
1267
1541
  {
1268
- ref: u,
1269
- className: `absolute bottom-full mb-4 ${b} 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 ${l}`,
1542
+ ref: h,
1543
+ className: `absolute bottom-full mb-4 ${x} 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}`,
1270
1544
  style: { ...p, borderRadius: "var(--radius-lg)" },
1271
- onClick: (y) => y.stopPropagation(),
1272
- onMouseDown: (y) => y.stopPropagation(),
1273
- onTouchStart: (y) => y.stopPropagation(),
1274
- children: /* @__PURE__ */ e("div", { className: "overflow-y-auto hide-scrollbar flex-1", style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e("div", { ref: h, children: i }) })
1545
+ onClick: (w) => w.stopPropagation(),
1546
+ onMouseDown: (w) => w.stopPropagation(),
1547
+ onTouchStart: (w) => w.stopPropagation(),
1548
+ children: /* @__PURE__ */ e(
1549
+ "div",
1550
+ {
1551
+ className: "overflow-y-auto hide-scrollbar flex-1",
1552
+ style: { borderRadius: "var(--radius)" },
1553
+ children: /* @__PURE__ */ e("div", { ref: u, children: n })
1554
+ }
1555
+ )
1275
1556
  }
1276
1557
  );
1277
- }, ge = ({ content: i, className: t }) => typeof i == "string" ? i.trim().startsWith("<") ? /* @__PURE__ */ e("span", { className: t, dangerouslySetInnerHTML: { __html: i } }) : /* @__PURE__ */ e("span", { className: t, children: i }) : /* @__PURE__ */ e("span", { className: t, children: i }), z = ({ label: i, value: t, active: n, onClick: o, hasSubmenu: l, icon: u, rightIcon: h }) => /* @__PURE__ */ d(
1558
+ }, ye = ({
1559
+ content: n,
1560
+ className: t
1561
+ }) => typeof n == "string" ? n.trim().startsWith("<") ? /* @__PURE__ */ e(
1562
+ "span",
1563
+ {
1564
+ className: t,
1565
+ dangerouslySetInnerHTML: { __html: n }
1566
+ }
1567
+ ) : /* @__PURE__ */ e("span", { className: t, children: n }) : /* @__PURE__ */ e("span", { className: t, children: n }), A = ({
1568
+ label: n,
1569
+ value: t,
1570
+ active: i,
1571
+ onClick: o,
1572
+ hasSubmenu: r,
1573
+ icon: h,
1574
+ rightIcon: u
1575
+ }) => /* @__PURE__ */ d(
1278
1576
  "button",
1279
1577
  {
1280
1578
  onClick: o,
@@ -1282,18 +1580,36 @@ const Ve = (i, t = 200) => {
1282
1580
  style: { borderRadius: "var(--radius)" },
1283
1581
  children: [
1284
1582
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3 overflow-hidden", children: [
1285
- u && /* @__PURE__ */ e("span", { className: "text-zinc-400 shrink-0 group-hover:text-zinc-300 transition-colors flex items-center justify-center w-4 h-4", children: /* @__PURE__ */ e(ge, { content: u }) }),
1286
- /* @__PURE__ */ e("span", { className: `font-medium truncate text-sm flex items-center ${n ? "text-[var(--accent)]" : ""}`, title: typeof i == "string" ? i : void 0, children: /* @__PURE__ */ e(ge, { content: i }) })
1583
+ h && /* @__PURE__ */ e("span", { className: "text-zinc-400 shrink-0 group-hover:text-zinc-300 transition-colors flex items-center justify-center w-4 h-4", children: /* @__PURE__ */ e(ye, { content: h }) }),
1584
+ /* @__PURE__ */ e(
1585
+ "span",
1586
+ {
1587
+ className: `font-medium truncate text-sm flex items-center ${i ? "text-[var(--accent)]" : ""}`,
1588
+ title: typeof n == "string" ? n : void 0,
1589
+ children: /* @__PURE__ */ e(ye, { content: n })
1590
+ }
1591
+ )
1287
1592
  ] }),
1288
1593
  /* @__PURE__ */ d("div", { className: "flex items-center gap-2 text-zinc-400 shrink-0", children: [
1289
- t && /* @__PURE__ */ e("span", { className: "text-xs font-medium truncate max-w-[60px]", title: t, children: /* @__PURE__ */ e(ge, { content: t }) }),
1290
- h,
1291
- n && /* @__PURE__ */ e(We, { className: "w-4 h-4 text-[var(--accent)] shrink-0" }),
1292
- l && /* @__PURE__ */ e("span", { className: "text-xs group-hover:translate-x-0.5 transition-transform text-zinc-500 shrink-0", children: "›" })
1594
+ t && /* @__PURE__ */ e(
1595
+ "span",
1596
+ {
1597
+ className: "text-xs font-medium truncate max-w-[60px]",
1598
+ title: t,
1599
+ children: /* @__PURE__ */ e(ye, { content: t })
1600
+ }
1601
+ ),
1602
+ u,
1603
+ i && /* @__PURE__ */ e(Be, { className: "w-4 h-4 text-[var(--accent)] shrink-0" }),
1604
+ r && /* @__PURE__ */ e("span", { className: "text-xs group-hover:translate-x-0.5 transition-transform text-zinc-500 shrink-0", children: "›" })
1293
1605
  ] })
1294
1606
  ]
1295
1607
  }
1296
- ), H = ({ label: i, onBack: t, rightAction: n }) => /* @__PURE__ */ d(
1608
+ ), K = ({
1609
+ label: n,
1610
+ onBack: t,
1611
+ rightAction: i
1612
+ }) => /* @__PURE__ */ d(
1297
1613
  "div",
1298
1614
  {
1299
1615
  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",
@@ -1305,24 +1621,44 @@ const Ve = (i, t = 200) => {
1305
1621
  className: "flex items-center gap-2 hover:text-white transition-colors focus:outline-none",
1306
1622
  onClick: t,
1307
1623
  children: [
1308
- /* @__PURE__ */ e(Ri, { className: "w-3 h-3" }),
1309
- /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(ge, { content: i }) })
1624
+ /* @__PURE__ */ e(Fi, { className: "w-3 h-3" }),
1625
+ /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(ye, { content: n }) })
1310
1626
  ]
1311
1627
  }
1312
1628
  ),
1313
- n
1629
+ i
1314
1630
  ]
1315
1631
  }
1316
- ), ee = () => /* @__PURE__ */ e("div", { className: "h-px bg-white/5 mx-2 my-1" }), dn = ({ items: i, onClose: t, title: n, maxHeight: o, className: l }) => {
1317
- const [u, h] = S([]), v = u.length > 0 ? u[u.length - 1] : null, w = v ? v.children || [] : i, b = v ? v.html : n || "Menu", p = () => {
1318
- h((m) => m.slice(0, -1));
1319
- }, y = (m) => {
1320
- m.children && h((T) => [...T, m]);
1632
+ ), pe = () => /* @__PURE__ */ e("div", { className: "h-px bg-white/5 mx-2 my-1" }), Vt = ({
1633
+ items: n,
1634
+ onClose: t,
1635
+ title: i,
1636
+ maxHeight: o,
1637
+ className: r
1638
+ }) => {
1639
+ const [h, u] = N([]), f = h.length > 0 ? h[h.length - 1] : null, g = f ? f.children || [] : n, x = f ? f.html : i || "Menu", p = () => {
1640
+ u((m) => m.slice(0, -1));
1641
+ }, w = (m) => {
1642
+ m.children && u((T) => [...T, m]);
1321
1643
  };
1322
- return /* @__PURE__ */ e(De, { onClose: t, maxHeight: o, className: l, children: /* @__PURE__ */ d("div", { className: "animate-in fade-in slide-in-from-right-4 duration-200", children: [
1323
- u.length > 0 ? /* @__PURE__ */ e(H, { label: b || "Menu", onBack: p }) : n && /* @__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: n }) }),
1324
- /* @__PURE__ */ e("div", { className: "pb-1", children: w.map((m, T) => m.separator ? /* @__PURE__ */ e(ee, {}, T) : m.range ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
1325
- le,
1644
+ return /* @__PURE__ */ e(it, { onClose: t, maxHeight: o, className: r, children: /* @__PURE__ */ d("div", { className: "animate-in fade-in slide-in-from-right-4 duration-200", children: [
1645
+ h.length > 0 ? /* @__PURE__ */ e(K, { label: x || "Menu", onBack: p }) : i && /* @__PURE__ */ e(
1646
+ "div",
1647
+ {
1648
+ 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",
1649
+ style: { borderRadius: "var(--radius)" },
1650
+ children: /* @__PURE__ */ e("span", { children: i })
1651
+ }
1652
+ ),
1653
+ /* @__PURE__ */ e("div", { className: "pb-1", children: g.map((m, T) => m.separator ? /* @__PURE__ */ e(pe, {}, T) : m.isLabel ? /* @__PURE__ */ e(
1654
+ "div",
1655
+ {
1656
+ className: "px-3 py-1.5 text-[10px] font-bold text-zinc-500 uppercase tracking-wider select-none",
1657
+ children: /* @__PURE__ */ e(ye, { content: m.html || "" })
1658
+ },
1659
+ T
1660
+ ) : m.range ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
1661
+ we,
1326
1662
  {
1327
1663
  label: m.html,
1328
1664
  icon: m.icon,
@@ -1330,20 +1666,20 @@ const Ve = (i, t = 200) => {
1330
1666
  min: m.min ?? 0,
1331
1667
  max: m.max ?? 100,
1332
1668
  step: m.step ?? 1,
1333
- onChange: ($) => m.onRange && m.onRange($),
1669
+ onChange: (I) => m.onRange && m.onRange(I),
1334
1670
  formatValue: m.formatValue
1335
1671
  }
1336
1672
  ) }, T) : m.switch !== void 0 ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
1337
- q,
1673
+ oe,
1338
1674
  {
1339
1675
  label: m.html,
1340
1676
  icon: m.icon,
1341
1677
  checked: m.switch,
1342
1678
  tooltip: m.tooltip,
1343
- onChange: ($) => m.onSwitch && m.onSwitch(m, $)
1679
+ onChange: (I) => m.onSwitch && m.onSwitch(m, I)
1344
1680
  }
1345
- ) }, T) : /* @__PURE__ */ e(ce.Fragment, { children: /* @__PURE__ */ e(
1346
- z,
1681
+ ) }, T) : /* @__PURE__ */ e(ke.Fragment, { children: /* @__PURE__ */ e(
1682
+ A,
1347
1683
  {
1348
1684
  label: m.html,
1349
1685
  icon: m.icon,
@@ -1351,313 +1687,410 @@ const Ve = (i, t = 200) => {
1351
1687
  active: m.active,
1352
1688
  hasSubmenu: !!m.children,
1353
1689
  onClick: () => {
1354
- m.children ? y(m) : m.onClick ? (m.onClick(m), !m.switch && !m.range && t()) : m.click && (m.click(m), t());
1690
+ m.children ? w(m) : m.onClick ? (m.onClick(m), !m.switch && !m.range && t()) : m.click && (m.click(m), t());
1355
1691
  }
1356
1692
  }
1357
1693
  ) }, T)) })
1358
1694
  ] }) });
1359
- }, un = ({ tracks: i, current: t, onSelect: n, onUpload: o, onClose: l, settings: u, onSettingsChange: h, onReset: v, offset: w, onOffsetChange: b, maxHeight: p, animationClass: y }) => {
1360
- const [m, T] = S("main"), $ = A(null);
1361
- return /* @__PURE__ */ d(De, { onClose: l, align: "right", maxHeight: p, className: y, children: [
1362
- m === "main" && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-left-4 fade-in duration-200", children: [
1363
- /* @__PURE__ */ e(
1364
- "div",
1365
- {
1366
- 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",
1367
- style: { borderRadius: "var(--radius)" },
1368
- children: /* @__PURE__ */ e("span", { children: "Subtitles" })
1369
- }
1370
- ),
1371
- /* @__PURE__ */ d("div", { children: [
1372
- /* @__PURE__ */ e(
1373
- z,
1374
- {
1375
- label: "Upload Subtitle",
1376
- icon: /* @__PURE__ */ e(Ii, { className: "w-4 h-4" }),
1377
- onClick: () => {
1378
- var g;
1379
- return (g = $.current) == null ? void 0 : g.click();
1380
- }
1381
- }
1382
- ),
1383
- /* @__PURE__ */ e("input", { type: "file", accept: ".vtt,.srt", ref: $, className: "hidden", onChange: (g) => {
1384
- var Q;
1385
- (Q = g.target.files) != null && Q[0] && o(g.target.files[0]);
1386
- } }),
1387
- /* @__PURE__ */ e(
1388
- z,
1389
- {
1390
- label: "Customize",
1391
- icon: /* @__PURE__ */ e(Ai, { className: "w-4 h-4" }),
1392
- onClick: () => T("customize"),
1393
- hasSubmenu: !0
1394
- }
1395
- ),
1396
- /* @__PURE__ */ e("div", { className: "h-px bg-white/5 mx-2 my-1" }),
1397
- /* @__PURE__ */ e(
1398
- z,
1399
- {
1400
- label: "Off",
1401
- active: t === -1,
1402
- onClick: () => {
1403
- n(-1), l();
1404
- }
1405
- }
1406
- ),
1407
- i.map((g) => /* @__PURE__ */ e(
1408
- z,
1409
- {
1410
- label: g.label,
1411
- value: g.language,
1412
- active: t === g.index,
1413
- onClick: () => {
1414
- n(g.index), l();
1695
+ }, mn = ({
1696
+ tracks: n,
1697
+ current: t,
1698
+ onSelect: i,
1699
+ onUpload: o,
1700
+ onClose: r,
1701
+ settings: h,
1702
+ onSettingsChange: u,
1703
+ onReset: f,
1704
+ offset: g,
1705
+ onOffsetChange: x,
1706
+ maxHeight: p,
1707
+ animationClass: w
1708
+ }) => {
1709
+ const [m, T] = N("main"), [I, O] = N(""), Y = U(null), W = xe(() => I ? n.filter(
1710
+ (b) => b.label.toLowerCase().includes(I.toLowerCase()) || b.srcLang && b.srcLang.toLowerCase().includes(I.toLowerCase())
1711
+ ) : n, [n, I]);
1712
+ return /* @__PURE__ */ d(
1713
+ it,
1714
+ {
1715
+ onClose: r,
1716
+ align: "right",
1717
+ maxHeight: p,
1718
+ className: w,
1719
+ children: [
1720
+ m === "main" && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-left-4 fade-in duration-200 flex flex-col h-full", children: [
1721
+ /* @__PURE__ */ e(
1722
+ "div",
1723
+ {
1724
+ 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 shrink-0",
1725
+ style: { borderRadius: "var(--radius)" },
1726
+ children: /* @__PURE__ */ e("span", { children: "Subtitles" })
1415
1727
  }
1416
- },
1417
- g.index
1418
- ))
1419
- ] })
1420
- ] }),
1421
- m === "customize" && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
1422
- /* @__PURE__ */ e(
1423
- H,
1424
- {
1425
- label: "Customize",
1426
- onBack: () => T("main"),
1427
- rightAction: /* @__PURE__ */ e("button", { onClick: v, className: "p-1.5 text-zinc-400 hover:text-white transition-colors rounded-md hover:bg-white/10", title: "Reset All", children: /* @__PURE__ */ e(Hi, { className: "w-4 h-4" }) })
1428
- }
1429
- ),
1430
- /* @__PURE__ */ d("div", { className: "pb-1", children: [
1431
- /* @__PURE__ */ e(te, { children: /* @__PURE__ */ e(
1432
- q,
1433
- {
1434
- label: "Native Video Subtitle",
1435
- checked: u.useNative,
1436
- onChange: (g) => h({ useNative: g })
1437
- }
1438
- ) }),
1439
- !u.useNative && /* @__PURE__ */ d(B, { children: [
1440
- /* @__PURE__ */ d(te, { title: "Sync & Position", children: [
1441
- /* @__PURE__ */ d("div", { className: "py-2.5 px-3 rounded-lg hover:bg-white/5 group transition-colors", children: [
1442
- /* @__PURE__ */ e("div", { className: "flex justify-between items-center mb-2", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
1443
- /* @__PURE__ */ e($i, { className: "w-4 h-4 text-zinc-500 group-hover:text-zinc-400 transition-colors" }),
1444
- /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: "Sync Offset" })
1445
- ] }) }),
1446
- /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1447
- /* @__PURE__ */ e(
1448
- "button",
1449
- {
1450
- onClick: () => b(Math.round((w - 0.1) * 10) / 10),
1451
- 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",
1452
- children: /* @__PURE__ */ e(Ei, { className: "w-4 h-4" })
1453
- }
1454
- ),
1455
- /* @__PURE__ */ d("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: [
1456
- w > 0 ? "+" : "",
1457
- (w == null ? void 0 : w.toFixed(1)) || "0.0",
1458
- "s"
1459
- ] }),
1460
- /* @__PURE__ */ e(
1461
- "button",
1462
- {
1463
- onClick: () => b(Math.round((w + 0.1) * 10) / 10),
1464
- 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",
1465
- children: /* @__PURE__ */ e(Fi, { className: "w-4 h-4" })
1466
- }
1467
- )
1468
- ] })
1469
- ] }),
1728
+ ),
1729
+ /* @__PURE__ */ d("div", { className: "px-1.5 pb-2 shrink-0", children: [
1470
1730
  /* @__PURE__ */ e(
1471
- le,
1731
+ A,
1472
1732
  {
1473
- label: "Vertical Position",
1474
- icon: /* @__PURE__ */ e(Oi, { className: "w-4 h-4" }),
1475
- value: u.verticalOffset,
1476
- min: 0,
1477
- max: 200,
1478
- step: 5,
1479
- onChange: (g) => h({ verticalOffset: g }),
1480
- formatValue: (g) => `${g}px`
1733
+ label: "Upload Subtitle",
1734
+ icon: /* @__PURE__ */ e(Ei, { className: "w-4 h-4" }),
1735
+ onClick: () => {
1736
+ var b;
1737
+ return (b = Y.current) == null ? void 0 : b.click();
1738
+ }
1481
1739
  }
1482
- )
1483
- ] }),
1484
- /* @__PURE__ */ d(te, { title: "Appearance", children: [
1740
+ ),
1485
1741
  /* @__PURE__ */ e(
1486
- le,
1742
+ "input",
1487
1743
  {
1488
- label: "Text Size",
1489
- icon: /* @__PURE__ */ e(Bi, { className: "w-4 h-4" }),
1490
- value: u.textSize,
1491
- min: 50,
1492
- max: 200,
1493
- step: 10,
1494
- onChange: (g) => h({ textSize: g }),
1495
- formatValue: (g) => `${g}%`
1744
+ type: "file",
1745
+ accept: ".vtt,.srt",
1746
+ ref: Y,
1747
+ className: "hidden",
1748
+ onChange: (b) => {
1749
+ var H;
1750
+ (H = b.target.files) != null && H[0] && o(b.target.files[0]);
1751
+ }
1496
1752
  }
1497
1753
  ),
1498
- /* @__PURE__ */ d("div", { className: "py-2.5 px-3 rounded-lg hover:bg-white/5 group transition-colors", children: [
1499
- /* @__PURE__ */ d("div", { className: "flex items-center gap-3 mb-2", children: [
1500
- /* @__PURE__ */ e(At, { className: "w-4 h-4 text-zinc-500 group-hover:text-zinc-400 transition-colors" }),
1501
- /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: "Text Color" })
1502
- ] }),
1503
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 p-1 bg-zinc-800/50 rounded-lg", children: [
1504
- ["#ffffff", "#ffff00", "#00ffff", "#ff00ff", "#ff0000", "#00ff00"].map((g) => /* @__PURE__ */ e(
1505
- "button",
1506
- {
1507
- onClick: () => h({ textColor: g }),
1508
- className: `w-6 h-6 rounded-full border border-white/10 transition-transform hover:scale-110 ${u.textColor === g ? "ring-2 scale-110" : ""}`,
1509
- style: { backgroundColor: g, "--tw-ring-color": "var(--accent)" }
1510
- },
1511
- g
1512
- )),
1513
- /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/10 mx-1" }),
1514
- /* @__PURE__ */ e("div", { className: "relative w-6 h-6 rounded-full overflow-hidden ring-1 ring-white/20 cursor-pointer", children: /* @__PURE__ */ e(
1515
- "input",
1516
- {
1517
- type: "color",
1518
- value: u.textColor,
1519
- onChange: (g) => h({ textColor: g.target.value }),
1520
- className: "absolute inset-[-4px] w-[150%] h-[150%] cursor-pointer p-0 border-0"
1521
- }
1522
- ) })
1523
- ] })
1524
- ] }),
1525
1754
  /* @__PURE__ */ e(
1526
- cn,
1755
+ A,
1527
1756
  {
1528
- label: "Text Style",
1529
- value: u.textStyle,
1530
- options: [
1531
- { label: "None", value: "none" },
1532
- { label: "Outline", value: "outline" },
1533
- { label: "Raised", value: "raised" },
1534
- { label: "Depressed", value: "depressed" },
1535
- { label: "Drop Shadow", value: "shadow" }
1536
- ],
1537
- onChange: (g) => h({ textStyle: g })
1757
+ label: "Customize",
1758
+ icon: /* @__PURE__ */ e(jt, { className: "w-4 h-4" }),
1759
+ onClick: () => T("customize"),
1760
+ hasSubmenu: !0
1538
1761
  }
1539
1762
  ),
1540
- /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2 mt-1 px-1", children: [
1541
- /* @__PURE__ */ e(q, { label: "Bold", icon: /* @__PURE__ */ e(ji, { className: "w-4 h-4" }), checked: u.isBold, onChange: (g) => h({ isBold: g }) }),
1542
- /* @__PURE__ */ e(q, { label: "Fix Caps", icon: /* @__PURE__ */ e(Wi, { className: "w-4 h-4" }), checked: u.fixCapitalization, onChange: (g) => h({ fixCapitalization: g }) })
1543
- ] })
1544
- ] }),
1545
- /* @__PURE__ */ d(te, { title: "Background", children: [
1763
+ /* @__PURE__ */ e("div", { className: "h-px bg-white/5 mx-2 my-1" }),
1546
1764
  /* @__PURE__ */ e(
1547
- le,
1765
+ A,
1548
1766
  {
1549
- label: "Opacity",
1550
- icon: /* @__PURE__ */ e(Vi, { className: "w-4 h-4" }),
1551
- value: u.backgroundOpacity,
1552
- min: 0,
1553
- max: 100,
1554
- step: 5,
1555
- onChange: (g) => h({ backgroundOpacity: g }),
1556
- formatValue: (g) => `${g}%`
1767
+ label: "Off",
1768
+ active: t === -1,
1769
+ onClick: () => {
1770
+ i(-1), r();
1771
+ }
1557
1772
  }
1558
1773
  ),
1559
- /* @__PURE__ */ e(q, { label: "Blur Background", icon: /* @__PURE__ */ e(Di, { className: "w-4 h-4" }), checked: u.backgroundBlur, onChange: (g) => h({ backgroundBlur: g }) }),
1560
- u.backgroundBlur && /* @__PURE__ */ e(
1561
- le,
1774
+ /* @__PURE__ */ d("div", { className: "relative mt-2", children: [
1775
+ /* @__PURE__ */ e(
1776
+ "input",
1777
+ {
1778
+ type: "text",
1779
+ placeholder: "Search subtitles...",
1780
+ value: I,
1781
+ onChange: (b) => O(b.target.value),
1782
+ 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"
1783
+ }
1784
+ ),
1785
+ /* @__PURE__ */ e(cn, { className: "w-3.5 h-3.5 text-zinc-500 absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none" })
1786
+ ] })
1787
+ ] }),
1788
+ /* @__PURE__ */ d("div", { className: "overflow-y-auto hide-scrollbar flex-1", children: [
1789
+ W.map((b) => {
1790
+ let H = null;
1791
+ return b.status === "loading" ? H = /* @__PURE__ */ e(Fe, { className: "w-3.5 h-3.5 animate-spin text-[var(--accent)]" }) : b.status === "error" ? H = /* @__PURE__ */ e(dn, { className: "w-3.5 h-3.5 text-red-500" }) : b.status === "success" && (H = /* @__PURE__ */ e(_t, { className: "w-3.5 h-3.5 text-emerald-500" })), /* @__PURE__ */ e(
1792
+ A,
1793
+ {
1794
+ label: b.label,
1795
+ value: b.srcLang,
1796
+ active: t === b.index,
1797
+ rightIcon: H,
1798
+ onClick: () => {
1799
+ i(b.index), r();
1800
+ }
1801
+ },
1802
+ b.index
1803
+ );
1804
+ }),
1805
+ W.length === 0 && I && /* @__PURE__ */ e("div", { className: "px-4 py-3 text-center text-xs text-zinc-500", children: "No results found" })
1806
+ ] })
1807
+ ] }),
1808
+ m === "customize" && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
1809
+ /* @__PURE__ */ e(
1810
+ K,
1811
+ {
1812
+ label: "Customize",
1813
+ onBack: () => T("main"),
1814
+ rightAction: /* @__PURE__ */ e(
1815
+ "button",
1816
+ {
1817
+ onClick: f,
1818
+ className: "p-1.5 text-zinc-400 hover:text-white transition-colors rounded-md hover:bg-white/10",
1819
+ title: "Reset All",
1820
+ children: /* @__PURE__ */ e(Ui, { className: "w-4 h-4" })
1821
+ }
1822
+ )
1823
+ }
1824
+ ),
1825
+ /* @__PURE__ */ d("div", { className: "pb-1", children: [
1826
+ /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
1827
+ oe,
1562
1828
  {
1563
- label: "Blur Intensity",
1564
- value: u.backgroundBlurAmount,
1565
- min: 0,
1566
- max: 20,
1567
- step: 1,
1568
- onChange: (g) => h({ backgroundBlurAmount: g }),
1569
- formatValue: (g) => `${g}px`
1829
+ label: "Native Video Subtitle",
1830
+ checked: h.useNative,
1831
+ onChange: (b) => u({ useNative: b })
1570
1832
  }
1571
- )
1833
+ ) }),
1834
+ !h.useNative && /* @__PURE__ */ d(_, { children: [
1835
+ /* @__PURE__ */ d(me, { title: "Sync & Position", children: [
1836
+ /* @__PURE__ */ d("div", { className: "py-2.5 px-3 rounded-lg hover:bg-white/5 group transition-colors", children: [
1837
+ /* @__PURE__ */ e("div", { className: "flex justify-between items-center mb-2", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3", children: [
1838
+ /* @__PURE__ */ e(Vi, { className: "w-4 h-4 text-zinc-500 group-hover:text-zinc-400 transition-colors" }),
1839
+ /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: "Sync Offset" })
1840
+ ] }) }),
1841
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1842
+ /* @__PURE__ */ e(
1843
+ "button",
1844
+ {
1845
+ onClick: () => x(Math.round((g - 0.1) * 10) / 10),
1846
+ 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",
1847
+ children: /* @__PURE__ */ e(Di, { className: "w-4 h-4" })
1848
+ }
1849
+ ),
1850
+ /* @__PURE__ */ d("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: [
1851
+ g > 0 ? "+" : "",
1852
+ (g == null ? void 0 : g.toFixed(1)) || "0.0",
1853
+ "s"
1854
+ ] }),
1855
+ /* @__PURE__ */ e(
1856
+ "button",
1857
+ {
1858
+ onClick: () => x(Math.round((g + 0.1) * 10) / 10),
1859
+ 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",
1860
+ children: /* @__PURE__ */ e(Oi, { className: "w-4 h-4" })
1861
+ }
1862
+ )
1863
+ ] })
1864
+ ] }),
1865
+ /* @__PURE__ */ e(
1866
+ we,
1867
+ {
1868
+ label: "Vertical Position",
1869
+ icon: /* @__PURE__ */ e(ji, { className: "w-4 h-4" }),
1870
+ value: h.verticalOffset,
1871
+ min: 0,
1872
+ max: 200,
1873
+ step: 5,
1874
+ onChange: (b) => u({ verticalOffset: b }),
1875
+ formatValue: (b) => `${b}px`
1876
+ }
1877
+ )
1878
+ ] }),
1879
+ /* @__PURE__ */ d(me, { title: "Appearance", children: [
1880
+ /* @__PURE__ */ e(
1881
+ we,
1882
+ {
1883
+ label: "Text Size",
1884
+ icon: /* @__PURE__ */ e(Hi, { className: "w-4 h-4" }),
1885
+ value: h.textSize,
1886
+ min: 50,
1887
+ max: 200,
1888
+ step: 10,
1889
+ onChange: (b) => u({ textSize: b }),
1890
+ formatValue: (b) => `${b}%`
1891
+ }
1892
+ ),
1893
+ /* @__PURE__ */ d("div", { className: "py-2.5 px-3 rounded-lg hover:bg-white/5 group transition-colors", children: [
1894
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-3 mb-2", children: [
1895
+ /* @__PURE__ */ e(Ut, { className: "w-4 h-4 text-zinc-500 group-hover:text-zinc-400 transition-colors" }),
1896
+ /* @__PURE__ */ e("span", { className: "text-xs font-bold text-zinc-400 uppercase tracking-wider group-hover:text-zinc-300 transition-colors", children: "Text Color" })
1897
+ ] }),
1898
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 p-1 bg-zinc-800/50 rounded-lg", children: [
1899
+ [
1900
+ "#ffffff",
1901
+ "#ffff00",
1902
+ "#00ffff",
1903
+ "#ff00ff",
1904
+ "#ff0000",
1905
+ "#00ff00"
1906
+ ].map((b) => /* @__PURE__ */ e(
1907
+ "button",
1908
+ {
1909
+ onClick: () => u({ textColor: b }),
1910
+ className: `w-6 h-6 rounded-full border border-white/10 transition-transform hover:scale-110 ${h.textColor === b ? "ring-2 scale-110" : ""}`,
1911
+ style: {
1912
+ backgroundColor: b,
1913
+ "--tw-ring-color": "var(--accent)"
1914
+ }
1915
+ },
1916
+ b
1917
+ )),
1918
+ /* @__PURE__ */ e("div", { className: "w-px h-6 bg-white/10 mx-1" }),
1919
+ /* @__PURE__ */ e("div", { className: "relative w-6 h-6 rounded-full overflow-hidden ring-1 ring-white/20 cursor-pointer", children: /* @__PURE__ */ e(
1920
+ "input",
1921
+ {
1922
+ type: "color",
1923
+ value: h.textColor,
1924
+ onChange: (b) => u({ textColor: b.target.value }),
1925
+ className: "absolute inset-[-4px] w-[150%] h-[150%] cursor-pointer p-0 border-0"
1926
+ }
1927
+ ) })
1928
+ ] })
1929
+ ] }),
1930
+ /* @__PURE__ */ e(
1931
+ pn,
1932
+ {
1933
+ label: "Text Style",
1934
+ value: h.textStyle,
1935
+ options: [
1936
+ { label: "None", value: "none" },
1937
+ { label: "Outline", value: "outline" },
1938
+ { label: "Raised", value: "raised" },
1939
+ { label: "Depressed", value: "depressed" },
1940
+ { label: "Drop Shadow", value: "shadow" }
1941
+ ],
1942
+ onChange: (b) => u({
1943
+ textStyle: b
1944
+ })
1945
+ }
1946
+ ),
1947
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-2 mt-1 px-1", children: [
1948
+ /* @__PURE__ */ e(
1949
+ oe,
1950
+ {
1951
+ label: "Bold",
1952
+ icon: /* @__PURE__ */ e(Gi, { className: "w-4 h-4" }),
1953
+ checked: h.isBold,
1954
+ onChange: (b) => u({ isBold: b })
1955
+ }
1956
+ ),
1957
+ /* @__PURE__ */ e(
1958
+ oe,
1959
+ {
1960
+ label: "Fix Caps",
1961
+ icon: /* @__PURE__ */ e(_i, { className: "w-4 h-4" }),
1962
+ checked: h.fixCapitalization,
1963
+ onChange: (b) => u({ fixCapitalization: b })
1964
+ }
1965
+ )
1966
+ ] })
1967
+ ] }),
1968
+ /* @__PURE__ */ d(me, { title: "Background", children: [
1969
+ /* @__PURE__ */ e(
1970
+ we,
1971
+ {
1972
+ label: "Opacity",
1973
+ icon: /* @__PURE__ */ e(Wi, { className: "w-4 h-4" }),
1974
+ value: h.backgroundOpacity,
1975
+ min: 0,
1976
+ max: 100,
1977
+ step: 5,
1978
+ onChange: (b) => u({ backgroundOpacity: b }),
1979
+ formatValue: (b) => `${b}%`
1980
+ }
1981
+ ),
1982
+ /* @__PURE__ */ e(
1983
+ oe,
1984
+ {
1985
+ label: "Blur Background",
1986
+ icon: /* @__PURE__ */ e(qi, { className: "w-4 h-4" }),
1987
+ checked: h.backgroundBlur,
1988
+ onChange: (b) => u({ backgroundBlur: b })
1989
+ }
1990
+ ),
1991
+ h.backgroundBlur && /* @__PURE__ */ e(
1992
+ we,
1993
+ {
1994
+ label: "Blur Intensity",
1995
+ value: h.backgroundBlurAmount,
1996
+ min: 0,
1997
+ max: 20,
1998
+ step: 1,
1999
+ onChange: (b) => u({ backgroundBlurAmount: b }),
2000
+ formatValue: (b) => `${b}px`
2001
+ }
2002
+ )
2003
+ ] })
2004
+ ] })
1572
2005
  ] })
1573
2006
  ] })
1574
- ] })
1575
- ] })
1576
- ] });
1577
- }, Oe = ({ content: i }) => typeof i == "string" ? i.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: i } }) : /* @__PURE__ */ e("span", { children: i }) : /* @__PURE__ */ e(B, { children: i }), hn = ({ x: i, y: t, items: n, onClose: o, containerWidth: l, containerHeight: u }) => {
1578
- const h = A(null), [v, w] = S({
2007
+ ]
2008
+ }
2009
+ );
2010
+ }, Ye = ({ content: n }) => typeof n == "string" ? n.trim().startsWith("<") ? /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: n } }) : /* @__PURE__ */ e("span", { children: n }) : /* @__PURE__ */ e(_, { children: n }), fn = ({ x: n, y: t, items: i, onClose: o, containerWidth: r, containerHeight: h }) => {
2011
+ const u = U(null), [f, g] = N({
1579
2012
  top: t,
1580
- left: i,
2013
+ left: n,
1581
2014
  opacity: 0
1582
2015
  });
1583
- return ve(() => {
1584
- if (!h.current) return;
1585
- const b = h.current.getBoundingClientRect(), p = b.width, y = b.height;
1586
- let m = i, T = t;
1587
- i + p > l - 10 && (m = i - p), m < 10 && (m = 10), m + p > l && (m = Math.max(10, l - p - 10)), t + y > u - 10 && (T = t - y);
1588
- let $ = u - 20;
1589
- T < 10 && (T = 10), T + y > u - 10 && (T = Math.max(10, u - y - 10)), w({
2016
+ return Ee(() => {
2017
+ if (!u.current) return;
2018
+ const x = u.current.getBoundingClientRect(), p = x.width, w = x.height;
2019
+ let m = n, T = t;
2020
+ n + p > r - 10 && (m = n - p), m < 10 && (m = 10), m + p > r && (m = Math.max(10, r - p - 10)), t + w > h - 10 && (T = t - w);
2021
+ let I = h - 20;
2022
+ T < 10 && (T = 10), T + w > h - 10 && (T = Math.max(10, h - w - 10)), g({
1590
2023
  top: T,
1591
2024
  left: m,
1592
- maxHeight: $,
2025
+ maxHeight: I,
1593
2026
  opacity: 1
1594
2027
  });
1595
- }, [i, t, n, l, u]), j(() => {
1596
- const b = (p) => {
1597
- h.current && !h.current.contains(p.target) && o();
2028
+ }, [n, t, i, r, h]), Q(() => {
2029
+ const x = (p) => {
2030
+ u.current && !u.current.contains(p.target) && o();
1598
2031
  };
1599
- return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
2032
+ return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
1600
2033
  }, [o]), /* @__PURE__ */ e(
1601
2034
  "div",
1602
2035
  {
1603
- ref: h,
2036
+ ref: u,
1604
2037
  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",
1605
2038
  style: {
1606
- top: v.top,
1607
- left: v.left,
1608
- maxHeight: v.maxHeight,
1609
- opacity: v.opacity,
2039
+ top: f.top,
2040
+ left: f.left,
2041
+ maxHeight: f.maxHeight,
2042
+ opacity: f.opacity,
1610
2043
  borderRadius: "var(--radius-lg)"
1611
2044
  },
1612
- onClick: (b) => b.stopPropagation(),
1613
- onMouseDown: (b) => b.stopPropagation(),
1614
- onTouchStart: (b) => b.stopPropagation(),
1615
- children: n.map((b, p) => b.separator ? /* @__PURE__ */ e("div", { className: "h-0 border-t border-white/10 mx-2 my-1.5" }, p) : b.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(Oe, { content: b.html || "" }) }, p) : /* @__PURE__ */ d(ce.Fragment, { children: [
2045
+ onClick: (x) => x.stopPropagation(),
2046
+ onMouseDown: (x) => x.stopPropagation(),
2047
+ onTouchStart: (x) => x.stopPropagation(),
2048
+ children: i.map((x, p) => x.separator ? /* @__PURE__ */ e("div", { className: "h-0 border-t border-white/10 mx-2 my-1.5" }, p) : x.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(Ye, { content: x.html || "" }) }, p) : /* @__PURE__ */ d(ke.Fragment, { children: [
1616
2049
  /* @__PURE__ */ d(
1617
2050
  "button",
1618
2051
  {
1619
2052
  onClick: () => {
1620
- b.disabled || (b.click ? b.click(o) : b.onClick && b.onClick(o));
2053
+ x.disabled || (x.click ? x.click(o) : x.onClick && x.onClick(o));
1621
2054
  },
1622
- disabled: b.disabled,
2055
+ disabled: x.disabled,
1623
2056
  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",
1624
2057
  style: { borderRadius: "var(--radius)" },
1625
2058
  children: [
1626
2059
  /* @__PURE__ */ d("div", { className: "flex items-center gap-3 overflow-hidden", children: [
1627
- b.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(Oe, { content: b.icon }) }),
1628
- /* @__PURE__ */ e("span", { className: `flex items-center font-medium truncate ${b.checked ? "text-[var(--accent)]" : ""}`, children: /* @__PURE__ */ e(Oe, { content: b.html || "" }) })
2060
+ x.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(Ye, { content: x.icon }) }),
2061
+ /* @__PURE__ */ e("span", { className: `flex items-center font-medium truncate ${x.checked ? "text-[var(--accent)]" : ""}`, children: /* @__PURE__ */ e(Ye, { content: x.html || "" }) })
1629
2062
  ] }),
1630
- b.checked && /* @__PURE__ */ e(We, { className: "w-4 h-4 text-[var(--accent)] shrink-0 ml-2" })
2063
+ x.checked && /* @__PURE__ */ e(Be, { className: "w-4 h-4 text-[var(--accent)] shrink-0 ml-2" })
1631
2064
  ]
1632
2065
  }
1633
2066
  ),
1634
- b.showBorder && /* @__PURE__ */ e("div", { className: "h-0 border-t border-white/10 mx-2 my-1" })
2067
+ x.showBorder && /* @__PURE__ */ e("div", { className: "h-0 border-t border-white/10 mx-2 my-1" })
1635
2068
  ] }, p))
1636
2069
  }
1637
2070
  );
1638
- }, pn = ({ player: i, onClose: t }) => {
1639
- const [n, o] = S({});
1640
- return j(() => {
1641
- const l = () => {
1642
- var w;
1643
- if (!i.video) return;
1644
- const h = i.video, v = h.getVideoPlaybackQuality ? h.getVideoPlaybackQuality() : null;
2071
+ }, bn = ({ player: n, onClose: t }) => {
2072
+ const [i, o] = N({});
2073
+ return Q(() => {
2074
+ const r = () => {
2075
+ var g;
2076
+ if (!n.video) return;
2077
+ const u = n.video, f = u.getVideoPlaybackQuality ? u.getVideoPlaybackQuality() : null;
1645
2078
  o({
1646
- "Player Size": `${h.offsetWidth} x ${h.offsetHeight}`,
1647
- "Video Resolution": `${h.videoWidth} x ${h.videoHeight}`,
1648
- "Current Time": `${h.currentTime.toFixed(3)}s`,
1649
- Duration: `${h.duration.toFixed(3)}s`,
1650
- Volume: `${Math.round(h.volume * 100)}%`,
1651
- "Dropped Frames": v ? v.droppedVideoFrames : "N/A",
1652
- Buffer: h.buffered.length > 0 ? `${(h.buffered.end(h.buffered.length - 1) - h.currentTime).toFixed(2)}s` : "0s",
1653
- Engine: ((w = i.store.get().sources[i.store.get().currentSourceIndex]) == null ? void 0 : w.type) || "native",
1654
- URL: h.currentSrc
2079
+ "Player Size": `${u.offsetWidth} x ${u.offsetHeight}`,
2080
+ "Video Resolution": `${u.videoWidth} x ${u.videoHeight}`,
2081
+ "Current Time": `${u.currentTime.toFixed(3)}s`,
2082
+ Duration: `${u.duration.toFixed(3)}s`,
2083
+ Volume: `${Math.round(u.volume * 100)}%`,
2084
+ "Dropped Frames": f ? f.droppedVideoFrames : "N/A",
2085
+ Buffer: u.buffered.length > 0 ? `${(u.buffered.end(u.buffered.length - 1) - u.currentTime).toFixed(2)}s` : "0s",
2086
+ Engine: ((g = n.store.get().sources[n.store.get().currentSourceIndex]) == null ? void 0 : g.type) || "native",
2087
+ URL: u.currentSrc
1655
2088
  });
1656
2089
  };
1657
- l();
1658
- const u = setInterval(l, 1e3);
1659
- return () => clearInterval(u);
1660
- }, [i]), /* @__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__ */ d(
2090
+ r();
2091
+ const h = setInterval(r, 1e3);
2092
+ return () => clearInterval(h);
2093
+ }, [n]), /* @__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__ */ d(
1661
2094
  "div",
1662
2095
  {
1663
2096
  className: "bg-[var(--bg-panel)] border border-white/10 rounded-xl w-full max-w-md shadow-2xl relative font-mono text-xs text-zinc-300 flex flex-col",
@@ -1667,234 +2100,243 @@ const Ve = (i, t = 200) => {
1667
2100
  /* @__PURE__ */ e(
1668
2101
  "button",
1669
2102
  {
1670
- onClick: (l) => {
1671
- l.stopPropagation(), t();
2103
+ onClick: (r) => {
2104
+ r.stopPropagation(), t();
1672
2105
  },
1673
2106
  className: "absolute top-3 right-3 p-1.5 text-zinc-400 hover:text-white hover:bg-white/10 rounded-full transition-colors",
1674
- children: /* @__PURE__ */ e(Xi, { className: "w-4 h-4" })
2107
+ children: /* @__PURE__ */ e(Gt, { className: "w-4 h-4" })
1675
2108
  }
1676
2109
  ),
1677
2110
  /* @__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" })
1678
2111
  ] }),
1679
- /* @__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(n).map(([l, u]) => /* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row sm:justify-between sm:items-center gap-1", children: [
1680
- /* @__PURE__ */ e("span", { className: "text-zinc-500 font-bold shrink-0", children: l }),
1681
- /* @__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) })
1682
- ] }, l)) })
2112
+ /* @__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, h]) => /* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row sm:justify-between sm:items-center gap-1", children: [
2113
+ /* @__PURE__ */ e("span", { className: "text-zinc-500 font-bold shrink-0", children: r }),
2114
+ /* @__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(h), children: String(h) })
2115
+ ] }, r)) })
1683
2116
  ]
1684
2117
  }
1685
2118
  ) });
1686
2119
  };
1687
- function mn(i) {
1688
- if (!i) return "#ffffff";
1689
- i = i.replace("#", ""), i.length === 3 && (i = i.split("").map((u) => u + u).join(""));
1690
- const t = parseInt(i.substring(0, 2), 16), n = parseInt(i.substring(2, 4), 16), o = parseInt(i.substring(4, 6), 16);
1691
- return (t * 299 + n * 587 + o * 114) / 1e3 >= 128 ? "#000000" : "#ffffff";
2120
+ function gn(n) {
2121
+ if (!n) return "#ffffff";
2122
+ n = n.replace("#", ""), n.length === 3 && (n = n.split("").map((h) => h + h).join(""));
2123
+ const t = parseInt(n.substring(0, 2), 16), i = parseInt(n.substring(2, 4), 16), o = parseInt(n.substring(4, 6), 16);
2124
+ return (t * 299 + i * 587 + o * 114) / 1e3 >= 128 ? "#000000" : "#ffffff";
1692
2125
  }
1693
- const fn = [
2126
+ const vn = [
1694
2127
  { label: "Strata", value: "#6366f1" },
1695
2128
  { label: "Emerald", value: "#10b981" },
1696
2129
  { label: "Rose", value: "#f43f5e" },
1697
2130
  { label: "Amber", value: "#f59e0b" },
1698
2131
  { label: "Sky", value: "#0ea5e9" },
1699
2132
  { label: "Violet", value: "#8b5cf6" }
1700
- ], bn = [
2133
+ ], xn = [
1701
2134
  { label: "Default", value: "default", color: "#6366f1" },
1702
2135
  { label: "Pixel", value: "pixel", color: "#ef4444" },
1703
2136
  { label: "Game", value: "game", color: "#eab308" },
1704
2137
  { label: "Hacker", value: "hacker", color: "#22c55e" }
1705
- ], Lt = ({ content: i, className: t, style: n }) => typeof i == "string" ? i.trim().startsWith("<") ? /* @__PURE__ */ e("div", { className: t, style: n, dangerouslySetInnerHTML: { __html: i } }) : /* @__PURE__ */ e("div", { className: t, style: n, children: i }) : /* @__PURE__ */ e("div", { className: t, style: n, children: i }), $t = (i) => {
1706
- var Nt, Mt;
1707
- const { src: t, type: n, sources: o, poster: l, autoPlay: u, thumbnails: h, textTracks: v, plugins: w, onGetInstance: b, ...p } = i, y = p.screenshot ?? !1, m = p.pip ?? !0, T = p.setting ?? !0, $ = p.fullscreen ?? !0, g = p.fullscreenWeb ?? !1, Q = p.lock ?? !1, X = p.fastForward ?? !0, Bt = p.flip ?? !0, Vt = p.aspectRatio ?? !0, _e = p.hotKey ?? !0, Ot = p.backdrop ?? !0, we = p.gestureSeek ?? !1, Ht = p.centerControls ?? !0, Ge = p.fetchTimeout ?? 3e4;
2138
+ ], Dt = ({ content: n, className: t, style: i }) => typeof n == "string" ? n.trim().startsWith("<") ? /* @__PURE__ */ e("div", { className: t, style: i, dangerouslySetInnerHTML: { __html: n } }) : /* @__PURE__ */ e("div", { className: t, style: i, children: n }) : /* @__PURE__ */ e("div", { className: t, style: i, children: n }), Ot = (n) => {
2139
+ var Lt, $t;
2140
+ const { src: t, type: i, sources: o, poster: r, autoPlay: h, thumbnails: u, textTracks: f, plugins: g, onGetInstance: x, ...p } = n, w = p.screenshot ?? !1, m = p.pip ?? !0, T = p.setting ?? !0, I = p.fullscreen ?? !0, O = p.fullscreenWeb ?? !1, Y = p.lock ?? !1, W = p.fastForward ?? !0, b = p.flip ?? !0, H = p.aspectRatio ?? !0, k = p.hotKey ?? !0, q = p.backdrop ?? !0, $ = p.gestureSeek ?? !1, j = p.centerControls ?? !0, Z = p.fetchTimeout ?? 3e4;
1708
2141
  p.autoOrientation;
1709
- const V = A(null), [s, Ue] = S(null), [ye, ke] = S(!1), [qe, Qe] = S(0), [jt, Xe] = S(0), [Je, Wt] = S(!1), Ke = fe(() => Ft(p), []), r = di(
1710
- be((c) => s ? s.store.subscribe(c) : () => {
2142
+ const P = U(null), [s, ie] = N(null), [ne, le] = N(!1), [ce, Se] = N(0), [nt, Ce] = N(0), [st, qt] = N(!1), ot = xe(() => Wt(p), []), a = bi(
2143
+ $e((c) => s ? s.store.subscribe(c) : () => {
1711
2144
  }, [s]),
1712
- () => s ? s.store.get() : Ke,
1713
- () => Ke
1714
- ), Dt = fe(() => mn(r.themeColor), [r.themeColor]), [E, ie] = S(!1), [F, Se] = S(!1), [O, R] = S("main"), [L, Ye] = S(null), Ze = A(null);
1715
- L && (Ze.current = L);
1716
- const [ne, Ce] = S({ x: 0, y: 0, visible: !1 }), [_t, et] = S(!1), tt = Ve(E, 300), it = Ve(F, 300), nt = Ve(!!L, 300), P = be(() => {
1717
- ie(!1), Se(!1), Ye(null), Ce((c) => ({ ...c, visible: !1 }));
1718
- }, []), [Ne, de] = S(!1), [ue, Me] = S(0), [Gt, st] = S(!1), [Ut, ot] = S(!1), [Te, he] = S(!1), [rt, at] = S([]), [lt, ct] = S(null), [qt, Qt] = S(0), [J, dt] = S(null), [Y, pe] = S(null), [gn, ut] = S(null), [ze, ht] = S(!1), Ie = A(null), pt = A(1), oe = A(null), mt = A(0), se = A(!1), re = A(null), K = A(null), Re = A(null), Pe = A(null), ae = A(null);
1719
- ve(() => {
1720
- s && V.current && s.attach(V.current);
1721
- }, [s, r.isWebFullscreen]), ve(() => {
1722
- if (!V.current) return;
2145
+ () => s ? s.store.get() : ot,
2146
+ () => ot
2147
+ ), Xt = xe(() => gn(a.themeColor), [a.themeColor]), [B, rt] = N(!1), [V, at] = N(!1), [X, D] = N("main"), [E, Ve] = N(null), De = U(null);
2148
+ E && (De.current = E);
2149
+ const [se, lt] = N({ x: 0, y: 0, visible: !1 }), [Qt, ct] = N(!1), dt = Ke(B, 300), ut = Ke(V, 300), Ne = Ke(!!E, 300), C = $e(() => {
2150
+ (B || V || E || se.visible) && (rt(!1), at(!1), Ve(null), lt((c) => ({ ...c, visible: !1 })));
2151
+ }, [B, V, E, se.visible]);
2152
+ Q(() => {
2153
+ const c = (v) => {
2154
+ (B || V || E || se.visible) && C();
2155
+ };
2156
+ return (B || V || E || se.visible) && (document.addEventListener("click", c), document.addEventListener("touchstart", c)), () => {
2157
+ document.removeEventListener("click", c), document.removeEventListener("touchstart", c);
2158
+ };
2159
+ }, [B, V, E, se.visible, C]);
2160
+ const [Oe, Me] = N(!1), [Te, He] = N(0), [Jt, ht] = N(!1), [Kt, pt] = N(!1), [We, ze] = N(!1), [mt, ft] = N([]), [bt, gt] = N(null), [Yt, Zt] = N(0), [re, vt] = N(null), [de, Ie] = N(null), [wn, xt] = N(null), [je, wt] = N(!1), Ue = U(null), yt = U(1), be = U(null), kt = U(0), fe = U(!1), ge = U(null), ae = U(null), Ge = U(null), _e = U(null), ve = U(null);
2161
+ Ee(() => {
2162
+ s && P.current && s.attach(P.current);
2163
+ }, [s, a.isWebFullscreen]), Ee(() => {
2164
+ if (!P.current) return;
1723
2165
  (() => {
1724
- V.current && (Qe(V.current.clientHeight), Xe(V.current.clientWidth));
2166
+ P.current && (Se(P.current.clientHeight), Ce(P.current.clientWidth));
1725
2167
  })();
1726
- const f = new ResizeObserver((k) => {
1727
- for (const N of k)
1728
- Qe(N.contentRect.height), Xe(N.contentRect.width);
2168
+ const v = new ResizeObserver((S) => {
2169
+ for (const M of S)
2170
+ Se(M.contentRect.height), Ce(M.contentRect.width);
1729
2171
  });
1730
- return f.observe(V.current), () => {
1731
- f.disconnect();
2172
+ return v.observe(P.current), () => {
2173
+ v.disconnect();
1732
2174
  };
1733
- }, [r.isWebFullscreen]), j(() => {
1734
- if (Wt("ontouchstart" in window || navigator.maxTouchPoints > 0), !V.current) return;
1735
- const c = new xi({ ...p, poster: l });
1736
- return w && w.length > 0 && w.forEach((f) => c.use(f)), c.attach(V.current), Ue(c), b && b(c), () => {
1737
- c.destroy(), Ue(null);
2175
+ }, [a.isWebFullscreen]), Q(() => {
2176
+ if (qt("ontouchstart" in window || navigator.maxTouchPoints > 0), !P.current) return;
2177
+ const c = new Ni({ ...p, poster: r });
2178
+ return g && g.length > 0 && g.forEach((v) => c.use(v)), c.attach(P.current), ie(c), x && x(c), () => {
2179
+ c.destroy(), ie(null);
1738
2180
  };
1739
- }, []), j(() => {
2181
+ }, []), Q(() => {
1740
2182
  if (!s) return;
1741
2183
  const c = {};
1742
- p.theme !== void 0 && p.theme !== r.theme && (c.theme = p.theme), p.themeColor !== void 0 && p.themeColor !== r.themeColor && (c.themeColor = p.themeColor), p.iconSize !== void 0 && p.iconSize !== r.iconSize && (c.iconSize = p.iconSize), Object.keys(c).length > 0 && s.setAppearance(c), p.volume !== void 0 && Math.abs(p.volume - r.volume) > 0.01 && s.setVolume(p.volume), p.muted !== void 0 && p.muted !== r.isMuted && (p.muted ? s.video.muted = !0 : s.video.muted = !1);
1743
- }, [s, p.theme, p.themeColor, p.iconSize, p.volume, p.muted]), j(() => {
2184
+ p.theme !== void 0 && p.theme !== a.theme && (c.theme = p.theme), p.themeColor !== void 0 && p.themeColor !== a.themeColor && (c.themeColor = p.themeColor), p.iconSize !== void 0 && p.iconSize !== a.iconSize && (c.iconSize = p.iconSize), Object.keys(c).length > 0 && s.setAppearance(c), p.volume !== void 0 && Math.abs(p.volume - a.volume) > 0.01 && s.setVolume(p.volume), p.muted !== void 0 && p.muted !== a.isMuted && (p.muted ? s.video.muted = !0 : s.video.muted = !1);
2185
+ }, [s, p.theme, p.themeColor, p.iconSize, p.volume, p.muted]), Q(() => {
1744
2186
  if (!s) return;
1745
- const c = v || [];
1746
- o && o.length > 0 ? (ke(!1), s.setSources(o, c)) : t && (ke(!1), s.setSources([{ url: t, type: n || "auto" }], c));
1747
- }, [t, n, o, v, s]), j(() => {
1748
- s && u && s.play().catch(() => {
1749
- console.warn("Autoplay failed (likely needs user interaction)");
2187
+ const c = f || [];
2188
+ o && o.length > 0 ? (le(!1), s.setSources(o, c)) : t && (le(!1), s.setSources([{ url: t, type: i || "auto" }], c));
2189
+ }, [t, i, o, f, s]), Q(() => {
2190
+ s && h && s.play().catch(() => {
2191
+ s.pause(), s.store.setState({ isPlaying: !1, isBuffering: !1 }), s.notify({ type: "warning", message: "Autoplay blocked by browser. Click play to start.", duration: 5e3 });
1750
2192
  });
1751
- }, [s, u]), j(() => {
1752
- r.isPlaying && !ye && ke(!0);
1753
- }, [r.isPlaying, ye]), j(() => {
1754
- h && s ? gi(h, s.notify.bind(s), Ge).then((c) => at(c)) : at([]);
1755
- }, [h, s, Ge]), j(() => (Y && (ae.current && clearTimeout(ae.current), ae.current = setTimeout(() => {
1756
- pe(null);
2193
+ }, [s, h]), Q(() => {
2194
+ a.isPlaying && !ne && le(!0);
2195
+ }, [a.isPlaying, ne]), Q(() => {
2196
+ u && s ? Si(u, s.notify.bind(s), Z).then((c) => ft(c)) : ft([]);
2197
+ }, [u, s, Z]), Q(() => (de && (ve.current && clearTimeout(ve.current), ve.current = setTimeout(() => {
2198
+ Ie(null);
1757
2199
  }, 600)), () => {
1758
- ae.current && clearTimeout(ae.current);
1759
- }), [Y]), j(() => {
1760
- const c = (f) => {
1761
- var N;
1762
- if (!s || !_e || ((N = document.activeElement) == null ? void 0 : N.tagName) === "INPUT") return;
1763
- switch (f.key.toLowerCase()) {
2200
+ ve.current && clearTimeout(ve.current);
2201
+ }), [de]), Q(() => {
2202
+ const c = (v) => {
2203
+ var M;
2204
+ if (!s || !k || ((M = document.activeElement) == null ? void 0 : M.tagName) === "INPUT") return;
2205
+ switch (v.key.toLowerCase()) {
1764
2206
  case " ":
1765
2207
  case "k":
1766
- f.preventDefault(), s.togglePlay();
2208
+ v.preventDefault(), s.togglePlay();
1767
2209
  break;
1768
2210
  case "arrowright":
1769
- f.preventDefault(), s.skip(5);
2211
+ v.preventDefault(), s.skip(5);
1770
2212
  break;
1771
2213
  case "arrowleft":
1772
- f.preventDefault(), s.skip(-5);
2214
+ v.preventDefault(), s.skip(-5);
1773
2215
  break;
1774
2216
  case "arrowup":
1775
- f.preventDefault(), s.setVolume(s.video.volume + 0.1);
2217
+ v.preventDefault(), s.setVolume(s.video.volume + 0.1);
1776
2218
  break;
1777
2219
  case "arrowdown":
1778
- f.preventDefault(), s.setVolume(s.video.volume - 0.1);
2220
+ v.preventDefault(), s.setVolume(s.video.volume - 0.1);
1779
2221
  break;
1780
2222
  case "f":
1781
- f.preventDefault(), s.toggleFullscreen();
2223
+ v.preventDefault(), s.toggleFullscreen();
1782
2224
  break;
1783
2225
  case "m":
1784
- f.preventDefault(), s.toggleMute();
2226
+ v.preventDefault(), s.toggleMute();
1785
2227
  break;
1786
2228
  case "escape":
1787
- s.store.get().isWebFullscreen && (f.preventDefault(), s.toggleWebFullscreen());
2229
+ s.store.get().isWebFullscreen && (v.preventDefault(), s.toggleWebFullscreen());
1788
2230
  break;
1789
2231
  }
1790
2232
  };
1791
2233
  return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
1792
- }, [s, _e]);
1793
- const ft = () => {
1794
- s && (s.setControlsVisible(!0), K.current && clearTimeout(K.current), !(E || F || L) && (K.current = setTimeout(() => {
1795
- !r.isPlaying || E || F || L || s.setControlsVisible(!1);
2234
+ }, [s, k]);
2235
+ const St = () => {
2236
+ s && (s.setControlsVisible(!0), ae.current && clearTimeout(ae.current), !(B || V || E) && (ae.current = setTimeout(() => {
2237
+ !a.isPlaying || B || V || E || s.setControlsVisible(!1);
1796
2238
  }, 2500)));
1797
2239
  };
1798
- j(() => {
1799
- s && (!E && !F && !L && r.isPlaying ? ft() : (E || F || L) && (s.setControlsVisible(!0), K.current && clearTimeout(K.current)));
1800
- }, [E, F, L, r.isPlaying, s]);
1801
- const bt = be(() => {
1802
- if (!(!X || !s || !r.isPlaying || r.isLocked)) {
1803
- if (E || F || L) {
1804
- P();
2240
+ Q(() => {
2241
+ s && (!B && !V && !E && a.isPlaying ? St() : (B || V || E) && (s.setControlsVisible(!0), ae.current && clearTimeout(ae.current)));
2242
+ }, [B, V, E, a.isPlaying, s]);
2243
+ const Ct = $e(() => {
2244
+ if (!(!W || !s || !a.isPlaying || a.isLocked)) {
2245
+ if (B || V || E) {
2246
+ C();
1805
2247
  return;
1806
2248
  }
1807
- pt.current = s.video.playbackRate, Ie.current = setTimeout(() => {
1808
- s.video.playbackRate = 2, ht(!0);
2249
+ yt.current = s.video.playbackRate, Ue.current = setTimeout(() => {
2250
+ s.video.playbackRate = 2, wt(!0);
1809
2251
  }, 500);
1810
2252
  }
1811
- }, [X, s, r.isPlaying, r.isLocked, E, F, L]), Le = be(() => {
1812
- Ie.current && clearTimeout(Ie.current), ze && s && (s.video.playbackRate = pt.current, ht(!1));
1813
- }, [ze, s]), Xt = (c) => {
1814
- if (bt(), E || F || L) {
1815
- P();
2253
+ }, [W, s, a.isPlaying, a.isLocked, B, V, E]), qe = $e(() => {
2254
+ Ue.current && clearTimeout(Ue.current), je && s && (s.video.playbackRate = yt.current, wt(!1));
2255
+ }, [je, s]), ei = (c) => {
2256
+ if (Ct(), B || V || E) {
2257
+ C();
1816
2258
  return;
1817
2259
  }
1818
- we && !r.isLocked && (oe.current = c.touches[0].clientX, mt.current = r.currentTime, se.current = !1);
1819
- }, Jt = (c) => {
1820
- if (!r.isLocked && we && oe.current !== null) {
1821
- const f = c.touches[0].clientX - oe.current;
1822
- if (Math.abs(f) > 10 && (Le(), se.current = !0, de(!0), V.current && r.duration)) {
1823
- const k = V.current.getBoundingClientRect(), N = f / k.width, G = Math.max(0, Math.min(r.duration, mt.current + N * r.duration));
1824
- Me(G);
2260
+ $ && !a.isLocked && (be.current = c.touches[0].clientX, kt.current = a.currentTime, fe.current = !1);
2261
+ }, ti = (c) => {
2262
+ if (!a.isLocked && $ && be.current !== null) {
2263
+ const v = c.touches[0].clientX - be.current;
2264
+ if (Math.abs(v) > 10 && (qe(), fe.current = !0, Me(!0), P.current && a.duration)) {
2265
+ const S = P.current.getBoundingClientRect(), M = v / S.width, L = Math.max(0, Math.min(a.duration, kt.current + M * a.duration));
2266
+ He(L);
1825
2267
  }
1826
2268
  }
1827
- }, Kt = (c) => {
1828
- if (Le(), we && se.current) {
1829
- s == null || s.seek(ue), de(!1), se.current = !1, oe.current = null;
2269
+ }, ii = (c) => {
2270
+ if (qe(), $ && fe.current) {
2271
+ s == null || s.seek(Te), Me(!1), fe.current = !1, be.current = null;
1830
2272
  return;
1831
2273
  }
1832
- oe.current = null;
1833
- }, $e = (c) => {
1834
- if (!Re.current || !r.duration) return 0;
1835
- const f = Re.current.getBoundingClientRect(), k = "touches" in c ? c.touches[0].clientX : c.clientX;
1836
- return Math.max(0, Math.min(1, (k - f.left) / f.width)) * r.duration;
1837
- }, gt = (c) => {
1838
- if (c.stopPropagation(), r.isLocked) return;
1839
- (E || F || L) && P(), de(!0), Me($e(c));
1840
- const f = (N) => Me($e(N)), k = (N) => {
1841
- s == null || s.seek($e(N)), de(!1), document.removeEventListener("mousemove", f), document.removeEventListener("touchmove", f), document.removeEventListener("mouseup", k), document.removeEventListener("touchend", k);
2274
+ be.current = null;
2275
+ }, Xe = (c) => {
2276
+ if (!Ge.current || !a.duration) return 0;
2277
+ const v = Ge.current.getBoundingClientRect(), S = "touches" in c ? c.touches[0].clientX : c.clientX;
2278
+ return Math.max(0, Math.min(1, (S - v.left) / v.width)) * a.duration;
2279
+ }, Nt = (c) => {
2280
+ if (c.stopPropagation(), a.isLocked) return;
2281
+ (B || V || E) && C(), Me(!0), He(Xe(c));
2282
+ const v = (M) => He(Xe(M)), S = (M) => {
2283
+ s == null || s.seek(Xe(M)), Me(!1), document.removeEventListener("mousemove", v), document.removeEventListener("touchmove", v), document.removeEventListener("mouseup", S), document.removeEventListener("touchend", S);
1842
2284
  };
1843
- document.addEventListener("mousemove", f), document.addEventListener("touchmove", f), document.addEventListener("mouseup", k), document.addEventListener("touchend", k);
1844
- }, vt = (c) => {
1845
- if (!Pe.current) return 0;
1846
- const f = Pe.current.getBoundingClientRect(), k = "touches" in c ? c.touches[0].clientX : c.clientX;
1847
- return Math.max(0, Math.min(1, (k - f.left) / f.width));
1848
- }, xt = (c) => {
1849
- if (c.stopPropagation(), !s || r.isLocked) return;
1850
- st(!0), s.setVolume(vt(c));
1851
- const f = (N) => s.setVolume(vt(N)), k = () => {
1852
- st(!1), document.removeEventListener("mousemove", f), document.removeEventListener("touchmove", f), document.removeEventListener("mouseup", k), document.removeEventListener("touchend", k);
2285
+ document.addEventListener("mousemove", v), document.addEventListener("touchmove", v), document.addEventListener("mouseup", S), document.addEventListener("touchend", S);
2286
+ }, Mt = (c) => {
2287
+ if (!_e.current) return 0;
2288
+ const v = _e.current.getBoundingClientRect(), S = "touches" in c ? c.touches[0].clientX : c.clientX;
2289
+ return Math.max(0, Math.min(1, (S - v.left) / v.width));
2290
+ }, Tt = (c) => {
2291
+ if (c.stopPropagation(), !s || a.isLocked) return;
2292
+ ht(!0), s.setVolume(Mt(c));
2293
+ const v = (M) => s.setVolume(Mt(M)), S = () => {
2294
+ ht(!1), document.removeEventListener("mousemove", v), document.removeEventListener("touchmove", v), document.removeEventListener("mouseup", S), document.removeEventListener("touchend", S);
1853
2295
  };
1854
- document.addEventListener("mousemove", f), document.addEventListener("touchmove", f), document.addEventListener("mouseup", k), document.addEventListener("touchend", k);
1855
- }, Yt = (c) => {
1856
- if (!r.duration || r.isLive) return;
1857
- const f = c.currentTarget.getBoundingClientRect(), k = (c.clientX - f.left) / f.width, N = k * r.duration;
1858
- Qt(k * 100), ct(N), rt.length > 0 && dt(rt.find((G) => N >= G.start && N < G.end) || null);
1859
- }, me = (c) => {
1860
- !s || r.isLocked || (s.skip(c === "forward" ? 10 : -10), ut(c), setTimeout(() => ut(null), 300));
1861
- }, Zt = (c) => {
2296
+ document.addEventListener("mousemove", v), document.addEventListener("touchmove", v), document.addEventListener("mouseup", S), document.addEventListener("touchend", S);
2297
+ }, ni = (c) => {
2298
+ if (!a.duration || a.isLive) return;
2299
+ const v = c.currentTarget.getBoundingClientRect(), S = (c.clientX - v.left) / v.width, M = S * a.duration;
2300
+ Zt(S * 100), gt(M), mt.length > 0 && vt(mt.find((L) => M >= L.start && M < L.end) || null);
2301
+ }, Re = (c) => {
2302
+ !s || a.isLocked || (s.skip(c === "forward" ? 10 : -10), xt(c), setTimeout(() => xt(null), 300));
2303
+ }, si = (c) => {
1862
2304
  if (!s) return;
1863
- if (se.current) {
1864
- se.current = !1;
2305
+ if (fe.current) {
2306
+ fe.current = !1;
1865
2307
  return;
1866
2308
  }
1867
- if (E || F || L || ne.visible) {
1868
- P();
2309
+ if (B || V || E || se.visible) {
2310
+ C();
1869
2311
  return;
1870
2312
  }
1871
- if (Te && he(!1), s.setControlsVisible(!0), K.current && clearTimeout(K.current), K.current = setTimeout(() => {
1872
- !r.isPlaying || E || F || L || s.setControlsVisible(!1);
1873
- }, 2500), r.isLocked) return;
1874
- const f = c.currentTarget.getBoundingClientRect(), k = c.clientX - f.left, N = f.width, G = Date.now();
1875
- re.current ? (clearTimeout(re.current), re.current = null, k < N * 0.35 ? (me("rewind"), pe({ type: "rewind", id: G })) : k > N * 0.65 ? (me("forward"), pe({ type: "forward", id: G })) : s.toggleFullscreen()) : re.current = setTimeout(() => {
1876
- s.togglePlay(), re.current = null;
2313
+ if (We && ze(!1), s.setControlsVisible(!0), ae.current && clearTimeout(ae.current), ae.current = setTimeout(() => {
2314
+ !a.isPlaying || B || V || E || s.setControlsVisible(!1);
2315
+ }, 2500), a.isLocked) return;
2316
+ const v = c.currentTarget.getBoundingClientRect(), S = c.clientX - v.left, M = v.width, L = Date.now();
2317
+ ge.current ? (clearTimeout(ge.current), ge.current = null, S < M * 0.35 ? (Re("rewind"), Ie({ type: "rewind", id: L })) : S > M * 0.65 ? (Re("forward"), Ie({ type: "forward", id: L })) : s.toggleFullscreen()) : ge.current = setTimeout(() => {
2318
+ s.togglePlay(), ge.current = null;
1877
2319
  }, 250);
1878
- }, ei = (c) => {
1879
- var k;
1880
- if (c.preventDefault(), c.stopPropagation(), r.isLocked) return;
1881
- P();
1882
- const f = (k = V.current) == null ? void 0 : k.getBoundingClientRect();
1883
- f && requestAnimationFrame(() => {
1884
- Ce({
2320
+ }, oi = (c) => {
2321
+ var S;
2322
+ if (c.preventDefault(), c.stopPropagation(), a.isLocked) return;
2323
+ C();
2324
+ const v = (S = P.current) == null ? void 0 : S.getBoundingClientRect();
2325
+ v && requestAnimationFrame(() => {
2326
+ lt({
1885
2327
  visible: !0,
1886
- x: c.clientX - f.left,
1887
- y: c.clientY - f.top
2328
+ x: c.clientX - v.left,
2329
+ y: c.clientY - v.top
1888
2330
  });
1889
2331
  });
1890
- }, ti = (c) => {
1891
- if (c.stopPropagation(), P(), Te) {
1892
- he(!1);
2332
+ }, ri = (c) => {
2333
+ if (c.stopPropagation(), C(), We) {
2334
+ ze(!1);
1893
2335
  return;
1894
2336
  }
1895
- Je ? he(!0) : s == null || s.toggleMute();
1896
- }, ii = r.isMuted || r.volume === 0 ? ki : r.volume < 0.5 ? yi : wi, Ee = Math.max(100, qe - 120), ni = () => {
1897
- switch (r.iconSize) {
2337
+ st ? ze(!0) : s == null || s.toggleMute();
2338
+ }, ai = a.isMuted || a.volume === 0 ? zi : a.volume < 0.5 ? Ti : Mi, Pe = Math.max(100, ce - 120), li = () => {
2339
+ switch (a.iconSize) {
1898
2340
  case "small":
1899
2341
  return "w-4 h-4";
1900
2342
  case "large":
@@ -1902,8 +2344,8 @@ const fn = [
1902
2344
  default:
1903
2345
  return "w-5 h-5";
1904
2346
  }
1905
- }, si = () => {
1906
- switch (r.iconSize) {
2347
+ }, ci = () => {
2348
+ switch (a.iconSize) {
1907
2349
  case "small":
1908
2350
  return "p-2 min-w-[32px] min-h-[32px]";
1909
2351
  case "large":
@@ -1911,8 +2353,8 @@ const fn = [
1911
2353
  default:
1912
2354
  return "p-2.5 min-w-[36px] min-h-[36px]";
1913
2355
  }
1914
- }, W = ni(), _ = si(), Z = (() => {
1915
- switch (r.iconSize) {
2356
+ }, J = li(), ee = ci(), ue = (() => {
2357
+ switch (a.iconSize) {
1916
2358
  case "small":
1917
2359
  return {
1918
2360
  playBtn: "w-14 h-14",
@@ -1935,7 +2377,7 @@ const fn = [
1935
2377
  skipIcon: "w-6 h-6"
1936
2378
  };
1937
2379
  }
1938
- })(), oi = !r.isLocked && (r.controlsVisible || !r.isPlaying || E || F || L || ne.visible), wt = Ut || Gt || Te, Fe = Ot ? "backdrop-blur-xl bg-black/80" : "bg-black/95", yt = fe(() => {
2380
+ })(), di = !a.isLocked && (a.controlsVisible || !a.isPlaying || B || V || E || se.visible), zt = Kt || Jt || We, Le = q ? "backdrop-blur-xl bg-black/80" : "bg-black/95", It = xe(() => {
1939
2381
  const c = [
1940
2382
  { id: "play", position: "left", index: 10, isBuiltIn: !0 },
1941
2383
  { id: "volume", position: "left", index: 20, isBuiltIn: !0 },
@@ -1948,269 +2390,304 @@ const fn = [
1948
2390
  { id: "fullscreenWeb", position: "right", index: 110, isBuiltIn: !0 },
1949
2391
  { id: "fullscreen", position: "right", index: 120, isBuiltIn: !0 }
1950
2392
  ];
1951
- return p.controls && p.controls.forEach((f) => {
1952
- const k = c.find((N) => N.id === f.id);
1953
- k ? Object.assign(k, f) : c.push(f);
1954
- }), c.filter((f) => !(f.id === "screenshot" && !y || f.id === "pip" && !m || f.id === "settings" && !T || f.id === "fullscreen" && !$ || f.id === "fullscreenWeb" && !g)).sort((f, k) => f.index - k.index);
1955
- }, [p.controls, y, m, T, $, g]), kt = (c) => {
1956
- var f, k, N, G, Tt;
2393
+ p.controls && p.controls.forEach((L) => {
2394
+ const he = c.find((l) => l.id === L.id);
2395
+ he ? Object.assign(he, L) : c.push(L);
2396
+ });
2397
+ const v = a.sources[a.currentSourceIndex] || { url: t || "", type: i || "auto" }, S = v.type === "hls" || v.url.includes(".m3u8"), M = c.find((L) => L.id === "download");
2398
+ return M && (S ? (M.children = [
2399
+ { html: "Download Format", isLabel: !0 },
2400
+ {
2401
+ html: "MPEG-TS",
2402
+ value: "Original Stream",
2403
+ icon: /* @__PURE__ */ e(_t, { className: "w-3.5 h-3.5" }),
2404
+ onClick: () => s == null ? void 0 : s.download({ format: "ts" })
2405
+ },
2406
+ {
2407
+ html: "MP4",
2408
+ value: "Converted",
2409
+ icon: /* @__PURE__ */ e(jt, { className: "w-3.5 h-3.5" }),
2410
+ onClick: () => s == null ? void 0 : s.download({ format: "mp4" })
2411
+ }
2412
+ ], M.onClick = void 0) : (M.children = void 0, M.onClick = (L) => L.download())), c.filter((L) => !(L.id === "screenshot" && !w || L.id === "pip" && !m || L.id === "settings" && !T || L.id === "fullscreen" && !I || L.id === "fullscreenWeb" && !O)).sort((L, he) => L.index - he.index);
2413
+ }, [p.controls, w, m, T, I, O, a.currentSourceIndex, a.sources, t, i]), Rt = (c) => {
2414
+ var v, S, M, L, he;
1957
2415
  if (!c.isBuiltIn) {
1958
- const a = c.id || `ctrl-${c.index}`, I = L === a, U = I || nt.isMounted && Ze.current === a;
2416
+ const l = c.id || `ctrl-${c.index}`, F = E === l, G = F || Ne.isMounted && De.current === l;
1959
2417
  return /* @__PURE__ */ d("div", { className: "relative", children: [
1960
2418
  /* @__PURE__ */ e(
1961
2419
  "button",
1962
2420
  {
1963
- onMouseDown: (C) => C.stopPropagation(),
1964
- onTouchStart: (C) => C.stopPropagation(),
1965
- onClick: (C) => {
1966
- if (C.stopPropagation(), c.children) {
1967
- const Ae = I;
1968
- P(), Ae || Ye(a);
2421
+ onMouseDown: (z) => z.stopPropagation(),
2422
+ onTouchStart: (z) => z.stopPropagation(),
2423
+ onClick: (z) => {
2424
+ if (z.stopPropagation(), c.children) {
2425
+ const Qe = F;
2426
+ C(), Qe || Ve(l);
1969
2427
  } else
1970
- P(), c.click ? c.click(s) : c.onClick && c.onClick(s);
2428
+ C(), c.click ? c.click(s) : c.onClick && c.onClick(s);
1971
2429
  },
1972
- className: `strata-control-btn transition-colors focus:outline-none flex items-center justify-center ${_} ${I ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"} ${c.className || ""}`,
2430
+ className: `strata-control-btn transition-colors focus:outline-none flex items-center justify-center ${ee} ${F ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"} ${c.className || ""}`,
1973
2431
  style: { borderRadius: "var(--radius)", ...c.style },
1974
2432
  title: c.tooltip,
1975
- children: /* @__PURE__ */ e(Lt, { content: c.html || "" })
2433
+ children: /* @__PURE__ */ e(Dt, { content: c.html || "" })
1976
2434
  }
1977
2435
  ),
1978
- c.children && U && /* @__PURE__ */ e(
1979
- dn,
2436
+ c.children && G && /* @__PURE__ */ e(
2437
+ Vt,
1980
2438
  {
1981
2439
  items: c.children,
1982
- onClose: P,
1983
- maxHeight: Ee,
1984
- className: `strata-backdrop ${Fe} ${nt.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"}`
2440
+ onClose: C,
2441
+ maxHeight: Pe,
2442
+ className: `strata-backdrop ${Le} ${Ne.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"}`
1985
2443
  }
1986
2444
  )
1987
2445
  ] }, c.index);
1988
2446
  }
1989
2447
  switch (c.id) {
1990
2448
  case "play":
1991
- return /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
1992
- a.stopPropagation(), P(), s == null || s.togglePlay();
1993
- }, className: `strata-control-btn text-zinc-300 hover:text-white transition-colors hover:bg-white/10 focus:outline-none ${_}`, style: { borderRadius: "var(--radius)" }, children: r.isPlaying ? /* @__PURE__ */ e(It, { className: `${W} fill-current` }) : /* @__PURE__ */ e(zt, { className: `${W} fill-current` }) }, "play");
2449
+ return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2450
+ l.stopPropagation(), C(), s == null || s.togglePlay();
2451
+ }, className: `strata-control-btn text-zinc-300 hover:text-white transition-colors hover:bg-white/10 focus:outline-none ${ee}`, style: { borderRadius: "var(--radius)" }, children: a.isPlaying ? /* @__PURE__ */ e(Ft, { className: `${J} fill-current` }) : /* @__PURE__ */ e(Et, { className: `${J} fill-current` }) }, "play");
1994
2452
  case "volume":
1995
2453
  return /* @__PURE__ */ d(
1996
2454
  "div",
1997
2455
  {
1998
2456
  className: "flex items-center gap-2 group/vol relative",
1999
2457
  onMouseEnter: () => {
2000
- window.matchMedia("(hover: hover)").matches && ot(!0);
2458
+ window.matchMedia("(hover: hover)").matches && pt(!0);
2001
2459
  },
2002
2460
  onMouseLeave: () => {
2003
- window.matchMedia("(hover: hover)").matches && ot(!1);
2461
+ window.matchMedia("(hover: hover)").matches && pt(!1);
2004
2462
  },
2005
2463
  children: [
2006
- /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: ti, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 focus:outline-none ${_}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(ii, { className: W }) }),
2007
- /* @__PURE__ */ e("div", { className: `relative h-8 flex items-center transition-all duration-300 ease-out overflow-hidden ${wt ? "w-28 opacity-100 ml-1" : "w-0 opacity-0"}`, children: /* @__PURE__ */ d("div", { ref: Pe, className: "relative w-full h-full flex items-center cursor-pointer px-2", onMouseDown: xt, onTouchStart: xt, children: [
2008
- /* @__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: `${(r.isMuted ? 0 : r.volume) * 100}%`, borderRadius: "var(--radius-full)" } }) }),
2009
- /* @__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(${(r.isMuted ? 0 : r.volume) * 100}% * 0.85 + 4px)`, borderRadius: "var(--radius-full)" } })
2464
+ /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: ri, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 focus:outline-none ${ee}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(ai, { className: J }) }),
2465
+ /* @__PURE__ */ e("div", { className: `relative h-8 flex items-center transition-all duration-300 ease-out overflow-hidden ${zt ? "w-28 opacity-100 ml-1" : "w-0 opacity-0"}`, children: /* @__PURE__ */ d("div", { ref: _e, className: "relative w-full h-full flex items-center cursor-pointer px-2", onMouseDown: Tt, onTouchStart: Tt, children: [
2466
+ /* @__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)" } }) }),
2467
+ /* @__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)" } })
2010
2468
  ] }) }),
2011
- wt && /* @__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 + ${(r.isMuted ? 0 : r.volume) * 80}px)` }, children: r.isMuted ? "0%" : `${Math.round(r.volume * 100)}%` })
2469
+ zt && /* @__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)}%` })
2012
2470
  ]
2013
2471
  },
2014
2472
  "volume"
2015
2473
  );
2016
2474
  case "time":
2017
- return p.isLive ? /* @__PURE__ */ d("div", { className: "flex items-center gap-2 px-2 py-0.5 rounded-md border border-white/10", style: { backgroundColor: `${r.themeColor}1a`, borderColor: `${r.themeColor}33` }, children: [
2018
- /* @__PURE__ */ e("div", { className: "w-2 h-2 rounded-full animate-pulse", style: { backgroundColor: r.themeColor } }),
2019
- /* @__PURE__ */ e("span", { className: "text-[10px] font-bold tracking-wider", style: { color: r.themeColor }, children: "LIVE" })
2475
+ return p.isLive ? /* @__PURE__ */ d("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: [
2476
+ /* @__PURE__ */ e("div", { className: "w-2 h-2 rounded-full animate-pulse", style: { backgroundColor: a.themeColor } }),
2477
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-bold tracking-wider", style: { color: a.themeColor }, children: "LIVE" })
2020
2478
  ] }, "live") : /* @__PURE__ */ d("div", { className: "text-xs font-medium text-zinc-400 font-mono select-none hidden sm:block tabular-nums", children: [
2021
- Be(Ne ? ue : r.currentTime),
2479
+ Je(Oe ? Te : a.currentTime),
2022
2480
  " ",
2023
2481
  /* @__PURE__ */ e("span", { className: "text-zinc-600", children: "/" }),
2024
2482
  " ",
2025
- Be(r.duration)
2483
+ Je(a.duration)
2026
2484
  ] }, "time");
2027
2485
  case "subtitle":
2028
2486
  return /* @__PURE__ */ d("div", { className: "relative", children: [
2029
- /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2030
- a.stopPropagation();
2031
- const I = F;
2032
- P(), I || Se(!0);
2033
- }, className: `strata-control-btn transition-colors focus:outline-none ${_} ${F ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Ti, { className: W }) }),
2034
- it.isMounted && /* @__PURE__ */ e(
2035
- un,
2487
+ /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2488
+ l.stopPropagation();
2489
+ const F = V;
2490
+ C(), F || at(!0);
2491
+ }, className: `strata-control-btn transition-colors focus:outline-none ${ee} ${V ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e($i, { className: J }) }),
2492
+ ut.isMounted && /* @__PURE__ */ e(
2493
+ mn,
2036
2494
  {
2037
- tracks: r.subtitleTracks,
2038
- current: r.currentSubtitle,
2039
- onSelect: (a) => s == null ? void 0 : s.setSubtitle(a),
2040
- onUpload: (a) => s == null ? void 0 : s.addTextTrack(a, a.name),
2041
- onClose: () => Se(!1),
2042
- settings: r.subtitleSettings,
2043
- onSettingsChange: (a) => s == null ? void 0 : s.updateSubtitleSettings(a),
2495
+ tracks: a.subtitleTracks,
2496
+ current: a.currentSubtitle,
2497
+ onSelect: (l) => s == null ? void 0 : s.setSubtitle(l),
2498
+ onUpload: (l) => s == null ? void 0 : s.addTextTrack(l, l.name),
2499
+ onClose: C,
2500
+ settings: a.subtitleSettings,
2501
+ onSettingsChange: (l) => s == null ? void 0 : s.updateSubtitleSettings(l),
2044
2502
  onReset: () => s == null ? void 0 : s.resetSubtitleSettings(),
2045
- offset: r.subtitleOffset,
2046
- onOffsetChange: (a) => s == null ? void 0 : s.setSubtitleOffset(a),
2047
- maxHeight: Ee,
2048
- animationClass: `strata-backdrop ${Fe} ${it.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"}`
2503
+ offset: a.subtitleOffset,
2504
+ onOffsetChange: (l) => s == null ? void 0 : s.setSubtitleOffset(l),
2505
+ maxHeight: Pe,
2506
+ animationClass: `strata-backdrop ${Le} ${ut.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"}`
2049
2507
  }
2050
2508
  )
2051
2509
  ] }, "subtitle");
2052
2510
  case "screenshot":
2053
- return /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2054
- a.stopPropagation(), P(), s == null || s.screenshot();
2055
- }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${_}`, style: { borderRadius: "var(--radius)" }, title: "Screenshot", children: /* @__PURE__ */ e(_i, { className: W }) }, "ss");
2511
+ return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2512
+ l.stopPropagation(), C(), s == null || s.screenshot();
2513
+ }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${ee}`, style: { borderRadius: "var(--radius)" }, title: "Screenshot", children: /* @__PURE__ */ e(Xi, { className: J }) }, "ss");
2056
2514
  case "pip":
2057
- return /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2058
- a.stopPropagation(), P(), s == null || s.togglePip();
2059
- }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${_}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Mi, { className: W }) }, "pip");
2515
+ return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2516
+ l.stopPropagation(), C(), s == null || s.togglePip();
2517
+ }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${ee}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Li, { className: J }) }, "pip");
2060
2518
  case "download":
2061
- return /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2062
- a.stopPropagation(), P(), s == null || s.download();
2063
- }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${_}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(zi, { className: W }) }, "dl");
2519
+ if (c.children) {
2520
+ const l = E === "download-menu", F = l || Ne.isMounted && De.current === "download-menu";
2521
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
2522
+ /* @__PURE__ */ e("button", { onMouseDown: (G) => G.stopPropagation(), onTouchStart: (G) => G.stopPropagation(), onClick: (G) => {
2523
+ G.stopPropagation();
2524
+ const z = l;
2525
+ C(), z || Ve("download-menu");
2526
+ }, className: `strata-control-btn transition-colors hidden sm:block focus:outline-none ${ee} ${l ? "text-[var(--accent)] bg-white/10" : "text-zinc-300 hover:text-white hover:bg-white/10"}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Ze, { className: J }) }),
2527
+ F && /* @__PURE__ */ e(
2528
+ Vt,
2529
+ {
2530
+ items: c.children,
2531
+ onClose: C,
2532
+ maxHeight: Pe,
2533
+ className: `strata-backdrop ${Le} ${Ne.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"}`
2534
+ }
2535
+ )
2536
+ ] }, "dl");
2537
+ }
2538
+ return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2539
+ l.stopPropagation(), C(), s == null || s.download();
2540
+ }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 transition-colors hidden sm:block focus:outline-none ${ee}`, style: { borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e(Ze, { className: J }) }, "dl");
2064
2541
  case "fullscreen":
2065
- return /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2066
- a.stopPropagation(), P(), s == null || s.toggleFullscreen();
2067
- }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 rounded-lg transition-transform focus:outline-none ${_}`, style: { borderRadius: "var(--radius)" }, children: r.isFullscreen || r.isWebFullscreen ? /* @__PURE__ */ e(Ci, { className: W }) : /* @__PURE__ */ e(Si, { className: W }) }, "fs");
2542
+ return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2543
+ l.stopPropagation(), C(), s == null || s.toggleFullscreen();
2544
+ }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 rounded-lg transition-transform focus:outline-none ${ee}`, style: { borderRadius: "var(--radius)" }, children: a.isFullscreen || a.isWebFullscreen ? /* @__PURE__ */ e(Ri, { className: J }) : /* @__PURE__ */ e(Ii, { className: J }) }, "fs");
2068
2545
  case "fullscreenWeb":
2069
- return /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2070
- a.stopPropagation(), P(), s == null || s.toggleWebFullscreen();
2071
- }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 hidden sm:block focus:outline-none ${_} ${r.isWebFullscreen ? "text-[var(--accent)]" : ""}`, style: { borderRadius: "var(--radius)" }, title: "Web Fullscreen", children: /* @__PURE__ */ e(qi, { className: W }) }, "fsw");
2546
+ return /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2547
+ l.stopPropagation(), C(), s == null || s.toggleWebFullscreen();
2548
+ }, className: `strata-control-btn text-zinc-300 hover:text-white hover:bg-white/10 hidden sm:block focus:outline-none ${ee} ${a.isWebFullscreen ? "text-[var(--accent)]" : ""}`, style: { borderRadius: "var(--radius)" }, title: "Web Fullscreen", children: /* @__PURE__ */ e(Ki, { className: J }) }, "fsw");
2072
2549
  case "settings":
2073
2550
  return /* @__PURE__ */ d("div", { className: "relative", children: [
2074
- /* @__PURE__ */ e("button", { onMouseDown: (a) => a.stopPropagation(), onTouchStart: (a) => a.stopPropagation(), onClick: (a) => {
2075
- a.stopPropagation();
2076
- const I = E;
2077
- P(), I || (ie(!0), R("main"));
2078
- }, className: `strata-control-btn transition-all duration-300 focus:outline-none ${_} ${E ? "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(Ni, { className: W }) }),
2079
- tt.isMounted && /* @__PURE__ */ e(De, { onClose: () => ie(!1), align: "right", maxHeight: Ee, className: `strata-backdrop ${Fe} ${tt.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__ */ d("div", { className: "w-full", children: [
2080
- O === "main" && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-left-4 fade-in duration-200", children: [
2551
+ /* @__PURE__ */ e("button", { onMouseDown: (l) => l.stopPropagation(), onTouchStart: (l) => l.stopPropagation(), onClick: (l) => {
2552
+ l.stopPropagation();
2553
+ const F = B;
2554
+ C(), F || (rt(!0), D("main"));
2555
+ }, className: `strata-control-btn transition-all duration-300 focus:outline-none ${ee} ${B ? "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(Pi, { className: J }) }),
2556
+ dt.isMounted && /* @__PURE__ */ e(it, { onClose: C, align: "right", maxHeight: Pe, className: `strata-backdrop ${Le} ${dt.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__ */ d("div", { className: "w-full", children: [
2557
+ X === "main" && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-left-4 fade-in duration-200", children: [
2081
2558
  /* @__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" }) }),
2082
- r.sources.length > 1 && /* @__PURE__ */ d(B, { children: [
2083
- /* @__PURE__ */ e(z, { label: "Source", icon: /* @__PURE__ */ e(Ki, { className: "w-4 h-4" }), value: ((f = r.sources[r.currentSourceIndex]) == null ? void 0 : f.name) || `Source ${r.currentSourceIndex + 1}`, onClick: () => R("sources"), hasSubmenu: !0 }),
2084
- /* @__PURE__ */ e(ee, {})
2559
+ a.sources.length > 1 && /* @__PURE__ */ d(_, { children: [
2560
+ /* @__PURE__ */ e(A, { label: "Source", icon: /* @__PURE__ */ e(en, { className: "w-4 h-4" }), value: ((v = a.sources[a.currentSourceIndex]) == null ? void 0 : v.name) || `Source ${a.currentSourceIndex + 1}`, onClick: () => D("sources"), hasSubmenu: !0 }),
2561
+ /* @__PURE__ */ e(pe, {})
2085
2562
  ] }),
2086
- /* @__PURE__ */ e(z, { label: "Quality", icon: /* @__PURE__ */ e(Yi, { className: "w-4 h-4" }), value: r.currentQuality === -1 ? "Auto" : `${(k = r.qualityLevels[r.currentQuality]) == null ? void 0 : k.height}p`, onClick: () => R("quality"), hasSubmenu: !0 }),
2087
- /* @__PURE__ */ e(z, { label: "Speed", icon: /* @__PURE__ */ e(tn, { className: "w-4 h-4" }), value: `${r.playbackRate}x`, onClick: () => R("speed"), hasSubmenu: !0 }),
2088
- /* @__PURE__ */ e(z, { label: "Audio", icon: /* @__PURE__ */ e(nn, { className: "w-4 h-4" }), value: ((N = r.audioTracks[r.currentAudioTrack]) == null ? void 0 : N.label) || "Default", onClick: () => R("audio"), hasSubmenu: !0 }),
2089
- /* @__PURE__ */ e(ee, {}),
2090
- Bt && /* @__PURE__ */ e(z, { label: "Flip", icon: /* @__PURE__ */ e(sn, { className: "w-4 h-4" }), value: r.flipState.horizontal ? "H" : r.flipState.vertical ? "V" : "Normal", onClick: () => R("flip"), hasSubmenu: !0 }),
2091
- Vt && /* @__PURE__ */ e(z, { label: "Aspect Ratio", icon: /* @__PURE__ */ e(Zi, { className: "w-4 h-4" }), value: r.aspectRatio, onClick: () => R("ratio"), hasSubmenu: !0 }),
2092
- /* @__PURE__ */ e(z, { label: "Audio Boost", icon: /* @__PURE__ */ e(en, { className: "w-4 h-4" }), value: r.audioGain > 1 ? `${r.audioGain}x` : "Off", onClick: () => R("boost"), hasSubmenu: !0 }),
2093
- /* @__PURE__ */ e(ee, {}),
2094
- /* @__PURE__ */ e(z, { label: "Watch Party", icon: /* @__PURE__ */ e(Li, { className: "w-4 h-4" }), onClick: () => R("party"), hasSubmenu: !0 }),
2095
- /* @__PURE__ */ e(z, { label: "Cast to Device", icon: /* @__PURE__ */ e(Pi, { className: "w-4 h-4" }), onClick: () => {
2096
- s == null || s.requestCast(), ie(!1);
2563
+ /* @__PURE__ */ e(A, { label: "Quality", icon: /* @__PURE__ */ e(an, { className: "w-4 h-4" }), value: a.currentQuality === -1 ? "Auto" : `${(S = a.qualityLevels[a.currentQuality]) == null ? void 0 : S.height}p`, onClick: () => D("quality"), hasSubmenu: !0 }),
2564
+ /* @__PURE__ */ e(A, { label: "Speed", icon: /* @__PURE__ */ e(sn, { className: "w-4 h-4" }), value: `${a.playbackRate}x`, onClick: () => D("speed"), hasSubmenu: !0 }),
2565
+ /* @__PURE__ */ e(A, { label: "Audio", icon: /* @__PURE__ */ e(on, { className: "w-4 h-4" }), value: ((M = a.audioTracks[a.currentAudioTrack]) == null ? void 0 : M.label) || "Default", onClick: () => D("audio"), hasSubmenu: !0 }),
2566
+ /* @__PURE__ */ e(pe, {}),
2567
+ b && /* @__PURE__ */ e(A, { label: "Flip", icon: /* @__PURE__ */ e(ln, { className: "w-4 h-4" }), value: a.flipState.horizontal ? "H" : a.flipState.vertical ? "V" : "Normal", onClick: () => D("flip"), hasSubmenu: !0 }),
2568
+ H && /* @__PURE__ */ e(A, { label: "Aspect Ratio", icon: /* @__PURE__ */ e(tn, { className: "w-4 h-4" }), value: a.aspectRatio, onClick: () => D("ratio"), hasSubmenu: !0 }),
2569
+ /* @__PURE__ */ e(A, { label: "Audio Boost", icon: /* @__PURE__ */ e(nn, { className: "w-4 h-4" }), value: a.audioGain > 1 ? `${a.audioGain}x` : "Off", onClick: () => D("boost"), hasSubmenu: !0 }),
2570
+ /* @__PURE__ */ e(pe, {}),
2571
+ /* @__PURE__ */ e(A, { label: "Watch Party", icon: /* @__PURE__ */ e(Bi, { className: "w-4 h-4" }), onClick: () => D("party"), hasSubmenu: !0 }),
2572
+ /* @__PURE__ */ e(A, { label: "Cast to Device", icon: /* @__PURE__ */ e(Ai, { className: "w-4 h-4" }), onClick: () => {
2573
+ s == null || s.requestCast(), C();
2097
2574
  } }),
2098
- p.settings && p.settings.length > 0 && /* @__PURE__ */ e(ee, {}),
2099
- (G = p.settings) == null ? void 0 : G.map((a, I) => a.switch !== void 0 ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
2100
- q,
2575
+ p.settings && p.settings.length > 0 && /* @__PURE__ */ e(pe, {}),
2576
+ (L = p.settings) == null ? void 0 : L.map((l, F) => l.switch !== void 0 ? /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(
2577
+ oe,
2101
2578
  {
2102
- label: a.html,
2103
- icon: a.icon,
2104
- checked: a.switch,
2105
- tooltip: a.tooltip,
2106
- onChange: (U) => {
2107
- a.onSwitch && a.onSwitch(a, U);
2579
+ label: l.html,
2580
+ icon: l.icon,
2581
+ checked: l.switch,
2582
+ tooltip: l.tooltip,
2583
+ onChange: (G) => {
2584
+ l.onSwitch && l.onSwitch(l, G);
2108
2585
  }
2109
2586
  }
2110
- ) }, `cust-${I}`) : /* @__PURE__ */ e(
2111
- z,
2587
+ ) }, `cust-${F}`) : /* @__PURE__ */ e(
2588
+ A,
2112
2589
  {
2113
- label: a.html,
2114
- icon: a.icon,
2115
- value: a.currentLabel || a.value,
2116
- hasSubmenu: !!a.children,
2590
+ label: l.html,
2591
+ icon: l.icon,
2592
+ value: l.currentLabel || l.value,
2593
+ hasSubmenu: !!l.children,
2117
2594
  onClick: () => {
2118
- a.children ? R(`custom-${I}`) : (a.click ? a.click(a) : a.onClick && a.onClick(a), ie(!1));
2595
+ l.children ? D(`custom-${F}`) : (l.click ? l.click(l) : l.onClick && l.onClick(l), C());
2119
2596
  }
2120
2597
  },
2121
- `cust-${I}`
2598
+ `cust-${F}`
2122
2599
  )),
2123
- /* @__PURE__ */ e(ee, {}),
2124
- /* @__PURE__ */ e(z, { label: "Appearance", icon: /* @__PURE__ */ e(At, { className: "w-4 h-4" }), onClick: () => R("appearance"), hasSubmenu: !0 })
2600
+ /* @__PURE__ */ e(pe, {}),
2601
+ /* @__PURE__ */ e(A, { label: "Appearance", icon: /* @__PURE__ */ e(Ut, { className: "w-4 h-4" }), onClick: () => D("appearance"), hasSubmenu: !0 })
2125
2602
  ] }),
2126
- O.startsWith("custom-") && (() => {
2127
- var U;
2128
- const a = parseInt(O.split("-")[1]), I = (U = p.settings) == null ? void 0 : U[a];
2129
- return !I || !I.children ? null : /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
2130
- /* @__PURE__ */ e(H, { label: I.html || "Menu", onBack: () => R("main") }),
2131
- I.children.map((C, Ae) => /* @__PURE__ */ d(ce.Fragment, { children: [
2132
- C.separator && /* @__PURE__ */ e(ee, {}),
2133
- C.switch !== void 0 && /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(q, { label: C.html, checked: C.switch, onChange: (ai) => C.onSwitch && C.onSwitch(C, ai) }) }),
2134
- !C.separator && C.switch === void 0 && /* @__PURE__ */ e(
2135
- z,
2603
+ X.startsWith("custom-") && (() => {
2604
+ var G;
2605
+ const l = parseInt(X.split("-")[1]), F = (G = p.settings) == null ? void 0 : G[l];
2606
+ return !F || !F.children ? null : /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
2607
+ /* @__PURE__ */ e(K, { label: F.html || "Menu", onBack: () => D("main") }),
2608
+ F.children.map((z, Qe) => /* @__PURE__ */ d(ke.Fragment, { children: [
2609
+ z.separator && /* @__PURE__ */ e(pe, {}),
2610
+ z.switch !== void 0 && /* @__PURE__ */ e("div", { className: "px-1", children: /* @__PURE__ */ e(oe, { label: z.html, checked: z.switch, onChange: (pi) => z.onSwitch && z.onSwitch(z, pi) }) }),
2611
+ !z.separator && z.switch === void 0 && /* @__PURE__ */ e(
2612
+ A,
2136
2613
  {
2137
- label: C.html,
2138
- icon: C.icon,
2139
- value: C.value,
2140
- active: C.active,
2614
+ label: z.html,
2615
+ icon: z.icon,
2616
+ value: z.value,
2617
+ active: z.active,
2141
2618
  onClick: () => {
2142
- C.onClick ? C.onClick(C) : C.click && C.click(C), ie(!1);
2619
+ z.onClick ? z.onClick(z) : z.click && z.click(z), C();
2143
2620
  }
2144
2621
  }
2145
2622
  )
2146
- ] }, Ae))
2623
+ ] }, Qe))
2147
2624
  ] });
2148
2625
  })(),
2149
- ["speed", "quality", "audio", "boost", "party", "appearance", "sources", "flip", "ratio"].includes(O) && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
2150
- O === "sources" && /* @__PURE__ */ d(B, { children: [
2151
- /* @__PURE__ */ e(H, { label: "Select Source", onBack: () => R("main") }),
2152
- r.sources.map((a, I) => {
2153
- const U = r.sourceStatuses[I], C = U === "success" ? /* @__PURE__ */ e(on, { className: "w-3.5 h-3.5 text-emerald-500" }) : U === "error" ? /* @__PURE__ */ e(rn, { className: "w-3.5 h-3.5 text-red-500" }) : null;
2626
+ ["speed", "quality", "audio", "boost", "party", "appearance", "sources", "flip", "ratio"].includes(X) && /* @__PURE__ */ d("div", { className: "animate-in slide-in-from-right-4 fade-in duration-200", children: [
2627
+ X === "sources" && /* @__PURE__ */ d(_, { children: [
2628
+ /* @__PURE__ */ e(K, { label: "Select Source", onBack: () => D("main") }),
2629
+ a.sources.map((l, F) => {
2630
+ const G = a.sourceStatuses[F], z = G === "success" ? /* @__PURE__ */ e(rn, { className: "w-3.5 h-3.5 text-emerald-500" }) : G === "error" ? /* @__PURE__ */ e(et, { className: "w-3.5 h-3.5 text-red-500" }) : null;
2154
2631
  return /* @__PURE__ */ e(
2155
- z,
2632
+ A,
2156
2633
  {
2157
- label: a.name || `Source ${I + 1}`,
2158
- value: a.type,
2159
- active: r.currentSourceIndex === I,
2160
- rightIcon: C,
2161
- onClick: () => s == null ? void 0 : s.switchSource(I)
2634
+ label: l.name || `Source ${F + 1}`,
2635
+ value: l.type,
2636
+ active: a.currentSourceIndex === F,
2637
+ rightIcon: z,
2638
+ onClick: () => s == null ? void 0 : s.switchSource(F)
2162
2639
  },
2163
- I
2640
+ F
2164
2641
  );
2165
2642
  })
2166
2643
  ] }),
2167
- O === "speed" && /* @__PURE__ */ d(B, { children: [
2168
- /* @__PURE__ */ e(H, { label: "Speed", onBack: () => R("main") }),
2169
- [0.5, 1, 1.5, 2].map((a) => /* @__PURE__ */ e(z, { label: `${a}x`, active: r.playbackRate === a, onClick: () => s.video.playbackRate = a }, a))
2644
+ X === "speed" && /* @__PURE__ */ d(_, { children: [
2645
+ /* @__PURE__ */ e(K, { label: "Speed", onBack: () => D("main") }),
2646
+ [0.5, 1, 1.5, 2].map((l) => /* @__PURE__ */ e(A, { label: `${l}x`, active: a.playbackRate === l, onClick: () => s.video.playbackRate = l }, l))
2170
2647
  ] }),
2171
- O === "quality" && /* @__PURE__ */ d(B, { children: [
2172
- /* @__PURE__ */ e(H, { label: "Quality", onBack: () => R("main") }),
2173
- /* @__PURE__ */ e(z, { label: "Auto", active: r.currentQuality === -1, onClick: () => s == null ? void 0 : s.setQuality(-1) }),
2174
- r.qualityLevels.map((a) => /* @__PURE__ */ e(z, { label: `${a.height}p`, value: `${Math.round(a.bitrate / 1e3)}k`, active: r.currentQuality === a.index, onClick: () => s == null ? void 0 : s.setQuality(a.index) }, a.index))
2648
+ X === "quality" && /* @__PURE__ */ d(_, { children: [
2649
+ /* @__PURE__ */ e(K, { label: "Quality", onBack: () => D("main") }),
2650
+ /* @__PURE__ */ e(A, { label: "Auto", active: a.currentQuality === -1, onClick: () => s == null ? void 0 : s.setQuality(-1) }),
2651
+ a.qualityLevels.map((l) => /* @__PURE__ */ e(A, { label: `${l.height}p`, value: `${Math.round(l.bitrate / 1e3)}k`, active: a.currentQuality === l.index, onClick: () => s == null ? void 0 : s.setQuality(l.index) }, l.index))
2175
2652
  ] }),
2176
- O === "audio" && /* @__PURE__ */ d(B, { children: [
2177
- /* @__PURE__ */ e(H, { label: "Audio Track", onBack: () => R("main") }),
2178
- r.audioTracks.length === 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 text-zinc-500 text-xs text-center", children: "No tracks available" }),
2179
- r.audioTracks.map((a) => /* @__PURE__ */ e(z, { label: a.label, value: a.language, active: r.currentAudioTrack === a.index, onClick: () => s == null ? void 0 : s.setAudioTrack(a.index) }, a.index))
2653
+ X === "audio" && /* @__PURE__ */ d(_, { children: [
2654
+ /* @__PURE__ */ e(K, { label: "Audio Track", onBack: () => D("main") }),
2655
+ a.audioTracks.length === 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 text-zinc-500 text-xs text-center", children: "No tracks available" }),
2656
+ a.audioTracks.map((l) => /* @__PURE__ */ e(A, { label: l.label, value: l.language, active: a.currentAudioTrack === l.index, onClick: () => s == null ? void 0 : s.setAudioTrack(l.index) }, l.index))
2180
2657
  ] }),
2181
- O === "boost" && /* @__PURE__ */ d(B, { children: [
2182
- /* @__PURE__ */ e(H, { label: "Audio Boost", onBack: () => R("main") }),
2183
- [1, 1.5, 2, 3].map((a) => /* @__PURE__ */ e(z, { label: a === 1 ? "Off" : `${a}x`, active: r.audioGain === a, onClick: () => s == null ? void 0 : s.setAudioGain(a) }, a))
2658
+ X === "boost" && /* @__PURE__ */ d(_, { children: [
2659
+ /* @__PURE__ */ e(K, { label: "Audio Boost", onBack: () => D("main") }),
2660
+ [1, 1.5, 2, 3].map((l) => /* @__PURE__ */ e(A, { label: l === 1 ? "Off" : `${l}x`, active: a.audioGain === l, onClick: () => s == null ? void 0 : s.setAudioGain(l) }, l))
2184
2661
  ] }),
2185
- O === "flip" && /* @__PURE__ */ d(B, { children: [
2186
- /* @__PURE__ */ e(H, { label: "Video Flip", onBack: () => R("main") }),
2662
+ X === "flip" && /* @__PURE__ */ d(_, { children: [
2663
+ /* @__PURE__ */ e(K, { label: "Video Flip", onBack: () => D("main") }),
2187
2664
  /* @__PURE__ */ d("div", { className: "p-2 space-y-1", children: [
2188
- /* @__PURE__ */ e(q, { label: "Horizontal Flip", checked: r.flipState.horizontal, onChange: () => s == null ? void 0 : s.setFlip("horizontal") }),
2189
- /* @__PURE__ */ e(q, { label: "Vertical Flip", checked: r.flipState.vertical, onChange: () => s == null ? void 0 : s.setFlip("vertical") })
2665
+ /* @__PURE__ */ e(oe, { label: "Horizontal Flip", checked: a.flipState.horizontal, onChange: () => s == null ? void 0 : s.setFlip("horizontal") }),
2666
+ /* @__PURE__ */ e(oe, { label: "Vertical Flip", checked: a.flipState.vertical, onChange: () => s == null ? void 0 : s.setFlip("vertical") })
2190
2667
  ] })
2191
2668
  ] }),
2192
- O === "ratio" && /* @__PURE__ */ d(B, { children: [
2193
- /* @__PURE__ */ e(H, { label: "Aspect Ratio", onBack: () => R("main") }),
2194
- ["default", "16:9", "4:3"].map((a) => /* @__PURE__ */ e(z, { label: a === "default" ? "Default" : a, active: r.aspectRatio === a, onClick: () => s == null ? void 0 : s.setAspectRatio(a) }, a))
2669
+ X === "ratio" && /* @__PURE__ */ d(_, { children: [
2670
+ /* @__PURE__ */ e(K, { label: "Aspect Ratio", onBack: () => D("main") }),
2671
+ ["default", "16:9", "4:3"].map((l) => /* @__PURE__ */ e(A, { label: l === "default" ? "Default" : l, active: a.aspectRatio === l, onClick: () => s == null ? void 0 : s.setAspectRatio(l) }, l))
2195
2672
  ] }),
2196
- O === "party" && /* @__PURE__ */ d(B, { children: [
2197
- /* @__PURE__ */ e(H, { label: "Watch Party", onBack: () => R("main") }),
2673
+ X === "party" && /* @__PURE__ */ d(_, { children: [
2674
+ /* @__PURE__ */ e(K, { label: "Watch Party", onBack: () => D("main") }),
2198
2675
  /* @__PURE__ */ d("div", { className: "p-4 space-y-3", children: [
2199
2676
  /* @__PURE__ */ e("p", { className: "text-xs text-zinc-400 leading-relaxed", children: "Create a synchronized room on WatchParty.me to watch together." }),
2200
- /* @__PURE__ */ e("a", { href: `https://www.watchparty.me/create?video=${encodeURIComponent(((Tt = r.sources[r.currentSourceIndex]) == null ? void 0 : Tt.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" })
2677
+ /* @__PURE__ */ e("a", { href: `https://www.watchparty.me/create?video=${encodeURIComponent(((he = a.sources[a.currentSourceIndex]) == null ? void 0 : he.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" })
2201
2678
  ] })
2202
2679
  ] }),
2203
- O === "appearance" && /* @__PURE__ */ d(B, { children: [
2204
- /* @__PURE__ */ e(H, { label: "Appearance", onBack: () => R("main") }),
2680
+ X === "appearance" && /* @__PURE__ */ d(_, { children: [
2681
+ /* @__PURE__ */ e(K, { label: "Appearance", onBack: () => D("main") }),
2205
2682
  /* @__PURE__ */ d("div", { className: "pb-1", children: [
2206
- /* @__PURE__ */ e(te, { title: "Theme", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2 px-3", children: bn.map((a) => /* @__PURE__ */ e("button", { onClick: () => s == null ? void 0 : s.setAppearance({ theme: a.value, themeColor: a.color }), className: `py-2 text-xs font-bold uppercase tracking-wide transition-colors border-[length:var(--border-width)] border-white/10 ${r.theme === a.value ? "bg-[var(--accent)] text-white" : "bg-white/5 text-zinc-400 hover:text-white"}`, style: { borderRadius: "var(--radius)" }, children: a.label }, a.value)) }) }),
2207
- /* @__PURE__ */ e(te, { title: "Icon Size", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-3 gap-1 px-3", children: ["small", "medium", "large"].map((a) => /* @__PURE__ */ e("button", { onClick: () => s == null ? void 0 : s.setAppearance({ iconSize: a }), className: `py-1.5 text-xs font-medium transition-colors ${r.iconSize === a ? "bg-white text-black" : "bg-white/5 text-zinc-400 hover:text-zinc-200"}`, style: { borderRadius: "var(--radius)" }, children: a.charAt(0).toUpperCase() + a.slice(1) }, a)) }) }),
2208
- /* @__PURE__ */ d(te, { title: "Theme Color", children: [
2209
- /* @__PURE__ */ e("div", { className: "grid grid-cols-6 gap-2 px-3", children: fn.map((a) => /* @__PURE__ */ e("button", { title: a.label, onClick: () => s == null ? void 0 : s.setAppearance({ themeColor: a.value }), className: `w-6 h-6 transition-transform hover:scale-110 ${r.themeColor === a.value ? "ring-2 ring-white scale-110" : "ring-1 ring-white/10"}`, style: { backgroundColor: a.value, borderRadius: "var(--radius-full)" }, children: r.themeColor === a.value && /* @__PURE__ */ e(We, { className: "w-3 h-3 text-white mx-auto stroke-[3]" }) }, a.value)) }),
2683
+ /* @__PURE__ */ e(me, { title: "Theme", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2 px-3", children: xn.map((l) => /* @__PURE__ */ e("button", { onClick: () => s == null ? void 0 : s.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)) }) }),
2684
+ /* @__PURE__ */ e(me, { 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: () => s == null ? void 0 : s.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)) }) }),
2685
+ /* @__PURE__ */ d(me, { title: "Theme Color", children: [
2686
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-6 gap-2 px-3", children: vn.map((l) => /* @__PURE__ */ e("button", { title: l.label, onClick: () => s == null ? void 0 : s.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(Be, { className: "w-3 h-3 text-white mx-auto stroke-[3]" }) }, l.value)) }),
2210
2687
  /* @__PURE__ */ e("div", { className: "px-3 pt-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 bg-white/5 p-2 hover:bg-white/10 transition-colors group", style: { borderRadius: "var(--radius)" }, children: [
2211
- /* @__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: r.themeColor, onChange: (a) => s == null ? void 0 : s.setAppearance({ themeColor: a.target.value }), className: "absolute inset-[-4px] w-[150%] h-[150%] cursor-pointer p-0 border-0" }) }),
2688
+ /* @__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) => s == null ? void 0 : s.setAppearance({ themeColor: l.target.value }), className: "absolute inset-[-4px] w-[150%] h-[150%] cursor-pointer p-0 border-0" }) }),
2212
2689
  /* @__PURE__ */ e("span", { className: "text-xs text-zinc-400 font-medium group-hover:text-zinc-200", children: "Custom Color" }),
2213
- /* @__PURE__ */ e("span", { className: "text-[10px] font-mono text-zinc-500 ml-auto uppercase", children: r.themeColor })
2690
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-mono text-zinc-500 ml-auto uppercase", children: a.themeColor })
2214
2691
  ] }) })
2215
2692
  ] })
2216
2693
  ] })
@@ -2221,13 +2698,13 @@ const fn = [
2221
2698
  default:
2222
2699
  return null;
2223
2700
  }
2224
- }, ri = fe(() => {
2701
+ }, ui = xe(() => {
2225
2702
  const c = [
2226
2703
  // Loop (Playback Group)
2227
2704
  { html: "Playback", isLabel: !0 },
2228
2705
  {
2229
2706
  html: "Loop",
2230
- checked: r.isLooping,
2707
+ checked: a.isLooping,
2231
2708
  onClick: () => s == null ? void 0 : s.toggleLoop()
2232
2709
  },
2233
2710
  { separator: !0 },
@@ -2238,15 +2715,15 @@ const fn = [
2238
2715
  { separator: !0 },
2239
2716
  // Aspect Ratio Group
2240
2717
  { html: "Aspect Ratio", isLabel: !0 },
2241
- { html: "Default", checked: r.aspectRatio === "default", onClick: () => s == null ? void 0 : s.setAspectRatio("default") },
2242
- { html: "16:9", checked: r.aspectRatio === "16:9", onClick: () => s == null ? void 0 : s.setAspectRatio("16:9") },
2243
- { html: "4:3", checked: r.aspectRatio === "4:3", onClick: () => s == null ? void 0 : s.setAspectRatio("4:3") },
2718
+ { html: "Default", checked: a.aspectRatio === "default", onClick: () => s == null ? void 0 : s.setAspectRatio("default") },
2719
+ { html: "16:9", checked: a.aspectRatio === "16:9", onClick: () => s == null ? void 0 : s.setAspectRatio("16:9") },
2720
+ { html: "4:3", checked: a.aspectRatio === "4:3", onClick: () => s == null ? void 0 : s.setAspectRatio("4:3") },
2244
2721
  { separator: !0 },
2245
2722
  // Stats
2246
2723
  {
2247
2724
  html: "Video Info",
2248
- icon: /* @__PURE__ */ e(Ji, { className: "w-3.5 h-3.5" }),
2249
- onClick: () => et(!0)
2725
+ icon: /* @__PURE__ */ e(Zi, { className: "w-3.5 h-3.5" }),
2726
+ onClick: () => ct(!0)
2250
2727
  },
2251
2728
  { separator: !0 }
2252
2729
  ];
@@ -2255,34 +2732,34 @@ const fn = [
2255
2732
  disabled: !0
2256
2733
  }), c.push({
2257
2734
  html: "Close",
2258
- onClick: (f) => f(),
2735
+ onClick: (v) => v(),
2259
2736
  // Wrapper handles close
2260
2737
  icon: /* @__PURE__ */ e("div", { className: "text-red-400", children: /* @__PURE__ */ d("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: [
2261
2738
  /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
2262
2739
  /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
2263
2740
  ] }) })
2264
2741
  }), c;
2265
- }, [p.contextmenu, r.aspectRatio, r.isLooping, s]), St = r.isWebFullscreen, Ct = /* @__PURE__ */ d(
2742
+ }, [p.contextmenu, a.aspectRatio, a.isLooping, s]), hi = a.isWebFullscreen, Pt = /* @__PURE__ */ d(
2266
2743
  "div",
2267
2744
  {
2268
2745
  id: p.id,
2269
- ref: V,
2270
- 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 ${St ? "fixed inset-0 z-[2147483647] w-screen h-screen rounded-none" : "relative w-full h-full rounded-[var(--radius)]"} ${p.container || ""}`,
2271
- style: { touchAction: "manipulation", "--accent": r.themeColor, "--accent-contrast": Dt },
2272
- onMouseMove: ft,
2746
+ ref: P,
2747
+ 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 ${hi ? "fixed inset-0 z-[2147483647] w-screen h-screen rounded-none" : "relative w-full h-full rounded-[var(--radius)]"} ${p.container || ""}`,
2748
+ style: { touchAction: "manipulation", "--accent": a.themeColor, "--accent-contrast": Xt },
2749
+ onMouseMove: St,
2273
2750
  onMouseLeave: () => {
2274
- r.isPlaying && !E && !F && !L && s && s.setControlsVisible(!1);
2751
+ a.isPlaying && !B && !V && !E && s && s.setControlsVisible(!1);
2275
2752
  },
2276
- onMouseDown: bt,
2277
- onMouseUp: Le,
2278
- onTouchStart: Xt,
2279
- onTouchMove: Jt,
2280
- onTouchEnd: Kt,
2281
- onContextMenu: ei,
2753
+ onMouseDown: Ct,
2754
+ onMouseUp: qe,
2755
+ onTouchStart: ei,
2756
+ onTouchMove: ti,
2757
+ onTouchEnd: ii,
2758
+ onContextMenu: oi,
2282
2759
  tabIndex: 0,
2283
2760
  role: "region",
2284
2761
  "aria-label": "Video Player",
2285
- "data-theme": r.theme,
2762
+ "data-theme": a.theme,
2286
2763
  children: [
2287
2764
  /* @__PURE__ */ e("style", { children: `
2288
2765
  [data-theme="default"] {
@@ -2378,45 +2855,54 @@ const fn = [
2378
2855
  [data-theme="pixel"] .strata-backdrop { backdrop-filter: none; background: #000; }
2379
2856
  [data-theme="hacker"] .strata-backdrop { backdrop-filter: none; background: #000; }
2380
2857
  ` }),
2381
- r.theme === "hacker" && /* @__PURE__ */ e("div", { className: "strata-scanlines" }),
2382
- !s && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-zinc-950 z-50", children: /* @__PURE__ */ e(He, { className: "w-10 h-10 text-[var(--accent)] animate-spin" }) }),
2383
- s && /* @__PURE__ */ d(B, { children: [
2384
- (Nt = p.layers) == null ? void 0 : Nt.map((c, f) => /* @__PURE__ */ e(
2858
+ a.theme === "hacker" && /* @__PURE__ */ e("div", { className: "strata-scanlines" }),
2859
+ !s && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center bg-zinc-950 z-50", children: /* @__PURE__ */ e(Fe, { className: "w-10 h-10 text-[var(--accent)] animate-spin" }) }),
2860
+ s && /* @__PURE__ */ d(_, { children: [
2861
+ (Lt = p.layers) == null ? void 0 : Lt.map((c, v) => /* @__PURE__ */ e(
2385
2862
  "div",
2386
2863
  {
2387
2864
  className: `absolute inset-0 pointer-events-none z-10 ${c.className || ""}`,
2388
2865
  style: c.style,
2389
- children: /* @__PURE__ */ e(Lt, { content: c.html || "", className: "w-full h-full" })
2866
+ children: /* @__PURE__ */ e(Dt, { content: c.html || "", className: "w-full h-full" })
2390
2867
  },
2391
- f
2868
+ v
2392
2869
  )),
2393
- /* @__PURE__ */ e(an, { notifications: r.notifications }),
2394
- /* @__PURE__ */ e(ln, { cues: r.activeCues, settings: r.subtitleSettings }),
2395
- /* @__PURE__ */ e("div", { className: "absolute inset-0 z-0", onClick: Zt, "aria-hidden": "true" }),
2396
- l && !ye && /* @__PURE__ */ e(
2870
+ /* @__PURE__ */ e(un, { notifications: a.notifications }),
2871
+ /* @__PURE__ */ e(hn, { cues: a.activeCues, settings: a.subtitleSettings }),
2872
+ /* @__PURE__ */ e(
2873
+ "div",
2874
+ {
2875
+ className: "absolute inset-0 z-[1] cursor-pointer",
2876
+ onClick: si,
2877
+ "aria-hidden": "true",
2878
+ role: "button",
2879
+ tabIndex: -1
2880
+ }
2881
+ ),
2882
+ r && !ne && /* @__PURE__ */ e(
2397
2883
  "div",
2398
2884
  {
2399
- className: "absolute inset-0 bg-cover bg-center z-[5] pointer-events-none",
2400
- style: { backgroundImage: `url(${l})` }
2885
+ className: "absolute inset-0 bg-cover bg-center z-[5] pointer-events-none strata-poster",
2886
+ style: { backgroundImage: `url(${r})` }
2401
2887
  }
2402
2888
  ),
2403
- ne.visible && /* @__PURE__ */ e(
2404
- hn,
2889
+ se.visible && /* @__PURE__ */ e(
2890
+ fn,
2405
2891
  {
2406
- x: ne.x,
2407
- y: ne.y,
2408
- items: ri,
2409
- onClose: () => Ce({ ...ne, visible: !1 }),
2410
- containerWidth: jt,
2411
- containerHeight: qe
2892
+ x: se.x,
2893
+ y: se.y,
2894
+ items: ui,
2895
+ onClose: C,
2896
+ containerWidth: nt,
2897
+ containerHeight: ce
2412
2898
  }
2413
2899
  ),
2414
- _t && s && /* @__PURE__ */ e(pn, { player: s, onClose: () => et(!1) }),
2415
- ze && /* @__PURE__ */ d("div", { className: "absolute top-8 left-1/2 -translate-x-1/2 bg-black/50 backdrop-blur-md px-4 py-2 rounded-full flex items-center gap-2 z-40 animate-in fade-in zoom-in duration-200", children: [
2416
- /* @__PURE__ */ e(Qi, { className: "w-4 h-4 text-[var(--accent)] fill-current" }),
2900
+ Qt && s && /* @__PURE__ */ e(bn, { player: s, onClose: () => ct(!1) }),
2901
+ je && /* @__PURE__ */ d("div", { className: "absolute top-8 left-1/2 -translate-x-1/2 bg-black/50 backdrop-blur-md px-4 py-2 rounded-full flex items-center gap-2 z-40 animate-in fade-in zoom-in duration-200 pointer-events-none", children: [
2902
+ /* @__PURE__ */ e(Yi, { className: "w-4 h-4 text-[var(--accent)] fill-current" }),
2417
2903
  /* @__PURE__ */ e("span", { className: "text-xs font-bold tracking-wider", children: "2x Speed" })
2418
2904
  ] }),
2419
- Q && Je && r.controlsVisible && /* @__PURE__ */ e(
2905
+ Y && st && a.controlsVisible && /* @__PURE__ */ e(
2420
2906
  "button",
2421
2907
  {
2422
2908
  onMouseDown: (c) => c.stopPropagation(),
@@ -2424,81 +2910,81 @@ const fn = [
2424
2910
  onClick: (c) => {
2425
2911
  c.stopPropagation(), s.toggleLock();
2426
2912
  },
2427
- 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 ${r.isLocked ? "text-[var(--accent)] bg-white/10" : "hover:bg-white/10"}`,
2428
- children: r.isLocked ? /* @__PURE__ */ e(Gi, { className: "w-5 h-5" }) : /* @__PURE__ */ e(Ui, { className: "w-5 h-5" })
2913
+ 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"}`,
2914
+ children: a.isLocked ? /* @__PURE__ */ e(Qi, { className: "w-5 h-5" }) : /* @__PURE__ */ e(Ji, { className: "w-5 h-5" })
2429
2915
  }
2430
2916
  ),
2431
- Y && /* @__PURE__ */ e(
2917
+ de && /* @__PURE__ */ e(
2432
2918
  "div",
2433
2919
  {
2434
- 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 ${Y.type === "rewind" ? "left-0 rounded-r-[4rem]" : "right-0 rounded-l-[4rem]"}`,
2435
- onAnimationEnd: () => pe(null),
2920
+ 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 ${de.type === "rewind" ? "left-0 rounded-r-[4rem]" : "right-0 rounded-l-[4rem]"}`,
2921
+ onAnimationEnd: () => Ie(null),
2436
2922
  children: /* @__PURE__ */ d("div", { className: "flex flex-col items-center text-white drop-shadow-lg", children: [
2437
- Y.type === "rewind" ? /* @__PURE__ */ e(Rt, { className: "w-12 h-12 animate-pulse" }) : /* @__PURE__ */ e(Pt, { className: "w-12 h-12 animate-pulse" }),
2438
- /* @__PURE__ */ e("span", { className: "font-bold text-sm mt-2 font-mono", children: Y.type === "rewind" ? "-10s" : "+10s" })
2923
+ de.type === "rewind" ? /* @__PURE__ */ e(At, { className: "w-12 h-12 animate-pulse" }) : /* @__PURE__ */ e(Bt, { className: "w-12 h-12 animate-pulse" }),
2924
+ /* @__PURE__ */ e("span", { className: "font-bold text-sm mt-2 font-mono", children: de.type === "rewind" ? "-10s" : "+10s" })
2439
2925
  ] })
2440
2926
  },
2441
- Y.id
2927
+ de.id
2442
2928
  ),
2443
- r.isBuffering && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ e(He, { className: "w-12 h-12 text-[var(--accent)] animate-spin drop-shadow-lg" }) }),
2444
- r.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__ */ d("div", { className: "flex flex-col items-center gap-4 text-red-500 p-8 max-w-md text-center", children: [
2929
+ a.isBuffering && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center z-20 pointer-events-none", children: /* @__PURE__ */ e(Fe, { className: "w-12 h-12 text-[var(--accent)] animate-spin drop-shadow-lg" }) }),
2930
+ 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__ */ d("div", { className: "flex flex-col items-center gap-4 text-red-500 p-8 max-w-md text-center", children: [
2445
2931
  /* @__PURE__ */ e("span", { className: "text-5xl mb-2", children: "⚠️" }),
2446
2932
  /* @__PURE__ */ e("h3", { className: "text-xl font-bold text-white", children: "Playback Error" }),
2447
- /* @__PURE__ */ e("p", { className: "text-zinc-400 text-sm", children: r.error }),
2448
- /* @__PURE__ */ e("button", { onClick: () => s.load(s.store.get().sources[s.store.get().currentSourceIndex] || { url: t || "", type: n || "auto" }, v), 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" })
2933
+ /* @__PURE__ */ e("p", { className: "text-zinc-400 text-sm", children: a.error }),
2934
+ /* @__PURE__ */ e("button", { onClick: () => s.load(s.store.get().sources[s.store.get().currentSourceIndex] || { url: t || "", type: i || "auto" }, f), 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" })
2449
2935
  ] }) }),
2450
- Ht && !r.isLocked && (!r.isPlaying && !r.isBuffering && !r.error || r.controlsVisible) && !r.isBuffering ? /* @__PURE__ */ e(
2936
+ j && !a.isLocked && (!a.isPlaying && !a.isBuffering && !a.error || a.controlsVisible) && !a.isBuffering ? /* @__PURE__ */ e(
2451
2937
  "div",
2452
2938
  {
2453
- className: `absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300 pointer-events-none ${r.controlsVisible || !r.isPlaying ? "opacity-100" : "opacity-0"}`,
2939
+ 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"}`,
2454
2940
  children: /* @__PURE__ */ d("div", { className: "flex items-center gap-8 md:gap-16 pointer-events-auto", children: [
2455
2941
  /* @__PURE__ */ e("button", { onMouseDown: (c) => c.stopPropagation(), onTouchStart: (c) => c.stopPropagation(), onClick: (c) => {
2456
- c.stopPropagation(), P(), me("rewind");
2457
- }, 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 ${Z.skipBtn}`, children: /* @__PURE__ */ e(Rt, { className: Z.skipIcon }) }),
2942
+ c.stopPropagation(), C(), Re("rewind");
2943
+ }, 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 ${ue.skipBtn}`, children: /* @__PURE__ */ e(At, { className: ue.skipIcon }) }),
2458
2944
  /* @__PURE__ */ e("button", { onMouseDown: (c) => c.stopPropagation(), onTouchStart: (c) => c.stopPropagation(), onClick: (c) => {
2459
- c.stopPropagation(), P(), s.togglePlay();
2460
- }, 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 ${Z.playBtn}`, children: r.isPlaying ? /* @__PURE__ */ e(It, { className: `${Z.playIcon} text-white fill-current` }) : /* @__PURE__ */ e(zt, { className: `${Z.playIcon} text-white ml-1 fill-current` }) }),
2945
+ c.stopPropagation(), C(), s.togglePlay();
2946
+ }, 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 ${ue.playBtn}`, children: a.isPlaying ? /* @__PURE__ */ e(Ft, { className: `${ue.playIcon} text-white fill-current` }) : /* @__PURE__ */ e(Et, { className: `${ue.playIcon} text-white ml-1 fill-current` }) }),
2461
2947
  /* @__PURE__ */ e("button", { onMouseDown: (c) => c.stopPropagation(), onTouchStart: (c) => c.stopPropagation(), onClick: (c) => {
2462
- c.stopPropagation(), P(), me("forward");
2463
- }, 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 ${Z.skipBtn}`, children: /* @__PURE__ */ e(Pt, { className: Z.skipIcon }) })
2948
+ c.stopPropagation(), C(), Re("forward");
2949
+ }, 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 ${ue.skipBtn}`, children: /* @__PURE__ */ e(Bt, { className: ue.skipIcon }) })
2464
2950
  ] })
2465
2951
  }
2466
2952
  ) : null,
2467
2953
  /* @__PURE__ */ d(
2468
2954
  "div",
2469
2955
  {
2470
- 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 ${oi ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4 pointer-events-none"}`,
2956
+ 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 ${di ? "opacity-100 translate-y-0" : "opacity-0 translate-y-4 pointer-events-none"}`,
2471
2957
  onClick: (c) => {
2472
- (E || F || L) && P(), c.target === c.currentTarget && he(!1), c.stopPropagation();
2958
+ (B || V || E) && C(), c.target === c.currentTarget && ze(!1), c.stopPropagation();
2473
2959
  },
2474
2960
  children: [
2475
2961
  !p.isLive && /* @__PURE__ */ d(
2476
2962
  "div",
2477
2963
  {
2478
- ref: Re,
2964
+ ref: Ge,
2479
2965
  className: "relative w-full h-3 group/slider mb-3 cursor-pointer touch-none flex items-center",
2480
- onMouseMove: Yt,
2966
+ onMouseMove: ni,
2481
2967
  onMouseLeave: () => {
2482
- ct(null), dt(null);
2968
+ gt(null), vt(null);
2483
2969
  },
2484
- onMouseDown: gt,
2485
- onTouchStart: gt,
2970
+ onMouseDown: Nt,
2971
+ onTouchStart: Nt,
2486
2972
  children: [
2487
- (Mt = p.highlight) == null ? void 0 : Mt.map((c, f) => /* @__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: `${c.time / r.duration * 100}%` }, title: c.text }, f)),
2488
- lt !== null && /* @__PURE__ */ d("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, ${qt}%, calc(100% - 70px))` }, children: [
2489
- J && /* @__PURE__ */ e("div", { className: "bg-black/90 border border-white/10 shadow-2xl overflow-hidden backdrop-blur-sm", style: { width: `${J.w * 0.5}px`, height: `${J.h * 0.5}px`, borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e("div", { style: { backgroundImage: `url("${J.url}")`, width: `${J.w}px`, height: `${J.h}px`, backgroundPosition: `-${J.x}px -${J.y}px`, backgroundRepeat: "no-repeat", transform: "scale(0.5)", transformOrigin: "top left" } }) }),
2490
- /* @__PURE__ */ e("div", { className: "strata-tooltip px-2 py-0.5 text-[11px] font-bold font-mono shadow-lg tabular-nums mt-1", children: Be(lt) })
2973
+ ($t = p.highlight) == null ? void 0 : $t.map((c, v) => /* @__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: `${c.time / a.duration * 100}%` }, title: c.text }, v)),
2974
+ bt !== null && /* @__PURE__ */ d("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, ${Yt}%, calc(100% - 70px))` }, children: [
2975
+ re && /* @__PURE__ */ e("div", { className: "bg-black/90 border border-white/10 shadow-2xl overflow-hidden backdrop-blur-sm", style: { width: `${re.w * 0.5}px`, height: `${re.h * 0.5}px`, borderRadius: "var(--radius)" }, children: /* @__PURE__ */ e("div", { style: { backgroundImage: `url("${re.url}")`, width: `${re.w}px`, height: `${re.h}px`, backgroundPosition: `-${re.x}px -${re.y}px`, backgroundRepeat: "no-repeat", transform: "scale(0.5)", transformOrigin: "top left" } }) }),
2976
+ /* @__PURE__ */ e("div", { className: "strata-tooltip px-2 py-0.5 text-[11px] font-bold font-mono shadow-lg tabular-nums mt-1", children: Je(bt) })
2491
2977
  ] }),
2492
2978
  /* @__PURE__ */ d("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: [
2493
- r.duration > 0 && r.buffered.map((c, f) => /* @__PURE__ */ e("div", { className: "absolute top-0 bottom-0 bg-white/20", style: { left: `${c.start / r.duration * 100}%`, width: `${(c.end - c.start) / r.duration * 100}%` } }, f)),
2494
- /* @__PURE__ */ e("div", { className: "absolute left-0 top-0 bottom-0 bg-[var(--accent)]", style: { width: `${(Ne ? ue : r.currentTime) / r.duration * 100}%` } })
2979
+ a.duration > 0 && a.buffered.map((c, v) => /* @__PURE__ */ e("div", { className: "absolute top-0 bottom-0 bg-white/20", style: { left: `${c.start / a.duration * 100}%`, width: `${(c.end - c.start) / a.duration * 100}%` } }, v)),
2980
+ /* @__PURE__ */ e("div", { className: "absolute left-0 top-0 bottom-0 bg-[var(--accent)]", style: { width: `${(Oe ? Te : a.currentTime) / a.duration * 100}%` } })
2495
2981
  ] }),
2496
2982
  /* @__PURE__ */ e(
2497
2983
  "div",
2498
2984
  {
2499
2985
  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",
2500
2986
  style: {
2501
- left: `${(Ne ? ue : r.currentTime) / r.duration * 100}%`,
2987
+ left: `${(Oe ? Te : a.currentTime) / a.duration * 100}%`,
2502
2988
  borderRadius: "var(--radius-full)"
2503
2989
  }
2504
2990
  }
@@ -2507,8 +2993,8 @@ const fn = [
2507
2993
  }
2508
2994
  ),
2509
2995
  /* @__PURE__ */ d("div", { className: "flex items-center justify-between pointer-events-auto", children: [
2510
- /* @__PURE__ */ e("div", { className: "flex items-center gap-3", children: yt.filter((c) => c.position === "left" || c.position === "center").map(kt) }),
2511
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: yt.filter((c) => c.position === "right").map(kt) })
2996
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-3", children: It.filter((c) => c.position === "left" || c.position === "center").map(Rt) }),
2997
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-1", children: It.filter((c) => c.position === "right").map(Rt) })
2512
2998
  ] })
2513
2999
  ]
2514
3000
  }
@@ -2517,21 +3003,21 @@ const fn = [
2517
3003
  ]
2518
3004
  }
2519
3005
  );
2520
- return St && typeof document < "u" ? hi(Ct, document.body) : Ct;
2521
- }, Cn = (i, t) => {
2522
- const n = ui(i);
2523
- return n.render(ce.createElement($t, t)), {
3006
+ return a.isWebFullscreen && typeof document < "u" ? vi(Pt, document.body) : Pt;
3007
+ }, Tn = (n, t) => {
3008
+ const i = gi(n);
3009
+ return i.render(ke.createElement(Ot, t)), {
2524
3010
  unmount: () => {
2525
- n.unmount();
3011
+ i.unmount();
2526
3012
  },
2527
3013
  update: (o) => {
2528
- n.render(ce.createElement($t, { ...t, ...o }));
3014
+ i.render(ke.createElement(Ot, { ...t, ...o }));
2529
3015
  }
2530
3016
  };
2531
3017
  };
2532
3018
  export {
2533
- xi as StrataCore,
2534
- $t as StrataPlayer,
2535
- Cn as mountStrataPlayer
3019
+ Ni as StrataCore,
3020
+ Ot as StrataPlayer,
3021
+ Tn as mountStrataPlayer
2536
3022
  };
2537
3023
  //# sourceMappingURL=strataplayer.es.js.map