import { Component, HostBinding, ChangeDetectionStrategy, ViewEncapsulation, Input, ChangeDetectorRef, Directive, ContentChild, forwardRef, QueryList, } from '@angular/core';
import { UxAppShellService } from '@eui/core';
import * as i0 from "@angular/core";
import * as i1 from "@eui/core";
import * as i2 from "@angular/common";
function EuiHeaderAppComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 2);
    i0.ɵɵprojection(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} }
function EuiHeaderAppComponent_ng_container_1_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 2);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r4.appNameFromState, " ");
} }
function EuiHeaderAppComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, EuiHeaderAppComponent_ng_container_1_div_1_Template, 2, 1, "div", 3);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r1.appNameFromState);
} }
function EuiHeaderAppComponent_ng_container_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 4);
    i0.ɵɵprojection(2, 1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} }
function EuiHeaderAppComponent_ng_container_5_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 4);
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r5 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r5.appSubTitleFromState);
} }
function EuiHeaderAppComponent_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, EuiHeaderAppComponent_ng_container_5_div_1_Template, 2, 1, "div", 5);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r3.appSubTitleFromState);
} }
const _c0 = [[["eui-header-app-name"]], [["eui-header-app-subtitle"]]];
const _c1 = ["eui-header-app-name", "eui-header-app-subtitle"];
export class EuiHeaderAppComponent {
    constructor(asService, ref) {
        this.asService = asService;
        this.ref = ref;
        this.string = 'eui-header-app';
        this.appName = '';
        this.appShortName = '';
        this.appSubTitle = '';
        this.appNameFromState = '';
        this.appShortNameFromState = '';
        this.appSubTitleFromState = '';
        this.asService.state$.subscribe((state) => {
            this.appNameFromState = state.appName;
            this.appShortNameFromState = state.appShortName;
            this.appSubTitleFromState = state.appSubTitle;
            this.ref.markForCheck();
        });
    }
    ngOnInit() {
        this.asService.setState(Object.assign(Object.assign({}, this.asService.state), { appName: this.appName, appShortName: this.appShortName, appSubTitle: this.appSubTitle }));
    }
    ngOnChanges() {
        if (this.appShortName === '') {
            this.appShortName = this.appName;
        }
        this.asService.setState(Object.assign(Object.assign({}, this.asService.state), { appName: this.appName, appShortName: this.appShortName, appSubTitle: this.appSubTitle }));
    }
}
/** @nocollapse */ EuiHeaderAppComponent.ɵfac = function EuiHeaderAppComponent_Factory(t) { return new (t || EuiHeaderAppComponent)(i0.ɵɵdirectiveInject(i1.UxAppShellService), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
/** @nocollapse */ EuiHeaderAppComponent.ɵcmp = i0.ɵɵdefineComponent({ type: EuiHeaderAppComponent, selectors: [["eui-header-app"]], contentQueries: function EuiHeaderAppComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
        i0.ɵɵcontentQuery(dirIndex, EuiHeaderAppNameDirective, true);
        i0.ɵɵcontentQuery(dirIndex, EuiHeaderAppSubtitleDirective, true);
    } if (rf & 2) {
        var _t;
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customAppName = _t.first);
        i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.customAppSubtitle = _t.first);
    } }, hostVars: 2, hostBindings: function EuiHeaderAppComponent_HostBindings(rf, ctx) { if (rf & 2) {
        i0.ɵɵclassMap(ctx.string);
    } }, inputs: { appName: "appName", appShortName: "appShortName", appSubTitle: "appSubTitle" }, features: [i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c1, decls: 6, vars: 5, consts: [[4, "ngIf"], [1, "eui-header-app__title", "short"], [1, "eui-header-app__title", "full"], ["class", "eui-header-app__title full", 4, "ngIf"], [1, "eui-header-app__sub-title"], ["class", "eui-header-app__sub-title", 4, "ngIf"]], template: function EuiHeaderAppComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef(_c0);
        i0.ɵɵtemplate(0, EuiHeaderAppComponent_ng_container_0_Template, 3, 0, "ng-container", 0);
        i0.ɵɵtemplate(1, EuiHeaderAppComponent_ng_container_1_Template, 2, 1, "ng-container", 0);
        i0.ɵɵelementStart(2, "div", 1);
        i0.ɵɵtext(3);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(4, EuiHeaderAppComponent_ng_container_4_Template, 3, 0, "ng-container", 0);
        i0.ɵɵtemplate(5, EuiHeaderAppComponent_ng_container_5_Template, 2, 1, "ng-container", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.customAppName);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !ctx.customAppName);
        i0.ɵɵadvance(2);
        i0.ɵɵtextInterpolate1(" ", ctx.appShortNameFromState, "\n");
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.customAppSubtitle);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !ctx.customAppSubtitle);
    } }, directives: [i2.NgIf], encapsulation: 2 });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiHeaderAppComponent, [{
        type: Component,
        args: [{
                selector: 'eui-header-app',
                templateUrl: './header-app.component.html',
                changeDetection: ChangeDetectionStrategy.Default,
                encapsulation: ViewEncapsulation.None,
            }]
    }], function () { return [{ type: i1.UxAppShellService }, { type: i0.ChangeDetectorRef }]; }, { string: [{
            type: HostBinding,
            args: ['class']
        }], appName: [{
            type: Input
        }], appShortName: [{
            type: Input
        }], appSubTitle: [{
            type: Input
        }], customAppName: [{
            type: ContentChild,
            args: [forwardRef(() => EuiHeaderAppNameDirective)]
        }], customAppSubtitle: [{
            type: ContentChild,
            args: [forwardRef(() => EuiHeaderAppSubtitleDirective)]
        }] }); })();
/* tslint:disable */
export class EuiHeaderAppNameDirective {
}
/** @nocollapse */ EuiHeaderAppNameDirective.ɵfac = function EuiHeaderAppNameDirective_Factory(t) { return new (t || EuiHeaderAppNameDirective)(); };
/** @nocollapse */ EuiHeaderAppNameDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiHeaderAppNameDirective, selectors: [["eui-header-app-name"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiHeaderAppNameDirective, [{
        type: Directive,
        args: [{ selector: 'eui-header-app-name' }]
    }], null, null); })();
export class EuiHeaderAppSubtitleDirective {
}
/** @nocollapse */ EuiHeaderAppSubtitleDirective.ɵfac = function EuiHeaderAppSubtitleDirective_Factory(t) { return new (t || EuiHeaderAppSubtitleDirective)(); };
/** @nocollapse */ EuiHeaderAppSubtitleDirective.ɵdir = i0.ɵɵdefineDirective({ type: EuiHeaderAppSubtitleDirective, selectors: [["eui-header-app-subtitle"]] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiHeaderAppSubtitleDirective, [{
        type: Directive,
        args: [{ selector: 'eui-header-app-subtitle' }]
    }], null, null); })();
//# sourceMappingURL=data:application/json;base64, 