var e=require("@hookform/resolvers"),r=require("effect"),t=require("effect/ParseResult"),n=require("react-hook-form");exports.effectTsResolver=function(o,a){return void 0===a&&(a={errors:"all",onExcessProperty:"ignore"}),function(s,c,f){return t.decodeUnknown(o,a)(s).pipe(r.Effect.catchAll(function(e){return r.Effect.flip(t.ArrayFormatter.formatIssue(e))}),r.Effect.mapError(function(r){var t=!f.shouldUseNativeValidation&&"all"===f.criteriaMode,o=r.reduce(function(e,r){var o=r.path.join(".");if(e[o]||(e[o]={message:r.message,type:r._tag}),t){var a=e[o].types,s=a&&a[String(r._tag)];e[o]=n.appendErrors(o,t,e,r._tag,s?[].concat(s,r.message):r.message)}return e},Object.create(null));return e.toNestErrors(o,f)}),r.Effect.tap(function(){return r.Effect.sync(function(){return f.shouldUseNativeValidation&&e.validateFieldsNatively({},f)})}),r.Effect.match({onFailure:function(e){return{errors:e,values:{}}},onSuccess:function(e){return{errors:{},values:e}}}),r.Effect.runPromise)}};
//# sourceMappingURL=effect-ts.js.map
