/*! * jQuery UI Widget 1.8.21 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * http://docs.jquery.com/UI/Widget */ (function(e,t){if(e.cleanData){var n=e.cleanData;e.cleanData=function(t){for(var r=0,i;(i=t[r])!=null;r++)try{e(i).triggerHandler("remove")}catch(s){}n(t)}}else{var r=e.fn.remove;e.fn.remove=function(t,n){return this.each(function(){return n||(!t||e.filter(t,[this]).length)&&e("*",this).add([this]).each(function(){try{e(this).triggerHandler("remove")}catch(t){}}),r.call(e(this),t,n)})}}e.widget=function(t,n,r){var i=t.split(".")[0],s;t=t.split(".")[1],s=i+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][s]=function(n){return!!e.data(n,t)},e[i]=e[i]||{},e[i][t]=function(e,t){arguments.length&&this._createWidget(e,t)};var o=new n;o.options=e.extend(!0,{},o.options),e[i][t].prototype=e.extend(!0,o,{namespace:i,widgetName:t,widgetEventPrefix:e[i][t].prototype.widgetEventPrefix||t,widgetBaseClass:s},r),e.widget.bridge(t,e[i][t])},e.widget.bridge=function(n,r){e.fn[n]=function(i){var s=typeof i=="string",o=Array.prototype.slice.call(arguments,1),u=this;return i=!s&&o.length?e.extend.apply(null,[!0,i].concat(o)):i,s&&i.charAt(0)==="_"?u:(s?this.each(function(){var r=e.data(this,n),s=r&&e.isFunction(r[i])?r[i].apply(r,o):r;if(s!==r&&s!==t)return u=s,!1}):this.each(function(){var t=e.data(this,n);t?t.option(i||{})._init():e.data(this,n,new r(i,this))}),u)}},e.Widget=function(e,t){arguments.length&&this._createWidget(e,t)},e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:!1},_createWidget:function(t,n){e.data(n,this.widgetName,this),this.element=e(n),this.options=e.extend(!0,{},this.options,this._getCreateOptions(),t);var r=this;this.element.bind("remove."+this.widgetName,function(){r.destroy()}),this._create(),this._trigger("create"),this._init()},_getCreateOptions:function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName),this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+"ui-state-disabled")},widget:function(){return this.element},option:function(n,r){var i=n;if(arguments.length===0)return e.extend({},this.options);if(typeof n=="string"){if(r===t)return this.options[n];i={},i[n]=r}return this._setOptions(i),this},_setOptions:function(t){var n=this;return e.each(t,function(e,t){n._setOption(e,t)}),this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&this.widget()[t?"addClass":"removeClass"](this.widgetBaseClass+"-disabled"+" "+"ui-state-disabled").attr("aria-disabled",t),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.call(this.element[0],n,r)===!1||n.isDefaultPrevented())}}})(jQuery); /*! * Marco Polo v1.8.0 * * A jQuery autocomplete plugin for the discerning developer. * * https://github.com/jstayton/jquery-marcopolo * * Copyright 2013 by Justin Stayton * Licensed MIT */ (function(e){"use strict";typeof define=="function"&&define.amd?define(["jquery"],e):e(jQuery)})(function(e,t){"use strict";var n={};e.widget("mp.marcoPolo",{options:{cache:!0,compare:!1,data:{},delay:250,formatData:null,formatError:function(){return"Your search could not be completed at this time."},formatItem:function(e){return e.title||e.name},formatMinChars:function(e){return"Your search must be at least "+e+" characters."},formatNoResults:function(e){return"No results for "+e+"."},hideOnSelect:!0,highlight:!0,label:null,minChars:1,onBlur:null,onChange:null,onError:null,onFocus:null,onMinChars:null,onNoResults:null,onRequestBefore:null,onRequestAfter:null,onResults:null,onSelect:function(e){this.val(e.title||e.name)},param:"q",required:!1,selectable:"*",selected:null,submitOnEnter:!1,url:null},keys:{DOWN:40,END:35,ENTER:13,ESC:27,HOME:36,TAB:9,UP:38},_create:function(){var t=this,n;t.$input=n=t.element.addClass("mp_input"),t.inputName="mp_"+(n.attr("name")||e.now()),t.$list=e('
    ').attr({"aria-atomic":"true","aria-busy":"false","aria-live":"polite",id:t.inputName+"_list",role:"listbox"}).hide().insertAfter(t.$input),t.inputOriginals={"aria-activedescendant":n.attr("aria-activedescendant"),"aria-autocomplete":n.attr("aria-autocomplete"),"aria-expanded":n.attr("aria-expanded"),"aria-labelledby":n.attr("aria-labelledby"),"aria-owns":n.attr("aria-owns"),"aria-required":n.attr("aria-required"),autocomplete:n.attr("autocomplete"),role:n.attr("role")},n.attr({"aria-autocomplete":"list","aria-owns":t.$list.attr("id"),autocomplete:"off",role:"combobox"}),t.ajax=null,t.ajaxAborted=!1,t.documentMouseup=null,t.focusPseudo=!1,t.focusReal=!1,t.mousedown=!1,t.selectedData=null,t.selectedMouseup=!1,t.timer=null,t.value=t.$input.val(),t._bindInput()._bindList()._bindDocument(),t._initSelected()._initOptions()},_setOption:function(t,n){e.Widget.prototype._setOption.apply(this,arguments),this._initOptions(t,n)},_initOptions:function(n,r){var i=this,s=n===t,o={};return s?o=i.options:o[n]=r,e.each(o,function(t,n){switch(t){case"label":i.options.label=e(n).addClass("mp_label"),i.options.label.attr("id")?i.removeLabelId=!1:(i.removeLabelId=!0,i.options.label.attr("id",i.inputName+"_label")),i._toggleLabel(),i.$input.attr("aria-labelledby",i.options.label.attr("id"));break;case"required":i.$input.attr("aria-required",n);break;case"selected":s&&n&&i.select(n,null,!0);break;case"url":n||(i.options.url=i.$input.closest("form").attr("action"))}}),i},change:function(e,t){var n=this;if(e===n.value)return;e!==n.$input.val()&&n.$input.val(e),n.selectedData=null,n.value=e,n._trigger("change",[e]),t!==!0&&(n.focusPseudo?n._cancelPendingRequest()._hideAndEmptyList():n._toggleLabel())},search:function(e){var n=this.$input;e!==t&&n.val(e),n.focus()},select:function(e,t,n){var r=this,i=r.$input,s=r.options.hideOnSelect;s&&r._hideList();if(!e)return r.change("");r.selectedData=e,r._trigger("select",[e,t,!!n]),i.val()!==r.value&&(r.value=i.val(),r.focusPseudo||r._toggleLabel(),r._hideAndEmptyList())},_initSelected:function(){var e=this,t=e.$input,n=t.data("selected"),r=t.val();return n?e.select(n,null,!0):r&&e.select(r,null,!0),e},selected:function(){return this.selectedData},destroy:function(){var n=this,r=n.options,i=n.$input;n.$list.remove(),e.each(n.inputOriginals,function(e,n){n===t?i.removeAttr(e):i.attr(e,n)}),i.removeClass("mp_input"),r.label&&(r.label.removeClass("mp_label"),n.removeLabelId&&r.label.removeAttr("id")),e(document).unbind("mouseup.marcoPolo",n.documentMouseup),e.Widget.prototype.destroy.apply(n,arguments)},list:function(){return this.$list},_bindInput:function(){var t=this,n=t.$input,r=t.$list;return n.bind("focus.marcoPolo",function(){if(t.focusReal)return;t.focusPseudo=!0,t.focusReal=!0,t._toggleLabel(),t.selectedMouseup?t.selectedMouseup=!1:(t._trigger("focus"),t._request(n.val()))}).bind("keydown.marcoPolo",function(n){var i=e();switch(n.which){case t.keys.UP:n.preventDefault(),t._showList()._highlightPrev();break;case t.keys.DOWN:n.preventDefault(),t._showList()._highlightNext();break;case t.keys.HOME:n.preventDefault(),t._showList()._highlightFirst();break;case t.keys.END:n.preventDefault(),t._showList()._highlightLast();break;case t.keys.ENTER:if(!r.is(":visible")){t.options.submitOnEnter||n.preventDefault();return}i=t._highlighted(),i.length&&t.select(i.data("marcoPolo"),i),(!t.options.submitOnEnter||i.length)&&n.preventDefault();break;case t.keys.TAB:if(!r.is(":visible"))return;i=t._highlighted(),i.length&&t.select(i.data("marcoPolo"),i);break;case t.keys.ESC:t._cancelPendingRequest()._hideList()}}).bind("keyup.marcoPolo",function(){n.val()!==t.value&&t._request(n.val())}).bind("blur.marcoPolo",function(){t.focusReal=!1,setTimeout(function(){t.mousedown||t._dismiss()},1)}),t},_bindList:function(){var t=this;return t.$list.bind("mousedown.marcoPolo",function(){t.mousedown=!0}).delegate("li.mp_selectable","mouseover",function(){t._addHighlight(e(this))}).delegate("li.mp_selectable","mouseout",function(){t._removeHighlight(e(this))}).delegate("li.mp_selectable","mouseup",function(){var n=e(this);t.select(n.data("marcoPolo"),n),t.selectedMouseup=!0,t.$input.focus()}),t},_bindDocument:function(){var t=this;return e(document).bind("mouseup.marcoPolo",t.documentMouseup=function(){t.mousedown=!1,!t.focusReal&&t.$list.is(":visible")&&t._dismiss()}),t},_toggleLabel:function(){var e=this,t=e.options.label;return t&&t.length&&(e.focusPseudo||e.$input.val()?t.hide():t.show()),e},_firstSelectableItem:function(){return this.$list.children("li.mp_selectable:visible:first")},_lastSelectableItem:function(){return this.$list.children("li.mp_selectable:visible:last")},_highlighted:function(){return this.$list.children("li.mp_highlighted")},_removeHighlight:function(e){return e.removeClass("mp_highlighted").attr("aria-selected","false").removeAttr("id"),this.$input.removeAttr("aria-activedescendant"),this},_addHighlight:function(e){return this._removeHighlight(this._highlighted()),e.addClass("mp_highlighted").attr({"aria-selected":"true",id:this.inputName+"_highlighted"}),this.$input.attr("aria-activedescendant",e.attr("id")),this},_highlightFirst:function(){return this._addHighlight(this._firstSelectableItem()),this},_highlightLast:function(){return this._addHighlight(this._lastSelectableItem()),this},_highlightPrev:function(){var e=this._highlighted(),t=e.prevAll("li.mp_selectable:visible:first");return t.length||(t=this._lastSelectableItem()),this._addHighlight(t),this},_highlightNext:function(){var e=this._highlighted(),t=e.nextAll("li.mp_selectable:visible:first");return t.length||(t=this._firstSelectableItem()),this._addHighlight(t),this},_showList:function(){return this.$list.children().length&&(this.$list.show(),this.$input.attr("aria-expanded","true")),this},_hideList:function(){return this.$list.hide(),this.$input.removeAttr("aria-activedescendant").removeAttr("aria-expanded"),this},_emptyList:function(){return this.$list.empty(),this.$input.removeAttr("aria-activedescendant"),this},_hideAndEmptyList:function(){return this.$list.hide().empty(),this.$input.removeAttr("aria-activedescendant").removeAttr("aria-expanded"),this},_buildNoResultsList:function(t){var n=this,r=n.$input,i=n.$list,s=n.options,o=e('