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