import{defineComponent as C,ref as j,onMounted as k,onBeforeUnmount as B,computed as u,createVNode as z}from"vue";import N from"../_util/classNames.mjs";import E from"../_util/hooks/useFlexGapSupport.mjs";import F,{responsiveArray as l}from"../_util/responsiveObserve.mjs";import{someType as c}from"../_util/type.mjs";import I from"../config-provider/hooks/useConfigInject.mjs";import M from"./context.mjs";import{useRowStyle as T}from"./style/index.mjs";const V=()=>({align:c([String,Object]),justify:c([String,Object]),prefixCls:String,gutter:c([Number,Array,Object],0),wrap:{type:Boolean,default:void 0}}),Q=C({compatConfig:{MODE:3},name:"ARow",inheritAttrs:!1,props:V(),setup(n,{slots:S,attrs:a}){const{prefixCls:s,direction:$}=I("row",n),[h,G]=T(s);let m;const d=F(),p=j({xs:!0,sm:!0,md:!0,lg:!0,xl:!0,xxl:!0}),v=j({xs:!1,sm:!1,md:!1,lg:!1,xl:!1,xxl:!1}),y=t=>u(()=>{if(typeof n[t]=="string")return n[t];if(typeof n[t]!="object")return"";for(let e=0;e<l.length;e++){const o=l[e];if(!v.value[o])continue;const r=n[t][o];if(r!==void 0)return r}return""}),g=y("align"),b=y("justify"),x=E();k(()=>{m=d.value.subscribe(t=>{v.value=t;const e=n.gutter||0;(!Array.isArray(e)&&typeof e=="object"||Array.isArray(e)&&(typeof e[0]=="object"||typeof e[1]=="object"))&&(p.value=t)})}),B(()=>{d.value.unsubscribe(m)});const w=u(()=>{const t=[void 0,void 0],{gutter:e=0}=n;return(Array.isArray(e)?e:[e,void 0]).forEach((r,A)=>{if(typeof r=="object")for(let i=0;i<l.length;i++){const f=l[i];if(p.value[f]&&r[f]!==void 0){t[A]=r[f];break}}else t[A]=r}),t});M({gutter:w,supportFlexGap:x,wrap:u(()=>n.wrap)});const R=u(()=>N(s.value,{[`${s.value}-no-wrap`]:n.wrap===!1,[`${s.value}-${b.value}`]:b.value,[`${s.value}-${g.value}`]:g.value,[`${s.value}-rtl`]:$.value==="rtl"},a.class,G.value)),O=u(()=>{const t=w.value,e={},o=t[0]!=null&&t[0]>0?`${t[0]/-2}px`:void 0,r=t[1]!=null&&t[1]>0?`${t[1]/-2}px`:void 0;return o&&(e.marginLeft=o,e.marginRight=o),x.value?e.rowGap=`${t[1]}px`:r&&(e.marginTop=r,e.marginBottom=r),e});return()=>h(z("div",{...a,class:R.value,style:{...O.value,...a.style}},[S.default?.()]))}});export{Q as default,V as rowProps};
