import{s as e}from"./chunk-Bj-mKKzh.js";import{n as t}from"./jsx-runtime-CiQ1k8xo.js";import{lt as n}from"./vscode-api-DjORcpSo.js";var r=n(),i=e(t(),1);function a(e){let t=(0,r.c)(24),{activationNonce:n,floatingElementSelectors:a,includeInteractiveRegion:l,interactiveRegionRef:u,isPaused:d,onInteractiveChange:f,regionElementSelectors:p}=e,m;t[0]===a?m=t[1]:(m=a===void 0?[]:a,t[0]=a,t[1]=m);let h=m,g=l===void 0?!1:l,_;t[2]===p?_=t[3]:(_=p===void 0?[]:p,t[2]=p,t[3]=_);let v=_,[y,b]=(0,i.useState)(!1),x;t[4]===d?x=t[5]:(x=()=>d?.()??!1,t[4]=d,t[5]=x);let S=(0,i.useEffectEvent)(x),C;t[6]===f?C=t[7]:(C=e=>{b(!e),f(e)},t[6]=f,t[7]=C);let w=(0,i.useEffectEvent)(C),T;t[8]===f?T=t[9]:(T=()=>{f(!0)},t[8]=f,t[9]=T);let E=(0,i.useEffectEvent)(T),D;t[10]!==h||t[11]!==g||t[12]!==u||t[13]!==S||t[14]!==w||t[15]!==v||t[16]!==E?(D=()=>{let e=null,t=null,n=null,r=null,i=t=>{e!==t&&(e=t,w(t))},a=e=>{let t=u.current;if(t==null||g&&s(e,t))return!0;for(let n of v){let r=t.querySelectorAll(n);for(let t of r)if(c(t)&&s(e,t))return!0}for(let t of h){let n=document.querySelectorAll(t);for(let t of n)if(c(t)&&s(e,t))return!0}return!1},l=()=>{r=null,!(n==null||S())&&(t=n,i(a(n)))},d=()=>{r??=requestAnimationFrame(l)},f=e=>{n={x:e.clientX,y:e.clientY},t=n,d()},p=()=>{t!=null&&(n=t,d())},m=()=>{S()||i(!1)},_=()=>{if(S())return;let e=o({floatingElementSelectors:h,includeInteractiveRegion:g,interactiveRegion:u.current,regionElementSelectors:v});e!=null&&i(e)},y=new MutationObserver(p);window.addEventListener(`mousemove`,f),window.addEventListener(`resize`,p),window.addEventListener(`scroll`,p,!0),window.addEventListener(`mouseleave`,m),y.observe(document.body,{attributeFilter:[`aria-hidden`,`class`,`hidden`,`style`],attributes:!0,childList:!0,subtree:!0}),_();let b=requestAnimationFrame(_);return()=>{window.removeEventListener(`mousemove`,f),window.removeEventListener(`resize`,p),window.removeEventListener(`scroll`,p,!0),window.removeEventListener(`mouseleave`,m),y.disconnect(),cancelAnimationFrame(b),r!=null&&cancelAnimationFrame(r),e=null,E()}},t[10]=h,t[11]=g,t[12]=u,t[13]=S,t[14]=w,t[15]=v,t[16]=E,t[17]=D):D=t[17];let O;return t[18]!==n||t[19]!==h||t[20]!==g||t[21]!==u||t[22]!==v?(O=[n,h,g,u,v],t[18]=n,t[19]=h,t[20]=g,t[21]=u,t[22]=v,t[23]=O):O=t[23],(0,i.useEffect)(D,O),y}function o({floatingElementSelectors:e,includeInteractiveRegion:t,interactiveRegion:n,regionElementSelectors:r}){if(n!=null){if(t&&n.matches(`:hover`))return!0;for(let e of r){let t=n.querySelectorAll(e);for(let e of t)if(c(e)&&e.matches(`:hover`))return!0}}for(let t of e){let e=document.querySelectorAll(t);for(let t of e)if(c(t)&&t.matches(`:hover`))return!0}return document.documentElement.matches(`:hover`)?!1:null}function s(e,t){return l(e,t.getBoundingClientRect())?document.elementsFromPoint(e.x,e.y).some(e=>e===t||t.contains(e)):!1}function c(e){let t=window.getComputedStyle(e);if(t.display===`none`||t.visibility===`hidden`||t.pointerEvents===`none`)return!1;let n=e.getBoundingClientRect();return n.width>0&&n.height>0}function l(e,t){return e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom}export{a as t};
//# sourceMappingURL=use-floating-window-pointer-interactivity-C4HXLzj1.js.map