(()=>{"use strict";var e={95745:(e,a,n)=>{n.d(a,{Q:()=>l});var r=n(51609),t=n(86087);const o=window.wp.coreData,i=window.wp.i18n;window.wp.apiFetch;const s=(e,a)=>{switch(e){case"amount":case"amountFromSubscriptions":const{currency:e}=window.GiveCampaignOptions,n=function(e){return new Intl.NumberFormat(navigator.language,{style:"currency",currency:e})}(e);return n.format(a);default:return a}},c=({campaign:e})=>(0,r.createElement)("div",{className:"givewp-campaign-goal"},(0,r.createElement)("div",{className:"givewp-campaign-goal__container"},(0,r.createElement)("div",{className:"givewp-campaign-goal__container-item"},(0,r.createElement)("span",null,(e=>{switch(e){case"amount":return(0,i.__)("Amount raised","give");case"donations":return(0,i.__)("Number of donations","give");case"donors":return(0,i.__)("Number of donors","give");case"amountFromSubscriptions":return(0,i.__)("Recurring amount raised","give");case"subscriptions":return(0,i.__)("Number of recurring donations","give");case"donorsFromSubscriptions":return(0,i.__)("Number of recurring donors","give")}})(e.goalType)),(0,r.createElement)("strong",null,s(e.goalType,e.goalStats.actual))),(0,r.createElement)("div",{className:"givewp-campaign-goal__container-item"},(0,r.createElement)("span",null,(0,i.__)("Our goal","give")),(0,r.createElement)("strong",null,s(e.goalType,e.goal)))),(0,r.createElement)("div",{className:"givewp-campaign-goal__progress-bar"},(0,r.createElement)("div",{className:"givewp-campaign-goal__progress-bar-container"},(0,r.createElement)("div",{className:"givewp-campaign-goal__progress-bar-progress",style:{width:`${e.goalStats.percentage}%`}})))),l=({campaignId:e})=>{const{campaign:a,hasResolved:n}=function(e){const a=(0,o.useEntityRecord)("givewp","campaign",e);return{campaign:{...a?.record},hasResolved:a?.hasResolved,isResolving:a?.isResolving}}(e);return n&&e?(0,r.createElement)(c,{campaign:a}):null},d=document.querySelectorAll("[data-givewp-campaign-goal]");d&&Array.from(d).map((e=>(0,t.createRoot)(e).render((0,r.createElement)(l,{campaignId:e.dataset?.id}))))},51609:e=>{e.exports=window.React},86087:e=>{e.exports=window.wp.element}},a={};function n(r){var t=a[r];if(void 0!==t)return t.exports;var o=a[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return n.d(a,{a}),a},n.d=(e,a)=>{for(var r in a)n.o(a,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:a[r]})},n.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a);var r=n(51609),t=n(86087),o=n(95745);class i extends elementorModules.frontend.handlers.Base{render(){const e=document.querySelectorAll(`[data-id="${this.getID()}"] [data-givewp-campaign-goal]`);e?.forEach((e=>{(0,t.createRoot)(e).render((0,r.createElement)(o.Q,{campaignId:Number(e.getAttribute("data-id"))}))}))}onInit(){this.render()}}window.addEventListener("elementor/frontend/init",(()=>{elementorFrontend.hooks.addAction("frontend/element_ready/givewp_campaign_goal.default",(e=>{elementorFrontend.elementsHandler.addHandler(i,{$element:e})}))}))})();