{"version":3,"file":"MetricCounter.CelUYPjg.mjs","names":["React.useRef","React.useState","__esmMin","init_npm_react_18_3_1","_e","de","c","init_jsx_runtime","ce","addPropertyControls","init_framer_Bf4_tcb2","ControlType","MetricCounter","ref","hasStarted","setHasStarted","current","setCurrent","element","observer","entry","frame","startedAt","animate","now","progress","duration","eased","value","prefix","suffix","style","init_MetricCounter"],"sources":["https:/framerusercontent.com/modules/zVWY5wQutQWgjDDUcwiE/xU1MAcdwIbgzK8JjSw0d/MetricCounter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// @framerSupportedLayoutWidth any-prefer-fill\n// @framerSupportedLayoutHeight fixed\nexport default function MetricCounter({value=90,prefix=\"\",suffix=\"%\",duration=1.2,fontSize=76,color=\"rgba(0, 0, 0, 0.9)\",style}){const ref=React.useRef(null);const[hasStarted,setHasStarted]=React.useState(false);const[current,setCurrent]=React.useState(0);React.useEffect(()=>{const element=ref.current;if(!element||hasStarted)return;const observer=new IntersectionObserver(([entry])=>{if(!entry.isIntersecting)return;setHasStarted(true);observer.disconnect();},{threshold:.4});observer.observe(element);return()=>observer.disconnect();},[hasStarted]);React.useEffect(()=>{if(!hasStarted)return;let frame=0;let startedAt=0;const animate=now=>{if(!startedAt)startedAt=now;const progress=Math.min((now-startedAt)/(duration*1e3),1);const eased=1-Math.pow(1-progress,3);setCurrent(Math.round(value*eased));if(progress<1)frame=requestAnimationFrame(animate);};frame=requestAnimationFrame(animate);return()=>cancelAnimationFrame(frame);},[duration,hasStarted,value]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,\"aria-label\":`${prefix}${value}${suffix}`,style:{width:\"100%\",height:\"auto\",fontFamily:\"Inter, sans-serif\",fontSize,fontWeight:400,lineHeight:.92,letterSpacing:\"-0.06em\",color,fontVariantNumeric:\"tabular-nums\",...style},children:`${prefix}${current}${suffix}`});}addPropertyControls(MetricCounter,{value:{type:ControlType.Number,title:\"Value\",defaultValue:90,min:0,step:1},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"%\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1.2,min:.2,max:5,step:.1},fontSize:{type:ControlType.Number,title:\"Size\",defaultValue:76,min:16,max:160,step:1},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgba(0, 0, 0, 0.9)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"MetricCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./MetricCounter.map"],"mappings":"A,wLAEA,SAAwBY,EAAc,CAAC,QAAM,GAAG,SAAO,GAAG,SAAO,IAAI,WAAS,IAAI,WAAS,GAAG,QAAM,qBAAqB,SAAO,CAAC,IAAMC,EAAIb,EAAa,IAAI,EAAO,CAACc,EAAWC,GAAed,EAAe,EAAK,EAAO,CAACe,EAAQC,GAAYhB,EAAe,CAAC,EAAmsB,OAAjsBO,MAAoB,CAAC,IAAMU,EAAQL,EAAI,QAAQ,GAAG,CAACK,GAASJ,EAAW,OAAO,IAAMK,EAAS,IAAI,sBAAsB,CAACC,KAAS,CAAKA,EAAM,iBAAsBL,EAAc,EAAI,EAAEI,EAAS,WAAW,EAAE,EAAE,CAAC,UAAU,EAAE,CAAC,EAA4B,OAA1BA,EAAS,QAAQD,CAAO,MAAYC,EAAS,WAAW,CAAE,EAAE,CAACL,CAAU,CAAC,EAAEN,MAAoB,CAAC,GAAG,CAACM,EAAW,OAAO,IAAIO,EAAM,EAAMC,EAAU,EAAQC,EAAQ,GAAK,CAAC,AAAcD,IAAUE,EAAI,IAAMC,EAAS,KAAK,KAAKD,EAAIF,IAAYI,EAAS,KAAK,CAAC,EAAQC,EAAM,GAAW,EAA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