text: /*! angular-tagger 2018-05-21 */
  (function(){var a,b,c,d,e;if(angular.module("tagger",[]),angular.version.major<1||1===angular.version.major&&angular.version.minor<3)for(e=["ngKeydown","ngKeyup","ngBlur","ngFocus"],b=function(a){return angular.module("tagger").directive(a,["$parse",function(b){return function(c,d,e){var f,g;return g=b(e[a]),f=angular.lowercase(a.substring(2)),d.bind(f,function(a){return g(c,{$event:a}),c.$$phase||c.$parent.$$phase||c.$root.$$phase?void 0:c.$apply()})}}])},c=0,d=e.length;d>c;c++)a=e[c],b(a);angular.module("tagger").directive("taggerContenteditable",function(){return{require:"ngModel",link:function(a,b,c,d){var e;return b.attr("contenteditable",!0),d.$render=function(){return b.text(d.$viewValue)},e=function(c){return 13===c.keyCode&&null!=c&&"function"==typeof c.preventDefault&&c.preventDefault(),a.$apply(function(){return d.$setViewValue(b.text())})},b.bind("keyup",e),b.bind("keydown",e)}}}),angular.module("tagger").directive("tagger",["$compile","$timeout",function(a,b){return{restrict:"AE",replace:!0,template:'<span\n  class="angular-tagger"\n  ng-click="handleOuterClick($event)"\n  ng-class="{\'angular-tagger--single\': config.single}"\n  ng-focus="handleOuterFocus($event)">\n  <span class="angular-tagger__wrapper">\n    <span class="angular-tagger__holder" ng-repeat="tag in tags">\n      <span tagger-contenteditable="true"\n        ng-model="$parent.query"\n        ng-show="pos == $index"\n        ng-keydown="handleKeyDown($event)"\n        ng-keyup="handleKeyUp($event)"\n        ng-click="handleInputClick($event)"\n        ng-blur="handleBlur($index, $event)"\n        class="angular-tagger__input">\n      </span>\n      <span class="angular-tagger__tag">\n        {{ config.displayFun(tag) }}\n        <span\n          class="angular-tagger-tag__delete"\n          ng-mousedown="handleMousedown()"\n          ng-mouseup="handleMouseup()"\n          ng-click="removeTag($index, $event)">x</span>\n      </span>\n    </span>\n  </span>\n  <span tagger-contenteditable="true"\n    ng-model="query"\n    ng-show="(config.single && !tags.length) || (!config.single && pos == tags.length)"\n    ng-keydown="handleKeyDown($event)"\n    ng-keyup="handleKeyUp($event)"\n    ng-click="handleInputClick($event)"\n    placeholder="{{ placeholder }}"\n    ng-blur="handleBlur(tags.length, $event)"\n    ng-focus="handleFocus($event)"\n    class="angular-tagger__input">\n  </span>\n  <div class="angular-tagger__hook">\n    <ul ng-show="expanded" class="angular-tagger__matching">\n      <li class="angular-tagger__matching-item"\n        ng-mousedown="handleMousedown()"\n        ng-mouseup="handleMouseup()"\n        ng-mouseover="selectItem(-1)"\n        ng-click="handleItemClick($event)"\n        ng-hide="config.disableNew || !query.length || hideNew || tags.indexOf(query) != -1 "\n        ng-class=\'{"angular-tagger__matching-item--selected": selected == -1}\'>\n        Add: {{ query }}...\n      </li>\n      <li\n        ng-repeat="e in matching"\n        ng-mousedown="handleMousedown()"\n        ng-mouseup="handleMouseup()"\n        ng-mouseover="selectItem($index)"\n        ng-click="handleItemClick($event)"\n        class="angular-tagger__matching-item"\n        ng-class=\'{"angular-tagger__matching-item--selected": $index == selected}\'>\n        {{ config.displayFun(e) }}\n      </li>\n    </ul>\n  </div>\n</span>',scope:{value:"=ngModel",options:"="},link:function(a,c,d){var e,f,g,h,i,j;return a.query="",a.expanded=!1,a.matching=[],a.selected=0,a.options||(a.options=[]),a.tags||(a.tags=[]),a.placeholder=null,a.hideNew=!1,a.config={disableNew:!1,displayFun:function(a){return a},createFun:function(a){return a},limit:null},null!=d.disableNew&&(a.config.disableNew=null!=d.disableNew),null!=d.limit&&(a.config.limit=parseInt(d.limit)),null!=d.displayFun&&(a.config.displayFun=a.$parent.$eval(d.displayFun)),null!=d.createFun&&(a.config.createFun=a.$parent.$eval(d.createFun)),null!=d.placeholder&&(a.config.placeholder=d.placeholder,a.placeholder=a.config.placeholder),null!=d.single&&(a.config.single=!0,a.config.limit=1),null!=d.onSelect&&(a.config.onSelect=a.$parent.$eval(d.onSelect)),a.config.disableNew&&(a.selected=0),e=c.children().eq(1),j=function(){return b(function(){var b,c,d,e,f,g,h,i,j,k,l;for(d=new RegExp(".*"+a.query.split("").join(".*")+".*","i"),a.hideNew=!1,a.matching=[],k=a.options,g=0,i=k.length;i>g;g++)if(c=k[g],e=a.config.displayFun(c),d.test(e)){for(angular.lowercase(e)===angular.lowercase(a.query)&&(a.hideNew=!0),b=!1,l=a.tags,h=0,j=l.length;j>h;h++)f=l[h],f===c&&(b=!0);b||a.matching.push(c)}return a.selected=a.config.disableNew?0:a.matching.length>0?0:-1,a.placeholder=a.tags.length>0||a.query.length>0?null:a.config.placeholder})},i=function(){return b(function(){return g().focus(),a.show()})},g=function(){return a.pos===a.tags.length?e[0]:c.children().eq(0).children().eq(a.pos).children()[0]},h=function(){return a.config.limit&&a.tags.length>=a.config.limit},a.handleOuterClick=function(b){return null!=b&&"function"==typeof b.stopPropagation&&b.stopPropagation(),a.config.single&&(a.removeTag(0),j()),i()},f=!1,a.handleMousedown=function(){return f=!0},a.handleMouseup=function(){return f=!1},a.handleKeyUp=function(b){var c;switch(b.keyCode){case 8:return j();case 46:return j();case 27:return a.hide();default:if(48<(c=b.keyCode)&&90>c)return j(),a.show()}},a.handleKeyDown=function(b){switch(b.keyCode){case 38:return a.selected=Math.max(a.selected-1,a.config.disableNew?0:-1),b.preventDefault();case 40:return a.selected=Math.min(a.selected+1,a.matching.length-1),b.preventDefault();case 13:return a.addItem();case 8:if(""===a.query&&a.pos>0)return a.removeTag(a.pos-1);break;case 46:if(""===a.query&&a.pos<a.tags.length)return a.removeTag(a.pos);break;case 37:if(""===a.query)return a.pos=Math.max(a.pos-1,0),i();break;case 39:if(""===a.query)return a.pos=Math.min(a.pos+1,a.tags.length),i()}},a.handleInputClick=function(a){return a.stopPropagation()},a.handleItemClick=function(b){return a.addItem(),b.stopPropagation()},a.handleOuterFocus=function(a){var b;return null!=(b=g())&&"function"==typeof b.focus?b.focus():void 0},a.handleBlur=function(b,c){return b!==a.pos||f?void 0:a.hide()},a.handleFocus=function(b){return a.show()},a.addItem=function(){var c;if(!h())return c=a.config.disableNew?a.selected>-1?a.matching[a.selected]:null:-1===a.selected&&a.query?a.config.createFun(a.query):a.selected>-1?a.matching[a.selected]:void 0,-1===a.tags.indexOf(c)&&(a.tags.splice(a.pos,0,c),a.query="",j(),a.selected=Math.min(a.selected,a.matching.length-1),a.pos++,i(),a.config.single&&(a.value=a.tags[0]),b(function(){var b;return"function"==typeof(b=a.config).onSelect?b.onSelect(c):void 0}),h())?a.hide():void 0},a.selectItem=function(b){return a.selected=b},a.show=function(){return a.expanded=!h()},a.hide=function(){return a.expanded=!1,a.query="",a.pos=a.tags.length,b(function(){var a;return null!=(a=g())&&"function"==typeof a.blur?a.blur():void 0})},a.removeTag=function(b,c){return null!=c&&"function"==typeof c.stopPropagation&&c.stopPropagation(),a.tags.splice(b,1),a.config.single&&(a.value=a.tags[0]),b<a.pos&&a.pos--,j(),a.expanded&&i(),a.config.single?a.value=a.tags[0]:void 0},j(),a.$watch("options",j,!0),a.$watch("value",function(){return a.config.single?null!=a.value?a.tags=[a.value]:a.tags=[]:a.tags=a.value||[],a.pos=a.tags.length},!0)}}}])}).call(this);