import{e8 as B,P as C,d as G,T as R,X as v,ab as j,z as E,a2 as P,e9 as T,dD as x,b7 as _,h as b}from"./index-bb1600c6.js";import{g as I}from"./get-slot-1efb97e5.js";const L=()=>B,M={name:"Space",self:L},A=M;let h;const D=()=>{if(!C)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({},v.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=v("Space","-space",void 0,A,e,a),g=j("Space",u,a);return{useGap:D(),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:{[P("gap",t)]:f}}=n.value,{row:l,col:p}=T(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:w,internalUseGap:S}=this,c=_(I(this));if(!c.length)return null;const y=`${t.horizontal}px`,d=`${t.horizontal/2}px`,z=`${t.vertical}px`,i=`${t.vertical/2}px`,s=c.length-1,m=n.startsWith("space-");return b("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`:""}},!w&&(o||S)?c:c.map(($,r)=>b("div",{role:"none",style:[g,{maxWidth:"100%"},o?"":e?{marginBottom:r!==s?z:""}: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}]},$)))}});export{H as _};
