{"version":3,"file":"Number_Counter.BvvyYnAz.mjs","names":["useState","useRef","__esmMin","init_npm_react_18_3_1","te","window","ce","init_jsx_runtime","c","p","_e","de","init_ssg_sandbox_shims","motion","init_framer_motion_DhsWWWsN","addPropertyControls","init_framer_Bf4_tcb2","ControlType","Counter","count","setCount","start","hasAnimated","setHasAnimated","containerRef","rafRef","type","TEXT_STYLES","textStyle","cls","css","easeOutCubic","t","startOnViewport","observer","entry","startTime","cancelled","animate","ts","elapsed","duration","eased","value","incrementType","end","formatNumber","decimalSeparatorType","number","gapSize","textColor","style","prefixText","prefixColor","suffixText","suffixColor","init_Number_Counter"],"sources":["https:/framerusercontent.com/modules/EtKqKS34VVG2qngCa2Of/6hkDl64XAbfV2U1SZ5Rk/Number_Counter.js"],"sourcesContent":["// Number Counter with ease-out animation, runs once on first viewport entry.\n// Typography comes from the site text styles (Display / Heading XL / Heading M)\n// so every counter matches the rest of the site. Only the colours are free.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";// Mirrors the site Text Styles (new-typography). Update here if the styles change.\n// fontSize is [phone (<760px), tablet (760px+), desktop (1440px+)] to match the site text style breakpoints.\nconst TEXT_STYLES={display:{fontSize:[40,56,56],lineHeight:1.07,fontWeight:700,letterSpacing:\"-0.03em\"},headingXL:{fontSize:[32,48,56],lineHeight:1.08,fontWeight:700,letterSpacing:\"-0.025em\"},headingM:{fontSize:[17,19,19],lineHeight:1.21,fontWeight:600,letterSpacing:\"0.012em\"}};/**\n * Number Counter with ease-out animation, runs once on first viewport entry\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */function Counter({start=0,end=100,duration=2,gapSize=4,prefixText=\"\",suffixText=\"\",prefixColor,suffixColor,decimalSeparatorType=\"comma\",textStyle=\"display\",textColor=\"#1D1D1F\",startOnViewport=false,incrementType=\"integer\",style}){const[count,setCount]=useState(start);const[hasAnimated,setHasAnimated]=useState(false);const containerRef=useRef(null);const rafRef=useRef(null);const type=TEXT_STYLES[textStyle]||TEXT_STYLES.display;const styleKey=textStyle in TEXT_STYLES?textStyle:\"display\";const cls=`fc-counter-${styleKey}`;const css=`.${cls}{font-size:${type.fontSize[0]}px}@media (min-width:760px){.${cls}{font-size:${type.fontSize[1]}px}}@media (min-width:1440px){.${cls}{font-size:${type.fontSize[2]}px}}`;function easeOutCubic(t){return 1-Math.pow(1-t,3);}useEffect(()=>{if(!startOnViewport){if(!hasAnimated)setHasAnimated(true);return;}if(typeof window===\"undefined\")return;const observer=new window.IntersectionObserver(([entry])=>{if(entry.isIntersecting&&!hasAnimated){startTransition(()=>setHasAnimated(true));}});if(containerRef.current)observer.observe(containerRef.current);return()=>observer.disconnect();},[startOnViewport,hasAnimated]);useEffect(()=>{if(!hasAnimated)return;let startTime=null;let cancelled=false;function animate(ts){if(cancelled)return;if(!startTime)startTime=ts;const elapsed=(ts-startTime)/1e3;const t=Math.min(elapsed/duration,1);const eased=easeOutCubic(t);let value;if(incrementType===\"integer\"){value=Math.round(start+(end-start)*eased);}else{value=parseFloat((start+(end-start)*eased).toFixed(1));}setCount(value);if(t<1){rafRef.current=requestAnimationFrame(animate);}else{setCount(end);}}rafRef.current=requestAnimationFrame(animate);return()=>{cancelled=true;if(rafRef.current)cancelAnimationFrame(rafRef.current);};},[hasAnimated,start,end,duration,incrementType]);const formatNumber=number=>{if(decimalSeparatorType===\"comma\")return number.toLocaleString(\"en-US\");if(decimalSeparatorType===\"period\")return number.toLocaleString(\"en-US\").replace(/,/g,\".\");return number.toFixed(incrementType===\"integer\"?0:1);};return /*#__PURE__*/_jsxs(motion.div,{ref:containerRef,className:cls,style:{display:\"flex\",gap:`${gapSize}px`,alignItems:\"baseline\",color:textColor,fontFamily:\"Inter, sans-serif\",lineHeight:type.lineHeight,fontWeight:type.fontWeight,letterSpacing:type.letterSpacing,...style},children:[/*#__PURE__*/_jsx(\"style\",{children:css}),prefixText&&/*#__PURE__*/_jsx(\"span\",{style:{color:prefixColor},children:prefixText}),/*#__PURE__*/_jsx(\"span\",{children:formatNumber(count)}),suffixText&&/*#__PURE__*/_jsx(\"span\",{style:{color:suffixColor},children:suffixText})]});}addPropertyControls(Counter,{textStyle:{type:ControlType.Enum,title:\"Text Style\",defaultValue:\"display\",options:[\"display\",\"headingXL\",\"headingM\"],optionTitles:[\"Display\",\"Heading XL\",\"Heading M\"]},textColor:{type:ControlType.Color,title:\"Colour\",defaultValue:\"#1D1D1F\"},startOnViewport:{type:ControlType.Boolean,title:\"Viewport\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},start:{type:ControlType.Number,title:\"Start Number\",defaultValue:0},end:{type:ControlType.Number,title:\"End Number\",defaultValue:100},duration:{type:ControlType.Number,title:\"Duration (s)\",defaultValue:2,min:0,step:.1},decimalSeparatorType:{type:ControlType.Enum,title:\"Separator\",defaultValue:\"comma\",options:[\"comma\",\"period\",\"none\"]},incrementType:{type:ControlType.Enum,title:\"Increment Type\",defaultValue:\"integer\",options:[\"integer\",\"decimal\"]},prefixText:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},prefixColor:{type:ControlType.Color,title:\"Prefix Color\",defaultValue:\"#1D1D1F\"},suffixText:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},suffixColor:{type:ControlType.Color,title:\"Suffix Color\",defaultValue:\"#C6F75E\"},gapSize:{type:ControlType.Number,title:\"Gap Size\",defaultValue:4,min:0,max:100}});export default Counter;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Number_Counter.map"],"mappings":"A,qQAUG,SAASk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