import{defineComponent as E,inject as A,ref as p,createVNode as r}from"vue";import I from"../_util/classNames.mjs";import{flattenChildren as j,isStringElement as k,isEmptyElement as N}from"../_util/props-util/index.mjs";import{cloneElement as S}from"../_util/vnode.mjs";import x from"../_util/vue-types/index.mjs";import L from"../config-provider/hooks/useConfigInject.mjs";import"../theme/internal.mjs";import M from"../grid/Col.mjs";import O from"./ItemMeta.mjs";import{ListContextKey as b}from"./contextKey.mjs";const P=()=>({prefixCls:String,extra:x.any,actions:x.array,grid:Object,colStyle:{type:Object,default:void 0}}),H=E({compatConfig:{MODE:3},name:"AListItem",inheritAttrs:!1,Meta:O,props:P(),slots:Object,setup(n,{slots:a,attrs:y}){const{itemLayout:s,grid:c}=A(b,{grid:p(),itemLayout:p()}),{prefixCls:g}=L("list",n),C=()=>{const i=a.default?.()||[];let o;return i.forEach(t=>{k(t)&&!N(t)&&(o=!0)}),o&&i.length>1},v=()=>{const i=n.extra??a.extra?.();return s.value==="vertical"?!!i:!C()};return()=>{const{class:i,...o}=y,t=g.value,l=n.extra??a.extra?.(),m=a.default?.();let e=n.actions??j(a.actions?.());e=e&&!Array.isArray(e)?[e]:e;const f=e&&e.length>0&&r("ul",{class:`${t}-item-action`,key:"actions"},[e.map(($,d)=>r("li",{key:`${t}-item-action-${d}`},[$,d!==e.length-1&&r("em",{class:`${t}-item-action-split`},null)]))]),h=c.value?"div":"li",u=r(h,{...o,class:I(`${t}-item`,{[`${t}-item-no-flex`]:!v()},i)},{default:()=>[s.value==="vertical"&&l?[r("div",{class:`${t}-item-main`,key:"content"},[m,f]),r("div",{class:`${t}-item-extra`,key:"extra"},[l])]:[m,f,S(l,{key:"extra"})]]});return c.value?r(M,{flex:1,style:n.colStyle},{default:()=>[u]}):u}}});export{H as default,P as listItemProps};
