import { RIBBON_ID } from '../ribbon-base/ribbon-constants';
import { RibbonItemSize } from '@syncfusion/ej2-ribbon';
import { LineSpacingHelper } from '../../helper/line-spacing-helper';
// Line spacing constants
export var LINE_SPACING_ID = '_line_spacing';
/**
 * LineSpacingGroup class for handling line spacing operations in Document Editor ribbon
 * @private
 */
var LineSpacingGroup = /** @class */ (function () {
    /**
     * Constructor for LineSpacingGroup
     * @param {DocumentEditorContainer} container - DocumentEditorContainer instance
     */
    function LineSpacingGroup(container) {
        // Property to track the last applied line spacing value
        this.appliedLineSpacing = '1';
        this.container = container;
        this.ribbonId = this.container.element.id + RIBBON_ID;
        this.localObj = this.container.localObj;
    }
    Object.defineProperty(LineSpacingGroup.prototype, "documentEditor", {
        get: function () {
            return this.container.documentEditor;
        },
        enumerable: true,
        configurable: true
    });
    /**
     * Get the line spacing dropdown item configuration
     * @returns {RibbonItemModel} - Line spacing dropdown item configuration
     * @private
     */
    LineSpacingGroup.prototype.getLineSpacingItem = function () {
        var _this = this;
        var id = this.ribbonId;
        return {
            type: 'DropDown',
            keyTip: 'K',
            allowedSizes: RibbonItemSize.Small,
            dropDownSettings: {
                iconCss: 'e-de-ctnr-linespacing e-icons',
                content: this.localObj.getConstant('Line spacing'),
                items: LineSpacingHelper.getLineSpacingItems(this.localObj),
                select: function (args) {
                    _this.lineSpacingAction(args);
                },
                beforeItemRender: function (args) {
                    LineSpacingHelper.customizeLineSpacingItem(args, _this.appliedLineSpacing);
                }
            },
            id: id + LINE_SPACING_ID,
            ribbonTooltipSettings: { content: this.localObj.getConstant('Line spacing') }
        };
    };
    /**
     * Set the line spacing based on current paragraph format
     * @returns {void}
     * @private
     */
    LineSpacingGroup.prototype.setLineSpacing = function () {
        this.appliedLineSpacing = LineSpacingHelper.getCurrentLineSpacing(this.documentEditor, this.localObj);
    };
    LineSpacingGroup.prototype.lineSpacingAction = function (args) {
        var appliedSpacing = { value: this.appliedLineSpacing };
        LineSpacingHelper.applyLineSpacing(this.documentEditor, args.item.text, appliedSpacing, this.localObj);
        this.appliedLineSpacing = appliedSpacing.value;
    };
    return LineSpacingGroup;
}());
export { LineSpacingGroup };
