import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Suspense } from 'react';
import { readConfObject } from '@jbrowse/core/configuration';
import { createJBrowseTheme } from '@jbrowse/core/ui';
import { getEnv } from '@jbrowse/core/util';
import { EmbeddedViewContainer, ModalWidget } from '@jbrowse/embedded-core';
import { ThemeProvider } from '@mui/material';
import { observer } from 'mobx-react';
const JBrowseCircularGenomeView = observer(function JBrowseCircularGenomeView({ viewState, }) {
    const { session } = viewState;
    const { view } = session;
    const { pluginManager } = getEnv(session);
    const viewType = pluginManager.getViewType(view.type);
    if (!viewType) {
        throw new Error(`unknown view type ${view.type}`);
    }
    const { ReactComponent } = viewType;
    const theme = createJBrowseTheme(readConfObject(viewState.config.configuration, 'theme'));
    return (_jsxs(ThemeProvider, { theme: theme, children: [_jsx(EmbeddedViewContainer, { view: view, children: _jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: _jsx(ReactComponent, { model: view, session: session }) }) }, `view-${view.id}`), _jsx(ModalWidget, { session: session })] }));
});
export default JBrowseCircularGenomeView;
