(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ng-zorro-antd/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('ng-zorro-antd/icon'), require('@angular/cdk/platform')) :
    typeof define === 'function' && define.amd ? define('ng-zorro-antd/timeline', ['exports', '@angular/core', 'ng-zorro-antd/core', 'rxjs', 'rxjs/operators', '@angular/common', 'ng-zorro-antd/icon', '@angular/cdk/platform'], factory) :
    (global = global || self, factory((global['ng-zorro-antd'] = global['ng-zorro-antd'] || {}, global['ng-zorro-antd'].timeline = {}), global.ng.core, global['ng-zorro-antd'].core, global.rxjs, global.rxjs.operators, global.ng.common, global['ng-zorro-antd'].icon, global.ng.cdk.platform));
}(this, (function (exports, core, core$1, rxjs, operators, common, icon, platform) { '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
     */
    var _c0 = ["template"];
    function NzTimelineItemComponent_ng_template_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtext"](1);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1045 = core["ɵɵnextContext"](2);
        core["ɵɵadvance"](1);
        core["ɵɵtextInterpolate"](ctx_r1045.nzDot);
    } }
    function NzTimelineItemComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementStart"](0, "li", 1);
        core["ɵɵelement"](1, "div", 2);
        core["ɵɵelementStart"](2, "div", 3);
        core["ɵɵtemplate"](3, NzTimelineItemComponent_ng_template_0_ng_container_3_Template, 2, 1, "ng-container", 4);
        core["ɵɵelementEnd"]();
        core["ɵɵelementStart"](4, "div", 5);
        core["ɵɵprojection"](5);
        core["ɵɵelementEnd"]();
        core["ɵɵelementEnd"]();
    } if (rf & 2) {
        var ctx_r1044 = core["ɵɵnextContext"]();
        core["ɵɵclassProp"]("ant-timeline-item-right", ctx_r1044.position === "right")("ant-timeline-item-left", ctx_r1044.position === "left")("ant-timeline-item-last", ctx_r1044.isLast);
        core["ɵɵadvance"](2);
        core["ɵɵstyleProp"]("border-color", ctx_r1044.borderColor);
        core["ɵɵclassProp"]("ant-timeline-item-head-red", ctx_r1044.nzColor === "red")("ant-timeline-item-head-blue", ctx_r1044.nzColor === "blue")("ant-timeline-item-head-green", ctx_r1044.nzColor === "green")("ant-timeline-item-head-gray", ctx_r1044.nzColor === "gray")("ant-timeline-item-head-custom", !!ctx_r1044.nzDot);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("nzStringTemplateOutlet", ctx_r1044.nzDot);
    } }
    var _c1 = ["*"];
    var TimelineTimeDefaultColors = ['red', 'blue', 'green', 'grey', 'gray'];
    function isDefaultColor(color) {
        return TimelineTimeDefaultColors.findIndex(function (i) { return i === color; }) !== -1;
    }
    var NzTimelineItemComponent = /** @class */ (function () {
        function NzTimelineItemComponent(cdr) {
            this.cdr = cdr;
            this.nzColor = 'blue';
            this.isLast = false;
            this.borderColor = null;
        }
        NzTimelineItemComponent.prototype.ngOnChanges = function (changes) {
            if (changes.nzColor) {
                this.updateCustomColor();
            }
        };
        NzTimelineItemComponent.prototype.detectChanges = function () {
            this.cdr.detectChanges();
        };
        NzTimelineItemComponent.prototype.updateCustomColor = function () {
            this.borderColor = isDefaultColor(this.nzColor) ? null : this.nzColor;
        };
        /** @nocollapse */ NzTimelineItemComponent.ɵfac = function NzTimelineItemComponent_Factory(t) { return new (t || NzTimelineItemComponent)(core["ɵɵdirectiveInject"](core.ChangeDetectorRef)); };
        /** @nocollapse */ NzTimelineItemComponent.ɵcmp = core["ɵɵdefineComponent"]({ type: NzTimelineItemComponent, selectors: [["nz-timeline-item"], ["", "nz-timeline-item", ""]], viewQuery: function NzTimelineItemComponent_Query(rf, ctx) { if (rf & 1) {
                core["ɵɵviewQuery"](_c0, true);
            } if (rf & 2) {
                var _t;
                core["ɵɵqueryRefresh"](_t = core["ɵɵloadQuery"]()) && (ctx.template = _t.first);
            } }, inputs: { nzColor: "nzColor", nzDot: "nzDot" }, exportAs: ["nzTimelineItem"], features: [core["ɵɵNgOnChangesFeature"]], ngContentSelectors: _c1, decls: 2, vars: 0, consts: [["template", ""], [1, "ant-timeline-item"], [1, "ant-timeline-item-tail"], [1, "ant-timeline-item-head"], [4, "nzStringTemplateOutlet"], [1, "ant-timeline-item-content"]], template: function NzTimelineItemComponent_Template(rf, ctx) { if (rf & 1) {
                core["ɵɵprojectionDef"]();
                core["ɵɵtemplate"](0, NzTimelineItemComponent_ng_template_0_Template, 6, 19, "ng-template", null, 0, core["ɵɵtemplateRefExtractor"]);
            } }, directives: [core$1.NzStringTemplateOutletDirective], encapsulation: 2, changeDetection: 0 });
        return NzTimelineItemComponent;
    }());
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTimelineItemComponent, [{
            type: core.Component,
            args: [{
                    changeDetection: core.ChangeDetectionStrategy.OnPush,
                    encapsulation: core.ViewEncapsulation.None,
                    preserveWhitespaces: false,
                    selector: 'nz-timeline-item, [nz-timeline-item]',
                    exportAs: 'nzTimelineItem',
                    template: "\n    <ng-template #template>\n      <li\n        class=\"ant-timeline-item\"\n        [class.ant-timeline-item-right]=\"position === 'right'\"\n        [class.ant-timeline-item-left]=\"position === 'left'\"\n        [class.ant-timeline-item-last]=\"isLast\"\n      >\n        <div class=\"ant-timeline-item-tail\"></div>\n        <div\n          class=\"ant-timeline-item-head\"\n          [class.ant-timeline-item-head-red]=\"nzColor === 'red'\"\n          [class.ant-timeline-item-head-blue]=\"nzColor === 'blue'\"\n          [class.ant-timeline-item-head-green]=\"nzColor === 'green'\"\n          [class.ant-timeline-item-head-gray]=\"nzColor === 'gray'\"\n          [class.ant-timeline-item-head-custom]=\"!!nzDot\"\n          [style.border-color]=\"borderColor\"\n        >\n          <ng-container *nzStringTemplateOutlet=\"nzDot\">{{ nzDot }}</ng-container>\n        </div>\n        <div class=\"ant-timeline-item-content\">\n          <ng-content></ng-content>\n        </div>\n      </li>\n    </ng-template>\n  "
                }]
        }], function () { return [{ type: core.ChangeDetectorRef }]; }, { template: [{
                type: core.ViewChild,
                args: ['template', { static: false }]
            }], nzColor: [{
                type: core.Input
            }], nzDot: [{
                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
     */
    function NzTimelineComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainer"](0, 4);
    } if (rf & 2) {
        core["ɵɵnextContext"]();
        var _r1035 = core["ɵɵreference"](5);
        core["ɵɵproperty"]("ngTemplateOutlet", _r1035);
    } }
    function NzTimelineComponent_ng_container_2_ng_template_1_Template(rf, ctx) { }
    function NzTimelineComponent_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTimelineComponent_ng_container_2_ng_template_1_Template, 0, 0, "ng-template", 4);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var item_r1037 = ctx.$implicit;
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngTemplateOutlet", item_r1037.template);
    } }
    function NzTimelineComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainer"](0, 4);
    } if (rf & 2) {
        core["ɵɵnextContext"]();
        var _r1035 = core["ɵɵreference"](5);
        core["ɵɵproperty"]("ngTemplateOutlet", _r1035);
    } }
    function NzTimelineComponent_ng_template_4_li_0_ng_container_3_i_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 12);
    } }
    function NzTimelineComponent_ng_template_4_li_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtext"](1);
        core["ɵɵtemplate"](2, NzTimelineComponent_ng_template_4_li_0_ng_container_3_i_2_Template, 1, 0, "i", 11);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1040 = core["ɵɵnextContext"](3);
        core["ɵɵadvance"](1);
        core["ɵɵtextInterpolate1"](" ", ctx_r1040.nzPendingDot, "");
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", !ctx_r1040.nzPendingDot);
    } }
    function NzTimelineComponent_ng_template_4_li_0_ng_container_5_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtext"](1);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1041 = core["ɵɵnextContext"](3);
        core["ɵɵadvance"](1);
        core["ɵɵtextInterpolate1"](" ", ctx_r1041.isPendingBoolean ? "" : ctx_r1041.nzPending, " ");
    } }
    function NzTimelineComponent_ng_template_4_li_0_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementStart"](0, "li", 6);
        core["ɵɵelement"](1, "div", 7);
        core["ɵɵelementStart"](2, "div", 8);
        core["ɵɵtemplate"](3, NzTimelineComponent_ng_template_4_li_0_ng_container_3_Template, 3, 2, "ng-container", 9);
        core["ɵɵelementEnd"]();
        core["ɵɵelementStart"](4, "div", 10);
        core["ɵɵtemplate"](5, NzTimelineComponent_ng_template_4_li_0_ng_container_5_Template, 2, 1, "ng-container", 9);
        core["ɵɵelementEnd"]();
        core["ɵɵelementEnd"]();
    } if (rf & 2) {
        var ctx_r1039 = core["ɵɵnextContext"](2);
        core["ɵɵadvance"](3);
        core["ɵɵproperty"]("nzStringTemplateOutlet", ctx_r1039.nzPendingDot);
        core["ɵɵadvance"](2);
        core["ɵɵproperty"]("nzStringTemplateOutlet", ctx_r1039.nzPending);
    } }
    function NzTimelineComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵtemplate"](0, NzTimelineComponent_ng_template_4_li_0_Template, 6, 2, "li", 5);
    } if (rf & 2) {
        var ctx_r1036 = core["ɵɵnextContext"]();
        core["ɵɵproperty"]("ngIf", ctx_r1036.nzPending);
    } }
    var _c0$1 = ["*"];
    var TimelineModes = ['left', 'alternate', 'right'];
    var NzTimelineComponent = /** @class */ (function () {
        function NzTimelineComponent(cdr) {
            this.cdr = cdr;
            this.nzReverse = false;
            this.isPendingBoolean = false;
            this.timelineItems = [];
            this.destroy$ = new rxjs.Subject();
        }
        NzTimelineComponent.prototype.ngOnChanges = function (changes) {
            var nzMode = changes.nzMode, nzReverse = changes.nzReverse, nzPending = changes.nzPending;
            if (simpleChangeActivated(nzMode) || simpleChangeActivated(nzReverse)) {
                this.updateChildren();
            }
            if (nzPending) {
                this.isPendingBoolean = nzPending.currentValue === true;
            }
        };
        NzTimelineComponent.prototype.ngAfterContentInit = function () {
            var _this = this;
            this.updateChildren();
            this.listOfItems.changes.pipe(operators.takeUntil(this.destroy$)).subscribe(function () {
                _this.updateChildren();
            });
        };
        NzTimelineComponent.prototype.ngOnDestroy = function () {
            this.destroy$.next();
            this.destroy$.complete();
        };
        NzTimelineComponent.prototype.updateChildren = function () {
            var _this = this;
            if (this.listOfItems && this.listOfItems.length) {
                var length_1 = this.listOfItems.length;
                this.listOfItems.forEach(function (item, index) {
                    item.isLast = !_this.nzReverse ? index === length_1 - 1 : index === 0;
                    item.position =
                        _this.nzMode === 'left' || !_this.nzMode
                            ? undefined
                            : _this.nzMode === 'right'
                                ? 'right'
                                : _this.nzMode === 'alternate' && index % 2 === 0
                                    ? 'left'
                                    : 'right';
                    item.detectChanges();
                });
                this.timelineItems = this.nzReverse ? this.listOfItems.toArray().reverse() : this.listOfItems.toArray();
            }
            this.cdr.markForCheck();
        };
        /** @nocollapse */ NzTimelineComponent.ɵfac = function NzTimelineComponent_Factory(t) { return new (t || NzTimelineComponent)(core["ɵɵdirectiveInject"](core.ChangeDetectorRef)); };
        /** @nocollapse */ NzTimelineComponent.ɵcmp = core["ɵɵdefineComponent"]({ type: NzTimelineComponent, selectors: [["nz-timeline"]], contentQueries: function NzTimelineComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
                core["ɵɵcontentQuery"](dirIndex, NzTimelineItemComponent, false);
            } if (rf & 2) {
                var _t;
                core["ɵɵqueryRefresh"](_t = core["ɵɵloadQuery"]()) && (ctx.listOfItems = _t);
            } }, inputs: { nzMode: "nzMode", nzPending: "nzPending", nzPendingDot: "nzPendingDot", nzReverse: "nzReverse" }, exportAs: ["nzTimeline"], features: [core["ɵɵNgOnChangesFeature"]], ngContentSelectors: _c0$1, decls: 7, vars: 11, consts: [[1, "ant-timeline"], [3, "ngTemplateOutlet", 4, "ngIf"], [4, "ngFor", "ngForOf"], ["pendingTemplate", ""], [3, "ngTemplateOutlet"], ["class", "ant-timeline-item ant-timeline-item-pending", 4, "ngIf"], [1, "ant-timeline-item", "ant-timeline-item-pending"], [1, "ant-timeline-item-tail"], [1, "ant-timeline-item-head", "ant-timeline-item-head-custom", "ant-timeline-item-head-blue"], [4, "nzStringTemplateOutlet"], [1, "ant-timeline-item-content"], ["nz-icon", "", "nzType", "loading", 4, "ngIf"], ["nz-icon", "", "nzType", "loading"]], template: function NzTimelineComponent_Template(rf, ctx) { if (rf & 1) {
                core["ɵɵprojectionDef"]();
                core["ɵɵelementStart"](0, "ul", 0);
                core["ɵɵtemplate"](1, NzTimelineComponent_ng_container_1_Template, 1, 1, "ng-container", 1);
                core["ɵɵtemplate"](2, NzTimelineComponent_ng_container_2_Template, 2, 1, "ng-container", 2);
                core["ɵɵtemplate"](3, NzTimelineComponent_ng_container_3_Template, 1, 1, "ng-container", 1);
                core["ɵɵelementEnd"]();
                core["ɵɵtemplate"](4, NzTimelineComponent_ng_template_4_Template, 1, 1, "ng-template", null, 3, core["ɵɵtemplateRefExtractor"]);
                core["ɵɵprojection"](6);
            } if (rf & 2) {
                core["ɵɵclassProp"]("ant-timeline-right", ctx.nzMode === "right")("ant-timeline-alternate", ctx.nzMode === "alternate")("ant-timeline-pending", !!ctx.nzPending)("ant-timeline-reverse", ctx.nzReverse);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngIf", ctx.nzReverse);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngForOf", ctx.timelineItems);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngIf", !ctx.nzReverse);
            } }, directives: [common.NgIf, common.NgForOf, common.NgTemplateOutlet, core$1.NzStringTemplateOutletDirective, icon.NzIconDirective], encapsulation: 2, changeDetection: 0 });
        return NzTimelineComponent;
    }());
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTimelineComponent, [{
            type: core.Component,
            args: [{
                    changeDetection: core.ChangeDetectionStrategy.OnPush,
                    encapsulation: core.ViewEncapsulation.None,
                    preserveWhitespaces: false,
                    selector: 'nz-timeline',
                    exportAs: 'nzTimeline',
                    template: "\n    <ul\n      class=\"ant-timeline\"\n      [class.ant-timeline-right]=\"nzMode === 'right'\"\n      [class.ant-timeline-alternate]=\"nzMode === 'alternate'\"\n      [class.ant-timeline-pending]=\"!!nzPending\"\n      [class.ant-timeline-reverse]=\"nzReverse\"\n    >\n      <!-- User inserted timeline dots. -->\n      <ng-container *ngIf=\"nzReverse\" [ngTemplateOutlet]=\"pendingTemplate\"></ng-container>\n      <ng-container *ngFor=\"let item of timelineItems\">\n        <ng-template [ngTemplateOutlet]=\"item.template\"></ng-template>\n      </ng-container>\n      <ng-container *ngIf=\"!nzReverse\" [ngTemplateOutlet]=\"pendingTemplate\"></ng-container>\n      <!-- Pending dot. -->\n    </ul>\n    <ng-template #pendingTemplate>\n      <li *ngIf=\"nzPending\" class=\"ant-timeline-item ant-timeline-item-pending\">\n        <div class=\"ant-timeline-item-tail\"></div>\n        <div class=\"ant-timeline-item-head ant-timeline-item-head-custom ant-timeline-item-head-blue\">\n          <ng-container *nzStringTemplateOutlet=\"nzPendingDot\">\n            {{ nzPendingDot }}<i *ngIf=\"!nzPendingDot\" nz-icon nzType=\"loading\"></i>\n          </ng-container>\n        </div>\n        <div class=\"ant-timeline-item-content\">\n          <ng-container *nzStringTemplateOutlet=\"nzPending\">\n            {{ isPendingBoolean ? '' : nzPending }}\n          </ng-container>\n        </div>\n      </li>\n    </ng-template>\n    <!-- Grasp items -->\n    <ng-content></ng-content>\n  "
                }]
        }], function () { return [{ type: core.ChangeDetectorRef }]; }, { listOfItems: [{
                type: core.ContentChildren,
                args: [NzTimelineItemComponent]
            }], nzMode: [{
                type: core.Input
            }], nzPending: [{
                type: core.Input
            }], nzPendingDot: [{
                type: core.Input
            }], nzReverse: [{
                type: core.Input
            }] }); })();
    function simpleChangeActivated(simpleChange) {
        return !!(simpleChange && (simpleChange.previousValue !== simpleChange.currentValue || simpleChange.isFirstChange()));
    }

    /**
     * @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 NzTimelineModule = /** @class */ (function () {
        function NzTimelineModule() {
        }
        /** @nocollapse */ NzTimelineModule.ɵmod = core["ɵɵdefineNgModule"]({ type: NzTimelineModule });
        /** @nocollapse */ NzTimelineModule.ɵinj = core["ɵɵdefineInjector"]({ factory: function NzTimelineModule_Factory(t) { return new (t || NzTimelineModule)(); }, imports: [[common.CommonModule, platform.PlatformModule, icon.NzIconModule, core$1.NzOutletModule]] });
        return NzTimelineModule;
    }());
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && core["ɵɵsetNgModuleScope"](NzTimelineModule, { declarations: [NzTimelineItemComponent, NzTimelineComponent], imports: [common.CommonModule, platform.PlatformModule, icon.NzIconModule, core$1.NzOutletModule], exports: [NzTimelineItemComponent, NzTimelineComponent] }); })();
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTimelineModule, [{
            type: core.NgModule,
            args: [{
                    declarations: [NzTimelineItemComponent, NzTimelineComponent],
                    exports: [NzTimelineItemComponent, NzTimelineComponent],
                    imports: [common.CommonModule, platform.PlatformModule, icon.NzIconModule, core$1.NzOutletModule]
                }]
        }], null, null); })();

    exports.NzTimelineComponent = NzTimelineComponent;
    exports.NzTimelineItemComponent = NzTimelineItemComponent;
    exports.NzTimelineModule = NzTimelineModule;

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

})));
//# sourceMappingURL=ng-zorro-antd-timeline.umd.js.map
