import{n as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";function n(e){if(typeof window>`u`||typeof document>`u`)return w;let t=e??document.documentElement,n=window.getComputedStyle(t).fontSize,r=Number.parseFloat(n);return!Number.isFinite(r)||r<=0?w:r}function r(e){return typeof e!=`object`||!e?!1:`mobile`in e||`tablet`in e||`laptop`in e||`desktop`in e}function i(e,t){if(e!==void 0)return r(e)?t===`mobile`?e.mobile??e.tablet??e.laptop:t===`tablet`?e.tablet??e.mobile??e.laptop:e.laptop??e.tablet??e.mobile:e}function a(e,t,n){let r={...e};for(let e of n)r[e]=i(r[e],t);return r}function o(e,t){return`addEventListener`in e?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):(e.addListener(t),()=>e.removeListener(t))}function s(e){let t=t=>t*e,n=t(C.mobileMax),r=t(C.tabletMin),i=t(C.tabletMax),a=t(C.laptopMin);return{mobile:`(width <= ${n}px)`,tablet:`(width >= ${r}px) and (width <= ${i}px)`,laptop:`(width >= ${a}px)`}}function c(e){return e.mobile?`mobile`:e.tablet?`tablet`:`laptop`}function l(e,t){return e.mobile===t.mobile&&e.tablet===t.tablet&&e.laptop===t.laptop}function u(e){l(O.matches,e)||(O={matches:e,activeBreakpoint:c(e)},L.forEach(e=>e()))}function d(){k&&u({mobile:k.mobile.matches,tablet:k.tablet.matches,laptop:k.laptop.matches})}function f(){A.forEach(e=>e()),A=[]}function p(e=!1){if(typeof window>`u`||typeof document>`u`)return;let t=n();if(!e&&k&&Math.abs(t-j)<E)return;j=t,f();let r=s(t);k={mobile:window.matchMedia(r.mobile),tablet:window.matchMedia(r.tablet),laptop:window.matchMedia(r.laptop)},A=Object.keys(k).map(e=>o(k[e],d)),d()}function m(){I&&clearTimeout(I),I=setTimeout(()=>{I=null,p()},D)}function h(){typeof window>`u`||typeof document>`u`||(N=new MutationObserver(m),N.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`,`class`,`data-font-size`]}),!(typeof ResizeObserver>`u`)&&(F=document.createElement(`div`),F.style.position=`absolute`,F.style.visibility=`hidden`,F.style.pointerEvents=`none`,F.style.width=`1em`,F.style.height=`1px`,F.style.overflow=`hidden`,F.setAttribute(`aria-hidden`,`true`),(document.body??document.documentElement).appendChild(F),P=new ResizeObserver(m),P.observe(F)))}function g(){f(),k=null,I&&=(clearTimeout(I),null),N&&=(N.disconnect(),null),P&&=(P.disconnect(),null),F?.parentNode&&F.parentNode.removeChild(F),F=null,M=!1}function _(){M||typeof window>`u`||typeof document>`u`||(M=!0,p(!0),h())}function v(e){return typeof window>`u`||typeof document>`u`?()=>{}:(L.add(e),_(),()=>{L.delete(e),L.size===0&&g()})}function y(){return O}function b(){return T}function x(){return(0,S.useSyncExternalStore)(v,y,b)}var S,C,w,T,E,D,O,k,A,j,M,N,P,F,I,L;function R(){return(R=e((()=>{S=t(),C={mobileMax:767.98/16,tabletMin:768/16,tabletMax:1151.98/16,laptopMin:1152/16},w=16,T={matches:{mobile:!1,tablet:!1,laptop:!1},activeBreakpoint:`laptop`},E=.25,D=80,O=T,k=null,A=[],j=0,M=!1,N=null,P=null,F=null,I=null,L=new Set})))()}export{i,a as n,R as r,x as t};