{"version":3,"file":"NumberCounter_1.9-YEXQty.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/pwmu5vBU2uueXEoj99en/cgvTB6RNCmO8lJQ8GC1i/NumberCounter_1.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useInView,useTransform,useMotionValue,animate}from\"framer-motion\";/**\n * Number Counter\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function NumberCounter(props){const{start,end,duration,delay,font,color,prefix,suffix,separator,decimalPlaces,threshold,once}=props;const ref=useRef(null);const isInView=useInView(ref,{once:once,amount:threshold});const motionValue=useMotionValue(start);useEffect(()=>{if(isInView){const controls=animate(motionValue,end,{duration:duration,delay:delay,ease:\"easeOut\"});return()=>controls.stop();}else if(!once){motionValue.set(start);}},[isInView,start,end,duration,delay,once,motionValue]);const formattedValue=useTransform(motionValue,latest=>{const number=latest.toFixed(decimalPlaces);const parts=number.toString().split(\".\");parts[0]=parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g,separator);return`${prefix}${parts.join(\".\")}${suffix}`;});return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",width:\"100%\",height:\"100%\",overflow:\"hidden\",...font,color:color},children:/*#__PURE__*/_jsx(motion.span,{children:formattedValue})});}addPropertyControls(NumberCounter,{start:{type:ControlType.Number,title:\"Start\",defaultValue:0},end:{type:ControlType.Number,title:\"End\",defaultValue:1e4},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\"},once:{type:ControlType.Boolean,title:\"Trigger\",defaultValue:true,enabledTitle:\"Once\",disabledTitle:\"Repeat\"},threshold:{type:ControlType.Number,title:\"Threshold\",defaultValue:.5,min:0,max:1,step:.1,displayStepper:true},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:48,variant:\"Bold\",textAlign:\"center\"}},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"%\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\" \",placeholder:\",\"},decimalPlaces:{type:ControlType.Number,title:\"Decimals\",defaultValue:0,min:0,max:5,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NumberCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"60\",\"framerIntrinsicWidth\":\"200\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NumberCounter_1.map"],"mappings":"+PAQG,SAAwB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,MAAI,WAAS,QAAM,OAAK,QAAM,SAAO,SAAO,YAAU,gBAAc,YAAU,QAAM,EAAY,EAAIA,EAAO,KAAK,CAAO,EAAS,EAAU,EAAI,CAAM,OAAK,OAAO,EAAU,CAAC,CAAO,EAAY,EAAe,EAAM,CAAC,MAAc,CAAC,GAAG,EAAS,CAAC,IAAM,EAAS,EAAQ,EAAY,EAAI,CAAU,WAAe,QAAM,KAAK,UAAU,CAAC,CAAC,UAAU,EAAS,MAAM,MAAW,GAAM,EAAY,IAAI,EAAM,EAAI,CAAC,EAAS,EAAM,EAAI,EAAS,EAAM,EAAK,EAAY,CAAC,CAAC,IAAM,EAAe,EAAa,EAAY,GAAQ,CAA4C,IAAM,EAApC,E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