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

class CardHeader {
    constructor() {
        /**
         * Defines the title text.
         */
        this.titleText = input(...(ngDevMode ? [undefined, { debugName: "titleText" }] : []));
        /**
         * Defines the subtitle text.
         */
        this.subtitleText = input(...(ngDevMode ? [undefined, { debugName: "subtitleText" }] : []));
        /**
         * Defines the additional text.
         */
        this.additionalText = input(...(ngDevMode ? [undefined, { debugName: "additionalText" }] : []));
        /**
         * Defines if the component would be interactive,
      e.g gets hover effect and `click` event is fired, when pressed.
         */
        this.interactive = input(false, ...(ngDevMode ? [{ debugName: "interactive", transform: booleanAttribute }] : [{ transform: booleanAttribute }])); // className is now passed
        /**
         * Fired when the component is activated by mouse/tap or by using the Enter or Space key.
      
      **Note:** The event would be fired only if the `interactive` 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.
         *
         * - **avatar**: Defines an avatar image, displayed in the left most part of the header.
         * - **action**: Defines an action, displayed in the right most part of the header.
         *
         * @example
         * ```html
         * <ui5-card-header>
         *   <div slot="header">Custom header content</div>
         *   <p>Default slot content</p>
         * </ui5-card-header>
         * ```
         *
         * @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": "avatar",
                "description": "Defines an avatar image, displayed in the left most part of the header."
            },
            {
                "name": "action",
                "description": "Defines an action, displayed in the right most part of the header."
            }
        ];
        this.elementRef = inject(ElementRef);
        this.injector = inject(Injector);
    }
    get element() {
        return this.elementRef.nativeElement;
    }
    ngAfterViewInit() {
        const wcElement = this.element;
        const inputsToSync = [
            'titleText',
            'subtitleText',
            'additionalText',
            'interactive',
        ];
        // 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: CardHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.4", type: CardHeader, isStandalone: true, selector: "ui5-card-header, [ui5-card-header]", inputs: { titleText: { classPropertyName: "titleText", publicName: "titleText", isSignal: true, isRequired: false, transformFunction: null }, subtitleText: { classPropertyName: "subtitleText", publicName: "subtitleText", isSignal: true, isRequired: false, transformFunction: null }, additionalText: { classPropertyName: "additionalText", publicName: "additionalText", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "interactive", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ui5Click: "ui5Click" }, exportAs: ["ui5CardHeader"], 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: CardHeader, decorators: [{
            type: Component,
            args: [{
                    standalone: true,
                    selector: 'ui5-card-header, [ui5-card-header]',
                    template: '<ng-content></ng-content>',
                    exportAs: 'ui5CardHeader',
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }] });

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

export { CardHeader };
//# sourceMappingURL=fundamental-ngx-ui5-webcomponents-card-header.mjs.map
