import{r as e,j as t}from"./router.chunk.YsRm4bSN.js";import{k as n,l as o,V as a,I as r,T as i,m as s}from"./pdf-core.chunk.D33I_Wdh.js";import{_ as __,s as sprintf}from"./wordpress.chunk.BVds2GcU.js";import{S as d}from"./donation.chunk.D76CvJSa.js";import{c4 as l,c5 as c,i as u,D as m,A as g,av as f,l as p,u as h,$ as j,L as _,N as x,aC as w,aD as b,az as y}from"./main.chunk.N-eZ2ybB.js";import{u as k,P as D}from"./pdf-context.chunk.DXMR6h2w.js";import{u as v}from"./use-currency.chunk.QE--bLc6.js";import{H as N}from"./pdf-html.chunk.CXZoRVhj.js";import{f as C}from"./date-utils.chunk.DWRtWTmT.js";import{a as T}from"./donation.chunk.Dp3XMNs5.js";import"./react-jsx-runtime.chunk.ATkk6v2S.js";import"./react.js";import"./ui-radix.chunk.Xzokq_Gv.js";import"./react-dom.js";import"./react-dom-client.chunk.BMQ1litG.js";import"./utils.chunk.C1IATKsN.js";import"./icons.chunk.BwnSC3zE.js";import"./forms.chunk.Bz8aaTWe.js";__("Campaign Name","growfund"),__("Fund Name","growfund"),__("Donor Name","growfund"),__("Donation Amount","growfund"),__("Payment Method","growfund"),__("Donation Date & Time","growfund"),__("Campaign Name","growfund"),__("Backer Name","growfund"),__("Pledge Amount","growfund"),__("Payment Method","growfund"),__("Pledge Date & Time","growfund");const z=[{label:__("Tribute Receiver Name","growfund"),value:"{tribute_notification_receiver}"},{label:__("Tribute Type","growfund"),value:"{tribute_type}"},{label:__("Tribute To","growfund"),value:"{tribute_to}"},{label:__("Donor Name","growfund"),value:"{donor_name}"},{label:__("Donation Amount","growfund"),value:"{donation_amount}"},{label:__("Donation Date","growfund"),value:"{donation_date}"},{label:__("Campaign Name","growfund"),value:"{campaign_name}"},{label:__("Organization Name","growfund"),value:"{organization_name}"}],A=({template:s,donation:d})=>{const{appConfig:{[g.General]:p,[g.Branding]:h},toCurrency:j}=k(),_=e.useMemo(()=>({tribute_notification_receiver:d.tribute_notification_recipient_name??"",tribute_type:d.tribute_type??"",tribute_to:d.tribute_to??"",donor_name:sprintf("%s %s",d.donor.first_name,d.donor.last_name),donation_amount:j(d.amount,!1),donation_date:C(d.created_at,m.HUMAN_READABLE),campaign_name:d.campaign.title,organization_name:p?.organization.name??""}),[d.amount,d.campaign.title,d.created_at,d.donor.first_name,d.donor.last_name,d.tribute_notification_recipient_name,d.tribute_to,d.tribute_type,p?.organization.name,j]),x=e.useMemo(()=>l(z,s.content.greetings,_),[s.content.greetings,_]),w=e.useMemo(()=>l(z,s.content.description,_),[s.content.description,_]),b=s.media.image,y=s.media.height,D=s.media.position,v=s.colors.greetings??"#000000",T=s.colors.background??"#F3E6D6",A=s.colors.text_color??"#333333",E=s.colors.secondary_text_color??"#636363";return t.jsx(n,{children:t.jsx(o,{size:"A4",style:{margin:0,fontFamily:"Helvetica",fontSize:12,display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%"},children:t.jsxs(a,{style:{width:384,backgroundColor:T,border:"0.6px",borderStyle:"solid",borderColor:"#E6E6E6"},children:[t.jsx(a,{style:{width:"100%",display:"flex",justifyContent:"left"===D?"flex-start":"right"===D?"flex-end":"center",height:y??"auto"},children:t.jsx(r,{src:c(b?.url??f.assets_url+"/images/ecard.webp"),style:{width:"100%",objectFit:"contain"}})}),t.jsxs(a,{style:{paddingTop:16,paddingBottom:24,paddingLeft:32,paddingRight:32},children:[t.jsx(i,{style:{fontSize:14,fontWeight:"semibold",color:v},children:x?x.replace("{tribute_notification_receiver}",""):""}),t.jsx(i,{style:{marginTop:16,lineHeight:1.4,color:A},children:t.jsx(N,{resetStyles:!1,stylesheet:{p:{marginBottom:1,marginTop:2,fontSize:14,lineHeight:1.4,width:"100%"}},children:w})}),t.jsxs(a,{style:{marginTop:20,flexDirection:"column",gap:12},children:[t.jsx(i,{style:{fontSize:12,color:E},children:C(d.created_at,m.HUMAN_READABLE)}),u(h?.logo?.url)&&t.jsx(r,{src:c(h.logo.url),style:{height:24,maxWidth:100}})]})]})]})})})},E=()=>{const{uid:e}=p(),{toCurrency:n}=v(),{appConfig:o}=h(),a=T(e),r=window.innerHeight;return j(a,{Loading:t.jsx(y,{}),Error:t.jsx(w,{className:"growfund-mt-10",children:t.jsxs(b,{children:[t.jsx(d,{}),t.jsx("div",{children:__("Donation not found.","growfund")})]})}),Empty:t.jsx(_,{className:"growfund-mt-10",children:t.jsxs(x,{className:"growfund-flex growfund-flex-col growfund-items-center",children:[t.jsx(d,{}),t.jsx("div",{children:__("Donation not found.","growfund")})]})}),Success:e=>{const a=e.data.template,i=e.data.donation;return t.jsx(s,{width:"100%",height:r,children:t.jsx(D,{toCurrency:n,appConfig:o,children:t.jsx(A,{template:a,donation:i})})})}})};export{E as default};
