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

class Icon {
    constructor() {
        /**
         * Defines the component semantic design.
         */
        this.design = input("Default", ...(ngDevMode ? [{ debugName: "design" }] : []));
        /**
         * Defines the unique identifier (icon name) of the component.
      
      To browse all available icons, see the
      [SAP Icons](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html),
      [SAP Fiori Tools](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html#/overview/SAP-icons-TNT) and
      [SAP Business Suite](https://sdk.openui5.org/test-resources/sap/m/demokit/iconExplorer/webapp/index.html)
      
      Example:
      `name='add'`, `name='delete'`, `name='employee'`.
      
      **Note:** To use the SAP Fiori Tools icons,
      you need to set the `tnt` prefix in front of the icon's name.
      
      Example:
      `name='tnt/antenna'`, `name='tnt/actor'`, `name='tnt/api'`.
      
      **Note:** To use the SAP Business Suite icons,
      you need to set the `business-suite` prefix in front of the icon's name.
      
      Example:
      `name='business-suite/3d'`, `name='business-suite/1x2-grid-layout'`, `name='business-suite/4x4-grid-layout'`.
         */
        this.name = input(...(ngDevMode ? [undefined, { debugName: "name" }] : []));
        /**
         * Defines the text alternative of the component.
      If not provided a default text alternative will be set, if present.
      
      **Note:** Every icon should have a text alternative in order to
      calculate its accessible name.
         */
        this.accessibleName = input(...(ngDevMode ? [undefined, { debugName: "accessibleName" }] : []));
        /**
         * Defines whether the component should have a tooltip.
      
      **Note:** The tooltip text should be provided via the `accessible-name` property.
         */
        this.showTooltip = input(false, ...(ngDevMode ? [{ debugName: "showTooltip", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
        /**
         * Defines the mode of the component.
         */
        this.mode = input("Decorative", ...(ngDevMode ? [{ debugName: "mode" }] : [])); // className is now passed
        /**
         * Fired on mouseup, `SPACE` and `ENTER`.
      - on mouse click, the icon fires native `click` event
      - on `SPACE` and `ENTER`, the icon fires custom `click` event
         */
        this.ui5Click = output();
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'design',
            'name',
            'accessibleName',
            'showTooltip',
            'mode',
        ];
        // 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: Icon, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: Icon, isStandalone: true, selector: "ui5-icon, [ui5-icon]", inputs: { design: { classPropertyName: "design", publicName: "design", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, accessibleName: { classPropertyName: "accessibleName", publicName: "accessibleName", isSignal: true, isRequired: false, transformFunction: null }, showTooltip: { classPropertyName: "showTooltip", publicName: "showTooltip", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Click: "ui5Click" }, exportAs: ["ui5Icon"], 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: Icon, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-icon, [ui5-icon]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5Icon',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

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