var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import { ItemOrientation } from '@syncfusion/ej2-ribbon';
import { RibbonGroupBase } from '../ribbon-interfaces';
// Constants for IDs
export var INSERT_FOOTNOTE_BUTTON_ID = '_insert_footnote';
export var INSERT_ENDNOTE_BUTTON_ID = '_insert_endnote';
/**
 * Footnotes group implementation for Reference tab
 * @private
 */
var FootnotesGroup = /** @class */ (function (_super) {
    __extends(FootnotesGroup, _super);
    /**
     * Constructor for FootnotesGroup
     * @param {DocumentEditorContainer} container - DocumentEditorContainer instance
     */
    function FootnotesGroup(container) {
        return _super.call(this, container) || this;
    }
    /**
     * Get the Ribbon items for Footnotes group
     * @returns {RibbonGroupModel} - Ribbon group model
     */
    FootnotesGroup.prototype.getGroupModel = function () {
        return {
            header: this.localObj.getConstant('Footnotes'),
            orientation: ItemOrientation.Row,
            enableGroupOverflow: true,
            overflowHeader: this.localObj.getConstant('Footnotes'),
            collections: [
                {
                    items: [
                        {
                            type: 'Button',
                            keyTip: 'RF',
                            buttonSettings: {
                                content: this.localObj.getConstant('Insert Footnote'),
                                iconCss: 'e-icons e-de-footnote',
                                clicked: this.insertFootnoteHandler.bind(this)
                            },
                            id: this.ribbonId + INSERT_FOOTNOTE_BUTTON_ID,
                            ribbonTooltipSettings: {
                                // title: this.localObj.getConstant('Insert Footnote'),
                                content: this.localObj.getConstant('Footnote Tooltip')
                            }
                        },
                        {
                            type: 'Button',
                            keyTip: 'RE',
                            buttonSettings: {
                                content: this.localObj.getConstant('Insert Endnote'),
                                iconCss: 'e-icons e-de-endnote',
                                clicked: this.insertEndnoteHandler.bind(this)
                            },
                            id: this.ribbonId + INSERT_ENDNOTE_BUTTON_ID,
                            ribbonTooltipSettings: {
                                // title: this.localObj.getConstant('Insert Endnote'),
                                content: this.localObj.getConstant('Endnote Tooltip')
                            }
                        }
                    ]
                }
            ]
        };
    };
    /**
     * Insert Footnote handler
     * @returns {void}
     */
    FootnotesGroup.prototype.insertFootnoteHandler = function () {
        this.documentEditor.editorModule.insertFootnote();
    };
    /**
     * Insert Endnote handler
     * @returns {void}
     */
    FootnotesGroup.prototype.insertEndnoteHandler = function () {
        this.documentEditor.editorModule.insertEndnote();
    };
    /**
     * Update UI based on selection state
     * @returns {void}
     * @private
     */
    FootnotesGroup.prototype.updateSelection = function () {
        var footnoteButton = this.container.ribbon.ribbon.getItem(this.ribbonId + INSERT_FOOTNOTE_BUTTON_ID);
        var endnoteButton = this.container.ribbon.ribbon.getItem(this.ribbonId + INSERT_ENDNOTE_BUTTON_ID);
        if (footnoteButton && endnoteButton) {
            var isPlainContentControl = this.documentEditor.selectionModule.isPlainContentControl();
            var disableButtons = this.documentEditor.selectionModule.isinFootnote ||
                this.documentEditor.selectionModule.isinEndnote ||
                this.documentEditor.enableHeaderAndFooter ||
                isPlainContentControl;
            var ribbon = this.container.ribbon.ribbon;
            if (disableButtons) {
                ribbon.disableItem(this.ribbonId + INSERT_FOOTNOTE_BUTTON_ID);
                ribbon.disableItem(this.ribbonId + INSERT_ENDNOTE_BUTTON_ID);
            }
            else {
                ribbon.enableItem(this.ribbonId + INSERT_FOOTNOTE_BUTTON_ID);
                ribbon.enableItem(this.ribbonId + INSERT_ENDNOTE_BUTTON_ID);
            }
        }
    };
    return FootnotesGroup;
}(RibbonGroupBase));
export { FootnotesGroup };
