{"version":3,"file":"CountUp.B-R06r_0.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/QCr34QU79YhKVH4MM8e0/q4TSygfoUOCKCocjkIhe/CountUp.js"],"sourcesContent":["// Number count up component with CMS integration\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CountUp(props){const{targetValue=1e3,duration=2e3,prefix=\"\",suffix=\"\",decimals=0,separator=true,textColor=\"#000000\",font,style}=props;const[count,setCount]=useState(0);const[isInView,setIsInView]=useState(false);const[hasAnimated,setHasAnimated]=useState(false);const elementRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting&&!hasAnimated){startTransition(()=>setIsInView(true));}},{threshold:.1});if(elementRef.current){observer.observe(elementRef.current);}return()=>{if(elementRef.current){observer.unobserve(elementRef.current);}};},[hasAnimated]);useEffect(()=>{if(!isInView||hasAnimated)return;const startTime=Date.now();const startValue=0;const animate=()=>{const currentTime=Date.now();const elapsed=currentTime-startTime;const progress=Math.min(elapsed/duration,1);const easeOutQuart=1-Math.pow(1-progress,4);const currentCount=startValue+(targetValue-startValue)*easeOutQuart;startTransition(()=>setCount(currentCount));if(progress<1){requestAnimationFrame(animate);}else{startTransition(()=>{setCount(targetValue);setHasAnimated(true);});}};requestAnimationFrame(animate);},[isInView,targetValue,duration,hasAnimated]);const formatNumber=num=>{const fixed=num.toFixed(decimals);if(!separator)return fixed;const parts=fixed.split(\".\");parts[0]=parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g,\".\");return parts.join(\".\");};const displayValue=formatNumber(count);return /*#__PURE__*/_jsx(\"div\",{ref:elementRef,style:{...style,position:\"relative\",width:\"max-content\",minWidth:\"max-content\"},children:/*#__PURE__*/_jsxs(\"span\",{style:{color:textColor,...font,whiteSpace:\"nowrap\"},children:[prefix,displayValue,suffix]})});}addPropertyControls(CountUp,{targetValue:{type:ControlType.Number,title:\"Target Value\",defaultValue:1e3,min:0,step:1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2e3,min:100,max:1e4,step:100,unit:\"ms\"},decimals:{type:ControlType.Number,title:\"Decimals\",defaultValue:0,min:0,max:4,step:1},separator:{type:ControlType.Boolean,title:\"Separator\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"+\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUp.map"],"mappings":"oNAIG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,cAAY,IAAI,WAAS,IAAI,SAAO,GAAG,SAAO,GAAG,WAAS,EAAE,YAAU,GAAK,YAAU,UAAU,OAAK,SAAO,EAAW,CAAC,EAAM,GAAUA,EAAS,CAAC,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAAQ,EAAWC,EAAO,IAAI,EAAE,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAS,IAAI,sBAAsB,CAAC,KAAS,CAAI,EAAM,gBAAgB,CAAC,GAAa,MAAoB,EAAY,E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