import * as i0 from '@angular/core';
import { EventEmitter, Output, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
import { LineClampDirective, LineClampTargetDirective } from '@fundamental-ngx/cdk/utils';
import { LinkComponent } from '@fundamental-ngx/core/link';
import { FdTranslatePipe } from '@fundamental-ngx/i18n';

class TextComponent {
    /** @hidden */
    get _isCollapsed() {
        return this.isCollapsed && !!this.maxLines && this.maxLines > 0;
    }
    /** @hidden */
    get _expandable() {
        return this.expandable && !!this.maxLines && this.maxLines > 0;
    }
    /** @hidden */
    constructor(_changeDetectorRef) {
        this._changeDetectorRef = _changeDetectorRef;
        /**
         * Max visible lines of text
         */
        this.maxLines = null;
        /**
         * Property allowing browsers to render whitespace and tabs
         */
        this.whitespaces = false;
        /**
         * Property for managing hyphenation, using css rule hyphens.
         */
        this.hyphenation = null;
        /**
         * Option that adds more and less buttons to expand/collapse text
         */
        this.expandable = false;
        /**
         * Option to set text collapsed or expand on render
         */
        this.isCollapsed = true;
        /**
         * Event, notifying about collapse state changes
         */
        this.isCollapsedChange = new EventEmitter();
        /** @hidden */
        this._hasMore = false;
    }
    /** @hidden */
    toggleTextView() {
        this.isCollapsed = !this.isCollapsed;
        this.isCollapsedChange.emit(this.isCollapsed);
    }
    /** @hidden */
    checkLineCount(count) {
        this._hasMore = !!this.maxLines && count > this.maxLines;
        this._changeDetectorRef.detectChanges();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TextComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.2", type: TextComponent, isStandalone: true, selector: "fd-text", inputs: { text: "text", maxLines: "maxLines", whitespaces: "whitespaces", hyphenation: "hyphenation", expandable: "expandable", isCollapsed: "isCollapsed" }, outputs: { isCollapsedChange: "isCollapsedChange" }, ngImport: i0, template: "<p class=\"fd-text\" [class.fd-text--pre-wrap]=\"whitespaces\" [style.hyphens]=\"hyphenation\">\n    <span\n        fdkLineClamp\n        class=\"fd-text__lineclamp\"\n        #lineClamp=\"fdLineClamp\"\n        [fdLineclampState]=\"_isCollapsed\"\n        [fdLineClampLines]=\"maxLines\"\n        (lineCountUpdate)=\"checkLineCount($event)\"\n    >\n        <span fdkLineClampTarget [fdLineClampTargetText]=\"text\" (update)=\"lineClamp.refreshTarget($event)\"></span>\n    </span>\n    @if (_expandable && _hasMore) {\n        <a\n            fd-link\n            tabindex=\"0\"\n            class=\"fd-text__link--more\"\n            (keydown.enter)=\"toggleTextView()\"\n            (click)=\"toggleTextView()\"\n        >\n            {{ isCollapsed ? ('coreText.moreLabel' | fdTranslate) : ('coreText.lessLabel' | fdTranslate) }}\n        </a>\n    }\n</p>\n", styles: [".fd-text{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);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}.fd-text:after,.fd-text:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-text::-moz-selection{background-color:var(--fdText_Selected_Background_Color);color:var(--sapContent_ContrastTextColor)}.fd-text::selection{background-color:var(--fdText_Selected_Background_Color);color:var(--sapContent_ContrastTextColor)}.fd-text--max-lines{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.fd-text--pre-wrap{white-space:pre-wrap}.fd-text--hyphenation{-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.fd-text__link--more{cursor:pointer;text-transform:capitalize}.fd-text__ai-highlight{background-color:var(--sapInformationBackground);border-radius:.25rem;color:inherit;padding-inline:.125rem}.fd-text__ai-highlight.is-focus,.fd-text__ai-highlight.is-hover,.fd-text__ai-highlight:focus,.fd-text__ai-highlight:hover{-webkit-box-shadow:0 0 0 .0625rem var(--sapInformationBorderColor);box-shadow:0 0 0 .0625rem var(--sapInformationBorderColor)}.fd-text__ai-highlight.is-focus,.fd-text__ai-highlight:focus{z-index:5}.fd-text__ai-highlight.is-hidden{background-color:transparent}.fd-text__ai-highlight.is-hidden.is-hover,.fd-text__ai-highlight.is-hidden:hover{-webkit-box-shadow:none;box-shadow:none}.fd-text__ai-highlight.is-hidden.is-focus,.fd-text__ai-highlight.is-hidden:focus{-webkit-box-shadow:none;box-shadow:none;z-index:5}.fd-text__lineclamp{display:block}\n/*! Bundled license information:\n\nfundamental-styles/dist/text.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: "directive", type: LineClampDirective, selector: "[fdkLineClamp]", inputs: ["fdLineClampLines", "fdLineclampState"], outputs: ["lineCountUpdate"], exportAs: ["fdLineClamp"] }, { kind: "directive", type: LineClampTargetDirective, selector: "[fdkLineClampTarget], [fdLineClampTarget], [fd-lineclamp-target]", inputs: ["fdLineClampTargetText"], outputs: ["update"], exportAs: ["fdLineClampTarget"] }, { kind: "component", type: LinkComponent, selector: "[fdLink], [fd-link]", inputs: ["class", "emphasized", "disabled", "inverted", "subtle", "undecorated"] }, { kind: "pipe", type: FdTranslatePipe, name: "fdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TextComponent, decorators: [{
            type: Component,
            args: [{ selector: 'fd-text', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [LineClampDirective, LineClampTargetDirective, LinkComponent, FdTranslatePipe], template: "<p class=\"fd-text\" [class.fd-text--pre-wrap]=\"whitespaces\" [style.hyphens]=\"hyphenation\">\n    <span\n        fdkLineClamp\n        class=\"fd-text__lineclamp\"\n        #lineClamp=\"fdLineClamp\"\n        [fdLineclampState]=\"_isCollapsed\"\n        [fdLineClampLines]=\"maxLines\"\n        (lineCountUpdate)=\"checkLineCount($event)\"\n    >\n        <span fdkLineClampTarget [fdLineClampTargetText]=\"text\" (update)=\"lineClamp.refreshTarget($event)\"></span>\n    </span>\n    @if (_expandable && _hasMore) {\n        <a\n            fd-link\n            tabindex=\"0\"\n            class=\"fd-text__link--more\"\n            (keydown.enter)=\"toggleTextView()\"\n            (click)=\"toggleTextView()\"\n        >\n            {{ isCollapsed ? ('coreText.moreLabel' | fdTranslate) : ('coreText.lessLabel' | fdTranslate) }}\n        </a>\n    }\n</p>\n", styles: [".fd-text{border:0;-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--sapTextColor);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}.fd-text:after,.fd-text:before{-webkit-box-sizing:inherit;box-sizing:inherit;font-size:inherit}.fd-text::-moz-selection{background-color:var(--fdText_Selected_Background_Color);color:var(--sapContent_ContrastTextColor)}.fd-text::selection{background-color:var(--fdText_Selected_Background_Color);color:var(--sapContent_ContrastTextColor)}.fd-text--max-lines{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.fd-text--pre-wrap{white-space:pre-wrap}.fd-text--hyphenation{-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto}.fd-text__link--more{cursor:pointer;text-transform:capitalize}.fd-text__ai-highlight{background-color:var(--sapInformationBackground);border-radius:.25rem;color:inherit;padding-inline:.125rem}.fd-text__ai-highlight.is-focus,.fd-text__ai-highlight.is-hover,.fd-text__ai-highlight:focus,.fd-text__ai-highlight:hover{-webkit-box-shadow:0 0 0 .0625rem var(--sapInformationBorderColor);box-shadow:0 0 0 .0625rem var(--sapInformationBorderColor)}.fd-text__ai-highlight.is-focus,.fd-text__ai-highlight:focus{z-index:5}.fd-text__ai-highlight.is-hidden{background-color:transparent}.fd-text__ai-highlight.is-hidden.is-hover,.fd-text__ai-highlight.is-hidden:hover{-webkit-box-shadow:none;box-shadow:none}.fd-text__ai-highlight.is-hidden.is-focus,.fd-text__ai-highlight.is-hidden:focus{-webkit-box-shadow:none;box-shadow:none;z-index:5}.fd-text__lineclamp{display:block}\n/*! Bundled license information:\n\nfundamental-styles/dist/text.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.ChangeDetectorRef }], propDecorators: { text: [{
                type: Input
            }], maxLines: [{
                type: Input
            }], whitespaces: [{
                type: Input
            }], hyphenation: [{
                type: Input
            }], expandable: [{
                type: Input
            }], isCollapsed: [{
                type: Input
            }], isCollapsedChange: [{
                type: Output
            }] } });

class TextModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TextModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.2", ngImport: i0, type: TextModule, imports: [TextComponent], exports: [TextComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TextModule, imports: [TextComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.2", ngImport: i0, type: TextModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [TextComponent],
                    exports: [TextComponent]
                }]
        }] });

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

export { TextComponent, TextModule };
//# sourceMappingURL=fundamental-ngx-core-text.mjs.map
