import{c as a,bD as d,b1 as v,bE as i,r as g,bF as t,j as s,bG as f,bH as x,bI as C}from"./index-DCNLpqIv.js";function k(o,e){switch(o){case i.XSMALL:return{padding:`${e.spacing.twoXS} ${e.spacing.sm}`,fontSize:e.fontSizes.sm};case i.SMALL:return{padding:`${e.spacing.twoXS} ${e.spacing.md}`};case i.LARGE:return{padding:`${e.spacing.md} ${e.spacing.md}`};default:return{padding:`${e.spacing.xs} ${e.spacing.md}`}}}const b=a("a",{target:"e16zdaao3"})(({containerWidth:o,size:e,theme:r})=>({display:"inline-flex",alignItems:"center",justifyContent:"center",fontWeight:r.fontWeights.normal,padding:`${r.spacing.xs} ${r.spacing.md}`,borderRadius:r.radii.button,minHeight:r.sizes.minElementHeight,margin:0,lineHeight:r.lineHeights.base,color:r.colors.primary,textDecoration:"none",width:o?"100%":"auto",userSelect:"none","&:visited":{color:r.colors.primary},"&:focus":{outline:"none"},"&:focus-visible":{boxShadow:`0 0 0 0.2rem ${v(r.colors.primary,.5)}`},"&:hover":{textDecoration:"none"},"&:active":{textDecoration:"none"},...k(e,r)}),""),y=a(b,{target:"e16zdaao2"})(({theme:o})=>({backgroundColor:o.colors.primary,color:o.colors.white,border:`${o.sizes.borderWidth} solid ${o.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:d(o.colors.primary,.15),borderColor:d(o.colors.primary,.15)},"&:active":{backgroundColor:o.colors.primary,borderColor:d(o.colors.primary,.15)},"&:visited:not(:active)":{color:o.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),""),$=a(b,{target:"e16zdaao1"})(({theme:o})=>({backgroundColor:o.colors.lightenedBg05,color:o.colors.bodyText,border:`${o.sizes.borderWidth} solid ${o.colors.borderColor}`,"&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"&:active":{backgroundColor:o.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),""),z=a(b,{target:"e16zdaao0"})(({theme:o})=>({padding:o.spacing.none,backgroundColor:o.colors.transparent,color:o.colors.bodyText,border:"none","&:visited":{color:o.colors.bodyText},"&:hover, &:focus-visible":{color:o.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:"inherit !important"}},"&:active":{color:d(o.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}}),"");function T({kind:o,size:e,disabled:r,children:n,autoFocus:l,href:u,rel:p,target:h,onClick:m}){let c=y;return o===t.SECONDARY?c=$:o===t.TERTIARY&&(c=z),s.jsx(c,{kind:o,size:e||i.MEDIUM,containerWidth:!0,disabled:r||!1,autoFocus:l||!1,href:u,target:h,rel:p,onClick:m,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${o}`,children:n})}const w=g.memo(T);function S(o){const{element:e}=o;let r=t.SECONDARY;e.type==="primary"?r=t.PRIMARY:e.type==="tertiary"&&(r=t.TERTIARY);const n=l=>{e.disabled&&l.preventDefault()};return s.jsx(f,{className:"stLinkButton","data-testid":"stLinkButton",children:s.jsx(x,{help:e.help,containerWidth:!0,children:s.jsx(w,{kind:r,size:i.SMALL,disabled:e.disabled,onClick:n,href:e.url,target:"_blank",rel:"noreferrer","aria-disabled":e.disabled,children:s.jsx(C,{icon:e.icon,label:e.label})})})})}const L=g.memo(S);export{L as default};
