import { combineReducers as r } from "@reduxjs/toolkit"
import { appSlice as e } from "./app"
import { ROOM_STATE_KEY as o, roomReducer as m } from "./room"
import { identitySlice as t } from "./identity"
import { memberListSlice as p } from "./member-list"
import {
createMemberSubscriptionMiddleware as i,
MEMBER_STATE_KEY as a,
memberReducer as f,
} from "./member"
import { networkSlice as d } from "./network"
import { CHAT_STATE_KEY as n, chatReducer as c } from "./chat"
import { CALL_STATE_KEY as s, callReducer as u } from "./call"
import { CALL_NEXT_STATE_KEY as l, callNextReducer as g } from "./call-next"
import { FILE_STATE_KEY as E, fileReducer as T } from "./media/file"
import { deviceSlice as x } from "./media"
import { errorSlice as _ } from "./error"
import { notificationSlice as k } from "./notification"
import { debugSlice as b } from "./debug"
import { statsSlice as N } from "./stats"
import { PREFERENCES_STATE_KEY as O, preferencesReducer as w } from "./preferences"
import { uiSlice as y } from "./ui-desktop"
import { paySlice as A } from "./pay"
import { SYSLOG_STATE_KEY as C, syslogMiddleware as K, syslogReducer as P } from "./syslog"
import { storeLoopStatsMiddleware as X } from "./debug/store-loop.middleware"
import { REPORTED_MESSAGES_STATE_KEY as Y, reportedMessagesReducer as M } from "./reported-messages"
export { desktopAppSaga as appSaga } from "./app/app-desktop.saga"
export { PLATFORM_CONTEXT_KEY, APP_CONTEXT_KEY, ENV_CONTEXT_KEY } from "./constants"
export const getReducer = (i = {}) =>
r({
[e.name]: e.reducer,
[o]: m,
[n]: c,
[s]: u,
[l]: g,
[_.name]: _.reducer,
[E]: T,
[t.name]: t.reducer,
[k.name]: k.reducer,
[d.name]: d.reducer,
[x.name]: x.reducer,
[a]: f,
[p.name]: p.reducer,
[O]: w,
[b.name]: b.reducer,
[N.name]: N.reducer,
[C]: P,
[A.name]: A.reducer,
[y.name]: y.reducer,
[Y]: M,
...i,
})
export const getMiddleware = () => [K, X(), i()]