function i(e,t){switch(t){case!1:return Array.isArray(e)?[]:e.rulesBeforeSubmit??[];case!0:case void 0:default:return Array.isArray(e)?e:(e.rulesBeforeSubmit??[]).concat(e.rules??[])}}function c(e,t){const r=(typeof t=="function"?t:()=>t)(e);return r!==!0&&typeof r!="string"&&console.error(`${String(r)} is not a valid value. Rule functions must return boolean true or a string.`),r}function a(e,t,u){const r=i(t,u),n=[];for(const s of r??[]){const o=c(e,s);o===!0||typeof o!="string"||n.push(o)}return n}function l(e,t,u){const r=i(t,u);let n=!0;for(const s of r)if(n=c(e,s),!(n===!0||typeof n!="string"))break;return n}function f(e,t,u){return Object.entries(e).reduce((r,[n,s])=>{const o=a(s,t[n]??[],u);return o.length>0&&(r[n]=o),r},{})}export{l as a,f as v};