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