{"version":3,"file":"SplitCounter.BiSH2BYo.mjs","names":["useRef","useState","useLayoutEffect","useEffect","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","window","le","_e","de","init_jsx_runtime","p","ce","useInView","init_framer_motion_DhsWWWsN","init_framer_D6uXRwWs","addPropertyControls","ControlType","useIsStaticRenderer","toNumber","n","t","format","int","dec","v","decimals","sep","SEP","separator","intSep","SplitCounter","props","start","startText","end","endText","incrementType","isStatic","ref","raf","value","setValue","armed","setArmed","done","inView","replay","useIsoLayoutEffect","r","vh","t0","ms","duration","tick","now","e","span","f","gapSize","prefix","prefixFont","prefixColor","font","fontColor","suffix","suffixFont","suffixColor","fontDefaults","init_SplitCounter"],"sources":["https:/framerusercontent.com/modules/EzseSDClN4FhS0KpaYrl/LIDM9v5iU9ZePIOATYnZ/SplitCounter.js"],"sourcesContent":["// Split counter: prefix + animated number + suffix, each with its own font.\n// SEO-safe: the server-rendered HTML (what Google sees) contains the FINAL\n// value. The count-up only runs client-side, after hydration, when the\n// counter scrolls into view. Counters already visible on load stay static.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useLayoutEffect,useRef}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";const useIsoLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;const SEP={comma:\",\",period:\".\",space:\" \",none:\"\"};function toNumber(t){const n=parseFloat(String(t??\"0\").replace(/[^\\d.\\-]/g,\"\"));return isFinite(n)?n:0;}function format(v,decimals,separator){const fixed=v.toFixed(decimals);const[int,dec]=fixed.split(\".\");const sep=SEP[separator]??\"\";const intSep=sep?int.replace(/\\B(?=(\\d{3})+(?!\\d))/g,sep):int;if(!dec)return intSep;// decimal mark is the \"other\" punctuation (es-ES: 1.000,5)\nreturn intSep+(sep===\".\"?\",\":\".\")+dec;}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function SplitCounter(props){const{startText=\"0\",endText=\"100\",separator=\"comma\",incrementType=\"integer\",prefix=\"\",suffix=\"\",font,fontColor=\"#000\",prefixFont,prefixColor=\"#000\",suffixFont,suffixColor=\"#000\",gapSize=0,duration=1.6,replay=false}=props;const start=toNumber(startText);const end=toNumber(endText);const decimals=incrementType===\"decimal\"?Math.max(1,(String(endText).split(/[.,]/)[1]||\"\").length):0;const isStatic=useIsStaticRenderer();const ref=useRef(null);const raf=useRef();// Final value on the server and on the first client render\nconst[value,setValue]=useState(end);const[armed,setArmed]=useState(false);const done=useRef(false);const inView=useInView(ref,{once:!replay,margin:\"0px 0px -10% 0px\"});useIsoLayoutEffect(()=>{if(isStatic)return;const r=ref.current?.getBoundingClientRect();const vh=typeof window!==\"undefined\"?window.innerHeight:0;const visibleNow=!!r&&r.top<vh&&r.bottom>0&&r.height>0;if(visibleNow&&!replay){done.current=true// already on screen: keep final value\n;}else{setValue(start);}setArmed(true);// eslint-disable-next-line react-hooks/exhaustive-deps\n},[]);useEffect(()=>{if(isStatic){setValue(end);return;}if(!armed)return;if(!inView){if(replay){done.current=false;setValue(start);}return;}if(done.current)return;done.current=true;const t0=performance.now();const ms=Math.max(100,duration*1e3);const tick=now=>{const p=Math.min(1,(now-t0)/ms);const e=1-Math.pow(1-p,3);setValue(start+(end-start)*e);if(p<1)raf.current=requestAnimationFrame(tick);};raf.current=requestAnimationFrame(tick);},[inView,armed,isStatic,start,end,duration,replay]);useEffect(()=>()=>{if(raf.current)cancelAnimationFrame(raf.current);},[]);const span=(f,color)=>({...f,color,whiteSpace:\"pre\"});return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{display:\"flex\",gap:gapSize,alignItems:\"flex-end\",justifyContent:\"flex-start\",width:\"max-content\",...props.style},children:[prefix?/*#__PURE__*/_jsx(\"span\",{style:span(prefixFont,prefixColor),children:prefix}):null,/*#__PURE__*/_jsx(\"span\",{style:span(font,fontColor),children:format(value,decimals,separator)}),suffix?/*#__PURE__*/_jsx(\"span\",{style:span(suffixFont,suffixColor),children:suffix}):null]});}const fontDefaults={fontSize:\"64px\",letterSpacing:\"-0.03em\",lineHeight:\"1.05em\"};addPropertyControls(SplitCounter,{startText:{type:ControlType.String,title:\"Start\",defaultValue:\"0\"},endText:{type:ControlType.String,title:\"End\",defaultValue:\"100\"},separator:{type:ControlType.Enum,title:\"Separator\",options:[\"comma\",\"period\",\"space\",\"none\"],optionTitles:[\"Comma\",\"Period\",\"Space\",\"None\"],defaultValue:\"comma\"},incrementType:{type:ControlType.Enum,title:\"Increment\",options:[\"integer\",\"decimal\"],optionTitles:[\"Integer\",\"Decimal\"],defaultValue:\"integer\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1.6,min:.1,max:10,step:.1,unit:\"s\"},replay:{type:ControlType.Boolean,title:\"Replay\",defaultValue:false},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:fontDefaults},fontColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#19214D\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},prefixFont:{type:ControlType.Font,title:\"Prefix font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:fontDefaults},prefixColor:{type:ControlType.Color,title:\"Prefix color\",defaultValue:\"#19214D\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},suffixFont:{type:ControlType.Font,title:\"Suffix font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{...fontDefaults,fontSize:\"32px\",lineHeight:\"1.4em\"}},suffixColor:{type:ControlType.Color,title:\"Suffix color\",defaultValue:\"#19214D\"},gapSize:{type:ControlType.Number,title:\"Gap\",defaultValue:0,min:0}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SplitCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__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