import { jsx as _jsx } from "react/jsx-runtime";
import { memo } from 'react';
import { markdownLinksCss } from '@redocly/theme/components/Markdown/styles/links';
import { normalizeText } from '../../utils/index.js';
import { styled } from '../../styled-components.js';
const LinkWrap = styled.div `
  ${markdownLinksCss};
  ${({ compact }) => (!compact ? 'margin: var(--spacing-sm) 0 0' : '')}
`;
function ExternalDocumentationComponent({ externalDocs, compact, }) {
    if (!externalDocs || !externalDocs.url) {
        return null;
    }
    const description = normalizeText(externalDocs.description);
    return (_jsx(LinkWrap, { compact: compact, "data-testid": "external-documentation", children: _jsx("a", { href: externalDocs.url, target: "_blank", rel: "noreferrer", "aria-label": description || externalDocs.url, children: description || externalDocs.url }) }));
}
export const ExternalDocumentation = memo(ExternalDocumentationComponent);
//# sourceMappingURL=ExternalDocumentation.js.map