import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
import { $ as $$1 } from '../../../../../base/browser/dom.js';
import { Button } from '../../../../../base/browser/ui/button/button.js';
import { Disposable } from '../../../../../base/common/lifecycle.js';
import { localizeWithPath } from '../../../../../nls.js';
import { ICommandService } from '../../../../../platform/commands/common/commands.service.js';
import { defaultButtonStyles } from '../../../../../platform/theme/browser/defaultStyles.js';
import { isResponseVM } from '../../common/chatViewModel.js';
const _moduleId = "vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart";
const $ = $$1;
let ChatCommandButtonContentPart = class ChatCommandButtonContentPart extends Disposable {
    constructor(commandButton, context, commandService) {
        super();
        this.commandService = commandService;
        this.domNode = $('.chat-command-button');
        const enabled = !isResponseVM(context.element) || !context.element.isStale;
        const tooltip = enabled ?
            commandButton.command.tooltip :
            ( localizeWithPath(_moduleId, 0, "Button not available in restored chat"));
        const button = this._register(( (new Button(
            this.domNode,
            { ...defaultButtonStyles, supportIcons: true, title: tooltip }
        ))));
        button.label = commandButton.command.title;
        button.enabled = enabled;
        this._register(button.onDidClick(() => this.commandService.executeCommand(commandButton.command.id, ...(commandButton.command.arguments ?? []))));
    }
    hasSameContent(other) {
        return other.kind === 'command';
    }
};
ChatCommandButtonContentPart = ( (__decorate([
    ( (__param(2, ICommandService)))
], ChatCommandButtonContentPart)));
export { ChatCommandButtonContentPart };
