{"version":3,"file":"CountUp.B_lRgG1Q.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/Dav9Ku91he9diOXzfplG/b81UpCwVVRi84T7zjX7b/CountUp.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * COUNTUP - stat counter that animates when scrolled into view.\n *\n * Port of the static site's `[data-count]` behaviour (Homepage + About).\n * Matches the original exactly: 1500ms, cubic ease-out (1 - (1-k)^3), fires\n * once at 50% visibility and then stops observing.\n *\n * All six shipped usages (three per page, same trio on both):\n *   target 12,  plain           -> \"12\"     BOOKS/NOVELS PUBLISHED\n *   target 3,   plain           -> \"3\"      COMPLETE SERIES\n *   target 500, unit K, suffix + -> \"500K+\"  READERS WORLDWIDE\n *\n * Note the unit is a literal letter appended to the counted number - it does\n * NOT divide. `target` is always the number you want on screen.\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 64\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CountUp(props){const{target,suffix,format,duration,font,color,align,style}=props;const ref=useRef(null);const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[value,setValue]=useState(()=>isCanvas?render(target,format,suffix):render(0,format,suffix));useEffect(()=>{if(isCanvas){setValue(render(target,format,suffix));return;}const node=ref.current;if(!node)return;const reduce=typeof window!==\"undefined\"&&typeof window.matchMedia===\"function\"&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;if(reduce||!(\"IntersectionObserver\"in window)){setValue(render(target,format,suffix));return;}let frame=0;const run=()=>{const t0=(window.performance||Date).now();const step=t=>{const k=Math.min(1,(t-t0)/duration);const eased=1-Math.pow(1-k,3);setValue(render(target*eased,format,suffix));if(k<1)frame=requestAnimationFrame(step);};frame=requestAnimationFrame(step);};const io=new IntersectionObserver(entries=>{entries.forEach(e=>{if(!e.isIntersecting)return;run();io.unobserve(e.target);});},{threshold:.5});io.observe(node);return()=>{io.disconnect();if(frame)cancelAnimationFrame(frame);};},[target,suffix,format,duration,isCanvas]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{...style,display:\"flex\",alignItems:\"center\",justifyContent:align===\"left\"?\"flex-start\":align===\"right\"?\"flex-end\":\"center\",color,...font,fontVariantNumeric:\"tabular-nums\"},children:value});}CountUp.defaultProps={target:12,suffix:\"\",format:\"plain\",duration:1500,color:\"#f0dcaa\",align:\"center\"};addPropertyControls(CountUp,{target:{type:ControlType.Number,title:\"Target\",min:0,max:1e7,step:1,defaultValue:12},format:{type:ControlType.Enum,title:\"Unit\",options:[\"plain\",\"K\",\"M\"],optionTitles:[\"None - 12\",\"K - 500K\",\"M - 2M\"],defaultValue:\"plain\"},suffix:{type:ControlType.String,title:\"Suffix\",placeholder:\"+\",defaultValue:\"\"},duration:{type:ControlType.Number,title:\"Duration\",min:200,max:5e3,step:100,unit:\"ms\",defaultValue:1500},color:{type:ControlType.Color,title:\"Colour\",defaultValue:\"#f0dcaa\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],displaySegmentedControl:true,defaultValue:\"center\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"monospace\"}});/**\n * The unit is appended, not applied as a divisor - this mirrors the original\n * `Math.round(target * eased) + (asK ? 'K' : '') + suffix`. So target 500 with\n * unit \"K\" and suffix \"+\" counts 0..500 and reads \"500K+\".\n */function render(n,unit,suffix){const base=Math.round(n);const u=unit===\"plain\"?\"\":unit;return`${base}${u}${suffix}`;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicHeight\":\"64\",\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"200\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\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