// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { IntlController } from '../../../../Intl/IntlController';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { ButtonElement } from '../../Buttons/Button/ButtonElement';
import { DividerElement } from '../../Primitives/Divider/DividerElement';
import { TooltipElement } from '../../Primitives/Tooltip/TooltipElement';
import { RichTextBoxElementIntl } from './Intl/RichTextBoxElementIntl';
import { richTextBoxToolboxElementTemplate } from './RichTextBoxToolboxElementTemplate';
import { richTextBoxToolboxElementJoyStyle } from './Themes/RichTextBoxToolboxElement.Joy';
import { richTextBoxToolboxElementMemphisStyle } from './Themes/RichTextBoxToolboxElement.Memphis';
import { richTextBoxToolboxElementCosmopolitanStyle } from './Themes/RichTextBoxToolboxElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * The `{@link RichTextBoxToolboxElement}` element.
 *
 * @public
 */
let RichTextBoxToolboxElement = class RichTextBoxToolboxElement extends Themeable(CustomElement) {
    // #region Fields
    _intl;
    _editor;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._intl = new IntlController(this, {
            factory: () => new RichTextBoxElementIntl()
        });
        this._editor = null;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-richtextbox-toolbox';
    }
    /**
     * Gets or sets the `editor` property.
     *
     * @public
     */
    get editor() {
        return this._editor;
    }
    set editor(value) {
        if (this._editor !== value) {
            this._editor = value;
            this.requestUpdate('editor');
        }
    }
    /**
     * Returns the `intl` property.
     *
     * @public
     * @readonly
     */
    get intl() {
        return this._intl.intl;
    }
    // #endregion
    // #region Methods
    /**
     * @internal
     * @template
     *
     * @param name - The toolbox action.
     */
    onAction(name) {
        switch (name) {
            case 'bold':
            case 'italic':
            case 'monospace':
            case 'strikethrough':
                console.debug(`[RichTextBoxToolboxComponent] Action ${name} was called.`);
                this._editor?.command(name);
                break;
        }
    }
};
__decorate([
    Property({ type: Object }),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [Object])
], RichTextBoxToolboxElement.prototype, "editor", null);
RichTextBoxToolboxElement = __decorate([
    Component({
        selector: 'mosaik-richtextbox-toolbox',
        template: richTextBoxToolboxElementTemplate,
        themes: {
            joy: richTextBoxToolboxElementJoyStyle,
            memphis: richTextBoxToolboxElementMemphisStyle,
            cosmopolitan: richTextBoxToolboxElementCosmopolitanStyle
        },
        imports: [
            ButtonElement,
            TooltipElement,
            DividerElement
        ]
    }),
    __metadata("design:paramtypes", [])
], RichTextBoxToolboxElement);
export { RichTextBoxToolboxElement };
//# sourceMappingURL=RichTextBoxToolboxElement.js.map