import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import cx from "classnames";
import { ErrorComponent, LoadingComponent } from "@gooddata/sdk-ui";
import { useDashboardSelector } from "../../model/react/DashboardStoreProvider.js";
import { selectIsDashboardLoading } from "../../model/store/loading/loadingSelectors.js";
import { useKdaState } from "../providers/KdaState.js";
/**
 * @internal
 */
export function KdaDialogSections({ footer, content, header }) {
    const { state } = useKdaState();
    const isDashboardLoading = useDashboardSelector(selectIsDashboardLoading);
    const isLoading = state.definitionStatus === "pending" || state.definitionStatus === "loading" || isDashboardLoading;
    const isError = state.definitionStatus === "error";
    return (_jsx("div", { className: cx("gd-kda-dialog-sections"), children: isLoading ? (_jsx(LoadingComponent, {})) : isError ? (_jsx(ErrorComponent, { message: "Unknown error", description: "Can not load key drivers data. Please try again later." })) : (_jsxs(_Fragment, { children: [
                _jsx("div", { className: cx("gd-kda-dialog-sections-header"), children: header }), _jsx("div", { className: cx("gd-kda-dialog-sections-divider") }), _jsx("div", { className: cx("gd-kda-dialog-sections-content"), children: content }), _jsx("div", { className: cx("gd-kda-dialog-sections-divider") }), _jsx("div", { className: cx("gd-kda-dialog-sections-footer"), children: footer })
            ] })) }));
}
