import * as i0 from '@angular/core';
import { Injectable, EventEmitter, Component, ViewChild, Input, Output, HostListener, NgModule } from '@angular/core';
import { Subject } from 'rxjs';
import moment from 'moment';
import { isNullOrUndefined, Breakpoints } from '@seniorsistemas/angular-components/utils';
import * as i1 from '@angular/platform-browser';
import { CustomHttpClient } from '@seniorsistemas/angular-components/common';
import * as i3 from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import * as i4 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i5 from '@seniorsistemas/angular-components/button';
import { ButtonModule } from '@seniorsistemas/angular-components/button';
import * as i6 from 'primeng/tooltip';
import { TooltipModule } from 'primeng/tooltip';
import * as i7 from 'primeng/progressbar';
import { ProgressBarModule } from 'primeng/progressbar';
import { LocaleModule } from '@seniorsistemas/angular-components/locale';

const ALL_PERMISSIONS = ['add', 'read', 'remove'];

class FileUploadService {
    BASE_URL_FIELD_CUSTOMIZATION = 'platform/field_customization';
    TOKEN = new AbortController();
    async getMetadataCustomField(request) {
        return CustomHttpClient.post(`${this.BASE_URL_FIELD_CUSTOMIZATION}/queries/getFileMetadata`, request, {
            signal: this.TOKEN.signal,
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
    static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadService, decorators: [{
            type: Injectable
        }] });

class FileUploadComponent {
    sanitizer;
    fileUploadService;
    translate;
    static nextId = 0;
    ADD_PERMISSION = 'add';
    READ_PERMISSION = 'read';
    REMOVE_PERMISSION = 'remove';
    inputUpload = null;
    anchor = null;
    id = `s-file-upload-${FileUploadComponent.nextId++}`;
    chooseLabel;
    removeLabel;
    cancelLabel;
    successTooltip;
    multiple;
    accept;
    supportedExtensions = [];
    ariaLabelFileName;
    maxFileSize;
    maxCombinedFileSize;
    fileLimit;
    ariaLabelProgress;
    ariaLabelSuccess;
    ariaLabelError;
    ariaLabelRemove;
    formGroup;
    disabled = false;
    showFileUploadDate = false;
    permissions = ALL_PERMISSIONS;
    set files(files) {
        if (this.showFileUploadDate && files[0]?.objectId) {
            this.getUploadDate(files);
        }
        this._files = files.map((file) => {
            file.objectURL = this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(file));
            return file;
        });
    }
    uploadHandler = new EventEmitter();
    removeFile = new EventEmitter();
    cancelUpload = new EventEmitter();
    downloadFile = new EventEmitter();
    validateErrors = new EventEmitter();
    _files = [];
    ngUsubscribe = new Subject();
    isSmallDevice = false;
    inputValue = '';
    modifiedDate;
    constructor(sanitizer, fileUploadService, translate) {
        this.sanitizer = sanitizer;
        this.fileUploadService = fileUploadService;
        this.translate = translate;
    }
    ngOnInit() {
        this.supportedExtensions = this.supportedExtensions.map((extension) => extension.replace('.', '').toLowerCase());
    }
    ngOnDestroy() {
        this.ngUsubscribe.next();
        this.ngUsubscribe.complete();
    }
    ngAfterContentInit() {
        this.update();
    }
    onResize() {
        this.update();
    }
    _onInputFileSelect($event) {
        const eventTargetFiles = $event.target?.files;
        const dataTransferFiles = $event.dataTransfer?.files;
        const files = Array.from(dataTransferFiles ? dataTransferFiles : eventTargetFiles);
        this.onFileSelect(files);
    }
    onFileSelect(files) {
        const newFiles = [];
        if (!this.multiple) {
            this.files = [];
        }
        if (this.isFileLimitExceeded(files)) {
            this.validateErrors.emit({
                files,
                validation: 'maxFileLimit',
            });
            this.clearFileInput();
            return;
        }
        if (this.isFileCombinedSizeExceeded(files)) {
            this.validateErrors.emit({
                files: files,
                validation: 'maxCombinedFileSize',
            });
            this.clearFileInput();
            return;
        }
        for (const file of files) {
            if (this.isUnsupportedFileExtension(file)) {
                this.validateErrors.emit({
                    files: [file],
                    validation: 'unsupportedExtension',
                });
                continue;
            }
            if (this.isFileSizeExceeded(file)) {
                this.validateErrors.emit({
                    files: [file],
                    validation: 'maxFileSize',
                });
                continue;
            }
            newFiles.push(file);
        }
        if (newFiles.length) {
            this.files = this.files.concat(newFiles);
            this.uploadHandler.emit({
                files: newFiles,
            });
        }
        this.clearFileInput();
    }
    onRemoveFile(file) {
        const fileIndex = this.files.indexOf(file);
        const removedFiles = this.files.splice(fileIndex, 1);
        if (removedFiles.length) {
            this.removeFile.emit({ file });
        }
    }
    onCancelUpload(index) {
        const removedFiles = this.files.splice(index, 1);
        if (removedFiles.length) {
            this.cancelUpload.emit(index);
        }
        this.clearFileInput();
    }
    onDowloadFile(index) {
        if (isNullOrUndefined(this.anchor))
            return;
        this.downloadFile.emit({
            index,
            anchor: this.anchor,
        });
    }
    get files() {
        return this._files;
    }
    formatFileSize(size) {
        if (size === 0) {
            return '0 Bytes';
        }
        const k = 1024;
        const sizes = ['bytes', 'KB', 'MB', 'GB', 'TB'];
        const i = Math.floor(Math.log(size) / Math.log(k));
        return parseFloat((size / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
    }
    update() {
        const windowWidth = window.innerWidth;
        this.isSmallDevice = windowWidth <= Breakpoints.SM_MAX;
    }
    isFileLimitExceeded(files) {
        if (!this.fileLimit) {
            return false;
        }
        return this.files.length + files.length > this.fileLimit;
    }
    isFileCombinedSizeExceeded(files) {
        if (!this.maxCombinedFileSize) {
            return false;
        }
        const filesList = [...files, ...this.files];
        const combinedSize = filesList.reduce((combinedSize, file) => combinedSize + file.size, 0);
        return combinedSize > this.maxCombinedFileSize;
    }
    isFileSizeExceeded(file) {
        if (!this.maxFileSize) {
            return false;
        }
        return file.size > this.maxFileSize;
    }
    isUnsupportedFileExtension(file) {
        if (this.supportedExtensions?.length) {
            const extension = file.name.split('.').pop()?.toLowerCase() ?? '';
            return !this.supportedExtensions.includes(extension);
        }
        return false;
    }
    clearFileInput() {
        if (isNullOrUndefined(this.inputUpload?.nativeElement))
            return;
        this.inputUpload.nativeElement.value = null;
    }
    getUploadDate(blobFile) {
        if (!blobFile) {
            return;
        }
        this.fileUploadService
            .getMetadataCustomField({ objectId: blobFile[0].objectId ?? '' })
            .then((metadata) => this.setModifiedDate(metadata));
    }
    setModifiedDate(metadata) {
        const hour = moment(metadata.modified).format('HH');
        const minutes = moment(metadata.modified).format('mm');
        const day = moment(metadata.modified).format('DD');
        const month = moment(metadata.modified).format('MM');
        const fullYear = moment(metadata.modified).format('YYYY');
        this.modifiedDate = this.translate.instant('platform.angular_components.date_modified_custom_blob', {
            hour,
            minutes,
            day,
            month,
            fullYear,
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadComponent, deps: [{ token: i1.DomSanitizer }, { token: FileUploadService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: FileUploadComponent, selector: "s-file-upload", inputs: { id: "id", chooseLabel: "chooseLabel", removeLabel: "removeLabel", cancelLabel: "cancelLabel", successTooltip: "successTooltip", multiple: "multiple", accept: "accept", supportedExtensions: "supportedExtensions", ariaLabelFileName: "ariaLabelFileName", maxFileSize: "maxFileSize", maxCombinedFileSize: "maxCombinedFileSize", fileLimit: "fileLimit", ariaLabelProgress: "ariaLabelProgress", ariaLabelSuccess: "ariaLabelSuccess", ariaLabelError: "ariaLabelError", ariaLabelRemove: "ariaLabelRemove", formGroup: "formGroup", disabled: "disabled", showFileUploadDate: "showFileUploadDate", permissions: "permissions", files: "files" }, outputs: { uploadHandler: "uploadHandler", removeFile: "removeFile", cancelUpload: "cancelUpload", downloadFile: "downloadFile", validateErrors: "validateErrors" }, host: { listeners: { "window:resize": "onResize()" } }, viewQueries: [{ propertyName: "inputUpload", first: true, predicate: ["inputUpload"], descendants: true }, { propertyName: "anchor", first: true, predicate: ["anchor"], descendants: true }], ngImport: i0, template: "<div\n    [id]=\"id\"\n    class=\"s-fileupload\"\n>\n    <div class=\"s-fileupload-choose\">\n        <input\n            #inputUpload\n            [id]=\"id + 'input-upload'\"\n            type=\"file\"\n            name=\"file\"\n            [accept]=\"accept\"\n            [multiple]=\"multiple\"\n            (change)=\"_onInputFileSelect($event)\"\n        />\n        <s-button\n            *ngIf=\"permissions.includes(ADD_PERMISSION)\"\n            [id]=\"id + 'upload-button'\"\n            [label]=\"chooseLabel || 'platform.angular_components.attach_files' | translate\"\n            (clicked)=\"inputUpload.click()\"\n            priority=\"primary\"\n            [disabled]=\"disabled || !!formGroup?.disabled || fileLimit === files.length\"\n            [auxiliary]=\"false\"\n        >\n        </s-button>\n    </div>\n\n    <section\n        *ngIf=\"files.length\"\n        [id]=\"id + 'fileupload-list'\"\n        class=\"s-fileupload-list\"\n        role=\"grid\"\n    >\n        <ng-container *ngFor=\"let file of files; let i = index\">\n            <div\n                class=\"s-fileupload-list-file\"\n                role=\"row\"\n            >\n                <div\n                    [id]=\"id + '-file-' + i + '-name'\"\n                    class=\"flex flex-grow items-center justify-between overflow-hidden text-ellipsis text-nowrap\"\n                    role=\"gridcell\"\n                >\n                    <ng-container\n                        *ngTemplateOutlet=\"\n                            (permissions.includes(READ_PERMISSION) && file.savedFile) || file.progress === 100\n                                ? descriptionUrl\n                                : description;\n                            context: {\n                                $implicit: file,\n                                index: i,\n                            }\n                        \"\n                    >\n                    </ng-container>\n\n                    <span>{{ formatFileSize(file.size) }}</span>\n\n                    <span\n                        *ngIf=\"modifiedDate\"\n                        class=\"s-fileupload-list-file-name-date\"\n                        >{{ modifiedDate }}</span\n                    >\n                </div>\n                <div\n                    class=\"s-fileupload-list-file-status\"\n                    role=\"gridcell\"\n                >\n                    <p-progressBar\n                        *ngIf=\"file.isUploading && !isSmallDevice\"\n                        [style]=\"{\n                            width: '250px',\n                            'background-color': '#d8d8d8',\n                            'border-radius': '0px',\n                            height: '14px',\n                        }\"\n                        [value]=\"file.progress\"\n                        [showValue]=\"false\"\n                        role=\"alert\"\n                        [attr.aria-label]=\"ariaLabelProgress || 'platform.angular_components.loading_file' | translate\"\n                    >\n                    </p-progressBar>\n                    <span\n                        *ngIf=\"file.isUploading && isSmallDevice\"\n                        [id]=\"id + '-file-' + i + '-spin'\"\n                        class=\"fas fa-circle-notch fa-spin\"\n                        [attr.aria-label]=\"ariaLabelProgress || 'platform.angular_components.loading_file' | translate\"\n                    >\n                    </span>\n\n                    <span\n                        *ngIf=\"!file.isUploading && !file.error && file.progress === 100\"\n                        [id]=\"id + '-file-' + i + '-check'\"\n                        class=\"fas fa-check\"\n                        role=\"alert\"\n                        [attr.aria-label]=\"\n                            ariaLabelSuccess ||\n                                successTooltip ||\n                                'platform.angular_components.file_attached_successfully' | translate\n                        \"\n                        [pTooltip]=\"\n                            successTooltip || 'platform.angular_components.file_attached_successfully' | translate\n                        \"\n                        tooltipPosition=\"top\"\n                        showDelay=\"500\"\n                        [appendTo]=\"'body'\"\n                    >\n                    </span>\n                    <span\n                        *ngIf=\"file.error?.message\"\n                        [id]=\"id + '-file-' + i + '-error'\"\n                        class=\"fas fa-times\"\n                        role=\"alert\"\n                        [pTooltip]=\"file.error?.message\"\n                        tooltipPosition=\"top\"\n                        showDelay=\"500\"\n                        [appendTo]=\"'body'\"\n                    >\n                    </span>\n                </div>\n                <div\n                    class=\"s-fileupload-list-file-actions\"\n                    role=\"gridcell\"\n                >\n                    <a\n                        *ngIf=\"file.isUploading\"\n                        [id]=\"id + '-file-' + i + '-cancel'\"\n                        class=\"s-fileupload-list-file-actions-action\"\n                        (click)=\"onCancelUpload(i)\"\n                    >\n                        {{ cancelLabel || 'platform.angular_components.cancel' | translate }}\n                    </a>\n                    <a\n                        *ngIf=\"\n                            permissions.includes(REMOVE_PERMISSION) &&\n                            !file.isUploading &&\n                            !(disabled || !!formGroup?.disabled)\n                        \"\n                        role=\"button\"\n                        tabindex=\"0\"\n                        [id]=\"id + '-file-' + i + '-remove'\"\n                        class=\"s-fileupload-list-file-actions-action\"\n                        (click)=\"onRemoveFile(file)\"\n                        [attr.aria-label]=\"\n                            ariaLabelRemove || removeLabel || 'platform.angular_components.remove' | translate\n                        \"\n                    >\n                        {{ removeLabel || 'platform.angular_components.remove' | translate }}\n                    </a>\n                </div>\n            </div>\n        </ng-container>\n    </section>\n</div>\n\n<ng-template\n    #descriptionUrl\n    let-file\n    let-i=\"index\"\n>\n    <div class=\"flex justify-between\">\n        <div>\n            <a\n                [id]=\"id + '-file-' + i + '-name-link'\"\n                tabindex=\"0\"\n                (click)=\"onDowloadFile(i)\"\n                [attr.aria-label]=\"ariaLabelFileName || file.name\"\n                class=\"break-words\"\n                >{{ file.name }}\n            </a>\n            <a\n                style=\"display: none\"\n                [href]=\"file.objectURL\"\n                target=\"_blank\"\n                download\n                #anchor\n            >\n            </a>\n        </div>\n    </div>\n</ng-template>\n\n<ng-template\n    #description\n    let-file\n>\n    <div class=\"flex justify-between\">\n        <span\n            tabindex=\"0\"\n            [attr.aria-label]=\"ariaLabelFileName || file.name\"\n        >\n            {{ file.name }}\n        </span>\n    </div>\n</ng-template>\n\n", styles: [".s-fileupload .s-fileupload-choose{position:relative;margin:15px 0;width:max-content}.s-fileupload input[type=file]{display:none}.s-fileupload-list{border:1px solid #ccc}.s-fileupload-list-file:not(:first-child){border-top:1px solid #ccc}.s-fileupload-list .s-fileupload-list-file{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{display:flex;flex-direction:column;align-self:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name .s-fileupload-list-file-name-date{font-size:.75rem;color:#999}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name>a{cursor:pointer;text-decoration:none}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{align-self:center}.s-fileupload-list .s-fileupload-list-file .fas.fa-circle-notch{color:#d8d8d8;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-check{color:#0c9348;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-times{color:#c13018;font-size:12px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin-top:15px;align-self:center;width:100%}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action{text-decoration:none;color:#428bca}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action:hover,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :focus,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :visited{text-decoration:none}@media (min-width: 768px){.s-fileupload-list .s-fileupload-list-file{flex-wrap:nowrap}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{width:auto;flex-grow:2}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{margin:0 15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin:0;width:auto}}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i5.ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor"], outputs: ["clicked"] }, { kind: "directive", type: i6.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i7.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "style", "unit", "mode", "color"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadComponent, decorators: [{
            type: Component,
            args: [{ selector: 's-file-upload', template: "<div\n    [id]=\"id\"\n    class=\"s-fileupload\"\n>\n    <div class=\"s-fileupload-choose\">\n        <input\n            #inputUpload\n            [id]=\"id + 'input-upload'\"\n            type=\"file\"\n            name=\"file\"\n            [accept]=\"accept\"\n            [multiple]=\"multiple\"\n            (change)=\"_onInputFileSelect($event)\"\n        />\n        <s-button\n            *ngIf=\"permissions.includes(ADD_PERMISSION)\"\n            [id]=\"id + 'upload-button'\"\n            [label]=\"chooseLabel || 'platform.angular_components.attach_files' | translate\"\n            (clicked)=\"inputUpload.click()\"\n            priority=\"primary\"\n            [disabled]=\"disabled || !!formGroup?.disabled || fileLimit === files.length\"\n            [auxiliary]=\"false\"\n        >\n        </s-button>\n    </div>\n\n    <section\n        *ngIf=\"files.length\"\n        [id]=\"id + 'fileupload-list'\"\n        class=\"s-fileupload-list\"\n        role=\"grid\"\n    >\n        <ng-container *ngFor=\"let file of files; let i = index\">\n            <div\n                class=\"s-fileupload-list-file\"\n                role=\"row\"\n            >\n                <div\n                    [id]=\"id + '-file-' + i + '-name'\"\n                    class=\"flex flex-grow items-center justify-between overflow-hidden text-ellipsis text-nowrap\"\n                    role=\"gridcell\"\n                >\n                    <ng-container\n                        *ngTemplateOutlet=\"\n                            (permissions.includes(READ_PERMISSION) && file.savedFile) || file.progress === 100\n                                ? descriptionUrl\n                                : description;\n                            context: {\n                                $implicit: file,\n                                index: i,\n                            }\n                        \"\n                    >\n                    </ng-container>\n\n                    <span>{{ formatFileSize(file.size) }}</span>\n\n                    <span\n                        *ngIf=\"modifiedDate\"\n                        class=\"s-fileupload-list-file-name-date\"\n                        >{{ modifiedDate }}</span\n                    >\n                </div>\n                <div\n                    class=\"s-fileupload-list-file-status\"\n                    role=\"gridcell\"\n                >\n                    <p-progressBar\n                        *ngIf=\"file.isUploading && !isSmallDevice\"\n                        [style]=\"{\n                            width: '250px',\n                            'background-color': '#d8d8d8',\n                            'border-radius': '0px',\n                            height: '14px',\n                        }\"\n                        [value]=\"file.progress\"\n                        [showValue]=\"false\"\n                        role=\"alert\"\n                        [attr.aria-label]=\"ariaLabelProgress || 'platform.angular_components.loading_file' | translate\"\n                    >\n                    </p-progressBar>\n                    <span\n                        *ngIf=\"file.isUploading && isSmallDevice\"\n                        [id]=\"id + '-file-' + i + '-spin'\"\n                        class=\"fas fa-circle-notch fa-spin\"\n                        [attr.aria-label]=\"ariaLabelProgress || 'platform.angular_components.loading_file' | translate\"\n                    >\n                    </span>\n\n                    <span\n                        *ngIf=\"!file.isUploading && !file.error && file.progress === 100\"\n                        [id]=\"id + '-file-' + i + '-check'\"\n                        class=\"fas fa-check\"\n                        role=\"alert\"\n                        [attr.aria-label]=\"\n                            ariaLabelSuccess ||\n                                successTooltip ||\n                                'platform.angular_components.file_attached_successfully' | translate\n                        \"\n                        [pTooltip]=\"\n                            successTooltip || 'platform.angular_components.file_attached_successfully' | translate\n                        \"\n                        tooltipPosition=\"top\"\n                        showDelay=\"500\"\n                        [appendTo]=\"'body'\"\n                    >\n                    </span>\n                    <span\n                        *ngIf=\"file.error?.message\"\n                        [id]=\"id + '-file-' + i + '-error'\"\n                        class=\"fas fa-times\"\n                        role=\"alert\"\n                        [pTooltip]=\"file.error?.message\"\n                        tooltipPosition=\"top\"\n                        showDelay=\"500\"\n                        [appendTo]=\"'body'\"\n                    >\n                    </span>\n                </div>\n                <div\n                    class=\"s-fileupload-list-file-actions\"\n                    role=\"gridcell\"\n                >\n                    <a\n                        *ngIf=\"file.isUploading\"\n                        [id]=\"id + '-file-' + i + '-cancel'\"\n                        class=\"s-fileupload-list-file-actions-action\"\n                        (click)=\"onCancelUpload(i)\"\n                    >\n                        {{ cancelLabel || 'platform.angular_components.cancel' | translate }}\n                    </a>\n                    <a\n                        *ngIf=\"\n                            permissions.includes(REMOVE_PERMISSION) &&\n                            !file.isUploading &&\n                            !(disabled || !!formGroup?.disabled)\n                        \"\n                        role=\"button\"\n                        tabindex=\"0\"\n                        [id]=\"id + '-file-' + i + '-remove'\"\n                        class=\"s-fileupload-list-file-actions-action\"\n                        (click)=\"onRemoveFile(file)\"\n                        [attr.aria-label]=\"\n                            ariaLabelRemove || removeLabel || 'platform.angular_components.remove' | translate\n                        \"\n                    >\n                        {{ removeLabel || 'platform.angular_components.remove' | translate }}\n                    </a>\n                </div>\n            </div>\n        </ng-container>\n    </section>\n</div>\n\n<ng-template\n    #descriptionUrl\n    let-file\n    let-i=\"index\"\n>\n    <div class=\"flex justify-between\">\n        <div>\n            <a\n                [id]=\"id + '-file-' + i + '-name-link'\"\n                tabindex=\"0\"\n                (click)=\"onDowloadFile(i)\"\n                [attr.aria-label]=\"ariaLabelFileName || file.name\"\n                class=\"break-words\"\n                >{{ file.name }}\n            </a>\n            <a\n                style=\"display: none\"\n                [href]=\"file.objectURL\"\n                target=\"_blank\"\n                download\n                #anchor\n            >\n            </a>\n        </div>\n    </div>\n</ng-template>\n\n<ng-template\n    #description\n    let-file\n>\n    <div class=\"flex justify-between\">\n        <span\n            tabindex=\"0\"\n            [attr.aria-label]=\"ariaLabelFileName || file.name\"\n        >\n            {{ file.name }}\n        </span>\n    </div>\n</ng-template>\n\n", styles: [".s-fileupload .s-fileupload-choose{position:relative;margin:15px 0;width:max-content}.s-fileupload input[type=file]{display:none}.s-fileupload-list{border:1px solid #ccc}.s-fileupload-list-file:not(:first-child){border-top:1px solid #ccc}.s-fileupload-list .s-fileupload-list-file{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between;padding:15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{display:flex;flex-direction:column;align-self:center;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name .s-fileupload-list-file-name-date{font-size:.75rem;color:#999}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name>a{cursor:pointer;text-decoration:none}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{align-self:center}.s-fileupload-list .s-fileupload-list-file .fas.fa-circle-notch{color:#d8d8d8;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-check{color:#0c9348;font-size:12px}.s-fileupload-list .s-fileupload-list-file .fas.fa-times{color:#c13018;font-size:12px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin-top:15px;align-self:center;width:100%}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action{text-decoration:none;color:#428bca}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action:hover,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :focus,.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions a.s-fileupload-list-file-actions-action :visited{text-decoration:none}@media (min-width: 768px){.s-fileupload-list .s-fileupload-list-file{flex-wrap:nowrap}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-name{width:auto;flex-grow:2}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-status{margin:0 15px}.s-fileupload-list .s-fileupload-list-file .s-fileupload-list-file-actions{margin:0;width:auto}}\n"] }]
        }], ctorParameters: () => [{ type: i1.DomSanitizer }, { type: FileUploadService }, { type: i3.TranslateService }], propDecorators: { inputUpload: [{
                type: ViewChild,
                args: ['inputUpload', { static: false }]
            }], anchor: [{
                type: ViewChild,
                args: ['anchor', { static: false }]
            }], id: [{
                type: Input
            }], chooseLabel: [{
                type: Input
            }], removeLabel: [{
                type: Input
            }], cancelLabel: [{
                type: Input
            }], successTooltip: [{
                type: Input
            }], multiple: [{
                type: Input
            }], accept: [{
                type: Input
            }], supportedExtensions: [{
                type: Input
            }], ariaLabelFileName: [{
                type: Input
            }], maxFileSize: [{
                type: Input
            }], maxCombinedFileSize: [{
                type: Input
            }], fileLimit: [{
                type: Input
            }], ariaLabelProgress: [{
                type: Input
            }], ariaLabelSuccess: [{
                type: Input
            }], ariaLabelError: [{
                type: Input
            }], ariaLabelRemove: [{
                type: Input
            }], formGroup: [{
                type: Input
            }], disabled: [{
                type: Input
            }], showFileUploadDate: [{
                type: Input
            }], permissions: [{
                type: Input
            }], files: [{
                type: Input
            }], uploadHandler: [{
                type: Output
            }], removeFile: [{
                type: Output
            }], cancelUpload: [{
                type: Output
            }], downloadFile: [{
                type: Output
            }], validateErrors: [{
                type: Output
            }], onResize: [{
                type: HostListener,
                args: ['window:resize']
            }] } });

class FileUploadModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: FileUploadModule, declarations: [FileUploadComponent], imports: [CommonModule,
            ButtonModule,
            TooltipModule,
            ProgressBarModule,
            TranslateModule,
            LocaleModule], exports: [FileUploadComponent] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadModule, providers: [FileUploadService], imports: [CommonModule,
            ButtonModule,
            TooltipModule,
            ProgressBarModule,
            TranslateModule,
            LocaleModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileUploadModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [FileUploadComponent],
                    imports: [
                        CommonModule,
                        ButtonModule,
                        TooltipModule,
                        ProgressBarModule,
                        TranslateModule,
                        LocaleModule,
                    ],
                    providers: [FileUploadService],
                    exports: [FileUploadComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { FileUploadComponent, FileUploadModule };
//# sourceMappingURL=seniorsistemas-angular-components-file-upload.mjs.map
