diff --git a/dist/components/dropdown.js b/dist/components/dropdown.js index 982d36206..14235c595 100644 --- a/dist/components/dropdown.js +++ b/dist/components/dropdown.js @@ -1152,6 +1152,7 @@ $.fn.dropdown = function(parameters) { hasSubMenu = ($subMenu.length> 0), hasSelectedItem = ($selectedItem.length > 0), selectedIsSelectable = ($selectedItem.not(selector.unselectable).length > 0), + delimiterPressed = (pressedKey == keys.delimiter && settings.allowAdditions && module.is.multiple()), $nextItem, isSubMenuItem, newIndex @@ -1161,7 +1162,7 @@ $.fn.dropdown = function(parameters) { if( module.is.visible() ) { // enter (select or open sub-menu) - if(pressedKey == keys.enter) { + if(pressedKey == keys.enter || delimiterPressed) { if(pressedKey == keys.enter && hasSelectedItem && hasSubMenu && !settings.allowCategorySelection) { module.verbose('Pressed enter on unselectable category, opening sub menu'); pressedKey = keys.rightArrow; @@ -1278,7 +1279,7 @@ $.fn.dropdown = function(parameters) { } else { // delimiter key - if(pressedKey == keys.delimiter && settings.allowAdditions && module.is.multiple()) { + if(delimiterPressed) { event.preventDefault(); } // down arrow (open menu) diff --git a/dist/components/dropdown.min.js b/dist/components/dropdown.min.js index 7fffef596..c878fdaec 100644 --- a/dist/components/dropdown.min.js +++ b/dist/components/dropdown.min.js @@ -8,5 +8,5 @@ * http://opensource.org/licenses/MIT * */ -!function(e,t,n,i){"use strict";e.fn.dropdown=function(a){var o,s=e(this),r=e(n),l=s.selector||"",c="ontouchstart"in n.documentElement,u=(new Date).getTime(),d=[],v=arguments[0],m="string"==typeof v,f=[].slice.call(arguments,1);return s.each(function(h){var g,p,b,w,x,C,S,y=e.isPlainObject(a)?e.extend(!0,{},e.fn.dropdown.settings,a):e.extend({},e.fn.dropdown.settings),T=y.className,A=y.message,k=y.fields,L=y.metadata,D=y.namespace,I=y.regExp,R=y.selector,q=y.error,V=y.templates,E="."+D,O="module-"+D,F=e(this),P=e(y.context),M=F.find(R.text),z=F.find(R.search),H=F.find(R.input),j=F.find(R.icon),U=F.prev().find(R.text).length>0?F.prev().find(R.text):F.prev(),N=F.children(R.menu),K=N.find(R.item),B=!1,W=!1,$=!1,Q=this,Y=F.data(O);S={initialize:function(){S.debug("Initializing dropdown",y),S.is.alreadySetup()?S.setup.reference():(S.setup.layout(),S.refreshData(),S.save.defaults(),S.restore.selected(),S.create.id(),S.bind.events(),S.observeChanges(),S.instantiate())},instantiate:function(){S.verbose("Storing instance of dropdown",S),Y=S,F.data(O,S)},destroy:function(){S.verbose("Destroying previous dropdown",F),S.remove.tabbable(),F.off(E).removeData(O),N.off(E),r.off(b),x&&x.disconnect(),C&&C.disconnect()},observeChanges:function(){"MutationObserver"in t&&(x=new MutationObserver(function(e){S.debug("").addClass(T.search).insertBefore(M)),y.allowTab&&S.set.tabbable()},select:function(){var t=S.get.selectValues();S.debug("Dropdown initialized on a select",t),F.is("select")&&(H=F),H.parent(R.dropdown).length>0?(S.debug("UI dropdown already exists. Creating dropdown menu only"),F=H.closest(R.dropdown),S.has.menu()||S.create.menu(),N=F.children(R.menu),S.setup.menu(t)):(S.debug("Creating entire dropdown from select"),F=e("
").attr("class",H.attr("class")).addClass(T.selection).addClass(T.dropdown).html(V.dropdown(t)).insertBefore(H),H.hasClass(T.multiple)&&H.prop("multiple")===!1&&(S.error(q.missingMultiple),H.prop("multiple",!0)),H.is("[multiple]")&&S.set.multiple(),H.prop("disabled")&&(S.debug("Disabling dropdown"),F.addClass(T.disabled)),H.removeAttr("class").detach().prependTo(F)),S.refresh()},menu:function(e){N.html(V.menu(e,k)),K=N.find(R.item)},reference:function(){S.debug("Dropdown behavior was called on select, replacing with closest dropdown"),F=F.parent(R.dropdown),S.refresh(),S.setup.returnedObject(),m&&(Y=S,S.invoke(v))},returnedObject:function(){var e=s.slice(0,h),t=s.slice(h+1);s=e.add(F).add(t)}},refresh:function(){S.refreshSelectors(),S.refreshData()},refreshSelectors:function(){S.verbose("Refreshing selector cache"),M=F.find(R.text),z=F.find(R.search),H=F.find(R.input),j=F.find(R.icon),U=F.prev().find(R.text).length>0?F.prev().find(R.text):F.prev(),N=F.children(R.menu),K=N.find(R.item)},refreshData:function(){S.verbose("Refreshing cached metadata"),K.removeData(L.text).removeData(L.value),F.removeData(L.defaultText).removeData(L.defaultValue).removeData(L.placeholderText)},toggle:function(){S.verbose("Toggling menu visibility"),S.is.active()?S.hide():S.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},S.can.show()&&!S.is.active()){if(S.debug("Showing dropdown"),S.is.multiple()&&!S.has.search()&&S.is.allFiltered())return!0;S.has.message()&&!S.has.maxSelections()&&S.remove.message(),y.onShow.call(Q)!==!1&&S.animate.show(function(){S.can.click()&&S.bind.intent(),S.set.visible(),t.call(Q)})}},hide:function(t){t=e.isFunction(t)?t:function(){},S.is.active()&&(S.debug("Hiding dropdown"),y.onHide.call(Q)!==!1&&S.animate.hide(function(){S.remove.visible(),t.call(Q)}))},hideOthers:function(){S.verbose("Finding other dropdowns to hide"),s.not(F).has(R.menu+"."+T.visible).dropdown("hide")},hideMenu:function(){S.verbose("Hiding menu instantaneously"),S.remove.active(),S.remove.visible(),N.transition("hide")},hideSubMenus:function(){var e=N.children(R.item).find(R.menu);S.verbose("Hiding sub menus",e),e.transition("hide")},bind:{events:function(){c&&S.bind.touchEvents(),S.bind.keyboardEvents(),S.bind.inputEvents(),S.bind.mouseEvents()},touchEvents:function(){S.debug("Touch device detected binding additional touch events"),S.is.searchSelection()||S.is.single()&&F.on("touchstart"+E,S.event.test.toggle),N.on("touchstart"+E,R.item,S.event.item.mouseenter)},keyboardEvents:function(){S.verbose("Binding keyboard events"),F.on("keydown"+E,S.event.keydown),S.has.search()&&F.on(S.get.inputEvent()+E,R.search,S.event.input),S.is.multiple()&&r.on("keydown"+b,S.event.document.keydown)},inputEvents:function(){S.verbose("Binding input change events"),F.on("change"+E,R.input,S.event.change)},mouseEvents:function(){S.verbose("Binding mouse events"),S.is.multiple()&&F.on("click"+E,R.label,S.event.label.click).on("click"+E,R.remove,S.event.remove.click),S.is.searchSelection()?(F.on("mousedown"+E,R.menu,S.event.menu.mousedown).on("mouseup"+E,R.menu,S.event.menu.mouseup).on("click"+E,R.icon,S.event.icon.click).on("click"+E,R.search,S.show).on("focus"+E,R.search,S.event.search.focus).on("blur"+E,R.search,S.event.search.blur).on("click"+E,R.text,S.event.text.focus),S.is.multiple()&&F.on("click"+E,S.event.click)):("click"==y.on?F.on("click"+E,R.icon,S.event.icon.click).on("click"+E,S.event.test.toggle):"hover"==y.on?F.on("mouseenter"+E,S.delay.show).on("mouseleave"+E,S.delay.hide):F.on(y.on+E,S.toggle),F.on("mousedown"+E,S.event.mousedown).on("mouseup"+E,S.event.mouseup).on("focus"+E,S.event.focus).on("blur"+E,S.event.blur)),N.on("mouseenter"+E,R.item,S.event.item.mouseenter).on("mouseleave"+E,R.item,S.event.item.mouseleave).on("click"+E,R.item,S.event.item.click)},intent:function(){S.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+b,S.event.test.touch).on("touchmove"+b,S.event.test.touch),r.on("click"+b,S.event.test.hide)}},unbind:{intent:function(){S.verbose("Removing hide intent event from document"),c&&r.off("touchstart"+b).off("touchmove"+b),r.off("click"+b)}},filter:function(e){var t=e!==i?e:S.get.query(),n=function(){S.is.multiple()&&S.filterActive(),S.select.firstUnfiltered(),S.has.allResultsFiltered()?y.onNoResults.call(Q,t)?y.allowAdditions||(S.verbose("All items filtered, showing message",t),S.add.message(A.noResults)):(S.verbose("All items filtered, hiding dropdown",t),S.hideMenu()):S.remove.message(),y.allowAdditions&&S.add.userSuggestion(e),S.is.searchSelection()&&S.can.show()&&S.is.focusedOnSearch()&&S.show()};y.useLabels&&S.has.maxSelections()||(y.apiSettings?S.can.useAPI()?S.queryRemote(t,function(){n()}):S.error(q.noAPI):(S.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:y.throttle,urlData:{query:t},onError:function(){S.add.message(A.serverError),n()},onFailure:function(){S.add.message(A.serverError),n()},onSuccess:function(e){S.remove.message(),S.setup.menu({values:e.results}),n()}};F.api("get request")||S.setup.api(),i=e.extend(!0,{},i,y.apiSettings),F.api("setting",i).api("query")},filterItems:function(t){var n=t!==i?t:S.get.query(),a=e(),o=S.escape.regExp(n),s=new RegExp("^"+o,"igm");S.has.query()?(S.verbose("Searching for matching values",n),K.each(function(){var t,i,o=e(this);if("both"==y.match||"text"==y.match){if(t=String(S.get.choiceText(o,!1)),-1!==t.search(s))return a=a.add(o),!0;if(y.fullTextSearch&&S.fuzzySearch(n,t))return a=a.add(o),!0}if("both"==y.match||"value"==y.match){if(i=String(S.get.choiceValue(o,t)),-1!==i.search(s))return a=a.add(o),!0;if(y.fullTextSearch&&S.fuzzySearch(n,i))return a=a.add(o),!0}})):a=K,S.debug("Showing only matched items",n),S.remove.filteredItem(),K.not(a).addClass(T.filtered)},fuzzySearch:function(e,t){var n=t.length,i=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),i>n)return!1;if(i===n)return e===t;e:for(var a=0,o=0;i>a;a++){for(var s=e.charCodeAt(a);n>o;)if(t.charCodeAt(o++)===s)continue e;return!1}return!0},filterActive:function(){y.useLabels&&K.filter("."+T.active).addClass(T.filtered)},focusSearch:function(){S.is.search()&&!S.is.focusedOnSearch()&&z[0].focus()},forceSelection:function(){var e=K.not(T.filtered).filter("."+T.selected).eq(0),t=K.not(T.filtered).filter("."+T.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i&&S.has.query()?(S.debug("Forcing partial selection to selected item",n),S.event.item.click.call(n)):S.hide()},event:{change:function(){$||(S.debug("Input changed, updating selection"),S.set.selected())},focus:function(){y.showOnFocus&&!B&&S.is.hidden()&&!p&&S.show()},click:function(t){var n=e(t.target);n.is(F)&&!S.is.focusedOnSearch()&&S.focusSearch()},blur:function(e){p=n.activeElement===this,B||p||(S.remove.activeLabel(),S.hide())},mousedown:function(){B=!0},mouseup:function(){B=!1},search:{focus:function(){B=!0,S.is.multiple()&&S.remove.activeLabel(),y.showOnFocus&&S.show()},blur:function(e){p=n.activeElement===this,W||p?p&&y.forceSelection&&S.forceSelection():S.is.multiple()?(S.remove.activeLabel(),S.hide()):y.forceSelection?S.forceSelection():S.hide()}},icon:{click:function(e){S.toggle(),e.stopPropagation()}},text:{focus:function(e){B=!0,S.focusSearch()}},input:function(e){(S.is.multiple()||S.is.searchSelection())&&S.set.filtered(),clearTimeout(S.timer),S.timer=setTimeout(S.search,y.delay.search)},label:{click:function(t){var n=e(this),i=F.find(R.label),a=i.filter("."+T.active),o=n.nextAll("."+T.active),s=n.prevAll("."+T.active),r=o.length>0?n.nextUntil(o).add(a).add(n):n.prevUntil(s).add(a).add(n);t.shiftKey?(a.removeClass(T.active),r.addClass(T.active)):t.ctrlKey?n.toggleClass(T.active):(a.removeClass(T.active),n.addClass(T.active)),y.onLabelSelect.apply(this,i.filter("."+T.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(T.active)?S.remove.activeLabels():S.remove.activeLabels(t)}},test:{toggle:function(e){var t=S.is.multiple()?S.show:S.toggle;S.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){S.determine.eventOnElement(e,function(){"touchstart"==e.type?S.timer=setTimeout(function(){S.hide()},y.delay.touch):"touchmove"==e.type&&clearTimeout(S.timer)}),e.stopPropagation()},hide:function(e){S.determine.eventInModule(e,S.hide)}},menu:{mousedown:function(){W=!0},mouseup:function(){W=!1}},item:{mouseenter:function(t){var n=e(this).children(R.menu),i=e(this).siblings(R.item).children(R.menu);n.length>0&&(clearTimeout(S.itemTimer),S.itemTimer=setTimeout(function(){S.verbose("Showing sub-menu",n),e.each(i,function(){S.animate.hide(!1,e(this))}),S.animate.show(!1,n)},y.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(R.menu);n.length>0&&(clearTimeout(S.itemTimer),S.itemTimer=setTimeout(function(){S.verbose("Hiding sub-menu",n),S.animate.hide(!1,n)},y.delay.hide))},touchend:function(){},click:function(t){var n=e(this),i=e(t?t.target:""),a=n.find(R.menu),o=S.get.choiceText(n),s=S.get.choiceValue(n,o),r=a.length>0,l=a.find(i).length>0;l||r&&!y.allowCategorySelection||(y.useLabels||(S.remove.filteredItem(),S.remove.searchTerm(),S.set.scrollPosition(n)),S.determine.selectAction.call(this,o,s))}},document:{keydown:function(e){var t=e.which,n=S.get.shortcutKeys(),i=S.is.inObject(t,n);if(i){var a=F.find(R.label),o=a.filter("."+T.active),s=(o.data(L.value),a.index(o)),r=a.length,l=o.length>0,c=o.length>1,u=0===s,d=s+1==r,v=S.is.searchSelection(),m=S.is.focusedOnSearch(),f=S.is.focused(),h=m&&0===S.get.caretPosition();if(v&&!l&&!m)return;t==n.leftArrow?!f&&!h||l?l&&(e.shiftKey?S.verbose("Adding previous label to selection"):(S.verbose("Selecting previous label"),a.removeClass(T.active)),u&&!c?o.addClass(T.active):o.prev(R.siblingLabel).addClass(T.active).end(),e.preventDefault()):(S.verbose("Selecting previous label"),a.last().addClass(T.active)):t==n.rightArrow?(f&&!l&&a.first().addClass(T.active),l&&(e.shiftKey?S.verbose("Adding next label to selection"):(S.verbose("Selecting next label"),a.removeClass(T.active)),d?v?m?a.removeClass(T.active):S.focusSearch():c?o.next(R.siblingLabel).addClass(T.active):o.addClass(T.active):o.next(R.siblingLabel).addClass(T.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?l?(S.verbose("Removing active labels"),d&&v&&!m&&S.focusSearch(),o.last().next(R.siblingLabel).addClass(T.active),S.remove.activeLabels(o),e.preventDefault()):h&&!l&&t==n.backspace&&(S.verbose("Removing last label on input backspace"),o=a.last().addClass(T.active),S.remove.activeLabels(o)):o.removeClass(T.active)}}},keydown:function(e){var t=e.which,n=S.get.shortcutKeys(),i=S.is.inObject(t,n);if(i){var a,o,s=K.not(R.unselectable).filter("."+T.selected).eq(0),r=N.children("."+T.active).eq(0),l=s.length>0?s:r,c=l.length>0?l.siblings(":not(."+T.filtered+")").andSelf():N.children(":not(."+T.filtered+")"),u=l.children(R.menu),d=l.closest(R.menu),v=d.hasClass(T.visible)||d.hasClass(T.animating)||d.parent(R.menu).length>0,m=u.length>0,f=l.length>0,h=l.not(R.unselectable).length>0;if(S.is.visible()){if(t==n.enter&&(t==n.enter&&f&&m&&!y.allowCategorySelection?(S.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):h&&(S.verbose("Selecting item from keyboard shortcut",l),S.event.item.click.call(l,e),S.is.searchSelection()&&S.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(o=d[0]!==N[0],o&&(S.verbose("Left key pressed, closing sub-menu"),S.animate.hide(!1,d),l.removeClass(T.selected),d.closest(R.item).addClass(T.selected),e.preventDefault())),t==n.rightArrow&&m&&(S.verbose("Right key pressed, opening sub-menu"),S.animate.show(!1,u),l.removeClass(T.selected),u.find(R.item).eq(0).addClass(T.selected),e.preventDefault()),t==n.upArrow){if(a=f&&v?l.prevAll(R.item+":not("+R.unselectable+")").eq(0):K.eq(0),c.index(a)<0)return S.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();S.verbose("Up key pressed, changing active item"),l.removeClass(T.selected),a.addClass(T.selected),S.set.scrollPosition(a),e.preventDefault()}if(t==n.downArrow){if(a=f&&v?a=l.nextAll(R.item+":not("+R.unselectable+")").eq(0):K.eq(0),0===a.length)return S.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();S.verbose("Down key pressed, changing active item"),K.removeClass(T.selected),a.addClass(T.selected),S.set.scrollPosition(a),e.preventDefault()}t==n.pageUp&&(S.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(S.scrollPage("down"),e.preventDefault()),t==n.escape&&(S.verbose("Escape key pressed, closing dropdown"),S.hide())}else t==n.delimiter&&y.allowAdditions&&S.is.multiple()&&e.preventDefault(),t==n.downArrow&&(S.verbose("Down key pressed, showing dropdown"),S.show(),e.preventDefault())}else S.is.selection()&&!S.is.search()&&S.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){S.verbose("Determining action",y.action),e.isFunction(S.action[y.action])?(S.verbose("Triggering preset action",y.action,t,n),S.action[y.action].call(this,t,n)):e.isFunction(y.action)?(S.verbose("Triggering user action",y.action,t,n),y.action.call(this,t,n)):S.error(q.action,y.action)},eventInModule:function(t,i){var a=e(t.target),o=a.closest(n.documentElement).length>0,s=a.closest(F).length>0;return i=e.isFunction(i)?i:function(){},o&&!s?(S.verbose("Triggering event",i),i(),!0):(S.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target),a=i.closest(R.siblingLabel),o=0===F.find(a).length,s=0===i.closest(N).length;return n=e.isFunction(n)?n:function(){},o&&s?(S.verbose("Triggering event",n),n(),!0):(S.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){if(n=n!==i?n:t,S.can.activate(e(this))){if(S.set.selected(n,e(this)),S.is.multiple()&&!S.is.allFiltered())return;S.hideAndClear()}},select:function(e,t){S.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,S.set.selected(n,e(this)),S.hideAndClear()},hide:function(e,t){S.set.value(t),S.hideAndClear()}},get:{id:function(){return w},defaultText:function(){return F.data(L.defaultText)},defaultValue:function(){return F.data(L.defaultValue)},placeholderText:function(){return F.data(L.placeholderText)||""},text:function(){return M.text()},query:function(){return e.trim(z.val())},searchWidth:function(e){return e*y.glyphWidth+"em"},selectionCount:function(){var t,n=S.get.values();return t=S.is.multiple()?e.isArray(n)?n.length:0:""!==S.get.value()?1:0},transition:function(e){return"auto"==y.transition?S.is.upward(e)?"slide up":"slide down":y.transition},userValues:function(){var t=S.get.values();return t?(t=e.isArray(t)?t:[t],e.grep(t,function(e){return S.get.item(e)===!1})):!1},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=z.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){var t=H.length>0?H.val():F.data(L.value);return e.isArray(t)&&1===t.length&&""===t[0]?"":t},values:function(){var e=S.get.value();return""===e?"":!S.has.selectInput()&&S.is.multiple()?"string"==typeof e?e.split(y.delimiter):"":e},remoteValues:function(){var t=S.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=S.read.remoteData(t);S.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(t,n){return n=n!==i?n:y.preserveHTML,t?(t.find(R.menu).length>0&&(S.verbose("Retreiving text of element with sub-menu"),t=t.clone(),t.find(R.menu).remove(),t.find(R.menuIcon).remove()),t.data(L.text)!==i?t.data(L.text):e.trim(n?t.html():t.text())):void 0},choiceValue:function(t,n){return n=n||S.get.choiceText(t),t?t.data(L.value)!==i?String(t.data(L.value)):"string"==typeof n?e.trim(n.toLowerCase()):String(n):!1},inputEvent:function(){var e=z[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],F.find("option").each(function(){var n=e(this),a=n.html(),o=n.attr("disabled"),s=n.attr("value")!==i?n.attr("value"):a;"auto"===y.placeholder&&""===s?t.placeholder=a:t.values.push({name:a,value:s,disabled:o})}),y.placeholder&&"auto"!==y.placeholder&&(S.debug("Setting placeholder value to",y.placeholder),t.placeholder=y.placeholder),y.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),S.debug("Retrieved and sorted values from select",t)):S.debug("Retreived values from select",t),t},activeItem:function(){return K.filter("."+T.active)},selectedItem:function(){var e=K.not(R.unselectable).filter("."+T.selected);return e.length>0?e:K.eq(0)},itemWithAdditions:function(e){var t=S.get.item(e),n=S.create.userChoice(e),i=n&&n.length>0;return i&&(t=t.length>0?t.add(n):n),t},item:function(t,n){var a,o,s=!1;return t=t!==i?t:S.get.values()!==i?S.get.values():S.get.text(),a=o?t.length>0:t!==i&&null!==t,o=S.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,a&&K.each(function(){var a=e(this),r=S.get.choiceText(a),l=S.get.choiceValue(a,r);if(null!==l&&l!==i)if(o)(-1!==e.inArray(String(l),t)||-1!==e.inArray(r,t))&&(s=s?s.add(a):a);else if(n){if(S.verbose("Ambiguous dropdown value using strict type check",a,t),l===t||r===t)return s=a,!0}else if(String(l)==String(t)||r==t)return S.verbose("Found select item by value",l,t),s=a,!0}),s}},check:{maxSelections:function(e){return y.maxSelections?(e=e!==i?e:S.get.selectionCount(),e>=y.maxSelections?(S.debug("Maximum selection count reached"),y.useLabels&&(K.addClass(T.filtered),S.add.message(A.maxSelections)),!0):(S.verbose("No longer at maximum selection count"),S.remove.message(),S.remove.filteredItem(),S.is.searchSelection()&&S.filterItems(),!1)):!0}},restore:{defaults:function(){S.clear(),S.restore.defaultText(),S.restore.defaultValue()},defaultText:function(){var e=S.get.defaultText(),t=S.get.placeholderText;e===t?(S.debug("Restoring default placeholder text",e),S.set.placeholderText(e)):(S.debug("Restoring default text",e),S.set.text(e))},defaultValue:function(){var e=S.get.defaultValue();e!==i&&(S.debug("Restoring default value",e),""!==e?(S.set.value(e),S.set.selected()):(S.remove.activeItem(),S.remove.selectedItem()))},labels:function(){y.allowAdditions&&(y.useLabels||(S.error(q.labels),y.useLabels=!0),S.debug("Restoring selected values"),S.create.userLabels()),S.check.maxSelections()},selected:function(){S.restore.values(),S.is.multiple()?(S.debug("Restoring previously selected values and labels"),S.restore.labels()):S.debug("Restoring previously selected values")},values:function(){S.set.initialLoad(),y.apiSettings?y.saveRemoteData?S.restore.remoteValues():S.clearValue():S.set.selected(),S.remove.initialLoad()},remoteValues:function(){var t=S.get.remoteValues();S.debug("Recreating selected from session data",t),t&&(S.is.single()?e.each(t,function(e,t){S.set.text(t)}):e.each(t,function(e,t){S.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void S.error(q.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){S.save.defaultText(),S.save.placeholderText(),S.save.defaultValue()},defaultValue:function(){var e=S.get.value();S.verbose("Saving default value as",e),F.data(L.defaultValue,e)},defaultText:function(){var e=S.get.text();S.verbose("Saving default text as",e),F.data(L.defaultText,e)},placeholderText:function(){var e;y.placeholder!==!1&&M.hasClass(T.placeholder)&&(e=S.get.text(),S.verbose("Saving placeholder text as",e),F.data(L.placeholderText,e))},remoteData:function(e,n){return t.Storage===i?void S.error(q.noStorage):(S.verbose("Saving remote data to session storage",n,e),void sessionStorage.setItem(n,e))}},clear:function(){S.is.multiple()?S.remove.labels():(S.remove.activeItem(),S.remove.selectedItem()),S.set.placeholderText(),S.clearValue()},clearValue:function(){S.set.value("")},scrollPage:function(e,t){var n,i,a,o=t||S.get.selectedItem(),s=o.closest(R.menu),r=s.outerHeight(),l=s.scrollTop(),c=K.eq(0).outerHeight(),u=Math.floor(r/c),d=(s.prop("scrollHeight"),"up"==e?l-c*u:l+c*u),v=K.not(R.unselectable);a="up"==e?v.index(o)-u:v.index(o)+u,n="up"==e?a>=0:a0&&(S.debug("Scrolling page",e,i),o.removeClass(T.selected),i.addClass(T.selected),s.scrollTop(d))},set:{filtered:function(){var e=S.is.multiple(),t=S.is.searchSelection(),n=e&&t,i=t?S.get.query():"",a="string"==typeof i&&i.length>0,o=S.get.searchWidth(i.length),s=""!==i;e&&a&&(S.verbose("Adjusting input width",o,y.glyphWidth),z.css("width",o)),a||n&&s?(S.verbose("Hiding placeholder text"),M.addClass(T.filtered)):(!e||n&&!s)&&(S.verbose("Showing placeholder text"),M.removeClass(T.filtered))},loading:function(){F.addClass(T.loading)},placeholderText:function(e){e=e||S.get.placeholderText(),S.debug("Setting placeholder text",e),S.set.text(e),M.addClass(T.placeholder)},tabbable:function(){S.has.search()?(S.debug("Added tabindex to searchable dropdown"),z.val("").attr("tabindex",0),N.attr("tabindex",-1)):(S.debug("Added tabindex to dropdown"),F.attr("tabindex")||(F.attr("tabindex",0),N.attr("tabindex",-1)))},initialLoad:function(){S.verbose("Setting initial load"),g=!0},activeItem:function(e){e.addClass(y.allowAdditions&&e.filter(R.addition).length>0?T.filtered:T.active)},scrollPosition:function(e,t){var n,a,o,s,r,l,c,u,d,v=5;e=e||S.get.selectedItem(),n=e.closest(R.menu),a=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&a&&(s=e.position().top,n.addClass(T.loading),l=n.scrollTop(),r=n.offset().top,s=e.offset().top,o=l-r+s,t||(c=n.height(),d=o+v>l+c,u=l>o-v),S.debug("Scrolling to active item",o),(t||u||d)&&n.scrollTop(o),n.removeClass(T.loading))},text:function(e){"select"!==y.action&&("combo"==y.action?(S.debug("Changing combo button text",e,U),y.preserveHTML?U.html(e):U.text(e)):(e!==S.get.placeholderText()&&M.removeClass(T.placeholder),S.debug("Changing text",e,M),M.removeClass(T.filtered),y.preserveHTML?M.html(e):M.text(e)))},selectedLetter:function(t){var n,i=K.filter("."+T.selected),a=i.length>0&&S.has.firstLetter(i,t),o=!1;a&&(n=i.nextAll(K).eq(0),S.has.firstLetter(n,t)&&(o=n)),o||K.each(function(){return S.has.firstLetter(e(this),t)?(o=e(this),!1):void 0}),o&&(S.verbose("Scrolling to next value with letter",t),S.set.scrollPosition(o),i.removeClass(T.selected),o.addClass(T.selected))},direction:function(e){"auto"==y.direction?S.is.onScreen(e)?S.remove.upward(e):S.set.upward(e):"upward"==y.direction&&S.set.upward(e)},upward:function(e){var t=e||F;t.addClass(T.upward)},value:function(e,t,n){var a=H.length>0,o=(!S.has.value(e),S.get.values()),s=e!==i?String(e):e;if(a){if(s==o&&(S.verbose("Skipping value update already same value",e,o),!S.is.initialLoad()))return;S.is.single()&&S.has.selectInput()&&S.can.extendSelect()&&(S.debug("Adding user option",e),S.add.optionValue(e)),S.debug("Updating input value",e,o),$=!0,H.val(e),y.fireOnInit===!1&&S.is.initialLoad()?S.debug("Input native change event ignored on initial load"):H.trigger("change"),$=!1}else S.verbose("Storing value in metadata",e,H),e!==o&&F.data(L.value,s);y.fireOnInit===!1&&S.is.initialLoad()?S.verbose("No callback on initial load",y.onChange):y.onChange.call(Q,e,t,n)},active:function(){F.addClass(T.active)},multiple:function(){F.addClass(T.multiple)},visible:function(){F.addClass(T.visible)},exactly:function(e,t){S.debug("Setting selected to exact values"),S.clear(),S.set.selected(e,t)},selected:function(t,n){var i=S.is.multiple();n=y.allowAdditions?n||S.get.itemWithAdditions(t):n||S.get.item(t),n&&(S.debug("Setting selected menu item to",n),S.is.single()?(S.remove.activeItem(),S.remove.selectedItem()):y.useLabels&&S.remove.selectedItem(),n.each(function(){var t=e(this),a=S.get.choiceText(t),o=S.get.choiceValue(t,a),s=t.hasClass(T.filtered),r=t.hasClass(T.active),l=t.hasClass(T.addition),c=i&&1==n.length;i?!r||l?(y.apiSettings&&y.saveRemoteData&&S.save.remoteData(a,o),y.useLabels?(S.add.value(o,a,t),S.add.label(o,a,c),S.set.activeItem(t),S.filterActive(),S.select.nextAvailable(n)):(S.add.value(o,a,t),S.set.text(S.add.variables(A.count)),S.set.activeItem(t))):s||(S.debug("Selected active value, removing label"),S.remove.selected(o)):(y.apiSettings&&y.saveRemoteData&&S.save.remoteData(a,o),S.set.text(a),S.set.value(o,a,t),t.addClass(T.active).addClass(T.selected))}))}},add:{label:function(t,n,i){var a,o=S.is.searchSelection()?z:M;return a=e("").addClass(T.label).attr("data-value",t).html(V.label(t,n)),a=y.onLabelCreate.call(a,t,n),S.has.label(t)?void S.debug("Label already exists, skipping",t):(y.label.variation&&a.addClass(y.label.variation),void(i===!0?(S.debug("Animating in label",a),a.addClass(T.hidden).insertBefore(o).transition(y.label.transition,y.label.duration)):(S.debug("Adding selection label",a),a.insertBefore(o))))},message:function(t){var n=N.children(R.message),i=y.templates.message(S.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(T.message).appendTo(N)},optionValue:function(t){var n=H.find('option[value="'+t+'"]'),i=n.length>0;i||(x&&(x.disconnect(),S.verbose("Temporarily disconnecting mutation observer",t)),S.is.single()&&(S.verbose("Removing previous user addition"),H.find("option."+T.addition).remove()),e("
").attr("class",H.attr("class")).addClass(T.selection).addClass(T.dropdown).html(V.dropdown(t)).insertBefore(H),H.hasClass(T.multiple)&&H.prop("multiple")===!1&&(S.error(q.missingMultiple),H.prop("multiple",!0)),H.is("[multiple]")&&S.set.multiple(),H.prop("disabled")&&(S.debug("Disabling dropdown"),F.addClass(T.disabled)),H.removeAttr("class").detach().prependTo(F)),S.refresh()},menu:function(e){N.html(V.menu(e,k)),K=N.find(R.item)},reference:function(){S.debug("Dropdown behavior was called on select, replacing with closest dropdown"),F=F.parent(R.dropdown),S.refresh(),S.setup.returnedObject(),m&&(Y=S,S.invoke(v))},returnedObject:function(){var e=s.slice(0,h),t=s.slice(h+1);s=e.add(F).add(t)}},refresh:function(){S.refreshSelectors(),S.refreshData()},refreshSelectors:function(){S.verbose("Refreshing selector cache"),M=F.find(R.text),z=F.find(R.search),H=F.find(R.input),j=F.find(R.icon),U=F.prev().find(R.text).length>0?F.prev().find(R.text):F.prev(),N=F.children(R.menu),K=N.find(R.item)},refreshData:function(){S.verbose("Refreshing cached metadata"),K.removeData(L.text).removeData(L.value),F.removeData(L.defaultText).removeData(L.defaultValue).removeData(L.placeholderText)},toggle:function(){S.verbose("Toggling menu visibility"),S.is.active()?S.hide():S.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},S.can.show()&&!S.is.active()){if(S.debug("Showing dropdown"),S.is.multiple()&&!S.has.search()&&S.is.allFiltered())return!0;S.has.message()&&!S.has.maxSelections()&&S.remove.message(),y.onShow.call(Q)!==!1&&S.animate.show(function(){S.can.click()&&S.bind.intent(),S.set.visible(),t.call(Q)})}},hide:function(t){t=e.isFunction(t)?t:function(){},S.is.active()&&(S.debug("Hiding dropdown"),y.onHide.call(Q)!==!1&&S.animate.hide(function(){S.remove.visible(),t.call(Q)}))},hideOthers:function(){S.verbose("Finding other dropdowns to hide"),s.not(F).has(R.menu+"."+T.visible).dropdown("hide")},hideMenu:function(){S.verbose("Hiding menu instantaneously"),S.remove.active(),S.remove.visible(),N.transition("hide")},hideSubMenus:function(){var e=N.children(R.item).find(R.menu);S.verbose("Hiding sub menus",e),e.transition("hide")},bind:{events:function(){c&&S.bind.touchEvents(),S.bind.keyboardEvents(),S.bind.inputEvents(),S.bind.mouseEvents()},touchEvents:function(){S.debug("Touch device detected binding additional touch events"),S.is.searchSelection()||S.is.single()&&F.on("touchstart"+E,S.event.test.toggle),N.on("touchstart"+E,R.item,S.event.item.mouseenter)},keyboardEvents:function(){S.verbose("Binding keyboard events"),F.on("keydown"+E,S.event.keydown),S.has.search()&&F.on(S.get.inputEvent()+E,R.search,S.event.input),S.is.multiple()&&r.on("keydown"+b,S.event.document.keydown)},inputEvents:function(){S.verbose("Binding input change events"),F.on("change"+E,R.input,S.event.change)},mouseEvents:function(){S.verbose("Binding mouse events"),S.is.multiple()&&F.on("click"+E,R.label,S.event.label.click).on("click"+E,R.remove,S.event.remove.click),S.is.searchSelection()?(F.on("mousedown"+E,R.menu,S.event.menu.mousedown).on("mouseup"+E,R.menu,S.event.menu.mouseup).on("click"+E,R.icon,S.event.icon.click).on("click"+E,R.search,S.show).on("focus"+E,R.search,S.event.search.focus).on("blur"+E,R.search,S.event.search.blur).on("click"+E,R.text,S.event.text.focus),S.is.multiple()&&F.on("click"+E,S.event.click)):("click"==y.on?F.on("click"+E,R.icon,S.event.icon.click).on("click"+E,S.event.test.toggle):"hover"==y.on?F.on("mouseenter"+E,S.delay.show).on("mouseleave"+E,S.delay.hide):F.on(y.on+E,S.toggle),F.on("mousedown"+E,S.event.mousedown).on("mouseup"+E,S.event.mouseup).on("focus"+E,S.event.focus).on("blur"+E,S.event.blur)),N.on("mouseenter"+E,R.item,S.event.item.mouseenter).on("mouseleave"+E,R.item,S.event.item.mouseleave).on("click"+E,R.item,S.event.item.click)},intent:function(){S.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+b,S.event.test.touch).on("touchmove"+b,S.event.test.touch),r.on("click"+b,S.event.test.hide)}},unbind:{intent:function(){S.verbose("Removing hide intent event from document"),c&&r.off("touchstart"+b).off("touchmove"+b),r.off("click"+b)}},filter:function(e){var t=e!==i?e:S.get.query(),n=function(){S.is.multiple()&&S.filterActive(),S.select.firstUnfiltered(),S.has.allResultsFiltered()?y.onNoResults.call(Q,t)?y.allowAdditions||(S.verbose("All items filtered, showing message",t),S.add.message(A.noResults)):(S.verbose("All items filtered, hiding dropdown",t),S.hideMenu()):S.remove.message(),y.allowAdditions&&S.add.userSuggestion(e),S.is.searchSelection()&&S.can.show()&&S.is.focusedOnSearch()&&S.show()};y.useLabels&&S.has.maxSelections()||(y.apiSettings?S.can.useAPI()?S.queryRemote(t,function(){n()}):S.error(q.noAPI):(S.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:y.throttle,urlData:{query:t},onError:function(){S.add.message(A.serverError),n()},onFailure:function(){S.add.message(A.serverError),n()},onSuccess:function(e){S.remove.message(),S.setup.menu({values:e.results}),n()}};F.api("get request")||S.setup.api(),i=e.extend(!0,{},i,y.apiSettings),F.api("setting",i).api("query")},filterItems:function(t){var n=t!==i?t:S.get.query(),a=e(),o=S.escape.regExp(n),s=new RegExp("^"+o,"igm");S.has.query()?(S.verbose("Searching for matching values",n),K.each(function(){var t,i,o=e(this);if("both"==y.match||"text"==y.match){if(t=String(S.get.choiceText(o,!1)),-1!==t.search(s))return a=a.add(o),!0;if(y.fullTextSearch&&S.fuzzySearch(n,t))return a=a.add(o),!0}if("both"==y.match||"value"==y.match){if(i=String(S.get.choiceValue(o,t)),-1!==i.search(s))return a=a.add(o),!0;if(y.fullTextSearch&&S.fuzzySearch(n,i))return a=a.add(o),!0}})):a=K,S.debug("Showing only matched items",n),S.remove.filteredItem(),K.not(a).addClass(T.filtered)},fuzzySearch:function(e,t){var n=t.length,i=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),i>n)return!1;if(i===n)return e===t;e:for(var a=0,o=0;i>a;a++){for(var s=e.charCodeAt(a);n>o;)if(t.charCodeAt(o++)===s)continue e;return!1}return!0},filterActive:function(){y.useLabels&&K.filter("."+T.active).addClass(T.filtered)},focusSearch:function(){S.is.search()&&!S.is.focusedOnSearch()&&z[0].focus()},forceSelection:function(){var e=K.not(T.filtered).filter("."+T.selected).eq(0),t=K.not(T.filtered).filter("."+T.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i&&S.has.query()?(S.debug("Forcing partial selection to selected item",n),S.event.item.click.call(n)):S.hide()},event:{change:function(){$||(S.debug("Input changed, updating selection"),S.set.selected())},focus:function(){y.showOnFocus&&!B&&S.is.hidden()&&!p&&S.show()},click:function(t){var n=e(t.target);n.is(F)&&!S.is.focusedOnSearch()&&S.focusSearch()},blur:function(e){p=n.activeElement===this,B||p||(S.remove.activeLabel(),S.hide())},mousedown:function(){B=!0},mouseup:function(){B=!1},search:{focus:function(){B=!0,S.is.multiple()&&S.remove.activeLabel(),y.showOnFocus&&S.show()},blur:function(e){p=n.activeElement===this,W||p?p&&y.forceSelection&&S.forceSelection():S.is.multiple()?(S.remove.activeLabel(),S.hide()):y.forceSelection?S.forceSelection():S.hide()}},icon:{click:function(e){S.toggle(),e.stopPropagation()}},text:{focus:function(e){B=!0,S.focusSearch()}},input:function(e){(S.is.multiple()||S.is.searchSelection())&&S.set.filtered(),clearTimeout(S.timer),S.timer=setTimeout(S.search,y.delay.search)},label:{click:function(t){var n=e(this),i=F.find(R.label),a=i.filter("."+T.active),o=n.nextAll("."+T.active),s=n.prevAll("."+T.active),r=o.length>0?n.nextUntil(o).add(a).add(n):n.prevUntil(s).add(a).add(n);t.shiftKey?(a.removeClass(T.active),r.addClass(T.active)):t.ctrlKey?n.toggleClass(T.active):(a.removeClass(T.active),n.addClass(T.active)),y.onLabelSelect.apply(this,i.filter("."+T.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(T.active)?S.remove.activeLabels():S.remove.activeLabels(t)}},test:{toggle:function(e){var t=S.is.multiple()?S.show:S.toggle;S.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){S.determine.eventOnElement(e,function(){"touchstart"==e.type?S.timer=setTimeout(function(){S.hide()},y.delay.touch):"touchmove"==e.type&&clearTimeout(S.timer)}),e.stopPropagation()},hide:function(e){S.determine.eventInModule(e,S.hide)}},menu:{mousedown:function(){W=!0},mouseup:function(){W=!1}},item:{mouseenter:function(t){var n=e(this).children(R.menu),i=e(this).siblings(R.item).children(R.menu);n.length>0&&(clearTimeout(S.itemTimer),S.itemTimer=setTimeout(function(){S.verbose("Showing sub-menu",n),e.each(i,function(){S.animate.hide(!1,e(this))}),S.animate.show(!1,n)},y.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(R.menu);n.length>0&&(clearTimeout(S.itemTimer),S.itemTimer=setTimeout(function(){S.verbose("Hiding sub-menu",n),S.animate.hide(!1,n)},y.delay.hide))},touchend:function(){},click:function(t){var n=e(this),i=e(t?t.target:""),a=n.find(R.menu),o=S.get.choiceText(n),s=S.get.choiceValue(n,o),r=a.length>0,l=a.find(i).length>0;l||r&&!y.allowCategorySelection||(y.useLabels||(S.remove.filteredItem(),S.remove.searchTerm(),S.set.scrollPosition(n)),S.determine.selectAction.call(this,o,s))}},document:{keydown:function(e){var t=e.which,n=S.get.shortcutKeys(),i=S.is.inObject(t,n);if(i){var a=F.find(R.label),o=a.filter("."+T.active),s=(o.data(L.value),a.index(o)),r=a.length,l=o.length>0,c=o.length>1,u=0===s,d=s+1==r,v=S.is.searchSelection(),m=S.is.focusedOnSearch(),f=S.is.focused(),h=m&&0===S.get.caretPosition();if(v&&!l&&!m)return;t==n.leftArrow?!f&&!h||l?l&&(e.shiftKey?S.verbose("Adding previous label to selection"):(S.verbose("Selecting previous label"),a.removeClass(T.active)),u&&!c?o.addClass(T.active):o.prev(R.siblingLabel).addClass(T.active).end(),e.preventDefault()):(S.verbose("Selecting previous label"),a.last().addClass(T.active)):t==n.rightArrow?(f&&!l&&a.first().addClass(T.active),l&&(e.shiftKey?S.verbose("Adding next label to selection"):(S.verbose("Selecting next label"),a.removeClass(T.active)),d?v?m?a.removeClass(T.active):S.focusSearch():c?o.next(R.siblingLabel).addClass(T.active):o.addClass(T.active):o.next(R.siblingLabel).addClass(T.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?l?(S.verbose("Removing active labels"),d&&v&&!m&&S.focusSearch(),o.last().next(R.siblingLabel).addClass(T.active),S.remove.activeLabels(o),e.preventDefault()):h&&!l&&t==n.backspace&&(S.verbose("Removing last label on input backspace"),o=a.last().addClass(T.active),S.remove.activeLabels(o)):o.removeClass(T.active)}}},keydown:function(e){var t=e.which,n=S.get.shortcutKeys(),i=S.is.inObject(t,n);if(i){var a,o,s=K.not(R.unselectable).filter("."+T.selected).eq(0),r=N.children("."+T.active).eq(0),l=s.length>0?s:r,c=l.length>0?l.siblings(":not(."+T.filtered+")").andSelf():N.children(":not(."+T.filtered+")"),u=l.children(R.menu),d=l.closest(R.menu),v=d.hasClass(T.visible)||d.hasClass(T.animating)||d.parent(R.menu).length>0,m=u.length>0,f=l.length>0,h=l.not(R.unselectable).length>0,g=t==n.delimiter&&y.allowAdditions&&S.is.multiple();if(S.is.visible()){if((t==n.enter||g)&&(t==n.enter&&f&&m&&!y.allowCategorySelection?(S.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):h&&(S.verbose("Selecting item from keyboard shortcut",l),S.event.item.click.call(l,e),S.is.searchSelection()&&S.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(o=d[0]!==N[0],o&&(S.verbose("Left key pressed, closing sub-menu"),S.animate.hide(!1,d),l.removeClass(T.selected),d.closest(R.item).addClass(T.selected),e.preventDefault())),t==n.rightArrow&&m&&(S.verbose("Right key pressed, opening sub-menu"),S.animate.show(!1,u),l.removeClass(T.selected),u.find(R.item).eq(0).addClass(T.selected),e.preventDefault()),t==n.upArrow){if(a=f&&v?l.prevAll(R.item+":not("+R.unselectable+")").eq(0):K.eq(0),c.index(a)<0)return S.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();S.verbose("Up key pressed, changing active item"),l.removeClass(T.selected),a.addClass(T.selected),S.set.scrollPosition(a),e.preventDefault()}if(t==n.downArrow){if(a=f&&v?a=l.nextAll(R.item+":not("+R.unselectable+")").eq(0):K.eq(0),0===a.length)return S.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();S.verbose("Down key pressed, changing active item"),K.removeClass(T.selected),a.addClass(T.selected),S.set.scrollPosition(a),e.preventDefault()}t==n.pageUp&&(S.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(S.scrollPage("down"),e.preventDefault()),t==n.escape&&(S.verbose("Escape key pressed, closing dropdown"),S.hide())}else g&&e.preventDefault(),t==n.downArrow&&(S.verbose("Down key pressed, showing dropdown"),S.show(),e.preventDefault())}else S.is.selection()&&!S.is.search()&&S.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){S.verbose("Determining action",y.action),e.isFunction(S.action[y.action])?(S.verbose("Triggering preset action",y.action,t,n),S.action[y.action].call(this,t,n)):e.isFunction(y.action)?(S.verbose("Triggering user action",y.action,t,n),y.action.call(this,t,n)):S.error(q.action,y.action)},eventInModule:function(t,i){var a=e(t.target),o=a.closest(n.documentElement).length>0,s=a.closest(F).length>0;return i=e.isFunction(i)?i:function(){},o&&!s?(S.verbose("Triggering event",i),i(),!0):(S.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target),a=i.closest(R.siblingLabel),o=0===F.find(a).length,s=0===i.closest(N).length;return n=e.isFunction(n)?n:function(){},o&&s?(S.verbose("Triggering event",n),n(),!0):(S.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){if(n=n!==i?n:t,S.can.activate(e(this))){if(S.set.selected(n,e(this)),S.is.multiple()&&!S.is.allFiltered())return;S.hideAndClear()}},select:function(e,t){S.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,S.set.selected(n,e(this)),S.hideAndClear()},hide:function(e,t){S.set.value(t),S.hideAndClear()}},get:{id:function(){return w},defaultText:function(){return F.data(L.defaultText)},defaultValue:function(){return F.data(L.defaultValue)},placeholderText:function(){return F.data(L.placeholderText)||""},text:function(){return M.text()},query:function(){return e.trim(z.val())},searchWidth:function(e){return e*y.glyphWidth+"em"},selectionCount:function(){var t,n=S.get.values();return t=S.is.multiple()?e.isArray(n)?n.length:0:""!==S.get.value()?1:0},transition:function(e){return"auto"==y.transition?S.is.upward(e)?"slide up":"slide down":y.transition},userValues:function(){var t=S.get.values();return t?(t=e.isArray(t)?t:[t],e.grep(t,function(e){return S.get.item(e)===!1})):!1},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=z.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){var t=H.length>0?H.val():F.data(L.value);return e.isArray(t)&&1===t.length&&""===t[0]?"":t},values:function(){var e=S.get.value();return""===e?"":!S.has.selectInput()&&S.is.multiple()?"string"==typeof e?e.split(y.delimiter):"":e},remoteValues:function(){var t=S.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=S.read.remoteData(t);S.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(t,n){return n=n!==i?n:y.preserveHTML,t?(t.find(R.menu).length>0&&(S.verbose("Retreiving text of element with sub-menu"),t=t.clone(),t.find(R.menu).remove(),t.find(R.menuIcon).remove()),t.data(L.text)!==i?t.data(L.text):e.trim(n?t.html():t.text())):void 0},choiceValue:function(t,n){return n=n||S.get.choiceText(t),t?t.data(L.value)!==i?String(t.data(L.value)):"string"==typeof n?e.trim(n.toLowerCase()):String(n):!1},inputEvent:function(){var e=z[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],F.find("option").each(function(){var n=e(this),a=n.html(),o=n.attr("disabled"),s=n.attr("value")!==i?n.attr("value"):a;"auto"===y.placeholder&&""===s?t.placeholder=a:t.values.push({name:a,value:s,disabled:o})}),y.placeholder&&"auto"!==y.placeholder&&(S.debug("Setting placeholder value to",y.placeholder),t.placeholder=y.placeholder),y.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),S.debug("Retrieved and sorted values from select",t)):S.debug("Retreived values from select",t),t},activeItem:function(){return K.filter("."+T.active)},selectedItem:function(){var e=K.not(R.unselectable).filter("."+T.selected);return e.length>0?e:K.eq(0)},itemWithAdditions:function(e){var t=S.get.item(e),n=S.create.userChoice(e),i=n&&n.length>0;return i&&(t=t.length>0?t.add(n):n),t},item:function(t,n){var a,o,s=!1;return t=t!==i?t:S.get.values()!==i?S.get.values():S.get.text(),a=o?t.length>0:t!==i&&null!==t,o=S.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,a&&K.each(function(){var a=e(this),r=S.get.choiceText(a),l=S.get.choiceValue(a,r);if(null!==l&&l!==i)if(o)(-1!==e.inArray(String(l),t)||-1!==e.inArray(r,t))&&(s=s?s.add(a):a);else if(n){if(S.verbose("Ambiguous dropdown value using strict type check",a,t),l===t||r===t)return s=a,!0}else if(String(l)==String(t)||r==t)return S.verbose("Found select item by value",l,t),s=a,!0}),s}},check:{maxSelections:function(e){return y.maxSelections?(e=e!==i?e:S.get.selectionCount(),e>=y.maxSelections?(S.debug("Maximum selection count reached"),y.useLabels&&(K.addClass(T.filtered),S.add.message(A.maxSelections)),!0):(S.verbose("No longer at maximum selection count"),S.remove.message(),S.remove.filteredItem(),S.is.searchSelection()&&S.filterItems(),!1)):!0}},restore:{defaults:function(){S.clear(),S.restore.defaultText(),S.restore.defaultValue()},defaultText:function(){var e=S.get.defaultText(),t=S.get.placeholderText;e===t?(S.debug("Restoring default placeholder text",e),S.set.placeholderText(e)):(S.debug("Restoring default text",e),S.set.text(e))},defaultValue:function(){var e=S.get.defaultValue();e!==i&&(S.debug("Restoring default value",e),""!==e?(S.set.value(e),S.set.selected()):(S.remove.activeItem(),S.remove.selectedItem()))},labels:function(){y.allowAdditions&&(y.useLabels||(S.error(q.labels),y.useLabels=!0),S.debug("Restoring selected values"),S.create.userLabels()),S.check.maxSelections()},selected:function(){S.restore.values(),S.is.multiple()?(S.debug("Restoring previously selected values and labels"),S.restore.labels()):S.debug("Restoring previously selected values")},values:function(){S.set.initialLoad(),y.apiSettings?y.saveRemoteData?S.restore.remoteValues():S.clearValue():S.set.selected(),S.remove.initialLoad()},remoteValues:function(){var t=S.get.remoteValues();S.debug("Recreating selected from session data",t),t&&(S.is.single()?e.each(t,function(e,t){S.set.text(t)}):e.each(t,function(e,t){S.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void S.error(q.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){S.save.defaultText(),S.save.placeholderText(),S.save.defaultValue()},defaultValue:function(){var e=S.get.value();S.verbose("Saving default value as",e),F.data(L.defaultValue,e)},defaultText:function(){var e=S.get.text();S.verbose("Saving default text as",e),F.data(L.defaultText,e)},placeholderText:function(){var e;y.placeholder!==!1&&M.hasClass(T.placeholder)&&(e=S.get.text(),S.verbose("Saving placeholder text as",e),F.data(L.placeholderText,e))},remoteData:function(e,n){return t.Storage===i?void S.error(q.noStorage):(S.verbose("Saving remote data to session storage",n,e),void sessionStorage.setItem(n,e))}},clear:function(){S.is.multiple()?S.remove.labels():(S.remove.activeItem(),S.remove.selectedItem()),S.set.placeholderText(),S.clearValue()},clearValue:function(){S.set.value("")},scrollPage:function(e,t){var n,i,a,o=t||S.get.selectedItem(),s=o.closest(R.menu),r=s.outerHeight(),l=s.scrollTop(),c=K.eq(0).outerHeight(),u=Math.floor(r/c),d=(s.prop("scrollHeight"),"up"==e?l-c*u:l+c*u),v=K.not(R.unselectable);a="up"==e?v.index(o)-u:v.index(o)+u,n="up"==e?a>=0:a0&&(S.debug("Scrolling page",e,i),o.removeClass(T.selected),i.addClass(T.selected),s.scrollTop(d))},set:{filtered:function(){var e=S.is.multiple(),t=S.is.searchSelection(),n=e&&t,i=t?S.get.query():"",a="string"==typeof i&&i.length>0,o=S.get.searchWidth(i.length),s=""!==i;e&&a&&(S.verbose("Adjusting input width",o,y.glyphWidth),z.css("width",o)),a||n&&s?(S.verbose("Hiding placeholder text"),M.addClass(T.filtered)):(!e||n&&!s)&&(S.verbose("Showing placeholder text"),M.removeClass(T.filtered))},loading:function(){F.addClass(T.loading)},placeholderText:function(e){e=e||S.get.placeholderText(),S.debug("Setting placeholder text",e),S.set.text(e),M.addClass(T.placeholder)},tabbable:function(){S.has.search()?(S.debug("Added tabindex to searchable dropdown"),z.val("").attr("tabindex",0),N.attr("tabindex",-1)):(S.debug("Added tabindex to dropdown"),F.attr("tabindex")||(F.attr("tabindex",0),N.attr("tabindex",-1)))},initialLoad:function(){S.verbose("Setting initial load"),g=!0},activeItem:function(e){e.addClass(y.allowAdditions&&e.filter(R.addition).length>0?T.filtered:T.active)},scrollPosition:function(e,t){var n,a,o,s,r,l,c,u,d,v=5;e=e||S.get.selectedItem(),n=e.closest(R.menu),a=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&a&&(s=e.position().top,n.addClass(T.loading),l=n.scrollTop(),r=n.offset().top,s=e.offset().top,o=l-r+s,t||(c=n.height(),d=o+v>l+c,u=l>o-v),S.debug("Scrolling to active item",o),(t||u||d)&&n.scrollTop(o),n.removeClass(T.loading))},text:function(e){"select"!==y.action&&("combo"==y.action?(S.debug("Changing combo button text",e,U),y.preserveHTML?U.html(e):U.text(e)):(e!==S.get.placeholderText()&&M.removeClass(T.placeholder),S.debug("Changing text",e,M),M.removeClass(T.filtered),y.preserveHTML?M.html(e):M.text(e)))},selectedLetter:function(t){var n,i=K.filter("."+T.selected),a=i.length>0&&S.has.firstLetter(i,t),o=!1;a&&(n=i.nextAll(K).eq(0),S.has.firstLetter(n,t)&&(o=n)),o||K.each(function(){return S.has.firstLetter(e(this),t)?(o=e(this),!1):void 0}),o&&(S.verbose("Scrolling to next value with letter",t),S.set.scrollPosition(o),i.removeClass(T.selected),o.addClass(T.selected))},direction:function(e){"auto"==y.direction?S.is.onScreen(e)?S.remove.upward(e):S.set.upward(e):"upward"==y.direction&&S.set.upward(e)},upward:function(e){var t=e||F;t.addClass(T.upward)},value:function(e,t,n){var a=H.length>0,o=(!S.has.value(e),S.get.values()),s=e!==i?String(e):e;if(a){if(s==o&&(S.verbose("Skipping value update already same value",e,o),!S.is.initialLoad()))return;S.is.single()&&S.has.selectInput()&&S.can.extendSelect()&&(S.debug("Adding user option",e),S.add.optionValue(e)),S.debug("Updating input value",e,o),$=!0,H.val(e),y.fireOnInit===!1&&S.is.initialLoad()?S.debug("Input native change event ignored on initial load"):H.trigger("change"),$=!1}else S.verbose("Storing value in metadata",e,H),e!==o&&F.data(L.value,s);y.fireOnInit===!1&&S.is.initialLoad()?S.verbose("No callback on initial load",y.onChange):y.onChange.call(Q,e,t,n)},active:function(){F.addClass(T.active)},multiple:function(){F.addClass(T.multiple)},visible:function(){F.addClass(T.visible)},exactly:function(e,t){S.debug("Setting selected to exact values"),S.clear(),S.set.selected(e,t)},selected:function(t,n){var i=S.is.multiple();n=y.allowAdditions?n||S.get.itemWithAdditions(t):n||S.get.item(t),n&&(S.debug("Setting selected menu item to",n),S.is.single()?(S.remove.activeItem(),S.remove.selectedItem()):y.useLabels&&S.remove.selectedItem(),n.each(function(){var t=e(this),a=S.get.choiceText(t),o=S.get.choiceValue(t,a),s=t.hasClass(T.filtered),r=t.hasClass(T.active),l=t.hasClass(T.addition),c=i&&1==n.length;i?!r||l?(y.apiSettings&&y.saveRemoteData&&S.save.remoteData(a,o),y.useLabels?(S.add.value(o,a,t),S.add.label(o,a,c),S.set.activeItem(t),S.filterActive(),S.select.nextAvailable(n)):(S.add.value(o,a,t),S.set.text(S.add.variables(A.count)),S.set.activeItem(t))):s||(S.debug("Selected active value, removing label"),S.remove.selected(o)):(y.apiSettings&&y.saveRemoteData&&S.save.remoteData(a,o),S.set.text(a),S.set.value(o,a,t),t.addClass(T.active).addClass(T.selected))}))}},add:{label:function(t,n,i){var a,o=S.is.searchSelection()?z:M;return a=e("").addClass(T.label).attr("data-value",t).html(V.label(t,n)),a=y.onLabelCreate.call(a,t,n),S.has.label(t)?void S.debug("Label already exists, skipping",t):(y.label.variation&&a.addClass(y.label.variation),void(i===!0?(S.debug("Animating in label",a),a.addClass(T.hidden).insertBefore(o).transition(y.label.transition,y.label.duration)):(S.debug("Adding selection label",a),a.insertBefore(o))))},message:function(t){var n=N.children(R.message),i=y.templates.message(S.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(T.message).appendTo(N)},optionValue:function(t){var n=H.find('option[value="'+t+'"]'),i=n.length>0;i||(x&&(x.disconnect(),S.verbose("Temporarily disconnecting mutation observer",t)),S.is.single()&&(S.verbose("Removing previous user addition"),H.find("option."+T.addition).remove()),e("
").addClass("ui basic red pointing prompt label").html(t[0])}},rules:{empty:function(t){return!(t===i||""===t||e.isArray(t)&&0===t.length)},checked:function(){return e(this).filter(":checked").length>0},email:function(t){var n=new RegExp(e.fn.form.settings.regExp.email,"i");return n.test(t)},url:function(t){return e.fn.form.settings.regExp.url.test(t)},regExp:function(t,n){var i,o=n.match(e.fn.form.settings.regExp.flags);return o&&(n=o.length>=2?o[1]:n,i=o.length>=3?o[2]:""),t.match(new RegExp(n,i))},integer:function(t,n){var o,a,r,s=e.fn.form.settings.regExp.integer;return n===i||""===n||".."===n||(-1==n.indexOf("..")?s.test(n)&&(o=a=n-0):(r=n.split("..",2),s.test(r[0])&&(o=r[0]-0),s.test(r[1])&&(a=r[1]-0))),s.test(t)&&(o===i||t>=o)&&(a===i||a>=t)},decimal:function(t){return e.fn.form.settings.regExp.decimal.test(t)},number:function(t){return e.fn.form.settings.regExp.number.test(t)},is:function(e,t){return t="string"==typeof t?t.toLowerCase():t,e="string"==typeof e?e.toLowerCase():e,e==t},isExactly:function(e,t){return e==t},not:function(e,t){return e="string"==typeof e?e.toLowerCase():e,t="string"==typeof t?t.toLowerCase():t,e!=t},notExactly:function(e,t){return e!=t},contains:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1!==t.search(new RegExp(n,"i"))},containsExactly:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1!==t.search(new RegExp(n))},doesntContain:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1===t.search(new RegExp(n,"i"))},doesntContainExactly:function(t,n){return n=n.replace(e.fn.form.settings.regExp.escape,"\\$&"),-1===t.search(new RegExp(n))},minLength:function(e,t){return e!==i?e.length>=t:!1},length:function(e,t){return e!==i?e.length>=t:!1},exactLength:function(e,t){return e!==i?e.length==t:!1},maxLength:function(e,t){return e!==i?e.length<=t:!1},match:function(t,n){{var o;e(this)}return e('[data-validate="'+n+'"]').length>0?o=e('[data-validate="'+n+'"]').val():e("#"+n).length>0?o=e("#"+n).val():e('[name="'+n+'"]').length>0?o=e('[name="'+n+'"]').val():e('[name="'+n+'[]"]').length>0&&(o=e('[name="'+n+'[]"]')),o!==i?t.toString()==o.toString():!1},different:function(t,n){{var o;e(this)}return e('[data-validate="'+n+'"]').length>0?o=e('[data-validate="'+n+'"]').val():e("#"+n).length>0?o=e("#"+n).val():e('[name="'+n+'"]').length>0?o=e('[name="'+n+'"]').val():e('[name="'+n+'[]"]').length>0&&(o=e('[name="'+n+'[]"]')),o!==i?t.toString()!==o.toString():!1},creditCard:function(t,n){var i,o,a={visa:{pattern:/^4/,length:[16]},amex:{pattern:/^3[47]/,length:[15]},mastercard:{pattern:/^5[1-5]/,length:[16]},discover:{pattern:/^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,length:[16]},unionPay:{pattern:/^(62|88)/,length:[16,17,18,19]},jcb:{pattern:/^35(2[89]|[3-8][0-9])/,length:[16]},maestro:{pattern:/^(5018|5020|5038|6304|6759|676[1-3])/,length:[12,13,14,15,16,17,18,19]},dinersClub:{pattern:/^(30[0-5]|^36)/,length:[14]},laser:{pattern:/^(6304|670[69]|6771)/,length:[16,17,18,19]},visaElectron:{pattern:/^(4026|417500|4508|4844|491(3|7))/,length:[16]}},r={},s=!1,c="string"==typeof n?n.split(","):!1;if("string"==typeof t&&0!==t.length){if(c&&(e.each(c,function(n,i){o=a[i],o&&(r={length:-1!==e.inArray(t.length,o.length),pattern:-1!==t.search(o.pattern)},r.length&&r.pattern&&(s=!0))}),!s))return!1;if(i={number:-1!==e.inArray(t.length,a.unionPay.length),pattern:-1!==t.search(a.unionPay.pattern)},i.number&&i.pattern)return!0;for(var l=t.length,u=0,d=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],m=0;l--;)m+=d[u][parseInt(t.charAt(l),10)],u^=1;return m%10===0&&m>0}},minCount:function(e,t){return 0==t?!0:1==t?""!==e:e.split(",").length>=t},exactCount:function(e,t){return 0==t?""===e:1==t?""!==e&&-1===e.search(","):e.split(",").length==t},maxCount:function(e,t){return 0==t?!1:1==t?-1===e.search(","):e.split(",").length<=t}}}}(jQuery,window,document),function(e,t,n,i){"use strict";e.fn.accordion=function(n){{var o,a=e(this),r=(new Date).getTime(),s=[],c=arguments[0],l="string"==typeof c,u=[].slice.call(arguments,1);t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)}}return a.each(function(){var d,m,f=e.isPlainObject(n)?e.extend(!0,{},e.fn.accordion.settings,n):e.extend({},e.fn.accordion.settings),g=f.className,p=f.namespace,v=f.selector,h=f.error,b="."+p,y="module-"+p,x=a.selector||"",C=e(this),w=C.find(v.title),k=C.find(v.content),S=this,T=C.data(y);m={initialize:function(){m.debug("Initializing",C),m.bind.events(),f.observeChanges&&m.observeChanges(),m.instantiate()},instantiate:function(){T=m,C.data(y,m)},destroy:function(){m.debug("Destroying previous instance",C),C.off(b).removeData(y)},refresh:function(){w=C.find(v.title),k=C.find(v.content)},observeChanges:function(){"MutationObserver"in t&&(d=new MutationObserver(function(e){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),d.observe(S,{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",d))},bind:{events:function(){m.debug("Binding delegated events"),C.on(f.on+b,v.trigger,m.event.click)}},event:{click:function(){m.toggle.call(this)}},toggle:function(t){var n=t!==i?"number"==typeof t?w.eq(t):e(t).closest(v.title):e(this).closest(v.title),o=n.next(k),a=o.hasClass(g.animating),r=o.hasClass(g.active),s=r&&!a,c=!r&&a;m.debug("Toggling visibility of content",n),s||c?f.collapsible?m.close.call(n):m.debug("Cannot close accordion content collapsing is disabled"):m.open.call(n)},open:function(t){var n=t!==i?"number"==typeof t?w.eq(t):e(t).closest(v.title):e(this).closest(v.title),o=n.next(k),a=o.hasClass(g.animating),r=o.hasClass(g.active),s=r||a;return s?void m.debug("Accordion already open, skipping",o):(m.debug("Opening accordion content",n),f.onOpening.call(o),f.exclusive&&m.closeOthers.call(n),n.addClass(g.active),o.stop(!0,!0).addClass(g.animating),f.animateChildren&&(e.fn.transition!==i&&C.transition("is supported")?o.children().transition({animation:"fade in",queue:!1,useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):o.children().stop(!0,!0).animate({opacity:1},f.duration,m.resetOpacity)),void o.slideDown(f.duration,f.easing,function(){o.removeClass(g.animating).addClass(g.active),m.reset.display.call(this),f.onOpen.call(this),f.onChange.call(this)}))},close:function(t){var n=t!==i?"number"==typeof t?w.eq(t):e(t).closest(v.title):e(this).closest(v.title),o=n.next(k),a=o.hasClass(g.animating),r=o.hasClass(g.active),s=!r&&a,c=r&&a;!r&&!s||c||(m.debug("Closing accordion content",o),f.onClosing.call(o),n.removeClass(g.active),o.stop(!0,!0).addClass(g.animating),f.animateChildren&&(e.fn.transition!==i&&C.transition("is supported")?o.children().transition({animation:"fade out",queue:!1,useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):o.children().stop(!0,!0).animate({opacity:0},f.duration,m.resetOpacity)),o.slideUp(f.duration,f.easing,function(){o.removeClass(g.animating).removeClass(g.active),m.reset.display.call(this),f.onClose.call(this),f.onChange.call(this)}))},closeOthers:function(t){var n,o,a,r=t!==i?w.eq(t):e(this).closest(v.title),s=r.parents(v.content).prev(v.title),c=r.closest(v.accordion),l=v.title+"."+g.active+":visible",u=v.content+"."+g.active+":visible";f.closeNested?(n=c.find(l).not(s),a=n.next(k)):(n=c.find(l).not(s),o=c.find(u).find(l).not(s),n=n.not(o),a=n.next(k)),n.length>0&&(m.debug("Exclusive enabled, closing other content",n),n.removeClass(g.active),a.removeClass(g.animating).stop(!0,!0),f.animateChildren&&(e.fn.transition!==i&&C.transition("is supported")?a.children().transition({animation:"fade out",useFailSafe:!0,debug:f.debug,verbose:f.verbose,duration:f.duration}):a.children().stop(!0,!0).animate({opacity:0},f.duration,m.resetOpacity)),a.slideUp(f.duration,f.easing,function(){e(this).removeClass(g.active),m.reset.display.call(this)}))},reset:{display:function(){m.verbose("Removing inline display from element",this),e(this).css("display",""),""===e(this).attr("style")&&e(this).attr("style","").removeAttr("style")},opacity:function(){m.verbose("Removing inline opacity from element",this),e(this).css("opacity",""),""===e(this).attr("style")&&e(this).attr("style","").removeAttr("style")}},setting:function(t,n){if(m.debug("Changing setting",t,n),e.isPlainObject(t))e.extend(!0,f,t);else{if(n===i)return f[t];f[t]=n}},internal:function(t,n){return m.debug("Changing internal",t,n),n===i?m[t]:void(e.isPlainObject(t)?e.extend(!0,m,t):m[t]=n)},debug:function(){f.debug&&(f.performance?m.performance.log(arguments):(m.debug=Function.prototype.bind.call(console.info,console,f.name+":"),m.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?m.performance.log(arguments):(m.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),m.verbose.apply(console,arguments)))},error:function(){m.error=Function.prototype.bind.call(console.error,console,f.name+":"),m.error.apply(console,arguments)},performance:{log:function(e){var t,n,i;f.performance&&(t=(new Date).getTime(),i=r||t,n=t-i,r=t,s.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:S,"Execution Time":n})),clearTimeout(m.performance.timer),m.performance.timer=setTimeout(m.performance.display,500)},display:function(){var t=f.name+":",n=0;r=!1,clearTimeout(m.performance.timer),e.each(s,function(e,t){n+=t["Execution Time"]}),t+=" "+n+"ms",x&&(t+=" '"+x+"'"),(console.group!==i||console.table!==i)&&s.length>0&&(console.groupCollapsed(t),console.table?console.table(s):e.each(s,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(t,n,a){var r,s,c,l=T;return n=n||u,a=S||a,"string"==typeof t&&l!==i&&(t=t.split(/[\. ]/),r=t.length-1,e.each(t,function(n,o){var a=n!=r?o+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(e.isPlainObject(l[a])&&n!=r)l=l[a];else{if(l[a]!==i)return s=l[a],!1;if(!e.isPlainObject(l[o])||n==r)return l[o]!==i?(s=l[o],!1):(m.error(h.method,t),!1);l=l[o]}})),e.isFunction(s)?c=s.apply(a,n):s!==i&&(c=s),e.isArray(o)?o.push(c):o!==i?o=[o,c]:c!==i&&(o=c),s}},l?(T===i&&m.initialize(),m.invoke(c)):(T!==i&&T.invoke("destroy"),m.initialize())}),o!==i?o:this},e.fn.accordion.settings={name:"Accordion",namespace:"accordion",debug:!1,verbose:!1,performance:!0,on:"click",observeChanges:!0,exclusive:!0,collapsible:!0,closeNested:!1,animateChildren:!0,duration:350,easing:"easeOutQuad",onOpening:function(){},onOpen:function(){},onClosing:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",animating:"animating"},selector:{accordion:".accordion",title:".title",trigger:".title",content:".content"}},e.extend(e.easing,{easeOutQuad:function(e,t,n,i,o){return-i*(t/=o)*(t-2)+n}})}(jQuery,window,document),function(e,t,n,i){"use strict";e.fn.checkbox=function(n){var o,a=e(this),r=a.selector||"",s=(new Date).getTime(),c=[],l=arguments[0],u="string"==typeof l,d=[].slice.call(arguments,1);return a.each(function(){var a,m,f=e.extend(!0,{},e.fn.checkbox.settings,n),g=f.className,p=f.namespace,v=f.selector,h=f.error,b="."+p,y="module-"+p,x=e(this),C=e(this).children(v.label),w=e(this).children(v.input),k=w[0],S=!1,T=!1,A=x.data(y),R=this; m={initialize:function(){m.verbose("Initializing checkbox",f),m.create.label(),m.bind.events(),m.set.tabbable(),m.hide.input(),m.observeChanges(),m.instantiate(),m.setup()},instantiate:function(){m.verbose("Storing instance of module",m),A=m,x.data(y,m)},destroy:function(){m.verbose("Destroying module"),m.unbind.events(),m.show.input(),x.removeData(y)},fix:{reference:function(){x.is(v.input)&&(m.debug("Behavior called on adjusting invoked element"),x=x.closest(v.checkbox),m.refresh())}},setup:function(){m.set.initialLoad(),m.is.indeterminate()?(m.debug("Initial value is indeterminate"),m.indeterminate()):m.is.checked()?(m.debug("Initial value is checked"),m.check()):(m.debug("Initial value is unchecked"),m.uncheck()),m.remove.initialLoad()},refresh:function(){C=x.children(v.label),w=x.children(v.input),k=w[0]},hide:{input:function(){m.verbose("Modfying z-index to be unselectable"),w.addClass(g.hidden)}},show:{input:function(){m.verbose("Modfying z-index to be selectable"),w.removeClass(g.hidden)}},observeChanges:function(){"MutationObserver"in t&&(a=new MutationObserver(function(e){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),a.observe(R,{childList:!0,subtree:!0}),m.debug("Setting up mutation observer",a))},attachEvents:function(t,n){var i=e(t);n=e.isFunction(m[n])?m[n]:m.toggle,i.length>0?(m.debug("Attaching checkbox events to element",t,n),i.on("click"+b,n)):m.error(h.notFound)},event:{click:function(t){var n=e(t.target);return n.is(v.input)?void m.verbose("Using default check action on initialized checkbox"):n.is(v.link)?void m.debug("Clicking link inside checkbox, skipping toggle"):(m.toggle(),w.focus(),void t.preventDefault())},keydown:function(e){var t=e.which,n={enter:13,space:32,escape:27};t==n.escape?(m.verbose("Escape key pressed blurring field"),w.blur(),T=!0):e.ctrlKey||t!=n.space&&t!=n.enter?T=!1:(m.verbose("Enter/space key pressed, toggling checkbox"),m.toggle(),T=!0)},keyup:function(e){T&&e.preventDefault()}},check:function(){m.should.allowCheck()&&(m.debug("Checking checkbox",w),m.set.checked(),m.should.ignoreCallbacks()||(f.onChecked.call(k),f.onChange.call(k)))},uncheck:function(){m.should.allowUncheck()&&(m.debug("Unchecking checkbox"),m.set.unchecked(),m.should.ignoreCallbacks()||(f.onUnchecked.call(k),f.onChange.call(k)))},indeterminate:function(){return m.should.allowIndeterminate()?void m.debug("Checkbox is already indeterminate"):(m.debug("Making checkbox indeterminate"),m.set.indeterminate(),void(m.should.ignoreCallbacks()||(f.onIndeterminate.call(k),f.onChange.call(k))))},determinate:function(){return m.should.allowDeterminate()?void m.debug("Checkbox is already determinate"):(m.debug("Making checkbox determinate"),m.set.determinate(),void(m.should.ignoreCallbacks()||(f.onDeterminate.call(k),f.onChange.call(k))))},enable:function(){return m.is.enabled()?void m.debug("Checkbox is already enabled"):(m.debug("Enabling checkbox"),m.set.enabled(),void f.onEnable.call(k))},disable:function(){return m.is.disabled()?void m.debug("Checkbox is already disabled"):(m.debug("Disabling checkbox"),m.set.disabled(),void f.onDisable.call(k))},get:{radios:function(){var t=m.get.name();return e('input[name="'+t+'"]').closest(v.checkbox)},otherRadios:function(){return m.get.radios().not(x)},name:function(){return w.attr("name")}},is:{initialLoad:function(){return S},radio:function(){return w.hasClass(g.radio)||"radio"==w.attr("type")},indeterminate:function(){return w.prop("indeterminate")!==i&&w.prop("indeterminate")},checked:function(){return w.prop("checked")!==i&&w.prop("checked")},disabled:function(){return w.prop("disabled")!==i&&w.prop("disabled")},enabled:function(){return!m.is.disabled()},determinate:function(){return!m.is.indeterminate()},unchecked:function(){return!m.is.checked()}},should:{allowCheck:function(){return m.is.determinate()&&m.is.checked()&&!m.should.forceCallbacks()?(m.debug("Should not allow check, checkbox is already checked"),!1):f.beforeChecked.apply(k)===!1?(m.debug("Should not allow check, beforeChecked cancelled"),!1):!0},allowUncheck:function(){return m.is.determinate()&&m.is.unchecked()&&!m.should.forceCallbacks()?(m.debug("Should not allow uncheck, checkbox is already unchecked"),!1):f.beforeUnchecked.apply(k)===!1?(m.debug("Should not allow uncheck, beforeUnchecked cancelled"),!1):!0},allowIndeterminate:function(){return m.is.indeterminate()&&!m.should.forceCallbacks()?(m.debug("Should not allow indeterminate, checkbox is already indeterminate"),!1):f.beforeIndeterminate.apply(k)===!1?(m.debug("Should not allow indeterminate, beforeIndeterminate cancelled"),!1):!0},allowDeterminate:function(){return m.is.determinate()&&!m.should.forceCallbacks()?(m.debug("Should not allow determinate, checkbox is already determinate"),!1):f.beforeDeterminate.apply(k)===!1?(m.debug("Should not allow determinate, beforeDeterminate cancelled"),!1):!0},forceCallbacks:function(){return m.is.initialLoad()&&f.fireOnInit},ignoreCallbacks:function(){return S&&!f.fireOnInit}},can:{change:function(){return!(x.hasClass(g.disabled)||x.hasClass(g.readOnly)||w.prop("disabled")||w.prop("readonly"))},uncheck:function(){return"boolean"==typeof f.uncheckable?f.uncheckable:!m.is.radio()}},set:{initialLoad:function(){S=!0},checked:function(){return m.verbose("Setting class to checked"),x.removeClass(g.indeterminate).addClass(g.checked),m.is.radio()&&m.uncheckOthers(),!m.is.indeterminate()&&m.is.checked()?void m.debug("Input is already checked, skipping input property change"):(m.verbose("Setting state to checked",k),w.prop("indeterminate",!1).prop("checked",!0),void m.trigger.change())},unchecked:function(){return m.verbose("Removing checked class"),x.removeClass(g.indeterminate).removeClass(g.checked),!m.is.indeterminate()&&m.is.unchecked()?void m.debug("Input is already unchecked"):(m.debug("Setting state to unchecked"),w.prop("indeterminate",!1).prop("checked",!1),void m.trigger.change())},indeterminate:function(){return m.verbose("Setting class to indeterminate"),x.addClass(g.indeterminate),m.is.indeterminate()?void m.debug("Input is already indeterminate, skipping input property change"):(m.debug("Setting state to indeterminate"),w.prop("indeterminate",!0),void m.trigger.change())},determinate:function(){return m.verbose("Removing indeterminate class"),x.removeClass(g.indeterminate),m.is.determinate()?void m.debug("Input is already determinate, skipping input property change"):(m.debug("Setting state to determinate"),void w.prop("indeterminate",!1))},disabled:function(){return m.verbose("Setting class to disabled"),x.addClass(g.disabled),m.is.disabled()?void m.debug("Input is already disabled, skipping input property change"):(m.debug("Setting state to disabled"),w.prop("disabled","disabled"),void m.trigger.change())},enabled:function(){return m.verbose("Removing disabled class"),x.removeClass(g.disabled),m.is.enabled()?void m.debug("Input is already enabled, skipping input property change"):(m.debug("Setting state to enabled"),w.prop("disabled",!1),void m.trigger.change())},tabbable:function(){m.verbose("Adding tabindex to checkbox"),w.attr("tabindex")===i&&w.attr("tabindex",0)}},remove:{initialLoad:function(){S=!1}},trigger:{change:function(){m.verbose("Triggering change event from programmatic change"),w.trigger("change")}},create:{label:function(){w.prevAll(v.label).length>0?(w.prev(v.label).detach().insertAfter(w),m.debug("Moving existing label",C)):m.has.label()||(C=e("
").attr("class","ui dimmer")}}}}(jQuery,window,document),function(e,t,n,i){"use strict";e.fn.dropdown=function(o){var a,r=e(this),s=e(n),c=r.selector||"",l="ontouchstart"in n.documentElement,u=(new Date).getTime(),d=[],m=arguments[0],f="string"==typeof m,g=[].slice.call(arguments,1);return r.each(function(p){var v,h,b,y,x,C,w,k=e.isPlainObject(o)?e.extend(!0,{},e.fn.dropdown.settings,o):e.extend({},e.fn.dropdown.settings),S=k.className,T=k.message,A=k.fields,R=k.metadata,P=k.namespace,E=k.regExp,F=k.selector,D=k.error,O=k.templates,q="."+P,j="module-"+P,z=e(this),I=e(k.context),L=z.find(F.text),N=z.find(F.search),V=z.find(F.input),H=z.find(F.icon),M=z.prev().find(F.text).length>0?z.prev().find(F.text):z.prev(),U=z.children(F.menu),W=U.find(F.item),B=!1,Q=!1,X=!1,$=this,Y=z.data(j);w={initialize:function(){w.debug("Initializing dropdown",k),w.is.alreadySetup()?w.setup.reference():(w.setup.layout(),w.refreshData(),w.save.defaults(),w.restore.selected(),w.create.id(),w.bind.events(),w.observeChanges(),w.instantiate())},instantiate:function(){w.verbose("Storing instance of dropdown",w),Y=w,z.data(j,w)},destroy:function(){w.verbose("Destroying previous dropdown",z),w.remove.tabbable(),z.off(q).removeData(j),U.off(q),s.off(b),x&&x.disconnect(),C&&C.disconnect()},observeChanges:function(){"MutationObserver"in t&&(x=new MutationObserver(function(e){w.debug("").addClass(S.search).insertBefore(L)),k.allowTab&&w.set.tabbable()},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t),z.is("select")&&(V=z),V.parent(F.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),z=V.closest(F.dropdown),w.has.menu()||w.create.menu(),U=z.children(F.menu),w.setup.menu(t)):(w.debug("Creating entire dropdown from select"),z=e("
").attr("class",V.attr("class")).addClass(S.selection).addClass(S.dropdown).html(O.dropdown(t)).insertBefore(V),V.hasClass(S.multiple)&&V.prop("multiple")===!1&&(w.error(D.missingMultiple),V.prop("multiple",!0)),V.is("[multiple]")&&w.set.multiple(),V.prop("disabled")&&(w.debug("Disabling dropdown"),z.addClass(S.disabled)),V.removeAttr("class").detach().prependTo(z)),w.refresh()},menu:function(e){U.html(O.menu(e,A)),W=U.find(F.item)},reference:function(){w.debug("Dropdown behavior was called on select, replacing with closest dropdown"),z=z.parent(F.dropdown),w.refresh(),w.setup.returnedObject(),f&&(Y=w,w.invoke(m))},returnedObject:function(){var e=r.slice(0,p),t=r.slice(p+1);r=e.add(z).add(t)}},refresh:function(){w.refreshSelectors(),w.refreshData()},refreshSelectors:function(){w.verbose("Refreshing selector cache"),L=z.find(F.text),N=z.find(F.search),V=z.find(F.input),H=z.find(F.icon),M=z.prev().find(F.text).length>0?z.prev().find(F.text):z.prev(),U=z.children(F.menu),W=U.find(F.item)},refreshData:function(){w.verbose("Refreshing cached metadata"),W.removeData(R.text).removeData(R.value),z.removeData(R.defaultText).removeData(R.defaultValue).removeData(R.placeholderText)},toggle:function(){w.verbose("Toggling menu visibility"),w.is.active()?w.hide():w.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},w.can.show()&&!w.is.active()){if(w.debug("Showing dropdown"),w.is.multiple()&&!w.has.search()&&w.is.allFiltered())return!0;w.has.message()&&!w.has.maxSelections()&&w.remove.message(),k.onShow.call($)!==!1&&w.animate.show(function(){w.can.click()&&w.bind.intent(),w.set.visible(),t.call($)})}},hide:function(t){t=e.isFunction(t)?t:function(){},w.is.active()&&(w.debug("Hiding dropdown"),k.onHide.call($)!==!1&&w.animate.hide(function(){w.remove.visible(),t.call($)}))},hideOthers:function(){w.verbose("Finding other dropdowns to hide"),r.not(z).has(F.menu+"."+S.visible).dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu instantaneously"),w.remove.active(),w.remove.visible(),U.transition("hide")},hideSubMenus:function(){var e=U.children(F.item).find(F.menu);w.verbose("Hiding sub menus",e),e.transition("hide")},bind:{events:function(){l&&w.bind.touchEvents(),w.bind.keyboardEvents(),w.bind.inputEvents(),w.bind.mouseEvents()},touchEvents:function(){w.debug("Touch device detected binding additional touch events"),w.is.searchSelection()||w.is.single()&&z.on("touchstart"+q,w.event.test.toggle),U.on("touchstart"+q,F.item,w.event.item.mouseenter)},keyboardEvents:function(){w.verbose("Binding keyboard events"),z.on("keydown"+q,w.event.keydown),w.has.search()&&z.on(w.get.inputEvent()+q,F.search,w.event.input),w.is.multiple()&&s.on("keydown"+b,w.event.document.keydown)},inputEvents:function(){w.verbose("Binding input change events"),z.on("change"+q,F.input,w.event.change)},mouseEvents:function(){w.verbose("Binding mouse events"),w.is.multiple()&&z.on("click"+q,F.label,w.event.label.click).on("click"+q,F.remove,w.event.remove.click),w.is.searchSelection()?(z.on("mousedown"+q,F.menu,w.event.menu.mousedown).on("mouseup"+q,F.menu,w.event.menu.mouseup).on("click"+q,F.icon,w.event.icon.click).on("click"+q,F.search,w.show).on("focus"+q,F.search,w.event.search.focus).on("blur"+q,F.search,w.event.search.blur).on("click"+q,F.text,w.event.text.focus),w.is.multiple()&&z.on("click"+q,w.event.click)):("click"==k.on?z.on("click"+q,F.icon,w.event.icon.click).on("click"+q,w.event.test.toggle):"hover"==k.on?z.on("mouseenter"+q,w.delay.show).on("mouseleave"+q,w.delay.hide):z.on(k.on+q,w.toggle),z.on("mousedown"+q,w.event.mousedown).on("mouseup"+q,w.event.mouseup).on("focus"+q,w.event.focus).on("blur"+q,w.event.blur)),U.on("mouseenter"+q,F.item,w.event.item.mouseenter).on("mouseleave"+q,F.item,w.event.item.mouseleave).on("click"+q,F.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document"),l&&s.on("touchstart"+b,w.event.test.touch).on("touchmove"+b,w.event.test.touch),s.on("click"+b,w.event.test.hide)}},unbind:{intent:function(){w.verbose("Removing hide intent event from document"),l&&s.off("touchstart"+b).off("touchmove"+b),s.off("click"+b)}},filter:function(e){var t=e!==i?e:w.get.query(),n=function(){w.is.multiple()&&w.filterActive(),w.select.firstUnfiltered(),w.has.allResultsFiltered()?k.onNoResults.call($,t)?k.allowAdditions||(w.verbose("All items filtered, showing message",t),w.add.message(T.noResults)):(w.verbose("All items filtered, hiding dropdown",t),w.hideMenu()):w.remove.message(),k.allowAdditions&&w.add.userSuggestion(e),w.is.searchSelection()&&w.can.show()&&w.is.focusedOnSearch()&&w.show()};k.useLabels&&w.has.maxSelections()||(k.apiSettings?w.can.useAPI()?w.queryRemote(t,function(){n()}):w.error(D.noAPI):(w.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:k.throttle,urlData:{query:t},onError:function(){w.add.message(T.serverError),n()},onFailure:function(){w.add.message(T.serverError),n()},onSuccess:function(e){w.remove.message(),w.setup.menu({values:e.results}),n()}};z.api("get request")||w.setup.api(),i=e.extend(!0,{},i,k.apiSettings),z.api("setting",i).api("query")},filterItems:function(t){var n=t!==i?t:w.get.query(),o=e(),a=w.escape.regExp(n),r=new RegExp("^"+a,"igm");w.has.query()?(w.verbose("Searching for matching values",n),W.each(function(){var t,i,a=e(this);if("both"==k.match||"text"==k.match){if(t=String(w.get.choiceText(a,!1)),-1!==t.search(r))return o=o.add(a),!0;if(k.fullTextSearch&&w.fuzzySearch(n,t))return o=o.add(a),!0}if("both"==k.match||"value"==k.match){if(i=String(w.get.choiceValue(a,t)),-1!==i.search(r))return o=o.add(a),!0;if(k.fullTextSearch&&w.fuzzySearch(n,i))return o=o.add(a),!0}})):o=W,w.debug("Showing only matched items",n),w.remove.filteredItem(),W.not(o).addClass(S.filtered)},fuzzySearch:function(e,t){var n=t.length,i=e.length;if(e=e.toLowerCase(),t=t.toLowerCase(),i>n)return!1;if(i===n)return e===t;e:for(var o=0,a=0;i>o;o++){for(var r=e.charCodeAt(o);n>a;)if(t.charCodeAt(a++)===r)continue e;return!1}return!0},filterActive:function(){k.useLabels&&W.filter("."+S.active).addClass(S.filtered)},focusSearch:function(){w.is.search()&&!w.is.focusedOnSearch()&&N[0].focus()},forceSelection:function(){var e=W.not(S.filtered).filter("."+S.selected).eq(0),t=W.not(S.filtered).filter("."+S.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i&&w.has.query()?(w.debug("Forcing partial selection to selected item",n),w.event.item.click.call(n)):w.hide()},event:{change:function(){X||(w.debug("Input changed, updating selection"),w.set.selected())},focus:function(){k.showOnFocus&&!B&&w.is.hidden()&&!h&&w.show()},click:function(t){var n=e(t.target);n.is(z)&&!w.is.focusedOnSearch()&&w.focusSearch()},blur:function(e){h=n.activeElement===this,B||h||(w.remove.activeLabel(),w.hide())},mousedown:function(){B=!0},mouseup:function(){B=!1},search:{focus:function(){B=!0,w.is.multiple()&&w.remove.activeLabel(),k.showOnFocus&&w.show()},blur:function(e){h=n.activeElement===this,Q||h?h&&k.forceSelection&&w.forceSelection():w.is.multiple()?(w.remove.activeLabel(),w.hide()):k.forceSelection?w.forceSelection():w.hide()}},icon:{click:function(e){w.toggle(),e.stopPropagation()}},text:{focus:function(e){B=!0,w.focusSearch()}},input:function(e){(w.is.multiple()||w.is.searchSelection())&&w.set.filtered(),clearTimeout(w.timer),w.timer=setTimeout(w.search,k.delay.search)},label:{click:function(t){var n=e(this),i=z.find(F.label),o=i.filter("."+S.active),a=n.nextAll("."+S.active),r=n.prevAll("."+S.active),s=a.length>0?n.nextUntil(a).add(o).add(n):n.prevUntil(r).add(o).add(n);t.shiftKey?(o.removeClass(S.active),s.addClass(S.active)):t.ctrlKey?n.toggleClass(S.active):(o.removeClass(S.active),n.addClass(S.active)),k.onLabelSelect.apply(this,i.filter("."+S.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(S.active)?w.remove.activeLabels():w.remove.activeLabels(t)}},test:{toggle:function(e){var t=w.is.multiple()?w.show:w.toggle;w.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){w.determine.eventOnElement(e,function(){"touchstart"==e.type?w.timer=setTimeout(function(){w.hide()},k.delay.touch):"touchmove"==e.type&&clearTimeout(w.timer)}),e.stopPropagation()},hide:function(e){w.determine.eventInModule(e,w.hide)}},menu:{mousedown:function(){Q=!0},mouseup:function(){Q=!1}},item:{mouseenter:function(t){var n=e(this).children(F.menu),i=e(this).siblings(F.item).children(F.menu);n.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Showing sub-menu",n),e.each(i,function(){w.animate.hide(!1,e(this))}),w.animate.show(!1,n)},k.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(F.menu);n.length>0&&(clearTimeout(w.itemTimer),w.itemTimer=setTimeout(function(){w.verbose("Hiding sub-menu",n),w.animate.hide(!1,n)},k.delay.hide))},touchend:function(){},click:function(t){var n=e(this),i=e(t?t.target:""),o=n.find(F.menu),a=w.get.choiceText(n),r=w.get.choiceValue(n,a),s=o.length>0,c=o.find(i).length>0;c||s&&!k.allowCategorySelection||(k.useLabels||(w.remove.filteredItem(),w.remove.searchTerm(),w.set.scrollPosition(n)),w.determine.selectAction.call(this,a,r))}},document:{keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o=z.find(F.label),a=o.filter("."+S.active),r=(a.data(R.value),o.index(a)),s=o.length,c=a.length>0,l=a.length>1,u=0===r,d=r+1==s,m=w.is.searchSelection(),f=w.is.focusedOnSearch(),g=w.is.focused(),p=f&&0===w.get.caretPosition();if(m&&!c&&!f)return;t==n.leftArrow?!g&&!p||c?c&&(e.shiftKey?w.verbose("Adding previous label to selection"):(w.verbose("Selecting previous label"),o.removeClass(S.active)),u&&!l?a.addClass(S.active):a.prev(F.siblingLabel).addClass(S.active).end(),e.preventDefault()):(w.verbose("Selecting previous label"),o.last().addClass(S.active)):t==n.rightArrow?(g&&!c&&o.first().addClass(S.active),c&&(e.shiftKey?w.verbose("Adding next label to selection"):(w.verbose("Selecting next label"), -o.removeClass(S.active)),d?m?f?o.removeClass(S.active):w.focusSearch():l?a.next(F.siblingLabel).addClass(S.active):a.addClass(S.active):a.next(F.siblingLabel).addClass(S.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?c?(w.verbose("Removing active labels"),d&&m&&!f&&w.focusSearch(),a.last().next(F.siblingLabel).addClass(S.active),w.remove.activeLabels(a),e.preventDefault()):p&&!c&&t==n.backspace&&(w.verbose("Removing last label on input backspace"),a=o.last().addClass(S.active),w.remove.activeLabels(a)):a.removeClass(S.active)}}},keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o,a,r=W.not(F.unselectable).filter("."+S.selected).eq(0),s=U.children("."+S.active).eq(0),c=r.length>0?r:s,l=c.length>0?c.siblings(":not(."+S.filtered+")").andSelf():U.children(":not(."+S.filtered+")"),u=c.children(F.menu),d=c.closest(F.menu),m=d.hasClass(S.visible)||d.hasClass(S.animating)||d.parent(F.menu).length>0,f=u.length>0,g=c.length>0,p=c.not(F.unselectable).length>0;if(w.is.visible()){if(t==n.enter&&(t==n.enter&&g&&f&&!k.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):p&&(w.verbose("Selecting item from keyboard shortcut",c),w.event.item.click.call(c,e),w.is.searchSelection()&&w.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(a=d[0]!==U[0],a&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,d),c.removeClass(S.selected),d.closest(F.item).addClass(S.selected),e.preventDefault())),t==n.rightArrow&&f&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,u),c.removeClass(S.selected),u.find(F.item).eq(0).addClass(S.selected),e.preventDefault()),t==n.upArrow){if(o=g&&m?c.prevAll(F.item+":not("+F.unselectable+")").eq(0):W.eq(0),l.index(o)<0)return w.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();w.verbose("Up key pressed, changing active item"),c.removeClass(S.selected),o.addClass(S.selected),w.set.scrollPosition(o),e.preventDefault()}if(t==n.downArrow){if(o=g&&m?o=c.nextAll(F.item+":not("+F.unselectable+")").eq(0):W.eq(0),0===o.length)return w.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();w.verbose("Down key pressed, changing active item"),W.removeClass(S.selected),o.addClass(S.selected),w.set.scrollPosition(o),e.preventDefault()}t==n.pageUp&&(w.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(w.scrollPage("down"),e.preventDefault()),t==n.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else t==n.delimiter&&k.allowAdditions&&w.is.multiple()&&e.preventDefault(),t==n.downArrow&&(w.verbose("Down key pressed, showing dropdown"),w.show(),e.preventDefault())}else w.is.selection()&&!w.is.search()&&w.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){w.verbose("Determining action",k.action),e.isFunction(w.action[k.action])?(w.verbose("Triggering preset action",k.action,t,n),w.action[k.action].call(this,t,n)):e.isFunction(k.action)?(w.verbose("Triggering user action",k.action,t,n),k.action.call(this,t,n)):w.error(D.action,k.action)},eventInModule:function(t,i){var o=e(t.target),a=o.closest(n.documentElement).length>0,r=o.closest(z).length>0;return i=e.isFunction(i)?i:function(){},a&&!r?(w.verbose("Triggering event",i),i(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target),o=i.closest(F.siblingLabel),a=0===z.find(o).length,r=0===i.closest(U).length;return n=e.isFunction(n)?n:function(){},a&&r?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){if(n=n!==i?n:t,w.can.activate(e(this))){if(w.set.selected(n,e(this)),w.is.multiple()&&!w.is.allFiltered())return;w.hideAndClear()}},select:function(e,t){w.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),w.hideAndClear()},hide:function(e,t){w.set.value(t),w.hideAndClear()}},get:{id:function(){return y},defaultText:function(){return z.data(R.defaultText)},defaultValue:function(){return z.data(R.defaultValue)},placeholderText:function(){return z.data(R.placeholderText)||""},text:function(){return L.text()},query:function(){return e.trim(N.val())},searchWidth:function(e){return e*k.glyphWidth+"em"},selectionCount:function(){var t,n=w.get.values();return t=w.is.multiple()?e.isArray(n)?n.length:0:""!==w.get.value()?1:0},transition:function(e){return"auto"==k.transition?w.is.upward(e)?"slide up":"slide down":k.transition},userValues:function(){var t=w.get.values();return t?(t=e.isArray(t)?t:[t],e.grep(t,function(e){return w.get.item(e)===!1})):!1},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=N.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){var t=V.length>0?V.val():z.data(R.value);return e.isArray(t)&&1===t.length&&""===t[0]?"":t},values:function(){var e=w.get.value();return""===e?"":!w.has.selectInput()&&w.is.multiple()?"string"==typeof e?e.split(k.delimiter):"":e},remoteValues:function(){var t=w.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=w.read.remoteData(t);w.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(t,n){return n=n!==i?n:k.preserveHTML,t?(t.find(F.menu).length>0&&(w.verbose("Retreiving text of element with sub-menu"),t=t.clone(),t.find(F.menu).remove(),t.find(F.menuIcon).remove()),t.data(R.text)!==i?t.data(R.text):e.trim(n?t.html():t.text())):void 0},choiceValue:function(t,n){return n=n||w.get.choiceText(t),t?t.data(R.value)!==i?String(t.data(R.value)):"string"==typeof n?e.trim(n.toLowerCase()):String(n):!1},inputEvent:function(){var e=N[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],z.find("option").each(function(){var n=e(this),o=n.html(),a=n.attr("disabled"),r=n.attr("value")!==i?n.attr("value"):o;"auto"===k.placeholder&&""===r?t.placeholder=o:t.values.push({name:o,value:r,disabled:a})}),k.placeholder&&"auto"!==k.placeholder&&(w.debug("Setting placeholder value to",k.placeholder),t.placeholder=k.placeholder),k.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),w.debug("Retrieved and sorted values from select",t)):w.debug("Retreived values from select",t),t},activeItem:function(){return W.filter("."+S.active)},selectedItem:function(){var e=W.not(F.unselectable).filter("."+S.selected);return e.length>0?e:W.eq(0)},itemWithAdditions:function(e){var t=w.get.item(e),n=w.create.userChoice(e),i=n&&n.length>0;return i&&(t=t.length>0?t.add(n):n),t},item:function(t,n){var o,a,r=!1;return t=t!==i?t:w.get.values()!==i?w.get.values():w.get.text(),o=a?t.length>0:t!==i&&null!==t,a=w.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,o&&W.each(function(){var o=e(this),s=w.get.choiceText(o),c=w.get.choiceValue(o,s);if(null!==c&&c!==i)if(a)(-1!==e.inArray(String(c),t)||-1!==e.inArray(s,t))&&(r=r?r.add(o):o);else if(n){if(w.verbose("Ambiguous dropdown value using strict type check",o,t),c===t||s===t)return r=o,!0}else if(String(c)==String(t)||s==t)return w.verbose("Found select item by value",c,t),r=o,!0}),r}},check:{maxSelections:function(e){return k.maxSelections?(e=e!==i?e:w.get.selectionCount(),e>=k.maxSelections?(w.debug("Maximum selection count reached"),k.useLabels&&(W.addClass(S.filtered),w.add.message(T.maxSelections)),!0):(w.verbose("No longer at maximum selection count"),w.remove.message(),w.remove.filteredItem(),w.is.searchSelection()&&w.filterItems(),!1)):!0}},restore:{defaults:function(){w.clear(),w.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=w.get.defaultText(),t=w.get.placeholderText;e===t?(w.debug("Restoring default placeholder text",e),w.set.placeholderText(e)):(w.debug("Restoring default text",e),w.set.text(e))},defaultValue:function(){var e=w.get.defaultValue();e!==i&&(w.debug("Restoring default value",e),""!==e?(w.set.value(e),w.set.selected()):(w.remove.activeItem(),w.remove.selectedItem()))},labels:function(){k.allowAdditions&&(k.useLabels||(w.error(D.labels),k.useLabels=!0),w.debug("Restoring selected values"),w.create.userLabels()),w.check.maxSelections()},selected:function(){w.restore.values(),w.is.multiple()?(w.debug("Restoring previously selected values and labels"),w.restore.labels()):w.debug("Restoring previously selected values")},values:function(){w.set.initialLoad(),k.apiSettings?k.saveRemoteData?w.restore.remoteValues():w.clearValue():w.set.selected(),w.remove.initialLoad()},remoteValues:function(){var t=w.get.remoteValues();w.debug("Recreating selected from session data",t),t&&(w.is.single()?e.each(t,function(e,t){w.set.text(t)}):e.each(t,function(e,t){w.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void w.error(D.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){var e=w.get.value();w.verbose("Saving default value as",e),z.data(R.defaultValue,e)},defaultText:function(){var e=w.get.text();w.verbose("Saving default text as",e),z.data(R.defaultText,e)},placeholderText:function(){var e;k.placeholder!==!1&&L.hasClass(S.placeholder)&&(e=w.get.text(),w.verbose("Saving placeholder text as",e),z.data(R.placeholderText,e))},remoteData:function(e,n){return t.Storage===i?void w.error(D.noStorage):(w.verbose("Saving remote data to session storage",n,e),void sessionStorage.setItem(n,e))}},clear:function(){w.is.multiple()?w.remove.labels():(w.remove.activeItem(),w.remove.selectedItem()),w.set.placeholderText(),w.clearValue()},clearValue:function(){w.set.value("")},scrollPage:function(e,t){var n,i,o,a=t||w.get.selectedItem(),r=a.closest(F.menu),s=r.outerHeight(),c=r.scrollTop(),l=W.eq(0).outerHeight(),u=Math.floor(s/l),d=(r.prop("scrollHeight"),"up"==e?c-l*u:c+l*u),m=W.not(F.unselectable);o="up"==e?m.index(a)-u:m.index(a)+u,n="up"==e?o>=0:o0&&(w.debug("Scrolling page",e,i),a.removeClass(S.selected),i.addClass(S.selected),r.scrollTop(d))},set:{filtered:function(){var e=w.is.multiple(),t=w.is.searchSelection(),n=e&&t,i=t?w.get.query():"",o="string"==typeof i&&i.length>0,a=w.get.searchWidth(i.length),r=""!==i;e&&o&&(w.verbose("Adjusting input width",a,k.glyphWidth),N.css("width",a)),o||n&&r?(w.verbose("Hiding placeholder text"),L.addClass(S.filtered)):(!e||n&&!r)&&(w.verbose("Showing placeholder text"),L.removeClass(S.filtered))},loading:function(){z.addClass(S.loading)},placeholderText:function(e){e=e||w.get.placeholderText(),w.debug("Setting placeholder text",e),w.set.text(e),L.addClass(S.placeholder)},tabbable:function(){w.has.search()?(w.debug("Added tabindex to searchable dropdown"),N.val("").attr("tabindex",0),U.attr("tabindex",-1)):(w.debug("Added tabindex to dropdown"),z.attr("tabindex")||(z.attr("tabindex",0),U.attr("tabindex",-1)))},initialLoad:function(){w.verbose("Setting initial load"),v=!0},activeItem:function(e){e.addClass(k.allowAdditions&&e.filter(F.addition).length>0?S.filtered:S.active)},scrollPosition:function(e,t){var n,o,a,r,s,c,l,u,d,m=5;e=e||w.get.selectedItem(),n=e.closest(F.menu),o=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&o&&(r=e.position().top,n.addClass(S.loading),c=n.scrollTop(),s=n.offset().top,r=e.offset().top,a=c-s+r,t||(l=n.height(),d=a+m>c+l,u=c>a-m),w.debug("Scrolling to active item",a),(t||u||d)&&n.scrollTop(a),n.removeClass(S.loading))},text:function(e){"select"!==k.action&&("combo"==k.action?(w.debug("Changing combo button text",e,M),k.preserveHTML?M.html(e):M.text(e)):(e!==w.get.placeholderText()&&L.removeClass(S.placeholder),w.debug("Changing text",e,L),L.removeClass(S.filtered),k.preserveHTML?L.html(e):L.text(e)))},selectedLetter:function(t){var n,i=W.filter("."+S.selected),o=i.length>0&&w.has.firstLetter(i,t),a=!1;o&&(n=i.nextAll(W).eq(0),w.has.firstLetter(n,t)&&(a=n)),a||W.each(function(){return w.has.firstLetter(e(this),t)?(a=e(this),!1):void 0}),a&&(w.verbose("Scrolling to next value with letter",t),w.set.scrollPosition(a),i.removeClass(S.selected),a.addClass(S.selected))},direction:function(e){"auto"==k.direction?w.is.onScreen(e)?w.remove.upward(e):w.set.upward(e):"upward"==k.direction&&w.set.upward(e)},upward:function(e){var t=e||z;t.addClass(S.upward)},value:function(e,t,n){var o=V.length>0,a=(!w.has.value(e),w.get.values()),r=e!==i?String(e):e;if(o){if(r==a&&(w.verbose("Skipping value update already same value",e,a),!w.is.initialLoad()))return;w.is.single()&&w.has.selectInput()&&w.can.extendSelect()&&(w.debug("Adding user option",e),w.add.optionValue(e)),w.debug("Updating input value",e,a),X=!0,V.val(e),k.fireOnInit===!1&&w.is.initialLoad()?w.debug("Input native change event ignored on initial load"):V.trigger("change"),X=!1}else w.verbose("Storing value in metadata",e,V),e!==a&&z.data(R.value,r);k.fireOnInit===!1&&w.is.initialLoad()?w.verbose("No callback on initial load",k.onChange):k.onChange.call($,e,t,n)},active:function(){z.addClass(S.active)},multiple:function(){z.addClass(S.multiple)},visible:function(){z.addClass(S.visible)},exactly:function(e,t){w.debug("Setting selected to exact values"),w.clear(),w.set.selected(e,t)},selected:function(t,n){var i=w.is.multiple();n=k.allowAdditions?n||w.get.itemWithAdditions(t):n||w.get.item(t),n&&(w.debug("Setting selected menu item to",n),w.is.single()?(w.remove.activeItem(),w.remove.selectedItem()):k.useLabels&&w.remove.selectedItem(),n.each(function(){var t=e(this),o=w.get.choiceText(t),a=w.get.choiceValue(t,o),r=t.hasClass(S.filtered),s=t.hasClass(S.active),c=t.hasClass(S.addition),l=i&&1==n.length;i?!s||c?(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,a),k.useLabels?(w.add.value(a,o,t),w.add.label(a,o,l),w.set.activeItem(t),w.filterActive(),w.select.nextAvailable(n)):(w.add.value(a,o,t),w.set.text(w.add.variables(T.count)),w.set.activeItem(t))):r||(w.debug("Selected active value, removing label"),w.remove.selected(a)):(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,a),w.set.text(o),w.set.value(a,o,t),t.addClass(S.active).addClass(S.selected))}))}},add:{label:function(t,n,i){var o,a=w.is.searchSelection()?N:L;return o=e("").addClass(S.label).attr("data-value",t).html(O.label(t,n)),o=k.onLabelCreate.call(o,t,n),w.has.label(t)?void w.debug("Label already exists, skipping",t):(k.label.variation&&o.addClass(k.label.variation),void(i===!0?(w.debug("Animating in label",o),o.addClass(S.hidden).insertBefore(a).transition(k.label.transition,k.label.duration)):(w.debug("Adding selection label",o),o.insertBefore(a))))},message:function(t){var n=U.children(F.message),i=k.templates.message(w.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(S.message).appendTo(U)},optionValue:function(t){var n=V.find('option[value="'+t+'"]'),i=n.length>0;i||(x&&(x.disconnect(),w.verbose("Temporarily disconnecting mutation observer",t)),w.is.single()&&(w.verbose("Removing previous user addition"),V.find("option."+S.addition).remove()),e("
").addClass(p.embed).html(m.generate.embed(t)).appendTo(k),f.onCreate.call(R,t),m.debug("Creating embed object",A)},createAndShow:function(){m.createEmbed(),m.show()},change:function(e,t,n){m.debug("Changing video to ",e,t,n),k.data(b.source,e).data(b.id,t).data(b.url,n),m.create()},reset:function(){m.debug("Clearing embed and showing placeholder"),m.remove.active(),m.remove.embed(),m.showPlaceholder(),f.onReset.call(R)},show:function(){m.debug("Showing embed"),m.set.active(),f.onDisplay.call(R)},hide:function(){m.debug("Hiding embed"),m.showPlaceholder()},showPlaceholder:function(){m.debug("Showing placeholder image"),m.remove.active(),f.onPlaceholderDisplay.call(R)},get:{id:function(){return f.id||k.data(b.id)},placeholder:function(){return f.placeholder||k.data(b.placeholder); +o.removeClass(S.active)),d?m?f?o.removeClass(S.active):w.focusSearch():l?a.next(F.siblingLabel).addClass(S.active):a.addClass(S.active):a.next(F.siblingLabel).addClass(S.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?c?(w.verbose("Removing active labels"),d&&m&&!f&&w.focusSearch(),a.last().next(F.siblingLabel).addClass(S.active),w.remove.activeLabels(a),e.preventDefault()):p&&!c&&t==n.backspace&&(w.verbose("Removing last label on input backspace"),a=o.last().addClass(S.active),w.remove.activeLabels(a)):a.removeClass(S.active)}}},keydown:function(e){var t=e.which,n=w.get.shortcutKeys(),i=w.is.inObject(t,n);if(i){var o,a,r=W.not(F.unselectable).filter("."+S.selected).eq(0),s=U.children("."+S.active).eq(0),c=r.length>0?r:s,l=c.length>0?c.siblings(":not(."+S.filtered+")").andSelf():U.children(":not(."+S.filtered+")"),u=c.children(F.menu),d=c.closest(F.menu),m=d.hasClass(S.visible)||d.hasClass(S.animating)||d.parent(F.menu).length>0,f=u.length>0,g=c.length>0,p=c.not(F.unselectable).length>0,v=t==n.delimiter&&k.allowAdditions&&w.is.multiple();if(w.is.visible()){if((t==n.enter||v)&&(t==n.enter&&g&&f&&!k.allowCategorySelection?(w.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):p&&(w.verbose("Selecting item from keyboard shortcut",c),w.event.item.click.call(c,e),w.is.searchSelection()&&w.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(a=d[0]!==U[0],a&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,d),c.removeClass(S.selected),d.closest(F.item).addClass(S.selected),e.preventDefault())),t==n.rightArrow&&f&&(w.verbose("Right key pressed, opening sub-menu"),w.animate.show(!1,u),c.removeClass(S.selected),u.find(F.item).eq(0).addClass(S.selected),e.preventDefault()),t==n.upArrow){if(o=g&&m?c.prevAll(F.item+":not("+F.unselectable+")").eq(0):W.eq(0),l.index(o)<0)return w.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();w.verbose("Up key pressed, changing active item"),c.removeClass(S.selected),o.addClass(S.selected),w.set.scrollPosition(o),e.preventDefault()}if(t==n.downArrow){if(o=g&&m?o=c.nextAll(F.item+":not("+F.unselectable+")").eq(0):W.eq(0),0===o.length)return w.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();w.verbose("Down key pressed, changing active item"),W.removeClass(S.selected),o.addClass(S.selected),w.set.scrollPosition(o),e.preventDefault()}t==n.pageUp&&(w.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(w.scrollPage("down"),e.preventDefault()),t==n.escape&&(w.verbose("Escape key pressed, closing dropdown"),w.hide())}else v&&e.preventDefault(),t==n.downArrow&&(w.verbose("Down key pressed, showing dropdown"),w.show(),e.preventDefault())}else w.is.selection()&&!w.is.search()&&w.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){w.verbose("Determining action",k.action),e.isFunction(w.action[k.action])?(w.verbose("Triggering preset action",k.action,t,n),w.action[k.action].call(this,t,n)):e.isFunction(k.action)?(w.verbose("Triggering user action",k.action,t,n),k.action.call(this,t,n)):w.error(D.action,k.action)},eventInModule:function(t,i){var o=e(t.target),a=o.closest(n.documentElement).length>0,r=o.closest(z).length>0;return i=e.isFunction(i)?i:function(){},a&&!r?(w.verbose("Triggering event",i),i(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target),o=i.closest(F.siblingLabel),a=0===z.find(o).length,r=0===i.closest(U).length;return n=e.isFunction(n)?n:function(){},a&&r?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){if(n=n!==i?n:t,w.can.activate(e(this))){if(w.set.selected(n,e(this)),w.is.multiple()&&!w.is.allFiltered())return;w.hideAndClear()}},select:function(e,t){w.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),w.hideAndClear()},hide:function(e,t){w.set.value(t),w.hideAndClear()}},get:{id:function(){return y},defaultText:function(){return z.data(R.defaultText)},defaultValue:function(){return z.data(R.defaultValue)},placeholderText:function(){return z.data(R.placeholderText)||""},text:function(){return L.text()},query:function(){return e.trim(N.val())},searchWidth:function(e){return e*k.glyphWidth+"em"},selectionCount:function(){var t,n=w.get.values();return t=w.is.multiple()?e.isArray(n)?n.length:0:""!==w.get.value()?1:0},transition:function(e){return"auto"==k.transition?w.is.upward(e)?"slide up":"slide down":k.transition},userValues:function(){var t=w.get.values();return t?(t=e.isArray(t)?t:[t],e.grep(t,function(e){return w.get.item(e)===!1})):!1},uniqueArray:function(t){return e.grep(t,function(n,i){return e.inArray(n,t)===i})},caretPosition:function(){var e,t,i=N.get(0);return"selectionStart"in i?i.selectionStart:n.selection?(i.focus(),e=n.selection.createRange(),t=e.text.length,e.moveStart("character",-i.value.length),e.text.length-t):void 0},shortcutKeys:function(){return{backspace:8,delimiter:188,deleteKey:46,enter:13,escape:27,pageUp:33,pageDown:34,leftArrow:37,upArrow:38,rightArrow:39,downArrow:40}},value:function(){var t=V.length>0?V.val():z.data(R.value);return e.isArray(t)&&1===t.length&&""===t[0]?"":t},values:function(){var e=w.get.value();return""===e?"":!w.has.selectInput()&&w.is.multiple()?"string"==typeof e?e.split(k.delimiter):"":e},remoteValues:function(){var t=w.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=w.read.remoteData(t);w.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(t,n){return n=n!==i?n:k.preserveHTML,t?(t.find(F.menu).length>0&&(w.verbose("Retreiving text of element with sub-menu"),t=t.clone(),t.find(F.menu).remove(),t.find(F.menuIcon).remove()),t.data(R.text)!==i?t.data(R.text):e.trim(n?t.html():t.text())):void 0},choiceValue:function(t,n){return n=n||w.get.choiceText(t),t?t.data(R.value)!==i?String(t.data(R.value)):"string"==typeof n?e.trim(n.toLowerCase()):String(n):!1},inputEvent:function(){var e=N[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],z.find("option").each(function(){var n=e(this),o=n.html(),a=n.attr("disabled"),r=n.attr("value")!==i?n.attr("value"):o;"auto"===k.placeholder&&""===r?t.placeholder=o:t.values.push({name:o,value:r,disabled:a})}),k.placeholder&&"auto"!==k.placeholder&&(w.debug("Setting placeholder value to",k.placeholder),t.placeholder=k.placeholder),k.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),w.debug("Retrieved and sorted values from select",t)):w.debug("Retreived values from select",t),t},activeItem:function(){return W.filter("."+S.active)},selectedItem:function(){var e=W.not(F.unselectable).filter("."+S.selected);return e.length>0?e:W.eq(0)},itemWithAdditions:function(e){var t=w.get.item(e),n=w.create.userChoice(e),i=n&&n.length>0;return i&&(t=t.length>0?t.add(n):n),t},item:function(t,n){var o,a,r=!1;return t=t!==i?t:w.get.values()!==i?w.get.values():w.get.text(),o=a?t.length>0:t!==i&&null!==t,a=w.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,o&&W.each(function(){var o=e(this),s=w.get.choiceText(o),c=w.get.choiceValue(o,s);if(null!==c&&c!==i)if(a)(-1!==e.inArray(String(c),t)||-1!==e.inArray(s,t))&&(r=r?r.add(o):o);else if(n){if(w.verbose("Ambiguous dropdown value using strict type check",o,t),c===t||s===t)return r=o,!0}else if(String(c)==String(t)||s==t)return w.verbose("Found select item by value",c,t),r=o,!0}),r}},check:{maxSelections:function(e){return k.maxSelections?(e=e!==i?e:w.get.selectionCount(),e>=k.maxSelections?(w.debug("Maximum selection count reached"),k.useLabels&&(W.addClass(S.filtered),w.add.message(T.maxSelections)),!0):(w.verbose("No longer at maximum selection count"),w.remove.message(),w.remove.filteredItem(),w.is.searchSelection()&&w.filterItems(),!1)):!0}},restore:{defaults:function(){w.clear(),w.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=w.get.defaultText(),t=w.get.placeholderText;e===t?(w.debug("Restoring default placeholder text",e),w.set.placeholderText(e)):(w.debug("Restoring default text",e),w.set.text(e))},defaultValue:function(){var e=w.get.defaultValue();e!==i&&(w.debug("Restoring default value",e),""!==e?(w.set.value(e),w.set.selected()):(w.remove.activeItem(),w.remove.selectedItem()))},labels:function(){k.allowAdditions&&(k.useLabels||(w.error(D.labels),k.useLabels=!0),w.debug("Restoring selected values"),w.create.userLabels()),w.check.maxSelections()},selected:function(){w.restore.values(),w.is.multiple()?(w.debug("Restoring previously selected values and labels"),w.restore.labels()):w.debug("Restoring previously selected values")},values:function(){w.set.initialLoad(),k.apiSettings?k.saveRemoteData?w.restore.remoteValues():w.clearValue():w.set.selected(),w.remove.initialLoad()},remoteValues:function(){var t=w.get.remoteValues();w.debug("Recreating selected from session data",t),t&&(w.is.single()?e.each(t,function(e,t){w.set.text(t)}):e.each(t,function(e,t){w.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void w.error(D.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){var e=w.get.value();w.verbose("Saving default value as",e),z.data(R.defaultValue,e)},defaultText:function(){var e=w.get.text();w.verbose("Saving default text as",e),z.data(R.defaultText,e)},placeholderText:function(){var e;k.placeholder!==!1&&L.hasClass(S.placeholder)&&(e=w.get.text(),w.verbose("Saving placeholder text as",e),z.data(R.placeholderText,e))},remoteData:function(e,n){return t.Storage===i?void w.error(D.noStorage):(w.verbose("Saving remote data to session storage",n,e),void sessionStorage.setItem(n,e))}},clear:function(){w.is.multiple()?w.remove.labels():(w.remove.activeItem(),w.remove.selectedItem()),w.set.placeholderText(),w.clearValue()},clearValue:function(){w.set.value("")},scrollPage:function(e,t){var n,i,o,a=t||w.get.selectedItem(),r=a.closest(F.menu),s=r.outerHeight(),c=r.scrollTop(),l=W.eq(0).outerHeight(),u=Math.floor(s/l),d=(r.prop("scrollHeight"),"up"==e?c-l*u:c+l*u),m=W.not(F.unselectable);o="up"==e?m.index(a)-u:m.index(a)+u,n="up"==e?o>=0:o0&&(w.debug("Scrolling page",e,i),a.removeClass(S.selected),i.addClass(S.selected),r.scrollTop(d))},set:{filtered:function(){var e=w.is.multiple(),t=w.is.searchSelection(),n=e&&t,i=t?w.get.query():"",o="string"==typeof i&&i.length>0,a=w.get.searchWidth(i.length),r=""!==i;e&&o&&(w.verbose("Adjusting input width",a,k.glyphWidth),N.css("width",a)),o||n&&r?(w.verbose("Hiding placeholder text"),L.addClass(S.filtered)):(!e||n&&!r)&&(w.verbose("Showing placeholder text"),L.removeClass(S.filtered))},loading:function(){z.addClass(S.loading)},placeholderText:function(e){e=e||w.get.placeholderText(),w.debug("Setting placeholder text",e),w.set.text(e),L.addClass(S.placeholder)},tabbable:function(){w.has.search()?(w.debug("Added tabindex to searchable dropdown"),N.val("").attr("tabindex",0),U.attr("tabindex",-1)):(w.debug("Added tabindex to dropdown"),z.attr("tabindex")||(z.attr("tabindex",0),U.attr("tabindex",-1)))},initialLoad:function(){w.verbose("Setting initial load"),v=!0},activeItem:function(e){e.addClass(k.allowAdditions&&e.filter(F.addition).length>0?S.filtered:S.active)},scrollPosition:function(e,t){var n,o,a,r,s,c,l,u,d,m=5;e=e||w.get.selectedItem(),n=e.closest(F.menu),o=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&o&&(r=e.position().top,n.addClass(S.loading),c=n.scrollTop(),s=n.offset().top,r=e.offset().top,a=c-s+r,t||(l=n.height(),d=a+m>c+l,u=c>a-m),w.debug("Scrolling to active item",a),(t||u||d)&&n.scrollTop(a),n.removeClass(S.loading))},text:function(e){"select"!==k.action&&("combo"==k.action?(w.debug("Changing combo button text",e,M),k.preserveHTML?M.html(e):M.text(e)):(e!==w.get.placeholderText()&&L.removeClass(S.placeholder),w.debug("Changing text",e,L),L.removeClass(S.filtered),k.preserveHTML?L.html(e):L.text(e)))},selectedLetter:function(t){var n,i=W.filter("."+S.selected),o=i.length>0&&w.has.firstLetter(i,t),a=!1;o&&(n=i.nextAll(W).eq(0),w.has.firstLetter(n,t)&&(a=n)),a||W.each(function(){return w.has.firstLetter(e(this),t)?(a=e(this),!1):void 0}),a&&(w.verbose("Scrolling to next value with letter",t),w.set.scrollPosition(a),i.removeClass(S.selected),a.addClass(S.selected))},direction:function(e){"auto"==k.direction?w.is.onScreen(e)?w.remove.upward(e):w.set.upward(e):"upward"==k.direction&&w.set.upward(e)},upward:function(e){var t=e||z;t.addClass(S.upward)},value:function(e,t,n){var o=V.length>0,a=(!w.has.value(e),w.get.values()),r=e!==i?String(e):e;if(o){if(r==a&&(w.verbose("Skipping value update already same value",e,a),!w.is.initialLoad()))return;w.is.single()&&w.has.selectInput()&&w.can.extendSelect()&&(w.debug("Adding user option",e),w.add.optionValue(e)),w.debug("Updating input value",e,a),X=!0,V.val(e),k.fireOnInit===!1&&w.is.initialLoad()?w.debug("Input native change event ignored on initial load"):V.trigger("change"),X=!1}else w.verbose("Storing value in metadata",e,V),e!==a&&z.data(R.value,r);k.fireOnInit===!1&&w.is.initialLoad()?w.verbose("No callback on initial load",k.onChange):k.onChange.call($,e,t,n)},active:function(){z.addClass(S.active)},multiple:function(){z.addClass(S.multiple)},visible:function(){z.addClass(S.visible)},exactly:function(e,t){w.debug("Setting selected to exact values"),w.clear(),w.set.selected(e,t)},selected:function(t,n){var i=w.is.multiple();n=k.allowAdditions?n||w.get.itemWithAdditions(t):n||w.get.item(t),n&&(w.debug("Setting selected menu item to",n),w.is.single()?(w.remove.activeItem(),w.remove.selectedItem()):k.useLabels&&w.remove.selectedItem(),n.each(function(){var t=e(this),o=w.get.choiceText(t),a=w.get.choiceValue(t,o),r=t.hasClass(S.filtered),s=t.hasClass(S.active),c=t.hasClass(S.addition),l=i&&1==n.length;i?!s||c?(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,a),k.useLabels?(w.add.value(a,o,t),w.add.label(a,o,l),w.set.activeItem(t),w.filterActive(),w.select.nextAvailable(n)):(w.add.value(a,o,t),w.set.text(w.add.variables(T.count)),w.set.activeItem(t))):r||(w.debug("Selected active value, removing label"),w.remove.selected(a)):(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,a),w.set.text(o),w.set.value(a,o,t),t.addClass(S.active).addClass(S.selected))}))}},add:{label:function(t,n,i){var o,a=w.is.searchSelection()?N:L;return o=e("").addClass(S.label).attr("data-value",t).html(O.label(t,n)),o=k.onLabelCreate.call(o,t,n),w.has.label(t)?void w.debug("Label already exists, skipping",t):(k.label.variation&&o.addClass(k.label.variation),void(i===!0?(w.debug("Animating in label",o),o.addClass(S.hidden).insertBefore(a).transition(k.label.transition,k.label.duration)):(w.debug("Adding selection label",o),o.insertBefore(a))))},message:function(t){var n=U.children(F.message),i=k.templates.message(w.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(S.message).appendTo(U)},optionValue:function(t){var n=V.find('option[value="'+t+'"]'),i=n.length>0;i||(x&&(x.disconnect(),w.verbose("Temporarily disconnecting mutation observer",t)),w.is.single()&&(w.verbose("Removing previous user addition"),V.find("option."+S.addition).remove()),e("