(()=>{"use strict";var e={51609:e=>{e.exports=window.React},86087:e=>{e.exports=window.wp.element}},a={};function r(n){var t=a[n];if(void 0!==t)return t.exports;var o=a[n]={exports:{}};return e[n](o,o.exports,r),o.exports}var n=r(51609),t=r(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,r=function(e){return new Intl.NumberFormat(navigator.language,{style:"currency",currency:e})}(e);return r.format(a);default:return a}},c=({campaign:e})=>(0,n.createElement)("div",{className:"givewp-campaign-goal"},(0,n.createElement)("div",{className:"givewp-campaign-goal__container"},(0,n.createElement)("div",{className:"givewp-campaign-goal__container-item"},(0,n.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,n.createElement)("strong",null,s(e.goalType,e.goalStats.actual))),(0,n.createElement)("div",{className:"givewp-campaign-goal__container-item"},(0,n.createElement)("span",null,(0,i.__)("Our goal","give")),(0,n.createElement)("strong",null,s(e.goalType,e.goal)))),(0,n.createElement)("div",{className:"givewp-campaign-goal__progress-bar"},(0,n.createElement)("div",{className:"givewp-campaign-goal__progress-bar-container"},(0,n.createElement)("div",{className:"givewp-campaign-goal__progress-bar-progress",style:{width:`${e.goalStats.percentage}%`}})))),g=({campaignId:e})=>{const{campaign:a,hasResolved:r}=function(e){const a=(0,o.useEntityRecord)("givewp","campaign",e);return{campaign:{...a?.record},hasResolved:a?.hasResolved,isResolving:a?.isResolving}}(e);return r&&e?(0,n.createElement)(c,{campaign:a}):null},l=document.querySelectorAll("[data-givewp-campaign-goal]");l&&Array.from(l).map((e=>(0,t.createRoot)(e).render((0,n.createElement)(g,{campaignId:e.dataset?.id}))))})();