// #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 { TextFormattable } from '../../../Behaviors/TextFormattable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { MessageBoxButtons } from '../../../Types/MessageBoxButtons';
import { ButtonElement } from '../../Buttons/Button/ButtonElement';
import { IconElement } from '../../Media/Icon/IconElement';
import { BackdropElement } from '../../Primitives/Backdrop/BackdropElement';
import { ElevationElement } from '../../Primitives/Elevation/ElevationElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { DialogElement } from '../Dialog/DialogElement';
import { MessageBoxElementIntl } from './MessageBoxElementIntl';
import { messageBoxElementTemplate } from './MessageBoxElementTemplate';
import { messageBoxElementCosmopolitanStyle } from './Themes/MessageBoxElement.Cosmopolitan';
import { messageBoxElementJoyStyle } from './Themes/MessageBoxElement.Joy';
import { messageBoxElementMemphisStyle } from './Themes/MessageBoxElement.Memphis';
// #endregion
/**
 * MessageBox - A modal dialog that presents information and prompts for a user response.
 *
 * @description
 * Displays alerts, confirmations, or informational prompts. The set of displayed buttons
 * is controlled by the `buttons` attribute (the only HTML-reflected property).
 * Header, message, icon, and labels must be set via JavaScript.
 *
 * @name MessageBox
 * @element mosaik-message-box
 * @category Overlays
 *
 * @csspart actionCancel - The cancel action button.
 * @csspart actionNo - The no action button.
 * @csspart actionOk - The ok action button.
 * @csspart actions - The actions container.
 * @csspart actionYes - The yes action button.
 * @csspart backdrop - The semi-transparent overlay backdrop.
 * @csspart content - The content area with icon and message.
 * @csspart elevation - The elevation shadow layer.
 * @csspart header - The header section with title and subtitle.
 * @csspart headerText - The header title text.
 * @csspart icon - The message icon.
 * @csspart message - The message text.
 * @csspart root - The root dialog element.
 * @csspart subHeaderText - The header subtitle text.
 *
 * @cssprop {String} --message-box-background-color - The box background color CSS custom property.
 * @cssprop {String} --message-box-border-color - The box border color CSS custom property.
 * @cssprop {String} --message-box-border-radius - The box border radius CSS custom property.
 * @cssprop {String} --message-box-border-style - The box border style CSS custom property.
 * @cssprop {String} --message-box-border-width - The box border width CSS custom property.
 * @cssprop {String} --message-box-divider-height - The box divider height CSS custom property.
 * @cssprop {String} --message-box-font-family - The box font family CSS custom property.
 * @cssprop {String} --message-box-font-letter-spacing - The box font letter spacing CSS custom property.
 * @cssprop {String} --message-box-font-line-height - The box font line height CSS custom property.
 * @cssprop {String} --message-box-font-size - The box font size CSS custom property.
 * @cssprop {String} --message-box-font-text-decoration - The box font text decoration CSS custom property.
 * @cssprop {String} --message-box-font-text-transform - The box font text transform CSS custom property.
 * @cssprop {String} --message-box-font-weight - The box font weight CSS custom property.
 * @cssprop {String} --message-box-foreground-color - The box foreground color CSS custom property.
 * @cssprop {String} --message-box-gap - The box gap CSS custom property.
 * @cssprop {String} --message-box-header-font-family - The box header font family CSS custom property.
 * @cssprop {String} --message-box-header-font-letter-spacing - The box header font letter spacing CSS custom property.
 * @cssprop {String} --message-box-header-font-line-height - The box header font line height CSS custom property.
 * @cssprop {String} --message-box-header-font-size - The box header font size CSS custom property.
 * @cssprop {String} --message-box-header-font-text-decoration - The box header font text decoration CSS custom property.
 * @cssprop {String} --message-box-header-font-text-transform - The box header font text transform CSS custom property.
 * @cssprop {String} --message-box-header-font-weight - The box header font weight CSS custom property.
 * @cssprop {String} --message-box-header-foreground-color - The box header foreground color CSS custom property.
 * @cssprop {String} --message-box-padding-bottom - The box padding bottom CSS custom property.
 * @cssprop {String} --message-box-padding-left - The box padding left CSS custom property.
 * @cssprop {String} --message-box-padding-right - The box padding right CSS custom property.
 * @cssprop {String} --message-box-padding-top - The box padding top CSS custom property.
 * @cssprop {String} --message-box-shadow - The box shadow CSS custom property.
 * @cssprop {String} --message-box-shadow-blur - The box shadow blur CSS custom property.
 * @cssprop {String} --message-box-shadow-color - The box shadow color CSS custom property.
 * @cssprop {String} --message-box-shadow-offset-x - The box shadow offset x CSS custom property.
 * @cssprop {String} --message-box-shadow-offset-y - The box shadow offset y CSS custom property.
 * @cssprop {String} --message-box-shadow-spread - The box shadow spread CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-family - The box sub header font family CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-letter-spacing - The box sub header font letter spacing CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-line-height - The box sub header font line height CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-size - The box sub header font size CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-text-decoration - The box sub header font text decoration CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-text-transform - The box sub header font text transform CSS custom property.
 * @cssprop {String} --message-box-sub-header-font-weight - The box sub header font weight CSS custom property.
 * @cssprop {String} --message-box-sub-header-foreground-color - The box sub header foreground color CSS custom property.
 * @cssprop {String} --message-box-transition-duration - The box transition duration CSS custom property.
 * @cssprop {String} --message-box-transition-mode - The box transition mode CSS custom property.
 * @cssprop {String} --message-box-transition-property - The box transition property CSS custom property.
 * @cssprop {String} --message-box-translate - The box translate CSS custom property.
 *
 * @dependency mosaik-backdrop - The Backdrop element.
 * @dependency mosaik-button - The Button element.
 * @dependency mosaik-elevation - The Elevation element.
 * @dependency mosaik-icon - The Icon element.
 * @dependency mosaik-text - The Text element.
 *
 * @example
 * Confirmation message box with Yes/No buttons:
 * ```html
 * <mosaik-message-box buttons="yesNo"></mosaik-message-box>
 * ```
 *
 * @example
 * Alert message box with OK button:
 * ```html
 * <mosaik-message-box buttons="ok"></mosaik-message-box>
 * ```
 *
 * @public
 */
