// #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 { Slottable } from '../../../Behaviors/Slottable';
import { Themeable } from '../../../Behaviors/Themeable';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { titleLayoutElementCosmopolitanStyle } from './Themes/TitleLayoutElement.Cosmopolitan';
import { titleLayoutElementJoyStyle } from './Themes/TitleLayoutElement.Joy';
import { titleLayoutElementMemphisStyle } from './Themes/TitleLayoutElement.Memphis';
import { titleLayoutElementTemplate } from './TitleLayoutElementTemplate';
// #endregion
/**
 * The `TitleLayoutElement` element.
 *
 * @element mosaik-title-layout
 * @category Layout
 *
 * @slot start - The start slot.
 * @slot - The default slot.
 * @slot end - The end slot.
 *
 * @example
 * Title layout with slotted start, center, and end content:
 * ```html
 * <mosaik-title-layout>
 *   <mosaik-button slot="start"></mosaik-button>
 *   <span>Page Title</span>
 *   <mosaik-button slot="end"></mosaik-button>
 * </mosaik-title-layout>
 * ```
 *
 * @public
 */
let TitleLayoutElement = class TitleLayoutElement extends Themeable(Slottable(CustomElement)) {
    // #region Fields
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     * The `is` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-title-layout';
    }
    /**
     * @public
     * @override
     */
    onSlotChanges(slotName) {
        super.onSlotChanges(slotName);
        void this.updateComplete.then(() => {
            this.adjustSizes();
        });
    }
    /**
     * @private
     */
    adjustSizes() {
        const start = this.getTemplatePart('start');
        const end = this.getTemplatePart('end');
        const startWidth = start.offsetWidth;
        const endWidth = end.offsetWidth;
        if (startWidth > endWidth) {
            end.style.minWidth = `${startWidth}px`;
        }
        else if (endWidth > startWidth) {
            start.style.minWidth = `${endWidth}px`;
        }
        else {
            start.style.minWidth = '';
            end.style.minWidth = '';
        }
    }
};
TitleLayoutElement = __decorate([
    Component({
        selector: 'mosaik-title-layout',
        template: titleLayoutElementTemplate,
        themes: {
            joy: titleLayoutElementJoyStyle,
            memphis: titleLayoutElementMemphisStyle,
            cosmopolitan: titleLayoutElementCosmopolitanStyle
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], TitleLayoutElement);
export { TitleLayoutElement };
//# sourceMappingURL=TitleLayoutElement.js.map