import { localize2WithPath, localizeWithPath } from '../../../nls.js';
import { registerAction2, Action2, MenuRegistry, MenuId } from '../../../platform/actions/common/actions.js';
import { Categories } from '../../../platform/action/common/actionCommonCategories.js';
import { IConfigurationService } from '../../../platform/configuration/common/configuration.service.js';
import { Position, Parts, LayoutSettings, EditorTabsMode, ZenModeSettings, EditorActionsLocation, positionToString } from '../../services/layout/browser/layoutService.js';
import { IWorkbenchLayoutService } from '../../services/layout/browser/layoutService.service.js';
import { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';
import { KeyMod as KeyMod$1, KeyCode, KeyChord } from '../../../base/common/keyCodes.js';
import { isWindows, isLinux, isWeb, isMacintosh, isNative } from '../../../base/common/platform.js';
import { IsMacNativeContext } from '../../../platform/contextkey/common/contextkeys.js';
import { KeybindingWeight, KeybindingsRegistry } from '../../../platform/keybinding/common/keybindingsRegistry.js';
import { ContextKeyExpr } from '../../../platform/contextkey/common/contextkey.js';
import { IContextKeyService } from '../../../platform/contextkey/common/contextkey.service.js';
import { ViewContainerLocationToString, ViewContainerLocation } from '../../common/views.js';
import { IViewDescriptorService } from '../../common/views.service.js';
import { IViewsService } from '../../services/views/common/viewsService.service.js';
import { IQuickInputService } from '../../../platform/quickinput/common/quickInput.service.js';
import { IDialogService } from '../../../platform/dialogs/common/dialogs.service.js';
import { IPaneCompositePartService } from '../../services/panecomposite/browser/panecomposite.service.js';
import { ToggleAuxiliaryBarAction } from '../parts/auxiliarybar/auxiliaryBarActions.js';
import { TogglePanelAction } from '../parts/panel/panelActions.js';
import { ICommandService } from '../../../platform/commands/common/commands.service.js';
import { SideBarVisibleContext, InEditorZenModeContext, IsAuxiliaryWindowFocusedContext, TitleBarStyleContext, IsMainWindowFullscreenContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, PanelAlignmentContext, PanelPositionContext, FocusedViewContext, AuxiliaryBarVisibleContext, PanelVisibleContext } from '../../common/contextkeys.js';
import { Codicon } from '../../../base/common/codicons.js';
import { ThemeIcon } from '../../../base/common/themables.js';
import { DisposableStore } from '../../../base/common/lifecycle.js';
import { registerIcon } from '../../../platform/theme/common/iconRegistry.js';
import { mainWindow } from '../../../base/browser/window.js';
import { IKeybindingService } from '../../../platform/keybinding/common/keybinding.service.js';
import { TitlebarStyle } from '../../../platform/window/common/window.js';
const _moduleId = "vs/workbench/browser/actions/layoutActions";
const menubarIcon = registerIcon('menuBar', Codicon.layoutMenubar, ( localizeWithPath(_moduleId, 0, "Represents the menu bar")));
const activityBarLeftIcon = registerIcon('activity-bar-left', Codicon.layoutActivitybarLeft, ( localizeWithPath(_moduleId, 1, "Represents the activity bar in the left position")));
const activityBarRightIcon = registerIcon('activity-bar-right', Codicon.layoutActivitybarRight, ( localizeWithPath(_moduleId, 2, "Represents the activity bar in the right position")));
const panelLeftIcon = registerIcon('panel-left', Codicon.layoutSidebarLeft, ( localizeWithPath(_moduleId, 3, "Represents a side bar in the left position")));
const panelLeftOffIcon = registerIcon('panel-left-off', Codicon.layoutSidebarLeftOff, ( localizeWithPath(_moduleId, 4, "Represents a side bar in the left position toggled off")));
const panelRightIcon = registerIcon('panel-right', Codicon.layoutSidebarRight, ( localizeWithPath(_moduleId, 5, "Represents side bar in the right position")));
const panelRightOffIcon = registerIcon('panel-right-off', Codicon.layoutSidebarRightOff, ( localizeWithPath(_moduleId, 6, "Represents side bar in the right position toggled off")));
const panelIcon = registerIcon('panel-bottom', Codicon.layoutPanel, ( localizeWithPath(_moduleId, 7, "Represents the bottom panel")));
const statusBarIcon = registerIcon('statusBar', Codicon.layoutStatusbar, ( localizeWithPath(_moduleId, 8, "Represents the status bar")));
const panelAlignmentLeftIcon = registerIcon('panel-align-left', Codicon.layoutPanelLeft, ( localizeWithPath(_moduleId, 9, "Represents the bottom panel alignment set to the left")));
const panelAlignmentRightIcon = registerIcon('panel-align-right', Codicon.layoutPanelRight, ( localizeWithPath(_moduleId, 10, "Represents the bottom panel alignment set to the right")));
const panelAlignmentCenterIcon = registerIcon('panel-align-center', Codicon.layoutPanelCenter, ( localizeWithPath(_moduleId, 11, "Represents the bottom panel alignment set to the center")));
const panelAlignmentJustifyIcon = registerIcon('panel-align-justify', Codicon.layoutPanelJustify, ( localizeWithPath(_moduleId, 12, "Represents the bottom panel alignment set to justified")));
const fullscreenIcon = registerIcon('fullscreen', Codicon.screenFull, ( localizeWithPath(_moduleId, 13, "Represents full screen")));
const centerLayoutIcon = registerIcon('centerLayoutIcon', Codicon.layoutCentered, ( localizeWithPath(_moduleId, 14, "Represents centered layout mode")));
const zenModeIcon = registerIcon('zenMode', Codicon.target, ( localizeWithPath(_moduleId, 15, "Represents zen mode")));
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.closeSidebar',
            title: ( localize2WithPath(_moduleId, 16, 'Close Primary Side Bar')),
            category: Categories.View,
            f1: true
        });
    }
    run(accessor) {
        accessor.get(IWorkbenchLayoutService).setPartHidden(true, Parts.SIDEBAR_PART);
    }
});
const ToggleActivityBarVisibilityActionId = 'workbench.action.toggleActivityBarVisibility';
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.toggleCenteredLayout',
            title: {
                ...( localize2WithPath(_moduleId, 17, "Toggle Centered Layout")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 18, "&&Centered Layout")),
            },
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated())),
            category: Categories.View,
            f1: true,
            toggled: IsMainEditorCenteredLayoutContext,
            menu: [{
                    id: MenuId.MenubarAppearanceMenu,
                    group: '1_toggle_view',
                    order: 3
                }]
        });
    }
    run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        layoutService.centerMainEditorLayout(!layoutService.isMainEditorLayoutCentered());
    }
});
const sidebarPositionConfigurationKey = 'workbench.sideBar.location';
class MoveSidebarPositionAction extends Action2 {
    constructor(id, title, position) {
        super({
            id,
            title,
            f1: false
        });
        this.position = position;
    }
    async run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        const configurationService = accessor.get(IConfigurationService);
        const position = layoutService.getSideBarPosition();
        if (position !== this.position) {
            return configurationService.updateValue(sidebarPositionConfigurationKey, positionToString(this.position));
        }
    }
}
class MoveSidebarRightAction extends MoveSidebarPositionAction {
    static { this.ID = 'workbench.action.moveSideBarRight'; }
    constructor() {
        super(MoveSidebarRightAction.ID, ( localize2WithPath(_moduleId, 19, "Move Primary Side Bar Right")), Position.RIGHT);
    }
}
class MoveSidebarLeftAction extends MoveSidebarPositionAction {
    static { this.ID = 'workbench.action.moveSideBarLeft'; }
    constructor() {
        super(MoveSidebarLeftAction.ID, ( localize2WithPath(_moduleId, 20, "Move Primary Side Bar Left")), Position.LEFT);
    }
}
registerAction2(MoveSidebarRightAction);
registerAction2(MoveSidebarLeftAction);
class ToggleSidebarPositionAction extends Action2 {
    static { this.ID = 'workbench.action.toggleSidebarPosition'; }
    static { this.LABEL = ( localizeWithPath(_moduleId, 21, "Toggle Primary Side Bar Position")); }
    static getLabel(layoutService) {
        return layoutService.getSideBarPosition() === Position.LEFT ? ( localizeWithPath(_moduleId, 19, "Move Primary Side Bar Right")) : ( localizeWithPath(_moduleId, 20, "Move Primary Side Bar Left"));
    }
    constructor() {
        super({
            id: ToggleSidebarPositionAction.ID,
            title: ( localize2WithPath(_moduleId, 21, "Toggle Primary Side Bar Position")),
            category: Categories.View,
            f1: true
        });
    }
    run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        const configurationService = accessor.get(IConfigurationService);
        const position = layoutService.getSideBarPosition();
        const newPositionValue = (position === Position.LEFT) ? 'right' : 'left';
        return configurationService.updateValue(sidebarPositionConfigurationKey, newPositionValue);
    }
}
registerAction2(ToggleSidebarPositionAction);
const configureLayoutIcon = registerIcon('configure-layout-icon', Codicon.layout, ( localizeWithPath(_moduleId, 22, 'Icon represents workbench layout configuration.')));
MenuRegistry.appendMenuItem(MenuId.LayoutControlMenu, {
    submenu: MenuId.LayoutControlMenuSubmenu,
    title: ( localizeWithPath(_moduleId, 23, "Configure Layout")),
    icon: configureLayoutIcon,
    group: '1_workbench_layout',
    when: ( (ContextKeyExpr.equals('config.workbench.layoutControl.type', 'menu')))
});
MenuRegistry.appendMenuItems([{
        id: MenuId.ViewContainerTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarPositionAction.ID,
                title: ( localizeWithPath(_moduleId, 24, "Move Primary Side Bar Right"))
            },
            when: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right')),
                 (ContextKeyExpr.equals(
                    'viewContainerLocation',
                    ViewContainerLocationToString(ViewContainerLocation.Sidebar)
                ))
            ))),
            order: 1
        }
    }, {
        id: MenuId.ViewTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarPositionAction.ID,
                title: ( localizeWithPath(_moduleId, 25, "Move Primary Side Bar Right"))
            },
            when: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right')),
                 (ContextKeyExpr.equals(
                    'viewLocation',
                    ViewContainerLocationToString(ViewContainerLocation.Sidebar)
                ))
            ))),
            order: 1
        }
    }, {
        id: MenuId.ViewContainerTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarPositionAction.ID,
                title: ( localizeWithPath(_moduleId, 26, "Move Primary Side Bar Left"))
            },
            when: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.equals('config.workbench.sideBar.location', 'right')),
                 (ContextKeyExpr.equals(
                    'viewContainerLocation',
                    ViewContainerLocationToString(ViewContainerLocation.Sidebar)
                ))
            ))),
            order: 1
        }
    }, {
        id: MenuId.ViewTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarPositionAction.ID,
                title: ( localizeWithPath(_moduleId, 26, "Move Primary Side Bar Left"))
            },
            when: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.equals('config.workbench.sideBar.location', 'right')),
                 (ContextKeyExpr.equals(
                    'viewLocation',
                    ViewContainerLocationToString(ViewContainerLocation.Sidebar)
                ))
            ))),
            order: 1
        }
    }, {
        id: MenuId.ViewTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarPositionAction.ID,
                title: ( localizeWithPath(_moduleId, 27, "Move Secondary Side Bar Left"))
            },
            when: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right')),
                 (ContextKeyExpr.equals(
                    'viewLocation',
                    ViewContainerLocationToString(ViewContainerLocation.AuxiliaryBar)
                ))
            ))),
            order: 1
        }
    }, {
        id: MenuId.ViewTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarPositionAction.ID,
                title: ( localizeWithPath(_moduleId, 28, "Move Secondary Side Bar Right"))
            },
            when: ( (ContextKeyExpr.and(
                 (ContextKeyExpr.equals('config.workbench.sideBar.location', 'right')),
                 (ContextKeyExpr.equals(
                    'viewLocation',
                    ViewContainerLocationToString(ViewContainerLocation.AuxiliaryBar)
                ))
            ))),
            order: 1
        }
    }]);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
    group: '3_workbench_layout_move',
    command: {
        id: ToggleSidebarPositionAction.ID,
        title: ( localizeWithPath(_moduleId, 29, "&&Move Primary Side Bar Right"))
    },
    when: ( (ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right'))),
    order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
    group: '3_workbench_layout_move',
    command: {
        id: ToggleSidebarPositionAction.ID,
        title: ( localizeWithPath(_moduleId, 30, "&&Move Primary Side Bar Left"))
    },
    when: ( (ContextKeyExpr.equals('config.workbench.sideBar.location', 'right'))),
    order: 2
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.toggleEditorVisibility',
            title: {
                ...( localize2WithPath(_moduleId, 31, "Toggle Editor Area Visibility")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 32, "Show &&Editor Area")),
            },
            category: Categories.View,
            f1: true,
            toggled: MainEditorAreaVisibleContext,
            precondition: ( (ContextKeyExpr.and(
                 (IsAuxiliaryWindowFocusedContext.toNegated()),
                 (ContextKeyExpr.or(
                     (PanelAlignmentContext.isEqualTo('center')),
                     (PanelPositionContext.notEqualsTo('bottom'))
                ))
            )))
        });
    }
    run(accessor) {
        accessor.get(IWorkbenchLayoutService).toggleMaximizedPanel();
    }
});
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
    group: '2_appearance',
    title: ( localizeWithPath(_moduleId, 33, "&&Appearance")),
    submenu: MenuId.MenubarAppearanceMenu,
    order: 1
});
class ToggleSidebarVisibilityAction extends Action2 {
    static { this.ID = 'workbench.action.toggleSidebarVisibility'; }
    constructor() {
        super({
            id: ToggleSidebarVisibilityAction.ID,
            title: ( localize2WithPath(_moduleId, 34, 'Toggle Primary Side Bar Visibility')),
            toggled: {
                condition: SideBarVisibleContext,
                title: ( localizeWithPath(_moduleId, 35, "Primary Side Bar")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 36, "&&Primary Side Bar")),
            },
            category: Categories.View,
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyMod$1.CtrlCmd | KeyCode.KeyB
            },
            menu: [
                {
                    id: MenuId.LayoutControlMenuSubmenu,
                    group: '0_workbench_layout',
                    order: 0
                },
                {
                    id: MenuId.MenubarAppearanceMenu,
                    group: '2_workbench_layout',
                    order: 1
                }
            ]
        });
    }
    run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        layoutService.setPartHidden(layoutService.isVisible(Parts.SIDEBAR_PART), Parts.SIDEBAR_PART);
    }
}
registerAction2(ToggleSidebarVisibilityAction);
MenuRegistry.appendMenuItems([
    {
        id: MenuId.ViewContainerTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarVisibilityAction.ID,
                title: ( localizeWithPath(_moduleId, 37, "Hide Primary Side Bar")),
            },
            when: ( (ContextKeyExpr.and(SideBarVisibleContext,  (ContextKeyExpr.equals(
                'viewContainerLocation',
                ViewContainerLocationToString(ViewContainerLocation.Sidebar)
            ))))),
            order: 2
        }
    }, {
        id: MenuId.ViewTitleContext,
        item: {
            group: '3_workbench_layout_move',
            command: {
                id: ToggleSidebarVisibilityAction.ID,
                title: ( localizeWithPath(_moduleId, 37, "Hide Primary Side Bar")),
            },
            when: ( (ContextKeyExpr.and(SideBarVisibleContext,  (ContextKeyExpr.equals(
                'viewLocation',
                ViewContainerLocationToString(ViewContainerLocation.Sidebar)
            ))))),
            order: 2
        }
    }, {
        id: MenuId.LayoutControlMenu,
        item: {
            group: '0_workbench_toggles',
            command: {
                id: ToggleSidebarVisibilityAction.ID,
                title: ( localizeWithPath(_moduleId, 38, "Toggle Primary Side Bar")),
                icon: panelLeftOffIcon,
                toggled: { condition: SideBarVisibleContext, icon: panelLeftIcon }
            },
            when: ( (ContextKeyExpr.and( (ContextKeyExpr.or(
                 (ContextKeyExpr.equals('config.workbench.layoutControl.type', 'toggles')),
                 (ContextKeyExpr.equals('config.workbench.layoutControl.type', 'both'))
            )),  (ContextKeyExpr.equals('config.workbench.sideBar.location', 'left'))))),
            order: 0
        }
    }, {
        id: MenuId.LayoutControlMenu,
        item: {
            group: '0_workbench_toggles',
            command: {
                id: ToggleSidebarVisibilityAction.ID,
                title: ( localizeWithPath(_moduleId, 38, "Toggle Primary Side Bar")),
                icon: panelRightOffIcon,
                toggled: { condition: SideBarVisibleContext, icon: panelRightIcon }
            },
            when: ( (ContextKeyExpr.and( (ContextKeyExpr.or(
                 (ContextKeyExpr.equals('config.workbench.layoutControl.type', 'toggles')),
                 (ContextKeyExpr.equals('config.workbench.layoutControl.type', 'both'))
            )),  (ContextKeyExpr.equals('config.workbench.sideBar.location', 'right'))))),
            order: 2
        }
    }
]);
class ToggleStatusbarVisibilityAction extends Action2 {
    static { this.ID = 'workbench.action.toggleStatusbarVisibility'; }
    static { this.statusbarVisibleKey = 'workbench.statusBar.visible'; }
    constructor() {
        super({
            id: ToggleStatusbarVisibilityAction.ID,
            title: {
                ...( localize2WithPath(_moduleId, 39, "Toggle Status Bar Visibility")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 40, "S&&tatus Bar")),
            },
            category: Categories.View,
            f1: true,
            toggled: ( (ContextKeyExpr.equals('config.workbench.statusBar.visible', true))),
            menu: [{
                    id: MenuId.MenubarAppearanceMenu,
                    group: '2_workbench_layout',
                    order: 3
                }]
        });
    }
    run(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        const configurationService = accessor.get(IConfigurationService);
        const visibility = layoutService.isVisible(Parts.STATUSBAR_PART, mainWindow);
        const newVisibilityValue = !visibility;
        return configurationService.updateValue(ToggleStatusbarVisibilityAction.statusbarVisibleKey, newVisibilityValue);
    }
}
registerAction2(ToggleStatusbarVisibilityAction);
class AbstractSetShowTabsAction extends Action2 {
    constructor(settingName, value, title, id, precondition, description) {
        super({
            id,
            title,
            category: Categories.View,
            precondition,
            metadata: description ? { description } : undefined,
            f1: true
        });
        this.settingName = settingName;
        this.value = value;
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        return configurationService.updateValue(this.settingName, this.value);
    }
}
class HideEditorTabsAction extends AbstractSetShowTabsAction {
    static { this.ID = 'workbench.action.hideEditorTabs'; }
    constructor() {
        const precondition = ( (ContextKeyExpr.and(
             (( (ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.NONE))).negate()),
             (InEditorZenModeContext.negate())
        )));
        const title = ( localize2WithPath(_moduleId, 41, 'Hide Editor Tabs'));
        super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.NONE, title, HideEditorTabsAction.ID, precondition, ( localize2WithPath(_moduleId, 42, "Hide Tab Bar")));
    }
}
class ZenHideEditorTabsAction extends AbstractSetShowTabsAction {
    static { this.ID = 'workbench.action.zenHideEditorTabs'; }
    constructor() {
        const precondition = ( (ContextKeyExpr.and(
             (( (ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.NONE))).negate()),
            InEditorZenModeContext
        )));
        const title = ( localize2WithPath(_moduleId, 43, 'Hide Editor Tabs in Zen Mode'));
        super(ZenModeSettings.SHOW_TABS, EditorTabsMode.NONE, title, ZenHideEditorTabsAction.ID, precondition, ( localize2WithPath(_moduleId, 44, "Hide Tab Bar in Zen Mode")));
    }
}
class ShowMultipleEditorTabsAction extends AbstractSetShowTabsAction {
    static { this.ID = 'workbench.action.showMultipleEditorTabs'; }
    constructor() {
        const precondition = ( (ContextKeyExpr.and(
             (( (ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.MULTIPLE))).negate()),
             (InEditorZenModeContext.negate())
        )));
        const title = ( localize2WithPath(_moduleId, 45, 'Show Multiple Editor Tabs'));
        super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.MULTIPLE, title, ShowMultipleEditorTabsAction.ID, precondition, ( localize2WithPath(_moduleId, 46, "Show Tab Bar with multiple tabs")));
    }
}
class ZenShowMultipleEditorTabsAction extends AbstractSetShowTabsAction {
    static { this.ID = 'workbench.action.zenShowMultipleEditorTabs'; }
    constructor() {
        const precondition = ( (ContextKeyExpr.and(
             (( (ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.MULTIPLE))).negate()),
            InEditorZenModeContext
        )));
        const title = ( localize2WithPath(_moduleId, 47, 'Show Multiple Editor Tabs in Zen Mode'));
        super(ZenModeSettings.SHOW_TABS, EditorTabsMode.MULTIPLE, title, ZenShowMultipleEditorTabsAction.ID, precondition, ( localize2WithPath(_moduleId, 48, "Show Tab Bar in Zen Mode")));
    }
}
class ShowSingleEditorTabAction extends AbstractSetShowTabsAction {
    static { this.ID = 'workbench.action.showEditorTab'; }
    constructor() {
        const precondition = ( (ContextKeyExpr.and(
             (( (ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.SINGLE))).negate()),
             (InEditorZenModeContext.negate())
        )));
        const title = ( localize2WithPath(_moduleId, 49, 'Show Single Editor Tab'));
        super(LayoutSettings.EDITOR_TABS_MODE, EditorTabsMode.SINGLE, title, ShowSingleEditorTabAction.ID, precondition, ( localize2WithPath(_moduleId, 50, "Show Tab Bar with one Tab")));
    }
}
class ZenShowSingleEditorTabAction extends AbstractSetShowTabsAction {
    static { this.ID = 'workbench.action.zenShowEditorTab'; }
    constructor() {
        const precondition = ( (ContextKeyExpr.and(
             (( (ContextKeyExpr.equals(`config.${ZenModeSettings.SHOW_TABS}`, EditorTabsMode.SINGLE))).negate()),
            InEditorZenModeContext
        )));
        const title = ( localize2WithPath(_moduleId, 51, 'Show Single Editor Tab in Zen Mode'));
        super(ZenModeSettings.SHOW_TABS, EditorTabsMode.SINGLE, title, ZenShowSingleEditorTabAction.ID, precondition, ( localize2WithPath(_moduleId, 52, "Show Tab Bar in Zen Mode with one Tab")));
    }
}
registerAction2(HideEditorTabsAction);
registerAction2(ZenHideEditorTabsAction);
registerAction2(ShowMultipleEditorTabsAction);
registerAction2(ZenShowMultipleEditorTabsAction);
registerAction2(ShowSingleEditorTabAction);
registerAction2(ZenShowSingleEditorTabAction);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
    submenu: MenuId.EditorTabsBarShowTabsSubmenu,
    title: ( localizeWithPath(_moduleId, 53, "Tab Bar")),
    group: '3_workbench_layout_move',
    order: 10,
    when: ( (InEditorZenModeContext.negate()))
});
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
    submenu: MenuId.EditorTabsBarShowTabsZenModeSubmenu,
    title: ( localizeWithPath(_moduleId, 53, "Tab Bar")),
    group: '3_workbench_layout_move',
    order: 10,
    when: InEditorZenModeContext
});
class EditorActionsTitleBarAction extends Action2 {
    static { this.ID = 'workbench.action.editorActionsTitleBar'; }
    constructor() {
        super({
            id: EditorActionsTitleBarAction.ID,
            title: ( localize2WithPath(_moduleId, 54, "Move Editor Actions to Title Bar")),
            category: Categories.View,
            precondition: ( (( (ContextKeyExpr.equals(
                `config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`,
                EditorActionsLocation.TITLEBAR
            ))).negate())),
            metadata: { description: ( localize2WithPath(_moduleId, 55, "Move Editor Actions from the tab bar to the title bar")) },
            f1: true
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        return configurationService.updateValue(LayoutSettings.EDITOR_ACTIONS_LOCATION, EditorActionsLocation.TITLEBAR);
    }
}
registerAction2(EditorActionsTitleBarAction);
class EditorActionsDefaultAction extends Action2 {
    static { this.ID = 'workbench.action.editorActionsDefault'; }
    constructor() {
        super({
            id: EditorActionsDefaultAction.ID,
            title: ( localize2WithPath(_moduleId, 56, "Move Editor Actions to Tab Bar")),
            category: Categories.View,
            precondition: ( (ContextKeyExpr.and( (( (ContextKeyExpr.equals(
                `config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`,
                EditorActionsLocation.DEFAULT
            ))).negate()),  (( (ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.NONE))).negate())))),
            metadata: { description: ( localize2WithPath(_moduleId, 57, "Move Editor Actions from the title bar to the tab bar")) },
            f1: true
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        return configurationService.updateValue(LayoutSettings.EDITOR_ACTIONS_LOCATION, EditorActionsLocation.DEFAULT);
    }
}
registerAction2(EditorActionsDefaultAction);
class HideEditorActionsAction extends Action2 {
    static { this.ID = 'workbench.action.hideEditorActions'; }
    constructor() {
        super({
            id: HideEditorActionsAction.ID,
            title: ( localize2WithPath(_moduleId, 58, "Hide Editor Actions")),
            category: Categories.View,
            precondition: ( (( (ContextKeyExpr.equals(
                `config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`,
                EditorActionsLocation.HIDDEN
            ))).negate())),
            metadata: { description: ( localize2WithPath(_moduleId, 59, "Hide Editor Actions in the tab and title bar")) },
            f1: true
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        return configurationService.updateValue(LayoutSettings.EDITOR_ACTIONS_LOCATION, EditorActionsLocation.HIDDEN);
    }
}
registerAction2(HideEditorActionsAction);
class ShowEditorActionsAction extends Action2 {
    static { this.ID = 'workbench.action.showEditorActions'; }
    constructor() {
        super({
            id: ShowEditorActionsAction.ID,
            title: ( localize2WithPath(_moduleId, 60, "Show Editor Actions")),
            category: Categories.View,
            precondition: ( (ContextKeyExpr.equals(
                `config.${LayoutSettings.EDITOR_ACTIONS_LOCATION}`,
                EditorActionsLocation.HIDDEN
            ))),
            metadata: { description: ( localize2WithPath(_moduleId, 61, "Make Editor Actions visible.")) },
            f1: true
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        return configurationService.updateValue(LayoutSettings.EDITOR_ACTIONS_LOCATION, EditorActionsLocation.DEFAULT);
    }
}
registerAction2(ShowEditorActionsAction);
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
    submenu: MenuId.EditorActionsPositionSubmenu,
    title: ( localizeWithPath(_moduleId, 62, "Editor Actions Position")),
    group: '3_workbench_layout_move',
    order: 11
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.toggleSeparatePinnedEditorTabs',
            title: ( localize2WithPath(_moduleId, 63, "Separate Pinned Editor Tabs")),
            category: Categories.View,
            precondition: ( (ContextKeyExpr.equals(`config.${LayoutSettings.EDITOR_TABS_MODE}`, EditorTabsMode.MULTIPLE))),
            metadata: { description: ( localize2WithPath(
                _moduleId,
                64,
                "Toggle whether pinned editor tabs are shown on a separate row above unpinned tabs."
            )) },
            f1: true
        });
    }
    run(accessor) {
        const configurationService = accessor.get(IConfigurationService);
        const oldettingValue = configurationService.getValue('workbench.editor.pinnedTabsOnSeparateRow');
        const newSettingValue = !oldettingValue;
        return configurationService.updateValue('workbench.editor.pinnedTabsOnSeparateRow', newSettingValue);
    }
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.toggleZenMode',
            title: {
                ...( localize2WithPath(_moduleId, 65, "Toggle Zen Mode")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 66, "Zen Mode")),
            },
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated())),
            category: Categories.View,
            f1: true,
            keybinding: {
                weight: KeybindingWeight.WorkbenchContrib,
                primary: KeyChord(KeyMod$1.CtrlCmd | KeyCode.KeyK, KeyCode.KeyZ)
            },
            toggled: InEditorZenModeContext,
            menu: [{
                    id: MenuId.MenubarAppearanceMenu,
                    group: '1_toggle_view',
                    order: 2
                }]
        });
    }
    run(accessor) {
        return accessor.get(IWorkbenchLayoutService).toggleZenMode();
    }
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
    id: 'workbench.action.exitZenMode',
    weight: KeybindingWeight.EditorContrib - 1000,
    handler(accessor) {
        const layoutService = accessor.get(IWorkbenchLayoutService);
        const contextKeyService = accessor.get(IContextKeyService);
        if (InEditorZenModeContext.getValue(contextKeyService)) {
            layoutService.toggleZenMode();
        }
    },
    when: InEditorZenModeContext,
    primary: KeyChord(KeyCode.Escape, KeyCode.Escape)
});
if (isWindows || isLinux || isWeb) {
    registerAction2(class ToggleMenubarAction extends Action2 {
        constructor() {
            super({
                id: 'workbench.action.toggleMenuBar',
                title: {
                    ...( localize2WithPath(_moduleId, 67, "Toggle Menu Bar")),
                    mnemonicTitle: ( localizeWithPath(_moduleId, 68, "Menu &&Bar")),
                },
                category: Categories.View,
                f1: true,
                toggled: ( (ContextKeyExpr.and(
                     (IsMacNativeContext.toNegated()),
                     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'hidden')),
                     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'toggle')),
                     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'compact'))
                ))),
                menu: [{
                        id: MenuId.MenubarAppearanceMenu,
                        group: '2_workbench_layout',
                        order: 0
                    }]
            });
        }
        run(accessor) {
            return accessor.get(IWorkbenchLayoutService).toggleMenuBar();
        }
    });
    for (const menuId of [MenuId.TitleBarContext, MenuId.TitleBarTitleContext]) {
        MenuRegistry.appendMenuItem(menuId, {
            command: {
                id: 'workbench.action.toggleMenuBar',
                title: ( localizeWithPath(_moduleId, 69, "Menu Bar")),
                toggled: ( (ContextKeyExpr.and(
                     (IsMacNativeContext.toNegated()),
                     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'hidden')),
                     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'toggle')),
                     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'compact'))
                )))
            },
            when: ( (ContextKeyExpr.and(
                 (IsAuxiliaryWindowFocusedContext.toNegated()),
                 (ContextKeyExpr.notEquals(TitleBarStyleContext.key, TitlebarStyle.NATIVE)),
                 (IsMainWindowFullscreenContext.negate())
            ))),
            group: '2_config',
            order: 0
        });
    }
}
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.resetViewLocations',
            title: ( localize2WithPath(_moduleId, 70, "Reset View Locations")),
            category: Categories.View,
            f1: true
        });
    }
    run(accessor) {
        return accessor.get(IViewDescriptorService).reset();
    }
});
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.moveView',
            title: ( localize2WithPath(_moduleId, 71, "Move View")),
            category: Categories.View,
            f1: true
        });
    }
    async run(accessor) {
        const viewDescriptorService = accessor.get(IViewDescriptorService);
        const instantiationService = accessor.get(IInstantiationService);
        const quickInputService = accessor.get(IQuickInputService);
        const contextKeyService = accessor.get(IContextKeyService);
        const paneCompositePartService = accessor.get(IPaneCompositePartService);
        const focusedViewId = FocusedViewContext.getValue(contextKeyService);
        let viewId;
        if (focusedViewId && viewDescriptorService.getViewDescriptorById(focusedViewId)?.canMoveView) {
            viewId = focusedViewId;
        }
        try {
            viewId = await this.getView(quickInputService, viewDescriptorService, paneCompositePartService, viewId);
            if (!viewId) {
                return;
            }
            const moveFocusedViewAction = ( (new MoveFocusedViewAction()));
            instantiationService.invokeFunction(accessor => moveFocusedViewAction.run(accessor, viewId));
        }
        catch { }
    }
    getViewItems(viewDescriptorService, paneCompositePartService) {
        const results = [];
        const viewlets = paneCompositePartService.getVisiblePaneCompositeIds(ViewContainerLocation.Sidebar);
        viewlets.forEach(viewletId => {
            const container = viewDescriptorService.getViewContainerById(viewletId);
            const containerModel = viewDescriptorService.getViewContainerModel(container);
            let hasAddedView = false;
            containerModel.visibleViewDescriptors.forEach(viewDescriptor => {
                if (viewDescriptor.canMoveView) {
                    if (!hasAddedView) {
                        results.push({
                            type: 'separator',
                            label: ( localizeWithPath(_moduleId, 72, "Side Bar / {0}", containerModel.title))
                        });
                        hasAddedView = true;
                    }
                    results.push({
                        id: viewDescriptor.id,
                        label: viewDescriptor.name.value
                    });
                }
            });
        });
        const panels = paneCompositePartService.getPinnedPaneCompositeIds(ViewContainerLocation.Panel);
        panels.forEach(panel => {
            const container = viewDescriptorService.getViewContainerById(panel);
            const containerModel = viewDescriptorService.getViewContainerModel(container);
            let hasAddedView = false;
            containerModel.visibleViewDescriptors.forEach(viewDescriptor => {
                if (viewDescriptor.canMoveView) {
                    if (!hasAddedView) {
                        results.push({
                            type: 'separator',
                            label: ( localizeWithPath(_moduleId, 73, "Panel / {0}", containerModel.title))
                        });
                        hasAddedView = true;
                    }
                    results.push({
                        id: viewDescriptor.id,
                        label: viewDescriptor.name.value
                    });
                }
            });
        });
        const sidePanels = paneCompositePartService.getPinnedPaneCompositeIds(ViewContainerLocation.AuxiliaryBar);
        sidePanels.forEach(panel => {
            const container = viewDescriptorService.getViewContainerById(panel);
            const containerModel = viewDescriptorService.getViewContainerModel(container);
            let hasAddedView = false;
            containerModel.visibleViewDescriptors.forEach(viewDescriptor => {
                if (viewDescriptor.canMoveView) {
                    if (!hasAddedView) {
                        results.push({
                            type: 'separator',
                            label: ( localizeWithPath(_moduleId, 74, "Secondary Side Bar / {0}", containerModel.title))
                        });
                        hasAddedView = true;
                    }
                    results.push({
                        id: viewDescriptor.id,
                        label: viewDescriptor.name.value
                    });
                }
            });
        });
        return results;
    }
    async getView(quickInputService, viewDescriptorService, paneCompositePartService, viewId) {
        const quickPick = quickInputService.createQuickPick();
        quickPick.placeholder = ( localizeWithPath(_moduleId, 75, "Select a View to Move"));
        quickPick.items = this.getViewItems(viewDescriptorService, paneCompositePartService);
        quickPick.selectedItems = quickPick.items.filter(item => item.id === viewId);
        return (
             (new Promise((resolve, reject) => {
                quickPick.onDidAccept(() => {
                    const viewId = quickPick.selectedItems[0];
                    if (viewId.id) {
                        resolve(viewId.id);
                    }
                    else {
                        reject();
                    }
                    quickPick.hide();
                });
                quickPick.onDidHide(() => reject());
                quickPick.show();
            }))
        );
    }
});
class MoveFocusedViewAction extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.moveFocusedView',
            title: ( localize2WithPath(_moduleId, 76, "Move Focused View")),
            category: Categories.View,
            precondition: ( (FocusedViewContext.notEqualsTo(''))),
            f1: true
        });
    }
    run(accessor, viewId) {
        const viewDescriptorService = accessor.get(IViewDescriptorService);
        const viewsService = accessor.get(IViewsService);
        const quickInputService = accessor.get(IQuickInputService);
        const contextKeyService = accessor.get(IContextKeyService);
        const dialogService = accessor.get(IDialogService);
        const paneCompositePartService = accessor.get(IPaneCompositePartService);
        const focusedViewId = viewId || FocusedViewContext.getValue(contextKeyService);
        if (focusedViewId === undefined || focusedViewId.trim() === '') {
            dialogService.error(( localizeWithPath(_moduleId, 77, "There is no view currently focused.")));
            return;
        }
        const viewDescriptor = viewDescriptorService.getViewDescriptorById(focusedViewId);
        if (!viewDescriptor || !viewDescriptor.canMoveView) {
            dialogService.error(( localizeWithPath(_moduleId, 78, "The currently focused view is not movable.")));
            return;
        }
        const quickPick = quickInputService.createQuickPick();
        quickPick.placeholder = ( localizeWithPath(_moduleId, 79, "Select a Destination for the View"));
        quickPick.title = ( localizeWithPath(_moduleId, 80, "View: Move {0}", viewDescriptor.name.value));
        const items = [];
        const currentContainer = viewDescriptorService.getViewContainerByViewId(focusedViewId);
        const currentLocation = viewDescriptorService.getViewLocationById(focusedViewId);
        const isViewSolo = viewDescriptorService.getViewContainerModel(currentContainer).allViewDescriptors.length === 1;
        if (!(isViewSolo && currentLocation === ViewContainerLocation.Panel)) {
            items.push({
                id: '_.panel.newcontainer',
                label: ( localizeWithPath(_moduleId, 81, "New Panel Entry")),
            });
        }
        if (!(isViewSolo && currentLocation === ViewContainerLocation.Sidebar)) {
            items.push({
                id: '_.sidebar.newcontainer',
                label: ( localizeWithPath(_moduleId, 82, "New Side Bar Entry"))
            });
        }
        if (!(isViewSolo && currentLocation === ViewContainerLocation.AuxiliaryBar)) {
            items.push({
                id: '_.auxiliarybar.newcontainer',
                label: ( localizeWithPath(_moduleId, 83, "New Secondary Side Bar Entry"))
            });
        }
        items.push({
            type: 'separator',
            label: ( localizeWithPath(_moduleId, 84, "Side Bar"))
        });
        const pinnedViewlets = paneCompositePartService.getVisiblePaneCompositeIds(ViewContainerLocation.Sidebar);
        items.push(...( (pinnedViewlets
            .filter(viewletId => {
            if (viewletId === viewDescriptorService.getViewContainerByViewId(focusedViewId).id) {
                return false;
            }
            return !viewDescriptorService.getViewContainerById(viewletId).rejectAddedViews;
        })
            .map(viewletId => {
            return {
                id: viewletId,
                label: viewDescriptorService.getViewContainerModel(viewDescriptorService.getViewContainerById(viewletId)).title
            };
        }))));
        items.push({
            type: 'separator',
            label: ( localizeWithPath(_moduleId, 85, "Panel"))
        });
        const pinnedPanels = paneCompositePartService.getPinnedPaneCompositeIds(ViewContainerLocation.Panel);
        items.push(...( (pinnedPanels
            .filter(panel => {
            if (panel === viewDescriptorService.getViewContainerByViewId(focusedViewId).id) {
                return false;
            }
            return !viewDescriptorService.getViewContainerById(panel).rejectAddedViews;
        })
            .map(panel => {
            return {
                id: panel,
                label: viewDescriptorService.getViewContainerModel(viewDescriptorService.getViewContainerById(panel)).title
            };
        }))));
        items.push({
            type: 'separator',
            label: ( localizeWithPath(_moduleId, 86, "Secondary Side Bar"))
        });
        const pinnedAuxPanels = paneCompositePartService.getPinnedPaneCompositeIds(ViewContainerLocation.AuxiliaryBar);
        items.push(...( (pinnedAuxPanels
            .filter(panel => {
            if (panel === viewDescriptorService.getViewContainerByViewId(focusedViewId).id) {
                return false;
            }
            return !viewDescriptorService.getViewContainerById(panel).rejectAddedViews;
        })
            .map(panel => {
            return {
                id: panel,
                label: viewDescriptorService.getViewContainerModel(viewDescriptorService.getViewContainerById(panel)).title
            };
        }))));
        quickPick.items = items;
        quickPick.onDidAccept(() => {
            const destination = quickPick.selectedItems[0];
            if (destination.id === '_.panel.newcontainer') {
                viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.Panel, this.desc.id);
                viewsService.openView(focusedViewId, true);
            }
            else if (destination.id === '_.sidebar.newcontainer') {
                viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.Sidebar, this.desc.id);
                viewsService.openView(focusedViewId, true);
            }
            else if (destination.id === '_.auxiliarybar.newcontainer') {
                viewDescriptorService.moveViewToLocation(viewDescriptor, ViewContainerLocation.AuxiliaryBar, this.desc.id);
                viewsService.openView(focusedViewId, true);
            }
            else if (destination.id) {
                viewDescriptorService.moveViewsToContainer([viewDescriptor], viewDescriptorService.getViewContainerById(destination.id), undefined, this.desc.id);
                viewsService.openView(focusedViewId, true);
            }
            quickPick.hide();
        });
        quickPick.show();
    }
}
registerAction2(MoveFocusedViewAction);
registerAction2(class extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.resetFocusedViewLocation',
            title: ( localize2WithPath(_moduleId, 87, "Reset Focused View Location")),
            category: Categories.View,
            f1: true,
            precondition: ( (FocusedViewContext.notEqualsTo('')))
        });
    }
    run(accessor) {
        const viewDescriptorService = accessor.get(IViewDescriptorService);
        const contextKeyService = accessor.get(IContextKeyService);
        const dialogService = accessor.get(IDialogService);
        const viewsService = accessor.get(IViewsService);
        const focusedViewId = FocusedViewContext.getValue(contextKeyService);
        let viewDescriptor = null;
        if (focusedViewId !== undefined && focusedViewId.trim() !== '') {
            viewDescriptor = viewDescriptorService.getViewDescriptorById(focusedViewId);
        }
        if (!viewDescriptor) {
            dialogService.error(( localizeWithPath(_moduleId, 88, "There is no view currently focused.")));
            return;
        }
        const defaultContainer = viewDescriptorService.getDefaultContainerById(viewDescriptor.id);
        if (!defaultContainer || defaultContainer === viewDescriptorService.getViewContainerByViewId(viewDescriptor.id)) {
            return;
        }
        viewDescriptorService.moveViewsToContainer([viewDescriptor], defaultContainer, undefined, this.desc.id);
        viewsService.openView(viewDescriptor.id, true);
    }
});
class BaseResizeViewAction extends Action2 {
    static { this.RESIZE_INCREMENT = 60; }
    resizePart(widthChange, heightChange, layoutService, partToResize) {
        let part;
        if (partToResize === undefined) {
            const isEditorFocus = layoutService.hasFocus(Parts.EDITOR_PART);
            const isSidebarFocus = layoutService.hasFocus(Parts.SIDEBAR_PART);
            const isPanelFocus = layoutService.hasFocus(Parts.PANEL_PART);
            const isAuxiliaryBarFocus = layoutService.hasFocus(Parts.AUXILIARYBAR_PART);
            if (isSidebarFocus) {
                part = Parts.SIDEBAR_PART;
            }
            else if (isPanelFocus) {
                part = Parts.PANEL_PART;
            }
            else if (isEditorFocus) {
                part = Parts.EDITOR_PART;
            }
            else if (isAuxiliaryBarFocus) {
                part = Parts.AUXILIARYBAR_PART;
            }
        }
        else {
            part = partToResize;
        }
        if (part) {
            layoutService.resizePart(part, widthChange, heightChange);
        }
    }
}
class IncreaseViewSizeAction extends BaseResizeViewAction {
    constructor() {
        super({
            id: 'workbench.action.increaseViewSize',
            title: ( localize2WithPath(_moduleId, 89, 'Increase Current View Size')),
            f1: true,
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated()))
        });
    }
    run(accessor) {
        this.resizePart(BaseResizeViewAction.RESIZE_INCREMENT, BaseResizeViewAction.RESIZE_INCREMENT, accessor.get(IWorkbenchLayoutService));
    }
}
class IncreaseViewWidthAction extends BaseResizeViewAction {
    constructor() {
        super({
            id: 'workbench.action.increaseViewWidth',
            title: ( localize2WithPath(_moduleId, 90, 'Increase Editor Width')),
            f1: true,
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated()))
        });
    }
    run(accessor) {
        this.resizePart(BaseResizeViewAction.RESIZE_INCREMENT, 0, accessor.get(IWorkbenchLayoutService), Parts.EDITOR_PART);
    }
}
class IncreaseViewHeightAction extends BaseResizeViewAction {
    constructor() {
        super({
            id: 'workbench.action.increaseViewHeight',
            title: ( localize2WithPath(_moduleId, 91, 'Increase Editor Height')),
            f1: true,
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated()))
        });
    }
    run(accessor) {
        this.resizePart(0, BaseResizeViewAction.RESIZE_INCREMENT, accessor.get(IWorkbenchLayoutService), Parts.EDITOR_PART);
    }
}
class DecreaseViewSizeAction extends BaseResizeViewAction {
    constructor() {
        super({
            id: 'workbench.action.decreaseViewSize',
            title: ( localize2WithPath(_moduleId, 92, 'Decrease Current View Size')),
            f1: true,
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated()))
        });
    }
    run(accessor) {
        this.resizePart(-BaseResizeViewAction.RESIZE_INCREMENT, -BaseResizeViewAction.RESIZE_INCREMENT, accessor.get(IWorkbenchLayoutService));
    }
}
class DecreaseViewWidthAction extends BaseResizeViewAction {
    constructor() {
        super({
            id: 'workbench.action.decreaseViewWidth',
            title: ( localize2WithPath(_moduleId, 93, 'Decrease Editor Width')),
            f1: true,
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated()))
        });
    }
    run(accessor) {
        this.resizePart(-BaseResizeViewAction.RESIZE_INCREMENT, 0, accessor.get(IWorkbenchLayoutService), Parts.EDITOR_PART);
    }
}
class DecreaseViewHeightAction extends BaseResizeViewAction {
    constructor() {
        super({
            id: 'workbench.action.decreaseViewHeight',
            title: ( localize2WithPath(_moduleId, 94, 'Decrease Editor Height')),
            f1: true,
            precondition: ( (IsAuxiliaryWindowFocusedContext.toNegated()))
        });
    }
    run(accessor) {
        this.resizePart(0, -BaseResizeViewAction.RESIZE_INCREMENT, accessor.get(IWorkbenchLayoutService), Parts.EDITOR_PART);
    }
}
registerAction2(IncreaseViewSizeAction);
registerAction2(IncreaseViewWidthAction);
registerAction2(IncreaseViewHeightAction);
registerAction2(DecreaseViewSizeAction);
registerAction2(DecreaseViewWidthAction);
registerAction2(DecreaseViewHeightAction);
function isContextualLayoutVisualIcon(icon) {
    return icon.iconA !== undefined;
}
const CreateToggleLayoutItem = (id, active, label, visualIcon) => {
    return {
        id,
        active,
        label,
        visualIcon,
        activeIcon: Codicon.eye,
        inactiveIcon: Codicon.eyeClosed,
        activeAriaLabel: ( localizeWithPath(_moduleId, 95, "Select to Hide")),
        inactiveAriaLabel: ( localizeWithPath(_moduleId, 96, "Select to Show")),
        useButtons: true,
    };
};
const CreateOptionLayoutItem = (id, active, label, visualIcon) => {
    return {
        id,
        active,
        label,
        visualIcon,
        activeIcon: Codicon.check,
        activeAriaLabel: ( localizeWithPath(_moduleId, 97, "Active")),
        useButtons: false
    };
};
const MenuBarToggledContext = ( (ContextKeyExpr.and(
     (IsMacNativeContext.toNegated()),
     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'hidden')),
     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'toggle')),
     (ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'compact'))
)));
const ToggleVisibilityActions = [];
if (!isMacintosh || !isNative) {
    ToggleVisibilityActions.push(CreateToggleLayoutItem('workbench.action.toggleMenuBar', MenuBarToggledContext, ( localizeWithPath(_moduleId, 98, "Menu Bar")), menubarIcon));
}
ToggleVisibilityActions.push(...[
    CreateToggleLayoutItem(ToggleActivityBarVisibilityActionId, ( (ContextKeyExpr.notEquals('config.workbench.activityBar.location', 'hidden'))), ( localizeWithPath(_moduleId, 99, "Activity Bar")), { whenA: ( (ContextKeyExpr.equals('config.workbench.sideBar.location', 'left'))), iconA: activityBarLeftIcon, iconB: activityBarRightIcon }),
    CreateToggleLayoutItem(ToggleSidebarVisibilityAction.ID, SideBarVisibleContext, ( localizeWithPath(_moduleId, 100, "Primary Side Bar")), { whenA: ( (ContextKeyExpr.equals('config.workbench.sideBar.location', 'left'))), iconA: panelLeftIcon, iconB: panelRightIcon }),
    CreateToggleLayoutItem(ToggleAuxiliaryBarAction.ID, AuxiliaryBarVisibleContext, ( localizeWithPath(_moduleId, 86, "Secondary Side Bar")), { whenA: ( (ContextKeyExpr.equals('config.workbench.sideBar.location', 'left'))), iconA: panelRightIcon, iconB: panelLeftIcon }),
    CreateToggleLayoutItem(TogglePanelAction.ID, PanelVisibleContext, ( localizeWithPath(_moduleId, 85, "Panel")), panelIcon),
    CreateToggleLayoutItem(ToggleStatusbarVisibilityAction.ID, ( (ContextKeyExpr.equals('config.workbench.statusBar.visible', true))), ( localizeWithPath(_moduleId, 101, "Status Bar")), statusBarIcon),
]);
const MoveSideBarActions = [
    CreateOptionLayoutItem(MoveSidebarLeftAction.ID, ( (ContextKeyExpr.equals('config.workbench.sideBar.location', 'left'))), ( localizeWithPath(_moduleId, 102, "Left")), panelLeftIcon),
    CreateOptionLayoutItem(MoveSidebarRightAction.ID, ( (ContextKeyExpr.equals('config.workbench.sideBar.location', 'right'))), ( localizeWithPath(_moduleId, 103, "Right")), panelRightIcon),
];
const AlignPanelActions = [
    CreateOptionLayoutItem('workbench.action.alignPanelLeft', ( (PanelAlignmentContext.isEqualTo('left'))), ( localizeWithPath(_moduleId, 104, "Left")), panelAlignmentLeftIcon),
    CreateOptionLayoutItem('workbench.action.alignPanelRight', ( (PanelAlignmentContext.isEqualTo('right'))), ( localizeWithPath(_moduleId, 105, "Right")), panelAlignmentRightIcon),
    CreateOptionLayoutItem('workbench.action.alignPanelCenter', ( (PanelAlignmentContext.isEqualTo('center'))), ( localizeWithPath(_moduleId, 106, "Center")), panelAlignmentCenterIcon),
    CreateOptionLayoutItem('workbench.action.alignPanelJustify', ( (PanelAlignmentContext.isEqualTo('justify'))), ( localizeWithPath(_moduleId, 107, "Justify")), panelAlignmentJustifyIcon),
];
const MiscLayoutOptions = [
    CreateOptionLayoutItem('workbench.action.toggleFullScreen', IsMainWindowFullscreenContext, ( localizeWithPath(_moduleId, 108, "Full Screen")), fullscreenIcon),
    CreateOptionLayoutItem('workbench.action.toggleZenMode', InEditorZenModeContext, ( localizeWithPath(_moduleId, 109, "Zen Mode")), zenModeIcon),
    CreateOptionLayoutItem('workbench.action.toggleCenteredLayout', IsMainEditorCenteredLayoutContext, ( localizeWithPath(_moduleId, 110, "Centered Layout")), centerLayoutIcon),
];
const LayoutContextKeySet = ( (new Set()));
for (const { active } of [...ToggleVisibilityActions, ...MoveSideBarActions, ...AlignPanelActions, ...MiscLayoutOptions]) {
    for (const key of ( (active.keys()))) {
        LayoutContextKeySet.add(key);
    }
}
registerAction2(class CustomizeLayoutAction extends Action2 {
    constructor() {
        super({
            id: 'workbench.action.customizeLayout',
            title: ( localize2WithPath(_moduleId, 111, "Customize Layout...")),
            f1: true,
            icon: configureLayoutIcon,
            menu: [
                {
                    id: MenuId.LayoutControlMenuSubmenu,
                    group: 'z_end',
                },
                {
                    id: MenuId.LayoutControlMenu,
                    when: ( (ContextKeyExpr.equals('config.workbench.layoutControl.type', 'both'))),
                    group: 'z_end'
                }
            ]
        });
    }
    getItems(contextKeyService, keybindingService) {
        const toQuickPickItem = (item) => {
            const toggled = item.active.evaluate(contextKeyService.getContext(null));
            let label = item.useButtons ?
                item.label :
                item.label + (toggled && item.activeIcon ? ` $(${item.activeIcon.id})` : (!toggled && item.inactiveIcon ? ` $(${item.inactiveIcon.id})` : ''));
            const ariaLabel = item.label + (toggled && item.activeAriaLabel ? ` (${item.activeAriaLabel})` : (!toggled && item.inactiveAriaLabel ? ` (${item.inactiveAriaLabel})` : ''));
            if (item.visualIcon) {
                let icon = item.visualIcon;
                if (isContextualLayoutVisualIcon(icon)) {
                    const useIconA = icon.whenA.evaluate(contextKeyService.getContext(null));
                    icon = useIconA ? icon.iconA : icon.iconB;
                }
                label = `$(${icon.id}) ${label}`;
            }
            const icon = toggled ? item.activeIcon : item.inactiveIcon;
            return {
                type: 'item',
                id: item.id,
                label,
                ariaLabel,
                keybinding: keybindingService.lookupKeybinding(item.id, contextKeyService),
                buttons: !item.useButtons ? undefined : [
                    {
                        alwaysVisible: false,
                        tooltip: ariaLabel,
                        iconClass: icon ? ThemeIcon.asClassName(icon) : undefined
                    }
                ]
            };
        };
        return [
            {
                type: 'separator',
                label: ( localizeWithPath(_moduleId, 112, "Visibility"))
            },
            ...( (ToggleVisibilityActions.map(toQuickPickItem))),
            {
                type: 'separator',
                label: ( localizeWithPath(_moduleId, 113, "Primary Side Bar Position"))
            },
            ...( (MoveSideBarActions.map(toQuickPickItem))),
            {
                type: 'separator',
                label: ( localizeWithPath(_moduleId, 114, "Panel Alignment"))
            },
            ...( (AlignPanelActions.map(toQuickPickItem))),
            {
                type: 'separator',
                label: ( localizeWithPath(_moduleId, 115, "Modes")),
            },
            ...( (MiscLayoutOptions.map(toQuickPickItem))),
        ];
    }
    run(accessor) {
        if (this._currentQuickPick) {
            this._currentQuickPick.hide();
            return;
        }
        const configurationService = accessor.get(IConfigurationService);
        const contextKeyService = accessor.get(IContextKeyService);
        const commandService = accessor.get(ICommandService);
        const quickInputService = accessor.get(IQuickInputService);
        const keybindingService = accessor.get(IKeybindingService);
        const quickPick = quickInputService.createQuickPick();
        this._currentQuickPick = quickPick;
        quickPick.items = this.getItems(contextKeyService, keybindingService);
        quickPick.ignoreFocusOut = true;
        quickPick.hideInput = true;
        quickPick.title = ( localizeWithPath(_moduleId, 116, "Customize Layout"));
        const closeButton = {
            alwaysVisible: true,
            iconClass: ThemeIcon.asClassName(Codicon.close),
            tooltip: ( localizeWithPath(_moduleId, 117, "Close"))
        };
        const resetButton = {
            alwaysVisible: true,
            iconClass: ThemeIcon.asClassName(Codicon.discard),
            tooltip: ( localizeWithPath(_moduleId, 118, "Restore Defaults"))
        };
        quickPick.buttons = [
            resetButton,
            closeButton
        ];
        const disposables = ( (new DisposableStore()));
        let selectedItem = undefined;
        disposables.add(contextKeyService.onDidChangeContext(changeEvent => {
            if (changeEvent.affectsSome(LayoutContextKeySet)) {
                quickPick.items = this.getItems(contextKeyService, keybindingService);
                if (selectedItem) {
                    quickPick.activeItems = quickPick.items.filter(item => item.id === selectedItem?.id);
                }
                setTimeout(() => quickInputService.focus(), 0);
            }
        }));
        quickPick.onDidAccept(event => {
            if (quickPick.selectedItems.length) {
                selectedItem = quickPick.selectedItems[0];
                commandService.executeCommand(selectedItem.id);
            }
        });
        quickPick.onDidTriggerItemButton(event => {
            if (event.item) {
                selectedItem = event.item;
                commandService.executeCommand(selectedItem.id);
            }
        });
        quickPick.onDidTriggerButton((button) => {
            if (button === closeButton) {
                quickPick.hide();
            }
            else if (button === resetButton) {
                const resetSetting = (id) => {
                    const config = configurationService.inspect(id);
                    configurationService.updateValue(id, config.defaultValue);
                };
                resetSetting('workbench.activityBar.location');
                resetSetting('workbench.sideBar.location');
                resetSetting('workbench.statusBar.visible');
                resetSetting('workbench.panel.defaultLocation');
                if (!isMacintosh || !isNative) {
                    resetSetting('window.menuBarVisibility');
                }
                commandService.executeCommand('workbench.action.alignPanelCenter');
            }
        });
        quickPick.onDidHide(() => {
            quickPick.dispose();
        });
        quickPick.onDispose(() => {
            this._currentQuickPick = undefined;
            disposables.dispose();
        });
        quickPick.show();
    }
});
export { EditorActionsDefaultAction, EditorActionsTitleBarAction, HideEditorActionsAction, HideEditorTabsAction, ShowEditorActionsAction, ShowMultipleEditorTabsAction, ShowSingleEditorTabAction, ToggleActivityBarVisibilityActionId, ToggleSidebarPositionAction, ToggleStatusbarVisibilityAction, ZenHideEditorTabsAction, ZenShowMultipleEditorTabsAction, ZenShowSingleEditorTabAction };
