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 { UUIIconRequestEvent, UUIRefNodeElement } from '../../../../../external/uui/index.js';
import { html, customElement, property, state } from '../../../../../external/lit/index.js';
import { UmbElementMixin } from '../../../../../libs/element-api/index.js';
let UmbRefManifestElement = class UmbRefManifestElement extends UmbElementMixin(UUIRefNodeElement) {
    get manifest() {
        return undefined;
    }
    set manifest(value) {
        this._alias = value?.alias;
        this.name = value?.name ?? '';
    }
    connectedCallback() {
        super.connectedCallback();
        this.#requestIconSVG('icon-umb-manifest');
    }
    /* This is a bit stupid, but because this element extends from uui-ref-node, it only accepts the icon via the icon slot.
     ** Instead we overwrite the fallbackIcon property which requires a SVG... */
    #requestIconSVG(iconName) {
        if (iconName !== '' && iconName !== null) {
            const event = new UUIIconRequestEvent(UUIIconRequestEvent.ICON_REQUEST, {
                detail: { iconName: iconName },
            });
            this.dispatchEvent(event);
            if (event.icon !== null) {
                event.icon.then((iconSvg) => {
                    this.fallbackIcon = iconSvg;
                    this.requestUpdate('fallbackIcon');
                });
            }
        }
    }
    renderDetail() {
        return html `<small id="detail">${this._alias}<slot name="detail"></slot></small>`;
    }
};
__decorate([
    property({ type: Object, attribute: false })
], UmbRefManifestElement.prototype, "manifest", null);
__decorate([
    state()
], UmbRefManifestElement.prototype, "_alias", void 0);
UmbRefManifestElement = __decorate([
    customElement('umb-ref-manifest')
], UmbRefManifestElement);
export { UmbRefManifestElement };
