@geekapps/silo-elements-nextjs 0.2.40 → 0.2.41

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.
@@ -236,7 +236,9 @@ function Video({
236
236
  setActiveCue(null);
237
237
  return;
238
238
  }
239
- const track = Array.from(video.textTracks).find((t) => t.language === mode && t.kind !== "metadata");
239
+ const track = Array.from(video.textTracks).find(
240
+ (t) => t.language === mode && t.kind !== "metadata"
241
+ );
240
242
  if (!track || !track.activeCues || track.activeCues.length === 0) {
241
243
  setActiveCue(null);
242
244
  return;
@@ -255,26 +257,48 @@ function Video({
255
257
  video.textTracks.addEventListener("addtrack", bindTracks);
256
258
  return () => {
257
259
  video.textTracks.removeEventListener("addtrack", bindTracks);
258
- Array.from(video.textTracks).forEach((t) => t.removeEventListener("cuechange", onCueChange));
260
+ Array.from(video.textTracks).forEach(
261
+ (t) => t.removeEventListener("cuechange", onCueChange)
262
+ );
259
263
  };
260
264
  }, []);
261
265
  useEffect(() => {
262
266
  const video = videoRef.current;
263
267
  const onFullscreenChange = () => {
264
268
  const doc = document;
265
- const nativeFullscreen = Boolean(document.fullscreenElement || doc.webkitFullscreenElement);
269
+ const nativeFullscreen = Boolean(
270
+ document.fullscreenElement || doc.webkitFullscreenElement
271
+ );
266
272
  const iosVideoFullscreen = Boolean(video?.webkitDisplayingFullscreen);
267
273
  setIsFullscreen(nativeFullscreen || iosVideoFullscreen);
268
274
  };
269
275
  document.addEventListener("fullscreenchange", onFullscreenChange);
270
- document.addEventListener("webkitfullscreenchange", onFullscreenChange);
271
- video?.addEventListener("webkitbeginfullscreen", onFullscreenChange);
272
- video?.addEventListener("webkitendfullscreen", onFullscreenChange);
276
+ document.addEventListener(
277
+ "webkitfullscreenchange",
278
+ onFullscreenChange
279
+ );
280
+ video?.addEventListener(
281
+ "webkitbeginfullscreen",
282
+ onFullscreenChange
283
+ );
284
+ video?.addEventListener(
285
+ "webkitendfullscreen",
286
+ onFullscreenChange
287
+ );
273
288
  return () => {
274
289
  document.removeEventListener("fullscreenchange", onFullscreenChange);
275
- document.removeEventListener("webkitfullscreenchange", onFullscreenChange);
276
- video?.removeEventListener("webkitbeginfullscreen", onFullscreenChange);
277
- video?.removeEventListener("webkitendfullscreen", onFullscreenChange);
290
+ document.removeEventListener(
291
+ "webkitfullscreenchange",
292
+ onFullscreenChange
293
+ );
294
+ video?.removeEventListener(
295
+ "webkitbeginfullscreen",
296
+ onFullscreenChange
297
+ );
298
+ video?.removeEventListener(
299
+ "webkitendfullscreen",
300
+ onFullscreenChange
301
+ );
278
302
  };
279
303
  }, []);
280
304
  useEffect(() => {
@@ -434,10 +458,12 @@ function Video({
434
458
  ]);
435
459
  const tracks = hls.audioTracks ?? [];
436
460
  if (tracks.length > 1) {
437
- setAudioTracks(tracks.map((t, i) => ({
438
- id: i,
439
- label: t.name ?? t.lang ?? `Track ${i + 1}`
440
- })));
461
+ setAudioTracks(
462
+ tracks.map((t, i) => ({
463
+ id: i,
464
+ label: t.name ?? t.lang ?? `Track ${i + 1}`
465
+ }))
466
+ );
441
467
  setSelectedAudio(hls.audioTrack ?? 0);
442
468
  }
443
469
  setIsLoading(false);
@@ -445,10 +471,12 @@ function Video({
445
471
  hls.on(Hls.Events.AUDIO_TRACKS_UPDATED, (_, data) => {
446
472
  const tracks = data.audioTracks ?? [];
447
473
  if (tracks.length > 1) {
448
- setAudioTracks(tracks.map((t, i) => ({
449
- id: i,
450
- label: t.name ?? t.lang ?? `Track ${i + 1}`
451
- })));
474
+ setAudioTracks(
475
+ tracks.map((t, i) => ({
476
+ id: i,
477
+ label: t.name ?? t.lang ?? `Track ${i + 1}`
478
+ }))
479
+ );
452
480
  }
453
481
  });
454
482
  hls.on(Hls.Events.ERROR, (_, data) => {
@@ -501,9 +529,13 @@ function Video({
501
529
  } else {
502
530
  video.pause();
503
531
  }
504
- if (clickIconTimerRef.current) window.clearTimeout(clickIconTimerRef.current);
532
+ if (clickIconTimerRef.current)
533
+ window.clearTimeout(clickIconTimerRef.current);
505
534
  setClickIcon(wasPaused ? "play" : "pause");
506
- clickIconTimerRef.current = window.setTimeout(() => setClickIcon(null), 600);
535
+ clickIconTimerRef.current = window.setTimeout(
536
+ () => setClickIcon(null),
537
+ 600
538
+ );
507
539
  } catch {
508
540
  setError("O navegador bloqueou a reprodu\xE7\xE3o autom\xE1tica.");
509
541
  }
@@ -522,7 +554,9 @@ function Video({
522
554
  const doc = document;
523
555
  if (!player && !video) return;
524
556
  try {
525
- const nativeFullscreen = Boolean(document.fullscreenElement || doc.webkitFullscreenElement);
557
+ const nativeFullscreen = Boolean(
558
+ document.fullscreenElement || doc.webkitFullscreenElement
559
+ );
526
560
  const iosVideoFullscreen = Boolean(video?.webkitDisplayingFullscreen);
527
561
  if (nativeFullscreen || iosVideoFullscreen) {
528
562
  if (document.fullscreenElement && document.exitFullscreen) {
@@ -637,7 +671,11 @@ function Video({
637
671
  setPreview(null);
638
672
  return;
639
673
  }
640
- setPreview({ cue, time, left: Math.max(80, Math.min(x, rect.width - 80)) });
674
+ setPreview({
675
+ cue,
676
+ time,
677
+ left: Math.max(80, Math.min(x, rect.width - 80))
678
+ });
641
679
  },
642
680
  [duration, storyboardCues]
643
681
  );
@@ -701,8 +739,7 @@ function Video({
701
739
  );
702
740
  if (!activeSource) {
703
741
  return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700", children: [
704
- "O componente Video precisa de pelo menos um",
705
- " ",
742
+ "O componente Video precisa de pelo menos um ",
706
743
  /* @__PURE__ */ jsx("code", { children: "<Source />" }),
707
744
  "."
708
745
  ] });
@@ -725,7 +762,12 @@ function Video({
725
762
  }
726
763
  },
727
764
  className: "relative w-full overflow-hidden rounded-[14px] bg-black shadow-[0_30px_90px_rgba(15,15,15,0.22)] outline-none ring-1 ring-black/5",
728
- style: fixedHeight ? { height: typeof fixedHeight === "number" ? `${fixedHeight}px` : fixedHeight } : maxHeight ? { maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight, aspectRatio: "16/9" } : { aspectRatio: "16/9" },
765
+ style: fixedHeight ? {
766
+ height: typeof fixedHeight === "number" ? `${fixedHeight}px` : fixedHeight
767
+ } : maxHeight ? {
768
+ maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight,
769
+ aspectRatio: "16/9"
770
+ } : { aspectRatio: "16/9" },
729
771
  children: [
730
772
  /* @__PURE__ */ jsxs(
731
773
  "video",
@@ -770,8 +812,17 @@ function Video({
770
812
  "div",
771
813
  {
772
814
  className: "pointer-events-none absolute inset-0 z-10 grid place-items-center",
773
- style: { opacity: clickIcon ? 1 : 0, transition: clickIcon ? "opacity 0.08s ease-in" : "opacity 0.45s ease-out" },
774
- children: /* @__PURE__ */ jsx("span", { className: "grid size-10 place-items-center text-white drop-shadow-[0_2px_12px_rgba(0,0,0,0.8)] @sm:size-14 @lg:size-16", children: clickIcon === "pause" ? /* @__PURE__ */ jsx(Pause, { className: "size-5 @sm:size-7 @lg:size-8" }) : /* @__PURE__ */ jsx(Play, { className: "ml-0.5 size-5 @sm:size-7 @lg:size-8" }) })
815
+ style: {
816
+ opacity: clickIcon ? 1 : 0,
817
+ transition: clickIcon ? "opacity 0.08s ease-in" : "opacity 0.45s ease-out"
818
+ },
819
+ children: /* @__PURE__ */ jsx("span", { className: "grid size-10 place-items-center text-white drop-shadow-[0_2px_12px_rgba(0,0,0,0.8)] @sm:size-14 @lg:size-16", children: clickIcon === "pause" ? /* @__PURE__ */ jsx(Pause, { className: "size-5 @sm:size-7 @lg:size-8", fill: "white" }) : /* @__PURE__ */ jsx(
820
+ Play,
821
+ {
822
+ className: "ml-0.5 size-5 @sm:size-7 @lg:size-8",
823
+ fill: "white"
824
+ }
825
+ ) })
775
826
  }
776
827
  ),
777
828
  isLoading && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 z-20 grid place-items-center bg-black/10", children: /* @__PURE__ */ jsx("div", { className: "size-9 animate-spin rounded-full border-2 border-white/25 border-t-white" }) }),
@@ -785,358 +836,667 @@ function Video({
785
836
  children: [
786
837
  isFullscreen && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 top-0 h-32 bg-linear-to-b from-black/70 to-transparent" }),
787
838
  /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-linear-to-t from-black/80 to-transparent" }),
788
- isFullscreen && /* @__PURE__ */ jsx("header", { onClick: (e) => e.stopPropagation(), className: "relative z-10 flex items-start px-4 pt-4 text-white @sm:px-7 @sm:pt-7 @lg:px-9 @lg:pt-8", children: /* @__PURE__ */ jsxs("div", { children: [
789
- title && /* @__PURE__ */ jsx("h1", { className: "text-sm font-bold tracking-wide @sm:text-base @md:text-lg @lg:text-xl", style: { textShadow: "0 1px 6px rgba(0,0,0,0.6)" }, children: title }),
790
- description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs font-medium text-white/85 @sm:text-sm", children: description })
791
- ] }) }),
792
- /* @__PURE__ */ jsxs("footer", { onClick: (e) => e.stopPropagation(), className: "relative z-10 px-4 pb-4 text-white", children: [
793
- settingsOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
794
- /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-70", onClick: () => setSettingsOpen(false) }),
795
- /* @__PURE__ */ jsxs("div", { className: "absolute bottom-full right-2 z-70 mb-2 overflow-hidden rounded-2xl bg-[#1c1c1e]/95 shadow-2xl backdrop-blur-xl ring-1 ring-white/10", style: { width: Math.min(224, Math.max(180, (playerWidth || 640) * 0.22)) + "px", animation: "spFadeIn 0.15s ease" }, children: [
796
- settingsTab === "root" && /* @__PURE__ */ jsx("div", { children: [
797
- { id: "quality", label: "Qualidade", value: qualities.find((q) => q.id === selectedQuality)?.label ?? "Auto" },
798
- ...parsed.subtitles.length > 0 ? [{ id: "subtitles", label: "Legendas", value: subtitleStyle.track === "off" ? "Desligado" : parsed.subtitles.find((s) => s.srclang === subtitleStyle.track)?.label ?? subtitleStyle.track }] : [],
799
- ...audioTracks.length > 1 ? [{ id: "audio", label: "\xC1udio", value: audioTracks.find((t) => t.id === selectedAudio)?.label ?? "" }] : [],
800
- { id: "playback", label: "Velocidade", value: playbackRate === 1 ? "Normal" : `${playbackRate}\xD7` }
801
- ].map((item) => /* @__PURE__ */ jsxs(
802
- "button",
839
+ isFullscreen && /* @__PURE__ */ jsx(
840
+ "header",
841
+ {
842
+ onClick: (e) => e.stopPropagation(),
843
+ className: "relative z-10 flex items-start px-4 pt-4 text-white @sm:px-7 @sm:pt-7 @lg:px-9 @lg:pt-8",
844
+ children: /* @__PURE__ */ jsxs("div", { children: [
845
+ title && /* @__PURE__ */ jsx(
846
+ "h1",
803
847
  {
804
- type: "button",
805
- onClick: () => setSettingsTab(item.id),
806
- className: "flex w-full items-center justify-between gap-3 px-4 py-3 text-sm transition hover:bg-white/8 first:pt-3.5 last:pb-3.5",
807
- children: [
808
- /* @__PURE__ */ jsx("span", { className: "text-white/80", children: item.label }),
809
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs text-white/40", children: [
810
- item.value,
811
- /* @__PURE__ */ jsx("svg", { className: "size-3 opacity-50", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M4.5 3l3 3-3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
812
- ] })
813
- ]
814
- },
815
- item.id
816
- )) }),
817
- settingsTab === "quality" && /* @__PURE__ */ jsxs("div", { children: [
818
- /* @__PURE__ */ jsxs(
819
- "button",
848
+ className: "text-sm font-bold tracking-wide @sm:text-base @md:text-lg @lg:text-xl",
849
+ style: { textShadow: "0 1px 6px rgba(0,0,0,0.6)" },
850
+ children: title
851
+ }
852
+ ),
853
+ description && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs font-medium text-white/85 @sm:text-sm", children: description })
854
+ ] })
855
+ }
856
+ ),
857
+ /* @__PURE__ */ jsxs(
858
+ "footer",
859
+ {
860
+ onClick: (e) => e.stopPropagation(),
861
+ className: "relative z-10 px-4 pb-4 text-white",
862
+ children: [
863
+ settingsOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
864
+ /* @__PURE__ */ jsx(
865
+ "div",
820
866
  {
821
- type: "button",
822
- onClick: () => setSettingsTab("root"),
823
- className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
824
- children: [
825
- /* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
826
- "Qualidade"
827
- ]
867
+ className: "fixed inset-0 z-70",
868
+ onClick: () => setSettingsOpen(false)
828
869
  }
829
870
  ),
830
- /* @__PURE__ */ jsx("div", { className: "py-1.5", children: [...qualities].reverse().map((quality) => /* @__PURE__ */ jsxs(
831
- "button",
871
+ /* @__PURE__ */ jsxs(
872
+ "div",
832
873
  {
833
- type: "button",
834
- onClick: () => {
835
- changeQuality(quality.id);
836
- setSettingsTab("root");
874
+ className: "absolute bottom-full right-2 z-70 mb-2 overflow-hidden rounded-2xl bg-[#1c1c1e]/95 shadow-2xl backdrop-blur-xl ring-1 ring-white/10",
875
+ style: {
876
+ width: Math.min(
877
+ 224,
878
+ Math.max(180, (playerWidth || 640) * 0.22)
879
+ ) + "px",
880
+ animation: "spFadeIn 0.15s ease"
837
881
  },
838
- className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
839
882
  children: [
840
- /* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0${selectedQuality === quality.id ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
841
- /* @__PURE__ */ jsxs("span", { className: selectedQuality === quality.id ? "font-semibold text-white" : "text-white/55", children: [
842
- quality.label,
843
- quality.id === "auto" ? " (ABR)" : ""
883
+ settingsTab === "root" && /* @__PURE__ */ jsx("div", { children: [
884
+ {
885
+ id: "quality",
886
+ label: "Qualidade",
887
+ value: qualities.find((q) => q.id === selectedQuality)?.label ?? "Auto"
888
+ },
889
+ ...parsed.subtitles.length > 0 ? [
890
+ {
891
+ id: "subtitles",
892
+ label: "Legendas",
893
+ value: subtitleStyle.track === "off" ? "Desligado" : parsed.subtitles.find(
894
+ (s) => s.srclang === subtitleStyle.track
895
+ )?.label ?? subtitleStyle.track
896
+ }
897
+ ] : [],
898
+ ...audioTracks.length > 1 ? [
899
+ {
900
+ id: "audio",
901
+ label: "\xC1udio",
902
+ value: audioTracks.find(
903
+ (t) => t.id === selectedAudio
904
+ )?.label ?? ""
905
+ }
906
+ ] : [],
907
+ {
908
+ id: "playback",
909
+ label: "Velocidade",
910
+ value: playbackRate === 1 ? "Normal" : `${playbackRate}\xD7`
911
+ }
912
+ ].map((item) => /* @__PURE__ */ jsxs(
913
+ "button",
914
+ {
915
+ type: "button",
916
+ onClick: () => setSettingsTab(item.id),
917
+ className: "flex w-full items-center justify-between gap-3 px-4 py-3 text-sm transition hover:bg-white/8 first:pt-3.5 last:pb-3.5",
918
+ children: [
919
+ /* @__PURE__ */ jsx("span", { className: "text-white/80", children: item.label }),
920
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs text-white/40", children: [
921
+ item.value,
922
+ /* @__PURE__ */ jsx(
923
+ "svg",
924
+ {
925
+ className: "size-3 opacity-50",
926
+ viewBox: "0 0 12 12",
927
+ fill: "none",
928
+ children: /* @__PURE__ */ jsx(
929
+ "path",
930
+ {
931
+ d: "M4.5 3l3 3-3 3",
932
+ stroke: "currentColor",
933
+ strokeWidth: "1.5",
934
+ strokeLinecap: "round",
935
+ strokeLinejoin: "round"
936
+ }
937
+ )
938
+ }
939
+ )
940
+ ] })
941
+ ]
942
+ },
943
+ item.id
944
+ )) }),
945
+ settingsTab === "quality" && /* @__PURE__ */ jsxs("div", { children: [
946
+ /* @__PURE__ */ jsxs(
947
+ "button",
948
+ {
949
+ type: "button",
950
+ onClick: () => setSettingsTab("root"),
951
+ className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
952
+ children: [
953
+ /* @__PURE__ */ jsx(
954
+ "svg",
955
+ {
956
+ className: "size-3.5",
957
+ viewBox: "0 0 12 12",
958
+ fill: "none",
959
+ children: /* @__PURE__ */ jsx(
960
+ "path",
961
+ {
962
+ d: "M7.5 3L4.5 6l3 3",
963
+ stroke: "currentColor",
964
+ strokeWidth: "1.5",
965
+ strokeLinecap: "round",
966
+ strokeLinejoin: "round"
967
+ }
968
+ )
969
+ }
970
+ ),
971
+ "Qualidade"
972
+ ]
973
+ }
974
+ ),
975
+ /* @__PURE__ */ jsx("div", { className: "py-1.5", children: [...qualities].reverse().map((quality) => /* @__PURE__ */ jsxs(
976
+ "button",
977
+ {
978
+ type: "button",
979
+ onClick: () => {
980
+ changeQuality(quality.id);
981
+ setSettingsTab("root");
982
+ },
983
+ className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
984
+ children: [
985
+ /* @__PURE__ */ jsx(
986
+ "svg",
987
+ {
988
+ className: `size-4 shrink-0${selectedQuality === quality.id ? "text-white" : "text-transparent"}`,
989
+ viewBox: "0 0 16 16",
990
+ fill: "none",
991
+ children: /* @__PURE__ */ jsx(
992
+ "path",
993
+ {
994
+ d: "M3 8l3.5 3.5L13 4.5",
995
+ stroke: "currentColor",
996
+ strokeWidth: "1.8",
997
+ strokeLinecap: "round",
998
+ strokeLinejoin: "round"
999
+ }
1000
+ )
1001
+ }
1002
+ ),
1003
+ /* @__PURE__ */ jsxs(
1004
+ "span",
1005
+ {
1006
+ className: selectedQuality === quality.id ? "font-semibold text-white" : "text-white/55",
1007
+ children: [
1008
+ quality.label,
1009
+ quality.id === "auto" ? " (ABR)" : ""
1010
+ ]
1011
+ }
1012
+ )
1013
+ ]
1014
+ },
1015
+ quality.id
1016
+ )) })
1017
+ ] }),
1018
+ settingsTab === "subtitles" && /* @__PURE__ */ jsxs("div", { children: [
1019
+ /* @__PURE__ */ jsxs(
1020
+ "button",
1021
+ {
1022
+ type: "button",
1023
+ onClick: () => setSettingsTab("root"),
1024
+ className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
1025
+ children: [
1026
+ /* @__PURE__ */ jsx(
1027
+ "svg",
1028
+ {
1029
+ className: "size-3.5",
1030
+ viewBox: "0 0 12 12",
1031
+ fill: "none",
1032
+ children: /* @__PURE__ */ jsx(
1033
+ "path",
1034
+ {
1035
+ d: "M7.5 3L4.5 6l3 3",
1036
+ stroke: "currentColor",
1037
+ strokeWidth: "1.5",
1038
+ strokeLinecap: "round",
1039
+ strokeLinejoin: "round"
1040
+ }
1041
+ )
1042
+ }
1043
+ ),
1044
+ "Legendas"
1045
+ ]
1046
+ }
1047
+ ),
1048
+ /* @__PURE__ */ jsx("div", { className: "py-1.5", children: [
1049
+ { srclang: "off", label: "Desligado" },
1050
+ ...parsed.subtitles
1051
+ ].map((s) => /* @__PURE__ */ jsxs(
1052
+ "button",
1053
+ {
1054
+ type: "button",
1055
+ onClick: () => {
1056
+ const next = s.srclang === "off" ? "off" : s.srclang;
1057
+ setSubtitleMode(next);
1058
+ setSubtitleStyle((st) => ({
1059
+ ...st,
1060
+ track: next
1061
+ }));
1062
+ },
1063
+ className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
1064
+ children: [
1065
+ /* @__PURE__ */ jsx(
1066
+ "svg",
1067
+ {
1068
+ className: `size-4 shrink-0${subtitleStyle.track === s.srclang ? "text-white" : "text-transparent"}`,
1069
+ viewBox: "0 0 16 16",
1070
+ fill: "none",
1071
+ children: /* @__PURE__ */ jsx(
1072
+ "path",
1073
+ {
1074
+ d: "M3 8l3.5 3.5L13 4.5",
1075
+ stroke: "currentColor",
1076
+ strokeWidth: "1.8",
1077
+ strokeLinecap: "round",
1078
+ strokeLinejoin: "round"
1079
+ }
1080
+ )
1081
+ }
1082
+ ),
1083
+ /* @__PURE__ */ jsx(
1084
+ "span",
1085
+ {
1086
+ className: subtitleStyle.track === s.srclang ? "font-semibold text-white" : "text-white/55",
1087
+ children: s.label
1088
+ }
1089
+ )
1090
+ ]
1091
+ },
1092
+ s.srclang
1093
+ )) }),
1094
+ subtitleStyle.track !== "off" && /* @__PURE__ */ jsxs(
1095
+ "button",
1096
+ {
1097
+ type: "button",
1098
+ onClick: () => setSettingsTab("subtitles-style"),
1099
+ className: "flex w-full items-center justify-between gap-3 border-t border-white/8 px-4 py-3 text-sm transition hover:bg-white/8",
1100
+ children: [
1101
+ /* @__PURE__ */ jsx("span", { className: "text-white/60", children: "Apar\xEAncia" }),
1102
+ /* @__PURE__ */ jsx(
1103
+ "svg",
1104
+ {
1105
+ className: "size-3 opacity-50",
1106
+ viewBox: "0 0 12 12",
1107
+ fill: "none",
1108
+ children: /* @__PURE__ */ jsx(
1109
+ "path",
1110
+ {
1111
+ d: "M4.5 3l3 3-3 3",
1112
+ stroke: "currentColor",
1113
+ strokeWidth: "1.5",
1114
+ strokeLinecap: "round",
1115
+ strokeLinejoin: "round"
1116
+ }
1117
+ )
1118
+ }
1119
+ )
1120
+ ]
1121
+ }
1122
+ )
1123
+ ] }),
1124
+ settingsTab === "subtitles-style" && /* @__PURE__ */ jsxs("div", { children: [
1125
+ /* @__PURE__ */ jsxs(
1126
+ "button",
1127
+ {
1128
+ type: "button",
1129
+ onClick: () => setSettingsTab("subtitles"),
1130
+ className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
1131
+ children: [
1132
+ /* @__PURE__ */ jsx(
1133
+ "svg",
1134
+ {
1135
+ className: "size-3.5",
1136
+ viewBox: "0 0 12 12",
1137
+ fill: "none",
1138
+ children: /* @__PURE__ */ jsx(
1139
+ "path",
1140
+ {
1141
+ d: "M7.5 3L4.5 6l3 3",
1142
+ stroke: "currentColor",
1143
+ strokeWidth: "1.5",
1144
+ strokeLinecap: "round",
1145
+ strokeLinejoin: "round"
1146
+ }
1147
+ )
1148
+ }
1149
+ ),
1150
+ "Apar\xEAncia"
1151
+ ]
1152
+ }
1153
+ ),
1154
+ /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 flex flex-col gap-3", children: [
1155
+ /* @__PURE__ */ jsxs("div", { children: [
1156
+ /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs font-semibold text-white/40 uppercase tracking-wide", children: "Tamanho" }),
1157
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5", children: ["small", "medium", "large", "xlarge"].map((s) => /* @__PURE__ */ jsx(
1158
+ "button",
1159
+ {
1160
+ type: "button",
1161
+ onClick: () => setSubtitleStyle((st) => ({ ...st, size: s })),
1162
+ className: `flex-1 rounded-lg py-1.5 text-xs font-medium transition${subtitleStyle.size === s ? "bg-white/20 text-white" : "text-white/45 hover:bg-white/10"}`,
1163
+ children: s === "small" ? "P" : s === "medium" ? "M" : s === "large" ? "G" : "GG"
1164
+ },
1165
+ s
1166
+ )) })
1167
+ ] }),
1168
+ /* @__PURE__ */ jsxs("div", { children: [
1169
+ /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs font-semibold text-white/40 uppercase tracking-wide", children: "Cor" }),
1170
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5", children: [
1171
+ ["white", "Branco", "#fff"],
1172
+ ["yellow", "Amarelo", "#facc15"],
1173
+ ["cyan", "Ciano", "#22d3ee"]
1174
+ ].map(([val, label, color]) => /* @__PURE__ */ jsx(
1175
+ "button",
1176
+ {
1177
+ type: "button",
1178
+ onClick: () => setSubtitleStyle((st) => ({
1179
+ ...st,
1180
+ color: val
1181
+ })),
1182
+ className: `flex-1 rounded-lg py-1.5 text-xs font-medium transition ring-1${subtitleStyle.color === val ? "ring-white/40" : "ring-transparent hover:ring-white/15"}`,
1183
+ style: { color },
1184
+ children: label
1185
+ },
1186
+ val
1187
+ )) })
1188
+ ] }),
1189
+ /* @__PURE__ */ jsxs("div", { children: [
1190
+ /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs font-semibold text-white/40 uppercase tracking-wide", children: "Fundo" }),
1191
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5", children: [
1192
+ ["none", "Nenhum"],
1193
+ ["semi", "Semi"],
1194
+ ["solid", "S\xF3lido"]
1195
+ ].map(([val, label]) => /* @__PURE__ */ jsx(
1196
+ "button",
1197
+ {
1198
+ type: "button",
1199
+ onClick: () => setSubtitleStyle((st) => ({ ...st, bg: val })),
1200
+ className: `flex-1 rounded-lg py-1.5 text-xs font-medium transition${subtitleStyle.bg === val ? "bg-white/20 text-white" : "text-white/45 hover:bg-white/10"}`,
1201
+ children: label
1202
+ },
1203
+ val
1204
+ )) })
1205
+ ] })
1206
+ ] })
1207
+ ] }),
1208
+ settingsTab === "audio" && /* @__PURE__ */ jsxs("div", { children: [
1209
+ /* @__PURE__ */ jsxs(
1210
+ "button",
1211
+ {
1212
+ type: "button",
1213
+ onClick: () => setSettingsTab("root"),
1214
+ className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
1215
+ children: [
1216
+ /* @__PURE__ */ jsx(
1217
+ "svg",
1218
+ {
1219
+ className: "size-3.5",
1220
+ viewBox: "0 0 12 12",
1221
+ fill: "none",
1222
+ children: /* @__PURE__ */ jsx(
1223
+ "path",
1224
+ {
1225
+ d: "M7.5 3L4.5 6l3 3",
1226
+ stroke: "currentColor",
1227
+ strokeWidth: "1.5",
1228
+ strokeLinecap: "round",
1229
+ strokeLinejoin: "round"
1230
+ }
1231
+ )
1232
+ }
1233
+ ),
1234
+ "\xC1udio"
1235
+ ]
1236
+ }
1237
+ ),
1238
+ /* @__PURE__ */ jsx("div", { className: "py-1.5", children: audioTracks.map((track) => /* @__PURE__ */ jsxs(
1239
+ "button",
1240
+ {
1241
+ type: "button",
1242
+ onClick: () => {
1243
+ changeAudio(track.id);
1244
+ setSettingsTab("root");
1245
+ },
1246
+ className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
1247
+ children: [
1248
+ /* @__PURE__ */ jsx(
1249
+ "svg",
1250
+ {
1251
+ className: `size-4 shrink-0${selectedAudio === track.id ? "text-white" : "text-transparent"}`,
1252
+ viewBox: "0 0 16 16",
1253
+ fill: "none",
1254
+ children: /* @__PURE__ */ jsx(
1255
+ "path",
1256
+ {
1257
+ d: "M3 8l3.5 3.5L13 4.5",
1258
+ stroke: "currentColor",
1259
+ strokeWidth: "1.8",
1260
+ strokeLinecap: "round",
1261
+ strokeLinejoin: "round"
1262
+ }
1263
+ )
1264
+ }
1265
+ ),
1266
+ /* @__PURE__ */ jsx(
1267
+ "span",
1268
+ {
1269
+ className: selectedAudio === track.id ? "font-semibold text-white" : "text-white/55",
1270
+ children: track.label
1271
+ }
1272
+ )
1273
+ ]
1274
+ },
1275
+ track.id
1276
+ )) })
1277
+ ] }),
1278
+ settingsTab === "playback" && /* @__PURE__ */ jsxs("div", { children: [
1279
+ /* @__PURE__ */ jsxs(
1280
+ "button",
1281
+ {
1282
+ type: "button",
1283
+ onClick: () => setSettingsTab("root"),
1284
+ className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
1285
+ children: [
1286
+ /* @__PURE__ */ jsx(
1287
+ "svg",
1288
+ {
1289
+ className: "size-3.5",
1290
+ viewBox: "0 0 12 12",
1291
+ fill: "none",
1292
+ children: /* @__PURE__ */ jsx(
1293
+ "path",
1294
+ {
1295
+ d: "M7.5 3L4.5 6l3 3",
1296
+ stroke: "currentColor",
1297
+ strokeWidth: "1.5",
1298
+ strokeLinecap: "round",
1299
+ strokeLinejoin: "round"
1300
+ }
1301
+ )
1302
+ }
1303
+ ),
1304
+ "Velocidade"
1305
+ ]
1306
+ }
1307
+ ),
1308
+ /* @__PURE__ */ jsx("div", { className: "py-1.5", children: PLAYBACK_SPEEDS.map((speed) => /* @__PURE__ */ jsxs(
1309
+ "button",
1310
+ {
1311
+ type: "button",
1312
+ onClick: () => {
1313
+ setPlaybackRate(speed);
1314
+ setSettingsOpen(false);
1315
+ setSettingsTab("root");
1316
+ },
1317
+ className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
1318
+ children: [
1319
+ /* @__PURE__ */ jsx(
1320
+ "svg",
1321
+ {
1322
+ className: `size-4 shrink-0${playbackRate === speed ? "text-white" : "text-transparent"}`,
1323
+ viewBox: "0 0 16 16",
1324
+ fill: "none",
1325
+ children: /* @__PURE__ */ jsx(
1326
+ "path",
1327
+ {
1328
+ d: "M3 8l3.5 3.5L13 4.5",
1329
+ stroke: "currentColor",
1330
+ strokeWidth: "1.8",
1331
+ strokeLinecap: "round",
1332
+ strokeLinejoin: "round"
1333
+ }
1334
+ )
1335
+ }
1336
+ ),
1337
+ /* @__PURE__ */ jsx(
1338
+ "span",
1339
+ {
1340
+ className: playbackRate === speed ? "font-semibold text-white" : "text-white/55",
1341
+ children: speed === 1 ? "Normal" : `${speed}\xD7`
1342
+ }
1343
+ )
1344
+ ]
1345
+ },
1346
+ speed
1347
+ )) })
844
1348
  ] })
845
1349
  ]
846
- },
847
- quality.id
848
- )) })
849
- ] }),
850
- settingsTab === "subtitles" && /* @__PURE__ */ jsxs("div", { children: [
851
- /* @__PURE__ */ jsxs(
852
- "button",
853
- {
854
- type: "button",
855
- onClick: () => setSettingsTab("root"),
856
- className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
857
- children: [
858
- /* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
859
- "Legendas"
860
- ]
861
1350
  }
862
1351
  ),
863
- /* @__PURE__ */ jsx("div", { className: "py-1.5", children: [{ srclang: "off", label: "Desligado" }, ...parsed.subtitles].map((s) => /* @__PURE__ */ jsxs(
864
- "button",
865
- {
866
- type: "button",
867
- onClick: () => {
868
- const next = s.srclang === "off" ? "off" : s.srclang;
869
- setSubtitleMode(next);
870
- setSubtitleStyle((st) => ({ ...st, track: next }));
871
- },
872
- className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
873
- children: [
874
- /* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0${subtitleStyle.track === s.srclang ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
875
- /* @__PURE__ */ jsx("span", { className: subtitleStyle.track === s.srclang ? "font-semibold text-white" : "text-white/55", children: s.label })
876
- ]
877
- },
878
- s.srclang
879
- )) }),
880
- subtitleStyle.track !== "off" && /* @__PURE__ */ jsxs(
881
- "button",
882
- {
883
- type: "button",
884
- onClick: () => setSettingsTab("subtitles-style"),
885
- className: "flex w-full items-center justify-between gap-3 border-t border-white/8 px-4 py-3 text-sm transition hover:bg-white/8",
886
- children: [
887
- /* @__PURE__ */ jsx("span", { className: "text-white/60", children: "Apar\xEAncia" }),
888
- /* @__PURE__ */ jsx("svg", { className: "size-3 opacity-50", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M4.5 3l3 3-3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
889
- ]
890
- }
891
- )
1352
+ /* @__PURE__ */ jsx("style", { children: `@keyframes spFadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}` })
892
1353
  ] }),
893
- settingsTab === "subtitles-style" && /* @__PURE__ */ jsxs("div", { children: [
894
- /* @__PURE__ */ jsxs(
895
- "button",
896
- {
897
- type: "button",
898
- onClick: () => setSettingsTab("subtitles"),
899
- className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
900
- children: [
901
- /* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
902
- "Apar\xEAncia"
903
- ]
904
- }
905
- ),
906
- /* @__PURE__ */ jsxs("div", { className: "px-4 py-3 flex flex-col gap-3", children: [
907
- /* @__PURE__ */ jsxs("div", { children: [
908
- /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs font-semibold text-white/40 uppercase tracking-wide", children: "Tamanho" }),
909
- /* @__PURE__ */ jsx("div", { className: "flex gap-1.5", children: ["small", "medium", "large", "xlarge"].map((s) => /* @__PURE__ */ jsx(
910
- "button",
1354
+ /* @__PURE__ */ jsxs(
1355
+ "div",
1356
+ {
1357
+ ref: progressRef,
1358
+ onPointerMove: handleProgressPointerMove,
1359
+ onPointerLeave: handleProgressPointerLeave,
1360
+ onPointerDown: handleProgressPointerDown,
1361
+ onPointerUp: handleProgressPointerUp,
1362
+ className: "group relative mb-3 h-7 cursor-pointer",
1363
+ children: [
1364
+ /* @__PURE__ */ jsxs(
1365
+ "div",
911
1366
  {
912
- type: "button",
913
- onClick: () => setSubtitleStyle((st) => ({ ...st, size: s })),
914
- className: `flex-1 rounded-lg py-1.5 text-xs font-medium transition${subtitleStyle.size === s ? "bg-white/20 text-white" : "text-white/45 hover:bg-white/10"}`,
915
- children: s === "small" ? "P" : s === "medium" ? "M" : s === "large" ? "G" : "GG"
916
- },
917
- s
918
- )) })
919
- ] }),
920
- /* @__PURE__ */ jsxs("div", { children: [
921
- /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs font-semibold text-white/40 uppercase tracking-wide", children: "Cor" }),
922
- /* @__PURE__ */ jsx("div", { className: "flex gap-1.5", children: [["white", "Branco", "#fff"], ["yellow", "Amarelo", "#facc15"], ["cyan", "Ciano", "#22d3ee"]].map(([val, label, color]) => /* @__PURE__ */ jsx(
923
- "button",
1367
+ className: "absolute left-0 right-0 top-1/2 -translate-y-1/2 overflow-hidden rounded-full bg-white/22 transition-[height] duration-150",
1368
+ style: { height: isDragging ? "6px" : "3px" },
1369
+ children: [
1370
+ /* @__PURE__ */ jsx(
1371
+ "div",
1372
+ {
1373
+ className: "absolute inset-y-0 left-0 rounded-full bg-white/30",
1374
+ style: { width: `${bufferedPercent}%` }
1375
+ }
1376
+ ),
1377
+ /* @__PURE__ */ jsx(
1378
+ "div",
1379
+ {
1380
+ className: "absolute inset-y-0 left-0 rounded-full bg-white/90",
1381
+ style: { width: `${progressPercent}%` }
1382
+ }
1383
+ )
1384
+ ]
1385
+ }
1386
+ ),
1387
+ /* @__PURE__ */ jsx(
1388
+ "div",
924
1389
  {
925
- type: "button",
926
- onClick: () => setSubtitleStyle((st) => ({ ...st, color: val })),
927
- className: `flex-1 rounded-lg py-1.5 text-xs font-medium transition ring-1${subtitleStyle.color === val ? "ring-white/40" : "ring-transparent hover:ring-white/15"}`,
928
- style: { color },
929
- children: label
930
- },
931
- val
932
- )) })
933
- ] }),
934
- /* @__PURE__ */ jsxs("div", { children: [
935
- /* @__PURE__ */ jsx("p", { className: "mb-1.5 text-xs font-semibold text-white/40 uppercase tracking-wide", children: "Fundo" }),
936
- /* @__PURE__ */ jsx("div", { className: "flex gap-1.5", children: [["none", "Nenhum"], ["semi", "Semi"], ["solid", "S\xF3lido"]].map(([val, label]) => /* @__PURE__ */ jsx(
1390
+ className: "pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-white shadow-md transition-[width,height] duration-100 group-hover:size-4",
1391
+ style: {
1392
+ left: `${progressPercent}%`,
1393
+ width: isDragging ? "16px" : "10px",
1394
+ height: isDragging ? "16px" : "10px"
1395
+ }
1396
+ }
1397
+ )
1398
+ ]
1399
+ }
1400
+ ),
1401
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1402
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 @sm:gap-2", children: [
1403
+ /* @__PURE__ */ jsx(
1404
+ "button",
1405
+ {
1406
+ type: "button",
1407
+ onClick: togglePlay,
1408
+ className: "grid size-8 place-items-center rounded-full text-white transition hover:bg-white/10 @sm:size-9",
1409
+ "aria-label": isPlaying ? "Pause" : "Play",
1410
+ children: isPlaying ? /* @__PURE__ */ jsx(Pause, { className: "size-4 @sm:size-5", fill: "white" }) : /* @__PURE__ */ jsx(Play, { className: "ml-0.5 size-4 @sm:size-5", fill: "white" })
1411
+ }
1412
+ ),
1413
+ /* @__PURE__ */ jsxs("span", { className: "text-[11px] font-medium tabular-nums text-white/80", children: [
1414
+ formatTime(currentTime),
1415
+ /* @__PURE__ */ jsx("span", { className: "text-white/30", children: "/" }),
1416
+ /* @__PURE__ */ jsx("span", { className: "text-white/45", children: formatTime(duration) })
1417
+ ] })
1418
+ ] }),
1419
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 @sm:gap-1", children: [
1420
+ /* @__PURE__ */ jsxs("div", { className: "group flex items-center", children: [
1421
+ /* @__PURE__ */ jsx(
937
1422
  "button",
938
1423
  {
939
1424
  type: "button",
940
- onClick: () => setSubtitleStyle((st) => ({ ...st, bg: val })),
941
- className: `flex-1 rounded-lg py-1.5 text-xs font-medium transition${subtitleStyle.bg === val ? "bg-white/20 text-white" : "text-white/45 hover:bg-white/10"}`,
942
- children: label
1425
+ onClick: () => setIsMuted((value) => !value),
1426
+ className: "grid size-8 place-items-center text-white/70 transition hover:text-white @sm:size-9",
1427
+ "aria-label": isMuted ? "Unmute" : "Mute",
1428
+ children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "size-4 @sm:size-5" }) : /* @__PURE__ */ jsx(Volume2, { className: "size-4 @sm:size-5" })
1429
+ }
1430
+ ),
1431
+ /* @__PURE__ */ jsx("div", { className: "w-0 overflow-hidden transition-all duration-200 group-hover:w-16 @md:group-hover:w-20", children: /* @__PURE__ */ jsx(
1432
+ "input",
1433
+ {
1434
+ type: "range",
1435
+ min: "0",
1436
+ max: "1",
1437
+ step: "0.01",
1438
+ value: isMuted ? 0 : volume,
1439
+ onChange: (event) => {
1440
+ const nextVolume = Number(event.target.value);
1441
+ setVolume(nextVolume);
1442
+ setIsMuted(nextVolume === 0);
1443
+ },
1444
+ className: "h-1 w-14 accent-white @md:w-20",
1445
+ "aria-label": "Audio level"
1446
+ }
1447
+ ) })
1448
+ ] }),
1449
+ /* @__PURE__ */ jsx("div", { className: "mx-0.5 h-4 w-px bg-white/20 @md:mx-1" }),
1450
+ parsed.subtitles.length > 0 && /* @__PURE__ */ jsx(
1451
+ "button",
1452
+ {
1453
+ type: "button",
1454
+ onClick: () => setSubtitleMode(
1455
+ (m) => m === "off" ? parsed.subtitles[0]?.srclang ?? "off" : "off"
1456
+ ),
1457
+ className: `grid size-8 place-items-center rounded transition hover:text-white/80 @sm:size-10${subtitleMode !== "off" ? "text-white" : "text-white/60"}`,
1458
+ "aria-label": "Captions",
1459
+ children: /* @__PURE__ */ jsx(Captions, { className: "size-4 @sm:size-5" })
1460
+ }
1461
+ ),
1462
+ /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
1463
+ "button",
1464
+ {
1465
+ type: "button",
1466
+ onClick: () => {
1467
+ setSettingsOpen((v) => !v);
1468
+ setSettingsTab("root");
943
1469
  },
944
- val
945
- )) })
946
- ] })
947
- ] })
948
- ] }),
949
- settingsTab === "audio" && /* @__PURE__ */ jsxs("div", { children: [
950
- /* @__PURE__ */ jsxs(
951
- "button",
952
- {
953
- type: "button",
954
- onClick: () => setSettingsTab("root"),
955
- className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
956
- children: [
957
- /* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
958
- "\xC1udio"
959
- ]
960
- }
961
- ),
962
- /* @__PURE__ */ jsx("div", { className: "py-1.5", children: audioTracks.map((track) => /* @__PURE__ */ jsxs(
963
- "button",
964
- {
965
- type: "button",
966
- onClick: () => {
967
- changeAudio(track.id);
968
- setSettingsTab("root");
969
- },
970
- className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
971
- children: [
972
- /* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0${selectedAudio === track.id ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
973
- /* @__PURE__ */ jsx("span", { className: selectedAudio === track.id ? "font-semibold text-white" : "text-white/55", children: track.label })
974
- ]
975
- },
976
- track.id
977
- )) })
978
- ] }),
979
- settingsTab === "playback" && /* @__PURE__ */ jsxs("div", { children: [
980
- /* @__PURE__ */ jsxs(
981
- "button",
982
- {
983
- type: "button",
984
- onClick: () => setSettingsTab("root"),
985
- className: "flex w-full items-center gap-2 border-b border-white/8 px-4 py-3 text-xs font-semibold text-white/50 transition hover:text-white",
986
- children: [
987
- /* @__PURE__ */ jsx("svg", { className: "size-3.5", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M7.5 3L4.5 6l3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }),
988
- "Velocidade"
989
- ]
990
- }
991
- ),
992
- /* @__PURE__ */ jsx("div", { className: "py-1.5", children: PLAYBACK_SPEEDS.map((speed) => /* @__PURE__ */ jsxs(
993
- "button",
994
- {
995
- type: "button",
996
- onClick: () => {
997
- setPlaybackRate(speed);
998
- setSettingsOpen(false);
999
- setSettingsTab("root");
1000
- },
1001
- className: "flex w-full items-center gap-3 px-4 py-2.5 text-sm transition hover:bg-white/8",
1002
- children: [
1003
- /* @__PURE__ */ jsx("svg", { className: `size-4 shrink-0${playbackRate === speed ? "text-white" : "text-transparent"}`, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3 8l3.5 3.5L13 4.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }),
1004
- /* @__PURE__ */ jsx("span", { className: playbackRate === speed ? "font-semibold text-white" : "text-white/55", children: speed === 1 ? "Normal" : `${speed}\xD7` })
1005
- ]
1006
- },
1007
- speed
1008
- )) })
1009
- ] })
1010
- ] }),
1011
- /* @__PURE__ */ jsx("style", { children: `@keyframes spFadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}` })
1012
- ] }),
1013
- /* @__PURE__ */ jsxs(
1014
- "div",
1015
- {
1016
- ref: progressRef,
1017
- onPointerMove: handleProgressPointerMove,
1018
- onPointerLeave: handleProgressPointerLeave,
1019
- onPointerDown: handleProgressPointerDown,
1020
- onPointerUp: handleProgressPointerUp,
1021
- className: "group relative mb-3 h-7 cursor-pointer",
1022
- children: [
1023
- /* @__PURE__ */ jsxs(
1024
- "div",
1025
- {
1026
- className: "absolute left-0 right-0 top-1/2 -translate-y-1/2 overflow-hidden rounded-full bg-white/22 transition-[height] duration-150",
1027
- style: { height: isDragging ? "6px" : "3px" },
1028
- children: [
1029
- /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 rounded-full bg-white/30", style: { width: `${bufferedPercent}%` } }),
1030
- /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 rounded-full bg-white/90", style: { width: `${progressPercent}%` } })
1031
- ]
1032
- }
1033
- ),
1034
- /* @__PURE__ */ jsx(
1035
- "div",
1036
- {
1037
- className: "pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-white shadow-md transition-[width,height] duration-100 group-hover:size-4",
1038
- style: {
1039
- left: `${progressPercent}%`,
1040
- width: isDragging ? "16px" : "10px",
1041
- height: isDragging ? "16px" : "10px"
1470
+ className: `grid size-8 place-items-center rounded transition hover:text-white/80 @sm:size-10${settingsOpen ? "text-white" : "text-white/60"}`,
1471
+ "aria-label": "Settings",
1472
+ children: /* @__PURE__ */ jsx(Settings, { className: "size-4 @sm:size-5" })
1042
1473
  }
1043
- }
1044
- )
1045
- ]
1046
- }
1047
- ),
1048
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
1049
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 @sm:gap-2", children: [
1050
- /* @__PURE__ */ jsx(
1051
- "button",
1052
- {
1053
- type: "button",
1054
- onClick: togglePlay,
1055
- className: "grid size-8 place-items-center rounded-full bg-white/15 text-white backdrop-blur-sm ring-1 ring-white/15 transition hover:bg-white/25 @sm:size-9",
1056
- "aria-label": isPlaying ? "Pause" : "Play",
1057
- children: isPlaying ? /* @__PURE__ */ jsx(Pause, { className: "size-4 @sm:size-5" }) : /* @__PURE__ */ jsx(Play, { className: "ml-0.5 size-4 @sm:size-5" })
1058
- }
1059
- ),
1060
- /* @__PURE__ */ jsxs("span", { className: "text-[11px] font-medium tabular-nums text-white/80", children: [
1061
- formatTime(currentTime),
1062
- /* @__PURE__ */ jsx("span", { className: "text-white/30", children: "/" }),
1063
- /* @__PURE__ */ jsx("span", { className: "text-white/45", children: formatTime(duration) })
1474
+ ) }),
1475
+ /* @__PURE__ */ jsx(
1476
+ "button",
1477
+ {
1478
+ type: "button",
1479
+ onClick: toggleFullscreen,
1480
+ className: "grid size-8 place-items-center text-white/60 transition hover:scale-110 hover:text-white/80 @sm:size-10",
1481
+ "aria-label": isFullscreen ? "Exit fullscreen" : "Fullscreen",
1482
+ children: isFullscreen ? /* @__PURE__ */ jsx(Minimize, { className: "size-4 @sm:size-5" }) : /* @__PURE__ */ jsx(Maximize, { className: "size-4 @sm:size-5" })
1483
+ }
1484
+ )
1485
+ ] })
1064
1486
  ] })
1065
- ] }),
1066
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 @sm:gap-1", children: [
1067
- /* @__PURE__ */ jsxs("div", { className: "group flex items-center", children: [
1068
- /* @__PURE__ */ jsx(
1069
- "button",
1070
- {
1071
- type: "button",
1072
- onClick: () => setIsMuted((value) => !value),
1073
- className: "grid size-8 place-items-center text-white/70 transition hover:text-white @sm:size-9",
1074
- "aria-label": isMuted ? "Unmute" : "Mute",
1075
- children: isMuted || volume === 0 ? /* @__PURE__ */ jsx(VolumeX, { className: "size-4 @sm:size-5" }) : /* @__PURE__ */ jsx(Volume2, { className: "size-4 @sm:size-5" })
1076
- }
1077
- ),
1078
- /* @__PURE__ */ jsx("div", { className: "w-0 overflow-hidden transition-all duration-200 group-hover:w-16 @md:group-hover:w-20", children: /* @__PURE__ */ jsx(
1079
- "input",
1080
- {
1081
- type: "range",
1082
- min: "0",
1083
- max: "1",
1084
- step: "0.01",
1085
- value: isMuted ? 0 : volume,
1086
- onChange: (event) => {
1087
- const nextVolume = Number(event.target.value);
1088
- setVolume(nextVolume);
1089
- setIsMuted(nextVolume === 0);
1090
- },
1091
- className: "h-1 w-14 accent-white @md:w-20",
1092
- "aria-label": "Audio level"
1093
- }
1094
- ) })
1095
- ] }),
1096
- /* @__PURE__ */ jsx("div", { className: "mx-0.5 h-4 w-px bg-white/20 @md:mx-1" }),
1097
- parsed.subtitles.length > 0 && /* @__PURE__ */ jsx(
1098
- "button",
1099
- {
1100
- type: "button",
1101
- onClick: () => setSubtitleMode((m) => m === "off" ? parsed.subtitles[0]?.srclang ?? "off" : "off"),
1102
- className: `grid size-8 place-items-center rounded transition hover:text-white/80 @sm:size-10${subtitleMode !== "off" ? "text-white" : "text-white/60"}`,
1103
- "aria-label": "Captions",
1104
- children: /* @__PURE__ */ jsx(Captions, { className: "size-4 @sm:size-5" })
1105
- }
1106
- ),
1107
- /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsx(
1108
- "button",
1109
- {
1110
- type: "button",
1111
- onClick: () => {
1112
- setSettingsOpen((v) => !v);
1113
- setSettingsTab("root");
1114
- },
1115
- className: `grid size-8 place-items-center rounded transition hover:text-white/80 @sm:size-10${settingsOpen ? "text-white" : "text-white/60"}`,
1116
- "aria-label": "Settings",
1117
- children: /* @__PURE__ */ jsx(Settings, { className: "size-4 @sm:size-5" })
1118
- }
1119
- ) }),
1120
- /* @__PURE__ */ jsx(
1121
- "button",
1122
- {
1123
- type: "button",
1124
- onClick: toggleFullscreen,
1125
- className: "grid size-8 place-items-center text-white/60 transition hover:scale-110 hover:text-white/80 @sm:size-10",
1126
- "aria-label": isFullscreen ? "Exit fullscreen" : "Fullscreen",
1127
- children: isFullscreen ? /* @__PURE__ */ jsx(Minimize, { className: "size-4 @sm:size-5" }) : /* @__PURE__ */ jsx(Maximize, { className: "size-4 @sm:size-5" })
1128
- }
1129
- )
1130
- ] })
1131
- ] })
1132
- ] })
1487
+ ]
1488
+ }
1489
+ )
1133
1490
  ]
