import * as i0 from '@angular/core';
import { Component, ViewChild, Input, forwardRef, Directive, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { Subject, fromEvent, takeUntil } from 'rxjs';

class BsRangeComponent {
    constructor() {
        this.min = 0;
        this.max = 10;
        this.step = 1;
    }
}
BsRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
BsRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BsRangeComponent, selector: "bs-range", inputs: { min: "min", max: "max", step: "step" }, viewQueries: [{ propertyName: "slider", first: true, predicate: ["slider"], descendants: true }], ngImport: i0, template: "<input #slider type=\"range\" [min]=\"min\" [max]=\"max\" [step]=\"step\" class=\"form-range\">\n", styles: [":host ::ng-deep .form-range{width:100%;height:1.5rem;padding:0;background-color:transparent;-webkit-appearance:none;appearance:none}:host ::ng-deep .form-range:focus{outline:0}:host ::ng-deep .form-range:focus::-webkit-slider-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .25rem #0d6efd40}:host ::ng-deep .form-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .25rem #0d6efd40}:host ::ng-deep .form-range::-moz-focus-outer{border:0}:host ::ng-deep .form-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-.25rem;background-color:#0d6efd;border:0;border-radius:1rem;-webkit-transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:none;appearance:none}@media (prefers-reduced-motion: reduce){:host ::ng-deep .form-range::-webkit-slider-thumb{-webkit-transition:none;transition:none}}:host ::ng-deep .form-range::-webkit-slider-thumb:active{background-color:#b6d4fe}:host ::ng-deep .form-range::-webkit-slider-runnable-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}:host ::ng-deep .form-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#0d6efd;border:0;border-radius:1rem;-moz-transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media (prefers-reduced-motion: reduce){:host ::ng-deep .form-range::-moz-range-thumb{-moz-transition:none;transition:none}}:host ::ng-deep .form-range::-moz-range-thumb:active{background-color:#b6d4fe}:host ::ng-deep .form-range::-moz-range-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}:host ::ng-deep .form-range:disabled{pointer-events:none}:host ::ng-deep .form-range:disabled::-webkit-slider-thumb{background-color:#adb5bd}:host ::ng-deep .form-range:disabled::-moz-range-thumb{background-color:#adb5bd}\n"] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'bs-range', template: "<input #slider type=\"range\" [min]=\"min\" [max]=\"max\" [step]=\"step\" class=\"form-range\">\n", styles: [":host ::ng-deep .form-range{width:100%;height:1.5rem;padding:0;background-color:transparent;-webkit-appearance:none;appearance:none}:host ::ng-deep .form-range:focus{outline:0}:host ::ng-deep .form-range:focus::-webkit-slider-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .25rem #0d6efd40}:host ::ng-deep .form-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .25rem #0d6efd40}:host ::ng-deep .form-range::-moz-focus-outer{border:0}:host ::ng-deep .form-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-.25rem;background-color:#0d6efd;border:0;border-radius:1rem;-webkit-transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:none;appearance:none}@media (prefers-reduced-motion: reduce){:host ::ng-deep .form-range::-webkit-slider-thumb{-webkit-transition:none;transition:none}}:host ::ng-deep .form-range::-webkit-slider-thumb:active{background-color:#b6d4fe}:host ::ng-deep .form-range::-webkit-slider-runnable-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}:host ::ng-deep .form-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#0d6efd;border:0;border-radius:1rem;-moz-transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;appearance:none}@media (prefers-reduced-motion: reduce){:host ::ng-deep .form-range::-moz-range-thumb{-moz-transition:none;transition:none}}:host ::ng-deep .form-range::-moz-range-thumb:active{background-color:#b6d4fe}:host ::ng-deep .form-range::-moz-range-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}:host ::ng-deep .form-range:disabled{pointer-events:none}:host ::ng-deep .form-range:disabled::-webkit-slider-thumb{background-color:#adb5bd}:host ::ng-deep .form-range:disabled::-moz-range-thumb{background-color:#adb5bd}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { slider: [{
                type: ViewChild,
                args: ['slider']
            }], min: [{
                type: Input
            }], max: [{
                type: Input
            }], step: [{
                type: Input
            }] } });

class BsRangeValueAccessor {
    constructor(host) {
        this.host = host;
        this.destroyed$ = new Subject();
    }
    //#region Lifecycle hooks
    ngAfterViewInit() {
        fromEvent(this.host.slider.nativeElement, 'input')
            .pipe(takeUntil(this.destroyed$))
            .subscribe((ev) => {
            if (this.onValueChange) {
                const val = parseFloat(ev.target.value);
                this.onValueChange(val);
            }
        });
    }
    ngOnDestroy() {
        this.destroyed$.next(true);
    }
    //#endregion
    //#region ControlValueAccessor implementation
    registerOnChange(fn) {
        this.onValueChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    writeValue(value) {
        if (this.host.slider) {
            this.host.slider.nativeElement.value = value.toString();
        }
    }
    setDisabledState(isDisabled) {
        if (this.host.slider) {
            this.host.slider.nativeElement.disabled = isDisabled;
        }
    }
}
BsRangeValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeValueAccessor, deps: [{ token: BsRangeComponent }], target: i0.ɵɵFactoryTarget.Directive });
BsRangeValueAccessor.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: BsRangeValueAccessor, selector: "bs-range", providers: [{
            provide: NG_VALUE_ACCESSOR,
            useExisting: forwardRef(() => BsRangeValueAccessor),
            multi: true,
        }], ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeValueAccessor, decorators: [{
            type: Directive,
            args: [{
                    selector: 'bs-range',
                    providers: [{
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => BsRangeValueAccessor),
                            multi: true,
                        }],
                }]
        }], ctorParameters: function () { return [{ type: BsRangeComponent }]; } });

class BsRangeModule {
}
BsRangeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
BsRangeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: BsRangeModule, declarations: [BsRangeComponent, BsRangeValueAccessor], imports: [CommonModule], exports: [BsRangeComponent, BsRangeValueAccessor] });
BsRangeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BsRangeModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [BsRangeComponent, BsRangeValueAccessor],
                    imports: [CommonModule],
                    exports: [BsRangeComponent, BsRangeValueAccessor],
                }]
        }] });

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

export { BsRangeComponent, BsRangeModule, BsRangeValueAccessor };
//# sourceMappingURL=mintplayer-ng-bootstrap-range.mjs.map
