"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, /**
 * @param {CopyPaste} copyPastePlugin The plugin instance.
 * @returns {object}
 */ "default", {
    enumerable: true,
    get: function() {
        return copyColumnHeadersOnlyItem;
    }
});
const _constants = require("../../../i18n/constants");
const _number = require("../../../helpers/number");
function copyColumnHeadersOnlyItem(copyPastePlugin) {
    return {
        key: 'copy_column_headers_only',
        name () {
            const activeSelectedRange = this.getSelectedRangeActive();
            const nounForm = activeSelectedRange ? (0, _number.clamp)(activeSelectedRange.getWidth() - 1, 0, 1) : 0;
            return this.getTranslatedPhrase(_constants.CONTEXTMENU_ITEMS_COPY_COLUMN_HEADERS_ONLY, nounForm);
        },
        callback () {
            copyPastePlugin.copyColumnHeadersOnly();
        },
        disabled () {
            if (!this.hasColHeaders()) {
                return true;
            }
            const range = this.getSelectedRangeActive();
            if (!range) {
                return true;
            }
            if (range.isSingleHeader()) {
                return true;
            }
            const selected = this.getSelected();
            // Disable for no selection or for non-contiguous selection.
            if (!selected || selected.length > 1) {
                return true;
            }
            return false;
        },
        hidden: false
    };
}
