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