import{o as w}from"./Du5p1CSp.js";import{c as d,w as p,h as g}from"./JdsLn7ux.js";import{aI as f,r as E,i as h,aJ as L,aG as $}from"./Dtqhy5Y2.js";function P(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function C(){return/Android/gi.test(window.navigator.userAgent)}function b(){return P()||C()}function s(t,r,i){d.isServer||f(a=>{document.addEventListener(t,r,i),a(()=>document.removeEventListener(t,r,i))})}function x(t,r,i){d.isServer||f(a=>{window.addEventListener(t,r,i),a(()=>window.removeEventListener(t,r,i))})}function T(t,r,i=h(()=>!0)){function a(n,l){if(!i.value||n.defaultPrevented)return;let e=l(n);if(e===null||!e.getRootNode().contains(e))return;let m=function u(o){return typeof o=="function"?u(o()):Array.isArray(o)||o instanceof Set?o:[o]}(t);for(let u of m){if(u===null)continue;let o=u instanceof HTMLElement?u:w(u);if(o!=null&&o.contains(e)||n.composed&&n.composedPath().includes(o))return}return!p(e,g.Loose)&&e.tabIndex!==-1&&n.preventDefault(),r(n,e)}let c=E(null);s("pointerdown",n=>{var l,e;i.value&&(c.value=((e=(l=n.composedPath)==null?void 0:l.call(n))==null?void 0:e[0])||n.target)},!0),s("mousedown",n=>{var l,e;i.value&&(c.value=((e=(l=n.composedPath)==null?void 0:l.call(n))==null?void 0:e[0])||n.target)},!0),s("click",n=>{b()||c.value&&(a(n,()=>c.value),c.value=null)},!0),s("touchend",n=>a(n,()=>n.target instanceof HTMLElement?n.target:null),!0),x("blur",n=>a(n,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}let v=Symbol("Context");var y=(t=>(t[t.Open=1]="Open",t[t.Closed=2]="Closed",t[t.Closing=4]="Closing",t[t.Opening=8]="Opening",t))(y||{});function H(){return A()!==null}function A(){return L(v,null)}function I(t){$(v,t)}export{x as a,P as b,y as i,A as l,b as n,H as s,I as t,T as w};
