{"version":3,"file":"Counter.YN_7JsXZ.mjs","names":["useState","React","__esmMin","init_npm_react_18_3_1","ce","e","init_jsx_runtime","p","_e","motion","init_framer_motion_DhsWWWsN","ControlType","init_framer_BCdLsbZT","addPropertyControls","NumberCounter","props","count","setCount","startNumber","isVisible","setIsVisible","ref","observer","entry","entries","endNumber","intervalId","prevCount","loop","speed","formatCount","decimalSeparator","number","NumberCounterStyles","fontSize","font","fontColor","prefix","suffix","init_Counter"],"sources":["https:/framerusercontent.com/modules/ty8jlTPuU59smhwzi0WE/QvzRNXDRoyjzOI2CGN95/Counter.js"],"sourcesContent":["/**\n * Counter.tsx - Interactive Number Counter Component\n * ==============================================\n *\n * A sophisticated number counter component that provides an animated,\n * customisable way to display incrementing numbers. Features smooth\n * animations, intersection observer-based triggering, and extensive\n * styling options.\n *\n * Key Features:\n * - Animated number counting with customisable speed\n * - Intersection Observer integration for viewport-based triggering\n * - Customisable typography (font family, weight, size)\n * - Multiple number formatting options (comma, period, or plain)\n * - Optional loop functionality\n * - Prefix and suffix text support\n * - Responsive layout with flexible alignment\n *\n * Component Structure:\n *\n * 1. NumberCounter:\n *    - Manages the counting animation state\n *    - Handles intersection observation for viewport detection\n *    - Controls number formatting and display\n *    - Provides comprehensive styling customisation\n *\n * Properties:\n * - startNumber: Initial value to begin counting from\n * - endNumber: Target value to count up to\n * - speed: Animation duration between increments (milliseconds)\n * - prefix: Optional text to display before the number\n * - suffix: Optional text to display after the number\n * - loop: Boolean to enable/disable continuous counting\n * - decimalSeparator: Number formatting style ('comma', 'period', or 'none')\n * - fontSize: Text size in pixels\n * - font: Object containing font family and weight settings\n * - fontColor: Colour of the displayed text\n */import{jsxs as _jsxs}from\"react/jsx-runtime\";import React,{useState,useEffect}from\"react\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Base styles for the NumberCounter component\n * Establishes left-aligned flexible layout\n */const NumberCounterStyles={display:\"flex\",justifyContent:\"left\",alignItems:\"left\"};/**\n * NumberCounter Component\n *\n * A versatile animated counter that increments from a start number to an end number.\n * The animation begins when the component enters the viewport, utilising the\n * Intersection Observer API for optimal performance.\n *\n * @param {Object} props - Component properties\n * @param {number} props.startNumber - The number to start counting from\n * @param {number} props.endNumber - The target number to count to\n * @param {number} props.speed - Animation speed in milliseconds\n * @param {string} props.prefix - Text to display before the number\n * @param {string} props.suffix - Text to display after the number\n * @param {boolean} props.loop - Whether to restart the animation after completion\n * @param {string} props.decimalSeparator - Number formatting style ('comma', 'period', or 'none')\n * @param {number} props.fontSize - Size of the text in pixels\n * @param {Object} props.font - Font family and weight configuration\n * @param {string} props.fontColor - Colour of the counter text\n */export function NumberCounter(props){const{startNumber,endNumber,speed,prefix,suffix,loop,decimalSeparator,fontSize,font,fontColor}=props;const[count,setCount]=useState(startNumber);const[isVisible,setIsVisible]=useState(false);const ref=React.useRef(null);useEffect(()=>{const observer=new IntersectionObserver(entries=>{const entry=entries[0];setIsVisible(entry.isIntersecting);});if(ref.current){observer.observe(ref.current);}return()=>{if(ref.current){observer.unobserve(ref.current);}};},[]);useEffect(()=>{if(isVisible&&startNumber!==endNumber){const intervalId=setInterval(()=>{if(count<endNumber){setCount(prevCount=>prevCount+1);}else if(loop){setCount(startNumber);}},speed);return()=>{clearInterval(intervalId);};}},[count,startNumber,endNumber,loop,isVisible]);/**\n     * Formats the counter number according to the specified decimal separator\n     *\n     * @param {number} number - The number to format\n     * @returns {string} The formatted number string\n     */const formatCount=number=>{if(decimalSeparator===\"comma\"){return number.toLocaleString(\"en-US\");}else if(decimalSeparator===\"period\"){return number.toLocaleString(\"en-US\").replace(/,/g,\".\");}else{return number.toFixed(0);}};return /*#__PURE__*/_jsxs(motion.div,{ref:ref,style:{...NumberCounterStyles,gap:`${fontSize/2}px`,flexDirection:\"row\",alignItems:\"left\",fontSize:`${fontSize}px`,fontFamily:font.fontFamily,fontWeight:font.fontWeight,color:fontColor},children:[prefix,formatCount(count),suffix]});}/**\n * Default properties for the NumberCounter component\n * Establishes sensible defaults for all configurable options\n */NumberCounter.defaultProps={startNumber:0,endNumber:10,speed:100,prefix:\"\",suffix:\"\",loop:false,decimalSeparator:\"comma\",fontSize:16,font:{fontFamily:\"Arial\",fontWeight:400,systemFont:true},fontColor:\"#707070\"};/**\n * Property Controls Configuration\n *\n * Defines the customisation options available in the Framer interface.\n * Provides intuitive controls for all component properties with appropriate\n * constraints and default values.\n */addPropertyControls(NumberCounter,{font:{title:\"Font\",type:ControlType.Object,controls:{family:{title:\"Family\",type:ControlType.String,defaultValue:\"Arial\"},weight:{title:\"Weight\",type:ControlType.Number,defaultValue:400}}},fontSize:{title:\"Font Size\",type:ControlType.Number,min:8,max:200,step:1},fontColor:{type:ControlType.Color,title:\"Font Color\"},startNumber:{type:ControlType.Number,title:\"Start Number\",defaultValue:0,displayStepper:true},endNumber:{type:ControlType.Number,title:\"End Number\",defaultValue:10,displayStepper:true},decimalSeparator:{type:ControlType.Enum,title:\"Decimal Separator\",defaultValue:\"comma\",options:[\"comma\",\"period\",\"none\"],optionTitles:[\"Comma (1,000)\",\"Period (1.000)\",\"None\"]},speed:{type:ControlType.Number,title:\"Speed (ms)\",defaultValue:100,min:0,max:1e3,step:10},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},loop:{type:ControlType.Boolean,title:\"Loop Animation\",defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"NumberCounter\":{\"type\":\"reactComponent\",\"name\":\"NumberCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],"mappings":"A,0OA0DG,SAAgBc,EAAc,EAAM,CAAC,GAAK,CAAC,cAAY,YAAU,QAAM,SAAO,SAAO,OAAK,mBAAiB,WAAS,OAAK,aAAWC,EAAW,CAACC,EAAMC,GAAUjB,EAASkB,CAAW,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