import{z as s,r as p,X as x,l as b,j as i,a as k,P as v,o as y,Y as g,q as L}from"./index.Drusyo5m.js";import{m as C}from"./iconPosition.B4EEXI3E.js";const S=s("div",{target:"e175gajv0"})({display:"flex",flexDirection:"column",width:"100%"}),P=s("a",{target:"e175gajv1"})(({disabled:e,isCurrentPage:r,theme:o})=>({textDecoration:"none",width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:o.spacing.sm,borderRadius:o.radii.default,paddingLeft:o.spacing.sm,paddingRight:o.spacing.sm,marginTop:o.spacing.threeXS,marginBottom:o.spacing.threeXS,lineHeight:o.lineHeights.menuItem,backgroundColor:r?o.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:r?o.colors.darkenedBgMix25:o.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:o.colors.darkenedBgMix15},"@media print":{paddingLeft:o.spacing.none},...e?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed","&:hover":{color:o.colors.fadedText40,backgroundColor:o.colors.transparent}}:{}})),T=s("span",{target:"e175gajv2"})(({disabled:e,theme:r})=>({color:r.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...e?{borderColor:r.colors.borderColor,backgroundColor:r.colors.transparent,color:r.colors.fadedText40,cursor:"not-allowed"}:{}}));function h(e){let r=e.page;if(e.queryString)if(e.external)try{const o=new URL(e.page);new URLSearchParams(e.queryString).forEach((t,a)=>o.searchParams.append(a,t)),r=o.toString()}catch{const[o,n]=r.split("#");r=o+(o.includes("?")?"&":"?")+e.queryString+(n?"#"+n:"")}else r+=(r.includes("?")?"&":"?")+e.queryString;return r}function w(e){const{onPageChange:r,currentPageScriptHash:o}=p.useContext(x),{colors:n}=b(),{disabled:t,element:a}=e,l=o===a.pageScriptHash,u=d=>{a.external?t&&d.preventDefault():(d.preventDefault(),t||r(a.pageScriptHash,a.queryString))},c=C(a.iconPosition),f=h(a);return i("div",{className:"stPageLink","data-testid":"stPageLink",children:i(k,{help:a.help,placement:v.TOP_RIGHT,containerWidth:!0,children:i(S,{children:y(P,{"data-testid":"stPageLink-NavLink",disabled:t,isCurrentPage:l,href:f,target:a.external?"_blank":"",rel:"noreferrer",onClick:u,children:[a.icon&&c==="left"&&i(g,{size:"lg",color:t?n.fadedText40:n.bodyText,iconValue:a.icon}),i(T,{disabled:t,children:i(L,{source:a.label,allowHTML:!1,isLabel:!0,boldLabel:l,largerLabel:!0,disableLinks:!0})}),a.icon&&c==="right"&&i(g,{size:"lg",color:t?n.fadedText40:n.bodyText,iconValue:a.icon})]})})})})}const j=p.memo(w);export{j as default};
