define(['exports', 'preact/jsx-runtime', 'preact/hooks', './Text-31cabc49', './useNavigationListItem-582f5564', './Flex-4b81b412', './Badge-b28ef084', './useComponentTheme-5aa41a8f', './classNames-08d99695', './WarningS-98a81abe', './ErrorS-d91c3db2', './InformationS-53490112', './SuccessS-eb8fd915', './UNSAFE_NavigationListCommon/themes/redwood/NavigationListItemTheme', './useTabBarItemTooltip-a81da662', './mergeProps-bcfa6a92'], (function(e,s,a,n,t,i,r,l,o,c,d,m,h,x,u,g){"use strict";const j=e=>{e.preventDefault()};function v({itemKey:e,label:v,badge:f,metadata:b,severity:p="none",removeIcon:y,icon:I,href:S,"aria-controls":C}){const N=a.useRef(null),{itemId:L,itemHandlers:T,itemClasses:F,isSelected:w,labelContainerClasses:B,labelContainerStyle:k,isIconOnly:E,isEdgeEnd:P,stackedBadgeClasses:R,iconOnlyClasses:z,isCurrent:K,showFocusRing:W}=t.useNavigationListItem({itemKey:e}),D=!("none"===p||void 0===p),H=e=>{switch(e){case"error":return s.jsx(d.SvgErrorS,{color:"danger"});case"warning":return s.jsx(c.SvgWarningS,{color:"warning"});case"info":return s.jsx(m.SvgInformationS,{color:"info"});case"confirmation":return s.jsx(h.SvgSuccessS,{color:"success"});default:return null}},{styles:{iconLabelContainer:O,iconContainer:A,startIconPadding:M,endContentPadding:U,removeIconPaddingWithEndContent:_,navigationItemMetadata:q,navigationListItemLink:G}}=l.useComponentTheme(x.NavigationListItemRedwoodTheme),J=o.classNames([q,U]),Q=o.classNames([G]),V=o.classNames([O,A,U]),X=o.classNames([!E&&O,A,!E&&M,E&&z]),{styles:{navigationlistRemoveIcon:Y}}=l.useComponentTheme(x.NavigationListItemRedwoodTheme),Z=b||D||f,$=o.classNames([Y,Z&&_,!Z&&U]),ee=null!=S,se=v&&!(" "===v&&void 0===v),ae=I&&null!=I&&E,ne=ae,{tooltipContent:te,tooltipEventHandlerProps:ie,onLogicalFocus:re,onLogicalBlur:le}=u.useTabBarItemTooltip({label:v,isDisabled:!ne,position:P?"start":"end"});ne&&(K&&W||w?re(N.current):K&&W||le());const oe=()=>s.jsxs(s.Fragment,{children:[I&&s.jsx(i.Flex,{justify:"start",children:s.jsx("span",{class:X,children:I})}),!E&&se&&s.jsx(i.Flex,{align:"center",justify:"start",flex:"1 1 auto",children:s.jsx("span",{class:B,style:k,children:s.jsx(n.Text,{size:"inherit",weight:"inherit",variant:"inherit",children:v})})}),y&&!ee&&s.jsx("span",{class:$,children:y})]}),ce=()=>s.jsxs(s.Fragment,{children:[ae&&s.jsxs("div",{class:X,children:[I,s.jsx("span",{class:R,children:f?s.jsx(r.Badge,{size:"xs",variant:"neutral",children:f}):null})]}),!E&&I&&s.jsx(i.Flex,{justify:"start",children:s.jsx("span",{class:X,children:I})}),(!E||E&&!ae)&&se&&s.jsx(i.Flex,{align:"center",justify:"start",flex:"1 1 auto",children:s.jsx("span",{class:B,style:k,children:s.jsx(n.Text,{size:"inherit",weight:"inherit",variant:"inherit",children:v})})}),(b||D||f||y)&&s.jsxs(i.Flex,{align:"center",justify:"end",children:[" ",(!E||E&&!ae)&&f&&s.jsx("span",{class:V,children:s.jsx(r.Badge,{size:"md",variant:"neutralSubtle",children:f})}),b&&s.jsx("span",{class:J,children:s.jsx(n.Text,{children:"( "+b+" )"})}),D&&s.jsx("span",{class:V,children:H(p)}),y&&!ee&&s.jsx("span",{class:$,children:y})]})]});return ee?s.jsx("div",{...T,class:F,children:s.jsx("a",{tabindex:-1,role:"tab","data-oj-key":e,id:L,class:Q,"aria-selected":w,"aria-controls":C,href:S,onClick:j,children:Z?ce():oe()})}):s.jsxs("div",{role:"tab",...g.mergeProps(ie,T),"data-oj-key":e,id:L,class:F,"aria-selected":w,ref:N,"aria-controls":C,children:[Z?ce():oe(),E&&te]})}e.BaseNavigationListItem=v,e.NavigationListLinkItem=function({itemKey:e,badge:a,metadata:n,severity:t,href:i,label:r,"aria-controls":l}){return s.jsx(v,{"aria-controls":l,itemKey:e,label:r,badge:a,metadata:n,severity:t,href:i})}}));
//# sourceMappingURL=NavigationListLinkItem-df1826e6.js.map
