"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../tslib.es6-C4EgNkz1.js"),t=require("react"),E=require("../utils-C9NL3q0j.js"),e=require("../use-tooltip-Bsf51pP_.js");require("classnames");const S=require("../index-Bsb1LHpi.js");require("../array.polyfill.flat-5BAolFdk.js");require("../icon-I30uh1Ov.js");const T=()=>null,d=()=>null,_=l=>{var{className:y,pointer:h,overlayStyle:f,noHover:i,onFocus:b=()=>{},onBlur:m=()=>{},onMouseEnter:O=()=>{},onMouseLeave:v=()=>{},onExpand:C,onCollapse:L,children:a}=l,M=N.__rest(l,["className","pointer","overlayStyle","noHover","onFocus","onBlur","onMouseEnter","onMouseLeave","onExpand","onCollapse","children"]);const{isExpanded:n,expandTooltip:u,collapseTooltip:s}=e.useTooltip({onCollapse:L,onExpand:C}),r=t.useRef(null);t.useEffect(()=>{const o=function(I){S.handleEscapeKeydown(I,s)};return n&&document.addEventListener("keydown",o),()=>{document.removeEventListener("keydown",o)}},[n]);const R=o=>{O(o),i||(clearTimeout(r.current),u())},q=o=>{v(o),i||(clearTimeout(r.current),r.current=setTimeout(()=>{s()},300))},w=o=>{b(o),u()},F=o=>{m(o),s()},c=E.findComponent(a,T),p=E.findComponent(a,d);if(!p)throw new Error("EbayTooltip: Please use a EbayTooltipHost that defines the host of the tooltip");if(!c)throw new Error("EbayTooltip: Please use a EbayTooltipContent that defines the content of the tooltip");return t.createElement(e.Tooltip,Object.assign({},M,{className:y,type:"tooltip",isExpanded:n,onFocus:w,onBlur:F,onMouseEnter:R,onMouseLeave:q}),t.createElement(e.TooltipHost,Object.assign({},p.props)),t.createElement(e.TooltipContent,Object.assign({},c.props,{type:"tooltip",style:f,pointer:h})))};exports.DEFAULT_POINTER_DIRECTION=e.DEFAULT_POINTER_DIRECTION;exports.POINTER_STYLES=e.POINTER_STYLES;exports.Tooltip=e.Tooltip;exports.TooltipFooter=e.TooltipFooter;exports.EbayTooltip=_;exports.EbayTooltipContent=T;exports.EbayTooltipHost=d;
