import{validateFieldsNatively as e,toNestErrors as r}from"@hookform/resolvers";import{Validator as o}from"ata-validator";import{appendErrors as s}from"react-hook-form";const t=(e,r)=>{const o={};for(let t=0;t<e.length;t+=1){const a=e[t],i=("required"===a.keyword?`${a.instancePath}/${a.params.missingProperty}`:a.instancePath).substring(1).replace(/\//g,".");if(o[i]||(o[i]={message:a.message,type:a.keyword}),r){const e=o[i].types,t=e&&e[a.keyword];o[i]=s(i,r,o,a.keyword,t?[].concat(t,a.message||""):a.message)}}return o},a=(s,a,i={})=>{const n=new o(s,a);return async(o,s,a)=>{const c=n.validate(o);return a.shouldUseNativeValidation&&e({},a),c.valid?{values:i.raw?Object.assign({},o):o,errors:{}}:{values:{},errors:r(t(c.errors,!a.shouldUseNativeValidation&&"all"===a.criteriaMode),a)}}};export{a as ataResolver};
//# sourceMappingURL=ata-validator.modern.mjs.map
