{"version":3,"file":"CountUpNumber.uFV_OSys.mjs","names":["React.useState","React.useRef","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","_e","de","init_jsx_runtime","p","ce","RenderTarget","addPropertyControls","ControlType","init_framer_DKtAEkcX","CountUpNumber","props","f","target","value","places","decimals","format","separator","n","current","setCurrent","ref","raf","timer","el","played","stop","run","ms","duration","start","step","t","now","eased","io","visible","entries","delay","replay","textStyle","finalText","prefix","suffix","SR_ONLY","init_CountUpNumber"],"sources":["https:/framerusercontent.com/modules/enbk7cRqjo8qiVJVH5Fy/I1bTjedhSEXmEetDgytE/CountUpNumber.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const SR_ONLY={position:\"absolute\",width:1,height:1,padding:0,margin:-1,overflow:\"hidden\",clip:\"rect(0,0,0,0)\",whiteSpace:\"nowrap\",border:0};/**\n * Count Up Number\n *\n * @framerIntrinsicWidth 120\n * @framerIntrinsicHeight 72\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CountUpNumber(props){const{prefix,value,suffix,decimals,separator,duration,delay,replay}=props;const f=props.numberFont||{};const target=Number.isFinite(value)?value:0;const places=Math.max(0,Math.min(3,Math.round(decimals||0)));const format=n=>separator?n.toLocaleString(\"en-US\",{minimumFractionDigits:places,maximumFractionDigits:places}):n.toFixed(places);// Server render and canvas show the final value; the live site resets to 0 and counts up\nconst[current,setCurrent]=React.useState(target);const ref=React.useRef(null);const raf=React.useRef(0);const timer=React.useRef(null);React.useEffect(()=>{setCurrent(target);if(RenderTarget.current()!==RenderTarget.preview)return;if(typeof window===\"undefined\"||!(\"IntersectionObserver\"in window))return;if(window.matchMedia&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches)return;const el=ref.current;if(!el)return;let played=false;const stop=()=>{cancelAnimationFrame(raf.current);if(timer.current)clearTimeout(timer.current);};const run=()=>{const ms=Math.max(.1,duration)*1e3;const start=performance.now();const step=now=>{const t=Math.min(1,(now-start)/ms);const eased=1-Math.pow(1-t,3);setCurrent(target*eased);if(t<1)raf.current=requestAnimationFrame(step);else setCurrent(target);};raf.current=requestAnimationFrame(step);};setCurrent(0);const io=new IntersectionObserver(entries=>{const visible=entries.some(e=>e.isIntersecting);if(visible&&!played){played=true;timer.current=setTimeout(run,Math.max(0,delay)*1e3);}else if(!visible&&replay&&played){stop();played=false;setCurrent(0);}},{threshold:.4});io.observe(el);return()=>{io.disconnect();stop();};},[target,duration,delay,replay]);const textStyle={fontFamily:f.fontFamily||`\"Instrument Serif\", Georgia, serif`,fontWeight:f.fontWeight??400,fontStyle:f.fontStyle??\"normal\",fontSize:f.fontSize??72,letterSpacing:f.letterSpacing??\"-0.04em\",lineHeight:f.lineHeight??\"0.9em\",textAlign:f.textAlign,color:props.numberColor||\"#A987FF\",textTransform:props.numberUppercase?\"uppercase\":\"none\",fontVariantNumeric:\"tabular-nums\"};const finalText=`${prefix}${format(target)}${suffix}`;return /*#__PURE__*/_jsxs(\"span\",{ref:ref,style:{...props.style,...textStyle,position:\"relative\",display:\"inline-block\",whiteSpace:\"nowrap\",margin:0},children:[/*#__PURE__*/_jsx(\"span\",{style:SR_ONLY,children:finalText}),/*#__PURE__*/_jsxs(\"span\",{\"aria-hidden\":\"true\",children:[prefix,/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-grid\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{gridArea:\"1 / 1\",visibility:\"hidden\"},children:format(target)}),/*#__PURE__*/_jsx(\"span\",{style:{gridArea:\"1 / 1\",textAlign:\"right\"},children:format(current)})]}),suffix]})]});}addPropertyControls(CountUpNumber,{prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},value:{type:ControlType.Number,title:\"Value\",min:0,max:1e9,step:.1,defaultValue:40},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"%\"},decimals:{type:ControlType.Number,title:\"Decimals\",min:0,max:3,step:1,displayStepper:true,defaultValue:0},separator:{type:ControlType.Boolean,title:\"Thousands ,\",defaultValue:true},duration:{type:ControlType.Number,title:\"Duration\",min:.3,max:5,step:.1,unit:\"s\",defaultValue:1.6},delay:{type:ControlType.Number,title:\"Delay\",min:0,max:3,step:.05,unit:\"s\",defaultValue:0},replay:{type:ControlType.Boolean,title:\"Replay on Re-enter\",defaultValue:false},numberFont:{type:ControlType.Font,title:\"Number Font\",controls:\"extended\",defaultFontType:\"serif\",defaultValue:{fontSize:\"72px\",letterSpacing:\"-0.04em\",lineHeight:\"0.9em\"}},numberColor:{type:ControlType.Color,title:\"Number Color\",defaultValue:\"#A987FF\"},numberUppercase:{type:ControlType.Boolean,title:\"Number Uppercase\",defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUpNumber\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerIntrinsicWidth\":\"120\",\"framerIntrinsicHeight\":\"72\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUpNumber.map"],"mappings":"A,iNAQG,SAAwBe,EAAc,EAAM,CAAC,GAAK,CAAC,SAAO,QAAM,SAAO,WAAS,YAAU,WAAS,QAAM,UAAQC,EAAYC,EAAED,EAAM,YAAY,CAAC,EAAQE,EAAO,OAAO,SAASC,CAAK,EAAEA,EAAM,EAAQC,EAAO,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,KAAK,MAAMC,GAAU,CAAC,CAAC,CAAC,EAAQC,EAAO,GAAGC,EAAUC,EAAE,eAAe,QAAQ,CAAC,sBAAsBJ,EAAO,sBAAsBA,CAAM,CAAC,EAAEI,EAAE,QAAQJ,CAAM,EAC3X,CAACK,EAAQC,GAAY1B,EAAekB,CAAM,EAAQS,EAAI1B,EAAa,IAAI,EAAQ2B,EAAI3B,E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