{"version":3,"file":"CountUpStat.C4Dt5RS3.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","c","init_jsx_runtime","ce","de","init_framer_D1IzEvwH","addPropertyControls","ControlType","parse","match","raw","prefix","digits","suffix","target","format","fixed","n","decimals","grouped","whole","frac","spaced","CountUpStat","alturaLinha","props","parsed","value","ref","display","setDisplay","animate","node","ticker","timer","watcher","started","observer","run","startedAt","t","duration","easeSoftLanding","inView","rect","h","stopWatching","onMove","begin","delay","entries","shown","paint","gradient","colorEnd","color","FONT","size","weight","style","init_CountUpStat","q","p"],"sources":["https:/framerusercontent.com/modules/MDN0b1k0IJ0yLY3vlif0/VtzQdwRcJS65Wg8RXtMk/CountUpStat.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";/**\n * Animated statistic number for the Impact band.\n *\n * Counts up once, when it first scrolls into view. Parses whatever it is given,\n * so \"1,000,000+\", \"70%\", \"2X\" and \"4.8/5\" all animate correctly and land on\n * exactly the string that was typed in.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */const FONT='\"Satoshi\", \"Satoshi Placeholder\", Inter, sans-serif';// Splits \"1,000,000+\" into { prefix: \"\", digits: \"1,000,000\", suffix: \"+\" }\nfunction parse(raw){const value=String(raw??\"\").trim();const match=value.match(/^([^\\d.-]*)([\\d.,]+)(.*)$/);if(!match)return null;const[,prefix,digits,suffix]=match;const target=parseFloat(digits.replace(/,/g,\"\"));if(!isFinite(target))return null;const decimals=(digits.split(\".\")[1]||\"\").length;return{prefix,suffix,target,decimals,grouped:digits.includes(\",\")};}function format(n,decimals,grouped){const fixed=n.toFixed(decimals);if(!grouped)return fixed;const[whole,frac]=fixed.split(\".\");const spaced=whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");return frac?`${spaced}.${frac}`:spaced;}// Fast start, then a long visible glide into the final value — the last\n// digits keep ticking slower and slower instead of stopping dead.\nconst easeOutExpo=t=>t===1?1:1-Math.pow(2,-10*t);const easeSoftLanding=t=>{// mostly cubic (long deceleration tail) with a touch of quad for liveliness\nconst c=1-Math.pow(1-t,3);const q=1-Math.pow(1-t,2);return c*.75+q*.25;};export default function CountUpStat(props){const{value=\"1,000,000+\",size=46,weight=\"500\",color=\"rgb(232, 93, 42)\",colorEnd=\"\",gradient=false,letterSpacing=-1,duration=1800,delay=0,animate=true,lineHeight:alturaLinha=1.15,style}=props;const parsed=parse(value);const ref=useRef(null);const[display,setDisplay]=useState(()=>animate&&parsed?format(0,parsed.decimals,parsed.grouped):null);useEffect(()=>{if(!animate||!parsed)return;const node=ref.current;if(!node)return;const reduced=typeof window!==\"undefined\"&&window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;if(reduced){setDisplay(null);return;}let ticker=0;let timer=0;let watcher=0;let started=false;let observer=null;// Interval, not requestAnimationFrame: rAF is driven by the paint loop,\n// which some embedded/preview renderers never run — the count would sit\n// frozen at zero there. A 16ms interval is timer-driven and always ticks.\nconst run=()=>{const startedAt=Date.now();const step=()=>{const t=Math.min(1,(Date.now()-startedAt)/Number(duration));setDisplay(format(parsed.target*easeSoftLanding(t),parsed.decimals,parsed.grouped));if(t>=1){window.clearInterval(ticker);// Hand back to the literal string so the ending is exact.\nsetDisplay(null);}};ticker=window.setInterval(step,16);};// Geometry, not IntersectionObserver: IO silently never fires in some\n// embedded/preview renderers, which leaves every number frozen at zero.\nconst inView=()=>{const rect=node.getBoundingClientRect();const h=window.innerHeight||document.documentElement.clientHeight;return rect.top<h*.9&&rect.bottom>0;};const stopWatching=()=>{window.removeEventListener(\"scroll\",onMove);window.removeEventListener(\"resize\",onMove);window.clearInterval(watcher);observer?.disconnect();observer=null;};function begin(){if(started)return;started=true;stopWatching();timer=window.setTimeout(run,Number(delay));}function onMove(){if(inView())begin();}if(inView()){begin();}else{// Polling is the only trigger that survives every renderer. Scroll\n// events and IntersectionObserver are both skipped in some embedded\n// previews, and the rect can still be empty on the first effect pass,\n// so an event-only version can miss its one chance and freeze at zero.\nwatcher=window.setInterval(onMove,200);window.addEventListener(\"scroll\",onMove,{passive:true});window.addEventListener(\"resize\",onMove);if(typeof IntersectionObserver!==\"undefined\"){observer=new IntersectionObserver(entries=>{if(entries.some(e=>e.isIntersecting))begin();},{threshold:.25});observer.observe(node);}}return()=>{stopWatching();window.clearInterval(ticker);window.clearTimeout(timer);};},[value,animate,duration,delay]);// display === null means \"show the real string\" — start state and end state.\nconst shown=display===null||!parsed?value:`${parsed.prefix}${display}${parsed.suffix}`;// Gradient numerals are painted through the glyphs. Framer ignores CSS\n// filters and blend modes, but background-clip does work here.\nconst paint=gradient&&colorEnd?{backgroundImage:`linear-gradient(104deg, ${color} 0%, ${colorEnd} 100%)`,WebkitBackgroundClip:\"text\",backgroundClip:\"text\",WebkitTextFillColor:\"transparent\",color:\"transparent\"}:{color};return /*#__PURE__*/_jsx(\"span\",{ref:ref,style:{display:\"block\",fontFamily:FONT,fontSize:size,fontWeight:weight,lineHeight:alturaLinha,letterSpacing,fontVariantNumeric:\"tabular-nums\",whiteSpace:\"nowrap\",width:\"fit-content\",...paint,...style},children:shown});}addPropertyControls(CountUpStat,{lineHeight:{type:ControlType.Number,title:\"Line Height\",defaultValue:1.15,min:.9,max:1.6,step:.05,description:\"Folga vertical do numero. Abaixo de 1.1 o rabinho do y/g/p fica colado na borda.\"},value:{type:ControlType.String,title:\"Value\",defaultValue:\"1,000,000+\"},size:{type:ControlType.Number,title:\"Size\",defaultValue:46,min:12,max:200,step:1,displayStepper:true},weight:{type:ControlType.Enum,title:\"Weight\",options:[\"400\",\"500\",\"600\",\"700\"],optionTitles:[\"Regular\",\"Medium\",\"Semibold\",\"Bold\"],defaultValue:\"500\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"rgb(232, 93, 42)\"},gradient:{type:ControlType.Boolean,title:\"Gradient\",defaultValue:false},colorEnd:{type:ControlType.Color,title:\"Color End\",defaultValue:\"rgb(184, 57, 26)\",hidden:p=>!p.gradient},letterSpacing:{type:ControlType.Number,title:\"Tracking\",defaultValue:-1,min:-6,max:4,step:.5},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1800,min:200,max:5e3,step:100,unit:\"ms\"},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:2e3,step:50,unit:\"ms\"},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUpStat\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUpStat.map"],"mappings":"A,sMAUA,SAASc,EAAM,EAAI,CAAoC,IAAMC,EAA7B,OAAOC,GAAK,EAAE,CAAC,CAAC,KAAuB,CAAC,CAAC,MAAM,2BAA2B,EAAE,GAAG,CAACD,EAAM,OAAO,KAAK,GAAK,EAAEE,EAAOC,EAAOC,GAAQJ,EAAYK,EAAO,WAAWF,EAAO,QAAQ,KAAK,EAAE,CAAC,EAAoF,OAA9E,SAASE,CAAM,EAAqE,CAAC,SAAO,SAAO,SAAO,UAA7DF,EAAO,MAAM,GAAG,CAAC,CAAC,IAAI,GAAA,CAAI,OAA4C,QAAQA,EAAO,SAAS,GAAG,CAAC,EAAvH,IAAyH,CAAC,SAASG,EAAO,EAAE,EAAS,EAAQ,CAAC,IAAMC,EAAMC,EAAE,QAAQC,CAAQ,EAAE,GAAG,CAACC,EAAQ,OAAOH,EAAM,GAAK,CAACI,EAAMC,GAAML,EAAM,MAAM,GAAG,EAAQM,EAAOF,EAAM,QAAQ,wBAAwB,GAAG,EAAE,OAAOC,EAAK,GAAGC,EAAO,GAAGD,IAAOC,CAAO,CAGlgB,SAAwBC,EAAY,EAAM,CAAC,GAAK,CAAC,QAAM,aAAa,OAAK,GAAG,SAAO,MAAM,QAAM,mBAAmB,WAAS,GA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