import{Bt as e,Or as t,Q as n,Sr as r,St as i,Tr as a,Vn as o,pn as s,sn as c}from"./jsx-runtime-NwRKtVrk.js";import{n as l}from"./space-Dvitgohy.js";var u=t(a()),d=[`wrap`,`nowrap`,`wrap-reverse`],f=[`flex-start`,`flex-end`,`start`,`end`,`center`,`space-between`,`space-around`,`space-evenly`,`stretch`,`normal`,`left`,`right`],p=[`center`,`start`,`end`,`flex-start`,`flex-end`,`self-start`,`self-end`,`baseline`,`normal`,`stretch`],m=(e,t)=>{let n=t.wrap===!0?`wrap`:t.wrap;return{[`${e}-wrap-${n}`]:n&&d.includes(n)}},h=(e,t)=>{let n={};return p.forEach(r=>{n[`${e}-align-${r}`]=t.align===r}),n[`${e}-align-stretch`]=!t.align&&!!t.vertical,n},g=(e,t)=>{let n={};return f.forEach(r=>{n[`${e}-justify-${r}`]=t.justify===r}),n},_=(e,t)=>r({...m(e,t),...h(e,t),...g(e,t)}),v=e=>{let{componentCls:t}=e;return{[t]:{display:`flex`,margin:0,padding:0,"&-vertical":{flexDirection:`column`},"&-rtl":{direction:`rtl`},"&:empty":{display:`none`}}}},y=e=>{let{componentCls:t}=e;return{[t]:{"&-gap-small":{gap:e.flexGapSM},"&-gap-medium, &-gap-middle":{gap:e.flexGap},"&-gap-large":{gap:e.flexGapLG}}}},b=e=>{let{componentCls:t}=e,n={};return d.forEach(e=>{n[`${t}-wrap-${e}`]={flexWrap:e}}),n},x=e=>{let{componentCls:t}=e,n={};return p.forEach(e=>{n[`${t}-align-${e}`]={alignItems:e}}),n},S=e=>{let{componentCls:t}=e,n={};return f.forEach(e=>{n[`${t}-justify-${e}`]={justifyContent:e}}),n},C=i(`Flex`,t=>{let{paddingXS:n,padding:r,paddingLG:i}=t,a=e(t,{flexGapSM:n,flexGap:r,flexGapLG:i});return[v(a),y(a),b(a),x(a),S(a)]},()=>({}),{resetStyle:!1}),w=u.forwardRef((e,t)=>{let{prefixCls:i,rootClassName:a,className:d,style:f,flex:p,gap:m,vertical:h,orientation:g,component:v=`div`,children:y,...b}=e,{flex:x,direction:S,getPrefixCls:w}=u.useContext(c),T=w(`flex`,i),[E,D]=C(T),[,O]=n(g,h??x?.vertical),k=r(d,a,x?.className,T,E,D,_(T,{...e,vertical:O}),{[`${T}-rtl`]:S===`rtl`,[`${T}-gap-${m}`]:l(m),[`${T}-vertical`]:O}),A={...x?.style,...f};return s(p)&&(A.flex=p),s(m)&&!l(m)&&(A.gap=m),u.createElement(v,{ref:t,className:k,style:A,...o(b,[`justify`,`wrap`,`align`])},y)});export{w as t};