function p(r){return r==null||r===""||Array.isArray(r)&&r.length===0||!(r instanceof Date)&&typeof r=="object"&&Object.keys(r).length===0}function f(r){return!p(r)}function u(r,t=!0){return r instanceof Object&&r.constructor===Object&&(t||Object.keys(r).length!==0)}var y=(r,t)=>u(r)&&r.hasOwnProperty(t)?r:t?{[t]:r}:r,b=(r,t,j)=>async({values:c,name:o})=>{let{sync:h=!1,raw:a=!1}={};try{let e=await r[h?"parse":"parseAsync"](c,t);return{values:y(a?c:e,o),errors:{}}}catch(e){if(Array.isArray(e==null?void 0:e.errors))return{values:y(a?c:void 0,o),errors:e.errors.reduce((n,i)=>{let s=f(i.path)?i.path.join("."):o;return s&&(n[s]||(n[s]=[]),n[s].push(i)),n},{})};throw e}};export{b as h};
