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