import{Ja as e,Qa as t,ai as n,an as r,in as i,io as a,nr as o,on as s,rn as c,tr as l,vr as u}from"./index.dkY5s53S.js";import{t as d}from"./iconPosition.CY47f4C7.js";var f=a(t(),1);function p(e,t){switch(e){case o.XSMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.sm}`,fontSize:t.fontSizes.sm};case o.SMALL:return{padding:`${t.spacing.twoXS} ${t.spacing.md}`};case o.LARGE:return{padding:`${t.spacing.md} ${t.spacing.md}`};default:return{padding:`${t.spacing.xs} ${t.spacing.md}`}}}var m=u(`a`,{target:`evo6qzw0`})(({containerWidth:e,size:t,theme:n})=>({display:`inline-flex`,alignItems:`center`,justifyContent:`center`,fontWeight:n.fontWeights.normal,padding:`${n.spacing.xs} ${n.spacing.md}`,borderRadius:n.radii.button,minHeight:n.sizes.minElementHeight,margin:0,lineHeight:n.lineHeights.base,color:n.colors.primary,textDecoration:`none`,width:e?`100%`:`auto`,userSelect:`none`,"&:visited":{color:n.colors.primary},"&:focus":{outline:`none`},"&:focus-visible":{boxShadow:n.shadows.focusRing},"&:hover":{textDecoration:`none`},"&:active":{textDecoration:`none`},...p(t,n)})),h=u(m,{target:`evo6qzw1`})(({theme:e})=>({backgroundColor:e.colors.primary,color:e.colors.white,border:`${e.sizes.borderWidth} solid ${e.colors.primary}`,"&:hover, &:focus-visible":{backgroundColor:n(e.colors.primary,.15),borderColor:n(e.colors.primary,.15)},"&:active":{backgroundColor:e.colors.primary,borderColor:n(e.colors.primary,.15)},"&:visited:not(:active)":{color:e.colors.white},"&[disabled], &[disabled]:hover, &[disabled]:active, &[disabled]:visited":{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:`not-allowed`}})),g=u(m,{target:`evo6qzw2`})(({theme:e})=>({backgroundColor:e.colors.lightenedBg05,color:e.colors.bodyText,border:`${e.sizes.borderWidth} solid ${e.colors.borderColor}`,"&:visited":{color:e.colors.bodyText},"&:hover, &:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"&:active":{backgroundColor:e.colors.darkenedBgMix25},"&[disabled], &[disabled]:hover, &[disabled]:active":{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:`not-allowed`}})),_=u(m,{target:`evo6qzw3`})(({theme:e})=>({padding:e.spacing.none,backgroundColor:e.colors.transparent,color:e.colors.bodyText,border:`none`,"&:visited":{color:e.colors.bodyText},"&:hover, &:focus-visible":{color:e.colors.primary},"&:hover:not([disabled]), &:focus-visible:not([disabled])":{"span.stMarkdownColoredText":{color:`inherit !important`}},"&:active":{color:n(e.colors.primary,.25)},"&[disabled], &[disabled]:hover, &[disabled]:active":{backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:`not-allowed`}})),v=(0,f.forwardRef)(function({kind:t,size:n,disabled:r,children:i,autoFocus:a,href:s,rel:c,target:u,onClick:d},f){let p=h;return t===l.SECONDARY?p=g:t===l.TERTIARY&&(p=_),e(p,{ref:f,kind:t,size:n||o.MEDIUM,containerWidth:!0,disabled:r||!1,autoFocus:a||!1,href:s,target:u,rel:c,onClick:d,tabIndex:r?-1:0,"data-testid":`stBaseLinkButton-${t}`,children:i})});v.displayName=`BaseLinkButton`;var y=(0,f.memo)(v);function b(t){let{element:n,widgetMgr:a,fragmentId:u}=t,p=n.shortcut||void 0,m=l.SECONDARY;n.type===`primary`?m=l.PRIMARY:n.type===`tertiary`&&(m=l.TERTIARY);let h=(0,f.useRef)(null),g=(0,f.useCallback)(()=>{n.disabled||h.current?.click()},[n.disabled]),_=(0,f.useCallback)(e=>{if(n.disabled){e.preventDefault();return}!n.ignoreRerun&&n.id&&a.setTriggerValue(n,{fromUi:!0},u)},[n,u,a]);return i({shortcut:p,disabled:n.disabled,onActivate:g}),e(s,{className:`stLinkButton`,"data-testid":`stLinkButton`,children:e(r,{help:n.help,containerWidth:!0,children:e(y,{ref:h,kind:m,size:o.SMALL,disabled:n.disabled,onClick:_,href:n.url,target:`_blank`,rel:`noreferrer`,"aria-disabled":n.disabled,children:e(c,{icon:n.icon,iconPosition:d(n.iconPosition),label:n.label,shortcut:p})})})})}var x=(0,f.memo)(b);export{x as default};