import{n as e,s as t}from"./rolldown-runtime-BG2f4sTM.js";import{Mvt as n,Nvt as r}from"./app-initial-BHB6SClA.js";function i(e){let t=(0,l.c)(26),{activationNonce:n,floatingElementSelectors:r,includeInteractiveRegion:i,interactiveRegionRef:c,isPaused:d,onInteractiveChange:f,publishInitialNonInteractive:p,regionElementSelectors:m}=e,h;t[0]===r?h=t[1]:(h=r===void 0?[]:r,t[0]=r,t[1]=h);let g=h,_=i===void 0?!1:i,v=p===void 0?!0:p,y;t[2]===m?y=t[3]:(y=m===void 0?[]:m,t[2]=m,t[3]=y);let b=y,[x,S]=(0,u.useState)(!1),C;t[4]===d?C=t[5]:(C=()=>d?.()??!1,t[4]=d,t[5]=C);let w=(0,u.useEffectEvent)(C),T;t[6]===f?T=t[7]:(T=e=>{S(!e),f(e)},t[6]=f,t[7]=T);let E=(0,u.useEffectEvent)(T),D;t[8]===f?D=t[9]:(D=()=>{f(!0)},t[8]=f,t[9]=D);let O=(0,u.useEffectEvent)(D),k;t[10]!==g||t[11]!==_||t[12]!==c||t[13]!==w||t[14]!==v||t[15]!==E||t[16]!==b||t[17]!==O?(k=()=>{let e=null,t=null,n=null,r=null,i=t=>{e!==t&&(e=t,E(t))},l=e=>{let t=c.current;if(t==null||_&&o(e,t))return!0;for(let n of b){let r=t.querySelectorAll(n);for(let t of r)if(s(t)&&o(e,t))return!0}for(let t of g){let n=document.querySelectorAll(t);for(let t of n)if(s(t)&&o(e,t))return!0}return!1},u=()=>{r=null,!(n==null||w())&&(t=n,i(l(n)))},d=()=>{r??=requestAnimationFrame(u)},f=e=>{n={x:e.clientX,y:e.clientY},t=n,d()},p=()=>{t!=null&&(n=t,d())},m=()=>{w()||i(!1)},h=()=>{if(w())return;let e=a({floatingElementSelectors:g,includeInteractiveRegion:_,interactiveRegion:c.current,regionElementSelectors:b});e!=null&&(e||v)&&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}),h();let x=requestAnimationFrame(h);return()=>{window.removeEventListener(`mousemove`,f),window.removeEventListener(`resize`,p),window.removeEventListener(`scroll`,p,!0),window.removeEventListener(`mouseleave`,m),y.disconnect(),cancelAnimationFrame(x),r!=null&&cancelAnimationFrame(r),e=null,O()}},t[10]=g,t[11]=_,t[12]=c,t[13]=w,t[14]=v,t[15]=E,t[16]=b,t[17]=O,t[18]=k):k=t[18];let A;return t[19]!==n||t[20]!==g||t[21]!==_||t[22]!==c||t[23]!==v||t[24]!==b?(A=[n,g,_,c,v,b],t[19]=n,t[20]=g,t[21]=_,t[22]=c,t[23]=v,t[24]=b,t[25]=A):A=t[25],(0,u.useEffect)(k,A),x}function a({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(s(e)&&e.matches(`:hover`))return!0}}for(let t of e){let e=document.querySelectorAll(t);for(let t of e)if(s(t)&&t.matches(`:hover`))return!0}return document.documentElement.matches(`:hover`)?!1:null}function o(e,t){return c(e,t.getBoundingClientRect())?document.elementsFromPoint(e.x,e.y).some(e=>e===t||t.contains(e)):!1}function s(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 c(e,t){return e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom}var l,u,d=e((()=>{l=n(),u=t(r(),1)}));export{i as n,d as t};
//# sourceMappingURL=use-floating-window-pointer-interactivity-D2j8KaO0.js.map