import e from"../../menu/src/MenuItem.mjs";import t from"../../menu/index.mjs";import n from"../../spin/index.mjs";import r from"./MentionsContext.mjs";import{createVNode as i,defineComponent as a,inject as o,onBeforeUnmount as s,shallowRef as c}from"vue";function l(){}var u=a({compatConfig:{MODE:3},name:`DropdownMenu`,props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(a,{slots:u}){let{activeIndex:d,setActiveIndex:f,selectOption:p,onFocus:m=l,loading:h}=o(r,{activeIndex:c(),loading:c(!1)}),g,_=e=>{clearTimeout(g),g=setTimeout(()=>{m(e)})};return s(()=>{clearTimeout(g)}),()=>{let{prefixCls:r,options:o}=a,s=o[d.value]||{};return i(t,{prefixCls:`${r}-menu`,activeKey:s.value,onSelect:({key:e})=>{let t=o.find(({value:t})=>t===e);p(t)},onMousedown:_},{default:()=>[!h.value&&o.map((t,n)=>{let{value:r,disabled:a,label:o=t.value,class:s,style:c}=t;return i(e,{key:r,disabled:a,onMouseenter:()=>{f(n)},class:s,style:c},{default:()=>[u.option?.(t)??(typeof o==`function`?o(t):o)]})}),!h.value&&o.length===0?i(e,{key:`notFoundContent`,disabled:!0},{default:()=>[u.notFoundContent?.()]}):null,h.value&&i(e,{key:`loading`,disabled:!0},{default:()=>[i(n,{size:`small`},null)]})]})}}});export{u as default};