{"version":3,"file":"CountUp.DbiYdPsQ.mjs","names":["useRef","__esmMin","init_ssg_sandbox_shims","init_npm_react_18_3_1","ce","init_jsx_runtime","c","de","window","init_framer_BpuvUAiZ","addPropertyControls","RenderTarget","ControlType","CountUp","props","root","isCanvas","me","host","box","i","target","el","original","m","pre","numStr","post","clean","sepMatch","lastSep","decimals","decChar","thouChar","value","fmt","int","dec","v","raf","done","run","t0","delay","tick","t","now","duration","e","r","io","en","init_CountUp"],"sources":["https:/framerusercontent.com/modules/19iiWeh8HpHMs7iFBDVe/wtIipjJkZBgaw5uVlPpg/CountUp.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Count Up (Morrow stats): an invisible helper. Drop it next to a number text layer and name that layer (default\n * \"Stat Value\"). When the number scrolls into view it counts from 0 to whatever the text says (\"12\", \"160+\", \"90%\",\n * \"€4M\", \"2.4x\"): prefix, separators, decimals and suffix are kept. The text layer stays a normal, editable, translatable\n * Framer text; this only animates it. Reduced motion or the editor: the text is left as it is.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CountUp(props){const{target,duration,delay}=props;const root=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{const me=root.current;if(!me||isCanvas)return;if(window.matchMedia&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;// the nearest layer called `target` around this helper\nlet host=me.parentElement,box=null;for(let i=0;i<5&&host&&!box;i++){box=host.querySelector(`[data-framer-name=\"${target}\"]`);host=host.parentElement;}if(!box)return;// the innermost element that holds the text\nlet el=box;while(el.children.length===1&&el.firstElementChild.textContent===el.textContent)el=el.firstElementChild;const original=el.textContent||\"\";const m=original.match(RegExp(\"^(\\\\D*?)(\\\\d[\\\\d.,\\\\s]*\\\\d|\\\\d)(.*)$\",\"s\"));if(!m)return;const[,pre,numStr,post]=m;const clean=numStr.replace(/\\s/g,\"\");// \"1,200\" / \"1.200\" thousands vs \"2.4\" / \"2,4\" decimals\nconst sepMatch=clean.match(/[.,]/g)||[];const lastSep=clean.search(/[.,](\\d{1,2})$/);const decimals=lastSep>=0&&!(sepMatch.length===1&&clean.length-lastSep-1===3)?clean.length-lastSep-1:0;const decChar=decimals?clean[lastSep]:\"\";const thouChar=sepMatch.find(c=>c!==decChar)||\"\";const value=parseFloat(clean.split(thouChar?thouChar:\"\\x00\").join(\"\").replace(decChar||\"\\x00\",\".\"));if(!isFinite(value))return;const fmt=v=>{const fixed=v.toFixed(decimals);let[int,dec]=fixed.split(\".\");if(thouChar)int=int.replace(/\\B(?=(\\d{3})+(?!\\d))/g,thouChar);return pre+int+(decimals?decChar+dec:\"\")+post;};el.style.fontVariantNumeric=\"tabular-nums\";let raf=0,done=false;const run=()=>{const t0=performance.now()+delay*1e3;const tick=now=>{const t=Math.min(1,Math.max(0,(now-t0)/(duration*1e3)));const e=1-Math.pow(1-t,3);el.textContent=t>=1?original:fmt(value*e);if(t<1)raf=requestAnimationFrame(tick);};raf=requestAnimationFrame(tick);};const r=box.getBoundingClientRect();const visibleNow=r.top<window.innerHeight*.9&&r.bottom>0;if(!visibleNow)el.textContent=fmt(0);const io=new IntersectionObserver(([en])=>{if(en.isIntersecting&&!done){done=true;io.disconnect();run();}},{threshold:.6});io.observe(box);return()=>{io.disconnect();if(raf)cancelAnimationFrame(raf);if(el.textContent!==original)el.textContent=original;};},[target,duration,delay,isCanvas]);return /*#__PURE__*/_jsx(\"div\",{ref:root,\"aria-hidden\":\"true\",style:{width:\"100%\",height:\"100%\",pointerEvents:\"none\"}});}CountUp.defaultProps={target:\"Stat Value\",duration:1.6,delay:0};addPropertyControls(CountUp,{target:{type:ControlType.String,title:\"Number Layer\",defaultValue:\"Stat Value\",description:\"Name of the text layer to count up.\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1.6,min:.3,max:5,step:.1,unit:\"s\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:2,step:.05,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUp.map"],"mappings":"A,uMAQG,SAAwBa,EAAQ,EAAM,CAAC,GAAK,CAAC,SAAO,WAAS,SAAOC,EAAYC,EAAKf,EAAO,IAAI,EAAQgB,EAASL,EAAa,QAAQ,IAAIA,EAAa,OAGqqC,OAH9pCP,MAAc,CAAC,IAAMa,EAAGF,EAAK,QAAgC,GAArB,CAACE,GAAID,GAAmBR,EAAO,YAAYA,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAQ,OAClT,IAAIU,EAAKD,EAAG,cAAcE,EAAI,KAAK,IAAI,IAAIC,EAAE,EAAEA,EAAE,GAAGF,GAAM,CAACC,EAAI,IAAK,EAAID,EAAK,cAAc,sBAAsBG,EAAO,GAAG,EAAE,EAAKH,EAAK,cAAe,GAAG,CAACC,EAAI,OAC9J,IAAIG,EAAGH,EAAI,KAAMG,EAAG,SAAS,SAAS,GAAGA,EAAG,kBAAkB,cAAcA,EAAG,aAAY,EAAGA,EAAG,kBAAkB,IAAMC,EAASD,EAAG,aAAa,GAASE,EAAED,EAAS,MAAM,OAAO,uCAAuC,GAAG,CAAC,EAAE,GAAG,CAACC,EAAE,OAAO,GAAK,EAAEC,EAAIC,EAAOC,GAAMH,EAAQI,EAAMF,EAAO,QAAQ,MAAM,EAAE,EACpSG,EAASD,EAAM,MAAM,OAAO,GAAG,CAAC,EAAQE,EAAQF,EAAM,OAAO,gBAAgB,EAAQG,EAASD,GAAS,IAAKD,EAAS,SAAS,GAAGD,EAAM,OAAOE,EAAQ,GAAI,GAAGF,EAAM,OAAOE,EAAQ,EAAE,EAAQE,E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