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