@ng-select/ng-select
Version:
Angular ng-select - All in One UI Select, Multiselect and Autocomplete
1 lines • 60.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("rxjs/operators"),require("rxjs"),require("@angular/forms")):"function"==typeof define&&define.amd?define("@ng-select/ng-select",["exports","@angular/core","@angular/common","rxjs/operators","rxjs","@angular/forms"],t):t((e["ng-select"]=e["ng-select"]||{},e["ng-select"]["ng-select"]={}),e.ng.core,e.ng.common,e.rxjs.operators,e.rxjs,e.ng.forms)}(this,function(e,a,t,r,c,n){"use strict";function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||0<t--)&&!(i=s.next()).done;)o.push(i.value)}catch(l){r={error:l}}finally{try{i&&!i.done&&(n=s["return"])&&n.call(s)}finally{if(r)throw r.error}}return o}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(y(arguments[t]));return e}var i=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-option-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),s=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-optgroup-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),o=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-label-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),l=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-multi-label-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),p=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-header-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),d=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-footer-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),u=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-notfound-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),h=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-typetosearch-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),m=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-loadingtext-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),g=function(){function e(e){this.template=e}return e.decorators=[{type:a.Directive,args:[{selector:"[ng-tag-tmp]"}]}],e.ctorParameters=function(){return[{type:a.TemplateRef}]},e}(),_=function(){function e(){}return e.prototype.warn=function(e){console.warn(e)},e.decorators=[{type:a.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=a.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();function b(e){return e!==undefined&&null!==e}function I(e){return"object"==typeof e&&b(e)}function w(e){return e instanceof Function}var T={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};function x(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return T[e]||e})}function O(){return"axxxxxxxxxxx".replace(/[x]/g,function(e){return(16*Math.random()|0).toString(16)})}var S=function(){function e(e,t){this._ngSelect=e,this._selectionModel=t,this._items=[],this._filteredItems=[],this._markedIndex=-1}return Object.defineProperty(e.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filteredItems",{get:function(){return this._filteredItems},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"markedIndex",{get:function(){return this._markedIndex},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedItems",{get:function(){return this._selectionModel.value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"markedItem",{get:function(){return this._filteredItems[this._markedIndex]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"noItemsToSelect",{get:function(){return this._ngSelect.hideSelected&&this._items.length===this.selectedItems.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxItemsSelected",{get:function(){return this._ngSelect.multiple&&this._ngSelect.maxSelectedItems<=this.selectedItems.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastSelectedItem",{get:function(){return this.selectedItems[this.selectedItems.length-1]},enumerable:!0,configurable:!0}),e.prototype.setItems=function(e){var n=this;this._items=e.map(function(e,t){return n.mapItem(e,t)}),this._ngSelect.groupBy?(this._groups=this._groupBy(this._items,this._ngSelect.groupBy),this._items=this._flatten(this._groups)):(this._groups=new Map,this._groups.set(undefined,this._items)),this._filteredItems=v(this._items)},e.prototype.select=function(e){if(!e.selected&&!this.maxItemsSelected){var t=this._ngSelect.multiple;t||this.clearSelected(),this._selectionModel.select(e,t,this._ngSelect.selectableGroupAsModel),this._ngSelect.hideSelected&&t&&this._hideSelected(e)}},e.prototype.unselect=function(e){e.selected&&(this._selectionModel.unselect(e,this._ngSelect.multiple),this._ngSelect.hideSelected&&b(e.index)&&this._ngSelect.multiple&&this._showSelected(e))},e.prototype.findItem=function(t){var n,i=this;return n=this._ngSelect.compareWith?function(e){return i._ngSelect.compareWith(e.value,t)}:this._ngSelect.bindValue?function(e){return!e.children&&i.resolveNested(e.value,i._ngSelect.bindValue)===t}:function(e){return e.value===t||!e.children&&e.label&&e.label===i.resolveNested(t,i._ngSelect.bindLabel)},this._items.find(function(e){return n(e)})},e.prototype.addItem=function(e){var t=this.mapItem(e,this._items.length);return this._items.push(t),this._filteredItems.push(t),t},e.prototype.clearSelected=function(){this._selectionModel.clear(),this._items.forEach(function(e){e.selected=!1,e.marked=!1}),this._ngSelect.hideSelected&&this.resetFilteredItems()},e.prototype.findByLabel=function(t){return t=x(t).toLocaleLowerCase(),this.filteredItems.find(function(e){return x(e.label).toLocaleLowerCase().substr(0,t.length)===t})},e.prototype.filter=function(u){var e,t;if(u){this._filteredItems=[],u=this._ngSelect.searchFn?u:x(u).toLocaleLowerCase();var h=this._ngSelect.searchFn||this._defaultSearchFn,m=this._ngSelect.hideSelected,n=function(e){var t,n,i,r=[];try{for(var s=f(g._groups.get(e)),o=s.next();!o.done;o=s.next()){var l=o.value;if(!m||!(l.parent&&l.parent.selected||l.selected)){var a=g._ngSelect.searchFn?l.value:l;h(u,a)&&r.push(l)}}}catch(d){t={error:d}}finally{try{o&&!o.done&&(n=s["return"])&&n.call(s)}finally{if(t)throw t.error}}if(0<r.length){var c=y(r.slice(-1),1)[0];if(c.parent){var p=g._items.find(function(e){return e===c.parent});g._filteredItems.push(p)}(i=g._filteredItems).push.apply(i,v(r))}},g=this;try{for(var i=f(Array.from(this._groups.keys())),r=i.next();!r.done;r=i.next()){n(r.value)}}catch(s){e={error:s}}finally{try{r&&!r.done&&(t=i["return"])&&t.call(i)}finally{if(e)throw e.error}}}else this.resetFilteredItems()},e.prototype.resetFilteredItems=function(){this._filteredItems.length!==this._items.length&&(this._ngSelect.hideSelected&&0<this.selectedItems.length?this._filteredItems=this._items.filter(function(e){return!e.selected}):this._filteredItems=this._items)},e.prototype.unmarkItem=function(){this._markedIndex=-1},e.prototype.markNextItem=function(){this._stepToItem(1)},e.prototype.markPreviousItem=function(){this._stepToItem(-1)},e.prototype.markItem=function(e){this._markedIndex=this._filteredItems.indexOf(e)},e.prototype.markSelectedOrDefault=function(e){if(0!==this._filteredItems.length){var t=this._ngSelect.hideSelected?-1:this._filteredItems.indexOf(this.lastSelectedItem);this.lastSelectedItem&&-1<t?this._markedIndex=t:this._markedIndex=e?this.filteredItems.findIndex(function(e){return!e.disabled}):-1}},e.prototype.resolveNested=function(e,t){if(!I(e))return e;if(-1===t.indexOf("."))return e[t];for(var n=t.split("."),i=e,r=0,s=n.length;r<s;++r){if(null==i)return null;i=i[n[r]]}return i},e.prototype.mapItem=function(e,t){var n=b(e.$ngOptionLabel)?e.$ngOptionLabel:this.resolveNested(e,this._ngSelect.bindLabel),i=b(e.$ngOptionValue)?e.$ngOptionValue:e;return{index:t,label:b(n)?n.toString():"",value:i,disabled:e.disabled,htmlId:O()}},e.prototype.mapSelectedItems=function(){var r=this;this.selectedItems.forEach(function(e,t){var n=r._ngSelect.bindValue?e.value[r._ngSelect.bindValue]:e.value,i=r.findItem(n);i&&e!==i&&(i.selected=!0,r.selectedItems[t]=i)}),this._ngSelect.hideSelected&&(this._filteredItems=this.filteredItems.filter(function(e){return-1===r.selectedItems.indexOf(e)}))},e.prototype._showSelected=function(e){var t,n;if(this._filteredItems.push(e),e.parent){var i=e.parent;this._filteredItems.find(function(e){return e===i})||this._filteredItems.push(i)}else if(e.children)try{for(var r=f(e.children),s=r.next();!s.done;s=r.next()){var o=s.value;o.selected=!1,this._filteredItems.push(o)}}catch(l){t={error:l}}finally{try{s&&!s.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}this._filteredItems=v(this._filteredItems.sort(function(e,t){return e.index-t.index}))},e.prototype._hideSelected=function(t){(this._filteredItems=this._filteredItems.filter(function(e){return e!==t}),t.parent)?t.parent.children.every(function(e){return e.selected})&&(this._filteredItems=this._filteredItems.filter(function(e){return e!==t.parent})):t.children&&(this._filteredItems=this.filteredItems.filter(function(e){return e.parent!==t}))},e.prototype._defaultSearchFn=function(e,t){return-1<x(t.label).toLocaleLowerCase().indexOf(e)},e.prototype._getNextItemIndex=function(e){return 0<e?this._markedIndex===this._filteredItems.length-1?0:this._markedIndex+1:this._markedIndex<=0?this._filteredItems.length-1:this._markedIndex-1},e.prototype._stepToItem=function(e){0===this._filteredItems.length||this._filteredItems.every(function(e){return e.disabled})||(this._markedIndex=this._getNextItemIndex(e),this.markedItem.disabled&&this._stepToItem(e))},e.prototype._groupBy=function(e,t){var n,i,r=w(this._ngSelect.groupBy),s=new Map;try{for(var o=f(e),l=o.next();!l.done;l=o.next()){var a=l.value,c=r?t.apply(this,[a.value]):a.value[t];c=b(c)?c:undefined;var p=s.get(c);p?p.push(a):s.set(c,[a])}}catch(d){n={error:d}}finally{try{l&&!l.done&&(i=o["return"])&&i.call(o)}finally{if(n)throw n.error}}return s},e.prototype._flatten=function(s){var e,t,o=w(this._ngSelect.groupBy),l=[],n=s.get(undefined)||[];l.push.apply(l,v(n));var a=n.length,i=function(e){var t;if(!b(e))return"continue";var n={label:e,children:undefined,parent:null,index:a++,disabled:!c._ngSelect.selectableGroup,htmlId:O()},i=o?c._ngSelect.bindLabel:c._ngSelect.groupBy;n.value=((t={})[i]=e,t),l.push(n);var r=s.get(e).map(function(e){return e.parent=n,e.children=undefined,e.index=a++,e});n.children=r,l.push.apply(l,v(r))},c=this;try{for(var r=f(Array.from(s.keys())),p=r.next();!p.done;p=r.next()){i(p.value)}}catch(d){e={error:d}}finally{try{p&&!p.done&&(t=r["return"])&&t.call(r)}finally{if(e)throw e.error}}return l},e}(),E={Tab:9,Enter:13,Esc:27,Space:32,ArrowUp:38,ArrowDown:40,Backspace:8};E[E.Tab]="Tab",E[E.Enter]="Enter",E[E.Esc]="Esc",E[E.Space]="Space",E[E.ArrowUp]="ArrowUp",E[E.ArrowDown]="ArrowDown",E[E.Backspace]="Backspace";var k=function(){function e(){}return e.prototype.requestAnimationFrame=function(e){return window.requestAnimationFrame(e)},e.prototype.setTimeout=function(e,t){return window.setTimeout(e,t)},e.decorators=[{type:a.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=a.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),L=function(){function e(){}return e.prototype.calculateItems=function(e,t,n){var i=e.childHeight*e.itemsLength;t.scrollTop>i&&(t.scrollTop=i);var r=Math.max(0,t.scrollTop)/i*e.itemsLength,s=Math.min(e.itemsLength,Math.ceil(r)+(e.itemsPerCol+1)),o=s,l=Math.max(0,o-e.itemsPerCol-1),a=Math.min(l,Math.floor(r)),c=e.childHeight*Math.ceil(a)-e.childHeight*Math.min(a,n);return c=isNaN(c)?0:c,a=isNaN(a)?-1:a,s=isNaN(s)?-1:s,a-=n,s+=n,{topPadding:c,scrollHeight:i,start:a=Math.max(0,a),end:s=Math.min(e.itemsLength,s)}},e.prototype.calculateDimensions=function(e,t,n,i){var r=n.getBoundingClientRect(),s=i.children[t]?i.children[t].getBoundingClientRect():{width:r.width,height:r.height,top:0},o=Math.max(1,Math.floor(r.height/s.height));return{itemsLength:e,viewWidth:r.width,viewHeight:r.height,childWidth:s.width,childHeight:s.height,itemsPerCol:o}},e.decorators=[{type:a.Injectable,args:[{providedIn:"root"}]}],e.ngInjectableDef=a.defineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}(),C="ng-select-top",A="ng-select-bottom",P=function(){function e(e,t,n,i,r,s){this._renderer=e,this._zone=t,this._virtualScrollService=n,this._window=i,this._document=s,this.items=[],this.position="auto",this.bufferAmount=4,this.virtualScroll=!1,this.update=new a.EventEmitter,this.scroll=new a.EventEmitter,this.scrollToEnd=new a.EventEmitter,this.outsideClick=new a.EventEmitter,this._destroy$=new c.Subject,this._startupLoop=!0,this._isScrolledToMarked=!1,this._scrollToEndFired=!1,this._disposeScrollListener=function(){},this._disposeDocumentResizeListener=function(){},this._dropdown=r.nativeElement}return e.prototype.handleMousedown=function(e){"INPUT"!==e.target.tagName&&(e.preventDefault(),e.stopPropagation())},e.prototype.ngOnInit=function(){var t=this;this._select=this._dropdown.parentElement,this._handleScroll(),this._document&&c.merge(c.fromEvent(this._document,"touchstart",{capture:!0}),c.fromEvent(this._document,"mousedown",{capture:!0})).pipe(r.takeUntil(this._destroy$)).subscribe(function(e){return t._handleOutsideClick(e)})},e.prototype.ngOnChanges=function(e){e.items&&(this._isScrolledToMarked=!1,this._handleItemsChange(e.items))},e.prototype.ngOnDestroy=function(){this._disposeDocumentResizeListener(),this._disposeScrollListener(),this._destroy$.next(),this._destroy$.complete(),this.appendTo&&this._renderer.removeChild(this._dropdown.parentNode,this._dropdown)},e.prototype.ngAfterContentInit=function(){var e=this;this._whenContentReady().then(function(){e.appendTo&&(e._appendDropdown(),e._handleDocumentResize()),e.updateDropdownPosition()})},e.prototype.refresh=function(){var t=this;return new Promise(function(e){t._zone.runOutsideAngular(function(){t._window.requestAnimationFrame(function(){t._updateItems().then(e)})})})},e.prototype.scrollInto=function(e){if(e){var t=this.items.indexOf(e);if(!(t<0||t>=this.items.length)){var n=this._calculateDimensions(this.virtualScroll?0:t),i=this.scrollElementRef.nativeElement,r=Math.floor(n.viewHeight/n.childHeight)-1;if(this.virtualScroll)i.scrollTop=t*n.childHeight-n.childHeight*Math.min(t,r);else{var s=this.contentElementRef.nativeElement,o=Array.from(s.children).slice(0,t).reduce(function(e,t){return e+t.clientHeight},0);i.scrollTop=o-n.childHeight*Math.min(t,r)}}}},e.prototype.scrollIntoTag=function(){var e=this.scrollElementRef.nativeElement,t=this._calculateDimensions();e.scrollTop=t.childHeight*(t.itemsLength+1)},e.prototype.updateDropdownPosition=function(){this._currentPosition=this._calculateCurrentPosition(this._dropdown),"top"===this._currentPosition?(this._renderer.addClass(this._dropdown,C),this._renderer.removeClass(this._dropdown,A),this._renderer.addClass(this._select,C),this._renderer.removeClass(this._select,A)):(this._renderer.addClass(this._dropdown,A),this._renderer.removeClass(this._dropdown,C),this._renderer.addClass(this._select,A),this._renderer.removeClass(this._select,C)),this.appendTo&&this._updateAppendedDropdownPosition(),this._dropdown.style.opacity="1"},e.prototype._handleOutsideClick=function(e){this._select.contains(e.target)||this._dropdown.contains(e.target)||this.outsideClick.emit()},e.prototype._handleScroll=function(){var e=this;this._disposeScrollListener=this._renderer.listen(this.scrollElementRef.nativeElement,"scroll",function(){e.refresh(),e._fireScrollToEnd()})},e.prototype._handleItemsChange=function(e){var t=this;this._scrollToEndFired=!1,this._previousStart=undefined,this._previousEnd=undefined,(e!==undefined&&e.previousValue===undefined||e.previousValue!==undefined&&0===e.previousValue.length)&&(this._startupLoop=!0),this.items=e.currentValue||[],this.refresh().then(function(){t.appendTo&&"top"===t._currentPosition&&t._updateAppendedDropdownPosition()})},e.prototype._updateItems=function(){var r=this;if(a.NgZone.assertNotInAngularZone(),!this.virtualScroll)return this._zone.run(function(){r.update.emit(r.items.slice()),r._scrollToMarked()}),Promise.resolve();var s=function(e){var t=r._calculateDimensions(),n=r._virtualScrollService.calculateItems(t,r.scrollElementRef.nativeElement,r.bufferAmount||0);r.paddingElementRef.nativeElement.style.height=n.scrollHeight+"px";var i="translateY("+n.topPadding+"px)";r.contentElementRef.nativeElement.style.transform=i,n.start!==r._previousStart||n.end!==r._previousEnd?(r._zone.run(function(){r.update.emit(r.items.slice(n.start,n.end)),r.scroll.emit({start:n.start,end:n.end})}),r._previousStart=n.start,r._previousEnd=n.end,!0===r._startupLoop&&s(e)):!0===r._startupLoop&&(r._startupLoop=!1,r._scrollToMarked(),e())};return new Promise(function(e){return s(e)})},e.prototype._fireScrollToEnd=function(){if(!this._scrollToEndFired){var e=this.scrollElementRef.nativeElement,t=this.virtualScroll?this.paddingElementRef.nativeElement:this.contentElementRef.nativeElement;e.scrollTop+this._dropdown.clientHeight>=t.clientHeight&&(this.scrollToEnd.emit(),this._scrollToEndFired=!0)}},e.prototype._calculateDimensions=function(e){return void 0===e&&(e=0),this._virtualScrollService.calculateDimensions(this.items.length,e,this.scrollElementRef.nativeElement,this.contentElementRef.nativeElement)},e.prototype._handleDocumentResize=function(){var e=this;this.appendTo&&(this._disposeDocumentResizeListener=this._renderer.listen("window","resize",function(){e._updateAppendedDropdownPosition()}))},e.prototype._scrollToMarked=function(){!this._isScrolledToMarked&&this.markedItem&&(this._isScrolledToMarked=!0,this.scrollInto(this.markedItem))},e.prototype._calculateCurrentPosition=function(e){if("auto"!==this.position)return this.position;var t=this._select.getBoundingClientRect(),n=document.documentElement.scrollTop||document.body.scrollTop;return t.top+window.pageYOffset+t.height+e.getBoundingClientRect().height>n+document.documentElement.clientHeight?"top":"bottom"},e.prototype._appendDropdown=function(){var e=document.querySelector(this.appendTo);if(!e)throw new Error("appendTo selector "+this.appendTo+" did not found any parent element");e.appendChild(this._dropdown)},e.prototype._updateAppendedDropdownPosition=function(){var e=document.querySelector(this.appendTo)||document.body,t=this._select.getBoundingClientRect(),n=e.getBoundingClientRect(),i=t.top-n.top,r=t.left-n.left,s="bottom"===this._currentPosition?t.height:-this._dropdown.clientHeight;this._dropdown.style.top=i+s+"px",this._dropdown.style.bottom="auto",this._dropdown.style.left=r+"px",this._dropdown.style.width=t.width+"px",this._dropdown.style.minWidth=t.width+"px"},e.prototype._whenContentReady=function(){var t=this;if(0===this.items.length)return Promise.resolve();var n=function(e){t._dropdown.querySelector(".ng-option")?e():t._zone.runOutsideAngular(function(){setTimeout(function(){return n(e)},5)})};return new Promise(function(e){return n(e)})},e.decorators=[{type:a.Component,args:[{changeDetection:a.ChangeDetectionStrategy.OnPush,encapsulation:a.ViewEncapsulation.None,selector:"ng-dropdown-panel",template:'\n <div *ngIf="headerTemplate" class="ng-dropdown-header">\n <ng-container [ngTemplateOutlet]="headerTemplate"></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 > 0">\n <ng-content></ng-content>\n </div>\n </div>\n <div *ngIf="footerTemplate" class="ng-dropdown-footer">\n <ng-container [ngTemplateOutlet]="footerTemplate"></ng-container>\n </div>\n ',styles:[".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}"]}]}],e.ctorParameters=function(){return[{type:a.Renderer2},{type:a.NgZone},{type:L},{type:k},{type:a.ElementRef},{type:undefined,decorators:[{type:a.Optional},{type:a.Inject,args:[t.DOCUMENT]}]}]},e.propDecorators={items:[{type:a.Input}],markedItem:[{type:a.Input}],position:[{type:a.Input}],appendTo:[{type:a.Input}],bufferAmount:[{type:a.Input}],virtualScroll:[{type:a.Input}],headerTemplate:[{type:a.Input}],footerTemplate:[{type:a.Input}],update:[{type:a.Output}],scroll:[{type:a.Output}],scrollToEnd:[{type:a.Output}],outsideClick:[{type:a.Output}],contentElementRef:[{type:a.ViewChild,args:["content",{read:a.ElementRef}]}],scrollElementRef:[{type:a.ViewChild,args:["scroll",{read:a.ElementRef}]}],paddingElementRef:[{type:a.ViewChild,args:["padding",{read:a.ElementRef}]}],handleMousedown:[{type:a.HostListener,args:["mousedown",["$event"]]}]},e}(),D=function(){function e(e){this.elementRef=e,this.stateChange$=new c.Subject,this._disabled=!1}return Object.defineProperty(e.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=this._isDisabled(e)},enumerable:!0,configurable:!0}),e.prototype.ngOnChanges=function(e){e.disabled&&this.stateChange$.next({value:this.value,disabled:this._disabled})},e.prototype._isDisabled=function(e){return null!=e&&""+e!="false"},e.decorators=[{type:a.Component,args:[{selector:"ng-option",changeDetection:a.ChangeDetectionStrategy.OnPush,template:"<ng-content></ng-content>"}]}],e.ctorParameters=function(){return[{type:a.ElementRef}]},e.propDecorators={value:[{type:a.Input}],disabled:[{type:a.Input}]},e}(),V=new a.InjectionToken("ng-select-default-options"),R=new a.InjectionToken("ng-select-selection-model"),M=function(){function e(e,t,n,i,r,s,o){var l=this;this.classes=e,this.tabIndex=t,this._cd=s,this._console=o,this.items=[],this.clearable=!0,this.markFirst=!0,this.dropdownPosition="auto",this.loading=!1,this.closeOnSelect=!0,this.hideSelected=!1,this.selectOnTab=!1,this.bufferAmount=4,this.virtualScroll=!1,this.selectableGroup=!1,this.selectableGroupAsModel=!0,this.searchFn=null,this.clearSearchOnAdd=!0,this.labelForId=null,this.multiple=!1,this.addTag=!1,this.searchable=!0,this.isOpen=!1,this.blurEvent=new a.EventEmitter,this.focusEvent=new a.EventEmitter,this.changeEvent=new a.EventEmitter,this.openEvent=new a.EventEmitter,this.closeEvent=new a.EventEmitter,this.searchEvent=new a.EventEmitter,this.clearEvent=new a.EventEmitter,this.addEvent=new a.EventEmitter,this.removeEvent=new a.EventEmitter,this.scroll=new a.EventEmitter,this.scrollToEnd=new a.EventEmitter,this.disabled=!1,this.viewPortItems=[],this.filterValue=null,this.dropdownId=O(),this.selectedItemId=0,this._defaultLabel="label",this._pressedKeys=[],this._destroy$=new c.Subject,this._keyPress$=new c.Subject,this._onChange=function(e){},this._onTouched=function(){},this.clearItem=function(t){var e=l.selectedItems.find(function(e){return e.value===t});l.unselect(e)},this._mergeGlobalConfig(n),this.itemsList=new S(this,i()),this.element=r.nativeElement}return Object.defineProperty(e.prototype,"compareWith",{get:function(){return this._compareWith},set:function(e){if(!w(e))throw Error("`compareWith` must be a function.");this._compareWith=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filtered",{get:function(){return!!this.filterValue&&this.searchable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedItems",{get:function(){return this.itemsList.selectedItems},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedValues",{get:function(){return this.selectedItems.map(function(e){return e.value})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasValue",{get:function(){return 0<this.selectedItems.length},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this._handleKeyPresses()},e.prototype.ngOnChanges=function(e){e.multiple&&this.itemsList.clearSelected(),e.items&&this._setItems(e.items.currentValue||[]),e.isOpen&&(this._manualOpen=!0)},e.prototype.ngAfterViewInit=function(){this.items&&0===this.items.length&&this._setItemsFromNgOptions()},e.prototype.ngOnDestroy=function(){this._destroy$.next(),this._destroy$.complete()},e.prototype.handleKeyDown=function(e){if(E[e.which])switch(e.which){case E.ArrowDown:this._handleArrowDown(e);break;case E.ArrowUp:this._handleArrowUp(e);break;case E.Space:this._handleSpace(e);break;case E.Enter:this._handleEnter(e);break;case E.Tab:this._handleTab(e);break;case E.Esc:this.close(),e.preventDefault(),e.stopPropagation();break;case E.Backspace:this._handleBackspace()}else e.key&&1===e.key.length&&this._keyPress$.next(e.key.toLocaleLowerCase())},e.prototype.handleMousedown=function(e){var t=e.target;"INPUT"!==t.tagName&&e.preventDefault(),e.stopPropagation(),"ng-clear"!==t.className?"ng-arrow-wrapper"!==t.className?t.className.includes("ng-value-icon")||(this.focused||this.focus(),this.searchable?this.open():this.toggle()):this.handleArrowClick():this.handleClearClick()},e.prototype.handleArrowClick=function(){this.isOpen?this.close():this.open()},e.prototype.handleClearClick=function(){this.hasValue&&this.clearModel(),this._clearSearch(),this.focus(),this._isTypeahead&&this.typeahead.next(null),this.clearEvent.emit()},e.prototype.clearModel=function(){this.clearable&&(this.itemsList.clearSelected(),this._updateNgModel())},e.prototype.writeValue=function(e){this.itemsList.clearSelected(),this._handleWriteValue(e),this._cd.markForCheck()},e.prototype.registerOnChange=function(e){this._onChange=e},e.prototype.registerOnTouched=function(e){this._onTouched=e},e.prototype.setDisabledState=function(e){this.disabled=e,this._cd.markForCheck()},e.prototype.toggle=function(){this.isOpen?this.close():this.open()},e.prototype.open=function(){this.disabled||this.isOpen||this.itemsList.maxItemsSelected||this._manualOpen||(this._isTypeahead||this.addTag||!this.itemsList.noItemsToSelect)&&(this.isOpen=!0,this.itemsList.markSelectedOrDefault(this.markFirst),this.openEvent.emit(),this.filterValue||this.focus(),this.detectChanges())},e.prototype.close=function(){this.isOpen&&!this._manualOpen&&(this.isOpen=!1,this._clearSearch(),this._onTouched(),this.closeEvent.emit(),this._cd.markForCheck())},e.prototype.toggleItem=function(e){!e||e.disabled||this.disabled||(this.multiple&&e.selected?this.unselect(e):this.select(e))},e.prototype.select=function(e){e.selected||(this.itemsList.select(e),this.clearSearchOnAdd&&this._clearSearch(),this.multiple&&this.addEvent.emit(e.value),this._updateNgModel()),(this.closeOnSelect||this.itemsList.noItemsToSelect)&&this.close()},e.prototype.focus=function(){this.filterInput.nativeElement.focus()},e.prototype.unselect=function(e){this.itemsList.unselect(e),this.focus(),this._updateNgModel(),this.removeEvent.emit(e)},e.prototype.selectTag=function(){var e,t,n=this;t=w(this.addTag)?this.addTag(this.filterValue):this._primitive?this.filterValue:((e={})[this.bindLabel]=this.filterValue,e);var i=function(e){return n._isTypeahead?n.itemsList.mapItem(e,null):n.itemsList.addItem(e)};!function r(e){return e instanceof Promise}(t)?t&&this.select(i(t)):t.then(function(e){return n.select(i(e))})["catch"](function(){})},e.prototype.showClear=function(){return this.clearable&&(this.hasValue||this.filterValue)&&!this.disabled},Object.defineProperty(e.prototype,"showAddTag",{get:function(){if(!this.filterValue)return!1;var t=this.filterValue.toLowerCase();return this.addTag&&!this.itemsList.filteredItems.some(function(e){return e.label.toLowerCase()===t})&&(!this.hideSelected||!this.selectedItems.some(function(e){return e.label.toLowerCase()===t}))&&!this.loading},enumerable:!0,configurable:!0}),e.prototype.showNoItemsFound=function(){var e=0===this.itemsList.filteredItems.length;return(e&&!this._isTypeahead&&!this.loading||e&&this._isTypeahead&&this.filterValue&&!this.loading)&&!this.showAddTag},e.prototype.showTypeToSearch=function(){return 0===this.itemsList.filteredItems.length&&this._isTypeahead&&!this.filterValue&&!this.loading},e.prototype.filter=function(e){this.filterValue=e,this.open(),this._isTypeahead?this.typeahead.next(this.filterValue):(this.itemsList.filter(this.filterValue),this.isOpen&&this.itemsList.markSelectedOrDefault(this.markFirst)),this.searchEvent.emit(e)},e.prototype.onInputFocus=function(e){this.focused||(this.element.classList.add("ng-select-focused"),this.focusEvent.emit(e),this.focused=!0)},e.prototype.onInputBlur=function(e){this.element.classList.remove("ng-select-focused"),this.blurEvent.emit(e),this.isOpen||this.disabled||this._onTouched(),this.focused=!1},e.prototype.onItemHover=function(e){e.disabled||this.itemsList.markItem(e)},e.prototype.detectChanges=function(){this._cd.destroyed||this._cd.detectChanges()},e.prototype.updateDropdownPosition=function(){this.dropdownPanel&&this.dropdownPanel.updateDropdownPosition()},e.prototype._setItems=function(e){var t=e[0];this.bindLabel=this.bindLabel||this._defaultLabel,this._primitive=t?!I(t):this._primitive,this.itemsList.setItems(e),0<e.length&&this.hasValue&&this.itemsList.mapSelectedItems(),this.isOpen&&b(this.filterValue)&&!this._isTypeahead&&this.itemsList.filter(this.filterValue),(this._isTypeahead||this.isOpen)&&this.itemsList.markSelectedOrDefault(this.markFirst)},e.prototype._setItemsFromNgOptions=function(){var i=this;this.ngOptions.changes.pipe(r.startWith(this.ngOptions),r.takeUntil(this._destroy$),r.filter(function(e){return!!e.length})).subscribe(function(e){var t,n;i.bindLabel=i._defaultLabel,t=e,i.items=t.map(function(e){return{$ngOptionValue:e.value,$ngOptionLabel:e.elementRef.nativeElement.innerHTML,disabled:e.disabled}}),i.itemsList.setItems(i.items),i.hasValue&&i.itemsList.mapSelectedItems(),i.detectChanges(),n=c.merge(i.ngOptions.changes,i._destroy$),c.merge.apply(void 0,v(i.ngOptions.map(function(e){return e.stateChange$}))).pipe(r.takeUntil(n)).subscribe(function(e){i.itemsList.findItem(e.value).disabled=e.disabled,i._cd.markForCheck()})})},e.prototype._isValidWriteValue=function(e){var t=this;if(!b(e)||this.multiple&&""===e||Array.isArray(e)&&0===e.length)return!1;var n=function(e){return!I(e)||!t.bindValue||(t._console.warn("Binding object("+JSON.stringify(e)+") with bindValue is not allowed."),!1)};return this.multiple?Array.isArray(e)?e.every(function(e){return n(e)}):(this._console.warn("Multiple select ngModel should be array."),!1):n(e)},e.prototype._handleWriteValue=function(e){var s=this;if(this._isValidWriteValue(e)){var t=function(e){var t,n=s.itemsList.findItem(e);if(n)s.itemsList.select(n);else{var i=I(e),r=!i&&!s.bindValue;i||r?s.itemsList.select(s.itemsList.mapItem(e,null)):s.bindValue&&((t={})[s.bindLabel]=null,t[s.bindValue]=e,n=t,s.itemsList.select(s.itemsList.mapItem(n,null)))}};this.multiple?e.forEach(function(e){return t(e)}):t(e)}},e.prototype._handleKeyPresses=function(){var n=this;this.searchable||this._keyPress$.pipe(r.takeUntil(this._destroy$),r.tap(function(e){return n._pressedKeys.push(e)}),r.debounceTime(200),r.filter(function(){return 0<n._pressedKeys.length}),r.map(function(){return n._pressedKeys.join("")})).subscribe(function(e){var t=n.itemsList.findByLabel(e);t&&(n.isOpen?(n.itemsList.markItem(t),n._cd.markForCheck()):n.select(t)),n._pressedKeys=[]})},e.prototype._updateNgModel=function(){var e,t,n=[];try{for(var i=f(this.selectedItems),r=i.next();!r.done;r=i.next()){var s=r.value;if(this.bindValue){var o=null;o=s.children?s.value[this.groupBy]:this.itemsList.resolveNested(s.value,this.bindValue),n.push(o)}else n.push(s.value)}}catch(a){e={error:a}}finally{try{r&&!r.done&&(t=i["return"])&&t.call(i)}finally{if(e)throw e.error}}var l=this.selectedItems.map(function(e){return e.value});this.multiple?(this._onChange(n),this.changeEvent.emit(l)):(this._onChange(b(n[0])?n[0]:null),this.changeEvent.emit(l[0])),this._cd.markForCheck()},e.prototype._clearSearch=function(){this.filterValue&&(this.filterValue=null,this.itemsList.resetFilteredItems())},e.prototype._scrollToMarked=function(){this.isOpen&&this.dropdownPanel&&this.dropdownPanel.scrollInto(this.itemsList.markedItem)},e.prototype._scrollToTag=function(){this.isOpen&&this.dropdownPanel&&this.dropdownPanel.scrollIntoTag()},e.prototype._handleTab=function(e){this.isOpen&&(this.selectOnTab?this.itemsList.markedItem?(this.toggleItem(this.itemsList.markedItem),e.preventDefault()):this.showAddTag?(this.selectTag(),e.preventDefault()):this.close():this.close())},e.prototype._handleEnter=function(e){this.isOpen||this._manualOpen?this.itemsList.markedItem?this.toggleItem(this.itemsList.markedItem):this.showAddTag&&this.selectTag():this.open(),e.preventDefault(),e.stopPropagation()},e.prototype._handleSpace=function(e){this.isOpen||this._manualOpen||(this.open(),e.preventDefault())},e.prototype._handleArrowDown=function(e){this._nextItemIsTag(1)?(this.itemsList.unmarkItem(),this._scrollToTag()):(this.itemsList.markNextItem(),this._scrollToMarked()),this.open(),e.preventDefault()},e.prototype._handleArrowUp=function(e){this.isOpen&&(this._nextItemIsTag(-1)?(this.itemsList.unmarkItem(),this._scrollToTag()):(this.itemsList.markPreviousItem(),this._scrollToMarked()),e.preventDefault())},e.prototype._nextItemIsTag=function(e){var t=this.itemsList.markedIndex+e;return this.addTag&&this.filterValue&&this.itemsList.markedItem&&(t<0||t===this.itemsList.filteredItems.length)},e.prototype._handleBackspace=function(){!this.filterValue&&this.clearable&&this.hasValue&&(this.multiple?this.unselect(this.itemsList.lastSelectedItem):this.clearModel())},Object.defineProperty(e.prototype,"_isTypeahead",{get:function(){return this.typeahead&&0<this.typeahead.observers.length},enumerable:!0,configurable:!0}),e.prototype._mergeGlobalConfig=function(e){this.placeholder=this.placeholder||e.placeholder,this.notFoundText=this.notFoundText||e.notFoundText,this.typeToSearchText=this.typeToSearchText||e.typeToSearchText,this.addTagText=this.addTagText||e.addTagText,this.loadingText=this.loadingText||e.loadingText,this.clearAllText=this.clearAllText||e.clearAllText},e.decorators=[{type:a.Component,args:[{selector:"ng-select",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">\n <ng-template #defaultLabelTemplate>\n <span class="ng-value-icon left" (click)="unselect(item);" aria-hidden="true">×</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 #filterInput\n type="text"\n autocomplete="{{dropdownId}}"\n [attr.id]="labelForId"\n [attr.tabindex]="tabIndex"\n [readOnly]="!searchable"\n [disabled]="disabled"\n [value]="filterValue"\n (input)="filter(filterInput.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 <div class="ng-spinner-loader" *ngIf="loading"></div>\n\n <span *ngIf="showClear()" class="ng-clear-wrapper" title="{{clearAllText}}">\n <span class="ng-clear" aria-hidden="true">×</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 [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]="classes"\n [id]="dropdownId">\n\n <ng-container>\n <div class="ng-option" [attr.role]="item.children ? \'group\' : \'option\'" (click)="toggleItem(item)" (mousedown)="$event.preventDefault()" (mouseover)="onItemHover(item)"\n *ngFor="let item of viewPortItems"\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.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: filterValue }">\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>"{{filterValue}}"</span>\n </ng-template>\n\n <ng-template\n [ngTemplateOutlet]="tagTemplate || defaultTagTemplate"\n [ngTemplateOutletContext]="{ searchTerm: filterValue }">\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: filterValue }">\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: filterValue }">\n </ng-template>\n </ng-container>\n\n</ng-dropdown-panel>\n',providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:a.forwardRef(function(){return e}),multi:!0}],encapsulation:a.ViewEncapsulation.None,changeDetection:a.ChangeDetectionStrategy.OnPush,host:{role:"listbox","class":"ng-select","[class.ng-select-single]":"!multiple"},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:flex;outline:0;overflow:hidden;position:relative;width:100%}.ng-select .ng-select-container .ng-value-container{display:flex;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-se