import{dM as h,dN as p,r as d,d0 as E,d7 as S}from"./index-6f149d0c.js";function g(t,a,e,s,u){const[r,i]=d.useState(()=>u&&e?e(t).matches:s?s(t).matches:a);return E(()=>{if(!e)return;const o=e(t),n=()=>{i(o.matches)};return n(),o.addEventListener("change",n),()=>{o.removeEventListener("change",n)}},[t,e]),r}const v={...S},m=v.useSyncExternalStore;function w(t,a,e,s,u){const r=d.useCallback(()=>a,[a]),i=d.useMemo(()=>{if(u&&e)return()=>e(t).matches;if(s!==null){const{matches:c}=s(t);return()=>c}return r},[r,t,s,u,e]),[o,n]=d.useMemo(()=>{if(e===null)return[r,()=>()=>{}];const c=e(t);return[()=>c.matches,f=>(c.addEventListener("change",f),()=>{c.removeEventListener("change",f)})]},[r,e,t]);return m(n,o,i)}function L(t,a={}){const e=h(),s=typeof window<"u"&&typeof window.matchMedia<"u",{defaultMatches:u=!1,matchMedia:r=s?window.matchMedia:null,ssrMatchMedia:i=null,noSsr:o=!1}=p({name:"MuiUseMediaQuery",props:a,theme:e});let n=typeof t=="function"?t(e):t;return n=n.replace(/^@media( ?)/m,""),(m!==void 0?w:g)(n,u,r,i,o)}export{L as u};
