import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2021-2026 GoodData Corporation
import { compact } from "lodash-es";
import { IconInteraction } from "@gooddata/sdk-ui-kit";
import { eagerRemoveSectionItemByWidgetRef } from "../../../../model/commands/layout.js";
import { userInteractionTriggered } from "../../../../model/events/userInteraction.js";
import { uiActions } from "../../../../model/store/ui/index.js";
import { InsightConfiguration } from "../../insight/configuration/InsightConfiguration.js";
import { InsightInteractions } from "../../insight/configuration/InsightInteractions.js";
/**
 * @internal
 */
export function getDefaultInsightEditMenuItems(widget, { intl, dispatch, eventDispatch, includeInteractions = true, includeConfigurations = true, useWidgetDeleteDialog = false, }) {
    return compact([
        includeConfigurations && {
            type: "submenu",
            itemId: "ConfigurationPanelSubmenu",
            tooltip: "",
            itemName: intl.formatMessage({ id: "configurationPanel.title" }),
            icon: "gd-icon-settings",
            disabled: false,
            className: "s-configuration-panel-submenu",
            SubmenuComponent: InsightConfiguration,
        },
        includeInteractions && {
            type: "submenu",
            itemId: "InteractionPanelSubmenu",
            tooltip: "",
            itemName: intl.formatMessage({ id: "configurationPanel.interactions" }),
            icon: _jsx(IconInteraction, { className: "item-icon" }),
            disabled: false,
            className: "s-configuration-panel-submenu",
            SubmenuComponent: InsightInteractions,
            onClick: () => eventDispatch(userInteractionTriggered("interactionPanelOpened")),
        },
        (includeConfigurations || includeInteractions) && {
            type: "separator",
            itemId: "InteractionPanelRemoveSeparator",
        },
        {
            type: "button",
            itemId: "InteractionPanelRemove",
            tooltip: "",
            itemName: intl.formatMessage({ id: "configurationPanel.remove.form.dashboard" }),
            icon: "gd-icon-trash",
            disabled: false,
            className: "s-delete-insight-item",
            onClick: () => useWidgetDeleteDialog
                ? dispatch(uiActions.openWidgetDeleteDialog(widget.ref))
                : dispatch(eagerRemoveSectionItemByWidgetRef(widget.ref)),
        },
    ]);
}
//# sourceMappingURL=getDefaultInsightEditMenuItems.js.map