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;
};
import { MelodicComponent } from '@melodicdev/core';
import { profileCardTemplate } from './profile-card.template.js';
import { profileCardStyles } from './profile-card.styles.js';
/**
 * ml-profile-card - Identity card for person/entity detail pages
 *
 * @example
 * ```html
 * <ml-profile-card
 *   name="Sarah Mitchell"
 *   subtitle="Member · Women's Ministry"
 *   avatar="https://example.com/photo.jpg"
 *   avatar-size="lg"
 * >
 *   <div slot="details">
 *     <div class="detail-row"><ml-icon icon="envelope" size="sm"></ml-icon> sarah@example.com</div>
 *     <div class="detail-row"><ml-icon icon="phone" size="sm"></ml-icon> (555) 123-4567</div>
 *   </div>
 *   <div slot="tags">
 *     <ml-tag>Women's Ministry</ml-tag>
 *     <ml-tag>Choir</ml-tag>
 *   </div>
 *   <div slot="actions">
 *     <ml-button variant="primary">Message</ml-button>
 *     <ml-button variant="outline">Edit</ml-button>
 *   </div>
 *   <div slot="meta">
 *     <div>Member since: January 2019</div>
 *     <div>Birthday: March 15</div>
 *   </div>
 * </ml-profile-card>
 * ```
 *
 * @slot details - Contact info rows (icon + text pairs)
 * @slot tags - Involvement/group tags
 * @slot actions - Action buttons (Message, Edit, etc.)
 * @slot meta - Detail fields (member since, birthday, family)
 *
 * @cssproperty --ml-profile-card-bg - Card background (default: var(--ml-color-surface))
 * @cssproperty --ml-profile-card-banner-from - Banner gradient start color
 * @cssproperty --ml-profile-card-banner-to - Banner gradient end color
 */
let ProfileCardComponent = class ProfileCardComponent {
    constructor() {
        /** Person name */
        this.name = '';
        /** Subtitle (e.g. "Member · Women's Ministry") */
        this.subtitle = '';
        /** Avatar image URL — falls back to initials derived from name */
        this.avatar = '';
        /** Avatar size */
        this['avatar-size'] = 'lg';
        /** Slot visibility flags (toggled via slotchange) */
        this.hasDetails = false;
        this.hasTags = false;
        this.hasActions = false;
        this.hasMeta = false;
    }
    /** Derive initials from name */
    get initials() {
        return this.name
            .split(' ')
            .map(part => part.charAt(0))
            .join('')
            .toUpperCase()
            .slice(0, 2);
    }
    onCreate() {
        const shadow = this.elementRef.shadowRoot;
        if (!shadow)
            return;
        shadow.querySelectorAll('slot[name]').forEach(slot => {
            slot.addEventListener('slotchange', () => {
                const name = slot.getAttribute('name');
                const hasContent = slot.assignedNodes().length > 0;
                if (name === 'details')
                    this.hasDetails = hasContent;
                else if (name === 'tags')
                    this.hasTags = hasContent;
                else if (name === 'actions')
                    this.hasActions = hasContent;
                else if (name === 'meta')
                    this.hasMeta = hasContent;
            });
        });
    }
};
ProfileCardComponent = __decorate([
    MelodicComponent({
        selector: 'ml-profile-card',
        template: profileCardTemplate,
        styles: profileCardStyles,
        attributes: ['name', 'subtitle', 'avatar', 'avatar-size']
    })
], ProfileCardComponent);
export { ProfileCardComponent };
