import { CommonModule } from '@angular/common';
import { InjectionToken, EventEmitter, isDevMode, NgZone, ElementRef, ChangeDetectorRef, Attribute, Optional, Self, Inject, Input, ViewChild, ContentChildren, Output, Component, ViewEncapsulation, ChangeDetectionStrategy, NgModule } from '@angular/core';
import { BOTTOM_LEFT, TOP_LEFT, NtOverlayComponent, NtOptionComponent, NT_OPTION_PARENT_COMPONENT, fadeOut, fadeIn, NtOverlayModule, NtOptionModule, NtPseudoInputModule } from '@ng-tangram/components/core';
import { Subject, defer, merge } from 'rxjs';
import { take, switchMap, startWith, takeUntil, filter } from 'rxjs/operators';
import { trigger, transition } from '@angular/animations';
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { SelectionModel } from '@angular/cdk/collections';
import { DOWN_ARROW, UP_ARROW, HOME, END, ENTER, SPACE, TAB, LEFT_ARROW, RIGHT_ARROW } from '@angular/cdk/keycodes';
import { CdkOverlayOrigin } from '@angular/cdk/overlay';
import { NgControl } from '@angular/forms';
import { NtFormFieldControl } from '@ng-tangram/components/forms';

var DEFAULT_SELECT_ICONS = {
    caret: 'fa fa-chevron-down',
    clear: 'fa fa-times'
};
var NT_SELECT_ICONS = new InjectionToken('nt-select-icons');

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 __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
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 __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
var __spread = (this && this.__spread) || function () {
    for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
    return ar;
};
function getNtSelectDynamicMultipleError() {
    return Error('Cannot change `multiple` mode of select after initialization.');
}
function getNtSelectNonArrayValueError() {
    return Error('Value must be an array in multiple-selection mode.');
}
function getNtSelectNonFunctionValueError() {
    return Error('`compareWith` must be a function.');
}
var NtSelectChange = (function () {
    function NtSelectChange(source, value) {
        this.source = source;
        this.value = value;
    }
    return NtSelectChange;
}());
var NtSelectComponent = (function (_super) {
    __extends(NtSelectComponent, _super);
    function NtSelectComponent(_ngZone, _elementRef, _changeDetectorRef, tabIndex, ngControl, icons) {
        var _this = _super.call(this) || this;
        _this._ngZone = _ngZone;
        _this._elementRef = _elementRef;
        _this._changeDetectorRef = _changeDetectorRef;
        _this.ngControl = ngControl;
        _this.icons = icons;
        _this._destroy = new Subject();
        _this._positionPairs = [BOTTOM_LEFT, TOP_LEFT];
        _this._compareWith = function (o1, o2) { return o1 === o2; };
        _this._onChange = function () { };
        _this._onTouched = function () { };
        _this._focused = false;
        _this._disabled = false;
        _this._required = false;
        _this._state = '';
        _this._multiple = false;
        _this.filterNotFound = 'Not Found';
        _this._placeholder = '';
        _this.afterOpen = new EventEmitter();
        _this.afterClosed = new EventEmitter();
        _this.beforeOpen = new EventEmitter();
        _this.beforeClosed = new EventEmitter();
        _this.positionChange = new EventEmitter();
        _this.selectionChange = new EventEmitter();
        _this.valueChange = new EventEmitter();
        _this.optionSelectionChanges = defer(function () {
            if (_this.options) {
                return merge.apply(void 0, __spread(_this.options.map(function (option) { return option.selectionChange; })));
            }
            return _this._ngZone.onStable
                .asObservable()
                .pipe(take(1), switchMap(function () { return _this.optionSelectionChanges; }));
        });
        if (_this.ngControl) {
            _this.ngControl.valueAccessor = _this;
        }
        _this.origin = new CdkOverlayOrigin(_this._elementRef);
        _this.icons = __assign(__assign({}, DEFAULT_SELECT_ICONS), icons);
        _this.tabIndex = parseInt(tabIndex) || 0;
        return _this;
    }
    NtSelectComponent_1 = NtSelectComponent;
    Object.defineProperty(NtSelectComponent.prototype, "value", {
        get: function () { return this._value; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "displayValue", {
        get: function () {
            if (this.empty) {
                return '';
            }
            if (this._multiple) {
                var selectedOptions = this._selectionModel.selected.map(function (option) { return option.label; });
                return selectedOptions.join(', ');
            }
            return this._selectionModel.selected[0].label;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "empty", {
        get: function () { return !this._selectionModel || this._selectionModel.isEmpty(); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "optionEmpty", {
        get: function () {
            return this.options ? this.options.filter(function (option) { return !option.hidden; }).length === 0 : false;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "focused", {
        get: function () { return this._focused; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "disabled", {
        get: function () { return this._disabled; },
        set: function (value) { this._disabled = coerceBooleanProperty(value); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "required", {
        get: function () { return this._required; },
        set: function (value) { this._required = coerceBooleanProperty(value); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "state", {
        get: function () { return this._state; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "width", {
        get: function () { return this._width; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "multiple", {
        get: function () { return this._multiple; },
        set: function (value) { this._multiple = coerceBooleanProperty(value); },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "filter", {
        get: function () { return this._filter; },
        set: function (value) {
            if (typeof value === 'function') {
                this._filter = value;
            }
            else if (coerceBooleanProperty(value)) {
                this._filter = function (keyword, option) {
                    var regex = new RegExp(keyword.toLowerCase(), 'g');
                    return regex.test(option.label.toLowerCase());
                };
            }
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "selected", {
        get: function () {
            return this.multiple ? this._selectionModel.selected : this._selectionModel.selected[0];
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "placeholder", {
        get: function () {
            if (this.empty) {
                return this._placeholder;
            }
            return this.filter ? this.displayValue : this._placeholder;
        },
        set: function (value) { this._placeholder = value; },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NtSelectComponent.prototype, "compareWith", {
        set: function (fn) {
            if (typeof fn !== 'function') {
                throw getNtSelectNonFunctionValueError();
            }
            else {
                this._compareWith = fn;
                if (this._selectionModel) {
                    this._initializeSelection();
                }
            }
        },
        enumerable: true,
        configurable: true
    });
    NtSelectComponent.prototype.ngOnInit = function () {
        this._selectionModel = new SelectionModel(this.multiple, undefined, false);
    };
    NtSelectComponent.prototype.ngAfterContentInit = function () {
        var _this = this;
        this._initKeyManager();
        this.options.changes.pipe(startWith(null), takeUntil(this._destroy)).subscribe(function () {
            _this._resetOptions();
            _this._initializeSelection();
        });
    };
    NtSelectComponent.prototype.ngOnDestroy = function () {
        this._destroy.next();
        this._destroy.complete();
    };
    NtSelectComponent.prototype.onResize = function () {
        this._width = this._elementRef.nativeElement.clientWidth;
    };
    NtSelectComponent.prototype._onSearch = function (event) {
        var _this = this;
        if (this.overlay.opened && this.filter && !this.disabled) {
            var target_1 = event.target;
            this.options.forEach(function (option) { return option.hidden = !_this.filter(target_1.value, option); });
        }
    };
    NtSelectComponent.prototype._beforeOpen = function (event) {
        this._state = 'folded';
        this.onResize();
        this._scrollActiveOptionIntoView();
        this._highlightCorrectOption();
        this.beforeOpen.next(event);
    };
    NtSelectComponent.prototype._beforeClosed = function (event) {
        this._state = 'closed';
        this._onTouched();
        this.beforeClosed.next(event);
    };
    NtSelectComponent.prototype._afterOpen = function (event) {
        this.afterOpen.next(event);
    };
    NtSelectComponent.prototype._afterClosed = function (event) {
        this._resetFilterResult();
        this.afterClosed.next(event);
    };
    NtSelectComponent.prototype._positionChange = function (change) {
        this.positionChange.next(change);
    };
    NtSelectComponent.prototype._onInputClick = function (event) {
        if (!this.disabled) {
            this.overlay.toggle();
        }
        event.stopPropagation();
    };
    NtSelectComponent.prototype._onInputFocus = function () {
        this._focused = true;
        this.overlay.markOpen();
    };
    NtSelectComponent.prototype._onInputBlur = function () {
        this._focused = false;
    };
    NtSelectComponent.prototype.focus = function () {
        if (!this.disabled) {
            if (this.filter) {
                this.inputElement.nativeElement.focus();
            }
            else {
                this.overlay.open();
            }
        }
    };
    NtSelectComponent.prototype.writeValue = function (value) {
        if (this.options) {
            this._setSelectionByValue(value);
        }
    };
    NtSelectComponent.prototype.registerOnChange = function (fn) {
        this._onChange = fn;
    };
    NtSelectComponent.prototype.registerOnTouched = function (fn) {
        this._onTouched = fn;
    };
    NtSelectComponent.prototype.setDisabledState = function (isDisabled) {
        this._disabled = isDisabled;
    };
    NtSelectComponent.prototype._handleKeydown = function (event) {
        if (!this.disabled) {
            this.overlay.opened ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
        }
    };
    NtSelectComponent.prototype._handleOpenKeydown = function (event) {
        var keyCode = event.keyCode;
        var isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW;
        var manager = this._keyManager;
        if (keyCode === HOME || keyCode === END) {
            event.preventDefault();
            keyCode === HOME ? manager.setFirstItemActive() : manager.setLastItemActive();
        }
        else if (isArrowKey && event.altKey) {
            event.preventDefault();
            this.overlay.close();
        }
        else if ((keyCode === ENTER || keyCode === SPACE) && manager.activeItem) {
            event.preventDefault();
            manager.activeItem.selectViaInteraction();
            if (keyCode === ENTER && this.multiple) {
                this.overlay.close();
            }
        }
        else if (keyCode === TAB) {
            this.overlay.close();
        }
        else {
            var previouslyFocusedIndex = manager.activeItemIndex;
            manager.onKeydown(event);
            if (this._multiple && isArrowKey && event.shiftKey && manager.activeItem &&
                manager.activeItemIndex !== previouslyFocusedIndex) {
                manager.activeItem.selectViaInteraction();
            }
        }
    };
    NtSelectComponent.prototype._handleClosedKeydown = function (event) {
        var keyCode = event.keyCode;
        var isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW ||
            keyCode === LEFT_ARROW || keyCode === RIGHT_ARROW;
        var isOpenKey = keyCode === ENTER || keyCode === SPACE;
        if (isOpenKey || ((this.multiple || event.altKey) && isArrowKey)) {
            event.preventDefault();
            this.overlay.open();
        }
        else if (!this.multiple) {
            this._keyManager.onKeydown(event);
        }
    };
    NtSelectComponent.prototype._resetOptions = function () {
        var _this = this;
        var changedOrDestroyed = merge(this.options.changes, this._destroy);
        this.optionSelectionChanges
            .pipe(takeUntil(changedOrDestroyed), filter(function (event) { return event.isUserInput; }))
            .subscribe(function (event) {
            _this._onSelect(event.source);
            if (!_this.multiple && _this.overlay.opened) {
                _this.overlay.close();
            }
        });
        merge.apply(void 0, __spread(this.options.map(function (option) { return option.stateChanges; }))).pipe(takeUntil(changedOrDestroyed))
            .subscribe(function () {
            _this._changeDetectorRef.markForCheck();
        });
        this._resetFilterResult();
    };
    NtSelectComponent.prototype._initKeyManager = function () {
        var _this = this;
        this._keyManager = new ActiveDescendantKeyManager(this.options)
            .withTypeAhead()
            .withVerticalOrientation();
        this._keyManager.tabOut.pipe(takeUntil(this._destroy)).subscribe(function () {
            _this.focus();
            _this.overlay.close();
        });
        this._keyManager.change.pipe(takeUntil(this._destroy)).subscribe(function () {
            if (_this.overlay.opened && _this.paneElement) {
                _this._scrollActiveOptionIntoView();
            }
            else if (!_this.overlay.opened && !_this.multiple && _this._keyManager.activeItem) {
                _this._keyManager.activeItem.selectViaInteraction();
            }
        });
    };
    NtSelectComponent.prototype._resetFilterResult = function () {
        this.options.forEach(function (option) { return option.hidden = false; });
    };
    NtSelectComponent.prototype._initializeSelection = function () {
        var _this = this;
        Promise.resolve().then(function () {
            _this._setSelectionByValue(_this.ngControl ? _this.ngControl.value : _this.value);
        });
    };
    NtSelectComponent.prototype._setSelectionByValue = function (value, isUserInput) {
        var _this = this;
        if (isUserInput === void 0) { isUserInput = false; }
        if (this.multiple && value) {
            if (!Array.isArray(value)) {
                throw getNtSelectNonArrayValueError();
            }
            this._clearSelection();
            value.forEach(function (currentValue) { return _this._selectValue(currentValue, isUserInput); });
            this._sortValues();
        }
        else {
            this._clearSelection();
            var correspondingOption = this._selectValue(value, isUserInput);
            if (correspondingOption) {
                this._keyManager.setActiveItem(this.options.toArray().indexOf(correspondingOption));
            }
        }
        this._changeDetectorRef.markForCheck();
    };
    NtSelectComponent.prototype._selectValue = function (value, isUserInput) {
        var _this = this;
        if (isUserInput === void 0) { isUserInput = false; }
        var correspondingOption = this.options.find(function (option) {
            try {
                return option.value != null && _this._compareWith(option.value, value);
            }
            catch (error) {
                if (isDevMode()) {
                    console.warn(error);
                }
                return false;
            }
        });
        if (correspondingOption) {
            isUserInput ? correspondingOption.selectViaInteraction() : correspondingOption.select();
            this._selectionModel.select(correspondingOption);
        }
        return correspondingOption;
    };
    NtSelectComponent.prototype._propagateChanges = function (fallbackValue) {
        var valueToEmit = null;
        if (this.multiple) {
            valueToEmit = this.selected.map(function (option) { return option.value; });
        }
        else {
            valueToEmit = this.selected ? this.selected.value : fallbackValue;
        }
        this._value = valueToEmit;
        this.valueChange.emit(valueToEmit);
        this._onChange(valueToEmit);
        this.selectionChange.emit(new NtSelectChange(this, valueToEmit));
        this._changeDetectorRef.markForCheck();
    };
    NtSelectComponent.prototype._clearSelection = function (skip) {
        this._selectionModel.clear();
        this.options.forEach(function (option) {
            if (option !== skip) {
                option.deselect();
            }
        });
    };
    NtSelectComponent.prototype._sortValues = function () {
        var _this = this;
        if (this.multiple) {
            this._selectionModel.clear();
            this.options.forEach(function (option) {
                if (option.selected) {
                    _this._selectionModel.select(option);
                }
            });
        }
    };
    NtSelectComponent.prototype._onSelect = function (option) {
        var wasSelected = this._selectionModel.isSelected(option);
        if (this.multiple) {
            this._selectionModel.toggle(option);
            wasSelected ? option.deselect() : option.select();
            this._keyManager.setActiveItem(this.options.toArray().indexOf(option));
            this._sortValues();
        }
        else {
            this._clearSelection(option.value == null ? undefined : option);
            if (option.value == null) {
                this._propagateChanges(option.value);
            }
            else {
                this._selectionModel.select(option);
            }
        }
        if (wasSelected !== this._selectionModel.isSelected(option)) {
            this._propagateChanges();
        }
    };
    NtSelectComponent.prototype._highlightCorrectOption = function () {
        if (this._keyManager) {
            if (this.empty) {
                this._keyManager.setFirstItemActive();
            }
            else {
                var selectIndex = this.options.toArray().indexOf(this._selectionModel.selected[0]);
                this._keyManager.setActiveItem(selectIndex);
            }
        }
    };
    NtSelectComponent.prototype._scrollActiveOptionIntoView = function () {
        var activeOption = this._keyManager.activeItem || this.options.first;
        if (!activeOption) {
            return;
        }
        var panelScrollTop = this.paneElement.nativeElement.scrollTop;
        var panelScrollBottom = panelScrollTop + this.paneElement.nativeElement.offsetHeight;
        if (panelScrollBottom === 0) {
            this.paneElement.nativeElement.scrollTop = activeOption.getOffsetTop();
        }
        else if (activeOption.getOffsetTop() < panelScrollTop) {
            this.paneElement.nativeElement.scrollTop = activeOption.getOffsetTop();
        }
        else if (activeOption.getOffsetTop() + activeOption.getOffsetHeight() >= panelScrollBottom) {
            var scrollOffset = this.paneElement.nativeElement.offsetHeight - activeOption.getOffsetHeight();
            this.paneElement.nativeElement.scrollTop = activeOption.getOffsetTop() - scrollOffset;
        }
    };
    NtSelectComponent.prototype._testOnFocus = function () {
        console.log('input:focus');
        this.overlay.markOpen();
    };
    NtSelectComponent.prototype._testOnBlur = function () {
        console.log('input:blur');
        this.overlay.markClose();
    };
    var NtSelectComponent_1;
    NtSelectComponent.ctorParameters = function () { return [
        { type: NgZone },
        { type: ElementRef },
        { type: ChangeDetectorRef },
        { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
        { type: NgControl, decorators: [{ type: Optional }, { type: Self }] },
        { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [NT_SELECT_ICONS,] }] }
    ]; };
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "disabled", null);
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "required", null);
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "multiple", null);
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "filter", null);
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "filterNotFound", void 0);
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "placeholder", null);
    __decorate([
        ViewChild('inputElement', { static: false })
    ], NtSelectComponent.prototype, "inputElement", void 0);
    __decorate([
        ViewChild('paneElement', { static: true })
    ], NtSelectComponent.prototype, "paneElement", void 0);
    __decorate([
        ViewChild(NtOverlayComponent, { static: true })
    ], NtSelectComponent.prototype, "overlay", void 0);
    __decorate([
        ContentChildren(NtOptionComponent)
    ], NtSelectComponent.prototype, "options", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "afterOpen", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "afterClosed", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "beforeOpen", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "beforeClosed", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "positionChange", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "selectionChange", void 0);
    __decorate([
        Output()
    ], NtSelectComponent.prototype, "valueChange", void 0);
    __decorate([
        Input()
    ], NtSelectComponent.prototype, "compareWith", null);
    NtSelectComponent = NtSelectComponent_1 = __decorate([
        Component({
            selector: 'nt-select',
            template: "<nt-pseudo-input\n  *ngIf=\"!filter\"\n  [style.margin.px]=\"0\"\n  [attr.tabindex]=\"tabIndex\"\n  [value]=\"displayValue\"\n  [placeholder]=\"placeholder\"\n  [disabled]=\"disabled\"\n  (click)=\"_onInputClick($event)\">\n  <nt-pseudo-caret>\n    <span [class]=\"icons.caret\"></span>\n  </nt-pseudo-caret>\n</nt-pseudo-input>\n<div *ngIf=\"filter\" class=\"nt-pseudo-input only-caret\">\n  <input #inputElement type=\"text\"\n    [style.margin.px]=\"0\"\n    [placeholder]=\"placeholder\"\n    [disabled]=\"disabled\"\n    [value]=\"focused && overlay.opened ? '' : displayValue\"\n    (focus)=\"_onInputFocus()\"\n    (blur)=\"_onInputBlur()\"\n    (keyup)=\"_onSearch($event)\">\n    <nt-pseudo-caret>\n      <span [class]=\"icons.caret\"></span>\n    </nt-pseudo-caret>\n</div>\n<nt-overlay\n  [origin]=\"origin\"\n  [positionPairs]=\"_positionPairs\"\n  (afterOpen)=\"_afterOpen($event)\"\n  (afterClosed)=\"_afterClosed($event)\"\n  (beforeOpen)=\"_beforeOpen($event)\"\n  (beforeClosed)=\"_beforeClosed($event)\"\n  (positionChange)=\"_positionChange($event)\"\n  (keydownEvents)=\"_handleKeydown($event)\">\n  <div #paneElement\n      class=\"nt-select-pane\"\n      [class.folded]=\"state === 'folded'\"\n      [style.width.px]=\"width\">\n    <ng-content select=\"nt-option\"></ng-content>\n    <div class=\"filter-empty\" [hidden]=\"!optionEmpty\">\n      {{ filterNotFound }}\n    </div>\n  </div>\n</nt-overlay>\n",
            providers: [
                { provide: NT_OPTION_PARENT_COMPONENT, useExisting: NtSelectComponent_1 },
                { provide: NtFormFieldControl, useExisting: NtSelectComponent_1 }
            ],
            encapsulation: ViewEncapsulation.None,
            changeDetection: ChangeDetectionStrategy.OnPush,
            animations: [
                trigger('fade', [
                    transition('* => void', fadeOut(.15)),
                    transition('void => *', fadeIn(.15))
                ])
            ],
            host: {
                'class': 'nt-select',
                '(window:resize)': 'onResize()'
            }
        }),
        __param(3, Attribute('tabindex')),
        __param(4, Optional()), __param(4, Self()),
        __param(5, Optional()), __param(5, Inject(NT_SELECT_ICONS))
    ], NtSelectComponent);
    return NtSelectComponent;
}(NtFormFieldControl));

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 NtSelectModule = (function () {
    function NtSelectModule() {
    }
    NtSelectModule = __decorate$1([
        NgModule({
            imports: [
                CommonModule,
                NtOverlayModule,
                NtOptionModule,
                NtPseudoInputModule
            ],
            exports: [NtSelectComponent, NtOptionModule],
            declarations: [NtSelectComponent]
        })
    ], NtSelectModule);
    return NtSelectModule;
}());

export { DEFAULT_SELECT_ICONS, NT_SELECT_ICONS, NtSelectChange, NtSelectComponent, NtSelectModule, getNtSelectDynamicMultipleError, getNtSelectNonArrayValueError, getNtSelectNonFunctionValueError };
//# sourceMappingURL=select.js.map
