// #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 { AutoCompleteable } from '../../../Behaviors/AutoCompleteable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { CustomElement } from '../../Abstracts/CustomElement';
import { autoCompleteBoxElementTemplate } from './AutoCompleteBoxElementTemplate';
import { autoCompleteBoxElementJoyStyle } from './Themes/AutoCompleteBoxElement.Joy';
import { autoCompleteBoxElementRetroStyle } from './Themes/AutoCompleteBoxElement.Retro';
import { autoCompleteBoxElementCosmopolitanStyle } from './Themes/AutoCompleteBoxElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * The `{@link AutoCompleteBoxElement}` element.
 *
 * @public
 */
let AutoCompleteBoxElement = class AutoCompleteBoxElement extends Themeable(AutoCompleteable(CustomElement)) {
    // #region Fields
    _text = '';
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
    }
    // #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-autocompletebox';
    }
    /**
     * Gets or sets the `text` property.
     *
     * @public
     * @attr
     */
    get text() {
        return this._text;
    }
    set text(value) {
        if (this._text !== value) {
            this._text = value;
            this.requestUpdate('text');
        }
    }
    // #endregion
    // #region Methods
    onInput(e) {
        const input = e.target.value;
        this.text = input;
        this.updateSearchText(input);
    }
    onSelectCallback(item) {
        this.text = this.getDisplayValue(item);
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], AutoCompleteBoxElement.prototype, "text", null);
AutoCompleteBoxElement = __decorate([
    Component({
        selector: 'mosaik-autocompletebox',
        template: autoCompleteBoxElementTemplate,
        themes: {
            joy: autoCompleteBoxElementJoyStyle,
            retro: autoCompleteBoxElementRetroStyle,
            cosmopolitan: autoCompleteBoxElementCosmopolitanStyle
        },
        options: {
            mode: 'open',
            delegatesFocus: true
        },
        imports: []
    }),
    __metadata("design:paramtypes", [])
], AutoCompleteBoxElement);
export { AutoCompleteBoxElement };
//# sourceMappingURL=AutoCompleteBoxElement.js.map