@digilogiclabs/saas-factory-ui 0.15.2 → 0.15.4

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.js CHANGED
@@ -1554,11 +1554,11 @@ function DataTable({
1554
1554
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "mt-2 text-sm text-muted-foreground", children: "Loading..." })
1555
1555
  ] }) }) });
1556
1556
  }
1557
- if (data.length === 0) {
1557
+ if ((data || []).length === 0) {
1558
1558
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "p-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-muted-foreground", children: emptyMessage }) }) }) });
1559
1559
  }
1560
1560
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: cn("w-full", className), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "rounded-md border", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("table", { className: "w-full", children: [
1561
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: "border-b bg-muted/50", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1561
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { className: "border-b bg-muted/50", children: (columns || []).map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1562
1562
  "th",
1563
1563
  {
1564
1564
  className: cn(
@@ -1574,7 +1574,7 @@ function DataTable({
1574
1574
  },
1575
1575
  String(column.key)
1576
1576
  )) }) }),
1577
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: sortedData.map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1577
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: (sortedData || []).map((row, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1578
1578
  "tr",
1579
1579
  {
1580
1580
  className: cn(
@@ -1582,7 +1582,7 @@ function DataTable({
1582
1582
  onRowClick && "cursor-pointer"
1583
1583
  ),
1584
1584
  onClick: () => onRowClick?.(row),
1585
- children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1585
+ children: (columns || []).map((column) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1586
1586
  "td",
1587
1587
  {
1588
1588
  className: cn(
@@ -3273,7 +3273,7 @@ var AudioPlayer = React19.forwardRef(
3273
3273
  const [isShuffled, setIsShuffled] = (0, import_react6.useState)(false);
3274
3274
  const [isRepeating, setIsRepeating] = (0, import_react6.useState)(false);
3275
3275
  const [shuffledPlaylist, setShuffledPlaylist] = (0, import_react6.useState)([]);
3276
- const currentTrack = track || (playlist.length > 0 ? playlist[currentTrackIndex] : null);
3276
+ const currentTrack = track || ((playlist?.length || 0) > 0 ? playlist?.[currentTrackIndex] : null);
3277
3277
  const activePlaylist = isShuffled ? shuffledPlaylist : playlist;
3278
3278
  const formatTime = (0, import_react6.useCallback)((time) => {
3279
3279
  const minutes = Math.floor(time / 60);
@@ -3282,7 +3282,7 @@ var AudioPlayer = React19.forwardRef(
3282
3282
  }, []);
3283
3283
  const shuffleArray = (0, import_react6.useCallback)((array) => {
3284
3284
  const shuffled = [...array];
3285
- for (let i = shuffled.length - 1; i > 0; i--) {
3285
+ for (let i = (shuffled?.length || 0) - 1; i > 0; i--) {
3286
3286
  const j = Math.floor(Math.random() * (i + 1));
3287
3287
  [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
3288
3288
  }
@@ -3313,14 +3313,14 @@ var AudioPlayer = React19.forwardRef(
3313
3313
  audioRef.current?.play();
3314
3314
  return;
3315
3315
  }
3316
- if (playlist.length > 1) {
3317
- const nextIndex = (currentTrackIndex + 1) % playlist.length;
3316
+ if (playlist?.length || 0 > 1) {
3317
+ const nextIndex = (currentTrackIndex + 1) % playlist?.length || 0;
3318
3318
  setCurrentTrackIndex(nextIndex);
3319
3319
  } else {
3320
3320
  setIsPlaying(false);
3321
3321
  onPlayStateChange?.(false);
3322
3322
  }
3323
- }, [currentTrack, isRepeating, playlist.length, currentTrackIndex, onTrackEnd, onPlayStateChange]);
3323
+ }, [currentTrack, isRepeating, playlist?.length, currentTrackIndex, onTrackEnd, onPlayStateChange]);
3324
3324
  const handleError = (0, import_react6.useCallback)(() => {
3325
3325
  const errorMsg = "Failed to load audio track";
3326
3326
  setError(errorMsg);
@@ -3369,17 +3369,17 @@ var AudioPlayer = React19.forwardRef(
3369
3369
  }
3370
3370
  }, []);
3371
3371
  const skipToNext = (0, import_react6.useCallback)(() => {
3372
- if (playlist.length > 1) {
3373
- const nextIndex = (currentTrackIndex + 1) % playlist.length;
3372
+ if (playlist?.length || 0 > 1) {
3373
+ const nextIndex = (currentTrackIndex + 1) % playlist?.length || 0;
3374
3374
  setCurrentTrackIndex(nextIndex);
3375
3375
  }
3376
- }, [playlist.length, currentTrackIndex]);
3376
+ }, [playlist?.length || 0, currentTrackIndex]);
3377
3377
  const skipToPrevious = (0, import_react6.useCallback)(() => {
3378
- if (playlist.length > 1) {
3379
- const prevIndex = (currentTrackIndex - 1 + playlist.length) % playlist.length;
3378
+ if (playlist?.length || 0 > 1) {
3379
+ const prevIndex = (currentTrackIndex - 1 + playlist?.length || 0) % playlist?.length || 0;
3380
3380
  setCurrentTrackIndex(prevIndex);
3381
3381
  }
3382
- }, [playlist.length, currentTrackIndex]);
3382
+ }, [playlist?.length || 0, currentTrackIndex]);
3383
3383
  const toggleShuffle = (0, import_react6.useCallback)(() => {
3384
3384
  if (!isShuffled) {
3385
3385
  setShuffledPlaylist(shuffleArray(playlist));
@@ -3472,7 +3472,7 @@ var AudioPlayer = React19.forwardRef(
3472
3472
  variant: "ghost",
3473
3473
  size: "icon",
3474
3474
  onClick: skipToPrevious,
3475
- disabled: playlist.length <= 1,
3475
+ disabled: (playlist?.length || 0) <= 1,
3476
3476
  className: "h-8 w-8",
3477
3477
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.SkipBack, { className: "h-4 w-4" })
3478
3478
  }
@@ -3494,7 +3494,7 @@ var AudioPlayer = React19.forwardRef(
3494
3494
  variant: "ghost",
3495
3495
  size: "icon",
3496
3496
  onClick: skipToNext,
3497
- disabled: playlist.length <= 1,
3497
+ disabled: (playlist?.length || 0) <= 1,
3498
3498
  className: "h-8 w-8",
3499
3499
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.SkipForward, { className: "h-4 w-4" })
3500
3500
  }
@@ -3536,10 +3536,10 @@ var AudioPlayer = React19.forwardRef(
3536
3536
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-sm text-muted-foreground font-mono w-8", children: Math.round((isMuted ? 0 : volume) * 100) })
3537
3537
  ] }),
3538
3538
  error && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-sm text-destructive bg-destructive/10 p-2 rounded mb-4", children: error }),
3539
- showPlaylist && playlist.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-t pt-4", children: [
3539
+ showPlaylist && playlist?.length || 0 > 1 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "border-t pt-4", children: [
3540
3540
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("h4", { className: "font-medium mb-2", children: [
3541
3541
  "Playlist (",
3542
- playlist.length,
3542
+ playlist?.length || 0,
3543
3543
  " tracks)"
3544
3544
  ] }),
3545
3545
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-h-48 overflow-y-auto space-y-1", children: playlist.map((playlistTrack, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
@@ -3993,7 +3993,7 @@ var VideoPlayer = React20.forwardRef(
3993
3993
  ),
3994
3994
  showSettings && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "absolute bottom-full right-0 mb-2 bg-black/90 rounded-lg p-2 min-w-[120px]", children: [
3995
3995
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "text-white text-xs font-medium mb-2", children: "Quality" }),
3996
- currentVideo.qualities.map((quality) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3996
+ (currentVideo?.qualities || []).map((quality) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3997
3997
  "button",
3998
3998
  {
3999
3999
  onClick: () => {
@@ -4024,13 +4024,13 @@ var VideoPlayer = React20.forwardRef(
4024
4024
  ] })
4025
4025
  ] })
4026
4026
  ] }),
4027
- showPlaylist && playlist.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute top-0 right-0 w-80 h-full bg-black/90 backdrop-blur-sm transform translate-x-full group-hover:translate-x-0 transition-transform duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "p-4", children: [
4027
+ showPlaylist && (playlist || []).length > 1 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "absolute top-0 right-0 w-80 h-full bg-black/90 backdrop-blur-sm transform translate-x-full group-hover:translate-x-0 transition-transform duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "p-4", children: [
4028
4028
  /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("h4", { className: "text-white font-medium mb-4", children: [
4029
4029
  "Playlist (",
4030
- playlist.length,
4030
+ (playlist || []).length,
4031
4031
  " videos)"
4032
4032
  ] }),
4033
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-2 max-h-[calc(100%-60px)] overflow-y-auto", children: playlist.map((playlistVideo, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4033
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "space-y-2 max-h-[calc(100%-60px)] overflow-y-auto", children: (playlist || []).map((playlistVideo, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4034
4034
  "div",
4035
4035
  {
4036
4036
  className: cn(
@@ -6569,13 +6569,13 @@ var WaveformPlayer = ({
6569
6569
  }, [hapticFeedback]);
6570
6570
  const drawWaveform = (0, import_react10.useCallback)(() => {
6571
6571
  const canvas = canvasRef.current;
6572
- if (!canvas || !waveform.peaks.length) return;
6572
+ if (!canvas || !waveform?.peaks?.length) return;
6573
6573
  const ctx = canvas.getContext("2d");
6574
6574
  if (!ctx) return;
6575
6575
  const { width, height } = canvas;
6576
6576
  const peaks = waveform.peaks;
6577
6577
  const barWidth = width / peaks.length;
6578
- const progressPoint = currentTime / waveform.duration * width;
6578
+ const progressPoint = currentTime / (waveform?.duration || 1) * width;
6579
6579
  ctx.clearRect(0, 0, width, height);
6580
6580
  peaks.forEach((peak, index) => {
6581
6581
  const barHeight = Math.max(2, peak * height * 0.8);
@@ -6598,7 +6598,7 @@ var WaveformPlayer = ({
6598
6598
  }
6599
6599
  if (showComments && comments.length > 0) {
6600
6600
  comments.forEach((comment) => {
6601
- const commentX = comment.timestamp / waveform.duration * width;
6601
+ const commentX = comment.timestamp / (waveform?.duration || 1) * width;
6602
6602
  ctx.fillStyle = "#ffffff";
6603
6603
  ctx.strokeStyle = "#ff5500";
6604
6604
  ctx.lineWidth = 2;
@@ -6633,20 +6633,20 @@ var WaveformPlayer = ({
6633
6633
  setHoverPosition(x);
6634
6634
  };
6635
6635
  const handleClick = (e) => {
6636
- if (!containerRef.current || !waveform.duration) return;
6636
+ if (!containerRef.current || !waveform?.duration) return;
6637
6637
  const rect = containerRef.current.getBoundingClientRect();
6638
6638
  const x = e.clientX - rect.left;
6639
6639
  const clickPercentage = x / rect.width;
6640
- const newTime = clickPercentage * waveform.duration;
6640
+ const newTime = clickPercentage * (waveform?.duration || 0);
6641
6641
  onSeek?.(newTime);
6642
6642
  triggerHaptic("light");
6643
6643
  };
6644
6644
  const handleDoubleClick = (e) => {
6645
- if (!containerRef.current || !waveform.duration) return;
6645
+ if (!containerRef.current || !waveform?.duration) return;
6646
6646
  const rect = containerRef.current.getBoundingClientRect();
6647
6647
  const x = e.clientX - rect.left;
6648
6648
  const clickPercentage = x / rect.width;
6649
- const timestamp = clickPercentage * waveform.duration;
6649
+ const timestamp = clickPercentage * (waveform?.duration || 0);
6650
6650
  setCommentPosition(timestamp);
6651
6651
  setShowCommentInput(true);
6652
6652
  triggerHaptic("medium");
@@ -6839,11 +6839,11 @@ var WaveformPlayer = ({
6839
6839
  transform: "translateX(-50%)",
6840
6840
  marginTop: "-30px"
6841
6841
  },
6842
- children: formatTime(hoverPosition / (containerRef.current?.getBoundingClientRect().width || 1) * waveform.duration)
6842
+ children: formatTime(hoverPosition / (containerRef.current?.getBoundingClientRect().width || 1) * (waveform?.duration || 0))
6843
6843
  }
6844
6844
  ),
6845
6845
  showComments && comments.map((comment) => {
6846
- const commentPosition2 = comment.timestamp / waveform.duration * 100;
6846
+ const commentPosition2 = comment.timestamp / (waveform?.duration || 1) * 100;
6847
6847
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
6848
6848
  import_framer_motion8.motion.div,
6849
6849
  {
@@ -6876,7 +6876,7 @@ var WaveformPlayer = ({
6876
6876
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { children: [
6877
6877
  formatTime(currentTime),
6878
6878
  " / ",
6879
- formatTime(waveform.duration)
6879
+ formatTime(waveform?.duration || 0)
6880
6880
  ] }),
6881
6881
  playCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-1", children: [
6882
6882
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react17.Play, { className: "w-3 h-3" }),
@@ -6885,7 +6885,7 @@ var WaveformPlayer = ({
6885
6885
  ] }),
6886
6886
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center gap-1", children: [
6887
6887
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_lucide_react17.Clock, { className: "w-3 h-3" }),
6888
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: formatTime(waveform.duration) })
6888
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { children: formatTime(waveform?.duration || 0) })
6889
6889
  ] })
6890
6890
  ] }),
6891
6891
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_framer_motion8.AnimatePresence, { children: showCommentInput && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
@@ -7008,6 +7008,7 @@ var TrackCard = ({
7008
7008
  return `${mins}:${secs.toString().padStart(2, "0")}`;
7009
7009
  };
7010
7010
  const formatDate3 = (date) => {
7011
+ if (!date) return "Unknown date";
7011
7012
  const now = /* @__PURE__ */ new Date();
7012
7013
  const diffTime = Math.abs(now.getTime() - date.getTime());
7013
7014
  const diffDays = Math.ceil(diffTime / (1e3 * 60 * 60 * 24));
@@ -7622,7 +7623,7 @@ var TabNavigation = ({
7622
7623
  }
7623
7624
  ) }),
7624
7625
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "relative", children: [
7625
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7626
+ typeof tab.icon === "function" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7626
7627
  tab.icon,
7627
7628
  {
7628
7629
  className: cn(
@@ -7630,7 +7631,10 @@ var TabNavigation = ({
7630
7631
  variant === "compact" && "w-5 h-5"
7631
7632
  )
7632
7633
  }
7633
- ),
7634
+ ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: cn(
7635
+ "w-6 h-6 bg-muted rounded flex items-center justify-center text-xs font-medium",
7636
+ variant === "compact" && "w-5 h-5"
7637
+ ), children: typeof tab.icon === "string" ? tab.icon.charAt(0).toUpperCase() : "?" }),
7634
7638
  showBadges && tab.badge && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
7635
7639
  import_framer_motion10.motion.div,
7636
7640
  {
@@ -7986,13 +7990,13 @@ var AudioFeed = ({
7986
7990
  { id: "random", label: "Discover", icon: import_lucide_react20.Music }
7987
7991
  ];
7988
7992
  const filterOptions = [
7989
- { id: "all", label: "All Content", count: items.length },
7990
- { id: "music", label: "Music", count: items.filter((item) => item.genre !== "Podcast").length },
7991
- { id: "podcast", label: "Podcasts", count: items.filter((item) => item.genre === "Podcast").length },
7992
- { id: "remix", label: "Remixes", count: items.filter((item) => item.tags?.includes("remix")).length },
7993
- { id: "original", label: "Originals", count: items.filter((item) => !item.tags?.includes("remix")).length }
7993
+ { id: "all", label: "All Content", count: items?.length || 0 },
7994
+ { id: "music", label: "Music", count: items?.filter((item) => item.genre !== "Podcast")?.length || 0 },
7995
+ { id: "podcast", label: "Podcasts", count: items?.filter((item) => item.genre === "Podcast")?.length || 0 },
7996
+ { id: "remix", label: "Remixes", count: items?.filter((item) => item.tags?.includes("remix"))?.length || 0 },
7997
+ { id: "original", label: "Originals", count: items?.filter((item) => !item.tags?.includes("remix"))?.length || 0 }
7994
7998
  ];
7995
- const displayItems = virtualScrolling ? items.slice(0, visibleItems) : items;
7999
+ const displayItems = virtualScrolling ? (items || []).slice(0, visibleItems) : items || [];
7996
8000
  const formatFeedContext = (item) => {
7997
8001
  const context = item.feedContext;
7998
8002
  if (!context) return null;
@@ -8394,13 +8398,14 @@ var SearchWithFilters = ({
8394
8398
  ).slice(0, 8);
8395
8399
  }, [suggestions, localQuery]);
8396
8400
  const activeFiltersCount = (0, import_react14.useMemo)(() => {
8401
+ if (!filters) return 0;
8397
8402
  let count = 0;
8398
- if (filters.category !== "all") count++;
8399
- if (filters.sortBy !== "relevance") count++;
8400
- if (filters.duration !== "any") count++;
8401
- if (filters.dateRange !== "any") count++;
8402
- if (filters.genres.length > 0) count++;
8403
- if (filters.tags.length > 0) count++;
8403
+ if (filters.category && filters.category !== "all") count++;
8404
+ if (filters.sortBy && filters.sortBy !== "relevance") count++;
8405
+ if (filters.duration && filters.duration !== "any") count++;
8406
+ if (filters.dateRange && filters.dateRange !== "any") count++;
8407
+ if (filters.genres && filters.genres.length > 0) count++;
8408
+ if (filters.tags && filters.tags.length > 0) count++;
8404
8409
  if (filters.verified) count++;
8405
8410
  if (filters.downloadable) count++;
8406
8411
  if (filters.hasLyrics) count++;
@@ -8476,7 +8481,7 @@ var SearchWithFilters = ({
8476
8481
  )
8477
8482
  ] })
8478
8483
  ] }),
8479
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_framer_motion12.AnimatePresence, { children: showSuggestions && (enableSuggestions || recentSearches.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8484
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_framer_motion12.AnimatePresence, { children: showSuggestions && (enableSuggestions || recentSearches?.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8480
8485
  import_framer_motion12.motion.div,
8481
8486
  {
8482
8487
  initial: { opacity: 0, y: -10 },
@@ -8484,7 +8489,7 @@ var SearchWithFilters = ({
8484
8489
  exit: { opacity: 0, y: -10 },
8485
8490
  className: "absolute top-full left-0 right-0 mt-1 bg-popover border border-border rounded-lg shadow-lg z-10 max-h-96 overflow-y-auto",
8486
8491
  children: [
8487
- !localQuery && recentSearches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 border-b border-border", children: [
8492
+ !localQuery && recentSearches?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3 border-b border-border", children: [
8488
8493
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
8489
8494
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { className: "text-sm font-medium text-foreground", children: "Recent" }),
8490
8495
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -8513,7 +8518,7 @@ var SearchWithFilters = ({
8513
8518
  index
8514
8519
  )) })
8515
8520
  ] }),
8516
- filteredSuggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3", children: [
8521
+ filteredSuggestions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "p-3", children: [
8517
8522
  !localQuery && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("h3", { className: "text-sm font-medium text-foreground mb-2", children: "Trending" }),
8518
8523
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "space-y-1", children: filteredSuggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8519
8524
  "button",
@@ -8588,7 +8593,7 @@ var SearchWithFilters = ({
8588
8593
  onClick: () => handleFilterChange("category", option.id),
8589
8594
  className: cn(
8590
8595
  "p-3 rounded-lg border text-sm font-medium transition-colors flex items-center gap-2",
8591
- filters.category === option.id ? "border-primary bg-primary/10 text-primary" : "border-border hover:border-muted-foreground"
8596
+ filters?.category === option.id ? "border-primary bg-primary/10 text-primary" : "border-border hover:border-muted-foreground"
8592
8597
  ),
8593
8598
  children: [
8594
8599
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(option.icon, { className: "w-4 h-4" }),
@@ -8625,7 +8630,7 @@ var SearchWithFilters = ({
8625
8630
  onClick: () => handleFilterChange("sortBy", option.id),
8626
8631
  className: cn(
8627
8632
  "p-3 rounded-lg border text-sm font-medium transition-colors flex items-center gap-2",
8628
- filters.sortBy === option.id ? "border-primary bg-primary/10 text-primary" : "border-border hover:border-muted-foreground"
8633
+ filters?.sortBy === option.id ? "border-primary bg-primary/10 text-primary" : "border-border hover:border-muted-foreground"
8629
8634
  ),
8630
8635
  children: [
8631
8636
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(option.icon, { className: "w-4 h-4" }),
@@ -8663,7 +8668,7 @@ var SearchWithFilters = ({
8663
8668
  type: "radio",
8664
8669
  name: "duration",
8665
8670
  value: option.id,
8666
- checked: filters.duration === option.id,
8671
+ checked: filters?.duration === option.id,
8667
8672
  onChange: () => handleFilterChange("duration", option.id),
8668
8673
  className: "text-primary focus:ring-primary"
8669
8674
  }
@@ -8673,7 +8678,7 @@ var SearchWithFilters = ({
8673
8678
  }
8674
8679
  ) })
8675
8680
  ] }),
8676
- showAdvancedFilters && availableGenres.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8681
+ showAdvancedFilters && availableGenres?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8677
8682
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
8678
8683
  "button",
8679
8684
  {
@@ -8696,12 +8701,13 @@ var SearchWithFilters = ({
8696
8701
  "button",
8697
8702
  {
8698
8703
  onClick: () => {
8699
- const newGenres = filters.genres.includes(genre) ? filters.genres.filter((g) => g !== genre) : [...filters.genres, genre];
8704
+ const currentGenres = filters?.genres || [];
8705
+ const newGenres = currentGenres.includes(genre) ? currentGenres.filter((g) => g !== genre) : [...currentGenres, genre];
8700
8706
  handleFilterChange("genres", newGenres);
8701
8707
  },
8702
8708
  className: cn(
8703
8709
  "px-3 py-1 rounded-full text-xs font-medium transition-colors",
8704
- filters.genres.includes(genre) ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted-foreground hover:text-background"
8710
+ (filters?.genres || []).includes(genre) ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted-foreground hover:text-background"
8705
8711
  ),
8706
8712
  children: genre
8707
8713
  },
@@ -8718,7 +8724,7 @@ var SearchWithFilters = ({
8718
8724
  "input",
8719
8725
  {
8720
8726
  type: "checkbox",
8721
- checked: filters.verified || false,
8727
+ checked: filters?.verified || false,
8722
8728
  onChange: (e) => handleFilterChange("verified", e.target.checked),
8723
8729
  className: "text-primary focus:ring-primary"
8724
8730
  }
@@ -8730,7 +8736,7 @@ var SearchWithFilters = ({
8730
8736
  "input",
8731
8737
  {
8732
8738
  type: "checkbox",
8733
- checked: filters.downloadable || false,
8739
+ checked: filters?.downloadable || false,
8734
8740
  onChange: (e) => handleFilterChange("downloadable", e.target.checked),
8735
8741
  className: "text-primary focus:ring-primary"
8736
8742
  }
@@ -8742,7 +8748,7 @@ var SearchWithFilters = ({
8742
8748
  "input",
8743
8749
  {
8744
8750
  type: "checkbox",
8745
- checked: filters.hasLyrics || false,
8751
+ checked: filters?.hasLyrics || false,
8746
8752
  onChange: (e) => handleFilterChange("hasLyrics", e.target.checked),
8747
8753
  className: "text-primary focus:ring-primary"
8748
8754
  }
@@ -8765,11 +8771,11 @@ var SearchWithFilters = ({
8765
8771
  " results",
8766
8772
  localQuery && ` for "${localQuery}"`
8767
8773
  ] }),
8768
- results.tracks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8774
+ results?.tracks?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8769
8775
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
8770
8776
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react21.Music, { className: "w-5 h-5" }),
8771
8777
  "Tracks (",
8772
- results.tracks.length,
8778
+ results?.tracks?.length || 0,
8773
8779
  ")"
8774
8780
  ] }),
8775
8781
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "space-y-4", children: results.tracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -8789,11 +8795,11 @@ var SearchWithFilters = ({
8789
8795
  track.id
8790
8796
  )) })
8791
8797
  ] }),
8792
- results.artists.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8798
+ results?.artists?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8793
8799
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
8794
8800
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react21.User, { className: "w-5 h-5" }),
8795
8801
  "Artists (",
8796
- results.artists.length,
8802
+ results?.artists?.length || 0,
8797
8803
  ")"
8798
8804
  ] }),
8799
8805
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: results.artists.map((artist) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -8828,11 +8834,11 @@ var SearchWithFilters = ({
8828
8834
  artist.id
8829
8835
  )) })
8830
8836
  ] }),
8831
- results.playlists.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8837
+ results?.playlists?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { children: [
8832
8838
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h2", { className: "text-lg font-semibold mb-4 flex items-center gap-2", children: [
8833
8839
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react21.Play, { className: "w-5 h-5" }),
8834
8840
  "Playlists (",
8835
- results.playlists.length,
8841
+ results?.playlists?.length || 0,
8836
8842
  ")"
8837
8843
  ] }),
8838
8844
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: results.playlists.map((playlist) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
@@ -9005,10 +9011,10 @@ var PlaylistBuilder = ({
9005
9011
  const totalDuration = tracks.reduce((sum, track) => sum + track.duration, 0);
9006
9012
  const totalPlays = tracks.reduce((sum, track) => sum + track.playCount, 0);
9007
9013
  return {
9008
- trackCount: tracks.length,
9014
+ trackCount: tracks?.length || 0,
9009
9015
  totalDuration,
9010
9016
  totalPlays,
9011
- averageDuration: tracks.length > 0 ? totalDuration / tracks.length : 0
9017
+ averageDuration: (tracks?.length || 0) > 0 ? totalDuration / (tracks?.length || 1) : 0
9012
9018
  };
9013
9019
  }, [localPlaylist.tracks]);
9014
9020
  const formatDuration2 = (seconds) => {
@@ -9089,7 +9095,7 @@ var PlaylistBuilder = ({
9089
9095
  playlist?.followerCount && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center gap-1", children: [
9090
9096
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react22.Users, { className: "w-4 h-4" }),
9091
9097
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { children: [
9092
- playlist.followerCount.toLocaleString(),
9098
+ playlist?.followerCount?.toLocaleString() || "0",
9093
9099
  " followers"
9094
9100
  ] })
9095
9101
  ] })
@@ -9266,7 +9272,7 @@ var PlaylistBuilder = ({
9266
9272
  animate: { opacity: 1, height: "auto" },
9267
9273
  exit: { opacity: 0, height: 0 },
9268
9274
  className: "space-y-2",
9269
- children: loading.search ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_framer_motion13.motion.div, { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" }) }) : searchResults.map((track) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9275
+ children: loading.search ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_framer_motion13.motion.div, { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" }) }) : (searchResults || []).map((track) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9270
9276
  import_framer_motion13.motion.div,
9271
9277
  {
9272
9278
  initial: { opacity: 0, y: 10 },
@@ -9344,10 +9350,10 @@ var PlaylistBuilder = ({
9344
9350
  import_framer_motion13.Reorder.Group,
9345
9351
  {
9346
9352
  axis: "y",
9347
- values: localPlaylist.tracks,
9353
+ values: localPlaylist.tracks || [],
9348
9354
  onReorder: handleReorder,
9349
9355
  className: "space-y-2",
9350
- children: localPlaylist.tracks.map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9356
+ children: (localPlaylist.tracks || []).map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9351
9357
  import_framer_motion13.Reorder.Item,
9352
9358
  {
9353
9359
  value: track,
@@ -9403,7 +9409,7 @@ var PlaylistBuilder = ({
9403
9409
  track.id
9404
9410
  ))
9405
9411
  }
9406
- ) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "space-y-2", children: localPlaylist.tracks.map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9412
+ ) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "space-y-2", children: (localPlaylist.tracks || []).map((track, index) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
9407
9413
  "div",
9408
9414
  {
9409
9415
  className: "flex items-center gap-3 p-3 rounded-lg hover:bg-muted/50 transition-colors group",
@@ -9761,11 +9767,11 @@ var TrendingSection = ({
9761
9767
  ] }),
9762
9768
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Badge, { variant: "outline", className: "text-xs", children: [
9763
9769
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_lucide_react23.Users, { className: "w-3 h-3 mr-1" }),
9764
- section.tracks.length,
9770
+ section.tracks?.length || 0,
9765
9771
  " tracks"
9766
9772
  ] }) })
9767
9773
  ] }) }),
9768
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "divide-y divide-gray-100 dark:divide-gray-800", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_framer_motion14.AnimatePresence, { children: displayTracks.map((track) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9774
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "divide-y divide-gray-100 dark:divide-gray-800", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_framer_motion14.AnimatePresence, { children: (displayTracks || []).map((track) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9769
9775
  TrackRow,
9770
9776
  {
9771
9777
  track,
@@ -9780,7 +9786,7 @@ var TrendingSection = ({
9780
9786
  },
9781
9787
  track.id
9782
9788
  )) }) }),
9783
- section.tracks.length > 10 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "p-4 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9789
+ (section.tracks?.length || 0) > 10 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "p-4 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
9784
9790
  Button,
9785
9791
  {
9786
9792
  variant: "ghost",
@@ -10389,7 +10395,7 @@ var CommentSystem = ({
10389
10395
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react24.MessageCircle, { className: "w-5 h-5 text-gray-600 dark:text-gray-400" }),
10390
10396
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h3", { className: "font-semibold text-gray-900 dark:text-gray-100", children: [
10391
10397
  "Comments (",
10392
- comments.length,
10398
+ comments?.length || 0,
10393
10399
  ")"
10394
10400
  ] })
10395
10401
  ] }),
