import{get as e,set as r}from"react-hook-form";const t=(r,t,s)=>{if(r&&"reportValidity"in r){const o=e(s,t);r.setCustomValidity(o&&o.message||""),r.reportValidity()}},s=(e,r)=>{for(const s in r.fields){const o=r.fields[s];o&&o.ref&&"reportValidity"in o.ref?t(o.ref,s,e):o&&o.refs&&o.refs.forEach(r=>t(r,s,e))}},o=(t,o)=>{o.shouldUseNativeValidation&&s(t,o);const n={};for(const s in t){const f=e(o.fields,s),c=Object.assign(t[s]||{},{ref:f&&f.refs?f.refs[0]:f&&f.ref});if(i(o.names||Object.keys(t),s)){const t=Object.assign({},e(n,s));r(t,"root",c),r(n,s,t)}else r(n,s,c)}return n},i=(e,r)=>{const t=n(r).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(e=>n(e).match(`^${t}\\.\\d+`))};function n(e){return e.replace(/[\[\]]/g,"")}export{o as toNestErrors,s as validateFieldsNatively};
//# sourceMappingURL=resolvers.mjs.map
