{"version":3,"file":"Counter.DWMefRBY.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/exch2fotb6b5DN3DGR2T/jkbhYwEAnKUHm0Ukqsb2/Counter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export function Counter(props){const{start,end,speed,suffixText,font,textSize,suffixTextSize}=props;const[count,setCount]=useState(start);const[hasAnimated,setHasAnimated]=useState(false);const containerRef=useRef(null);// Verifica se está visível na tela\nuseEffect(()=>{const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting&&!hasAnimated){startAnimation();setHasAnimated(true);}},{threshold:.1});if(containerRef.current)observer.observe(containerRef.current);return()=>{if(containerRef.current)observer.unobserve(containerRef.current);};},[hasAnimated]);// Função para iniciar animação com requestAnimationFrame\nconst startAnimation=()=>{const duration=(end-start)*speed;const startTime=performance.now();const animate=currentTime=>{const elapsed=currentTime-startTime;const progress=Math.min(elapsed/duration,1);const currentCount=Math.floor(start+(end-start)*progress);setCount(currentCount);if(progress<1){requestAnimationFrame(animate);}else{setCount(end)// Garante valor final\n;}};requestAnimationFrame(animate);};const formatNumber=num=>{return num.toLocaleString(\"en-US\");};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{display:\"flex\",flexDirection:\"row\",alignItems:\"baseline\",height:\"100%\",color:\"#ffffff\",fontFamily:font.fontFamily,fontWeight:font.fontWeight},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontSize:textSize,lineHeight:1},children:\"+\"}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize:textSize,lineHeight:1},children:formatNumber(count)}),/*#__PURE__*/_jsx(\"span\",{style:{fontSize:suffixTextSize,marginLeft:4,lineHeight:1},children:suffixText})]});}Counter.defaultProps={start:0,end:100,speed:20,suffixText:\"\",font:{fontFamily:\"Inter\",fontWeight:500,systemFont:true},textSize:120,suffixTextSize:80};addPropertyControls(Counter,{start:{type:ControlType.Number,title:\"Start\"},end:{type:ControlType.Number,title:\"End\"},speed:{type:ControlType.Number,title:\"Speed (ms por n\\xfamero)\",min:1,max:100,step:1},suffixText:{type:ControlType.String,title:\"Suffix Text\"},font:{type:ControlType.Font,title:\"Font\"},textSize:{type:ControlType.Number,title:\"Text Size\",min:10,max:200},suffixTextSize:{type:ControlType.Number,title:\"Suffix Text Size\",min:10,max:200}});\nexport const __FramerMetadata__ = {\"exports\":{\"Counter\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"+LAA0J,SAAgB,EAAQ,EAAM,CAAC,GAAK,CAAC,QAAM,MAAI,QAAM,aAAW,OAAK,WAAS,kBAAgB,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAM,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAaC,EAAO,KAAK,CACrX,MAAc,CAAC,IAAM,EAAS,IAAI,sBAAsB,CAAC,KAAS,CAAI,EAAM,gBAAgB,CAAC,IAAa,GAAgB,CAAC,EAAe,GAAK,GAAI,CAAC,UAAU,GAAG,CAAC,CAAgE,OAA5D,EAAa,SAAQ,EAAS,QAAQ,EAAa,QAAQ,KAAW,CAAI,EAAa,SAAQ,EAAS,UAAU,EAAa,QAAQ,GAAK,CAAC,EAAY,CAAC,CAChU,IAAM,MAAmB,CAAC,IAAM,GAAU,EAAI,GAAO,EAAY,EAAU,YAAY,KAAK,CAAO,EAAQ,GAAa,CAAC,IAAM,EAAQ,EAAY,EAAgB,EAAS,KAAK,IAAI,EAAQ,EAAS,EAAE,CAA2D,EAAvC,KAAK,MAAM,GAAO,EAAI,GAAO,EAAS,CAAuB,CAAI,EAAS,EAAG,sBAAsB,EAAQ,CAAO,EAAS,EAAI,EACvV,sBAAsB,EAAQ,EAAiE,OAAoB,EAAM,MAAM,CAAC,IAAI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