!function(q,k,D,E){"use strict";q.isFunction=q.isFunction||function(e){return"function"==typeofe&&"number"!=typeofe.nodeType},k=void0!==k&&k.Math==Math?k:"undefined"!=typeofself&&self.Math==Math?self:Function("return this")(),q.fn.search=function(u){varx,C=q(this),w=C.selector||"",S=(newDate).getTime(),T=[],F=u,j="string"==typeofF,A=[].slice.call(arguments,1);returnq(this).each(function(){varf,l=q.isPlainObject(u)?q.extend(!0,{},q.fn.search.settings,u):q.extend({},q.fn.search.settings),g=l.className,d=l.metadata,n=l.regExp,i=l.fields,h=l.selector,p=l.error,e=l.namespace,r="."+e,t=e+"-module",m=q(this),v=m.find(h.prompt),s=m.find(h.searchButton),a=m.find(h.results),o=m.find(h.result),y=(m.find(h.category),this),c=m.data(t),b=!1,R=!1;f={initialize:function(){f.verbose("Initializing module"),f.get.settings(),f.determine.searchFields(),f.bind.events(),f.set.type(),f.create.results(),f.instantiate()},instantiate:function(){f.verbose("Storing instance of module",f),c=f,m.data(t,f)},destroy:function(){f.verbose("Destroying instance"),m.off(r).removeData(t)},refresh:function(){f.debug("Refreshing selector cache"),v=m.find(h.prompt),s=m.find(h.searchButton),m.find(h.category),a=m.find(h.results),o=m.find(h.result)},refreshResults:function(){a=m.find(h.results),o=m.find(h.result)},bind:{events:function(){f.verbose("Binding events to search"),l.automatic&&(m.on(f.get.inputEvent()+r,h.prompt,f.event.input),v.attr("autocomplete",f.is.chrome()?"fomantic-search":"off")),m.on("focus"+r,h.prompt,f.event.focus).on("blur"+r,h.prompt,f.event.blur).on("keydown"+r,h.prompt,f.handleKeyboard).on("click"+r,h.searchButton,f.query).on("mousedown"+r,h.results,f.event.result.mousedown).on("mouseup"+r,h.results,f.event.result.mouseup).on("click"+r,h.result,f.event.result.click)}},determine:{searchFields:function(){u&&u.searchFields!==E&&(l.searchFields=u.searchFields)}},event:{input:function(){l.searchDelay?(clearTimeout(f.timer),f.timer=setTimeout(function(){f.is.focused()&&f.query()},l.searchDelay)):f.query()},focus:function(){f.set.focus(),l.searchOnFocus&&f.has.minimumCharacters()&&f.query(function(){f.can.show()&&f.showResults()})},blur:function(e){functiont(){f.cancel.query(),f.remove.focus(),f.timer=setTimeout(f.hideResults,l.hideDelay)}vars=D.activeElement===this;s||(R=!1,f.resultsClicked?(f.debug("Determining if user action caused search to close"),m.one("click.close"+r,h.results,function(e){f.is.inMessage(e)||b?v.focus():(b=!1,f.is.animating()||f.is.hidden()||t())})):(f.debug("Input blurred without user action, closing results"),t()))},result:{mousedown:function(){f.resultsClicked=!0},mouseup:function(){f.resultsClicked=!1},click:function(e){f.debug("Search result selected");vart=q(this),s=t.find(h.title).eq(0),n=t.is("a[href]")?t:t.find("a[href]").eq(0),r=n.attr("href")||!1,i=n.attr("target")||!1,a=0<s.length&&s.text(),o=f.get.results(),c=t.data(d.result)||f.get.result(a,o),u=f.get.value();if(q.isFunction(l.onSelect)&&!1===l.onSelect.call(y,c,o))returnf.debug("Custom onSelect callback cancelled default select action"),void(b=!0);f.hideResults(),a&&f.get.value()===u&&f.set.value(a),r&&(e.preventDefault(),f.verbose("Opening search link found in result",n),"_blank"==i||e.ctrlKey?k.open(r):k.location.href=r)}}},ensureVisible:function(e){vart,s,n,r;0!==e.length&&(s=(t=e.position().top)+e.outerHeight(!0),n=a.scrollTop(),r=a.height(),t<0?a.scrollTop(n+t):r<s&&a.scrollTop(n+(s-r)))},handleKeyboard:function(e){vart,s=m.find(h.result),n=m.find(h.category),r=s.filter("."+g.active),i=s.index(r),a=s.length,o=0<r.length,c=e.which,u=13,l=38,d=40;if(c==27&&(f.verbose("Escape key pressed, blurring search field"),f.hideResults(),R=!0),f.is.visible())if(c==u){if(f.verbose("Enter key pressed, selecting active result"),0<s.filter("."+g.active).length)returnf.event.result.click.call(s.filter("."+g.active),e),e.preventDefault(),!1}elsec==l&&o?(f.verbose("Up key pressed, changing active result"),t=i-1<0?i:i-1,n.removeClass(g.active),s.removeClass(g.active).eq(t).addClass(g.active).closest(n).addClass(g.active),f.ensureVisible(s.eq(t)),e.preventD