import{t as e}from"../chunks/createLucideIcon-CYyWUN7r.js";import{createCommentVNode as t,createElementBlock as n,createVNode as r,onBeforeUnmount as i,onMounted as a,openBlock as o,ref as s,toDisplayString as c,unref as l}from"vue";import{http as u}from"@inhaus/ui";var d=e({name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]}),f=[`aria-label`,`title`],p={key:0,class:`ih:absolute ih:top-0.5 ih:right-0.5 ih:grid ih:h-4 ih:min-w-4 ih:place-items-center ih:rounded-full ih:bg-brand ih:px-1 ih:text-[10px] ih:font-semibold ih:text-brand-foreground ih:tabular-nums`,"aria-hidden":`true`},m={__name:`Unread`,props:{unread:{type:Number,default:0}},setup(e){let m=s(e.unread),h,g=e=>m.value=e.detail;async function _(){document.visibilityState===`visible`&&!location.pathname.startsWith(`/chat`)&&(m.value=(await u.get(`/chat/api/ungelesen`).catch(()=>({unread:m.value}))).unread)}return a(()=>{window.addEventListener(`inhaus-chat:unread`,g),h=setInterval(_,3e4)}),i(()=>{window.removeEventListener(`inhaus-chat:unread`,g),clearInterval(h)}),(e,i)=>(o(),n(`a`,{href:`/chat`,class:`ih:relative ih:grid ih:size-9 ih:place-items-center ih:rounded-md ih:text-muted-foreground ih:transition-colors ih:hover:bg-accent ih:hover:text-foreground`,"aria-label":m.value?`Nachrichten, ${m.value} ungelesen`:`Nachrichten`,title:m.value?`${m.value} ungelesene Nachrichten`:`Nachrichten`},[r(l(d),{class:`ih:size-5`}),m.value?(o(),n(`span`,p,c(m.value>99?`99+`:m.value),1)):t(``,!0)],8,f))}};export{m as default};