import { ReactNode } from "react"; import AppleMusicEmbed from "@/Components/Embed/AppleMusicEmbed"; import LinkPreview from "@/Components/Embed/LinkPreview"; import MagnetLink from "@/Components/Embed/MagnetLink"; import MixCloudEmbed from "@/Components/Embed/MixCloudEmbed"; import NostrLink from "@/Components/Embed/NostrLink"; import SoundCloudEmbed from "@/Components/Embed/SoundCloudEmded"; import SpotifyEmbed from "@/Components/Embed/SpotifyEmbed"; import TidalEmbed from "@/Components/Embed/TidalEmbed"; import TwitchEmbed from "@/Components/Embed/TwitchEmbed"; import WavlakeEmbed from "@/Components/Embed/WavlakeEmbed"; import { magnetURIDecode } from "@/Utils"; import { AppleMusicRegex, MixCloudRegex, NostrNestsRegex, SoundCloudRegex, SpotifyRegex, TidalRegex, TwitchRegex, WavlakeRegex, YoutubeUrlRegex, } from "@/Utils/Const"; interface HypeTextProps { link: string; children?: ReactNode | Array | null; depth?: number; showLinkPreview?: boolean; } export default function HyperText({ link, depth, showLinkPreview, children }: HypeTextProps) { const a = link; try { const url = new URL(a); const youtubeId = YoutubeUrlRegex.test(a) && RegExp.$1; const tidalId = TidalRegex.test(a) && RegExp.$1; const soundcloundId = SoundCloudRegex.test(a) && RegExp.$1; const mixcloudId = MixCloudRegex.test(a) && RegExp.$1; const isSpotifyLink = SpotifyRegex.test(a); const isTwitchLink = TwitchRegex.test(a); const isAppleMusicLink = AppleMusicRegex.test(a); const isNostrNestsLink = NostrNestsRegex.test(a); const isWavlakeLink = WavlakeRegex.test(a); if (youtubeId) { return ( <>