(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/a11y'), require('@angular/common'), require('@angular/core'), require('@ng-tangram/components/overlay'), require('@angular/cdk/coercion'), require('@angular/cdk/keycodes'), require('@angular/cdk/overlay'), require('@angular/forms'), require('@ng-tangram/components/forms')) :
    typeof define === 'function' && define.amd ? define('@ng-tangram/components/slider', ['exports', '@angular/cdk/a11y', '@angular/common', '@angular/core', '@ng-tangram/components/overlay', '@angular/cdk/coercion', '@angular/cdk/keycodes', '@angular/cdk/overlay', '@angular/forms', '@ng-tangram/components/forms'], factory) :
    (global = global || self, factory((global.nt = global.nt || {}, global.nt.components = global.nt.components || {}, global.nt.components.slider = {}), global.ng.cdk.a11y, global.ng.common, global.ng.core, global.nt.components.overlay, global.ng.cdk.coercion, global.ng.cdk.keycodes, global.ng.cdk.overlay, global.ng.forms, global.nt.components.forms));
}(this, (function (exports, a11y, common, core, overlay, coercion, keycodes, overlay$1, forms, forms$1) { 'use strict';

    var __extends = (this && this.__extends) || (function () {
        var extendStatics = function (d, b) {
            extendStatics = Object.setPrototypeOf ||
                ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
                function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
            return extendStatics(d, b);
        };
        return function (d, b) {
            extendStatics(d, b);
            function __() { this.constructor = d; }
            d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
        };
    })();
    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __param = (this && this.__param) || function (paramIndex, decorator) {
        return function (target, key) { decorator(target, key, paramIndex); }
    };
    var activeEventOptions = { passive: false };
    var NtSliderChange = (function () {
        function NtSliderChange() {
        }
        return NtSliderChange;
    }());
    var NtSliderComponent = (function (_super) {
        __extends(NtSliderComponent, _super);
        function NtSliderComponent(_changeDetectorRef, _elementRef, _focusMonitor, document, tabIndex, ngControl, _ngZone) {
            var _this = _super.call(this) || this;
            _this._changeDetectorRef = _changeDetectorRef;
            _this._elementRef = _elementRef;
            _this._focusMonitor = _focusMonitor;
            _this.ngControl = ngControl;
            _this._ngZone = _ngZone;
            _this._min = 0;
            _this._max = 100;
            _this._step = 1;
            _this._value = null;
            _this._percent = 0;
            _this._disabled = false;
            _this._invert = false;
            _this._stepmark = false;
            _this._vertical = false;
            _this.change = new core.EventEmitter();
            _this.input = new core.EventEmitter();
            _this.valueChange = new core.EventEmitter();
            _this._onChange = function () { };
            _this._onTouched = function () { };
            _this._sliderDimensions = null;
            _this._isSliding = false;
            _this._isActive = false;
            _this._stepmarkValues = [];
            _this._pointerDown = function (event) {
                if (_this.disabled || _this._isSliding || (!isTouchEvent(event) && event.button !== 0)) {
                    return;
                }
                _this._ngZone.run(function () {
                    var oldValue = _this.value;
                    var pointerPosition = getPointerPositionOnPage(event);
                    setTimeout(function () { return _this._isSliding = true; });
                    _this._lastPointerEvent = event;
                    event.preventDefault();
                    _this._focusHostElement();
                    _this._onMouseenter();
                    _this._bindGlobalEvents(event);
                    _this._focusHostElement();
                    _this._updateValueFromPosition(pointerPosition);
                    _this._valueOnSlideStart = _this.value;
                    _this._pointerPositionOnStart = pointerPosition;
                    if (oldValue != _this.value) {
                        _this._emitInputEvent();
                        _this._emitChangeEvent();
                    }
                });
            };
            _this._pointerMove = function (event) {
                if (_this._isSliding) {
                    event.preventDefault();
                    var oldValue = _this.value;
                    _this._lastPointerEvent = event;
                    _this._updateValueFromPosition(getPointerPositionOnPage(event));
                    if (oldValue != _this.value) {
                        _this._emitInputEvent();
                    }
                    _this._overlay.markOpen();
                    _this._overlay.forceUpdatePosition();
                }
            };
            _this._pointerUp = function (event) {
                if (_this._isSliding) {
                    var pointerPositionOnStart = _this._pointerPositionOnStart;
                    var currentPointerPosition = getPointerPositionOnPage(event);
                    event.preventDefault();
                    _this._removeGlobalEvents();
                    _this._valueOnSlideStart = _this._pointerPositionOnStart = _this._lastPointerEvent = null;
                    _this._isSliding = false;
                    if (_this._valueOnSlideStart !== _this.value &&
                        !_this.disabled && ((pointerPositionOnStart === null || pointerPositionOnStart === void 0 ? void 0 : pointerPositionOnStart.x) !== currentPointerPosition.x ||
                        (pointerPositionOnStart === null || pointerPositionOnStart === void 0 ? void 0 : pointerPositionOnStart.y) !== currentPointerPosition.y)) {
                        _this._emitChangeEvent();
                    }
                }
                _this._overlay.markClose();
            };
            _this._windowBlur = function () {
                if (_this._lastPointerEvent) {
                    _this._pointerUp(_this._lastPointerEvent);
                }
            };
            _this._document = document;
            _this.tabIndex = parseInt(tabIndex) || 0;
            if (_this.ngControl) {
                _this.ngControl.valueAccessor = _this;
            }
            _this._ngZone.runOutsideAngular(function () {
                var element = _elementRef.nativeElement;
                element.addEventListener('mousedown', _this._pointerDown, activeEventOptions);
                element.addEventListener('touchstart', _this._pointerDown, activeEventOptions);
            });
            return _this;
        }
        NtSliderComponent_1 = NtSliderComponent;
        Object.defineProperty(NtSliderComponent.prototype, "min", {
            get: function () { return this._min; },
            set: function (value) {
                this._min = coercion.coerceNumberProperty(value, this._max);
                if (this._value === null) {
                    this.value = this._min;
                }
                this._percent = this._calculatePercentage(this._value);
                this._changeDetectorRef.markForCheck();
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "max", {
            get: function () { return this._max; },
            set: function (value) {
                this._max = coercion.coerceNumberProperty(value, this._min);
                this._percent = this._calculatePercentage(this._value);
                this._changeDetectorRef.markForCheck();
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "step", {
            get: function () { return this._step; },
            set: function (value) {
                this._step = coercion.coerceNumberProperty(value, this._step);
                if (this._step % 1 !== 0) {
                    this._roundToDecimal = this._step.toString().split('.').pop().length;
                }
                this._changeDetectorRef.markForCheck();
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "value", {
            get: function () {
                if (this._value === null) {
                    this.value = this._min;
                }
                return this._value;
            },
            set: function (value) {
                if (value !== this._value) {
                    var _value = coercion.coerceNumberProperty(value);
                    if (this._roundToDecimal) {
                        _value = parseFloat(_value.toFixed(this._roundToDecimal));
                    }
                    this._value = this._clamp(_value, this.min, this.max);
                    this._percent = this._calculatePercentage(this._value);
                    this._changeDetectorRef.markForCheck();
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "percent", {
            get: function () { return this._clamp(this._percent); },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "displayValue", {
            get: function () {
                if (this._roundToDecimal && this.value && this.value % 1 !== 0) {
                    return this.value.toFixed(this._roundToDecimal);
                }
                return this.value || 0;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "disabled", {
            get: function () { return this._disabled; },
            set: function (value) {
                this._disabled = coercion.coerceBooleanProperty(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "invert", {
            get: function () { return this._invert; },
            set: function (value) {
                this._invert = coercion.coerceBooleanProperty(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "stepmark", {
            get: function () { return this._stepmark; },
            set: function (value) {
                this._stepmark = coercion.coerceBooleanProperty(value);
                if (this._stepmark) {
                    this._stepmarkValues = this._calculateStepmarks();
                }
                else {
                    this._stepmarkValues = [];
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "vertical", {
            get: function () { return this._vertical; },
            set: function (value) {
                this._vertical = coercion.coerceBooleanProperty(value);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "_trackFillStyles", {
            get: function () {
                var sizeValue = this.percent * 100;
                return !this.vertical
                    ? { width: sizeValue + "%" }
                    : { height: sizeValue + "%" };
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "_trackHandleStyles", {
            get: function () {
                var offsetValue = this.percent * 100;
                if (!this.vertical) {
                    return !this.invert
                        ? { left: offsetValue + "%" }
                        : { right: offsetValue + "%" };
                }
                else {
                    return { top: offsetValue + "%" };
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NtSliderComponent.prototype, "_trackTootipPosition", {
            get: function () {
                return !this.vertical
                    ? [overlay.TOP_CENTER, overlay.BOTTOM_CENTER]
                    : [overlay.LEFT_CENTER, overlay.RIGHT_CENTER];
            },
            enumerable: true,
            configurable: true
        });
        NtSliderComponent.prototype.ngOnInit = function () {
            var _this = this;
            this._origin = new overlay$1.CdkOverlayOrigin(this._sliderHandle);
            this._focusMonitor
                .monitor(this._elementRef, true)
                .subscribe(function (origin) {
                _this._isActive = !!origin && origin !== 'keyboard';
                _this._changeDetectorRef.detectChanges();
            });
        };
        NtSliderComponent.prototype.ngOnDestroy = function () {
            var element = this._elementRef.nativeElement;
            element.removeEventListener('mousedown', this._pointerDown, activeEventOptions);
            element.removeEventListener('touchstart', this._pointerDown, activeEventOptions);
        };
        NtSliderComponent.prototype.writeValue = function (obj) {
            if (this.disabled) {
                return;
            }
            this.value = obj;
        };
        NtSliderComponent.prototype.registerOnChange = function (fn) {
            this._onChange = fn;
        };
        NtSliderComponent.prototype.registerOnTouched = function (fn) {
            this._onTouched = fn;
        };
        NtSliderComponent.prototype.setDisabledState = function (isDisabled) {
            this.disabled = isDisabled;
        };
        NtSliderComponent.prototype.focus = function (options) {
            this._focusHostElement(options);
        };
        NtSliderComponent.prototype.blur = function () {
            this._blurHostElement();
        };
        NtSliderComponent.prototype._onMouseenter = function () {
            if (this.disabled) {
                return;
            }
            this._sliderDimensions = this._getSliderDimensions();
        };
        NtSliderComponent.prototype._onFocus = function () {
            this._sliderDimensions = this._getSliderDimensions();
        };
        NtSliderComponent.prototype._onBlur = function () {
            this._onTouched();
        };
        NtSliderComponent.prototype._onKeydown = function (event) {
            if (this.disabled || keycodes.hasModifierKey(event)) {
                return;
            }
            var oldValue = this.value;
            switch (event.keyCode) {
                case keycodes.PAGE_UP:
                    this._increment(10);
                    break;
                case keycodes.PAGE_DOWN:
                    this._increment(-10);
                    break;
                case keycodes.END:
                    this.value = this.max;
                    break;
                case keycodes.HOME:
                    this.value = this.min;
                    break;
                case keycodes.LEFT_ARROW:
                    this._increment(-1);
                    break;
                case keycodes.UP_ARROW:
                    this._increment(1);
                    break;
                case keycodes.RIGHT_ARROW:
                    this._increment(1);
                    break;
                case keycodes.DOWN_ARROW:
                    this._increment(-1);
                    break;
                default:
                    return;
            }
            if (oldValue != this.value) {
                this._emitInputEvent();
                this._emitChangeEvent();
            }
            this._isSliding = true;
            event.preventDefault();
        };
        NtSliderComponent.prototype._onKeyup = function () {
            this._isSliding = false;
        };
        NtSliderComponent.prototype._shouldInvertMouseCoords = function () {
            return !this.vertical ? this.invert : !this.invert;
        };
        NtSliderComponent.prototype._trackStepmarkStyles = function (stepmark) {
            if (!this.vertical) {
                return !this.invert
                    ? { left: stepmark.percent + "%" }
                    : { right: stepmark.percent + "%" };
            }
            else {
                return { top: stepmark.percent + "%" };
            }
        };
        NtSliderComponent.prototype._increment = function (numSteps) {
            this.value = this._clamp((this.value || 0) + this.step * numSteps, this.min, this.max);
        };
        NtSliderComponent.prototype._getSliderDimensions = function () {
            return this._elementRef.nativeElement.getBoundingClientRect();
        };
        NtSliderComponent.prototype._updateValueFromPosition = function (pos) {
            if (!this._sliderDimensions) {
                return;
            }
            var offset = this.vertical ? this._sliderDimensions.top : this._sliderDimensions.left;
            var size = this.vertical ? this._sliderDimensions.height : this._sliderDimensions.width;
            var posComponent = this.vertical ? pos.y : pos.x;
            var percent = this._clamp((posComponent - offset) / size);
            if (this._shouldInvertMouseCoords()) {
                percent = 1 - percent;
            }
            if (percent === 0) {
                this.value = this.min;
            }
            else if (percent === 1) {
                this.value = this.max;
            }
            else {
                var exactValue = this._calculateValue(percent);
                var closestValue = Math.round((exactValue - this.min) / this.step) * this.step + this.min;
                this.value = this._clamp(closestValue, this.min, this.max);
            }
        };
        NtSliderComponent.prototype._calculatePercentage = function (value) {
            return ((value || 0) - this.min) / (this.max - this.min);
        };
        NtSliderComponent.prototype._calculateValue = function (percentage) {
            return this.min + percentage * (this.max - this.min);
        };
        NtSliderComponent.prototype._calculateStepmarks = function () {
            var _this = this;
            var values = [{ value: this.min, percent: 0 }];
            var range = this.max - this.min;
            var start = this.min;
            while ((start += this.step) < this.max) {
                values.push({
                    value: start,
                    percent: (start - this.min) / range * 100
                });
            }
            if (!values.find(function (item) { return item.value === _this.max; })) {
                values.push({ value: this.max, percent: 100 });
            }
            return values;
        };
        NtSliderComponent.prototype._clamp = function (value, min, max) {
            if (min === void 0) { min = 0; }
            if (max === void 0) { max = 1; }
            return Math.max(min, Math.min(value, max));
        };
        NtSliderComponent.prototype._bindGlobalEvents = function (triggerEvent) {
            if (typeof this._document !== 'undefined' && this._document) {
                var body = this._document.body;
                var isTouch = isTouchEvent(triggerEvent);
                var moveEventName = isTouch ? 'touchmove' : 'mousemove';
                var endEventName = isTouch ? 'touchend' : 'mouseup';
                body.addEventListener(moveEventName, this._pointerMove, activeEventOptions);
                body.addEventListener(endEventName, this._pointerUp, activeEventOptions);
                if (isTouch) {
                    body.addEventListener('touchcancel', this._pointerUp, activeEventOptions);
                }
            }
            if (typeof window !== 'undefined' && window) {
                window.addEventListener('blur', this._windowBlur);
            }
        };
        NtSliderComponent.prototype._removeGlobalEvents = function () {
            if (typeof this._document !== 'undefined' && this._document) {
                var body = this._document.body;
                body.removeEventListener('mousemove', this._pointerMove, activeEventOptions);
                body.removeEventListener('mouseup', this._pointerUp, activeEventOptions);
                body.removeEventListener('touchmove', this._pointerMove, activeEventOptions);
                body.removeEventListener('touchend', this._pointerUp, activeEventOptions);
                body.removeEventListener('touchcancel', this._pointerUp, activeEventOptions);
            }
            if (typeof window !== 'undefined' && window) {
                window.removeEventListener('blur', this._windowBlur);
            }
        };
        NtSliderComponent.prototype._focusHostElement = function (options) {
            this._elementRef.nativeElement.focus(options);
        };
        NtSliderComponent.prototype._blurHostElement = function () {
            this._elementRef.nativeElement.blur();
        };
        NtSliderComponent.prototype._emitChangeEvent = function () {
            this._onChange(this.value);
            this.valueChange.emit(this.value);
            this.change.emit(this._createSliderChange());
        };
        NtSliderComponent.prototype._emitInputEvent = function () {
            this.input.emit(this._createSliderChange());
            this._changeDetectorRef.markForCheck();
        };
        NtSliderComponent.prototype._createSliderChange = function () {
            var change = new NtSliderChange();
            change.source = this;
            change.value = this.value || this.min;
            return change;
        };
        var NtSliderComponent_1;
        NtSliderComponent.ctorParameters = function () { return [
            { type: core.ChangeDetectorRef },
            { type: core.ElementRef },
            { type: a11y.FocusMonitor },
            { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
            { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] },
            { type: forms.NgControl, decorators: [{ type: core.Self }, { type: core.Optional }] },
            { type: core.NgZone }
        ]; };
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "min", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "max", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "step", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "value", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "disabled", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "invert", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "stepmark", null);
        __decorate([
            core.Input()
        ], NtSliderComponent.prototype, "vertical", null);
        __decorate([
            core.Output()
        ], NtSliderComponent.prototype, "change", void 0);
        __decorate([
            core.Output()
        ], NtSliderComponent.prototype, "input", void 0);
        __decorate([
            core.Output()
        ], NtSliderComponent.prototype, "valueChange", void 0);
        __decorate([
            core.ViewChild('sliderHandle', { static: true, read: core.ElementRef })
        ], NtSliderComponent.prototype, "_sliderHandle", void 0);
        __decorate([
            core.ViewChild(overlay.NtOverlayComponent, { static: true })
        ], NtSliderComponent.prototype, "_overlay", void 0);
        NtSliderComponent = NtSliderComponent_1 = __decorate([
            core.Component({
                selector: 'nt-slider',
                exportAs: 'ntSlider',
                template: "<span #sliderHandle\n  class=\"nt-slider-handle\"\n  [ngStyle]=\"_trackHandleStyles\"\n  (mouseenter)=\"_overlay.markOpen()\"\n  (mouseleave)=\"_overlay.markClose()\">\n</span>\n<span class=\"nt-slider-fill\" [ngStyle]=\"_trackFillStyles\"></span>\n<div class=\"nt-slider-stepmark\" *ngIf=\"stepmark\">\n  <span *ngFor=\"let mark of _stepmarkValues\"\n    [class.is-passed]=\"value >= mark.value\"\n    [ngStyle]=\"_trackStepmarkStyles(mark)\">\n  </span>\n</div>\n<nt-overlay\n  overlayClass=\"nt-slider-tooltip-overlay\"\n  arrow\n  [origin]=\"_origin\"\n  [positionPairs]=\"_trackTootipPosition\"\n  (overlayEnter)=\"_overlay.markOpen()\"\n  (overlayLeave)=\"_overlay.markClose()\">\n  <div class=\"nt-slider-tooltip\">{{ displayValue }}</div>\n</nt-overlay>\n",
                encapsulation: core.ViewEncapsulation.None,
                changeDetection: core.ChangeDetectionStrategy.OnPush,
                host: {
                    '(focus)': '_onFocus()',
                    '(blur)': '_onBlur()',
                    '(keydown)': '_onKeydown($event)',
                    '(keyup)': '_onKeyup()',
                    '(mouseenter)': '_onMouseenter()',
                    '(selectstart)': '$event.preventDefault()',
                    'class': 'nt-slider',
                    'role': 'slider',
                    '[tabIndex]': 'tabIndex',
                    '[class.is-sliding]': '_isSliding',
                    '[class.vertical]': 'vertical',
                    '[class.invert]': 'invert'
                },
                providers: [
                    { provide: forms$1.NtFormFieldControl, useExisting: NtSliderComponent_1, multi: true }
                ]
            }),
            __param(3, core.Inject(common.DOCUMENT)),
            __param(4, core.Attribute('tabindex')),
            __param(5, core.Self()), __param(5, core.Optional())
        ], NtSliderComponent);
        return NtSliderComponent;
    }(forms$1.NtFormFieldControl));
    function isTouchEvent(event) {
        return event.type[0] === 't';
    }
    function getPointerPositionOnPage(event) {
        var point = isTouchEvent(event) ? (event.touches[0] || event.changedTouches[0]) : event;
        return { x: point.clientX, y: point.clientY };
    }

    var __decorate$1 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtSliderInputDirective = (function () {
        function NtSliderInputDirective(element) {
            this._input = element.nativeElement;
        }
        Object.defineProperty(NtSliderInputDirective.prototype, "slider", {
            get: function () { return this._slider; },
            set: function (value) {
                this._slider = value;
                if (this._slider) {
                    this._connect();
                }
                else {
                    this._disconnect();
                }
            },
            enumerable: true,
            configurable: true
        });
        NtSliderInputDirective.prototype._connect = function () {
            var _this = this;
            this._connection = this.slider.input.subscribe(function () { return _this._updateInputValue(); });
            this._coverOriginalAttributes();
            this._updateInputValue();
            this._input.addEventListener('change', this._onInputValueChange.bind(this));
        };
        NtSliderInputDirective.prototype._disconnect = function () {
            var _a;
            (_a = this._connection) === null || _a === void 0 ? void 0 : _a.unsubscribe();
            this._input.removeEventListener('change', this._onInputValueChange);
            this._restoreOriginalAttributes();
        };
        NtSliderInputDirective.prototype._updateInputValue = function () {
            this._input.value = "" + this.slider.displayValue;
        };
        NtSliderInputDirective.prototype._onInputValueChange = function (_) {
            var newValue = Number.parseFloat(this._input.value);
            this.slider.writeValue(newValue);
            this._updateInputValue();
            this._emitSliderChangeEvent();
        };
        NtSliderInputDirective.prototype._emitSliderChangeEvent = function () {
            this.slider.valueChange.emit(this.slider.value);
            this.slider.change.emit(this._createSliderChange());
        };
        NtSliderInputDirective.prototype._createSliderChange = function () {
            var change = new NtSliderChange();
            change.source = this.slider;
            change.value = this.slider.value || 0;
            return change;
        };
        NtSliderInputDirective.prototype._coverOriginalAttributes = function () {
            this._originalStep = this._input.step;
            this._originalMin = this._input.min;
            this._originalMax = this._input.max;
            this._input.step = "" + this.slider.step;
            this._input.min = "" + this.slider.min;
            this._input.max = "" + this.slider.max;
        };
        NtSliderInputDirective.prototype._restoreOriginalAttributes = function () {
            this._input.step = this._originalStep;
            this._input.min = this._originalMin;
            this._input.max = this._originalMax;
        };
        NtSliderInputDirective.ctorParameters = function () { return [
            { type: core.ElementRef }
        ]; };
        __decorate$1([
            core.Input('ntSliderInput')
        ], NtSliderInputDirective.prototype, "slider", null);
        NtSliderInputDirective = __decorate$1([
            core.Directive({
                selector: 'input[type="number"][ntSliderInput]'
            })
        ], NtSliderInputDirective);
        return NtSliderInputDirective;
    }());

    var __decorate$2 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtSliderRangeComponent = (function () {
        function NtSliderRangeComponent() {
        }
        NtSliderRangeComponent = __decorate$2([
            core.Component({
                selector: 'nt-slider-range',
                template: "",
                encapsulation: core.ViewEncapsulation.None
            })
        ], NtSliderRangeComponent);
        return NtSliderRangeComponent;
    }());

    var __decorate$3 = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var NtSliderModule = (function () {
        function NtSliderModule() {
        }
        NtSliderModule = __decorate$3([
            core.NgModule({
                imports: [
                    common.CommonModule,
                    a11y.A11yModule,
                    overlay.NtOverlayModule,
                ],
                exports: [
                    NtSliderComponent,
                    NtSliderRangeComponent,
                    NtSliderInputDirective
                ],
                declarations: [
                    NtSliderComponent,
                    NtSliderRangeComponent,
                    NtSliderInputDirective
                ]
            })
        ], NtSliderModule);
        return NtSliderModule;
    }());

    exports.NtSliderChange = NtSliderChange;
    exports.NtSliderComponent = NtSliderComponent;
    exports.NtSliderInputDirective = NtSliderInputDirective;
    exports.NtSliderModule = NtSliderModule;
    exports.NtSliderRangeComponent = NtSliderRangeComponent;

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

})));
//# sourceMappingURL=slider.umd.js.map
