import{k as F,af as M,a4 as c,aC as R,aH as d,p as k,j as w,i as m,aR as B,bs as D}from"#entry";const y=Symbol.for("vuetify:form"),O=k({disabled:Boolean,fastFail:Boolean,readonly:Boolean,modelValue:{type:Boolean,default:null},validateOn:{type:String,default:"input"}},"form");function j(t){const r=F(t,"modelValue"),f=d(()=>t.disabled),v=d(()=>t.readonly),n=R(!1),a=c([]),o=c([]);async function g(){const e=[];let s=!0;o.value=[],n.value=!0;for(const i of a.value){const l=await i.validate();if(l.length>0&&(s=!1,e.push({id:i.id,errorMessages:l})),!s&&t.fastFail)break}return o.value=e,n.value=!1,{valid:s,errors:o.value}}function V(){a.value.forEach(e=>e.reset())}function h(){a.value.forEach(e=>e.resetValidation())}return M(a,()=>{let e=0,s=0;const i=[];for(const l of a.value)l.isValid===!1?(s++,i.push({id:l.id,errorMessages:l.errorMessages})):l.isValid===!0&&e++;o.value=i,r.value=s>0?!1:e===a.value.length?!0:null},{deep:!0,flush:"post"}),B(y,{register:e=>{let{id:s,vm:i,validate:l,reset:u,resetValidation:b}=e;a.value.some(p=>p.id===s),a.value.push({id:s,validate:l,reset:u,resetValidation:b,vm:D(i),isValid:null,errorMessages:[]})},unregister:e=>{a.value=a.value.filter(s=>s.id!==e)},update:(e,s,i)=>{const l=a.value.find(u=>u.id===e);l&&(l.isValid=s,l.errorMessages=i)},isDisabled:f,isReadonly:v,isValidating:n,isValid:r,items:a,validateOn:d(()=>t.validateOn)}),{errors:o,isDisabled:f,isReadonly:v,isValidating:n,isValid:r,items:a,validate:g,reset:V,resetValidation:h}}function x(t){const r=w(y,null);return{...r,isReadonly:m(()=>!!(t?.readonly??r?.isReadonly.value)),isDisabled:m(()=>!!(t?.disabled??r?.isDisabled.value))}}export{j as c,O as m,x as u};
