{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/7bhu3foZ2XR1oZD9BZUA/4U6U8RisTsmdhDaVW9pJ/Counter.js"],
  "sourcesContent": ["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";import{useInView,useMotionValue,useSpring}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Counter({decimal,value,decimalValue,direction,stiffness,damping,color,fontStyle}){const initialValue=0;const ref=useRef(null);const updatedDecimalValue=decimal===true?decimalValue:value;const motionValue=useMotionValue(direction===\"down\"?updatedDecimalValue:initialValue);const springValue=useSpring(motionValue,{damping:damping,stiffness:stiffness});const isInView=useInView(ref,{once:true,margin:\"-100px\"});useEffect(()=>{if(isInView){motionValue.set(direction===\"down\"?initialValue:updatedDecimalValue);}},[motionValue,isInView]);useEffect(()=>springValue.on(\"change\",latest=>{if(ref.current){ref.current.textContent=Intl.NumberFormat(\"en-US\").format(latest.toFixed(decimal===true?2:0));}}),[springValue]);return /*#__PURE__*/_jsx(_Fragment,{children:/*#__PURE__*/_jsx(\"span\",{ref:ref,style:{...fontStyle,color:color},children:initialValue})});}Counter.defaultProps={decimal:false,value:100,decimalValue:100,direction:\"up\",stiffness:300,damping:100,color:\"#000000\",fontStyle:\"\"};addPropertyControls(Counter,{decimal:{title:\"Decimal\",type:ControlType.Boolean,enabledTitle:\"Yes\",disabledTitle:\"No\"},value:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,hidden(props){return props.decimal===true;}},decimalValue:{title:\"Value\",type:ControlType.Number,min:0,max:1e3,step:.01,hidden(props){return props.decimal===false;}},direction:{title:\"Direction\",type:ControlType.Enum,options:[\"up\",\"down\"]},stiffness:{title:\"Stiffness\",type:ControlType.Number,min:1,max:1e3},damping:{title:\"Damping\",type:ControlType.Number,min:0,max:100},color:{title:\"Color\",type:ControlType.Color},fontStyle:{title:\"Font Style\",type:\"font\",controls:\"extended\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Counter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Counter.map"],
  "mappings": "mIAQkB,SAARA,EAAyB,CAAC,QAAAC,EAAQ,MAAAC,EAAM,aAAAC,EAAa,UAAAC,EAAU,UAAAC,EAAU,QAAAC,EAAQ,MAAAC,EAAM,UAAAC,CAAS,EAAE,CAAsB,IAAMC,EAAIC,EAAO,IAAI,EAAQC,EAAoBV,IAAU,GAAKE,EAAaD,EAAYU,EAAYC,EAAeT,IAAY,OAAOO,EAAoB,CAAY,EAAQG,EAAYC,EAAUH,EAAY,CAAC,QAAQN,EAAQ,UAAUD,CAAS,CAAC,EAAQW,EAASC,EAAUR,EAAI,CAAC,KAAK,GAAK,OAAO,QAAQ,CAAC,EAAE,OAAAS,EAAU,IAAI,CAAIF,GAAUJ,EAAY,IAAIR,IAAY,OAAO,EAAaO,CAAmB,CAAG,EAAE,CAACC,EAAYI,CAAQ,CAAC,EAAEE,EAAU,IAAIJ,EAAY,GAAG,SAASK,GAAQ,CAAIV,EAAI,UAASA,EAAI,QAAQ,YAAY,KAAK,aAAa,OAAO,EAAE,OAAOU,EAAO,QAAQlB,IAAU,GAAK,EAAE,CAAC,CAAC,EAAG,CAAC,EAAE,CAACa,CAAW,CAAC,EAAsBM,EAAKC,EAAU,CAAC,SAAsBD,EAAK,OAAO,CAAC,IAAIX,EAAI,MAAM,CAAC,GAAGD,EAAU,MAAMD,CAAK,EAAE,SAAS,CAAY,CAAC,CAAC,CAAC,CAAE,CAACP,EAAQ,aAAa,CAAC,QAAQ,GAAM,MAAM,IAAI,aAAa,IAAI,UAAU,KAAK,UAAU,IAAI,QAAQ,IAAI,MAAM,UAAU,UAAU,EAAE,EAAEsB,EAAoBtB,EAAQ,CAAC,QAAQ,CAAC,MAAM,UAAU,KAAKuB,EAAY,QAAQ,aAAa,MAAM,cAAc,IAAI,EAAE,MAAM,CAAC,MAAM,QAAQ,KAAKA,EAAY,OAAO,IAAI,EAAE,IAAI,IAAI,OAAOC,EAAM,CAAC,OAAOA,EAAM,UAAU,EAAK,CAAC,EAAE,aAAa,CAAC,MAAM,QAAQ,KAAKD,EAAY,OAAO,IAAI,EAAE,IAAI,IAAI,KAAK,IAAI,OAAOC,EAAM,CAAC,OAAOA,EAAM,UAAU,EAAM,CAAC,EAAE,UAAU,CAAC,MAAM,YAAY,KAAKD,EAAY,KAAK,QAAQ,CAAC,KAAK,MAAM,CAAC,EAAE,UAAU,CAAC,MAAM,YAAY,KAAKA,EAAY,OAAO,IAAI,EAAE,IAAI,GAAG,EAAE,QAAQ,CAAC,MAAM,UAAU,KAAKA,EAAY,OAAO,IAAI,EAAE,IAAI,GAAG,EAAE,MAAM,CAAC,MAAM,QAAQ,KAAKA,EAAY,KAAK,EAAE,UAAU,CAAC,MAAM,aAAa,KAAK,OAAO,SAAS,UAAU,CAAC,CAAC",
  "names": ["Counter", "decimal", "value", "decimalValue", "direction", "stiffness", "damping", "color", "fontStyle", "ref", "pe", "updatedDecimalValue", "motionValue", "useMotionValue", "springValue", "useSpring", "isInView", "useInView", "ue", "latest", "p", "l", "addPropertyControls", "ControlType", "props"]
}
