
import { localize } from '../../../../../nls.js';
import { RawContextKey, ContextKeyExpr } from '../../../../../platform/contextkey/common/contextkey.js';
import { IsWebContext } from '../../../../../platform/contextkey/common/contextkeys.js';
import { RemoteNameContext } from '../../../../common/contextkeys.js';
import { ChatEntitlementContextKeys } from '../../../../services/chat/common/chatEntitlementService.js';
import { ChatModeKind } from '../constants.js';

var ChatContextKeys;
(function(ChatContextKeys) {
    ChatContextKeys.responseVote = ( new RawContextKey("chatSessionResponseVote", "", {
        type: "string",
        description: ( localize(
            6247,
            "When the response has been voted up, is set to 'up'. When voted down, is set to 'down'. Otherwise an empty string."
        ))
    }));
    ChatContextKeys.responseDetectedAgentCommand = ( new RawContextKey("chatSessionResponseDetectedAgentOrCommand", false, {
        type: "boolean",
        description: ( localize(6248, "When the agent or command was automatically detected"))
    }));
    ChatContextKeys.responseSupportsIssueReporting = ( new RawContextKey("chatResponseSupportsIssueReporting", false, {
        type: "boolean",
        description: ( localize(6249, "True when the current chat response supports issue reporting."))
    }));
    ChatContextKeys.responseIsFiltered = ( new RawContextKey("chatSessionResponseFiltered", false, {
        type: "boolean",
        description: ( localize(6250, "True when the chat response was filtered out by the server."))
    }));
    ChatContextKeys.responseHasError = ( new RawContextKey("chatSessionResponseError", false, {
        type: "boolean",
        description: ( localize(6251, "True when the chat response resulted in an error."))
    }));
    ChatContextKeys.requestInProgress = ( new RawContextKey("chatSessionRequestInProgress", false, {
        type: "boolean",
        description: ( localize(6252, "True when the current request is still in progress."))
    }));
    ChatContextKeys.currentlyEditing = ( new RawContextKey("chatSessionCurrentlyEditing", false, {
        type: "boolean",
        description: ( localize(6253, "True when the current request is being edited."))
    }));
    ChatContextKeys.currentlyEditingInput = ( new RawContextKey("chatSessionCurrentlyEditingInput", false, {
        type: "boolean",
        description: ( localize(6254, "True when the current request input at the bottom is being edited."))
    }));
    (function(EditingRequestType) {
        EditingRequestType["Sent"] = "s";
        EditingRequestType["QueueOrSteer"] = "qs";
    })(
        ChatContextKeys.EditingRequestType || (ChatContextKeys.EditingRequestType = {})
    );
    ChatContextKeys.editingRequestType = ( new RawContextKey("chatEditingSentRequest", undefined, {
        type: "string",
        description: ( localize(6255, "The type of the current editing request."))
    }));
    ChatContextKeys.isResponse = ( new RawContextKey("chatResponse", false, {
        type: "boolean",
        description: ( localize(6256, "The chat item is a response."))
    }));
    ChatContextKeys.isRequest = ( new RawContextKey("chatRequest", false, {
        type: "boolean",
        description: ( localize(6257, "The chat item is a request"))
    }));
    ChatContextKeys.isPendingRequest = ( new RawContextKey("chatRequestIsPending", false, {
        type: "boolean",
        description: ( localize(6258, "True when the chat request item is pending in the queue."))
    }));
    ChatContextKeys.itemId = ( new RawContextKey("chatItemId", "", {
        type: "string",
        description: ( localize(6259, "The id of the chat item."))
    }));
    ChatContextKeys.lastItemId = ( new RawContextKey("chatLastItemId", [], {
        type: "string",
        description: ( localize(6260, "The id of the last chat item."))
    }));
    ChatContextKeys.editApplied = ( new RawContextKey("chatEditApplied", false, {
        type: "boolean",
        description: ( localize(6261, "True when the chat text edits have been applied."))
    }));
    ChatContextKeys.inputHasText = ( new RawContextKey("chatInputHasText", false, {
        type: "boolean",
        description: ( localize(6262, "True when the chat input has text."))
    }));
    ChatContextKeys.inputHasFocus = ( new RawContextKey("chatInputHasFocus", false, {
        type: "boolean",
        description: ( localize(6263, "True when the chat input has focus."))
    }));
    ChatContextKeys.inChatInput = ( new RawContextKey("inChatInput", false, {
        type: "boolean",
        description: ( localize(6264, "True when focus is in the chat input, false otherwise."))
    }));
    ChatContextKeys.inChatSession = ( new RawContextKey("inChat", false, {
        type: "boolean",
        description: ( localize(6265, "True when focus is in the chat widget, false otherwise."))
    }));
    ChatContextKeys.inChatEditor = ( new RawContextKey("inChatEditor", false, {
        type: "boolean",
        description: ( localize(6266, "Whether focus is in a chat editor."))
    }));
    ChatContextKeys.inChatTerminalToolOutput = ( new RawContextKey("inChatTerminalToolOutput", false, {
        type: "boolean",
        description: ( localize(6267, "True when focus is in the chat terminal output region."))
    }));
    ChatContextKeys.chatModeKind = ( new RawContextKey("chatAgentKind", ChatModeKind.Ask, {
        type: "string",
        description: ( localize(6268, "The 'kind' of the current agent."))
    }));
    ChatContextKeys.chatModeName = ( new RawContextKey("chatModeName", "", {
        type: "string",
        description: ( localize(6269, "The name of the current chat mode (e.g. 'Plan' for custom modes)."))
    }));
    ChatContextKeys.supported = ( ContextKeyExpr.or(( IsWebContext.negate()), ( RemoteNameContext.notEqualsTo("")), ( ContextKeyExpr.has("config.chat.experimental.serverlessWebEnabled"))));
    ChatContextKeys.enabled = ( new RawContextKey("chatIsEnabled", false, {
        type: "boolean",
        description: ( localize(
            6270,
            "True when chat is enabled because a default chat participant is activated with an implementation."
        ))
    }));
    ChatContextKeys.lockedToCodingAgent = ( new RawContextKey("lockedToCodingAgent", false, {
        type: "boolean",
        description: ( localize(6271, "True when the chat widget is locked to the coding agent session."))
    }));
    ChatContextKeys.chatSessionHasCustomAgentTarget = ( new RawContextKey("chatSessionHasCustomAgentTarget", false, {
        type: "boolean",
        description: ( localize(
            6272,
            "True when the chat session has a customAgentTarget defined to filter modes."
        ))
    }));
    ChatContextKeys.agentSupportsAttachments = ( new RawContextKey("agentSupportsAttachments", false, {
        type: "boolean",
        description: ( localize(6273, "True when the chat agent supports attachments."))
    }));
    ChatContextKeys.withinEditSessionDiff = ( new RawContextKey("withinEditSessionDiff", false, {
        type: "boolean",
        description: ( localize(6274, "True when the chat widget dispatches to the edit session chat."))
    }));
    ChatContextKeys.filePartOfEditSession = ( new RawContextKey("filePartOfEditSession", false, {
        type: "boolean",
        description: ( localize(6275, "True when the chat widget is within a file with an edit session."))
    }));
    ChatContextKeys.extensionParticipantRegistered = ( new RawContextKey("chatPanelExtensionParticipantRegistered", false, {
        type: "boolean",
        description: ( localize(
            6276,
            "True when a default chat participant is registered for the panel from an extension."
        ))
    }));
    ChatContextKeys.panelParticipantRegistered = ( new RawContextKey("chatPanelParticipantRegistered", false, {
        type: "boolean",
        description: ( localize(6277, "True when a default chat participant is registered for the panel."))
    }));
    ChatContextKeys.chatEditingCanUndo = ( new RawContextKey("chatEditingCanUndo", false, {
        type: "boolean",
        description: ( localize(
            6278,
            "True when it is possible to undo an interaction in the editing panel."
        ))
    }));
    ChatContextKeys.chatEditingCanRedo = ( new RawContextKey("chatEditingCanRedo", false, {
        type: "boolean",
        description: ( localize(
            6279,
            "True when it is possible to redo an interaction in the editing panel."
        ))
    }));
    ChatContextKeys.languageModelsAreUserSelectable = ( new RawContextKey("chatModelsAreUserSelectable", false, {
        type: "boolean",
        description: ( localize(6280, "True when the chat model can be selected manually by the user."))
    }));
    ChatContextKeys.chatSessionHasModels = ( new RawContextKey("chatSessionHasModels", false, {
        type: "boolean",
        description: ( localize(
            6281,
            "True when the chat is in a contributed chat session that has available 'models' to display."
        ))
    }));
    ChatContextKeys.chatSessionOptionsValid = ( new RawContextKey("chatSessionOptionsValid", true, {
        type: "boolean",
        description: ( localize(
            6282,
            "True when all selected session options exist in their respective option group items."
        ))
    }));
    ChatContextKeys.extensionInvalid = ( new RawContextKey("chatExtensionInvalid", false, {
        type: "boolean",
        description: ( localize(
            6283,
            "True when the installed chat extension is invalid and needs to be updated."
        ))
    }));
    ChatContextKeys.inputCursorAtTop = ( new RawContextKey("chatCursorAtTop", false));
    ChatContextKeys.inputHasAgent = ( new RawContextKey("chatInputHasAgent", false));
    ChatContextKeys.location = ( new RawContextKey("chatLocation", undefined));
    ChatContextKeys.inQuickChat = ( new RawContextKey("quickChatHasFocus", false, {
        type: "boolean",
        description: ( localize(6284, "True when the quick chat UI has focus, false otherwise."))
    }));
    ChatContextKeys.inAgentSessionsWelcome = ( new RawContextKey("inAgentSessionsWelcome", false, {
        type: "boolean",
        description: ( localize(
            6285,
            "True when the chat input is within the agent sessions welcome page."
        ))
    }));
    ChatContextKeys.chatSessionType = ( new RawContextKey("chatSessionType", "", {
        type: "string",
        description: ( localize(6286, "The type of the current chat session."))
    }));
    ChatContextKeys.hasFileAttachments = ( new RawContextKey("chatHasFileAttachments", false, {
        type: "boolean",
        description: ( localize(6287, "True when the chat has file attachments."))
    }));
    ChatContextKeys.chatSessionIsEmpty = ( new RawContextKey("chatSessionIsEmpty", true, {
        type: "boolean",
        description: ( localize(6288, "True when the current chat session has no requests."))
    }));
    ChatContextKeys.hasPendingRequests = ( new RawContextKey("chatHasPendingRequests", false, {
        type: "boolean",
        description: ( localize(6289, "True when there are pending requests in the queue."))
    }));
    ChatContextKeys.remoteJobCreating = ( new RawContextKey("chatRemoteJobCreating", false, {
        type: "boolean",
        description: ( localize(6290, "True when a remote coding agent job is being created."))
    }));
    ChatContextKeys.hasRemoteCodingAgent = ( new RawContextKey("hasRemoteCodingAgent", false, ( localize(6291, "Whether any remote coding agent is available"))));
    ChatContextKeys.hasCanDelegateProviders = ( new RawContextKey("chatHasCanDelegateProviders", false, {
        type: "boolean",
        description: ( localize(
            6292,
            "True when there are chat session providers with delegation support available."
        ))
    }));
    ChatContextKeys.enableRemoteCodingAgentPromptFileOverlay = ( new RawContextKey("enableRemoteCodingAgentPromptFileOverlay", false, ( localize(
        6293,
        "Whether the remote coding agent prompt file overlay feature is enabled"
    ))));
    ChatContextKeys.skipChatRequestInProgressMessage = ( new RawContextKey("chatSkipRequestInProgressMessage", false, {
        type: "boolean",
        description: ( localize(6294, "True when the chat request in progress message should be skipped."))
    }));
    ChatContextKeys.Setup = ChatEntitlementContextKeys.Setup;
    ChatContextKeys.Entitlement = ChatEntitlementContextKeys.Entitlement;
    ChatContextKeys.chatQuotaExceeded = ChatEntitlementContextKeys.chatQuotaExceeded;
    ChatContextKeys.completionsQuotaExceeded = ChatEntitlementContextKeys.completionsQuotaExceeded;
    ChatContextKeys.Editing = {
        hasToolConfirmation: ( new RawContextKey("chatHasToolConfirmation", false, {
            type: "boolean",
            description: ( localize(6295, "True when a tool confirmation is present."))
        })),
        hasElicitationRequest: ( new RawContextKey("chatHasElicitationRequest", false, {
            type: "boolean",
            description: ( localize(6296, "True when a chat elicitation request is pending."))
        }))
    };
    ChatContextKeys.Tools = {
        toolsCount: ( new RawContextKey("toolsCount", 0, {
            type: "number",
            description: ( localize(6297, "The count of tools available in the chat."))
        }))
    };
    ChatContextKeys.Modes = {
        hasCustomChatModes: ( new RawContextKey("chatHasCustomAgents", false, {
            type: "boolean",
            description: ( localize(6298, "True when the chat has custom agents available."))
        })),
        agentModeDisabledByPolicy: ( new RawContextKey("chatAgentModeDisabledByPolicy", false, {
            type: "boolean",
            description: ( localize(6299, "True when agent mode is disabled by organization policy."))
        }))
    };
    ChatContextKeys.panelLocation = ( new RawContextKey("chatPanelLocation", undefined, {
        type: "number",
        description: ( localize(6300, "The location of the chat panel."))
    }));
    ChatContextKeys.agentSessionsViewerFocused = ( new RawContextKey("agentSessionsViewerFocused", true, {
        type: "boolean",
        description: ( localize(6301, "If the agent sessions view in the chat view is focused."))
    }));
    ChatContextKeys.agentSessionsViewerOrientation = ( new RawContextKey("agentSessionsViewerOrientation", undefined, {
        type: "number",
        description: ( localize(6302, "Orientation of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionsViewerPosition = ( new RawContextKey("agentSessionsViewerPosition", undefined, {
        type: "number",
        description: ( localize(6303, "Position of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionsViewerVisible = ( new RawContextKey("agentSessionsViewerVisible", undefined, {
        type: "boolean",
        description: ( localize(6304, "Visibility of the agent sessions view in the chat view."))
    }));
    ChatContextKeys.agentSessionType = ( new RawContextKey("chatSessionType", "", {
        type: "string",
        description: ( localize(6305, "The type of the current agent session item."))
    }));
    ChatContextKeys.agentSessionSection = ( new RawContextKey("agentSessionSection", "", {
        type: "string",
        description: ( localize(6306, "The section of the current agent session section item."))
    }));
    ChatContextKeys.isArchivedAgentSession = ( new RawContextKey("agentSessionIsArchived", false, {
        type: "boolean",
        description: ( localize(6307, "True when the agent session item is archived."))
    }));
    ChatContextKeys.isReadAgentSession = ( new RawContextKey("agentSessionIsRead", false, {
        type: "boolean",
        description: ( localize(6308, "True when the agent session item is read."))
    }));
    ChatContextKeys.hasMultipleAgentSessionsSelected = ( new RawContextKey("agentSessionHasMultipleSelected", false, {
        type: "boolean",
        description: ( localize(6309, "True when multiple agent sessions are selected."))
    }));
    ChatContextKeys.hasAgentSessionChanges = ( new RawContextKey("agentSessionHasChanges", false, {
        type: "boolean",
        description: ( localize(6310, "True when the current agent session item has changes."))
    }));
    ChatContextKeys.isKatexMathElement = ( new RawContextKey("chatIsKatexMathElement", false, {
        type: "boolean",
        description: ( localize(6311, "True when focusing a KaTeX math element."))
    }));
})(ChatContextKeys || (ChatContextKeys = {}));
var ChatContextKeyExprs;
(function(ChatContextKeyExprs) {
    ChatContextKeyExprs.inEditingMode = ( ContextKeyExpr.or(( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Edit)), ( ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Agent))));
    ChatContextKeyExprs.chatSetupTriggerContext = ( ContextKeyExpr.or(( ChatContextKeys.Setup.installed.negate()), ChatContextKeys.Entitlement.canSignUp));
})(ChatContextKeyExprs || (ChatContextKeyExprs = {}));

export { ChatContextKeyExprs, ChatContextKeys };
