(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('ng-zorro-antd/core'), require('ng-zorro-antd/icon'), require('rxjs'), require('rxjs/operators'), require('@angular/forms')) :
    typeof define === 'function' && define.amd ? define('ng-zorro-antd/tree', ['exports', '@angular/common', '@angular/core', 'ng-zorro-antd/core', 'ng-zorro-antd/icon', 'rxjs', 'rxjs/operators', '@angular/forms'], factory) :
    (global = global || self, factory((global['ng-zorro-antd'] = global['ng-zorro-antd'] || {}, global['ng-zorro-antd'].tree = {}), global.ng.common, global.ng.core, global['ng-zorro-antd'].core, global['ng-zorro-antd'].icon, global.rxjs, global.rxjs.operators, global.ng.forms));
}(this, (function (exports, common, core, core$1, icon, rxjs, operators, forms) { 'use strict';

    /*! *****************************************************************************
    Copyright (c) Microsoft Corporation. All rights reserved.
    Licensed under the Apache License, Version 2.0 (the "License"); you may not use
    this file except in compliance with the License. You may obtain a copy of the
    License at http://www.apache.org/licenses/LICENSE-2.0

    THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
    WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
    MERCHANTABLITY OR NON-INFRINGEMENT.

    See the Apache Version 2.0 License for specific language governing permissions
    and limitations under the License.
    ***************************************************************************** */
    /* global Reflect, Promise */

    var extendStatics = function(d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };

    function __extends(d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    }

    var __assign = function() {
        __assign = Object.assign || function __assign(t) {
            for (var s, i = 1, n = arguments.length; i < n; i++) {
                s = arguments[i];
                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
            }
            return t;
        };
        return __assign.apply(this, arguments);
    };

    function __rest(s, e) {
        var t = {};
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
            t[p] = s[p];
        if (s != null && typeof Object.getOwnPropertySymbols === "function")
            for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
                if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                    t[p[i]] = s[p[i]];
            }
        return t;
    }

    function __decorate(decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    }

    function __param(paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); }
    }

    function __metadata(metadataKey, metadataValue) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
    }

    function __awaiter(thisArg, _arguments, P, generator) {
        function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
        return new (P || (P = Promise))(function (resolve, reject) {
            function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
            function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
            function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    }

    function __generator(thisArg, body) {
        var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
        return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
        function verb(n) { return function (v) { return step([n, v]); }; }
        function step(op) {
            if (f) throw new TypeError("Generator is already executing.");
            while (_) try {
                if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                if (y = 0, t) op = [op[0] & 2, t.value];
                switch (op[0]) {
                    case 0: case 1: t = op; break;
                    case 4: _.label++; return { value: op[1], done: false };
                    case 5: _.label++; y = op[1]; op = [0]; continue;
                    case 7: op = _.ops.pop(); _.trys.pop(); continue;
                    default:
                        if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                        if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                        if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                        if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                        if (t[2]) _.ops.pop();
                        _.trys.pop(); continue;
                }
                op = body.call(thisArg, _);
            } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
            if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
        }
    }

    function __exportStar(m, exports) {
        for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
    }

    function __values(o) {
        var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
        if (m) return m.call(o);
        if (o && typeof o.length === "number") return {
            next: function () {
                if (o && i >= o.length) o = void 0;
                return { value: o && o[i++], done: !o };
            }
        };
        throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
    }

    function __read(o, n) {
        var m = typeof Symbol === "function" && o[Symbol.iterator];
        if (!m) return o;
        var i = m.call(o), r, ar = [], e;
        try {
            while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
        }
        catch (error) { e = { error: error }; }
        finally {
            try {
                if (r && !r.done && (m = i["return"])) m.call(i);
            }
            finally { if (e) throw e.error; }
        }
        return ar;
    }

    function __spread() {
        for (var ar = [], i = 0; i < arguments.length; i++)
            ar = ar.concat(__read(arguments[i]));
        return ar;
    }

    function __spreadArrays() {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
        for (var r = Array(s), k = 0, i = 0; i < il; i++)
            for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
                r[k] = a[j];
        return r;
    };

    function __await(v) {
        return this instanceof __await ? (this.v = v, this) : new __await(v);
    }

    function __asyncGenerator(thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var g = generator.apply(thisArg, _arguments || []), i, q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
        function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
        function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
        function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
        function fulfill(value) { resume("next", value); }
        function reject(value) { resume("throw", value); }
        function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
    }

    function __asyncDelegator(o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
        function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
    }

    function __asyncValues(o) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var m = o[Symbol.asyncIterator], i;
        return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
        function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
        function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
    }

    function __makeTemplateObject(cooked, raw) {
        if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
        return cooked;
    };

    function __importStar(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
        result.default = mod;
        return result;
    }

    function __importDefault(mod) {
        return (mod && mod.__esModule) ? mod : { default: mod };
    }

    function __classPrivateFieldGet(receiver, privateMap) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to get private field on non-instance");
        }
        return privateMap.get(receiver);
    }

    function __classPrivateFieldSet(receiver, privateMap, value) {
        if (!privateMap.has(receiver)) {
            throw new TypeError("attempted to set private field on non-instance");
        }
        privateMap.set(receiver, value);
        return value;
    }

    function NzTreeIndentComponent_span_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "span", 2);
    } if (rf & 2) {
        var index_r1090 = ctx.index;
        var ctx_r1088 = core["ɵɵnextContext"]();
        core["ɵɵproperty"]("ngClass", ctx_r1088.unitMapOfClass(index_r1090));
    } }
    var NzTreeIndentComponent = /** @class */ (function () {
        function NzTreeIndentComponent() {
            this.listOfUnit = [];
        }
        NzTreeIndentComponent.prototype.unitMapOfClass = function (index) {
            var _a;
            return _a = {},
                _a[this.nzPrefixCls + "-indent-unit"] = true,
                _a[this.nzPrefixCls + "-indent-unit-start"] = this.nzIsStart[index + 1],
                _a[this.nzPrefixCls + "-indent-unit-end"] = this.nzIsEnd[index + 1],
                _a;
        };
        NzTreeIndentComponent.prototype.ngOnInit = function () { };
        NzTreeIndentComponent.prototype.ngOnChanges = function (changes) {
            var nzTreeLevel = changes.nzTreeLevel;
            if (nzTreeLevel) {
                this.listOfUnit = __spread(new Array(nzTreeLevel.currentValue || 0));
            }
        };
        /** @nocollapse */ NzTreeIndentComponent.ɵfac = function NzTreeIndentComponent_Factory(t) { return new (t || NzTreeIndentComponent)(); };
        /** @nocollapse */ NzTreeIndentComponent.ɵcmp = core["ɵɵdefineComponent"]({ type: NzTreeIndentComponent, selectors: [["nz-tree-indent"]], inputs: { nzPrefixCls: "nzPrefixCls", nzTreeLevel: "nzTreeLevel", nzIsStart: "nzIsStart", nzIsEnd: "nzIsEnd" }, exportAs: ["nzTreeIndent"], features: [core["ɵɵNgOnChangesFeature"]], decls: 2, vars: 4, consts: [["aria-hidden", "true"], [3, "ngClass", 4, "ngFor", "ngForOf"], [3, "ngClass"]], template: function NzTreeIndentComponent_Template(rf, ctx) { if (rf & 1) {
                core["ɵɵelementStart"](0, "span", 0);
                core["ɵɵtemplate"](1, NzTreeIndentComponent_span_1_Template, 1, 1, "span", 1);
                core["ɵɵelementEnd"]();
            } if (rf & 2) {
                core["ɵɵclassMapInterpolate1"]("", ctx.nzPrefixCls, "-indent");
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngForOf", ctx.listOfUnit);
            } }, directives: [common.NgForOf, common.NgClass], encapsulation: 2, changeDetection: 0 });
        return NzTreeIndentComponent;
    }());
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTreeIndentComponent, [{
            type: core.Component,
            args: [{
                    selector: 'nz-tree-indent',
                    exportAs: 'nzTreeIndent',
                    template: "\n    <span aria-hidden=\"true\" class=\"{{ nzPrefixCls }}-indent\">\n      <span *ngFor=\"let i of listOfUnit; let index = index\" [ngClass]=\"unitMapOfClass(index)\"></span>\n    </span>\n  ",
                    changeDetection: core.ChangeDetectionStrategy.OnPush,
                    preserveWhitespaces: false
                }]
        }], null, { nzPrefixCls: [{
                type: core.Input
            }], nzTreeLevel: [{
                type: core.Input
            }], nzIsStart: [{
                type: core.Input
            }], nzIsEnd: [{
                type: core.Input
            }] }); })();

    var _c0 = ["dragElement"];
    function NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_1_ng_template_0_Template(rf, ctx) { }
    var _c1 = function (a0, a1) { return { $implicit: a0, origin: a1 }; };
    function NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵtemplate"](0, NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_1_ng_template_0_Template, 0, 0, "ng-template", 5);
    } if (rf & 2) {
        var ctx_r1100 = core["ɵɵnextContext"](4);
        core["ɵɵproperty"]("ngTemplateOutlet", ctx_r1100.nzExpandedIcon)("ngTemplateOutletContext", core["ɵɵpureFunction2"](2, _c1, ctx_r1100.nzTreeNode, ctx_r1100.nzTreeNode.origin));
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_i_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 9);
    } if (rf & 2) {
        var ctx_r1101 = core["ɵɵnextContext"](4);
        core["ɵɵclassProp"]("ant-select-tree-switcher-icon", ctx_r1101.nzSelectMode)("ant-tree-switcher-icon", !ctx_r1101.nzSelectMode);
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_1_Template, 1, 5, undefined, 3);
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_i_2_Template, 1, 4, "i", 8);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1098 = core["ɵɵnextContext"](3);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1098.isTemplateRef(ctx_r1098.nzExpandedIcon));
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", !ctx_r1098.isTemplateRef(ctx_r1098.nzExpandedIcon));
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_2_i_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 10);
    } if (rf & 2) {
        core["ɵɵproperty"]("nzSpin", true);
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTreeNodeComponent_ng_container_3_ng_container_2_ng_container_1_Template, 3, 2, "ng-container", 3);
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_3_ng_container_2_i_2_Template, 1, 1, "i", 7);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1096 = core["ɵɵnextContext"](2);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", !ctx_r1096.nzTreeNode.isLoading);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1096.nzTreeNode.isLoading);
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_1_ng_template_0_Template(rf, ctx) { }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵtemplate"](0, NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_1_ng_template_0_Template, 0, 0, "ng-template", 5);
    } if (rf & 2) {
        var ctx_r1105 = core["ɵɵnextContext"](4);
        core["ɵɵproperty"]("ngTemplateOutlet", ctx_r1105.nzExpandedIcon)("ngTemplateOutletContext", core["ɵɵpureFunction2"](2, _c1, ctx_r1105.nzTreeNode, ctx_r1105.nzTreeNode.origin));
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_ng_container_2_i_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 13);
    } if (rf & 2) {
        var ctx_r1108 = core["ɵɵnextContext"](5);
        core["ɵɵproperty"]("nzType", ctx_r1108.isSwitcherOpen ? "minus-square" : "plus-square");
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_ng_container_2_i_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 14);
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_ng_container_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_ng_container_2_i_1_Template, 1, 1, "i", 11);
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_ng_container_2_i_2_Template, 1, 0, "i", 12);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1106 = core["ɵɵnextContext"](4);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1106.isShowLineIcon);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", !ctx_r1106.isShowLineIcon);
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_1_Template, 1, 5, undefined, 3);
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_ng_container_2_Template, 3, 2, "ng-container", 3);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1103 = core["ɵɵnextContext"](3);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1103.isTemplateRef(ctx_r1103.nzExpandedIcon));
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", !ctx_r1103.isTemplateRef(ctx_r1103.nzExpandedIcon));
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_i_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 10);
    } if (rf & 2) {
        core["ɵɵproperty"]("nzSpin", true);
    } }
    function NzTreeNodeComponent_ng_container_3_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTreeNodeComponent_ng_container_3_ng_container_3_ng_container_1_Template, 3, 2, "ng-container", 3);
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_3_ng_container_3_i_2_Template, 1, 1, "i", 7);
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1097 = core["ɵɵnextContext"](2);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", !ctx_r1097.nzTreeNode.isLoading);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1097.nzTreeNode.isLoading);
    } }
    function NzTreeNodeComponent_ng_container_3_Template(rf, ctx) { if (rf & 1) {
        var _r1111 = core["ɵɵgetCurrentView"]();
        core["ɵɵelementContainerStart"](0);
        core["ɵɵelementStart"](1, "span", 6);
        core["ɵɵlistener"]("click", function NzTreeNodeComponent_ng_container_3_Template_span_click_1_listener($event) { core["ɵɵrestoreView"](_r1111); var ctx_r1110 = core["ɵɵnextContext"](); return ctx_r1110.clickExpand($event); });
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_3_ng_container_2_Template, 3, 2, "ng-container", 3);
        core["ɵɵtemplate"](3, NzTreeNodeComponent_ng_container_3_ng_container_3_Template, 3, 2, "ng-container", 3);
        core["ɵɵelementEnd"]();
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1092 = core["ɵɵnextContext"]();
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngClass", ctx_r1092.nzNodeSwitcherClass);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1092.isShowSwitchIcon);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1092.nzShowLine);
    } }
    function NzTreeNodeComponent_ng_container_4_Template(rf, ctx) { if (rf & 1) {
        var _r1113 = core["ɵɵgetCurrentView"]();
        core["ɵɵelementContainerStart"](0);
        core["ɵɵelementStart"](1, "span", 6);
        core["ɵɵlistener"]("click", function NzTreeNodeComponent_ng_container_4_Template_span_click_1_listener($event) { core["ɵɵrestoreView"](_r1113); var ctx_r1112 = core["ɵɵnextContext"](); return ctx_r1112.clickCheckBox($event); });
        core["ɵɵelement"](2, "span");
        core["ɵɵelementEnd"]();
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1093 = core["ɵɵnextContext"]();
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngClass", ctx_r1093.nzNodeCheckboxClass);
        core["ɵɵadvance"](1);
        core["ɵɵclassProp"]("ant-tree-checkbox-inner", !ctx_r1093.nzSelectMode)("ant-select-tree-checkbox-inner", ctx_r1093.nzSelectMode);
    } }
    function NzTreeNodeComponent_ng_template_6_Template(rf, ctx) { }
    function NzTreeNodeComponent_ng_container_7_span_1_i_2_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelement"](0, "i", 19);
    } if (rf & 2) {
        var ctx_r1115 = core["ɵɵnextContext"](3);
        core["ɵɵproperty"]("nzType", ctx_r1115.nzIcon);
    } }
    function NzTreeNodeComponent_ng_container_7_span_1_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementStart"](0, "span", 17);
        core["ɵɵelementStart"](1, "span", 17);
        core["ɵɵtemplate"](2, NzTreeNodeComponent_ng_container_7_span_1_i_2_Template, 1, 1, "i", 18);
        core["ɵɵelementEnd"]();
        core["ɵɵelementEnd"]();
    } if (rf & 2) {
        var ctx_r1114 = core["ɵɵnextContext"](2);
        core["ɵɵclassProp"]("ant-tree-icon__open", ctx_r1114.isSwitcherOpen)("ant-tree-icon__close", ctx_r1114.isSwitcherClose)("ant-tree-icon_loading", ctx_r1114.nzTreeNode.isLoading);
        core["ɵɵproperty"]("ngClass", ctx_r1114.nzNodeContentLoadingClass);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngClass", ctx_r1114.nzNodeContentIconClass);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1114.nzIcon);
    } }
    function NzTreeNodeComponent_ng_container_7_Template(rf, ctx) { if (rf & 1) {
        core["ɵɵelementContainerStart"](0);
        core["ɵɵtemplate"](1, NzTreeNodeComponent_ng_container_7_span_1_Template, 3, 9, "span", 15);
        core["ɵɵelement"](2, "span", 16);
        core["ɵɵpipe"](3, "nzHighlight");
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var ctx_r1095 = core["ɵɵnextContext"]();
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("ngIf", ctx_r1095.nzTreeNode.icon && ctx_r1095.nzShowIcon);
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("innerHTML", core["ɵɵpipeBind4"](3, 2, ctx_r1095.nzTreeNode.title, ctx_r1095.matchedValue, "", "font-highlight"), core["ɵɵsanitizeHtml"]);
    } }
    var NzTreeNodeComponent = /** @class */ (function () {
        function NzTreeNodeComponent(nzTreeService, ngZone, renderer, elRef, cdr, noAnimation) {
            this.nzTreeService = nzTreeService;
            this.ngZone = ngZone;
            this.renderer = renderer;
            this.elRef = elRef;
            this.cdr = cdr;
            this.noAnimation = noAnimation;
            this.nzHideUnMatched = false;
            this.nzNoAnimation = false;
            this.nzSelectMode = false;
            this.nzShowIcon = false;
            this.nzSearchValue = '';
            this.nzClick = new core.EventEmitter();
            this.nzDblClick = new core.EventEmitter();
            this.nzContextMenu = new core.EventEmitter();
            this.nzCheckBoxChange = new core.EventEmitter();
            this.nzExpandChange = new core.EventEmitter();
            this.nzOnDragStart = new core.EventEmitter();
            this.nzOnDragEnter = new core.EventEmitter();
            this.nzOnDragOver = new core.EventEmitter();
            this.nzOnDragLeave = new core.EventEmitter();
            this.nzOnDrop = new core.EventEmitter();
            this.nzOnDragEnd = new core.EventEmitter();
            // default var
            this.prefixCls = 'ant-tree';
            this.nzNodeClass = {};
            this.nzNodeSwitcherClass = {};
            this.nzNodeContentClass = {};
            this.nzNodeCheckboxClass = {};
            this.nzNodeContentIconClass = {};
            this.nzNodeContentLoadingClass = {};
            /**
             * drag var
             */
            this.destroy$ = new rxjs.Subject();
            this.dragPos = 2;
            this.dragPosClass = {
                '0': 'drag-over',
                '1': 'drag-over-gap-bottom',
                '-1': 'drag-over-gap-top'
            };
        }
        Object.defineProperty(NzTreeNodeComponent.prototype, "displayStyle", {
            /**
             * default set
             */
            get: function () {
                // to hide unmatched nodes
                return this.nzSearchValue &&
                    this.nzHideUnMatched &&
                    !this.nzTreeNode.isMatched &&
                    !this.nzTreeNode.isExpanded &&
                    this.nzTreeNode.canHide
                    ? 'none'
                    : '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "matchedValue", {
            get: function () {
                return this.nzTreeNode.isMatched ? this.nzSearchValue : '';
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "nzIcon", {
            get: function () {
                return this.nzTreeNode.icon;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "canDraggable", {
            get: function () {
                return this.nzDraggable && !this.nzTreeNode.isDisabled ? true : null;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "isShowLineIcon", {
            get: function () {
                return !this.nzTreeNode.isLeaf && this.nzShowLine;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "isShowSwitchIcon", {
            get: function () {
                return !this.nzTreeNode.isLeaf && !this.nzShowLine;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "isSwitcherOpen", {
            get: function () {
                return this.nzTreeNode.isExpanded && !this.nzTreeNode.isLeaf;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeNodeComponent.prototype, "isSwitcherClose", {
            get: function () {
                return !this.nzTreeNode.isExpanded && !this.nzTreeNode.isLeaf;
            },
            enumerable: true,
            configurable: true
        });
        /**
         * reset node class
         */
        NzTreeNodeComponent.prototype.setClassMap = function () {
            var _a, _b, _c, _d, _e, _f;
            this.prefixCls = this.nzSelectMode ? 'ant-select-tree' : 'ant-tree';
            this.nzNodeClass = (_a = {},
                _a[this.prefixCls + "-treenode"] = true,
                _a[this.prefixCls + "-treenode-disabled"] = this.nzTreeNode.isDisabled,
                _a[this.prefixCls + "-treenode-switcher-open"] = this.isSwitcherOpen,
                _a[this.prefixCls + "-treenode-switcher-close"] = this.isSwitcherClose,
                _a[this.prefixCls + "-treenode-checkbox-checked"] = this.nzTreeNode.isChecked,
                _a[this.prefixCls + "-treenode-checkbox-indeterminate"] = this.nzTreeNode.isHalfChecked,
                _a[this.prefixCls + "-treenode-selected"] = this.nzTreeNode.isSelected,
                _a[this.prefixCls + "-treenode-loading"] = this.nzTreeNode.isLoading,
                _a);
            this.nzNodeSwitcherClass = (_b = {},
                _b[this.prefixCls + "-switcher"] = true,
                _b[this.prefixCls + "-switcher-noop"] = this.nzTreeNode.isLeaf,
                _b[this.prefixCls + "-switcher_open"] = this.isSwitcherOpen,
                _b[this.prefixCls + "-switcher_close"] = this.isSwitcherClose,
                _b);
            this.nzNodeCheckboxClass = (_c = {},
                _c[this.prefixCls + "-checkbox"] = true,
                _c[this.prefixCls + "-checkbox-checked"] = this.nzTreeNode.isChecked,
                _c[this.prefixCls + "-checkbox-indeterminate"] = this.nzTreeNode.isHalfChecked,
                _c[this.prefixCls + "-checkbox-disabled"] = this.nzTreeNode.isDisabled || this.nzTreeNode.isDisableCheckbox,
                _c);
            this.nzNodeContentClass = (_d = {},
                _d[this.prefixCls + "-node-content-wrapper"] = true,
                _d[this.prefixCls + "-node-content-wrapper-open"] = this.isSwitcherOpen,
                _d[this.prefixCls + "-node-content-wrapper-close"] = this.isSwitcherClose,
                _d[this.prefixCls + "-node-selected"] = this.nzTreeNode.isSelected,
                _d);
            this.nzNodeContentIconClass = (_e = {},
                _e[this.prefixCls + "-iconEle"] = true,
                _e[this.prefixCls + "-icon__customize"] = true,
                _e);
            this.nzNodeContentLoadingClass = (_f = {},
                _f[this.prefixCls + "-iconEle"] = true,
                _f);
        };
        NzTreeNodeComponent.prototype.onMousedown = function (event) {
            if (this.nzSelectMode) {
                event.preventDefault();
            }
        };
        /**
         * collapse node
         * @param event
         */
        NzTreeNodeComponent.prototype.clickExpand = function (event) {
            event.preventDefault();
            if (!this.nzTreeNode.isLoading && !this.nzTreeNode.isLeaf) {
                // set async state
                if (this.nzAsyncData && this.nzTreeNode.children.length === 0 && !this.nzTreeNode.isExpanded) {
                    this.nzTreeNode.isLoading = true;
                }
                this.nzTreeNode.setExpanded(!this.nzTreeNode.isExpanded);
            }
            this.nzTreeService.setExpandedNodeList(this.nzTreeNode);
            var eventNext = this.nzTreeService.formatEvent('expand', this.nzTreeNode, event);
            this.nzExpandChange.emit(eventNext);
        };
        NzTreeNodeComponent.prototype.clickSelect = function (event) {
            event.preventDefault();
            if (this.nzTreeNode.isSelectable && !this.nzTreeNode.isDisabled) {
                this.nzTreeNode.isSelected = !this.nzTreeNode.isSelected;
            }
            this.nzTreeService.setSelectedNodeList(this.nzTreeNode);
            var eventNext = this.nzTreeService.formatEvent('click', this.nzTreeNode, event);
            this.nzClick.emit(eventNext);
        };
        NzTreeNodeComponent.prototype.dblClick = function (event) {
            event.preventDefault();
            var eventNext = this.nzTreeService.formatEvent('dblclick', this.nzTreeNode, event);
            this.nzDblClick.emit(eventNext);
        };
        NzTreeNodeComponent.prototype.contextMenu = function (event) {
            event.preventDefault();
            var eventNext = this.nzTreeService.formatEvent('contextmenu', this.nzTreeNode, event);
            this.nzContextMenu.emit(eventNext);
        };
        /**
         * check node
         * @param event
         */
        NzTreeNodeComponent.prototype.clickCheckBox = function (event) {
            event.preventDefault();
            // return if node is disabled
            if (this.nzTreeNode.isDisabled || this.nzTreeNode.isDisableCheckbox) {
                return;
            }
            this.nzTreeNode.isChecked = !this.nzTreeNode.isChecked;
            this.nzTreeNode.isHalfChecked = false;
            this.nzTreeService.setCheckedNodeList(this.nzTreeNode);
            var eventNext = this.nzTreeService.formatEvent('check', this.nzTreeNode, event);
            this.nzCheckBoxChange.emit(eventNext);
        };
        /**
         * drag event
         * @param e
         */
        NzTreeNodeComponent.prototype.clearDragClass = function () {
            var _this = this;
            var dragClass = ['drag-over-gap-top', 'drag-over-gap-bottom', 'drag-over'];
            dragClass.forEach(function (e) {
                _this.renderer.removeClass(_this.dragElement.nativeElement, e);
            });
        };
        NzTreeNodeComponent.prototype.handleDragStart = function (e) {
            try {
                // ie throw error
                // firefox-need-it
                e.dataTransfer.setData('text/plain', this.nzTreeNode.key);
            }
            catch (error) {
                // empty
            }
            this.nzTreeService.setSelectedNode(this.nzTreeNode);
            var eventNext = this.nzTreeService.formatEvent('dragstart', this.nzTreeNode, e);
            this.nzOnDragStart.emit(eventNext);
        };
        NzTreeNodeComponent.prototype.handleDragEnter = function (e) {
            var _this = this;
            e.preventDefault();
            // reset position
            this.dragPos = 2;
            this.ngZone.run(function () {
                var eventNext = _this.nzTreeService.formatEvent('dragenter', _this.nzTreeNode, e);
                _this.nzOnDragEnter.emit(eventNext);
            });
        };
        NzTreeNodeComponent.prototype.handleDragOver = function (e) {
            e.preventDefault();
            var dropPosition = this.nzTreeService.calcDropPosition(e);
            if (this.dragPos !== dropPosition) {
                this.clearDragClass();
                this.dragPos = dropPosition;
                // leaf node will pass
                if (!(this.dragPos === 0 && this.nzTreeNode.isLeaf)) {
                    this.renderer.addClass(this.dragElement.nativeElement, this.dragPosClass[this.dragPos]);
                }
            }
            var eventNext = this.nzTreeService.formatEvent('dragover', this.nzTreeNode, e);
            this.nzOnDragOver.emit(eventNext);
        };
        NzTreeNodeComponent.prototype.handleDragLeave = function (e) {
            var _this = this;
            e.preventDefault();
            this.ngZone.run(function () {
                _this.clearDragClass();
            });
            var eventNext = this.nzTreeService.formatEvent('dragleave', this.nzTreeNode, e);
            this.nzOnDragLeave.emit(eventNext);
        };
        NzTreeNodeComponent.prototype.handleDragDrop = function (e) {
            var _this = this;
            this.ngZone.run(function () {
                _this.clearDragClass();
                var node = _this.nzTreeService.getSelectedNode();
                if (!node || (node && node.key === _this.nzTreeNode.key) || (_this.dragPos === 0 && _this.nzTreeNode.isLeaf)) {
                    return;
                }
                // pass if node is leafNo
                var dropEvent = _this.nzTreeService.formatEvent('drop', _this.nzTreeNode, e);
                var dragEndEvent = _this.nzTreeService.formatEvent('dragend', _this.nzTreeNode, e);
                if (_this.nzBeforeDrop) {
                    _this.nzBeforeDrop({
                        dragNode: _this.nzTreeService.getSelectedNode(),
                        node: _this.nzTreeNode,
                        pos: _this.dragPos
                    }).subscribe(function (canDrop) {
                        if (canDrop) {
                            _this.nzTreeService.dropAndApply(_this.nzTreeNode, _this.dragPos);
                        }
                        _this.nzOnDrop.emit(dropEvent);
                        _this.nzOnDragEnd.emit(dragEndEvent);
                    });
                }
                else if (_this.nzTreeNode) {
                    _this.nzTreeService.dropAndApply(_this.nzTreeNode, _this.dragPos);
                    _this.nzOnDrop.emit(dropEvent);
                }
            });
        };
        NzTreeNodeComponent.prototype.handleDragEnd = function (e) {
            var _this = this;
            e.preventDefault();
            this.ngZone.run(function () {
                // if user do not custom beforeDrop
                if (!_this.nzBeforeDrop) {
                    var eventNext = _this.nzTreeService.formatEvent('dragend', _this.nzTreeNode, e);
                    _this.nzOnDragEnd.emit(eventNext);
                }
            });
        };
        /**
         * Listening to dragging events.
         */
        NzTreeNodeComponent.prototype.handDragEvent = function () {
            var _this = this;
            this.ngZone.runOutsideAngular(function () {
                if (_this.nzDraggable) {
                    _this.destroy$ = new rxjs.Subject();
                    rxjs.fromEvent(_this.elRef.nativeElement, 'dragstart')
                        .pipe(operators.takeUntil(_this.destroy$))
                        .subscribe(function (e) { return _this.handleDragStart(e); });
                    rxjs.fromEvent(_this.elRef.nativeElement, 'dragenter')
                        .pipe(operators.takeUntil(_this.destroy$))
                        .subscribe(function (e) { return _this.handleDragEnter(e); });
                    rxjs.fromEvent(_this.elRef.nativeElement, 'dragover')
                        .pipe(operators.takeUntil(_this.destroy$))
                        .subscribe(function (e) { return _this.handleDragOver(e); });
                    rxjs.fromEvent(_this.elRef.nativeElement, 'dragleave')
                        .pipe(operators.takeUntil(_this.destroy$))
                        .subscribe(function (e) { return _this.handleDragLeave(e); });
                    rxjs.fromEvent(_this.elRef.nativeElement, 'drop')
                        .pipe(operators.takeUntil(_this.destroy$))
                        .subscribe(function (e) { return _this.handleDragDrop(e); });
                    rxjs.fromEvent(_this.elRef.nativeElement, 'dragend')
                        .pipe(operators.takeUntil(_this.destroy$))
                        .subscribe(function (e) { return _this.handleDragEnd(e); });
                }
                else {
                    _this.destroy$.next();
                    _this.destroy$.complete();
                }
            });
        };
        NzTreeNodeComponent.prototype.isTemplateRef = function (value) {
            return value instanceof core.TemplateRef;
        };
        NzTreeNodeComponent.prototype.markForCheck = function () {
            this.cdr.markForCheck();
        };
        NzTreeNodeComponent.prototype.ngOnInit = function () {
            this.nzTreeNode.component = this;
        };
        NzTreeNodeComponent.prototype.ngOnChanges = function (changes) {
            var nzDraggable = changes.nzDraggable;
            if (nzDraggable) {
                this.handDragEvent();
            }
            this.setClassMap();
        };
        NzTreeNodeComponent.prototype.ngOnDestroy = function () {
            this.destroy$.next();
            this.destroy$.complete();
        };
        /** @nocollapse */ NzTreeNodeComponent.ɵfac = function NzTreeNodeComponent_Factory(t) { return new (t || NzTreeNodeComponent)(core["ɵɵdirectiveInject"](core$1.NzTreeBaseService), core["ɵɵdirectiveInject"](core.NgZone), core["ɵɵdirectiveInject"](core.Renderer2), core["ɵɵdirectiveInject"](core.ElementRef), core["ɵɵdirectiveInject"](core.ChangeDetectorRef), core["ɵɵdirectiveInject"](core$1.NzNoAnimationDirective, 9)); };
        /** @nocollapse */ NzTreeNodeComponent.ɵcmp = core["ɵɵdefineComponent"]({ type: NzTreeNodeComponent, selectors: [["nz-tree-node"]], viewQuery: function NzTreeNodeComponent_Query(rf, ctx) { if (rf & 1) {
                core["ɵɵviewQuery"](_c0, true);
            } if (rf & 2) {
                var _t;
                core["ɵɵqueryRefresh"](_t = core["ɵɵloadQuery"]()) && (ctx.dragElement = _t.first);
            } }, hostBindings: function NzTreeNodeComponent_HostBindings(rf, ctx) { if (rf & 1) {
                core["ɵɵlistener"]("mousedown", function NzTreeNodeComponent_mousedown_HostBindingHandler($event) { return ctx.onMousedown($event); });
            } }, inputs: { nzTreeNode: "nzTreeNode", nzShowLine: "nzShowLine", nzShowExpand: "nzShowExpand", nzCheckable: "nzCheckable", nzAsyncData: "nzAsyncData", nzHideUnMatched: "nzHideUnMatched", nzNoAnimation: "nzNoAnimation", nzSelectMode: "nzSelectMode", nzShowIcon: "nzShowIcon", nzExpandedIcon: "nzExpandedIcon", nzTreeTemplate: "nzTreeTemplate", nzBeforeDrop: "nzBeforeDrop", nzSearchValue: "nzSearchValue", nzDraggable: "nzDraggable" }, outputs: { nzClick: "nzClick", nzDblClick: "nzDblClick", nzContextMenu: "nzContextMenu", nzCheckBoxChange: "nzCheckBoxChange", nzExpandChange: "nzExpandChange", nzOnDragStart: "nzOnDragStart", nzOnDragEnter: "nzOnDragEnter", nzOnDragOver: "nzOnDragOver", nzOnDragLeave: "nzOnDragLeave", nzOnDrop: "nzOnDrop", nzOnDragEnd: "nzOnDragEnd" }, exportAs: ["nzTreeNode"], features: [core["ɵɵNgOnChangesFeature"]], decls: 8, vars: 21, consts: [["role", "treeitem", 3, "ngClass"], ["dragElement", ""], [3, "nzTreeLevel", "nzPrefixCls", "nzIsStart", "nzIsEnd"], [4, "ngIf"], [3, "title", "ngClass", "dblclick", "click", "contextmenu"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], [3, "ngClass", "click"], ["nz-icon", "", "nzType", "loading", "class", "ant-tree-switcher-loading-icon", 3, "nzSpin", 4, "ngIf"], ["nz-icon", "", "nzType", "caret-down", 3, "ant-select-tree-switcher-icon", "ant-tree-switcher-icon", 4, "ngIf"], ["nz-icon", "", "nzType", "caret-down"], ["nz-icon", "", "nzType", "loading", 1, "ant-tree-switcher-loading-icon", 3, "nzSpin"], ["nz-icon", "", "class", "ant-tree-switcher-line-icon", 3, "nzType", 4, "ngIf"], ["nz-icon", "", "nzType", "file", "class", "ant-tree-switcher-line-icon", 4, "ngIf"], ["nz-icon", "", 1, "ant-tree-switcher-line-icon", 3, "nzType"], ["nz-icon", "", "nzType", "file", 1, "ant-tree-switcher-line-icon"], [3, "ant-tree-icon__open", "ant-tree-icon__close", "ant-tree-icon_loading", "ngClass", 4, "ngIf"], [1, "ant-tree-title", 3, "innerHTML"], [3, "ngClass"], ["nz-icon", "", 3, "nzType", 4, "ngIf"], ["nz-icon", "", 3, "nzType"]], template: function NzTreeNodeComponent_Template(rf, ctx) { if (rf & 1) {
                core["ɵɵelementStart"](0, "div", 0, 1);
                core["ɵɵelement"](2, "nz-tree-indent", 2);
                core["ɵɵtemplate"](3, NzTreeNodeComponent_ng_container_3_Template, 4, 3, "ng-container", 3);
                core["ɵɵtemplate"](4, NzTreeNodeComponent_ng_container_4_Template, 3, 5, "ng-container", 3);
                core["ɵɵelementStart"](5, "span", 4);
                core["ɵɵlistener"]("dblclick", function NzTreeNodeComponent_Template_span_dblclick_5_listener($event) { return ctx.dblClick($event); })("click", function NzTreeNodeComponent_Template_span_click_5_listener($event) { return ctx.clickSelect($event); })("contextmenu", function NzTreeNodeComponent_Template_span_contextmenu_5_listener($event) { return ctx.contextMenu($event); });
                core["ɵɵtemplate"](6, NzTreeNodeComponent_ng_template_6_Template, 0, 0, "ng-template", 5);
                core["ɵɵtemplate"](7, NzTreeNodeComponent_ng_container_7_Template, 4, 7, "ng-container", 3);
                core["ɵɵelementEnd"]();
                core["ɵɵelementEnd"]();
            } if (rf & 2) {
                core["ɵɵstyleProp"]("display", ctx.displayStyle);
                core["ɵɵproperty"]("ngClass", ctx.nzNodeClass);
                core["ɵɵadvance"](2);
                core["ɵɵproperty"]("nzTreeLevel", ctx.nzTreeNode.level)("nzPrefixCls", ctx.prefixCls)("nzIsStart", ctx.nzTreeNode.isStart)("nzIsEnd", ctx.nzTreeNode.isEnd);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngIf", ctx.nzShowExpand);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngIf", ctx.nzCheckable);
                core["ɵɵadvance"](1);
                core["ɵɵclassProp"]("draggable", ctx.canDraggable);
                core["ɵɵpropertyInterpolate"]("title", ctx.nzTreeNode.title);
                core["ɵɵproperty"]("ngClass", ctx.nzNodeContentClass);
                core["ɵɵattribute"]("draggable", ctx.canDraggable)("aria-grabbed", ctx.canDraggable);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngTemplateOutlet", ctx.nzTreeTemplate)("ngTemplateOutletContext", core["ɵɵpureFunction2"](18, _c1, ctx.nzTreeNode, ctx.nzTreeNode.origin));
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngIf", !ctx.nzTreeTemplate);
            } }, directives: [common.NgClass, NzTreeIndentComponent, common.NgIf, common.NgTemplateOutlet, icon.NzIconDirective], pipes: [core$1.NzHighlightPipe], encapsulation: 2, data: { animation: [core$1.treeCollapseMotion] }, changeDetection: 0 });
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeNodeComponent.prototype, "nzShowLine", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeNodeComponent.prototype, "nzShowExpand", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeNodeComponent.prototype, "nzCheckable", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeNodeComponent.prototype, "nzAsyncData", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeNodeComponent.prototype, "nzHideUnMatched", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeNodeComponent.prototype, "nzNoAnimation", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeNodeComponent.prototype, "nzSelectMode", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeNodeComponent.prototype, "nzShowIcon", void 0);
        return NzTreeNodeComponent;
    }());
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTreeNodeComponent, [{
            type: core.Component,
            args: [{
                    selector: 'nz-tree-node',
                    exportAs: 'nzTreeNode',
                    template: "\n    <div #dragElement role=\"treeitem\" [ngClass]=\"nzNodeClass\" [style.display]=\"displayStyle\">\n      <nz-tree-indent\n        [nzTreeLevel]=\"nzTreeNode.level\"\n        [nzPrefixCls]=\"prefixCls\"\n        [nzIsStart]=\"nzTreeNode.isStart\"\n        [nzIsEnd]=\"nzTreeNode.isEnd\"\n      ></nz-tree-indent>\n      <ng-container *ngIf=\"nzShowExpand\">\n        <!-- render switcher -->\n        <span [ngClass]=\"nzNodeSwitcherClass\" (click)=\"clickExpand($event)\">\n          <ng-container *ngIf=\"isShowSwitchIcon\">\n            <ng-container *ngIf=\"!nzTreeNode.isLoading\">\n              <ng-template\n                *ngIf=\"isTemplateRef(nzExpandedIcon)\"\n                [ngTemplateOutlet]=\"nzExpandedIcon\"\n                [ngTemplateOutletContext]=\"{ $implicit: nzTreeNode, origin: nzTreeNode.origin }\"\n              >\n              </ng-template>\n              <i\n                *ngIf=\"!isTemplateRef(nzExpandedIcon)\"\n                nz-icon\n                nzType=\"caret-down\"\n                [class.ant-select-tree-switcher-icon]=\"nzSelectMode\"\n                [class.ant-tree-switcher-icon]=\"!nzSelectMode\"\n              >\n              </i>\n            </ng-container>\n            <i *ngIf=\"nzTreeNode.isLoading\" nz-icon nzType=\"loading\" [nzSpin]=\"true\" class=\"ant-tree-switcher-loading-icon\"></i>\n          </ng-container>\n          <ng-container *ngIf=\"nzShowLine\">\n            <ng-container *ngIf=\"!nzTreeNode.isLoading\">\n              <ng-template\n                *ngIf=\"isTemplateRef(nzExpandedIcon)\"\n                [ngTemplateOutlet]=\"nzExpandedIcon\"\n                [ngTemplateOutletContext]=\"{ $implicit: nzTreeNode, origin: nzTreeNode.origin }\"\n              >\n              </ng-template>\n              <ng-container *ngIf=\"!isTemplateRef(nzExpandedIcon)\">\n                <i\n                  *ngIf=\"isShowLineIcon\"\n                  nz-icon\n                  [nzType]=\"isSwitcherOpen ? 'minus-square' : 'plus-square'\"\n                  class=\"ant-tree-switcher-line-icon\"\n                ></i>\n                <i *ngIf=\"!isShowLineIcon\" nz-icon nzType=\"file\" class=\"ant-tree-switcher-line-icon\"></i>\n              </ng-container>\n            </ng-container>\n            <i *ngIf=\"nzTreeNode.isLoading\" nz-icon nzType=\"loading\" [nzSpin]=\"true\" class=\"ant-tree-switcher-loading-icon\"></i>\n          </ng-container>\n        </span>\n      </ng-container>\n      <ng-container *ngIf=\"nzCheckable\">\n        <span [ngClass]=\"nzNodeCheckboxClass\" (click)=\"clickCheckBox($event)\">\n          <span [class.ant-tree-checkbox-inner]=\"!nzSelectMode\" [class.ant-select-tree-checkbox-inner]=\"nzSelectMode\"></span>\n        </span>\n      </ng-container>\n      <span\n        title=\"{{ nzTreeNode.title }}\"\n        [attr.draggable]=\"canDraggable\"\n        [attr.aria-grabbed]=\"canDraggable\"\n        [ngClass]=\"nzNodeContentClass\"\n        [class.draggable]=\"canDraggable\"\n        (dblclick)=\"dblClick($event)\"\n        (click)=\"clickSelect($event)\"\n        (contextmenu)=\"contextMenu($event)\"\n      >\n        <ng-template [ngTemplateOutlet]=\"nzTreeTemplate\" [ngTemplateOutletContext]=\"{ $implicit: nzTreeNode, origin: nzTreeNode.origin }\">\n        </ng-template>\n        <ng-container *ngIf=\"!nzTreeTemplate\">\n          <span\n            *ngIf=\"nzTreeNode.icon && nzShowIcon\"\n            [class.ant-tree-icon__open]=\"isSwitcherOpen\"\n            [class.ant-tree-icon__close]=\"isSwitcherClose\"\n            [class.ant-tree-icon_loading]=\"nzTreeNode.isLoading\"\n            [ngClass]=\"nzNodeContentLoadingClass\"\n          >\n            <span [ngClass]=\"nzNodeContentIconClass\">\n              <i nz-icon *ngIf=\"nzIcon\" [nzType]=\"nzIcon\"></i>\n            </span>\n          </span>\n          <span class=\"ant-tree-title\" [innerHTML]=\"nzTreeNode.title | nzHighlight: matchedValue:'':'font-highlight'\"> </span>\n        </ng-container>\n      </span>\n    </div>\n  ",
                    changeDetection: core.ChangeDetectionStrategy.OnPush,
                    preserveWhitespaces: false,
                    animations: [core$1.treeCollapseMotion]
                }]
        }], function () { return [{ type: core$1.NzTreeBaseService }, { type: core.NgZone }, { type: core.Renderer2 }, { type: core.ElementRef }, { type: core.ChangeDetectorRef }, { type: core$1.NzNoAnimationDirective, decorators: [{
                    type: core.Host
                }, {
                    type: core.Optional
                }] }]; }, { dragElement: [{
                type: core.ViewChild,
                args: ['dragElement', { static: false }]
            }], nzTreeNode: [{
                type: core.Input
            }], nzShowLine: [{
                type: core.Input
            }], nzShowExpand: [{
                type: core.Input
            }], nzCheckable: [{
                type: core.Input
            }], nzAsyncData: [{
                type: core.Input
            }], nzHideUnMatched: [{
                type: core.Input
            }], nzNoAnimation: [{
                type: core.Input
            }], nzSelectMode: [{
                type: core.Input
            }], nzShowIcon: [{
                type: core.Input
            }], nzExpandedIcon: [{
                type: core.Input
            }], nzTreeTemplate: [{
                type: core.Input
            }], nzBeforeDrop: [{
                type: core.Input
            }], nzSearchValue: [{
                type: core.Input
            }], nzDraggable: [{
                type: core.Input
            }], nzClick: [{
                type: core.Output
            }], nzDblClick: [{
                type: core.Output
            }], nzContextMenu: [{
                type: core.Output
            }], nzCheckBoxChange: [{
                type: core.Output
            }], nzExpandChange: [{
                type: core.Output
            }], nzOnDragStart: [{
                type: core.Output
            }], nzOnDragEnter: [{
                type: core.Output
            }], nzOnDragOver: [{
                type: core.Output
            }], nzOnDragLeave: [{
                type: core.Output
            }], nzOnDrop: [{
                type: core.Output
            }], nzOnDragEnd: [{
                type: core.Output
            }], onMousedown: [{
                type: core.HostListener,
                args: ['mousedown', ['$event']]
            }] }); })();

    var NzTreeService = /** @class */ (function (_super) {
        __extends(NzTreeService, _super);
        function NzTreeService() {
            return _super.call(this) || this;
        }
        /** @nocollapse */ NzTreeService.ɵfac = function NzTreeService_Factory(t) { return new (t || NzTreeService)(); };
        /** @nocollapse */ NzTreeService.ɵprov = core["ɵɵdefineInjectable"]({ token: NzTreeService, factory: NzTreeService.ɵfac });
        return NzTreeService;
    }(core$1.NzTreeBaseService));
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTreeService, [{
            type: core.Injectable
        }], function () { return []; }, null); })();

    var _c0$1 = ["nzTreeTemplate"];
    function NzTreeComponent_ng_container_6_Template(rf, ctx) { if (rf & 1) {
        var _r1119 = core["ɵɵgetCurrentView"]();
        core["ɵɵelementContainerStart"](0);
        core["ɵɵelementStart"](1, "nz-tree-node", 4);
        core["ɵɵlistener"]("nzExpandChange", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzExpandChange_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1118 = core["ɵɵnextContext"](); return ctx_r1118.eventTriggerChanged($event); })("nzClick", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzClick_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1120 = core["ɵɵnextContext"](); return ctx_r1120.eventTriggerChanged($event); })("nzDblClick", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzDblClick_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1121 = core["ɵɵnextContext"](); return ctx_r1121.eventTriggerChanged($event); })("nzContextMenu", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzContextMenu_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1122 = core["ɵɵnextContext"](); return ctx_r1122.eventTriggerChanged($event); })("nzCheckBoxChange", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzCheckBoxChange_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1123 = core["ɵɵnextContext"](); return ctx_r1123.eventTriggerChanged($event); })("nzOnDragStart", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzOnDragStart_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1124 = core["ɵɵnextContext"](); return ctx_r1124.eventTriggerChanged($event); })("nzOnDragEnter", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzOnDragEnter_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1125 = core["ɵɵnextContext"](); return ctx_r1125.eventTriggerChanged($event); })("nzOnDragOver", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzOnDragOver_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1126 = core["ɵɵnextContext"](); return ctx_r1126.eventTriggerChanged($event); })("nzOnDragLeave", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzOnDragLeave_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1127 = core["ɵɵnextContext"](); return ctx_r1127.eventTriggerChanged($event); })("nzOnDragEnd", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzOnDragEnd_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1128 = core["ɵɵnextContext"](); return ctx_r1128.eventTriggerChanged($event); })("nzOnDrop", function NzTreeComponent_ng_container_6_Template_nz_tree_node_nzOnDrop_1_listener($event) { core["ɵɵrestoreView"](_r1119); var ctx_r1129 = core["ɵɵnextContext"](); return ctx_r1129.eventTriggerChanged($event); });
        core["ɵɵelementEnd"]();
        core["ɵɵelementContainerEnd"]();
    } if (rf & 2) {
        var node_r1117 = ctx.$implicit;
        var ctx_r1116 = core["ɵɵnextContext"]();
        core["ɵɵadvance"](1);
        core["ɵɵproperty"]("nzTreeNode", node_r1117.data)("nzSelectMode", ctx_r1116.nzSelectMode)("nzShowLine", ctx_r1116.nzShowLine)("nzExpandedIcon", ctx_r1116.nzExpandedIcon)("nzDraggable", ctx_r1116.nzDraggable)("nzCheckable", ctx_r1116.nzCheckable)("nzShowExpand", ctx_r1116.nzShowExpand)("nzAsyncData", ctx_r1116.nzAsyncData)("nzSearchValue", ctx_r1116.nzSearchValue)("nzHideUnMatched", ctx_r1116.nzHideUnMatched)("nzBeforeDrop", ctx_r1116.nzBeforeDrop)("nzShowIcon", ctx_r1116.nzShowIcon)("nzTreeTemplate", ctx_r1116.treeTemplate)("@.disabled", ctx_r1116.noAnimation == null ? null : ctx_r1116.noAnimation.nzNoAnimation)("nzNoAnimation", ctx_r1116.noAnimation == null ? null : ctx_r1116.noAnimation.nzNoAnimation);
    } }
    function NzTreeServiceFactory(higherOrderService, treeService) {
        return higherOrderService ? higherOrderService : treeService;
    }
    var NZ_CONFIG_COMPONENT_NAME = 'tree';
    var NzTreeComponent = /** @class */ (function (_super) {
        __extends(NzTreeComponent, _super);
        // Handle emit event end
        function NzTreeComponent(nzTreeService, nzConfigService, cdr, noAnimation) {
            var _this = _super.call(this, nzTreeService) || this;
            _this.nzConfigService = nzConfigService;
            _this.cdr = cdr;
            _this.noAnimation = noAnimation;
            _this.nzShowExpand = true;
            _this.nzShowLine = false;
            _this.nzCheckable = false;
            _this.nzAsyncData = false;
            _this.nzDraggable = false;
            _this.nzSelectMode = false;
            _this.nzCheckStrictly = false;
            _this.nzExpandAll = false;
            _this.nzMultiple = false;
            _this.nzData = [];
            _this.nzExpandedKeys = [];
            _this.nzSelectedKeys = [];
            _this.nzCheckedKeys = [];
            _this.nzExpandedKeysChange = new core.EventEmitter();
            _this.nzSelectedKeysChange = new core.EventEmitter();
            _this.nzCheckedKeysChange = new core.EventEmitter();
            _this.nzSearchValueChange = new core.EventEmitter();
            _this.nzClick = new core.EventEmitter();
            _this.nzDblClick = new core.EventEmitter();
            _this.nzContextMenu = new core.EventEmitter();
            _this.nzCheckBoxChange = new core.EventEmitter();
            _this.nzExpandChange = new core.EventEmitter();
            _this.nzOnDragStart = new core.EventEmitter();
            _this.nzOnDragEnter = new core.EventEmitter();
            _this.nzOnDragOver = new core.EventEmitter();
            _this.nzOnDragLeave = new core.EventEmitter();
            _this.nzOnDrop = new core.EventEmitter();
            _this.nzOnDragEnd = new core.EventEmitter();
            _this.HIDDEN_STYLE = {
                width: 0,
                height: 0,
                display: 'flex',
                overflow: 'hidden',
                opacity: 0,
                border: 0,
                padding: 0,
                margin: 0
            };
            _this.destroy$ = new rxjs.Subject();
            _this.prefixCls = 'ant-tree';
            _this.classMap = {};
            _this.classMapOfNodeList = {};
            _this.classMapOfListContainer = {};
            _this.onChange = function () { return null; };
            _this.onTouched = function () { return null; };
            return _this;
        }
        Object.defineProperty(NzTreeComponent.prototype, "treeTemplate", {
            get: function () {
                return this.nzTreeTemplate || this.nzTreeTemplateChild;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeComponent.prototype, "nzNodes", {
            /**
             * To render nodes if root is changed.
             */
            get: function () {
                return this.nzTreeService.rootNodes;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NzTreeComponent.prototype, "nzFlattenNodes", {
            get: function () {
                return this.nzTreeService.flattenNodes;
            },
            enumerable: true,
            configurable: true
        });
        NzTreeComponent.prototype.setClassMap = function () {
            var _a, _b, _c;
            this.prefixCls = this.nzSelectMode ? 'ant-select-tree' : 'ant-tree';
            this.classMapOfNodeList = (_a = {},
                _a[this.prefixCls + '-list'] = true,
                _a);
            this.classMapOfListContainer = (_b = {},
                _b[this.prefixCls + '-list-holder-inner'] = true,
                _b);
            this.classMap = (_c = {},
                _c[this.prefixCls] = true,
                _c[this.prefixCls + '-show-line'] = this.nzShowLine,
                _c[this.prefixCls + "-icon-hide"] = !this.nzShowIcon,
                _c[this.prefixCls + "-block-node"] = this.nzBlockNode,
                _c['draggable-tree'] = this.nzDraggable,
                _c);
            this.cdr.markForCheck();
        };
        NzTreeComponent.prototype.writeValue = function (value) {
            this.handleNzData(value);
        };
        NzTreeComponent.prototype.registerOnChange = function (fn) {
            this.onChange = fn;
        };
        NzTreeComponent.prototype.registerOnTouched = function (fn) {
            this.onTouched = fn;
        };
        /**
         * Render all properties of nzTree
         * @param changes: all changes from @Input
         */
        NzTreeComponent.prototype.renderTreeProperties = function (changes) {
            var useDefaultExpandedKeys = false;
            var expandAll = false;
            var nzData = changes.nzData, nzExpandedKeys = changes.nzExpandedKeys, nzSelectedKeys = changes.nzSelectedKeys, nzCheckedKeys = changes.nzCheckedKeys, nzCheckStrictly = changes.nzCheckStrictly, nzExpandAll = changes.nzExpandAll, nzMultiple = changes.nzMultiple, nzSearchValue = changes.nzSearchValue;
            if (nzExpandAll) {
                useDefaultExpandedKeys = true;
                expandAll = this.nzExpandAll;
            }
            if (nzMultiple) {
                this.nzTreeService.isMultiple = this.nzMultiple;
            }
            if (nzCheckStrictly) {
                this.nzTreeService.isCheckStrictly = this.nzCheckStrictly;
            }
            if (nzData) {
                this.handleNzData(this.nzData);
            }
            if (nzCheckedKeys || nzCheckStrictly) {
                this.handleCheckedKeys(this.nzCheckedKeys);
            }
            if (nzExpandedKeys || nzExpandAll) {
                useDefaultExpandedKeys = true;
                this.handleExpandedKeys(expandAll || this.nzExpandedKeys);
            }
            if (nzSelectedKeys) {
                this.handleSelectedKeys(this.nzSelectedKeys, this.nzMultiple);
            }
            if (nzSearchValue) {
                if (!(nzSearchValue.firstChange && !this.nzSearchValue)) {
                    useDefaultExpandedKeys = false;
                    this.handleSearchValue(this.nzSearchValue, this.nzSearchFunc);
                    this.nzSearchValueChange.emit(this.nzTreeService.formatEvent('search', null, null));
                }
            }
            // flatten data
            var currentExpandedKeys = this.getExpandedNodeList().map(function (v) { return v.key; });
            var newExpandedKeys = useDefaultExpandedKeys ? expandAll || this.nzExpandedKeys : currentExpandedKeys;
            this.handleFlattenNodes(this.nzNodes, newExpandedKeys);
        };
        // Deal with properties
        /**
         * nzData
         * @param value
         */
        // tslint:disable-next-line:no-any
        NzTreeComponent.prototype.handleNzData = function (value) {
            if (Array.isArray(value)) {
                var data = this.coerceTreeNodes(value);
                this.nzTreeService.initTree(data);
            }
        };
        NzTreeComponent.prototype.handleFlattenNodes = function (data, expandKeys) {
            if (expandKeys === void 0) { expandKeys = []; }
            this.nzTreeService.flattenTreeData(data, expandKeys);
        };
        NzTreeComponent.prototype.handleCheckedKeys = function (keys) {
            this.nzTreeService.conductCheck(keys, this.nzCheckStrictly);
        };
        NzTreeComponent.prototype.handleExpandedKeys = function (keys) {
            if (keys === void 0) { keys = []; }
            this.nzTreeService.conductExpandedKeys(keys);
        };
        NzTreeComponent.prototype.handleSelectedKeys = function (keys, isMulti) {
            this.nzTreeService.conductSelectedKeys(keys, isMulti);
        };
        NzTreeComponent.prototype.handleSearchValue = function (value, searchFunc) {
            var _this = this;
            var dataList = core$1.flattenTreeData(this.nzNodes, true).map(function (v) { return v.data; });
            var checkIfMatched = function (node) {
                if (searchFunc) {
                    return searchFunc(node.origin);
                }
                return !value || !node.title.includes(value) ? false : true;
            };
            dataList.forEach(function (v) {
                v.isMatched = checkIfMatched(v);
                v.canHide = !v.isMatched;
                if (!v.isMatched) {
                    v.setExpanded(false);
                    _this.nzTreeService.setExpandedNodeList(v);
                }
                else {
                    // expand
                    _this.nzTreeService.expandNodeAllParentBySearch(v);
                }
                _this.nzTreeService.setMatchedNodeList(v);
            });
        };
        /**
         * Handle emit event
         * @param event
         * handle each event
         */
        NzTreeComponent.prototype.eventTriggerChanged = function (event) {
            var node = event.node;
            switch (event.eventName) {
                case 'expand':
                    this.renderTree();
                    this.nzExpandChange.emit(event);
                    break;
                case 'click':
                    this.nzClick.emit(event);
                    break;
                case 'dblclick':
                    this.nzDblClick.emit(event);
                    break;
                case 'contextmenu':
                    this.nzContextMenu.emit(event);
                    break;
                case 'check':
                    // Render checked state with nodes' property `isChecked`
                    this.nzTreeService.setCheckedNodeList(node);
                    if (!this.nzCheckStrictly) {
                        this.nzTreeService.conduct(node);
                    }
                    // Cause check method will rerender list, so we need recover it and next the new event to user
                    var eventNext = this.nzTreeService.formatEvent('check', node, event.event);
                    this.nzCheckBoxChange.emit(eventNext);
                    break;
                case 'dragstart':
                    // if node is expanded
                    if (node.isExpanded) {
                        node.setExpanded(!node.isExpanded);
                        this.renderTree();
                    }
                    this.nzOnDragStart.emit(event);
                    break;
                case 'dragenter':
                    var selectedNode = this.nzTreeService.getSelectedNode();
                    if (selectedNode && selectedNode.key !== node.key && !node.isExpanded && !node.isLeaf) {
                        node.setExpanded(true);
                        this.renderTree();
                    }
                    this.nzOnDragEnter.emit(event);
                    break;
                case 'dragover':
                    this.nzOnDragOver.emit(event);
                    break;
                case 'dragleave':
                    this.nzOnDragLeave.emit(event);
                    break;
                case 'dragend':
                    this.nzOnDragEnd.emit(event);
                    break;
                case 'drop':
                    this.renderTree();
                    this.nzOnDrop.emit(event);
                    break;
            }
        };
        /**
         * Click expand icon
         */
        NzTreeComponent.prototype.renderTree = function () {
            this.handleFlattenNodes(this.nzNodes, this.getExpandedNodeList().map(function (v) { return v.key; }));
            this.cdr.markForCheck();
        };
        NzTreeComponent.prototype.ngOnInit = function () { };
        NzTreeComponent.prototype.ngOnChanges = function (changes) {
            this.setClassMap();
            this.renderTreeProperties(changes);
        };
        NzTreeComponent.prototype.ngOnDestroy = function () {
            this.destroy$.next();
            this.destroy$.complete();
        };
        /** @nocollapse */ NzTreeComponent.ɵfac = function NzTreeComponent_Factory(t) { return new (t || NzTreeComponent)(core["ɵɵdirectiveInject"](core$1.NzTreeBaseService), core["ɵɵdirectiveInject"](core$1.NzConfigService), core["ɵɵdirectiveInject"](core.ChangeDetectorRef), core["ɵɵdirectiveInject"](core$1.NzNoAnimationDirective, 9)); };
        /** @nocollapse */ NzTreeComponent.ɵcmp = core["ɵɵdefineComponent"]({ type: NzTreeComponent, selectors: [["nz-tree"]], contentQueries: function NzTreeComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
                core["ɵɵstaticContentQuery"](dirIndex, _c0$1, true);
            } if (rf & 2) {
                var _t;
                core["ɵɵqueryRefresh"](_t = core["ɵɵloadQuery"]()) && (ctx.nzTreeTemplateChild = _t.first);
            } }, inputs: { nzShowIcon: "nzShowIcon", nzShowExpand: "nzShowExpand", nzShowLine: "nzShowLine", nzExpandedIcon: "nzExpandedIcon", nzCheckable: "nzCheckable", nzAsyncData: "nzAsyncData", nzDraggable: "nzDraggable", nzHideUnMatched: "nzHideUnMatched", nzSelectMode: "nzSelectMode", nzCheckStrictly: "nzCheckStrictly", nzBlockNode: "nzBlockNode", nzExpandAll: "nzExpandAll", nzTreeTemplate: "nzTreeTemplate", nzBeforeDrop: "nzBeforeDrop", nzMultiple: "nzMultiple", nzData: "nzData", nzExpandedKeys: "nzExpandedKeys", nzSelectedKeys: "nzSelectedKeys", nzCheckedKeys: "nzCheckedKeys", nzSearchValue: "nzSearchValue", nzSearchFunc: "nzSearchFunc" }, outputs: { nzExpandedKeysChange: "nzExpandedKeysChange", nzSelectedKeysChange: "nzSelectedKeysChange", nzCheckedKeysChange: "nzCheckedKeysChange", nzSearchValueChange: "nzSearchValueChange", nzClick: "nzClick", nzDblClick: "nzDblClick", nzContextMenu: "nzContextMenu", nzCheckBoxChange: "nzCheckBoxChange", nzExpandChange: "nzExpandChange", nzOnDragStart: "nzOnDragStart", nzOnDragEnter: "nzOnDragEnter", nzOnDragOver: "nzOnDragOver", nzOnDragLeave: "nzOnDragLeave", nzOnDrop: "nzOnDrop", nzOnDragEnd: "nzOnDragEnd" }, exportAs: ["nzTree"], features: [core["ɵɵProvidersFeature"]([
                    NzTreeService,
                    {
                        provide: core$1.NzTreeBaseService,
                        useFactory: NzTreeServiceFactory,
                        deps: [[new core.SkipSelf(), new core.Optional(), core$1.NzTreeHigherOrderServiceToken], NzTreeService]
                    },
                    {
                        provide: forms.NG_VALUE_ACCESSOR,
                        useExisting: core.forwardRef((function () { return NzTreeComponent; })),
                        multi: true
                    }
                ]), core["ɵɵInheritDefinitionFeature"], core["ɵɵNgOnChangesFeature"]], decls: 7, vars: 5, consts: [[3, "ngClass"], ["role", "tree"], [3, "ngStyle"], [4, "ngFor", "ngForOf"], [3, "nzTreeNode", "nzSelectMode", "nzShowLine", "nzExpandedIcon", "nzDraggable", "nzCheckable", "nzShowExpand", "nzAsyncData", "nzSearchValue", "nzHideUnMatched", "nzBeforeDrop", "nzShowIcon", "nzTreeTemplate", "nzNoAnimation", "nzExpandChange", "nzClick", "nzDblClick", "nzContextMenu", "nzCheckBoxChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDragEnd", "nzOnDrop"]], template: function NzTreeComponent_Template(rf, ctx) { if (rf & 1) {
                core["ɵɵelementStart"](0, "div", 0);
                core["ɵɵelementStart"](1, "div", 1);
                core["ɵɵelement"](2, "input", 2);
                core["ɵɵelementEnd"]();
                core["ɵɵelementStart"](3, "div", 0);
                core["ɵɵelementStart"](4, "div");
                core["ɵɵelementStart"](5, "div", 0);
                core["ɵɵtemplate"](6, NzTreeComponent_ng_container_6_Template, 2, 15, "ng-container", 3);
                core["ɵɵelementEnd"]();
                core["ɵɵelementEnd"]();
                core["ɵɵelementEnd"]();
                core["ɵɵelementEnd"]();
            } if (rf & 2) {
                core["ɵɵproperty"]("ngClass", ctx.classMap);
                core["ɵɵadvance"](2);
                core["ɵɵproperty"]("ngStyle", ctx.HIDDEN_STYLE);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngClass", ctx.classMapOfNodeList);
                core["ɵɵadvance"](2);
                core["ɵɵproperty"]("ngClass", ctx.classMapOfListContainer);
                core["ɵɵadvance"](1);
                core["ɵɵproperty"]("ngForOf", ctx.nzFlattenNodes);
            } }, directives: [common.NgClass, common.NgStyle, common.NgForOf, NzTreeNodeComponent, core$1.NzNoAnimationDirective], encapsulation: 2, changeDetection: 0 });
        __decorate([
            core$1.InputBoolean(), core$1.WithConfig(NZ_CONFIG_COMPONENT_NAME, false),
            __metadata("design:type", Boolean)
        ], NzTreeComponent.prototype, "nzShowIcon", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeComponent.prototype, "nzShowExpand", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzShowLine", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzCheckable", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzAsyncData", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeComponent.prototype, "nzDraggable", void 0);
        __decorate([
            core$1.InputBoolean(), core$1.WithConfig(NZ_CONFIG_COMPONENT_NAME, false),
            __metadata("design:type", Boolean)
        ], NzTreeComponent.prototype, "nzHideUnMatched", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzSelectMode", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzCheckStrictly", void 0);
        __decorate([
            core$1.WithConfig(NZ_CONFIG_COMPONENT_NAME, false), core$1.InputBoolean(),
            __metadata("design:type", Boolean)
        ], NzTreeComponent.prototype, "nzBlockNode", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzExpandAll", void 0);
        __decorate([
            core$1.InputBoolean(),
            __metadata("design:type", Object)
        ], NzTreeComponent.prototype, "nzMultiple", void 0);
        return NzTreeComponent;
    }(core$1.NzTreeBase));
    /*@__PURE__*/ (function () { core["ɵsetClassMetadata"](NzTreeComponent, [{
            type: core.Component,
            args: [{
                    selector: 'nz-tree',
                    exportAs: 'nzTree',
                    template: "\n    <div [ngClass]=\"classMap\">\n      <div role=\"tree\">\n        <input [ngStyle]=\"HIDDEN_STYLE\" />\n      </div>\n      <div [ngClass]=\"classMapOfNodeList\">\n        <div>\n          <div [ngClass]=\"classMapOfListContainer\">\n            <ng-container *ngFor=\"let node of nzFlattenNodes\">\n              <nz-tree-node\n                [nzTreeNode]=\"node.data\"\n                [nzSelectMode]=\"nzSelectMode\"\n                [nzShowLine]=\"nzShowLine\"\n                [nzExpandedIcon]=\"nzExpandedIcon\"\n                [nzDraggable]=\"nzDraggable\"\n                [nzCheckable]=\"nzCheckable\"\n                [nzShowExpand]=\"nzShowExpand\"\n                [nzAsyncData]=\"nzAsyncData\"\n                [nzSearchValue]=\"nzSearchValue\"\n                [nzHideUnMatched]=\"nzHideUnMatched\"\n                [nzBeforeDrop]=\"nzBeforeDrop\"\n                [nzShowIcon]=\"nzShowIcon\"\n                [nzTreeTemplate]=\"treeTemplate\"\n                [@.disabled]=\"noAnimation?.nzNoAnimation\"\n                [nzNoAnimation]=\"noAnimation?.nzNoAnimation\"\n                (nzExpandChange)=\"eventTriggerChanged($event)\"\n                (nzClick)=\"eventTriggerChanged($event)\"\n                (nzDblClick)=\"eventTriggerChanged($event)\"\n                (nzContextMenu)=\"eventTriggerChanged($event)\"\n                (nzCheckBoxChange)=\"eventTriggerChanged($event)\"\n                (nzOnDragStart)=\"eventTriggerChanged($event)\"\n                (nzOnDragEnter)=\"eventTriggerChanged($event)\"\n                (nzOnDragOver)=\"eventTriggerChanged($event)\"\n                (nzOnDragLeave)=\"eventTriggerChanged($event)\"\n                (nzOnDragEnd)=\"eventTriggerChanged($event)\"\n                (nzOnDrop)=\"eventTriggerChanged($event)\"\n              >\n              </nz-tree-node>\n            </ng-container>\n          </div>\n        </div>\n      </div>\n    </div>\n  ",
                    changeDetection: core.ChangeDetectionStrategy.OnPush,
                    providers: [
                        NzTreeService,
                        {
                            provide: core$1.NzTreeBaseService,
                            useFactory: NzTreeServiceFactory,
                            deps: [[new core.SkipSelf(), new core.Optional(), core$1.NzTreeHigherOrderServiceToken], NzTreeService]
                        },
                        {
                            provide: forms.NG_VALUE_ACCESSOR,
                            useExisting: core.forwardRef((function () { return NzTreeComponent; })),
                            multi: true
                        }
                    ]
                }]
        }], function () { return [{ type: core$1.NzTreeBaseService }, { type: core$1.NzConfigService }, { type: core.ChangeDetectorRef }, { type: core$1.NzNoAnimationDirective, decorators: [{
                    type: core.Host
                }, {
                    type: core.Optional
                }] }]; }, { nzShowIcon: [{
                type: core.Input
            }], nzShowExpand: [{
                type: core.Input
            }], nzShowLine: [{
                type: core.Input
            }], nzExpandedIcon: [{
                type: core.Input
            }], nzCheckable: [{
                type: core.Input
            }], nzAsyncData: [{
                type: core.Input
            }], nzDraggable: [{
                type: core.Input
            }], nzHideUnMatched: [{
                type: core.Input
            }], nzSelectMode: [{
                type: core.Input
            }], nzCheckStrictly: [{
                type: core.Input
            }], nzBlockNode: [{
                type: core.Input
            }], nzExpandAll: [{
                type: core.Input
            }], nzTreeTemplate: [{
                type: core.Input
            }], nzTreeTemplateChild: [{
                type: core.ContentChild,
                args: ['nzTreeTemplate', { static: true }]
            }], nzBeforeDrop: [{
                type: core.Input
            }], nzMultiple: [{
                type: core.Input
            }], nzData: [{
                type: core.Input
            }], nzExpandedKeys: [{
                type: core.Input
            }], nzSelectedKeys: [{
                type: core.Input
            }], nzCheckedKeys: [{
                type: core.Input
            }], nzSearchValue: [{
                type: core.Input
            }], nzSearchFunc: [{
                type: core.Input
            }], nzExpandedKeysChange: [{
                type: core.Output
            }], nzSelectedKeysChange: [{
                type: core.Output
            }], nzCheckedKeysChange: [{
                type: core.Output
            }], nzSearchValueChange: [{
                type: core.Output
            }], nzClick: [{
                type: core.Output
            }], nzDblClick: [{
                type: core.Output
            }], nzContextMenu: [{
                type: core.Output
            }], nzCheckBoxChange: [{
                type: core.Output
            }], nzExpandChange: [{
                type: core.Output
            }], nzOnDragStart: [{
                type: core.Output
            }], nzOnDragEnter: [{
                type: core.Output
            }], nzOnDragOver: [{
                type: core.Output
            }], nzOnDragLeave: [{
                type: core.Output
            }], nzOnDrop: [{
                type: core.Output
            }], nzOnDragEnd: [{
                type: core.Output
            }] }); })();

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

    exports.NzTreeComponent = NzTreeComponent;
    exports.NzTreeIndentComponent = NzTreeIndentComponent;
    exports.NzTreeModule = NzTreeModule;
    exports.NzTreeNodeComponent = NzTreeNodeComponent;
    exports.NzTreeService = NzTreeService;
    exports.NzTreeServiceFactory = NzTreeServiceFactory;

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

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