import { jsx as _jsx } from "react/jsx-runtime";
import { useDashboardSelector } from "../../model/react/DashboardStoreProvider.js";
import { selectRenderMode } from "../../model/store/renderMode/renderModeSelectors.js";
/**
 * Returns a component that wraps components for different render modes and automatically chooses the correct one.
 * If component for current render mode is not defined, component for "view" mode is used.
 *
 * @param components - the components to choose from
 * @internal
 */
export function renderModeAware(components) {
    function RenderModeAware(props) {
        const renderMode = useDashboardSelector(selectRenderMode);
        const Component = components[renderMode] ?? components["view"];
        return _jsx(Component, { ...props });
    }
    return RenderModeAware;
}
