{"version":3,"file":"AnimatedNumberCounter.DxJKV6Fn.mjs","names":["useState","useRef","_Fragment","useEffect","useLayoutEffect"],"sources":["https:/framerusercontent.com/modules/derx9sMtjp89UNB6MwBT/GsjjIhTJcOKPwuCzqeUT/AnimatedNumberCounter.js"],"sourcesContent":["import{jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useLayoutEffect,useRef,useState}from\"react\";import{animate,motion,useInView}from\"framer-motion\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// T-238: our copy of Framer University's \"Animated Number Counter\" (marketplace module qpjhCcDm4G1NbFAlpMKV), same\n// controls and behaviour. One change: the server HTML and the first render carry the END number, so crawlers and AI\n// agents read the real figure. Before the first paint in the browser it goes back to its start and counts up as before.\n// The original's object controls (\"Animation\", \"Color\") are flat controls here (Trigger, Replay, Duration, Bounce, Color\n// mode, Color, Start/End color, Angle): Framer's API cannot write object controls, flat ones it can.\nconst useIsoLayoutEffect=typeof window===\"undefined\"?useEffect:useLayoutEffect;// T-242 (Karim): some parents swap variants while hovered, which mounts a new counter each time, and every new counter\n// counted up from the start again. A counter that has started is remembered here (per page and figures), so a\n// remounted copy shows the end number at once. Leaving the viewport forgets it, so Replay still works on scroll.\nconst finished=new Set;/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function AnimatedNumberCounter(props){const{mode,start,end,value,decimals,commas}=props;const animation={trigger:props.trigger,replay:props.replay,transition:{type:\"spring\",duration:props.duration,bounce:props.bounce}};const color={mode:props.colorMode,color:props.textColor,startColor:props.startColor,endColor:props.endColor,angle:props.angle};const isCanvas=RenderTarget.current()===RenderTarget.canvas;const Tag=props.tag;const MotionTag=motion[props.tag];const isDefault=mode==\"default\";const initial=isDefault?start:value;const transition=isDefault?animation.transition:props.transition;const format=n=>{let t=n.toFixed(decimals);if(commas)t=t.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");return t;};// shown: the number on screen; sizer: the invisible copy that reserves the width of the target number\nconst[shown,setShown]=useState(isDefault?end:initial);const[sizer,setSizer]=useState(isDefault?end:initial);const[anim,setAnim]=useState(null);const ref=useRef(null);const inView=useInView(ref,{once:!animation.replay,amount:\"some\"});const doneKey=`${typeof document===\"undefined\"?\"\":document.location.pathname}|${start}|${end}|${props.prefix}|${props.suffix}`;const seenInView=useRef(false);// back to the original starting state before the first paint (server HTML keeps the end number)\nuseIsoLayoutEffect(()=>{if(isDefault&&!isCanvas&&!finished.has(doneKey)){setShown(start);setSizer(start);}},[]);const run=(from,to)=>{if(isCanvas)return;if(anim)anim.stop();setSizer(to);setAnim(animate(from,to,{...transition,onUpdate:v=>setShown(v)}));};const countUp=()=>{if(finished.has(doneKey)){setSizer(end);setShown(end);return;}// remembered from the start of the count: a copy mounted mid-count shows the end number, not a restart\nfinished.add(doneKey);run(start,end);};useEffect(()=>{if(isDefault&&animation.trigger==\"appear\")countUp();},[]);useEffect(()=>{if(isDefault&&animation.trigger==\"layerInView\"){if(inView){seenInView.current=true;countUp();}else if(seenInView.current){// scrolled away: reset so it counts again when it comes back (Replay)\nif(anim)anim.stop();finished.delete(doneKey);setShown(start);}}},[inView]);useEffect(()=>{if(!isDefault)run(shown,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,format(isCanvas?initial:sizer),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,format(isCanvas?initial:shown),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:p=>p.mode!==\"variants\"},start:{type:ControlType.Number,defaultValue:0,hidden:p=>p.mode!==\"default\"},end:{type:ControlType.Number,defaultValue:100,hidden:p=>p.mode!==\"default\"},trigger:{type:ControlType.Enum,defaultValue:\"layerInView\",options:[\"appear\",\"layerInView\"],optionTitles:[\"Appear\",\"Layer in View\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\",hidden:p=>p.mode!==\"default\"},replay:{type:ControlType.Boolean,defaultValue:true,hidden:p=>p.mode!==\"default\"||p.trigger!==\"layerInView\"},duration:{type:ControlType.Number,defaultValue:1,min:0,max:10,step:.1,unit:\"s\",hidden:p=>p.mode!==\"default\"},bounce:{type:ControlType.Number,defaultValue:0,min:0,max:1,step:.05,hidden:p=>p.mode!==\"default\"},transition:{type:ControlType.Transition,defaultValue:{type:\"spring\",duration:1,bounce:0},hidden:p=>p.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:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1}},colorMode:{type:ControlType.Enum,defaultValue:\"solid\",options:[\"solid\",\"gradient\"],optionTitles:[\"Solid\",\"Gradient\"],displaySegmentedControl:true},textColor:{type:ControlType.Color,defaultValue:\"#000\",hidden:p=>p.colorMode!==\"solid\"},startColor:{type:ControlType.Color,defaultValue:\"#000\",hidden:p=>p.colorMode!==\"gradient\"},endColor:{type:ControlType.Color,defaultValue:\"#FFF\",hidden:p=>p.colorMode!==\"gradient\"},angle:{type:ControlType.Number,defaultValue:180,min:-360,max:360,unit:\"\\xb0\",hidden:p=>p.colorMode!==\"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}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedNumberCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedNumberCounter.map"],"mappings":"0RAWG,SAAwB,EAAsB,EAAM,CAAC,GAAK,CAAC,OAAK,QAAM,MAAI,QAAM,WAAS,UAAQ,EAAY,EAAU,CAAC,QAAQ,EAAM,QAAQ,OAAO,EAAM,OAAO,WAAW,CAAC,KAAK,SAAS,SAAS,EAAM,SAAS,OAAO,EAAM,MAAM,CAAC,EAAQ,EAAM,CAAC,KAAK,EAAM,UAAU,MAAM,EAAM,UAAU,WAAW,EAAM,WAAW,SAAS,EAAM,SAAS,MAAM,EAAM,KAAK,EAAQ,EAAS,EAAa,QAAQ,IAAI,EAAa,OAAa,EAAI,EAAM,IAAU,EAAU,EAAO,EAAM,KAAW,EAAU,GAAM,UAAgB,EAAQ,EAAU,EAAM,EAAY,EAAW,EAAU,EAAU,WAAW,EAAM,WAAiB,EAAO,GA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