{"version":3,"file":"Counter.BjUYu0Ne.mjs","names":["useState","useRef","__esmMin","te","init_npm_react_18_3_1","_e","de","p","ce","addPropertyControls","ControlType","init_framer_Duogf4LG","Counter","props","count","setCount","hasStarted","setHasStarted","counterRef","autoStart","observer","entries","numericTarget","targetNumber","startTime","endTime","duration","updateCount","now","progress","currentCount","numberColor","numberFont","prefix","suffix","title","titleColor","titleFont","init_Counter","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/vlFUL3q9SS1yvoyozXpi/tWO6tEFGS4sAhISUAddt/Counter.js"],"sourcesContent":["// Counter component with prefix, suffix, and title options\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState,useRef,startTransition}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter(props){const{prefix=\"\",targetNumber=\"230\",suffix=\"+\",title=\"Client Feedback\",duration=2e3,numberColor=\"#000000\",titleColor=\"#FF6B35\",numberFont,titleFont,autoStart=true}=props;const[count,setCount]=useState(0);const[hasStarted,setHasStarted]=useState(false);const counterRef=useRef(null);useEffect(()=>{if(!autoStart||hasStarted)return;const observer=new IntersectionObserver(entries=>{if(entries[0].isIntersecting){startTransition(()=>setHasStarted(true));}},{threshold:.1});if(counterRef.current){observer.observe(counterRef.current);}return()=>observer.disconnect();},[autoStart,hasStarted]);useEffect(()=>{if(!hasStarted&&autoStart)return;if(!autoStart&&!hasStarted){startTransition(()=>setHasStarted(true));return;}const numericTarget=parseFloat(targetNumber)||0;const startTime=Date.now();const endTime=startTime+duration;const updateCount=()=>{const now=Date.now();const progress=Math.min((now-startTime)/duration,1);// Linear counting, no easing\nconst currentCount=Math.floor(progress*numericTarget);startTransition(()=>setCount(currentCount));if(now<endTime){requestAnimationFrame(updateCount);}else{startTransition(()=>setCount(numericTarget));}};requestAnimationFrame(updateCount);},[hasStarted,targetNumber,duration,autoStart]);return /*#__PURE__*/_jsxs(\"div\",{ref:counterRef,style:{display:\"flex\",flexDirection:\"column\",alignItems:\"flex-start\",gap:8,width:\"max-content\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"baseline\",color:numberColor,...numberFont},children:[prefix&&/*#__PURE__*/_jsx(\"span\",{children:prefix}),/*#__PURE__*/_jsx(\"span\",{children:count}),suffix&&/*#__PURE__*/_jsx(\"span\",{children:suffix})]}),title&&/*#__PURE__*/_jsx(\"span\",{style:{color:titleColor,...titleFont},children:title})]});}addPropertyControls(Counter,{prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},targetNumber:{type:ControlType.String,title:\"Target Number\",defaultValue:\"230\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"+\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Client Feedback\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2e3,min:100,max:1e4,step:100,unit:\"ms\"},autoStart:{type:ControlType.Boolean,title:\"Auto Start\",defaultValue:true,enabledTitle:\"On Scroll\",disabledTitle:\"Immediate\"},numberColor:{type:ControlType.Color,title:\"Number Color\",defaultValue:\"#000000\"},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#FF6B35\"},numberFont:{type:ControlType.Font,title:\"Number Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"64px\",variant:\"Bold\",letterSpacing:\"-0.02em\",lineHeight:\"1em\"}},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Medium\",letterSpacing:\"0em\",lineHeight:\"1.2em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//#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