import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2022-2026 GoodData Corporation
import { useDashboardSelector } from "../../../model/react/DashboardStoreProvider.js";
import { selectDashboardLoading } from "../../../model/store/loading/loadingSelectors.js";
import { useDashboardComponentsContext } from "../../dashboardContexts/DashboardComponentsContext.js";
import { DashboardInner } from "./DashboardInner.js";
export function DashboardLoading(props) {
    const { loading, error, result } = useDashboardSelector(selectDashboardLoading);
    const { ErrorComponent, LoadingComponent } = useDashboardComponentsContext();
    if (error) {
        return _jsx(ErrorComponent, { message: error.message });
    }
    if (loading || !result) {
        return _jsx(LoadingComponent, {});
    }
    return _jsx(DashboardInner, { ...props });
}
//# sourceMappingURL=DashboardLoading.js.map