import{d as V,W,c as s,r as G,L as k,N as M,_ as m,aT as q,A as p,a1 as H,R as I,P as j,bf as B,aC as J}from"./D3l4Cb4m.js";import{u as K}from"./WIvQOhpN.js";import{l as Q,C as x}from"./BbpBKUVh.js";const U={small:8,middle:16,large:24},X=()=>({prefixCls:String,size:{type:[String,Number,Array]},direction:j.oneOf(B("horizontal","vertical")).def("horizontal"),align:j.oneOf(B("start","end","center","baseline")),wrap:J()});function Y(e){return typeof e=="string"?U[e]:e||0}const d=V({compatConfig:{MODE:3},name:"ASpace",inheritAttrs:!1,props:X(),slots:Object,setup(e,F){let{slots:o,attrs:f}=F;const{prefixCls:l,space:g,direction:z}=W("space",e),[P,R]=Q(l),h=K(),n=s(()=>{var a,t,i;return(i=(a=e.size)!==null&&a!==void 0?a:(t=g==null?void 0:g.value)===null||t===void 0?void 0:t.size)!==null&&i!==void 0?i:"small"}),y=G(),r=G();k(n,()=>{[y.value,r.value]=(Array.isArray(n.value)?n.value:[n.value,n.value]).map(a=>Y(a))},{immediate:!0});const C=s(()=>e.align===void 0&&e.direction==="horizontal"?"center":e.align),T=s(()=>M(l.value,R.value,`${l.value}-${e.direction}`,{[`${l.value}-rtl`]:z.value==="rtl",[`${l.value}-align-${C.value}`]:C.value})),D=s(()=>z.value==="rtl"?"marginLeft":"marginRight"),E=s(()=>{const a={};return h.value&&(a.columnGap=`${y.value}px`,a.rowGap=`${r.value}px`),m(m({},a),e.wrap&&{flexWrap:"wrap",marginBottom:`${-r.value}px`})});return()=>{var a,t;const{wrap:i,direction:L="horizontal"}=e,b=(a=o.default)===null||a===void 0?void 0:a.call(o),_=q(b),w=_.length;if(w===0)return null;const c=(t=o.split)===null||t===void 0?void 0:t.call(o),A=`${l.value}-item`,N=y.value,S=w-1;return p("div",I(I({},f),{},{class:[T.value,f.class],style:[E.value,f.style]}),[_.map((O,u)=>{let $=b.indexOf(O);$===-1&&($=`$$space-${u}`);let v={};return h.value||(L==="vertical"?u<S&&(v={marginBottom:`${N/(c?2:1)}px`}):v=m(m({},u<S&&{[D.value]:`${N/(c?2:1)}px`}),i&&{paddingBottom:`${r.value}px`})),P(p(H,{key:$},[p("div",{class:A,style:v},[O]),u<S&&c&&p("span",{class:`${A}-split`,style:v},[c])]))})])}}});d.Compact=x;d.install=function(e){return e.component(d.name,d),e.component(x.name,x),e};export{d as S};
