/**
 * @packageDocumentation
 * @module async-data
 */
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Reason } from '../../page-guard/public-api';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
function ErrorStateComponent_div_0_ng_container_3_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    const _r6 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "button", 3);
    i0.ɵɵlistener("click", function ErrorStateComponent_div_0_ng_container_3_ng_container_1_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r5.backToList()); });
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "return_resource_list"), " ");
} }
function ErrorStateComponent_div_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, ErrorStateComponent_div_0_ng_container_3_ng_container_1_Template, 4, 3, "ng-container", 2);
    i0.ɵɵelementContainerEnd();
} }
function ErrorStateComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div")(1, "acl-page-guard", 1);
    i0.ɵɵpipe(2, "translate");
    i0.ɵɵtemplate(3, ErrorStateComponent_div_0_ng_container_3_Template, 2, 0, "ng-container", 0);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("allowed", false)("reason", ctx_r0.reason.NoPermission)("title", i0.ɵɵpipeBind1(2, 5, "no_view_permission"))("description", "");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r0.showBackButton);
} }
function ErrorStateComponent_div_1_ng_container_3_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    const _r10 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "button", 3);
    i0.ɵɵlistener("click", function ErrorStateComponent_div_1_ng_container_3_ng_container_1_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r9.backToList()); });
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "return_resource_list"), " ");
} }
function ErrorStateComponent_div_1_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, ErrorStateComponent_div_1_ng_container_3_ng_container_1_Template, 4, 3, "ng-container", 2);
    i0.ɵɵelementContainerEnd();
} }
function ErrorStateComponent_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div")(1, "acl-page-guard", 1);
    i0.ɵɵpipe(2, "translate");
    i0.ɵɵtemplate(3, ErrorStateComponent_div_1_ng_container_3_Template, 2, 0, "ng-container", 0);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("allowed", false)("reason", ctx_r1.reason.NotFound)("title", i0.ɵɵpipeBind1(2, 5, "resource_not_exist"))("description", "");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r1.showBackButton);
} }
function ErrorStateComponent_div_2_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    const _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "button", 3);
    i0.ɵɵlistener("click", function ErrorStateComponent_div_2_ng_container_3_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r12.reload.emit()); });
    i0.ɵɵtext(2);
    i0.ɵɵpipe(3, "translate");
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "reload"), " ");
} }
function ErrorStateComponent_div_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div")(1, "acl-page-guard", 1);
    i0.ɵɵpipe(2, "translate");
    i0.ɵɵtemplate(3, ErrorStateComponent_div_2_ng_container_3_Template, 4, 3, "ng-container", 2);
    i0.ɵɵelementEnd()();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("allowed", false)("reason", ctx_r2.reason.Disconnected)("title", i0.ɵɵpipeBind1(2, 4, "loading_error"))("description", "");
} }
export class ErrorStateComponent {
    constructor(router, route) {
        this.router = router;
        this.route = route;
        this.reload = new EventEmitter();
        this.redirect = new EventEmitter();
        this.reason = Reason;
    }
    backToList() {
        this.redirect.emit();
        if (this.autoRedirect && this.showBackButton) {
            this.router.navigate([this.backLink || '../..'], {
                relativeTo: this.route,
            });
        }
    }
}
ErrorStateComponent.ɵfac = function ErrorStateComponent_Factory(t) { return new (t || ErrorStateComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i1.ActivatedRoute)); };
ErrorStateComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ErrorStateComponent, selectors: [["acl-error-state"]], inputs: { errorCode: "errorCode", autoRedirect: "autoRedirect", showBackButton: "showBackButton", backLink: "backLink" }, outputs: { reload: "reload", redirect: "redirect" }, decls: 3, vars: 3, consts: [[4, "ngIf"], [3, "allowed", "reason", "title", "description"], [4, "aclPageGuardOperation"], ["aui-button", "primary", 3, "click"]], template: function ErrorStateComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, ErrorStateComponent_div_0_Template, 4, 7, "div", 0);
        i0.ɵɵtemplate(1, ErrorStateComponent_div_1_Template, 4, 7, "div", 0);
        i0.ɵɵtemplate(2, ErrorStateComponent_div_2_Template, 4, 6, "div", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.errorCode === 403);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.errorCode === 404);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.errorCode !== 403 && ctx.errorCode !== 404);
    } }, encapsulation: 2, changeDetection: 0 });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ErrorStateComponent, [{
        type: Component,
        args: [{ selector: 'acl-error-state', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"errorCode === 403\">\n  <acl-page-guard\n    [allowed]=\"false\"\n    [reason]=\"reason.NoPermission\"\n    [title]=\"'no_view_permission' | translate\"\n    [description]=\"''\"\n  >\n    <ng-container *ngIf=\"showBackButton\">\n      <ng-container *aclPageGuardOperation>\n        <button\n          aui-button=\"primary\"\n          (click)=\"backToList()\"\n        >\n          {{ 'return_resource_list' | translate }}\n        </button>\n      </ng-container>\n    </ng-container>\n  </acl-page-guard>\n</div>\n<div *ngIf=\"errorCode === 404\">\n  <acl-page-guard\n    [allowed]=\"false\"\n    [reason]=\"reason.NotFound\"\n    [title]=\"'resource_not_exist' | translate\"\n    [description]=\"''\"\n  >\n    <ng-container *ngIf=\"showBackButton\">\n      <ng-container *aclPageGuardOperation>\n        <button\n          aui-button=\"primary\"\n          (click)=\"backToList()\"\n        >\n          {{ 'return_resource_list' | translate }}\n        </button>\n      </ng-container>\n    </ng-container>\n  </acl-page-guard>\n</div>\n<div *ngIf=\"errorCode !== 403 && errorCode !== 404\">\n  <acl-page-guard\n    [allowed]=\"false\"\n    [reason]=\"reason.Disconnected\"\n    [title]=\"'loading_error' | translate\"\n    [description]=\"''\"\n  >\n    <ng-container *aclPageGuardOperation>\n      <button\n        aui-button=\"primary\"\n        (click)=\"reload.emit()\"\n      >\n        {{ 'reload' | translate }}\n      </button>\n    </ng-container>\n  </acl-page-guard>\n</div>\n" }]
    }], function () { return [{ type: i1.Router }, { type: i1.ActivatedRoute }]; }, { errorCode: [{
            type: Input
        }], autoRedirect: [{
            type: Input
        }], showBackButton: [{
            type: Input
        }], backLink: [{
            type: Input
        }], reload: [{
            type: Output
        }], redirect: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 