import { AlRoute } from '@al/core';
import { Component, Input, Output, TemplateRef, EventEmitter, } from '@angular/core';
import { Router } from '@angular/router';
import { AlNavigationService } from '../../services/al-navigation.service';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
import * as i2 from "../../services/al-navigation.service";
import * as i3 from "@angular/common";
const _c0 = function (a0) { return { "active": a0 }; };
function AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_li_0_Template(rf, ctx) { if (rf & 1) {
    const _r9 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "li", 7);
    i0.ɵɵlistener("click", function AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_li_0_Template_li_click_0_listener($event) { i0.ɵɵrestoreView(_r9); const menuItem_r5 = i0.ɵɵnextContext().$implicit; const ctx_r7 = i0.ɵɵnextContext(3); return ctx_r7.onClick(menuItem_r5, $event); })("mouseover", function AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_li_0_Template_li_mouseover_0_listener($event) { i0.ɵɵrestoreView(_r9); const menuItem_r5 = i0.ɵɵnextContext().$implicit; const ctx_r10 = i0.ɵɵnextContext(3); return ctx_r10.onHoverStart(menuItem_r5, $event); });
    i0.ɵɵelementStart(1, "a", 8);
    i0.ɵɵlistener("click", function AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_li_0_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r9); const menuItem_r5 = i0.ɵɵnextContext().$implicit; const ctx_r12 = i0.ɵɵnextContext(3); return ctx_r12.onClick(menuItem_r5, $event); });
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const menuItem_r5 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(4, _c0, menuItem_r5.activated));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(6, _c0, menuItem_r5.activated))("href", menuItem_r5.href || "", i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(menuItem_r5.caption);
} }
function AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_li_0_Template, 3, 8, "li", 6);
} if (rf & 2) {
    const menuItem_r5 = ctx.$implicit;
    i0.ɵɵproperty("ngIf", menuItem_r5.visible);
} }
function AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "ul");
    i0.ɵɵtemplate(1, AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_ng_template_1_Template, 1, 1, "ng-template", 5);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r2.menu.children);
} }
function AlArchipeligo17TertiaryMenuComponent_nav_0_ng_container_2_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 0, ["*ngTemplateOutlet", "contentRef"]);
} }
function AlArchipeligo17TertiaryMenuComponent_nav_0_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AlArchipeligo17TertiaryMenuComponent_nav_0_ng_container_2_1_Template, 1, 0, undefined, 9);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", ctx_r3.contentRef);
} }
function AlArchipeligo17TertiaryMenuComponent_nav_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "nav", 3);
    i0.ɵɵtemplate(1, AlArchipeligo17TertiaryMenuComponent_nav_0_ul_1_Template, 2, 1, "ul", 4);
    i0.ɵɵtemplate(2, AlArchipeligo17TertiaryMenuComponent_nav_0_ng_container_2_Template, 2, 1, "ng-container", 4);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.menu);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.renderCustomSidenav);
} }
const _c1 = function (a0, a1) { return { "active": a0, "disabled": a1 }; };
function AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_div_0_Template(rf, ctx) { if (rf & 1) {
    const _r21 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 7);
    i0.ɵɵlistener("click", function AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_div_0_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r21); const tab_r17 = i0.ɵɵnextContext().$implicit; const ctx_r19 = i0.ɵɵnextContext(2); return ctx_r19.onClick(tab_r17, $event); })("mouseover", function AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_div_0_Template_div_mouseover_0_listener($event) { i0.ɵɵrestoreView(_r21); const tab_r17 = i0.ɵɵnextContext().$implicit; const ctx_r22 = i0.ɵɵnextContext(2); return ctx_r22.onHoverStart(tab_r17, $event); });
    i0.ɵɵelementStart(1, "a", 8);
    i0.ɵɵlistener("click", function AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_div_0_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r21); const tab_r17 = i0.ɵɵnextContext().$implicit; const ctx_r24 = i0.ɵɵnextContext(2); return ctx_r24.onClick(tab_r17, $event); });
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const tab_r17 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("ngClass", tab_r17.properties.consolidated_css_classes);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(4, _c1, tab_r17.activated, !tab_r17.enabled))("href", tab_r17.href || "", i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(tab_r17.caption);
} }
function AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_div_0_Template, 3, 7, "div", 6);
} if (rf & 2) {
    const tab_r17 = ctx.$implicit;
    i0.ɵɵproperty("ngIf", tab_r17.visible);
} }
function AlArchipeligo17TertiaryMenuComponent_section_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "section", 10);
    i0.ɵɵelementStart(1, "div", 11);
    i0.ɵɵtemplate(2, AlArchipeligo17TertiaryMenuComponent_section_3_ng_template_2_Template, 1, 1, "ng-template", 5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngForOf", ctx_r1.activeTabs.children);
} }
const _c2 = [[["", 8, "custom-tertiary"]]];
const _c3 = [".custom-tertiary"];
export class AlArchipeligo17TertiaryMenuComponent {
    constructor(router, alNavigation) {
        this.router = router;
        this.alNavigation = alNavigation;
        this.visible = true;
        this.menu = null;
        this.contentRef = null;
        this.renderCustomSidenav = false;
        this.showQuaternaryMenu = true;
        this.changed = new EventEmitter();
        this.activeTabs = null;
        this.sidenavOpen = false;
        this.onMenuChanged = () => {
            if ((this.menu && this.menu.children.length > 0) || this.renderCustomSidenav) {
                if (this.sidenavOpen === false) {
                    this.sidenavOpen = true;
                    this.changed.emit(this.sidenavOpen);
                }
                this.onLocationChange();
            }
            else if (this.sidenavOpen === true) {
                this.sidenavOpen = false;
                this.changed.emit(this.sidenavOpen);
            }
        };
        this.onLocationChange = () => {
            this.activeTabs = null;
            this.checkMenu();
            if (this.menu) {
                for (let i = 0; i < this.menu.children.length; i++) {
                    this.setMenuItemClasses(this.menu.children[i]);
                    if (this.menu.children[i].activated) {
                        this.activeTabs = this.menu.children[i];
                        for (let j = 0; j < this.activeTabs.children.length; j++) {
                            this.setMenuItemClasses(this.activeTabs.children[j], true);
                        }
                    }
                }
            }
        };
    }
    ngOnChanges(changes) {
        this.activeTabs = null;
        if (changes.hasOwnProperty("menu") || changes.hasOwnProperty("contentRef") || changes.hasOwnProperty("renderCustomSidenav")) {
            this.onMenuChanged();
        }
    }
    onClick(menuItem, $event) {
        if ($event) {
            $event.stopPropagation();
            $event.preventDefault();
        }
        menuItem.dispatch();
        setTimeout(() => {
            this.onMenuChanged();
        }, 500);
    }
    onHoverStart(menuItem, $event) {
        menuItem.refresh(true);
    }
    setMenuItemClasses(route, hasCuartoTab = false) {
        let classes = [route.getProperty("css_class", "default")];
        if (route.activated) {
            classes.push('active');
        }
        if (!route.activated) {
            classes.push("disabled");
        }
        if (hasCuartoTab) {
            classes.push("cuarto-tab");
        }
        classes.push(route.definition.id ? route.definition.id.replace(/\:/g, "_") : route.caption.replace(/\s/g, "_"));
        route.setProperty("consolidated_css_classes", classes.join(" "));
    }
    checkMenu() {
        if (this.menu) {
            this.menu = !this.menu.getProperty("childOutletOnly") ? this.menu : null;
        }
    }
}
/** @nocollapse */ AlArchipeligo17TertiaryMenuComponent.ɵfac = function AlArchipeligo17TertiaryMenuComponent_Factory(t) { return new (t || AlArchipeligo17TertiaryMenuComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i2.AlNavigationService)); };
/** @nocollapse */ AlArchipeligo17TertiaryMenuComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlArchipeligo17TertiaryMenuComponent, selectors: [["al-archipeligo17-tertiary-menu"]], inputs: { visible: "visible", menu: "menu", contentRef: "contentRef", renderCustomSidenav: "renderCustomSidenav", showQuaternaryMenu: "showQuaternaryMenu" }, outputs: { changed: "changed" }, features: [i0.ɵɵNgOnChangesFeature], ngContentSelectors: _c3, decls: 4, vars: 5, consts: [["class", "sideNav", 4, "ngIf"], [1, "", 3, "ngClass"], ["class", "navigation-tabs", 4, "ngIf"], [1, "sideNav"], [4, "ngIf"], ["ngFor", "", 3, "ngForOf"], [3, "ngClass", "click", "mouseover", 4, "ngIf"], [3, "ngClass", "click", "mouseover"], [3, "ngClass", "href", "click"], [4, "ngTemplateOutlet"], [1, "navigation-tabs"], [1, "tab-container"]], template: function AlArchipeligo17TertiaryMenuComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵprojectionDef(_c2);
        i0.ɵɵtemplate(0, AlArchipeligo17TertiaryMenuComponent_nav_0_Template, 3, 2, "nav", 0);
        i0.ɵɵelementStart(1, "main", 1);
        i0.ɵɵpipe(2, "async");
        i0.ɵɵtemplate(3, AlArchipeligo17TertiaryMenuComponent_section_3_Template, 3, 1, "section", 2);
        i0.ɵɵelementEnd();
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.visible && (ctx.menu || ctx.renderCustomSidenav));
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngClass", i0.ɵɵpipeBind1(2, 3, ctx.alNavigation.tertiaryContentClass$));
        i0.ɵɵadvance(2);
        i0.ɵɵproperty("ngIf", ctx.showQuaternaryMenu && ctx.activeTabs && ctx.activeTabs.children.length > 1);
    } }, directives: [i3.NgIf, i3.NgClass, i3.NgForOf, i3.NgTemplateOutlet], pipes: [i3.AsyncPipe], styles: ["[_nghost-%COMP%]     .sideNav{height:100vh;background-color:#fbfbfb}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left h2{margin:0;font-size:1em;align-items:center;display:flex;color:#fff;padding:7px 35px}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left h2>i{font-size:2.571em;display:flex;margin-right:10px}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left .title{display:flex;flex-flow:column;padding-top:24px;padding-bottom:24px;border-bottom:1px solid #ededed}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left .title>h3{height:60px;padding:2px;margin:0 30px;font-size:1em;display:flex;font-weight:700;word-wrap:break-word;overflow:hidden}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .active{background-color:#535353;color:#fff;font-weight:700}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .active:hover{background:#535353}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul{display:flex;flex-flow:column;margin:0;width:100%;list-style:none;padding:0;text-align:left}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>ul>li, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>ul>li{padding-left:60px}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li{display:flex;justify-content:space-between;align-items:center;padding:9px 20px 10px 40px;cursor:pointer}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li>a, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li>a{font-weight:400;color:#212121;text-decoration:none}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li>a.active, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li>a.active{background-color:#535353;color:#fff;font-weight:700}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li>a.active:hover, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li>a.active:hover{background:#535353}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li:hover, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li:hover{background:#ededed}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li:hover.active, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li:hover.active{background-color:#535353;color:#fff;font-weight:700}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .left-nav ul>li:hover.active:hover, [_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav>ul>li:hover.active:hover{background:#535353}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left nav .optionLabel{margin-left:10px}[_nghost-%COMP%]     div.embedded-layout div.tertiary-navigation-left path{fill:none}[_nghost-%COMP%]     div.tertiary-content{width:100%;box-sizing:border-box;padding:var(--ald-g-space-6) var(--ald-g-space-10)}[_nghost-%COMP%]     div.tertiary-content.body-content, [_nghost-%COMP%]     div.tertiary-content.with-padding{padding:var(--ald-g-space-6) var(--ald-g-space-10)}[_nghost-%COMP%]     div.tertiary-content section.navigation-tabs{display:block;margin:36px 40px 10px;border-bottom:3px solid #ededed}[_nghost-%COMP%]     div.tertiary-content section.navigation-tabs div.tab-container{display:flex;flex-direction:columns}[_nghost-%COMP%]     div.tertiary-content section.navigation-tabs div.tab-container div.cuarto-tab{padding:5px 15px;margin-bottom:-3px}[_nghost-%COMP%]     div.tertiary-content section.navigation-tabs div.tab-container div.cuarto-tab.active{font-weight:700;border-bottom:3px solid #ffb74d}[_nghost-%COMP%]     div.tertiary-content section.navigation-tabs div.tab-container div.cuarto-tab.active>a{color:#535353}[_nghost-%COMP%]     div.tertiary-content section.navigation-tabs div.tab-container div.cuarto-tab a{text-decoration:none;color:#a8a8a8}[_nghost-%COMP%]     div.tertiary-content section.content{display:flex;flex:1 1;min-height:200px}"] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlArchipeligo17TertiaryMenuComponent, [{
        type: Component,
        args: [{
                selector: 'al-archipeligo17-tertiary-menu',
                templateUrl: './al-archipeligo17-tertiary-menu.component.html',
                styleUrls: ['./al-archipeligo17-tertiary-menu.component.scss']
            }]
    }], function () { return [{ type: i1.Router }, { type: i2.AlNavigationService }]; }, { visible: [{
            type: Input
        }], menu: [{
            type: Input
        }], contentRef: [{
            type: Input
        }], renderCustomSidenav: [{
            type: Input
        }], showQuaternaryMenu: [{
            type: Input
        }], changed: [{
            type: Output
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 