/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
import { ChangeDetectionStrategy, Component, ElementRef, Inject, Input, Optional, Renderer2, SkipSelf, ViewChild, ViewEncapsulation } from '@angular/core';
import { NzIsMenuInsideDropDownToken } from './menu.token';
import * as i0 from "@angular/core";
import * as i1 from "ng-zorro-antd/core";
import * as i2 from "@angular/common";
var _c0 = ["titleElement"];
var _c1 = ["nz-menu-group", ""];
function NzMenuGroupComponent_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r361 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r361.nzTitle);
} }
function NzMenuGroupComponent_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵprojection(0, 1, ["*ngIf", "!nzTitle"]);
} }
var _c2 = ["*", [["", "title", ""]]];
var _c3 = ["*", "[title]"];
var NzMenuGroupComponent = /** @class */ (function () {
    function NzMenuGroupComponent(elementRef, renderer, isMenuInsideDropDown) {
        this.elementRef = elementRef;
        this.renderer = renderer;
        this.isMenuInsideDropDown = isMenuInsideDropDown;
        var className = this.isMenuInsideDropDown ? 'ant-dropdown-menu-item-group' : 'ant-menu-item-group';
        this.renderer.addClass(elementRef.nativeElement, className);
    }
    NzMenuGroupComponent.prototype.ngAfterViewInit = function () {
        var ulElement = this.renderer.nextSibling(this.titleElement.nativeElement);
        if (ulElement) {
            /** add classname to ul **/
            var className = this.isMenuInsideDropDown ? 'ant-dropdown-menu-item-group-list' : 'ant-menu-item-group-list';
            this.renderer.addClass(ulElement, className);
        }
    };
    /** @nocollapse */ NzMenuGroupComponent.ɵfac = function NzMenuGroupComponent_Factory(t) { return new (t || NzMenuGroupComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(NzIsMenuInsideDropDownToken)); };
    /** @nocollapse */ NzMenuGroupComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzMenuGroupComponent, selectors: [["", "nz-menu-group", ""]], viewQuery: function NzMenuGroupComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, true);
        } if (rf & 2) {
            var _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.titleElement = _t.first);
        } }, inputs: { nzTitle: "nzTitle" }, exportAs: ["nzMenuGroup"], features: [i0.ɵɵProvidersFeature([
                /** check if menu inside dropdown-menu component **/
                {
                    provide: NzIsMenuInsideDropDownToken,
                    useFactory: (function (isMenuInsideDropDownToken) {
                        return isMenuInsideDropDownToken ? isMenuInsideDropDownToken : false;
                    }),
                    deps: [[new SkipSelf(), new Optional(), NzIsMenuInsideDropDownToken]]
                }
            ])], attrs: _c1, ngContentSelectors: _c3, decls: 5, vars: 6, consts: [["titleElement", ""], [4, "nzStringTemplateOutlet"], [4, "ngIf"]], template: function NzMenuGroupComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵprojectionDef(_c2);
            i0.ɵɵelementStart(0, "div", null, 0);
            i0.ɵɵtemplate(2, NzMenuGroupComponent_ng_container_2_Template, 2, 1, "ng-container", 1);
            i0.ɵɵtemplate(3, NzMenuGroupComponent_3_Template, 1, 0, undefined, 2);
            i0.ɵɵelementEnd();
            i0.ɵɵprojection(4);
        } if (rf & 2) {
            i0.ɵɵclassProp("ant-menu-item-group-title", !ctx.isMenuInsideDropDown)("ant-dropdown-menu-item-group-title", ctx.isMenuInsideDropDown);
            i0.ɵɵadvance(2);
            i0.ɵɵproperty("nzStringTemplateOutlet", ctx.nzTitle);
            i0.ɵɵadvance(1);
            i0.ɵɵproperty("ngIf", !ctx.nzTitle);
        } }, directives: [i1.NzStringTemplateOutletDirective, i2.NgIf], encapsulation: 2, changeDetection: 0 });
    return NzMenuGroupComponent;
}());
export { NzMenuGroupComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzMenuGroupComponent, [{
        type: Component,
        args: [{
                selector: '[nz-menu-group]',
                exportAs: 'nzMenuGroup',
                changeDetection: ChangeDetectionStrategy.OnPush,
                providers: [
                    /** check if menu inside dropdown-menu component **/
                    {
                        provide: NzIsMenuInsideDropDownToken,
                        useFactory: (function (isMenuInsideDropDownToken) {
                            return isMenuInsideDropDownToken ? isMenuInsideDropDownToken : false;
                        }),
                        deps: [[new SkipSelf(), new Optional(), NzIsMenuInsideDropDownToken]]
                    }
                ],
                encapsulation: ViewEncapsulation.None,
                template: "\n    <div\n      [class.ant-menu-item-group-title]=\"!isMenuInsideDropDown\"\n      [class.ant-dropdown-menu-item-group-title]=\"isMenuInsideDropDown\"\n      #titleElement\n    >\n      <ng-container *nzStringTemplateOutlet=\"nzTitle\">{{ nzTitle }}</ng-container>\n      <ng-content select=\"[title]\" *ngIf=\"!nzTitle\"></ng-content>\n    </div>\n    <ng-content></ng-content>\n  ",
                preserveWhitespaces: false
            }]
    }], function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
                type: Inject,
                args: [NzIsMenuInsideDropDownToken]
            }] }]; }, { nzTitle: [{
            type: Input
        }], titleElement: [{
            type: ViewChild,
            args: ['titleElement']
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 