import{a7 as o,a8 as i,j as e,a9 as c,aa as u,T as m,ab as d,ac as r,n as h,P as b}from"./index-CHfgriyV.js";import{u as g}from"./useSuspenseQuery-Cya_zjFk.js";import{M as p}from"./main-D1eRPv4V.js";import{a as x}from"./mutations-CwRupjuz.js";import"./useMutation-DgMLlnbr.js";function C(){const n=g(c()),s=o.useNavigate(),t=i();return n.data.__type==="unauthenticated"?(s({to:"/login",search:{returnUrl:t.state.location.pathname}}),null):e.jsx(v,{alertingSettings:n.data.configuration})}function v({alertingSettings:n}){const s=x(),t=u({defaultValues:{enabled:n.enabled,email:n.email_report},onSubmit:a=>{s.mutate({enabled:a.value.enabled,email_report:a.value.email},{onError:l=>{t.reset(),b({content:{children:l.toString(),variant:"error"}})}})}});return e.jsx(p,{title:"Settings",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(m,{weight:"medium",className:"text-secondary",children:"Alerting properties"}),e.jsxs(d,{handleSubmit:t.handleSubmit,className:"flex flex-col gap-4",children:[e.jsx(t.Field,{name:"enabled",children:a=>e.jsx(r,{"aria-label":`${a.state.value?"Disable":"Enable"} alerting service at plakar.io`,title:e.jsxs(e.Fragment,{children:["Enable alerting service at"," ",e.jsx("strong",{className:"text-accent",children:"plakar.io"})]}),description:"Securely send concise task summaries to your account on our servers—your backup data stays on your side.",isSelected:a.state.value,onChange:a.handleChange,onBlur:a.handleBlur}),listeners:{onChange:t.handleSubmit}}),n.enabled&&e.jsx(t.Field,{name:"email",children:a=>e.jsx(r,{"aria-label":`${a.state.value?"Disable":"Receive"} alerts by email`,title:"Receive alerts by email",description:"Get issue notifications and weekly backup summaries—only metadata, never your actual data.",isSelected:a.state.value,onChange:a.handleChange,onBlur:a.handleBlur}),listeners:{onChange:t.handleSubmit}}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(r,{"aria-label":"Enable alerting to custom webhook",title:"Enable alerting to custom webhook",description:"Send alerts to your own webhook URL for custom processing.",isDisabled:!0}),e.jsx(h,{variant:"brand",leftIcon:"bell",children:"Available soon"})]})]})]})})}export{C as component};
