import{validateFieldsNatively as r,toNestErrors as e}from"@hookform/resolvers";import{Validator as a}from"ata-validator";import{appendErrors as o}from"react-hook-form";var t=function(r,e){for(var a={},t=0;t<r.length;t+=1){var s=r[t],i=("required"===s.keyword?s.instancePath+"/"+s.params.missingProperty:s.instancePath).substring(1).replace(/\//g,".");if(a[i]||(a[i]={message:s.message,type:s.keyword}),e){var n=a[i].types,m=n&&n[s.keyword];a[i]=o(i,e,a,s.keyword,m?[].concat(m,s.message||""):s.message)}}return a},s=function(o,s,i){void 0===i&&(i={});var n=new a(o,s);return function(a,o,s){try{var m=n.validate(a);return s.shouldUseNativeValidation&&r({},s),Promise.resolve(m.valid?{values:i.raw?Object.assign({},a):a,errors:{}}:{values:{},errors:e(t(m.errors,!s.shouldUseNativeValidation&&"all"===s.criteriaMode),s)})}catch(r){return Promise.reject(r)}}};export{s as ataResolver};
//# sourceMappingURL=ata-validator.module.js.map
