
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
import { Disposable } from '../../../../base/common/lifecycle.js';
import { areSameExtensions } from '../../../../platform/extensionManagement/common/extensionManagementUtil.js';
import { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
import { MenuId } from '../../../../platform/actions/common/actions.js';
import { localize2 } from '../../../../nls.js';
import { ExtensionGalleryManifestStatus } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js';
import { IExtensionsWorkbenchService } from './extensions.service.js';

const VIEWLET_ID = "workbench.view.extensions";
const EXTENSIONS_CATEGORY = ( localize2(10236, "Extensions"));
var ExtensionState;
(function(ExtensionState) {
    ExtensionState[ExtensionState["Installing"] = 0] = "Installing";
    ExtensionState[ExtensionState["Installed"] = 1] = "Installed";
    ExtensionState[ExtensionState["Uninstalling"] = 2] = "Uninstalling";
    ExtensionState[ExtensionState["Uninstalled"] = 3] = "Uninstalled";
})(ExtensionState || (ExtensionState = {}));
var ExtensionRuntimeActionType;
(function(ExtensionRuntimeActionType) {
    ExtensionRuntimeActionType["ReloadWindow"] = "reloadWindow";
    ExtensionRuntimeActionType["RestartExtensions"] = "restartExtensions";
    ExtensionRuntimeActionType["DownloadUpdate"] = "downloadUpdate";
    ExtensionRuntimeActionType["ApplyUpdate"] = "applyUpdate";
    ExtensionRuntimeActionType["QuitAndInstall"] = "quitAndInstall";
})(ExtensionRuntimeActionType || (ExtensionRuntimeActionType = {}));
var ExtensionEditorTab;
(function(ExtensionEditorTab) {
    ExtensionEditorTab["Readme"] = "readme";
    ExtensionEditorTab["Features"] = "features";
    ExtensionEditorTab["Changelog"] = "changelog";
    ExtensionEditorTab["Dependencies"] = "dependencies";
    ExtensionEditorTab["ExtensionPack"] = "extensionPack";
})(ExtensionEditorTab || (ExtensionEditorTab = {}));
const AutoUpdateConfigurationKey = "extensions.autoUpdate";
const AutoCheckUpdatesConfigurationKey = "extensions.autoCheckUpdates";
const CloseExtensionDetailsOnViewChangeKey = "extensions.closeExtensionDetailsOnViewChange";
const AutoRestartConfigurationKey = "extensions.autoRestart";
let ExtensionContainers = class ExtensionContainers extends Disposable {
    constructor(containers, extensionsWorkbenchService) {
        super();
        this.containers = containers;
        this._register(extensionsWorkbenchService.onChange(this.update, this));
    }
    set extension(extension) {
        this.containers.forEach(c => c.extension = extension);
    }
    update(extension) {
        for (const container of this.containers) {
            if (extension && container.extension) {
                if (areSameExtensions(container.extension.identifier, extension.identifier)) {
                    if (container.extension.server && extension.server && container.extension.server !== extension.server) {
                        if (container.updateWhenCounterExtensionChanges) {
                            container.update();
                        }
                    } else {
                        container.extension = extension;
                    }
                }
            } else {
                container.update();
            }
        }
    }
};
ExtensionContainers = ( __decorate([( __param(1, IExtensionsWorkbenchService))], ExtensionContainers));
const WORKSPACE_RECOMMENDATIONS_VIEW_ID = "workbench.views.extensions.workspaceRecommendations";
const OUTDATED_EXTENSIONS_VIEW_ID = "workbench.views.extensions.searchOutdated";
const TOGGLE_IGNORE_EXTENSION_ACTION_ID = "workbench.extensions.action.toggleIgnoreExtension";
const SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID = "workbench.extensions.action.installVSIX";
const INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID = "workbench.extensions.command.installFromVSIX";
const LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID = "workbench.extensions.action.listWorkspaceUnsupportedExtensions";
const DefaultViewsContext = ( new RawContextKey("defaultExtensionViews", true));
const HasOutdatedExtensionsContext = ( new RawContextKey("hasOutdatedExtensions", false));
const CONTEXT_HAS_GALLERY = ( new RawContextKey("hasGallery", false));
const CONTEXT_EXTENSIONS_GALLERY_STATUS = ( new RawContextKey("extensionsGalleryStatus", ExtensionGalleryManifestStatus.Unavailable));
const ExtensionResultsListFocused = ( new RawContextKey("extensionResultListFocused ", true));
const SearchMcpServersContext = ( new RawContextKey("searchMcpServers", false));
const SearchAgentPluginsContext = ( new RawContextKey("searchAgentPlugins", false));
const THEME_ACTIONS_GROUP = "_theme_";
const INSTALL_ACTIONS_GROUP = "0_install";
const UPDATE_ACTIONS_GROUP = "0_update";
const extensionsSearchActionsMenu = ( new MenuId("extensionsSearchActionsMenu"));
const extensionsFilterSubMenu = ( new MenuId("extensionsFilterSubMenu"));

export { AutoCheckUpdatesConfigurationKey, AutoRestartConfigurationKey, AutoUpdateConfigurationKey, CONTEXT_EXTENSIONS_GALLERY_STATUS, CONTEXT_HAS_GALLERY, CloseExtensionDetailsOnViewChangeKey, DefaultViewsContext, EXTENSIONS_CATEGORY, ExtensionContainers, ExtensionEditorTab, ExtensionResultsListFocused, ExtensionRuntimeActionType, ExtensionState, HasOutdatedExtensionsContext, INSTALL_ACTIONS_GROUP, INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID, OUTDATED_EXTENSIONS_VIEW_ID, SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID, SearchAgentPluginsContext, SearchMcpServersContext, THEME_ACTIONS_GROUP, TOGGLE_IGNORE_EXTENSION_ACTION_ID, UPDATE_ACTIONS_GROUP, VIEWLET_ID, WORKSPACE_RECOMMENDATIONS_VIEW_ID, extensionsFilterSubMenu, extensionsSearchActionsMenu };
