import{f as N,h as v,Y as $,r as T,k as w,G as I,ap as m,b as y,M as A,d as O,L as Y}from"./Ca9y1zsW.js";import{b as C,u as L,i as g,h,w as k}from"./BPRC2v3K.js";import{c as G}from"./Immh241S.js";import{P as o,i as P,a as R}from"./BR6Cm0N-.js";const V=C({prefixCls:{type:String}}),x=N({name:"ElSpaceItem",props:V,setup(e,{slots:u}){const p=L("space"),n=v(()=>`${e.prefixCls||p.b()}__item`);return()=>$("div",{class:n.value},T(u,"default"))}}),z={small:8,default:12,large:16};function _(e){const u=L("space"),p=v(()=>[u.b(),u.m(e.direction),e.class]),n=w(0),i=w(0),d=v(()=>{const t=e.wrap||e.fill?{flexWrap:"wrap"}:{},r={alignItems:e.alignment},l={rowGap:`${i.value}px`,columnGap:`${n.value}px`};return[t,r,l,e.style]}),f=v(()=>e.fill?{flexGrow:1,minWidth:`${e.fillRatio}%`}:{});return I(()=>{const{size:t="small",wrap:r,direction:l,fill:a}=e;if(m(t)){const[s=0,c=0]=t;n.value=s,i.value=c}else{let s;g(t)?s=t:s=z[t||"small"]||z.small,(r||a)&&l==="horizontal"?n.value=i.value=s:l==="horizontal"?(n.value=s,i.value=0):(i.value=s,n.value=0)}}),{classes:p,containerStyle:d,itemStyle:f}}const j=C({direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},class:{type:h([String,Object,Array]),default:""},style:{type:h([String,Array,Object]),default:""},alignment:{type:h(String),default:"center"},prefixCls:{type:String},spacer:{type:h([Object,String,Number,Array]),default:null,validator:e=>A(e)||g(e)||Y(e)},wrap:Boolean,fill:Boolean,fillRatio:{type:Number,default:100},size:{type:[String,Array,Number],values:G,validator:e=>g(e)||m(e)&&e.length===2&&e.every(g)}}),B=N({name:"ElSpace",props:j,setup(e,{slots:u}){const{classes:p,containerStyle:n,itemStyle:i}=_(e);function d(f,t="",r=[]){const{prefixCls:l}=e;return f.forEach((a,s)=>{P(a)?m(a.children)&&a.children.forEach((c,S)=>{P(c)&&m(c.children)?d(c.children,`${t+S}-`,r):r.push(y(x,{style:i.value,prefixCls:l,key:`nested-${t+S}`},{default:()=>[c]},o.PROPS|o.STYLE,["style","prefixCls"]))}):R(a)&&r.push(y(x,{style:i.value,prefixCls:l,key:`LoopKey${t+s}`},{default:()=>[a]},o.PROPS|o.STYLE,["style","prefixCls"]))}),r}return()=>{var f;const{spacer:t,direction:r}=e,l=T(u,"default",{key:0},()=>[]);if(((f=l.children)!=null?f:[]).length===0)return null;if(m(l.children)){let a=d(l.children);if(t){const s=a.length-1;a=a.reduce((c,S,E)=>{const b=[...c,S];return E!==s&&b.push(y("span",{style:[i.value,r==="vertical"?"width: 100%":null],key:E},[A(t)?t:O(t,o.TEXT)],o.STYLE)),b},[])}return y("div",{class:p.value,style:n.value},a,o.STYLE|o.CLASS)}return l.children}}}),Z=k(B);export{Z as E};