import{C as e,D as t,F as n,H as r,N as i,Q as a,S as o,T as s,_ as c,a as l,b as u,et as d,q as f,x as p}from"./app-ZDsCoklL.js";import{t as m}from"./PrimaryButton-BWV8KpTQ.js";import{a as h,i as g,r as _,t as v}from"./push-Cl6j2SWS.js";import{t as y}from"./SecondaryButton-BjiwokQd.js";var b={class:`mt-6`},x={key:0,class:`text-sm text-gray-500 dark:text-gray-400`},S={key:2,class:`mt-2 text-sm text-green-600 dark:text-green-400`},C={key:3,class:`mt-2 text-sm text-red-600 dark:text-red-400`},w=t({__name:`PushToggle`,setup(t){let d=l(),w=()=>d.props.pushKey??``,T=f(!1),E=f(!1),D=f(!1),O=f(``);i(async()=>{T.value=_()&&!!w(),T.value&&(E.value=!!await v())});async function k(){O.value=``,D.value=!0;try{await g(w())?E.value=!0:O.value=`Permission was denied or push is unavailable.`}catch(e){O.value=e?.message??`Could not enable push.`}finally{D.value=!1}}async function A(){D.value=!0;try{await h(),E.value=!1}catch(e){O.value=e?.message??`Could not disable push.`}finally{D.value=!1}}return(t,i)=>(n(),e(`section`,null,[i[0]||=u(`header`,null,[u(`h2`,{class:`text-lg font-medium text-gray-900 dark:text-gray-100`},`Push notifications`),u(`p`,{class:`mt-1 text-sm text-gray-600 dark:text-gray-400`},` Get browser notifications for replies, mentions and reactions — even when Convoro isn't open. `)],-1),u(`div`,b,[T.value?(n(),e(c,{key:1},[E.value?(n(),p(y,{key:1,disabled:D.value,onClick:A},{default:r(()=>[s(a(D.value?`Disabling…`:`Disable push notifications`),1)]),_:1},8,[`disabled`])):(n(),p(m,{key:0,disabled:D.value,onClick:k},{default:r(()=>[s(a(D.value?`Enabling…`:`Enable push notifications`),1)]),_:1},8,[`disabled`])),E.value?(n(),e(`p`,S,`Push is enabled on this device.`)):o(``,!0),O.value?(n(),e(`p`,C,a(O.value),1)):o(``,!0)],64)):(n(),e(`p`,x,` Push isn't available in this browser (or the site isn't served over HTTPS). `))])]))}}),T=d({default:()=>E}),E=w;export{T as n,E as t};