import * as i0 from '@angular/core';
import { input, signal, output, computed, Component } from '@angular/core';
import * as i1 from 'primeng/avatar';
import { AvatarModule } from 'primeng/avatar';
import * as i2 from 'primeng/overlaybadge';
import { OverlayBadgeModule } from 'primeng/overlaybadge';
import { Icon } from '@masterteam/icons';

class Avatar {
    label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
    icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
    image = input(...(ngDevMode ? [undefined, { debugName: "image" }] : []));
    styleClass = input(...(ngDevMode ? [undefined, { debugName: "styleClass" }] : []));
    size = input('normal', ...(ngDevMode ? [{ debugName: "size" }] : []));
    shape = input('circle', ...(ngDevMode ? [{ debugName: "shape" }] : []));
    badge = input(...(ngDevMode ? [undefined, { debugName: "badge" }] : []));
    badgeSize = input(...(ngDevMode ? [undefined, { debugName: "badgeSize" }] : []));
    badgeSeverity = input('primary', ...(ngDevMode ? [{ debugName: "badgeSeverity" }] : []));
    errorImage = signal(false, ...(ngDevMode ? [{ debugName: "errorImage" }] : []));
    onImageError = output();
    OnImageError(event) {
        this.onImageError.emit(event);
        this.errorImage.set(true);
    }
    badgeSizeMap = {
        normal: 'small',
        large: undefined,
        xlarge: 'large',
    };
    internalBadgeSize = computed(() => {
        if (this.badgeSize())
            return this.badgeSize();
        return this.badgeSizeMap[this.size() ?? 'normal'];
    }, ...(ngDevMode ? [{ debugName: "internalBadgeSize" }] : []));
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: Avatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.3", type: Avatar, isStandalone: true, selector: "mt-avatar", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, image: { classPropertyName: "image", publicName: "image", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, badge: { classPropertyName: "badge", publicName: "badge", isSignal: true, isRequired: false, transformFunction: null }, badgeSize: { classPropertyName: "badgeSize", publicName: "badgeSize", isSignal: true, isRequired: false, transformFunction: null }, badgeSeverity: { classPropertyName: "badgeSeverity", publicName: "badgeSeverity", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onImageError: "onImageError" }, host: { classAttribute: "grid gap-1" }, ngImport: i0, template: "@if (!badge()) {\r\n  <p-avatar\r\n    [styleClass]=\"styleClass()\"\r\n    [size]=\"size()\"\r\n    [shape]=\"shape()\"\r\n    [label]=\"label()\"\r\n    [image]=\"image()\"\r\n    (onImageError)=\"OnImageError($event)\"\r\n  >\r\n    @if (icon() && (errorImage() || !image())) {\r\n      <mt-icon [icon]=\"icon()\" />\r\n    }\r\n  </p-avatar>\r\n} @else {\r\n  <p-overlaybadge\r\n    [badgeSize]=\"internalBadgeSize()\"\r\n    [value]=\"badge()\"\r\n    [severity]=\"badgeSeverity()\"\r\n  >\r\n    <p-avatar\r\n      [size]=\"size()\"\r\n      [shape]=\"shape()\"\r\n      [label]=\"label()\"\r\n      [image]=\"image()\"\r\n      (onImageError)=\"onImageError($event)\"\r\n    >\r\n      @if (icon()) {\r\n        <mt-icon [icon]=\"icon()\" />\r\n      }\r\n    </p-avatar>\r\n  </p-overlaybadge>\r\n}\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: AvatarModule }, { kind: "component", type: i1.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "styleClass", "ariaLabel", "ariaLabelledBy"], outputs: ["onImageError"] }, { kind: "ngmodule", type: OverlayBadgeModule }, { kind: "component", type: i2.OverlayBadge, selector: "p-overlayBadge, p-overlay-badge, p-overlaybadge", inputs: ["styleClass", "style", "badgeSize", "severity", "value", "badgeDisabled", "size"] }, { kind: "component", type: Icon, selector: "mt-icon", inputs: ["icon"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.3", ngImport: i0, type: Avatar, decorators: [{
            type: Component,
            args: [{ selector: 'mt-avatar', standalone: true, imports: [AvatarModule, OverlayBadgeModule, Icon], host: {
                        class: 'grid gap-1',
                    }, template: "@if (!badge()) {\r\n  <p-avatar\r\n    [styleClass]=\"styleClass()\"\r\n    [size]=\"size()\"\r\n    [shape]=\"shape()\"\r\n    [label]=\"label()\"\r\n    [image]=\"image()\"\r\n    (onImageError)=\"OnImageError($event)\"\r\n  >\r\n    @if (icon() && (errorImage() || !image())) {\r\n      <mt-icon [icon]=\"icon()\" />\r\n    }\r\n  </p-avatar>\r\n} @else {\r\n  <p-overlaybadge\r\n    [badgeSize]=\"internalBadgeSize()\"\r\n    [value]=\"badge()\"\r\n    [severity]=\"badgeSeverity()\"\r\n  >\r\n    <p-avatar\r\n      [size]=\"size()\"\r\n      [shape]=\"shape()\"\r\n      [label]=\"label()\"\r\n      [image]=\"image()\"\r\n      (onImageError)=\"onImageError($event)\"\r\n    >\r\n      @if (icon()) {\r\n        <mt-icon [icon]=\"icon()\" />\r\n      }\r\n    </p-avatar>\r\n  </p-overlaybadge>\r\n}\r\n" }]
        }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], image: [{ type: i0.Input, args: [{ isSignal: true, alias: "image", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], badge: [{ type: i0.Input, args: [{ isSignal: true, alias: "badge", required: false }] }], badgeSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "badgeSize", required: false }] }], badgeSeverity: [{ type: i0.Input, args: [{ isSignal: true, alias: "badgeSeverity", required: false }] }], onImageError: [{ type: i0.Output, args: ["onImageError"] }] } });

/**
 * Generated bundle index. Do not edit.
 */

export { Avatar };
//# sourceMappingURL=masterteam-components-avatar.mjs.map
