import { forwardRef } from "react"; import { Link } from "react-router"; type AnchorProps = React.AnchorHTMLAttributes & { to?: string }; export function isDocumentHref(href: string): boolean { return !href.startsWith("/") || href.startsWith("//") || /^\/[^/]+\/raw\//.test(href); } export const AppLink = forwardRef(function AppLink({ href, to, ...rest }, ref) { const target = href ?? to ?? ""; if (isDocumentHref(target) || rest.target || rest.download !== undefined) return ; return ; });