@@ -10416,7 +10422,7 @@ var CommentSystem = ({
10416
10422
  formatTimestamp(currentTime),
10417
10423
  ":"
10418
10424
  ] }),
10419
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "space-y-2", children: currentTimeComments.slice(0, 3).map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
10425
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "space-y-2", children: (currentTimeComments || []).slice(0, 3).map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
10420
10426
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("img", { src: comment.author.avatar, alt: "", className: "w-6 h-6 rounded-full" }),
10421
10427
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("span", { className: "font-medium", children: [
10422
10428
  comment.author.name,
@@ -10443,7 +10449,7 @@ var CommentSystem = ({
10443
10449
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_lucide_react24.MessageCircle, { className: "w-12 h-12 mx-auto mb-4 opacity-50" }),
10444
10450
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: "No comments yet" }),
10445
10451
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-sm", children: "Be the first to share your thoughts!" })
10446
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_framer_motion15.AnimatePresence, { children: sortedComments.map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
10452
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_framer_motion15.AnimatePresence, { children: (sortedComments || []).map((comment) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { children: [
10447
10453
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10448
10454
  CommentItem,
10449
10455
  {
@@ -10478,7 +10484,7 @@ var CommentSystem = ({
10478
10484
  hapticFeedback
10479
10485
  }
10480
10486
  ) }),
10481
- comment.replies && comment.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "ml-12 border-l border-gray-200 dark:border-gray-700", children: comment.replies.map((reply) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10487
+ comment.replies && comment.replies.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "ml-12 border-l border-gray-200 dark:border-gray-700", children: (comment.replies || []).map((reply) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
10482
10488
  CommentItem,
10483
10489
  {
10484
10490
  comment: reply,
@@ -10827,7 +10833,7 @@ var ContentTabs = ({
10827
10833
  if (isArtist) {
10828
10834
  tabs.splice(1, 0, { id: "popular", label: "Popular", icon: import_lucide_react25.TrendingUp });
10829
10835
  }
10830
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("nav", { className: "flex space-x-8 px-6", children: tabs.map((tab) => {
10836
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("nav", { className: "flex space-x-8 px-6", children: (tabs || []).map((tab) => {
10831
10837
  const Icon2 = tab.icon;
10832
10838
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
10833
10839
  "button",
@@ -10940,7 +10946,7 @@ var UserProfile = ({
10940
10946
  /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_lucide_react25.Star, { className: "w-5 h-5 text-yellow-500" }),
10941
10947
  "Pinned Tracks"
10942
10948
  ] }) }),
10943
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: profile.pinnedTracks.slice(0, 4).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10949
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: (profile.pinnedTracks || []).slice(0, 4).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10944
10950
  TrackCard,
10945
10951
  {
10946
10952
  track,
@@ -10971,7 +10977,7 @@ var UserProfile = ({
10971
10977
  }
10972
10978
  )
10973
10979
  ] }),
10974
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "space-y-2", children: profile.recentTracks.slice(0, 3).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10980
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "space-y-2", children: (profile.recentTracks || []).slice(0, 3).map((track) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
10975
10981
  TrackCard,
10976
10982
  {
10977
10983
  track,
@@ -11214,7 +11220,7 @@ var ShareModal = ({
11214
11220
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h3", { className: "text-lg font-semibold text-gray-900 dark:text-white mb-2", children: "Share" }),
11215
11221
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: "text-sm text-gray-600 dark:text-gray-400 truncate", children: shareTitle || shareUrl })
11216
11222
  ] }),
11217
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "grid grid-cols-3 gap-4", children: shareOptions.map((option) => {
11223
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "grid grid-cols-3 gap-4", children: (shareOptions || []).map((option) => {
11218
11224
  const Icon2 = option.icon;
11219
11225
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
11220
11226
  "button",
@@ -11505,7 +11511,7 @@ var SocialActions = ({
11505
11511
  };
11506
11512
  return configs;
11507
11513
  }, [actionStates, actionCounts, loadingStates]);
11508
- const visibleActions = actions.filter((action) => actionConfigs[action]);
11514
+ const visibleActions = (actions || []).filter((action) => actionConfigs[action]);
11509
11515
  const primaryActions = visibleActions.slice(0, variant === "compact" ? 3 : 4);
11510
11516
  const secondaryActions = visibleActions.slice(variant === "compact" ? 3 : 4);
11511
11517
  const containerClasses = cn(
@@ -11517,7 +11523,7 @@ var SocialActions = ({
11517
11523
  );
11518
11524
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
11519
11525
  /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: containerClasses, style: { backgroundColor }, children: [
11520
- primaryActions.map((actionType) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
11526
+ (primaryActions || []).map((actionType) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
11521
11527
  ActionButton,
11522
11528
  {
11523
11529
  action: actionConfigs[actionType],
@@ -11779,7 +11785,7 @@ var NotificationItemComponent = ({
11779
11785
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-start justify-between", children: [
11780
11786
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "min-w-0 flex-1", children: [
11781
11787
  notification.users && notification.users.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex -space-x-2 mb-2", children: [
11782
- notification.users.slice(0, 3).map((user) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11788
+ (notification.users || []).slice(0, 3).map((user) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
11783
11789
  "img",
11784
11790
  {
11785
11791
  src: user.avatar,
@@ -11941,7 +11947,7 @@ var FilterTabs = ({ activeFilter, onFilterChange, counts }) => {
11941
11947
  { id: "content", label: "Content", count: counts.content },
11942
11948
  { id: "system", label: "System", count: counts.system }
11943
11949
  ];
11944
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex space-x-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg", children: filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11950
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "flex space-x-1 p-1 bg-gray-100 dark:bg-gray-800 rounded-lg", children: (filters || []).map((filter) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
11945
11951
  "button",
11946
11952
  {
11947
11953
  onClick: () => onFilterChange(filter.id),
@@ -11991,7 +11997,8 @@ var NotificationCenter = ({
11991
11997
  let filtered = notifications;
11992
11998
  if (groupSimilar) {
11993
11999
  const grouped = {};
11994
- notifications.forEach((notification) => {
12000
+ const notificationArray = notifications || [];
12001
+ notificationArray.forEach((notification) => {
11995
12002
  const key = `${notification.type}-${notification.track?.id || notification.playlist?.id || "general"}`;
11996
12003
  if (!grouped[key]) {
11997
12004
  grouped[key] = [];
@@ -12160,6 +12167,7 @@ var AudioVisualizer = ({
12160
12167
  if (!ctx) return;
12161
12168
  const { width, height } = canvas;
12162
12169
  const { frequencies, waveform, rms, peak } = audioAnalysis;
12170
+ if (!frequencies || !waveform) return;
12163
12171
  ctx.clearRect(0, 0, width, height);
12164
12172
  ctx.fillStyle = accentColor;
12165
12173
  switch (type) {
@@ -12489,7 +12497,7 @@ var AdvancedPlayer = ({
12489
12497
  onRepeat?.(nextMode);
12490
12498
  }, [repeatMode, onRepeat, triggerHaptic]);
12491
12499
  const canGoPrevious = currentIndex > 0 || repeatMode === "all";
12492
- const canGoNext = currentIndex < playlist.length - 1 || repeatMode === "all";
12500
+ const canGoNext = currentIndex < (playlist?.length || 0) - 1 || repeatMode === "all";
12493
12501
  if (!track) {
12494
12502
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Card, { className: cn("p-6 text-center", className), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
12495
12503
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "w-16 h-16 rounded-full bg-gray-200 dark:bg-gray-700 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_lucide_react28.Headphones, { className: "w-8 h-8 text-gray-400" }) }),
@@ -13087,10 +13095,10 @@ var ActivityFeed = ({
13087
13095
  }
13088
13096
  ) });
13089
13097
  }
13090
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cn("space-y-3", className), children: activities.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [
13098
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cn("space-y-3", className), children: (activities?.length || 0) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "text-center py-8 text-gray-500 dark:text-gray-400", children: [
13091
13099
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_lucide_react29.Activity, { className: "w-8 h-8 mx-auto mb-2 opacity-50" }),
13092
13100
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-sm", children: "No recent activity" })
13093
- ] }) : activities.map((activity) => {
13101
+ ] }) : (activities || []).map((activity) => {
13094
13102
  const Icon2 = getActivityIcon(activity.type);
13095
13103
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
13096
13104
  import_framer_motion20.motion.div,
@@ -13210,7 +13218,7 @@ var LiveSessionControls = ({
13210
13218
  "Live Session Active"
13211
13219
  ] }),
13212
13220
  /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
13213
- playlist.liveSession.listeners.length,
13221
+ playlist.liveSession?.listeners?.length || 0,
13214
13222
  " listening",
13215
13223
  playlist.liveSession.chatEnabled && " \u2022 Chat enabled"
13216
13224
  ] })
@@ -14155,6 +14163,10 @@ function useMounted() {
14155
14163
  var import_react26 = require("react");
14156
14164
  function useLockBody() {
14157
14165
  (0, import_react26.useLayoutEffect)(() => {
14166
+ if (typeof window === "undefined" || typeof document === "undefined") {
14167
+ return () => {
14168
+ };
14169
+ }
14158
14170
  const originalStyle = window.getComputedStyle(
14159
14171
  document.body
14160
14172
  ).overflow;
@@ -14166,8 +14178,14 @@ function useLockBody() {
14166
14178
  // src/hooks/web/use-media-query.ts
14167
14179
  var import_react27 = require("react");
14168
14180
  function useMediaQuery(query) {
14169
- const [matches, setMatches] = (0, import_react27.useState)(false);
14181
+ const [matches, setMatches] = (0, import_react27.useState)(() => {
14182
+ if (typeof window !== "undefined") {
14183
+ return window.matchMedia(query).matches;
14184
+ }
14185
+ return false;
14186
+ });
14170
14187
  (0, import_react27.useEffect)(() => {
14188
+ if (typeof window === "undefined") return;
14171
14189
  const media = window.matchMedia(query);
14172
14190
  if (media.matches !== matches) {
14173
14191
  setMatches(media.matches);
@@ -15294,9 +15312,9 @@ var VirtualScrollList = ({
15294
15312
  const measurementsRef = (0, import_react33.useRef)({});
15295
15313
  const itemSizes = (0, import_react33.useMemo)(() => {
15296
15314
  if (typeof itemHeight === "number") {
15297
- return Array(items.length).fill(itemHeight);
15315
+ return Array(items?.length || 0).fill(itemHeight);
15298
15316
  }
15299
- return items.map((item, index) => {
15317
+ return (items || []).map((item, index) => {
15300
15318
  if (measurementsRef.current[index] !== void 0) {
15301
15319
  return measurementsRef.current[index];
15302
15320
  }
@@ -15320,9 +15338,9 @@ var VirtualScrollList = ({
15320
15338
  const containerHeight2 = scrollElementRef.current?.clientHeight || 400;
15321
15339
  const start = Math.max(0, Math.floor(scrollTop / (itemHeight || 50)) - overscan);
15322
15340
  const visibleCount = Math.ceil(containerHeight2 / (itemHeight || 50)) + overscan * 2;
15323
- const end = Math.min(items.length - 1, start + visibleCount);
15341
+ const end = Math.min((items?.length || 0) - 1, start + visibleCount);
15324
15342
  return { start, end };
15325
- }, [scrollTop, itemHeight, overscan, items.length]);
15343
+ }, [scrollTop, itemHeight, overscan, items?.length]);
15326
15344
  const visibleItems = (0, import_react33.useMemo)(() => {
15327
15345
  return itemPositions.slice(visibleRange.start, visibleRange.end + 1);
15328
15346
  }, [itemPositions, visibleRange]);
@@ -15906,15 +15924,22 @@ var formatDate2 = (date, options = {
15906
15924
  day: "numeric",
15907
15925
  year: "numeric"
15908
15926
  }) => {
15909
- return new Date(date).toLocaleDateString(void 0, options);
15927
+ if (!date) return "Invalid date";
15928
+ try {
15929
+ return new Date(date).toLocaleDateString(void 0, options);
15930
+ } catch (error) {
15931
+ return "Invalid date";
15932
+ }
15910
15933
  };
15911
15934
  var formatNumber3 = (number, options = {
15912
15935
  minimumFractionDigits: 0,
15913
15936
  maximumFractionDigits: 2
15914
15937
  }) => {
15938
+ if (typeof number !== "number" || isNaN(number)) return "0";
15915
15939
  return new Intl.NumberFormat(void 0, options).format(number);
15916
15940
  };
15917
15941
  var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
15942
+ if (typeof amount !== "number" || isNaN(amount)) return "$0.00";
15918
15943
  return new Intl.NumberFormat(locale, {
15919
15944
  style: "currency",
15920
15945
  currency
@@ -15923,11 +15948,16 @@ var formatCurrency = (amount, currency = "USD", locale = "en-US") => {
15923
15948
 
15924
15949
  // src/utils/validation.ts
15925
15950
  var validateEmail = (email) => {
15951
+ if (!email || typeof email !== "string") return false;
15926
15952
  const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
15927
15953
  return re.test(email);
15928
15954
  };
15929
15955
  var validatePassword = (password) => {
15930
15956
  const errors = [];
15957
+ if (!password || typeof password !== "string") {
15958
+ errors.push("Password is required");
15959
+ return { isValid: false, errors };
15960
+ }
15931
15961
  if (password.length < 8) {
15932
15962
  errors.push("Password must be at least 8 characters long");
15933
15963
  }