import{r as l}from"./redux-1.0.74-D8bIc6ki.js";import{T as _e,D as Ie,b as P,c as Pe,d as De,s as Ae}from"./CircularProgress-1.0.74-QfwfRJ7i.js";import{j as f}from"./tanstack-1.0.74-aU0azVkW.js";import{u as Ve,G as Ke}from"./Typography-1.0.74-B4mhsevh.js";import{u as Oe}from"./useEnhancedEffect-1.0.74-B56M26dS.js";const pe=l.createContext(null);function B(){return l.useContext(pe)}const Re=typeof Symbol=="function"&&Symbol.for,Ne=Re?Symbol.for("mui.nested"):"__THEME_NESTED__";function We(e,t){return typeof t=="function"?t(e):{...e,...t}}function Ge(e){const{children:t,theme:r}=e,i=B(),y=l.useMemo(()=>{const a=i===null?{...r}:We(i,r);return a!=null&&(a[Ne]=i!==null),a},[r,i]);return f.jsx(pe.Provider,{value:y,children:t})}const ke=l.createContext();function He({value:e,...t}){return f.jsx(ke.Provider,{value:e??!0,...t})}const rt=()=>l.useContext(ke)??!1,Se={};function ge(e,t,r,i=!1){return l.useMemo(()=>{const y=e&&t[e]||t;if(typeof r=="function"){const a=r(y),o=e?{...t,[e]:a}:a;return i?()=>o:o}return e?{...t,[e]:r}:{...t,...r}},[e,t,r,i])}function Me(e){const{children:t,theme:r,themeId:i}=e,y=Ve(Se),a=B()||Se,o=ge(i,y,r),d=ge(i,a,r,!0),v=(i?o[i]:o).direction==="rtl";return f.jsx(Ge,{theme:d,children:f.jsx(_e.Provider,{value:o,children:f.jsx(He,{value:v,children:f.jsx(Ie,{value:i?o[i].components:o.components,children:t})})})})}const Q="mode",J="color-scheme",Fe="data-color-scheme";function qe(e){const{defaultMode:t="system",defaultLightColorScheme:r="light",defaultDarkColorScheme:i="dark",modeStorageKey:y=Q,colorSchemeStorageKey:a=J,attribute:o=Fe,colorSchemeNode:d="document.documentElement",nonce:v}=e||{};let m="",S=o;if(o==="class"&&(S=".%s"),o==="data"&&(S="[data-%s]"),S.startsWith(".")){const u=S.substring(1);m+=`${d}.classList.remove('${u}'.replace('%s', light), '${u}'.replace('%s', dark));
      ${d}.classList.add('${u}'.replace('%s', colorScheme));`}const x=S.match(/\[([^\]]+)\]/);if(x){const[u,E]=x[1].split("=");E||(m+=`${d}.removeAttribute('${u}'.replace('%s', light));
      ${d}.removeAttribute('${u}'.replace('%s', dark));`),m+=`
      ${d}.setAttribute('${u}'.replace('%s', colorScheme), ${E?`${E}.replace('%s', colorScheme)`:'""'});`}else m+=`${d}.setAttribute('${S}', colorScheme);`;return f.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?v:"",dangerouslySetInnerHTML:{__html:`(function() {
try {
  let colorScheme = '';
  const mode = localStorage.getItem('${y}') || '${t}';
  const dark = localStorage.getItem('${a}-dark') || '${i}';
  const light = localStorage.getItem('${a}-light') || '${r}';
  if (mode === 'system') {
    // handle system mode
    const mql = window.matchMedia('(prefers-color-scheme: dark)');
    if (mql.matches) {
      colorScheme = dark
    } else {
      colorScheme = light
    }
  }
  if (mode === 'light') {
    colorScheme = light;
  }
  if (mode === 'dark') {
    colorScheme = dark;
  }
  if (colorScheme) {
    ${m}
  }
} catch(e){}})();`}},"mui-color-scheme-init")}function ye(e){if(typeof window<"u"&&typeof window.matchMedia=="function"&&e==="system")return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xe(e,t){if(e.mode==="light"||e.mode==="system"&&e.systemMode==="light")return t("light");if(e.mode==="dark"||e.mode==="system"&&e.systemMode==="dark")return t("dark")}function Ue(e){return xe(e,t=>{if(t==="light")return e.lightColorScheme;if(t==="dark")return e.darkColorScheme})}function z(e,t){if(typeof window>"u")return;let r;try{r=localStorage.getItem(e)||void 0,r||localStorage.setItem(e,t)}catch{}return r||t}function Ye(e){const{defaultMode:t="light",defaultLightColorScheme:r,defaultDarkColorScheme:i,supportedColorSchemes:y=[],modeStorageKey:a=Q,colorSchemeStorageKey:o=J,storageWindow:d=typeof window>"u"?void 0:window,noSsr:v=!1}=e,m=y.join(","),S=y.length>1,[x,u]=l.useState(()=>{const n=z(a,t),s=z(`${o}-light`,r),c=z(`${o}-dark`,i);return{mode:n,systemMode:ye(n),lightColorScheme:s,darkColorScheme:c}}),[E,N]=l.useState(v||!S);l.useEffect(()=>{N(!0)},[]);const W=Ue(x),K=l.useCallback(n=>{u(s=>{if(n===s.mode)return s;const c=n??t;try{localStorage.setItem(a,c)}catch{}return{...s,mode:c,systemMode:ye(c)}})},[a,t]),j=l.useCallback(n=>{n?typeof n=="string"?n&&!m.includes(n)?console.error(`\`${n}\` does not exist in \`theme.colorSchemes\`.`):u(s=>{const c={...s};return xe(s,T=>{try{localStorage.setItem(`${o}-${T}`,n)}catch{}T==="light"&&(c.lightColorScheme=n),T==="dark"&&(c.darkColorScheme=n)}),c}):u(s=>{const c={...s},T=n.light===null?r:n.light,C=n.dark===null?i:n.dark;if(T)if(!m.includes(T))console.error(`\`${T}\` does not exist in \`theme.colorSchemes\`.`);else{c.lightColorScheme=T;try{localStorage.setItem(`${o}-light`,T)}catch{}}if(C)if(!m.includes(C))console.error(`\`${C}\` does not exist in \`theme.colorSchemes\`.`);else{c.darkColorScheme=C;try{localStorage.setItem(`${o}-dark`,C)}catch{}}return c}):u(s=>{try{localStorage.setItem(`${o}-light`,r),localStorage.setItem(`${o}-dark`,i)}catch{}return{...s,lightColorScheme:r,darkColorScheme:i}})},[m,o,r,i]),O=l.useCallback(n=>{x.mode==="system"&&u(s=>{const c=n!=null&&n.matches?"dark":"light";return s.systemMode===c?s:{...s,systemMode:c}})},[x.mode]),_=l.useRef(O);return _.current=O,l.useEffect(()=>{if(typeof window.matchMedia!="function"||!S)return;const n=(...c)=>_.current(...c),s=window.matchMedia("(prefers-color-scheme: dark)");return s.addListener(n),n(s),()=>{s.removeListener(n)}},[S]),l.useEffect(()=>{if(d&&S){const n=s=>{const c=s.newValue;typeof s.key=="string"&&s.key.startsWith(o)&&(!c||m.match(c))&&(s.key.endsWith("light")&&j({light:c}),s.key.endsWith("dark")&&j({dark:c})),s.key===a&&(!c||["light","dark","system"].includes(c))&&K(c||t)};return d.addEventListener("storage",n),()=>{d.removeEventListener("storage",n)}}},[j,K,a,o,m,t,d,S]),{...x,mode:E?x.mode:void 0,systemMode:E?x.systemMode:void 0,colorScheme:E?W:void 0,setMode:K,setColorScheme:j}}const ze="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function Be(e){const{themeId:t,theme:r={},modeStorageKey:i=Q,colorSchemeStorageKey:y=J,disableTransitionOnChange:a=!1,defaultColorScheme:o,resolveTheme:d}=e,v={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},m=l.createContext(void 0),S=()=>l.useContext(m)||v,x={},u={};function E(j){var me,ue,he,fe;const{children:O,theme:_,modeStorageKey:n=i,colorSchemeStorageKey:s=y,disableTransitionOnChange:c=a,storageWindow:T=typeof window>"u"?void 0:window,documentNode:C=typeof document>"u"?void 0:document,colorSchemeNode:w=typeof document>"u"?void 0:document.documentElement,disableNestedContext:Te=!1,disableStyleSheetGeneration:$e=!1,defaultMode:Ee="system",noSsr:we}=j,G=l.useRef(!1),H=B(),F=l.useContext(m),q=!!F&&!Te,X=l.useMemo(()=>_||(typeof r=="function"?r():r),[_]),Z=X[t],k=Z||X,{colorSchemes:L=x,components:ee=u,cssVarPrefix:U}=k,te=Object.keys(L).filter(h=>!!L[h]).join(","),I=l.useMemo(()=>te.split(","),[te]),oe=typeof o=="string"?o:o.light,re=typeof o=="string"?o:o.dark,be=L[oe]&&L[re]?Ee:((ue=(me=L[k.defaultColorScheme])==null?void 0:me.palette)==null?void 0:ue.mode)||((he=k.palette)==null?void 0:he.mode),{mode:je,setMode:ne,systemMode:se,lightColorScheme:ce,darkColorScheme:ie,colorScheme:Le,setColorScheme:le}=Ye({supportedColorSchemes:I,defaultLightColorScheme:oe,defaultDarkColorScheme:re,modeStorageKey:n,colorSchemeStorageKey:s,defaultMode:be,storageWindow:T,noSsr:we});let Y=je,M=Le;q&&(Y=F.mode,M=F.colorScheme);const D=l.useMemo(()=>{var V;const h=M||k.defaultColorScheme,g=((V=k.generateThemeVars)==null?void 0:V.call(k))||k.vars,p={...k,components:ee,colorSchemes:L,cssVarPrefix:U,vars:g};if(typeof p.generateSpacing=="function"&&(p.spacing=p.generateSpacing()),h){const $=L[h];$&&typeof $=="object"&&Object.keys($).forEach(b=>{$[b]&&typeof $[b]=="object"?p[b]={...p[b],...$[b]}:p[b]=$[b]})}return d?d(p):p},[k,M,ee,L,U]),A=k.colorSchemeSelector;Oe(()=>{if(M&&w&&A&&A!=="media"){const h=A;let g=A;if(h==="class"&&(g=".%s"),h==="data"&&(g="[data-%s]"),h!=null&&h.startsWith("data-")&&!h.includes("%s")&&(g=`[${h}="%s"]`),g.startsWith("."))w.classList.remove(...I.map(p=>g.substring(1).replace("%s",p))),w.classList.add(g.substring(1).replace("%s",M));else{const p=g.replace("%s",M).match(/\[([^\]]+)\]/);if(p){const[V,$]=p[1].split("=");$||I.forEach(b=>{w.removeAttribute(V.replace(M,b))}),w.setAttribute(V,$?$.replace(/"|'/g,""):"")}else w.setAttribute(g,M)}}},[M,A,w,I]),l.useEffect(()=>{let h;if(c&&G.current&&C){const g=C.createElement("style");g.appendChild(C.createTextNode(ze)),C.head.appendChild(g),window.getComputedStyle(C.body),h=setTimeout(()=>{C.head.removeChild(g)},1)}return()=>{clearTimeout(h)}},[M,c,C]),l.useEffect(()=>(G.current=!0,()=>{G.current=!1}),[]);const ve=l.useMemo(()=>({allColorSchemes:I,colorScheme:M,darkColorScheme:ie,lightColorScheme:ce,mode:Y,setColorScheme:le,setMode:ne,systemMode:se}),[I,M,ie,ce,Y,le,ne,se,D.colorSchemeSelector]);let ae=!0;($e||k.cssVariables===!1||q&&(H==null?void 0:H.cssVarPrefix)===U)&&(ae=!1);const de=f.jsxs(l.Fragment,{children:[f.jsx(Me,{themeId:Z?t:void 0,theme:D,children:O}),ae&&f.jsx(Ke,{styles:((fe=D.generateStyleSheets)==null?void 0:fe.call(D))||[]})]});return q?de:f.jsx(m.Provider,{value:ve,children:de})}const N=typeof o=="string"?o:o.light,W=typeof o=="string"?o:o.dark;return{CssVarsProvider:E,useColorScheme:S,getInitColorSchemeScript:j=>qe({colorSchemeStorageKey:y,defaultLightColorScheme:N,defaultDarkColorScheme:W,modeStorageKey:i,...j})}}function Ce({theme:e,...t}){const r=P in e?e[P]:void 0;return f.jsx(Me,{...t,themeId:r?P:void 0,theme:r||e})}const R={colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},{CssVarsProvider:Qe}=Be({themeId:P,theme:()=>Pe({cssVariables:!0}),colorSchemeStorageKey:R.colorSchemeStorageKey,modeStorageKey:R.modeStorageKey,defaultColorScheme:{light:R.defaultLightColorScheme,dark:R.defaultDarkColorScheme},resolveTheme:e=>{const t={...e,typography:De(e.palette,e.typography)};return t.unstable_sx=function(i){return Ae({sx:i,theme:this})},t}}),Je=Qe;function nt({theme:e,...t}){return typeof e=="function"?f.jsx(Ce,{theme:e,...t}):"colorSchemes"in(P in e?e[P]:e)?f.jsx(Je,{theme:e,...t}):f.jsx(Ce,{theme:e,...t})}export{nt as T,rt as u};
