import { Event } from "../../../../../../base/common/event.js"; import { IMarkdownString } from "../../../../../../base/common/htmlContent.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { IAccessibilityService } from "../../../../../../platform/accessibility/common/accessibility.service.js"; import { IInstantiationService } from "../../../../../../platform/instantiation/common/instantiation.js"; import { IChatQuestionCarousel, IChatQuestionAnswerValue } from "../../../common/chatService/chatService.js"; import { IChatContentPart, IChatContentPartRenderContext } from "./chatContentParts.js"; import { IChatRendererContent } from "../../../common/model/chatViewModel.js"; import { ChatTreeItem } from "../../chat.js"; import { IHoverService } from "../../../../../../platform/hover/browser/hover.service.js"; import { IContextKeyService } from "../../../../../../platform/contextkey/common/contextkey.service.js"; import { IKeybindingService } from "../../../../../../platform/keybinding/common/keybinding.service.js"; import { ICommandService } from "../../../../../../platform/commands/common/commands.service.js"; import { IConfigurationService } from "../../../../../../platform/configuration/common/configuration.service.js"; import { ITelemetryService } from "../../../../../../platform/telemetry/common/telemetry.service.js"; import { ITerminalChatService } from "../../../../terminal/browser/terminal.service.js"; export interface IChatQuestionCarouselOptions { onSubmit: (answers: Map | undefined) => void; onDidDismiss?: (answers: ReadonlyMap) => void; dismissLabel?: string; submissionAcknowledgement?: { readonly message: string; readonly description?: IMarkdownString; readonly dismissLabel: string; readonly onDidDismiss: () => void; }; shouldAutoFocus?: boolean; shouldAutoSelectFirstOption?: boolean; /** Opt-in suppression of details identical to the displayed question heading. */ hideDuplicateDetailedMessage?: boolean; } export declare class ChatQuestionCarouselPart extends Disposable implements IChatContentPart { readonly carousel: IChatQuestionCarousel; private readonly _context; private readonly _options; private readonly _hoverService; private readonly _accessibilityService; private readonly _contextKeyService; private readonly _keybindingService; private readonly _commandService; private readonly _configurationService; private readonly _telemetryService; private readonly _terminalChatService; readonly domNode: HTMLElement; private readonly _onDidChangeHeight; readonly onDidChangeHeight: Event; private _currentIndex; private readonly _answers; private _isCollapsed; private _questionContainer; private _headerActionsContainer; private _closeButtonContainer; private _footerRow; private _stepIndicator; private _submitHint; private _submitButton; private _collapseButton; private _prevButton; private _nextButton; private _skipAllButton; private _isSkipped; private readonly _textInputBoxes; private readonly _singleSelectItems; private readonly _multiSelectCheckboxes; private readonly _freeformTextareas; private readonly _inputBoxes; private readonly _questionRenderStore; /** * Disposable store for interactive UI components (header, nav buttons, etc.) * that should be disposed when transitioning to summary view. */ private readonly _interactiveUIStore; private readonly _inChatQuestionCarouselContextKey; private readonly _chatQuestionCarouselHasTerminalContextKey; private readonly _markdownRenderer; private _validationMessageElement; private _currentValidationError; private _focusTerminalButtonContainer; constructor(carousel: IChatQuestionCarousel, _context: IChatContentPartRenderContext | undefined, _options: IChatQuestionCarouselOptions, instantiationService: IInstantiationService, _hoverService: IHoverService, _accessibilityService: IAccessibilityService, _contextKeyService: IContextKeyService, _keybindingService: IKeybindingService, _commandService: ICommandService, _configurationService: IConfigurationService, _telemetryService: ITelemetryService, _terminalChatService: ITerminalChatService); /** * Saves the current question's answer to the answers map. */ private saveCurrentAnswer; private persistDraftState; private toggleCollapsed; private _focusTerminal; private updateCollapsedPresentation; /** * Navigates the carousel by the given delta. * @param delta Negative for previous, positive for next */ private navigate; /** * Handles the next/submit behavior for keyboard and option selection flows. * Either advances to the next question or submits when on the last question. */ private handleNextOrSubmit; /** * Handles explicit submit action from the dedicated submit button. */ private submit; /** * Focuses the container element and announces the question for screen reader users. */ private _focusContainerAndAnnounce; /** * Hides the carousel UI and shows a summary of answers. */ private hideAndShowSummary; private renderSubmissionAcknowledgement; /** * Clears and disposes all interactive UI resources (header, nav buttons, input boxes, etc.) * and resets references to disposed elements. */ private clearInteractiveResources; private layoutQuestionSections; /** * Skips the carousel with default values - called when user wants to proceed quickly. * Returns defaults for all questions. * * `carousel.isUsed` covers resolution that did not come from this part: a * voice answer dismisses the carousel directly, and a later auto-skip on * request submit would otherwise overwrite the answer that actually landed * with defaults. */ skip(): boolean; /** * Ignores the carousel completely - called when user wants to dismiss without data. * Returns undefined to signal the carousel was ignored. * * Guarded on `carousel.isUsed` for the same reason as {@link skip}. */ ignore(): boolean; /** * Collects default values for all questions in the carousel. */ private getDefaultAnswers; /** * Gets the default answer for a specific question. */ private getDefaultAnswerForQuestion; /** * Returns whether auto-focus should be enabled. * Disabled when screen reader mode is active or when explicitly disabled via options. */ private _shouldAutoFocus; /** * Updates the aria-label of the carousel container based on the current question. */ private _updateAriaLabel; /** * Focuses the carousel container element. */ focus(): void; /** * Returns whether the carousel container has focus. */ hasFocus(): boolean; navigateToPreviousQuestion(): boolean; navigateToNextQuestion(): boolean; focusTerminal(): boolean; private renderCurrentQuestion; /** * Renders or updates the persistent footer with nav arrows, step indicator, and submit button. */ private renderFooter; /** * Updates the footer nav button enabled state and step indicator text. */ private updateFooterState; /** * Renders a simplified footer with just a submit button for single-question multi-select carousels. */ private renderSingleQuestionFooter; private getLabelWithKeybinding; private renderInput; /** * Sets up auto-resize behavior for a textarea element. * @returns A function that triggers the resize manually (useful for initial sizing). */ private setupTextareaAutoResize; private renderTextInput; private renderSingleSelect; private renderMultiSelect; private getCurrentAnswer; /** * Renders a terminal-state message (Skipped/Answered) when the carousel is * dismissed without structured answers. */ private renderTerminalStateMessage; /** * Renders a summary of answers when the carousel is already used. */ private renderSummary; private renderConversationSummary; private renderConversationOptions; private renderSelectedOptionState; /** * Formats an answer for display in the summary. */ private formatAnswerForSummary; private getQuestionText; /** * Validates the current question's answer against its validation rules. * Returns true if valid, false if validation errors were shown. */ private validateCurrentQuestion; /** * Validates that all required questions have been answered. * Returns true if all required fields are satisfied. */ private validateRequiredFields; /** * Returns a validation error message for the given value, or undefined if valid. */ private getValidationError; private showValidationError; private clearValidationError; hasSameContent(other: IChatRendererContent, _followingContent: IChatRendererContent[], element: ChatTreeItem): boolean; addDisposable(disposable: { dispose(): void; }): void; dispose(): void; }