{"version":3,"file":"FunfactCounter.D0EBakRi.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/ppf9vxPH7OILGhj9PzdH/SsrpYnbBKAtUlP4RaL54/FunfactCounter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";function withFunfactCounter(Component){function FunfactCounter(props){const rootRef=useRef(null);const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;const root=rootRef.current;if(!root)return;const original=(root.textContent||\"\").trim();// Framer often applies text color on an inner span. Replacing\n// textContent removes that span, so capture and promote its color\n// to the root before the counter starts.\nconst colorSource=Array.from(root.querySelectorAll(\"*\")).find(element=>(element.textContent||\"\").trim().length>0);const animatedColor=window.getComputedStyle(colorSource||root).color;const originalInlineColor=root.style.color;const originalColorPriority=root.style.getPropertyPriority(\"color\");root.style.setProperty(\"color\",animatedColor,\"important\");const match=original.match(/^(.*?)(-?\\d[\\d,.]*)(.*)$/);if(!match)return;const prefix=match[1];const numeric=match[2].replace(/,/g,\"\");const suffix=match[3];const target=Number(numeric);if(!Number.isFinite(target))return;const reduceMotion=window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;let frame=0;let observer=null;let started=false;const render=value=>{const rounded=Math.round(value);root.textContent=prefix+rounded.toLocaleString(\"en-US\")+suffix;};const animate=()=>{if(started)return;started=true;if(reduceMotion){render(target);return;}const start=performance.now();const duration=1400;const tick=now=>{const progress=Math.min(1,(now-start)/duration);const eased=1-Math.pow(1-progress,4);render(target*eased);if(progress<1)frame=window.requestAnimationFrame(tick);};render(0);frame=window.requestAnimationFrame(tick);};observer=new IntersectionObserver(entries=>{if(entries.some(entry=>entry.isIntersecting)){animate();observer?.disconnect();}},{threshold:.35});observer.observe(root);return()=>{observer?.disconnect();if(frame)window.cancelAnimationFrame(frame);root.textContent=original;if(originalInlineColor){root.style.setProperty(\"color\",originalInlineColor,originalColorPriority);}else{root.style.removeProperty(\"color\");}};},[isStatic]);addPropertyControls(FunfactCounter,{duration:{type:ControlType.Number,title:\"Count Duration\",defaultValue:1.4,min:.4,max:3,step:.1,unit:\"s\"}});return /*#__PURE__*/_jsx(Component,{...props,ref:rootRef,style:{...props.style,fontFamily:\"Manrope\",fontSize:props.style?.fontSize??\"4rem\",fontWeight:600,fontStyle:\"normal\",letterSpacing:\"-0.03em\",lineHeight:1.2}});}return FunfactCounter;}export{withFunfactCounter};\nexport const __FramerMetadata__ = {\"exports\":{\"withFunfactCounter\":{\"type\":\"reactHoc\",\"name\":\"withFunfactCounter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FunfactCounter.map"],"mappings":"uMAAuJ,SAAS,EAAmB,EAAU,CAAC,SAAS,EAAe,EAAM,CAAC,IAAM,EAAQA,EAAO,IAAI,EAAQ,EAAS,EAAoB,EAGs8C,OAHp8C,MAAc,CAAC,GAAG,GAAiB,IAAS,OAAY,OAAO,IAAM,EAAK,EAAQ,QAAQ,GAAG,CAAC,EAAK,OAAO,IAAM,GAAU,EAAK,aAAa,GAAA,CAAI,KAAK,EAG5a,EAAY,MAAM,KAAK,EAAK,iBAAiB,GAAG,CAAC,CAAC,CAAC,KAAK,IAAU,EAAQ,aAAa,GAAA,CAAI,KAAK,CAAC,CAAC,OAAO,CAAC,EAAQ,EAAc,EAAO,iBAAiB,GAAa,CAAI,CAAC,CAAC,MAAY,EAAoB,EAAK,MAAM,MAAY,EAAsB,EAAK,MAAM,oBAAoB,OAAO,EAAE,EAAK,MAAM,YAAY,QAAQ,EAAc,WAAW,EAAE,IAAM,EAAM,EAAS,MAAM,0BAA0B,EAAE,GAAG,CAAC,EAAM,OAAO,IAAM,EAAO,EAAM,GAAS,EAAQ,EAAM,EAAE,CAAC,QAAQ,KAAK,EAAE,EAAQ,EAAO,EAAM,GAAS,EAAO,OAAO,CAAO,EAAE,GAAG,CAA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