"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[6753],{20875:(e,t,n)=>{n.d(t,{d:()=>d});var r=n(41867),c=n(32407),u=n(95809),o=n(89293),s=n(80838);function i(e){return e.substring(2).toLowerCase()}function d(e){const{children:t,disableReactTree:n=!1,mouseEvent:d="onClick",onClickAway:f,touchEvent:l="onTouchEnd"}=e,a=r.useRef(!1),m=r.useRef(null),v=r.useRef(!1),E=r.useRef(!1);r.useEffect((()=>(setTimeout((()=>{v.current=!0}),0),()=>{v.current=!1})),[]);const h=(0,c.Z)(t.ref,m),b=(0,u.Z)((e=>{const t=E.current;E.current=!1;const r=(0,o.Z)(m.current);if(!v.current||!m.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,r))return;if(a.current)return void(a.current=!1);let c;c=e.composedPath?e.composedPath().indexOf(m.current)>-1:!r.documentElement.contains(e.target)||m.current.contains(e.target),c||!n&&t||f(e)})),w=e=>n=>{E.current=!0;const r=t.props[e];r&&r(n)},p={ref:h};return!1!==l&&(p[l]=w(l)),r.useEffect((()=>{if(!1!==l){const e=i(l),t=(0,o.Z)(m.current),n=()=>{a.current=!0};return t.addEventListener(e,b),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,b),t.removeEventListener("touchmove",n)}}}),[b,l]),!1!==d&&(p[d]=w(d)),r.useEffect((()=>{if(!1!==d){const e=i(d),t=(0,o.Z)(m.current);return t.addEventListener(e,b),()=>{t.removeEventListener(e,b)}}}),[b,d]),(0,s.jsx)(r.Fragment,{children:r.cloneElement(t,p)})}},56753:(e,t,n)=>{n.r(t),n.d(t,{default:()=>r.d});var r=n(20875)}}]);
//# sourceMappingURL=6753.6cec4da7.chunk.js.map