{"version":3,"file":"Digit_Up.DPHV0Fef.mjs","names":["useState","useRef","useMemo","__esmMin","pe","te","init_npm_react_18_3_1","ce","p","init_jsx_runtime","_e","de","useInView","animate","init_framer_motion_DhsWWWsN","addPropertyControls","init_framer_DKgW_P28","ControlType","AnimatedCounter","props","displayValue","setDisplayValue","startValue","hasAnimated","setHasAnimated","ref","isInView","inferredDecimals","getDecimals","asString","value","dotIndex","endValue","controls","timer","easingFunctions","easing","delay","duration","decimals","formattedValue","style","font","prefix","suffix","init_Digit_Up"],"sources":["https:/framerusercontent.com/modules/ty2g1ZjKCCzHcdbW6Tmt/agwrjSYzAWFq9NXSUARd/Digit_Up.js"],"sourcesContent":["// Number counter component that animates from start to end value when in view\n// Supports prefix/suffix, font customization, decimals, easing, duration and delay\n// Animation triggers once when component enters viewport\nimport{jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useInView,animate}from\"framer-motion\";const easingFunctions={linear:[0,0,1,1],easeIn:[.42,0,1,1],easeOut:[0,0,.58,1],easeInOut:[.42,0,.58,1]};/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function AnimatedCounter(props){const{startValue,endValue,duration,delay,decimals,prefix,suffix,easing,font,color,style}=props;const[displayValue,setDisplayValue]=useState(startValue);const[hasAnimated,setHasAnimated]=useState(false);const ref=useRef(null);const isInView=useInView(ref,{once:true});const inferredDecimals=useMemo(()=>{const getDecimals=value=>{const asString=value.toString();const dotIndex=asString.indexOf(\".\");if(dotIndex===-1)return 0;return asString.length-dotIndex-1;};return Math.max(getDecimals(startValue),getDecimals(endValue));},[startValue,endValue]);useEffect(()=>{if(isInView&&!hasAnimated){let controls;const timer=setTimeout(()=>{controls=animate(startValue,endValue,{duration:duration,ease:easingFunctions[easing],onUpdate:value=>{startTransition(()=>{setDisplayValue(value);});},onComplete:()=>{startTransition(()=>{setHasAnimated(true);});}});},delay*1e3);return()=>{clearTimeout(timer);if(controls){controls.stop();}};}},[isInView,hasAnimated,startValue,endValue,duration,delay,easing]);useEffect(()=>{startTransition(()=>{setHasAnimated(false);setDisplayValue(startValue);});},[startValue,endValue,duration,delay,easing,decimals]);const formattedValue=displayValue.toFixed(decimals>0?decimals:inferredDecimals);return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...style,position:\"relative\",width:\"max-content\",minWidth:\"max-content\",color:color,...font},children:[prefix,formattedValue,suffix]});}addPropertyControls(AnimatedCounter,{startValue:{type:ControlType.Number,title:\"Start Value\",defaultValue:0,step:.1},endValue:{type:ControlType.Number,title:\"End Value\",defaultValue:100,step:.1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2,min:.1,max:10,step:.1,unit:\"s\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:5,step:.1,unit:\"s\"},decimals:{type:ControlType.Number,title:\"Decimals\",defaultValue:1,min:0,max:4,step:1,displayStepper:true},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"%\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"linear\",\"easeIn\",\"easeOut\",\"easeInOut\"],optionTitles:[\"Linear\",\"Ease In\",\"Ease Out\",\"Ease In Out\"],defaultValue:\"easeOut\",displaySegmentedControl:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"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