@ng-select/ng-select 2.20.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +3 -3
  2. package/bundles/ng-select-ng-select.umd.js +4525 -0
  3. package/bundles/ng-select-ng-select.umd.js.map +1 -0
  4. package/bundles/ng-select-ng-select.umd.min.js +2 -0
  5. package/bundles/ng-select-ng-select.umd.min.js.map +1 -0
  6. package/esm2015/lib/config.service.js +40 -0
  7. package/esm2015/lib/console.service.js +20 -0
  8. package/esm2015/lib/id.js +21 -0
  9. package/esm2015/lib/items-list.js +661 -0
  10. package/esm2015/lib/ng-dropdown-panel.component.js +661 -0
  11. package/esm2015/lib/ng-dropdown-panel.service.js +127 -0
  12. package/esm2015/lib/ng-option.component.js +74 -0
  13. package/esm2015/lib/ng-select.component.js +1384 -0
  14. package/esm2015/lib/ng-select.module.js +57 -0
  15. package/esm2015/lib/ng-select.types.js +48 -0
  16. package/esm2015/{ng-select → lib}/ng-templates.directive.js +2 -3
  17. package/esm2015/lib/search-helper.js +862 -0
  18. package/esm2015/lib/selection-model.js +166 -0
  19. package/esm2015/lib/value-utils.js +33 -0
  20. package/esm2015/ng-select-ng-select.js +15 -0
  21. package/esm2015/public-api.js +11 -0
  22. package/esm5/lib/config.service.js +42 -0
  23. package/esm5/lib/console.service.js +28 -0
  24. package/esm5/lib/id.js +21 -0
  25. package/esm5/lib/items-list.js +888 -0
  26. package/esm5/lib/ng-dropdown-panel.component.js +770 -0
  27. package/esm5/lib/ng-dropdown-panel.service.js +150 -0
  28. package/esm5/lib/ng-option.component.js +86 -0
  29. package/esm5/lib/ng-select.component.js +1637 -0
  30. package/esm5/lib/ng-select.module.js +61 -0
  31. package/esm5/lib/ng-select.types.js +48 -0
  32. package/esm5/{ng-select → lib}/ng-templates.directive.js +2 -3
  33. package/esm5/lib/search-helper.js +862 -0
  34. package/esm5/{ng-select → lib}/selection-model.js +69 -22
  35. package/esm5/lib/value-utils.js +33 -0
  36. package/esm5/ng-select-ng-select.js +15 -0
  37. package/esm5/public-api.js +11 -0
  38. package/fesm2015/ng-select-ng-select.js +3804 -0
  39. package/fesm2015/ng-select-ng-select.js.map +1 -0
  40. package/fesm5/ng-select-ng-select.js +4442 -0
  41. package/fesm5/ng-select-ng-select.js.map +1 -0
  42. package/{ng-select → lib}/config.service.d.ts +0 -0
  43. package/{ng-select → lib}/console.service.d.ts +0 -0
  44. package/{ng-select → lib}/id.d.ts +0 -0
  45. package/{ng-select → lib}/items-list.d.ts +1 -1
  46. package/{ng-select → lib}/ng-dropdown-panel.component.d.ts +0 -0
  47. package/{ng-select → lib}/ng-dropdown-panel.service.d.ts +0 -0
  48. package/{ng-select → lib}/ng-option.component.d.ts +0 -0
  49. package/{ng-select → lib}/ng-select.component.d.ts +9 -9
  50. package/{ng-select → lib}/ng-select.module.d.ts +0 -0
  51. package/{ng-select → lib}/ng-select.types.d.ts +0 -0
  52. package/{ng-select → lib}/ng-templates.directive.d.ts +0 -0
  53. package/{ng-select → lib}/search-helper.d.ts +0 -0
  54. package/{ng-select → lib}/selection-model.d.ts +0 -0
  55. package/{ng-select → lib}/value-utils.d.ts +0 -0
  56. package/ng-select-ng-select.d.ts +10 -0
  57. package/ng-select-ng-select.metadata.json +1 -0
  58. package/package.json +13 -14
  59. package/public-api.d.ts +5 -0
  60. package/scss/material.theme.scss +1 -1
  61. package/themes/material.theme.css +1 -1
  62. package/bundles/ng-select.umd.js +0 -4283
  63. package/bundles/ng-select.umd.js.map +0 -1
  64. package/bundles/ng-select.umd.min.js +0 -2
  65. package/bundles/ng-select.umd.min.js.map +0 -1
  66. package/esm2015/index.js +0 -9
  67. package/esm2015/ng-select/config.service.js +0 -41
  68. package/esm2015/ng-select/console.service.js +0 -21
  69. package/esm2015/ng-select/id.js +0 -17
  70. package/esm2015/ng-select/items-list.js +0 -542
  71. package/esm2015/ng-select/ng-dropdown-panel.component.js +0 -562
  72. package/esm2015/ng-select/ng-dropdown-panel.service.js +0 -121
  73. package/esm2015/ng-select/ng-option-highlight.directive.js +0 -98
  74. package/esm2015/ng-select/ng-option.component.js +0 -71
  75. package/esm2015/ng-select/ng-select.component.js +0 -1214
  76. package/esm2015/ng-select/ng-select.module.js +0 -61
  77. package/esm2015/ng-select/ng-select.types.js +0 -49
  78. package/esm2015/ng-select/search-helper.js +0 -859
  79. package/esm2015/ng-select/selection-model.js +0 -122
  80. package/esm2015/ng-select/value-utils.js +0 -34
  81. package/esm2015/ng-select.js +0 -17
  82. package/esm5/index.js +0 -9
  83. package/esm5/ng-select/config.service.js +0 -43
  84. package/esm5/ng-select/console.service.js +0 -29
  85. package/esm5/ng-select/id.js +0 -17
  86. package/esm5/ng-select/items-list.js +0 -761
  87. package/esm5/ng-select/ng-dropdown-panel.component.js +0 -654
  88. package/esm5/ng-select/ng-dropdown-panel.service.js +0 -144
  89. package/esm5/ng-select/ng-option-highlight.directive.js +0 -113
  90. package/esm5/ng-select/ng-option.component.js +0 -82
  91. package/esm5/ng-select/ng-select.component.js +0 -1430
  92. package/esm5/ng-select/ng-select.module.js +0 -65
  93. package/esm5/ng-select/ng-select.types.js +0 -49
  94. package/esm5/ng-select/search-helper.js +0 -859
  95. package/esm5/ng-select/value-utils.js +0 -34
  96. package/esm5/ng-select.js +0 -17
  97. package/fesm2015/ng-select.js +0 -3559
  98. package/fesm2015/ng-select.js.map +0 -1
  99. package/fesm5/ng-select.js +0 -4145
  100. package/fesm5/ng-select.js.map +0 -1
  101. package/index.d.ts +0 -5
  102. package/ng-select/ng-option-highlight.directive.d.ts +0 -14
  103. package/ng-select.d.ts +0 -11
  104. package/ng-select.metadata.json +0 -1
