define(["modules/ui/module","jquery-ui"],function(a){"use strict";a.registerDirective("smartJquiAjaxAutocomplete",function(){return{restrict:"A",scope:{ngModel:"="},link:function(a,b){function c(a){return a.split(/,\s*/)}function d(a){return c(a).pop()}function e(a){return c(a)[0]}b.autocomplete({source:function(a,b){jQuery.getJSON("http://gd.geobytes.com/AutoCompleteCity?callback=?&q="+d(a.term),function(a){b(a)})},minLength:3,select:function(d,f){var g=f.item,h=g.value;if("undefined"==typeof h&&(h=b.val()),h){var i=c(b.val());i.pop(),i.push(e(h)),i.push(""),a.$apply(function(){a.ngModel=i.join(", ")})}return!1},focus:function(){return!1},delay:100})}}})});