{"version":3,"file":"Counter.DN72PRe3.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/GbsL9kmDxPLicZR1fGj3/m0I0AmRQnzlFsfvkDMky/Counter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{animate,useMotionValue,useInView}from\"framer-motion\";import{ControlType}from\"framer\";/**\n * Animated counter that counts from `start` to `end` when scrolled into view.\n *\n * SEO-safe: the server-rendered HTML always contains the final `end` value,\n * so crawlers and AI systems see the real number regardless of JS execution.\n * The animation only runs client-side after hydration.\n */export function Counter({start=1,end=10,duration=2,style={},font={fontSize:14,lineHeight:1.4,fontFamily:\"sans-serif\"},fontColor=\"#000\",locale=\"it-IT\",suffix=\"\"}){// Start with `end` so SSR markup shows the final value.\nconst[displayValue,setDisplayValue]=React.useState(end);const[hydrated,setHydrated]=React.useState(false);const motionValue=useMotionValue(start);const ref=React.useRef(null);const isInView=useInView(ref,{once:true});// After hydration, reset to `start` so the animation can play.\nReact.useEffect(()=>{setDisplayValue(start);setHydrated(true);},[start]);// Animate from `start` to `end` once the element is in viewport.\nReact.useEffect(()=>{if(!hydrated||!isInView)return;const controls=animate(motionValue,end,{duration,onUpdate:latest=>setDisplayValue(latest)});return()=>controls.stop();},[hydrated,isInView,end,duration,motionValue]);const formatted=Math.round(displayValue).toLocaleString(locale)+suffix;return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...font,color:fontColor,...style},children:formatted});}Counter.defaultProps={start:1,end:10,duration:2,style:{},font:{fontSize:14,lineHeight:1.4,fontFamily:\"sans-serif\"},fontColor:\"#000\",locale:\"it-IT\",suffix:\"\"};Counter.propertyControls={start:{type:ControlType.Number,title:\"Start\"},end:{type:ControlType.Number,title:\"End\"},duration:{type:ControlType.Number,title:\"Duration (s)\",min:.1,step:.1},locale:{type:ControlType.String,title:\"Locale\",defaultValue:\"it-IT\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},font:{type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4,fontFamily:\"sans-serif\"}},fontColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#000\"},style:{type:ControlType.Object,title:\"Style\"}};\nexport const __FramerMetadata__ = {\"exports\":{\"CounterProps\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Counter\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"gPAMG,SAAgB,EAAQ,CAAC,QAAM,EAAE,MAAI,GAAG,WAAS,EAAE,QAAM,EAAE,CAAC,OAAK,CAAC,SAAS,GAAG,WAAW,IAAI,WAAW,aAAa,CAAC,YAAU,OAAO,SAAO,QAAQ,SAAO,IAAI,CACpK,GAAK,CAAC,EAAa,GAAiBA,EAAe,EAAI,CAAM,CAAC,EAAS,GAAaA,EAAe,GAAM,CAAO,EAAY,EAAe,EAAM,CAAO,EAAIC,EAAa,KAAK,CAAO,EAAS,EAAU,EAAI,CAAC,KAAK,GAAK,CAAC,CACxN,MAAoB,CAAC,EAAgB,EAAM,CAAC,EAAY,GAAK,EAAG,CAAC,EAAM,CAAC,CACxE,MAAoB,CAAC,GAAG,CAAC,GAAU,CAAC,EAAS,OAAO,IAAM,EAAS,EAAQ,EAAY,EAAI,CAAC,WAAS,SAAS,GAAQ,EAAgB,EAAO,CAAC,CAAC,CAAC,UAAU,EAAS,MAAM,EAAG,CAAC,EAAS,EAAS,EAAI,EAAS,EAAY,CAAC,CAAC,IAAM,EAAU,KAAK,MAAM,EAAa,CAAC,eAAe,EAAO,CAAC,EAAO,OAAoB,EAAK,MAAM,CAAK,MAAI,MAAM,CAAC,GAAG,EAAK,MAAM,EAAU,GAAG,EAAM,CAAC,SAAS,EAAU,CAAC,kBAT3V,IAA4B,IAA4D,IAAgC,CASqO,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