import * as i0 from '@angular/core';
import { numberAttribute, inject, booleanAttribute, Input, HostBinding, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import * as i1 from '@eui/components/shared';
import { BaseStatesDirective } from '@eui/components/shared';
import { EUI_ICON } from '@eui/components/eui-icon';
import * as i2 from '@eui/components/eui-icon-state';
import { EUI_ICON_STATE } from '@eui/components/eui-icon-state';

/**
 * Transform function that ensures progress value doesn't exceed 100
 * @param value - The input progress value
 * @returns A number between 0 and 100
 */
const progressAttribute = (value) => Math.min(numberAttribute(value), 100);
/**
 * Progress bar component that displays a horizontal progress indicator
 * with optional label and status icon.
 */
class EuiProgressBarComponent {
    constructor() {
        /** Element attribute for e2e testing */
        this.e2eAttr = 'eui-progress-bar';
        /** Optional label displayed above the progress bar */
        this.label = '';
        /**
         * When true, shows an indeterminate progress animation
         * instead of a specific progress value
         */
        this.isIndeterminate = false;
        /**
         * When true, displays a status icon based on the current state
         * (success, warning, error, etc.)
         */
        this.hasStatusIcon = false;
        /**
         * Reference to the BaseStatesDirective for managing component states
         */
        this.baseStatesDirective = inject(BaseStatesDirective);
    }
    /** CSS classes applied to the host element */
    get cssClasses() {
        return this.getCssClasses();
    }
    ngOnChanges(changes) {
        if (changes['progress']) {
            this.progress = changes['progress'].currentValue;
            if (this?.progress > 100) {
                this.progress = 100;
            }
        }
    }
    /**
     * Generates CSS classes for the component based on current state
     * @returns Space-separated string of CSS class names
     */
    getCssClasses() {
        return [
            this.baseStatesDirective.getCssClasses('eui-progress-bar'),
            this.isIndeterminate ? 'eui-progress-bar--indeterminate' : '',
            this.hasStatusIcon ? 'eui-progress-bar--hasStatusIcon' : '',
        ]
            .join(' ')
            .trim();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: EuiProgressBarComponent, isStandalone: true, selector: "eui-progress-bar", inputs: { e2eAttr: "e2eAttr", label: "label", progress: ["progress", "progress", numberAttribute], isIndeterminate: ["isIndeterminate", "isIndeterminate", booleanAttribute], hasStatusIcon: ["hasStatusIcon", "hasStatusIcon", booleanAttribute] }, host: { properties: { "attr.data-e2e": "this.e2eAttr", "class": "this.cssClasses" } }, usesOnChanges: true, hostDirectives: [{ directive: i1.BaseStatesDirective, inputs: ["euiSecondary", "euiSecondary", "euiSuccess", "euiSuccess", "euiInfo", "euiInfo", "euiWarning", "euiWarning", "euiDanger", "euiDanger", "euiAccent", "euiAccent", "euiSize2XS", "euiSize2XS", "euiSizeXS", "euiSizeXS", "euiSizeS", "euiSizeS", "euiSizeM", "euiSizeM", "euiSizeL", "euiSizeL", "euiSizeXL", "euiSizeXL", "euiVariant", "euiVariant", "euiSizeVariant", "euiSizeVariant"] }], ngImport: i0, template: "@if(label || hasStatusIcon) {\n    <div class=\"eui-progress-bar__header\">\n        @if(label) {\n            <div class=\"eui-progress-bar__header-label\">{{ label }}</div>\n        }\n        @if(hasStatusIcon) {\n            <div class=\"eui-progress-bar__header-status\">\n                <eui-icon-state [euiVariant]=\"baseStatesDirective.euiVariant\"/>\n            </div>\n        }\n    </div>\n}\n<div class=\"eui-progress-bar__indicator-container\">\n    <div class=\"eui-progress-bar__indicator\" [style.width]=\"!isIndeterminate ? progress + '%' : null\"></div>\n</div>\n", styles: [".eui-19 :host.eui-progress-bar{align-items:center;display:flex;flex-direction:column;position:relative}.eui-19 :host.eui-progress-bar .eui-progress-bar__header{align-items:center;display:flex;justify-content:space-between;height:var(--eui-s-l);margin-bottom:var(--eui-s-s);width:100%}.eui-19 :host.eui-progress-bar .eui-progress-bar__header-label{display:flex;justify-content:flex-start;font:var(--eui-f-m-bold)}.eui-19 :host.eui-progress-bar .eui-progress-bar__header-status{display:flex;justify-content:flex-end}.eui-19 :host.eui-progress-bar .eui-progress-bar__indicator-container{margin-bottom:var(--eui-s-2xs);background-color:var(--eui-c-surface-container-3);height:var(--eui-s-2xs);position:relative;width:100%}.eui-19 :host.eui-progress-bar .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-primary-surface);height:100%;transition:width .25s ease}.eui-19 :host.eui-progress-bar--size-2xs .eui-progress-bar__indicator-container{height:var(--eui-s-2xs)}.eui-19 :host.eui-progress-bar--size-xs .eui-progress-bar__indicator-container{height:var(--eui-s-xs)}.eui-19 :host.eui-progress-bar--size-s .eui-progress-bar__indicator-container{height:var(--eui-s-s)}.eui-19 :host.eui-progress-bar--size-m .eui-progress-bar__indicator-container{height:var(--eui-s-m)}.eui-19 :host.eui-progress-bar--size-l .eui-progress-bar__indicator-container{height:var(--eui-s-l)}.eui-19 :host.eui-progress-bar--size-xl .eui-progress-bar__indicator-container{height:var(--eui-s-xl)}.eui-19 :host.eui-progress-bar--secondary .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-secondary-surface)}.eui-19 :host.eui-progress-bar--success .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-success-surface)}.eui-19 :host.eui-progress-bar--info .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-info-surface)}.eui-19 :host.eui-progress-bar--warning .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-warning-surface)}.eui-19 :host.eui-progress-bar--danger .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-danger-surface)}.eui-19 :host.eui-progress-bar--accent .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-accent-surface)}.eui-19 :host.eui-progress-bar--indeterminate .eui-progress-bar__indicator-container .eui-progress-bar__indicator{animation:progress-linear-indeterminate 2s infinite linear;background-color:var(--eui-c-surface-container-3);background-size:200% 100%;background-image:linear-gradient(to right,transparent 50%,var(--eui-c-s-primary) 50%,var(--eui-c-s-primary) 60%,transparent 60%,transparent 71.5%,var(--eui-c-s-primary) 71.5%,var(--eui-c-s-primary) 84%,transparent 84%);transition:all .2s}@keyframes progress-linear-indeterminate{0%{background-size:200% 100%;background-position:left -31.25% top 0%}50%{background-size:800% 100%;background-position:left -49% top 0%}to{background-size:400% 100%;background-position:left -102% top 0%}}@media screen and (max-width: 767px){.eui-19 :host.eui-progress-bar--size-2xs .eui-progress-bar__indicator-container{height:var(--eui-s-xs)}}\n"], dependencies: [{ kind: "component", type: i2.EuiIconStateComponent, selector: "eui-icon-state", inputs: ["size", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiProgressBarComponent, decorators: [{
            type: Component,
            args: [{ selector: 'eui-progress-bar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
                        ...EUI_ICON,
                        ...EUI_ICON_STATE,
                    ], hostDirectives: [
                        {
                            directive: BaseStatesDirective,
                            inputs: [
                                'euiSecondary',
                                'euiSuccess',
                                'euiInfo',
                                'euiWarning',
                                'euiDanger',
                                'euiAccent',
                                'euiSize2XS',
                                'euiSizeXS',
                                'euiSizeS',
                                'euiSizeM',
                                'euiSizeL',
                                'euiSizeXL',
                                'euiVariant',
                                'euiSizeVariant',
                            ],
                        },
                    ], template: "@if(label || hasStatusIcon) {\n    <div class=\"eui-progress-bar__header\">\n        @if(label) {\n            <div class=\"eui-progress-bar__header-label\">{{ label }}</div>\n        }\n        @if(hasStatusIcon) {\n            <div class=\"eui-progress-bar__header-status\">\n                <eui-icon-state [euiVariant]=\"baseStatesDirective.euiVariant\"/>\n            </div>\n        }\n    </div>\n}\n<div class=\"eui-progress-bar__indicator-container\">\n    <div class=\"eui-progress-bar__indicator\" [style.width]=\"!isIndeterminate ? progress + '%' : null\"></div>\n</div>\n", styles: [".eui-19 :host.eui-progress-bar{align-items:center;display:flex;flex-direction:column;position:relative}.eui-19 :host.eui-progress-bar .eui-progress-bar__header{align-items:center;display:flex;justify-content:space-between;height:var(--eui-s-l);margin-bottom:var(--eui-s-s);width:100%}.eui-19 :host.eui-progress-bar .eui-progress-bar__header-label{display:flex;justify-content:flex-start;font:var(--eui-f-m-bold)}.eui-19 :host.eui-progress-bar .eui-progress-bar__header-status{display:flex;justify-content:flex-end}.eui-19 :host.eui-progress-bar .eui-progress-bar__indicator-container{margin-bottom:var(--eui-s-2xs);background-color:var(--eui-c-surface-container-3);height:var(--eui-s-2xs);position:relative;width:100%}.eui-19 :host.eui-progress-bar .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-primary-surface);height:100%;transition:width .25s ease}.eui-19 :host.eui-progress-bar--size-2xs .eui-progress-bar__indicator-container{height:var(--eui-s-2xs)}.eui-19 :host.eui-progress-bar--size-xs .eui-progress-bar__indicator-container{height:var(--eui-s-xs)}.eui-19 :host.eui-progress-bar--size-s .eui-progress-bar__indicator-container{height:var(--eui-s-s)}.eui-19 :host.eui-progress-bar--size-m .eui-progress-bar__indicator-container{height:var(--eui-s-m)}.eui-19 :host.eui-progress-bar--size-l .eui-progress-bar__indicator-container{height:var(--eui-s-l)}.eui-19 :host.eui-progress-bar--size-xl .eui-progress-bar__indicator-container{height:var(--eui-s-xl)}.eui-19 :host.eui-progress-bar--secondary .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-secondary-surface)}.eui-19 :host.eui-progress-bar--success .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-success-surface)}.eui-19 :host.eui-progress-bar--info .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-info-surface)}.eui-19 :host.eui-progress-bar--warning .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-warning-surface)}.eui-19 :host.eui-progress-bar--danger .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-danger-surface)}.eui-19 :host.eui-progress-bar--accent .eui-progress-bar__indicator-container .eui-progress-bar__indicator{background-color:var(--eui-c-s-accent-surface)}.eui-19 :host.eui-progress-bar--indeterminate .eui-progress-bar__indicator-container .eui-progress-bar__indicator{animation:progress-linear-indeterminate 2s infinite linear;background-color:var(--eui-c-surface-container-3);background-size:200% 100%;background-image:linear-gradient(to right,transparent 50%,var(--eui-c-s-primary) 50%,var(--eui-c-s-primary) 60%,transparent 60%,transparent 71.5%,var(--eui-c-s-primary) 71.5%,var(--eui-c-s-primary) 84%,transparent 84%);transition:all .2s}@keyframes progress-linear-indeterminate{0%{background-size:200% 100%;background-position:left -31.25% top 0%}50%{background-size:800% 100%;background-position:left -49% top 0%}to{background-size:400% 100%;background-position:left -102% top 0%}}@media screen and (max-width: 767px){.eui-19 :host.eui-progress-bar--size-2xs .eui-progress-bar__indicator-container{height:var(--eui-s-xs)}}\n"] }]
        }], propDecorators: { e2eAttr: [{
                type: HostBinding,
                args: ['attr.data-e2e']
            }, {
                type: Input
            }], cssClasses: [{
                type: HostBinding,
                args: ['class']
            }], label: [{
                type: Input
            }], progress: [{
                type: Input,
                args: [{ transform: numberAttribute }]
            }], isIndeterminate: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }], hasStatusIcon: [{
                type: Input,
                args: [{ transform: booleanAttribute }]
            }] } });

/**
 * Module providing the EuiProgressBar component and its dependencies.
 *
 * @deprecated Use standalone {@link EUI_PROGRESS_BAR} instead.
 * This module is maintained for backward compatibility.
 */
class EuiProgressBarModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: EuiProgressBarModule, imports: [EuiProgressBarComponent], exports: [EuiProgressBarComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiProgressBarModule, imports: [EuiProgressBarComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: EuiProgressBarModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [EuiProgressBarComponent],
                    exports: [EuiProgressBarComponent],
                }]
        }] });

const EUI_PROGRESS_BAR = [
    EuiProgressBarComponent,
];
// export { EuiProgressBarComponent as EuiProgressBar } from './eui-progress-bar.component';

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

export { EUI_PROGRESS_BAR, EuiProgressBarComponent, EuiProgressBarModule };
//# sourceMappingURL=eui-components-eui-progress-bar.mjs.map
