import{r as e,j as s}from"./router.chunk.YsRm4bSN.js";import{ae as r}from"./icons.chunk.BwnSC3zE.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{c8 as t,Z as n,J as a,c9 as i,K as o,r as c,x as l,y as d,z as u,aj as m,G as f,ba as p,E as g}from"./main.chunk.N-eZ2ybB.js";import{k as h}from"./forms.chunk.Bz8aaTWe.js";import{S as j}from"./switch-field.chunk.CouXKsOC.js";import{B as _,D as w}from"./user.chunk.pqINMGd0.js";import"./react-jsx-runtime.chunk.ATkk6v2S.js";import"./react.js";import"./react-dom-client.chunk.BMQ1litG.js";import"./react-dom.js";import"./pdf-core.chunk.D33I_Wdh.js";import"./ui-radix.chunk.Xzokq_Gv.js";import"./utils.chunk.C1IATKsN.js";import"./date-utils.chunk.DWRtWTmT.js";import"./switch.chunk.BWrU_4pe.js";import"./settings.chunk.D9nMP-Um.js";const x=()=>{const{registerForm:r,setIsCurrentFormDirty:c,user:l}=t(),d=h({resolver:a(_),defaultValues:n(_)});return e.useEffect(()=>{l?.notification_settings&&d.reset.call(null,l.notification_settings)},[l,d.reset]),e.useEffect(()=>{const e=r(i.Notifications,d);return()=>{e()}},[r]),e.useEffect(()=>{c(d.formState.isDirty)},[d.formState.isDirty,c]),s.jsx(o,{...d,children:s.jsxs("form",{className:"growfund-space-y-6",children:[s.jsx(j,{control:d.control,name:"is_enabled_backer_email_campaign_post_update",label:__("Campaign Updates","growfund"),description:__("Receive an email when a campaign is updated.","growfund")}),s.jsx(j,{control:d.control,name:"is_enabled_backer_email_campaign_half_funded",label:__("Campaign 50% Funded","growfund"),description:__("Celebrate and inform backers when a campaign reaches 50% of its goal.","growfund")}),s.jsx(j,{control:d.control,name:"is_enabled_backer_email_reward_delivered",label:__("Rewards Delivered","growfund"),description:__("Receive an email when a reward is delivered.","growfund")})]})})},b=()=>{const{registerForm:r,setIsCurrentFormDirty:c,user:l}=t(),d=h({resolver:a(w),defaultValues:n(w)});return e.useEffect(()=>{l?.notification_settings&&d.reset.call(null,l.notification_settings)},[l,d.reset]),e.useEffect(()=>{const e=r(i.Notifications,d);return()=>{e()}},[r]),e.useEffect(()=>{c(d.formState.isDirty)},[d.formState.isDirty,c]),s.jsx(o,{...d,children:s.jsxs("form",{className:"growfund-space-y-6",children:[s.jsx(j,{control:d.control,name:"is_enabled_donor_email_campaign_post_update",label:__("Campaign Update","growfund"),description:__("Get notified about campaign updates.","growfund")}),s.jsx(j,{control:d.control,name:"is_enabled_donor_email_campaign_half_milestone_achieved",label:__("50% Milestone Achieved","growfund"),description:__("Celebrate and inform donors when a campaign reaches 50% of its goal.","growfund")})]})})},k=()=>{const{user:e}=t();if(!e)return null;const n=c.get("FundraiserNotificationSettingsForm");return s.jsxs("div",{className:"growfund-w-full growfund-space-y-3",children:[s.jsx("p",{className:"growfund-typo-small growfund-font-semibold growfund-text-fg-primary growfund-mt-2",children:__("Notifications","growfund")}),s.jsxs(l,{children:[s.jsxs(d,{children:[s.jsxs(u,{className:"growfund-flex growfund-items-center growfund-gap-2",children:[s.jsx(r,{}),__("Email Notifications","growfund")]}),s.jsx(m,{children:__("Choose which email notifications you want to receive.","growfund")})]}),s.jsxs(f,{children:[e.active_role===p.BACKER&&s.jsx(x,{}),e.active_role===p.DONOR&&s.jsx(b,{}),e.active_role===p.FUNDRAISER&&s.jsx(g,{children:n&&s.jsx(n,{})})]})]})]})};export{k as default};
