@ng-select/ng-select
Version:
Angular ng-select - All in One UI Select, Multiselect and Autocomplete
1,982 lines (1,975 loc) • 161 kB
JavaScript
import { __spread, __values, __read, __assign } from 'tslib';
import { Directive, ElementRef, Input, TemplateRef, Injectable, ɵɵdefineInjectable, EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, Renderer2, NgZone, Optional, Inject, Output, ViewChild, HostListener, InjectionToken, forwardRef, Attribute, ChangeDetectorRef, HostBinding, ContentChild, ContentChildren, NgModule } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
import { animationFrameScheduler, asapScheduler, Subject, fromEvent, merge } from 'rxjs';
import { DOCUMENT, CommonModule } from '@angular/common';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var unescapedHTMLExp = /[&<>"']/g;
/** @type {?} */
var hasUnescapedHTMLExp = RegExp(unescapedHTMLExp.source);
/** @type {?} */
var htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
'\'': '''
};
/**
* @param {?} string
* @return {?}
*/
function escapeHTML(string) {
return (string && hasUnescapedHTMLExp.test(string)) ?
string.replace(unescapedHTMLExp, (/**
* @param {?} chr
* @return {?}
*/
function (chr) { return htmlEscapes[chr]; })) :
string;
}
/**
* @param {?} value
* @return {?}
*/
function isDefined(value) {
return value !== undefined && value !== null;
}
/**
* @param {?} value
* @return {?}
*/
function isObject(value) {
return typeof value === 'object' && isDefined(value);
}
/**
* @param {?} value
* @return {?}
*/
function isPromise(value) {
return value instanceof Promise;
}
/**
* @param {?} value
* @return {?}
*/
function isFunction(value) {
return value instanceof Function;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var NgItemLabelDirective = /** @class */ (function () {
function NgItemLabelDirective(element) {
this.element = element;
this.escape = true;
}
/**
* @param {?} changes
* @return {?}
*/
NgItemLabelDirective.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
this.element.nativeElement.innerHTML = this.escape ?
escapeHTML(this.ngItemLabel) :
this.ngItemLabel;
};
NgItemLabelDirective.decorators = [
{ type: Directive, args: [{ selector: '[ngItemLabel]' },] }
];
/** @nocollapse */
NgItemLabelDirective.ctorParameters = function () { return [
{ type: ElementRef }
]; };
NgItemLabelDirective.propDecorators = {
ngItemLabel: [{ type: Input }],
escape: [{ type: Input }]
};
return NgItemLabelDirective;
}());
if (false) {
/** @type {?} */
NgItemLabelDirective.prototype.ngItemLabel;
/** @type {?} */
NgItemLabelDirective.prototype.escape;
/**
* @type {?}
* @private
*/
NgItemLabelDirective.prototype.element;
}
var NgOptionTemplateDirective = /** @class */ (function () {
function NgOptionTemplateDirective(template) {
this.template = template;
}
NgOptionTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-option-tmp]' },] }
];
/** @nocollapse */
NgOptionTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgOptionTemplateDirective;
}());
if (false) {
/** @type {?} */
NgOptionTemplateDirective.prototype.template;
}
var NgOptgroupTemplateDirective = /** @class */ (function () {
function NgOptgroupTemplateDirective(template) {
this.template = template;
}
NgOptgroupTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-optgroup-tmp]' },] }
];
/** @nocollapse */
NgOptgroupTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgOptgroupTemplateDirective;
}());
if (false) {
/** @type {?} */
NgOptgroupTemplateDirective.prototype.template;
}
var NgLabelTemplateDirective = /** @class */ (function () {
function NgLabelTemplateDirective(template) {
this.template = template;
}
NgLabelTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-label-tmp]' },] }
];
/** @nocollapse */
NgLabelTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgLabelTemplateDirective;
}());
if (false) {
/** @type {?} */
NgLabelTemplateDirective.prototype.template;
}
var NgMultiLabelTemplateDirective = /** @class */ (function () {
function NgMultiLabelTemplateDirective(template) {
this.template = template;
}
NgMultiLabelTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-multi-label-tmp]' },] }
];
/** @nocollapse */
NgMultiLabelTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgMultiLabelTemplateDirective;
}());
if (false) {
/** @type {?} */
NgMultiLabelTemplateDirective.prototype.template;
}
var NgHeaderTemplateDirective = /** @class */ (function () {
function NgHeaderTemplateDirective(template) {
this.template = template;
}
NgHeaderTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-header-tmp]' },] }
];
/** @nocollapse */
NgHeaderTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgHeaderTemplateDirective;
}());
if (false) {
/** @type {?} */
NgHeaderTemplateDirective.prototype.template;
}
var NgFooterTemplateDirective = /** @class */ (function () {
function NgFooterTemplateDirective(template) {
this.template = template;
}
NgFooterTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-footer-tmp]' },] }
];
/** @nocollapse */
NgFooterTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgFooterTemplateDirective;
}());
if (false) {
/** @type {?} */
NgFooterTemplateDirective.prototype.template;
}
var NgNotFoundTemplateDirective = /** @class */ (function () {
function NgNotFoundTemplateDirective(template) {
this.template = template;
}
NgNotFoundTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-notfound-tmp]' },] }
];
/** @nocollapse */
NgNotFoundTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgNotFoundTemplateDirective;
}());
if (false) {
/** @type {?} */
NgNotFoundTemplateDirective.prototype.template;
}
var NgTypeToSearchTemplateDirective = /** @class */ (function () {
function NgTypeToSearchTemplateDirective(template) {
this.template = template;
}
NgTypeToSearchTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-typetosearch-tmp]' },] }
];
/** @nocollapse */
NgTypeToSearchTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgTypeToSearchTemplateDirective;
}());
if (false) {
/** @type {?} */
NgTypeToSearchTemplateDirective.prototype.template;
}
var NgLoadingTextTemplateDirective = /** @class */ (function () {
function NgLoadingTextTemplateDirective(template) {
this.template = template;
}
NgLoadingTextTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-loadingtext-tmp]' },] }
];
/** @nocollapse */
NgLoadingTextTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgLoadingTextTemplateDirective;
}());
if (false) {
/** @type {?} */
NgLoadingTextTemplateDirective.prototype.template;
}
var NgTagTemplateDirective = /** @class */ (function () {
function NgTagTemplateDirective(template) {
this.template = template;
}
NgTagTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-tag-tmp]' },] }
];
/** @nocollapse */
NgTagTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgTagTemplateDirective;
}());
if (false) {
/** @type {?} */
NgTagTemplateDirective.prototype.template;
}
var NgLoadingSpinnerTemplateDirective = /** @class */ (function () {
function NgLoadingSpinnerTemplateDirective(template) {
this.template = template;
}
NgLoadingSpinnerTemplateDirective.decorators = [
{ type: Directive, args: [{ selector: '[ng-loadingspinner-tmp]' },] }
];
/** @nocollapse */
NgLoadingSpinnerTemplateDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return NgLoadingSpinnerTemplateDirective;
}());
if (false) {
/** @type {?} */
NgLoadingSpinnerTemplateDirective.prototype.template;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ConsoleService = /** @class */ (function () {
function ConsoleService() {
}
/**
* @param {?} message
* @return {?}
*/
ConsoleService.prototype.warn = /**
* @param {?} message
* @return {?}
*/
function (message) {
console.warn(message);
};
ConsoleService.decorators = [
{ type: Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */ ConsoleService.ngInjectableDef = ɵɵdefineInjectable({ factory: function ConsoleService_Factory() { return new ConsoleService(); }, token: ConsoleService, providedIn: "root" });
return ConsoleService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @return {?}
*/
function newId() {
// First character is an 'a', it's good practice to tag id to begin with a letter
return 'axxxxxxxxxxx'.replace(/[x]/g, (/**
* @param {?} _
* @return {?}
*/
function (_) {
// tslint:disable-next-line:no-bitwise
/** @type {?} */
var val = Math.random() * 16 | 0;
return val.toString(16);
}));
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var diacritics = {
'\u24B6': 'A',
'\uFF21': 'A',
'\u00C0': 'A',
'\u00C1': 'A',
'\u00C2': 'A',
'\u1EA6': 'A',
'\u1EA4': 'A',
'\u1EAA': 'A',
'\u1EA8': 'A',
'\u00C3': 'A',
'\u0100': 'A',
'\u0102': 'A',
'\u1EB0': 'A',
'\u1EAE': 'A',
'\u1EB4': 'A',
'\u1EB2': 'A',
'\u0226': 'A',
'\u01E0': 'A',
'\u00C4': 'A',
'\u01DE': 'A',
'\u1EA2': 'A',
'\u00C5': 'A',
'\u01FA': 'A',
'\u01CD': 'A',
'\u0200': 'A',
'\u0202': 'A',
'\u1EA0': 'A',
'\u1EAC': 'A',
'\u1EB6': 'A',
'\u1E00': 'A',
'\u0104': 'A',
'\u023A': 'A',
'\u2C6F': 'A',
'\uA732': 'AA',
'\u00C6': 'AE',
'\u01FC': 'AE',
'\u01E2': 'AE',
'\uA734': 'AO',
'\uA736': 'AU',
'\uA738': 'AV',
'\uA73A': 'AV',
'\uA73C': 'AY',
'\u24B7': 'B',
'\uFF22': 'B',
'\u1E02': 'B',
'\u1E04': 'B',
'\u1E06': 'B',
'\u0243': 'B',
'\u0182': 'B',
'\u0181': 'B',
'\u24B8': 'C',
'\uFF23': 'C',
'\u0106': 'C',
'\u0108': 'C',
'\u010A': 'C',
'\u010C': 'C',
'\u00C7': 'C',
'\u1E08': 'C',
'\u0187': 'C',
'\u023B': 'C',
'\uA73E': 'C',
'\u24B9': 'D',
'\uFF24': 'D',
'\u1E0A': 'D',
'\u010E': 'D',
'\u1E0C': 'D',
'\u1E10': 'D',
'\u1E12': 'D',
'\u1E0E': 'D',
'\u0110': 'D',
'\u018B': 'D',
'\u018A': 'D',
'\u0189': 'D',
'\uA779': 'D',
'\u01F1': 'DZ',
'\u01C4': 'DZ',
'\u01F2': 'Dz',
'\u01C5': 'Dz',
'\u24BA': 'E',
'\uFF25': 'E',
'\u00C8': 'E',
'\u00C9': 'E',
'\u00CA': 'E',
'\u1EC0': 'E',
'\u1EBE': 'E',
'\u1EC4': 'E',
'\u1EC2': 'E',
'\u1EBC': 'E',
'\u0112': 'E',
'\u1E14': 'E',
'\u1E16': 'E',
'\u0114': 'E',
'\u0116': 'E',
'\u00CB': 'E',
'\u1EBA': 'E',
'\u011A': 'E',
'\u0204': 'E',
'\u0206': 'E',
'\u1EB8': 'E',
'\u1EC6': 'E',
'\u0228': 'E',
'\u1E1C': 'E',
'\u0118': 'E',
'\u1E18': 'E',
'\u1E1A': 'E',
'\u0190': 'E',
'\u018E': 'E',
'\u24BB': 'F',
'\uFF26': 'F',
'\u1E1E': 'F',
'\u0191': 'F',
'\uA77B': 'F',
'\u24BC': 'G',
'\uFF27': 'G',
'\u01F4': 'G',
'\u011C': 'G',
'\u1E20': 'G',
'\u011E': 'G',
'\u0120': 'G',
'\u01E6': 'G',
'\u0122': 'G',
'\u01E4': 'G',
'\u0193': 'G',
'\uA7A0': 'G',
'\uA77D': 'G',
'\uA77E': 'G',
'\u24BD': 'H',
'\uFF28': 'H',
'\u0124': 'H',
'\u1E22': 'H',
'\u1E26': 'H',
'\u021E': 'H',
'\u1E24': 'H',
'\u1E28': 'H',
'\u1E2A': 'H',
'\u0126': 'H',
'\u2C67': 'H',
'\u2C75': 'H',
'\uA78D': 'H',
'\u24BE': 'I',
'\uFF29': 'I',
'\u00CC': 'I',
'\u00CD': 'I',
'\u00CE': 'I',
'\u0128': 'I',
'\u012A': 'I',
'\u012C': 'I',
'\u0130': 'I',
'\u00CF': 'I',
'\u1E2E': 'I',
'\u1EC8': 'I',
'\u01CF': 'I',
'\u0208': 'I',
'\u020A': 'I',
'\u1ECA': 'I',
'\u012E': 'I',
'\u1E2C': 'I',
'\u0197': 'I',
'\u24BF': 'J',
'\uFF2A': 'J',
'\u0134': 'J',
'\u0248': 'J',
'\u24C0': 'K',
'\uFF2B': 'K',
'\u1E30': 'K',
'\u01E8': 'K',
'\u1E32': 'K',
'\u0136': 'K',
'\u1E34': 'K',
'\u0198': 'K',
'\u2C69': 'K',
'\uA740': 'K',
'\uA742': 'K',
'\uA744': 'K',
'\uA7A2': 'K',
'\u24C1': 'L',
'\uFF2C': 'L',
'\u013F': 'L',
'\u0139': 'L',
'\u013D': 'L',
'\u1E36': 'L',
'\u1E38': 'L',
'\u013B': 'L',
'\u1E3C': 'L',
'\u1E3A': 'L',
'\u0141': 'L',
'\u023D': 'L',
'\u2C62': 'L',
'\u2C60': 'L',
'\uA748': 'L',
'\uA746': 'L',
'\uA780': 'L',
'\u01C7': 'LJ',
'\u01C8': 'Lj',
'\u24C2': 'M',
'\uFF2D': 'M',
'\u1E3E': 'M',
'\u1E40': 'M',
'\u1E42': 'M',
'\u2C6E': 'M',
'\u019C': 'M',
'\u24C3': 'N',
'\uFF2E': 'N',
'\u01F8': 'N',
'\u0143': 'N',
'\u00D1': 'N',
'\u1E44': 'N',
'\u0147': 'N',
'\u1E46': 'N',
'\u0145': 'N',
'\u1E4A': 'N',
'\u1E48': 'N',
'\u0220': 'N',
'\u019D': 'N',
'\uA790': 'N',
'\uA7A4': 'N',
'\u01CA': 'NJ',
'\u01CB': 'Nj',
'\u24C4': 'O',
'\uFF2F': 'O',
'\u00D2': 'O',
'\u00D3': 'O',
'\u00D4': 'O',
'\u1ED2': 'O',
'\u1ED0': 'O',
'\u1ED6': 'O',
'\u1ED4': 'O',
'\u00D5': 'O',
'\u1E4C': 'O',
'\u022C': 'O',
'\u1E4E': 'O',
'\u014C': 'O',
'\u1E50': 'O',
'\u1E52': 'O',
'\u014E': 'O',
'\u022E': 'O',
'\u0230': 'O',
'\u00D6': 'O',
'\u022A': 'O',
'\u1ECE': 'O',
'\u0150': 'O',
'\u01D1': 'O',
'\u020C': 'O',
'\u020E': 'O',
'\u01A0': 'O',
'\u1EDC': 'O',
'\u1EDA': 'O',
'\u1EE0': 'O',
'\u1EDE': 'O',
'\u1EE2': 'O',
'\u1ECC': 'O',
'\u1ED8': 'O',
'\u01EA': 'O',
'\u01EC': 'O',
'\u00D8': 'O',
'\u01FE': 'O',
'\u0186': 'O',
'\u019F': 'O',
'\uA74A': 'O',
'\uA74C': 'O',
'\u01A2': 'OI',
'\uA74E': 'OO',
'\u0222': 'OU',
'\u24C5': 'P',
'\uFF30': 'P',
'\u1E54': 'P',
'\u1E56': 'P',
'\u01A4': 'P',
'\u2C63': 'P',
'\uA750': 'P',
'\uA752': 'P',
'\uA754': 'P',
'\u24C6': 'Q',
'\uFF31': 'Q',
'\uA756': 'Q',
'\uA758': 'Q',
'\u024A': 'Q',
'\u24C7': 'R',
'\uFF32': 'R',
'\u0154': 'R',
'\u1E58': 'R',
'\u0158': 'R',
'\u0210': 'R',
'\u0212': 'R',
'\u1E5A': 'R',
'\u1E5C': 'R',
'\u0156': 'R',
'\u1E5E': 'R',
'\u024C': 'R',
'\u2C64': 'R',
'\uA75A': 'R',
'\uA7A6': 'R',
'\uA782': 'R',
'\u24C8': 'S',
'\uFF33': 'S',
'\u1E9E': 'S',
'\u015A': 'S',
'\u1E64': 'S',
'\u015C': 'S',
'\u1E60': 'S',
'\u0160': 'S',
'\u1E66': 'S',
'\u1E62': 'S',
'\u1E68': 'S',
'\u0218': 'S',
'\u015E': 'S',
'\u2C7E': 'S',
'\uA7A8': 'S',
'\uA784': 'S',
'\u24C9': 'T',
'\uFF34': 'T',
'\u1E6A': 'T',
'\u0164': 'T',
'\u1E6C': 'T',
'\u021A': 'T',
'\u0162': 'T',
'\u1E70': 'T',
'\u1E6E': 'T',
'\u0166': 'T',
'\u01AC': 'T',
'\u01AE': 'T',
'\u023E': 'T',
'\uA786': 'T',
'\uA728': 'TZ',
'\u24CA': 'U',
'\uFF35': 'U',
'\u00D9': 'U',
'\u00DA': 'U',
'\u00DB': 'U',
'\u0168': 'U',
'\u1E78': 'U',
'\u016A': 'U',
'\u1E7A': 'U',
'\u016C': 'U',
'\u00DC': 'U',
'\u01DB': 'U',
'\u01D7': 'U',
'\u01D5': 'U',
'\u01D9': 'U',
'\u1EE6': 'U',
'\u016E': 'U',
'\u0170': 'U',
'\u01D3': 'U',
'\u0214': 'U',
'\u0216': 'U',
'\u01AF': 'U',
'\u1EEA': 'U',
'\u1EE8': 'U',
'\u1EEE': 'U',
'\u1EEC': 'U',
'\u1EF0': 'U',
'\u1EE4': 'U',
'\u1E72': 'U',
'\u0172': 'U',
'\u1E76': 'U',
'\u1E74': 'U',
'\u0244': 'U',
'\u24CB': 'V',
'\uFF36': 'V',
'\u1E7C': 'V',
'\u1E7E': 'V',
'\u01B2': 'V',
'\uA75E': 'V',
'\u0245': 'V',
'\uA760': 'VY',
'\u24CC': 'W',
'\uFF37': 'W',
'\u1E80': 'W',
'\u1E82': 'W',
'\u0174': 'W',
'\u1E86': 'W',
'\u1E84': 'W',
'\u1E88': 'W',
'\u2C72': 'W',
'\u24CD': 'X',
'\uFF38': 'X',
'\u1E8A': 'X',
'\u1E8C': 'X',
'\u24CE': 'Y',
'\uFF39': 'Y',
'\u1EF2': 'Y',
'\u00DD': 'Y',
'\u0176': 'Y',
'\u1EF8': 'Y',
'\u0232': 'Y',
'\u1E8E': 'Y',
'\u0178': 'Y',
'\u1EF6': 'Y',
'\u1EF4': 'Y',
'\u01B3': 'Y',
'\u024E': 'Y',
'\u1EFE': 'Y',
'\u24CF': 'Z',
'\uFF3A': 'Z',
'\u0179': 'Z',
'\u1E90': 'Z',
'\u017B': 'Z',
'\u017D': 'Z',
'\u1E92': 'Z',
'\u1E94': 'Z',
'\u01B5': 'Z',
'\u0224': 'Z',
'\u2C7F': 'Z',
'\u2C6B': 'Z',
'\uA762': 'Z',
'\u24D0': 'a',
'\uFF41': 'a',
'\u1E9A': 'a',
'\u00E0': 'a',
'\u00E1': 'a',
'\u00E2': 'a',
'\u1EA7': 'a',
'\u1EA5': 'a',
'\u1EAB': 'a',
'\u1EA9': 'a',
'\u00E3': 'a',
'\u0101': 'a',
'\u0103': 'a',
'\u1EB1': 'a',
'\u1EAF': 'a',
'\u1EB5': 'a',
'\u1EB3': 'a',
'\u0227': 'a',
'\u01E1': 'a',
'\u00E4': 'a',
'\u01DF': 'a',
'\u1EA3': 'a',
'\u00E5': 'a',
'\u01FB': 'a',
'\u01CE': 'a',
'\u0201': 'a',
'\u0203': 'a',
'\u1EA1': 'a',
'\u1EAD': 'a',
'\u1EB7': 'a',
'\u1E01': 'a',
'\u0105': 'a',
'\u2C65': 'a',
'\u0250': 'a',
'\uA733': 'aa',
'\u00E6': 'ae',
'\u01FD': 'ae',
'\u01E3': 'ae',
'\uA735': 'ao',
'\uA737': 'au',
'\uA739': 'av',
'\uA73B': 'av',
'\uA73D': 'ay',
'\u24D1': 'b',
'\uFF42': 'b',
'\u1E03': 'b',
'\u1E05': 'b',
'\u1E07': 'b',
'\u0180': 'b',
'\u0183': 'b',
'\u0253': 'b',
'\u24D2': 'c',
'\uFF43': 'c',
'\u0107': 'c',
'\u0109': 'c',
'\u010B': 'c',
'\u010D': 'c',
'\u00E7': 'c',
'\u1E09': 'c',
'\u0188': 'c',
'\u023C': 'c',
'\uA73F': 'c',
'\u2184': 'c',
'\u24D3': 'd',
'\uFF44': 'd',
'\u1E0B': 'd',
'\u010F': 'd',
'\u1E0D': 'd',
'\u1E11': 'd',
'\u1E13': 'd',
'\u1E0F': 'd',
'\u0111': 'd',
'\u018C': 'd',
'\u0256': 'd',
'\u0257': 'd',
'\uA77A': 'd',
'\u01F3': 'dz',
'\u01C6': 'dz',
'\u24D4': 'e',
'\uFF45': 'e',
'\u00E8': 'e',
'\u00E9': 'e',
'\u00EA': 'e',
'\u1EC1': 'e',
'\u1EBF': 'e',
'\u1EC5': 'e',
'\u1EC3': 'e',
'\u1EBD': 'e',
'\u0113': 'e',
'\u1E15': 'e',
'\u1E17': 'e',
'\u0115': 'e',
'\u0117': 'e',
'\u00EB': 'e',
'\u1EBB': 'e',
'\u011B': 'e',
'\u0205': 'e',
'\u0207': 'e',
'\u1EB9': 'e',
'\u1EC7': 'e',
'\u0229': 'e',
'\u1E1D': 'e',
'\u0119': 'e',
'\u1E19': 'e',
'\u1E1B': 'e',
'\u0247': 'e',
'\u025B': 'e',
'\u01DD': 'e',
'\u24D5': 'f',
'\uFF46': 'f',
'\u1E1F': 'f',
'\u0192': 'f',
'\uA77C': 'f',
'\u24D6': 'g',
'\uFF47': 'g',
'\u01F5': 'g',
'\u011D': 'g',
'\u1E21': 'g',
'\u011F': 'g',
'\u0121': 'g',
'\u01E7': 'g',
'\u0123': 'g',
'\u01E5': 'g',
'\u0260': 'g',
'\uA7A1': 'g',
'\u1D79': 'g',
'\uA77F': 'g',
'\u24D7': 'h',
'\uFF48': 'h',
'\u0125': 'h',
'\u1E23': 'h',
'\u1E27': 'h',
'\u021F': 'h',
'\u1E25': 'h',
'\u1E29': 'h',
'\u1E2B': 'h',
'\u1E96': 'h',
'\u0127': 'h',
'\u2C68': 'h',
'\u2C76': 'h',
'\u0265': 'h',
'\u0195': 'hv',
'\u24D8': 'i',
'\uFF49': 'i',
'\u00EC': 'i',
'\u00ED': 'i',
'\u00EE': 'i',
'\u0129': 'i',
'\u012B': 'i',
'\u012D': 'i',
'\u00EF': 'i',
'\u1E2F': 'i',
'\u1EC9': 'i',
'\u01D0': 'i',
'\u0209': 'i',
'\u020B': 'i',
'\u1ECB': 'i',
'\u012F': 'i',
'\u1E2D': 'i',
'\u0268': 'i',
'\u0131': 'i',
'\u24D9': 'j',
'\uFF4A': 'j',
'\u0135': 'j',
'\u01F0': 'j',
'\u0249': 'j',
'\u24DA': 'k',
'\uFF4B': 'k',
'\u1E31': 'k',
'\u01E9': 'k',
'\u1E33': 'k',
'\u0137': 'k',
'\u1E35': 'k',
'\u0199': 'k',
'\u2C6A': 'k',
'\uA741': 'k',
'\uA743': 'k',
'\uA745': 'k',
'\uA7A3': 'k',
'\u24DB': 'l',
'\uFF4C': 'l',
'\u0140': 'l',
'\u013A': 'l',
'\u013E': 'l',
'\u1E37': 'l',
'\u1E39': 'l',
'\u013C': 'l',
'\u1E3D': 'l',
'\u1E3B': 'l',
'\u017F': 'l',
'\u0142': 'l',
'\u019A': 'l',
'\u026B': 'l',
'\u2C61': 'l',
'\uA749': 'l',
'\uA781': 'l',
'\uA747': 'l',
'\u01C9': 'lj',
'\u24DC': 'm',
'\uFF4D': 'm',
'\u1E3F': 'm',
'\u1E41': 'm',
'\u1E43': 'm',
'\u0271': 'm',
'\u026F': 'm',
'\u24DD': 'n',
'\uFF4E': 'n',
'\u01F9': 'n',
'\u0144': 'n',
'\u00F1': 'n',
'\u1E45': 'n',
'\u0148': 'n',
'\u1E47': 'n',
'\u0146': 'n',
'\u1E4B': 'n',
'\u1E49': 'n',
'\u019E': 'n',
'\u0272': 'n',
'\u0149': 'n',
'\uA791': 'n',
'\uA7A5': 'n',
'\u01CC': 'nj',
'\u24DE': 'o',
'\uFF4F': 'o',
'\u00F2': 'o',
'\u00F3': 'o',
'\u00F4': 'o',
'\u1ED3': 'o',
'\u1ED1': 'o',
'\u1ED7': 'o',
'\u1ED5': 'o',
'\u00F5': 'o',
'\u1E4D': 'o',
'\u022D': 'o',
'\u1E4F': 'o',
'\u014D': 'o',
'\u1E51': 'o',
'\u1E53': 'o',
'\u014F': 'o',
'\u022F': 'o',
'\u0231': 'o',
'\u00F6': 'o',
'\u022B': 'o',
'\u1ECF': 'o',
'\u0151': 'o',
'\u01D2': 'o',
'\u020D': 'o',
'\u020F': 'o',
'\u01A1': 'o',
'\u1EDD': 'o',
'\u1EDB': 'o',
'\u1EE1': 'o',
'\u1EDF': 'o',
'\u1EE3': 'o',
'\u1ECD': 'o',
'\u1ED9': 'o',
'\u01EB': 'o',
'\u01ED': 'o',
'\u00F8': 'o',
'\u01FF': 'o',
'\u0254': 'o',
'\uA74B': 'o',
'\uA74D': 'o',
'\u0275': 'o',
'\u01A3': 'oi',
'\u0223': 'ou',
'\uA74F': 'oo',
'\u24DF': 'p',
'\uFF50': 'p',
'\u1E55': 'p',
'\u1E57': 'p',
'\u01A5': 'p',
'\u1D7D': 'p',
'\uA751': 'p',
'\uA753': 'p',
'\uA755': 'p',
'\u24E0': 'q',
'\uFF51': 'q',
'\u024B': 'q',
'\uA757': 'q',
'\uA759': 'q',
'\u24E1': 'r',
'\uFF52': 'r',
'\u0155': 'r',
'\u1E59': 'r',
'\u0159': 'r',
'\u0211': 'r',
'\u0213': 'r',
'\u1E5B': 'r',
'\u1E5D': 'r',
'\u0157': 'r',
'\u1E5F': 'r',
'\u024D': 'r',
'\u027D': 'r',
'\uA75B': 'r',
'\uA7A7': 'r',
'\uA783': 'r',
'\u24E2': 's',
'\uFF53': 's',
'\u00DF': 's',
'\u015B': 's',
'\u1E65': 's',
'\u015D': 's',
'\u1E61': 's',
'\u0161': 's',
'\u1E67': 's',
'\u1E63': 's',
'\u1E69': 's',
'\u0219': 's',
'\u015F': 's',
'\u023F': 's',
'\uA7A9': 's',
'\uA785': 's',
'\u1E9B': 's',
'\u24E3': 't',
'\uFF54': 't',
'\u1E6B': 't',
'\u1E97': 't',
'\u0165': 't',
'\u1E6D': 't',
'\u021B': 't',
'\u0163': 't',
'\u1E71': 't',
'\u1E6F': 't',
'\u0167': 't',
'\u01AD': 't',
'\u0288': 't',
'\u2C66': 't',
'\uA787': 't',
'\uA729': 'tz',
'\u24E4': 'u',
'\uFF55': 'u',
'\u00F9': 'u',
'\u00FA': 'u',
'\u00FB': 'u',
'\u0169': 'u',
'\u1E79': 'u',
'\u016B': 'u',
'\u1E7B': 'u',
'\u016D': 'u',
'\u00FC': 'u',
'\u01DC': 'u',
'\u01D8': 'u',
'\u01D6': 'u',
'\u01DA': 'u',
'\u1EE7': 'u',
'\u016F': 'u',
'\u0171': 'u',
'\u01D4': 'u',
'\u0215': 'u',
'\u0217': 'u',
'\u01B0': 'u',
'\u1EEB': 'u',
'\u1EE9': 'u',
'\u1EEF': 'u',
'\u1EED': 'u',
'\u1EF1': 'u',
'\u1EE5': 'u',
'\u1E73': 'u',
'\u0173': 'u',
'\u1E77': 'u',
'\u1E75': 'u',
'\u0289': 'u',
'\u24E5': 'v',
'\uFF56': 'v',
'\u1E7D': 'v',
'\u1E7F': 'v',
'\u028B': 'v',
'\uA75F': 'v',
'\u028C': 'v',
'\uA761': 'vy',
'\u24E6': 'w',
'\uFF57': 'w',
'\u1E81': 'w',
'\u1E83': 'w',
'\u0175': 'w',
'\u1E87': 'w',
'\u1E85': 'w',
'\u1E98': 'w',
'\u1E89': 'w',
'\u2C73': 'w',
'\u24E7': 'x',
'\uFF58': 'x',
'\u1E8B': 'x',
'\u1E8D': 'x',
'\u24E8': 'y',
'\uFF59': 'y',
'\u1EF3': 'y',
'\u00FD': 'y',
'\u0177': 'y',
'\u1EF9': 'y',
'\u0233': 'y',
'\u1E8F': 'y',
'\u00FF': 'y',
'\u1EF7': 'y',
'\u1E99': 'y',
'\u1EF5': 'y',
'\u01B4': 'y',
'\u024F': 'y',
'\u1EFF': 'y',
'\u24E9': 'z',
'\uFF5A': 'z',
'\u017A': 'z',
'\u1E91': 'z',
'\u017C': 'z',
'\u017E': 'z',
'\u1E93': 'z',
'\u1E95': 'z',
'\u01B6': 'z',
'\u0225': 'z',
'\u0240': 'z',
'\u2C6C': 'z',
'\uA763': 'z',
'\u0386': '\u0391',
'\u0388': '\u0395',
'\u0389': '\u0397',
'\u038A': '\u0399',
'\u03AA': '\u0399',
'\u038C': '\u039F',
'\u038E': '\u03A5',
'\u03AB': '\u03A5',
'\u038F': '\u03A9',
'\u03AC': '\u03B1',
'\u03AD': '\u03B5',
'\u03AE': '\u03B7',
'\u03AF': '\u03B9',
'\u03CA': '\u03B9',
'\u0390': '\u03B9',
'\u03CC': '\u03BF',
'\u03CD': '\u03C5',
'\u03CB': '\u03C5',
'\u03B0': '\u03C5',
'\u03C9': '\u03C9',
'\u03C2': '\u03C3'
};
/**
* @param {?} text
* @return {?}
*/
function stripSpecialChars(text) {
/** @type {?} */
var match = (/**
* @param {?} a
* @return {?}
*/
function (a) {
return diacritics[a] || a;
});
return text.replace(/[^\u0000-\u007E]/g, match);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ItemsList = /** @class */ (function () {
function ItemsList(_ngSelect, _selectionModel) {
this._ngSelect = _ngSelect;
this._selectionModel = _selectionModel;
this._items = [];
this._filteredItems = [];
this._markedIndex = -1;
}
Object.defineProperty(ItemsList.prototype, "items", {
get: /**
* @return {?}
*/
function () {
return this._items;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "filteredItems", {
get: /**
* @return {?}
*/
function () {
return this._filteredItems;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "markedIndex", {
get: /**
* @return {?}
*/
function () {
return this._markedIndex;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "selectedItems", {
get: /**
* @return {?}
*/
function () {
return this._selectionModel.value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "markedItem", {
get: /**
* @return {?}
*/
function () {
return this._filteredItems[this._markedIndex];
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "noItemsToSelect", {
get: /**
* @return {?}
*/
function () {
return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "maxItemsSelected", {
get: /**
* @return {?}
*/
function () {
return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ItemsList.prototype, "lastSelectedItem", {
get: /**
* @return {?}
*/
function () {
/** @type {?} */
var i = this.selectedItems.length - 1;
for (; i >= 0; i--) {
/** @type {?} */
var item = this.selectedItems[i];
if (!item.disabled) {
return item;
}
}
return null;
},
enumerable: true,
configurable: true
});
/**
* @param {?} items
* @return {?}
*/
ItemsList.prototype.setItems = /**
* @param {?} items
* @return {?}
*/
function (items) {
var _this = this;
this._items = items.map((/**
* @param {?} item
* @param {?} index
* @return {?}
*/
function (item, index) { return _this.mapItem(item, index); }));
if (this._ngSelect.groupBy) {
this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
this._items = this._flatten(this._groups);
}
else {
this._groups = new Map();
this._groups.set(undefined, this._items);
}
this._filteredItems = __spread(this._items);
};
/**
* @param {?} item
* @return {?}
*/
ItemsList.prototype.select = /**
* @param {?} item
* @return {?}
*/
function (item) {
if (item.selected || this.maxItemsSelected) {
return;
}
/** @type {?} */
var multiple = this._ngSelect.multiple;
if (!multiple) {
this.clearSelected();
}
this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
if (this._ngSelect.hideSelected) {
this._hideSelected(item);
}
};
/**
* @param {?} item
* @return {?}
*/
ItemsList.prototype.unselect = /**
* @param {?} item
* @return {?}
*/
function (item) {
if (!item.selected) {
return;
}
this._selectionModel.unselect(item, this._ngSelect.multiple);
if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
this._showSelected(item);
}
};
/**
* @param {?} value
* @return {?}
*/
ItemsList.prototype.findItem = /**
* @param {?} value
* @return {?}
*/
function (value) {
var _this = this;
/** @type {?} */
var findBy;
if (this._ngSelect.compareWith) {
findBy = (/**
* @param {?} item
* @return {?}
*/
function (item) { return _this._ngSelect.compareWith(item.value, value); });
}
else if (this._ngSelect.bindValue) {
findBy = (/**
* @param {?} item
* @return {?}
*/
function (item) { return !item.children && _this.resolveNested(item.value, _this._ngSelect.bindValue) === value; });
}
else {
findBy = (/**
* @param {?} item
* @return {?}
*/
function (item) { return item.value === value ||
!item.children && item.label && item.label === _this.resolveNested(value, _this._ngSelect.bindLabel); });
}
return this._items.find((/**
* @param {?} item
* @return {?}
*/
function (item) { return findBy(item); }));
};
/**
* @param {?} item
* @return {?}
*/
ItemsList.prototype.addItem = /**
* @param {?} item
* @return {?}
*/
function (item) {
/** @type {?} */
var option = this.mapItem(item, this._items.length);
this._items.push(option);
this._filteredItems.push(option);
return option;
};
/**
* @param {?=} keepDisabled
* @return {?}
*/
ItemsList.prototype.clearSelected = /**
* @param {?=} keepDisabled
* @return {?}
*/
function (keepDisabled) {
if (keepDisabled === void 0) { keepDisabled = false; }
this._selectionModel.clear(keepDisabled);
this._items.forEach((/**
* @param {?} item
* @return {?}
*/
function (item) {
item.selected = keepDisabled && item.selected && item.disabled;
item.marked = false;
}));
if (this._ngSelect.hideSelected) {
this.resetFilteredItems();
}
};
/**
* @param {?} term
* @return {?}
*/
ItemsList.prototype.findByLabel = /**
* @param {?} term
* @return {?}
*/
function (term) {
term = stripSpecialChars(term).toLocaleLowerCase();
return this.filteredItems.find((/**
* @param {?} item
* @return {?}
*/
function (item) {
/** @type {?} */
var label = stripSpecialChars(item.label).toLocaleLowerCase();
return label.substr(0, term.length) === term;
}));
};
/**
* @param {?} term
* @return {?}
*/
ItemsList.prototype.filter = /**
* @param {?} term
* @return {?}
*/
function (term) {
var e_1, _a;
if (!term) {
this.resetFilteredItems();
return;
}
this._filteredItems = [];
term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
/** @type {?} */
var match = this._ngSelect.searchFn || this._defaultSearchFn;
/** @type {?} */
var hideSelected = this._ngSelect.hideSelected;
var _loop_1 = function (key) {
var e_2, _a, _b;
/** @type {?} */
var matchedItems = [];
try {
for (var _c = __values(this_1._groups.get(key)), _d = _c.next(); !_d.done; _d = _c.next()) {
var item = _d.value;
if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
continue;
}
/** @type {?} */
var searchItem = this_1._ngSelect.searchFn ? item.value : item;
if (match(term, searchItem)) {
matchedItems.push(item);
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_2) throw e_2.error; }
}
if (matchedItems.length > 0) {
var _e = __read(matchedItems.slice(-1), 1), last_1 = _e[0];
if (last_1.parent) {
/** @type {?} */
var head = this_1._items.find((/**
* @param {?} x
* @return {?}
*/
function (x) { return x === last_1.parent; }));
this_1._filteredItems.push(head);
}
(_b = this_1._filteredItems).push.apply(_b, __spread(matchedItems));
}
};
var this_1 = this;
try {
for (var _b = __values(Array.from(this._groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
var key = _c.value;
_loop_1(key);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
};
/**
* @return {?}
*/
ItemsList.prototype.resetFilteredItems = /**
* @return {?}
*/
function () {
if (this._filteredItems.length === this._items.length) {
return;
}
if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
this._filteredItems = this._items.filter((/**
* @param {?} x
* @return {?}
*/
function (x) { return !x.selected; }));
}
else {
this._filteredItems = this._items;
}
};
/**
* @return {?}
*/
ItemsList.prototype.unmarkItem = /**
* @return {?}
*/
function () {
this._markedIndex = -1;
};
/**
* @return {?}
*/
ItemsList.prototype.markNextItem = /**
* @return {?}
*/
function () {
this._stepToItem(+1);
};
/**
* @return {?}
*/
ItemsList.prototype.markPreviousItem = /**
* @return {?}
*/
function () {
this._stepToItem(-1);
};
/**
* @param {?} item
* @return {?}
*/
ItemsList.prototype.markItem = /**
* @param {?} item
* @return {?}
*/
function (item) {
this._markedIndex = this._filteredItems.indexOf(item);
};
/**
* @param {?=} markDefault
* @return {?}
*/
ItemsList.prototype.markSelectedOrDefault = /**
* @param {?=} markDefault
* @return {?}
*/
function (markDefault) {
if (this._filteredItems.length === 0) {
return;
}
/** @type {?} */
var lastMarkedIndex = this._getLastMarkedIndex();
if (lastMarkedIndex > -1) {
this._markedIndex = lastMarkedIndex;
}
else {
this._markedIndex = markDefault ? this.filteredItems.findIndex((/**
* @param {?} x
* @return {?}
*/
function (x) { return !x.disabled; })) : -1;
}
};
/**
* @param {?} option
* @param {?} key
* @return {?}
*/
ItemsList.prototype.resolveNested = /**
* @param {?} option
* @param {?} key
* @return {?}
*/
function (option, key) {
if (!isObject(option)) {
return option;
}
if (key.indexOf('.') === -1) {
return option[key];
}
else {
/** @type {?} */
var keys = key.split('.');
/** @type {?} */
var value = option;
for (var i = 0, len = keys.length; i < len; ++i) {
if (value == null) {
return null;
}
value = value[keys[i]];
}
return value;
}
};
/**
* @param {?} item
* @param {?} index
* @return {?}
*/
ItemsList.prototype.mapItem = /**
* @param {?} item
* @param {?} index
* @return {?}
*/
function (item, index) {
/** @type {?} */
var label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
/** @type {?} */
var value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
return {
index: index,
label: isDefined(label) ? label.toString() : '',
value: value,
disabled: item.disabled,
htmlId: this._ngSelect.dropdownId + "-" + index,
};
};
/**
* @return {?}
*/
ItemsList.prototype.mapSelectedItems = /**
* @return {?}
*/
function () {
var _this = this;
var e_3, _a;
/** @type {?} */
var multiple = this._ngSelect.multiple;
try {
for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
var selected = _c.value;
/** @type {?} */
var value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
/** @type {?} */
var item = isDefined(value) ? this.findItem(value) : null;
this._selectionModel.unselect(selected, multiple);
this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
if (this._ngSelect.hideSelected) {
this._filteredItems = this.filteredItems.filter((/**
* @param {?} x
* @return {?}
*/
function (x) { return _this.selectedItems.indexOf(x) === -1; }));
}
};
/**
* @private
* @param {?} item
* @return {?}
*/
ItemsList.prototype._showSelected = /**
* @private
* @param {?} item
* @return {?}
*/
function (item) {
var e_4, _a;
this._filteredItems.push(item);
if (item.parent) {
/** @type {?} */
var parent_1 = item.parent;
/** @type {?} */
var parentExists = this._filteredItems.find((/**
* @param {?} x
* @return {?}
*/
function (x) { return x === parent_1; }));
if (!parentExists) {
this._filteredItems.push(parent_1);
}
}
else if (item.children) {
try {
for (var _b = __values(item.children), _c = _b.next(); !_c.done; _c = _b.next()) {
var child = _c.value;
child.selected = false;
this._filteredItems.push(child);
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
}
this._filteredItems = __spread(this._filteredItems.sort((/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function (a, b) { return (a.index - b.index); })));
};
/**
* @private
* @param {?} item
* @return {?}
*/
ItemsList.prototype._hideSelected = /**
* @private
* @param {?} item
* @return {?}
*/
function (item) {
this._filteredItems = this._filteredItems.filter((/**
* @param {?} x
* @return {?}
*/
function (x) { return x !== item; }));
if (item.parent) {
/** @type {?} */
var children = item.parent.children;
if (children.every((/**
* @param {?} x
* @return {?}
*/
function (x) { return x.selected; }))) {
this._filteredItems = this._filteredItems.filter((/**
* @param {?} x
* @return {?}
*/
function (x) { return x !== item.parent; }));
}
}
else if (item.children) {
this._filteredItems = this.filteredItems.filter((/**
* @param {?} x
* @return {?}
*/
function (x) { return x.parent !== item; }));
}
};
/**
* @private
* @param {?} search
* @param {?} opt
* @return {?}
*/
ItemsList.prototype._defaultSearchFn = /**
* @private
* @param {?} search
* @param {?} opt
* @return {?}
*/
function (search, opt) {
/** @type {?} */
var label = stripSpecialChars(opt.label).toLocaleLowerCase();
return label.indexOf(search) > -1;
};
/**
* @private
* @param {?} steps
* @return {?}
*/
ItemsList.prototype._getNextItemIndex = /**
* @private
* @param {?} steps
* @return {?}
*/
function (steps) {
if (steps > 0) {
return (this._markedIndex === this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
}
return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
};
/**
* @private
* @param {?} steps
* @return {?}
*/
ItemsList.prototype._stepToItem = /**
* @private
* @param {?} steps
* @return {?}
*/
function (steps) {
if (this._filteredItems.length === 0 || this._filteredItems.every((/**
* @param {?} x
* @return {?}
*/
function (x) { return x.disabled; }))) {
return;
}
this._markedIndex = this._getNextItemIndex(steps);
if (this.markedItem.disabled) {
this._stepToItem(steps);
}
};
/**
* @private
* @return {?}
*/
ItemsList.prototype._getLastMarkedIndex = /**
* @private
* @return {?}
*/
function () {
if (this._ngSelect.hideSelected) {
return -1;
}
if (this._markedIndex > -1 && this.markedItem === undefined) {
return -1;
}
/** @type {?} */
var selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
if (this.lastSelectedItem && selectedIndex < 0) {
return -1;
}
return Math.max(this.markedIndex, selectedIndex);
};
/**
* @private
* @param {?} items
* @param {?} prop
* @return {?}
*/
ItemsList.prototype._groupBy = /**
* @private
* @param {?} items
* @param {?} prop
* @return {?}
*/
function (items, prop) {
var _this = this;
var e_5, _a, e_6, _b;
/** @type {?} */
var groups = new Map();
if (items.length === 0) {
return groups;
}
// Check if items are already grouped by given key.
if (Array.isArray(items[0].value[(/** @type {?} */ (prop))])) {
try {
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
var item = items_1_1.value;
/** @type {?} */
var children = (item.value[(/** @type {?} */ (prop))] || []).map((/**
* @param {?} x
* @param {?} index
* @return {?}
*/
function (x, index) { return _this.mapItem(x, index); }));
groups.set(item, children);
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
}
finally { if (e_5) throw e_5.error; }
}
return groups;
}
/** @type {?} */
var isFnKey = isFunction(this._ngSelect.groupBy);
/** @type {?} */
var keyFn = (/**
* @param {?} item
* @return {?}
*/
function (item) {
/** @type {?} */
var key = isFnKey ? ((/** @type {?} */ (prop)))(item.value) : item.value[(/** @type {?} */ (prop))];
return isDefined(key) ? key : undefined;
});
try {
// Group items by key.
for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
var item = items_2_1.value;
/** @type {?} */
var key = keyFn(item);
/** @type {?} */
var group = groups.get(key);
if (group) {
group.push(item);
}
else {
groups.set(key, [item]);
}
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (items_2_1 && !items_2_1.done && (_b = items_2.return)) _b.call(items_2);
}
finally { if (e_6) throw e_6.error; }
}
return groups;
};
/**
* @private
* @param {?} groups
* @return {?}
*/
ItemsList.prototype._flatten = /**
* @private
* @param {?} groups
* @return {?}
*/
function (groups) {
var e_7, _a;
/** @type {?} */
var isGroupByFn = isFunction(this._ngSelect.groupBy);
/** @type {?} */