import{f as C,a as M}from"./context-IddTiA87.js";import{q as w,bi as S,p as k,d as O,v as P,F as B,J as _,r as F,bj as L,bk as I,aF as x}from"./index-DGnN4tUo.js";const R=w("form",[S("inline",`
 width: 100%;
 display: inline-flex;
 align-items: flex-start;
 align-content: space-around;
 `,[w("form-item",{width:"auto",marginRight:"18px"},[k("&:last-child",{marginRight:0})])])]);var V=function(t,m,i,o){function h(a){return a instanceof i?a:new i(function(f){f(a)})}return new(i||(i=Promise))(function(a,f){function v(n){try{e(o.next(n))}catch(d){f(d)}}function r(n){try{e(o.throw(n))}catch(d){f(d)}}function e(n){n.done?a(n.value):h(n.value).then(v,r)}e((o=o.apply(t,m||[])).next())})};const q=Object.assign(Object.assign({},_.props),{inline:Boolean,labelWidth:[Number,String],labelAlign:String,labelPlacement:{type:String,default:"top"},model:{type:Object,default:()=>{}},rules:Object,disabled:Boolean,size:String,showRequireMark:{type:Boolean,default:void 0},requireMarkPlacement:String,showFeedback:{type:Boolean,default:!0},onSubmit:{type:Function,default:t=>{t.preventDefault()}},showLabel:{type:Boolean,default:void 0},validateMessages:Object}),$=O({name:"Form",props:q,setup(t){const{mergedClsPrefixRef:m}=B(t);_("Form","-form",R,L,t,m);const i={},o=F(void 0),h=r=>{const e=o.value;(e===void 0||r>=e)&&(o.value=r)};function a(r){return V(this,arguments,void 0,function*(e,n=()=>!0){return yield new Promise((d,j)=>{const y=[];for(const u of I(i)){const g=i[u];for(const s of g)s.path&&y.push(s.internalValidate(null,n))}Promise.all(y).then(u=>{const g=u.some(l=>!l.valid),s=[],c=[];u.forEach(l=>{var p,b;!((p=l.errors)===null||p===void 0)&&p.length&&s.push(l.errors),!((b=l.warnings)===null||b===void 0)&&b.length&&c.push(l.warnings)}),e&&e(s.length?s:void 0,{warnings:c.length?c:void 0}),g?j(s.length?s:void 0):d({warnings:c.length?c:void 0})})})})}function f(){for(const r of I(i)){const e=i[r];for(const n of e)n.restoreValidation()}}return x(C,{props:t,maxChildLabelWidthRef:o,deriveMaxChildLabelWidth:h}),x(M,{formItems:i}),Object.assign({validate:a,restoreValidation:f},{mergedClsPrefix:m})},render(){const{mergedClsPrefix:t}=this;return P("form",{class:[`${t}-form`,this.inline&&`${t}-form--inline`],onSubmit:this.onSubmit},this.$slots)}});export{$ as _};
