import * as i0 from '@angular/core';
import { EventEmitter, ElementRef, ViewChild, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
import * as i1 from '@angular/forms';
import { FormsModule } from '@angular/forms';
import { warnOnce } from '@fundamental-ngx/cdk/utils';
import { AvatarComponent } from '@fundamental-ngx/core/avatar';
import { ButtonComponent } from '@fundamental-ngx/core/button';
import { FormControlComponent } from '@fundamental-ngx/core/form';
import { FdTranslatePipe } from '@fundamental-ngx/i18n';

/**
 * @deprecated
 * Use the `fd-feed-input[modelDriven]` component from `@fundamental-ngx/core/feed-input` instead.
 * The `fd-feed-input` component is a drop-in replacement for the `fdp-feed-input` component.
 */
class FeedInputComponent {
    /** @hidden */
    constructor(_renderer) {
        this._renderer = _renderer;
        /** Set feed input without user image */
        this.avatarShow = true;
        /** Set disabled state */
        this.disabled = false;
        /** @hidden Event emitted when user click on send button */
        this.submit = new EventEmitter();
        warnOnce('FeedInputComponent is deprecated and will be removed in future release. ' +
            'Use the `fd-feed-input` component from `@fundamental-ngx/core/feed-input` instead.');
    }
    /** @hidden */
    ngAfterViewInit() {
        const lineHeight = this._getTextareaLineHeight();
        if (this.maxHeight) {
            this.textarea.nativeElement.style.maxHeight = lineHeight * this.maxHeight + 'px';
        }
    }
    /** @hidden */
    onChange() {
        this.resize();
    }
    /** @hidden Handle submit feed input value*/
    onSubmit() {
        if (this.value) {
            this.submit.emit(this.value);
        }
    }
    /** @hidden Make grow textarea */
    resize() {
        this._renderer.setStyle(this.textarea.nativeElement, 'height', 'inherit');
        const totalHeight = this._getTextareaTotalHeight();
        this._renderer.setStyle(this.textarea.nativeElement, 'height', `${totalHeight}px`);
    }
    /** @hidden get line height of textarea */
    _getTextareaLineHeight() {
        if (this.textarea && this.textarea.nativeElement) {
            const lineHeight = window.getComputedStyle(this.textarea.nativeElement).getPropertyValue('line-height');
            if (lineHeight === 'normal') {
                return (parseInt(window.getComputedStyle(this.textarea.nativeElement).getPropertyValue('font-size'), 10) *
                    1.1);
            }
            return parseInt(lineHeight, 10);
        }
        return 1;
    }
    /** @hidden Get the total height including borders and scroll height */
    _getTextareaTotalHeight() {
        const computed = window.getComputedStyle(this.textarea.nativeElement);
        return (parseInt(computed.getPropertyValue('border-top-width'), 10) +
            this.textarea.nativeElement.scrollHeight +
            parseInt(computed.getPropertyValue('border-bottom-width'), 10));
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FeedInputComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: FeedInputComponent, isStandalone: true, selector: "fdp-feed-input", inputs: { avatarSrc: "avatarSrc", placeholder: "placeholder", avatarShow: "avatarShow", disabled: "disabled", maxHeight: "maxHeight" }, outputs: { submit: "submit" }, viewQueries: [{ propertyName: "textarea", first: true, predicate: ["textAreaElement"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"fd-feed-input\" [class.is-disabled]=\"disabled\">\n    @if (avatarShow) {\n        <fd-avatar\n            class=\"fd-feed-input__thumb\"\n            size=\"s\"\n            role=\"img\"\n            [attr.aria-label]=\"'platformFeedInput.userTitle' | fdTranslate\"\n            [title]=\"'platformFeedInput.userTitle' | fdTranslate\"\n            [image]=\"avatarSrc\"\n            [class.fd-avatar--placeholder]=\"!avatarSrc\"\n            [class.sap-icon]=\"!avatarSrc\"\n            [glyph]=\"!avatarSrc ? 'person-placeholder' : null\"\n        >\n        </fd-avatar>\n    }\n    <textarea\n        #textAreaElement\n        fd-form-control\n        class=\"fd-textarea fd-feed-input__textarea\"\n        [disabled]=\"disabled\"\n        [placeholder]=\"placeholder\"\n        [(ngModel)]=\"value\"\n        (ngModelChange)=\"onChange()\"\n    ></textarea>\n    <button\n        fd-button\n        class=\"fd-feed-input__submit-button\"\n        glyph=\"feeder-arrow\"\n        title=\"Send\"\n        ariaLabel=\"Send\"\n        [disabled]=\"!value || disabled\"\n        (click)=\"onSubmit()\"\n    ></button>\n</div>\n", styles: [".fd-feed-input{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);container-name:feed-input;container-type:inline-size;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;height:100%;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0}.fd-feed-input:after,.fd-feed-input:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-feed-input.is-disabled,.fd-feed-input:disabled,.fd-feed-input[aria-disabled=true]{cursor:not-allowed;opacity:1;pointer-events:auto}.fd-feed-input.is-disabled textarea::-webkit-input-placeholder,.fd-feed-input:disabled textarea::-webkit-input-placeholder,.fd-feed-input[aria-disabled=true] textarea::-webkit-input-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea::-moz-placeholder,.fd-feed-input:disabled textarea::-moz-placeholder,.fd-feed-input[aria-disabled=true] textarea::-moz-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea:-ms-input-placeholder,.fd-feed-input:disabled textarea:-ms-input-placeholder,.fd-feed-input[aria-disabled=true] textarea:-ms-input-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea::-ms-input-placeholder,.fd-feed-input:disabled textarea::-ms-input-placeholder,.fd-feed-input[aria-disabled=true] textarea::-ms-input-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea::placeholder,.fd-feed-input:disabled textarea::placeholder,.fd-feed-input[aria-disabled=true] textarea::placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input .fd-feed-input__container{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;-webkit-box-orient:horizontal;-webkit-box-direction:normal;background-color:var(--sapGroup_ContentBackground);-ms-flex-direction:row;flex-direction:row;gap:.5rem;margin-block:1rem;padding-block:1rem;padding-inline:1rem .5rem}.fd-feed-input .fd-feed-input__container:after,.fd-feed-input .fd-feed-input__container:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-feed-input .fd-feed-input__textarea{margin-block:0;margin-inline:0;max-height:20rem;min-height:3rem;padding-block:.375rem;padding-inline:.5rem}.fd-feed-input .fd-feed-input__submit-button{margin-block:.375rem;-ms-flex-item-align:end;align-self:flex-end}.fd-feed-input .fd-feed-input__submit-button[dir=rtl],[dir=rtl] .fd-feed-input .fd-feed-input__submit-button{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fd-feed-input .fd-feed-input__submit-button[class*=-compact],.fd-feed-input .fd-feed-input__submit-button[class*=-condensed],[class*=-compact] .fd-feed-input .fd-feed-input__submit-button:not([class*=-cozy]),[class*=-condensed] .fd-feed-input .fd-feed-input__submit-button:not([class*=-cozy]){--fdButton_Compact_Height:var(--sapElement_Height);--fdButton_Clickable_Height:2.75rem;--fdButton_Padding_X:.625rem;--fdButton_Min_Width:2.25rem;--fdButton_Badge_Margin_Inline_Start:0;--fdButton_Badge_Size_Attention:.75rem}@container feed-input (max-width: 20rem){.fd-feed-input .fd-feed-input__container{margin-block:0}.fd-feed-input .fd-feed-input__thumb{display:none}}\n/*! Bundled license information:\n\nfundamental-styles/dist/feed-input.css:\n  (*!\n   * Fundamental Library Styles v0.40.1\n   * Copyright (c) 2025 SAP SE or an SAP affiliate company.\n   * Licensed under Apache License 2.0 (https://github.com/SAP/fundamental-styles/blob/main/LICENSE)\n   *)\n*/\n"], dependencies: [{ kind: "component", type: AvatarComponent, selector: "fd-avatar", inputs: ["id", "ariaLabel", "ariaLabelledby", "label", "size", "font", "glyph", "zoomGlyph", "circle", "interactive", "transparent", "contain", "placeholder", "tile", "border", "colorAccent", "colorIndication", "random", "clickable", "valueState", "image", "alterIcon", "backupImage"], outputs: ["avatarClicked", "zoomGlyphClicked"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FormControlComponent, selector: "input[fd-form-control], textarea[fd-form-control]", inputs: ["state", "type", "class", "ariaLabel", "ariaLabelledBy"] }, { kind: "component", type: ButtonComponent, selector: "button[fd-button], a[fd-button], span[fd-button]", inputs: ["class", "id"], exportAs: ["fd-button"] }, { kind: "pipe", type: FdTranslatePipe, name: "fdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: FeedInputComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fdp-feed-input', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [AvatarComponent, FormsModule, FormControlComponent, ButtonComponent, FdTranslatePipe], template: "<div class=\"fd-feed-input\" [class.is-disabled]=\"disabled\">\n    @if (avatarShow) {\n        <fd-avatar\n            class=\"fd-feed-input__thumb\"\n            size=\"s\"\n            role=\"img\"\n            [attr.aria-label]=\"'platformFeedInput.userTitle' | fdTranslate\"\n            [title]=\"'platformFeedInput.userTitle' | fdTranslate\"\n            [image]=\"avatarSrc\"\n            [class.fd-avatar--placeholder]=\"!avatarSrc\"\n            [class.sap-icon]=\"!avatarSrc\"\n            [glyph]=\"!avatarSrc ? 'person-placeholder' : null\"\n        >\n        </fd-avatar>\n    }\n    <textarea\n        #textAreaElement\n        fd-form-control\n        class=\"fd-textarea fd-feed-input__textarea\"\n        [disabled]=\"disabled\"\n        [placeholder]=\"placeholder\"\n        [(ngModel)]=\"value\"\n        (ngModelChange)=\"onChange()\"\n    ></textarea>\n    <button\n        fd-button\n        class=\"fd-feed-input__submit-button\"\n        glyph=\"feeder-arrow\"\n        title=\"Send\"\n        ariaLabel=\"Send\"\n        [disabled]=\"!value || disabled\"\n        (click)=\"onSubmit()\"\n    ></button>\n</div>\n", styles: [".fd-feed-input{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);container-name:feed-input;container-type:inline-size;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;height:100%;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0}.fd-feed-input:after,.fd-feed-input:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-feed-input.is-disabled,.fd-feed-input:disabled,.fd-feed-input[aria-disabled=true]{cursor:not-allowed;opacity:1;pointer-events:auto}.fd-feed-input.is-disabled textarea::-webkit-input-placeholder,.fd-feed-input:disabled textarea::-webkit-input-placeholder,.fd-feed-input[aria-disabled=true] textarea::-webkit-input-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea::-moz-placeholder,.fd-feed-input:disabled textarea::-moz-placeholder,.fd-feed-input[aria-disabled=true] textarea::-moz-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea:-ms-input-placeholder,.fd-feed-input:disabled textarea:-ms-input-placeholder,.fd-feed-input[aria-disabled=true] textarea:-ms-input-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea::-ms-input-placeholder,.fd-feed-input:disabled textarea::-ms-input-placeholder,.fd-feed-input[aria-disabled=true] textarea::-ms-input-placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input.is-disabled textarea::placeholder,.fd-feed-input:disabled textarea::placeholder,.fd-feed-input[aria-disabled=true] textarea::placeholder{color:var(--sapTextColor,#32363a);font-style:var(--fdFeed_Input_Placeholder_Font_Style)}.fd-feed-input .fd-feed-input__container{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);display:-webkit-box;display:-ms-flexbox;display:flex;font-family:var(--sapFontFamily);font-size:var(--sapFontSize);font-weight:400;forced-color-adjust:none;line-height:normal;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;-webkit-box-orient:horizontal;-webkit-box-direction:normal;background-color:var(--sapGroup_ContentBackground);-ms-flex-direction:row;flex-direction:row;gap:.5rem;margin-block:1rem;padding-block:1rem;padding-inline:1rem .5rem}.fd-feed-input .fd-feed-input__container:after,.fd-feed-input .fd-feed-input__container:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-feed-input .fd-feed-input__textarea{margin-block:0;margin-inline:0;max-height:20rem;min-height:3rem;padding-block:.375rem;padding-inline:.5rem}.fd-feed-input .fd-feed-input__submit-button{margin-block:.375rem;-ms-flex-item-align:end;align-self:flex-end}.fd-feed-input .fd-feed-input__submit-button[dir=rtl],[dir=rtl] .fd-feed-input .fd-feed-input__submit-button{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.fd-feed-input .fd-feed-input__submit-button[class*=-compact],.fd-feed-input .fd-feed-input__submit-button[class*=-condensed],[class*=-compact] .fd-feed-input .fd-feed-input__submit-button:not([class*=-cozy]),[class*=-condensed] .fd-feed-input .fd-feed-input__submit-button:not([class*=-cozy]){--fdButton_Compact_Height:var(--sapElement_Height);--fdButton_Clickable_Height:2.75rem;--fdButton_Padding_X:.625rem;--fdButton_Min_Width:2.25rem;--fdButton_Badge_Margin_Inline_Start:0;--fdButton_Badge_Size_Attention:.75rem}@container feed-input (max-width: 20rem){.fd-feed-input .fd-feed-input__container{margin-block:0}.fd-feed-input .fd-feed-input__thumb{display:none}}\n/*! Bundled license information:\n\nfundamental-styles/dist/feed-input.css:\n  (*!\n   * Fundamental Library Styles v0.40.1\n   * Copyright (c) 2025 SAP SE or an SAP affiliate company.\n   * Licensed under Apache License 2.0 (https://github.com/SAP/fundamental-styles/blob/main/LICENSE)\n   *)\n*/\n"] }]
        }], ctorParameters: () => [{ type: i0.Renderer2 }], propDecorators: { avatarSrc: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], avatarShow: [{
                type: Input
            }], disabled: [{
                type: Input
            }], maxHeight: [{
                type: Input
            }], submit: [{
                type: Output
            }], textarea: [{
                type: ViewChild,
                args: ['textAreaElement', { read: ElementRef }]
            }] } });

/**
 * @deprecated
 * Use direct imports of components and directives.
 */
class PlatformFeedInputModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PlatformFeedInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.0", ngImport: i0, type: PlatformFeedInputModule, imports: [FeedInputComponent], exports: [FeedInputComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PlatformFeedInputModule, imports: [FeedInputComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: PlatformFeedInputModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [FeedInputComponent],
                    exports: [FeedInputComponent]
                }]
        }] });

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

export { FeedInputComponent, PlatformFeedInputModule };
//# sourceMappingURL=fundamental-ngx-platform-feed-input.mjs.map
