{"version":3,"file":"useFormValueWithValidation.CQIP_6Gf.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/tUYmAf2d6XYP3NSKtVAk/XJsXKbUbFF3IcncKNLdu/useFormValueWithValidation.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{getAnswers}from\"https://framerusercontent.com/modules/lAWlxyGOJSWGdss5SWjU/rcu9DZZoBxxGubcgfokp/getAnswers.js\";import{useFormStore}from\"https://framerusercontent.com/modules/iS2muT0YJjapdbNK3s3r/sgvYZLnpBBkq5pJBsSgQ/useFormStore.js\";export function useFormValueWithValidation(stepId){const[formStore]=useFormStore();const[valueState,setValueState]=useState({stepId});useEffect(()=>{/**\n         * PATH:\n         * The `value` from formState.[id].[id] doesn't work with _system-hidden_field_,\n         * so we get the value from `getAnswer` function and `isValid` from the formState,\n         * However, we should avoid that and use the same behavior for every inputs.\n         */const isValid=formStore?.[stepId]?.[stepId]?.isValid;const type=formStore?.[stepId]?.[stepId]?.type;const value=getAnswers(formStore)[stepId];(async()=>{if(typeof isValid===\"function\"){const{valid,errors}=await isValid(value);setValueState({stepId,value,type,valid,errors});}else{setValueState({stepId,value,type,valid:true});}})();},[stepId,formStore]);return valueState;}\nexport const __FramerMetadata__ = {\"exports\":{\"useFormValueWithValidation\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"iLAAsR,SAAgB,EAA2B,EAAO,CAAC,GAAK,CAAC,GAAW,GAAc,CAAM,CAAC,EAAW,GAAeA,EAAS,CAAC,SAAO,CAAC,CAK9C,OAL+C,MAAc,CAK/Z,IAAM,EAAQ,IAAY,KAAU,IAAS,QAAc,EAAK,IAAY,KAAU,IAAS,KAAW,EAAM,EAAW,EAAU,CAAC,IAAS,SAAS,CAAC,GAAG,OAAO,GAAU,WAAW,CAAC,GAAK,CAAC,QAAM,UAAQ,MAAM,EAAQ,EAAM,CAAC,EAAc,CAAC,SAAO,QAAM,OAAK,QAAM,SAAO,CAAC,MAAO,EAAc,CAAC,SAAO,QAAM,OAAK,MAAM,GAAK,CAAC,IAAM,EAAG,CAAC,EAAO,EAAU,CAAC,CAAQ,mBAL9U,IAAsH,IAA0H"}