import { __decorate, __metadata } from "tslib";
import { AsyncPipe, NgClass } from '@angular/common';
import { Component, EventEmitter, Injector, ViewChild, ViewEncapsulation, forwardRef } from '@angular/core';
import { OTranslatePipe } from '../../pipes/o-translate.pipe';
import { BooleanInputConverter } from '../../decorators/input-converter';
import { AuthService } from '../../services';
import { DialogService } from '../../services/dialog.service';
import { OModulesInfoService } from '../../services/o-modules-info.service';
import { Codes } from '../../util/codes';
import { OLanguageSelectorModule } from '../language-selector/o-language-selector.module';
import { OUserInfoModule } from '../user-info/o-user-info.module';
import { OUserInfoBase } from '../user-info/o-user-info-base.class';
import { OAppHeaderBase } from './o-app-header-base.class';
import * as i0 from "@angular/core";
import * as i1 from "../user-info/o-user-info.component";
import * as i2 from "../language-selector/o-language-selector.component";
export const DEFAULT_INPUTS_O_APP_HEADER = [
    'showUserInfo: show-user-info',
    'showLanguageSelector: show-language-selector',
    'useFlagIcons: use-flag-icons',
    'color',
    'headerHeight:header-height',
    'showTitle: show-title',
    'staticTitle: static-title',
    'showStaticTitle: show-static-title'
];
export const DEFAULT_OUTPUTS_O_APP_HEADER = [
    'onSidenavToggle'
];
export class OAppHeaderComponent {
    set headerHeight(value) {
        this._headerHeight = value ? value.toLowerCase() : value;
        if (!Codes.isValidRowHeight(this._headerHeight)) {
            this._headerHeight = Codes.DEFAULT_ROW_HEIGHT;
        }
    }
    get headerHeight() {
        return this._headerHeight;
    }
    constructor(injector) {
        this.injector = injector;
        this.showTitle = false;
        this.showStaticTitle = false;
        this.showUserInfo = true;
        this.showLanguageSelector = true;
        this.useFlagIcons = false;
        this.onSidenavToggle = new EventEmitter();
        this._headerHeight = Codes.DEFAULT_ROW_HEIGHT;
        this.dialogService = this.injector.get(DialogService);
        this.modulesInfoService = this.injector.get(OModulesInfoService);
        this.authService = this.injector.get(AuthService);
    }
    ngOnInit() {
        if (!this.showStaticTitle) {
            this.headerTitle$ = this.modulesInfoService.getModuleChangeObservable();
        }
    }
    onLogoutClick() {
        this.authService.logoutWithConfirmation();
    }
    set color(newValue) {
        this._color = newValue;
    }
    get color() {
        return this._color;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: OAppHeaderComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: OAppHeaderComponent, isStandalone: true, selector: "o-app-header", inputs: { showUserInfo: ["show-user-info", "showUserInfo"], showLanguageSelector: ["show-language-selector", "showLanguageSelector"], useFlagIcons: ["use-flag-icons", "useFlagIcons"], color: "color", headerHeight: ["header-height", "headerHeight"], showTitle: ["show-title", "showTitle"], staticTitle: ["static-title", "staticTitle"], showStaticTitle: ["show-static-title", "showStaticTitle"] }, outputs: { onSidenavToggle: "onSidenavToggle" }, host: { properties: { "class.o-app-header": "true", "class.o-app-header-small": "headerHeight===\"small\"", "class.o-app-header-medium": "headerHeight===\"medium\"", "class.o-app-header-large": "headerHeight===\"large\"" } }, providers: [
            { provide: OAppHeaderBase, useExisting: forwardRef(() => OAppHeaderComponent) }
        ], viewQueries: [{ propertyName: "userInfo", first: true, predicate: ["userInfo"], descendants: true }], ngImport: i0, template: "<nav class=\"o-flex o-flex-row o-layout-align-sb-stretch\" [ngClass]=\"color ? 'o-app-header-'+color : ''\">\n  <div class=\"o-flex o-flex-row o-layout-align-sb-center\">\n    <ng-content></ng-content>\n    <ng-content select=\"o-app-layout-header-projection-start\"></ng-content>\n    @if (showTitle && !showStaticTitle) {\n      <span class=\"o-app-header-title o-flex-row o-layout-align-center-center\">\n        {{ headerTitle$ | async | oTranslate }}\n      </span>\n    }\n    @if (showTitle && showStaticTitle) {\n      <span class=\"o-app-header-title o-flex-row o-layout-align-center-center\">\n        {{ staticTitle | oTranslate }}\n      </span>\n    }\n    <div class=\"o-app-header-default-actions o-flex-row o-layout-align-end-stretch\">\n      <div class=\"layout-header-projection-end\">\n        <ng-content select=\"o-app-layout-header-projection-end\"></ng-content>\n      </div>\n      @if (showUserInfo) {\n        <o-user-info #userInfo id=\"userInfo\"></o-user-info>\n      }\n      @if (showLanguageSelector) {\n        <o-language-selector [use-flag-icons]=\"useFlagIcons\"></o-language-selector>\n      }\n    </div>\n  </div>\n</nav>\n", styles: [".o-app-header{z-index:2;align-content:center}.o-app-header.o-app-header-large{height:56px}.o-app-header.o-app-header-large+.header-layout{top:56px}.o-app-header.o-app-header-large .o-user-info{font-size:16px}.o-app-header.o-app-header-large .o-user-info .o-user-info-avatar-wrapper{height:40px;width:40px}.o-app-header.o-app-header-medium{height:48px}.o-app-header.o-app-header-medium+.header-layout{top:48px}.o-app-header.o-app-header-medium .o-user-info{font-size:16px}.o-app-header.o-app-header-medium .o-user-info .o-user-info-avatar-wrapper{height:32px;width:32px}.o-app-header.o-app-header-small{height:40px}.o-app-header.o-app-header-small+.header-layout{top:40px}.o-app-header.o-app-header-small .o-user-info{font-size:14px}.o-app-header.o-app-header-small .o-user-info .o-user-info-avatar-wrapper{height:30px;width:30px}.o-app-header nav{padding-right:16px}.o-app-header nav .sidenav-toggle{text-align:center;padding:16px;cursor:pointer}.o-app-header nav .o-app-header-title{padding:0 16px;cursor:default}.o-app-header nav .o-app-header-default-actions{margin-left:auto}.o-app-header nav .o-app-header-default-actions .layout-header-projection-end{margin-right:16px}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: OTranslatePipe, name: "oTranslate" }, { kind: "ngmodule", type: OUserInfoModule }, { kind: "component", type: i1.OUserInfoComponent, selector: "o-user-info", inputs: ["show-profile", "show-settings", "show-logout", "id"] }, { kind: "ngmodule", type: OLanguageSelectorModule }, { kind: "component", type: i2.OLanguageSelectorComponent, selector: "o-language-selector", inputs: ["use-flag-icons"], outputs: ["onChange"] }], encapsulation: i0.ViewEncapsulation.None }); }
}
__decorate([
    BooleanInputConverter(),
    __metadata("design:type", Boolean)
], OAppHeaderComponent.prototype, "showUserInfo", void 0);
__decorate([
    BooleanInputConverter(),
    __metadata("design:type", Boolean)
], OAppHeaderComponent.prototype, "showLanguageSelector", void 0);
__decorate([
    BooleanInputConverter(),
    __metadata("design:type", Boolean)
], OAppHeaderComponent.prototype, "useFlagIcons", void 0);
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: OAppHeaderComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [AsyncPipe, NgClass, OTranslatePipe, OUserInfoModule, OLanguageSelectorModule], selector: 'o-app-header', inputs: DEFAULT_INPUTS_O_APP_HEADER, outputs: DEFAULT_OUTPUTS_O_APP_HEADER, encapsulation: ViewEncapsulation.None, host: {
                        '[class.o-app-header]': 'true',
                        '[class.o-app-header-small]': 'headerHeight==="small"',
                        '[class.o-app-header-medium]': 'headerHeight==="medium"',
                        '[class.o-app-header-large]': 'headerHeight==="large"'
                    }, providers: [
                        { provide: OAppHeaderBase, useExisting: forwardRef(() => OAppHeaderComponent) }
                    ], template: "<nav class=\"o-flex o-flex-row o-layout-align-sb-stretch\" [ngClass]=\"color ? 'o-app-header-'+color : ''\">\n  <div class=\"o-flex o-flex-row o-layout-align-sb-center\">\n    <ng-content></ng-content>\n    <ng-content select=\"o-app-layout-header-projection-start\"></ng-content>\n    @if (showTitle && !showStaticTitle) {\n      <span class=\"o-app-header-title o-flex-row o-layout-align-center-center\">\n        {{ headerTitle$ | async | oTranslate }}\n      </span>\n    }\n    @if (showTitle && showStaticTitle) {\n      <span class=\"o-app-header-title o-flex-row o-layout-align-center-center\">\n        {{ staticTitle | oTranslate }}\n      </span>\n    }\n    <div class=\"o-app-header-default-actions o-flex-row o-layout-align-end-stretch\">\n      <div class=\"layout-header-projection-end\">\n        <ng-content select=\"o-app-layout-header-projection-end\"></ng-content>\n      </div>\n      @if (showUserInfo) {\n        <o-user-info #userInfo id=\"userInfo\"></o-user-info>\n      }\n      @if (showLanguageSelector) {\n        <o-language-selector [use-flag-icons]=\"useFlagIcons\"></o-language-selector>\n      }\n    </div>\n  </div>\n</nav>\n", styles: [".o-app-header{z-index:2;align-content:center}.o-app-header.o-app-header-large{height:56px}.o-app-header.o-app-header-large+.header-layout{top:56px}.o-app-header.o-app-header-large .o-user-info{font-size:16px}.o-app-header.o-app-header-large .o-user-info .o-user-info-avatar-wrapper{height:40px;width:40px}.o-app-header.o-app-header-medium{height:48px}.o-app-header.o-app-header-medium+.header-layout{top:48px}.o-app-header.o-app-header-medium .o-user-info{font-size:16px}.o-app-header.o-app-header-medium .o-user-info .o-user-info-avatar-wrapper{height:32px;width:32px}.o-app-header.o-app-header-small{height:40px}.o-app-header.o-app-header-small+.header-layout{top:40px}.o-app-header.o-app-header-small .o-user-info{font-size:14px}.o-app-header.o-app-header-small .o-user-info .o-user-info-avatar-wrapper{height:30px;width:30px}.o-app-header nav{padding-right:16px}.o-app-header nav .sidenav-toggle{text-align:center;padding:16px;cursor:pointer}.o-app-header nav .o-app-header-title{padding:0 16px;cursor:default}.o-app-header nav .o-app-header-default-actions{margin-left:auto}.o-app-header nav .o-app-header-default-actions .layout-header-projection-end{margin-right:16px}\n"] }]
        }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { userInfo: [{
                type: ViewChild,
                args: ['userInfo']
            }], showUserInfo: [], showLanguageSelector: [], useFlagIcons: [] } });
//# sourceMappingURL=data:application/json;base64, 