import { Component, HostBinding, Input } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/material/legacy-progress-bar";
import * as i3 from "@angular/material/legacy-tooltip";
// import { ContentProgressService } from './content-progress.service'
export class ContentProgressComponent {
    constructor() {
        this.contentId = '';
        this.progress = 0;
        this.progressType = '';
        this.forPreview = false;
        this.className = '';
        this.customClassName = 'accent-progress';
        this.rendom = Math.random();
        this.id = `progress_${Math.random()}`;
        if (this.contentId) {
            this.id = this.contentId;
        }
    }
    ngOnChanges() {
        if (this.contentId && !this.progress && !this.forPreview) {
            // this.progressSvc.getProgressFor(this.contentId).subscribe(data => {
            //   this.progress = data
            //   if (this.progress) {
            //     this.progress = Math.round(this.progress * 10000) / 100
            //   }
            // })
        }
        if (this.progress) {
            if (this.progressType === 'percentage') {
                this.progress = this.progress;
            }
            else {
                this.progress = Math.round(this.progress * 10000) / 100;
            }
        }
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContentProgressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ContentProgressComponent, selector: "ws-widget-content-progress", inputs: { contentId: "contentId", progress: "progress", progressType: "progressType", forPreview: "forPreview", className: "className", customClassName: "customClassName" }, host: { attributes: { "role": "progressbar", "aria-valuemin": "0", "aria-valuemax": "100", "title": "progres" }, properties: { "attr.aria-valuenow": "progress", "id": "this.id" } }, usesOnChanges: true, ngImport: i0, template: "<mat-progress-bar [mode]=\"'determinate'\" [matTooltip]=\"progress + ' %'\" [value]=\"progress\" class=\"new-w content-progress {{customClassName}}\"\n  [attr.aria-labelledby]=\"'m-c-'+ contentId\" [ngClass]=\"{ 'visibility-0': progress === undefined, 'thick': className}\"\n  i18n-aria-label> {{ progress }} % </mat-progress-bar>", styles: [".visibility-0{display:none}::ng-deep .mat-progress-bar.thick{height:10px}::ng-deep .theme-igot.day-mode .mat-progress-bar-fill:after{background:#34d6a4 0% 0% no-repeat padding-box}::ng-deep .theme-igot.day-mode .mat-progress-bar-background{fill:#0000!important}::ng-deep .theme-igot.day-mode .mat-progress-bar-buffer{background-color:#0000001a!important}::ng-deep .content-progress .mat-progress-bar-fill:after{background:#f69953!important}::ng-deep .theme-igot.day-mode .viewer-progress .mat-progress-bar-background{fill:#0000001a!important}::ng-deep .theme-igot.day-mode .viewer-progress .mat-progress-bar-buffer{background-color:#0000001a!important}::ng-deep .mat-progress-bar.viewer-progress{height:4px;border-radius:5px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2.MatLegacyProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i3.MatLegacyTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContentProgressComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ws-widget-content-progress', host: {
                        // Sets the role for this component to "progressbar"
                        role: 'progressbar',
                        // Sets the minimum and maximum values for the progressbar role.
                        'aria-valuemin': '0',
                        'aria-valuemax': '100',
                        'title': 'progres',
                        // Binding that updates the current value of the progressbar.
                        '[attr.aria-valuenow]': 'progress',
                    }, template: "<mat-progress-bar [mode]=\"'determinate'\" [matTooltip]=\"progress + ' %'\" [value]=\"progress\" class=\"new-w content-progress {{customClassName}}\"\n  [attr.aria-labelledby]=\"'m-c-'+ contentId\" [ngClass]=\"{ 'visibility-0': progress === undefined, 'thick': className}\"\n  i18n-aria-label> {{ progress }} % </mat-progress-bar>", styles: [".visibility-0{display:none}::ng-deep .mat-progress-bar.thick{height:10px}::ng-deep .theme-igot.day-mode .mat-progress-bar-fill:after{background:#34d6a4 0% 0% no-repeat padding-box}::ng-deep .theme-igot.day-mode .mat-progress-bar-background{fill:#0000!important}::ng-deep .theme-igot.day-mode .mat-progress-bar-buffer{background-color:#0000001a!important}::ng-deep .content-progress .mat-progress-bar-fill:after{background:#f69953!important}::ng-deep .theme-igot.day-mode .viewer-progress .mat-progress-bar-background{fill:#0000001a!important}::ng-deep .theme-igot.day-mode .viewer-progress .mat-progress-bar-buffer{background-color:#0000001a!important}::ng-deep .mat-progress-bar.viewer-progress{height:4px;border-radius:5px}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { contentId: [{
                type: Input
            }], progress: [{
                type: Input
            }], progressType: [{
                type: Input
            }], forPreview: [{
                type: Input
            }], className: [{
                type: Input
            }], customClassName: [{
                type: Input
            }], id: [{
                type: HostBinding,
                args: ['id']
            }] } });
//# sourceMappingURL=data:application/json;base64, 