
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
import { $ as $$1, append, hide, addDisposableListener, EventType } from '../../../../../../base/browser/dom.js';
import { Codicon } from '../../../../../../base/common/codicons.js';
import { ThemeIcon } from '../../../../../../base/common/themables.js';
import { localize } from '../../../../../../nls.js';
import { IKeybindingService } from '../../../../../../platform/keybinding/common/keybinding.service.js';
import { EXPAND_CELL_OUTPUT_COMMAND_ID } from '../../notebookBrowser.js';
import { CellContentPart } from '../cellPart.js';

const $ = $$1;
let CollapsedCellOutput = class CollapsedCellOutput extends CellContentPart {
    constructor(notebookEditor, cellOutputCollapseContainer, keybindingService) {
        super();
        this.notebookEditor = notebookEditor;
        const placeholder = append(cellOutputCollapseContainer, $("span.expandOutputPlaceholder"));
        placeholder.textContent = ( localize(11383, "Outputs are collapsed"));
        const expandIcon = append(cellOutputCollapseContainer, $("span.expandOutputIcon"));
        expandIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.more));
        const keybinding = keybindingService.lookupKeybinding(EXPAND_CELL_OUTPUT_COMMAND_ID);
        if (keybinding) {
            placeholder.title = ( localize(11384, "Double-click to expand cell output ({0})", keybinding.getLabel()));
            cellOutputCollapseContainer.title = ( localize(11385, "Expand Cell Output (${0})", keybinding.getLabel()));
        }
        hide(cellOutputCollapseContainer);
        this._register(
            addDisposableListener(expandIcon, EventType.CLICK, () => this.expand())
        );
        this._register(
            addDisposableListener(cellOutputCollapseContainer, EventType.DBLCLICK, () => this.expand())
        );
    }
    expand() {
        if (!this.currentCell) {
            return;
        }
        if (!this.currentCell) {
            return;
        }
        const textModel = this.notebookEditor.textModel;
        const index = textModel.cells.indexOf(this.currentCell.model);
        if (index < 0) {
            return;
        }
        this.currentCell.isOutputCollapsed = !this.currentCell.isOutputCollapsed;
    }
};
CollapsedCellOutput = ( __decorate([( __param(2, IKeybindingService))], CollapsedCellOutput));

export { CollapsedCellOutput };
