(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/platform'), require('@angular/core')) :
    typeof define === 'function' && define.amd ? define('ng-zorro-antd/core/transition-patch', ['exports', '@angular/cdk/platform', '@angular/core'], factory) :
    (global = global || self, factory((global['ng-zorro-antd'] = global['ng-zorro-antd'] || {}, global['ng-zorro-antd'].core = global['ng-zorro-antd'].core || {}, global['ng-zorro-antd'].core['transition-patch'] = {}), global.ng.cdk.platform, global.ng.core));
}(this, (function (exports, platform, core) { 'use strict';

    /**
     * @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
     */
    /**
     * hack the bug
     * angular router change with unexpected transition trigger after calling applicationRef.attachView
     * https://github.com/angular/angular/issues/34718
     */
    var NzTransitionPatchDirective = /** @class */ (function () {
        function NzTransitionPatchDirective(elementRef, renderer) {
            this.elementRef = elementRef;
            this.renderer = renderer;
            this.hidden = null;
            this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
        }
        NzTransitionPatchDirective.prototype.setHiddenAttribute = function () {
            if (this.hidden === true) {
                this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', '');
            }
            else if (this.hidden === false || this.hidden === null) {
                this.renderer.removeAttribute(this.elementRef.nativeElement, 'hidden');
            }
            else if (typeof this.hidden === 'string') {
                this.renderer.setAttribute(this.elementRef.nativeElement, 'hidden', this.hidden);
            }
        };
        NzTransitionPatchDirective.prototype.ngOnChanges = function () {
            this.setHiddenAttribute();
        };
        NzTransitionPatchDirective.prototype.ngAfterViewInit = function () {
            this.setHiddenAttribute();
        };
        /** @nocollapse */ NzTransitionPatchDirective.ɵfac = function NzTransitionPatchDirective_Factory(t) { return new (t || NzTransitionPatchDirective)(core["ɵɵdirectiveInject"](core.ElementRef), core["ɵɵdirectiveInject"](core.Renderer2)); };
        /** @nocollapse */ NzTransitionPatchDirective.ɵdir = core["ɵɵdefineDirective"]({ type: NzTransitionPatchDirective, selectors: [["", "nz-button", ""], ["nz-button-group"], ["", "nz-icon", ""], ["", "nz-menu-item", ""], ["", "nz-submenu", ""]], inputs: { hidden: "hidden" }, features: [core["ɵɵNgOnChangesFeature"]] });
        return NzTransitionPatchDirective;
    }());
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTransitionPatchDirective, [{
            type: core.Directive,
            args: [{
                    selector: '[nz-button],nz-button-group,[nz-icon],[nz-menu-item],[nz-submenu]'
                }]
        }], function () { return [{ type: core.ElementRef }, { type: core.Renderer2 }]; }, { hidden: [{
                type: core.Input
            }] }); })();

    /**
     * @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
     */
    var NzTransitionPatchModule = /** @class */ (function () {
        function NzTransitionPatchModule() {
        }
        /** @nocollapse */ NzTransitionPatchModule.ɵmod = core["ɵɵdefineNgModule"]({ type: NzTransitionPatchModule });
        /** @nocollapse */ NzTransitionPatchModule.ɵinj = core["ɵɵdefineInjector"]({ factory: function NzTransitionPatchModule_Factory(t) { return new (t || NzTransitionPatchModule)(); }, imports: [[platform.PlatformModule]] });
        return NzTransitionPatchModule;
    }());
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && core["ɵɵsetNgModuleScope"](NzTransitionPatchModule, { declarations: [NzTransitionPatchDirective], imports: [platform.PlatformModule], exports: [NzTransitionPatchDirective] }); })();
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTransitionPatchModule, [{
            type: core.NgModule,
            args: [{
                    imports: [platform.PlatformModule],
                    exports: [NzTransitionPatchDirective],
                    declarations: [NzTransitionPatchDirective]
                }]
        }], null, null); })();

    exports.ɵNzTransitionPatchDirective = NzTransitionPatchDirective;
    exports.ɵNzTransitionPatchModule = NzTransitionPatchModule;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=ng-zorro-antd-core-transition-patch.umd.js.map
