import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
import { $ } from '../../../../../base/browser/dom.js';
import { Event } from '../../../../../base/common/event.js';
import { Disposable } from '../../../../../base/common/lifecycle.js';
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { ChatProgressContentPart } from './chatProgressContentPart.js';
import { ChatReferencesContentPart } from './chatReferencesContentPart.js';
let ChatTaskContentPart = class ChatTaskContentPart extends Disposable {
    constructor(task, contentReferencesListPool, renderer, context, instantiationService) {
        super();
        this.task = task;
        if (task.progress.length) {
            const refsPart = this._register(instantiationService.createInstance(ChatReferencesContentPart, task.progress, task.content.value, context.element, contentReferencesListPool));
            this.domNode = $('.chat-progress-task');
            this.domNode.appendChild(refsPart.domNode);
            this.onDidChangeHeight = refsPart.onDidChangeHeight;
        }
        else {
            const isSettled = task.isSettled?.() ?? true;
            const progressPart = this._register(instantiationService.createInstance(ChatProgressContentPart, task, renderer, context, !isSettled, true));
            this.domNode = progressPart.domNode;
            this.onDidChangeHeight = Event.None;
        }
    }
    hasSameContent(other) {
        return other.kind === 'progressTask'
            && other.progress.length === this.task.progress.length
            && other.isSettled() === this.task.isSettled();
    }
    addDisposable(disposable) {
        this._register(disposable);
    }
};
ChatTaskContentPart = ( __decorate([
    ( __param(4, IInstantiationService))
], ChatTaskContentPart));
export { ChatTaskContentPart };
