/*!

* typeahead.js 0.11.1
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
*/

!function(e,n){“function”==typeof define&&define.amd?define(“bloodhound”,,function(t){return e.Bloodhound=n(t)}):“object”==typeof exports?module.exports=n(require(“jquery”)):e.Bloodhound=n(jQuery)}(this,function(h){var l=function(){“use strict”;return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(d+(.d+)?)/i)},isBlankString:function(t){return!t||/^s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[-/{}()*+?.\^$|]/g,“\$&”)},isString:function(t){return“string”==typeof t},isNumber:function(t){return“number”==typeof t},isArray:h.isArray,isFunction:h.isFunction,isObject:h.isPlainObject,isUndefined:function(t){return void 0===t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(t){return t instanceof h},toStr:function(t){return l.isUndefined(t)||null===t?“”:t+“”},bind:h.proxy,each:function(t,n){h.each(t,function(t,e){return n(e,t)})},map:h.map,filter:h.grep,every:function(n,i){var r=!0;return n?(h.each(n,function(t,e){if(!(r=i.call(null,e,t,n)))return!1}),!!r):r},some:function(n,i){var r=!1;return n?(h.each(n,function(t,e){if(r=i.call(null,e,t,n))return!1}),!!r):r},mixin:h.extend,identity:function(t){return t},clone:function(t){return h.extend(!0,{},t)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(t){return h.isFunction(t)?t:function(){return String(t)}},defer:function(t){setTimeout(t,0)},debounce:function(r,s,o){var u,a;return function(){function t(){u=null,o||(a=r.apply(e,n))}var e=this,n=arguments,i=o&&!u;return clearTimeout(u),u=setTimeout(t,s),i&&(a=r.apply(e,n)),a}},throttle:function(n,i){function r(){c=new Date,u=null,a=n.apply(s,o)}var s,o,u,a,c=0;return function(){var t=new Date,e=i-(t-c);return s=this,o=arguments,e<=0?(clearTimeout(u),u=null,c=t,a=n.apply(s,o)):u=u||setTimeout(r,e),a}},stringify:function(t){return l.isString(t)?t:JSON.stringify(t)},noop:function(){}}}(),n=function(){“use strict”;return{nonword:e,whitespace:t,obj:{nonword:n(e),whitespace:n(t)}};function t(t){return(t=l.toStr(t))?t.split(/s+/):[]}function e(t){return(t=l.toStr(t))?t.split(/W+/):[]}function n(i){return function(t){return t=l.isArray(t)?t:[].slice.call(arguments,0),function(e){var n=[];return l.each(t,function(t){n=n.concat(i(l.toStr(e)))}),n}}}}(),i=function(){“use strict”;function t(t){this.maxSize=l.isNumber(t)?t:100,this.reset(),this.maxSize<=0&&(this.set=this.get=h.noop)}function e(){this.head=this.tail=null}function r(t,e){this.key=t,this.val=e,this.prev=this.next=null}return l.mixin(t.prototype,{set:function(t,e){var n,i=this.list.tail;this.size>=this.maxSize&&(this.list.remove(i),delete this.hash,this.size–),(n=this.hash)?(n.val=e,this.list.moveToFront(n)):(n=new r(t,e),this.list.add(n),this.hash=n,this.size++)},get:function(t){var e=this.hash;if(e)return this.list.moveToFront(e),e.val},reset:function(){this.size=0,this.hash={},this.list=new e}}),l.mixin(e.prototype,{add:function(t){this.head&&(t.next=this.head,this.head.prev=t),this.head=t,this.tail=this.tail||t},remove:function(t){t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev},moveToFront:function(t){this.remove(t),this.add(t)}}),t}(),e=function(){“use strict”;var s;try{(s=window.localStorage).setItem(“~~~”,“!”),s.removeItem(“~~~”)}catch(t){s=null}function t(t,e){this.prefix=.join(“”),this.ttlKey=“__ttl__”,this.keyMatcher=new RegExp(“^”+l.escapeRegExChars(this.prefix)),this.ls=e||s,this.ls||this._noop()}return l.mixin(t.prototype,{_prefix:function(t){return this.prefix+t},_ttlKey:function(t){return this._prefix(t)+this.ttlKey},_noop:function(){this.get=this.set=this.remove=this.clear=this.isExpired=l.noop},_safeSet:function(t,e){try{this.ls.setItem(t,e)}catch(t){“QuotaExceededError”===t.name&&(this.clear(),this._noop())}},get:function(t){return this.isExpired(t)&&this.remove(t),n(this.ls.getItem(this._prefix(t)))},set:function(t,e,n){return l.isNumber(n)?this._safeSet(this._ttlKey(t),r(i()+n)):this.ls.removeItem(this._ttlKey(t)),this._safeSet(this._prefix(t),r(e))},remove:function(t){return this.ls.removeItem(this._ttlKey(t)),this.ls.removeItem(this._prefix(t)),this},clear:function(){for(var t=function(t){var e,n,i=[],r=s.length;for(e=0;e<r;e++)(n=s.key(e)).match(t)&&i.push(n.replace(t,“”));return i}(this.keyMatcher),e=t.length;e–;)this.remove(t);return this},isExpired:function(t){var e=n(this.ls.getItem(this._ttlKey(t)));return!!(l.isNumber(e)&&i()>e)}}),t;function i(){return(new Date).getTime()}function r(t){return JSON.stringify(l.isUndefined(t)?null:t)}function n(t){return h.parseJSON(t)}}(),r=function(){“use strict”;var u=0,a={},c=6,e=new i(10);function t(t){t=t||{},this.cancelled=!1,this.lastReq=null,this._send=t.transport,this._get=t.limiter?t.limiter(this._get):this._get,this._cache=!1===t.cache?new i(0):e}return t.setMaxPendingRequests=function(t){c=t},t.resetCache=function(){e.reset()},l.mixin(t.prototype,{_fingerprint:function(t){return(t=t||{}).url+t.type+h.param(t.data||{})},_get:function(t,e){var n,i,r=this;function s(t){e(null,t),r._cache.set(n,t)}function o(){e(!0)}n=this._fingerprint(t),this.cancelled||n!==this.lastReq||((i=a)?i.done(s).fail(o):u=this._send(t).done(s).fail(o).always(function(){u–,delete a,r.onDeckRequestArgs&&(r._get.apply(r,r.onDeckRequestArgs),r.onDeckRequestArgs=null)})):this.onDeckRequestArgs=[].slice.call(arguments,0))},get:function(t,e){var n,i;e=e||h.noop,t=l.isString(t)?{url:t}:t||{},i=this._fingerprint(t),this.cancelled=!1,this.lastReq=i,(n=this._cache.get(i))?e(null,n):this._get(t,e)},cancel:function(){this.cancelled=!0}}),t}(),s=window.SearchIndex=function(){“use strict”;var u=“c”,a=“i”;function t(t){(t=t||{}).datumTokenizer&&t.queryTokenizer||h.error(“datumTokenizer and queryTokenizer are both required”),this.identify=t.identify||l.stringify,this.datumTokenizer=t.datumTokenizer,this.queryTokenizer=t.queryTokenizer,this.reset()}return l.mixin(t.prototype,{bootstrap:function(t){this.datums=t.datums,this.trie=t.trie},add:function(t){var s=this;t=l.isArray(t)?t:,l.each(t,function(t){var r,e;s.datums=t,e=n(s.datumTokenizer(t)),l.each(e,function(t){for(var e,n=s.trie,i=t.split(“”);e=i.shift();)(n=n[e]||(n[e]=o())).push®})})},get:function(t){var e=this;return l.map(t,function(t){return e.datums})},search:function(t){var s,o=this,e=n(this.queryTokenizer(t));return l.each(e,function(t){var e,n,i,r;if(s&&0===s.length)return!1;for(e=o.trie,n=t.split(“”);e&&(i=n.shift());)e=e[i];if(!e||0!==n.length)return!(s=[]);r=e.slice(0),s=s?function(t,e){var n=0,i=0,r=[];t=t.sort(),e=e.sort();var s=t.length,o=e.length;for(;n<e?n++:(t>e||(r.push(t),n++),i++);return r}(s,r):r}),s?l.map(function(t){for(var e={},n=[],i=0,r=t.length;i]||(e[t]=!0,n.push(t));return n}(s),function(t){return o.datums}):[]},all:function(){var t=[];for(var e in this.datums)t.push(this.datums);return t},reset:function(){this.datums={},this.trie=o()},serialize:function(){return{datums:this.datums,trie:this.trie}}}),t;function n(t){return t=l.filter(t,function(t){return!!t}),t=l.map(t,function(t){return t.toLowerCase()})}function o(){var t={};return t=[],t={},t}}(),o=function(){“use strict”;var n;function t(t){this.url=t.url,this.ttl=t.ttl,this.cache=t.cache,this.prepare=t.prepare,this.transform=t.transform,this.transport=t.transport,this.thumbprint=t.thumbprint,this.storage=new e(t.cacheKey)}return n={data:“data”,protocol:“protocol”,thumbprint:“thumbprint”},l.mixin(t.prototype,{_settings:function(){return{url:this.url,type:“GET”,dataType:“json”}},store:function(t){this.cache&&(this.storage.set(n.data,t,this.ttl),this.storage.set(n.protocol,location.protocol,this.ttl),this.storage.set(n.thumbprint,this.thumbprint,this.ttl))},fromCache:function(){var t,e={};return this.cache?(e.data=this.storage.get(n.data),e.protocol=this.storage.get(n.protocol),e.thumbprint=this.storage.get(n.thumbprint),t=e.thumbprint!==this.thumbprint||e.protocol!==location.protocol,e.data&&!t?e.data:null):null},fromNetwork:function(e){var t,n=this;e&&(t=this.prepare(this._settings()),this.transport(t).fail(function(){e(!0)}).done(function(t){e(null,n.transform(t))}))},clear:function(){return this.storage.clear(),this}}),t}(),u=function(){“use strict”;function t(t){this.url=t.url,this.prepare=t.prepare,this.transform=t.transform,this.transport=new r({cache:t.cache,limiter:t.limiter,transport:t.transport})}return l.mixin(t.prototype,{_settings:function(){return{url:this.url,type:“GET”,dataType:“json”}},get:function(t,n){var e,i=this;if(n)return t=t||“”,e=this.prepare(t,this._settings()),this.transport.get(e,function(t,e){n(t?[]:i.transform(e))})},cancelLastRequest:function(){this.transport.cancel()}}),t}(),a=function(){“use strict”;return function(t){var e,n,i,r,s,o={initialize:!0,identify:l.stringify,datumTokenizer:null,queryTokenizer:null,sufficient:5,sorter:null,local:[],prefetch:null,remote:null};return(t=l.mixin(o,t||{})).datumTokenizer||h.error(“datumTokenizer is required”),t.queryTokenizer||h.error(“queryTokenizer is required”),e=t.sorter,t.sorter=e?function(t){return t.sort(e)}:l.identity,t.local=l.isFunction(t.local)?t.local():t.local,t.prefetch=(n=t.prefetch)?(i={url:null,ttl:864e5,cache:!0,cacheKey:null,thumbprint:“”,prepare:l.identity,transform:l.identity,transport:null},n=l.isString(n)?{url:n}:n,(n=l.mixin(i,n)).url||h.error(“prefetch requires url to be set”),n.transform=n.filter||n.transform,n.cacheKey=n.cacheKey||n.url,n.thumbprint=“0.11.1”+n.thumbprint,n.transport=n.transport?u(n.transport):h.ajax,n):null,t.remote=(r=t.remote)?(s={url:null,cache:!0,prepare:null,replace:null,wildcard:null,limiter:null,rateLimitBy:“debounce”,rateLimitWait:300,transform:l.identity,transport:null},r=l.isString®?{url:r}:r,(r=l.mixin(s,r)).url||h.error(“remote requires url to be set”),r.transform=r.filter||r.transform,r.prepare=function(t){var e,n,i;return e=t.prepare,n=t.replace,i=t.wildcard,e||(e=n?function(t,e){return e.url=n(e.url,t),e}:t.wildcard?function(t,e){return e.url=e.url.replace(i,encodeURIComponent(t)),e}:function(t,e){return e})}®,r.limiter=function(t){var e,n,i;return e=t.limiter,n=t.rateLimitBy,i=t.rateLimitWait,e=e||(/^throttle$/i.test(n)?function(e){return function(t){return l.throttle(t,e)}}:function(e){return function(t){return l.debounce(t,e)}})(i)}®,r.transport=r.transport?u(r.transport):h.ajax,delete r.replace,delete r.wildcard,delete r.rateLimitBy,delete r.rateLimitWait,r):void 0,t};function u(n){return function(t){var e=h.Deferred();return n(t,function(t){l.defer(function(){e.resolve(t)})},function(t){l.defer(function(){e.reject(t)})}),e}}}();return function(){“use strict”;var t;function e(t){t=a(t),this.sorter=t.sorter,this.identify=t.identify,this.sufficient=t.sufficient,this.local=t.local,this.remote=t.remote?new u(t.remote):null,this.prefetch=t.prefetch?new o(t.prefetch):null,this.index=new s({identify:this.identify,datumTokenizer:t.datumTokenizer,queryTokenizer:t.queryTokenizer}),!1!==t.initialize&&this.initialize()}return t=window&&window.Bloodhound,e.noConflict=function(){return window&&(window.Bloodhound=t),e},e.tokenizers=n,l.mixin(e.prototype,{__ttAdapter:function(){var i=this;return this.remote?function(t,e,n){return i.search(t,e,n)}:function(t,e){return i.search(t,e)}},_loadPrefetch:function(){var t,n=this,i=h.Deferred();return this.prefetch?(t=this.prefetch.fromCache())?(this.index.bootstrap(t),i.resolve()):this.prefetch.fromNetwork(function(t,e){if(t)return i.reject();n.add(e),n.prefetch.store(n.index.serialize()),i.resolve()}):i.resolve(),i.promise()},_initialize:function(){var t=this;return this.clear(),(this.initPromise=this._loadPrefetch()).done(function(){t.add(t.local)}),this.initPromise},initialize:function(t){return!this.initPromise||t?this._initialize():this.initPromise},add:function(t){return this.index.add(t),this},get:function(t){return t=l.isArray(t)?t:[].slice.call(arguments),this.index.get(t)},search:function(t,e,i){var r=this,s=this.sorter(this.index.search(t));return e(this.remote?s.slice():s),this.remote&&s.length<this.sufficient?this.remote.get(t,function(t){var n=[];l.each(t,function(e){l.some(s,function(t){return r.identify(e)===r.identify(t)})||n.push(e)}),i&&i(n)}):this.remote&&this.remote.cancelLastRequest(),this},all:function(){return this.index.all()},clear:function(){return this.index.reset(),this},clearPrefetchCache:function(){return this.prefetch&&this.prefetch.clear(),this},clearRemoteCache:function(){return r.resetCache(),this},ttAdapter:function(){return this.__ttAdapter()}}),e}()}),function(t){“function”==typeof define&&define.amd?define(“typeahead.js”,,t):“object”==typeof exports?module.exports=t(require(“jquery”)):t(jQuery)}(function(m){var y=function(){“use strict”;return{isMsie:function(){return!!/(msie|trident)/i.test(navigator.userAgent)&&navigator.userAgent.match(/(msie |rv:)(d+(.d+)?)/i)},isBlankString:function(t){return!t||/^s*$/.test(t)},escapeRegExChars:function(t){return t.replace(/[-/{}()*+?.\^$|]/g,“\$&”)},isString:function(t){return“string”==typeof t},isNumber:function(t){return“number”==typeof t},isArray:m.isArray,isFunction:m.isFunction,isObject:m.isPlainObject,isUndefined:function(t){return void 0===t},isElement:function(t){return!(!t||1!==t.nodeType)},isJQuery:function(t){return t instanceof m},toStr:function(t){return y.isUndefined(t)||null===t?“”:t+“”},bind:m.proxy,each:function(t,n){m.each(t,function(t,e){return n(e,t)})},map:m.map,filter:m.grep,every:function(n,i){var r=!0;return n?(m.each(n,function(t,e){if(!(r=i.call(null,e,t,n)))return!1}),!!r):r},some:function(n,i){var r=!1;return n?(m.each(n,function(t,e){if(r=i.call(null,e,t,n))return!1}),!!r):r},mixin:m.extend,identity:function(t){return t},clone:function(t){return m.extend(!0,{},t)},getIdGenerator:function(){var t=0;return function(){return t++}},templatify:function(t){return m.isFunction(t)?t:function(){return String(t)}},defer:function(t){setTimeout(t,0)},debounce:function(r,s,o){var u,a;return function(){function t(){u=null,o||(a=r.apply(e,n))}var e=this,n=arguments,i=o&&!u;return clearTimeout(u),u=setTimeout(t,s),i&&(a=r.apply(e,n)),a}},throttle:function(n,i){function r(){c=new Date,u=null,a=n.apply(s,o)}var s,o,u,a,c=0;return function(){var t=new Date,e=i-(t-c);return s=this,o=arguments,e<=0?(clearTimeout(u),u=null,c=t,a=n.apply(s,o)):u=u||setTimeout(r,e),a}},stringify:function(t){return y.isString(t)?t:JSON.stringify(t)},noop:function(){}}}(),n=function(){“use strict”;var i={wrapper:“twitter-typeahead”,input:“tt-input”,hint:“tt-hint”,menu:“tt-menu”,dataset:“tt-dataset”,suggestion:“tt-suggestion”,selectable:“tt-selectable”,empty:“tt-empty”,open:“tt-open”,cursor:“tt-cursor”,highlight:“tt-highlight”};return function(t){var e,n;return n=y.mixin({},i,t),{css:(e={css:function(){var t={wrapper:{position:“relative”,display:“inline-block”},hint:{position:“absolute”,top:“0”,left:“0”,borderColor:“transparent”,boxShadow:“none”,opacity:“1”},input:{position:“relative”,verticalAlign:“top”,backgroundColor:“transparent”},inputWithNoHint:{position:“relative”,verticalAlign:“top”},menu:{position:“absolute”,top:“100%”,left:“20”,zIndex:“100”,display:“none”},ltr:{left:“0”,right:“auto”},rtl:{left:“auto”,right:“ 0”}};y.isMsie()&&y.mixin(t.input,{backgroundImage:“url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)”});return t}(),classes:n,html:function(t){return{wrapper:'<span class=“'t.wrapper'”></span>',menu:'<div class=“'t.menu'”></div>'}}(n),selectors:function(t){var n={};return y.each(t,function(t,e){n=“.”+t}),n}(n)}).css,html:e.html,classes:e.classes,selectors:e.selectors,mixin:function(t){y.mixin(t,e)}}}}(),v=function(){“use strict”;var n;function t(t){t&&t.el||m.error(“EventBus initialized without el”),this.$el=m(t.el)}return n={render:“rendered”,cursorchange:“cursorchanged”,select:“selected”,autocomplete:“autocompleted”},y.mixin(t.prototype,{_trigger:function(t,e){var n=m.Event(“typeahead:”+t);return(e=e||[]).unshift(n),this.$el.trigger.apply(this.$el,e),n},before:function(t){var e=[].slice.call(arguments,1);return this._trigger(“before”+t,e).isDefaultPrevented()},trigger:function(t){var e;this._trigger(t,[].slice.call(arguments,1)),(e=n)&&this._trigger(e,[].slice.call(arguments,1))}}),t}(),e=function(){“use strict”;var u=/s+/,o=function(){var t;t=window.setImmediate?function(t){setImmediate(function(){t()})}:function(t){setTimeout(function(){t()},0)};return t}();return{onSync:function(t,e,n){return i.call(this,“sync”,t,e,n)},onAsync:function(t,e,n){return i.call(this,“async”,t,e,n)},off:function(t){var e;if(!this._callbacks)return this;t=t.split(u);for(;e=t.shift();)delete this._callbacks;return this},trigger:function(t){var e,n,i,r,s;if(!this._callbacks)return this;t=t.split(u),i=[].slice.call(arguments,1);for(;(e=t.shift())&&(n=this._callbacks);)r=a(n.sync,this,.concat(i)),s=a(n.async,this,.concat(i)),r()&&o(s);return this}};function i(t,e,n,i){var r,s,o;if(!n)return this;for(e=e.split(u),n=i?(o=i,(s=n).bind?s.bind(o):function(){s.apply(o,[].slice.call(arguments,0))}):n,this._callbacks=this._callbacks||{};r=e.shift();)this._callbacks=this._callbacks||{sync:[],async:},this._callbacks[t].push(n);return this}function a(i,r,s){return function(){for(var t,e=0,n=i.length;!t&&e.apply(r,s);return!t}}}(),a=function(o){“use strict”;var t={node:null,pattern:null,tagName:“strong”,className:null,wordsOnly:!1,caseSensitive:!1};return function®{var s;(r=y.mixin({},t,r)).node&&r.pattern&&(r.pattern=y.isArray(r.pattern)?r.pattern:,s=function(t,e,n){for(var i,r=[],s=0,o=t.length;s));return i=n?“\b(”+r.join(“|”)+“)\b”:“(”+r.join(“|”)+“)”,e?new RegExp(i):new RegExp(i,“i”)}(r.pattern,r.caseSensitive,r.wordsOnly),function t(e,n){var i;for(var r=0;r).nodeType?r+=n(i)?1:0:t(i,n)}(r.node,function(t){var e,n,i;(e=s.exec(t.data))&&(i=o.createElement(r.tagName),r.className&&(i.className=r.className),(n=t.splitText(e.index)).splitText(e.length),i.appendChild(n.cloneNode(!0)),t.parentNode.replaceChild(i,n));return!!e}))}}(window.document),_=function(){“use strict”;var s;function o(t,e){var n;(t=t||{}).input||m.error(“input is missing”),e.mixin(this),this.$hint=m(t.hint),this.$input=m(t.input),this.query=this.$input.val(),this.queryWhenFocused=this.hasFocus()?this.query:null,this.$overflowHelper=(n=this.$input,m('<pre aria-hidden=“true”></pre>').css({position:“absolute”,visibility:“hidden”,whiteSpace:“pre”,fontFamily:n.css(“font-family”),fontSize:n.css(“font-size”),fontStyle:n.css(“font-style”),fontVariant:n.css(“font-variant”),fontWeight:n.css(“font-weight”),wordSpacing:n.css(“word-spacing”),letterSpacing:n.css(“letter-spacing”),textIndent:n.css(“text-indent”),textRendering:n.css(“text-rendering”),textTransform:n.css(“text-transform”)}).insertAfter(n)),this._checkLanguageDirection(),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=y.noop)}return s={9:“tab”,27:“esc”,37:“left”,39:“right”,13:“enter”,38:“up”,40:“down”},o.normalizeQuery=function(t){return y.toStr(t).replace(/^s*/g,“”).replace(/s{2,}/g,“ ”)},y.mixin(o.prototype,e,{_onBlur:function(){this.resetInputValue(),this.trigger(“blurred”)},_onFocus:function(){this.queryWhenFocused=this.query,this.trigger(“focused”)},_onKeydown:function(t){var e=s;this._managePreventDefault(e,t),e&&this._shouldTrigger(e,t)&&this.trigger(e+“Keyed”,t)},_onInput:function(){this._setQuery(this.getInputValue()),this.clearHintIfInvalid(),this._checkLanguageDirection()},_managePreventDefault:function(t,e){var n;switch(t){case“up”:case“down”:n=!i(e);break;default:n=!1}n&&e.preventDefault()},_shouldTrigger:function(t,e){var n;switch(t){case“tab”:n=!i(e);break;default:n=!0}return n},_checkLanguageDirection:function(){var t=(this.$input.css(“direction”)||“ltr”).toLowerCase();this.dir!==t&&(this.dir=t,this.$hint.attr(“dir”,t),this.trigger(“langDirChanged”,t))},_setQuery:function(t,e){var n,i,r,s;r=t,s=this.query,i=(n=o.normalizeQuery®===o.normalizeQuery(s))&&this.query.length!==t.length,this.query=t,e||n?!e&&i&&this.trigger(“whitespaceChanged”,this.query):this.trigger(“queryChanged”,this.query)},bind:function(){var e=this,t=y.bind(this._onBlur,this),n=y.bind(this._onFocus,this),i=y.bind(this._onKeydown,this),r=y.bind(this._onInput,this);return this.$input.on(“blur.tt”,t).on(“focus.tt”,n).on(“keydown.tt”,i),!y.isMsie()||9<y.isMsie()?this.$input.on(“input.tt”,r):this.$input.on(“keydown.tt keypress.tt cut.tt paste.tt”,function(t){s||y.defer(y.bind(e._onInput,e,t))}),this},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getLangDir:function(){return this.dir},getQuery:function(){return this.query||“”},setQuery:function(t,e){this.setInputValue(t),this._setQuery(t,e)},hasQueryChangedSinceLastFocus:function(){return this.query!==this.queryWhenFocused},getInputValue:function(){return this.$input.val()},setInputValue:function(t){this.$input.val(t),this.clearHintIfInvalid(),this._checkLanguageDirection()},resetInputValue:function(){this.setInputValue(this.query)},getHint:function(){return this.$hint.val()},setHint:function(t){this.$hint.val(t)},clearHint:function(){this.setHint(“”)},clearHintIfInvalid:function(){var t=this.getInputValue(),e=this.getHint(),n=t!==e&&0===e.indexOf(t);“”!==t&&n&&!this.hasOverflow()||this.clearHint()},hasFocus:function(){return this.$input.is(“:focus”)},hasOverflow:function(){var t=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=t},isCursorAtEnd:function(){var t,e=this.$input.val().length,n=this.$input.selectionStart;return y.isNumber(n)?n===e:!document.selection||((t=document.selection.createRange()).moveStart(“character”,-e),e===t.text.length)},destroy:function(){this.$hint.off(“.tt”),this.$input.off(“.tt”),this.$overflowHelper.remove(),this.$hint=this.$input=this.$overflowHelper=m(“<div>”)}}),o;function i(t){return t.altKey||t.ctrlKey||t.metaKey||t.shiftKey}}(),r=function(){“use strict”;var o,u;function t(t,e){var n,i,r,s;(t=t||{}).templates=t.templates||{},t.templates.notFound=t.templates.notFound||t.templates.empty,t.source||m.error(“missing source”),t.node||m.error(“missing node”),t.name&&(n=t.name,!/^+$/.test(n))&&m.error(“invalid dataset name: ”+t.name),e.mixin(this),this.highlight=!!t.highlight,this.name=t.name||u(),this.limit=t.limit||5,this.displayFn=(i=(i=t.display||t.displayKey)||y.stringify,y.isFunction(i)?i:function(t){return t}),this.templates=(r=t.templates,s=this.displayFn,{notFound:r.notFound&&y.templatify(r.notFound),pending:r.pending&&y.templatify(r.pending),header:r.header&&y.templatify(r.header),footer:r.footer&&y.templatify(r.footer),suggestion:r.suggestion||function(t){return m(“<div>”).text(s(t))}}),this.source=t.source.__ttAdapter?t.source.__ttAdapter():t.source,this.async=y.isUndefined(t.async)?2<this.source.length:!!t.async,this._resetLastSuggestion(),this.$el=m(t.node).addClass(this.classes.dataset).addClass(this.classes.dataset+“-”+this.name)}return o={val:“tt-selectable-display”,obj:“tt-selectable-object”},u=y.getIdGenerator(),t.extractData=function(t){var e=m(t);return e.data(o.obj)?{val:e.data(o.val)||“”,obj:e.data(o.obj)||null}:null},y.mixin(t.prototype,e,{_overwrite:function(t,e){(e=e||[]).length?this._renderSuggestions(t,e):this.async&&this.templates.pending?this._renderPending(t):!this.async&&this.templates.notFound?this._renderNotFound(t):this._empty(),this.trigger(“rendered”,this.name,e,!1)},_append:function(t,e){(e=e||).length&&this.$lastSuggestion.length?this._appendSuggestions(t,e):e.length?this._renderSuggestions(t,e):!this.$lastSuggestion.length&&this.templates.notFound&&this._renderNotFound(t),this.trigger(“rendered”,this.name,e,!0)},_renderSuggestions:function(t,e){var n=this._getSuggestionsFragment(t,e);this.$lastSuggestion=n.children().last(),this.$el.html(n).prepend(this._getHeader(t,e)).append(this._getFooter(t,e))},_appendSuggestions:function(t,e){var n=this._getSuggestionsFragment(t,e),i=n.children().last();this.$lastSuggestion.after(n),this.$lastSuggestion=i},_renderPending:function(t){var e=this.templates.pending;this._resetLastSuggestion(),e&&this.$el.html(e({query:t,dataset:this.name}))},_renderNotFound:function(t){var e=this.templates.notFound;this._resetLastSuggestion(),e&&this.$el.html(e({query:t,dataset:this.name}))},_empty:function(){this.$el.empty(),this._resetLastSuggestion()},_getSuggestionsFragment:function(i,t){var r=this,s=document.createDocumentFragment();return y.each(t,function(t){var e=r._injectQuery(i,t),n=m(r.templates.suggestion(e)).data(o.obj,t).data(o.val,r.displayFn(t)).addClass(r.classes.suggestion+“ ”+r.classes.selectable);s.appendChild(n)}),this.highlight&&a({className:this.classes.highlight,node:s,pattern:i}),m(s)},_getFooter:function(t,e){return this.templates.footer?this.templates.footer({query:t,suggestions:e,dataset:this.name}):null},_getHeader:function(t,e){return this.templates.header?this.templates.header({query:t,suggestions:e,dataset:this.name}):null},_resetLastSuggestion:function(){this.$lastSuggestion=m()},_injectQuery:function(t,e){return y.isObject(e)?y.mixin({_query:t},e):e},update:function(e){var n=this,i=!1,r=!1,s=0;function t(t){r||(r=!0,t=(t||[]).slice(0,n.limit),s=t.length,n._overwrite(e,t),s,!i&&s<n.limit&&(n.cancel=m.noop,s+=t.length,n._append(e,t.slice(0,n.limit-s)),n.async&&n.trigger(“asyncReceived”,e))}),r||t([])},cancel:m.noop,clear:function(){this._empty(),this.cancel(),this.trigger(“cleared”)},isEmpty:function(){return this.$el.is(“:empty”)},destroy:function(){this.$el=m(“<div>”)}}),t}(),b=function(){“use strict”;function t(t,n){var i=this;(t=t||{}).node||m.error(“node is required”),n.mixin(this),this.$node=m(t.node),this.query=null,this.datasets=y.map(t.datasets,function(t){var e=i.$node.find(t.node).first();return t.node=e.length?e:m(“<div>”).appendTo(i.$node),new r(t,n)})}return y.mixin(t.prototype,e,{_onSelectableClick:function(t){this.trigger(“selectableClicked”,m(t.currentTarget))},_onRendered:function(t,e,n,i){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty()),this.trigger(“datasetRendered”,e,n,i)},_onCleared:function(){this.$node.toggleClass(this.classes.empty,this._allDatasetsEmpty()),this.trigger(“datasetCleared”)},_propagate:function(){this.trigger.apply(this,arguments)},_allDatasetsEmpty:function(){return y.every(this.datasets,function(t){return t.isEmpty()})},_getSelectables:function(){return this.$node.find(this.selectors.selectable)},_removeCursor:function(){var t=this.getActiveSelectable();t&&t.removeClass(this.classes.cursor)},_ensureVisible:function(t){var e=t.position().top,n=e+t.outerHeight(!0),i=this.$node.scrollTop(),r=this.$node.height()+parseInt(this.$node.css(“paddingTop”),10)+parseInt(this.$node.css(“paddingBottom”),10);e<0?this.$node.scrollTop(i+e):r<n&&this.$node.scrollTop(i+(n-r))},bind:function(){var e=this,t=y.bind(this._onSelectableClick,this);return this.$node.on(“click.tt”,this.selectors.selectable,t),y.each(this.datasets,function(t){t.onSync(“asyncRequested”,e._propagate,e).onSync(“asyncCanceled”,e._propagate,e).onSync(“asyncReceived”,e._propagate,e).onSync(“rendered”,e._onRendered,e).onSync(“cleared”,e._onCleared,e)}),this},isOpen:function(){return this.$node.hasClass(this.classes.open)},open:function(){this.$node.addClass(this.classes.open)},close:function(){this.$node.removeClass(this.classes.open),this._removeCursor()},setLanguageDirection:function(t){this.$node.attr(“dir”,t)},selectableRelativeToCursor:function(t){var e=this.getActiveSelectable(),n=this._getSelectables(),i=(e?n.index(e):-1)+t;return-1===(i=(i=(i+1)%(n.length+1)-1)<-1?n.length-1:i)?null:n.eq(i)},setCursor:function(t){this._removeCursor(),(t=t&&t.first())&&(t.addClass(this.classes.cursor),this._ensureVisible(t))},getSelectableData:function(t){return t&&t.length?r.extractData(t):null},getActiveSelectable:function(){var t=this._getSelectables().filter(this.selectors.cursor).first();return t.length?t:null},getTopSelectable:function(){var t=this._getSelectables().first();return t.length?t:null},update:function(e){var t=e!==this.query;return t&&(this.query=e,y.each(this.datasets,function(t){t.update(e)})),t},empty:function(){y.each(this.datasets,function(t){t.clear()}),this.query=null,this.$node.addClass(this.classes.empty)},destroy:function(){this.$node.off(“.tt”),this.$node=m(“<div>”),y.each(this.datasets,function(t){t.destroy()})}}),t}(),w=function(){“use strict”;var e=b.prototype;function t(){b.apply(this,[].slice.call(arguments,0))}return y.mixin(t.prototype,b.prototype,{open:function(){return this._allDatasetsEmpty()||this._show(),e.open.apply(this,[].slice.call(arguments,0))},close:function(){return this._hide(),e.close.apply(this,[].slice.call(arguments,0))},_onRendered:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),e._onRendered.apply(this,[].slice.call(arguments,0))},_onCleared:function(){return this._allDatasetsEmpty()?this._hide():this.isOpen()&&this._show(),e._onCleared.apply(this,[].slice.call(arguments,0))},setLanguageDirection:function(t){return this.$node.css(“ltr”===t?this.css.ltr:this.css.rtl),e.setLanguageDirection.apply(this,[].slice.call(arguments,0))},_hide:function(){this.$node.hide()},_show:function(){this.$node.css(“display”,“block”)}}),t}(),S=function(){“use strict”;function t(t,e){var n,i,r,s,o,u,a,c,h,l,f;(t=t||{}).input||m.error(“missing input”),t.menu||m.error(“missing menu”),t.eventBus||m.error(“missing event bus”),e.mixin(this),this.eventBus=t.eventBus,this.minLength=y.isNumber(t.minLength)?t.minLength:1,this.input=t.input,this.menu=t.menu,this.enabled=!0,this.active=!1,this.input.hasFocus()&&this.activate(),this.dir=this.input.getLangDir(),this._hacks(),this.menu.bind().onSync(“selectableClicked”,this._onSelectableClicked,this).onSync(“asyncRequested”,this._onAsyncRequested,this).onSync(“asyncCanceled”,this._onAsyncCanceled,this).onSync(“asyncReceived”,this._onAsyncReceived,this).onSync(“datasetRendered”,this._onDatasetRendered,this).onSync(“datasetCleared”,this._onDatasetCleared,this),n=d(this,“activate”,“open”,“_onFocused”),i=d(this,“deactivate”,“_onBlurred”),r=d(this,“isActive”,“isOpen”,“_onEnterKeyed”),s=d(this,“isActive”,“isOpen”,“_onTabKeyed”),o=d(this,“isActive”,“_onEscKeyed”),u=d(this,“isActive”,“open”,“_onUpKeyed”),a=d(this,“isActive”,“open”,“_onDownKeyed”),c=d(this,“isActive”,“isOpen”,“_onLeftKeyed”),h=d(this,“isActive”,“isOpen”,“_onRightKeyed”),l=d(this,“_openIfActive”,“_onQueryChanged”),f=d(this,“_openIfActive”,“_onWhitespaceChanged”),this.input.bind().onSync(“focused”,n,this).onSync(“blurred”,i,this).onSync(“enterKeyed”,r,this).onSync(“tabKeyed”,s,this).onSync(“escKeyed”,o,this).onSync(“upKeyed”,u,this).onSync(“downKeyed”,a,this).onSync(“leftKeyed”,c,this).onSync(“rightKeyed”,h,this).onSync(“queryChanged”,l,this).onSync(“whitespaceChanged”,f,this).onSync(“langDirChanged”,this._onLangDirChanged,this)}return y.mixin(t.prototype,{_hacks:function(){var r=this.input.$input||m(“<div>”),s=this.menu.$node||m(“<div>”);r.on(“blur.tt”,function(t){var e=document.activeElement,n=s.is(e),i=0<s.has(e).length;y.isMsie()&&(n||i)&&(t.preventDefault(),t.stopImmediatePropagation(),y.defer(function(){r.focus()}))}),s.on(“mousedown.tt”,function(t){t.preventDefault()})},_onSelectableClicked:function(t,e){this.select(e)},_onDatasetCleared:function(){this._updateHint()},_onDatasetRendered:function(t,e,n,i){this._updateHint(),this.eventBus.trigger(“render”,n,i,e)},_onAsyncRequested:function(t,e,n){this.eventBus.trigger(“asyncrequest”,n,e)},_onAsyncCanceled:function(t,e,n){this.eventBus.trigger(“asynccancel”,n,e)},_onAsyncReceived:function(t,e,n){this.eventBus.trigger(“asyncreceive”,n,e)},_onFocused:function(){this._minLengthMet()&&this.menu.update(this.input.getQuery())},_onBlurred:function(){this.input.hasQueryChangedSinceLastFocus()&&this.eventBus.trigger(“change”,this.input.getQuery())},_onEnterKeyed:function(t,e){var n;(n=this.menu.getActiveSelectable())&&this.select(n)&&e.preventDefault()},_onTabKeyed:function(t,e){var n;(n=this.menu.getActiveSelectable())?this.select(n)&&e.preventDefault():(n=this.menu.getTopSelectable())&&this.autocomplete(n)&&e.preventDefault()},_onEscKeyed:function(){this.close()},_onUpKeyed:function(){this.moveCursor(-1)},_onDownKeyed:function(){this.moveCursor(1)},_onLeftKeyed:function(){“rtl”===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onRightKeyed:function(){“ltr”===this.dir&&this.input.isCursorAtEnd()&&this.autocomplete(this.menu.getTopSelectable())},_onQueryChanged:function(t,e){this._minLengthMet(e)?this.menu.update(e):this.menu.empty()},_onWhitespaceChanged:function(){this._updateHint()},_onLangDirChanged:function(t,e){this.dir!==e&&(this.dir=e,this.menu.setLanguageDirection(e))},_openIfActive:function(){this.isActive()&&this.open()},_minLengthMet:function(t){return(t=y.isString(t)?t:this.input.getQuery()||“”).length>=this.minLength},_updateHint:function(){var t,e,n,i=this.menu.getTopSelectable(),r=this.menu.getSelectableData(i),s=this.input.getInputValue();!r||y.isBlankString(s)||this.input.hasOverflow()?this.input.clearHint():(t=_.normalizeQuery(s),e=y.escapeRegExChars(t),(n=new RegExp(“^(?:”e“)(.+$)”,“i”).exec(r.val))&&this.input.setHint(s+n))},isEnabled:function(){return this.enabled},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},isActive:function(){return this.active},activate:function(){return!!this.isActive()||!(!this.isEnabled()||this.eventBus.before(“active”))&&(this.active=!0,this.eventBus.trigger(“active”),!0)},deactivate:function(){return!this.isActive()||!this.eventBus.before(“idle”)&&(this.active=!1,this.close(),this.eventBus.trigger(“idle”),!0)},isOpen:function(){return this.menu.isOpen()},open:function(){return this.isOpen()||this.eventBus.before(“open”)||(this.menu.open(),this._updateHint(),this.eventBus.trigger(“open”)),this.isOpen()},close:function(){return this.isOpen()&&!this.eventBus.before(“close”)&&(this.menu.close(),this.input.clearHint(),this.input.resetInputValue(),this.eventBus.trigger(“close”)),!this.isOpen()},setVal:function(t){this.input.setQuery(y.toStr(t))},getVal:function(){return this.input.getQuery()},select:function(t){var e=this.menu.getSelectableData(t);return!(!e||this.eventBus.before(“select”,e.obj))&&(this.input.setQuery(e.val,!0),this.eventBus.trigger(“select”,e.obj),this.close(),!0)},autocomplete:function(t){var e=this.input.getQuery(),n=this.menu.getSelectableData(t);return!(!(n&&e!==n.val)||this.eventBus.before(“autocomplete”,n.obj))&&(this.input.setQuery(n.val),this.eventBus.trigger(“autocomplete”,n.obj),!0)},moveCursor:function(t){var e=this.input.getQuery(),n=this.menu.selectableRelativeToCursor(t),i=this.menu.getSelectableData(n),r=i?i.obj:null;return!(this._minLengthMet()&&this.menu.update(e))&&!this.eventBus.before(“cursorchange”,r)&&(this.menu.setCursor(n),i?this.input.setInputValue(i.val):(this.input.resetInputValue(),this._updateHint()),this.eventBus.trigger(“cursorchange”,r),!0)},destroy:function(){this.input.destroy(),this.menu.destroy()}}),t;function d(n){var t=[].slice.call(arguments,1);return function(){var e=[].slice.call(arguments);y.each(t,function(t){return n.apply(n,e)})}}}();!function(){“use strict”;var t,p,e;function i(t,n){t.each(function(){var t,e=m(this);(t=e.data(p.typeahead))&&n(t,e)})}function g(t){var e=y.isJQuery(t)||y.isElement(t)?m(t).first():[];return e.length?e:null}t=m.fn.typeahead,p={www:“tt-www”,attrs:“tt-attrs”,typeahead:“tt-typeahead”},e={initialize:function(l,f){var d;return f=y.isArray(f)?f:[].slice.call(arguments,1),d=n((l=l||{}).classNames),this.each(function(){var t,e,n,i,r,s,o,u,a,c,h;y.each(f,function(t){t.highlight=!!l.highlight}),t=m(this),e=m(d.html.wrapper),n=g(l.hint),i=g(l.menu),r=!1!==l.hint&&!n,s=!1!==l.menu&&!i,r&&(n=function(t,e){return t.clone().addClass(e.classes.hint).removeData().css(e.css.hint).css(function(t){return{backgroundAttachment:t.css(“background-attachment”),backgroundClip:t.css(“background-clip”),backgroundColor:t.css(“background-color”),backgroundImage:t.css(“background-image”),backgroundOrigin:t.css(“background-origin”),backgroundPosition:t.css(“background-position”),backgroundRepeat:t.css(“background-repeat”),backgroundSize:t.css(“background-size”)}}(t)).prop(“readonly”,!0).removeAttr(“id name placeholder required”).attr({autocomplete:“off”,spellcheck:“false”,tabindex:-1})}(t,d)),s&&(i=m(d.html.menu).css(d.css.menu)),n&&n.val(“”),t=function(t,e){t.data(p.attrs,{dir:t.attr(“dir”),autocomplete:t.attr(“autocomplete”),spellcheck:t.attr(“spellcheck”),style:t.attr(“style”)}),t.addClass(e.classes.input).attr({autocomplete:“off”,spellcheck:!1});try{t.attr(“dir”)||t.attr(“dir”,“auto”)}catch(t){}return t}(t,d),(r||s)&&(e.css(d.css.wrapper),t.css(r?d.css.input:d.css.inputWithNoHint),t.wrap(e).parent().prepend(r?n:null).append(s?i:null));h=s?w:b,o=new v({el:t}),u=new _({hint:n,input:t},d),a=new h({node:i,datasets:f},d),c=new S({input:u,menu:a,eventBus:o,minLength:l.minLength},d),t.data(p.www,d),t.data(p.typeahead,c)})},isEnabled:function(){var e;return i(this.first(),function(t){e=t.isEnabled()}),e},enable:function(){return i(this,function(t){t.enable()}),this},disable:function(){return i(this,function(t){t.disable()}),this},isActive:function(){var e;return i(this.first(),function(t){e=t.isActive()}),e},activate:function(){return i(this,function(t){t.activate()}),this},deactivate:function(){return i(this,function(t){t.deactivate()}),this},isOpen:function(){var e;return i(this.first(),function(t){e=t.isOpen()}),e},open:function(){return i(this,function(t){t.open()}),this},close:function(){return i(this,function(t){t.close()}),this},select:function(t){var e=!1,n=m(t);return i(this.first(),function(t){e=t.select(n)}),e},autocomplete:function(t){var e=!1,n=m(t);return i(this.first(),function(t){e=t.autocomplete(n)}),e},moveCursor:function(e){var n=!1;return i(this.first(),function(t){n=t.moveCursor(e)}),n},val:function(e){var n;return arguments.length?(i(this,function(t){t.setVal(e)}),this):(i(this.first(),function(t){n=t.getVal()}),n)},destroy:function(){return i(this,function(t,e){var n,i,r;i=(n=e).data(p.www),r=n.parent().filter(i.selectors.wrapper),y.each(n.data(p.attrs),function(t,e){y.isUndefined(t)?n.removeAttr(e):n.attr(e,t)}),n.removeData(p.typeahead).removeData(p.www).removeData(p.attr).removeClass(i.classes.input),r.length&&(n.detach().insertAfter®,r.remove()),t.destroy()}),this}},m.fn.typeahead=function(t){return e?e.apply(this,[].slice.call(arguments,1)):e.initialize.apply(this,arguments)},m.fn.typeahead.noConflict=function(){return m.fn.typeahead=t,this}}()});