"use strict";var pe=Object.create;var c=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var de=Object.getPrototypeOf;var ne=Object.prototype.hasOwnProperty;var D=(s,e)=>c(s,"name",{value:e,configurable:true});var le=(s,e)=>{for(var r in e)c(s,r,{get:e[r],enumerable:true})};var k=(s,e,r,o)=>{if(e&&typeof e==="object"||typeof e==="function"){for(let t of ce(e))if(!ne.call(s,t)&&t!==r)c(s,t,{get:()=>e[t],enumerable:!(o=q(e,t))||o.enumerable})}return s};var d=(s,e,r)=>(r=s!=null?pe(de(s)):{},k(e||!s||!s.__esModule?c(r,"default",{value:s,enumerable:true}):r,s));var ue=s=>k(c({},"__esModule",{value:true}),s);var T=(s,e,r,o)=>{var t=o>1?void 0:o?q(e,r):e;for(var a=s.length-1,p;a>=0;a--)if(p=s[a])t=(o?p(e,r,t):p(t))||t;if(o&&t)c(e,r,t);return t};var ge={};le(ge,{default:()=>me});module.exports=ue(ge);var i=require("react/jsx-runtime");var m=require("mobx-react");var E=require("react");var h=require("react-jss");var A=require("react-router-dom");var u=require("@mui/material/styles");var W=d(require("tinycolor2"));var I=d(require("../../components/layout/AppLayout"));var U=d(require("../../components/layout/Sidebar"));var C=d(require("../../components/services/content/Services"));var P=d(require("../../components/ui/AppLoader"));var b=require("../../config");var S=require("../../features/workspaces");var y=d(require("../../features/workspaces/components/WorkspaceDrawer"));let n=class extends E.Component{render(){const{app:e,features:r,services:o,ui:t,settings:a,requests:p,user:v,router:B}=this.props.stores;if(!v.isLoggedIn){B.push("/auth/welcome")}const{setActive:L,setWebviewReference:O,detachService:F,reorder:x,reload:f,toggleNotifications:N,toggleAudio:V,toggleDarkMode:H,deleteService:_,updateService:w,clearCache:j,hibernate:z,awake:G}=this.props.actions.service;let{accentColor:l}=a.app;l=(0,W.default)(l).isValid()?l:b.DEFAULT_ACCENT_COLOR;const J=(0,u.createTheme)({palette:{mode:"dark",primary:{main:l}}});const K=(0,u.createTheme)({palette:{mode:"light",primary:{main:l}}});const{retryRequiredRequests:Q}=this.props.actions.requests;const{installUpdate:X,toggleMuteApp:Y,toggleCollapseMenu:Z}=this.props.actions.app;const{openSettings:R,closeSettings:$,openDownloads:ee}=this.props.actions.ui;const se=r.featuresRequest.isExecuting&&!r.featuresRequest.wasExecuted;const te=o.allServicesRequest.isExecuting&&o.allServicesRequest.isExecutingFirstTime;const re=!a.loaded;if(re||se||te){return(0,i.jsx)(h.ThemeProvider,{theme:t.theme,children:(0,i.jsx)(P.default,{theme:t.theme})})}const oe=(0,i.jsx)(y.default,{getServicesForWorkspace:M=>M?S.workspaceStore.getWorkspaceServices(M).map(g=>g.name):o.all.map(g=>g.name),stores:this.props.stores,actions:this.props.actions});const ae=(0,i.jsx)(U.default,{services:o.allDisplayed,setActive:L,isAppMuted:a.all.app.isAppMuted,isMenuCollapsed:a.all.app.isMenuCollapsed,openSettings:R,openDownloads:ee,closeSettings:$,reorder:x,reload:f,toggleNotifications:N,toggleAudio:V,toggleDarkMode:H,deleteService:_,updateService:w,clearCache:j,hibernateService:z,wakeUpService:G,toggleMuteApp:Y,toggleCollapseMenu:Z,toggleWorkspaceDrawer:this.props.actions.workspaces.toggleWorkspaceDrawer,isWorkspaceDrawerOpen:S.workspaceStore.isWorkspaceDrawerOpen,showServicesUpdatedInfoBar:t.showServicesUpdatedInfoBar,showMessageBadgeWhenMutedSetting:a.all.app.showMessageBadgeWhenMuted,showServiceNameSetting:a.all.app.showServiceName,showMessageBadgesEvenWhenMuted:t.showMessageBadgesEvenWhenMuted,isTodosServiceActive:o.isTodosServiceActive||false});const ie=(0,i.jsx)(C.default,{services:o.allDisplayedUnordered,setWebviewReference:O,detachService:F,reload:f,openSettings:R,update:w,userHasCompletedSignup:v.hasCompletedSignup,isSpellcheckerEnabled:a.app.enableSpellchecking});return(0,i.jsx)(u.ThemeProvider,{theme:a.app.darkMode?J:K,children:(0,i.jsx)(h.ThemeProvider,{theme:t.theme,children:(0,i.jsx)(I.default,{settings:a,isFullScreen:e.isFullScreen,showServicesUpdatedInfoBar:t.showServicesUpdatedInfoBar,appUpdateIsDownloaded:e.updateStatus===e.updateStatusTypes.DOWNLOADED,authRequestFailed:e.authRequestFailed,sidebar:ae,workspacesDrawer:oe,services:ie,installAppUpdate:X,showRequiredRequestsError:p.showRequiredRequestsError,areRequiredRequestsSuccessful:p.areRequiredRequestsSuccessful,retryRequiredRequests:Q,areRequiredRequestsLoading:p.areRequiredRequestsLoading,updateVersion:e.updateVersion,isUpdateAvailable:e.updateStatus===e.updateStatusTypes.AVAILABLE,children:(0,i.jsx)(A.Outlet,{})})})})}};D(n,"AppLayoutContainer");n=T([(0,m.inject)("stores","actions"),m.observer],n);var me=n;
