{"version":3,"file":"Number_Count_2.BiZ1u5IV.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/TBaO6icIuiVpywER8TyR/2TDYsqN7vspMdmPhM6oP/Number_Count_2.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";export function NumberCounter(props){const{prefix=\"\",startNumber=null,endNumber=null,suffix=\"\",speed=100,loop=false,fontSize=16,fontColor=\"#19191D\",showNumber=true,decimalSeparator=\"comma\"}=props;const[count,setCount]=useState(startNumber);const[isVisible,setIsVisible]=useState(false);const ref=useRef(null);// Visibility observer\nuseEffect(()=>{const observer=new IntersectionObserver(entries=>{setIsVisible(entries[0].isIntersecting);});if(ref.current)observer.observe(ref.current);return()=>ref.current&&observer.unobserve(ref.current);},[]);// Counting effect\nuseEffect(()=>{if(isVisible&&startNumber!==null&&endNumber!==null&&startNumber!==endNumber&&showNumber){const intervalId=setInterval(()=>{setCount(prev=>prev<endNumber?prev+1:loop?startNumber:prev);},speed);return()=>clearInterval(intervalId);}},[count,startNumber,endNumber,loop,isVisible,speed,showNumber]);// Format number\nconst formatCount=number=>{if(!showNumber||number===null)return\"\";if(decimalSeparator===\"comma\")return number.toLocaleString(\"en-US\");if(decimalSeparator===\"period\")return number.toLocaleString(\"en-US\").replace(/,/g,\".\");return number.toFixed(0);};return /*#__PURE__*/_jsxs(motion.div,{ref:ref,style:{display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",textAlign:\"center\",fontFamily:\"'Roboto', sans-serif\",fontWeight:500,color:fontColor,lineHeight:1.2,whiteSpace:\"normal\",padding:\"0 4px\"},children:[prefix&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:`${fontSize}px`,fontWeight:500},children:prefix}),endNumber!==null&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:`${fontSize}px`,fontWeight:500},children:formatCount(count)}),suffix&&/*#__PURE__*/_jsx(\"span\",{style:{fontSize:`${fontSize*.75}px`,color:\"#6B6B6B\",fontWeight:400},children:suffix})]});}NumberCounter.defaultProps={prefix:\"\",startNumber:null,endNumber:null,speed:100,suffix:\"\",loop:false,decimalSeparator:\"comma\",fontSize:16,fontColor:\"#19191D\",showNumber:true};addPropertyControls(NumberCounter,{prefix:{type:ControlType.String,title:\"Prefix\"},startNumber:{type:ControlType.Number,title:\"Start Number\",defaultValue:null},endNumber:{type:ControlType.Number,title:\"End Number\",defaultValue:null},suffix:{type:ControlType.String,title:\"Suffix\"},fontSize:{title:\"Font Size\",type:ControlType.Number,min:8,max:200,step:1},fontColor:{type:ControlType.Color,title:\"Font Color\"},speed:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:100},loop:{type:ControlType.Boolean,title:\"Loop Animation\",defaultValue:false},showNumber:{type:ControlType.Boolean,title:\"Show Number\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"NumberCounter\":{\"type\":\"reactComponent\",\"name\":\"NumberCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Number_Count_2.map"],"mappings":"yWAA4L,SAAgB,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO,GAAG,cAAY,KAAK,YAAU,KAAK,SAAO,GAAG,QAAM,IAAI,OAAK,GAAM,WAAS,GAAG,YAAU,UAAU,aAAW,GAAK,mBAAiB,SAAS,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAY,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAIC,EAAO,KAAK,CAGxP,OAFxP,MAAc,CAAC,IAAM,EAAS,IAAI,qBAAqB,GAAS,CAAC,EAAa,EAAQ,GAAG,eAAe,EAAG,CAA8C,OAA1C,EAAI,SAAQ,EAAS,QAAQ,EAAI,QAAQ,KAAW,EAAI,SAAS,EAAS,UAAU,EAAI,QAAQ,EAAG,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