import{dX as z,S as B,d as G,W as R,$ as b,ae as j,C as E,a5 as _,dY as I,dZ as x,bn as L,k as v}from"./index-e497b666.js";import{g as M}from"./get-slot-1efb97e5.js";const P=()=>z,T={name:"Space",self:P},W=T;let h;const A=()=>{if(!B)return!0;if(h===void 0){const e=document.createElement("div");e.style.display="flex",e.style.flexDirection="column",e.style.rowGap="1px",e.appendChild(document.createElement("div")),e.appendChild(document.createElement("div")),document.body.appendChild(e);const a=e.scrollHeight===1;return document.body.removeChild(e),h=a}return h},O=Object.assign(Object.assign({},b.props),{align:String,justify:{type:String,default:"start"},inline:Boolean,vertical:Boolean,size:{type:[String,Number,Array],default:"medium"},wrapItem:{type:Boolean,default:!0},itemStyle:[String,Object],wrap:{type:Boolean,default:!0},internalUseGap:{type:Boolean,default:void 0}}),H=G({name:"Space",props:O,setup(e){const{mergedClsPrefixRef:a,mergedRtlRef:u}=R(e),n=b("Space","-space",void 0,W,e,a),g=j("Space",u,a);return{useGap:A(),rtlEnabled:g,mergedClsPrefix:a,margin:E(()=>{const{size:t}=e;if(Array.isArray(t))return{horizontal:t[0],vertical:t[1]};if(typeof t=="number")return{horizontal:t,vertical:t};const{self:{[_("gap",t)]:f}}=n.value,{row:l,col:p}=I(f);return{horizontal:x(p),vertical:x(l)}})}},render(){const{vertical:e,align:a,inline:u,justify:n,itemStyle:g,margin:t,wrap:f,mergedClsPrefix:l,rtlEnabled:p,useGap:o,wrapItem:S,internalUseGap:w}=this,c=L(M(this));if(!c.length)return null;const y=`${t.horizontal}px`,d=`${t.horizontal/2}px`,$=`${t.vertical}px`,i=`${t.vertical/2}px`,s=c.length-1,m=n.startsWith("space-");return v("div",{role:"none",class:[`${l}-space`,p&&`${l}-space--rtl`],style:{display:u?"inline-flex":"flex",flexDirection:e?"column":"row",justifyContent:["start","end"].includes(n)?"flex-"+n:n,flexWrap:!f||e?"nowrap":"wrap",marginTop:o||e?"":`-${i}`,marginBottom:o||e?"":`-${i}`,alignItems:a,gap:o?`${t.vertical}px ${t.horizontal}px`:""}},!S&&(o||w)?c:c.map((C,r)=>v("div",{role:"none",style:[g,{maxWidth:"100%"},o?"":e?{marginBottom:r!==s?$:""}:p?{marginLeft:m?n==="space-between"&&r===s?"":d:r!==s?y:"",marginRight:m?n==="space-between"&&r===0?"":d:"",paddingTop:i,paddingBottom:i}:{marginRight:m?n==="space-between"&&r===s?"":d:r!==s?y:"",marginLeft:m?n==="space-between"&&r===0?"":d:"",paddingTop:i,paddingBottom:i}]},C)))}});export{H as _};