{"version":3,"file":"BaseLink-CDL2WhjE.js","sources":["../../../resources/js/Components/BaseLink.tsx"],"sourcesContent":["import React from \"react\";\nimport { InertiaLinkProps, Link as InertiaLink } from \"@inertiajs/react\";\n\ninterface AProps {\n    href: string;\n    target?: string;\n    external?: boolean;\n    as?: string;\n    children: React.ReactNode;\n    className?: string;\n    download?: boolean;\n    title?: string;\n}\n\nconst A: React.FC<AProps> = ({ children, ...props }) => {\n    const target = props.target ? props.target : \"_blank\";\n\n    return (\n        <a {...props} target={target}>\n            {children}\n        </a>\n    );\n};\n\nexport interface LinkProps extends AProps {\n    method?: InertiaLinkProps[\"method\"];\n    prefetch?: InertiaLinkProps[\"prefetch\"];\n    cacheFor?: InertiaLinkProps[\"cacheFor\"];\n}\n\nconst Link: React.FC<LinkProps> = (props) => {\n    return <InertiaLink {...props} />;\n};\n\nconst BaseLink = ({ external, children, target, ...props }: LinkProps) => {\n    const v1 = props.href.startsWith(\"/v1\");\n    if (external || target === \"_blank\" || v1) {\n        return (\n            <A {...props} target={v1 ? \"_self\" : target}>\n                {children}\n            </A>\n        );\n    }\n\n    // eslint-disable-next-line prefer-const\n    let { as, ...otherProps } = props;\n\n    if (as === \"a\" && props.method !== \"get\") {\n        as = \"button\";\n    }\n\n    return (\n        <Link as={as} {...otherProps}>\n            {children}\n        </Link>\n    );\n};\n\nexport default BaseLink;\n"],"names":["A","children","props","target","jsx","Link","InertiaLink","BaseLink","external","v1","as","otherProps"],"mappings":"6CAcA,MAAMA,EAAsB,CAAC,CAAE,SAAAC,EAAU,GAAGC,KAAY,CACpD,MAAMC,EAASD,EAAM,OAASA,EAAM,OAAS,SAE7C,OACKE,EAAAA,IAAA,IAAA,CAAG,GAAGF,EAAO,OAAAC,EACT,SAAAF,EACL,CAER,EAQMI,EAA6BH,GACxBE,MAACE,EAAa,CAAA,GAAGJ,CAAO,CAAA,EAG7BK,EAAW,CAAC,CAAE,SAAAC,EAAU,SAAAP,EAAU,OAAAE,EAAQ,GAAGD,KAAuB,CACtE,MAAMO,EAAKP,EAAM,KAAK,WAAW,KAAK,EAClC,GAAAM,GAAYL,IAAW,UAAYM,EAE/B,OAAAL,EAAA,IAACJ,GAAG,GAAGE,EAAO,OAAQO,EAAK,QAAUN,EAChC,SAAAF,EACL,EAKR,GAAI,CAAE,GAAAS,EAAI,GAAGC,CAAA,EAAeT,EAE5B,OAAIQ,IAAO,KAAOR,EAAM,SAAW,QAC1BQ,EAAA,UAIJN,EAAAA,IAAAC,EAAA,CAAK,GAAAK,EAAS,GAAGC,EACb,SAAAV,EACL,CAER"}