import { AlRoute, AlSubscriptionGroup } from '@al/core';
import { Component, Input, } from '@angular/core';
import { AlNavigationService } from '../../services/al-navigation.service';
import { AlNavigationContextChanged } from '../../types';
import * as i0 from "@angular/core";
import * as i1 from "../../services/al-navigation.service";
import * as i2 from "@angular/common";
const _c0 = function (a0) { return { "activated u-border-b-2 u-border-solid u-border-amber-500": a0 }; };
const _c1 = function (a0) { return [a0]; };
function AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_ng_container_1_span_1_Template(rf, ctx) { if (rf & 1) {
    const _r8 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵlistener("click", function AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_ng_container_1_span_1_Template_span_click_0_listener($event) { i0.ɵɵrestoreView(_r8); const child_r4 = i0.ɵɵnextContext().$implicit; const ctx_r6 = i0.ɵɵnextContext(3); return ctx_r6.dispatch(child_r4, $event); });
    i0.ɵɵelementStart(1, "a", 8);
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const child_r4 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵclassMapInterpolate1("u-z-1 ", child_r4.caption, "");
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(7, _c0, child_r4.activated));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("href", child_r4.href, i0.ɵɵsanitizeUrl)("ngClass", i0.ɵɵpureFunction1(9, _c1, child_r4.activated ? "activated u-text-primary" : "u-text-secondary"));
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1("", child_r4.caption, " ");
} }
function AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_ng_container_1_span_1_Template, 3, 11, "span", 5);
    i0.ɵɵelement(2, "div", 6);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const child_r4 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", child_r4.visible);
} }
function AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "section", 3);
    i0.ɵɵtemplate(1, AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_ng_container_1_Template, 3, 1, "ng-container", 4);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r1.menu.children);
} }
const _c2 = function (a0, a1) { return { "active": a0, "disabled": a1 }; };
function AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_div_0_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 14);
    i0.ɵɵlistener("click", function AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_div_0_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r15); const tab_r11 = i0.ɵɵnextContext().$implicit; const ctx_r13 = i0.ɵɵnextContext(3); return ctx_r13.onClick(tab_r11, $event); })("mouseover", function AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_div_0_Template_div_mouseover_0_listener($event) { i0.ɵɵrestoreView(_r15); const tab_r11 = i0.ɵɵnextContext().$implicit; const ctx_r16 = i0.ɵɵnextContext(3); return ctx_r16.onHoverStart(tab_r11, $event); });
    i0.ɵɵelementStart(1, "a", 15);
    i0.ɵɵlistener("click", function AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_div_0_Template_a_click_1_listener($event) { i0.ɵɵrestoreView(_r15); const tab_r11 = i0.ɵɵnextContext().$implicit; const ctx_r18 = i0.ɵɵnextContext(3); return ctx_r18.onClick(tab_r11, $event); });
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const tab_r11 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("ngClass", tab_r11.properties.consolidated_css_classes);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction2(4, _c2, tab_r11.activated, !tab_r11.enabled))("href", tab_r11._href || "", i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(tab_r11.caption);
} }
function AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_div_0_Template, 3, 7, "div", 13);
} if (rf & 2) {
    const tab_r11 = ctx.$implicit;
    i0.ɵɵproperty("ngIf", tab_r11.visible);
} }
function AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "section", 9);
    i0.ɵɵelementStart(1, "div", 10);
    i0.ɵɵpipe(2, "async");
    i0.ɵɵelementStart(3, "div", 11);
    i0.ɵɵtemplate(4, AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_ng_template_4_Template, 1, 1, "ng-template", 12);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngClass", i0.ɵɵpipeBind1(2, 2, ctx_r2.alNavigation.tertiaryContentClass$));
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("ngForOf", ctx_r2.menu.children);
} }
function AlArchipeligo19ContentMenuComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, AlArchipeligo19ContentMenuComponent_ng_container_0_section_1_Template, 2, 1, "section", 1);
    i0.ɵɵtemplate(2, AlArchipeligo19ContentMenuComponent_ng_container_0_section_2_Template, 5, 4, "section", 2);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.form === "archipeligo19");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.form === "archipeligo17");
} }
export class AlArchipeligo19ContentMenuComponent {
    constructor(alNavigation) {
        this.alNavigation = alNavigation;
        this.form = "archipeligo19";
        this.subscriptions = new AlSubscriptionGroup();
        this.onNavigationContextChanged = (event) => {
            if (this.menu) {
                this.setMenuItemClasses(this.menu);
            }
        };
    }
    ngOnInit() {
        this.subscriptions.manage(this.alNavigation.events.attach(AlNavigationContextChanged, this.onNavigationContextChanged));
    }
    ngOnChanges(changes) {
        if ("menu" in changes) {
            //  Refresh!
            this.menu.refresh(true);
            this.setMenuItemClasses(this.menu);
        }
    }
    ngOnDestroy() {
        this.subscriptions.cancelAll();
    }
    dispatch(route, $event) {
        if ($event) {
            $event.preventDefault();
        }
        route.dispatch();
    }
    onClick(menuItem, $event) {
        if ($event) {
            $event.stopPropagation();
            $event.preventDefault();
        }
        menuItem.dispatch();
    }
    onHoverStart(menuItem, $event) {
        menuItem.refresh(true);
    }
    setMenuItemClasses(route) {
        let classes = [route.getProperty("css_class", "default")];
        if (route.activated) {
            classes.push('active');
        }
        if (!route.activated) {
            classes.push("disabled");
        }
        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(" "));
        if (route.children) {
            route.children.forEach(child => this.setMenuItemClasses(child));
        }
    }
}
/** @nocollapse */ AlArchipeligo19ContentMenuComponent.ɵfac = function AlArchipeligo19ContentMenuComponent_Factory(t) { return new (t || AlArchipeligo19ContentMenuComponent)(i0.ɵɵdirectiveInject(i1.AlNavigationService)); };
/** @nocollapse */ AlArchipeligo19ContentMenuComponent.ɵcmp = i0.ɵɵdefineComponent({ type: AlArchipeligo19ContentMenuComponent, selectors: [["al-archipeligo19-content-menu"]], inputs: { menu: "menu", form: "form" }, features: [i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [[4, "ngIf"], ["class", "u-relative u-flex u-flex-1 u-flex-wrap tabs-archipeligo19", 4, "ngIf"], ["class", "tabs-archipeligo17", 4, "ngIf"], [1, "u-relative", "u-flex", "u-flex-1", "u-flex-wrap", "tabs-archipeligo19"], [4, "ngFor", "ngForOf"], [3, "class", "ngClass", "click", 4, "ngIf"], [1, "u-absolute", "u-bottom-0", "u-left-0", "u-w-100%", "u-border", "u-border-solid", "u-border-secondary"], [3, "ngClass", "click"], [1, "u-flex", "u-items-center", "u-text-sm", "u-px-6", "u-py-3", "u-font-medium", "u-no-underline", "hover:u-text-secondary", 3, "href", "ngClass"], [1, "tabs-archipeligo17"], [1, "navigation-tabs", 3, "ngClass"], [1, "tab-container"], ["ngFor", "", 3, "ngForOf"], [3, "ngClass", "click", "mouseover", 4, "ngIf"], [3, "ngClass", "click", "mouseover"], [3, "ngClass", "href", "click"]], template: function AlArchipeligo19ContentMenuComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, AlArchipeligo19ContentMenuComponent_ng_container_0_Template, 3, 2, "ng-container", 0);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", ctx.menu);
    } }, directives: [i2.NgIf, i2.NgForOf, i2.NgClass], pipes: [i2.AsyncPipe], styles: ["section.tabs-archipeligo17[_ngcontent-%COMP%]   div.navigation-tabs[_ngcontent-%COMP%]{display:block;margin:36px 40px;border-bottom:3px solid #ededed}section.tabs-archipeligo17[_ngcontent-%COMP%]   div.navigation-tabs[_ngcontent-%COMP%]   div.tab-container[_ngcontent-%COMP%]{display:flex;flex-direction:columns}section.tabs-archipeligo17[_ngcontent-%COMP%]   div.navigation-tabs[_ngcontent-%COMP%]   div.tab-container[_ngcontent-%COMP%]   div.cuarto-tab[_ngcontent-%COMP%]{padding:5px 15px;margin-bottom:-3px}section.tabs-archipeligo17[_ngcontent-%COMP%]   div.navigation-tabs[_ngcontent-%COMP%]   div.tab-container[_ngcontent-%COMP%]   div.cuarto-tab.active[_ngcontent-%COMP%]{font-weight:700;border-bottom:3px solid #ffb74d}section.tabs-archipeligo17[_ngcontent-%COMP%]   div.navigation-tabs[_ngcontent-%COMP%]   div.tab-container[_ngcontent-%COMP%]   div.cuarto-tab.active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{color:#535353}section.tabs-archipeligo17[_ngcontent-%COMP%]   div.navigation-tabs[_ngcontent-%COMP%]   div.tab-container[_ngcontent-%COMP%]   div.cuarto-tab[_ngcontent-%COMP%]   a[_ngcontent-%COMP%]{text-decoration:none;color:#a8a8a8}"] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(AlArchipeligo19ContentMenuComponent, [{
        type: Component,
        args: [{
                selector: 'al-archipeligo19-content-menu',
                templateUrl: './al-archipeligo19-content-menu.component.html',
                styleUrls: ['./al-archipeligo19-content-menu.component.scss']
            }]
    }], function () { return [{ type: i1.AlNavigationService }]; }, { menu: [{
            type: Input
        }], form: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 