"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),g=require("@ant-design/icons-vue/RightOutlined"),b=require("../_util/classNames.js"),j=require("../_util/omit.js"),M=require("../_util/placements.js"),w=require("../_util/props-util/index.js"),C=require("../_util/vnode.js"),S=require("../config-provider/hooks/useConfigInject.js"),L=require("../menu/src/OverrideContext.js"),R=require("../vc-dropdown/Dropdown.js"),y=require("../vc-util/devWarning.js"),T=require("./dropdown-button.js"),B=require("./props.js"),_=require("./style/index.js"),k=require("../_util/props-util/initDefaultProps.js"),x=n.defineComponent({compatConfig:{MODE:3},name:"ADropdown",inheritAttrs:!1,props:k.default(B.dropdownProps(),{mouseEnterDelay:.15,mouseLeaveDelay:.1,placement:"bottomLeft",trigger:"hover"}),slots:Object,setup(r,{slots:p,attrs:h,emit:s}){const{prefixCls:o,rootPrefixCls:m,direction:i,getPopupContainer:q}=S.default("dropdown",r),[N,$]=_.default(o),P=n.computed(()=>{const{placement:e="",transitionName:t}=r;return t!==void 0?t:e.includes("top")?`${m.value}-slide-down`:`${m.value}-slide-up`});L.useProvideOverride({prefixCls:n.computed(()=>`${o.value}-menu`),expandIcon:n.computed(()=>n.createVNode("span",{class:`${o.value}-menu-submenu-arrow`},[n.createVNode(g,{class:`${o.value}-menu-submenu-arrow-icon`},null)])),mode:n.computed(()=>"vertical"),selectable:n.computed(()=>!1),onClick:()=>{},validator:({mode:e})=>{}});const O=()=>{const e=r.overlay||p.overlay?.(),t=Array.isArray(e)?e[0]:e;if(!t)return null;const a=t.props||{};y.default(!a.mode||a.mode==="vertical","Dropdown",`mode="${a.mode}" is not supported for Dropdown's Menu.`);const{selectable:u=!1,expandIcon:l=t.children?.expandIcon?.()}=a,d=typeof l<"u"&&w.isValidElement(l)?l:n.createVNode("span",{class:`${o.value}-menu-submenu-arrow`},[n.createVNode(g,{class:`${o.value}-menu-submenu-arrow-icon`},null)]);return w.isValidElement(t)?C.cloneElement(t,{mode:"vertical",selectable:u,expandIcon:()=>d}):t},D=n.computed(()=>{const e=r.placement;if(!e)return i.value==="rtl"?"bottomRight":"bottomLeft";if(e.includes("Center")){const t=e.slice(0,e.indexOf("Center"));return y.default(!e.includes("Center"),"Dropdown",`You are using '${e}' placement in Dropdown, which is deprecated. Try to use '${t}' instead.`),t}return e}),V=n.computed(()=>typeof r.visible=="boolean"?r.visible:r.open),A=e=>{s("update:visible",e),s("visibleChange",e),s("update:open",e),s("openChange",e)};return()=>{const{arrow:e,trigger:t,disabled:a,overlayClassName:u}=r,l=p.default?.()[0],d=C.cloneElement(l,Object.assign({class:b.default(l?.props?.class,{[`${o.value}-rtl`]:i.value==="rtl"},`${o.value}-trigger`)},a?{disabled:a}:{})),v=b.default(u,$.value,{[`${o.value}-rtl`]:i.value==="rtl"}),c=a?[]:t;let f;c&&c.includes("contextmenu")&&(f=!0);const E=M.default({arrowPointAtCenter:typeof e=="object"&&e.pointAtCenter,autoAdjustOverflow:!0}),I=j.default({...r,...h,visible:V.value,builtinPlacements:E,overlayClassName:v,arrow:!!e,alignPoint:f,prefixCls:o.value,getPopupContainer:q?.value,transitionName:P.value,trigger:c,onVisibleChange:A,placement:D.value},["overlay","onUpdate:visible"]);return N(n.createVNode(R.default,I,{default:()=>[d],overlay:O}))}}});x.Button=T.default;exports.default=x;
