import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Tag } from '@rspress/core/theme';
import { isExternalUrl, withoutBase, } from '@rspress/shared';
import { useMemo } from 'react';
import styles from '../../../styles/versions-nav.module.scss';
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 : ''} text-sm font-medium ${compact ? 'mx-0.5' : 'mx-1.5'} px-3 py-2 flex items-center`, children: [_jsx(Tag, { tag: tag }), text, rightIcon] }) }, link));
}
