import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";import styled from"styled-components";import{useAtomValue}from"jotai";import{Link as LinkRouter}from"react-router-dom";import{LinkIcon}from"@redocly/theme";import{globalOptionsAtom}from"../../jotai/store";import{tryDecodeURIComponent}from"../../utils";export function Link(i){var o;const{routingBasePath:t,unstable_hooks:e,onDeepLinkClick:n}=useAtomValue(globalOptionsAtom),r=i.security?null===(o=null==e?void 0:e.replaceSecurityLink)||void 0===o?void 0:o.call(e,{securityRequirementId:i.to}):i.to,a=n&&{onClick:i=>{i.preventDefault(),n((t||"")+r)}};return r?_jsx(LinkRouter,Object.assign({"aria-label":i["aria-label"]||`link to ${r}`,id:tryDecodeURIComponent(i.id||""),className:i.className||"",to:(null==r?void 0:r.startsWith("#"))?r:(t||"")+r},a,{children:i.children})):i.children?_jsxs("span",{"aria-label":i["aria-label"]||`link to ${r}`,className:i.className,children:[" ",i.children," "]}):null}export const StyledShareLink=styled(Link)`
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-100%, -50%);
  padding-right: var(--heading-anchor-offset-right);
  z-index: 1;

  ${LinkIcon} {
    opacity: 0;
    transition:
      visibility 0.3s linear,
      opacity 0.3s linear;
  }

  :hover ${LinkIcon}, :focus ${LinkIcon} {
    visibility: visible;
    opacity: 1;
  }
`;export function ShareLink(i){return _jsx(StyledShareLink,Object.assign({},i,{children:_jsx(LinkIcon,{size:"13px",color:"--heading-anchor-color"})}))}
//# sourceMappingURL=linkify.js.map