import{j as o,r}from"./router.chunk.YsRm4bSN.js";import{T as e,n,k as s,aA as t,C as a,aJ as c,Z as l,J as d}from"./main.chunk.N-eZ2ybB.js";import{u as i,c as u,d as m,e as f,f as g,k as h}from"./forms.chunk.Bz8aaTWe.js";import{T as p,a as w,b as j,c as x,d as k}from"./template.chunk.DPZ5D-on.js";import{O as y}from"./option-keys.chunk.CTqS8AT8.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";import{E as b}from"./editor-field.chunk.851uyGBn.js";import{u as _}from"./template-layout-context.chunk.B1U8ZWnY.js";import{a as v}from"./use-update-dirty-state.chunk.Bh3v76yr.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"./icons.chunk.BwnSC3zE.js";import"./date-utils.chunk.DWRtWTmT.js";import"./radio-group.chunk.BTBtVnZk.js";import"./separator.chunk.3HcpyIlz.js";import"./media-field.chunk.B--jhwMa.js";import"./media.chunk.BUcAGRSV.js";import"./charts.chunk.BbweDdoQ.js";import"./range-slider-field.chunk.lLx6oBQy.js";const C=({shortCodes:r})=>{const n=i();return o.jsxs("div",{className:"growfund-w-full growfund-space-y-4",children:[o.jsx(e,{control:n.control,name:"content.greetings",label:__("Greetings","growfund"),placeholder:`${__("Dear","growfund")} {tribute_notification_receiver}`,shortCodes:[{label:"Notification Recipient",value:"{tribute_notification_receiver}"}]}),o.jsx(b,{control:n.control,name:"content.description",label:__("Description","growfund"),shortCodes:r,rows:4})]})},N=()=>{const r=i(),e=u({control:r.control,name:"content.greetings"}),a=u({control:r.control,name:"content.description"}),c=u({control:r.control,name:"media.image"}),l=u({control:r.control,name:"media.height"}),d=u({control:r.control,name:"media.position"}),m=u({control:r.control,name:"colors.greetings"}),f=u({control:r.control,name:"colors.background"}),g=u({control:r.control,name:"colors.text_color"}),h=u({control:r.control,name:"colors.secondary_text_color"});return o.jsxs(n,{className:"growfund-overflow-hidden growfund-text-black growfund-w-[24rem]",style:{backgroundColor:f??""},children:[o.jsx("div",{className:"growfund-w-full growfund-flex",style:{justifyContent:d,height:l?`${l}px`:""},children:o.jsx(s,{src:c?.url??"/images/ecard.webp",alt:"e-card image",className:"growfund-p-0 growfund-m-0 growfund-rounded-none",fit:"contain",style:{backgroundColor:f??""}})}),o.jsxs("div",{className:"growfund-pt-4 growfund-pb-6 growfund-px-8",children:[o.jsx("div",{className:"growfund-typo-small growfund-font-semibold",style:{color:m??""},children:e&&e}),o.jsx("div",{className:"growfund-mt-2",style:{color:g??""},children:o.jsx("div",{dangerouslySetInnerHTML:{__html:a}})}),o.jsxs("div",{className:"growfund-flex growfund-flex-col growfund-gap-2 growfund-p-0 growfund-m-0 growfund-mt-5",children:[o.jsx("div",{className:"growfund-typo-tiny",style:{color:h??""},children:__("March 26, 2026","growfund")}),o.jsx(t,{className:"growfund-h-5",viewBox:"0 0 210 24"})]})]})]})},E=({shortCodes:r})=>{const e=i();return o.jsx(a,{className:"growfund-mt-6",children:o.jsxs("div",{className:"growfund-flex growfund-justify-center growfund-gap-6",children:[o.jsx("div",{className:"growfund-flex-col",children:o.jsxs("div",{className:"growfund-w-[29rem] growfund-space-y-4",children:[o.jsx(p,{namePrefix:"media",control:e.control,header:__("eCard Image","growfund"),minRangeHeight:12,maxRangeHeight:480}),o.jsx(w,{header:__("Contents","growfund"),description:__("Manage the pdf contents from here","growfund"),children:o.jsx(C,{shortCodes:r})}),o.jsx(j,{control:e.control,fields:[{name:"colors.background",label:__("Background","growfund")},{name:"colors.greetings",label:__("Greetings","growfund")},{name:"colors.text_color",label:__("Text Color","growfund")},{name:"colors.secondary_text_color",label:__("Secondary Text Color","growfund")}],header:__("Colors","growfund"),description:__("Style how the emails look like","growfund")})]})}),o.jsx("div",{className:"growfund-flex-col growfund-sticky growfund-top-[calc(var(--growfund-topbar-height)+var(--growfund-spacing)_*_1.5)] growfund-h-full",children:o.jsx(N,{})})]})})},T=m({background:g().nullish(),text_color:g().nullish(),secondary_text_color:g().nullish(),greetings:g().nullish()}),M=m({greetings:g(),description:g()}),R=m({media:x.default({image:null,height:"326",position:"center"}),content:M,colors:T,short_codes:f(m({value:g(),label:g()})).optional()}).omit({short_codes:!0}),A=()=>{const e=r.useRef(null),n=c(y.ECARD_TEMPLATE),s=r.useMemo(()=>n.data?n.data:{},[n.data]),t=h({resolver:d(R),defaultValues:l(R)});r.useEffect(()=>{0!==Object.keys(s).length&&t.reset.call(null,s)},[s,t.reset]);const{registerForm:a}=_();return r.useEffect(()=>{const o=a(y.ECARD_TEMPLATE,t);return()=>{o()}},[a]),v(t),o.jsx(k,{form:t,ref:e,children:o.jsx(E,{shortCodes:s.short_codes})})};export{A as default};
