import * as i0 from '@angular/core';
import { input, booleanAttribute, output, inject, ElementRef, Injector, runInInjectionContext, effect, ChangeDetectionStrategy, Component } from '@angular/core';
import '@ui5/webcomponents/dist/Avatar.js';

class Avatar {
    constructor() {
        /**
         * Defines whether the component is disabled.
      A disabled component can't be pressed or
      focused, and it is not in the tab chain.
         */
        this.disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines if the avatar is interactive (focusable and pressable).
      
      **Note:** This property won't have effect if the `disabled`
      property is set to `true`.
         */
        this.interactive = input(false, ...(ngDevMode ? [{ debugName: "interactive", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the name of the UI5 Icon, that will be displayed.
      
      **Note:** If `image` slot is provided, the property will be ignored.
      
      **Note:** You should import the desired icon first, then use its name as "icon".
      
      `import "@ui5/webcomponents-icons/dist/{icon_name}.js"`
      
      `<ui5-avatar icon="employee">`
      
      **Note:** If no icon or an empty one is provided, by default the "employee" icon should be displayed.
      
      See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
         */
        this.icon = input(...(ngDevMode ? [undefined, { debugName: "icon" }] : []));
        /**
         * Defines the name of the fallback icon, which should be displayed in the following cases:
      
          - If the initials are not valid (more than 3 letters, unsupported languages or empty initials).
          - If there are three initials and they do not fit in the shape (e.g. WWW for some of the sizes).
          - If the image src is wrong.
      
      **Note:** If not set, a default fallback icon "employee" is displayed.
      
      **Note:** You should import the desired icon first, then use its name as "fallback-icon".
      
      `import "@ui5/webcomponents-icons/dist/{icon_name}.js"`
      
      `<ui5-avatar fallback-icon="alert">`
      
      See all the available icons in the [Icon Explorer](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html).
         */
        this.fallbackIcon = input("employee", ...(ngDevMode ? [{ debugName: "fallbackIcon" }] : []));
        /**
         * Defines the displayed initials.
      
      Up to three Latin letters can be displayed as initials.
         */
        this.initials = input(...(ngDevMode ? [undefined, { debugName: "initials" }] : []));
        /**
         * Defines the shape of the component.
         */
        this.shape = input("Circle", ...(ngDevMode ? [{ debugName: "shape" }] : []));
        /**
         * Defines predefined size of the component.
         */
        this.size = input("S", ...(ngDevMode ? [{ debugName: "size" }] : []));
        /**
         * Defines the background color of the desired image.
      If `colorScheme` is set to `Auto`, the avatar will be displayed with the `Accent6` color.
         */
        this.colorScheme = input("Auto", ...(ngDevMode ? [{ debugName: "colorScheme" }] : []));
        /**
         * Defines the text alternative of the component.
      If not provided a default text alternative will be set, if present.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * Defines the additional accessibility attributes that will be applied to the component.
      The following field is supported:
      
      - **hasPopup**: Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by the button.
      Accepts the following string values: `dialog`, `grid`, `listbox`, `menu` or `tree`.
         */
        this.accessibilityAttributes = input({}, ...(ngDevMode ? [{ debugName: "accessibilityAttributes" }] : [])); // className is now passed
        /**
         * Fired on mouseup, space and enter if avatar is interactive
      
      **Note:** The event will not be fired if the `disabled`
      property is set to `true`.
         */
        this.ui5Click = output();
        /**
         * Available slots for content projection in this component.
         *
         * Slots allow you to insert custom content into predefined areas of the web component.
         * Use the `slot` attribute on child elements to target specific slots.
         *
         * - **(default)**: Receives the desired `<img>` tag
      
      **Note:** If you experience flickering of the provided image, you can hide the component until it is defined with the following CSS:<br/>
      `ui5-avatar:not(:defined) {`<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;`visibility: hidden;`<br/>
      `}`
         * - **badge**: Defines the optional badge that will be used for visual affordance.
      
      **Note:** While the slot allows for custom badges, to achieve
      the Fiori design, you can use the `ui5-tag` with `ui5-icon`
      in the corresponding `icon` slot, without text nodes.
         *
         * @example
         * ```html
         * <ui5-avatar>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-avatar>
         * ```
         *
         * @readonly
         * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots | MDN Web Components Slots}
         */
        this.slots = [
            {
                "name": "default",
                "description": "Receives the desired `<img>` tag\n\n**Note:** If you experience flickering of the provided image, you can hide the component until it is defined with the following CSS:<br/>\n`ui5-avatar:not(:defined) {`<br/>\n&nbsp;&nbsp;&nbsp;&nbsp;`visibility: hidden;`<br/>\n`}`",
                "since": "1.0.0-rc.15"
            },
            {
                "name": "badge",
                "description": "Defines the optional badge that will be used for visual affordance.\n\n**Note:** While the slot allows for custom badges, to achieve\nthe Fiori design, you can use the `ui5-tag` with `ui5-icon`\nin the corresponding `icon` slot, without text nodes.",
                "since": "1.7.0"
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'disabled',
            'interactive',
            'icon',
            'fallbackIcon',
            'initials',
            'shape',
            'size',
            'colorScheme',
            'accessibleName',
            'accessibilityAttributes',
        ];
        // Synchronize inputs (properties)
        for (const inputName of inputsToSync) {
            // Find the corresponding camelCase signal property on the Angular component
            const signalName = inputName.replace(/-./g, (x) => x[1].toUpperCase());
            // Use the Injector to run the effect in the correct context
            if (this[signalName] && typeof this[signalName] === 'function') {
                runInInjectionContext(this.injector, () => {
                    effect(() => {
                        // Read the signal value
                        const value = this[signalName]();
                        if (wcElement) {
                            // Write the value to the Web Component's property
                            wcElement[inputName] = value;
                        }
                    });
                });
            }
        }
        const outputsToSync = [
            'ui5Click',
        ];
        // Synchronize outputs (events)
        for (const outputName of outputsToSync) {
            // Map Angular output name to UI5 web component event name
            const eventName = outputName.replace('ui5', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1);
            // Ensure the output property exists and has an emit function before adding listener
            if (this[outputName] && typeof this[outputName].emit === 'function' && wcElement.addEventListener) {
                // Cast the listener to the correct type to satisfy TypeScript
                wcElement.addEventListener(eventName, (e) => {
                    this[outputName].emit(e);
                });
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Avatar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Avatar, isStandalone: true, selector: "ui5-avatar, [ui5-avatar]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "interactive", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, fallbackIcon: { classPropertyName: "fallbackIcon", publicName: "fallbackIcon", isSignal: true, isRequired: false, transformFunction: null }, initials: { classPropertyName: "initials", publicName: "initials", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, colorScheme: { classPropertyName: "colorScheme", publicName: "colorScheme", isSignal: true, isRequired: false, transformFunction: null }, accessibleName: { classPropertyName: "accessibleName", publicName: "accessibleName", isSignal: true, isRequired: false, transformFunction: null }, accessibilityAttributes: { classPropertyName: "accessibilityAttributes", publicName: "accessibilityAttributes", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Click: "ui5Click" }, exportAs: ["ui5Avatar"], ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: Avatar, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-avatar, [ui5-avatar]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5Avatar',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

export { Avatar };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-avatar.mjs.map
