@apollosproject/canvas-embeds 2.1.668 → 2.1.670

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/widget/index.js +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apollosproject/canvas-embeds",
3
3
  "description": "Apollos React embed widgets",
4
- "version": "2.1.668",
4
+ "version": "2.1.670",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",
package/widget/index.js CHANGED
@@ -1960,7 +1960,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1960
1960
  background-color: rgb(var(--color-brand-primary) / 0.3);
1961
1961
  color: inherit;
1962
1962
  }
1963
- `,fM1=({amount:t="0",selectedFrequency:a=null,selectedCampus:n=null,selectedFund:r=null,predefinedAmounts:l="",onError:o,isProcessing:i=!1,onShowPayment:c,onAmountChange:u,onFrequencyChange:d,onCampusChange:h,onFundChange:f,onStartDateChange:A,churchName:Z,churchLogo:H,message:y,displayLogo:b,title:S,displayHeader:_})=>{var W;const{currentChurch:w}=mp(),{trackEvent:P,trackPageView:N}=MV0(),{campuses:T,loading:x}=UT(),z=SP(a),Y=e.useRef(null),R=e.useRef(null),X=e.useRef(null),G=l?l.split(",").map(l0=>l0.trim()).filter(l0=>l0):[];e.useEffect(()=>{N({title:"Donate screen viewed",path:"/donate",properties:{church_slug:(w==null?void 0:w.slug)||""}})},[N,w==null?void 0:w.slug]),e.useEffect(()=>{z&&Y.current&&X.current&&setTimeout(()=>{const l0=X.current,m0=Y.current;if(l0&&m0){const e0=l0.getBoundingClientRect();m0.getBoundingClientRect().bottom>e0.bottom&&m0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[z]),e.useEffect(()=>{n&&R.current&&X.current&&setTimeout(()=>{const l0=X.current,m0=R.current;if(l0&&m0){const e0=l0.getBoundingClientRect();m0.getBoundingClientRect().bottom>e0.bottom&&m0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[n]);const[a0,o0]=e.useState(80),K=e.useRef(null);e.useLayoutEffect(()=>{K.current&&(K.current.textContent=t||"0",o0(Math.max(K.current.offsetWidth+16,80)))},[t]),e.useEffect(()=>{const l0=setTimeout(()=>{K.current&&(K.current.textContent=t||"0",o0(Math.max(K.current.offsetWidth+16,80)))},10);return()=>clearTimeout(l0)},[t]);const T0=l0=>{const m0=parseFloat(l0);return!isNaN(m0)&&m0>999999.99},V0=l0=>{let m0=l0.replace(/[^0-9.]/g,"");if(m0.includes(".")){const e0=m0.split(".");e0.length>2&&(m0=e0[0]+"."+e0.slice(1).join("")),e0[1]&&e0[1].length>2&&(m0=e0[0]+"."+e0[1].substring(0,2))}m0.length>1&&m0[0]==="0"&&m0[1]!=="."&&(m0=m0.substring(1)),!T0(m0)&&(m0==="."&&(m0="0."),u==null||u(m0))},f0=l0=>{const m0=T.find(e0=>e0.id===l0);if(m0){const e0={...m0,donationFunds:m0.donationFunds?m0.donationFunds.map(n0=>({...n0})):[]};h==null||h(e0);const L0=uM1(r,e0);f==null||f(L0)}else h==null||h(null),f==null||f(null)},v0=l0=>{var e0;if(!n)return;const m0=(e0=n.donationFunds)==null?void 0:e0.find(L0=>L0.id===l0);f==null||f(m0?{...m0}:null)},j=l0=>{const e0=x7.find(L0=>L0.id===l0)||null;e0&&(a!=null&&a.startDate)&&(sM1(a.startDate,e0)||A==null||A(null)),d==null||d(e0)},t0=l0=>{A==null||A(l0)},s0=()=>{const l0=bn(t);if(!l0||l0<=0){o({message:"Please enter a valid amount"});return}if(l0<.5){o({message:"Please enter an amount of $0.50 or more"});return}if(!n){o({message:"Please select a campus"});return}if(!r){o({message:"Please select a fund"});return}P({event:"Donation Started",properties:{amount:l0,fund:(r==null?void 0:r.id)||"",campusId:(n==null?void 0:n.id)||"",is_recurring:z}}),c&&c()};return F.jsxs("div",{className:"flex flex-col h-full","data-testid":"donation-setup-form",children:[F.jsx("style",{children:pM1}),_!=="false"?F.jsx(wP,{churchName:Z,churchLogo:H,message:y,title:S,displayLogo:b,theme:void 0}):null,F.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",ref:X,children:F.jsxs("div",{className:"space-y-4",children:[F.jsxs("div",{className:"",children:[F.jsxs("div",{className:"flex items-start justify-center text-[60px] font-bold leading-none min-h-[60px]",children:[F.jsx("span",{className:"text-3xl leading-normal font-bold mt-3 flex-none text-brand dark:text-white",children:"$"}),F.jsx("span",{ref:K,className:"absolute invisible h-0 overflow-hidden whitespace-pre text-[80px] font-bold font-inherit p-0 m-0",style:{fontFamily:"inherit",position:"absolute",left:"-9999px",top:"-9999px"},children:t||"0"}),F.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:t,onKeyDown:l0=>{if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(l0.key)){if(/^[0-9]$/.test(l0.key)||l0.key==="."||l0.ctrlKey||l0.metaKey){if(l0.key==="."&&t.includes(".")){l0.preventDefault();return}if(/^[0-9]$/.test(l0.key)){const m0=l0.target,e0=m0.value,L0=m0.selectionStart||0,n0=e0.substring(0,L0)+l0.key+e0.substring(m0.selectionEnd||0);if(T0(n0)){l0.preventDefault();return}}return}l0.preventDefault()}},onChange:l0=>{const m0=l0.target.value;V0(m0),requestAnimationFrame(()=>{if(K.current){K.current.textContent=m0||"0";const e0=Math.max(K.current.offsetWidth+16,80);o0(e0)}})},onInput:l0=>{const m0=l0.target.value;if(K.current){K.current.textContent=m0||"0";const e0=Math.max(K.current.offsetWidth+16,80);o0(e0)}},onKeyUp:l0=>{const m0=l0.target.value;if(K.current){K.current.textContent=m0||"0";const e0=Math.max(K.current.offsetWidth+16,80);o0(e0)}},onFocus:l0=>{setTimeout(()=>{l0.target.select()},0)},onBlur:()=>{const l0=bn(t);l0>0&&(u==null||u(GM(l0)))},onClick:l0=>{l0.target.select()},disabled:i||x,className:"text-[80px] font-bold border-none outline-none bg-transparent flex-none p-0 m-0 text-brand dark:text-white caret-current text-center appearance-none transition-[width] duration-100 ease-in-out",style:{width:`${a0}px`}})]}),G&&G.length>0?F.jsx("div",{className:"flex flex-wrap pt-12",style:{gap:"6px"},children:G.map(l0=>F.jsxs(qe,{onClick:()=>V0(l0),disabled:i||x,surface:t===l0?"solid":"system",className:"min-w-0 flex-1",style:{flexBasis:"calc(25% - 4.5px)",minWidth:"0",...t===l0&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:["$",l0]},l0))}):null]}),F.jsx("div",{children:F.jsxs("div",{className:"flex",children:[F.jsxs(qe,{onClick:()=>{d==null||d(x7.find(l0=>l0.id===(w==null?void 0:w.givingDefaultFrequency))||x7[2])},disabled:i||x,surface:z?"solid":"system",className:"flex-1 rounded-r-none",style:{...z&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[F.jsx(jV0,{size:24}),"Recurring"]}),F.jsxs(qe,{onClick:()=>d==null?void 0:d(null),disabled:i||x,surface:z?"system":"solid",className:"flex-1 rounded-l-none",style:{...!z&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[F.jsx(jT,{size:24}),"One time"]})]})}),z?F.jsx(F.Fragment,{children:a?F.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[F.jsxs("div",{ref:Y,children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",children:"Frequency"}),F.jsxs(ug,{value:(a==null?void 0:a.id)||"",onChange:l0=>j(l0.target.value),disabled:i||x,required:!0,surface:"system",children:[F.jsx("option",{value:"",children:"Select a frequency"}),x7.map(l0=>F.jsx("option",{value:l0.id,children:l0.id},l0.id))]})]}),F.jsx("div",{children:F.jsx(hM1,{startDate:a.startDate??null,frequency:a,onStartDateChange:t0,disabled:i||x})})]}):F.jsxs("div",{ref:Y,children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",children:"Frequency"}),F.jsxs(ug,{value:(a==null?void 0:a.id)||"",onChange:l0=>j(l0.target.value),disabled:i||x,required:!0,surface:"system",children:[F.jsx("option",{value:"",children:"Select a frequency"}),x7.map(l0=>F.jsx("option",{value:l0.id,children:l0.id},l0.id))]})]})}):null,F.jsxs("div",{children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",children:"Campus"}),F.jsxs(ug,{value:(n==null?void 0:n.id)||"",onChange:l0=>f0(l0.target.value),disabled:i||x,required:!0,surface:"system",children:[F.jsx("option",{value:"",children:x?"Loading...":"Select a campus"}),T.map(l0=>F.jsx("option",{value:l0.id,children:l0.name},l0.id))]})]}),n?F.jsxs("div",{ref:R,children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",id:"fund-label",children:"Fund"}),F.jsxs(ug,{value:(r==null?void 0:r.id)||"",onChange:l0=>v0(l0.target.value),disabled:i,required:!0,surface:"system","aria-labelledby":"fund-label",children:[F.jsx("option",{value:"",children:"Select a fund"}),(W=n.donationFunds)==null?void 0:W.sort((l0,m0)=>(l0.displayOrder||0)-(m0.displayOrder||0)).map(l0=>F.jsx("option",{value:l0.id,children:l0.displayName||l0.name},l0.id))]})]}):null]})}),F.jsxs("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark",children:[F.jsxs(qe,{type:"button",className:"w-full py-3",onClick:s0,disabled:i||x||!n||!r||bn(t)<=0,surface:"solid",children:["Give $",GM(bn(t))," ",z&&a?a.id:""]}),F.jsx("div",{className:"text-center mt-4 px-6",children:F.jsxs(re,{className:"text-sm",fg:"primary",children:["By making this gift, you agree to our",F.jsx("br",{})," ",F.jsx("a",{href:"https://apollos.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Terms of Use"})," ","and"," ",F.jsx("a",{href:"https://apollos.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Privacy Policy"}),"."]})})]})]})},RV0=({onRetry:t,theme:a})=>{var n,r;return F.jsxs("div",{className:"text-center p-6 flex flex-col items-center justify-center min-h-full",children:[F.jsx("div",{className:"mb-6",children:F.jsx(Jg,{size:64,color:((r=(n=a==null?void 0:a.colors)==null?void 0:n.base)==null?void 0:r.secondary)||"#17B582",weight:"fill"})}),F.jsx(re,{as:"h3",className:"mb-4",children:"Thank You!"}),F.jsx(re,{fg:"secondary",className:"mb-12",children:"Your donation has been processed successfully."}),F.jsx(qe,{surface:"solid",onClick:t,children:"Make Another Donation"})]})};RV0.propTypes={onRetry:t1.func.isRequired};const YM=new Map,vM1=t=>typeof window>"u"?Promise.resolve(null):(YM.has(t)||YM.set(t,Promise.resolve().then(()=>hve).then(({loadStripe:a})=>a(t)).catch(a=>(console.error("Failed to load Stripe.js",a),YM.delete(t),null))),YM.get(t)),AM1=({amount:t="0",frequency:a,message:n="",campus:r="",fund:l="",predefinedAmounts:o="",width:i="",height:c="",displayLogo:u="",title:d="",displayHeader:h="",prefilledPayment:f=null,userFirstName:A=null,userLastName:Z=null,userEmail:H=null,userPhone:y=null})=>{var _0,P0,X0,Z1,x1,me;const b=F0=>typeof F0=="string"&&parseFloat(F0)>0,S=F0=>typeof F0=="string"&&F0.trim().length>0,_=F0=>F0===null||typeof F0=="string"&&F0.trim().length>0,w=F0=>F0==null||typeof F0=="object"&&!!F0.id,P=e.useCallback(F0=>F0?b(F0.amount)&&S(F0.campusId)&&_(F0.fundId||null)&&w(F0.selectedFrequency):!1,[]),[N,T]=e.useState("setup"),[x,z]=e.useState(""),[Y,R]=e.useState(null),[X,G]=e.useState(!1),[a0,o0]=e.useState(null),[K,T0]=e.useState(()=>({amount:t,selectedFrequency:UM(a),selectedCampusId:r||null,selectedFundId:l||null,selectedCampus:null,selectedFund:null})),[V0,f0]=e.useState(!1);e.useEffect(()=>{f&&f.amount&&f.campusId&&T0({amount:f.amount,selectedFrequency:f.selectedFrequency??null,selectedCampusId:f.campusId,selectedFundId:f.fundId??null,selectedCampus:null,selectedFund:null})},[f]);const v0=e.useRef({amount:t,campus:r,fund:l}),{currentChurch:j,loading:t0,error:s0}=mp(),{campuses:W}=UT(),{matchedCampus:l0,matchedFund:m0}=rv1(W,K.selectedCampusId,K.selectedFundId),e0=yV0(),L0=WZ1(),n0=e.useMemo(()=>{var c1,_1,he,J1,xe,Se,b2,je,Ne,Ge,s2,m2,s8,mt;const F0={light:{primary:((_1=(c1=L0==null?void 0:L0.colors)==null?void 0:c1.base)==null?void 0:_1.primary)||"#00676D",background:n2.colors.light.fill.screen,componentBackground:n2.colors.light.fill.paper,componentBorder:n2.colors.light.neutral.gray5,componentDivider:n2.colors.light.neutral.gray4,primaryText:n2.colors.light.text.primary,secondaryText:n2.colors.light.text.secondary,componentText:n2.colors.light.text.primary,icon:n2.colors.light.neutral.gray},dark:{primary:((J1=(he=L0==null?void 0:L0.colors)==null?void 0:he.base)==null?void 0:J1.secondary)||"#17B582",background:n2.colors.dark.fill.screen,componentBackground:n2.colors.dark.fill.paper,componentBorder:n2.colors.dark.neutral.gray5,componentDivider:n2.colors.dark.neutral.gray4,primaryText:n2.colors.dark.text.primary,secondaryText:n2.colors.dark.text.secondary,componentText:n2.colors.dark.text.primary,icon:n2.colors.dark.neutral.gray}};return{theme:e0==="dark"?"night":"stripe",variables:{colorPrimary:((Se=(xe=L0==null?void 0:L0.colors)==null?void 0:xe.base)==null?void 0:Se.primary)||"#00676D",colorBackground:e0==="dark"?F0.dark.componentBackground:F0.light.componentBackground,colorText:e0==="dark"?F0.dark.primaryText:F0.light.primaryText,colorTextSecondary:e0==="dark"?F0.dark.secondaryText:F0.light.secondaryText,colorTextPlaceholder:e0==="dark"?F0.dark.secondaryText:F0.light.secondaryText,colorDanger:((je=(b2=L0==null?void 0:L0.colors)==null?void 0:b2.base)==null?void 0:je.alert)||"#FF4444",colorSuccess:((Ge=(Ne=L0==null?void 0:L0.colors)==null?void 0:Ne.base)==null?void 0:Ge.success)||"#17B582",colorWarning:((m2=(s2=L0==null?void 0:L0.colors)==null?void 0:s2.base)==null?void 0:m2.warning)||"#FFA500",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",fontSizeBase:"16px",spacingUnit:((s8=L0==null?void 0:L0.space)==null?void 0:s8.xxxs)||"4px",borderRadius:((mt=L0==null?void 0:L0.radii)==null?void 0:mt.base)||"6px",iconColor:e0==="dark"?F0.dark.icon:F0.light.icon}}},[L0,e0]);e.useEffect(()=>{var _1;const F0=(_1=j==null?void 0:j.stripeConnectAccount)==null?void 0:_1.publishableKey;if(!F0){o0(null);return}const c1=vM1(F0);o0(c1)},[(_0=j==null?void 0:j.stripeConnectAccount)==null?void 0:_0.publishableKey]),e.useEffect(()=>{if(!f)if(a!==void 0)T0(F0=>({...F0,selectedFrequency:UM(a)}));else if(j!=null&&j.givingDefaultFrequency){const F0=j.givingDefaultFrequency;if(F0==="One Time"||F0===null)T0(c1=>({...c1,selectedFrequency:null}));else{const c1=x7.find(_1=>_1.id===F0)||null;T0(_1=>({..._1,selectedFrequency:c1}))}}else T0(F0=>({...F0,selectedFrequency:null}))},[j==null?void 0:j.givingDefaultFrequency,f,a]),e.useEffect(()=>{!f&&t!==v0.current.amount&&t!==K.amount&&T0(F0=>({...F0,amount:t})),v0.current.amount=t},[t,f]),e.useEffect(()=>{!f&&r!==v0.current.campus&&r!==K.selectedCampusId&&T0(F0=>({...F0,selectedCampusId:r||null,selectedCampus:null,selectedFund:null,selectedFundId:null})),v0.current.campus=r},[r,f]),e.useEffect(()=>{!f&&l!==v0.current.fund&&l!==K.selectedFundId&&T0(F0=>({...F0,selectedFundId:l||null,selectedFund:null})),v0.current.fund=l},[l,f]),e.useEffect(()=>{var F0;if(!f&&K.selectedFundId&&((F0=K.selectedCampus)!=null&&F0.donationFunds)&&!K.selectedFund){let c1=K.selectedCampus.donationFunds.find(_1=>_1.id===K.selectedFundId);c1||(c1=K.selectedCampus.donationFunds.find(_1=>Zr(K.selectedFundId,_1.name)||_1.displayName&&Zr(K.selectedFundId,_1.displayName))),c1&&T0(_1=>({..._1,selectedFund:{...c1}}))}},[f,K.selectedFundId,(P0=K.selectedCampus)==null?void 0:P0.donationFunds,K.selectedFund]),e.useEffect(()=>{if(!K.selectedCampus&&l0){const F0={...l0,donationFunds:l0.donationFunds?l0.donationFunds.map(c1=>({...c1})):[]};T0(c1=>({...c1,selectedCampus:F0,selectedCampusId:F0.id,selectedFund:m0?{...m0}:c1.selectedFund}))}},[l0,m0,K.selectedCampus]);const[Z0,{loading:g0}]=tv1(),y0=e.useCallback(()=>{T("success")},[]),H0=e.useCallback(F0=>{z(F0.message)},[]),c0=e.useCallback(()=>{z("")},[]),Q0=e.useCallback(()=>{T("setup"),z(""),R(null),f0(!1),T0({amount:t,selectedFrequency:UM(a),selectedCampusId:null,selectedFundId:null,selectedCampus:null,selectedFund:null}),G(!1)},[t,a]),d0=e.useCallback(F0=>{T0(c1=>({...c1,amount:F0}))},[]),a1=e.useCallback(F0=>{T0(c1=>{var he;const _1=F0?{...F0,startDate:(he=c1.selectedFrequency)==null?void 0:he.startDate}:null;return{...c1,selectedFrequency:_1}})},[]),G0=e.useCallback(F0=>{T0(c1=>({...c1,selectedFrequency:c1.selectedFrequency?{...c1.selectedFrequency,startDate:F0??void 0}:null}))},[]),h1=e.useCallback(F0=>{T0(c1=>({...c1,selectedCampus:F0,selectedCampusId:(F0==null?void 0:F0.id)||null,selectedFund:null,selectedFundId:null}))},[]),S1=e.useCallback(F0=>{T0(c1=>({...c1,selectedFund:F0,selectedFundId:(F0==null?void 0:F0.id)||null}))},[]),g1=e.useCallback(async(F0,c1,_1,he,J1)=>{var xe;try{const Se={amount:Math.round(F0*100),campusId:_1||"",fundId:he||null};Se.recurring=YZ1(c1,J1);const{data:b2,errors:je}=await Z0({variables:{input:Se}});if(je)throw new Error(je[0].message);if((xe=b2==null?void 0:b2.createPaymentIntent)!=null&&xe.clientSecret)R(b2.createPaymentIntent.clientSecret),T("payment");else throw new Error("No client secret received from server")}catch(Se){H0(Se)}},[Z0,H0]),v1=e.useCallback(()=>{T("setup"),R(null)},[]),e1={width:i?isNaN(Number(i))?i:`${i}px`:"100%",height:c?isNaN(Number(c))?c:`${c}px`:"500px",maxWidth:i?void 0:"400px",margin:i?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0},K0=t0||!a0||g0||X;if(e.useEffect(()=>{f&&P(f)&&!t0&&!g0&&!V0&&N==="setup"&&(f0(!0),T0({amount:f.amount,selectedFrequency:f.selectedFrequency??null,selectedCampusId:f.campusId,selectedFundId:f.fundId??null,selectedCampus:null,selectedFund:null}),g1(parseFloat(f.amount),SV0(f.selectedFrequency),f.campusId,f.fundId??"",f.startDate??null))},[f,t0,g0,V0,N,g1,P]),s0)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[F.jsx(re,{fg:"secondary",className:"text-center px-8",children:"Unable to load church information. Please try again later."}),F.jsx(qe,{surface:"tinted",onClick:Q0,className:"mt-2",children:"Try Again"})]})});if(!t0&&j&&j.givingEnabled===!1)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3 space-y-2",children:[F.jsx(DM0,{size:32,weight:"duotone"}),F.jsx(re,{fg:"secondary",className:"text-center px-8",children:"Online giving is closed. For questions, please contact support."}),F.jsx(qe,{href:"mailto:support@apollos.app",surface:"tinted",className:"mt-2",children:"Contact Us"})]})});if(!t0&&j&&j.givingInMaintenance===!0)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3 space-y-2",children:[F.jsx(RM0,{size:32,weight:"duotone"}),F.jsx(re,{fg:"secondary",className:"text-center px-8",children:"We're updating the giving experience. Please check back shortly."})]})});if(!t0&&!a0)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[F.jsx(jT,{size:32,weight:"duotone"}),F.jsx(re,{fg:"secondary",className:"text-center",children:"Online giving is not currently available. Please contact your church for assistance."}),F.jsx(qe,{href:"mailto:support@apollos.app",surface:"tinted",className:"mt-2",children:"Contact Us"})]})});if(N==="success")return F.jsx(i6,{style:e1,children:F.jsx("div",{className:"flex-1 flex flex-col justify-center items-center",children:F.jsx(RV0,{onRetry:Q0,theme:L0||void 0})})});const j0=A||Z?`${A} ${Z}`.trim():"",i1=(j==null?void 0:j.name)||"Your Church";return F.jsxs(i6,{style:e1,children:[K0?F.jsx("div",{className:"absolute inset-0 bg-material-screen dark:bg-material-screen-dark flex items-center justify-center z-[1000]",children:F.jsx($s,{size:32,className:"animate-spin mx-auto mb-2"})}):null,x?F.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[50] p-3 flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-xl",style:{borderColor:((Z1=(X0=L0==null?void 0:L0.colors)==null?void 0:X0.base)==null?void 0:Z1.alert)||"#FF4444"},children:[F.jsx(zM0,{size:20,color:((me=(x1=L0==null?void 0:L0.colors)==null?void 0:x1.base)==null?void 0:me.alert)||"#FF4444",weight:"fill"}),F.jsx("div",{className:"flex-1",children:F.jsx(re,{className:"text-red-700 dark:text-red-300 font-medium text-sm",children:x})}),F.jsx(qe,{surface:"tinted",onClick:c0,className:"p-1 min-w-0 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-800/30",children:F.jsx(W5,{size:16})})]}):null,F.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:N==="payment"&&Y&&a0?F.jsx(eE0,{stripe:a0,options:{clientSecret:Y,appearance:n0},children:F.jsx(xV0,{amount:K!=null&&K.amount?parseFloat(K.amount):parseFloat(t),selectedFrequency:K==null?void 0:K.selectedFrequency,selectedCampusId:(K==null?void 0:K.selectedCampusId)||void 0,selectedFundId:(K==null?void 0:K.selectedFundId)||void 0,clientSecret:Y,onSuccess:y0,onError:H0,isProcessing:X,onProcessingChange:G,onBack:v1,userFullName:j0,userEmail:H||void 0,userPhone:y||void 0,churchName:i1,churchLogo:j==null?void 0:j.logo,message:n,displayLogo:u,title:d,displayHeader:h})}):F.jsx(F.Fragment,{children:N==="setup"&&!(f&&P(f)&&!V0)?F.jsx(fM1,{amount:K.amount,selectedFrequency:K.selectedFrequency,selectedCampus:K.selectedCampus,selectedFund:K.selectedFund,predefinedAmounts:o,onError:F0=>H0(new Error(F0.message)),isProcessing:g0,onAmountChange:d0,onFrequencyChange:a1,onCampusChange:h1,onFundChange:S1,onStartDateChange:G0,onShowPayment:()=>{var _1;const F0=typeof K.amount=="string"?parseFloat(K.amount):K.amount,c1=SV0(K.selectedFrequency);g1(F0,c1,K.selectedCampusId||"",K.selectedFundId||"",((_1=K.selectedFrequency)==null?void 0:_1.startDate)??null)},churchName:i1,churchLogo:j==null?void 0:j.logo,message:n,displayLogo:u,title:d,displayHeader:h}):N==="setup"&&f&&P(f)&&!V0?F.jsxs("div",{className:"flex flex-col justify-center items-center h-full min-h-[400px]",children:[F.jsx($s,{size:32,className:"animate-spin mx-auto mb-2"}),F.jsx(re,{children:"Preparing your donation..."})]}):null})})]})},gM1=t=>{const[a,n]=e.useState(!1);e.useEffect(()=>{n(!0)},[]);const r=()=>({width:t.width?isNaN(Number(t.width))?t.width:`${t.width}px`:"100%",height:t.height?isNaN(Number(t.height))?t.height:`${t.height}px`:"500px",maxWidth:t.width?void 0:"400px",margin:t.width?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0});return F.jsx(LV0,{children:a?F.jsx(AM1,{...t}):F.jsx(i6,{style:r(),children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[F.jsx($s,{size:32,className:"animate-spin mx-auto mb-2"}),F.jsx(re,{className:"text-center",children:"Loading donation form..."})]})})})},ZM1=e.forwardRef(function({to:a,href:n,isExternal:r,...l},o){const{navigate:i}=sM(),c=eH0(),u=tH0(),d=aH0(),h=mT(),f=$91();if(r&&n||!a)return F.jsx("a",{ref:o,href:n,...l});let A;if(typeof a=="object"){if(!a.contentId)return null;A=a.contentId.split(":").join("-")}else if(a!=null&&a.includes("ContentItem"))A=a.split("/").slice(-1)[0];else return null;if(!d&&!h)return F.jsx("a",{ref:o,...l,href:`https://apollos.site/@${f}/c/${A}`,target:"_blank",rel:"noopener noreferrer"});let Z=u&&h?`/ac/${A}`:`?${c?"apollosId":"id"}=${A}`;return h||(Z=`${d}${n}`),F.jsx("a",{ref:o,...l,href:Z,onClick:H=>{H.preventDefault(),i({id:A})}})}),HM1=({children:t})=>F.jsx(Vx0,{linkComponent:ZM1,children:t});function KM(){return KM=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},KM.apply(null,arguments)}function DV0(t,a){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(a.indexOf(r)>=0)continue;n[r]=t[r]}return n}function NP(t,a){return NP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},NP(t,a)}function zV0(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,NP(t,a)}function MM1(t,a){return t.classList?!!a&&t.classList.contains(a):(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+a+" ")!==-1}function EM1(t,a){t.classList?t.classList.add(a):MM1(t,a)||(typeof t.className=="string"?t.className=t.className+" "+a:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+a))}function UV0(t,a){return t.replace(new RegExp("(^|\\s)"+a+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function VM1(t,a){t.classList?t.classList.remove(a):typeof t.className=="string"?t.className=UV0(t.className,a):t.setAttribute("class",UV0(t.className&&t.className.baseVal||"",a))}const BV0={disabled:!1};var qV0={},yM1=qV0.NODE_ENV!=="production"?t1.oneOfType([t1.number,t1.shape({enter:t1.number,exit:t1.number,appear:t1.number}).isRequired]):null,bM1=qV0.NODE_ENV!=="production"?t1.oneOfType([t1.string,t1.shape({enter:t1.string,exit:t1.string,active:t1.string}),t1.shape({enter:t1.string,enterDone:t1.string,enterActive:t1.string,exit:t1.string,exitDone:t1.string,exitActive:t1.string})]):null;const WV0=Y0.createContext(null);var GV0=function(a){return a.scrollTop},LM1={},gp="unmounted",B7="exited",q7="entering",tu="entered",TP="exiting",Fl=function(t){zV0(a,t);function a(r,l){var o;o=t.call(this,r,l)||this;var i=l,c=i&&!i.isMounting?r.enter:r.appear,u;return o.appearStatus=null,r.in?c?(u=B7,o.appearStatus=q7):u=tu:r.unmountOnExit||r.mountOnEnter?u=gp:u=B7,o.state={status:u},o.nextCallback=null,o}a.getDerivedStateFromProps=function(l,o){var i=l.in;return i&&o.status===gp?{status:B7}:null};var n=a.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(l){var o=null;if(l!==this.props){var i=this.state.status;this.props.in?i!==q7&&i!==tu&&(o=q7):(i===q7||i===tu)&&(o=TP)}this.updateStatus(!1,o)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var l=this.props.timeout,o,i,c;return o=i=c=l,l!=null&&typeof l!="number"&&(o=l.exit,i=l.enter,c=l.appear!==void 0?l.appear:i),{exit:o,enter:i,appear:c}},n.updateStatus=function(l,o){if(l===void 0&&(l=!1),o!==null)if(this.cancelNextCallback(),o===q7){if(this.props.unmountOnExit||this.props.mountOnEnter){var i=this.props.nodeRef?this.props.nodeRef.current:Tm.findDOMNode(this);i&&GV0(i)}this.performEnter(l)}else this.performExit();else this.props.unmountOnExit&&this.state.status===B7&&this.setState({status:gp})},n.performEnter=function(l){var o=this,i=this.props.enter,c=this.context?this.context.isMounting:l,u=this.props.nodeRef?[c]:[Tm.findDOMNode(this),c],d=u[0],h=u[1],f=this.getTimeouts(),A=c?f.appear:f.enter;if(!l&&!i||BV0.disabled){this.safeSetState({status:tu},function(){o.props.onEntered(d)});return}this.props.onEnter(d,h),this.safeSetState({status:q7},function(){o.props.onEntering(d,h),o.onTransitionEnd(A,function(){o.safeSetState({status:tu},function(){o.props.onEntered(d,h)})})})},n.performExit=function(){var l=this,o=this.props.exit,i=this.getTimeouts(),c=this.props.nodeRef?void 0:Tm.findDOMNode(this);if(!o||BV0.disabled){this.safeSetState({status:B7},function(){l.props.onExited(c)});return}this.props.onExit(c),this.safeSetState({status:TP},function(){l.props.onExiting(c),l.onTransitionEnd(i.exit,function(){l.safeSetState({status:B7},function(){l.props.onExited(c)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(l,o){o=this.setNextCallback(o),this.setState(l,o)},n.setNextCallback=function(l){var o=this,i=!0;return this.nextCallback=function(c){i&&(i=!1,o.nextCallback=null,l(c))},this.nextCallback.cancel=function(){i=!1},this.nextCallback},n.onTransitionEnd=function(l,o){this.setNextCallback(o);var i=this.props.nodeRef?this.props.nodeRef.current:Tm.findDOMNode(this),c=l==null&&!this.props.addEndListener;if(!i||c){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[i,this.nextCallback],d=u[0],h=u[1];this.props.addEndListener(d,h)}l!=null&&setTimeout(this.nextCallback,l)},n.render=function(){var l=this.state.status;if(l===gp)return null;var o=this.props,i=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var c=DV0(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Y0.createElement(WV0.Provider,{value:null},typeof i=="function"?i(l,c):Y0.cloneElement(Y0.Children.only(i),c))},a}(Y0.Component);Fl.contextType=WV0,Fl.propTypes=LM1.NODE_ENV!=="production"?{nodeRef:t1.shape({current:typeof Element>"u"?t1.any:function(t,a,n,r,l,o){var i=t[a];return t1.instanceOf(i&&"ownerDocument"in i?i.ownerDocument.defaultView.Element:Element)(t,a,n,r,l,o)}}),children:t1.oneOfType([t1.func.isRequired,t1.element.isRequired]).isRequired,in:t1.bool,mountOnEnter:t1.bool,unmountOnExit:t1.bool,appear:t1.bool,enter:t1.bool,exit:t1.bool,timeout:function(a){var n=yM1;a.addEndListener||(n=n.isRequired);for(var r=arguments.length,l=new Array(r>1?r-1:0),o=1;o<r;o++)l[o-1]=arguments[o];return n.apply(void 0,[a].concat(l))},addEndListener:t1.func,onEnter:t1.func,onEntering:t1.func,onEntered:t1.func,onExit:t1.func,onExiting:t1.func,onExited:t1.func}:{};function au(){}Fl.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:au,onEntering:au,onEntered:au,onExit:au,onExiting:au,onExited:au},Fl.UNMOUNTED=gp,Fl.EXITED=B7,Fl.ENTERING=q7,Fl.ENTERED=tu,Fl.EXITING=TP;var SM1={},FM1=function(a,n){return a&&n&&n.split(" ").forEach(function(r){return EM1(a,r)})},PP=function(a,n){return a&&n&&n.split(" ").forEach(function(r){return VM1(a,r)})},$P=function(t){zV0(a,t);function a(){for(var r,l=arguments.length,o=new Array(l),i=0;i<l;i++)o[i]=arguments[i];return r=t.call.apply(t,[this].concat(o))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(c,u){var d=r.resolveArguments(c,u),h=d[0],f=d[1];r.removeClasses(h,"exit"),r.addClass(h,f?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(c,u)},r.onEntering=function(c,u){var d=r.resolveArguments(c,u),h=d[0],f=d[1],A=f?"appear":"enter";r.addClass(h,A,"active"),r.props.onEntering&&r.props.onEntering(c,u)},r.onEntered=function(c,u){var d=r.resolveArguments(c,u),h=d[0],f=d[1],A=f?"appear":"enter";r.removeClasses(h,A),r.addClass(h,A,"done"),r.props.onEntered&&r.props.onEntered(c,u)},r.onExit=function(c){var u=r.resolveArguments(c),d=u[0];r.removeClasses(d,"appear"),r.removeClasses(d,"enter"),r.addClass(d,"exit","base"),r.props.onExit&&r.props.onExit(c)},r.onExiting=function(c){var u=r.resolveArguments(c),d=u[0];r.addClass(d,"exit","active"),r.props.onExiting&&r.props.onExiting(c)},r.onExited=function(c){var u=r.resolveArguments(c),d=u[0];r.removeClasses(d,"exit"),r.addClass(d,"exit","done"),r.props.onExited&&r.props.onExited(c)},r.resolveArguments=function(c,u){return r.props.nodeRef?[r.props.nodeRef.current,c]:[c,u]},r.getClassNames=function(c){var u=r.props.classNames,d=typeof u=="string",h=d&&u?u+"-":"",f=d?""+h+c:u[c],A=d?f+"-active":u[c+"Active"],Z=d?f+"-done":u[c+"Done"];return{baseClassName:f,activeClassName:A,doneClassName:Z}},r}var n=a.prototype;return n.addClass=function(l,o,i){var c=this.getClassNames(o)[i+"ClassName"],u=this.getClassNames("enter"),d=u.doneClassName;o==="appear"&&i==="done"&&d&&(c+=" "+d),i==="active"&&l&&GV0(l),c&&(this.appliedClasses[o][i]=c,FM1(l,c))},n.removeClasses=function(l,o){var i=this.appliedClasses[o],c=i.base,u=i.active,d=i.done;this.appliedClasses[o]={},c&&PP(l,c),u&&PP(l,u),d&&PP(l,d)},n.render=function(){var l=this.props;l.classNames;var o=DV0(l,["classNames"]);return Y0.createElement(Fl,KM({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},a}(Y0.Component);$P.defaultProps={classNames:""},$P.propTypes=SM1.NODE_ENV!=="production"?KM({},Fl.propTypes,{classNames:bM1,onEnter:t1.func,onEntering:t1.func,onEntered:t1.func,onExit:t1.func,onExiting:t1.func,onExited:t1.func}):{};const YV0={Search:We($P)`
1963
+ `,fM1=({amount:t="0",selectedFrequency:a=null,selectedCampus:n=null,selectedFund:r=null,predefinedAmounts:l="",onError:o,isProcessing:i=!1,onShowPayment:c,onAmountChange:u,onFrequencyChange:d,onCampusChange:h,onFundChange:f,onStartDateChange:A,churchName:Z,churchLogo:H,message:y,displayLogo:b,title:S,displayHeader:_})=>{var W;const{currentChurch:w}=mp(),{trackEvent:P,trackPageView:N}=MV0(),{campuses:T,loading:x}=UT(),z=SP(a),Y=e.useRef(null),R=e.useRef(null),X=e.useRef(null),G=l?l.split(",").map(l0=>l0.trim()).filter(l0=>l0):[];e.useEffect(()=>{N({title:"Donate screen viewed",path:"/donate",properties:{church_slug:(w==null?void 0:w.slug)||""}})},[N,w==null?void 0:w.slug]),e.useEffect(()=>{z&&Y.current&&X.current&&setTimeout(()=>{const l0=X.current,m0=Y.current;if(l0&&m0){const e0=l0.getBoundingClientRect();m0.getBoundingClientRect().bottom>e0.bottom&&m0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[z]),e.useEffect(()=>{n&&R.current&&X.current&&setTimeout(()=>{const l0=X.current,m0=R.current;if(l0&&m0){const e0=l0.getBoundingClientRect();m0.getBoundingClientRect().bottom>e0.bottom&&m0.scrollIntoView({behavior:"smooth",block:"nearest"})}},100)},[n]);const[a0,o0]=e.useState(80),K=e.useRef(null);e.useLayoutEffect(()=>{K.current&&(K.current.textContent=t||"0",o0(Math.max(K.current.offsetWidth+16,80)))},[t]),e.useEffect(()=>{const l0=setTimeout(()=>{K.current&&(K.current.textContent=t||"0",o0(Math.max(K.current.offsetWidth+16,80)))},10);return()=>clearTimeout(l0)},[t]);const T0=l0=>{const m0=parseFloat(l0);return!isNaN(m0)&&m0>999999.99},V0=l0=>{let m0=l0.replace(/[^0-9.]/g,"");if(m0.includes(".")){const e0=m0.split(".");e0.length>2&&(m0=e0[0]+"."+e0.slice(1).join("")),e0[1]&&e0[1].length>2&&(m0=e0[0]+"."+e0[1].substring(0,2))}m0.length>1&&m0[0]==="0"&&m0[1]!=="."&&(m0=m0.substring(1)),!T0(m0)&&(m0==="."&&(m0="0."),u==null||u(m0))},f0=l0=>{const m0=T.find(e0=>e0.id===l0);if(m0){const e0={...m0,donationFunds:m0.donationFunds?m0.donationFunds.map(n0=>({...n0})):[]};h==null||h(e0);const L0=uM1(r,e0);f==null||f(L0)}else h==null||h(null),f==null||f(null)},v0=l0=>{var e0;if(!n)return;const m0=(e0=n.donationFunds)==null?void 0:e0.find(L0=>L0.id===l0);f==null||f(m0?{...m0}:null)},j=l0=>{const e0=x7.find(L0=>L0.id===l0)||null;e0&&(a!=null&&a.startDate)&&(sM1(a.startDate,e0)||A==null||A(null)),d==null||d(e0)},t0=l0=>{A==null||A(l0)},s0=()=>{const l0=bn(t);if(!l0||l0<=0){o({message:"Please enter a valid amount"});return}if(l0<.5){o({message:"Please enter an amount of $0.50 or more"});return}if(!n){o({message:"Please select a campus"});return}if(!r){o({message:"Please select a fund"});return}P({event:"Donation Started",properties:{amount:l0,fund:(r==null?void 0:r.id)||"",campusId:(n==null?void 0:n.id)||"",is_recurring:z}}),c&&c()};return F.jsxs("div",{className:"flex flex-col h-full","data-testid":"donation-setup-form",children:[F.jsx("style",{children:pM1}),_!=="false"?F.jsx(wP,{churchName:Z,churchLogo:H,message:y,title:S,displayLogo:b,theme:void 0}):null,F.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",ref:X,children:F.jsxs("div",{className:"space-y-4",children:[F.jsxs("div",{className:"",children:[F.jsxs("div",{className:"flex items-start justify-center text-[60px] font-bold leading-none min-h-[60px]",children:[F.jsx("span",{className:"text-3xl leading-normal font-bold mt-3 flex-none text-brand dark:text-white",children:"$"}),F.jsx("span",{ref:K,className:"absolute invisible h-0 overflow-hidden whitespace-pre text-[80px] font-bold font-inherit p-0 m-0",style:{fontFamily:"inherit",position:"absolute",left:"-9999px",top:"-9999px"},children:t||"0"}),F.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:t,onKeyDown:l0=>{if(!["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowUp","ArrowRight","ArrowDown"].includes(l0.key)){if(/^[0-9]$/.test(l0.key)||l0.key==="."||l0.ctrlKey||l0.metaKey){if(l0.key==="."&&t.includes(".")){l0.preventDefault();return}if(/^[0-9]$/.test(l0.key)){const m0=l0.target,e0=m0.value,L0=m0.selectionStart||0,n0=e0.substring(0,L0)+l0.key+e0.substring(m0.selectionEnd||0);if(T0(n0)){l0.preventDefault();return}}return}l0.preventDefault()}},onChange:l0=>{const m0=l0.target.value;V0(m0),requestAnimationFrame(()=>{if(K.current){K.current.textContent=m0||"0";const e0=Math.max(K.current.offsetWidth+16,80);o0(e0)}})},onInput:l0=>{const m0=l0.target.value;if(K.current){K.current.textContent=m0||"0";const e0=Math.max(K.current.offsetWidth+16,80);o0(e0)}},onKeyUp:l0=>{const m0=l0.target.value;if(K.current){K.current.textContent=m0||"0";const e0=Math.max(K.current.offsetWidth+16,80);o0(e0)}},onFocus:l0=>{setTimeout(()=>{l0.target.select()},0)},onBlur:()=>{const l0=bn(t);l0>0&&(u==null||u(GM(l0)))},onClick:l0=>{l0.target.select()},disabled:i||x,className:"text-[80px] font-bold border-none outline-none bg-transparent flex-none p-0 m-0 text-brand dark:text-white caret-current text-center appearance-none transition-[width] duration-100 ease-in-out",style:{width:`${a0}px`}})]}),G&&G.length>0?F.jsx("div",{className:"flex flex-wrap pt-12",style:{gap:"6px"},children:G.map(l0=>F.jsxs(qe,{onClick:()=>V0(l0),disabled:i||x,surface:t===l0?"solid":"system",className:"min-w-0 flex-1",style:{flexBasis:"calc(25% - 4.5px)",minWidth:"0",...t===l0&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:["$",l0]},l0))}):null]}),F.jsx("div",{children:F.jsxs("div",{className:"flex",children:[F.jsxs(qe,{onClick:()=>d==null?void 0:d(null),disabled:i||x,surface:z?"system":"solid",className:"flex-1 rounded-r-none",style:{...!z&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[F.jsx(jT,{size:24}),"One time"]}),F.jsxs(qe,{onClick:()=>{d==null||d(x7.find(l0=>l0.id===(w==null?void 0:w.givingDefaultFrequency))||x7[2])},disabled:i||x,surface:z?"solid":"system",className:"flex-1 rounded-l-none",style:{...z&&{"--btn-bg":"rgb(var(--color-brand-primary))","--btn-hover-overlay":"rgb(255 255 255 / 15%)"}},children:[F.jsx(jV0,{size:24}),"Recurring"]})]})}),z?F.jsx(F.Fragment,{children:a?F.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[F.jsxs("div",{ref:Y,children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",children:"Frequency"}),F.jsxs(ug,{value:(a==null?void 0:a.id)||"",onChange:l0=>j(l0.target.value),disabled:i||x,required:!0,surface:"system",children:[F.jsx("option",{value:"",children:"Select a frequency"}),x7.map(l0=>F.jsx("option",{value:l0.id,children:l0.id},l0.id))]})]}),F.jsx("div",{children:F.jsx(hM1,{startDate:a.startDate??null,frequency:a,onStartDateChange:t0,disabled:i||x})})]}):F.jsxs("div",{ref:Y,children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",children:"Frequency"}),F.jsxs(ug,{value:(a==null?void 0:a.id)||"",onChange:l0=>j(l0.target.value),disabled:i||x,required:!0,surface:"system",children:[F.jsx("option",{value:"",children:"Select a frequency"}),x7.map(l0=>F.jsx("option",{value:l0.id,children:l0.id},l0.id))]})]})}):null,F.jsxs("div",{children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",children:"Campus"}),F.jsxs(ug,{value:(n==null?void 0:n.id)||"",onChange:l0=>f0(l0.target.value),disabled:i||x,required:!0,surface:"system",children:[F.jsx("option",{value:"",children:x?"Loading...":"Select a campus"}),T.map(l0=>F.jsx("option",{value:l0.id,children:l0.name},l0.id))]})]}),n?F.jsxs("div",{ref:R,children:[F.jsx(re,{className:"mb-2 text-sm",fg:"secondary",id:"fund-label",children:"Fund"}),F.jsxs(ug,{value:(r==null?void 0:r.id)||"",onChange:l0=>v0(l0.target.value),disabled:i,required:!0,surface:"system","aria-labelledby":"fund-label",children:[F.jsx("option",{value:"",children:"Select a fund"}),(W=n.donationFunds)==null?void 0:W.sort((l0,m0)=>(l0.displayOrder||0)-(m0.displayOrder||0)).map(l0=>F.jsx("option",{value:l0.id,children:l0.displayName||l0.name},l0.id))]})]}):null]})}),F.jsxs("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-system-chrome dark:bg-system-chrome-dark",children:[F.jsxs(qe,{type:"button",className:"w-full py-3",onClick:s0,disabled:i||x||!n||!r||bn(t)<=0,surface:"solid",children:["Give $",GM(bn(t))," ",z&&a?a.id:""]}),F.jsx("div",{className:"text-center mt-4 px-6",children:F.jsxs(re,{className:"text-sm",fg:"primary",children:["By making this gift, you agree to our",F.jsx("br",{})," ",F.jsx("a",{href:"https://apollos.com/terms",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Terms of Use"})," ","and"," ",F.jsx("a",{href:"https://apollos.com/privacy",target:"_blank",rel:"noopener noreferrer",className:"text-brand-primary underline",children:"Privacy Policy"}),"."]})})]})]})},RV0=({onRetry:t,theme:a})=>{var n,r;return F.jsxs("div",{className:"text-center p-6 flex flex-col items-center justify-center min-h-full",children:[F.jsx("div",{className:"mb-6",children:F.jsx(Jg,{size:64,color:((r=(n=a==null?void 0:a.colors)==null?void 0:n.base)==null?void 0:r.secondary)||"#17B582",weight:"fill"})}),F.jsx(re,{as:"h3",className:"mb-4",children:"Thank You!"}),F.jsx(re,{fg:"secondary",className:"mb-12",children:"Your donation has been processed successfully."}),F.jsx(qe,{surface:"solid",onClick:t,children:"Make Another Donation"})]})};RV0.propTypes={onRetry:t1.func.isRequired};const YM=new Map,vM1=t=>typeof window>"u"?Promise.resolve(null):(YM.has(t)||YM.set(t,Promise.resolve().then(()=>hve).then(({loadStripe:a})=>a(t)).catch(a=>(console.error("Failed to load Stripe.js",a),YM.delete(t),null))),YM.get(t)),AM1=({amount:t="0",frequency:a,message:n="",campus:r="",fund:l="",predefinedAmounts:o="",width:i="",height:c="",displayLogo:u="",title:d="",displayHeader:h="",prefilledPayment:f=null,userFirstName:A=null,userLastName:Z=null,userEmail:H=null,userPhone:y=null})=>{var _0,P0,X0,Z1,x1,me;const b=F0=>typeof F0=="string"&&parseFloat(F0)>0,S=F0=>typeof F0=="string"&&F0.trim().length>0,_=F0=>F0===null||typeof F0=="string"&&F0.trim().length>0,w=F0=>F0==null||typeof F0=="object"&&!!F0.id,P=e.useCallback(F0=>F0?b(F0.amount)&&S(F0.campusId)&&_(F0.fundId||null)&&w(F0.selectedFrequency):!1,[]),[N,T]=e.useState("setup"),[x,z]=e.useState(""),[Y,R]=e.useState(null),[X,G]=e.useState(!1),[a0,o0]=e.useState(null),[K,T0]=e.useState(()=>({amount:t,selectedFrequency:UM(a),selectedCampusId:r||null,selectedFundId:l||null,selectedCampus:null,selectedFund:null})),[V0,f0]=e.useState(!1);e.useEffect(()=>{f&&f.amount&&f.campusId&&T0({amount:f.amount,selectedFrequency:f.selectedFrequency??null,selectedCampusId:f.campusId,selectedFundId:f.fundId??null,selectedCampus:null,selectedFund:null})},[f]);const v0=e.useRef({amount:t,campus:r,fund:l}),{currentChurch:j,loading:t0,error:s0}=mp(),{campuses:W}=UT(),{matchedCampus:l0,matchedFund:m0}=rv1(W,K.selectedCampusId,K.selectedFundId),e0=yV0(),L0=WZ1(),n0=e.useMemo(()=>{var c1,_1,he,J1,xe,Se,b2,je,Ne,Ge,s2,m2,s8,mt;const F0={light:{primary:((_1=(c1=L0==null?void 0:L0.colors)==null?void 0:c1.base)==null?void 0:_1.primary)||"#00676D",background:n2.colors.light.fill.screen,componentBackground:n2.colors.light.fill.paper,componentBorder:n2.colors.light.neutral.gray5,componentDivider:n2.colors.light.neutral.gray4,primaryText:n2.colors.light.text.primary,secondaryText:n2.colors.light.text.secondary,componentText:n2.colors.light.text.primary,icon:n2.colors.light.neutral.gray},dark:{primary:((J1=(he=L0==null?void 0:L0.colors)==null?void 0:he.base)==null?void 0:J1.secondary)||"#17B582",background:n2.colors.dark.fill.screen,componentBackground:n2.colors.dark.fill.paper,componentBorder:n2.colors.dark.neutral.gray5,componentDivider:n2.colors.dark.neutral.gray4,primaryText:n2.colors.dark.text.primary,secondaryText:n2.colors.dark.text.secondary,componentText:n2.colors.dark.text.primary,icon:n2.colors.dark.neutral.gray}};return{theme:e0==="dark"?"night":"stripe",variables:{colorPrimary:((Se=(xe=L0==null?void 0:L0.colors)==null?void 0:xe.base)==null?void 0:Se.primary)||"#00676D",colorBackground:e0==="dark"?F0.dark.componentBackground:F0.light.componentBackground,colorText:e0==="dark"?F0.dark.primaryText:F0.light.primaryText,colorTextSecondary:e0==="dark"?F0.dark.secondaryText:F0.light.secondaryText,colorTextPlaceholder:e0==="dark"?F0.dark.secondaryText:F0.light.secondaryText,colorDanger:((je=(b2=L0==null?void 0:L0.colors)==null?void 0:b2.base)==null?void 0:je.alert)||"#FF4444",colorSuccess:((Ge=(Ne=L0==null?void 0:L0.colors)==null?void 0:Ne.base)==null?void 0:Ge.success)||"#17B582",colorWarning:((m2=(s2=L0==null?void 0:L0.colors)==null?void 0:s2.base)==null?void 0:m2.warning)||"#FFA500",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",fontSizeBase:"16px",spacingUnit:((s8=L0==null?void 0:L0.space)==null?void 0:s8.xxxs)||"4px",borderRadius:((mt=L0==null?void 0:L0.radii)==null?void 0:mt.base)||"6px",iconColor:e0==="dark"?F0.dark.icon:F0.light.icon}}},[L0,e0]);e.useEffect(()=>{var _1;const F0=(_1=j==null?void 0:j.stripeConnectAccount)==null?void 0:_1.publishableKey;if(!F0){o0(null);return}const c1=vM1(F0);o0(c1)},[(_0=j==null?void 0:j.stripeConnectAccount)==null?void 0:_0.publishableKey]),e.useEffect(()=>{if(!f)if(a!==void 0)T0(F0=>({...F0,selectedFrequency:UM(a)}));else if(j!=null&&j.givingDefaultFrequency){const F0=j.givingDefaultFrequency;if(F0==="One Time"||F0===null)T0(c1=>({...c1,selectedFrequency:null}));else{const c1=x7.find(_1=>_1.id===F0)||null;T0(_1=>({..._1,selectedFrequency:c1}))}}else T0(F0=>({...F0,selectedFrequency:null}))},[j==null?void 0:j.givingDefaultFrequency,f,a]),e.useEffect(()=>{!f&&t!==v0.current.amount&&t!==K.amount&&T0(F0=>({...F0,amount:t})),v0.current.amount=t},[t,f]),e.useEffect(()=>{!f&&r!==v0.current.campus&&r!==K.selectedCampusId&&T0(F0=>({...F0,selectedCampusId:r||null,selectedCampus:null,selectedFund:null,selectedFundId:null})),v0.current.campus=r},[r,f]),e.useEffect(()=>{!f&&l!==v0.current.fund&&l!==K.selectedFundId&&T0(F0=>({...F0,selectedFundId:l||null,selectedFund:null})),v0.current.fund=l},[l,f]),e.useEffect(()=>{var F0;if(!f&&K.selectedFundId&&((F0=K.selectedCampus)!=null&&F0.donationFunds)&&!K.selectedFund){let c1=K.selectedCampus.donationFunds.find(_1=>_1.id===K.selectedFundId);c1||(c1=K.selectedCampus.donationFunds.find(_1=>Zr(K.selectedFundId,_1.name)||_1.displayName&&Zr(K.selectedFundId,_1.displayName))),c1&&T0(_1=>({..._1,selectedFund:{...c1}}))}},[f,K.selectedFundId,(P0=K.selectedCampus)==null?void 0:P0.donationFunds,K.selectedFund]),e.useEffect(()=>{if(!K.selectedCampus&&l0){const F0={...l0,donationFunds:l0.donationFunds?l0.donationFunds.map(c1=>({...c1})):[]};T0(c1=>({...c1,selectedCampus:F0,selectedCampusId:F0.id,selectedFund:m0?{...m0}:c1.selectedFund}))}},[l0,m0,K.selectedCampus]);const[Z0,{loading:g0}]=tv1(),y0=e.useCallback(()=>{T("success")},[]),H0=e.useCallback(F0=>{z(F0.message)},[]),c0=e.useCallback(()=>{z("")},[]),Q0=e.useCallback(()=>{T("setup"),z(""),R(null),f0(!1),T0({amount:t,selectedFrequency:UM(a),selectedCampusId:null,selectedFundId:null,selectedCampus:null,selectedFund:null}),G(!1)},[t,a]),d0=e.useCallback(F0=>{T0(c1=>({...c1,amount:F0}))},[]),a1=e.useCallback(F0=>{T0(c1=>{var he;const _1=F0?{...F0,startDate:(he=c1.selectedFrequency)==null?void 0:he.startDate}:null;return{...c1,selectedFrequency:_1}})},[]),G0=e.useCallback(F0=>{T0(c1=>({...c1,selectedFrequency:c1.selectedFrequency?{...c1.selectedFrequency,startDate:F0??void 0}:null}))},[]),h1=e.useCallback(F0=>{T0(c1=>({...c1,selectedCampus:F0,selectedCampusId:(F0==null?void 0:F0.id)||null,selectedFund:null,selectedFundId:null}))},[]),S1=e.useCallback(F0=>{T0(c1=>({...c1,selectedFund:F0,selectedFundId:(F0==null?void 0:F0.id)||null}))},[]),g1=e.useCallback(async(F0,c1,_1,he,J1)=>{var xe;try{const Se={amount:Math.round(F0*100),campusId:_1||"",fundId:he||null};Se.recurring=YZ1(c1,J1);const{data:b2,errors:je}=await Z0({variables:{input:Se}});if(je)throw new Error(je[0].message);if((xe=b2==null?void 0:b2.createPaymentIntent)!=null&&xe.clientSecret)R(b2.createPaymentIntent.clientSecret),T("payment");else throw new Error("No client secret received from server")}catch(Se){H0(Se)}},[Z0,H0]),v1=e.useCallback(()=>{T("setup"),R(null)},[]),e1={width:i?isNaN(Number(i))?i:`${i}px`:"100%",height:c?isNaN(Number(c))?c:`${c}px`:"500px",maxWidth:i?void 0:"400px",margin:i?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0},K0=t0||!a0||g0||X;if(e.useEffect(()=>{f&&P(f)&&!t0&&!g0&&!V0&&N==="setup"&&(f0(!0),T0({amount:f.amount,selectedFrequency:f.selectedFrequency??null,selectedCampusId:f.campusId,selectedFundId:f.fundId??null,selectedCampus:null,selectedFund:null}),g1(parseFloat(f.amount),SV0(f.selectedFrequency),f.campusId,f.fundId??"",f.startDate??null))},[f,t0,g0,V0,N,g1,P]),s0)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[F.jsx(re,{fg:"secondary",className:"text-center px-8",children:"Unable to load church information. Please try again later."}),F.jsx(qe,{surface:"tinted",onClick:Q0,className:"mt-2",children:"Try Again"})]})});if(!t0&&j&&j.givingEnabled===!1)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3 space-y-2",children:[F.jsx(DM0,{size:32,weight:"duotone"}),F.jsx(re,{fg:"secondary",className:"text-center px-8",children:"Online giving is closed. For questions, please contact support."}),F.jsx(qe,{href:"mailto:support@apollos.app",surface:"tinted",className:"mt-2",children:"Contact Us"})]})});if(!t0&&j&&j.givingInMaintenance===!0)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3 space-y-2",children:[F.jsx(RM0,{size:32,weight:"duotone"}),F.jsx(re,{fg:"secondary",className:"text-center px-8",children:"We're updating the giving experience. Please check back shortly."})]})});if(!t0&&!a0)return F.jsx(i6,{style:e1,children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[F.jsx(jT,{size:32,weight:"duotone"}),F.jsx(re,{fg:"secondary",className:"text-center",children:"Online giving is not currently available. Please contact your church for assistance."}),F.jsx(qe,{href:"mailto:support@apollos.app",surface:"tinted",className:"mt-2",children:"Contact Us"})]})});if(N==="success")return F.jsx(i6,{style:e1,children:F.jsx("div",{className:"flex-1 flex flex-col justify-center items-center",children:F.jsx(RV0,{onRetry:Q0,theme:L0||void 0})})});const j0=A||Z?`${A} ${Z}`.trim():"",i1=(j==null?void 0:j.name)||"Your Church";return F.jsxs(i6,{style:e1,children:[K0?F.jsx("div",{className:"absolute inset-0 bg-material-screen dark:bg-material-screen-dark flex items-center justify-center z-[1000]",children:F.jsx($s,{size:32,className:"animate-spin mx-auto mb-2"})}):null,x?F.jsxs("div",{className:"absolute top-0 left-0 right-0 z-[50] p-3 flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-xl",style:{borderColor:((Z1=(X0=L0==null?void 0:L0.colors)==null?void 0:X0.base)==null?void 0:Z1.alert)||"#FF4444"},children:[F.jsx(zM0,{size:20,color:((me=(x1=L0==null?void 0:L0.colors)==null?void 0:x1.base)==null?void 0:me.alert)||"#FF4444",weight:"fill"}),F.jsx("div",{className:"flex-1",children:F.jsx(re,{className:"text-red-700 dark:text-red-300 font-medium text-sm",children:x})}),F.jsx(qe,{surface:"tinted",onClick:c0,className:"p-1 min-w-0 text-red-700 dark:text-red-300 hover:bg-red-100 dark:hover:bg-red-800/30",children:F.jsx(W5,{size:16})})]}):null,F.jsx("div",{className:"flex flex-col h-full min-h-[400px]",children:N==="payment"&&Y&&a0?F.jsx(eE0,{stripe:a0,options:{clientSecret:Y,appearance:n0},children:F.jsx(xV0,{amount:K!=null&&K.amount?parseFloat(K.amount):parseFloat(t),selectedFrequency:K==null?void 0:K.selectedFrequency,selectedCampusId:(K==null?void 0:K.selectedCampusId)||void 0,selectedFundId:(K==null?void 0:K.selectedFundId)||void 0,clientSecret:Y,onSuccess:y0,onError:H0,isProcessing:X,onProcessingChange:G,onBack:v1,userFullName:j0,userEmail:H||void 0,userPhone:y||void 0,churchName:i1,churchLogo:j==null?void 0:j.logo,message:n,displayLogo:u,title:d,displayHeader:h})}):F.jsx(F.Fragment,{children:N==="setup"&&!(f&&P(f)&&!V0)?F.jsx(fM1,{amount:K.amount,selectedFrequency:K.selectedFrequency,selectedCampus:K.selectedCampus,selectedFund:K.selectedFund,predefinedAmounts:o,onError:F0=>H0(new Error(F0.message)),isProcessing:g0,onAmountChange:d0,onFrequencyChange:a1,onCampusChange:h1,onFundChange:S1,onStartDateChange:G0,onShowPayment:()=>{var _1;const F0=typeof K.amount=="string"?parseFloat(K.amount):K.amount,c1=SV0(K.selectedFrequency);g1(F0,c1,K.selectedCampusId||"",K.selectedFundId||"",((_1=K.selectedFrequency)==null?void 0:_1.startDate)??null)},churchName:i1,churchLogo:j==null?void 0:j.logo,message:n,displayLogo:u,title:d,displayHeader:h}):N==="setup"&&f&&P(f)&&!V0?F.jsxs("div",{className:"flex flex-col justify-center items-center h-full min-h-[400px]",children:[F.jsx($s,{size:32,className:"animate-spin mx-auto mb-2"}),F.jsx(re,{children:"Preparing your donation..."})]}):null})})]})},gM1=t=>{const[a,n]=e.useState(!1);e.useEffect(()=>{n(!0)},[]);const r=()=>({width:t.width?isNaN(Number(t.width))?t.width:`${t.width}px`:"100%",height:t.height?isNaN(Number(t.height))?t.height:`${t.height}px`:"500px",maxWidth:t.width?void 0:"400px",margin:t.width?"0":"0 auto",border:"none",position:"relative",overflow:"hidden",padding:0});return F.jsx(LV0,{children:a?F.jsx(AM1,{...t}):F.jsx(i6,{style:r(),children:F.jsxs("div",{className:"flex-1 flex flex-col justify-center items-center p-3",children:[F.jsx($s,{size:32,className:"animate-spin mx-auto mb-2"}),F.jsx(re,{className:"text-center",children:"Loading donation form..."})]})})})},ZM1=e.forwardRef(function({to:a,href:n,isExternal:r,...l},o){const{navigate:i}=sM(),c=eH0(),u=tH0(),d=aH0(),h=mT(),f=$91();if(r&&n||!a)return F.jsx("a",{ref:o,href:n,...l});let A;if(typeof a=="object"){if(!a.contentId)return null;A=a.contentId.split(":").join("-")}else if(a!=null&&a.includes("ContentItem"))A=a.split("/").slice(-1)[0];else return null;if(!d&&!h)return F.jsx("a",{ref:o,...l,href:`https://apollos.site/@${f}/c/${A}`,target:"_blank",rel:"noopener noreferrer"});let Z=u&&h?`/ac/${A}`:`?${c?"apollosId":"id"}=${A}`;return h||(Z=`${d}${n}`),F.jsx("a",{ref:o,...l,href:Z,onClick:H=>{H.preventDefault(),i({id:A})}})}),HM1=({children:t})=>F.jsx(Vx0,{linkComponent:ZM1,children:t});function KM(){return KM=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},KM.apply(null,arguments)}function DV0(t,a){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(a.indexOf(r)>=0)continue;n[r]=t[r]}return n}function NP(t,a){return NP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},NP(t,a)}function zV0(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,NP(t,a)}function MM1(t,a){return t.classList?!!a&&t.classList.contains(a):(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+a+" ")!==-1}function EM1(t,a){t.classList?t.classList.add(a):MM1(t,a)||(typeof t.className=="string"?t.className=t.className+" "+a:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+a))}function UV0(t,a){return t.replace(new RegExp("(^|\\s)"+a+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function VM1(t,a){t.classList?t.classList.remove(a):typeof t.className=="string"?t.className=UV0(t.className,a):t.setAttribute("class",UV0(t.className&&t.className.baseVal||"",a))}const BV0={disabled:!1};var qV0={},yM1=qV0.NODE_ENV!=="production"?t1.oneOfType([t1.number,t1.shape({enter:t1.number,exit:t1.number,appear:t1.number}).isRequired]):null,bM1=qV0.NODE_ENV!=="production"?t1.oneOfType([t1.string,t1.shape({enter:t1.string,exit:t1.string,active:t1.string}),t1.shape({enter:t1.string,enterDone:t1.string,enterActive:t1.string,exit:t1.string,exitDone:t1.string,exitActive:t1.string})]):null;const WV0=Y0.createContext(null);var GV0=function(a){return a.scrollTop},LM1={},gp="unmounted",B7="exited",q7="entering",tu="entered",TP="exiting",Fl=function(t){zV0(a,t);function a(r,l){var o;o=t.call(this,r,l)||this;var i=l,c=i&&!i.isMounting?r.enter:r.appear,u;return o.appearStatus=null,r.in?c?(u=B7,o.appearStatus=q7):u=tu:r.unmountOnExit||r.mountOnEnter?u=gp:u=B7,o.state={status:u},o.nextCallback=null,o}a.getDerivedStateFromProps=function(l,o){var i=l.in;return i&&o.status===gp?{status:B7}:null};var n=a.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(l){var o=null;if(l!==this.props){var i=this.state.status;this.props.in?i!==q7&&i!==tu&&(o=q7):(i===q7||i===tu)&&(o=TP)}this.updateStatus(!1,o)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var l=this.props.timeout,o,i,c;return o=i=c=l,l!=null&&typeof l!="number"&&(o=l.exit,i=l.enter,c=l.appear!==void 0?l.appear:i),{exit:o,enter:i,appear:c}},n.updateStatus=function(l,o){if(l===void 0&&(l=!1),o!==null)if(this.cancelNextCallback(),o===q7){if(this.props.unmountOnExit||this.props.mountOnEnter){var i=this.props.nodeRef?this.props.nodeRef.current:Tm.findDOMNode(this);i&&GV0(i)}this.performEnter(l)}else this.performExit();else this.props.unmountOnExit&&this.state.status===B7&&this.setState({status:gp})},n.performEnter=function(l){var o=this,i=this.props.enter,c=this.context?this.context.isMounting:l,u=this.props.nodeRef?[c]:[Tm.findDOMNode(this),c],d=u[0],h=u[1],f=this.getTimeouts(),A=c?f.appear:f.enter;if(!l&&!i||BV0.disabled){this.safeSetState({status:tu},function(){o.props.onEntered(d)});return}this.props.onEnter(d,h),this.safeSetState({status:q7},function(){o.props.onEntering(d,h),o.onTransitionEnd(A,function(){o.safeSetState({status:tu},function(){o.props.onEntered(d,h)})})})},n.performExit=function(){var l=this,o=this.props.exit,i=this.getTimeouts(),c=this.props.nodeRef?void 0:Tm.findDOMNode(this);if(!o||BV0.disabled){this.safeSetState({status:B7},function(){l.props.onExited(c)});return}this.props.onExit(c),this.safeSetState({status:TP},function(){l.props.onExiting(c),l.onTransitionEnd(i.exit,function(){l.safeSetState({status:B7},function(){l.props.onExited(c)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(l,o){o=this.setNextCallback(o),this.setState(l,o)},n.setNextCallback=function(l){var o=this,i=!0;return this.nextCallback=function(c){i&&(i=!1,o.nextCallback=null,l(c))},this.nextCallback.cancel=function(){i=!1},this.nextCallback},n.onTransitionEnd=function(l,o){this.setNextCallback(o);var i=this.props.nodeRef?this.props.nodeRef.current:Tm.findDOMNode(this),c=l==null&&!this.props.addEndListener;if(!i||c){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var u=this.props.nodeRef?[this.nextCallback]:[i,this.nextCallback],d=u[0],h=u[1];this.props.addEndListener(d,h)}l!=null&&setTimeout(this.nextCallback,l)},n.render=function(){var l=this.state.status;if(l===gp)return null;var o=this.props,i=o.children;o.in,o.mountOnEnter,o.unmountOnExit,o.appear,o.enter,o.exit,o.timeout,o.addEndListener,o.onEnter,o.onEntering,o.onEntered,o.onExit,o.onExiting,o.onExited,o.nodeRef;var c=DV0(o,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return Y0.createElement(WV0.Provider,{value:null},typeof i=="function"?i(l,c):Y0.cloneElement(Y0.Children.only(i),c))},a}(Y0.Component);Fl.contextType=WV0,Fl.propTypes=LM1.NODE_ENV!=="production"?{nodeRef:t1.shape({current:typeof Element>"u"?t1.any:function(t,a,n,r,l,o){var i=t[a];return t1.instanceOf(i&&"ownerDocument"in i?i.ownerDocument.defaultView.Element:Element)(t,a,n,r,l,o)}}),children:t1.oneOfType([t1.func.isRequired,t1.element.isRequired]).isRequired,in:t1.bool,mountOnEnter:t1.bool,unmountOnExit:t1.bool,appear:t1.bool,enter:t1.bool,exit:t1.bool,timeout:function(a){var n=yM1;a.addEndListener||(n=n.isRequired);for(var r=arguments.length,l=new Array(r>1?r-1:0),o=1;o<r;o++)l[o-1]=arguments[o];return n.apply(void 0,[a].concat(l))},addEndListener:t1.func,onEnter:t1.func,onEntering:t1.func,onEntered:t1.func,onExit:t1.func,onExiting:t1.func,onExited:t1.func}:{};function au(){}Fl.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:au,onEntering:au,onEntered:au,onExit:au,onExiting:au,onExited:au},Fl.UNMOUNTED=gp,Fl.EXITED=B7,Fl.ENTERING=q7,Fl.ENTERED=tu,Fl.EXITING=TP;var SM1={},FM1=function(a,n){return a&&n&&n.split(" ").forEach(function(r){return EM1(a,r)})},PP=function(a,n){return a&&n&&n.split(" ").forEach(function(r){return VM1(a,r)})},$P=function(t){zV0(a,t);function a(){for(var r,l=arguments.length,o=new Array(l),i=0;i<l;i++)o[i]=arguments[i];return r=t.call.apply(t,[this].concat(o))||this,r.appliedClasses={appear:{},enter:{},exit:{}},r.onEnter=function(c,u){var d=r.resolveArguments(c,u),h=d[0],f=d[1];r.removeClasses(h,"exit"),r.addClass(h,f?"appear":"enter","base"),r.props.onEnter&&r.props.onEnter(c,u)},r.onEntering=function(c,u){var d=r.resolveArguments(c,u),h=d[0],f=d[1],A=f?"appear":"enter";r.addClass(h,A,"active"),r.props.onEntering&&r.props.onEntering(c,u)},r.onEntered=function(c,u){var d=r.resolveArguments(c,u),h=d[0],f=d[1],A=f?"appear":"enter";r.removeClasses(h,A),r.addClass(h,A,"done"),r.props.onEntered&&r.props.onEntered(c,u)},r.onExit=function(c){var u=r.resolveArguments(c),d=u[0];r.removeClasses(d,"appear"),r.removeClasses(d,"enter"),r.addClass(d,"exit","base"),r.props.onExit&&r.props.onExit(c)},r.onExiting=function(c){var u=r.resolveArguments(c),d=u[0];r.addClass(d,"exit","active"),r.props.onExiting&&r.props.onExiting(c)},r.onExited=function(c){var u=r.resolveArguments(c),d=u[0];r.removeClasses(d,"exit"),r.addClass(d,"exit","done"),r.props.onExited&&r.props.onExited(c)},r.resolveArguments=function(c,u){return r.props.nodeRef?[r.props.nodeRef.current,c]:[c,u]},r.getClassNames=function(c){var u=r.props.classNames,d=typeof u=="string",h=d&&u?u+"-":"",f=d?""+h+c:u[c],A=d?f+"-active":u[c+"Active"],Z=d?f+"-done":u[c+"Done"];return{baseClassName:f,activeClassName:A,doneClassName:Z}},r}var n=a.prototype;return n.addClass=function(l,o,i){var c=this.getClassNames(o)[i+"ClassName"],u=this.getClassNames("enter"),d=u.doneClassName;o==="appear"&&i==="done"&&d&&(c+=" "+d),i==="active"&&l&&GV0(l),c&&(this.appliedClasses[o][i]=c,FM1(l,c))},n.removeClasses=function(l,o){var i=this.appliedClasses[o],c=i.base,u=i.active,d=i.done;this.appliedClasses[o]={},c&&PP(l,c),u&&PP(l,u),d&&PP(l,d)},n.render=function(){var l=this.props;l.classNames;var o=DV0(l,["classNames"]);return Y0.createElement(Fl,KM({},o,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},a}(Y0.Component);$P.defaultProps={classNames:""},$P.propTypes=SM1.NODE_ENV!=="production"?KM({},Fl.propTypes,{classNames:bM1,onEnter:t1.func,onEntering:t1.func,onEntered:t1.func,onExit:t1.func,onExiting:t1.func,onExited:t1.func}):{};const YV0={Search:We($P)`
1964
1964
  opacity: 0;
1965
1965
  transition: opacity 0.3s ease-in-out;
1966
1966