import{r,ac as L,ae as g,af as E,j as w,a7 as k,a8 as T}from"./vendor-ClLR6ncd.js";function R(c){return c.substring(2).toLowerCase()}function j(c,s){return s.documentElement.clientWidth<c.clientX||s.documentElement.clientHeight<c.clientY}function M(c){const{children:s,disableReactTree:x=!1,mouseEvent:a="onClick",onClickAway:C,touchEvent:u="onTouchEnd"}=c,l=r.useRef(!1),o=r.useRef(null),f=r.useRef(!1),d=r.useRef(!1);r.useEffect(()=>(setTimeout(()=>{f.current=!0},0),()=>{f.current=!1}),[]);const D=L(s.ref,o),i=g(e=>{const t=d.current;d.current=!1;const n=E(o.current);if(!f.current||!o.current||"clientX"in e&&j(e,n))return;if(l.current){l.current=!1;return}let v;e.composedPath?v=e.composedPath().indexOf(o.current)>-1:v=!n.documentElement.contains(e.target)||o.current.contains(e.target),!v&&(x||!t)&&C(e)}),h=e=>t=>{d.current=!0;const n=s.props[e];n&&n(t)},m={ref:D};return u!==!1&&(m[u]=h(u)),r.useEffect(()=>{if(u!==!1){const e=R(u),t=E(o.current),n=()=>{l.current=!0};return t.addEventListener(e,i),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,i),t.removeEventListener("touchmove",n)}}},[i,u]),a!==!1&&(m[a]=h(a)),r.useEffect(()=>{if(a!==!1){const e=R(a),t=E(o.current);return t.addEventListener(e,i),()=>{t.removeEventListener(e,i)}}},[i,a]),w.jsx(r.Fragment,{children:r.cloneElement(s,m)})}var p={},y=T;Object.defineProperty(p,"__esModule",{value:!0});var P=p.default=void 0,_=y(k()),b=w;P=p.default=(0,_.default)((0,b.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");export{M as C,P as d};
