{"version":3,"file":"CustomHooks.CLSlTYHQ.mjs","names":["useState","useCallback","error"],"sources":["https:/framerusercontent.com/modules/QKffHBv8HPr45fvuCCky/YlRVWTB1Blp0rB3xrs4w/CustomHooks.js"],"sourcesContent":["import{useState,useCallback,useEffect}from\"react\";// Helper hook for async requests in idiomatic React (SWR currently does not work!)\n// Source: https://usehooks.com\nconst useAsync=(asyncFunction,immediate=true)=>{const[status,setStatus]=useState(\"idle\");const[data,setData]=useState(null);const[error,setError]=useState(null);// The execute function wraps asyncFunction and\n// handles setting state for pending, value, and error.\n// useCallback ensures the below useEffect is not called\n// on every render, but only if asyncFunction changes.\nconst execute=useCallback(()=>{setStatus(\"pending\");setData(null);setError(null);return asyncFunction().then(response=>{setData(response);setStatus(\"success\");}).catch(error=>{setError(error);setStatus(\"error\");});},[asyncFunction]);// Call execute if we want to fire it right away.\n// Otherwise execute can be called later, such as\n// in an onClick handler.\nuseEffect(()=>{if(immediate){execute();}},[execute,immediate]);return{execute,status,data,error};};export{useAsync};\nexport const __FramerMetadata__ = {\"exports\":{\"useAsync\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CustomHooks.map"],"mappings":"iKAAkD,CAE5C,GAAU,EAAc,EAAU,KAAO,CAAC,GAAK,CAAC,EAAO,GAAWA,EAAS,OAAO,CAAM,CAAC,EAAK,GAASA,EAAS,KAAK,CAAM,CAAC,EAAM,GAAUA,EAAS,KAAK,CAI1J,EAAQC,OAAiB,EAAU,UAAU,CAAC,EAAQ,KAAK,CAAC,EAAS,KAAK,CAAQ,GAAe,CAAC,KAAK,GAAU,CAAC,EAAQ,EAAS,CAAC,EAAU,UAAU,EAAG,CAAC,MAAM,GAAO,CAAC,EAASC,EAAM,CAAC,EAAU,QAAQ,EAAG,EAAG,CAAC,EAAc,CAAC,CAGzK,OAA/D,MAAc,CAAI,GAAW,GAAS,EAAI,CAAC,EAAQ,EAAU,CAAC,CAAO,CAAC,UAAQ,SAAO,OAAK,QAAM"}