@livo-tv/blocks 1.18.0 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4245,6 +4245,7 @@ function LiveCaptionStack({
4245
4245
 
4246
4246
  // src/components/video/nativeCaptionTrack.ts
4247
4247
  var NATIVE_CAPTION_HOLD_S = 4;
4248
+ var NATIVE_SUBTITLE_KIND = "subtitles";
4248
4249
  function joinCaptionTexts(cues) {
4249
4250
  return cues.map((cue) => cue.text.trim()).filter(Boolean).join(" ");
4250
4251
  }
@@ -4256,12 +4257,46 @@ function clearNativeCaptionCues(track) {
4256
4257
  if (cue) track.removeCue(cue);
4257
4258
  }
4258
4259
  }
4259
- function ensureNativeCaptionTrack(video, locale, existing) {
4260
- if (existing && existing.language === locale) return existing;
4261
- if (existing) existing.mode = "disabled";
4262
- const track = video.addTextTrack("captions", "Livo", locale);
4263
- track.mode = "hidden";
4264
- return track;
4260
+ function subtitleTracksForLocales(video) {
4261
+ return Array.from(video.textTracks).filter(
4262
+ (track) => track.kind === NATIVE_SUBTITLE_KIND && isCaptionLocale(track.language)
4263
+ );
4264
+ }
4265
+ function findSubtitleTrack(video, locale) {
4266
+ return subtitleTracksForLocales(video).find(
4267
+ (track) => track.language === locale
4268
+ ) ?? null;
4269
+ }
4270
+ function showingCaptionLocale(video) {
4271
+ for (const track of subtitleTracksForLocales(video)) {
4272
+ if (track.mode === "showing" && isCaptionLocale(track.language)) {
4273
+ return track.language;
4274
+ }
4275
+ }
4276
+ return "off";
4277
+ }
4278
+ function applyCaptionTrackModes(video, locale, nativeVisible) {
4279
+ for (const track of subtitleTracksForLocales(video)) {
4280
+ if (locale !== "off" && track.language === locale) {
4281
+ track.mode = nativeVisible ? "showing" : "hidden";
4282
+ } else {
4283
+ track.mode = "disabled";
4284
+ }
4285
+ }
4286
+ }
4287
+ function ensureLiveSubtitleTracks(video, labels) {
4288
+ const existing = subtitleTracksForLocales(video);
4289
+ return CAPTION_LOCALES.map((locale) => {
4290
+ const found = existing.find((track2) => track2.language === locale);
4291
+ if (found) return found;
4292
+ const track = video.addTextTrack(
4293
+ NATIVE_SUBTITLE_KIND,
4294
+ labels[locale],
4295
+ locale
4296
+ );
4297
+ track.mode = "disabled";
4298
+ return track;
4299
+ });
4265
4300
  }
4266
4301
  function syncNativeCaptionCue(video, track, text) {
4267
4302
  clearNativeCaptionCues(track);
@@ -4270,17 +4305,45 @@ function syncNativeCaptionCue(video, track, text) {
4270
4305
  const start = Number.isFinite(video.currentTime) ? video.currentTime : 0;
4271
4306
  track.addCue(new VTTCue(start, start + NATIVE_CAPTION_HOLD_S, trimmed));
4272
4307
  }
4273
- function syncNativeVodCues(track, cues) {
4274
- clearNativeCaptionCues(track);
4275
- for (const cue of cues) {
4276
- const text = cue.text.trim();
4277
- if (!text) continue;
4278
- track.addCue(new VTTCue(cue.start, cue.end, text));
4308
+ function zeroAnchorNativeTrackCues(track) {
4309
+ const list = track.cues;
4310
+ if (!list || list.length === 0) return;
4311
+ let origin = Number.POSITIVE_INFINITY;
4312
+ for (let index = 0; index < list.length; index += 1) {
4313
+ const cue = list[index];
4314
+ if (cue && Number.isFinite(cue.startTime) && cue.startTime < origin) {
4315
+ origin = cue.startTime;
4316
+ }
4279
4317
  }
4318
+ if (!Number.isFinite(origin) || origin <= 0) return;
4319
+ const next = [];
4320
+ for (let index = 0; index < list.length; index += 1) {
4321
+ const cue = list[index];
4322
+ if (!(cue instanceof VTTCue)) continue;
4323
+ next.push(
4324
+ new VTTCue(
4325
+ Math.max(0, cue.startTime - origin),
4326
+ Math.max(0, cue.endTime - origin),
4327
+ cue.text
4328
+ )
4329
+ );
4330
+ }
4331
+ clearNativeCaptionCues(track);
4332
+ for (const cue of next) track.addCue(cue);
4280
4333
  }
4281
- function setNativeCaptionTrackVisible(track, showing) {
4282
- if (!track) return;
4283
- track.mode = showing ? "showing" : "hidden";
4334
+ function listenTextTracksChange(tracks, onChange) {
4335
+ if (typeof tracks.addEventListener === "function") {
4336
+ tracks.addEventListener("change", onChange);
4337
+ return () => {
4338
+ if (typeof tracks.removeEventListener === "function") {
4339
+ tracks.removeEventListener("change", onChange);
4340
+ }
4341
+ };
4342
+ }
4343
+ tracks.onchange = onChange;
4344
+ return () => {
4345
+ if (tracks.onchange === onChange) tracks.onchange = null;
4346
+ };
4284
4347
  }
4285
4348
  var DEFAULT_LABELS3 = {
4286
4349
  play: "Play",
@@ -4293,6 +4356,7 @@ var DEFAULT_LABELS3 = {
4293
4356
  cast: "Cast",
4294
4357
  settings: "Settings",
4295
4358
  more: "More",
4359
+ back: "Back",
4296
4360
  quality: "Quality",
4297
4361
  auto: "Auto",
4298
4362
  speed: "Speed",
@@ -4373,7 +4437,8 @@ function VideoPlayer({
4373
4437
  const t = { ...DEFAULT_LABELS3, ...labels };
4374
4438
  const containerRef = React9__namespace.useRef(null);
4375
4439
  const firstPlayFiredRef = React9__namespace.useRef(false);
4376
- const nativeTrackRef = React9__namespace.useRef(null);
4440
+ const applyingTrackModesRef = React9__namespace.useRef(false);
4441
+ const captionLocaleRef = React9__namespace.useRef("off");
4377
4442
  const cssFullscreenRef = React9__namespace.useRef(false);
4378
4443
  const webkitFsRef = React9__namespace.useRef(false);
4379
4444
  const [userStarted, setUserStarted] = React9__namespace.useState(false);
@@ -4421,6 +4486,9 @@ function VideoPlayer({
4421
4486
  const [controlsVisible, setControlsVisible] = React9__namespace.useState(true);
4422
4487
  const [playbackRate, setPlaybackRate] = React9__namespace.useState(1);
4423
4488
  const [openMenu, setOpenMenu] = React9__namespace.useState(null);
4489
+ const [morePane, setMorePane] = React9__namespace.useState(
4490
+ "root"
4491
+ );
4424
4492
  const [compactChrome, setCompactChrome] = React9__namespace.useState(false);
4425
4493
  const [captionLocale, setCaptionLocale] = React9__namespace.useState(defaultCaptionLocale ?? "off");
4426
4494
  const [captionCues, setCaptionCues] = React9__namespace.useState([]);
@@ -4431,8 +4499,10 @@ function VideoPlayer({
4431
4499
  const [embedded, setEmbedded] = React9__namespace.useState(false);
4432
4500
  const [cssFullscreen, setCssFullscreen] = React9__namespace.useState(false);
4433
4501
  const [appleMobile, setAppleMobile] = React9__namespace.useState(false);
4502
+ const [webkitNativeFs, setWebkitNativeFs] = React9__namespace.useState(false);
4434
4503
  const hideTimerRef = React9__namespace.useRef(null);
4435
4504
  cssFullscreenRef.current = cssFullscreen;
4505
+ captionLocaleRef.current = captionLocale;
4436
4506
  React9__namespace.useEffect(() => {
4437
4507
  const el = containerRef.current;
4438
4508
  if (!el || typeof ResizeObserver === "undefined") return;
@@ -4448,6 +4518,9 @@ function VideoPlayer({
4448
4518
  observer.observe(el);
4449
4519
  return () => observer.disconnect();
4450
4520
  }, [active]);
4521
+ React9__namespace.useEffect(() => {
4522
+ if (openMenu !== "more") setMorePane("root");
4523
+ }, [openMenu]);
4451
4524
  const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
4452
4525
  const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
4453
4526
  React9__namespace.useEffect(() => {
@@ -4520,17 +4593,42 @@ function VideoPlayer({
4520
4593
  document.addEventListener("fullscreenchange", onFsChange);
4521
4594
  return () => document.removeEventListener("fullscreenchange", onFsChange);
4522
4595
  }, []);
4596
+ function applyNativeTrackModes(video, locale, nativeVisible) {
4597
+ applyingTrackModesRef.current = true;
4598
+ try {
4599
+ applyCaptionTrackModes(video, locale, nativeVisible);
4600
+ } finally {
4601
+ applyingTrackModesRef.current = false;
4602
+ }
4603
+ }
4604
+ function onSidecarTrackLoad(event) {
4605
+ const track = event.currentTarget.track;
4606
+ if (!track) return;
4607
+ if (isLivePlaylistSrc(src)) {
4608
+ zeroAnchorNativeTrackCues(track);
4609
+ }
4610
+ const video = videoRef.current;
4611
+ if (video) {
4612
+ applyNativeTrackModes(
4613
+ video,
4614
+ captionLocaleRef.current,
4615
+ webkitFsRef.current
4616
+ );
4617
+ }
4618
+ }
4523
4619
  React9__namespace.useEffect(() => {
4524
4620
  const video = asWebkitVideo(videoRef.current);
4525
4621
  if (!video) return;
4526
4622
  const onBegin = () => {
4527
4623
  webkitFsRef.current = true;
4624
+ setWebkitNativeFs(true);
4528
4625
  setIsFullscreen(true);
4529
- setNativeCaptionTrackVisible(nativeTrackRef.current, true);
4626
+ applyNativeTrackModes(video, captionLocaleRef.current, true);
4530
4627
  };
4531
4628
  const onEnd = () => {
4532
4629
  webkitFsRef.current = false;
4533
- setNativeCaptionTrackVisible(nativeTrackRef.current, false);
4630
+ setWebkitNativeFs(false);
4631
+ applyNativeTrackModes(video, captionLocaleRef.current, false);
4534
4632
  if (!cssFullscreenRef.current) setIsFullscreen(false);
4535
4633
  };
4536
4634
  video.addEventListener("webkitbeginfullscreen", onBegin);
@@ -4627,41 +4725,56 @@ function VideoPlayer({
4627
4725
  const activeCaption = liveCaptionsBaseUrl || endedLiveReplay ? null : captionAtTime(captionCues, currentTime);
4628
4726
  React9__namespace.useEffect(() => {
4629
4727
  const video = videoRef.current;
4630
- if (!video || captionLocale === "off") {
4631
- if (nativeTrackRef.current) {
4632
- nativeTrackRef.current.mode = "disabled";
4633
- nativeTrackRef.current = null;
4634
- }
4635
- return;
4636
- }
4728
+ if (!video || !liveCaptionsBaseUrl) return;
4637
4729
  try {
4638
- nativeTrackRef.current = ensureNativeCaptionTrack(
4639
- video,
4640
- captionLocale,
4641
- nativeTrackRef.current
4642
- );
4643
- setNativeCaptionTrackVisible(nativeTrackRef.current, webkitFsRef.current);
4730
+ ensureLiveSubtitleTracks(video, {
4731
+ en: t.captionsEn,
4732
+ es: t.captionsEs,
4733
+ pt: t.captionsPt
4734
+ });
4644
4735
  } catch {
4645
- nativeTrackRef.current = null;
4736
+ return;
4646
4737
  }
4647
- }, [videoRef, active, captionLocale]);
4738
+ applyNativeTrackModes(video, captionLocale, webkitFsRef.current);
4739
+ }, [
4740
+ videoRef,
4741
+ active,
4742
+ liveCaptionsBaseUrl,
4743
+ captionLocale,
4744
+ t.captionsEn,
4745
+ t.captionsEs,
4746
+ t.captionsPt
4747
+ ]);
4648
4748
  React9__namespace.useEffect(() => {
4649
- const track = nativeTrackRef.current;
4650
- if (!track || captionLocale === "off") return;
4651
- if (liveCaptionsBaseUrl || endedLiveReplay) return;
4652
- syncNativeVodCues(track, captionCues);
4653
- }, [captionCues, captionLocale, liveCaptionsBaseUrl, endedLiveReplay]);
4749
+ const video = videoRef.current;
4750
+ if (!video) return;
4751
+ applyNativeTrackModes(video, captionLocale, webkitFsRef.current);
4752
+ }, [videoRef, active, captionLocale, src]);
4753
+ React9__namespace.useEffect(() => {
4754
+ const video = videoRef.current;
4755
+ if (!video) return;
4756
+ const onChange = () => {
4757
+ if (applyingTrackModesRef.current) return;
4758
+ const showing = showingCaptionLocale(video);
4759
+ if (!webkitFsRef.current) {
4760
+ if (showing !== "off") setCaptionLocale(showing);
4761
+ return;
4762
+ }
4763
+ setCaptionLocale(showing);
4764
+ };
4765
+ return listenTextTracksChange(video.textTracks, onChange);
4766
+ }, [videoRef, active, src, liveCaptionsBaseUrl]);
4654
4767
  React9__namespace.useEffect(() => {
4655
4768
  const video = videoRef.current;
4656
- const track = nativeTrackRef.current;
4657
- if (!video || !track) return;
4658
- if (!(liveCaptionsBaseUrl || endedLiveReplay)) return;
4769
+ if (!video || captionLocale === "off" || !liveCaptionsBaseUrl) return;
4770
+ const track = findSubtitleTrack(video, captionLocale);
4771
+ if (!track) return;
4659
4772
  syncNativeCaptionCue(
4660
4773
  video,
4661
4774
  track,
4662
4775
  lastCaptionLines(joinCaptionTexts(captionStackCues))
4663
4776
  );
4664
- }, [captionStackCues, liveCaptionsBaseUrl, endedLiveReplay]);
4777
+ }, [captionStackCues, captionLocale, liveCaptionsBaseUrl]);
4665
4778
  function togglePlay() {
4666
4779
  const video = videoRef.current;
4667
4780
  if (!video) return;
@@ -4846,7 +4959,22 @@ function VideoPlayer({
4846
4959
  muted: isMuted,
4847
4960
  className: "livo-video-player-media h-full w-full bg-black object-contain",
4848
4961
  onClick: active ? togglePlay : void 0,
4849
- poster
4962
+ poster,
4963
+ children: !liveCaptionsBaseUrl ? CAPTION_LOCALES.map((locale) => {
4964
+ const url = captionsVttUrlFromPlayback(src, locale);
4965
+ if (!url) return null;
4966
+ return /* @__PURE__ */ jsxRuntime.jsx(
4967
+ "track",
4968
+ {
4969
+ kind: "subtitles",
4970
+ srcLang: locale,
4971
+ label: captionLocaleLabel(locale, t),
4972
+ src: url,
4973
+ onLoad: onSidecarTrackLoad
4974
+ },
4975
+ `${locale}:${url}`
4976
+ );
4977
+ }) : null
4850
4978
  }
4851
4979
  ),
4852
4980
  showPoster && /* @__PURE__ */ jsxRuntime.jsx(
@@ -4912,7 +5040,7 @@ function VideoPlayer({
4912
5040
  ] }),
4913
5041
  typeof stats?.viewers === "number" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-black/60 px-2 py-0.5 text-xs", children: t.formatViewers ? t.formatViewers(stats.viewers) : `\u{1F441} ${stats.viewers}` })
4914
5042
  ] }),
4915
- (liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
5043
+ (liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && !webkitNativeFs && /* @__PURE__ */ jsxRuntime.jsx(
4916
5044
  LiveCaptionStack,
4917
5045
  {
4918
5046
  cues: captionStackCues,
@@ -4920,7 +5048,7 @@ function VideoPlayer({
4920
5048
  variant: appleMobile ? "window" : "scroll"
4921
5049
  }
4922
5050
  ),
4923
- !liveCaptionsBaseUrl && !endedLiveReplay && activeCaption && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
5051
+ !liveCaptionsBaseUrl && !endedLiveReplay && activeCaption && captionLocale !== "off" && !webkitNativeFs && /* @__PURE__ */ jsxRuntime.jsx(
4924
5052
  "div",
4925
5053
  {
4926
5054
  className: "pointer-events-none absolute inset-x-0 bottom-16 z-[1] flex justify-center px-4",
@@ -5096,55 +5224,87 @@ function VideoPlayer({
5096
5224
  className: cn("size-5", pipActive && "text-primary")
5097
5225
  }
5098
5226
  ) }),
5099
- compactChrome && /* @__PURE__ */ jsxRuntime.jsxs(
5227
+ compactChrome && /* @__PURE__ */ jsxRuntime.jsx(
5100
5228
  MenuControl,
5101
5229
  {
5102
5230
  label: t.more,
5103
5231
  open: openMenu === "more",
5104
5232
  onOpenChange: (o) => setOpenMenu(o ? "more" : null),
5105
5233
  trigger: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.EllipsisVertical, { className: "size-5" }),
5106
- children: [
5107
- mode === "vod" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5108
- /* @__PURE__ */ jsxRuntime.jsx(MenuSection, { children: t.speed }),
5109
- PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxRuntime.jsxs(
5110
- MenuItem,
5111
- {
5112
- selected: rate === playbackRate,
5113
- onSelect: () => changeRate(rate),
5114
- children: [
5115
- rate,
5116
- "\xD7"
5117
- ]
5118
- },
5119
- rate
5120
- ))
5121
- ] }),
5122
- showQuality && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5123
- /* @__PURE__ */ jsxRuntime.jsx(MenuSection, { children: t.quality }),
5124
- /* @__PURE__ */ jsxRuntime.jsx(
5125
- MenuItem,
5126
- {
5127
- selected: activeLevel < 0,
5128
- onSelect: () => chooseLevel(-1),
5129
- children: t.auto
5130
- }
5131
- ),
5132
- qualities.map((q) => /* @__PURE__ */ jsxRuntime.jsxs(
5133
- MenuItem,
5134
- {
5135
- selected: activeLevel === q.index,
5136
- onSelect: () => chooseLevel(q.index),
5137
- children: [
5138
- q.height,
5139
- "p"
5140
- ]
5141
- },
5142
- q.index
5143
- ))
5144
- ] }),
5234
+ children: morePane === "speed" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5235
+ /* @__PURE__ */ jsxRuntime.jsx(
5236
+ MenuBack,
5237
+ {
5238
+ label: t.back,
5239
+ title: t.speed,
5240
+ onSelect: () => setMorePane("root")
5241
+ }
5242
+ ),
5243
+ PLAYBACK_RATES.map((rate) => /* @__PURE__ */ jsxRuntime.jsxs(
5244
+ MenuItem,
5245
+ {
5246
+ selected: rate === playbackRate,
5247
+ onSelect: () => changeRate(rate),
5248
+ children: [
5249
+ rate,
5250
+ "\xD7"
5251
+ ]
5252
+ },
5253
+ rate
5254
+ ))
5255
+ ] }) : morePane === "quality" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5256
+ /* @__PURE__ */ jsxRuntime.jsx(
5257
+ MenuBack,
5258
+ {
5259
+ label: t.back,
5260
+ title: t.quality,
5261
+ onSelect: () => setMorePane("root")
5262
+ }
5263
+ ),
5264
+ /* @__PURE__ */ jsxRuntime.jsx(
5265
+ MenuItem,
5266
+ {
5267
+ selected: activeLevel < 0,
5268
+ onSelect: () => chooseLevel(-1),
5269
+ children: t.auto
5270
+ }
5271
+ ),
5272
+ qualities.map((q) => /* @__PURE__ */ jsxRuntime.jsxs(
5273
+ MenuItem,
5274
+ {
5275
+ selected: activeLevel === q.index,
5276
+ onSelect: () => chooseLevel(q.index),
5277
+ children: [
5278
+ q.height,
5279
+ "p"
5280
+ ]
5281
+ },
5282
+ q.index
5283
+ ))
5284
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5285
+ mode === "vod" && /* @__PURE__ */ jsxRuntime.jsx(
5286
+ MenuNavRow,
5287
+ {
5288
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Gauge, { className: "size-4" }),
5289
+ label: t.speed,
5290
+ value: `${playbackRate}\xD7`,
5291
+ onSelect: () => setMorePane("speed")
5292
+ }
5293
+ ),
5294
+ showQuality && /* @__PURE__ */ jsxRuntime.jsx(
5295
+ MenuNavRow,
5296
+ {
5297
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Settings, { className: "size-4" }),
5298
+ label: t.quality,
5299
+ value: currentLevelLabel,
5300
+ onSelect: () => setMorePane("quality")
5301
+ }
5302
+ ),
5303
+ (mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-white/15" }),
5145
5304
  /* @__PURE__ */ jsxRuntime.jsx(
5146
5305
  MenuAction,
5147
5306
  {
5307
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cast, { className: "size-4" }),
5148
5308
  onSelect: () => {
5149
5309
  setOpenMenu(null);
5150
5310
  void castHlsUrl(src).catch(() => void 0);
@@ -5155,6 +5315,8 @@ function VideoPlayer({
5155
5315
  pipSupported && /* @__PURE__ */ jsxRuntime.jsx(
5156
5316
  MenuAction,
5157
5317
  {
5318
+ icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PictureInPicture2, { className: "size-4" }),
5319
+ active: pipActive,
5158
5320
  onSelect: () => {
5159
5321
  setOpenMenu(null);
5160
5322
  togglePip();
@@ -5162,7 +5324,7 @@ function VideoPlayer({
5162
5324
  children: t.pictureInPicture
5163
5325
  }
5164
5326
  )
5165
- ]
5327
+ ] })
5166
5328
  }
5167
5329
  ),
5168
5330
  fullscreenSupported && /* @__PURE__ */ jsxRuntime.jsx(
@@ -5228,15 +5390,12 @@ function MenuControl({
5228
5390
  "div",
5229
5391
  {
5230
5392
  role: "menu",
5231
- className: "absolute right-0 bottom-full z-10 mb-2 min-w-24 rounded-md bg-black/90 p-1 text-sm shadow-lg backdrop-blur-sm",
5393
+ className: "absolute right-0 bottom-full z-10 mb-2 min-w-52 rounded-md bg-black/90 p-1 text-sm shadow-lg backdrop-blur-sm",
5232
5394
  children
5233
5395
  }
5234
5396
  )
5235
5397
  ] });
5236
5398
  }
5237
- function MenuSection({ children }) {
5238
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 pt-1.5 pb-0.5 text-[10px] font-semibold tracking-wide text-white/50 uppercase", children });
5239
- }
5240
5399
  function MenuItem({
5241
5400
  selected,
5242
5401
  onSelect,
@@ -5249,7 +5408,7 @@ function MenuItem({
5249
5408
  role: "menuitemradio",
5250
5409
  "aria-checked": selected,
5251
5410
  onClick: onSelect,
5252
- className: "flex w-full items-center justify-between gap-3 rounded px-2 py-1.5 text-left text-white/90 hover:bg-white/15",
5411
+ className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5253
5412
  children: [
5254
5413
  children,
5255
5414
  selected && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4" })
@@ -5257,18 +5416,69 @@ function MenuItem({
5257
5416
  }
5258
5417
  );
5259
5418
  }
5419
+ function MenuNavRow({
5420
+ icon,
5421
+ label,
5422
+ value,
5423
+ onSelect
5424
+ }) {
5425
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5426
+ "button",
5427
+ {
5428
+ type: "button",
5429
+ role: "menuitem",
5430
+ "aria-label": `${label}, ${value}`,
5431
+ onClick: onSelect,
5432
+ className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5433
+ children: [
5434
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/70", children: icon }),
5435
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: label }),
5436
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/50", children: value }),
5437
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "size-4 text-white/50" })
5438
+ ]
5439
+ }
5440
+ );
5441
+ }
5442
+ function MenuBack({
5443
+ label,
5444
+ title,
5445
+ onSelect
5446
+ }) {
5447
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5448
+ "button",
5449
+ {
5450
+ type: "button",
5451
+ role: "menuitem",
5452
+ "aria-label": label,
5453
+ onClick: onSelect,
5454
+ className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5455
+ children: [
5456
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" }),
5457
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: title })
5458
+ ]
5459
+ }
5460
+ );
5461
+ }
5260
5462
  function MenuAction({
5261
5463
  onSelect,
5464
+ icon,
5465
+ active,
5262
5466
  children
5263
5467
  }) {
5264
- return /* @__PURE__ */ jsxRuntime.jsx(
5468
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5265
5469
  "button",
5266
5470
  {
5267
5471
  type: "button",
5268
5472
  role: "menuitem",
5269
5473
  onClick: onSelect,
5270
- className: "flex w-full items-center rounded px-2 py-1.5 text-left text-white/90 hover:bg-white/15",
5271
- children
5474
+ className: cn(
5475
+ "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5476
+ active && "text-primary"
5477
+ ),
5478
+ children: [
5479
+ icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("text-white/70", active && "text-primary"), children: icon }) : null,
5480
+ children
5481
+ ]
5272
5482
  }
5273
5483
  );
5274
5484
  }