let MessageBoxElement = class MessageBoxElement extends TextFormattable(Variantable(DialogElement)) {
    // #region Fields
    _intlController;
    _header;
    _subHeader;
    _message;
    _buttons;
    _icon;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._intlController = new IntlController(this, {
            factory: () => new MessageBoxElementIntl()
        });
        this._header = '';
        this._subHeader = '';
        this._message = '';
        this._buttons = MessageBoxButtons.OK;
        this._icon = '';
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-message-box';
    }
    /**
     * Gets or sets the `header` property.
     *
     * @public
     */
    get header() {
        return this._header;
    }
    set header(value) {
        if (this._header !== value) {
            this._header = value;
            this.requestUpdate('header');
        }
    }
    /**
     * Gets or sets the `subHeader` property.
     *
     * @public
     */
    get subHeader() {
        return this._subHeader;
    }
    set subHeader(value) {
        if (this._subHeader !== value) {
            this._subHeader = value;
            this.requestUpdate('subHeader');
        }
    }
    /**
     * Gets or sets the `message` property.
     *
     * @public
     */
    get message() {
        return this._message;
    }
    set message(value) {
        if (this._message !== value) {
            this._message = value;
            this.requestUpdate('message');
        }
    }
    /**
     * Gets or sets the `buttons` property.
     *
     * @public
     * @attr
     */
    get buttons() {
        return this._buttons;
    }
    set buttons(value) {
        if (this._buttons !== value) {
            this._buttons = value;
            this.requestUpdate('buttons');
        }
    }
    /**
     * Gets or sets the `icon` property.
     *
     * @public
     */
    get icon() {
        return this._icon;
    }
    set icon(value) {
        if (this._icon !== value) {
            this._icon = value;
            this.requestUpdate('icon');
        }
    }
    /**
     * Returns the `intl` property.
     *
     * @public
     * @readonly
     */
    get intl() {
        return this._intlController.intl;
    }
    // #endregion
    // #region Methods
    /**
     * Handles the `isOpen` property change.
     * Ensures the native dialog element is shown or hidden.
     *
     * @protected
     */
    onIsOpenPropertyChanged(_prev, next) {
        super.onIsOpenPropertyChanged(_prev, next);
    }
    /**
     * @private
     * @template
     */
    onDialogResult(result) {
        this.emit(new CustomEvent('dialogResult'), { detail: result });
        void this.close();
    }
};
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], MessageBoxElement.prototype, "header", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], MessageBoxElement.prototype, "subHeader", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], MessageBoxElement.prototype, "message", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], MessageBoxElement.prototype, "buttons", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], MessageBoxElement.prototype, "icon", null);
__decorate([
    Watch('isOpen', { waitUntilFirstUpdate: true }),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Boolean, Boolean]),
    __metadata("design:returntype", void 0)
], MessageBoxElement.prototype, "onIsOpenPropertyChanged", null);
MessageBoxElement = __decorate([
    Component({
        selector: 'mosaik-message-box',
        template: messageBoxElementTemplate,
        themes: {
            joy: messageBoxElementJoyStyle,
            memphis: messageBoxElementMemphisStyle,
            cosmopolitan: messageBoxElementCosmopolitanStyle
        },
        imports: [
            BackdropElement,
            ElevationElement,
            ButtonElement,
            TextElement,
            IconElement
        ]
    }),
    __metadata("design:paramtypes", [])
], MessageBoxElement);
export { MessageBoxElement };
//# sourceMappingURL=MessageBoxElement.js.map