// #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 { DomServiceLocator } from '../../../../Dom/Dom';
import { Listen } from '../../../../Events/Decorators/ListenDecorator';
import { Disableable } from '../../../Behaviors/Disableable';
import { Focusable } from '../../../Behaviors/Focusable';
import { Labelable } from '../../../Behaviors/Labelable';
import { Valueable } from '../../../Behaviors/Valueable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { SelectionMode } from '../../../Types/SelectionMode';
import { CheckmarkElement } from '../../Primitives/Checkmark/CheckmarkElement';
import { SelectorItemElement } from '../Abstracts/Selector/SelectorItemElement';
import { comboItemElementTemplate } from './ComboItemElementTemplate';
import { comboItemElementJoyStyle } from './Themes/ComboItemElement.Joy';
import { comboItemElementRetroStyle } from './Themes/ComboItemElement.Retro';
import { comboItemElementCosmopolitanStyle } from './Themes/ComboItemElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
import { PortalProjectionElement } from '../../Primitives/Portal/PortalProjectionElement';
// #endregion
/**
 * ComboItem - An individual selectable option within a combo dropdown component.
 *
 * Represents a single choice that users can select from within a combo box dropdown.
 * Supports visual states (selected, focused, disabled) and provides value binding
 * for form integration and selection management.
 *
 * @name ComboItemElement
 * @element mosaik-combo-item
 * @category Selectors
 *
 * @slot - Default content area for the option label and description
 * @slot prefix - Leading content (icons, avatars, indicators)
 * @slot suffix - Trailing content (checkmarks, badges, secondary actions)
 *
 * @csspart container - Main container for the combo item
 * @csspart content - Content wrapper for text and elements
 * @csspart checkmark - Checkmark indicator for selected state
 *
 * @cssprop --combo-item-padding - Internal padding for the option content
 * @cssprop --combo-item-background - Background color for the option
 * @cssprop --combo-item-background-hover - Hover state background color
 * @cssprop --combo-item-background-selected - Selected state background color
 * @cssprop --combo-item-color - Text color for the option
 * @cssprop --combo-item-border-radius - Border radius for option styling
 *
 * @fires selected - Called when the element is selected.
 * @fires unselected - Called when the element is unselected.
 *
 * @dependency ComboElement - Parent combo component that manages the dropdown and selection
 * @dependency CheckmarkElement - For indicating selected state in the option
 *
 * @example
 * ```html
 * <!-- Simple text option -->
 * <mosaik-combo-item value="option1">Option 1</mosaik-combo-item>
 *
 * <!-- Option with icon -->
 * <mosaik-combo-item value="javascript">
 *   <mosaik-icon slot="prefix" data="logo-javascript"></mosaik-icon>
 *   JavaScript
 * </mosaik-combo-item>
 *
 * <!-- Option with description -->
 * <mosaik-combo-item value="premium">
 *   Premium Plan
 *   <mosaik-text slot="suffix" variant="caption">$29/month</mosaik-text>
 * </mosaik-combo-item>
 *
 * <!-- User selection option -->
 * <mosaik-combo-item value="user123">
 *   <mosaik-avatar slot="prefix" src="user.jpg"></mosaik-avatar>
 *   John Smith
 *   <mosaik-text slot="suffix" variant="caption">john.smith@company.com</mosaik-text>
 * </mosaik-combo-item>
 *
 * <!-- Disabled option -->
 * <mosaik-combo-item value="unavailable" disabled="true">
 *   <mosaik-icon slot="prefix" data="lock"></mosaik-icon>
 *   Premium Feature (Upgrade Required)
 * </mosaik-combo-item>
 * ```
 *
 * @public
 */
let ComboItemElement = class ComboItemElement extends Themeable(Disableable(Valueable(Variantable(Focusable(Labelable(SelectorItemElement)))))) {
    // #region Fields
    _isChecked;
    _icon;
    _isActive;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._isChecked = false;
        this._icon = '';
        this._isActive = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @override
     * @readonly
     */
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    static get is() {
        return 'mosaik-combo-item';
    }
    /**
     * Gets or sets the `isChecked` property.
     *
     * @public
     * @attr
     */
    get isChecked() {
        return this._isChecked;
    }
    set isChecked(value) {
        if (this._isChecked !== value) {
            this._isChecked = value;
            this.requestUpdate('isChecked');
        }
    }
    /**
     * 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');
        }
    }
    /**
     * Gets or sets the `isActive` property.
     *
     * @public
     * @attr
     */
    get isActive() {
        return this._isActive;
    }
    set isActive(value) {
        if (this._isActive !== value) {
            this._isActive = value;
            this.requestUpdate('isActive');
        }
    }
    /**
     * Gets the `displayText` property.
     *
     * @public
     * @readonly
     * @hidden
     */
    get displayText() {
        return this.label.trim();
    }
    /**
     * Get the item parent.
     *
     * @protected
     * @readonly
     */
    get parent() {
        const projection = DomServiceLocator.current.findAncestor(this, PortalProjectionElement.is, { strict: true });
        const parent = DomServiceLocator.current.findShadowDomHost(projection.portal, { strict: true });
        return parent;
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onClick(event) {
        if (this.disabled) {
            return;
        }
        if (this === event.currentTarget) {
            if (!(this.parent.selectionMode === SelectionMode.Single || this.parent.selectionMode === SelectionMode.None)) {
                this.isChecked = !this._isChecked;
            }
        }
    }
};
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ComboItemElement.prototype, "isChecked", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ComboItemElement.prototype, "icon", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ComboItemElement.prototype, "isActive", null);
__decorate([
    Listen('click'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Event]),
    __metadata("design:returntype", void 0)
], ComboItemElement.prototype, "onClick", null);
ComboItemElement = __decorate([
    Component({
        selector: 'mosaik-combo-item',
        template: comboItemElementTemplate,
        themes: {
            joy: comboItemElementJoyStyle,
            retro: comboItemElementRetroStyle,
            cosmopolitan: comboItemElementCosmopolitanStyle
        },
        host: {
            'tabIndex': '0',
            'role': 'option',
            'aria-selected': 'false'
        },
        options: {
            mode: 'open',
            delegatesFocus: true
        },
        imports: [
            CheckmarkElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ComboItemElement);
export { ComboItemElement };
//# sourceMappingURL=ComboItemElement.js.map