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