{"version":3,"file":"progress-bar.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/material/progress-bar/progress-bar.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/material/progress-bar/progress-bar.html","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/material/progress-bar/progress-bar-module.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n  Component,\n  ViewEncapsulation,\n  ElementRef,\n  NgZone,\n  Input,\n  Output,\n  EventEmitter,\n  AfterViewInit,\n  OnDestroy,\n  ChangeDetectorRef,\n  InjectionToken,\n  inject,\n  numberAttribute,\n  Renderer2,\n  DOCUMENT,\n} from '@angular/core';\n\nimport {_getAnimationsState, ThemePalette} from '../core';\n\n/** Last animation end data. */\nexport interface ProgressAnimationEnd {\n  value: number;\n}\n\n/** Default `mat-progress-bar` options that can be overridden. */\nexport interface MatProgressBarDefaultOptions {\n  /**\n   * Default theme color of the progress bar. This API is supported in M2 themes only,\n   * it has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/progress-bar/styling.\n   *\n   * For information on applying color variants in M3, see\n   * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants\n   */\n  color?: ThemePalette;\n\n  /** Default mode of the progress bar. */\n  mode?: ProgressBarMode;\n}\n\n/** Injection token to be used to override the default options for `mat-progress-bar`. */\nexport const MAT_PROGRESS_BAR_DEFAULT_OPTIONS = new InjectionToken<MatProgressBarDefaultOptions>(\n  'MAT_PROGRESS_BAR_DEFAULT_OPTIONS',\n);\n\n/**\n * Injection token used to provide the current location to `MatProgressBar`.\n * Used to handle server-side rendering and to stub out during unit tests.\n * @docs-private\n */\nexport const MAT_PROGRESS_BAR_LOCATION = new InjectionToken<MatProgressBarLocation>(\n  'mat-progress-bar-location',\n  {\n    providedIn: 'root',\n    factory: () => {\n      const _document = inject(DOCUMENT);\n      const _location = _document ? _document.location : null;\n\n      return {\n        // Note that this needs to be a function, rather than a property, because Angular\n        // will only resolve it once, but we want the current path on each call.\n        getPathname: () => (_location ? _location.pathname + _location.search : ''),\n      };\n    },\n  },\n);\n\n/**\n * Stubbed out location for `MatProgressBar`.\n * @docs-private\n */\nexport interface MatProgressBarLocation {\n  getPathname: () => string;\n}\n\nexport type ProgressBarMode = 'determinate' | 'indeterminate' | 'buffer' | 'query';\n\n@Component({\n  selector: 'mat-progress-bar',\n  exportAs: 'matProgressBar',\n  host: {\n    'role': 'progressbar',\n    'aria-valuemin': '0',\n    'aria-valuemax': '100',\n    // set tab index to -1 so screen readers will read the aria-label\n    // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox\n    'tabindex': '-1',\n    '[attr.aria-valuenow]': '_isIndeterminate() ? null : value',\n    '[attr.mode]': 'mode',\n    'class': 'mat-mdc-progress-bar mdc-linear-progress',\n    '[class]': '\"mat-\" + color',\n    '[class._mat-animation-noopable]': '_isNoopAnimation',\n    '[class.mdc-linear-progress--animation-ready]': '!_isNoopAnimation',\n    '[class.mdc-linear-progress--indeterminate]': '_isIndeterminate()',\n  },\n  templateUrl: 'progress-bar.html',\n  styleUrl: 'progress-bar.css',\n  encapsulation: ViewEncapsulation.None,\n})\nexport class MatProgressBar implements AfterViewInit, OnDestroy {\n  readonly _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n  private _ngZone = inject(NgZone);\n  private _changeDetectorRef = inject(ChangeDetectorRef);\n  private _renderer = inject(Renderer2);\n  private _cleanupTransitionEnd: (() => void) | undefined;\n\n  constructor() {\n    const animationsState = _getAnimationsState();\n\n    const defaults = inject<MatProgressBarDefaultOptions>(MAT_PROGRESS_BAR_DEFAULT_OPTIONS, {\n      optional: true,\n    });\n\n    this._isNoopAnimation = animationsState === 'di-disabled';\n\n    if (animationsState === 'reduced-motion') {\n      this._elementRef.nativeElement.classList.add('mat-progress-bar-reduced-motion');\n    }\n\n    if (defaults) {\n      if (defaults.color) {\n        this.color = this._defaultColor = defaults.color;\n      }\n\n      this.mode = defaults.mode || this.mode;\n    }\n  }\n\n  /** Flag that indicates whether NoopAnimations mode is set to true. */\n  _isNoopAnimation: boolean;\n\n  // TODO: should be typed as `ThemePalette` but internal apps pass in arbitrary strings.\n  /**\n   * Theme color of the progress bar. This API is supported in M2 themes only, it\n   * has no effect in M3 themes. For color customization in M3, see https://material.angular.dev/components/progress-bar/styling.\n   *\n   * For information on applying color variants in M3, see\n   * https://material.angular.dev/guide/material-2-theming#optional-add-backwards-compatibility-styles-for-color-variants\n   */\n  @Input()\n  get color() {\n    return this._color || this._defaultColor;\n  }\n  set color(value: string | null | undefined) {\n    this._color = value;\n  }\n  private _color: string | null | undefined;\n  private _defaultColor: ThemePalette = 'primary';\n\n  /** Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow. */\n  @Input({transform: numberAttribute})\n  get value(): number {\n    return this._value;\n  }\n  set value(v: number) {\n    this._value = clamp(v || 0);\n    this._changeDetectorRef.markForCheck();\n  }\n  private _value = 0;\n\n  /** Buffer value of the progress bar. Defaults to zero. */\n  @Input({transform: numberAttribute})\n  get bufferValue(): number {\n    return this._bufferValue || 0;\n  }\n  set bufferValue(v: number) {\n    this._bufferValue = clamp(v || 0);\n    this._changeDetectorRef.markForCheck();\n  }\n  private _bufferValue = 0;\n\n  /**\n   * Event emitted when animation of the primary progress bar completes. This event will not\n   * be emitted when animations are disabled, nor will it be emitted for modes with continuous\n   * animations (indeterminate and query).\n   */\n  @Output() readonly animationEnd = new EventEmitter<ProgressAnimationEnd>();\n\n  /**\n   * Mode of the progress bar.\n   *\n   * Input must be one of these values: determinate, indeterminate, buffer, query, defaults to\n   * 'determinate'.\n   * Mirrored to mode attribute.\n   */\n  @Input()\n  get mode(): ProgressBarMode {\n    return this._mode;\n  }\n  set mode(value: ProgressBarMode) {\n    // Note that we don't technically need a getter and a setter here,\n    // but we use it to match the behavior of the existing mat-progress-bar.\n    this._mode = value;\n    this._changeDetectorRef.markForCheck();\n  }\n  private _mode: ProgressBarMode = 'determinate';\n\n  ngAfterViewInit() {\n    // Run outside angular so change detection didn't get triggered on every transition end\n    // instead only on the animation that we care about (primary value bar's transitionend)\n    this._ngZone.runOutsideAngular(() => {\n      this._cleanupTransitionEnd = this._renderer.listen(\n        this._elementRef.nativeElement,\n        'transitionend',\n        this._transitionendHandler,\n      );\n    });\n  }\n\n  ngOnDestroy() {\n    this._cleanupTransitionEnd?.();\n  }\n\n  /** Gets the transform style that should be applied to the primary bar. */\n  _getPrimaryBarTransform(): string {\n    return `scaleX(${this._isIndeterminate() ? 1 : this.value / 100})`;\n  }\n\n  /** Gets the `flex-basis` value that should be applied to the buffer bar. */\n  _getBufferBarFlexBasis(): string {\n    return `${this.mode === 'buffer' ? this.bufferValue : 100}%`;\n  }\n\n  /** Returns whether the progress bar is indeterminate. */\n  _isIndeterminate(): boolean {\n    return this.mode === 'indeterminate' || this.mode === 'query';\n  }\n\n  /** Event handler for `transitionend` events. */\n  private _transitionendHandler = (event: TransitionEvent) => {\n    if (\n      this.animationEnd.observers.length === 0 ||\n      !event.target ||\n      !(event.target as HTMLElement).classList.contains('mdc-linear-progress__primary-bar')\n    ) {\n      return;\n    }\n\n    if (this.mode === 'determinate' || this.mode === 'buffer') {\n      this._ngZone.run(() => this.animationEnd.next({value: this.value}));\n    }\n  };\n}\n\n/** Clamps a value to be between two numbers, by default 0 and 100. */\nfunction clamp(v: number, min = 0, max = 100) {\n  return Math.max(min, Math.min(max, v));\n}\n","<!--\n  All children need to be hidden for screen readers in order to support ChromeVox.\n  More context in the issue: https://github.com/angular/components/issues/22165.\n-->\n<div class=\"mdc-linear-progress__buffer\" aria-hidden=\"true\">\n  <div\n    class=\"mdc-linear-progress__buffer-bar\"\n    [style.flex-basis]=\"_getBufferBarFlexBasis()\"></div>\n  <!-- Remove the dots outside of buffer mode since they can cause CSP issues (see #28938) -->\n  @if (mode === 'buffer') {\n    <div class=\"mdc-linear-progress__buffer-dots\"></div>\n  }\n</div>\n<div\n  class=\"mdc-linear-progress__bar mdc-linear-progress__primary-bar\"\n  aria-hidden=\"true\"\n  [style.transform]=\"_getPrimaryBarTransform()\">\n  <span class=\"mdc-linear-progress__bar-inner\"></span>\n</div>\n<div class=\"mdc-linear-progress__bar mdc-linear-progress__secondary-bar\" aria-hidden=\"true\">\n  <span class=\"mdc-linear-progress__bar-inner\"></span>\n</div>\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {BidiModule} from '@angular/cdk/bidi';\nimport {NgModule} from '@angular/core';\nimport {MatProgressBar} from './progress-bar';\n\n@NgModule({\n  imports: [MatProgressBar],\n  exports: [MatProgressBar, BidiModule],\n})\nexport class MatProgressBarModule {}\n"],"names":[],"mappings":";;;;;;MAiDa,gCAAgC,GAAG,IAAI,cAAc,CAChE,kCAAkC;MAQvB,yBAAyB,GAAG,IAAI,cAAc,CACzD,2BAA2B,EAC3B;AACE,EAAA,UAAU,EAAE,MAAM;AAClB,EAAA,OAAO,EAAE,MAAK;AACZ,IAAA,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAClC,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,QAAQ,GAAG,IAAI;IAEvD,OAAO;MAGL,WAAW,EAAE,MAAO,SAAS,GAAG,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG;KACzE;AACH,EAAA;AACD,CAAA;MAmCU,cAAc,CAAA;AAChB,EAAA,WAAW,GAAG,MAAM,CAA0B,UAAU,CAAC;AAC1D,EAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;AACxB,EAAA,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC9C,EAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;EAC7B,qBAAqB;AAE7B,EAAA,WAAA,GAA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