/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
import { animate, style, transition, trigger } from '@angular/animations';
import { Platform } from '@angular/cdk/platform';
import { DOCUMENT } from '@angular/common';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Inject, Input, NgZone, TemplateRef, ViewEncapsulation } from '@angular/core';
import { NzUpdateHostClassService } from 'ng-zorro-antd/core';
import * as i0 from "@angular/core";
import * as i1 from "ng-zorro-antd/core";
import * as i2 from "@angular/cdk/platform";
import * as i3 from "@angular/common";
import * as i4 from "ng-zorro-antd/tooltip";
import * as i5 from "ng-zorro-antd/icon";
import * as i6 from "ng-zorro-antd/progress";
function NzUploadListComponent_div_0_ng_template_1_div_1_ng_template_1_Template(rf, ctx) { }
var _c0 = function (a0) { return { $implicit: a0 }; };
function NzUploadListComponent_div_0_ng_template_1_div_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 17);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_div_1_ng_template_1_Template, 0, 0, "ng-template", 18);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    var _r2500 = i0.ɵɵreference(4);
    i0.ɵɵclassProp("ant-upload-list-item-file", !file_r2497.isUploading);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2500)("ngTemplateOutletContext", i0.ɵɵpureFunction1(4, _c0, file_r2497));
} }
function NzUploadListComponent_div_0_ng_template_1_a_2_img_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "img", 21);
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(3).$implicit;
    i0.ɵɵproperty("src", file_r2497.thumbUrl || file_r2497.url, i0.ɵɵsanitizeUrl);
    i0.ɵɵattribute("alt", file_r2497.name);
} }
function NzUploadListComponent_div_0_ng_template_1_a_2_Template(rf, ctx) { if (rf & 1) {
    var _r2525 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "a", 19);
    i0.ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_1_a_2_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r2525); var file_r2497 = i0.ɵɵnextContext(2).$implicit; var ctx_r2523 = i0.ɵɵnextContext(); return ctx_r2523.handlePreview(file_r2497, $event); });
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_a_2_img_1_Template, 1, 2, "img", 20);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    var _r2517 = i0.ɵɵreference(5);
    var file_r2497 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵclassProp("ant-upload-list-item-file", !file_r2497.isImageUrl);
    i0.ɵɵproperty("href", file_r2497.url || file_r2497.thumbUrl, i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", file_r2497.isImageUrl)("ngIfElse", _r2517);
} }
function NzUploadListComponent_div_0_ng_template_1_span_3_ng_template_1_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_1_span_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 22);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_span_3_ng_template_1_Template, 0, 0, "ng-template", 18);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    var _r2500 = i0.ɵɵreference(4);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2500)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c0, file_r2497));
} }
function NzUploadListComponent_div_0_ng_template_1_ng_template_4_ng_template_0_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_1_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_1_ng_template_4_ng_template_0_Template, 0, 0, "ng-template", 18);
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    var _r2500 = i0.ɵɵreference(4);
    i0.ɵɵproperty("ngTemplateOutlet", _r2500)("ngTemplateOutletContext", i0.ɵɵpureFunction1(2, _c0, file_r2497));
} }
function NzUploadListComponent_div_0_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0, 12);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_div_1_Template, 2, 6, "div", 13);
    i0.ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_1_a_2_Template, 2, 5, "a", 14);
    i0.ɵɵtemplate(3, NzUploadListComponent_div_0_ng_template_1_span_3_Template, 2, 4, "span", 15);
    i0.ɵɵelementContainerEnd();
    i0.ɵɵtemplate(4, NzUploadListComponent_div_0_ng_template_1_ng_template_4_Template, 1, 4, "ng-template", null, 16, i0.ɵɵtemplateRefExtractor);
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("ngSwitch", file_r2497.iconType);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "uploading");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "thumbnail");
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelement(1, "i", 27);
    i0.ɵɵelementContainerEnd();
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_ng_container_1_Template, 2, 0, "ng-container", 23);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var file_r2532 = i0.ɵɵnextContext(2).$implicit;
    var _r2534 = i0.ɵɵreference(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", file_r2532.isUploading)("ngIfElse", _r2534);
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtext(1);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r2541 = i0.ɵɵnextContext(5);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(ctx_r2541.locale.uploading);
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_ng_container_1_Template, 2, 1, "ng-container", 23);
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var file_r2532 = i0.ɵɵnextContext(2).$implicit;
    var _r2534 = i0.ɵɵreference(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", file_r2532.isUploading)("ngIfElse", _r2534);
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_i_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 28);
} if (rf & 2) {
    var file_r2532 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵproperty("nzType", file_r2532.isUploading ? "loading" : "paper-clip");
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementContainerStart(1, 12);
    i0.ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_Template, 2, 2, "ng-container", 25);
    i0.ɵɵtemplate(3, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_Template, 2, 2, "ng-container", 25);
    i0.ɵɵtemplate(4, NzUploadListComponent_div_0_ng_template_3_ng_container_0_i_4_Template, 1, 1, "i", 26);
    i0.ɵɵelementContainerEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r2533 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitch", ctx_r2533.listType);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "picture");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngSwitchCase", "picture-card");
} }
function NzUploadListComponent_div_0_ng_template_3_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "i", 29);
} if (rf & 2) {
    var file_r2532 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("nzType", file_r2532.isImageUrl ? "picture" : "file");
} }
function NzUploadListComponent_div_0_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_3_ng_container_0_Template, 5, 3, "ng-container", 23);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_3_ng_template_1_Template, 1, 1, "ng-template", null, 24, i0.ɵɵtemplateRefExtractor);
} if (rf & 2) {
    var ctx_r2501 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngIf", !ctx_r2501.iconRender)("ngIfElse", ctx_r2501.iconRender);
} }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_1_ng_template_1_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 32);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_5_span_0_a_1_ng_template_1_Template, 0, 0, "ng-template", 9);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    i0.ɵɵnextContext(3);
    var _r2508 = i0.ɵɵreference(12);
    var ctx_r2546 = i0.ɵɵnextContext();
    i0.ɵɵpropertyInterpolate("title", ctx_r2546.locale.downloadFile);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2508);
} }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_2_ng_template_1_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 32);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_5_span_0_a_2_ng_template_1_Template, 0, 0, "ng-template", 9);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    i0.ɵɵnextContext(3);
    var _r2506 = i0.ɵɵreference(10);
    var ctx_r2547 = i0.ɵɵnextContext();
    i0.ɵɵpropertyInterpolate("title", ctx_r2547.locale.removeFile);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2506);
} }
function NzUploadListComponent_div_0_ng_template_5_span_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span");
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_5_span_0_a_1_Template, 2, 2, "a", 31);
    i0.ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_5_span_0_a_2_Template, 2, 2, "a", 31);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    var ctx_r2545 = i0.ɵɵnextContext();
    i0.ɵɵclassMapInterpolate1("ant-upload-list-item-card-actions ", ctx_r2545.listType === "picture" ? "picture" : "", "");
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", file_r2497.showDownload);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r2545.icons.showRemoveIcon);
} }
function NzUploadListComponent_div_0_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_5_span_0_Template, 3, 5, "span", 30);
} if (rf & 2) {
    var ctx_r2503 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngIf", ctx_r2503.listType !== "picture-card");
} }
function NzUploadListComponent_div_0_ng_template_7_a_0_Template(rf, ctx) { if (rf & 1) {
    var _r2556 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "a", 35);
    i0.ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_7_a_0_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r2556); var file_r2497 = i0.ɵɵnextContext(2).$implicit; var ctx_r2554 = i0.ɵɵnextContext(); return ctx_r2554.handlePreview(file_r2497, $event); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵpropertyInterpolate("title", file_r2497.name);
    i0.ɵɵproperty("ngClass", file_r2497.listItemNameCls)("href", file_r2497.url, i0.ɵɵsanitizeUrl);
    i0.ɵɵattribute("download", file_r2497.linkProps && file_r2497.linkProps.download);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(file_r2497.name);
} }
function NzUploadListComponent_div_0_ng_template_7_span_1_Template(rf, ctx) { if (rf & 1) {
    var _r2560 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "span", 36);
    i0.ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_7_span_1_Template_span_click_0_listener($event) { i0.ɵɵrestoreView(_r2560); var file_r2497 = i0.ɵɵnextContext(2).$implicit; var ctx_r2558 = i0.ɵɵnextContext(); return ctx_r2558.handlePreview(file_r2497, $event); });
    i0.ɵɵtext(1);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    i0.ɵɵpropertyInterpolate("title", file_r2497.name);
    i0.ɵɵproperty("ngClass", file_r2497.listItemNameCls);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(file_r2497.name);
} }
function NzUploadListComponent_div_0_ng_template_7_ng_template_2_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_7_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_7_a_0_Template, 2, 5, "a", 33);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_7_span_1_Template, 2, 3, "span", 34);
    i0.ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_7_ng_template_2_Template, 0, 0, "ng-template", 9);
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext().$implicit;
    var _r2502 = i0.ɵɵreference(6);
    i0.ɵɵproperty("ngIf", file_r2497.url);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", !file_r2497.url);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2502);
} }
function NzUploadListComponent_div_0_ng_template_9_i_0_Template(rf, ctx) { if (rf & 1) {
    var _r2566 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "i", 38);
    i0.ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_9_i_0_Template_i_click_0_listener($event) { i0.ɵɵrestoreView(_r2566); var file_r2497 = i0.ɵɵnextContext(2).$implicit; var ctx_r2564 = i0.ɵɵnextContext(); return ctx_r2564.handleRemove(file_r2497, $event); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2563 = i0.ɵɵnextContext(3);
    i0.ɵɵpropertyInterpolate("title", ctx_r2563.locale.removeFile);
} }
function NzUploadListComponent_div_0_ng_template_9_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_9_i_0_Template, 1, 1, "i", 37);
} if (rf & 2) {
    var ctx_r2507 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("ngIf", ctx_r2507.icons.showRemoveIcon);
} }
function NzUploadListComponent_div_0_ng_template_11_i_0_Template(rf, ctx) { if (rf & 1) {
    var _r2570 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "i", 40);
    i0.ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_11_i_0_Template_i_click_0_listener() { i0.ɵɵrestoreView(_r2570); var file_r2497 = i0.ɵɵnextContext(2).$implicit; var ctx_r2568 = i0.ɵɵnextContext(); return ctx_r2568.handleDownload(file_r2497); });
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2567 = i0.ɵɵnextContext(3);
    i0.ɵɵpropertyInterpolate("title", ctx_r2567.locale.downloadFile);
} }
function NzUploadListComponent_div_0_ng_template_11_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_11_i_0_Template, 1, 1, "i", 39);
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵproperty("ngIf", file_r2497.showDownload);
} }
function NzUploadListComponent_div_0_ng_template_15_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_16_Template(rf, ctx) { }
var _c1 = function () { return { opacity: 0.5, "pointer-events": "none" }; };
function NzUploadListComponent_div_0_span_17_a_1_Template(rf, ctx) { if (rf & 1) {
    var _r2577 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "a", 43);
    i0.ɵɵlistener("click", function NzUploadListComponent_div_0_span_17_a_1_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r2577); var file_r2497 = i0.ɵɵnextContext(2).$implicit; var ctx_r2575 = i0.ɵɵnextContext(); return ctx_r2575.handlePreview(file_r2497, $event); });
    i0.ɵɵelement(1, "i", 44);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext(2).$implicit;
    var ctx_r2572 = i0.ɵɵnextContext();
    i0.ɵɵpropertyInterpolate("title", ctx_r2572.locale.previewFile);
    i0.ɵɵproperty("href", file_r2497.url || file_r2497.thumbUrl, i0.ɵɵsanitizeUrl)("ngStyle", !(file_r2497.url || file_r2497.thumbUrl) && i0.ɵɵpureFunction0(3, _c1));
} }
function NzUploadListComponent_div_0_span_17_ng_template_2_Template(rf, ctx) { }
function NzUploadListComponent_div_0_span_17_ng_template_3_Template(rf, ctx) { }
function NzUploadListComponent_div_0_span_17_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 41);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_span_17_a_1_Template, 2, 4, "a", 42);
    i0.ɵɵtemplate(2, NzUploadListComponent_div_0_span_17_ng_template_2_Template, 0, 0, "ng-template", 9);
    i0.ɵɵtemplate(3, NzUploadListComponent_div_0_span_17_ng_template_3_Template, 0, 0, "ng-template", 9);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    i0.ɵɵnextContext();
    var _r2508 = i0.ɵɵreference(12);
    var _r2506 = i0.ɵɵreference(10);
    var ctx_r2512 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r2512.icons.showPreviewIcon);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2508);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2506);
} }
function NzUploadListComponent_div_0_div_18_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 45);
    i0.ɵɵelement(1, "nz-progress", 46);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("nzPercent", file_r2497.percent)("nzShowInfo", false)("nzStrokeWidth", 2);
} }
function NzUploadListComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 1);
    i0.ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_Template, 6, 3, "ng-template", null, 2, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(3, NzUploadListComponent_div_0_ng_template_3_Template, 3, 2, "ng-template", null, 3, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(5, NzUploadListComponent_div_0_ng_template_5_Template, 1, 1, "ng-template", null, 4, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(7, NzUploadListComponent_div_0_ng_template_7_Template, 3, 3, "ng-template", null, 5, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(9, NzUploadListComponent_div_0_ng_template_9_Template, 1, 1, "ng-template", null, 6, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵtemplate(11, NzUploadListComponent_div_0_ng_template_11_Template, 1, 1, "ng-template", null, 7, i0.ɵɵtemplateRefExtractor);
    i0.ɵɵelementStart(13, "div", 8);
    i0.ɵɵelementStart(14, "span");
    i0.ɵɵtemplate(15, NzUploadListComponent_div_0_ng_template_15_Template, 0, 0, "ng-template", 9);
    i0.ɵɵtemplate(16, NzUploadListComponent_div_0_ng_template_16_Template, 0, 0, "ng-template", 9);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(17, NzUploadListComponent_div_0_span_17_Template, 4, 3, "span", 10);
    i0.ɵɵtemplate(18, NzUploadListComponent_div_0_div_18_Template, 2, 3, "div", 11);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ctx.$implicit;
    var _r2498 = i0.ɵɵreference(2);
    var _r2504 = i0.ɵɵreference(8);
    var ctx_r2496 = i0.ɵɵnextContext();
    i0.ɵɵclassMapInterpolate2("ant-upload-list-item ant-upload-list-item-", file_r2497.status, " ant-upload-list-item-list-type-", ctx_r2496.listType, "");
    i0.ɵɵproperty("@itemState", undefined)("nzTooltipTitle", file_r2497.status === "error" ? file_r2497.message : null);
    i0.ɵɵattribute("data-key", file_r2497.key);
    i0.ɵɵadvance(15);
    i0.ɵɵproperty("ngTemplateOutlet", _r2498);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngTemplateOutlet", _r2504);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r2496.listType === "picture-card" && !file_r2497.isUploading);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", file_r2497.isUploading);
} }
var isImageFileType = function (type) { return !!type && type.indexOf('image/') === 0; };
var MEASURE_SIZE = 200;
var NzUploadListComponent = /** @class */ (function () {
    // #endregion
    function NzUploadListComponent(el, cdr, updateHostClassService, doc, // tslint:disable-line no-any
    ngZone, platform) {
        this.el = el;
        this.cdr = cdr;
        this.updateHostClassService = updateHostClassService;
        this.doc = doc;
        this.ngZone = ngZone;
        this.platform = platform;
        // #region fields
        // tslint:disable-next-line:no-any
        this.locale = {};
        // #endregion
        // #region styles
        this.prefixCls = 'ant-upload-list';
    }
    Object.defineProperty(NzUploadListComponent.prototype, "showPic", {
        get: function () {
            return this.listType === 'picture' || this.listType === 'picture-card';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzUploadListComponent.prototype, "items", {
        set: function (list) {
            this.list = list;
        },
        enumerable: true,
        configurable: true
    });
    NzUploadListComponent.prototype.setClassMap = function () {
        var _a;
        var classMap = (_a = {},
            _a[this.prefixCls] = true,
            _a[this.prefixCls + "-" + this.listType] = true,
            _a);
        this.updateHostClassService.updateHostClass(this.el.nativeElement, classMap);
        return this;
    };
    // #endregion
    // #region render
    NzUploadListComponent.prototype.genErr = function (file) {
        if (file.response && typeof file.response === 'string') {
            return file.response;
        }
        return (file.error && file.error.statusText) || this.locale.uploadError;
    };
    NzUploadListComponent.prototype.extname = function (url) {
        var temp = url.split('/');
        var filename = temp[temp.length - 1];
        var filenameWithoutSuffix = filename.split(/#|\?/)[0];
        return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
    };
    NzUploadListComponent.prototype.isImageUrl = function (file) {
        if (isImageFileType(file.type)) {
            return true;
        }
        var url = (file.thumbUrl || file.url || '');
        if (!url) {
            return false;
        }
        var extension = this.extname(url);
        if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg)$/i.test(extension)) {
            return true;
        }
        else if (/^data:/.test(url)) {
            // other file types of base64
            return false;
        }
        else if (extension) {
            // other file types which have extension
            return false;
        }
        return true;
    };
    NzUploadListComponent.prototype.getIconType = function (file) {
        if (!this.showPic) {
            return '';
        }
        if (file.isUploading || (!file.thumbUrl && !file.url)) {
            return 'uploading';
        }
        else {
            return 'thumbnail';
        }
    };
    NzUploadListComponent.prototype.previewImage = function (file) {
        var _this = this;
        return new Promise(function (resolve) {
            if (!isImageFileType(file.type)) {
                resolve('');
                return;
            }
            _this.ngZone.runOutsideAngular(function () {
                var canvas = _this.doc.createElement('canvas');
                canvas.width = MEASURE_SIZE;
                canvas.height = MEASURE_SIZE;
                canvas.style.cssText = "position: fixed; left: 0; top: 0; width: " + MEASURE_SIZE + "px; height: " + MEASURE_SIZE + "px; z-index: 9999; display: none;";
                _this.doc.body.appendChild(canvas);
                var ctx = canvas.getContext('2d');
                var img = new Image();
                img.onload = function () {
                    var width = img.width, height = img.height;
                    var drawWidth = MEASURE_SIZE;
                    var drawHeight = MEASURE_SIZE;
                    var offsetX = 0;
                    var offsetY = 0;
                    if (width < height) {
                        drawHeight = height * (MEASURE_SIZE / width);
                        offsetY = -(drawHeight - drawWidth) / 2;
                    }
                    else {
                        drawWidth = width * (MEASURE_SIZE / height);
                        offsetX = -(drawWidth - drawHeight) / 2;
                    }
                    try {
                        ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
                    }
                    catch (_a) { }
                    var dataURL = canvas.toDataURL();
                    _this.doc.body.removeChild(canvas);
                    resolve(dataURL);
                };
                img.src = window.URL.createObjectURL(file);
            });
        });
    };
    NzUploadListComponent.prototype.genThumb = function () {
        var _this = this;
        if (!this.platform.isBrowser) {
            return;
        }
        // tslint:disable-next-line:no-any
        var win = window;
        if (!this.showPic || typeof document === 'undefined' || typeof win === 'undefined' || !win.FileReader || !win.File) {
            return;
        }
        this.list
            .filter(function (file) { return file.originFileObj instanceof File && file.thumbUrl === undefined; })
            .forEach(function (file) {
            file.thumbUrl = '';
            (_this.previewFile ? _this.previewFile(file).toPromise() : _this.previewImage(file.originFileObj)).then(function (dataUrl) {
                file.thumbUrl = dataUrl;
                _this.detectChanges();
            });
        });
    };
    NzUploadListComponent.prototype.listItemNameCls = function (file) {
        var _a;
        var count = [this.showDownload(file), this.icons.showRemoveIcon].filter(function (x) { return x; }).length;
        return _a = {},
            _a[this.prefixCls + "-item-name"] = true,
            _a[this.prefixCls + "-item-name-icon-count-" + count] = true,
            _a;
    };
    NzUploadListComponent.prototype.showDownload = function (file) {
        return this.icons.showDownloadIcon && file.status === 'done' ? true : false;
    };
    NzUploadListComponent.prototype.fixData = function () {
        var _this = this;
        this.list.forEach(function (file) {
            file.message = _this.genErr(file);
            file.linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
            file.isImageUrl = _this.isImageUrl(file);
            file.iconType = _this.getIconType(file);
            file.isUploading = file.status === 'uploading';
            file.listItemNameCls = _this.listItemNameCls(file);
            file.showDownload = _this.showDownload(file);
        });
        return this;
    };
    NzUploadListComponent.prototype.handlePreview = function (file, e) {
        if (!this.onPreview) {
            return;
        }
        e.preventDefault();
        return this.onPreview(file);
    };
    NzUploadListComponent.prototype.handleRemove = function (file, e) {
        e.preventDefault();
        if (this.onRemove) {
            this.onRemove(file);
        }
        return;
    };
    NzUploadListComponent.prototype.handleDownload = function (file) {
        if (typeof this.onDownload === 'function') {
            this.onDownload(file);
        }
        else if (file.url) {
            window.open(file.url);
        }
    };
    NzUploadListComponent.prototype.detectChanges = function () {
        this.fixData();
        this.cdr.detectChanges();
    };
    NzUploadListComponent.prototype.ngOnChanges = function () {
        this.fixData()
            .setClassMap()
            .genThumb();
    };
    /** @nocollapse */ NzUploadListComponent.ɵfac = function NzUploadListComponent_Factory(t) { return new (t || NzUploadListComponent)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1.NzUpdateHostClassService), i0.ɵɵdirectiveInject(DOCUMENT), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵdirectiveInject(i2.Platform)); };
    /** @nocollapse */ NzUploadListComponent.ɵcmp = i0.ɵɵdefineComponent({ type: NzUploadListComponent, selectors: [["nz-upload-list"]], inputs: { locale: "locale", listType: "listType", items: "items", icons: "icons", onPreview: "onPreview", onRemove: "onRemove", onDownload: "onDownload", previewFile: "previewFile", iconRender: "iconRender" }, exportAs: ["nzUploadList"], features: [i0.ɵɵProvidersFeature([NzUpdateHostClassService]), i0.ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["nz-tooltip", "", 3, "class", "nzTooltipTitle", 4, "ngFor", "ngForOf"], ["nz-tooltip", "", 3, "nzTooltipTitle"], ["icon", ""], ["iconNode", ""], ["downloadOrDelete", ""], ["preview", ""], ["removeIcon", ""], ["downloadIcon", ""], [1, "ant-upload-list-item-info"], [3, "ngTemplateOutlet"], ["class", "ant-upload-list-item-actions", 4, "ngIf"], ["class", "ant-upload-list-item-progress", 4, "ngIf"], [3, "ngSwitch"], ["class", "ant-upload-list-item-thumbnail", 3, "ant-upload-list-item-file", 4, "ngSwitchCase"], ["class", "ant-upload-list-item-thumbnail", "target", "_blank", "rel", "noopener noreferrer", 3, "ant-upload-list-item-file", "href", "click", 4, "ngSwitchCase"], ["class", "ant-upload-text-icon", 4, "ngSwitchDefault"], ["noImageThumbTpl", ""], [1, "ant-upload-list-item-thumbnail"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["target", "_blank", "rel", "noopener noreferrer", 1, "ant-upload-list-item-thumbnail", 3, "href", "click"], ["class", "ant-upload-list-item-image", 3, "src", 4, "ngIf", "ngIfElse"], [1, "ant-upload-list-item-image", 3, "src"], [1, "ant-upload-text-icon"], [4, "ngIf", "ngIfElse"], ["iconNodeFileIcon", ""], [4, "ngSwitchCase"], ["nz-icon", "", 3, "nzType", 4, "ngSwitchDefault"], ["nz-icon", "", "nzType", "loading"], ["nz-icon", "", 3, "nzType"], ["nz-icon", "", "nzTheme", "twotone", 3, "nzType"], [3, "class", 4, "ngIf"], [3, "title", 4, "ngIf"], [3, "title"], ["target", "_blank", "rel", "noopener noreferrer", 3, "ngClass", "title", "href", "click", 4, "ngIf"], [3, "ngClass", "title", "click", 4, "ngIf"], ["target", "_blank", "rel", "noopener noreferrer", 3, "ngClass", "title", "href", "click"], [3, "ngClass", "title", "click"], ["nz-icon", "", "nzType", "delete", 3, "title", "click", 4, "ngIf"], ["nz-icon", "", "nzType", "delete", 3, "title", "click"], ["nz-icon", "", "nzType", "download", 3, "title", "click", 4, "ngIf"], ["nz-icon", "", "nzType", "download", 3, "title", "click"], [1, "ant-upload-list-item-actions"], ["target", "_blank", "rel", "noopener noreferrer", 3, "href", "title", "ngStyle", "click", 4, "ngIf"], ["target", "_blank", "rel", "noopener noreferrer", 3, "href", "title", "ngStyle", "click"], ["nz-icon", "", "nzType", "eye"], [1, "ant-upload-list-item-progress"], ["nzType", "line", 3, "nzPercent", "nzShowInfo", "nzStrokeWidth"]], template: function NzUploadListComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵtemplate(0, NzUploadListComponent_div_0_Template, 19, 11, "div", 0);
        } if (rf & 2) {
            i0.ɵɵproperty("ngForOf", ctx.list);
        } }, directives: [i3.NgForOf, i4.NzTooltipDirective, i3.NgTemplateOutlet, i3.NgIf, i3.NgSwitch, i3.NgSwitchCase, i3.NgSwitchDefault, i5.NzIconDirective, i3.NgClass, i3.NgStyle, i6.NzProgressComponent], encapsulation: 2, data: { animation: [
                trigger('itemState', [
                    transition(':enter', [style({ height: '0', width: '0', opacity: 0 }), animate(150, style({ height: '*', width: '*', opacity: 1 }))]),
                    transition(':leave', [animate(150, style({ height: '0', width: '0', opacity: 0 }))])
                ])
            ] }, changeDetection: 0 });
    return NzUploadListComponent;
}());
export { NzUploadListComponent };
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(NzUploadListComponent, [{
        type: Component,
        args: [{
                selector: 'nz-upload-list',
                exportAs: 'nzUploadList',
                templateUrl: './upload-list.component.html',
                providers: [NzUpdateHostClassService],
                animations: [
                    trigger('itemState', [
                        transition(':enter', [style({ height: '0', width: '0', opacity: 0 }), animate(150, style({ height: '*', width: '*', opacity: 1 }))]),
                        transition(':leave', [animate(150, style({ height: '0', width: '0', opacity: 0 }))])
                    ])
                ],
                preserveWhitespaces: false,
                encapsulation: ViewEncapsulation.None,
                changeDetection: ChangeDetectionStrategy.OnPush
            }]
    }], function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.NzUpdateHostClassService }, { type: undefined, decorators: [{
                type: Inject,
                args: [DOCUMENT]
            }] }, { type: i0.NgZone }, { type: i2.Platform }]; }, { locale: [{
            type: Input
        }], listType: [{
            type: Input
        }], items: [{
            type: Input
        }], icons: [{
            type: Input
        }], onPreview: [{
            type: Input
        }], onRemove: [{
            type: Input
        }], onDownload: [{
            type: Input
        }], previewFile: [{
            type: Input
        }], iconRender: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 