import { Component, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../../../tld-common/services";
import * as i2 from "../../services/tld-translate-text.service";
import * as i3 from "@angular/common";
import * as i4 from "@ngbracket/ngx-layout/flex";
import * as i5 from "@ngbracket/ngx-layout/extended";
import * as i6 from "../textarea-with-background/textarea-with-background.component";
import * as i7 from "@ngx-translate/core";
export class TldTranslateSourceComponent {
    config;
    textService;
    textareaDisabled;
    sourceParagraphs;
    // params from config.
    autoFocuss;
    highlight;
    showSensitiveInfoTooltip;
    allowedFileTypes;
    extendedFileTypes;
    showExtensionsUnauthOnly;
    webTranslation;
    get isAuth() { return this.config.coreConfig.isAuth; }
    ;
    maxCharLength;
    acceptedTypesString;
    extendedFileTypesString;
    sourceChangedManually = false;
    get sourceText() { return this.textService?.sourceText; }
    ;
    get sourceTextHypothesis() { return this.textService?.sourceTextHypothesis; }
    get showPlaceHolder() {
        return (!this.sourceText || this.sourceText.length == 0) && !this.isDictating;
    }
    ;
    get registerLink() { return this.config.coreConfig.registerLink; }
    get isDictating() { return this.textService.isDictating; }
    get showExtensions() {
        return this.config.textConfig.showAvailableExtensions;
    }
    get appName() {
        return this.config.coreConfig.appName;
    }
    constructor(config, textService) {
        this.config = config;
        this.textService = textService;
    }
    ngOnInit() {
        const textCfg = this.config.textConfig;
        const fileCfg = this.config.fileConfig;
        this.autoFocuss = this.config.textConfig.autoFocuss;
        this.highlight = this.config.textConfig.highlight;
        this.allowedFileTypes = fileCfg.allowedFileTypes;
        this.extendedFileTypes = fileCfg.extendedFileTypes;
        this.maxCharLength = textCfg.maxCharLength;
        this.showExtensionsUnauthOnly = textCfg.showExtensionsUnauthOnly;
        this.showSensitiveInfoTooltip = textCfg.showSensitiveInfoTooltip;
        this.webTranslation = textCfg.allowWebsiteTranslation;
        this.acceptedTypesString = this.allowedFileTypes.join(", ").replace(/\./g, '');
        this.extendedFileTypesString = this.extendedFileTypes.join(", ").replace(/\./g, '');
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TldTranslateSourceComponent, deps: [{ token: i1.TldTranslateConfigService }, { token: i2.TldTranslateTextService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: TldTranslateSourceComponent, selector: "tld-translate-source", inputs: { textareaDisabled: "textareaDisabled", sourceParagraphs: "sourceParagraphs" }, ngImport: i0, template: "<div class=\"tld-translate-source-wrapper\" fxFlex fxLayout=\"column\">\r\n  <div class=\"source-input-wrapper\" fxFlex>\r\n    <tld-textarea-with-background *ngIf=\"!isDictating\" [textareaDisabled]=\"textareaDisabled\" [highlight]=\"highlight\"\r\n      [autoFocuss]=\"autoFocuss\" [highlightTree]=\"sourceParagraphs\" fxFlex\r\n      [maxCharLength]=\"maxCharLength\"></tld-textarea-with-background>\r\n    <div *ngIf=\"isDictating\" class=\"asr-result-wrapper\">\r\n      <span class=\"asr-result\">\r\n        {{sourceText}}\r\n      </span>\r\n      <span class=\"asr-hypothesis\">\r\n        {{sourceTextHypothesis}}\r\n      </span>\r\n    </div>\r\n  </div>\r\n  <div fxLayout=\"column\" fxFlex *ngIf=\"showPlaceHolder\" class=\"description-text tld-trg-placeholder\">\r\n    <div fxFlex>\r\n      <p\r\n        [innerHtml]=\"(webTranslation?'TLD_TRANSLATE.SOURCE_TOOLTIP':'TLD_TRANSLATE.SOURCE_TOOLTIP_ONLY_TEXT') | translate: {appName: appName}\">\r\n      </p>\r\n      <ng-container *ngIf=\"showSensitiveInfoTooltip\">\r\n        <br fxHide.xs />\r\n        <p>{{'TLD_TRANSLATE.SOURCE_TOOLTIP_SENSITIVE_INFO' | translate: {appName: appName} }}</p>\r\n      </ng-container>\r\n    </div>\r\n\r\n    <div *ngIf=\"showExtensions\" class=\"extension-container\">\r\n      <ng-container *ngIf=\"!isAuth\">\r\n        <p class=\"description-smaller\">\r\n          <span>{{'TLD_TRANSLATE.SOURCE_FORMATS' | translate: { formats:acceptedTypesString, appName:\r\n            appName} }}</span>\r\n        </p>\r\n\r\n        <ng-container *ngIf=\"!showExtensionsUnauthOnly\">\r\n          <br fxHide.xs />\r\n          <p class=\"description-smaller\" *ngIf=\" !isAuth\"\r\n            [innerHtml]=\"'TLD_TRANSLATE.REGISTERED_FORMATS' | translate: { formats:extendedFileTypesString, registerLink:registerLink, appName: appName }\">\r\n        </ng-container>\r\n      </ng-container>\r\n\r\n      <p class=\"description-smaller\" *ngIf=\"isAuth\"\r\n        [innerHtml]=\"'TLD_TRANSLATE.REGISTERED_FORMATS_LOGGED_IN' | translate: { formats:extendedFileTypesString, registerLink:registerLink, appName: appName }\">\r\n      </p>\r\n    </div>\r\n  </div>\r\n</div>\r\n", styles: ["textarea{resize:none!important;outline:none;border:none;font-size:1em;z-index:1;background-color:transparent;font-family:Inter,sans-serif;padding:0;line-height:1.5;word-break:break-word;padding:1em!important;caret-color:#000!important}.tld-translate-source-wrapper{position:relative;cursor:text}.source-input-wrapper{position:relative}.tld-trg-placeholder{padding:18px;position:absolute;height:100%;width:100%;font-size:1em}.tld-trg-placeholder p{margin:0}.extension-container{z-index:2}.asr-result-wrapper{margin:1em}.asr-result-wrapper .asr-hypothesis{color:gray}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.DefaultLayoutDirective, selector: "  [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md],  [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md],  [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm],  [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i4.DefaultFlexDirective, selector: "  [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md],  [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md],  [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm],  [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "directive", type: i5.DefaultShowHideDirective, selector: "  [fxShow], [fxShow.print],  [fxShow.xs], [fxShow.sm], [fxShow.md], [fxShow.lg], [fxShow.xl],  [fxShow.lt-sm], [fxShow.lt-md], [fxShow.lt-lg], [fxShow.lt-xl],  [fxShow.gt-xs], [fxShow.gt-sm], [fxShow.gt-md], [fxShow.gt-lg],  [fxHide], [fxHide.print],  [fxHide.xs], [fxHide.sm], [fxHide.md], [fxHide.lg], [fxHide.xl],  [fxHide.lt-sm], [fxHide.lt-md], [fxHide.lt-lg], [fxHide.lt-xl],  [fxHide.gt-xs], [fxHide.gt-sm], [fxHide.gt-md], [fxHide.gt-lg]", inputs: ["fxShow", "fxShow.print", "fxShow.xs", "fxShow.sm", "fxShow.md", "fxShow.lg", "fxShow.xl", "fxShow.lt-sm", "fxShow.lt-md", "fxShow.lt-lg", "fxShow.lt-xl", "fxShow.gt-xs", "fxShow.gt-sm", "fxShow.gt-md", "fxShow.gt-lg", "fxHide", "fxHide.print", "fxHide.xs", "fxHide.sm", "fxHide.md", "fxHide.lg", "fxHide.xl", "fxHide.lt-sm", "fxHide.lt-md", "fxHide.lt-lg", "fxHide.lt-xl", "fxHide.gt-xs", "fxHide.gt-sm", "fxHide.gt-md", "fxHide.gt-lg"] }, { kind: "component", type: i6.TextareaWithBackgroundComponent, selector: "tld-textarea-with-background", inputs: ["maxCharLength", "autoFocuss", "highlightTree", "highlight", "textareaDisabled"] }, { kind: "pipe", type: i7.TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TldTranslateSourceComponent, decorators: [{
            type: Component,
            args: [{ selector: 'tld-translate-source', template: "<div class=\"tld-translate-source-wrapper\" fxFlex fxLayout=\"column\">\r\n  <div class=\"source-input-wrapper\" fxFlex>\r\n    <tld-textarea-with-background *ngIf=\"!isDictating\" [textareaDisabled]=\"textareaDisabled\" [highlight]=\"highlight\"\r\n      [autoFocuss]=\"autoFocuss\" [highlightTree]=\"sourceParagraphs\" fxFlex\r\n      [maxCharLength]=\"maxCharLength\"></tld-textarea-with-background>\r\n    <div *ngIf=\"isDictating\" class=\"asr-result-wrapper\">\r\n      <span class=\"asr-result\">\r\n        {{sourceText}}\r\n      </span>\r\n      <span class=\"asr-hypothesis\">\r\n        {{sourceTextHypothesis}}\r\n      </span>\r\n    </div>\r\n  </div>\r\n  <div fxLayout=\"column\" fxFlex *ngIf=\"showPlaceHolder\" class=\"description-text tld-trg-placeholder\">\r\n    <div fxFlex>\r\n      <p\r\n        [innerHtml]=\"(webTranslation?'TLD_TRANSLATE.SOURCE_TOOLTIP':'TLD_TRANSLATE.SOURCE_TOOLTIP_ONLY_TEXT') | translate: {appName: appName}\">\r\n      </p>\r\n      <ng-container *ngIf=\"showSensitiveInfoTooltip\">\r\n        <br fxHide.xs />\r\n        <p>{{'TLD_TRANSLATE.SOURCE_TOOLTIP_SENSITIVE_INFO' | translate: {appName: appName} }}</p>\r\n      </ng-container>\r\n    </div>\r\n\r\n    <div *ngIf=\"showExtensions\" class=\"extension-container\">\r\n      <ng-container *ngIf=\"!isAuth\">\r\n        <p class=\"description-smaller\">\r\n          <span>{{'TLD_TRANSLATE.SOURCE_FORMATS' | translate: { formats:acceptedTypesString, appName:\r\n            appName} }}</span>\r\n        </p>\r\n\r\n        <ng-container *ngIf=\"!showExtensionsUnauthOnly\">\r\n          <br fxHide.xs />\r\n          <p class=\"description-smaller\" *ngIf=\" !isAuth\"\r\n            [innerHtml]=\"'TLD_TRANSLATE.REGISTERED_FORMATS' | translate: { formats:extendedFileTypesString, registerLink:registerLink, appName: appName }\">\r\n        </ng-container>\r\n      </ng-container>\r\n\r\n      <p class=\"description-smaller\" *ngIf=\"isAuth\"\r\n        [innerHtml]=\"'TLD_TRANSLATE.REGISTERED_FORMATS_LOGGED_IN' | translate: { formats:extendedFileTypesString, registerLink:registerLink, appName: appName }\">\r\n      </p>\r\n    </div>\r\n  </div>\r\n</div>\r\n", styles: ["textarea{resize:none!important;outline:none;border:none;font-size:1em;z-index:1;background-color:transparent;font-family:Inter,sans-serif;padding:0;line-height:1.5;word-break:break-word;padding:1em!important;caret-color:#000!important}.tld-translate-source-wrapper{position:relative;cursor:text}.source-input-wrapper{position:relative}.tld-trg-placeholder{padding:18px;position:absolute;height:100%;width:100%;font-size:1em}.tld-trg-placeholder p{margin:0}.extension-container{z-index:2}.asr-result-wrapper{margin:1em}.asr-result-wrapper .asr-hypothesis{color:gray}\n"] }]
        }], ctorParameters: () => [{ type: i1.TldTranslateConfigService }, { type: i2.TldTranslateTextService }], propDecorators: { textareaDisabled: [{
                type: Input
            }], sourceParagraphs: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 