import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { isExternalUrl } from '@rspress/shared';
import { useMemo } from 'react';
import { Tag } from 'rspress/theme';
import styles from '../../../styles/versions-nav.module.scss';
import { withoutBase } from '../../shared/index.js';
export function NavMenuSingleItem({ activeMatch, base, compact, download, link, pathname, rightIcon, text, tag, }) {
    const isActive = useMemo(() => !!base &&
        !!pathname &&
        new RegExp(activeMatch || link).test(withoutBase(pathname, base)), [activeMatch, base, link, pathname]);
    return (_jsx("a", { href: link, download: download, target: isExternalUrl(link) ? '_blank' : undefined, rel: "noopener noreferrer", children: _jsxs("div", { className: `rspress-nav-menu-item ${styles.singleItem} ${isActive ? `${styles.activeItem} rspress-nav-menu-item-active` : ''} rp-text-sm rp-font-medium ${compact ? 'rp-mx-0.5' : 'rp-mx-1.5'} rp-px-3 rp-py-2 rp-flex rp-items-center`, children: [_jsx(Tag, { tag: tag }), text, rightIcon] }) }, link));
}
