var e=require("@hookform/resolvers"),r=require("@standard-schema/utils");function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},n.apply(null,arguments)}var a=Symbol("Schema root");function o(e,r){r&&(e.message=e.message?e.message+"\n"+r:r)}exports.standardSchemaResolver=function(s,i,l){return void 0===l&&(l={}),function(i,u,c){try{var v=function(){if(f.issues){var s=function(e,s){for(var i=new Map,l=0;l<e.length;l++){var u=e[l],c=r.getDotPath(u)||a,v=i.get(c);if(v?c===a&&o(v,u.message):i.set(c,{message:u.message,type:""}),s){var f,d=i.get(c),m=d.types||{};d.types=n({},m,((f={})[Object.keys(m).length]=u.message,f))}}for(var g,y={},h=function(e){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(i);!(g=h()).done;){var b=g.value,p=b[0];p!==a&&(y[p]=b[1])}var j=i.get(a);return j&&(y.root?(o(y.root,j.message),function(e,r){if(r){for(var t=e.types||{},n=0,a=Object.values(r);n<a.length;n++){var o=a[n];t[Object.keys(t).length]=o}e.types=t}}(y.root,j.types)):y.root=j),y}(f.issues,!c.shouldUseNativeValidation&&"all"===c.criteriaMode);return{values:{},errors:e.toNestErrors(s,c)}}return c.shouldUseNativeValidation&&e.validateFieldsNatively({},c),{values:l.raw?Object.assign({},i):f.value,errors:{}}},f=s["~standard"].validate(i),d=function(){if(f instanceof Promise)return Promise.resolve(f).then(function(e){f=e})}();return Promise.resolve(d&&d.then?d.then(v):v())}catch(e){return Promise.reject(e)}}};
//# sourceMappingURL=standard-schema.js.map
