{"version":3,"file":"Count_Up.DqlGJODU.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/eLJxjzEXQ4CG3mQYAluJ/J7VKXtjKnCvBxOgWmbYr/Count_Up.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * COUNT UP\n *\n * Animates a number from a start value to an end value when scrolled into view.\n * Animation triggers only the first time the component enters the viewport.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 60\n */export default function CountUp(props){const{prefix,suffix,startValue,endValue,duration,showDecimals,decimals,useThousandsSeparator,easing,fontFamily,fontSizeDesktop,fontSizeMobile,fontWeight,lineHeight,textColor}=props;const ref=useRef(null);const hasAnimated=useRef(false);const[displayValue,setDisplayValue]=useState(startValue);const[isMobile,setIsMobile]=useState(false);// Track viewport size for responsive font sizing\nuseEffect(()=>{const checkMobile=()=>{setIsMobile(window.innerWidth<768);};checkMobile();window.addEventListener(\"resize\",checkMobile);return()=>window.removeEventListener(\"resize\",checkMobile);},[]);// Easing functions\nconst easingFunctions={easeOut:t=>1-Math.pow(1-t,3),easeIn:t=>t*t*t,easeInOut:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,linear:t=>t};// Run the count-up animation\nconst animate=()=>{const startTime=performance.now();const easeFn=easingFunctions[easing]||easingFunctions.easeOut;const totalDuration=duration*1e3;const step=currentTime=>{const elapsed=currentTime-startTime;const progress=Math.min(elapsed/totalDuration,1);const eased=easeFn(progress);const currentValue=startValue+(endValue-startValue)*eased;setDisplayValue(currentValue);if(progress<1){requestAnimationFrame(step);}else{setDisplayValue(endValue);}};requestAnimationFrame(step);};// Set up the IntersectionObserver to trigger animation on scroll into view\nuseEffect(()=>{if(!ref.current)return;const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{if(entry.isIntersecting&&!hasAnimated.current){hasAnimated.current=true;animate();observer.disconnect();}});},{threshold:.1});observer.observe(ref.current);return()=>observer.disconnect();},[startValue,endValue,duration,easing]);// Format the displayed number\nconst formatNumber=value=>{const fixed=showDecimals?value.toFixed(decimals):Math.round(value).toString();if(!useThousandsSeparator)return fixed;// Add thousands separator (comma) to integer part only\nconst parts=fixed.split(\".\");parts[0]=parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");return parts.join(\".\");};const textStyle={fontFamily,fontSize:isMobile?fontSizeMobile:fontSizeDesktop,fontWeight,lineHeight,color:textColor,display:\"inline-block\",whiteSpace:\"pre\",margin:0,padding:0};return /*#__PURE__*/_jsxs(\"span\",{ref:ref,style:textStyle,children:[prefix,formatNumber(displayValue),suffix]});}// Default values match the spec provided\nCountUp.defaultProps={prefix:\"\",suffix:\"\",startValue:0,endValue:100,duration:3,showDecimals:false,decimals:2,useThousandsSeparator:false,easing:\"easeOut\",fontFamily:'\"Hanken Grotesk\", \"Hanken Grotesk Placeholder\", sans-serif',fontSizeDesktop:44,fontSizeMobile:24,fontWeight:700,lineHeight:\"1em\",textColor:\"rgb(14, 55, 39)\"};addPropertyControls(CountUp,{// ─── CONTENT ──────────────────────────────────────────────\nprefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"e.g. $\"},startValue:{type:ControlType.Number,title:\"Start\",defaultValue:0,min:-1e6,max:1e6,step:1,displayStepper:true},endValue:{type:ControlType.Number,title:\"End\",defaultValue:100,min:-1e6,max:1e6,step:1,displayStepper:true},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"e.g. +\"},// ─── NUMBER FORMATTING ────────────────────────────────────\nuseThousandsSeparator:{type:ControlType.Boolean,title:\"Thousands\",defaultValue:false,enabledTitle:\"1,000\",disabledTitle:\"1000\"},showDecimals:{type:ControlType.Boolean,title:\"Decimals\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},decimals:{type:ControlType.Number,title:\"Places\",defaultValue:2,min:0,max:10,step:1,displayStepper:true,hidden:props=>!props.showDecimals},// ─── ANIMATION ────────────────────────────────────────────\nduration:{type:ControlType.Number,title:\"Duration\",defaultValue:3,min:.1,max:20,step:.1,unit:\"s\"},easing:{type:ControlType.Enum,title:\"Easing\",defaultValue:\"easeOut\",options:[\"easeOut\",\"easeIn\",\"easeInOut\",\"linear\"],optionTitles:[\"Ease Out\",\"Ease In\",\"Ease In Out\",\"Linear\"]},// ─── TYPOGRAPHY ───────────────────────────────────────────\nfontFamily:{type:ControlType.String,title:\"Font\",defaultValue:'\"Hanken Grotesk\", \"Hanken Grotesk Placeholder\", sans-serif'},fontSizeDesktop:{type:ControlType.Number,title:\"Size\",defaultValue:44,min:1,max:400,step:1,unit:\"px\"},fontSizeMobile:{type:ControlType.Number,title:\"Mobile Size\",defaultValue:24,min:1,max:400,step:1,unit:\"px\"},fontWeight:{type:ControlType.Enum,title:\"Weight\",defaultValue:700,options:[100,200,300,400,500,600,700,800,900],optionTitles:[\"100 Thin\",\"200 Extra Light\",\"300 Light\",\"400 Regular\",\"500 Medium\",\"600 Semibold\",\"700 Bold\",\"800 Extra Bold\",\"900 Black\"]},lineHeight:{type:ControlType.String,title:\"Line Height\",defaultValue:\"1em\"},textColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgb(14, 55, 39)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"60\",\"framerIntrinsicWidth\":\"200\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Count_Up.map"],"mappings":"kMAUG,SAAwB,EAAQ,EAAM,CAAC,GAAK,CAAC,SAAO,SAAO,aAAW,WAAS,WAAS,eAAa,WAAS,wBAAsB,SAAO,aAAW,kBAAgB,iBAAe,aAAW,aAAW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