import{u as e,j as t,O as s,r as a}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{aE as r,aF as n,az as o,aG as i,aH as u,B as c,i as l,aI as d,R as m,w as p}from"./main.chunk.N-eZ2ybB.js";import{u as f,T as j}from"./template-layout-context.chunk.B1U8ZWnY.js";import{af as g}from"./icons.chunk.BwnSC3zE.js";import{u as h}from"./use-wp-layout.chunk.BWIP3R_N.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"./forms.chunk.Bz8aaTWe.js";const w={[m.EcardTemplate.template]:__("eCard Template","growfund"),[m.PdfReceiptTemplate.template]:__("Pdf Receipt","growfund"),[m.PdfAnnualReceiptTemplate.template]:__("Pdf Annual Receipt","growfund"),[m.EmailNotificationTemplate.template]:__("Email Template","growfund")},k={[m.EcardTemplate.template]:__("eCard template saved successfully","growfund"),[m.PdfReceiptTemplate.template]:__("Pdf Receipt saved successfully","growfund"),[m.PdfAnnualReceiptTemplate.template]:__("Pdf Annual Receipt saved successfully","growfund"),[m.EmailNotificationTemplate.template]:__("Email template saved successfully","growfund")},x=()=>{const a=r(),m=e(),{isLoading:j,getCurrentForm:h,getCurrentKey:x,isCurrentFormDirty:y}=f(),T=n(),v=x();if(j)return t.jsx(o,{});const P=h(),R=T.isPending;return t.jsxs(i,{children:[t.jsx(u,{icon:t.jsx(g,{}),name:l(a)?w[a]:__("Template","growfund"),onGoBack:()=>{m(-1)},variant:"fluid",action:t.jsxs("div",{className:"growfund-flex growfund-items-center growfund-gap-3",children:[t.jsx(c,{variant:"outline",onClick:()=>{P?.reset()},disabled:R||!y,children:__("Discard","growfund")}),t.jsx(c,{onClick:()=>{P&&v&&P.handleSubmit(e=>{T.mutate({key:v,data:e},{onSuccess(){p.success(l(a)?k[a]:__("Saved successfully","growfund"))}})},e=>{console.error(e)})()},loading:R,disabled:R||!y,children:__("Save","growfund")})]})}),t.jsx(d,{children:t.jsx(s,{})})]})},y=()=>{const{hideWordpressLayout:e,showWordpressLayout:s}=h();return a.useEffect(()=>(e(),()=>{s()}),[]),t.jsx(j,{children:t.jsx(x,{})})};export{y as default};
