"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),F=require("../_util/classNames.js"),M=require("../_util/hooks/useFlexGapSupport.js"),P=require("../_util/props-util/index.js"),v=require("../_util/type.js"),b=require("../_util/vue-types/index.js"),D=require("../config-provider/hooks/useConfigInject.js"),s=require("./Compact.js"),E=require("./style/index.js"),R={small:8,middle:16,large:24},w=()=>({prefixCls:String,size:{type:[String,Number,Array]},direction:b.default.oneOf(v.tuple("horizontal","vertical")).def("horizontal"),align:b.default.oneOf(v.tuple("start","end","center","baseline")),wrap:v.booleanType()});function T(e){return typeof e=="string"?R[e]:e||0}const r=t.defineComponent({compatConfig:{MODE:3},name:"ASpace",inheritAttrs:!1,props:w(),slots:Object,setup(e,{slots:g,attrs:d}){const{prefixCls:n,space:A,direction:$}=D.default("space",e),[O,V]=E.default(n),y=M.default(),l=t.computed(()=>e.size??A?.value?.size??"small"),p=t.ref(),i=t.ref();t.watch(l,()=>{[p.value,i.value]=(Array.isArray(l.value)?l.value:[l.value,l.value]).map(a=>T(a))},{immediate:!0});const S=t.computed(()=>e.align===void 0&&e.direction==="horizontal"?"center":e.align),G=t.computed(()=>F.default(n.value,V.value,`${n.value}-${e.direction}`,{[`${n.value}-rtl`]:$.value==="rtl",[`${n.value}-align-${S.value}`]:S.value})),I=t.computed(()=>$.value==="rtl"?"marginLeft":"marginRight"),j=t.computed(()=>{const a={};return y.value&&(a.columnGap=`${p.value}px`,a.rowGap=`${i.value}px`),{...a,...e.wrap&&{flexWrap:"wrap",marginBottom:`${-i.value}px`}}});return()=>{const{wrap:a,direction:B="horizontal"}=e,x=g.default?.(),z=P.filterEmpty(x),h=z.length;if(h===0)return null;const o=g.split?.(),C=`${n.value}-item`,q=p.value,m=h-1;return t.createVNode("div",{...d,class:[G.value,d.class],style:[j.value,d.style]},[z.map((N,u)=>{let f=x.indexOf(N);f===-1&&(f=`$$space-${u}`);let c={};return y.value||(B==="vertical"?u<m&&(c={marginBottom:`${q/(o?2:1)}px`}):c={...u<m&&{[I.value]:`${q/(o?2:1)}px`},...a&&{paddingBottom:`${i.value}px`}}),O(t.createVNode(t.Fragment,{key:f},[t.createVNode("div",{class:C,style:c},[N]),u<m&&o&&t.createVNode("span",{class:`${C}-split`,style:c},[o])]))})])}}});r.Compact=s.default;r.install=function(e){return e.component(r.name,r),e.component(s.default.name,s.default),e};exports.Compact=s.default;exports.default=r;exports.spaceProps=w;
