"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7054],{6816:(e,t,n)=>{n.d(t,{d:()=>d});var r=n(66204),c=n(52682),u=n(76734),o=n(26074),s=n(43188);function i(e){return e.substring(2).toLowerCase()}function d(e){const{children:t,disableReactTree:n=!1,mouseEvent:d="onClick",onClickAway:l,touchEvent:a="onTouchEnd"}=e,f=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(f.current)return void(f.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||l(e)})),w=e=>n=>{E.current=!0;const r=t.props[e];r&&r(n)},g={ref:h};return!1!==a&&(g[a]=w(a)),r.useEffect((()=>{if(!1!==a){const e=i(a),t=(0,o.Z)(m.current),n=()=>{f.current=!0};return t.addEventListener(e,b),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,b),t.removeEventListener("touchmove",n)}}}),[b,a]),!1!==d&&(g[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,g)})}},57054:(e,t,n)=>{n.r(t),n.d(t,{default:()=>r.d});var r=n(6816)}}]);
//# sourceMappingURL=7054.6da32038.chunk.js.map