1134
1491
  }
1135
1492
  ),
1136
1493
  preview && (() => {
1137
1494
  const srcW = preview.cue.w ?? 160;
1138
1495
  const srcH = preview.cue.h ?? 90;
1139
- const thumbW = Math.max(140, Math.round((playerWidth || 640) * 0.13));
1496
+ const thumbW = Math.max(
1497
+ 140,
1498
+ Math.round((playerWidth || 640) * 0.13)
1499
+ );
1140
1500
  const thumbH = Math.round(thumbW * (srcH / srcW));
1141
1501
  const scale = thumbW / srcW;
1142
1502
  const isSprite = preview.cue.x != null && preview.cue.y != null;
@@ -1144,24 +1504,48 @@ function Video({
1144
1504
  "div",
1145
1505
  {
1146
1506
  className: "pointer-events-none absolute z-60 -translate-x-1/2 -translate-y-2 overflow-hidden rounded-xl shadow-2xl ring-1 ring-white/15",
1147
- style: { bottom: controlsVisible ? "80px" : "20px", left: preview.left, transition: "bottom 0.2s" },
1148
- children: isSprite ? /* @__PURE__ */ jsx("div", { style: { width: thumbW, height: thumbH, overflow: "hidden" }, children: /* @__PURE__ */ jsx("div", { style: {
1149
- width: srcW,
1150
- height: srcH,
1151
- backgroundImage: `url(${preview.cue.image})`,
1152
- backgroundPosition: `-${preview.cue.x ?? 0}px -${preview.cue.y ?? 0}px`,
1153
- backgroundSize: "auto",
1154
- backgroundRepeat: "no-repeat",
1155
- transform: `scale(${scale})`,
1156
- transformOrigin: "top left"
1157
- } }) }) : /* @__PURE__ */ jsx("div", { style: {
1158
- width: thumbW,
1159
- height: thumbH,
1160
- backgroundImage: `url(${preview.cue.image})`,
1161
- backgroundSize: "cover",
1162
- backgroundPosition: "center",
1163
- backgroundRepeat: "no-repeat"
1164
- } })
1507
+ style: {
1508
+ bottom: controlsVisible ? "80px" : "20px",
1509
+ left: preview.left,
1510
+ transition: "bottom 0.2s"
1511
+ },
1512
+ children: isSprite ? /* @__PURE__ */ jsx(
1513
+ "div",
1514
+ {
1515
+ style: {
1516
+ width: thumbW,
1517
+ height: thumbH,
1518
+ overflow: "hidden"
1519
+ },
1520
+ children: /* @__PURE__ */ jsx(
1521
+ "div",
1522
+ {
1523
+ style: {
1524
+ width: srcW,
1525
+ height: srcH,
1526
+ backgroundImage: `url(${preview.cue.image})`,
1527
+ backgroundPosition: `-${preview.cue.x ?? 0}px -${preview.cue.y ?? 0}px`,
1528
+ backgroundSize: "auto",
1529
+ backgroundRepeat: "no-repeat",
1530
+ transform: `scale(${scale})`,
1531
+ transformOrigin: "top left"
1532
+ }
1533
+ }
1534
+ )
1535
+ }
1536
+ ) : /* @__PURE__ */ jsx(
1537
+ "div",
1538
+ {
1539
+ style: {
1540
+ width: thumbW,
1541
+ height: thumbH,
1542
+ backgroundImage: `url(${preview.cue.image})`,
1543
+ backgroundSize: "cover",
1544
+ backgroundPosition: "center",
1545
+ backgroundRepeat: "no-repeat"
1546
+ }
1547
+ }
1548
+ )
1165
1549
  }
1166
1550
  );
1167
1551
  })(),
@@ -1235,15 +1619,22 @@ function parseVideoChildren(children) {
1235
1619
  React.Children.forEach(element.props.children, (frameChild) => {
1236
1620
  if (!React.isValidElement(frameChild)) return;
1237
1621
  const fn2 = dn(frameChild);
1238
- if (frameChild.type !== StoryboardFrame && fn2 !== "SiloStoryboardFrame") return;
1622
+ if (frameChild.type !== StoryboardFrame && fn2 !== "SiloStoryboardFrame")
1623
+ return;
1239
1624
  const frameElement = frameChild;
1240
1625
  frames.push(frameElement.props);
1241
1626
  });
1242
1627
  parsed.storyboard = {
1243
1628
  ...element.props.src !== void 0 && { src: element.props.src },
1244
- ...element.props.fallbackImage !== void 0 && { fallbackImage: element.props.fallbackImage },
1245
- ...element.props.width !== void 0 && { width: element.props.width },
1246
- ...element.props.height !== void 0 && { height: element.props.height },
1629
+ ...element.props.fallbackImage !== void 0 && {
1630
+ fallbackImage: element.props.fallbackImage
1631
+ },
1632
+ ...element.props.width !== void 0 && {
1633
+ width: element.props.width
1634
+ },
1635
+ ...element.props.height !== void 0 && {
1636
+ height: element.props.height
1637
+ },
1247
1638
  frames
1248
1639
  };
1249
1640
  }