import{$ as e,C as t,D as n,I as r,L as i,O as a,U as o,X as s,Z as c,_ as l,et as u,r as d,v as f,w as p,x as m}from"./app-UwMR-xl0.js";import{t as h}from"./i18n-AQND1q1G.js";import{n as g,t as _}from"./AppLayout-C-z4mIkd.js";var v={class:`mx-auto max-w-[760px]`},y={class:`mb-5 flex items-center justify-between`},b={class:`text-2xl font-extrabold tracking-tight`},x={class:`flex items-center gap-2`},S={class:`overflow-hidden rounded-c border border-line bg-surface`},C=[`onClick`],w={class:`min-w-0 flex-1`},T={class:`text-sm leading-snug text-ink`},E={key:0,class:`mt-1 truncate text-sm text-ink-muted`},D={class:`mt-1 text-xs text-ink-muted`},O={key:0,class:`mt-1.5 h-2.5 w-2.5 shrink-0 rounded-full bg-primary`},k=[`title`,`onClick`],A={key:0,class:`px-5 py-16 text-center text-ink-muted`},j={class:`mt-2 text-sm`},M=a({__name:`Index`,props:{items:{},unread:{}},setup(a){let M=a;function N(e){return e.type===`badge`?e.text||h(`You earned a badge`):e.type===`mention`?h(`{name} mentioned you in {topic}`,{name:e.actor.name,topic:e.topic.title}):e.type===`reaction`?h(`{name} reacted {emoji} to your post`,{name:e.actor.name,emoji:e.emoji??``}):h(`{name} replied in {topic}`,{name:e.actor.name,topic:e.topic.title})}function P(e){e.read||u.post(`/notifications/${e.id}/read`,{},{preserveScroll:!0}),u.visit(e.url)}function F(){u.post(`/notifications/read`,{},{preserveScroll:!0})}function I(){window.confirm(h(`Clear all notifications? This cannot be undone.`))&&u.delete(`/notifications`,{preserveScroll:!0})}function L(e){u.delete(`/notifications/${e.id}`,{preserveScroll:!0})}return(a,u)=>(r(),p(f,null,[n(s(d),{title:s(h)(`Notifications`)},null,8,[`title`]),n(_,null,{default:o(()=>[m(`div`,v,[m(`div`,y,[m(`h1`,b,e(s(h)(`Notifications`)),1),m(`div`,x,[M.unread>0?(r(),p(`button`,{key:0,type:`button`,class:`rounded-lg border border-line bg-surface px-3 py-2 text-sm font-semibold text-ink-2 hover:bg-surface-2`,onClick:F},e(s(h)(`Mark all read`)),1)):t(``,!0),M.items.length?(r(),p(`button`,{key:1,type:`button`,class:`rounded-lg border border-line bg-surface px-3 py-2 text-sm font-semibold text-ink-2 hover:border-red-500/40 hover:text-red-500`,onClick:I},e(s(h)(`Clear all`)),1)):t(``,!0)])]),m(`div`,S,[(r(!0),p(f,null,i(M.items,i=>(r(),p(`div`,{key:i.id,class:c([`group flex w-full cursor-pointer items-start gap-3 border-b border-line/60 px-5 py-4 text-left last:border-0 hover:bg-surface-2`,i.read?``:`bg-primary/10`]),onClick:e=>P(i)},[n(g,{avatar:{initials:i.actor.initials,color:i.actor.color},size:40},null,8,[`avatar`]),m(`div`,w,[m(`div`,T,e(N(i)),1),i.excerpt?(r(),p(`div`,E,e(i.excerpt),1)):t(``,!0),m(`div`,D,e(i.time),1)]),i.read?t(``,!0):(r(),p(`span`,O)),m(`button`,{type:`button`,title:s(h)(`Dismiss`),class:`-mr-1 shrink-0 rounded-md p-1 text-ink-muted opacity-0 transition hover:bg-red-500/10 hover:text-red-500 focus:opacity-100 group-hover:opacity-100`,onClick:l(e=>L(i),[`stop`])},[...u[0]||=[m(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`},[m(`path`,{d:`M18 6 6 18M6 6l12 12`})],-1)]],8,k)],10,C))),128)),M.items.length?t(``,!0):(r(),p(`div`,A,[u[1]||=m(`div`,{class:`text-3xl`},`🎉`,-1),m(`p`,j,e(s(h)(`No notifications yet — you're all caught up.`)),1)]))])])]),_:1})],64))}});export{M as default};