@@ -0,0 +1,4442 @@
1
+ import { __spread, __values, __read, __assign } from 'tslib';
2
+ import { Directive, TemplateRef, Injectable, ɵɵdefineInjectable, Component, ChangeDetectionStrategy, ViewEncapsulation, Renderer2, NgZone, ElementRef, Optional, Inject, Input, Output, ViewChild, HostListener, EventEmitter, InjectionToken, forwardRef, Attribute, ChangeDetectorRef, HostBinding, ContentChild, ContentChildren, NgModule } from '@angular/core';
3
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
+ import { takeUntil, auditTime, startWith, tap, debounceTime, filter, map } from 'rxjs/operators';
5
+ import { fromEvent, merge, animationFrameScheduler, asapScheduler, Subject } from 'rxjs';
6
+ import { DOCUMENT, CommonModule } from '@angular/common';
7
+
8
+ /**
9
+ * @fileoverview added by tsickle
10
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
11
+ */
12
+ var NgOptionTemplateDirective = /** @class */ (function () {
13
+ function NgOptionTemplateDirective(template) {
14
+ this.template = template;
15
+ }
16
+ NgOptionTemplateDirective.decorators = [
17
+ { type: Directive, args: [{ selector: '[ng-option-tmp]' },] }
18
+ ];
19
+ /** @nocollapse */
20
+ NgOptionTemplateDirective.ctorParameters = function () { return [
21
+ { type: TemplateRef }
22
+ ]; };
23
+ return NgOptionTemplateDirective;
24
+ }());
25
+ var NgOptgroupTemplateDirective = /** @class */ (function () {
26
+ function NgOptgroupTemplateDirective(template) {
27
+ this.template = template;
28
+ }
29
+ NgOptgroupTemplateDirective.decorators = [
30
+ { type: Directive, args: [{ selector: '[ng-optgroup-tmp]' },] }
31
+ ];
32
+ /** @nocollapse */
33
+ NgOptgroupTemplateDirective.ctorParameters = function () { return [
34
+ { type: TemplateRef }
35
+ ]; };
36
+ return NgOptgroupTemplateDirective;
37
+ }());
38
+ var NgLabelTemplateDirective = /** @class */ (function () {
39
+ function NgLabelTemplateDirective(template) {
40
+ this.template = template;
41
+ }
42
+ NgLabelTemplateDirective.decorators = [
43
+ { type: Directive, args: [{ selector: '[ng-label-tmp]' },] }
44
+ ];
45
+ /** @nocollapse */
46
+ NgLabelTemplateDirective.ctorParameters = function () { return [
47
+ { type: TemplateRef }
48
+ ]; };
49
+ return NgLabelTemplateDirective;
50
+ }());
51
+ var NgMultiLabelTemplateDirective = /** @class */ (function () {
52
+ function NgMultiLabelTemplateDirective(template) {
53
+ this.template = template;
54
+ }
55
+ NgMultiLabelTemplateDirective.decorators = [
56
+ { type: Directive, args: [{ selector: '[ng-multi-label-tmp]' },] }
57
+ ];
58
+ /** @nocollapse */
59
+ NgMultiLabelTemplateDirective.ctorParameters = function () { return [
60
+ { type: TemplateRef }
61
+ ]; };
62
+ return NgMultiLabelTemplateDirective;
63
+ }());
64
+ var NgHeaderTemplateDirective = /** @class */ (function () {
65
+ function NgHeaderTemplateDirective(template) {
66
+ this.template = template;
67
+ }
68
+ NgHeaderTemplateDirective.decorators = [
69
+ { type: Directive, args: [{ selector: '[ng-header-tmp]' },] }
70
+ ];
71
+ /** @nocollapse */
72
+ NgHeaderTemplateDirective.ctorParameters = function () { return [
73
+ { type: TemplateRef }
74
+ ]; };
75
+ return NgHeaderTemplateDirective;
76
+ }());
77
+ var NgFooterTemplateDirective = /** @class */ (function () {
78
+ function NgFooterTemplateDirective(template) {
79
+ this.template = template;
80
+ }
81
+ NgFooterTemplateDirective.decorators = [
82
+ { type: Directive, args: [{ selector: '[ng-footer-tmp]' },] }
83
+ ];
84
+ /** @nocollapse */
85
+ NgFooterTemplateDirective.ctorParameters = function () { return [
86
+ { type: TemplateRef }
87
+ ]; };
88
+ return NgFooterTemplateDirective;
89
+ }());
90
+ var NgNotFoundTemplateDirective = /** @class */ (function () {
91
+ function NgNotFoundTemplateDirective(template) {
92
+ this.template = template;
93
+ }
94
+ NgNotFoundTemplateDirective.decorators = [
95
+ { type: Directive, args: [{ selector: '[ng-notfound-tmp]' },] }
96
+ ];
97
+ /** @nocollapse */
98
+ NgNotFoundTemplateDirective.ctorParameters = function () { return [
99
+ { type: TemplateRef }
100
+ ]; };
101
+ return NgNotFoundTemplateDirective;
102
+ }());
103
+ var NgTypeToSearchTemplateDirective = /** @class */ (function () {
104
+ function NgTypeToSearchTemplateDirective(template) {
105
+ this.template = template;
106
+ }
107
+ NgTypeToSearchTemplateDirective.decorators = [
108
+ { type: Directive, args: [{ selector: '[ng-typetosearch-tmp]' },] }
109
+ ];
110
+ /** @nocollapse */
111
+ NgTypeToSearchTemplateDirective.ctorParameters = function () { return [
112
+ { type: TemplateRef }
113
+ ]; };
114
+ return NgTypeToSearchTemplateDirective;
115
+ }());
116
+ var NgLoadingTextTemplateDirective = /** @class */ (function () {
117
+ function NgLoadingTextTemplateDirective(template) {
118
+ this.template = template;
119
+ }
120
+ NgLoadingTextTemplateDirective.decorators = [
121
+ { type: Directive, args: [{ selector: '[ng-loadingtext-tmp]' },] }
122
+ ];
123
+ /** @nocollapse */
124
+ NgLoadingTextTemplateDirective.ctorParameters = function () { return [
125
+ { type: TemplateRef }
126
+ ]; };
127
+ return NgLoadingTextTemplateDirective;
128
+ }());
129
+ var NgTagTemplateDirective = /** @class */ (function () {
130
+ function NgTagTemplateDirective(template) {
131
+ this.template = template;
132
+ }
133
+ NgTagTemplateDirective.decorators = [
134
+ { type: Directive, args: [{ selector: '[ng-tag-tmp]' },] }
135
+ ];
136
+ /** @nocollapse */
137
+ NgTagTemplateDirective.ctorParameters = function () { return [
138
+ { type: TemplateRef }
139
+ ]; };
140
+ return NgTagTemplateDirective;
141
+ }());
142
+ var NgLoadingSpinnerTemplateDirective = /** @class */ (function () {
143
+ function NgLoadingSpinnerTemplateDirective(template) {
144
+ this.template = template;
145
+ }
146
+ NgLoadingSpinnerTemplateDirective.decorators = [
147
+ { type: Directive, args: [{ selector: '[ng-loadingspinner-tmp]' },] }
148
+ ];
149
+ /** @nocollapse */
150
+ NgLoadingSpinnerTemplateDirective.ctorParameters = function () { return [
151
+ { type: TemplateRef }
152
+ ]; };
153
+ return NgLoadingSpinnerTemplateDirective;
154
+ }());
155
+
156
+ /**
157
+ * @fileoverview added by tsickle
158
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
159
+ */
160
+ var ConsoleService = /** @class */ (function () {
161
+ function ConsoleService() {
162
+ }
163
+ /**
164
+ * @param {?} message
165
+ * @return {?}
166
+ */
167
+ ConsoleService.prototype.warn = /**
168
+ * @param {?} message
169
+ * @return {?}
170
+ */
171
+ function (message) {
172
+ console.warn(message);
173
+ };
174
+ ConsoleService.decorators = [
175
+ { type: Injectable, args: [{ providedIn: 'root' },] }
176
+ ];
177
+ /** @nocollapse */ ConsoleService.ngInjectableDef = ɵɵdefineInjectable({ factory: function ConsoleService_Factory() { return new ConsoleService(); }, token: ConsoleService, providedIn: "root" });
178
+ return ConsoleService;
179
+ }());
180
+
181
+ /**
182
+ * @fileoverview added by tsickle
183
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
184
+ */
185
+ /**
186
+ * @param {?} value
187
+ * @return {?}
188
+ */
189
+ function isDefined(value) {
190
+ return value !== undefined && value !== null;
191
+ }
192
+ /**
193
+ * @param {?} value
194
+ * @return {?}
195
+ */
196
+ function isObject(value) {
197
+ return typeof value === 'object' && isDefined(value);
198
+ }
199
+ /**
200
+ * @param {?} value
201
+ * @return {?}
202
+ */
203
+ function isPromise(value) {
204
+ return value instanceof Promise;
205
+ }
206
+ /**
207
+ * @param {?} value
208
+ * @return {?}
209
+ */
210
+ function isFunction(value) {
211
+ return value instanceof Function;
212
+ }
213
+
214
+ /**
215
+ * @fileoverview added by tsickle
216
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
217
+ */
218
+ /**
219
+ * @return {?}
220
+ */
221
+ function newId() {
222
+ // First character is an 'a', it's good practice to tag id to begin with a letter
223
+ return 'axxxxxxxxxxx'.replace(/[x]/g, (/**
224
+ * @param {?} _
225
+ * @return {?}
226
+ */
227
+ function (_) {
228
+ // tslint:disable-next-line:no-bitwise
229
+ /** @type {?} */
230
+ var val = Math.random() * 16 | 0;
231
+ return val.toString(16);
232
+ }));
233
+ }
234
+
235
+ /**
236
+ * @fileoverview added by tsickle
237
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
238
+ */
239
+ /** @type {?} */
240
+ var diacritics = {
241
+ '\u24B6': 'A',
242
+ '\uFF21': 'A',
243
+ '\u00C0': 'A',
244
+ '\u00C1': 'A',
245
+ '\u00C2': 'A',
246
+ '\u1EA6': 'A',
247
+ '\u1EA4': 'A',
248
+ '\u1EAA': 'A',
249
+ '\u1EA8': 'A',
250
+ '\u00C3': 'A',
251
+ '\u0100': 'A',
252
+ '\u0102': 'A',
253
+ '\u1EB0': 'A',
254
+ '\u1EAE': 'A',
255
+ '\u1EB4': 'A',
256
+ '\u1EB2': 'A',
257
+ '\u0226': 'A',
258
+ '\u01E0': 'A',
259
+ '\u00C4': 'A',
260
+ '\u01DE': 'A',
261
+ '\u1EA2': 'A',
262
+ '\u00C5': 'A',
263
+ '\u01FA': 'A',
264
+ '\u01CD': 'A',
265
+ '\u0200': 'A',
266
+ '\u0202': 'A',
267
+ '\u1EA0': 'A',
268
+ '\u1EAC': 'A',
269
+ '\u1EB6': 'A',
270
+ '\u1E00': 'A',
271
+ '\u0104': 'A',
272
+ '\u023A': 'A',
273
+ '\u2C6F': 'A',
274
+ '\uA732': 'AA',
275
+ '\u00C6': 'AE',
276
+ '\u01FC': 'AE',
277
+ '\u01E2': 'AE',
278
+ '\uA734': 'AO',
279
+ '\uA736': 'AU',
280
+ '\uA738': 'AV',
281
+ '\uA73A': 'AV',
282
+ '\uA73C': 'AY',
283
+ '\u24B7': 'B',
284
+ '\uFF22': 'B',
285
+ '\u1E02': 'B',
286
+ '\u1E04': 'B',
287
+ '\u1E06': 'B',
288
+ '\u0243': 'B',
289
+ '\u0182': 'B',
290
+ '\u0181': 'B',
291
+ '\u24B8': 'C',
292
+ '\uFF23': 'C',
293
+ '\u0106': 'C',
294
+ '\u0108': 'C',
295
+ '\u010A': 'C',
296
+ '\u010C': 'C',
297
+ '\u00C7': 'C',
298
+ '\u1E08': 'C',
299
+ '\u0187': 'C',
300
+ '\u023B': 'C',
301
+ '\uA73E': 'C',
302
+ '\u24B9': 'D',
303
+ '\uFF24': 'D',
304
+ '\u1E0A': 'D',
305
+ '\u010E': 'D',
306
+ '\u1E0C': 'D',
307
+ '\u1E10': 'D',
308
+ '\u1E12': 'D',
309
+ '\u1E0E': 'D',
310
+ '\u0110': 'D',
311
+ '\u018B': 'D',
312
+ '\u018A': 'D',
313
+ '\u0189': 'D',
314
+ '\uA779': 'D',
315
+ '\u01F1': 'DZ',
316
+ '\u01C4': 'DZ',
317
+ '\u01F2': 'Dz',
318
+ '\u01C5': 'Dz',
319
+ '\u24BA': 'E',
320
+ '\uFF25': 'E',
321
+ '\u00C8': 'E',
322
+ '\u00C9': 'E',
323
+ '\u00CA': 'E',
324
+ '\u1EC0': 'E',
325
+ '\u1EBE': 'E',
326
+ '\u1EC4': 'E',
327
+ '\u1EC2': 'E',
328
+ '\u1EBC': 'E',
329
+ '\u0112': 'E',
330
+ '\u1E14': 'E',
331
+ '\u1E16': 'E',
332
+ '\u0114': 'E',
333
+ '\u0116': 'E',
334
+ '\u00CB': 'E',
335
+ '\u1EBA': 'E',
336
+ '\u011A': 'E',
337
+ '\u0204': 'E',
338
+ '\u0206': 'E',
339
+ '\u1EB8': 'E',
340
+ '\u1EC6': 'E',
341
+ '\u0228': 'E',
342
+ '\u1E1C': 'E',
343
+ '\u0118': 'E',
344
+ '\u1E18': 'E',
345
+ '\u1E1A': 'E',
346
+ '\u0190': 'E',
347
+ '\u018E': 'E',
348
+ '\u24BB': 'F',
349
+ '\uFF26': 'F',
350
+ '\u1E1E': 'F',
351
+ '\u0191': 'F',
352
+ '\uA77B': 'F',
353
+ '\u24BC': 'G',
354
+ '\uFF27': 'G',
355
+ '\u01F4': 'G',
356
+ '\u011C': 'G',
357
+ '\u1E20': 'G',
358
+ '\u011E': 'G',
359
+ '\u0120': 'G',
360
+ '\u01E6': 'G',
361
+ '\u0122': 'G',
362
+ '\u01E4': 'G',
363
+ '\u0193': 'G',
364
+ '\uA7A0': 'G',
365
+ '\uA77D': 'G',
366
+ '\uA77E': 'G',
367
+ '\u24BD': 'H',
368
+ '\uFF28': 'H',
369
+ '\u0124': 'H',
370
+ '\u1E22': 'H',
371
+ '\u1E26': 'H',
372
+ '\u021E': 'H',
373
+ '\u1E24': 'H',
374
+ '\u1E28': 'H',
375
+ '\u1E2A': 'H',
376
+ '\u0126': 'H',
377
+ '\u2C67': 'H',
378
+ '\u2C75': 'H',
379
+ '\uA78D': 'H',
380
+ '\u24BE': 'I',
381
+ '\uFF29': 'I',
382
+ '\u00CC': 'I',
383
+ '\u00CD': 'I',
384
+ '\u00CE': 'I',
385
+ '\u0128': 'I',
386
+ '\u012A': 'I',
387
+ '\u012C': 'I',
388
+ '\u0130': 'I',
389
+ '\u00CF': 'I',
390
+ '\u1E2E': 'I',
391
+ '\u1EC8': 'I',
392
+ '\u01CF': 'I',
393
+ '\u0208': 'I',
394
+ '\u020A': 'I',
395
+ '\u1ECA': 'I',
396
+ '\u012E': 'I',
397
+ '\u1E2C': 'I',
398
+ '\u0197': 'I',
399
+ '\u24BF': 'J',
400
+ '\uFF2A': 'J',
401
+ '\u0134': 'J',
402
+ '\u0248': 'J',
403
+ '\u24C0': 'K',
404
+ '\uFF2B': 'K',
405
+ '\u1E30': 'K',
406
+ '\u01E8': 'K',
407
+ '\u1E32': 'K',
408
+ '\u0136': 'K',
409
+ '\u1E34': 'K',
410
+ '\u0198': 'K',
411
+ '\u2C69': 'K',
412
+ '\uA740': 'K',
413
+ '\uA742': 'K',
414
+ '\uA744': 'K',
415
+ '\uA7A2': 'K',
416
+ '\u24C1': 'L',
417
+ '\uFF2C': 'L',
418
+ '\u013F': 'L',
419
+ '\u0139': 'L',
420
+ '\u013D': 'L',
421
+ '\u1E36': 'L',
422
+ '\u1E38': 'L',
423
+ '\u013B': 'L',
424
+ '\u1E3C': 'L',
425
+ '\u1E3A': 'L',
426
+ '\u0141': 'L',
427
+ '\u023D': 'L',
428
+ '\u2C62': 'L',
429
+ '\u2C60': 'L',
430
+ '\uA748': 'L',
431
+ '\uA746': 'L',
432
+ '\uA780': 'L',
433
+ '\u01C7': 'LJ',
434
+ '\u01C8': 'Lj',
435
+ '\u24C2': 'M',
436
+ '\uFF2D': 'M',
437
+ '\u1E3E': 'M',
438
+ '\u1E40': 'M',
439
+ '\u1E42': 'M',
440
+ '\u2C6E': 'M',
441
+ '\u019C': 'M',
442
+ '\u24C3': 'N',
443
+ '\uFF2E': 'N',
444
+ '\u01F8': 'N',
445
+ '\u0143': 'N',
446
+ '\u00D1': 'N',
447
+ '\u1E44': 'N',
448
+ '\u0147': 'N',
449
+ '\u1E46': 'N',
450
+ '\u0145': 'N',
451
+ '\u1E4A': 'N',
452
+ '\u1E48': 'N',
453
+ '\u0220': 'N',
454
+ '\u019D': 'N',
455
+ '\uA790': 'N',
456
+ '\uA7A4': 'N',
457
+ '\u01CA': 'NJ',
458
+ '\u01CB': 'Nj',
459
+ '\u24C4': 'O',
460
+ '\uFF2F': 'O',
461
+ '\u00D2': 'O',
462
+ '\u00D3': 'O',
463
+ '\u00D4': 'O',
464
+ '\u1ED2': 'O',
465
+ '\u1ED0': 'O',
466
+ '\u1ED6': 'O',
467
+ '\u1ED4': 'O',
468
+ '\u00D5': 'O',
469
+ '\u1E4C': 'O',
470
+ '\u022C': 'O',
471
+ '\u1E4E': 'O',
472
+ '\u014C': 'O',
473
+ '\u1E50': 'O',
474
+ '\u1E52': 'O',
475
+ '\u014E': 'O',
476
+ '\u022E': 'O',
477
+ '\u0230': 'O',
478
+ '\u00D6': 'O',
479
+ '\u022A': 'O',
480
+ '\u1ECE': 'O',
481
+ '\u0150': 'O',
482
+ '\u01D1': 'O',
483
+ '\u020C': 'O',
484
+ '\u020E': 'O',
485
+ '\u01A0': 'O',
486
+ '\u1EDC': 'O',
487
+ '\u1EDA': 'O',
488
+ '\u1EE0': 'O',
489
+ '\u1EDE': 'O',
490
+ '\u1EE2': 'O',
491
+ '\u1ECC': 'O',
492
+ '\u1ED8': 'O',
493
+ '\u01EA': 'O',
494
+ '\u01EC': 'O',
495
+ '\u00D8': 'O',
496
+ '\u01FE': 'O',
497
+ '\u0186': 'O',
498
+ '\u019F': 'O',
499
+ '\uA74A': 'O',
500
+ '\uA74C': 'O',
501
+ '\u01A2': 'OI',
502
+ '\uA74E': 'OO',
503
+ '\u0222': 'OU',
504
+ '\u24C5': 'P',
505
+ '\uFF30': 'P',
506
+ '\u1E54': 'P',
507
+ '\u1E56': 'P',
508
+ '\u01A4': 'P',
509
+ '\u2C63': 'P',
510
+ '\uA750': 'P',
511
+ '\uA752': 'P',
512
+ '\uA754': 'P',
513
+ '\u24C6': 'Q',
514
+ '\uFF31': 'Q',
515
+ '\uA756': 'Q',
516
+ '\uA758': 'Q',
517
+ '\u024A': 'Q',
518
+ '\u24C7': 'R',
519
+ '\uFF32': 'R',
520
+ '\u0154': 'R',
521
+ '\u1E58': 'R',
522
+ '\u0158': 'R',
523
+ '\u0210': 'R',
524
+ '\u0212': 'R',
525
+ '\u1E5A': 'R',
526
+ '\u1E5C': 'R',
527
+ '\u0156': 'R',
528
+ '\u1E5E': 'R',
529
+ '\u024C': 'R',
530
+ '\u2C64': 'R',
531
+ '\uA75A': 'R',
532
+ '\uA7A6': 'R',
533
+ '\uA782': 'R',
534
+ '\u24C8': 'S',
535
+ '\uFF33': 'S',
536
+ '\u1E9E': 'S',
537
+ '\u015A': 'S',
538
+ '\u1E64': 'S',
539
+ '\u015C': 'S',
540
+ '\u1E60': 'S',
541
+ '\u0160': 'S',
542
+ '\u1E66': 'S',
543
+ '\u1E62': 'S',
544
+ '\u1E68': 'S',
545
+ '\u0218': 'S',
546
+ '\u015E': 'S',
547
+ '\u2C7E': 'S',
548
+ '\uA7A8': 'S',
549
+ '\uA784': 'S',
550
+ '\u24C9': 'T',
551
+ '\uFF34': 'T',
552
+ '\u1E6A': 'T',
553
+ '\u0164': 'T',
554
+ '\u1E6C': 'T',
555
+ '\u021A': 'T',
556
+ '\u0162': 'T',
557
+ '\u1E70': 'T',
558
+ '\u1E6E': 'T',
559
+ '\u0166': 'T',
560
+ '\u01AC': 'T',
561
+ '\u01AE': 'T',
562
+ '\u023E': 'T',
563
+ '\uA786': 'T',
564
+ '\uA728': 'TZ',
565
+ '\u24CA': 'U',
566
+ '\uFF35': 'U',
567
+ '\u00D9': 'U',
568
+ '\u00DA': 'U',
569
+ '\u00DB': 'U',
570
+ '\u0168': 'U',
571
+ '\u1E78': 'U',
572
+ '\u016A': 'U',
573
+ '\u1E7A': 'U',
574
+ '\u016C': 'U',
575
+ '\u00DC': 'U',
576
+ '\u01DB': 'U',
577
+ '\u01D7': 'U',
578
+ '\u01D5': 'U',
579
+ '\u01D9': 'U',
580
+ '\u1EE6': 'U',
581
+ '\u016E': 'U',
582
+ '\u0170': 'U',
583
+ '\u01D3': 'U',
584
+ '\u0214': 'U',
585
+ '\u0216': 'U',
586
+ '\u01AF': 'U',
587
+ '\u1EEA': 'U',
588
+ '\u1EE8': 'U',
589
+ '\u1EEE': 'U',
590
+ '\u1EEC': 'U',
591
+ '\u1EF0': 'U',
592
+ '\u1EE4': 'U',
593
+ '\u1E72': 'U',
594
+ '\u0172': 'U',
595
+ '\u1E76': 'U',
596
+ '\u1E74': 'U',
597
+ '\u0244': 'U',
598
+ '\u24CB': 'V',
599
+ '\uFF36': 'V',
600
+ '\u1E7C': 'V',
601
+ '\u1E7E': 'V',
602
+ '\u01B2': 'V',
603
+ '\uA75E': 'V',
604
+ '\u0245': 'V',
605
+ '\uA760': 'VY',
606
+ '\u24CC': 'W',
607
+ '\uFF37': 'W',
608
+ '\u1E80': 'W',
609
+ '\u1E82': 'W',
610
+ '\u0174': 'W',
611
+ '\u1E86': 'W',
612
+ '\u1E84': 'W',
613
+ '\u1E88': 'W',
614
+ '\u2C72': 'W',
615
+ '\u24CD': 'X',
616
+ '\uFF38': 'X',
617
+ '\u1E8A': 'X',
618
+ '\u1E8C': 'X',
619
+ '\u24CE': 'Y',
620
+ '\uFF39': 'Y',
621
+ '\u1EF2': 'Y',
622
+ '\u00DD': 'Y',
623
+ '\u0176': 'Y',
624
+ '\u1EF8': 'Y',
625
+ '\u0232': 'Y',
626
+ '\u1E8E': 'Y',
627
+ '\u0178': 'Y',
628
+ '\u1EF6': 'Y',
629
+ '\u1EF4': 'Y',
630
+ '\u01B3': 'Y',
631
+ '\u024E': 'Y',
632
+ '\u1EFE': 'Y',
633
+ '\u24CF': 'Z',
634
+ '\uFF3A': 'Z',
635
+ '\u0179': 'Z',
636
+ '\u1E90': 'Z',
637
+ '\u017B': 'Z',
638
+ '\u017D': 'Z',
639
+ '\u1E92': 'Z',
640
+ '\u1E94': 'Z',
641
+ '\u01B5': 'Z',
642
+ '\u0224': 'Z',
643
+ '\u2C7F': 'Z',
644
+ '\u2C6B': 'Z',
645
+ '\uA762': 'Z',
646
+ '\u24D0': 'a',
647
+ '\uFF41': 'a',
648
+ '\u1E9A': 'a',
649
+ '\u00E0': 'a',
650
+ '\u00E1': 'a',
651
+ '\u00E2': 'a',
652
+ '\u1EA7': 'a',
653
+ '\u1EA5': 'a',
654
+ '\u1EAB': 'a',
655
+ '\u1EA9': 'a',
656
+ '\u00E3': 'a',
657
+ '\u0101': 'a',
658
+ '\u0103': 'a',
659
+ '\u1EB1': 'a',
660
+ '\u1EAF': 'a',
661
+ '\u1EB5': 'a',
662
+ '\u1EB3': 'a',
663
+ '\u0227': 'a',
664
+ '\u01E1': 'a',
665
+ '\u00E4': 'a',
666
+ '\u01DF': 'a',
667
+ '\u1EA3': 'a',
668
+ '\u00E5': 'a',
669
+ '\u01FB': 'a',
670
+ '\u01CE': 'a',
671
+ '\u0201': 'a',
672
+ '\u0203': 'a',
673
+ '\u1EA1': 'a',
674
+ '\u1EAD': 'a',
675
+ '\u1EB7': 'a',
676
+ '\u1E01': 'a',
677
+ '\u0105': 'a',
678
+ '\u2C65': 'a',
679
+ '\u0250': 'a',
680
+ '\uA733': 'aa',
681
+ '\u00E6': 'ae',
682
+ '\u01FD': 'ae',
683
+ '\u01E3': 'ae',
684
+ '\uA735': 'ao',
685
+ '\uA737': 'au',
686
+ '\uA739': 'av',
687
+ '\uA73B': 'av',
688
+ '\uA73D': 'ay',
689
+ '\u24D1': 'b',
690
+ '\uFF42': 'b',
691
+ '\u1E03': 'b',
692
+ '\u1E05': 'b',
693
+ '\u1E07': 'b',
694
+ '\u0180': 'b',
695
+ '\u0183': 'b',
696
+ '\u0253': 'b',
697
+ '\u24D2': 'c',
698
+ '\uFF43': 'c',
699
+ '\u0107': 'c',
700
+ '\u0109': 'c',
701
+ '\u010B': 'c',
702
+ '\u010D': 'c',
703
+ '\u00E7': 'c',
704
+ '\u1E09': 'c',
705
+ '\u0188': 'c',
706
+ '\u023C': 'c',
707
+ '\uA73F': 'c',
708
+ '\u2184': 'c',
709
+ '\u24D3': 'd',
710
+ '\uFF44': 'd',
711
+ '\u1E0B': 'd',
712
+ '\u010F': 'd',
713
+ '\u1E0D': 'd',
714
+ '\u1E11': 'd',
715
+ '\u1E13': 'd',
716
+ '\u1E0F': 'd',
717
+ '\u0111': 'd',
718
+ '\u018C': 'd',
719
+ '\u0256': 'd',
720
+ '\u0257': 'd',
721
+ '\uA77A': 'd',
722
+ '\u01F3': 'dz',
723
+ '\u01C6': 'dz',
724
+ '\u24D4': 'e',
725
+ '\uFF45': 'e',
726
+ '\u00E8': 'e',
727
+ '\u00E9': 'e',
728
+ '\u00EA': 'e',
729
+ '\u1EC1': 'e',
730
+ '\u1EBF': 'e',
731
+ '\u1EC5': 'e',
732
+ '\u1EC3': 'e',
733
+ '\u1EBD': 'e',
734
+ '\u0113': 'e',
735
+ '\u1E15': 'e',
736
+ '\u1E17': 'e',
737
+ '\u0115': 'e',
738
+ '\u0117': 'e',
739
+ '\u00EB': 'e',
740
+ '\u1EBB': 'e',
741
+ '\u011B': 'e',
742
+ '\u0205': 'e',
743
+ '\u0207': 'e',
744
+ '\u1EB9': 'e',
745
+ '\u1EC7': 'e',
746
+ '\u0229': 'e',
747
+ '\u1E1D': 'e',
748
+ '\u0119': 'e',
749
+ '\u1E19': 'e',
750
+ '\u1E1B': 'e',
751
+ '\u0247': 'e',
752
+ '\u025B': 'e',
753
+ '\u01DD': 'e',
754
+ '\u24D5': 'f',
755
+ '\uFF46': 'f',
756
+ '\u1E1F': 'f',
757
+ '\u0192': 'f',
758
+ '\uA77C': 'f',
759
+ '\u24D6': 'g',
760
+ '\uFF47': 'g',
761
+ '\u01F5': 'g',
762
+ '\u011D': 'g',
763
+ '\u1E21': 'g',
764
+ '\u011F': 'g',
765
+ '\u0121': 'g',
766
+ '\u01E7': 'g',
767
+ '\u0123': 'g',
768
+ '\u01E5': 'g',
769
+ '\u0260': 'g',
770
+ '\uA7A1': 'g',
771
+ '\u1D79': 'g',
772
+ '\uA77F': 'g',
773
+ '\u24D7': 'h',
774
+ '\uFF48': 'h',
775
+ '\u0125': 'h',
776
+ '\u1E23': 'h',
777
+ '\u1E27': 'h',
778
+ '\u021F': 'h',
779
+ '\u1E25': 'h',
780
+ '\u1E29': 'h',
781
+ '\u1E2B': 'h',
782
+ '\u1E96': 'h',
783
+ '\u0127': 'h',
784
+ '\u2C68': 'h',
785
+ '\u2C76': 'h',
786
+ '\u0265': 'h',
787
+ '\u0195': 'hv',
788
+ '\u24D8': 'i',
789
+ '\uFF49': 'i',
790
+ '\u00EC': 'i',
791
+ '\u00ED': 'i',
792
+ '\u00EE': 'i',
793
+ '\u0129': 'i',
794
+ '\u012B': 'i',
795
+ '\u012D': 'i',
796
+ '\u00EF': 'i',
797
+ '\u1E2F': 'i',
798
+ '\u1EC9': 'i',
799
+ '\u01D0': 'i',
800
+ '\u0209': 'i',
801
+ '\u020B': 'i',
802
+ '\u1ECB': 'i',
803
+ '\u012F': 'i',
804
+ '\u1E2D': 'i',
805
+ '\u0268': 'i',
806
+ '\u0131': 'i',
807
+ '\u24D9': 'j',
808
+ '\uFF4A': 'j',
809
+ '\u0135': 'j',
810
+ '\u01F0': 'j',
811
+ '\u0249': 'j',
812
+ '\u24DA': 'k',
813
+ '\uFF4B': 'k',
814
+ '\u1E31': 'k',
815
+ '\u01E9': 'k',
816
+ '\u1E33': 'k',
817
+ '\u0137': 'k',
818
+ '\u1E35': 'k',
819
+ '\u0199': 'k',
820
+ '\u2C6A': 'k',
821
+ '\uA741': 'k',
822
+ '\uA743': 'k',
823
+ '\uA745': 'k',
824
+ '\uA7A3': 'k',
825
+ '\u24DB': 'l',
826
+ '\uFF4C': 'l',
827
+ '\u0140': 'l',
828
+ '\u013A': 'l',
829
+ '\u013E': 'l',
830
+ '\u1E37': 'l',
831
+ '\u1E39': 'l',
832
+ '\u013C': 'l',
833
+ '\u1E3D': 'l',
834
+ '\u1E3B': 'l',
835
+ '\u017F': 'l',
836
+ '\u0142': 'l',
837
+ '\u019A': 'l',
838
+ '\u026B': 'l',
839
+ '\u2C61': 'l',
840
+ '\uA749': 'l',
841
+ '\uA781': 'l',
842
+ '\uA747': 'l',
843
+ '\u01C9': 'lj',
844
+ '\u24DC': 'm',
845
+ '\uFF4D': 'm',
846
+ '\u1E3F': 'm',
847
+ '\u1E41': 'm',
848
+ '\u1E43': 'm',
849
+ '\u0271': 'm',
850
+ '\u026F': 'm',
851
+ '\u24DD': 'n',
852
+ '\uFF4E': 'n',
853
+ '\u01F9': 'n',
854
+ '\u0144': 'n',
855
+ '\u00F1': 'n',
856
+ '\u1E45': 'n',
857
+ '\u0148': 'n',
858
+ '\u1E47': 'n',
859
+ '\u0146': 'n',
860
+ '\u1E4B': 'n',
861
+ '\u1E49': 'n',
862
+ '\u019E': 'n',
863
+ '\u0272': 'n',
864
+ '\u0149': 'n',
865
+ '\uA791': 'n',
866
+ '\uA7A5': 'n',
867
+ '\u01CC': 'nj',
868
+ '\u24DE': 'o',
869
+ '\uFF4F': 'o',
870
+ '\u00F2': 'o',
871
+ '\u00F3': 'o',
872
+ '\u00F4': 'o',
873
+ '\u1ED3': 'o',
874
+ '\u1ED1': 'o',
875
+ '\u1ED7': 'o',
876
+ '\u1ED5': 'o',
877
+ '\u00F5': 'o',
878
+ '\u1E4D': 'o',
879
+ '\u022D': 'o',
880
+ '\u1E4F': 'o',
881
+ '\u014D': 'o',
882
+ '\u1E51': 'o',
883
+ '\u1E53': 'o',
884
+ '\u014F': 'o',
885
+ '\u022F': 'o',
886
+ '\u0231': 'o',
887
+ '\u00F6': 'o',
888
+ '\u022B': 'o',
889
+ '\u1ECF': 'o',
890
+ '\u0151': 'o',
891
+ '\u01D2': 'o',
892
+ '\u020D': 'o',
893
+ '\u020F': 'o',
894
+ '\u01A1': 'o',
895
+ '\u1EDD': 'o',
896
+ '\u1EDB': 'o',
897
+ '\u1EE1': 'o',
898
+ '\u1EDF': 'o',
899
+ '\u1EE3': 'o',
900
+ '\u1ECD': 'o',
901
+ '\u1ED9': 'o',
902
+ '\u01EB': 'o',
903
+ '\u01ED': 'o',
904
+ '\u00F8': 'o',
905
+ '\u01FF': 'o',
906
+ '\u0254': 'o',
907
+ '\uA74B': 'o',
908
+ '\uA74D': 'o',
909
+ '\u0275': 'o',
910
+ '\u01A3': 'oi',
911
+ '\u0223': 'ou',
912
+ '\uA74F': 'oo',
913
+ '\u24DF': 'p',
914
+ '\uFF50': 'p',
915
+ '\u1E55': 'p',
916
+ '\u1E57': 'p',
917
+ '\u01A5': 'p',
918
+ '\u1D7D': 'p',
919
+ '\uA751': 'p',
920
+ '\uA753': 'p',
921
+ '\uA755': 'p',
922
+ '\u24E0': 'q',
923
+ '\uFF51': 'q',
924
+ '\u024B': 'q',
925
+ '\uA757': 'q',
926
+ '\uA759': 'q',
927
+ '\u24E1': 'r',
928
+ '\uFF52': 'r',
929
+ '\u0155': 'r',
930
+ '\u1E59': 'r',
931
+ '\u0159': 'r',
932
+ '\u0211': 'r',
933
+ '\u0213': 'r',
934
+ '\u1E5B': 'r',
935
+ '\u1E5D': 'r',
936
+ '\u0157': 'r',
937
+ '\u1E5F': 'r',
938
+ '\u024D': 'r',
939
+ '\u027D': 'r',
940
+ '\uA75B': 'r',
941
+ '\uA7A7': 'r',
942
+ '\uA783': 'r',
943
+ '\u24E2': 's',
944
+ '\uFF53': 's',
945
+ '\u00DF': 's',
946
+ '\u015B': 's',
947
+ '\u1E65': 's',
948
+ '\u015D': 's',
949
+ '\u1E61': 's',
950
+ '\u0161': 's',
951
+ '\u1E67': 's',
952
+ '\u1E63': 's',
953
+ '\u1E69': 's',
954
+ '\u0219': 's',
955
+ '\u015F': 's',
956
+ '\u023F': 's',
957
+ '\uA7A9': 's',
958
+ '\uA785': 's',
959
+ '\u1E9B': 's',
960
+ '\u24E3': 't',
961
+ '\uFF54': 't',
962
+ '\u1E6B': 't',
963
+ '\u1E97': 't',
964
+ '\u0165': 't',
965
+ '\u1E6D': 't',
966
+ '\u021B': 't',
967
+ '\u0163': 't',
968
+ '\u1E71': 't',
969
+ '\u1E6F': 't',
970
+ '\u0167': 't',
971
+ '\u01AD': 't',
972
+ '\u0288': 't',
973
+ '\u2C66': 't',
974
+ '\uA787': 't',
975
+ '\uA729': 'tz',
976
+ '\u24E4': 'u',
977
+ '\uFF55': 'u',
978
+ '\u00F9': 'u',
979
+ '\u00FA': 'u',
980
+ '\u00FB': 'u',
981
+ '\u0169': 'u',
982
+ '\u1E79': 'u',
983
+ '\u016B': 'u',
984
+ '\u1E7B': 'u',
985
+ '\u016D': 'u',
986
+ '\u00FC': 'u',
987
+ '\u01DC': 'u',
988
+ '\u01D8': 'u',
989
+ '\u01D6': 'u',
990
+ '\u01DA': 'u',
991
+ '\u1EE7': 'u',
992
+ '\u016F': 'u',
993
+ '\u0171': 'u',
994
+ '\u01D4': 'u',
995
+ '\u0215': 'u',
996
+ '\u0217': 'u',
997
+ '\u01B0': 'u',
998
+ '\u1EEB': 'u',
999
+ '\u1EE9': 'u',
1000
+ '\u1EEF': 'u',
1001
+ '\u1EED': 'u',
1002
+ '\u1EF1': 'u',
1003
+ '\u1EE5': 'u',
1004
+ '\u1E73': 'u',
1005
+ '\u0173': 'u',
1006
+ '\u1E77': 'u',
1007
+ '\u1E75': 'u',
1008
+ '\u0289': 'u',
1009
+ '\u24E5': 'v',
1010
+ '\uFF56': 'v',
1011
+ '\u1E7D': 'v',
1012
+ '\u1E7F': 'v',
1013
+ '\u028B': 'v',
1014
+ '\uA75F': 'v',
1015
+ '\u028C': 'v',
1016
+ '\uA761': 'vy',
1017
+ '\u24E6': 'w',
1018
+ '\uFF57': 'w',
1019
+ '\u1E81': 'w',
1020
+ '\u1E83': 'w',
1021
+ '\u0175': 'w',
1022
+ '\u1E87': 'w',
1023
+ '\u1E85': 'w',
1024
+ '\u1E98': 'w',
1025
+ '\u1E89': 'w',
1026
+ '\u2C73': 'w',
1027
+ '\u24E7': 'x',
1028
+ '\uFF58': 'x',
1029
+ '\u1E8B': 'x',
1030
+ '\u1E8D': 'x',
1031
+ '\u24E8': 'y',
1032
+ '\uFF59': 'y',
1033
+ '\u1EF3': 'y',
1034
+ '\u00FD': 'y',
1035
+ '\u0177': 'y',
1036
+ '\u1EF9': 'y',
1037
+ '\u0233': 'y',
1038
+ '\u1E8F': 'y',
1039
+ '\u00FF': 'y',
1040
+ '\u1EF7': 'y',
1041
+ '\u1E99': 'y',
1042
+ '\u1EF5': 'y',
1043
+ '\u01B4': 'y',
1044
+ '\u024F': 'y',
1045
+ '\u1EFF': 'y',
1046
+ '\u24E9': 'z',
1047
+ '\uFF5A': 'z',
1048
+ '\u017A': 'z',
1049
+ '\u1E91': 'z',
1050
+ '\u017C': 'z',
1051
+ '\u017E': 'z',
1052
+ '\u1E93': 'z',
1053
+ '\u1E95': 'z',
1054
+ '\u01B6': 'z',
1055
+ '\u0225': 'z',
1056
+ '\u0240': 'z',
1057
+ '\u2C6C': 'z',
1058
+ '\uA763': 'z',
1059
+ '\u0386': '\u0391',
1060
+ '\u0388': '\u0395',
1061
+ '\u0389': '\u0397',
1062
+ '\u038A': '\u0399',
1063
+ '\u03AA': '\u0399',
1064
+ '\u038C': '\u039F',
1065
+ '\u038E': '\u03A5',
1066
+ '\u03AB': '\u03A5',
1067
+ '\u038F': '\u03A9',
1068
+ '\u03AC': '\u03B1',
1069
+ '\u03AD': '\u03B5',
1070
+ '\u03AE': '\u03B7',
1071
+ '\u03AF': '\u03B9',
1072
+ '\u03CA': '\u03B9',
1073
+ '\u0390': '\u03B9',
1074
+ '\u03CC': '\u03BF',
1075
+ '\u03CD': '\u03C5',
1076
+ '\u03CB': '\u03C5',
1077
+ '\u03B0': '\u03C5',
1078
+ '\u03C9': '\u03C9',
1079
+ '\u03C2': '\u03C3'
1080
+ };
1081
+ /**
1082
+ * @param {?} text
1083
+ * @return {?}
1084
+ */
1085
+ function stripSpecialChars(text) {
1086
+ /** @type {?} */
1087
+ var match = (/**
1088
+ * @param {?} a
1089
+ * @return {?}
1090
+ */
1091
+ function (a) {
1092
+ return diacritics[a] || a;
1093
+ });
1094
+ return text.replace(/[^\u0000-\u007E]/g, match);
1095
+ }
1096
+
1097
+ /**
1098
+ * @fileoverview added by tsickle
1099
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1100
+ */
1101
+ var ItemsList = /** @class */ (function () {
1102
+ function ItemsList(_ngSelect, _selectionModel) {
1103
+ this._ngSelect = _ngSelect;
1104
+ this._selectionModel = _selectionModel;
1105
+ this._items = [];
1106
+ this._filteredItems = [];
1107
+ this._markedIndex = -1;
1108
+ }
1109
+ Object.defineProperty(ItemsList.prototype, "items", {
1110
+ get: /**
1111
+ * @return {?}
1112
+ */
1113
+ function () {
1114
+ return this._items;
1115
+ },
1116
+ enumerable: true,
1117
+ configurable: true
1118
+ });
1119
+ Object.defineProperty(ItemsList.prototype, "filteredItems", {
1120
+ get: /**
1121
+ * @return {?}
1122
+ */
1123
+ function () {
1124
+ return this._filteredItems;
1125
+ },
1126
+ enumerable: true,
1127
+ configurable: true
1128
+ });
1129
+ Object.defineProperty(ItemsList.prototype, "markedIndex", {
1130
+ get: /**
1131
+ * @return {?}
1132
+ */
1133
+ function () {
1134
+ return this._markedIndex;
1135
+ },
1136
+ enumerable: true,
1137
+ configurable: true
1138
+ });
1139
+ Object.defineProperty(ItemsList.prototype, "selectedItems", {
1140
+ get: /**
1141
+ * @return {?}
1142
+ */
1143
+ function () {
1144
+ return this._selectionModel.value;
1145
+ },
1146
+ enumerable: true,
1147
+ configurable: true
1148
+ });
1149
+ Object.defineProperty(ItemsList.prototype, "markedItem", {
1150
+ get: /**
1151
+ * @return {?}
1152
+ */
1153
+ function () {
1154
+ return this._filteredItems[this._markedIndex];
1155
+ },
1156
+ enumerable: true,
1157
+ configurable: true
1158
+ });
1159
+ Object.defineProperty(ItemsList.prototype, "noItemsToSelect", {
1160
+ get: /**
1161
+ * @return {?}
1162
+ */
1163
+ function () {
1164
+ return this._ngSelect.hideSelected && this._items.length === this.selectedItems.length;
1165
+ },
1166
+ enumerable: true,
1167
+ configurable: true
1168
+ });
1169
+ Object.defineProperty(ItemsList.prototype, "maxItemsSelected", {
1170
+ get: /**
1171
+ * @return {?}
1172
+ */
1173
+ function () {
1174
+ return this._ngSelect.multiple && this._ngSelect.maxSelectedItems <= this.selectedItems.length;
1175
+ },
1176
+ enumerable: true,
1177
+ configurable: true
1178
+ });
1179
+ Object.defineProperty(ItemsList.prototype, "lastSelectedItem", {
1180
+ get: /**
1181
+ * @return {?}
1182
+ */
1183
+ function () {
1184
+ /** @type {?} */
1185
+ var i = this.selectedItems.length - 1;
1186
+ for (; i >= 0; i--) {
1187
+ /** @type {?} */
1188
+ var item = this.selectedItems[i];
1189
+ if (!item.disabled) {
1190
+ return item;
1191
+ }
1192
+ }
1193
+ return null;
1194
+ },
1195
+ enumerable: true,
1196
+ configurable: true
1197
+ });
1198
+ /**
1199
+ * @param {?} items
1200
+ * @return {?}
1201
+ */
1202
+ ItemsList.prototype.setItems = /**
1203
+ * @param {?} items
1204
+ * @return {?}
1205
+ */
1206
+ function (items) {
1207
+ var _this = this;
1208
+ this._items = items.map((/**
1209
+ * @param {?} item
1210
+ * @param {?} index
1211
+ * @return {?}
1212
+ */
1213
+ function (item, index) { return _this.mapItem(item, index); }));
1214
+ if (this._ngSelect.groupBy) {
1215
+ this._groups = this._groupBy(this._items, this._ngSelect.groupBy);
1216
+ this._items = this._flatten(this._groups);
1217
+ }
1218
+ else {
1219
+ this._groups = new Map();
1220
+ this._groups.set(undefined, this._items);
1221
+ }
1222
+ this._filteredItems = __spread(this._items);
1223
+ };
1224
+ /**
1225
+ * @param {?} item
1226
+ * @return {?}
1227
+ */
1228
+ ItemsList.prototype.select = /**
1229
+ * @param {?} item
1230
+ * @return {?}
1231
+ */
1232
+ function (item) {
1233
+ if (item.selected || this.maxItemsSelected) {
1234
+ return;
1235
+ }
1236
+ /** @type {?} */
1237
+ var multiple = this._ngSelect.multiple;
1238
+ if (!multiple) {
1239
+ this.clearSelected();
1240
+ }
1241
+ this._selectionModel.select(item, multiple, this._ngSelect.selectableGroupAsModel);
1242
+ if (this._ngSelect.hideSelected) {
1243
+ this._hideSelected(item);
1244
+ }
1245
+ };
1246
+ /**
1247
+ * @param {?} item
1248
+ * @return {?}
1249
+ */
1250
+ ItemsList.prototype.unselect = /**
1251
+ * @param {?} item
1252
+ * @return {?}
1253
+ */
1254
+ function (item) {
1255
+ if (!item.selected) {
1256
+ return;
1257
+ }
1258
+ this._selectionModel.unselect(item, this._ngSelect.multiple);
1259
+ if (this._ngSelect.hideSelected && isDefined(item.index) && this._ngSelect.multiple) {
1260
+ this._showSelected(item);
1261
+ }
1262
+ };
1263
+ /**
1264
+ * @param {?} value
1265
+ * @return {?}
1266
+ */
1267
+ ItemsList.prototype.findItem = /**
1268
+ * @param {?} value
1269
+ * @return {?}
1270
+ */
1271
+ function (value) {
1272
+ var _this = this;
1273
+ /** @type {?} */
1274
+ var findBy;
1275
+ if (this._ngSelect.compareWith) {
1276
+ findBy = (/**
1277
+ * @param {?} item
1278
+ * @return {?}
1279
+ */
1280
+ function (item) { return _this._ngSelect.compareWith(item.value, value); });
1281
+ }
1282
+ else if (this._ngSelect.bindValue) {
1283
+ findBy = (/**
1284
+ * @param {?} item
1285
+ * @return {?}
1286
+ */
1287
+ function (item) { return !item.children && _this.resolveNested(item.value, _this._ngSelect.bindValue) === value; });
1288
+ }
1289
+ else {
1290
+ findBy = (/**
1291
+ * @param {?} item
1292
+ * @return {?}
1293
+ */
1294
+ function (item) { return item.value === value ||
1295
+ !item.children && item.label && item.label === _this.resolveNested(value, _this._ngSelect.bindLabel); });
1296
+ }
1297
+ return this._items.find((/**
1298
+ * @param {?} item
1299
+ * @return {?}
1300
+ */
1301
+ function (item) { return findBy(item); }));
1302
+ };
1303
+ /**
1304
+ * @param {?} item
1305
+ * @return {?}
1306
+ */
1307
+ ItemsList.prototype.addItem = /**
1308
+ * @param {?} item
1309
+ * @return {?}
1310
+ */
1311
+ function (item) {
1312
+ /** @type {?} */
1313
+ var option = this.mapItem(item, this._items.length);
1314
+ this._items.push(option);
1315
+ this._filteredItems.push(option);
1316
+ return option;
1317
+ };
1318
+ /**
1319
+ * @param {?=} keepDisabled
1320
+ * @return {?}
1321
+ */
1322
+ ItemsList.prototype.clearSelected = /**
1323
+ * @param {?=} keepDisabled
1324
+ * @return {?}
1325
+ */
1326
+ function (keepDisabled) {
1327
+ if (keepDisabled === void 0) { keepDisabled = false; }
1328
+ this._selectionModel.clear(keepDisabled);
1329
+ this._items.forEach((/**
1330
+ * @param {?} item
1331
+ * @return {?}
1332
+ */
1333
+ function (item) {
1334
+ item.selected = keepDisabled && item.selected && item.disabled;
1335
+ item.marked = false;
1336
+ }));
1337
+ if (this._ngSelect.hideSelected) {
1338
+ this.resetFilteredItems();
1339
+ }
1340
+ };
1341
+ /**
1342
+ * @param {?} term
1343
+ * @return {?}
1344
+ */
1345
+ ItemsList.prototype.findByLabel = /**
1346
+ * @param {?} term
1347
+ * @return {?}
1348
+ */
1349
+ function (term) {
1350
+ term = stripSpecialChars(term).toLocaleLowerCase();
1351
+ return this.filteredItems.find((/**
1352
+ * @param {?} item
1353
+ * @return {?}
1354
+ */
1355
+ function (item) {
1356
+ /** @type {?} */
1357
+ var label = stripSpecialChars(item.label).toLocaleLowerCase();
1358
+ return label.substr(0, term.length) === term;
1359
+ }));
1360
+ };
1361
+ /**
1362
+ * @param {?} term
1363
+ * @return {?}
1364
+ */
1365
+ ItemsList.prototype.filter = /**
1366
+ * @param {?} term
1367
+ * @return {?}
1368
+ */
1369
+ function (term) {
1370
+ var e_1, _a;
1371
+ if (!term) {
1372
+ this.resetFilteredItems();
1373
+ return;
1374
+ }
1375
+ this._filteredItems = [];
1376
+ term = this._ngSelect.searchFn ? term : stripSpecialChars(term).toLocaleLowerCase();
1377
+ /** @type {?} */
1378
+ var match = this._ngSelect.searchFn || this._defaultSearchFn;
1379
+ /** @type {?} */
1380
+ var hideSelected = this._ngSelect.hideSelected;
1381
+ var _loop_1 = function (key) {
1382
+ var e_2, _a, _b;
1383
+ /** @type {?} */
1384
+ var matchedItems = [];
1385
+ try {
1386
+ for (var _c = __values(this_1._groups.get(key)), _d = _c.next(); !_d.done; _d = _c.next()) {
1387
+ var item = _d.value;
1388
+ if (hideSelected && (item.parent && item.parent.selected || item.selected)) {
1389
+ continue;
1390
+ }
1391
+ /** @type {?} */
1392
+ var searchItem = this_1._ngSelect.searchFn ? item.value : item;
1393
+ if (match(term, searchItem)) {
1394
+ matchedItems.push(item);
1395
+ }
1396
+ }
1397
+ }
1398
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1399
+ finally {
1400
+ try {
1401
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1402
+ }
1403
+ finally { if (e_2) throw e_2.error; }
1404
+ }
1405
+ if (matchedItems.length > 0) {
1406
+ var _e = __read(matchedItems.slice(-1), 1), last_1 = _e[0];
1407
+ if (last_1.parent) {
1408
+ /** @type {?} */
1409
+ var head = this_1._items.find((/**
1410
+ * @param {?} x
1411
+ * @return {?}
1412
+ */
1413
+ function (x) { return x === last_1.parent; }));
1414
+ this_1._filteredItems.push(head);
1415
+ }
1416
+ (_b = this_1._filteredItems).push.apply(_b, __spread(matchedItems));
1417
+ }
1418
+ };
1419
+ var this_1 = this;
1420
+ try {
1421
+ for (var _b = __values(Array.from(this._groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
1422
+ var key = _c.value;
1423
+ _loop_1(key);
1424
+ }
1425
+ }
1426
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1427
+ finally {
1428
+ try {
1429
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1430
+ }
1431
+ finally { if (e_1) throw e_1.error; }
1432
+ }
1433
+ };
1434
+ /**
1435
+ * @return {?}
1436
+ */
1437
+ ItemsList.prototype.resetFilteredItems = /**
1438
+ * @return {?}
1439
+ */
1440
+ function () {
1441
+ if (this._filteredItems.length === this._items.length) {
1442
+ return;
1443
+ }
1444
+ if (this._ngSelect.hideSelected && this.selectedItems.length > 0) {
1445
+ this._filteredItems = this._items.filter((/**
1446
+ * @param {?} x
1447
+ * @return {?}
1448
+ */
1449
+ function (x) { return !x.selected; }));
1450
+ }
1451
+ else {
1452
+ this._filteredItems = this._items;
1453
+ }
1454
+ };
1455
+ /**
1456
+ * @return {?}
1457
+ */
1458
+ ItemsList.prototype.unmarkItem = /**
1459
+ * @return {?}
1460
+ */
1461
+ function () {
1462
+ this._markedIndex = -1;
1463
+ };
1464
+ /**
1465
+ * @return {?}
1466
+ */
1467
+ ItemsList.prototype.markNextItem = /**
1468
+ * @return {?}
1469
+ */
1470
+ function () {
1471
+ this._stepToItem(+1);
1472
+ };
1473
+ /**
1474
+ * @return {?}
1475
+ */
1476
+ ItemsList.prototype.markPreviousItem = /**
1477
+ * @return {?}
1478
+ */
1479
+ function () {
1480
+ this._stepToItem(-1);
1481
+ };
1482
+ /**
1483
+ * @param {?} item
1484
+ * @return {?}
1485
+ */
1486
+ ItemsList.prototype.markItem = /**
1487
+ * @param {?} item
1488
+ * @return {?}
1489
+ */
1490
+ function (item) {
1491
+ this._markedIndex = this._filteredItems.indexOf(item);
1492
+ };
1493
+ /**
1494
+ * @param {?=} markDefault
1495
+ * @return {?}
1496
+ */
1497
+ ItemsList.prototype.markSelectedOrDefault = /**
1498
+ * @param {?=} markDefault
1499
+ * @return {?}
1500
+ */
1501
+ function (markDefault) {
1502
+ if (this._filteredItems.length === 0) {
1503
+ return;
1504
+ }
1505
+ /** @type {?} */
1506
+ var lastMarkedIndex = this._getLastMarkedIndex();
1507
+ if (lastMarkedIndex > -1) {
1508
+ this._markedIndex = lastMarkedIndex;
1509
+ }
1510
+ else {
1511
+ this._markedIndex = markDefault ? this.filteredItems.findIndex((/**
1512
+ * @param {?} x
1513
+ * @return {?}
1514
+ */
1515
+ function (x) { return !x.disabled; })) : -1;
1516
+ }
1517
+ };
1518
+ /**
1519
+ * @param {?} option
1520
+ * @param {?} key
1521
+ * @return {?}
1522
+ */
1523
+ ItemsList.prototype.resolveNested = /**
1524
+ * @param {?} option
1525
+ * @param {?} key
1526
+ * @return {?}
1527
+ */
1528
+ function (option, key) {
1529
+ if (!isObject(option)) {
1530
+ return option;
1531
+ }
1532
+ if (key.indexOf('.') === -1) {
1533
+ return option[key];
1534
+ }
1535
+ else {
1536
+ /** @type {?} */
1537
+ var keys = key.split('.');
1538
+ /** @type {?} */
1539
+ var value = option;
1540
+ for (var i = 0, len = keys.length; i < len; ++i) {
1541
+ if (value == null) {
1542
+ return null;
1543
+ }
1544
+ value = value[keys[i]];
1545
+ }
1546
+ return value;
1547
+ }
1548
+ };
1549
+ /**
1550
+ * @param {?} item
1551
+ * @param {?} index
1552
+ * @return {?}
1553
+ */
1554
+ ItemsList.prototype.mapItem = /**
1555
+ * @param {?} item
1556
+ * @param {?} index
1557
+ * @return {?}
1558
+ */
1559
+ function (item, index) {
1560
+ /** @type {?} */
1561
+ var label = isDefined(item.$ngOptionLabel) ? item.$ngOptionLabel : this.resolveNested(item, this._ngSelect.bindLabel);
1562
+ /** @type {?} */
1563
+ var value = isDefined(item.$ngOptionValue) ? item.$ngOptionValue : item;
1564
+ return {
1565
+ index: index,
1566
+ label: isDefined(label) ? label.toString() : '',
1567
+ value: value,
1568
+ disabled: item.disabled,
1569
+ htmlId: this._ngSelect.dropdownId + "-" + index,
1570
+ };
1571
+ };
1572
+ /**
1573
+ * @return {?}
1574
+ */
1575
+ ItemsList.prototype.mapSelectedItems = /**
1576
+ * @return {?}
1577
+ */
1578
+ function () {
1579
+ var _this = this;
1580
+ var e_3, _a;
1581
+ /** @type {?} */
1582
+ var multiple = this._ngSelect.multiple;
1583
+ try {
1584
+ for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
1585
+ var selected = _c.value;
1586
+ /** @type {?} */
1587
+ var value = this._ngSelect.bindValue ? this.resolveNested(selected.value, this._ngSelect.bindValue) : selected.value;
1588
+ /** @type {?} */
1589
+ var item = isDefined(value) ? this.findItem(value) : null;
1590
+ this._selectionModel.unselect(selected, multiple);
1591
+ this._selectionModel.select(item || selected, multiple, this._ngSelect.selectableGroupAsModel);
1592
+ }
1593
+ }
1594
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
1595
+ finally {
1596
+ try {
1597
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1598
+ }
1599
+ finally { if (e_3) throw e_3.error; }
1600
+ }
1601
+ if (this._ngSelect.hideSelected) {
1602
+ this._filteredItems = this.filteredItems.filter((/**
1603
+ * @param {?} x
1604
+ * @return {?}
1605
+ */
1606
+ function (x) { return _this.selectedItems.indexOf(x) === -1; }));
1607
+ }
1608
+ };
1609
+ /**
1610
+ * @private
1611
+ * @param {?} item
1612
+ * @return {?}
1613
+ */
1614
+ ItemsList.prototype._showSelected = /**
1615
+ * @private
1616
+ * @param {?} item
1617
+ * @return {?}
1618
+ */
1619
+ function (item) {
1620
+ var e_4, _a;
1621
+ this._filteredItems.push(item);
1622
+ if (item.parent) {
1623
+ /** @type {?} */
1624
+ var parent_1 = item.parent;
1625
+ /** @type {?} */
1626
+ var parentExists = this._filteredItems.find((/**
1627
+ * @param {?} x
1628
+ * @return {?}
1629
+ */
1630
+ function (x) { return x === parent_1; }));
1631
+ if (!parentExists) {
1632
+ this._filteredItems.push(parent_1);
1633
+ }
1634
+ }
1635
+ else if (item.children) {
1636
+ try {
1637
+ for (var _b = __values(item.children), _c = _b.next(); !_c.done; _c = _b.next()) {
1638
+ var child = _c.value;
1639
+ child.selected = false;
1640
+ this._filteredItems.push(child);
1641
+ }
1642
+ }
1643
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
1644
+ finally {
1645
+ try {
1646
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1647
+ }
1648
+ finally { if (e_4) throw e_4.error; }
1649
+ }
1650
+ }
1651
+ this._filteredItems = __spread(this._filteredItems.sort((/**
1652
+ * @param {?} a
1653
+ * @param {?} b
1654
+ * @return {?}
1655
+ */
1656
+ function (a, b) { return (a.index - b.index); })));
1657
+ };
1658
+ /**
1659
+ * @private
1660
+ * @param {?} item
1661
+ * @return {?}
1662
+ */
1663
+ ItemsList.prototype._hideSelected = /**
1664
+ * @private
1665
+ * @param {?} item
1666
+ * @return {?}
1667
+ */
1668
+ function (item) {
1669
+ this._filteredItems = this._filteredItems.filter((/**
1670
+ * @param {?} x
1671
+ * @return {?}
1672
+ */
1673
+ function (x) { return x !== item; }));
1674
+ if (item.parent) {
1675
+ /** @type {?} */
1676
+ var children = item.parent.children;
1677
+ if (children.every((/**
1678
+ * @param {?} x
1679
+ * @return {?}
1680
+ */
1681
+ function (x) { return x.selected; }))) {
1682
+ this._filteredItems = this._filteredItems.filter((/**
1683
+ * @param {?} x
1684
+ * @return {?}
1685
+ */
1686
+ function (x) { return x !== item.parent; }));
1687
+ }
1688
+ }
1689
+ else if (item.children) {
1690
+ this._filteredItems = this.filteredItems.filter((/**
1691
+ * @param {?} x
1692
+ * @return {?}
1693
+ */
1694
+ function (x) { return x.parent !== item; }));
1695
+ }
1696
+ };
1697
+ /**
1698
+ * @private
1699
+ * @param {?} search
1700
+ * @param {?} opt
1701
+ * @return {?}
1702
+ */
1703
+ ItemsList.prototype._defaultSearchFn = /**
1704
+ * @private
1705
+ * @param {?} search
1706
+ * @param {?} opt
1707
+ * @return {?}
1708
+ */
1709
+ function (search, opt) {
1710
+ /** @type {?} */
1711
+ var label = stripSpecialChars(opt.label).toLocaleLowerCase();
1712
+ return label.indexOf(search) > -1;
1713
+ };
1714
+ /**
1715
+ * @private
1716
+ * @param {?} steps
1717
+ * @return {?}
1718
+ */
1719
+ ItemsList.prototype._getNextItemIndex = /**
1720
+ * @private
1721
+ * @param {?} steps
1722
+ * @return {?}
1723
+ */
1724
+ function (steps) {
1725
+ if (steps > 0) {
1726
+ return (this._markedIndex === this._filteredItems.length - 1) ? 0 : (this._markedIndex + 1);
1727
+ }
1728
+ return (this._markedIndex <= 0) ? (this._filteredItems.length - 1) : (this._markedIndex - 1);
1729
+ };
1730
+ /**
1731
+ * @private
1732
+ * @param {?} steps
1733
+ * @return {?}
1734
+ */
1735
+ ItemsList.prototype._stepToItem = /**
1736
+ * @private
1737
+ * @param {?} steps
1738
+ * @return {?}
1739
+ */
1740
+ function (steps) {
1741
+ if (this._filteredItems.length === 0 || this._filteredItems.every((/**
1742
+ * @param {?} x
1743
+ * @return {?}
1744
+ */
1745
+ function (x) { return x.disabled; }))) {
1746
+ return;
1747
+ }
1748
+ this._markedIndex = this._getNextItemIndex(steps);
1749
+ if (this.markedItem.disabled) {
1750
+ this._stepToItem(steps);
1751
+ }
1752
+ };
1753
+ /**
1754
+ * @private
1755
+ * @return {?}
1756
+ */
1757
+ ItemsList.prototype._getLastMarkedIndex = /**
1758
+ * @private
1759
+ * @return {?}
1760
+ */
1761
+ function () {
1762
+ if (this._ngSelect.hideSelected) {
1763
+ return -1;
1764
+ }
1765
+ if (this._markedIndex > -1 && this.markedItem === undefined) {
1766
+ return -1;
1767
+ }
1768
+ /** @type {?} */
1769
+ var selectedIndex = this._filteredItems.indexOf(this.lastSelectedItem);
1770
+ if (this.lastSelectedItem && selectedIndex < 0) {
1771
+ return -1;
1772
+ }
1773
+ return Math.max(this.markedIndex, selectedIndex);
1774
+ };
1775
+ /**
1776
+ * @private
1777
+ * @param {?} items
1778
+ * @param {?} prop
1779
+ * @return {?}
1780
+ */
1781
+ ItemsList.prototype._groupBy = /**
1782
+ * @private
1783
+ * @param {?} items
1784
+ * @param {?} prop
1785
+ * @return {?}
1786
+ */
1787
+ function (items, prop) {
1788
+ var _this = this;
1789
+ var e_5, _a, e_6, _b;
1790
+ /** @type {?} */
1791
+ var groups = new Map();
1792
+ if (items.length === 0) {
1793
+ return groups;
1794
+ }
1795
+ // Check if items are already grouped by given key.
1796
+ if (Array.isArray(items[0].value[(/** @type {?} */ (prop))])) {
1797
+ try {
1798
+ for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
1799
+ var item = items_1_1.value;
1800
+ /** @type {?} */
1801
+ var children = (item.value[(/** @type {?} */ (prop))] || []).map((/**
1802
+ * @param {?} x
1803
+ * @param {?} index
1804
+ * @return {?}
1805
+ */
1806
+ function (x, index) { return _this.mapItem(x, index); }));
1807
+ groups.set(item, children);
1808
+ }
1809
+ }
1810
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1811
+ finally {
1812
+ try {
1813
+ if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
1814
+ }
1815
+ finally { if (e_5) throw e_5.error; }
1816
+ }
1817
+ return groups;
1818
+ }
1819
+ /** @type {?} */
1820
+ var isFnKey = isFunction(this._ngSelect.groupBy);
1821
+ /** @type {?} */
1822
+ var keyFn = (/**
1823
+ * @param {?} item
1824
+ * @return {?}
1825
+ */
1826
+ function (item) {
1827
+ /** @type {?} */
1828
+ var key = isFnKey ? ((/** @type {?} */ (prop)))(item.value) : item.value[(/** @type {?} */ (prop))];
1829
+ return isDefined(key) ? key : undefined;
1830
+ });
1831
+ try {
1832
+ // Group items by key.
1833
+ for (var items_2 = __values(items), items_2_1 = items_2.next(); !items_2_1.done; items_2_1 = items_2.next()) {
1834
+ var item = items_2_1.value;
1835
+ /** @type {?} */
1836
+ var key = keyFn(item);
1837
+ /** @type {?} */
1838
+ var group = groups.get(key);
1839
+ if (group) {
1840
+ group.push(item);
1841
+ }
1842
+ else {
1843
+ groups.set(key, [item]);
1844
+ }
1845
+ }
1846
+ }
1847
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1848
+ finally {
1849
+ try {
1850
+ if (items_2_1 && !items_2_1.done && (_b = items_2.return)) _b.call(items_2);
1851
+ }
1852
+ finally { if (e_6) throw e_6.error; }
1853
+ }
1854
+ return groups;
1855
+ };
1856
+ /**
1857
+ * @private
1858
+ * @param {?} groups
1859
+ * @return {?}
1860
+ */
1861
+ ItemsList.prototype._flatten = /**
1862
+ * @private
1863
+ * @param {?} groups
1864
+ * @return {?}
1865
+ */
1866
+ function (groups) {
1867
+ var e_7, _a;
1868
+ /** @type {?} */
1869
+ var isGroupByFn = isFunction(this._ngSelect.groupBy);
1870
+ /** @type {?} */
1871
+ var items = [];
1872
+ var _loop_2 = function (key) {
1873
+ /** @type {?} */
1874
+ var i = items.length;
1875
+ if (key === undefined) {
1876
+ /** @type {?} */
1877
+ var withoutGroup = groups.get(undefined) || [];
1878
+ items.push.apply(items, __spread(withoutGroup.map((/**
1879
+ * @param {?} x
1880
+ * @return {?}
1881
+ */
1882
+ function (x) { return (__assign({}, x, { index: i++ })); }))));
1883
+ return "continue";
1884
+ }
1885
+ /** @type {?} */
1886
+ var isObjectKey = isObject(key);
1887
+ /** @type {?} */
1888
+ var parent_2 = {
1889
+ label: isObjectKey ? '' : String(key),
1890
+ children: undefined,
1891
+ parent: null,
1892
+ index: i++,
1893
+ disabled: !this_2._ngSelect.selectableGroup,
1894
+ htmlId: newId(),
1895
+ };
1896
+ /** @type {?} */
1897
+ var groupKey = isGroupByFn ? this_2._ngSelect.bindLabel : (/** @type {?} */ (this_2._ngSelect.groupBy));
1898
+ /** @type {?} */
1899
+ var groupValue = this_2._ngSelect.groupValue || ((/**
1900
+ * @return {?}
1901
+ */
1902
+ function () {
1903
+ var _a;
1904
+ if (isObjectKey) {
1905
+ return ((/** @type {?} */ (key))).value;
1906
+ }
1907
+ return _a = {}, _a[groupKey] = key, _a;
1908
+ }));
1909
+ /** @type {?} */
1910
+ var children = groups.get(key).map((/**
1911
+ * @param {?} x
1912
+ * @return {?}
1913
+ */
1914
+ function (x) {
1915
+ x.parent = parent_2;
1916
+ x.children = undefined;
1917
+ x.index = i++;
1918
+ return x;
1919
+ }));
1920
+ parent_2.children = children;
1921
+ parent_2.value = groupValue(key, children.map((/**
1922
+ * @param {?} x
1923
+ * @return {?}
1924
+ */
1925
+ function (x) { return x.value; })));
1926
+ items.push(parent_2);
1927
+ items.push.apply(items, __spread(children));
1928
+ };
1929
+ var this_2 = this;
1930
+ try {
1931
+ for (var _b = __values(Array.from(groups.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
1932
+ var key = _c.value;
1933
+ _loop_2(key);
1934
+ }
1935
+ }
1936
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1937
+ finally {
1938
+ try {
1939
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1940
+ }
1941
+ finally { if (e_7) throw e_7.error; }
1942
+ }
1943
+ return items;
1944
+ };
1945
+ return ItemsList;
1946
+ }());
1947
+
1948
+ /**
1949
+ * @fileoverview added by tsickle
1950
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1951
+ */
1952
+ /** @enum {number} */
1953
+ var KeyCode = {
1954
+ Tab: 9,
1955
+ Enter: 13,
1956
+ Esc: 27,
1957
+ Space: 32,
1958
+ ArrowUp: 38,
1959
+ ArrowDown: 40,
1960
+ Backspace: 8,
1961
+ };
1962
+ KeyCode[KeyCode.Tab] = 'Tab';
1963
+ KeyCode[KeyCode.Enter] = 'Enter';
1964
+ KeyCode[KeyCode.Esc] = 'Esc';
1965
+ KeyCode[KeyCode.Space] = 'Space';
1966
+ KeyCode[KeyCode.ArrowUp] = 'ArrowUp';
1967
+ KeyCode[KeyCode.ArrowDown] = 'ArrowDown';
1968
+ KeyCode[KeyCode.Backspace] = 'Backspace';
1969
+
1970
+ /**
1971
+ * @fileoverview added by tsickle
1972
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1973
+ */
1974
+ var NgDropdownPanelService = /** @class */ (function () {
1975
+ function NgDropdownPanelService() {
1976
+ this._dimensions = {
1977
+ itemHeight: 0,
1978
+ panelHeight: 0,
1979
+ itemsPerViewport: 0
1980
+ };
1981
+ }
1982
+ Object.defineProperty(NgDropdownPanelService.prototype, "dimensions", {
1983
+ get: /**
1984
+ * @return {?}
1985
+ */
1986
+ function () {
1987
+ return this._dimensions;
1988
+ },
1989
+ enumerable: true,
1990
+ configurable: true
1991
+ });
1992
+ /**
1993
+ * @param {?} scrollPos
1994
+ * @param {?} itemsLength
1995
+ * @param {?} buffer
1996
+ * @return {?}
1997
+ */
1998
+ NgDropdownPanelService.prototype.calculateItems = /**
1999
+ * @param {?} scrollPos
2000
+ * @param {?} itemsLength
2001
+ * @param {?} buffer
2002
+ * @return {?}
2003
+ */
2004
+ function (scrollPos, itemsLength, buffer) {
2005
+ /** @type {?} */
2006
+ var d = this._dimensions;
2007
+ /** @type {?} */
2008
+ var scrollHeight = d.itemHeight * itemsLength;
2009
+ /** @type {?} */
2010
+ var scrollTop = Math.max(0, scrollPos);
2011
+ /** @type {?} */
2012
+ var indexByScrollTop = scrollTop / scrollHeight * itemsLength;
2013
+ /** @type {?} */
2014
+ var end = Math.min(itemsLength, Math.ceil(indexByScrollTop) + (d.itemsPerViewport + 1));
2015
+ /** @type {?} */
2016
+ var maxStartEnd = end;
2017
+ /** @type {?} */
2018
+ var maxStart = Math.max(0, maxStartEnd - d.itemsPerViewport);
2019
+ /** @type {?} */
2020
+ var start = Math.min(maxStart, Math.floor(indexByScrollTop));
2021
+ /** @type {?} */
2022
+ var topPadding = d.itemHeight * Math.ceil(start) - (d.itemHeight * Math.min(start, buffer));
2023
+ topPadding = !isNaN(topPadding) ? topPadding : 0;
2024
+ start = !isNaN(start) ? start : -1;
2025
+ end = !isNaN(end) ? end : -1;
2026
+ start -= buffer;
2027
+ start = Math.max(0, start);
2028
+ end += buffer;
2029
+ end = Math.min(itemsLength, end);
2030
+ return {
2031
+ topPadding: topPadding,
2032
+ scrollHeight: scrollHeight,
2033
+ start: start,
2034
+ end: end
2035
+ };
2036
+ };
2037
+ /**
2038
+ * @param {?} itemHeight
2039
+ * @param {?} panelHeight
2040
+ * @return {?}
2041
+ */
2042
+ NgDropdownPanelService.prototype.setDimensions = /**
2043
+ * @param {?} itemHeight
2044
+ * @param {?} panelHeight
2045
+ * @return {?}
2046
+ */
2047
+ function (itemHeight, panelHeight) {
2048
+ /** @type {?} */
2049
+ var itemsPerViewport = Math.max(1, Math.floor(panelHeight / itemHeight));
2050
+ this._dimensions = {
2051
+ itemHeight: itemHeight,
2052
+ panelHeight: panelHeight,
2053
+ itemsPerViewport: itemsPerViewport
2054
+ };
2055
+ };
2056
+ /**
2057
+ * @param {?} itemTop
2058
+ * @param {?} itemHeight
2059
+ * @param {?} lastScroll
2060
+ * @return {?}
2061
+ */
2062
+ NgDropdownPanelService.prototype.getScrollTo = /**
2063
+ * @param {?} itemTop
2064
+ * @param {?} itemHeight
2065
+ * @param {?} lastScroll
2066
+ * @return {?}
2067
+ */
2068
+ function (itemTop, itemHeight, lastScroll) {
2069
+ /** @type {?} */
2070
+ var itemBottom = itemTop + itemHeight;
2071
+ /** @type {?} */
2072
+ var top = lastScroll;
2073
+ /** @type {?} */
2074
+ var bottom = top + this.dimensions.panelHeight;
2075
+ if (itemBottom > bottom) {
2076
+ return top + itemBottom - bottom;
2077
+ }
2078
+ else if (itemTop <= top) {
2079
+ return itemTop;
2080
+ }
2081
+ return null;
2082
+ };
2083
+ return NgDropdownPanelService;
2084
+ }());
2085
+
2086
+ /**
2087
+ * @fileoverview added by tsickle
2088
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2089
+ */
2090
+ /** @type {?} */
2091
+ var TOP_CSS_CLASS = 'ng-select-top';
2092
+ /** @type {?} */
2093
+ var BOTTOM_CSS_CLASS = 'ng-select-bottom';
2094
+ /** @type {?} */
2095
+ var SCROLL_SCHEDULER = typeof requestAnimationFrame !== 'undefined' ? animationFrameScheduler : asapScheduler;
2096
+ var NgDropdownPanelComponent = /** @class */ (function () {
2097
+ function NgDropdownPanelComponent(_renderer, _zone, _panelService, _elementRef, _document) {
2098
+ this._renderer = _renderer;
2099
+ this._zone = _zone;
2100
+ this._panelService = _panelService;
2101
+ this._document = _document;
2102
+ this.items = [];
2103
+ this.position = 'auto';
2104
+ this.virtualScroll = false;
2105
+ this.filterValue = null;
2106
+ this.update = new EventEmitter();
2107
+ this.scroll = new EventEmitter();
2108
+ this.scrollToEnd = new EventEmitter();
2109
+ this.outsideClick = new EventEmitter();
2110
+ this._destroy$ = new Subject();
2111
+ this._scrollToEndFired = false;
2112
+ this._updateScrollHeight = false;
2113
+ this._lastScrollPosition = 0;
2114
+ this._dropdown = _elementRef.nativeElement;
2115
+ }
2116
+ Object.defineProperty(NgDropdownPanelComponent.prototype, "currentPosition", {
2117
+ get: /**
2118
+ * @return {?}
2119
+ */
2120
+ function () {
2121
+ return this._currentPosition;
2122
+ },
2123
+ enumerable: true,
2124
+ configurable: true
2125
+ });
2126
+ Object.defineProperty(NgDropdownPanelComponent.prototype, "itemsLength", {
2127
+ get: /**
2128
+ * @private
2129
+ * @return {?}
2130
+ */
2131
+ function () {
2132
+ return this._itemsLength;
2133
+ },
2134
+ set: /**
2135
+ * @private
2136
+ * @param {?} value
2137
+ * @return {?}
2138
+ */
2139
+ function (value) {
2140
+ if (value !== this._itemsLength) {
2141
+ this._itemsLength = value;
2142
+ this._onItemsLengthChanged();
2143
+ }
2144
+ },
2145
+ enumerable: true,
2146
+ configurable: true
2147
+ });
2148
+ /**
2149
+ * @param {?} $event
2150
+ * @return {?}
2151
+ */
2152
+ NgDropdownPanelComponent.prototype.handleMousedown = /**
2153
+ * @param {?} $event
2154
+ * @return {?}
2155
+ */
2156
+ function ($event) {
2157
+ /** @type {?} */
2158
+ var target = (/** @type {?} */ ($event.target));
2159
+ if (target.tagName === 'INPUT') {
2160
+ return;
2161
+ }
2162
+ $event.preventDefault();
2163
+ };
2164
+ /**
2165
+ * @return {?}
2166
+ */
2167
+ NgDropdownPanelComponent.prototype.ngOnInit = /**
2168
+ * @return {?}
2169
+ */
2170
+ function () {
2171
+ this._select = this._dropdown.parentElement;
2172
+ this._virtualPadding = this.paddingElementRef.nativeElement;
2173
+ this._scrollablePanel = this.scrollElementRef.nativeElement;
2174
+ this._contentPanel = this.contentElementRef.nativeElement;
2175
+ this._handleScroll();
2176
+ this._handleOutsideClick();
2177
+ this._appendDropdown();
2178
+ };
2179
+ /**
2180
+ * @param {?} changes
2181
+ * @return {?}
2182
+ */
2183
+ NgDropdownPanelComponent.prototype.ngOnChanges = /**
2184
+ * @param {?} changes
2185
+ * @return {?}
2186
+ */
2187
+ function (changes) {
2188
+ if (changes.items) {
2189
+ /** @type {?} */
2190
+ var change = changes.items;
2191
+ this._onItemsChange(change.currentValue, change.firstChange);
2192
+ }
2193
+ };
2194
+ /**
2195
+ * @return {?}
2196
+ */
2197
+ NgDropdownPanelComponent.prototype.ngOnDestroy = /**
2198
+ * @return {?}
2199
+ */
2200
+ function () {
2201
+ this._destroy$.next();
2202
+ this._destroy$.complete();
2203
+ this._destroy$.unsubscribe();
2204
+ if (this.appendTo) {
2205
+ this._renderer.removeChild(this._dropdown.parentNode, this._dropdown);
2206
+ }
2207
+ };
2208
+ /**
2209
+ * @param {?} option
2210
+ * @param {?=} startFromOption
2211
+ * @return {?}
2212
+ */
2213
+ NgDropdownPanelComponent.prototype.scrollTo = /**
2214
+ * @param {?} option
2215
+ * @param {?=} startFromOption
2216
+ * @return {?}
2217
+ */
2218
+ function (option, startFromOption) {
2219
+ if (startFromOption === void 0) { startFromOption = false; }
2220
+ if (!option) {
2221
+ return;
2222
+ }
2223
+ /** @type {?} */
2224
+ var index = this.items.indexOf(option);
2225
+ if (index < 0 || index >= this.itemsLength) {
2226
+ return;
2227
+ }
2228
+ /** @type {?} */
2229
+ var scrollTo;
2230
+ if (this.virtualScroll) {
2231
+ /** @type {?} */
2232
+ var itemHeight = this._panelService.dimensions.itemHeight;
2233
+ scrollTo = this._panelService.getScrollTo(index * itemHeight, itemHeight, this._lastScrollPosition);
2234
+ }
2235
+ else {
2236
+ /** @type {?} */
2237
+ var item = this._dropdown.querySelector("#" + option.htmlId);
2238
+ /** @type {?} */
2239
+ var lastScroll = startFromOption ? item.offsetTop : this._lastScrollPosition;
2240
+ scrollTo = this._panelService.getScrollTo(item.offsetTop, item.clientHeight, lastScroll);
2241
+ }
2242
+ if (isDefined(scrollTo)) {
2243
+ this._scrollablePanel.scrollTop = scrollTo;
2244
+ }
2245
+ };
2246
+ /**
2247
+ * @return {?}
2248
+ */
2249
+ NgDropdownPanelComponent.prototype.scrollToTag = /**
2250
+ * @return {?}
2251
+ */
2252
+ function () {
2253
+ /** @type {?} */
2254
+ var panel = this._scrollablePanel;
2255
+ panel.scrollTop = panel.scrollHeight - panel.clientHeight;
2256
+ };
2257
+ /**
2258
+ * @return {?}
2259
+ */
2260
+ NgDropdownPanelComponent.prototype.adjustPosition = /**
2261
+ * @return {?}
2262
+ */
2263
+ function () {
2264
+ /** @type {?} */
2265
+ var parent = this._parent.getBoundingClientRect();
2266
+ /** @type {?} */
2267
+ var select = this._select.getBoundingClientRect();
2268
+ this._setOffset(parent, select);
2269
+ };
2270
+ /**
2271
+ * @private
2272
+ * @return {?}
2273
+ */
2274
+ NgDropdownPanelComponent.prototype._handleDropdownPosition = /**
2275
+ * @private
2276
+ * @return {?}
2277
+ */
2278
+ function () {
2279
+ this._currentPosition = this._calculateCurrentPosition(this._dropdown);
2280
+ if (this._currentPosition === 'top') {
2281
+ this._renderer.addClass(this._dropdown, TOP_CSS_CLASS);
2282
+ this._renderer.removeClass(this._dropdown, BOTTOM_CSS_CLASS);
2283
+ this._renderer.addClass(this._select, TOP_CSS_CLASS);
2284
+ this._renderer.removeClass(this._select, BOTTOM_CSS_CLASS);
2285
+ }
2286
+ else {
2287
+ this._renderer.addClass(this._dropdown, BOTTOM_CSS_CLASS);
2288
+ this._renderer.removeClass(this._dropdown, TOP_CSS_CLASS);
2289
+ this._renderer.addClass(this._select, BOTTOM_CSS_CLASS);
2290
+ this._renderer.removeClass(this._select, TOP_CSS_CLASS);
2291
+ }
2292
+ if (this.appendTo) {
2293
+ this._updatePosition();
2294
+ }
2295
+ this._dropdown.style.opacity = '1';
2296
+ };
2297
+ /**
2298
+ * @private
2299
+ * @return {?}
2300
+ */
2301
+ NgDropdownPanelComponent.prototype._handleScroll = /**
2302
+ * @private
2303
+ * @return {?}
2304
+ */
2305
+ function () {
2306
+ var _this = this;
2307
+ this._zone.runOutsideAngular((/**
2308
+ * @return {?}
2309
+ */
2310
+ function () {
2311
+ fromEvent(_this.scrollElementRef.nativeElement, 'scroll')
2312
+ .pipe(takeUntil(_this._destroy$), auditTime(0, SCROLL_SCHEDULER))
2313
+ .subscribe((/**
2314
+ * @param {?} e
2315
+ * @return {?}
2316
+ */
2317
+ function (e) { return _this._onContentScrolled(e.target.scrollTop); }));
2318
+ }));
2319
+ };
2320
+ /**
2321
+ * @private
2322
+ * @return {?}
2323
+ */
2324
+ NgDropdownPanelComponent.prototype._handleOutsideClick = /**
2325
+ * @private
2326
+ * @return {?}
2327
+ */
2328
+ function () {
2329
+ var _this = this;
2330
+ if (!this._document) {
2331
+ return;
2332
+ }
2333
+ this._zone.runOutsideAngular((/**
2334
+ * @return {?}
2335
+ */
2336
+ function () {
2337
+ merge(fromEvent(_this._document, 'touchstart', { capture: true }), fromEvent(_this._document, 'mousedown', { capture: true })).pipe(takeUntil(_this._destroy$))
2338
+ .subscribe((/**
2339
+ * @param {?} $event
2340
+ * @return {?}
2341
+ */
2342
+ function ($event) { return _this._checkToClose($event); }));
2343
+ }));
2344
+ };
2345
+ /**
2346
+ * @private
2347
+ * @param {?} $event
2348
+ * @return {?}
2349
+ */
2350
+ NgDropdownPanelComponent.prototype._checkToClose = /**
2351
+ * @private
2352
+ * @param {?} $event
2353
+ * @return {?}
2354
+ */
2355
+ function ($event) {
2356
+ if (this._select.contains($event.target) || this._dropdown.contains($event.target)) {
2357
+ return;
2358
+ }
2359
+ /** @type {?} */
2360
+ var path = $event.path || ($event.composedPath && $event.composedPath());
2361
+ if ($event.target && $event.target.shadowRoot && path && path[0] && this._select.contains(path[0])) {
2362
+ return;
2363
+ }
2364
+ this.outsideClick.emit();
2365
+ };
2366
+ /**
2367
+ * @private
2368
+ * @param {?} items
2369
+ * @param {?} firstChange
2370
+ * @return {?}
2371
+ */
2372
+ NgDropdownPanelComponent.prototype._onItemsChange = /**
2373
+ * @private
2374
+ * @param {?} items
2375
+ * @param {?} firstChange
2376
+ * @return {?}
2377
+ */
2378
+ function (items, firstChange) {
2379
+ this.items = items || [];
2380
+ this._scrollToEndFired = false;
2381
+ this.itemsLength = items.length;
2382
+ if (this.virtualScroll) {
2383
+ this._updateItemsRange(firstChange);
2384
+ }
2385
+ else {
2386
+ this._updateItems(firstChange);
2387
+ }
2388
+ };
2389
+ /**
2390
+ * @private
2391
+ * @param {?} firstChange
2392
+ * @return {?}
2393
+ */
2394
+ NgDropdownPanelComponent.prototype._updateItems = /**
2395
+ * @private
2396
+ * @param {?} firstChange
2397
+ * @return {?}
2398
+ */
2399
+ function (firstChange) {
2400
+ var _this = this;
2401
+ this.update.emit(this.items);
2402
+ if (firstChange === false) {
2403
+ return;
2404
+ }
2405
+ this._zone.runOutsideAngular((/**
2406
+ * @return {?}
2407
+ */
2408
+ function () {
2409
+ Promise.resolve().then((/**
2410
+ * @return {?}
2411
+ */
2412
+ function () {
2413
+ /** @type {?} */
2414
+ var panelHeight = _this._scrollablePanel.clientHeight;
2415
+ _this._panelService.setDimensions(0, panelHeight);
2416
+ _this._handleDropdownPosition();
2417
+ _this.scrollTo(_this.markedItem, firstChange);
2418
+ }));
2419
+ }));
2420
+ };
2421
+ /**
2422
+ * @private
2423
+ * @param {?} firstChange
2424
+ * @return {?}
2425
+ */
2426
+ NgDropdownPanelComponent.prototype._updateItemsRange = /**
2427
+ * @private
2428
+ * @param {?} firstChange
2429
+ * @return {?}
2430
+ */
2431
+ function (firstChange) {
2432
+ var _this = this;
2433
+ this._zone.runOutsideAngular((/**
2434
+ * @return {?}
2435
+ */
2436
+ function () {
2437
+ _this._measureDimensions().then((/**
2438
+ * @return {?}
2439
+ */
2440
+ function () {
2441
+ if (firstChange) {
2442
+ _this._renderItemsRange(_this._startOffset);
2443
+ _this._handleDropdownPosition();
2444
+ }
2445
+ else {
2446
+ _this._renderItemsRange();
2447
+ }
2448
+ }));
2449
+ }));
2450
+ };
2451
+ /**
2452
+ * @private
2453
+ * @param {?} scrollTop
2454
+ * @return {?}
2455
+ */
2456
+ NgDropdownPanelComponent.prototype._onContentScrolled = /**
2457
+ * @private
2458
+ * @param {?} scrollTop
2459
+ * @return {?}
2460
+ */
2461
+ function (scrollTop) {
2462
+ if (this.virtualScroll) {
2463
+ this._renderItemsRange(scrollTop);
2464
+ }
2465
+ this._lastScrollPosition = scrollTop;
2466
+ this._fireScrollToEnd(scrollTop);
2467
+ };
2468
+ /**
2469
+ * @private
2470
+ * @param {?} height
2471
+ * @return {?}
2472
+ */
2473
+ NgDropdownPanelComponent.prototype._updateVirtualHeight = /**
2474
+ * @private
2475
+ * @param {?} height
2476
+ * @return {?}
2477
+ */
2478
+ function (height) {
2479
+ if (this._updateScrollHeight) {
2480
+ this._virtualPadding.style.height = height + "px";
2481
+ this._updateScrollHeight = false;
2482
+ }
2483
+ };
2484
+ /**
2485
+ * @private
2486
+ * @return {?}
2487
+ */
2488
+ NgDropdownPanelComponent.prototype._onItemsLengthChanged = /**
2489
+ * @private
2490
+ * @return {?}
2491
+ */
2492
+ function () {
2493
+ this._updateScrollHeight = true;
2494
+ };
2495
+ Object.defineProperty(NgDropdownPanelComponent.prototype, "_startOffset", {
2496
+ get: /**
2497
+ * @private
2498
+ * @return {?}
2499
+ */
2500
+ function () {
2501
+ if (this.markedItem) {
2502
+ return this.markedItem.index * this._panelService.dimensions.itemHeight;
2503
+ }
2504
+ return 0;
2505
+ },
2506
+ enumerable: true,
2507
+ configurable: true
2508
+ });
2509
+ /**
2510
+ * @private
2511
+ * @param {?=} scrollTop
2512
+ * @return {?}
2513
+ */
2514
+ NgDropdownPanelComponent.prototype._renderItemsRange = /**
2515
+ * @private
2516
+ * @param {?=} scrollTop
2517
+ * @return {?}
2518
+ */
2519
+ function (scrollTop) {
2520
+ var _this = this;
2521
+ if (scrollTop === void 0) { scrollTop = null; }
2522
+ if (scrollTop && this._lastScrollPosition === scrollTop) {
2523
+ return;
2524
+ }
2525
+ scrollTop = scrollTop || this._scrollablePanel.scrollTop;
2526
+ /** @type {?} */
2527
+ var range = this._panelService.calculateItems(scrollTop, this.itemsLength, this.bufferAmount);
2528
+ this._updateVirtualHeight(range.scrollHeight);
2529
+ this._contentPanel.style.transform = "translateY(" + range.topPadding + "px)";
2530
+ this._zone.run((/**
2531
+ * @return {?}
2532
+ */
2533
+ function () {
2534
+ _this.update.emit(_this.items.slice(range.start, range.end));
2535
+ _this.scroll.emit({ start: range.start, end: range.end });
2536
+ }));
2537
+ if (isDefined(scrollTop) && this._lastScrollPosition === 0) {
2538
+ this._scrollablePanel.scrollTop = scrollTop;
2539
+ this._lastScrollPosition = scrollTop;
2540
+ }
2541
+ };
2542
+ /**
2543
+ * @private
2544
+ * @return {?}
2545
+ */
2546
+ NgDropdownPanelComponent.prototype._measureDimensions = /**
2547
+ * @private
2548
+ * @return {?}
2549
+ */
2550
+ function () {
2551
+ var _this = this;
2552
+ if (this._panelService.dimensions.itemHeight > 0 || this.itemsLength === 0) {
2553
+ return Promise.resolve(this._panelService.dimensions);
2554
+ }
2555
+ var _a = __read(this.items, 1), first = _a[0];
2556
+ this.update.emit([first]);
2557
+ return Promise.resolve().then((/**
2558
+ * @return {?}
2559
+ */
2560
+ function () {
2561
+ /** @type {?} */
2562
+ var option = _this._dropdown.querySelector("#" + first.htmlId);
2563
+ /** @type {?} */
2564
+ var optionHeight = option.clientHeight;
2565
+ _this._virtualPadding.style.height = optionHeight * _this.itemsLength + "px";
2566
+ /** @type {?} */
2567
+ var panelHeight = _this._scrollablePanel.clientHeight;
2568
+ _this._panelService.setDimensions(optionHeight, panelHeight);
2569
+ return _this._panelService.dimensions;
2570
+ }));
2571
+ };
2572
+ /**
2573
+ * @private
2574
+ * @param {?} scrollTop
2575
+ * @return {?}
2576
+ */
2577
+ NgDropdownPanelComponent.prototype._fireScrollToEnd = /**
2578
+ * @private
2579
+ * @param {?} scrollTop
2580
+ * @return {?}
2581
+ */
2582
+ function (scrollTop) {
2583
+ var _this = this;
2584
+ if (this._scrollToEndFired || scrollTop === 0) {
2585
+ return;
2586
+ }
2587
+ /** @type {?} */
2588
+ var padding = this.virtualScroll ?
2589
+ this._virtualPadding :
2590
+ this._contentPanel;
2591
+ if (scrollTop + this._dropdown.clientHeight >= padding.clientHeight) {
2592
+ this._zone.run((/**
2593
+ * @return {?}
2594
+ */
2595
+ function () { return _this.scrollToEnd.emit(); }));
2596
+ this._scrollToEndFired = true;
2597
+ }
2598
+ };
2599
+ /**
2600
+ * @private
2601
+ * @param {?} dropdownEl
2602
+ * @return {?}
2603
+ */
2604
+ NgDropdownPanelComponent.prototype._calculateCurrentPosition = /**
2605
+ * @private
2606
+ * @param {?} dropdownEl
2607
+ * @return {?}
2608
+ */
2609
+ function (dropdownEl) {
2610
+ if (this.position !== 'auto') {
2611
+ return this.position;
2612
+ }
2613
+ /** @type {?} */
2614
+ var selectRect = this._select.getBoundingClientRect();
2615
+ /** @type {?} */
2616
+ var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
2617
+ /** @type {?} */
2618
+ var offsetTop = selectRect.top + window.pageYOffset;
2619
+ /** @type {?} */
2620
+ var height = selectRect.height;
2621
+ /** @type {?} */
2622
+ var dropdownHeight = dropdownEl.getBoundingClientRect().height;
2623
+ if (offsetTop + height + dropdownHeight > scrollTop + document.documentElement.clientHeight) {
2624
+ return 'top';
2625
+ }
2626
+ else {
2627
+ return 'bottom';
2628
+ }
2629
+ };
2630
+ /**
2631
+ * @private
2632
+ * @return {?}
2633
+ */
2634
+ NgDropdownPanelComponent.prototype._appendDropdown = /**
2635
+ * @private
2636
+ * @return {?}
2637
+ */
2638
+ function () {
2639
+ if (!this.appendTo) {
2640
+ return;
2641
+ }
2642
+ this._parent = document.querySelector(this.appendTo);
2643
+ if (!parent) {
2644
+ throw new Error("appendTo selector " + this.appendTo + " did not found any parent element");
2645
+ }
2646
+ this._parent.appendChild(this._dropdown);
2647
+ };
2648
+ /**
2649
+ * @private
2650
+ * @return {?}
2651
+ */
2652
+ NgDropdownPanelComponent.prototype._updatePosition = /**
2653
+ * @private
2654
+ * @return {?}
2655
+ */
2656
+ function () {
2657
+ /** @type {?} */
2658
+ var select = this._select.getBoundingClientRect();
2659
+ /** @type {?} */
2660
+ var parent = this._parent.getBoundingClientRect();
2661
+ /** @type {?} */
2662
+ var offsetLeft = select.left - parent.left;
2663
+ this._setOffset(parent, select);
2664
+ this._dropdown.style.left = offsetLeft + 'px';
2665
+ this._dropdown.style.width = select.width + 'px';
2666
+ this._dropdown.style.minWidth = select.width + 'px';
2667
+ };
2668
+ /**
2669
+ * @private
2670
+ * @param {?} parent
2671
+ * @param {?} select
2672
+ * @return {?}
2673
+ */
2674
+ NgDropdownPanelComponent.prototype._setOffset = /**
2675
+ * @private
2676
+ * @param {?} parent
2677
+ * @param {?} select
2678
+ * @return {?}
2679
+ */
2680
+ function (parent, select) {
2681
+ /** @type {?} */
2682
+ var delta = select.height;
2683
+ if (this._currentPosition === 'top') {
2684
+ /** @type {?} */
2685
+ var offsetBottom = parent.bottom - select.bottom;
2686
+ this._dropdown.style.bottom = offsetBottom + delta + 'px';
2687
+ this._dropdown.style.top = 'auto';
2688
+ }
2689
+ else if (this._currentPosition === 'bottom') {
2690
+ /** @type {?} */
2691
+ var offsetTop = select.top - parent.top;
2692
+ this._dropdown.style.top = offsetTop + delta + 'px';
2693
+ this._dropdown.style.bottom = 'auto';
2694
+ }
2695
+ };
2696
+ NgDropdownPanelComponent.decorators = [
2697
+ { type: Component, args: [{
2698
+ changeDetection: ChangeDetectionStrategy.OnPush,
2699
+ encapsulation: ViewEncapsulation.None,
2700
+ selector: 'ng-dropdown-panel',
2701
+ template: "\n <div *ngIf=\"headerTemplate\" class=\"ng-dropdown-header\">\n <ng-container [ngTemplateOutlet]=\"headerTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: filterValue }\"></ng-container>\n </div>\n <div #scroll class=\"ng-dropdown-panel-items scroll-host\">\n <div #padding [class.total-padding]=\"virtualScroll\"></div>\n <div #content [class.scrollable-content]=\"virtualScroll && items.length\">\n <ng-content></ng-content>\n </div>\n </div>\n <div *ngIf=\"footerTemplate\" class=\"ng-dropdown-footer\">\n <ng-container [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{ searchTerm: filterValue }\"></ng-container>\n </div>\n "
2702
+ }] }
2703
+ ];
2704
+ /** @nocollapse */
2705
+ NgDropdownPanelComponent.ctorParameters = function () { return [
2706
+ { type: Renderer2 },
2707
+ { type: NgZone },
2708
+ { type: NgDropdownPanelService },
2709
+ { type: ElementRef },
2710
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
2711
+ ]; };
2712
+ NgDropdownPanelComponent.propDecorators = {
2713
+ items: [{ type: Input }],
2714
+ markedItem: [{ type: Input }],
2715
+ position: [{ type: Input }],
2716
+ appendTo: [{ type: Input }],
2717
+ bufferAmount: [{ type: Input }],
2718
+ virtualScroll: [{ type: Input }],
2719
+ headerTemplate: [{ type: Input }],
2720
+ footerTemplate: [{ type: Input }],
2721
+ filterValue: [{ type: Input }],
2722
+ update: [{ type: Output }],
2723
+ scroll: [{ type: Output }],
2724
+ scrollToEnd: [{ type: Output }],
2725
+ outsideClick: [{ type: Output }],
2726
+ contentElementRef: [{ type: ViewChild, args: ['content', { read: ElementRef, static: true },] }],
2727
+ scrollElementRef: [{ type: ViewChild, args: ['scroll', { read: ElementRef, static: true },] }],
2728
+ paddingElementRef: [{ type: ViewChild, args: ['padding', { read: ElementRef, static: true },] }],
2729
+ handleMousedown: [{ type: HostListener, args: ['mousedown', ['$event'],] }]
2730
+ };
2731
+ return NgDropdownPanelComponent;
2732
+ }());
2733
+
2734
+ /**
2735
+ * @fileoverview added by tsickle
2736
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2737
+ */
2738
+ var NgOptionComponent = /** @class */ (function () {
2739
+ function NgOptionComponent(elementRef) {
2740
+ this.elementRef = elementRef;
2741
+ this.stateChange$ = new Subject();
2742
+ this._disabled = false;
2743
+ }
2744
+ Object.defineProperty(NgOptionComponent.prototype, "disabled", {
2745
+ get: /**
2746
+ * @return {?}
2747
+ */
2748
+ function () { return this._disabled; },
2749
+ set: /**
2750
+ * @param {?} value
2751
+ * @return {?}
2752
+ */
2753
+ function (value) { this._disabled = this._isDisabled(value); },
2754
+ enumerable: true,
2755
+ configurable: true
2756
+ });
2757
+ /**
2758
+ * @param {?} changes
2759
+ * @return {?}
2760
+ */
2761
+ NgOptionComponent.prototype.ngOnChanges = /**
2762
+ * @param {?} changes
2763
+ * @return {?}
2764
+ */
2765
+ function (changes) {
2766
+ if (changes.disabled) {
2767
+ this.stateChange$.next({
2768
+ value: this.value,
2769
+ disabled: this._disabled
2770
+ });
2771
+ }
2772
+ };
2773
+ /**
2774
+ * @private
2775
+ * @param {?} value
2776
+ * @return {?}
2777
+ */
2778
+ NgOptionComponent.prototype._isDisabled = /**
2779
+ * @private
2780
+ * @param {?} value
2781
+ * @return {?}
2782
+ */
2783
+ function (value) {
2784
+ return value != null && "" + value !== 'false';
2785
+ };
2786
+ NgOptionComponent.decorators = [
2787
+ { type: Component, args: [{
2788
+ selector: 'ng-option',
2789
+ changeDetection: ChangeDetectionStrategy.OnPush,
2790
+ template: "<ng-content></ng-content>"
2791
+ }] }
2792
+ ];
2793
+ /** @nocollapse */
2794
+ NgOptionComponent.ctorParameters = function () { return [
2795
+ { type: ElementRef }
2796
+ ]; };
2797
+ NgOptionComponent.propDecorators = {
2798
+ value: [{ type: Input }],
2799
+ disabled: [{ type: Input }]
2800
+ };
2801
+ return NgOptionComponent;
2802
+ }());
2803
+
2804
+ /**
2805
+ * @fileoverview added by tsickle
2806
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2807
+ */
2808
+ var NgSelectConfig = /** @class */ (function () {
2809
+ function NgSelectConfig() {
2810
+ this.notFoundText = 'No items found';
2811
+ this.typeToSearchText = 'Type to search';
2812
+ this.addTagText = 'Add item';
2813
+ this.loadingText = 'Loading...';
2814
+ this.clearAllText = 'Clear all';
2815
+ this.disableVirtualScroll = true;
2816
+ this.openOnEnter = true;
2817
+ }
2818
+ NgSelectConfig.decorators = [
2819
+ { type: Injectable, args: [{ providedIn: 'root' },] }
2820
+ ];
2821
+ /** @nocollapse */ NgSelectConfig.ngInjectableDef = ɵɵdefineInjectable({ factory: function NgSelectConfig_Factory() { return new NgSelectConfig(); }, token: NgSelectConfig, providedIn: "root" });
2822
+ return NgSelectConfig;
2823
+ }());
2824
+
2825
+ /**
2826
+ * @fileoverview added by tsickle
2827
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2828
+ */
2829
+ /** @type {?} */
2830
+ var SELECTION_MODEL_FACTORY = new InjectionToken('ng-select-selection-model');
2831
+ var NgSelectComponent = /** @class */ (function () {
2832
+ function NgSelectComponent(classes, autoFocus, config, newSelectionModel, _elementRef, _cd, _console) {
2833
+ var _this = this;
2834
+ this.classes = classes;
2835
+ this.autoFocus = autoFocus;
2836
+ this._cd = _cd;
2837
+ this._console = _console;
2838
+ this.markFirst = true;
2839
+ this.dropdownPosition = 'auto';
2840
+ this.loading = false;
2841
+ this.closeOnSelect = true;
2842
+ this.hideSelected = false;
2843
+ this.selectOnTab = false;
2844
+ this.bufferAmount = 4;
2845
+ this.selectableGroup = false;
2846
+ this.selectableGroupAsModel = true;
2847
+ this.searchFn = null;
2848
+ this.trackByFn = null;
2849
+ this.clearOnBackspace = true;
2850
+ this.labelForId = null;
2851
+ this.inputAttrs = {};
2852
+ this.multiple = false;
2853
+ this.addTag = false;
2854
+ this.searchable = true;
2855
+ this.clearable = true;
2856
+ this.isOpen = false;
2857
+ // output events
2858
+ this.blurEvent = new EventEmitter();
2859
+ this.focusEvent = new EventEmitter();
2860
+ this.changeEvent = new EventEmitter();
2861
+ this.openEvent = new EventEmitter();
2862
+ this.closeEvent = new EventEmitter();
2863
+ this.searchEvent = new EventEmitter();
2864
+ this.clearEvent = new EventEmitter();
2865
+ this.addEvent = new EventEmitter();
2866
+ this.removeEvent = new EventEmitter();
2867
+ this.scroll = new EventEmitter();
2868
+ this.scrollToEnd = new EventEmitter();
2869
+ this.disabled = false;
2870
+ this.viewPortItems = [];
2871
+ this.searchTerm = null;
2872
+ this.dropdownId = newId();
2873
+ this._items = [];
2874
+ this._defaultLabel = 'label';
2875
+ this._pressedKeys = [];
2876
+ this._destroy$ = new Subject();
2877
+ this._keyPress$ = new Subject();
2878
+ this._onChange = (/**
2879
+ * @param {?} _
2880
+ * @return {?}
2881
+ */
2882
+ function (_) { });
2883
+ this._onTouched = (/**
2884
+ * @return {?}
2885
+ */
2886
+ function () { });
2887
+ this.clearItem = (/**
2888
+ * @param {?} item
2889
+ * @return {?}
2890
+ */
2891
+ function (item) {
2892
+ /** @type {?} */
2893
+ var option = _this.selectedItems.find((/**
2894
+ * @param {?} x
2895
+ * @return {?}
2896
+ */
2897
+ function (x) { return x.value === item; }));
2898
+ _this.unselect(option);
2899
+ });
2900
+ this.trackByOption = (/**
2901
+ * @param {?} _
2902
+ * @param {?} item
2903
+ * @return {?}
2904
+ */
2905
+ function (_, item) {
2906
+ if (_this.trackByFn) {
2907
+ return _this.trackByFn(item.value);
2908
+ }
2909
+ return item.htmlId;
2910
+ });
2911
+ this._mergeGlobalConfig(config);
2912
+ this.itemsList = new ItemsList(this, newSelectionModel());
2913
+ this.element = _elementRef.nativeElement;
2914
+ }
2915
+ Object.defineProperty(NgSelectComponent.prototype, "items", {
2916
+ get: /**
2917
+ * @return {?}
2918
+ */
2919
+ function () { return this._items; },
2920
+ set: /**
2921
+ * @param {?} value
2922
+ * @return {?}
2923
+ */
2924
+ function (value) {
2925
+ this._itemsAreUsed = true;
2926
+ this._items = value;
2927
+ },
2928
+ enumerable: true,
2929
+ configurable: true
2930
+ });
2931
+ Object.defineProperty(NgSelectComponent.prototype, "compareWith", {
2932
+ get: /**
2933
+ * @return {?}
2934
+ */
2935
+ function () { return this._compareWith; },
2936
+ set: /**
2937
+ * @param {?} fn
2938
+ * @return {?}
2939
+ */
2940
+ function (fn) {
2941
+ if (!isFunction(fn)) {
2942
+ throw Error('`compareWith` must be a function.');
2943
+ }
2944
+ this._compareWith = fn;
2945
+ },
2946
+ enumerable: true,
2947
+ configurable: true
2948
+ });
2949
+ Object.defineProperty(NgSelectComponent.prototype, "clearSearchOnAdd", {
2950
+ get: /**
2951
+ * @return {?}
2952
+ */
2953
+ function () { return isDefined(this._clearSearchOnAdd) ? this._clearSearchOnAdd : this.closeOnSelect; },
2954
+ set: /**
2955
+ * @param {?} value
2956
+ * @return {?}
2957
+ */
2958
+ function (value) {
2959
+ this._clearSearchOnAdd = value;
2960
+ },
2961
+ enumerable: true,
2962
+ configurable: true
2963
+ });
2964
+ Object.defineProperty(NgSelectComponent.prototype, "filtered", {
2965
+ get: /**
2966
+ * @return {?}
2967
+ */
2968
+ function () { return !!this.searchTerm && this.searchable; },
2969
+ enumerable: true,
2970
+ configurable: true
2971
+ });
2972
+ Object.defineProperty(NgSelectComponent.prototype, "selectedItems", {
2973
+ get: /**
2974
+ * @return {?}
2975
+ */
2976
+ function () {
2977
+ return this.itemsList.selectedItems;
2978
+ },
2979
+ enumerable: true,
2980
+ configurable: true
2981
+ });
2982
+ Object.defineProperty(NgSelectComponent.prototype, "selectedValues", {
2983
+ get: /**
2984
+ * @return {?}
2985
+ */
2986
+ function () {
2987
+ return this.selectedItems.map((/**
2988
+ * @param {?} x
2989
+ * @return {?}
2990
+ */
2991
+ function (x) { return x.value; }));
2992
+ },
2993
+ enumerable: true,
2994
+ configurable: true
2995
+ });
2996
+ Object.defineProperty(NgSelectComponent.prototype, "hasValue", {
2997
+ get: /**
2998
+ * @return {?}
2999
+ */
3000
+ function () {
3001
+ return this.selectedItems.length > 0;
3002
+ },
3003
+ enumerable: true,
3004
+ configurable: true
3005
+ });
3006
+ Object.defineProperty(NgSelectComponent.prototype, "currentPanelPosition", {
3007
+ get: /**
3008
+ * @return {?}
3009
+ */
3010
+ function () {
3011
+ if (this.dropdownPanel) {
3012
+ return this.dropdownPanel.currentPosition;
3013
+ }
3014
+ return undefined;
3015
+ },
3016
+ enumerable: true,
3017
+ configurable: true
3018
+ });
3019
+ /**
3020
+ * @return {?}
3021
+ */
3022
+ NgSelectComponent.prototype.ngOnInit = /**
3023
+ * @return {?}
3024
+ */
3025
+ function () {
3026
+ this._handleKeyPresses();
3027
+ this._setInputAttributes();
3028
+ };
3029
+ /**
3030
+ * @param {?} changes
3031
+ * @return {?}
3032
+ */
3033
+ NgSelectComponent.prototype.ngOnChanges = /**
3034
+ * @param {?} changes
3035
+ * @return {?}
3036
+ */
3037
+ function (changes) {
3038
+ if (changes.multiple) {
3039
+ this.itemsList.clearSelected();
3040
+ }
3041
+ if (changes.items) {
3042
+ this._setItems(changes.items.currentValue || []);
3043
+ }
3044
+ if (changes.isOpen) {
3045
+ this._manualOpen = isDefined(changes.isOpen.currentValue);
3046
+ }
3047
+ };
3048
+ /**
3049
+ * @return {?}
3050
+ */
3051
+ NgSelectComponent.prototype.ngAfterViewInit = /**
3052
+ * @return {?}
3053
+ */
3054
+ function () {
3055
+ if (!this._itemsAreUsed) {
3056
+ this._setItemsFromNgOptions();
3057
+ }
3058
+ if (isDefined(this.autoFocus)) {
3059
+ this.focus();
3060
+ }
3061
+ };
3062
+ /**
3063
+ * @return {?}
3064
+ */
3065
+ NgSelectComponent.prototype.ngOnDestroy = /**
3066
+ * @return {?}
3067
+ */
3068
+ function () {
3069
+ this._destroy$.next();
3070
+ this._destroy$.complete();
3071
+ };
3072
+ /**
3073
+ * @param {?} $event
3074
+ * @return {?}
3075
+ */
3076
+ NgSelectComponent.prototype.handleKeyDown = /**
3077
+ * @param {?} $event
3078
+ * @return {?}
3079
+ */
3080
+ function ($event) {
3081
+ if (KeyCode[$event.which]) {
3082
+ switch ($event.which) {
3083
+ case KeyCode.ArrowDown:
3084
+ this._handleArrowDown($event);
3085
+ break;
3086
+ case KeyCode.ArrowUp:
3087
+ this._handleArrowUp($event);
3088
+ break;
3089
+ case KeyCode.Space:
3090
+ this._handleSpace($event);
3091
+ break;
3092
+ case KeyCode.Enter:
3093
+ this._handleEnter($event);
3094
+ break;
3095
+ case KeyCode.Tab:
3096
+ this._handleTab($event);
3097
+ break;
3098
+ case KeyCode.Esc:
3099
+ this.close();
3100
+ $event.preventDefault();
3101
+ break;
3102
+ case KeyCode.Backspace:
3103
+ this._handleBackspace();
3104
+ break;
3105
+ }
3106
+ }
3107
+ else if ($event.key && $event.key.length === 1) {
3108
+ this._keyPress$.next($event.key.toLocaleLowerCase());
3109
+ }
3110
+ };
3111
+ /**
3112
+ * @param {?} $event
3113
+ * @return {?}
3114
+ */
3115
+ NgSelectComponent.prototype.handleMousedown = /**
3116
+ * @param {?} $event
3117
+ * @return {?}
3118
+ */
3119
+ function ($event) {
3120
+ /** @type {?} */
3121
+ var target = (/** @type {?} */ ($event.target));
3122
+ if (target.tagName !== 'INPUT') {
3123
+ $event.preventDefault();
3124
+ }
3125
+ if (target.classList.contains('ng-clear-wrapper')) {
3126
+ this.handleClearClick();
3127
+ return;
3128
+ }
3129
+ if (target.classList.contains('ng-arrow-wrapper')) {
3130
+ this.handleArrowClick();
3131
+ return;
3132
+ }
3133
+ if (target.classList.contains('ng-value-icon')) {
3134
+ return;
3135
+ }
3136
+ if (!this.focused) {
3137
+ this.focus();
3138
+ }
3139
+ if (this.searchable) {
3140
+ this.open();
3141
+ }
3142
+ else {
3143
+ this.toggle();
3144
+ }
3145
+ };
3146
+ /**
3147
+ * @return {?}
3148
+ */
3149
+ NgSelectComponent.prototype.handleArrowClick = /**
3150
+ * @return {?}
3151
+ */
3152
+ function () {
3153
+ if (this.isOpen) {
3154
+ this.close();
3155
+ }
3156
+ else {
3157
+ this.open();
3158
+ }
3159
+ };
3160
+ /**
3161
+ * @return {?}
3162
+ */
3163
+ NgSelectComponent.prototype.handleClearClick = /**
3164
+ * @return {?}
3165
+ */
3166
+ function () {
3167
+ if (this.hasValue) {
3168
+ this.itemsList.clearSelected(true);
3169
+ this._updateNgModel();
3170
+ }
3171
+ this._clearSearch();
3172
+ this.focus();
3173
+ if (this._isTypeahead) {
3174
+ this.typeahead.next(null);
3175
+ }
3176
+ this.clearEvent.emit();
3177
+ this._onSelectionChanged();
3178
+ };
3179
+ /**
3180
+ * @return {?}
3181
+ */
3182
+ NgSelectComponent.prototype.clearModel = /**
3183
+ * @return {?}
3184
+ */
3185
+ function () {
3186
+ if (!this.clearable) {
3187
+ return;
3188
+ }
3189
+ this.itemsList.clearSelected();
3190
+ this._updateNgModel();
3191
+ };
3192
+ /**
3193
+ * @param {?} value
3194
+ * @return {?}
3195
+ */
3196
+ NgSelectComponent.prototype.writeValue = /**
3197
+ * @param {?} value
3198
+ * @return {?}
3199
+ */
3200
+ function (value) {
3201
+ this.itemsList.clearSelected();
3202
+ this._handleWriteValue(value);
3203
+ this._cd.markForCheck();
3204
+ };
3205
+ /**
3206
+ * @param {?} fn
3207
+ * @return {?}
3208
+ */
3209
+ NgSelectComponent.prototype.registerOnChange = /**
3210
+ * @param {?} fn
3211
+ * @return {?}
3212
+ */
3213
+ function (fn) {
3214
+ this._onChange = fn;
3215
+ };
3216
+ /**
3217
+ * @param {?} fn
3218
+ * @return {?}
3219
+ */
3220
+ NgSelectComponent.prototype.registerOnTouched = /**
3221
+ * @param {?} fn
3222
+ * @return {?}
3223
+ */
3224
+ function (fn) {
3225
+ this._onTouched = fn;
3226
+ };
3227
+ /**
3228
+ * @param {?} isDisabled
3229
+ * @return {?}
3230
+ */
3231
+ NgSelectComponent.prototype.setDisabledState = /**
3232
+ * @param {?} isDisabled
3233
+ * @return {?}
3234
+ */
3235
+ function (isDisabled) {
3236
+ this.disabled = isDisabled;
3237
+ this._cd.markForCheck();
3238
+ };
3239
+ /**
3240
+ * @return {?}
3241
+ */
3242
+ NgSelectComponent.prototype.toggle = /**
3243
+ * @return {?}
3244
+ */
3245
+ function () {
3246
+ if (!this.isOpen) {
3247
+ this.open();
3248
+ }
3249
+ else {
3250
+ this.close();
3251
+ }
3252
+ };
3253
+ /**
3254
+ * @return {?}
3255
+ */
3256
+ NgSelectComponent.prototype.open = /**
3257
+ * @return {?}
3258
+ */
3259
+ function () {
3260
+ if (this.disabled || this.isOpen || this.itemsList.maxItemsSelected || this._manualOpen) {
3261
+ return;
3262
+ }
3263
+ if (!this._isTypeahead && !this.addTag && this.itemsList.noItemsToSelect) {
3264
+ return;
3265
+ }
3266
+ this.isOpen = true;
3267
+ this.itemsList.markSelectedOrDefault(this.markFirst);
3268
+ this.openEvent.emit();
3269
+ if (!this.searchTerm) {
3270
+ this.focus();
3271
+ }
3272
+ this.detectChanges();
3273
+ };
3274
+ /**
3275
+ * @return {?}
3276
+ */
3277
+ NgSelectComponent.prototype.close = /**
3278
+ * @return {?}
3279
+ */
3280
+ function () {
3281
+ if (!this.isOpen || this._manualOpen) {
3282
+ return;
3283
+ }
3284
+ this.isOpen = false;
3285
+ this._clearSearch();
3286
+ this.itemsList.unmarkItem();
3287
+ this._onTouched();
3288
+ this.closeEvent.emit();
3289
+ this._cd.markForCheck();
3290
+ };
3291
+ /**
3292
+ * @param {?} item
3293
+ * @return {?}
3294
+ */
3295
+ NgSelectComponent.prototype.toggleItem = /**
3296
+ * @param {?} item
3297
+ * @return {?}
3298
+ */
3299
+ function (item) {
3300
+ if (!item || item.disabled || this.disabled) {
3301
+ return;
3302
+ }
3303
+ if (this.multiple && item.selected) {
3304
+ this.unselect(item);
3305
+ }
3306
+ else {
3307
+ this.select(item);
3308
+ }
3309
+ this._onSelectionChanged();
3310
+ };
3311
+ /**
3312
+ * @param {?} item
3313
+ * @return {?}
3314
+ */
3315
+ NgSelectComponent.prototype.select = /**
3316
+ * @param {?} item
3317
+ * @return {?}
3318
+ */
3319
+ function (item) {
3320
+ if (!item.selected) {
3321
+ this.itemsList.select(item);
3322
+ if (this.clearSearchOnAdd) {
3323
+ this._clearSearch();
3324
+ }
3325
+ this._updateNgModel();
3326
+ if (this.multiple) {
3327
+ this.addEvent.emit(item.value);
3328
+ }
3329
+ }
3330
+ if (this.closeOnSelect || this.itemsList.noItemsToSelect) {
3331
+ this.close();
3332
+ }
3333
+ };
3334
+ /**
3335
+ * @return {?}
3336
+ */
3337
+ NgSelectComponent.prototype.focus = /**
3338
+ * @return {?}
3339
+ */
3340
+ function () {
3341
+ this.searchInput.nativeElement.focus();
3342
+ };
3343
+ /**
3344
+ * @return {?}
3345
+ */
3346
+ NgSelectComponent.prototype.blur = /**
3347
+ * @return {?}
3348
+ */
3349
+ function () {
3350
+ this.searchInput.nativeElement.blur();
3351
+ };
3352
+ /**
3353
+ * @param {?} item
3354
+ * @return {?}
3355
+ */
3356
+ NgSelectComponent.prototype.unselect = /**
3357
+ * @param {?} item
3358
+ * @return {?}
3359
+ */
3360
+ function (item) {
3361
+ if (!item) {
3362
+ return;
3363
+ }
3364
+ this.itemsList.unselect(item);
3365
+ this.focus();
3366
+ this._updateNgModel();
3367
+ this.removeEvent.emit(item);
3368
+ };
3369
+ /**
3370
+ * @return {?}
3371
+ */
3372
+ NgSelectComponent.prototype.selectTag = /**
3373
+ * @return {?}
3374
+ */
3375
+ function () {
3376
+ var _this = this;
3377
+ var _a;
3378
+ /** @type {?} */
3379
+ var tag;
3380
+ if (isFunction(this.addTag)) {
3381
+ tag = ((/** @type {?} */ (this.addTag)))(this.searchTerm);
3382
+ }
3383
+ else {
3384
+ tag = this._primitive ? this.searchTerm : (_a = {}, _a[this.bindLabel] = this.searchTerm, _a);
3385
+ }
3386
+ /** @type {?} */
3387
+ var handleTag = (/**
3388
+ * @param {?} item
3389
+ * @return {?}
3390
+ */
3391
+ function (item) { return _this._isTypeahead || !_this.isOpen ? _this.itemsList.mapItem(item, null) : _this.itemsList.addItem(item); });
3392
+ if (isPromise(tag)) {
3393
+ tag.then((/**
3394
+ * @param {?} item
3395
+ * @return {?}
3396
+ */
3397
+ function (item) { return _this.select(handleTag(item)); })).catch((/**
3398
+ * @return {?}
3399
+ */
3400
+ function () { }));
3401
+ }
3402
+ else if (tag) {
3403
+ this.select(handleTag(tag));
3404
+ }
3405
+ };
3406
+ /**
3407
+ * @return {?}
3408
+ */
3409
+ NgSelectComponent.prototype.showClear = /**
3410
+ * @return {?}
3411
+ */
3412
+ function () {
3413
+ return this.clearable && (this.hasValue || this.searchTerm) && !this.disabled;
3414
+ };
3415
+ Object.defineProperty(NgSelectComponent.prototype, "showAddTag", {
3416
+ get: /**
3417
+ * @return {?}
3418
+ */
3419
+ function () {
3420
+ if (!this.searchTerm) {
3421
+ return false;
3422
+ }
3423
+ /** @type {?} */
3424
+ var term = this.searchTerm.toLowerCase();
3425
+ return this.addTag &&
3426
+ (!this.itemsList.filteredItems.some((/**
3427
+ * @param {?} x
3428
+ * @return {?}
3429
+ */
3430
+ function (x) { return x.label.toLowerCase() === term; })) &&
3431
+ (!this.hideSelected && this.isOpen || !this.selectedItems.some((/**
3432
+ * @param {?} x
3433
+ * @return {?}
3434
+ */
3435
+ function (x) { return x.label.toLowerCase() === term; })))) &&
3436
+ !this.loading;
3437
+ },
3438
+ enumerable: true,
3439
+ configurable: true
3440
+ });
3441
+ /**
3442
+ * @return {?}
3443
+ */
3444
+ NgSelectComponent.prototype.showNoItemsFound = /**
3445
+ * @return {?}
3446
+ */
3447
+ function () {
3448
+ /** @type {?} */
3449
+ var empty = this.itemsList.filteredItems.length === 0;
3450
+ return ((empty && !this._isTypeahead && !this.loading) ||
3451
+ (empty && this._isTypeahead && this.searchTerm && !this.loading)) &&
3452
+ !this.showAddTag;
3453
+ };
3454
+ /**
3455
+ * @return {?}
3456
+ */
3457
+ NgSelectComponent.prototype.showTypeToSearch = /**
3458
+ * @return {?}
3459
+ */
3460
+ function () {
3461
+ /** @type {?} */
3462
+ var empty = this.itemsList.filteredItems.length === 0;
3463
+ return empty && this._isTypeahead && !this.searchTerm && !this.loading;
3464
+ };
3465
+ /**
3466
+ * @param {?} term
3467
+ * @return {?}
3468
+ */
3469
+ NgSelectComponent.prototype.filter = /**
3470
+ * @param {?} term
3471
+ * @return {?}
3472
+ */
3473
+ function (term) {
3474
+ this.searchTerm = term;
3475
+ if (this._isTypeahead) {
3476
+ this.typeahead.next(this.searchTerm);
3477
+ }
3478
+ else {
3479
+ this.itemsList.filter(this.searchTerm);
3480
+ if (this.isOpen) {
3481
+ this.itemsList.markSelectedOrDefault(this.markFirst);
3482
+ }
3483
+ }
3484
+ this.searchEvent.emit({ term: term, items: this.itemsList.filteredItems.map((/**
3485
+ * @param {?} x
3486
+ * @return {?}
3487
+ */
3488
+ function (x) { return x.value; })) });
3489
+ this.open();
3490
+ };
3491
+ /**
3492
+ * @param {?} $event
3493
+ * @return {?}
3494
+ */
3495
+ NgSelectComponent.prototype.onInputFocus = /**
3496
+ * @param {?} $event
3497
+ * @return {?}
3498
+ */
3499
+ function ($event) {
3500
+ if (this.focused) {
3501
+ return;
3502
+ }
3503
+ this.element.classList.add('ng-select-focused');
3504
+ this.focusEvent.emit($event);
3505
+ this.focused = true;
3506
+ };
3507
+ /**
3508
+ * @param {?} $event
3509
+ * @return {?}
3510
+ */
3511
+ NgSelectComponent.prototype.onInputBlur = /**
3512
+ * @param {?} $event
3513
+ * @return {?}
3514
+ */
3515
+ function ($event) {
3516
+ this.element.classList.remove('ng-select-focused');
3517
+ this.blurEvent.emit($event);
3518
+ if (!this.isOpen && !this.disabled) {
3519
+ this._onTouched();
3520
+ }
3521
+ this.focused = false;
3522
+ };
3523
+ /**
3524
+ * @param {?} item
3525
+ * @return {?}
3526
+ */
3527
+ NgSelectComponent.prototype.onItemHover = /**
3528
+ * @param {?} item
3529
+ * @return {?}
3530
+ */
3531
+ function (item) {
3532
+ if (item.disabled) {
3533
+ return;
3534
+ }
3535
+ this.itemsList.markItem(item);
3536
+ };
3537
+ /**
3538
+ * @return {?}
3539
+ */
3540
+ NgSelectComponent.prototype.detectChanges = /**
3541
+ * @return {?}
3542
+ */
3543
+ function () {
3544
+ if (!((/** @type {?} */ (this._cd))).destroyed) {
3545
+ this._cd.detectChanges();
3546
+ }
3547
+ };
3548
+ /**
3549
+ * @private
3550
+ * @param {?} items
3551
+ * @return {?}
3552
+ */
3553
+ NgSelectComponent.prototype._setItems = /**
3554
+ * @private
3555
+ * @param {?} items
3556
+ * @return {?}
3557
+ */
3558
+ function (items) {
3559
+ /** @type {?} */
3560
+ var firstItem = items[0];
3561
+ this.bindLabel = this.bindLabel || this._defaultLabel;
3562
+ this._primitive = isDefined(firstItem) ? !isObject(firstItem) : this._primitive || this.bindLabel === this._defaultLabel;
3563
+ this.itemsList.setItems(items);
3564
+ if (items.length > 0 && this.hasValue) {
3565
+ this.itemsList.mapSelectedItems();
3566
+ }
3567
+ if (this.isOpen && isDefined(this.searchTerm) && !this._isTypeahead) {
3568
+ this.itemsList.filter(this.searchTerm);
3569
+ }
3570
+ if (this._isTypeahead || this.isOpen) {
3571
+ this.itemsList.markSelectedOrDefault(this.markFirst);
3572
+ }
3573
+ };
3574
+ /**
3575
+ * @private
3576
+ * @return {?}
3577
+ */
3578
+ NgSelectComponent.prototype._setItemsFromNgOptions = /**
3579
+ * @private
3580
+ * @return {?}
3581
+ */
3582
+ function () {
3583
+ var _this = this;
3584
+ /** @type {?} */
3585
+ var handleNgOptions = (/**
3586
+ * @param {?} options
3587
+ * @return {?}
3588
+ */
3589
+ function (options) {
3590
+ _this.items = options.map((/**
3591
+ * @param {?} option
3592
+ * @return {?}
3593
+ */
3594
+ function (option) { return ({
3595
+ $ngOptionValue: option.value,
3596
+ $ngOptionLabel: option.elementRef.nativeElement.innerHTML,
3597
+ disabled: option.disabled
3598
+ }); }));
3599
+ _this.itemsList.setItems(_this.items);
3600
+ if (_this.hasValue) {
3601
+ _this.itemsList.mapSelectedItems();
3602
+ }
3603
+ _this.detectChanges();
3604
+ });
3605
+ /** @type {?} */
3606
+ var handleOptionChange = (/**
3607
+ * @return {?}
3608
+ */
3609
+ function () {
3610
+ /** @type {?} */
3611
+ var changedOrDestroyed = merge(_this.ngOptions.changes, _this._destroy$);
3612
+ merge.apply(void 0, __spread(_this.ngOptions.map((/**
3613
+ * @param {?} option
3614
+ * @return {?}
3615
+ */
3616
+ function (option) { return option.stateChange$; })))).pipe(takeUntil(changedOrDestroyed))
3617
+ .subscribe((/**
3618
+ * @param {?} option
3619
+ * @return {?}
3620
+ */
3621
+ function (option) {
3622
+ /** @type {?} */
3623
+ var item = _this.itemsList.findItem(option.value);
3624
+ item.disabled = option.disabled;
3625
+ _this._cd.markForCheck();
3626
+ }));
3627
+ });
3628
+ this.ngOptions.changes
3629
+ .pipe(startWith(this.ngOptions), takeUntil(this._destroy$))
3630
+ .subscribe((/**
3631
+ * @param {?} options
3632
+ * @return {?}
3633
+ */
3634
+ function (options) {
3635
+ _this.bindLabel = _this._defaultLabel;
3636
+ handleNgOptions(options);
3637
+ handleOptionChange();
3638
+ }));
3639
+ };
3640
+ /**
3641
+ * @private
3642
+ * @param {?} value
3643
+ * @return {?}
3644
+ */
3645
+ NgSelectComponent.prototype._isValidWriteValue = /**
3646
+ * @private
3647
+ * @param {?} value
3648
+ * @return {?}
3649
+ */
3650
+ function (value) {
3651
+ var _this = this;
3652
+ if (!isDefined(value) || (this.multiple && value === '') || Array.isArray(value) && value.length === 0) {
3653
+ return false;
3654
+ }
3655
+ /** @type {?} */
3656
+ var validateBinding = (/**
3657
+ * @param {?} item
3658
+ * @return {?}
3659
+ */
3660
+ function (item) {
3661
+ if (!isDefined(_this.compareWith) && isObject(item) && _this.bindValue) {
3662
+ _this._console.warn("Binding object(" + JSON.stringify(item) + ") with bindValue is not allowed.");
3663
+ return false;
3664
+ }
3665
+ return true;
3666
+ });
3667
+ if (this.multiple) {
3668
+ if (!Array.isArray(value)) {
3669
+ this._console.warn('Multiple select ngModel should be array.');
3670
+ return false;
3671
+ }
3672
+ return value.every((/**
3673
+ * @param {?} item
3674
+ * @return {?}
3675
+ */
3676
+ function (item) { return validateBinding(item); }));
3677
+ }
3678
+ else {
3679
+ return validateBinding(value);
3680
+ }
3681
+ };
3682
+ /**
3683
+ * @private
3684
+ * @param {?} ngModel
3685
+ * @return {?}
3686
+ */
3687
+ NgSelectComponent.prototype._handleWriteValue = /**
3688
+ * @private
3689
+ * @param {?} ngModel
3690
+ * @return {?}
3691
+ */
3692
+ function (ngModel) {
3693
+ var _this = this;
3694
+ if (!this._isValidWriteValue(ngModel)) {
3695
+ return;
3696
+ }
3697
+ /** @type {?} */
3698
+ var select = (/**
3699
+ * @param {?} val
3700
+ * @return {?}
3701
+ */
3702
+ function (val) {
3703
+ var _a;
3704
+ /** @type {?} */
3705
+ var item = _this.itemsList.findItem(val);
3706
+ if (item) {
3707
+ _this.itemsList.select(item);
3708
+ }
3709
+ else {
3710
+ /** @type {?} */
3711
+ var isValObject = isObject(val);
3712
+ /** @type {?} */
3713
+ var isPrimitive = !isValObject && !_this.bindValue;
3714
+ if ((isValObject || isPrimitive)) {
3715
+ _this.itemsList.select(_this.itemsList.mapItem(val, null));
3716
+ }
3717
+ else if (_this.bindValue) {
3718
+ item = (_a = {},
3719
+ _a[_this.bindLabel] = null,
3720
+ _a[_this.bindValue] = val,
3721
+ _a);
3722
+ _this.itemsList.select(_this.itemsList.mapItem(item, null));
3723
+ }
3724
+ }
3725
+ });
3726
+ if (this.multiple) {
3727
+ ((/** @type {?} */ (ngModel))).forEach((/**
3728
+ * @param {?} item
3729
+ * @return {?}
3730
+ */
3731
+ function (item) { return select(item); }));
3732
+ }
3733
+ else {
3734
+ select(ngModel);
3735
+ }
3736
+ };
3737
+ /**
3738
+ * @private
3739
+ * @return {?}
3740
+ */
3741
+ NgSelectComponent.prototype._handleKeyPresses = /**
3742
+ * @private
3743
+ * @return {?}
3744
+ */
3745
+ function () {
3746
+ var _this = this;
3747
+ if (this.searchable) {
3748
+ return;
3749
+ }
3750
+ this._keyPress$
3751
+ .pipe(takeUntil(this._destroy$), tap((/**
3752
+ * @param {?} letter
3753
+ * @return {?}
3754
+ */
3755
+ function (letter) { return _this._pressedKeys.push(letter); })), debounceTime(200), filter((/**
3756
+ * @return {?}
3757
+ */
3758
+ function () { return _this._pressedKeys.length > 0; })), map((/**
3759
+ * @return {?}
3760
+ */
3761
+ function () { return _this._pressedKeys.join(''); })))
3762
+ .subscribe((/**
3763
+ * @param {?} term
3764
+ * @return {?}
3765
+ */
3766
+ function (term) {
3767
+ /** @type {?} */
3768
+ var item = _this.itemsList.findByLabel(term);
3769
+ if (item) {
3770
+ if (_this.isOpen) {
3771
+ _this.itemsList.markItem(item);
3772
+ _this._cd.markForCheck();
3773
+ }
3774
+ else {
3775
+ _this.select(item);
3776
+ }
3777
+ }
3778
+ _this._pressedKeys = [];
3779
+ }));
3780
+ };
3781
+ /**
3782
+ * @private
3783
+ * @return {?}
3784
+ */
3785
+ NgSelectComponent.prototype._setInputAttributes = /**
3786
+ * @private
3787
+ * @return {?}
3788
+ */
3789
+ function () {
3790
+ var e_1, _a;
3791
+ /** @type {?} */
3792
+ var input = this.searchInput.nativeElement;
3793
+ /** @type {?} */
3794
+ var attributes = __assign({ type: 'text', autocorrect: 'off', autocapitalize: 'off', autocomplete: this.labelForId ? 'off' : this.dropdownId }, this.inputAttrs);
3795
+ try {
3796
+ for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
3797
+ var key = _c.value;
3798
+ input.setAttribute(key, attributes[key]);
3799
+ }
3800
+ }
3801
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3802
+ finally {
3803
+ try {
3804
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3805
+ }
3806
+ finally { if (e_1) throw e_1.error; }
3807
+ }
3808
+ };
3809
+ /**
3810
+ * @private
3811
+ * @return {?}
3812
+ */
3813
+ NgSelectComponent.prototype._updateNgModel = /**
3814
+ * @private
3815
+ * @return {?}
3816
+ */
3817
+ function () {
3818
+ var e_2, _a;
3819
+ /** @type {?} */
3820
+ var model = [];
3821
+ try {
3822
+ for (var _b = __values(this.selectedItems), _c = _b.next(); !_c.done; _c = _b.next()) {
3823
+ var item = _c.value;
3824
+ if (this.bindValue) {
3825
+ /** @type {?} */
3826
+ var value = null;
3827
+ if (item.children) {
3828
+ /** @type {?} */
3829
+ var groupKey = this.groupValue ? this.bindValue : (/** @type {?} */ (this.groupBy));
3830
+ value = item.value[groupKey || (/** @type {?} */ (this.groupBy))];
3831
+ }
3832
+ else {
3833
+ value = this.itemsList.resolveNested(item.value, this.bindValue);
3834
+ }
3835
+ model.push(value);
3836
+ }
3837
+ else {
3838
+ model.push(item.value);
3839
+ }
3840
+ }
3841
+ }
3842
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
3843
+ finally {
3844
+ try {
3845
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
3846
+ }
3847
+ finally { if (e_2) throw e_2.error; }
3848
+ }
3849
+ /** @type {?} */
3850
+ var selected = this.selectedItems.map((/**
3851
+ * @param {?} x
3852
+ * @return {?}
3853
+ */
3854
+ function (x) { return x.value; }));
3855
+ if (this.multiple) {
3856
+ this._onChange(model);
3857
+ this.changeEvent.emit(selected);
3858
+ }
3859
+ else {
3860
+ this._onChange(isDefined(model[0]) ? model[0] : null);
3861
+ this.changeEvent.emit(selected[0]);
3862
+ }
3863
+ this._cd.markForCheck();
3864
+ };
3865
+ /**
3866
+ * @private
3867
+ * @return {?}
3868
+ */
3869
+ NgSelectComponent.prototype._clearSearch = /**
3870
+ * @private
3871
+ * @return {?}
3872
+ */
3873
+ function () {
3874
+ if (!this.searchTerm) {
3875
+ return;
3876
+ }
3877
+ this.searchTerm = null;
3878
+ this.itemsList.resetFilteredItems();
3879
+ };
3880
+ /**
3881
+ * @private
3882
+ * @return {?}
3883
+ */
3884
+ NgSelectComponent.prototype._scrollToMarked = /**
3885
+ * @private
3886
+ * @return {?}
3887
+ */
3888
+ function () {
3889
+ if (!this.isOpen || !this.dropdownPanel) {
3890
+ return;
3891
+ }
3892
+ this.dropdownPanel.scrollTo(this.itemsList.markedItem);
3893
+ };
3894
+ /**
3895
+ * @private
3896
+ * @return {?}
3897
+ */
3898
+ NgSelectComponent.prototype._scrollToTag = /**
3899
+ * @private
3900
+ * @return {?}
3901
+ */
3902
+ function () {
3903
+ if (!this.isOpen || !this.dropdownPanel) {
3904
+ return;
3905
+ }
3906
+ this.dropdownPanel.scrollToTag();
3907
+ };
3908
+ /**
3909
+ * @private
3910
+ * @return {?}
3911
+ */
3912
+ NgSelectComponent.prototype._onSelectionChanged = /**
3913
+ * @private
3914
+ * @return {?}
3915
+ */
3916
+ function () {
3917
+ if (this.isOpen && this.multiple && this.appendTo) {
3918
+ // Make sure items are rendered.
3919
+ this._cd.detectChanges();
3920
+ this.dropdownPanel.adjustPosition();
3921
+ }
3922
+ };
3923
+ /**
3924
+ * @private
3925
+ * @param {?} $event
3926
+ * @return {?}
3927
+ */
3928
+ NgSelectComponent.prototype._handleTab = /**
3929
+ * @private
3930
+ * @param {?} $event
3931
+ * @return {?}
3932
+ */
3933
+ function ($event) {
3934
+ if (this.isOpen === false && !this.addTag) {
3935
+ return;
3936
+ }
3937
+ if (this.selectOnTab) {
3938
+ if (this.itemsList.markedItem) {
3939
+ this.toggleItem(this.itemsList.markedItem);
3940
+ $event.preventDefault();
3941
+ }
3942
+ else if (this.showAddTag) {
3943
+ this.selectTag();
3944
+ $event.preventDefault();
3945
+ }
3946
+ else {
3947
+ this.close();
3948
+ }
3949
+ }
3950
+ else {
3951
+ this.close();
3952
+ }
3953
+ };
3954
+ /**
3955
+ * @private
3956
+ * @param {?} $event
3957
+ * @return {?}
3958
+ */
3959
+ NgSelectComponent.prototype._handleEnter = /**
3960
+ * @private
3961
+ * @param {?} $event
3962
+ * @return {?}
3963
+ */
3964
+ function ($event) {
3965
+ if (this.isOpen || this._manualOpen) {
3966
+ if (this.itemsList.markedItem) {
3967
+ this.toggleItem(this.itemsList.markedItem);
3968
+ }
3969
+ else if (this.showAddTag) {
3970
+ this.selectTag();
3971
+ }
3972
+ }
3973
+ else if (this.openOnEnter) {
3974
+ this.open();
3975
+ }
3976
+ else {
3977
+ return;
3978
+ }
3979
+ $event.preventDefault();
3980
+ };
3981
+ /**
3982
+ * @private
3983
+ * @param {?} $event
3984
+ * @return {?}
3985
+ */
3986
+ NgSelectComponent.prototype._handleSpace = /**
3987
+ * @private
3988
+ * @param {?} $event
3989
+ * @return {?}
3990
+ */
3991
+ function ($event) {
3992
+ if (this.isOpen || this._manualOpen) {
3993
+ return;
3994
+ }
3995
+ this.open();
3996
+ $event.preventDefault();
3997
+ };
3998
+ /**
3999
+ * @private
4000
+ * @param {?} $event
4001
+ * @return {?}
4002
+ */
4003
+ NgSelectComponent.prototype._handleArrowDown = /**
4004
+ * @private
4005
+ * @param {?} $event
4006
+ * @return {?}
4007
+ */
4008
+ function ($event) {
4009
+ if (this._nextItemIsTag(+1)) {
4010
+ this.itemsList.unmarkItem();
4011
+ this._scrollToTag();
4012
+ }
4013
+ else {
4014
+ this.itemsList.markNextItem();
4015
+ this._scrollToMarked();
4016
+ }
4017
+ this.open();
4018
+ $event.preventDefault();
4019
+ };
4020
+ /**
4021
+ * @private
4022
+ * @param {?} $event
4023
+ * @return {?}
4024
+ */
4025
+ NgSelectComponent.prototype._handleArrowUp = /**
4026
+ * @private
4027
+ * @param {?} $event
4028
+ * @return {?}
4029
+ */
4030
+ function ($event) {
4031
+ if (!this.isOpen) {
4032
+ return;
4033
+ }
4034
+ if (this._nextItemIsTag(-1)) {
4035
+ this.itemsList.unmarkItem();
4036
+ this._scrollToTag();
4037
+ }
4038
+ else {
4039
+ this.itemsList.markPreviousItem();
4040
+ this._scrollToMarked();
4041
+ }
4042
+ $event.preventDefault();
4043
+ };
4044
+ /**
4045
+ * @private
4046
+ * @param {?} nextStep
4047
+ * @return {?}
4048
+ */
4049
+ NgSelectComponent.prototype._nextItemIsTag = /**
4050
+ * @private
4051
+ * @param {?} nextStep
4052
+ * @return {?}
4053
+ */
4054
+ function (nextStep) {
4055
+ /** @type {?} */
4056
+ var nextIndex = this.itemsList.markedIndex + nextStep;
4057
+ return this.addTag && this.searchTerm
4058
+ && this.itemsList.markedItem
4059
+ && (nextIndex < 0 || nextIndex === this.itemsList.filteredItems.length);
4060
+ };
4061
+ /**
4062
+ * @private
4063
+ * @return {?}
4064
+ */
4065
+ NgSelectComponent.prototype._handleBackspace = /**
4066
+ * @private
4067
+ * @return {?}
4068
+ */
4069
+ function () {
4070
+ if (this.searchTerm || !this.clearable || !this.clearOnBackspace || !this.hasValue) {
4071
+ return;
4072
+ }
4073
+ if (this.multiple) {
4074
+ this.unselect(this.itemsList.lastSelectedItem);
4075
+ }
4076
+ else {
4077
+ this.clearModel();
4078
+ }
4079
+ };
4080
+ Object.defineProperty(NgSelectComponent.prototype, "_isTypeahead", {
4081
+ get: /**
4082
+ * @private
4083
+ * @return {?}
4084
+ */
4085
+ function () {
4086
+ return this.typeahead && this.typeahead.observers.length > 0;
4087
+ },
4088
+ enumerable: true,
4089
+ configurable: true
4090
+ });
4091
+ /**
4092
+ * @private
4093
+ * @param {?} config
4094
+ * @return {?}
4095
+ */
4096
+ NgSelectComponent.prototype._mergeGlobalConfig = /**
4097
+ * @private
4098
+ * @param {?} config
4099
+ * @return {?}
4100
+ */
4101
+ function (config) {
4102
+ this.placeholder = this.placeholder || config.placeholder;
4103
+ this.notFoundText = this.notFoundText || config.notFoundText;
4104
+ this.typeToSearchText = this.typeToSearchText || config.typeToSearchText;
4105
+ this.addTagText = this.addTagText || config.addTagText;
4106
+ this.loadingText = this.loadingText || config.loadingText;
4107
+ this.clearAllText = this.clearAllText || config.clearAllText;
4108
+ this.virtualScroll = isDefined(this.virtualScroll)
4109
+ ? this.virtualScroll
4110
+ : isDefined(config.disableVirtualScroll) ? !config.disableVirtualScroll : false;
4111
+ this.openOnEnter = isDefined(this.openOnEnter) ? this.openOnEnter : config.openOnEnter;
4112
+ };
4113
+ NgSelectComponent.decorators = [
4114
+ { type: Component, args: [{
4115
+ selector: 'ng-select',
4116
+ template: "<div (mousedown)=\"handleMousedown($event)\" [class.ng-has-value]=\"hasValue\" class=\"ng-select-container\">\n <div class=\"ng-value-container\">\n <div class=\"ng-placeholder\">{{placeholder}}</div>\n\n <ng-container *ngIf=\"!multiLabelTemplate && selectedItems.length > 0\">\n <div [class.ng-value-disabled]=\"item.disabled\" class=\"ng-value\" *ngFor=\"let item of selectedItems; trackBy: trackByOption\">\n <ng-template #defaultLabelTemplate>\n <span class=\"ng-value-icon left\" (click)=\"unselect(item);\" aria-hidden=\"true\">\u00D7</span>\n <span class=\"ng-value-label\">{{item.label}}</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"labelTemplate || defaultLabelTemplate\"\n [ngTemplateOutletContext]=\"{ item: item.value, clear: clearItem, label: item.label }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-template *ngIf=\"multiLabelTemplate && selectedValues.length > 0\"\n [ngTemplateOutlet]=\"multiLabelTemplate\"\n [ngTemplateOutletContext]=\"{ items: selectedValues, clear: clearItem }\">\n </ng-template>\n\n <div class=\"ng-input\">\n <input #searchInput\n [attr.id]=\"labelForId\"\n [attr.tabindex]=\"tabIndex\"\n [readOnly]=\"!searchable || itemsList.maxItemsSelected\"\n [disabled]=\"disabled\"\n [value]=\"searchTerm ? searchTerm : ''\"\n (input)=\"filter(searchInput.value)\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n (change)=\"$event.stopPropagation()\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-owns]=\"isOpen ? dropdownId : null\"\n [attr.aria-activedescendant]=\"isOpen ? itemsList?.markedItem?.htmlId : null\">\n </div>\n </div>\n\n <ng-container *ngIf=\"loading\">\n <ng-template #defaultLoadingSpinnerTemplate>\n <div class=\"ng-spinner-loader\"></div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingSpinnerTemplate || defaultLoadingSpinnerTemplate\">\n </ng-template>\n </ng-container>\n\n <span *ngIf=\"showClear()\" class=\"ng-clear-wrapper\" title=\"{{clearAllText}}\">\n <span class=\"ng-clear\" aria-hidden=\"true\">\u00D7</span>\n </span>\n\n <span class=\"ng-arrow-wrapper\">\n <span class=\"ng-arrow\"></span>\n </span>\n</div>\n\n<ng-dropdown-panel *ngIf=\"isOpen\"\n class=\"ng-dropdown-panel\"\n [virtualScroll]=\"virtualScroll\"\n [bufferAmount]=\"bufferAmount\"\n [appendTo]=\"appendTo\"\n [position]=\"dropdownPosition\"\n [headerTemplate]=\"headerTemplate\"\n [footerTemplate]=\"footerTemplate\"\n [filterValue]=\"searchTerm\"\n [items]=\"itemsList.filteredItems\"\n [markedItem]=\"itemsList.markedItem\"\n (update)=\"viewPortItems = $event\"\n (scroll)=\"scroll.emit($event)\"\n (scrollToEnd)=\"scrollToEnd.emit($event)\"\n (outsideClick)=\"close()\"\n [class.ng-select-multiple]=\"multiple\"\n [ngClass]=\"appendTo ? classes : null\"\n [id]=\"dropdownId\">\n\n <ng-container>\n <div class=\"ng-option\" [attr.role]=\"item.children ? 'group' : 'option'\" (click)=\"toggleItem(item)\" (mouseover)=\"onItemHover(item)\"\n *ngFor=\"let item of viewPortItems; trackBy: trackByOption\"\n [class.ng-option-disabled]=\"item.disabled\"\n [class.ng-option-selected]=\"item.selected\"\n [class.ng-optgroup]=\"item.children\"\n [class.ng-option]=\"!item.children\"\n [class.ng-option-child]=\"!!item.parent\"\n [class.ng-option-marked]=\"item === itemsList.markedItem\"\n [attr.aria-selected]=\"item.selected\"\n [attr.id]=\"item?.htmlId\">\n\n <ng-template #defaultOptionTemplate>\n <span class=\"ng-option-label\">{{item.label}}</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"item.children ? (optgroupTemplate || defaultOptionTemplate) : (optionTemplate || defaultOptionTemplate)\"\n [ngTemplateOutletContext]=\"{ item: item.value, item$:item, index: item.index, searchTerm: searchTerm }\">\n </ng-template>\n </div>\n\n <div class=\"ng-option\" [class.ng-option-marked]=\"!itemsList.markedItem\" (mouseover)=\"itemsList.unmarkItem()\" role=\"option\" (click)=\"selectTag()\" *ngIf=\"showAddTag\">\n <ng-template #defaultTagTemplate>\n <span><span class=\"ng-tag-label\">{{addTagText}}</span>\"{{searchTerm}}\"</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"tagTemplate || defaultTagTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"showNoItemsFound()\">\n <ng-template #defaultNotFoundTemplate>\n <div class=\"ng-option ng-option-disabled\">{{notFoundText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"notFoundTemplate || defaultNotFoundTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"showTypeToSearch()\">\n <ng-template #defaultTypeToSearchTemplate>\n <div class=\"ng-option ng-option-disabled\">{{typeToSearchText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"typeToSearchTemplate || defaultTypeToSearchTemplate\">\n </ng-template>\n </ng-container>\n\n <ng-container *ngIf=\"loading && itemsList.filteredItems.length === 0\">\n <ng-template #defaultLoadingTextTemplate>\n <div class=\"ng-option ng-option-disabled\">{{loadingText}}</div>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]=\"loadingTextTemplate || defaultLoadingTextTemplate\"\n [ngTemplateOutletContext]=\"{ searchTerm: searchTerm }\">\n </ng-template>\n </ng-container>\n\n</ng-dropdown-panel>\n",
4117
+ providers: [{
4118
+ provide: NG_VALUE_ACCESSOR,
4119
+ useExisting: forwardRef((/**
4120
+ * @return {?}
4121
+ */
4122
+ function () { return NgSelectComponent; })),
4123
+ multi: true
4124
+ }, NgDropdownPanelService],
4125
+ encapsulation: ViewEncapsulation.None,
4126
+ changeDetection: ChangeDetectionStrategy.OnPush,
4127
+ host: {
4128
+ 'role': 'listbox',
4129
+ 'class': 'ng-select',
4130
+ '[class.ng-select-single]': '!multiple',
4131
+ },
4132
+ styles: [".ng-select{position:relative;display:block;box-sizing:border-box}.ng-select div,.ng-select input,.ng-select span{box-sizing:border-box}.ng-select [hidden]{display:none}.ng-select.ng-select-searchable .ng-select-container .ng-value-container .ng-input{opacity:1}.ng-select.ng-select-opened .ng-select-container{z-index:1001}.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-placeholder,.ng-select.ng-select-disabled .ng-select-container .ng-value-container .ng-value{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.ng-select.ng-select-disabled .ng-arrow-wrapper{cursor:default}.ng-select.ng-select-filtered .ng-placeholder{display:none}.ng-select .ng-select-container{color:#333;cursor:default;display:-webkit-box;display:flex;outline:0;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:-webkit-box;display:flex;-webkit-box-flex:1;flex:1}.ng-select .ng-select-container .ng-value-container .ng-input{opacity:0}.ng-select .ng-select-container .ng-value-container .ng-input>input{box-sizing:content-box;background:none;border:0;box-shadow:none;outline:0;cursor:default;width:100%}.ng-select .ng-select-container .ng-value-container .ng-input>input::-ms-clear{display:none}.ng-select .ng-select-container .ng-value-container .ng-input>input[readonly]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:0;padding:0}.ng-select.ng-select-single.ng-select-filtered .ng-select-container .ng-value-container .ng-value{visibility:hidden}.ng-select.ng-select-single .ng-select-container .ng-value-container,.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-single .ng-select-container .ng-value-container .ng-input{position:absolute;left:0;width:100%}.ng-select.ng-select-multiple.ng-select-disabled>.ng-select-container .ng-value-container .ng-value .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container{flex-wrap:wrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value{white-space:nowrap}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value.ng-value-disabled .ng-value-icon{display:none}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-value .ng-value-icon{cursor:pointer}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-input{-webkit-box-flex:1;flex:1;z-index:2}.ng-select.ng-select-multiple .ng-select-container .ng-value-container .ng-placeholder{position:absolute;z-index:1}.ng-select .ng-clear-wrapper{cursor:pointer;position:relative;width:17px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-clear-wrapper .ng-clear{display:inline-block;font-size:18px;line-height:1;pointer-events:none}.ng-select .ng-spinner-loader{border-radius:50%;width:17px;height:17px;margin-right:5px;font-size:10px;position:relative;text-indent:-9999em;border-top:2px solid rgba(66,66,66,.2);border-right:2px solid rgba(66,66,66,.2);border-bottom:2px solid rgba(66,66,66,.2);border-left:2px solid #424242;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation:.8s linear infinite load8;animation:.8s linear infinite load8}.ng-select .ng-spinner-loader:after{border-radius:50%;width:17px;height:17px}@-webkit-keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes load8{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ng-select .ng-arrow-wrapper{cursor:pointer;position:relative;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ng-select .ng-arrow-wrapper .ng-arrow{pointer-events:none;display:inline-block;height:0;width:0;position:relative}.ng-dropdown-panel{box-sizing:border-box;position:absolute;opacity:0;width:100%;z-index:1050;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .ng-dropdown-panel-items{display:block;height:auto;box-sizing:border-box;max-height:240px;overflow-y:auto}.ng-dropdown-panel .ng-dropdown-panel-items .ng-optgroup{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option{box-sizing:border-box;cursor:pointer;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option .highlighted{font-weight:700;text-decoration:underline}.ng-dropdown-panel .ng-dropdown-panel-items .ng-option.disabled{cursor:default}.ng-dropdown-panel .scroll-host{overflow:hidden;overflow-y:auto;position:relative;display:block;-webkit-overflow-scrolling:touch}.ng-dropdown-panel .scrollable-content{top:0;left:0;width:100%;height:100%;position:absolute}.ng-dropdown-panel .total-padding{width:1px;opacity:0}"]
4133
+ }] }
4134
+ ];
4135
+ /** @nocollapse */
4136
+ NgSelectComponent.ctorParameters = function () { return [
4137
+ { type: String, decorators: [{ type: Attribute, args: ['class',] }] },
4138
+ { type: undefined, decorators: [{ type: Attribute, args: ['autofocus',] }] },
4139
+ { type: NgSelectConfig },
4140
+ { type: undefined, decorators: [{ type: Inject, args: [SELECTION_MODEL_FACTORY,] }] },
4141
+ { type: ElementRef },
4142
+ { type: ChangeDetectorRef },
4143
+ { type: ConsoleService }
4144
+ ]; };
4145
+ NgSelectComponent.propDecorators = {
4146
+ bindLabel: [{ type: Input }],
4147
+ bindValue: [{ type: Input }],
4148
+ markFirst: [{ type: Input }],
4149
+ placeholder: [{ type: Input }],
4150
+ notFoundText: [{ type: Input }],
4151
+ typeToSearchText: [{ type: Input }],
4152
+ addTagText: [{ type: Input }],
4153
+ loadingText: [{ type: Input }],
4154
+ clearAllText: [{ type: Input }],
4155
+ dropdownPosition: [{ type: Input }],
4156
+ appendTo: [{ type: Input }],
4157
+ loading: [{ type: Input }],
4158
+ closeOnSelect: [{ type: Input }],
4159
+ hideSelected: [{ type: Input }],
4160
+ selectOnTab: [{ type: Input }],
4161
+ openOnEnter: [{ type: Input }],
4162
+ maxSelectedItems: [{ type: Input }],
4163
+ groupBy: [{ type: Input }],
4164
+ groupValue: [{ type: Input }],
4165
+ bufferAmount: [{ type: Input }],
4166
+ virtualScroll: [{ type: Input }],
4167
+ selectableGroup: [{ type: Input }],
4168
+ selectableGroupAsModel: [{ type: Input }],
4169
+ searchFn: [{ type: Input }],
4170
+ trackByFn: [{ type: Input }],
4171
+ clearOnBackspace: [{ type: Input }],
4172
+ labelForId: [{ type: Input }],
4173
+ inputAttrs: [{ type: Input }],
4174
+ tabIndex: [{ type: Input }],
4175
+ typeahead: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-typeahead',] }],
4176
+ multiple: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-multiple',] }],
4177
+ addTag: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-taggable',] }],
4178
+ searchable: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-searchable',] }],
4179
+ clearable: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-clearable',] }],
4180
+ isOpen: [{ type: Input }, { type: HostBinding, args: ['class.ng-select-opened',] }],
4181
+ items: [{ type: Input }],
4182
+ compareWith: [{ type: Input }],
4183
+ clearSearchOnAdd: [{ type: Input }],
4184
+ blurEvent: [{ type: Output, args: ['blur',] }],
4185
+ focusEvent: [{ type: Output, args: ['focus',] }],
4186
+ changeEvent: [{ type: Output, args: ['change',] }],
4187
+ openEvent: [{ type: Output, args: ['open',] }],
4188
+ closeEvent: [{ type: Output, args: ['close',] }],
4189
+ searchEvent: [{ type: Output, args: ['search',] }],
4190
+ clearEvent: [{ type: Output, args: ['clear',] }],
4191
+ addEvent: [{ type: Output, args: ['add',] }],
4192
+ removeEvent: [{ type: Output, args: ['remove',] }],
4193
+ scroll: [{ type: Output, args: ['scroll',] }],
4194
+ scrollToEnd: [{ type: Output, args: ['scrollToEnd',] }],
4195
+ optionTemplate: [{ type: ContentChild, args: [NgOptionTemplateDirective, { read: TemplateRef, static: true },] }],
4196
+ optgroupTemplate: [{ type: ContentChild, args: [NgOptgroupTemplateDirective, { read: TemplateRef, static: true },] }],
4197
+ labelTemplate: [{ type: ContentChild, args: [NgLabelTemplateDirective, { read: TemplateRef, static: true },] }],
4198
+ multiLabelTemplate: [{ type: ContentChild, args: [NgMultiLabelTemplateDirective, { read: TemplateRef, static: true },] }],
4199
+ headerTemplate: [{ type: ContentChild, args: [NgHeaderTemplateDirective, { read: TemplateRef, static: true },] }],
4200
+ footerTemplate: [{ type: ContentChild, args: [NgFooterTemplateDirective, { read: TemplateRef, static: true },] }],
4201
+ notFoundTemplate: [{ type: ContentChild, args: [NgNotFoundTemplateDirective, { read: TemplateRef, static: true },] }],
4202
+ typeToSearchTemplate: [{ type: ContentChild, args: [NgTypeToSearchTemplateDirective, { read: TemplateRef, static: true },] }],
4203
+ loadingTextTemplate: [{ type: ContentChild, args: [NgLoadingTextTemplateDirective, { read: TemplateRef, static: true },] }],
4204
+ tagTemplate: [{ type: ContentChild, args: [NgTagTemplateDirective, { read: TemplateRef, static: true },] }],
4205
+ loadingSpinnerTemplate: [{ type: ContentChild, args: [NgLoadingSpinnerTemplateDirective, { read: TemplateRef, static: true },] }],
4206
+ dropdownPanel: [{ type: ViewChild, args: [forwardRef((/**
4207
+ * @return {?}
4208
+ */
4209
+ function () { return NgDropdownPanelComponent; })), { static: false },] }],
4210
+ searchInput: [{ type: ViewChild, args: ['searchInput', { static: true },] }],
4211
+ ngOptions: [{ type: ContentChildren, args: [NgOptionComponent, { descendants: true },] }],
4212
+ disabled: [{ type: HostBinding, args: ['class.ng-select-disabled',] }],
4213
+ filtered: [{ type: HostBinding, args: ['class.ng-select-filtered',] }],
4214
+ handleKeyDown: [{ type: HostListener, args: ['keydown', ['$event'],] }]
4215
+ };
4216
+ return NgSelectComponent;
4217
+ }());
4218
+
4219
+ /**
4220
+ * @fileoverview added by tsickle
4221
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4222
+ */
4223
+ /**
4224
+ * @return {?}
4225
+ */
4226
+ function DefaultSelectionModelFactory() {
4227
+ return new DefaultSelectionModel();
4228
+ }
4229
+ var DefaultSelectionModel = /** @class */ (function () {
4230
+ function DefaultSelectionModel() {
4231
+ this._selected = [];
4232
+ }
4233
+ Object.defineProperty(DefaultSelectionModel.prototype, "value", {
4234
+ get: /**
4235
+ * @return {?}
4236
+ */
4237
+ function () {
4238
+ return this._selected;
4239
+ },
4240
+ enumerable: true,
4241
+ configurable: true
4242
+ });
4243
+ /**
4244
+ * @param {?} item
4245
+ * @param {?} multiple
4246
+ * @param {?} groupAsModel
4247
+ * @return {?}
4248
+ */
4249
+ DefaultSelectionModel.prototype.select = /**
4250
+ * @param {?} item
4251
+ * @param {?} multiple
4252
+ * @param {?} groupAsModel
4253
+ * @return {?}
4254
+ */
4255
+ function (item, multiple, groupAsModel) {
4256
+ item.selected = true;
4257
+ if (groupAsModel || !item.children) {
4258
+ this._selected.push(item);
4259
+ }
4260
+ if (multiple) {
4261
+ if (item.parent) {
4262
+ /** @type {?} */
4263
+ var childrenCount = item.parent.children.length;
4264
+ /** @type {?} */
4265
+ var selectedCount = item.parent.children.filter((/**
4266
+ * @param {?} x
4267
+ * @return {?}
4268
+ */
4269
+ function (x) { return x.selected; })).length;
4270
+ item.parent.selected = childrenCount === selectedCount;
4271
+ }
4272
+ else if (item.children) {
4273
+ this._setChildrenSelectedState(item.children, true);
4274
+ this._removeChildren(item);
4275
+ if (!groupAsModel) {
4276
+ this._selected = __spread(this._selected, item.children);
4277
+ }
4278
+ }
4279
+ }
4280
+ };
4281
+ /**
4282
+ * @param {?} item
4283
+ * @param {?} multiple
4284
+ * @return {?}
4285
+ */
4286
+ DefaultSelectionModel.prototype.unselect = /**
4287
+ * @param {?} item
4288
+ * @param {?} multiple
4289
+ * @return {?}
4290
+ */
4291
+ function (item, multiple) {
4292
+ var _a;
4293
+ this._selected = this._selected.filter((/**
4294
+ * @param {?} x
4295
+ * @return {?}
4296
+ */
4297
+ function (x) { return x !== item; }));
4298
+ item.selected = false;
4299
+ if (multiple) {
4300
+ if (item.parent && item.parent.selected) {
4301
+ /** @type {?} */
4302
+ var children = item.parent.children;
4303
+ this._removeParent(item.parent);
4304
+ this._removeChildren(item.parent);
4305
+ (_a = this._selected).push.apply(_a, __spread(children.filter((/**
4306
+ * @param {?} x
4307
+ * @return {?}
4308
+ */
4309
+ function (x) { return x !== item; }))));
4310
+ item.parent.selected = false;
4311
+ }
4312
+ else if (item.children) {
4313
+ this._setChildrenSelectedState(item.children, false);
4314
+ this._removeChildren(item);
4315
+ }
4316
+ }
4317
+ };
4318
+ /**
4319
+ * @param {?} keepDisabled
4320
+ * @return {?}
4321
+ */
4322
+ DefaultSelectionModel.prototype.clear = /**
4323
+ * @param {?} keepDisabled
4324
+ * @return {?}
4325
+ */
4326
+ function (keepDisabled) {
4327
+ this._selected = keepDisabled ? this._selected.filter((/**
4328
+ * @param {?} x
4329
+ * @return {?}
4330
+ */
4331
+ function (x) { return x.disabled; })) : [];
4332
+ };
4333
+ /**
4334
+ * @private
4335
+ * @param {?} children
4336
+ * @param {?} selected
4337
+ * @return {?}
4338
+ */
4339
+ DefaultSelectionModel.prototype._setChildrenSelectedState = /**
4340
+ * @private
4341
+ * @param {?} children
4342
+ * @param {?} selected
4343
+ * @return {?}
4344
+ */
4345
+ function (children, selected) {
4346
+ children.forEach((/**
4347
+ * @param {?} x
4348
+ * @return {?}
4349
+ */
4350
+ function (x) { return x.selected = selected; }));
4351
+ };
4352
+ /**
4353
+ * @private
4354
+ * @param {?} parent
4355
+ * @return {?}
4356
+ */
4357
+ DefaultSelectionModel.prototype._removeChildren = /**
4358
+ * @private
4359
+ * @param {?} parent
4360
+ * @return {?}
4361
+ */
4362
+ function (parent) {
4363
+ this._selected = this._selected.filter((/**
4364
+ * @param {?} x
4365
+ * @return {?}
4366
+ */
4367
+ function (x) { return x.parent !== parent; }));
4368
+ };
4369
+ /**
4370
+ * @private
4371
+ * @param {?} parent
4372
+ * @return {?}
4373
+ */
4374
+ DefaultSelectionModel.prototype._removeParent = /**
4375
+ * @private
4376
+ * @param {?} parent
4377
+ * @return {?}
4378
+ */
4379
+ function (parent) {
4380
+ this._selected = this._selected.filter((/**
4381
+ * @param {?} x
4382
+ * @return {?}
4383
+ */
4384
+ function (x) { return x !== parent; }));
4385
+ };
4386
+ return DefaultSelectionModel;
4387
+ }());
4388
+
4389
+ /**
4390
+ * @fileoverview added by tsickle
4391
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4392
+ */
4393
+ var ɵ0 = DefaultSelectionModelFactory;
4394
+ var NgSelectModule = /** @class */ (function () {
4395
+ function NgSelectModule() {
4396
+ }
4397
+ NgSelectModule.decorators = [
4398
+ { type: NgModule, args: [{
4399
+ declarations: [
4400
+ NgDropdownPanelComponent,
4401
+ NgOptionComponent,
4402
+ NgSelectComponent,
4403
+ NgOptgroupTemplateDirective,
4404
+ NgOptionTemplateDirective,
4405
+ NgLabelTemplateDirective,
4406
+ NgMultiLabelTemplateDirective,
4407
+ NgHeaderTemplateDirective,
4408
+ NgFooterTemplateDirective,
4409
+ NgNotFoundTemplateDirective,
4410
+ NgTypeToSearchTemplateDirective,
4411
+ NgLoadingTextTemplateDirective,
4412
+ NgTagTemplateDirective,
4413
+ NgLoadingSpinnerTemplateDirective
4414
+ ],
4415
+ imports: [
4416
+ CommonModule
4417
+ ],
4418
+ exports: [
4419
+ NgSelectComponent,
4420
+ NgOptionComponent,
4421
+ NgOptgroupTemplateDirective,
4422
+ NgOptionTemplateDirective,
4423
+ NgLabelTemplateDirective,
4424
+ NgMultiLabelTemplateDirective,
4425
+ NgHeaderTemplateDirective,
4426
+ NgFooterTemplateDirective,
4427
+ NgNotFoundTemplateDirective,
4428
+ NgTypeToSearchTemplateDirective,
4429
+ NgLoadingTextTemplateDirective,
4430
+ NgTagTemplateDirective,
4431
+ NgLoadingSpinnerTemplateDirective
4432
+ ],
4433
+ providers: [
4434
+ { provide: SELECTION_MODEL_FACTORY, useValue: ɵ0 }
4435
+ ]
4436
+ },] }
4437
+ ];
4438
+ return NgSelectModule;
4439
+ }());
4440
+
4441
+ export { NgSelectComponent, NgSelectConfig, NgSelectModule, SELECTION_MODEL_FACTORY, DefaultSelectionModelFactory as ɵb, DefaultSelectionModel as ɵc, NgDropdownPanelService as ɵd, NgOptionTemplateDirective as ɵe, NgOptgroupTemplateDirective as ɵf, NgLabelTemplateDirective as ɵg, NgMultiLabelTemplateDirective as ɵh, NgHeaderTemplateDirective as ɵi, NgFooterTemplateDirective as ɵj, NgNotFoundTemplateDirective as ɵk, NgTypeToSearchTemplateDirective as ɵl, NgLoadingTextTemplateDirective as ɵm, NgTagTemplateDirective as ɵn, NgLoadingSpinnerTemplateDirective as ɵo, NgDropdownPanelComponent as ɵp, NgOptionComponent as ɵq, ConsoleService as ɵr };
4442
+ //# sourceMappingURL=ng-select-ng-select.js.map