import{r as l}from"./index.BIRwh3HZ.js";function h(){return typeof navigator>"u"?!1:/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)}function K(e,a){const{key:s,modifiers:n=[],ignoreInputs:o=!0}=a;if(o){const u=e.target;if(u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)return!1}const i=e.key.toLowerCase(),c=s.toLowerCase();if(i!==c)return!1;const r=new Set(n),t=r.has("meta"),d=r.has("ctrl");let f=!0;t||d?h()?f=t?e.metaKey:e.ctrlKey:f=t||d?e.ctrlKey:!0:f=!e.metaKey&&!e.ctrlKey;const y=r.has("shift")?e.shiftKey:!e.shiftKey,p=r.has("alt")?e.altKey:!e.altKey;return f&&y&&p}function w(e){const{handler:a,enabled:s=!0,preventDefault:n=!0,stopPropagation:o=!1}=e,i=l.useRef(a);i.current=a;const c=l.useRef(e);c.current=e,l.useEffect(()=>{if(!s||typeof window>"u")return;const r=t=>{K(t,c.current)&&(n&&t.preventDefault(),o&&t.stopPropagation(),i.current(t))};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}},[s,n,o])}function m(e,a=!0){w({key:"Escape",handler:e,enabled:a,ignoreInputs:!1})}export{m as a,w as u};
