import{slicedToArray as o}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as e,Fragment as t}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useCallback as l}from"react";import a from"../Tooltip/Tooltip.js";import s from"../Dialog/Dialog.js";import u from"./AvatarGroupCounterTooltipContent.js";import{useTooltipContentTabNavigation as c,TOOLTIP_SHOW_DELAY as p}from"./AvatarGroupCounterTooltipHelper.js";var d=function(d){var f=d.focusPrevPlaceholderRef,m=d.focusNextPlaceholderRef,v=d.counterContainerRef,h=d.children,T=void 0===h?[]:h,g=d.avatars,C=void 0===g?[]:g,R=d.type,P=d.className,j=d.counterTooltipCustomProps,E=d.counterTooltipIsVirtualizedList,b=void 0!==E&&E,y=r(!1),N=o(y,2),V=N[0],w=N[1],x=i(null),A=n((function(){return(null==j?void 0:j.content)||e(u,{avatars:C,type:R,className:P,isVirtualizedList:b,tooltipContentContainerRef:x})}),[C,P,null==j?void 0:j.content,b,R]);c({counterContainerRef:v,tooltipContentContainerRef:x,focusPrevPlaceholderRef:f,focusNextPlaceholderRef:m,setIsKeyboardTooltipVisible:w,isKeyboardTooltipVisible:V});var D=l((function(){w(!1)}),[]),O=n((function(){return[s.hideShowTriggers.MOUSE_ENTER]}),[]),S=n((function(){return[s.hideShowTriggers.MOUSE_LEAVE]}),[]);return(null==C?void 0:C.length)||(null==j?void 0:j.content)?e(a,Object.assign({showOnDialogEnter:!0,open:V,hideDelay:p,showTrigger:O,hideTrigger:S,onTooltipHide:D},j||{},{content:A},{children:T})):e(t,{children:T})};export{d as default};
