import React from "react";
import Ps from "perfect-scrollbar";
import { ThemeProvider } from "styled-components";
import { loadCss } from "./utils/css-loader";
import { mapTheme } from "./utils/map-theme";
import "./domains/chart/utils/jquery-loader";
import { Portals } from "./domains/chart/components/portals";
import { useRegistry } from "./hooks/use-registry";
import { useAlarms } from "./hooks/use-alarms";
import { useSelector } from "./store/redux-separate-context";
import { selectTheme } from "./domains/global/selectors";
import "./types/global";
if (!window.netdataNoBootstrap) {
    // it needs to be imported indirectly, there's probably a bug in webpack
    import("./dynamic-imports/bootstrap");
}
if (!window.netdataNoFontAwesome) {
    // @ts-ignore
    import("@fortawesome/fontawesome-free/js/all");
}
// support legacy code
window.Ps = Ps;
loadCss(window.NETDATA.themes.current.bootstrap_css);
loadCss(window.NETDATA.themes.current.dashboard_css);
const CustomDashboardsApp = () => {
    const shouldUseRegistry = window.netdataRegistry === true;
    useRegistry(shouldUseRegistry);
    // backwards-compatibility: in old dashboard any truthy window.netdataShowAlarms was enough
    // but window.netdataRegistry needed to be explicitly `true`
    const shouldUseAlarms = !!window.netdataShowAlarms;
    useAlarms(shouldUseAlarms);
    const theme = useSelector(selectTheme);
    return (React.createElement(ThemeProvider, { theme: mapTheme(theme) },
        React.createElement("div", { className: "App" },
            React.createElement(Portals, null))));
};
export default CustomDashboardsApp;
//# sourceMappingURL=custom-dashboards-app.js.map