{"version":3,"file":"CountUp.C35o7ZY2.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/dYUzLymdgR0hTWR1OBX7/DR8GqGnzhlg1JzCyeMZ8/CountUp.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CountUp(props){const{targetNumber,duration,font,color,decimalPlaces}=props;const[count,setCount]=useState(0);const[isVisible,setIsVisible]=useState(false);const[hasAnimated,setHasAnimated]=useState(false);const ref=useRef(null);useEffect(()=>{const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting&&!hasAnimated){startTransition(()=>{setIsVisible(true);setHasAnimated(true);});let start=0;const increment=targetNumber/(duration*60);const updateCounter=()=>{start+=increment;if(start<targetNumber){startTransition(()=>setCount(start));requestAnimationFrame(updateCounter);}else{startTransition(()=>setCount(targetNumber));}};updateCounter();}},{threshold:.1});const currentRef=ref.current;if(currentRef){observer.observe(currentRef);}return()=>{if(currentRef){observer.unobserve(currentRef);}};},[targetNumber,duration,hasAnimated]);return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,ref:ref,children:/*#__PURE__*/_jsx(\"span\",{style:{...textStyle,...font,color:color,opacity:isVisible?1:0,transition:\"opacity 1.5s ease-in-out\"},children:count.toLocaleString(undefined,{minimumFractionDigits:decimalPlaces,maximumFractionDigits:decimalPlaces})})});}// Styles are written in object syntax\nconst containerStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\"};const textStyle={letterSpacing:\"0em\",textAlign:\"center\",margin:\"0\"};// Adding property controls for Framer\naddPropertyControls(CountUp,{targetNumber:{type:ControlType.Number,title:\"Target Number\",defaultValue:100},decimalPlaces:{type:ControlType.Number,title:\"Decimal Places\",defaultValue:0,min:0,max:4,step:1},duration:{type:ControlType.Number,title:\"Duration (s)\",defaultValue:2,step:.1},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"54px\",variant:\"Regular\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUp.map"],"mappings":"+LAMG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,eAAa,WAAS,OAAK,QAAM,iBAAe,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAE,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAIC,EAAO,KAAK,CAAknB,OAAjnB,MAAc,CAAC,IAAM,EAAS,IAAI,sBAAsB,CAAC,KAAS,CAAC,GAAG,EAAM,gBAAgB,CAAC,EAAY,CAAC,MAAoB,CAAC,EAAa,GAAK,CAAC,EAAe,GAAK,EAAG,CAAC,IAAI,EAAM,EAAQ,EAAU,GAAc,EAAS,IAAU,MAAkB,CAAC,GAAO,EAAa,EAAM,GAAc,MAAoB,EAAS,EAAM,CAAC,CAAC,sBAAsB,EAAc,EAAO,MAAoB,EAAS,EAAa,CAAC,EAAI,GAAe,GAAI,CAAC,UAAU,GAAG,CAAC,CAAO,EAAW,EAAI,QAAqD,OAA1C,GAAY,EAAS,QAAQ,EAAW,KAAY,CAAI,GAAY,EAAS,UAAU,EAAW,GAAM,CAAC,EAAa,EAAS,EAAY,CAAC,CAAqB,EAAK,MAAM,CAAC,MAAM,EAAmB,MAAI,SAAsB,EAAK,OAAO,CAAC,MAAM,CAA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