import { jsx as _jsx } from "react/jsx-runtime";
import NextLink from "next/link";
import { cn } from "../../../utils/cn";
const variantStyles = {
    default: "text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-white",
    primary: "text-primary-600 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-300",
    secondary: "text-secondary-600 dark:text-secondary-400 hover:text-secondary-700 dark:hover:text-secondary-300",
};
export const Link = ({ href, children, variant = "default", className, external = false, onClick, onMouseEnter, onFocus, testId, }) => {
    const classes = cn("transition-colors underline underline-offset-1", variantStyles[variant], className);
    const hrefStr = typeof href === "string" ? href : "#";
    if (external || hrefStr.startsWith("http")) {
        return (_jsx("a", { href: hrefStr, className: classes, target: "_blank", rel: "noopener noreferrer", onClick: onClick, onMouseEnter: onMouseEnter, onFocus: onFocus, "aria-label": typeof children === "string" ? undefined : `External link: ${href}`, "data-testid": testId, children: children }));
    }
    return (_jsx(NextLink, { href: hrefStr, className: classes, onClick: onClick, onMouseEnter: onMouseEnter, onFocus: onFocus, "data-testid": testId, children: children }));
};
export default Link;
