var r=require("@hookform/resolvers"),e=require("react-hook-form");function n(r){if(r&&r.__esModule)return r;var e=Object.create(null);return r&&Object.keys(r).forEach(function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,t.get?t:{enumerable:!0,get:function(){return r[n]}})}}),e.default=r,e}var t=/*#__PURE__*/n(require("zod/v4/core"));function o(){return o=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)({}).hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},o.apply(null,arguments)}function s(r,e){try{var n=r()}catch(r){return e(r)}return n&&n.then?n.then(void 0,e):n}function i(r,n){for(var t={};r.length;){var o=r[0],s=o.code,i=o.message,a=o.path.join(".");if(!t[a])if("unionErrors"in o){var u=o.unionErrors[0].errors[0];t[a]={message:u.message,type:u.code}}else t[a]={message:i,type:s};if("unionErrors"in o&&o.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),n){var c=t[a].types,f=c&&c[o.code];t[a]=e.appendErrors(a,n,t,s,f?[].concat(f,o.message):o.message)}r.shift()}return t}function a(r,n){for(var t={},s=function(){var s=r[0],i=s.code,a=s.message,u=s.path.join(".");if(!t[u])if("invalid_union"===s.code&&s.errors.length>0){var c=s.errors[0][0];t[u]={message:c.message,type:c.code}}else t[u]={message:a,type:i};if("invalid_union"===s.code&&s.errors.forEach(function(e){return e.forEach(function(e){return r.push(o({},e,{path:[].concat(s.path,e.path)}))})}),n){var f=t[u].types,l=f&&f[s.code];t[u]=e.appendErrors(u,n,t,i,l?[].concat(l,s.message):s.message)}r.shift()};r.length;)s();return t}exports.zodResolver=function(e,n,o){if(void 0===o&&(o={}),function(r){return"_def"in r&&"object"==typeof r._def&&"typeName"in r._def}(e))return function(t,a,u){try{return Promise.resolve(s(function(){return Promise.resolve(e["sync"===o.mode?"parse":"parseAsync"](t,n)).then(function(e){return u.shouldUseNativeValidation&&r.validateFieldsNatively({},u),{errors:{},values:o.raw?Object.assign({},t):e}})},function(e){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(e))return{values:{},errors:r.toNestErrors(i(e.errors,!u.shouldUseNativeValidation&&"all"===u.criteriaMode),u)};throw e}))}catch(r){return Promise.reject(r)}};if(function(r){return"_zod"in r&&"object"==typeof r._zod}(e))return function(i,u,c){try{return Promise.resolve(s(function(){return Promise.resolve(("sync"===o.mode?t.parse:t.parseAsync)(e,i,n)).then(function(e){return c.shouldUseNativeValidation&&r.validateFieldsNatively({},c),{errors:{},values:o.raw?Object.assign({},i):e}})},function(e){if(function(r){return r instanceof t.$ZodError}(e))return{values:{},errors:r.toNestErrors(a(e.issues,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw e}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")};
//# sourceMappingURL=zod.js.map
