'use strict';

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

const index = require('./index-1ee80297.js');

const dvnLinearProgressCss = "dvn-linear-progress{}dvn-linear-progress progress{border-radius:50vh}dvn-linear-progress progress::-webkit-progress-bar{background-color:var(--color-disabled);border-radius:50vh}dvn-linear-progress span{margin-left:var(--spacing-unit);font-Weight:100;color:var(--color-text-secondary)}dvn-linear-progress.large{font-size:var(--font-size-large)}dvn-linear-progress.medium{font-size:var(--font-size-medium)}dvn-linear-progress.small{font-size:var(--font-size-small)}dvn-linear-progress .neutral::-webkit-progress-value{background-color:var(--color-neutral);border-radius:50vh}dvn-linear-progress .primary::-webkit-progress-value{background-color:var(--color-primary);border-radius:50vh}dvn-linear-progress .secondary{color:var(--color-secondary)}dvn-linear-progress .secondary::-webkit-progress-value{background-color:var(--color-secondary);border-radius:50vh}dvn-linear-progress .warning::-webkit-progress-value{background-color:var(--color-warning);border-radius:50vh}dvn-linear-progress .danger{color:var(--color-danger)}dvn-linear-progress .danger::-webkit-progress-value{background-color:var(--color-danger);border-radius:50vh}dvn-linear-progress .stroke-color::-webkit-progress-value{background-color:var(--stroke-color);border-radius:50vh}";

const tintsToIcons = {
  success: 'uil-check-circle',
  error: 'uil-exclamation-octagon',
};
const getIconSize = (scale = 'medium') => {
  switch (scale) {
    case 'large':
      return 18;
    case 'small':
      return 14;
    case 'medium':
    default:
      return 16;
  }
};
let LinearProgress = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.showPercent = false;
    this.scale = 'medium';
    this.tint = 'primary';
  }
  render() {
    const iconSize = getIconSize(this.scale);
    const selectedColor = this.status === 'error' ? 'danger' : this.status === 'success' ? 'secondary' : this.tint;
    const style = {};
    let iconName;
    if (this.strokeColor) {
      style['--stroke-color'] = this.strokeColor;
    }
    if (this.status) {
      iconName = tintsToIcons[this.status];
    }
    return (index.h(index.Host, { class: {
        [this.scale]: true,
        'd-flex': true,
        'align-items-center': true
      } }, index.h("progress", { style: style, class: { [selectedColor]: !this.strokeColor, 'stroke-color': !!this.strokeColor }, max: "100", value: this.status === 'success' ? 100 : this.percent }), this.showPercent && !this.status &&
      index.h("span", null, this.percent, " %"), this.status &&
      index.h("span", { class: {
          'danger': this.status === 'error',
          'secondary': this.status !== 'error',
        } }, index.h("dvn-icon", { iconName: iconName, class: "pr-2", size: iconSize }))));
  }
};
LinearProgress.style = dvnLinearProgressCss;

exports.dvn_linear_progress = LinearProgress;
