import{validateFieldsNatively as e,toNestErrors as r}from"@hookform/resolvers";import{errors as t}from"@vinejs/vine";import{appendErrors as s}from"react-hook-form";function o(e,r){const t=Object.create(null);for(;e.length;){const o=e[0],a=o.field;if(a in t||(t[a]={message:o.message,type:o.rule}),r){const{types:e}=t[a],i=e&&e[o.rule];t[a]=s(a,r,t,o.rule,i?[...i,o.message]:o.message)}e.shift()}return t}function a(s,a,i={}){return async(n,l,c)=>{try{const r=await s.validate(n,a);return c.shouldUseNativeValidation&&e({},c),{errors:{},values:i.raw?Object.assign({},n):r}}catch(e){if(e instanceof t.E_VALIDATION_ERROR)return{values:{},errors:r(o(e.messages,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw e}}}export{a as vineResolver};
//# sourceMappingURL=vine.modern.mjs.map
