import{aI as useTheme,aJ as getThemeProps,r as reactExports,aK as useEnhancedEffect,aL as React}from"./js-core.esm4.js";function useMediaQueryOld(r,e,s,t,a){let[n,u]=reactExports.useState(()=>a&&s?s(r).matches:t?t(r).matches:e);return useEnhancedEffect(()=>{let a=!0;if(s){let e=s(r),t=()=>{a&&u(e.matches)};return t(),e.addListener(t),()=>{a=!1,e.removeListener(t)}}},[r,s]),n}let maybeReactUseSyncExternalStore=React.useSyncExternalStore;function useMediaQueryNew(a,e,r,t,s){let n=reactExports.useCallback(()=>e,[e]);var u=reactExports.useMemo(()=>{if(s&&r)return()=>r(a).matches;if(null===t)return n;{let e=t(a).matches;return()=>e}},[n,a,t,s,r]),[c,i]=reactExports.useMemo(()=>{if(null===r)return[n,()=>()=>{}];let t=r(a);return[()=>t.matches,e=>(t.addListener(e),()=>{t.removeListener(e)})]},[n,r,a]);return maybeReactUseSyncExternalStore(i,c,u)}function useMediaQuery(e,t={}){var a=useTheme(),r="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:t=!1,matchMedia:r=r?window.matchMedia:null,ssrMatchMedia:s=null,noSsr:n=!1}=getThemeProps({name:"MuiUseMediaQuery",props:t,theme:a});let u="function"==typeof e?e(a):e;return u=u.replace(/^@media( ?)/m,""),(void 0!==maybeReactUseSyncExternalStore?useMediaQueryNew:useMediaQueryOld)(u,t,r,s,n)}export{useMediaQuery as u};
