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