import e from"../_util/canUseDom.mjs";import t from"../_util/classNames.mjs";import n from"../_util/props-util/initDefaultProps.mjs";import{findDOMNode as r}from"../_util/props-util/index.mjs";import i from"../config-provider/hooks/useConfigInject.mjs";import{getTransitionProps as a}from"../_util/transition.mjs";import o from"../_util/hooks/useMergedState.mjs";import{floatButtonGroupProps as s}from"./interface.mjs";import{useProvideFloatButtonGroupContext as c}from"./context.mjs";import l from"./style/index.mjs";import u,{floatButtonPrefixCls as d}from"./FloatButton.mjs";import{Fragment as f,Transition as p,computed as m,createVNode as h,defineComponent as g,onBeforeUnmount as _,ref as v,vShow as y,watch as b,withDirectives as x}from"vue";import{CloseOutlined as S,FileTextOutlined as C}from"@antsoo-lib/icons";var w=g({compatConfig:{MODE:3},name:`AFloatButtonGroup`,inheritAttrs:!1,props:n(s(),{type:`default`,shape:`circle`}),setup(n,{attrs:s,slots:g,emit:w}){let{prefixCls:T,direction:E}=i(d,n),[D,O]=l(T),[k,A]=o(!1,{value:m(()=>n.open)}),j=v(null),M=v(null);c({shape:m(()=>n.shape)});let N={onMouseenter(){A(!0),w(`update:open`,!0),n.onOpenChange?.(!0)},onMouseleave(){A(!1),w(`update:open`,!1),n.onOpenChange?.(!1)}},P=m(()=>n.trigger===`hover`?N:{}),F=()=>{let e=!k.value;w(`update:open`,e),n.onOpenChange?.(e),A(e)},I=e=>{if(j.value?.contains(e.target)){r(M.value)?.contains(e.target)&&F();return}A(!1),w(`update:open`,!1),n.onOpenChange?.(!1)};return b(m(()=>n.trigger),t=>{e()&&(document.removeEventListener(`click`,I),t===`click`&&document.addEventListener(`click`,I))},{immediate:!0}),_(()=>{document.removeEventListener(`click`,I)}),()=>{let{shape:e=`circle`,type:r=`default`,tooltip:i,description:o,trigger:c}=n,l=`${T.value}-group`,d=t(l,O.value,s.class,{[`${l}-rtl`]:E.value===`rtl`,[`${l}-${e}`]:e,[`${l}-${e}-shadow`]:!c}),m=t(O.value,`${l}-wrap`),_=a(`${l}-wrap`);return D(h(`div`,{ref:j,...s,class:d,...P.value},[c&&[`click`,`hover`].includes(c)?h(f,null,[h(p,_,{default:()=>[x(h(`div`,{class:m},[g.default&&g.default()]),[[y,k.value]])]}),h(u,{ref:M,type:r,shape:e,tooltip:i,description:o},{icon:()=>k.value?g.closeIcon?.()||h(S,null,null):g.icon?.()||h(C,null,null),tooltip:g.tooltip,description:g.description})]):g.default?.()]))}}});export{w as default};