import * as i0 from '@angular/core';
import { inject, ElementRef, NgZone, Renderer2, input, numberAttribute, output, computed, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';

class ProgressBar {
    _elementRef = inject(ElementRef);
    _ngZone = inject(NgZone);
    _renderer = inject(Renderer2);
    color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
    value = input(0, { ...(ngDevMode ? { debugName: "value" } : /* istanbul ignore next */ {}), transform: numberAttribute });
    bufferValue = input(0, { ...(ngDevMode ? { debugName: "bufferValue" } : /* istanbul ignore next */ {}), transform: numberAttribute });
    mode = input('determinate', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
    animationEnd = output();
    _cleanupTransitionEnd;
    isIndeterminate = computed(() => {
        return this.mode() === 'indeterminate' || this.mode() === 'query';
    }, ...(ngDevMode ? [{ debugName: "isIndeterminate" }] : /* istanbul ignore next */ []));
    primaryBarTransform = computed(() => {
        return `scaleX(${this.isIndeterminate() ? 1 : this.value() / 100})`;
    }, ...(ngDevMode ? [{ debugName: "primaryBarTransform" }] : /* istanbul ignore next */ []));
    bufferBarTransform = computed(() => {
        return `scaleX(${this.mode() === 'buffer' ? this.bufferValue() / 100 : 1})`;
    }, ...(ngDevMode ? [{ debugName: "bufferBarTransform" }] : /* istanbul ignore next */ []));
    /** @deprecated use bufferBarTransform instead */
    bufferBarFlexBasis = computed(() => {
        return this.bufferBarTransform();
    }, ...(ngDevMode ? [{ debugName: "bufferBarFlexBasis" }] : /* istanbul ignore next */ []));
    ngAfterViewInit() {
        this._ngZone.runOutsideAngular(() => {
            this._cleanupTransitionEnd = this._renderer.listen(this._elementRef.nativeElement, 'transitionend', this._transitionendHandler);
        });
    }
    ngOnDestroy() {
        this._cleanupTransitionEnd?.();
    }
    _transitionendHandler = (event) => {
        if (!event.target ||
            !event.target.classList.contains('ngs-progress-bar-primary-bar')) {
            return;
        }
        if (this.mode() === 'determinate' || this.mode() === 'buffer') {
            this._ngZone.run(() => this.animationEnd.emit({ value: this.value() }));
        }
    };
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ProgressBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: ProgressBar, isStandalone: true, selector: "ngs-progress-bar", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, bufferValue: { classPropertyName: "bufferValue", publicName: "bufferValue", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { animationEnd: "animationEnd" }, host: { attributes: { "role": "progressbar", "aria-valuemin": "0", "aria-valuemax": "100", "tabindex": "-1" }, properties: { "attr.aria-valuenow": "isIndeterminate() ? null : value()", "attr.mode": "mode()", "class.ngs-progress-bar-indeterminate": "isIndeterminate()", "style.--ngs-progress-bar-value": "value()", "style.--ngs-progress-bar-buffer-value": "bufferValue()" }, classAttribute: "ngs-progress-bar" }, exportAs: ["ngsProgressBar"], ngImport: i0, template: "@if (mode() === 'buffer') {\n  <div class=\"ngs-progress-bar-track\"></div>\n  <div class=\"ngs-progress-bar-buffer-bar\" [style.transform]=\"bufferBarTransform()\"></div>\n} @else {\n  <div class=\"ngs-progress-bar-track\"></div>\n}\n\n<div class=\"ngs-progress-bar-primary-bar\" [style.transform]=\"primaryBarTransform()\">\n  <span class=\"ngs-progress-bar-inner\"></span>\n</div>\n\n@if (isIndeterminate()) {\n  <div class=\"ngs-progress-bar-secondary-bar\">\n    <span class=\"ngs-progress-bar-inner\"></span>\n  </div>\n}\n", styles: [".ngs-progress-bar{--ngs-progress-bar-height: 4px;--ngs-progress-bar-track-color: var(--ngs-color-surface-container-highest);--ngs-progress-bar-indicator-color: var(--ngs-color-primary);--ngs-progress-bar-animation-multiplier: 1;display:block;position:relative;height:var(--ngs-progress-bar-height);overflow:hidden;width:100%;transform:translateZ(0);transition:opacity .25s linear}.ngs-progress-bar[mode=query]{transform:rotate(180deg)}.ngs-progress-bar[mode=buffer] .ngs-progress-bar-track{background-image:radial-gradient(circle,var(--ngs-progress-bar-track-color) calc(var(--ngs-progress-bar-height) / 2),transparent 0);background-repeat:repeat-x;background-size:calc(var(--ngs-progress-bar-height) / 2 * 5) var(--ngs-progress-bar-height);background-position:left;flex:auto;transform:rotate(180deg);animation:mdc-linear-progress-buffering calc(.25s * var(--ngs-progress-bar-animation-multiplier)) infinite linear;background-color:transparent}.ngs-progress-bar-track,.ngs-progress-bar-buffer-bar,.ngs-progress-bar-primary-bar,.ngs-progress-bar-secondary-bar{position:absolute;inset:0}.ngs-progress-bar-track{background:var(--ngs-progress-bar-track-color)}.ngs-progress-bar-buffer-bar{background:var(--ngs-progress-bar-track-color);opacity:.25;transform-origin:top left;transition:transform .25s linear}.ngs-progress-bar-primary-bar,.ngs-progress-bar-secondary-bar{transform-origin:top left;transition:transform .25s linear}.ngs-progress-bar-inner{display:inline-block;position:absolute;width:100%;height:100%;background:var(--ngs-progress-bar-indicator-color)}.ngs-progress-bar-indeterminate .ngs-progress-bar-primary-bar,.ngs-progress-bar[mode=query] .ngs-progress-bar-primary-bar{left:0;animation:ngs-progress-bar-primary-indeterminate-translate 2s infinite linear}.ngs-progress-bar-indeterminate .ngs-progress-bar-primary-bar .ngs-progress-bar-inner,.ngs-progress-bar[mode=query] .ngs-progress-bar-primary-bar .ngs-progress-bar-inner{animation:ngs-progress-bar-primary-indeterminate-scale 2s infinite linear}.ngs-progress-bar-indeterminate .ngs-progress-bar-secondary-bar,.ngs-progress-bar[mode=query] .ngs-progress-bar-secondary-bar{left:0;display:block;animation:ngs-progress-bar-secondary-indeterminate-translate 2s infinite linear}.ngs-progress-bar-indeterminate .ngs-progress-bar-secondary-bar .ngs-progress-bar-inner,.ngs-progress-bar[mode=query] .ngs-progress-bar-secondary-bar .ngs-progress-bar-inner{animation:ngs-progress-bar-secondary-indeterminate-scale 2s infinite linear}.ngs-progress-bar-primary-bar,.ngs-progress-bar-secondary-bar,.ngs-progress-bar-buffer-bar{display:block}@keyframes ngs-progress-bar-primary-indeterminate-translate{0%{transform:translate(-145.166611%)}20%{animation-timing-function:cubic-bezier(.5,0,.701732,.495819);transform:translate(-145.166611%)}59.15%{animation-timing-function:cubic-bezier(.302435,.381352,.55,.956352);transform:translate(-61.495191%)}to{transform:translate(55.444446%)}}@keyframes ngs-progress-bar-primary-indeterminate-scale{0%{transform:scaleX(.08)}36.65%{animation-timing-function:cubic-bezier(.334731,.12482,.785844,1);transform:scaleX(.08)}69.15%{animation-timing-function:cubic-bezier(.06,.11,.6,1);transform:scaleX(.661479)}to{transform:scaleX(.08)}}@keyframes ngs-progress-bar-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(.15,0,.515058,.409685);transform:translate(-54.888891%)}25%{animation-timing-function:cubic-bezier(.31033,.284058,.8,.733712);transform:translate(-17.236978%)}48.35%{animation-timing-function:cubic-bezier(.4,.627035,.6,.902026);transform:translate(29.497274%)}to{transform:translate(105.388891%)}}@keyframes ngs-progress-bar-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(.15,0,.515058,.409685);transform:scaleX(.08)}19.15%{animation-timing-function:cubic-bezier(.31033,.284058,.8,.733712);transform:scaleX(.457104)}44.15%{animation-timing-function:cubic-bezier(.4,.627035,.6,.902026);transform:scaleX(.72796)}to{transform:scaleX(.08)}}@keyframes mdc-linear-progress-buffering{to{background-position:calc(var(--ngs-progress-bar-height) / 2 * -5) 0}}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: ProgressBar, decorators: [{
            type: Component,
            args: [{ selector: 'ngs-progress-bar', exportAs: 'ngsProgressBar', host: {
                        'role': 'progressbar',
                        'aria-valuemin': '0',
                        'aria-valuemax': '100',
                        'tabindex': '-1',
                        '[attr.aria-valuenow]': 'isIndeterminate() ? null : value()',
                        '[attr.mode]': 'mode()',
                        'class': 'ngs-progress-bar',
                        '[class.ngs-progress-bar-indeterminate]': 'isIndeterminate()',
                        '[style.--ngs-progress-bar-value]': 'value()',
                        '[style.--ngs-progress-bar-buffer-value]': 'bufferValue()',
                    }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "@if (mode() === 'buffer') {\n  <div class=\"ngs-progress-bar-track\"></div>\n  <div class=\"ngs-progress-bar-buffer-bar\" [style.transform]=\"bufferBarTransform()\"></div>\n} @else {\n  <div class=\"ngs-progress-bar-track\"></div>\n}\n\n<div class=\"ngs-progress-bar-primary-bar\" [style.transform]=\"primaryBarTransform()\">\n  <span class=\"ngs-progress-bar-inner\"></span>\n</div>\n\n@if (isIndeterminate()) {\n  <div class=\"ngs-progress-bar-secondary-bar\">\n    <span class=\"ngs-progress-bar-inner\"></span>\n  </div>\n}\n", styles: [".ngs-progress-bar{--ngs-progress-bar-height: 4px;--ngs-progress-bar-track-color: var(--ngs-color-surface-container-highest);--ngs-progress-bar-indicator-color: var(--ngs-color-primary);--ngs-progress-bar-animation-multiplier: 1;display:block;position:relative;height:var(--ngs-progress-bar-height);overflow:hidden;width:100%;transform:translateZ(0);transition:opacity .25s linear}.ngs-progress-bar[mode=query]{transform:rotate(180deg)}.ngs-progress-bar[mode=buffer] .ngs-progress-bar-track{background-image:radial-gradient(circle,var(--ngs-progress-bar-track-color) calc(var(--ngs-progress-bar-height) / 2),transparent 0);background-repeat:repeat-x;background-size:calc(var(--ngs-progress-bar-height) / 2 * 5) var(--ngs-progress-bar-height);background-position:left;flex:auto;transform:rotate(180deg);animation:mdc-linear-progress-buffering calc(.25s * var(--ngs-progress-bar-animation-multiplier)) infinite linear;background-color:transparent}.ngs-progress-bar-track,.ngs-progress-bar-buffer-bar,.ngs-progress-bar-primary-bar,.ngs-progress-bar-secondary-bar{position:absolute;inset:0}.ngs-progress-bar-track{background:var(--ngs-progress-bar-track-color)}.ngs-progress-bar-buffer-bar{background:var(--ngs-progress-bar-track-color);opacity:.25;transform-origin:top left;transition:transform .25s linear}.ngs-progress-bar-primary-bar,.ngs-progress-bar-secondary-bar{transform-origin:top left;transition:transform .25s linear}.ngs-progress-bar-inner{display:inline-block;position:absolute;width:100%;height:100%;background:var(--ngs-progress-bar-indicator-color)}.ngs-progress-bar-indeterminate .ngs-progress-bar-primary-bar,.ngs-progress-bar[mode=query] .ngs-progress-bar-primary-bar{left:0;animation:ngs-progress-bar-primary-indeterminate-translate 2s infinite linear}.ngs-progress-bar-indeterminate .ngs-progress-bar-primary-bar .ngs-progress-bar-inner,.ngs-progress-bar[mode=query] .ngs-progress-bar-primary-bar .ngs-progress-bar-inner{animation:ngs-progress-bar-primary-indeterminate-scale 2s infinite linear}.ngs-progress-bar-indeterminate .ngs-progress-bar-secondary-bar,.ngs-progress-bar[mode=query] .ngs-progress-bar-secondary-bar{left:0;display:block;animation:ngs-progress-bar-secondary-indeterminate-translate 2s infinite linear}.ngs-progress-bar-indeterminate .ngs-progress-bar-secondary-bar .ngs-progress-bar-inner,.ngs-progress-bar[mode=query] .ngs-progress-bar-secondary-bar .ngs-progress-bar-inner{animation:ngs-progress-bar-secondary-indeterminate-scale 2s infinite linear}.ngs-progress-bar-primary-bar,.ngs-progress-bar-secondary-bar,.ngs-progress-bar-buffer-bar{display:block}@keyframes ngs-progress-bar-primary-indeterminate-translate{0%{transform:translate(-145.166611%)}20%{animation-timing-function:cubic-bezier(.5,0,.701732,.495819);transform:translate(-145.166611%)}59.15%{animation-timing-function:cubic-bezier(.302435,.381352,.55,.956352);transform:translate(-61.495191%)}to{transform:translate(55.444446%)}}@keyframes ngs-progress-bar-primary-indeterminate-scale{0%{transform:scaleX(.08)}36.65%{animation-timing-function:cubic-bezier(.334731,.12482,.785844,1);transform:scaleX(.08)}69.15%{animation-timing-function:cubic-bezier(.06,.11,.6,1);transform:scaleX(.661479)}to{transform:scaleX(.08)}}@keyframes ngs-progress-bar-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(.15,0,.515058,.409685);transform:translate(-54.888891%)}25%{animation-timing-function:cubic-bezier(.31033,.284058,.8,.733712);transform:translate(-17.236978%)}48.35%{animation-timing-function:cubic-bezier(.4,.627035,.6,.902026);transform:translate(29.497274%)}to{transform:translate(105.388891%)}}@keyframes ngs-progress-bar-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(.15,0,.515058,.409685);transform:scaleX(.08)}19.15%{animation-timing-function:cubic-bezier(.31033,.284058,.8,.733712);transform:scaleX(.457104)}44.15%{animation-timing-function:cubic-bezier(.4,.627035,.6,.902026);transform:scaleX(.72796)}to{transform:scaleX(.08)}}@keyframes mdc-linear-progress-buffering{to{background-position:calc(var(--ngs-progress-bar-height) / 2 * -5) 0}}\n/*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */\n"] }]
        }], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], bufferValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "bufferValue", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], animationEnd: [{ type: i0.Output, args: ["animationEnd"] }] } });

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

export { ProgressBar };
//# sourceMappingURL=ngstarter-ui-components-progress-bar.mjs.map
