{"version":3,"file":"Counter.D4LonXIP.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/tppu5TBUwn2bCMQ2U0Lw/qSmurZvqE5bUXabbcQQs/Counter.js"],"sourcesContent":["// Animated counter from 0 to 1350 with smooth animation\nimport{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Animated Counter\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 80\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter(props){const{from,to,duration,font,color,decimals,style,animateOnScroll}=props;const[value,setValue]=useState(from);const[hasAnimated,setHasAnimated]=useState(false);const raf=useRef();const start=useRef();const isStatic=useIsStaticRenderer();const containerRef=useRef(null);// Intersection Observer for scroll trigger\nuseEffect(()=>{if(!animateOnScroll)return;if(isStatic)return;const node=containerRef.current;if(!node)return;let observer;function handleIntersect(entries){if(entries[0].isIntersecting){setHasAnimated(true);observer.disconnect();}}observer=new window.IntersectionObserver(handleIntersect,{threshold:.3});observer.observe(node);return()=>observer&&observer.disconnect();},[animateOnScroll,isStatic]);useEffect(()=>{if(isStatic){startTransition(()=>setValue(to));return;}if(animateOnScroll){if(!hasAnimated){startTransition(()=>setValue(from));return;}}startTransition(()=>setValue(from));function animate(ts){if(!start.current)start.current=ts;const elapsed=ts-start.current;const progress=Math.min(elapsed/duration,1);const current=from+(to-from)*easeOutExpo(progress);startTransition(()=>setValue(current));if(progress<1){raf.current=requestAnimationFrame(animate);}else{startTransition(()=>setValue(to));}}raf.current=requestAnimationFrame(animate);return()=>{if(raf.current)cancelAnimationFrame(raf.current);start.current=undefined;};},[from,to,duration,isStatic,animateOnScroll,hasAnimated]);function easeOutExpo(x){return x===1?1:1-Math.pow(2,-10*x);}return /*#__PURE__*/_jsxs(\"span\",{ref:containerRef,style:{...style,...font,color,display:\"inline-block\",minWidth:\"max-content\",textAlign:\"right\"},\"aria-label\":`Counter: ${to}`,children:[props.prefix,Number(value).toLocaleString(undefined,{minimumFractionDigits:decimals,maximumFractionDigits:decimals}),props.suffix]});}addPropertyControls(Counter,{animateOnScroll:{type:ControlType.Boolean,title:\"Animate on Scroll\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"+\"},from:{type:ControlType.Number,title:\"From\",defaultValue:0,min:0},to:{type:ControlType.Number,title:\"To\",defaultValue:1350,min:0},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1200,min:200,max:5e3,unit:\"ms\"},decimals:{type:ControlType.Number,title:\"Decimals\",defaultValue:0,min:0,max:4,step:1,displayStepper:true},color:{type:ControlType.Color,title:\"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\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerIntrinsicWidth\":\"200\",\"framerIntrinsicHeight\":\"80\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"iNASG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,OAAK,KAAG,WAAS,OAAK,QAAM,WAAS,QAAM,mBAAiB,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAK,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAIC,GAAQ,CAAO,EAAMA,GAAQ,CAAO,EAAS,GAAqB,CAAO,EAAaA,EAAO,KAAK,CACrT,MAAc,CAA4B,GAAxB,CAAC,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