{"version":3,"file":"AnimatedNumberCounter_Prod.DBdwkyEh.mjs","names":["number","useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/zptyyBkF8EVktwLYeePn/DEIEOmnAs05rBRRNttkQ/c2RRBdx6h.js","https:/framerusercontent.com/modules/qpjhCcDm4G1NbFAlpMKV/OnyZiTlIjOBuSKcKQWFv/AnimatedNumberCounter_Prod.js"],"sourcesContent":["// Generated by Framer (eb93fa7)\nimport{fontStore}from\"framer\";fontStore.loadFonts([\"GF;Geist-500\",\"GF;Geist-700\"]);export const fonts=[{explicitInter:true,fonts:[{family:\"Geist\",source:\"google\",style:\"normal\",url:\"https://fonts.gstatic.com/s/geist/v3/gyBhhwUxId8gMGYQMKR3pzfaWI_RruM4mJPby1QNtA.woff2\",weight:\"500\"},{family:\"Geist\",source:\"google\",style:\"normal\",url:\"https://fonts.gstatic.com/s/geist/v3/gyBhhwUxId8gMGYQMKR3pzfaWI_Re-Q4mJPby1QNtA.woff2\",weight:\"700\"}]}];export const css=['.framer-h88xZ .framer-styles-preset-hbsgig:not(.rich-text-wrapper), .framer-h88xZ .framer-styles-preset-hbsgig.rich-text-wrapper p { --framer-font-family: \"Geist\", \"Geist Placeholder\", sans-serif; --framer-font-family-bold: \"Geist\", \"Geist Placeholder\", sans-serif; --framer-font-open-type-features: normal; --framer-font-size: 16px; --framer-font-style: normal; --framer-font-style-bold: normal; --framer-font-variation-axes: normal; --framer-font-weight: 500; --framer-font-weight-bold: 700; --framer-letter-spacing: 0em; --framer-line-height: 1.4em; --framer-paragraph-spacing: 20px; --framer-text-alignment: center; --framer-text-color: var(--token-5f3729c4-183c-47b5-94e6-78322fe2ee11, #ffffff); --framer-text-decoration: none; --framer-text-stroke-color: initial; --framer-text-stroke-width: initial; --framer-text-transform: none; }'];export const className=\"framer-h88xZ\";\nexport const __FramerMetadata__ = {\"exports\":{\"className\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"css\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fonts\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useState,useRef}from\"react\";import{motion,useMotionValue,animate,useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n *\n * @framerDisableUnlink\n */export default function AnimatedNumberCounter(props){const{mode,start,end,value,decimals,commas,color,animation}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const Tag=props.tag;const MotionTag=motion[props.tag];const isDefault=mode==\"default\";const initialValue=isDefault?start:value;const transition=isDefault?animation.transition:props.transition;const formatNumber=number=>{let numberString=number.toFixed(decimals);if(commas){numberString=numberString.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");}return numberString;};const[number,setNumber]=useState(initialValue);const[finalValue,setFinalValue]=useState(number);const[currentAnimation,setCurrentAnimation]=useState(null);const ref=useRef(null);const isInView=useInView(ref,{once:!props.animation.replay,amount:\"some\"});const motionValue=useMotionValue(value);const runAnimation=(from,to)=>{if(!isCanvas){if(currentAnimation){currentAnimation.stop();}setFinalValue(to);setCurrentAnimation(animate(from,to,{...transition,onUpdate:latest=>{setNumber(latest);}}));}};useEffect(()=>{if(isDefault&&animation.trigger==\"appear\"){runAnimation(start,end);}},[]);useEffect(()=>{if(isDefault&&animation.trigger==\"layerInView\"){if(isInView){runAnimation(start,end);}else{if(currentAnimation){currentAnimation.stop();}setNumber(start);}}},[isInView]);useEffect(()=>{if(!isDefault){runAnimation(number,value);}},[value]);return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsxs(Tag,{style:{...props.style,margin:0,opacity:0,pointerEvents:\"none\",userSelect:\"none\",textWrap:props.balance?\"balance\":undefined,fontVariantNumeric:props.monospace?\"tabular-nums\":undefined,textAlign:\"center\",...props.font},children:[props.prefix,formatNumber(isCanvas?initialValue:finalValue),props.suffix]}),/*#__PURE__*/_jsxs(MotionTag,{ref:ref,style:{position:\"absolute\",inset:0,userSelect:props.userSelect?\"auto\":\"none\",fontVariantNumeric:props.monospace?\"tabular-nums\":undefined,margin:0,...color.mode==\"solid\"?{color:color.color}:{WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundImage:`linear-gradient(${color.angle}deg, ${color.startColor}, ${color.endColor})`},textDecoration:props.decoration,textWrap:props.balance?\"balance\":undefined,textAlign:\"center\",...props.font,...props.style},children:[props.prefix,formatNumber(isCanvas?initialValue:number),props.suffix]})]});}AnimatedNumberCounter.displayName=\"Animated Number Counter\";addPropertyControls(AnimatedNumberCounter,{mode:{type:ControlType.Enum,options:[\"default\",\"variants\"],optionTitles:[\"Default\",\"Variants\"],displaySegmentedControl:true},value:{type:ControlType.Number,defaultValue:0,hidden:props=>props.mode!==\"variants\"},start:{type:ControlType.Number,defaultValue:0,hidden:props=>props.mode!==\"default\"},end:{type:ControlType.Number,defaultValue:100,hidden:props=>props.mode!==\"default\"},animation:{type:ControlType.Object,icon:\"effect\",hidden:props=>props.mode!==\"default\",controls:{trigger:{type:ControlType.Enum,defaultValue:\"layerInView\",options:[\"appear\",\"layerInView\"],optionTitles:[\"Appear\",\"Layer in View\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},replay:{type:ControlType.Boolean,defaultValue:true,hidden(props){return props.trigger!==\"layerInView\";}},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",duration:1,bounce:0}}}},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",duration:1,bounce:0},hidden:props=>props.mode!==\"variants\"},decimals:{type:ControlType.Enum,defaultValue:0,options:[0,1,2,3],optionTitles:[\"Off\",\"1\",\"2\",\"3\"],displaySegmentedControl:true},commas:{type:ControlType.Boolean,defaultValue:true},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1}},color:{type:ControlType.Object,controls:{mode:{type:ControlType.Enum,defaultValue:\"solid\",options:[\"solid\",\"gradient\"],optionTitles:[\"Solid\",\"Gradient\"],displaySegmentedControl:true},color:{type:ControlType.Color,defaultValue:\"#000\",hidden:props=>props.mode!==\"solid\"},startColor:{type:ControlType.Color,defaultValue:\"#000\",hidden:props=>props.mode!==\"gradient\"},endColor:{type:ControlType.Color,defaultValue:\"#FFF\",hidden:props=>props.mode!==\"gradient\"},angle:{type:ControlType.Number,defaultValue:180,min:-360,max:360,unit:\"\\xb0\",hidden:props=>props.mode!==\"gradient\"}}},prefix:{type:ControlType.String,placeholder:\"Prefix\"},suffix:{type:ControlType.String,placeholder:\"Suffix\"},decoration:{type:ControlType.Enum,defaultValue:\"none\",options:[\"none\",\"underline\",\"line-through\"],optionTitles:[\"None\",\"Underline\",\"Strikethrough\"]},balance:{type:ControlType.Boolean,defaultValue:false},userSelect:{type:ControlType.Boolean,defaultValue:true},tag:{type:ControlType.Enum,defaultValue:\"p\",displaySegmentedControl:true,options:[\"h1\",\"h2\",\"h3\",\"p\"],optionTitles:[\"H1\",\"H2\",\"H3\",\"P\"]},monospace:{type:ControlType.Boolean,defaultValue:false,description:\"More components at [Framer University](https://frameruni.link/cc).\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedNumberCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedNumberCounter_Prod.map"],"mappings":"0SAC8B,GAAU,UAAU,CAAC,eAAe,eAAe,CAAC,CAAc,EAAM,CAAC,CAAC,cAAc,GAAK,MAAM,CAAC,CAAC,OAAO,QAAQ,OAAO,SAAS,MAAM,SAAS,IAAI,wFAAwF,OAAO,MAAM,CAAC,CAAC,OA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