{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/3mKFSGQqKHV82uOV1eBc/TbXI1XaZFNevVKcgIt7G/isMotionValue.js", "ssg:https://framer.com/m/framer/useAutoMotionValue.js@^0.3.0"],
  "sourcesContent": ["import{MotionValue}from\"framer\";// Basic MotionValue check\nexport const isMotionValue=v=>v instanceof MotionValue;\nexport const __FramerMetadata__ = {\"exports\":{\"isMotionValue\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./isMotionValue.map", "import{useCallback,useEffect,useRef}from\"react\";import{motionValue,animate,RenderTarget}from\"framer\";import{isMotionValue}from\"https://framerusercontent.com/modules/3mKFSGQqKHV82uOV1eBc/TbXI1XaZFNevVKcgIt7G/isMotionValue.js\";import{useConstant}from\"https://framerusercontent.com/modules/ExNgrA7EJTKUPpH6vIlN/eiOrSJ2Ab5M9jPCvVwUz/useConstant.js\";export function useAutoMotionValue(inputValue,options){// Put options on a local ref\n// Might wanna just memo instead but it works for now\nconst optionsRef=useRef(options);const animation=useRef();const didInitialMount=useRef(false);const isOnCanvas=RenderTarget.current()===RenderTarget.canvas;// in-progress - trying to figure out effect hooks\nconst onChangeDeps=(options===null||options===void 0?void 0:options.onChangeDeps)?options.onChangeDeps:[];// Memoize the onChange handler\nconst onChange=useCallback(options===null||options===void 0?void 0:options.onChange,[...onChangeDeps,]);// Optionally scale the value from props\nconst transformer=useCallback(value=>{var ref;return((ref=optionsRef.current)===null||ref===void 0?void 0:ref.transform)?optionsRef.current.transform(value):value;},[]);// Create new MotionValue from inputValue\nconst value1=useConstant(()=>isMotionValue(inputValue)?inputValue:motionValue(transformer(inputValue)));// Setting value from prop change\nuseEffect(()=>{if(!isMotionValue(inputValue)&&didInitialMount.current){var ref,ref1;const newValue=transformer(inputValue);(ref=animation.current)===null||ref===void 0?void 0:ref.stop();// Call change callback\nif(onChange)onChange(newValue,value1);// Trigger animation to new value\nif(((ref1=optionsRef.current)===null||ref1===void 0?void 0:ref1.animate)&&!isOnCanvas){var ref2;// @ts-ignore\nanimation.current=animate(value1,newValue,(ref2=optionsRef.current)===null||ref2===void 0?void 0:ref2.transition);}else{value1.set(newValue);}}didInitialMount.current=true;},[inputValue,...onChangeDeps]);return value1;}\nexport const __FramerMetadata__ = {\"exports\":{\"useAutoMotionValue\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useAutoMotionValue.map"],
  "mappings": "4HACO,IAAMA,EAAcC,GAAGA,aAAaC,ECDqT,SAASC,EAAmBC,EAAWC,EAAQ,CAE/Y,IAAMC,EAAWC,EAAOF,CAAO,EAAQG,EAAUD,EAAO,EAAQE,EAAgBF,EAAO,EAAK,EAAQG,EAAWC,EAAa,QAAQ,IAAIA,EAAa,OAC/IC,EAAsDP,GAAQ,aAAcA,EAAQ,aAAa,CAAC,EAClGQ,EAASC,EAAoDT,GAAQ,SAAS,CAAC,GAAGO,CAAa,CAAC,EAChGG,EAAYD,EAAYE,GAAO,CAAC,IAAIC,EAAI,MAAQ,GAAAA,EAAIX,EAAW,WAAW,MAAMW,IAAM,SAAcA,EAAI,UAAWX,EAAW,QAAQ,UAAUU,CAAK,EAAEA,CAAM,EAAE,CAAC,CAAC,EACjKE,EAAOC,EAAY,IAAIC,EAAchB,CAAU,EAAEA,EAAWiB,EAAYN,EAAYX,CAAU,CAAC,CAAC,EACtG,OAAAkB,EAAU,IAAI,CAAC,GAAG,CAACF,EAAchB,CAAU,GAAGK,EAAgB,QAAQ,CAAC,IAAIQ,EAAIM,EAAK,IAAMC,EAAST,EAAYX,CAAU,EAEzH,IAF4Ha,EAAIT,EAAU,WAAW,MAAMS,IAAM,QAAcA,EAAI,KAAK,EACrLJ,GAASA,EAASW,EAASN,CAAM,EAC/B,GAAAK,EAAKjB,EAAW,WAAW,MAAMiB,IAAO,SAAcA,EAAK,SAAU,CAACb,EAAW,CAAC,IAAIe,EAC3FjB,EAAU,QAAQkB,EAAQR,EAAOM,GAAUC,EAAKnB,EAAW,WAAW,MAAMmB,IAAO,OAAO,OAAOA,EAAK,UAAU,CAAE,MAAMP,EAAO,IAAIM,CAAQ,CAAG,CAACf,EAAgB,QAAQ,EAAK,EAAE,CAACL,EAAW,GAAGQ,CAAY,CAAC,EAASM,CAAO",
  "names": ["isMotionValue", "v", "MotionValue", "useAutoMotionValue", "inputValue", "options", "optionsRef", "pe", "animation", "didInitialMount", "isOnCanvas", "RenderTarget", "onChangeDeps", "onChange", "te", "transformer", "value", "ref", "value1", "useConstant", "isMotionValue", "motionValue", "ue", "ref1", "newValue", "ref2", "animate2"]
}
