import { Component, EventEmitter, HostBinding, Input, Output } from '@angular/core';
import { consumeEvent } from '@eui/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "ngx-moment";
import * as i3 from "../../pipes/eui-truncate.pipe";
import * as i4 from "@ngx-translate/core";
function EuiNotificationItemComponent_div_2_i_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 13);
} }
const _c0 = function (a0, a1) { return { "ux-u-color-info-lighter time__icon--rotated": a0, "ux-u-color-grey-light": a1 }; };
function EuiNotificationItemComponent_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 8);
    i0.ɵɵelementStart(1, "span", 9);
    i0.ɵɵelement(2, "i", 10);
    i0.ɵɵtemplate(3, EuiNotificationItemComponent_div_2_i_3_Template, 1, 0, "i", 11);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "span", 12);
    i0.ɵɵtext(5);
    i0.ɵɵpipe(6, "amDateFormat");
    i0.ɵɵpipe(7, "amLocal");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(8, _c0, !(ctx_r0.item.metadata == null ? null : ctx_r0.item.metadata.read), ctx_r0.item.metadata == null ? null : ctx_r0.item.metadata.read));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.item.metadata == null ? null : ctx_r0.item.metadata.new);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(6, 3, i0.ɵɵpipeBind1(7, 6, ctx_r0.item.metadata == null ? null : ctx_r0.item.metadata.date), ctx_r0.dateFormat));
} }
function EuiNotificationItemComponent_div_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 14);
    i0.ɵɵelement(1, "i", 15);
    i0.ɵɵelementEnd();
} }
function EuiNotificationItemComponent_ng_template_5_div_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 19);
    i0.ɵɵpipe(1, "euiTruncate");
    i0.ɵɵpipe(2, "translate");
} if (rf & 2) {
    const ctx_r7 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("innerHTML", i0.ɵɵpipeBind2(1, 1, i0.ɵɵpipeBind1(2, 4, ctx_r7.item.subLabel), 200), i0.ɵɵsanitizeHtml);
} }
const _c1 = function (a0) { return { "ux-u-font-bold": a0 }; };
function EuiNotificationItemComponent_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 16);
    i0.ɵɵelementStart(1, "div", 17);
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "euiTruncate");
    i0.ɵɵpipe(4, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, EuiNotificationItemComponent_ng_template_5_div_5_Template, 3, 6, "div", 18);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵpropertyInterpolate("href", ctx_r2.item.metadata.url, i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(9, _c1, !ctx_r2.item.metadata || ctx_r2.item.metadata && !ctx_r2.item.metadata.read));
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(3, 4, i0.ɵɵpipeBind1(4, 7, ctx_r2.item.label), 200), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r2.item.subLabel);
} }
function EuiNotificationItemComponent_ng_template_6_div_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 19);
    i0.ɵɵpipe(1, "euiTruncate");
    i0.ɵɵpipe(2, "translate");
} if (rf & 2) {
    const ctx_r8 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("innerHTML", i0.ɵɵpipeBind2(1, 1, i0.ɵɵpipeBind1(2, 4, ctx_r8.item.subLabel), 200), i0.ɵɵsanitizeHtml);
} }
function EuiNotificationItemComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 20);
    i0.ɵɵelementStart(1, "div", 17);
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "euiTruncate");
    i0.ɵɵpipe(4, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(5, EuiNotificationItemComponent_ng_template_6_div_5_Template, 3, 6, "div", 18);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext();
    i0.ɵɵpropertyInterpolate("href", ctx_r3.item.metadata.urlExternal, i0.ɵɵsanitizeUrl);
    i0.ɵɵproperty("target", !ctx_r3.item.metadata.urlExternalTarget ? "_black" : ctx_r3.item.metadata.urlExternalTarget);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(10, _c1, !ctx_r3.item.metadata || ctx_r3.item.metadata && !ctx_r3.item.metadata.read));
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(3, 5, i0.ɵɵpipeBind1(4, 8, ctx_r3.item.label), 200), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r3.item.subLabel);
} }
function EuiNotificationItemComponent_ng_template_7_div_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "div", 19);
    i0.ɵɵpipe(1, "euiTruncate");
    i0.ɵɵpipe(2, "translate");
} if (rf & 2) {
    const ctx_r9 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("innerHTML", i0.ɵɵpipeBind2(1, 1, i0.ɵɵpipeBind1(2, 4, ctx_r9.item.subLabel), 200), i0.ɵɵsanitizeHtml);
} }
function EuiNotificationItemComponent_ng_template_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 17);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "euiTruncate");
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(4, EuiNotificationItemComponent_ng_template_7_div_4_Template, 3, 6, "div", 18);
} if (rf & 2) {
    const ctx_r4 = i0.ɵɵnextContext();
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(8, _c1, !ctx_r4.item.metadata || ctx_r4.item.metadata && !ctx_r4.item.metadata.read));
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(2, 3, i0.ɵɵpipeBind1(3, 6, ctx_r4.item.label), 200), " ");
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngIf", ctx_r4.item.subLabel);
} }
function EuiNotificationItemComponent_a_9_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "a", 21);
    i0.ɵɵlistener("click", function EuiNotificationItemComponent_a_9_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(); return ctx_r10.onItemMarkAsRead($event); });
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "translate");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r5 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r5.markAsReadLabel ? ctx_r5.markAsReadLabel : i0.ɵɵpipeBind1(2, 1, "eui.NOTIFICATIONMARKASREAD"), " ");
} }
const _c2 = function (a0, a1) { return { "ux-u-bg-color-grey-lightester-2": a0, "ux-u-bg-color-white": a1 }; };
export class EuiNotificationItemComponent {
    constructor() {
        this.string = 'eui-notification-item';
        this.dateFormat = 'DD/MM/YYYY';
        this.isShowMarkAsRead = true;
        this.markAsReadLabel = null;
        this.itemClick = new EventEmitter();
        this.itemMarkAsRead = new EventEmitter();
        this.tooltipSize = 'auto';
    }
    onItemClick(event) {
        this.itemClick.emit(this.item);
    }
    onItemMarkAsRead(event) {
        if (this.item.metadata) {
            this.item.metadata.read = true;
        }
        this.itemMarkAsRead.emit(this.item);
        consumeEvent(event);
    }
}
/** @nocollapse */ EuiNotificationItemComponent.ɵfac = function EuiNotificationItemComponent_Factory(t) { return new (t || EuiNotificationItemComponent)(); };
/** @nocollapse */ EuiNotificationItemComponent.ɵcmp = i0.ɵɵdefineComponent({ type: EuiNotificationItemComponent, selectors: [["eui-notification-item"]], hostVars: 2, hostBindings: function EuiNotificationItemComponent_HostBindings(rf, ctx) { if (rf & 2) {
        i0.ɵɵclassMap(ctx.string);
    } }, inputs: { item: "item", dateFormat: "dateFormat", isShowMarkAsRead: "isShowMarkAsRead", markAsReadLabel: "markAsReadLabel" }, outputs: { itemClick: "itemClick", itemMarkAsRead: "itemMarkAsRead" }, decls: 10, vars: 10, consts: [[1, "eui-notification-item-content", 3, "ngClass", "click"], [1, "eui-notification-item-content-top", "ux-u-font-size-h7"], ["class", "eui-notification-item-content-top__date", 4, "ngIf"], ["class", "ux-u-font-bold ux-u-color-grey-dark", 4, "ngIf"], [1, "eui-notification-item-content-middle", "ux-u-cursor-pointer"], [3, "ngIf"], [1, "eui-notification-item-content-bottom"], ["href", "javascript:void(0)", 3, "click", 4, "ngIf"], [1, "eui-notification-item-content-top__date"], [1, "eui-notification-item-content-top__date-icon", "mr-2"], [1, "eui-icon", "eui-icon-bell", "ux-u-font-size-h5", 3, "ngClass"], ["class", "eui-notification-item-content-top__date-dot ux-u-color-danger-light ux-u-font-size-h9 fa fa-circle", 4, "ngIf"], [1, "ux-u-color-grey-dark"], [1, "eui-notification-item-content-top__date-dot", "ux-u-color-danger-light", "ux-u-font-size-h9", "fa", "fa-circle"], [1, "ux-u-font-bold", "ux-u-color-grey-dark"], [1, "ml-1", "ux-u-color-danger-dark", "eui-icon", "eui-icon-exclamation"], [3, "href"], [1, "eui-notification-item-content-middle__label", 3, "ngClass"], ["class", "eui-notification-item-content-middle__sub-label", 3, "innerHTML", 4, "ngIf"], [1, "eui-notification-item-content-middle__sub-label", 3, "innerHTML"], [3, "href", "target"], ["href", "javascript:void(0)", 3, "click"]], template: function EuiNotificationItemComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵelementStart(0, "div", 0);
        i0.ɵɵlistener("click", function EuiNotificationItemComponent_Template_div_click_0_listener($event) { return ctx.onItemClick($event); });
        i0.ɵɵelementStart(1, "div", 1);
        i0.ɵɵtemplate(2, EuiNotificationItemComponent_div_2_Template, 8, 11, "div", 2);
        i0.ɵɵtemplate(3, EuiNotificationItemComponent_div_3_Template, 2, 0, "div", 3);
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(4, "span", 4);
        i0.ɵɵtemplate(5, EuiNotificationItemComponent_ng_template_5_Template, 6, 11, "ng-template", 5);
        i0.ɵɵtemplate(6, EuiNotificationItemComponent_ng_template_6_Template, 6, 12, "ng-template", 5);
        i0.ɵɵtemplate(7, EuiNotificationItemComponent_ng_template_7_Template, 5, 10, "ng-template", 5);
        i0.ɵɵelementEnd();
        i0.ɵɵelementStart(8, "div", 6);
        i0.ɵɵtemplate(9, EuiNotificationItemComponent_a_9_Template, 3, 3, "a", 7);
        i0.ɵɵelementEnd();
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(7, _c2, ctx.item.metadata == null ? null : ctx.item.metadata.read, !ctx.item.metadata));
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.item.metadata == null ? null : ctx.item.metadata.date);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.item.metadata == null ? null : ctx.item.metadata.important);
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.item.metadata == null ? null : ctx.item.metadata.url);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.item.metadata == null ? null : ctx.item.metadata.urlExternal);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", !(ctx.item.metadata == null ? null : ctx.item.metadata.url) && !(ctx.item.metadata == null ? null : ctx.item.metadata.urlExternal));
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.isShowMarkAsRead && ctx.item.metadata && !ctx.item.metadata.read);
    } }, directives: [i1.NgClass, i1.NgIf], pipes: [i2.DateFormatPipe, i2.LocalTimePipe, i3.EuiTruncatePipe, i4.TranslatePipe], encapsulation: 2 });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(EuiNotificationItemComponent, [{
        type: Component,
        args: [{
                selector: 'eui-notification-item',
                templateUrl: './eui-notification-item.component.html',
            }]
    }], null, { string: [{
            type: HostBinding,
            args: ['class']
        }], item: [{
            type: Input
        }], dateFormat: [{
            type: Input
        }], isShowMarkAsRead: [{
            type: Input
        }], markAsReadLabel: [{
            type: Input
        }], itemClick: [{
            type: Output
        }], itemMarkAsRead: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 