!function(a,b){"use strict";"undefined"!=typeofmodule&&module.exports?module.exports=b(require("angular")):"function"==typeofdefine&&define.amd?define(["angular"],b):b(a.angular)}(window,function(a){"use strict";a.module("angucomplete-alt",[]).directive("angucompleteAlt",["$q","$parse","$http","$sce","$timeout","$templateCache","$interpolate",function(a,b,c,d,e,f,g){functionh(b,f,g,h){functionw(a,c){a&&("object"==typeofa?(b.searchStr=C(a),z({originalObject:a})):"string"==typeofa&&a.length>0?b.searchStr=a:console&&console.error&&console.error("Tried to set "+(c?"initial":"")+" value of angucomplete to",a,"which is an invalid value"),F(!0))}functionx(a){na=null,b.hideResults(a),document.body.removeEventListener("click",x)}functiony(a){returna.which?a.which:a.keyCode}functionz(a){"function"==typeofb.selectedObject?b.selectedObject(a,b.selectedObjectData):b.selectedObject=a,F(a?!0:!1)}functionA(a){returnfunction(c){returnb[a]?b[a](c):c}}functionB(a){z({originalObject:a}),b.clearSelected&&(b.searchStr=null),U()}functionC(a){returnb.titleField.split(",").map(function(b){returnD(a,b)}).join(" ")}functionD(a,b){varc,d;if(b){c=b.split("."),d=a;for(vare=0;e<c.length;e++)d=d[c[e]]}elsed=a;returnd}functionE(a,c){vare,f,g;if(g=newRegExp(c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i"),a)returna.match&&a.replace||(a=a.toString()),f=a.match(g),e=f?a.replace(g,'<span class="'+b.matchClass+'">'+f[0]+"</span>"):a,d.trustAsHtml(e)}functionF(a){b.notEmpty=a,ia=b.searchStr,b.fieldRequired&&h&&b.inputName&&h[b.inputName].$setValidity(ha,a)}functionG(a){varc=y(a);if(c!==l&&c!==j)if(c===k||c===n)a.preventDefault();elseif(c===i)a.preventDefault(),!b.showDropdown&&b.searchStr&&b.searchStr.length>=fa&&(V(),b.searching=!0,Y(b.searchStr));elseif(c===m)U(),b.$apply(function(){ea.val(b.searchStr)});else{if(0===fa&&!b.searchStr)return;b.searchStr&&""!==b.searchStr?b.searchStr.length>=fa&&(V(),ga&&e.cancel(ga),b.searching=!0,ga=e(function(){Y(b.searchStr)},b.pause)):b.showDropdown=!1,ia&&ia!==b.searchStr&&!b.clearSelected&&b.$apply(function(){z()})}}functionH(a){!b.overrideSuggestions||b.selectedObject&&b.selectedObject.originalObject===b.searchStr||(a&&a.preventDefault(),e.cancel(ga),R(),B(b.searchStr))}functionI(a){varb=getComputedStyle(a);returna.offsetHeight+parseInt(b.marginTop,10)+parseInt(b.marginBottom,10)}functionJ(){returnla.getBoundingClientRect().top+parseInt(getComputedStyle(la).maxHeight,10)}functionK(){returnf[0].querySelectorAll(".angucomplete-row")[b.currentIndex]}functionL(){returnK().getBoundingClientRect().top-(la.getBoundingClientRect().top+parseInt(getComputedStyle(la).paddingTop,10))}functionM(a){la.scrollTop=la.scrollTop+a}functionN(){vara=b.results[b.currentIndex];b.matchClass?ea.val(C(a.originalObject)):ea.val(a.title)}functionO(a){varc=y(a),d=null,e=null;c===n&&b.results?(b.currentIndex>=0&&b.currentIndex<b.results.length?(a.preventDefault(),b.selectResult(b.results[b.currentIndex])):(H(a),U()),b.$apply()):c===i&&b.results?(a.preventDefault(),b.currentIndex+1<b.results.length&&b.showDropdown&&(b.$apply(function(){b.currentIndex++,N()}),ma&&(d=K(),J()<d.getBoundingClientRect().bottom&&M(I(d))))):c===k&&b.results?(a.preventDefault(),b.currentIndex>=1?(b.$apply(function(){b.currentIndex--,N()}),ma&&(e=L(),e<0&&M(e-1))):0===b.currentIndex&&b.$apply(function(){b.currentIndex=-1,ea.val(b.searchStr)})):c===o?b.results&&b.results.length>0&&b.showDropdown?b.currentIndex===-1&&b.overrideSuggestions?H():(b.currentIndex===-1&&(b.currentIndex=0),b.selectResult(b.results[b.currentIndex]),b.$digest()):b.searchStr&&b.searchStr.length>0&&H():c===m&&a.preventDefault()}functionP(a){returnfunction(c,d,e,f){d||e||f||!c.data||(c=c.data),b.searching=!1,Z(D(aa(c),b.remoteUrlDataField),a)}}functionQ(a,c,d,e){b.searching=ka,c||d||e||(c=a.status),0!==c&&c!==-1&&(b.remoteUrlErrorCallback?b.remoteUrlErrorCallback(a,c,d,e):console&&console.error&&console.error("http error"))}functionR(){ja&&ja.resolve()}functionS(d){vare={},f=b.remoteUrl+encodeURIComponent(d);b.remoteUrlRequestFormatter&&(e={params:b.remote