import { Component, HostBinding, ChangeDetectionStrategy, Input } from '@angular/core';
import { UiStateService } from '../../services/ui-state.service';
import * as i0 from "@angular/core";
import * as i1 from "../../services/ui-state.service";
import * as i2 from "@angular/material/card";
import * as i3 from "@angular/common";
import * as i4 from "../../../eui-button/eui-button.component";
const _c0 = function (a0) { return { "background-image": a0 }; };
function EuiCardHeaderComponent_div_1_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 10);
} if (rf & 2) {
    const ctx_r7 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(2, _c0, "url(" + ctx_r7.avatarUrl + ")"));
    i0.ɵɵattribute("aria-label", ctx_r7.avatarDerscription);
} }
function EuiCardHeaderComponent_div_1_div_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 11);
    i0.ɵɵelement(1, "span");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r8 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("eui-card-header__icon--rounded", ctx_r8.iconClass.indexOf("eui-icon--rounded") !== -1);
    i0.ɵɵadvance(1);
    i0.ɵɵclassMap(ctx_r8.iconClass);
    i0.ɵɵattribute("aria-label", ctx_r8.iconDescription);
} }
function EuiCardHeaderComponent_div_1_ng_container_4_ng_content_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 2, ["*ngTemplateOutlet", "title"]);
} }
function EuiCardHeaderComponent_div_1_ng_container_4_ng_content_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 3, ["*ngTemplateOutlet", "subtitle"]);
} }
function EuiCardHeaderComponent_div_1_ng_container_4_ng_content_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 4, ["*ngTemplateOutlet", "rightContent"]);
} }
function EuiCardHeaderComponent_div_1_ng_container_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 12);
    i0.ɵɵtemplate(2, EuiCardHeaderComponent_div_1_ng_container_4_ng_content_2_Template, 1, 0, "ng-content", 13);
    i0.ɵɵtemplate(3, EuiCardHeaderComponent_div_1_ng_container_4_ng_content_3_Template, 1, 0, "ng-content", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(4, EuiCardHeaderComponent_div_1_ng_container_4_ng_content_4_Template, 1, 0, "ng-content", 13);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext(2);
    const _r1 = i0.ɵɵreference(5);
    const _r3 = i0.ɵɵreference(7);
    const _r5 = i0.ɵɵreference(9);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", _r1);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r3);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r5);
} }
function EuiCardHeaderComponent_div_1_ng_container_5_ng_content_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 5, ["*ngTemplateOutlet", "title"]);
} }
function EuiCardHeaderComponent_div_1_ng_container_5_ng_content_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 6, ["*ngTemplateOutlet", "subtitle"]);
} }
function EuiCardHeaderComponent_div_1_ng_container_5_ng_content_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 7, ["*ngTemplateOutlet", "rightContent"]);
} }
function EuiCardHeaderComponent_div_1_ng_container_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "div", 14);
    i0.ɵɵelementStart(2, "div", 12);
    i0.ɵɵtemplate(3, EuiCardHeaderComponent_div_1_ng_container_5_ng_content_3_Template, 1, 0, "ng-content", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "div", 15);
    i0.ɵɵtemplate(5, EuiCardHeaderComponent_div_1_ng_container_5_ng_content_5_Template, 1, 0, "ng-content", 13);
    i0.ɵɵtemplate(6, EuiCardHeaderComponent_div_1_ng_container_5_ng_content_6_Template, 1, 0, "ng-content", 13);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵnextContext(2);
    const _r1 = i0.ɵɵreference(5);
    const _r3 = i0.ɵɵreference(7);
    const _r5 = i0.ɵɵreference(9);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngTemplateOutlet", _r1);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngTemplateOutlet", _r3);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r5);
} }
function EuiCardHeaderComponent_div_1_div_6_Template(rf, ctx) { if (rf & 1) {
    const _r19 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 16);
    i0.ɵɵlistener("click", function EuiCardHeaderComponent_div_1_div_6_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(2); return ctx_r18.onToggle($event); });
    i0.ɵɵelementStart(1, "button", 17);
    i0.ɵɵpipe(2, "async");
    i0.ɵɵelement(3, "span", 18);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r11 = i0.ɵɵnextContext(2);
    i0.ɵɵclassProp("eui-card-header__expander--bottom", ctx_r11.hasBottomExpander);
    i0.ɵɵadvance(1);
    i0.ɵɵattribute("aria-label", !i0.ɵɵpipeBind1(2, 3, ctx_r11.uiStateService.state$).isCollapsed ? ctx_r11.collapseLabel : ctx_r11.expandLabel);
} }
function EuiCardHeaderComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    const _r21 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 5);
    i0.ɵɵlistener("click", function EuiCardHeaderComponent_div_1_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r21); const ctx_r20 = i0.ɵɵnextContext(); return ctx_r20.onToggleHeader($event); });
    i0.ɵɵprojection(1, 1);
    i0.ɵɵtemplate(2, EuiCardHeaderComponent_div_1_div_2_Template, 1, 4, "div", 6);
    i0.ɵɵtemplate(3, EuiCardHeaderComponent_div_1_div_3_Template, 2, 6, "div", 7);
    i0.ɵɵtemplate(4, EuiCardHeaderComponent_div_1_ng_container_4_Template, 5, 3, "ng-container", 8);
    i0.ɵɵtemplate(5, EuiCardHeaderComponent_div_1_ng_container_5_Template, 7, 3, "ng-container", 8);
    i0.ɵɵtemplate(6, EuiCardHeaderComponent_div_1_div_6_Template, 4, 5, "div", 9);
    i0.ɵɵpipe(7, "async");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r0.avatarUrl && !ctx_r0.iconClass);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.iconClass);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !ctx_r0.hasFullTitle);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.hasFullTitle);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", i0.ɵɵpipeBind1(7, 5, ctx_r0.uiStateService.state$).isCollapsible);
} }
function EuiCardHeaderComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 8);
} }
function EuiCardHeaderComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 9);
} }
function EuiCardHeaderComponent_ng_template_8_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 10);
} }
const _c1 = [[["eui-card-header-body"]], [["eui-card-header-left-content"]], "*", "*", "*", "*", "*", "*", [["eui-card-header-title"]], [["eui-card-header-subtitle"]], [["eui-card-header-right-content"]]];
const _c2 = ["eui-card-header-body", "eui-card-header-left-content", "*", "*", "*", "*", "*", "*", "eui-card-header-title", "eui-card-header-subtitle", "eui-card-header-right-content"];
export class EuiCardHeaderComponent {
    constructor(uiStateService) {
        this.uiStateService = uiStateService;
        this.expandLabel = 'expand';
        this.collapseLabel = 'collapse';
        this.avatarDerscription = 'eUI card header avatar';
        this.iconDescription = 'eUI card header icon';
        this.isHeaderBodyOnly = false; // TO BE DEPRECATED
        this.hasHeaderClickToggle = true;
        this.hasBottomExpander = false;
        this.hasFullTitle = false;
        this.string = 'eui-card-header';
    }
    onToggle(event) {
        this.uiStateService.setState({ isCollapsed: !this.uiStateService.state.isCollapsed });
        this._preventDefault(event);
    }
    onToggleHeader(event) {
        if (this.hasHeaderClickToggle && this.uiStateService.state.isCollapsible) {
            this.uiStateService.setState({ isCollapsed: !this.uiStateService.state.isCollapsed });
        }
    }
    _preventDefault(event) {
        if (event) {
            event.preventDefault();
            event.stopPropagation();
            event.cancelBubble = true;
        }
        return;
    }
}
/** @nocollapse */ EuiCardHeaderComponent.ɵfac = function EuiCardHeaderComponent_Factory(t) { return new (t || EuiCardHeaderComponent)(i0.ɵɵdirectiveInject(i1.UiStateService)); };
/** @nocollapse */ EuiCardHeaderComponent.ɵcmp = i0.ɵɵdefineComponent({ type: EuiCardHeaderComponent, selectors: [["eui-card-header"]], hostVars: 2, hostBindings: function EuiCardHeaderComponent_HostBindings(rf, ctx) { if (rf & 2) {
        i0.ɵɵclassMap(ctx.string);
    } }, inputs: { avatarUrl: "avatarUrl", expandLabel: "expandLabel", collapseLabel: "collapseLabel", iconClass: "iconClass", avatarDerscription: "avatarDerscription", iconDescription: "iconDescription", isHeaderBodyOnly: "isHeaderBodyOnly", hasHeaderClickToggle: "hasHeaderClickToggle", hasBottomExpander: "hasBottomExpander", hasFullTitle: "hasFullTitle" }, ngContentSelectors: _c2, decls: 10, vars: 3, consts: [["class", "eui-card-header__container", 3, "click", 4, "ngIf"], [1, "eui-card-header__urgent-indicator"], ["title", ""], ["subtitle", ""], ["rightContent", ""], [1, "eui-card-header__container", 3, "click"], ["mat-card-avatar", "", "class", "eui-card-header__avatar", 3, "ngStyle", 4, "ngIf"], ["class", "eui-card-header__icon", 3, "eui-card-header__icon--rounded", 4, "ngIf"], [4, "ngIf"], ["class", "eui-card-header__expander", 3, "eui-card-header__expander--bottom", "click", 4, "ngIf"], ["mat-card-avatar", "", 1, "eui-card-header__avatar", 3, "ngStyle"], [1, "eui-card-header__icon"], [1, "eui-card-header__title-container"], [4, "ngTemplateOutlet"], [1, "eui-card-header__middle-container"], [1, "eui-card-header__middle-content"], [1, "eui-card-header__expander", 3, "click"], ["euiButton", "", "euiRounded", "", "euiIconButton", "", "euiSizeM", "", "euiBasicButton", "", "euiSecondary", "", 1, "eui-card-header__expander-icon"], [1, "eui-icon", "eui-icon-angle-up"]], template: function EuiCardHeaderComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef(_c1);
        i0.ɵɵelementStart(0, "mat-card-header");
        i0.ɵɵtemplate(1, EuiCardHeaderComponent_div_1_Template, 8, 7, "div", 0);
        i0.ɵɵelement(2, "div", 1);
        i0.ɵɵprojection(3);
        i0.ɵɵelementEnd();
        i0.ɵɵtemplate(4, EuiCardHeaderComponent_ng_template_4_Template, 1, 0, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor);
        i0.ɵɵtemplate(6, EuiCardHeaderComponent_ng_template_6_Template, 1, 0, "ng-template", null, 3, i0.ɵɵtemplateRefExtractor);
        i0.ɵɵtemplate(8, EuiCardHeaderComponent_ng_template_8_Template, 1, 0, "ng-template", null, 4, i0.ɵɵtemplateRefExtractor);
    } if (rf & 2) {
        i0.ɵɵclassProp("eui-card-header--body-only", ctx.isHeaderBodyOnly);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !ctx.isHeaderBodyOnly);
    } }, directives: [i2.MatCardHeader, i3.NgIf, i2.MatCardAvatar, i3.NgStyle, i3.NgTemplateOutlet, i4.EuiButtonComponent], pipes: [i3.AsyncPipe], encapsulation: 2, changeDetection: 0 });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiCardHeaderComponent, [{
        type: Component,
        args: [{
                selector: 'eui-card-header',
                templateUrl: './eui-card-header.component.html',
                changeDetection: ChangeDetectionStrategy.OnPush,
            }]
    }], function () { return [{ type: i1.UiStateService }]; }, { avatarUrl: [{
            type: Input
        }], expandLabel: [{
            type: Input
        }], collapseLabel: [{
            type: Input
        }], iconClass: [{
            type: Input
        }], avatarDerscription: [{
            type: Input
        }], iconDescription: [{
            type: Input
        }], isHeaderBodyOnly: [{
            type: Input
        }], hasHeaderClickToggle: [{
            type: Input
        }], hasBottomExpander: [{
            type: Input
        }], hasFullTitle: [{
            type: Input
        }], string: [{
            type: HostBinding,
            args: ['class']
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 