From d6f5861ff094faf8368f7667b1d5351f29b9e3db Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 12 Jun 2015 13:54:55 -0400 Subject: [PATCH] Rebuild --- dist/components/dropdown.js | 21 ++-- dist/components/dropdown.min.js | 4 +- dist/components/transition.js | 158 +++++++++++++++----------- dist/components/transition.min.js | 2 +- dist/components/visibility.js | 4 +- dist/components/visibility.min.js | 2 +- dist/semantic.js | 183 +++++++++++++++++------------- dist/semantic.min.js | 14 +-- 8 files changed, 224 insertions(+), 164 deletions(-) diff --git a/dist/components/dropdown.js b/dist/components/dropdown.js index 9a060f738..a8123f075 100644 --- a/dist/components/dropdown.js +++ b/dist/components/dropdown.js @@ -17,6 +17,7 @@ $.fn.dropdown = function(parameters) { var $allModules = $(this), $document = $(document), + $window = $(window), moduleSelector = $allModules.selector || '', @@ -1492,9 +1493,11 @@ $.fn.dropdown = function(parameters) { .find('option') .each(function() { var - name = $(this).html(), - value = ( $(this).attr('value') !== undefined ) - ? $(this).attr('value') + $option = $(this), + name = $option.html(), + disabled = $option.attr('disabled'), + value = ( $option.attr('value') !== undefined ) + ? $option.attr('value') : name ; if(settings.placeholder === 'auto' && value === '') { @@ -1502,8 +1505,9 @@ $.fn.dropdown = function(parameters) { } else { select.values.push({ - name: name, - value: value + name : name, + value : value, + disabled : disabled }); } }) @@ -2558,7 +2562,7 @@ $.fn.dropdown = function(parameters) { $currentMenu.addClass(className.loading); onScreen = ($.fn.visibility !== undefined) ? $currentMenu.visibility('bottom visible') - : $(window).scrollTop() + $(window).height() >= $currentMenu.offset().top + $currentMenu.height() + : $window.scrollTop() + $window.height() >= $currentMenu.offset().top + $currentMenu.height() ; module.debug('Checking if menu can fit on screen', onScreen, $menu); $currentMenu.removeClass(className.loading); @@ -3101,7 +3105,10 @@ $.fn.dropdown.settings.templates = { } html += ''; return html; diff --git a/dist/components/dropdown.min.js b/dist/components/dropdown.min.js index a95a40199..77511a4b5 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(){var h,g,b,p,w,C,x,y=e.isPlainObject(a)?e.extend(!0,{},e.fn.dropdown.settings,a):e.extend({},e.fn.dropdown.settings),S=y.className,A=y.message,T=y.metadata,k=y.namespace,L=y.regExp,D=y.selector,I=y.error,R=y.templates,q="."+k,V="module-"+k,E=e(this),O=E.find(D.text),F=E.find(D.search),P=E.find(D.input),M=E.find(D.icon),z=E.prev().find(D.text).length>0?E.prev().find(D.text):E.prev(),H=E.children(D.menu),j=H.find(D.item),U=!1,N=!1,K=this,W=E.data(V);x={initialize:function(){x.debug("Initializing dropdown",y),x.is.alreadySetup()?x.setup.reference():(x.setup.layout(),x.save.defaults(),x.restore.selected(),x.create.id(),c&&x.bind.touchEvents(),x.bind.mouseEvents(),x.bind.keyboardEvents(),x.observeChanges(),x.instantiate())},instantiate:function(){x.verbose("Storing instance of dropdown",x),W=x,E.data(V,x)},destroy:function(){x.verbose("Destroying previous dropdown for",E),x.remove.tabbable(),E.off(q).removeData(V),H.off(q),r.off(b),w&&w.disconnect(),C&&C.disconnect()},observeChanges:function(){"MutationObserver"in t&&(w=new MutationObserver(function(e){x.debug("").addClass(S.search).insertBefore(O)),y.allowTab&&x.set.tabbable(),0===H.length&&(H=e("
").addClass(S.menu).appendTo(E))},select:function(){var t=x.get.selectValues();x.debug("Dropdown initialized on a select",t),E.is("select")&&(P=E),P.parent(D.dropdown).length>0?(x.debug("UI dropdown already exists. Creating dropdown menu only"),E=P.closest(D.dropdown),H=E.children(D.menu),x.setup.menu(t)):(x.debug("Creating entire dropdown from select"),E=e("
").attr("class",P.attr("class")).addClass(S.selection).addClass(S.dropdown).html(R.dropdown(t)).insertBefore(P),P.removeAttr("class").detach().prependTo(E)),P.is("[multiple]")&&x.set.multiple(),x.refresh()},menu:function(e){H.html(R.menu(e)),j=H.find(D.item)},reference:function(){var e,t,n=s.index(E);x.debug("Dropdown behavior was called on select, replacing with closest dropdown"),E=E.parent(D.dropdown),x.refresh(),e=s.slice(0,n),t=s.slice(n+1),s=e.add(E).add(t),m&&(W=x,x.invoke(v))}},refresh:function(){x.verbose("Refreshing selector cache"),O=E.find(D.text),F=E.find(D.search),P=E.find(D.input),M=E.find(D.icon),z=E.prev().find(D.text).length>0?E.prev().find(D.text):E.prev(),H=E.children(D.menu),j=H.find(D.item)},toggle:function(){x.verbose("Toggling menu visibility"),x.is.active()?x.hide():x.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},x.can.show()&&!x.is.active()){if(x.debug("Showing dropdown"),x.is.multiple()&&!x.has.search()&&x.is.allFiltered())return!0;x.animate.show(function(){x.can.click()&&x.bind.intent(),x.set.visible(),t.call(K)}),y.onShow.call(K)}},hide:function(t){t=e.isFunction(t)?t:function(){},x.is.active()&&(x.debug("Hiding dropdown"),x.animate.hide(function(){x.remove.visible(),t.call(K)}),y.onHide.call(K))},hideOthers:function(){x.verbose("Finding other dropdowns to hide"),s.not(E).has(D.menu+"."+S.visible).dropdown("hide")},hideMenu:function(){x.verbose("Hiding menu instantaneously"),x.remove.active(),x.remove.visible(),H.transition("hide")},hideSubMenus:function(){var e=H.children(D.item).find(D.menu);x.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){x.debug("Binding keyboard events"),E.on("keydown"+q,x.event.keydown),x.has.search()&&E.on(x.get.inputEvent()+q,D.search,x.event.input),x.is.multiple()&&r.on("keydown"+b,x.event.document.keydown)},touchEvents:function(){x.debug("Touch device detected binding additional touch events"),x.is.searchSelection()||E.on("touchstart"+q,x.event.test.toggle),H.on("touchstart"+q,D.item,x.event.item.mouseenter)},mouseEvents:function(){x.debug("Mouse detected binding mouse events"),x.is.multiple()&&E.on("click"+q,D.label,x.event.label.click).on("click"+q,D.remove,x.event.remove.click),x.is.searchSelection()?(E.on("mousedown"+q,D.menu,x.event.menu.mousedown).on("mouseup"+q,D.menu,x.event.menu.mouseup).on("click"+q,D.search,x.show).on("focus"+q,D.search,x.event.search.focus).on("blur"+q,D.search,x.event.search.blur).on("click"+q,D.text,x.event.text.focus),x.is.multiple()&&E.on("click"+q,x.event.click)):("click"==y.on?E.on("click"+q,x.event.test.toggle):"hover"==y.on?E.on("mouseenter"+q,x.delay.show).on("mouseleave"+q,x.delay.hide):E.on(y.on+q,x.toggle),E.on("mousedown"+q,x.event.mousedown).on("mouseup"+q,x.event.mouseup).on("focus"+q,x.event.focus).on("blur"+q,x.event.blur)),H.on("mouseenter"+q,D.item,x.event.item.mouseenter).on("mouseleave"+q,D.item,x.event.item.mouseleave).on("click"+q,D.item,x.event.item.click)},intent:function(){x.verbose("Binding hide intent event to document"),c&&r.on("touchstart"+b,x.event.test.touch).on("touchmove"+b,x.event.test.touch),r.on("click"+b,x.event.test.hide)}},unbind:{intent:function(){x.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:x.get.query(),n=function(){x.is.multiple()&&x.filterActive(),x.select.firstUnfiltered(),x.has.allResultsFiltered()?y.onNoResults.call(K,t)?y.allowAdditions||(x.verbose("All items filtered, showing message",t),x.add.message(A.noResults)):(x.verbose("All items filtered, hiding dropdown",t),x.hideMenu()):x.remove.message(),y.allowAdditions&&x.add.userSuggestion(e),x.is.searchSelection()&&x.can.show()&&x.is.focusedOnSearch()&&x.show()};x.has.maxSelections()||(y.apiSettings?x.can.useAPI()?x.queryRemote(t,function(){n()}):x.error(I.noAPI):(x.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:y.throttle,cache:"local",urlData:{query:t},onError:function(){x.add.message(A.serverError),n()},onFailure:function(){x.add.message(A.serverError),n()},onSuccess:function(e){x.remove.message(),x.setup.menu({values:e.results}),n()}};E.api("get request")||x.setup.api(),i=e.extend(!0,{},i,y.apiSettings),E.api("setting",i).api("query")},filterItems:function(t){var n=t!==i?t:x.get.query(),a=e(),o=x.escape.regExp(n),s=new RegExp("^"+o,"igm");""===n?a=j:(x.verbose("Searching for matching values",n),j.each(function(){var t,i,o=e(this);if("both"==y.match||"text"==y.match){if(t=String(x.get.choiceText(o,!1)),-1!==t.search(s))return a=a.add(o),!0;if(y.fullTextSearch&&x.fuzzySearch(n,t))return a=a.add(o),!0}if("both"==y.match||"value"==y.match){if(i=String(x.get.choiceValue(o,t)),-1!==i.search(s))return a=a.add(o),!0;if(y.fullTextSearch&&x.fuzzySearch(n,i))return a=a.add(o),!0}})),x.debug("Showing only matched items",n),x.remove.filteredItem(),j.not(a).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 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&&j.filter("."+S.active).addClass(S.filtered)},focusSearch:function(){x.is.search()&&!x.is.focusedOnSearch()&&F[0].focus()},forceSelection:function(){var e=j.not(S.filtered).filter("."+S.selected).eq(0),t=j.not(S.filtered).filter("."+S.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(x.debug("Forcing partial selection to selected item",n),x.event.item.click.call(n)):x.hide()},event:{focus:function(){y.showOnFocus&&!U&&x.is.hidden()&&!g&&x.show()},click:function(t){var n=e(t.target);!n.is(E)&&!n.is(M)||x.is.focusedOnSearch()||x.focusSearch()},blur:function(e){g=n.activeElement===this,U||g||(x.remove.activeLabel(),x.hide())},mousedown:function(){U=!0},mouseup:function(){U=!1},search:{focus:function(){U=!0,x.is.multiple()&&x.remove.activeLabel(),y.showOnFocus&&x.show()},blur:function(e){g=n.activeElement===this,N||g||(x.is.multiple()?(x.remove.activeLabel(),x.hide()):y.forceSelection?x.forceSelection():x.hide())}},text:{focus:function(e){U=!0,x.focusSearch()}},input:function(e){(x.is.multiple()||x.is.searchSelection())&&x.set.filtered(),clearTimeout(x.timer),x.timer=setTimeout(x.search,y.delay.search)},label:{click:function(t){var n=e(this),i=E.find(D.label),a=i.filter("."+S.active),o=n.nextAll("."+S.active),s=n.prevAll("."+S.active),r=o.length>0?n.nextUntil(o).add(a).add(n):n.prevUntil(s).add(a).add(n);t.shiftKey?(a.removeClass(S.active),r.addClass(S.active)):t.ctrlKey?n.toggleClass(S.active):(a.removeClass(S.active),n.addClass(S.active)),y.onLabelSelect.apply(this,i.filter("."+S.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(S.active)?x.remove.activeLabels():x.remove.activeLabels(t)}},test:{toggle:function(e){var t=x.is.multiple()?x.show:x.toggle;x.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){x.determine.eventOnElement(e,function(){"touchstart"==e.type?x.timer=setTimeout(x.hide,y.delay.touch):"touchmove"==e.type&&clearTimeout(x.timer)}),e.stopPropagation()},hide:function(e){x.determine.eventInModule(e,x.hide)}},menu:{mousedown:function(){N=!0},mouseup:function(){N=!1}},item:{mouseenter:function(t){var n=e(this).children(D.menu),i=e(this).siblings(D.item).children(D.menu);n.length>0&&(clearTimeout(x.itemTimer),x.itemTimer=setTimeout(function(){x.verbose("Showing sub-menu",n),e.each(i,function(){x.animate.hide(!1,e(this))}),x.animate.show(!1,n)},y.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(D.menu);n.length>0&&(clearTimeout(x.itemTimer),x.itemTimer=setTimeout(function(){x.verbose("Hiding sub-menu",n),x.animate.hide(!1,n)},y.delay.hide))},click:function(t){var n=e(this),i=e(t?t.target:""),a=n.find(D.menu),o=x.get.choiceText(n),s=x.get.choiceValue(n,o),r=a.length>0,l=a.find(i).length>0;l||r&&!y.allowCategorySelection||(y.useLabels||x.remove.searchTerm(),x.determine.selectAction.call(this,o,s))}},document:{keydown:function(e){var t=e.which,n=x.get.shortcutKeys(),i=x.is.inObject(t,n);if(i){var a=E.find(D.label),o=a.filter("."+S.active),s=(o.data("value"),a.index(o)),r=a.length,l=o.length>0,c=o.length>1,u=0===s,d=s+1==r,v=x.is.searchSelection(),m=x.is.focusedOnSearch(),f=x.is.focused(),h=m&&0===x.get.caretPosition();if(v&&!l&&!m)return;t==n.leftArrow?!f&&!h||l?l&&(e.shiftKey?x.verbose("Adding previous label to selection"):(x.verbose("Selecting previous label"),a.removeClass(S.active)),u&&!c?o.addClass(S.active):o.prev(D.siblingLabel).addClass(S.active).end(),e.preventDefault()):(x.verbose("Selecting previous label"),a.last().addClass(S.active)):t==n.rightArrow?(f&&!l&&a.first().addClass(S.active),l&&(e.shiftKey?x.verbose("Adding next label to selection"):(x.verbose("Selecting next label"),a.removeClass(S.active)),d?v?m?a.removeClass(S.active):x.focusSearch():c?o.next(D.siblingLabel).addClass(S.active):o.addClass(S.active):o.next(D.siblingLabel).addClass(S.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?l?(x.verbose("Removing active labels"),d&&v&&!m&&x.focusSearch(),o.last().next(D.siblingLabel).addClass(S.active),x.remove.activeLabels(o),e.preventDefault()):h&&!l&&t==n.backspace&&(x.verbose("Removing last label on input backspace"),o=a.last().addClass(S.active),x.remove.activeLabels(o)):o.removeClass(S.active)}}},keydown:function(e){var t=e.which,n=x.get.shortcutKeys(),i=x.is.inObject(t,n);if(i){var a,o,s=j.not(D.unselectable).filter("."+S.selected).eq(0),r=H.children("."+S.active).eq(0),l=s.length>0?s:r,c=l.length>0?l.siblings(":not(."+S.filtered+")").andSelf():H.children(":not(."+S.filtered+")"),u=l.children(D.menu),d=l.closest(D.menu),v=d.hasClass(S.visible)||d.hasClass(S.animating)||d.parent(D.menu).length>0,m=u.length>0,f=l.length>0,h=l.not(D.unselectable).length>0;if(x.is.visible()){if((t==n.enter||t==n.delimiter)&&(t==n.enter&&f&&m&&!y.allowCategorySelection?(x.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):h&&(x.verbose("Selecting item from keyboard shortcut",l),x.event.item.click.call(l,e),y.useLabels&&x.is.searchSelection()?x.hideAndClear():x.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(o=d[0]!==H[0],o&&(x.verbose("Left key pressed, closing sub-menu"),x.animate.hide(!1,d),l.removeClass(S.selected),d.closest(D.item).addClass(S.selected),e.preventDefault())),t==n.rightArrow&&m&&(x.verbose("Right key pressed, opening sub-menu"),x.animate.show(!1,u),l.removeClass(S.selected),u.find(D.item).eq(0).addClass(S.selected),e.preventDefault()),t==n.upArrow){if(a=f&&v?l.prevAll(D.item+":not("+D.unselectable+")").eq(0):j.eq(0),c.index(a)<0)return x.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();x.verbose("Up key pressed, changing active item"),l.removeClass(S.selected),a.addClass(S.selected),x.set.scrollPosition(a),e.preventDefault()}if(t==n.downArrow){if(a=f&&v?a=l.nextAll(D.item+":not("+D.unselectable+")").eq(0):j.eq(0),0===a.length)return x.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();x.verbose("Down key pressed, changing active item"),j.removeClass(S.selected),a.addClass(S.selected),x.set.scrollPosition(a),e.preventDefault()}t==n.pageUp&&(x.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(x.scrollPage("down"),e.preventDefault()),t==n.escape&&(x.verbose("Escape key pressed, closing dropdown"),x.hide())}else t==n.delimiter&&e.preventDefault(),t==n.downArrow&&(x.verbose("Down key pressed, showing dropdown"),x.show(),e.preventDefault())}else x.is.selection()&&!x.is.search()&&x.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){x.verbose("Determining action",y.action),e.isFunction(x.action[y.action])?(x.verbose("Triggering preset action",y.action,t,n),x.action[y.action].call(this,t,n)):e.isFunction(y.action)?(x.verbose("Triggering user action",y.action,t,n),y.action.call(this,t,n)):x.error(I.action,y.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(E).length?(x.verbose("Triggering event",n),n(),!0):(x.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0===i.closest(H).length?(x.verbose("Triggering event",n),n(),!0):(x.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,x.set.selected(n,e(this)),(!x.is.multiple()||x.is.allFiltered())&&x.hideAndClear()},select:function(e,t){x.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,x.set.selected(n,e(this)),x.hideAndClear()},hide:function(){x.hideAndClear()}},get:{id:function(){return p},text:function(){return O.text()},query:function(){return e.trim(F.val())},searchWidth:function(e){return e*y.glyphWidth+"em"},selectionCount:function(){var t=x.get.values();return x.is.multiple()?e.isArray(t)?t.length:0:""!==x.get.value()?1:0},transition:function(e){return"auto"==y.transition?x.is.upward(e)?"slide up":"slide down":y.transition},userValues:function(){var t=x.get.values();return t?e.grep(t,function(e){return x.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=F.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(){return P.length>0?P.val():E.data(T.value)},values:function(){var e=x.get.value();return""===e?"":!P.is("select")&&x.is.multiple()?"string"==typeof e?e.split(y.delimiter):"":e},remoteValues:function(){var t=x.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=x.read.remoteData(t);x.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(e,t){return t=t!==i?t:y.preserveHTML,e?(e.find(D.menu).length>0&&(x.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(D.menu).remove(),e.find(D.menuIcon).remove()),e.data(T.text)!==i?e.data(T.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||x.get.choiceText(e),e?e.data(T.value)!==i?e.data(T.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=F[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],E.find("option").each(function(){var n=e(this).html(),a=e(this).attr("value")!==i?e(this).attr("value"):n;"auto"===y.placeholder&&""===a?t.placeholder=n:t.values.push({name:n,value:a})}),y.placeholder&&"auto"!==y.placeholder&&(x.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}),x.debug("Retrieved and sorted values from select",t)):x.debug("Retreived values from select",t),t},activeItem:function(){return j.filter("."+S.active)},selectedItem:function(){var e=j.not(D.unselectable).filter("."+S.selected);return e.length>0?e:j.eq(0)},itemWithAdditions:function(e){var t=x.get.item(e),n=x.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:x.get.values()!==i?x.get.values():x.get.text(),a=o?t.length>0:t!==i&&""!==t&&null!==t,o=x.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,a&&j.each(function(){var a=e(this),r=x.get.choiceText(a),l=x.get.choiceValue(a,r);if(null!==l&&l!==i)if(o)(-1!==e.inArray(l.toString(),t)||-1!==e.inArray(r,t))&&(s=s?s.add(a):a);else if(n){if(x.verbose("Ambiguous dropdown value using strict type check",a,t),l===t||r===t)return s=a,!0}else if(l.toString()==t.toString()||r==t)return x.verbose("Found select item by value",l,t),s=a,!0}),s}},check:{maxSelections:function(e){return y.maxSelections?(e=e!==i?e:x.get.selectionCount(),e>=y.maxSelections?(x.debug("Maximum selection count reached"),j.addClass(S.filtered),x.add.message(A.maxSelections),!0):(x.verbose("No longer at maximum selection count"),x.remove.message(),x.remove.filteredItem(),x.is.searchSelection()&&x.filterItems(),!1)):!0}},restore:{defaults:function(){x.restore.defaultText(),x.restore.defaultValue()},defaultText:function(){var e=E.data(T.defaultText);x.debug("Restoring default text",e),x.set.text(e),O.addClass(S.placeholder)},defaultValue:function(){var e=E.data(T.defaultValue);e!==i&&(x.debug("Restoring default value",e),""!==e?(x.set.value(e),x.set.selected()):(x.remove.activeItem(),x.remove.selectedItem()))},labels:function(){y.allowAdditions&&(y.useLabels||(x.error(I.labels),y.useLabels=!0),x.debug("Restoring selected values"),x.create.userLabels()),x.check.maxSelections()},selected:function(){x.restore.values(),x.is.multiple()?(x.debug("Restoring previously selected values and labels"),x.restore.labels()):x.debug("Restoring previously selected values")},values:function(){x.set.initialLoad(),y.apiSettings?y.saveRemoteData?x.restore.remoteValues():x.clearValue():x.set.selected(),x.remove.initialLoad()},remoteValues:function(){var t=x.get.remoteValues();x.debug("Recreating selected from session data",t),t&&(x.is.single()?e.each(t,function(e,t){x.set.text(t)}):e.each(t,function(e,t){x.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void x.error(I.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){x.save.defaultText(),x.save.placeholderText(),x.save.defaultValue()},defaultValue:function(){E.data(T.defaultValue,x.get.value())},defaultText:function(){E.data(T.defaultText,O.text())},placeholderText:function(){O.hasClass(S.placeholder)&&E.data(T.placeholderText,O.text())},remoteData:function(e,n){return t.Storage===i?void x.error(I.noStorage):void sessionStorage.setItem(n,e)}},clear:function(){x.is.multiple()?x.remove.labels():(x.remove.activeItem(),x.remove.selectedItem()),x.set.placeholderText(),x.clearValue()},clearValue:function(){x.set.value("")},scrollPage:function(e,t){var n,i,a,t=t||x.get.selectedItem(),o=t.closest(D.menu),s=o.outerHeight(),r=o.scrollTop(),l=j.eq(0).outerHeight(),c=Math.floor(s/l),u=(o.prop("scrollHeight"),"up"==e?r-l*c:r+l*c),d=j.not(D.unselectable);a="up"==e?d.index(t)-c:d.index(t)+c,n="up"==e?a>=0:a0&&(x.debug("Scrolling page",e,i),t.removeClass(S.selected),i.addClass(S.selected),o.scrollTop(u))},set:{filtered:function(){var e=x.is.multiple(),t=x.is.searchSelection(),n=e&&t,i=t?x.get.query():"",a="string"==typeof i&&i.length>0,o=x.get.searchWidth(i.length),s=""!==i;e&&a&&(x.verbose("Adjusting input width",o,y.glyphWidth),F.css("width",o)),a||n&&s?(x.verbose("Hiding placeholder text"),O.addClass(S.filtered)):(!e||n&&!s)&&(x.verbose("Showing placeholder text"),O.removeClass(S.filtered))},loading:function(){E.addClass(S.loading)},placeholderText:function(e){x.debug("Restoring placeholder text"),e=e||E.data(T.placeholderText),x.set.text(e),O.addClass(S.placeholder)},tabbable:function(){x.has.search()?(x.debug("Added tabindex to searchable dropdown"),F.val("").attr("tabindex",0),H.attr("tabindex",-1)):(x.debug("Added tabindex to dropdown"),E.attr("tabindex")||(E.attr("tabindex",0),H.attr("tabindex",-1)))},initialLoad:function(){x.verbose("Setting initial load"),h=!0},scrollPosition:function(e,t){var n,a,o,s,r,l,c,u,d,v=5;e=e||x.get.selectedItem(),n=e.closest(D.menu),a=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&a&&(s=e.position().top,n.addClass(S.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),x.debug("Scrolling to active item",o),(t||u||d)&&n.scrollTop(o),n.removeClass(S.loading))},text:function(e){"select"!==y.action&&("combo"==y.action?(x.debug("Changing combo button text",e,z),y.preserveHTML?z.html(e):z.text(e)):(x.debug("Changing text",e,O),O.removeClass(S.filtered).removeClass(S.placeholder),y.preserveHTML?O.html(e):O.text(e)))},selectedLetter:function(t){var n=j.filter("."+S.selected),i=!1;j.each(function(){var n=e(this),a=x.get.choiceText(n,!1),o=String(a).charAt(0).toLowerCase(),s=t.toLowerCase();return o==s?(i=n,!1):void 0}),i&&(x.verbose("Scrolling to next value with letter",t),x.set.scrollPosition(i),n.removeClass(S.selected),i.addClass(S.selected))},direction:function(e){"auto"==y.direction?x.is.onScreen(e)?x.remove.upward(e):x.set.upward(e):"upward"==y.direction&&x.set.upward(e)},upward:function(e){var t=e||E;t.addClass(S.upward)},value:function(e,t,n){var i=P.length>0,a=(!x.has.value(e),x.get.values());if(i){if(e==a)return void x.verbose("Skipping value update already same value",e,a);x.debug("Updating input value",e,a),P.val(e).trigger("change")}else x.verbose("Storing value in metadata",e,P),e!==a&&E.data(T.value,e);y.fireOnInit===!1&&x.is.initialLoad()?x.verbose("No callback on initial load",y.onChange):y.onChange.call(K,e,t,n)},active:function(){E.addClass(S.active)},multiple:function(){E.addClass(S.multiple)},visible:function(){E.addClass(S.visible)},selected:function(t,n){var i=x.is.multiple();return(n=y.allowAdditions?n||x.get.itemWithAdditions(t):n||x.get.item(t))?(x.debug("Setting selected menu item to",n),x.is.single()?(x.remove.activeItem(),x.remove.selectedItem()):y.useLabels&&x.remove.selectedItem(),void n.each(function(){var t=e(this),a=x.get.choiceText(t),o=x.get.choiceValue(t,a),s=t.hasClass(S.filtered),r=t.hasClass(S.active),l=t.hasClass(S.addition),c=i&&1==n.length;i?!r||l?(y.apiSettings&&y.saveRemoteData&&x.save.remoteData(a,o),y.useLabels?(x.add.value(o,a,t),x.add.label(o,a,c),t.addClass(S.active),x.filterActive(),x.select.nextAvailable(n)):(x.add.value(o,a,t),x.set.text(x.add.variables(A.count)),t.addClass(S.active))):s||(x.debug("Selected active value, removing label"),x.remove.selected(o)):(y.apiSettings&&y.saveRemoteData&&x.save.remoteData(a,o),x.set.value(o,a,t),x.set.text(a),t.addClass(S.active).addClass(S.selected))})):!1}},add:{label:function(t,n,i){var a,o=x.is.searchSelection()?F:O;return a=e("").addClass(S.label).attr("data-value",t).html(R.label(t,n)),a=y.onLabelCreate.call(a,t,n),x.has.label(t)?void x.debug("Label already exists, skipping",t):(y.label.variation&&a.addClass(y.label.variation),void(i===!0?(x.debug("Animating in label",a),a.addClass(S.hidden).insertBefore(o).transition(y.label.transition,y.label.duration)):(x.debug("Adding selection label",a),a.insertBefore(o))))},message:function(t){var n=H.children(D.message),i=y.templates.message(x.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(S.message).appendTo(H)},optionValue:function(t){var n=P.find('option[value="'+t+'"]'),i=n.length>0;i||(w&&(w.disconnect(),x.verbose("Temporarily disconnecting mutation observer",t)),e("
").html(o).data(k.value,s).addClass(A.addition).addClass(A.item),n=n===i?a:n.add(a),y.verbose("Creating user choices for value",s,a))}),n):!1},userLabels:function(t){var n=y.get.userValues();n&&(y.debug("Adding user labels",n),e.each(n,function(e,t){y.verbose("Adding custom user value"),y.add.label(t,t)}))}},search:function(e){e=e!==i?e:y.get.query(),y.verbose("Searching for query",e),y.filter(e)},select:{firstUnfiltered:function(){y.verbose("Selecting first non-filtered element"),y.remove.selectedItem(),U.not(I.unselectable).eq(0).addClass(A.selected)},nextAvailable:function(e){e=e.eq(0);var t=e.nextAll(I.item).not(I.unselectable).eq(0),n=e.prevAll(I.item).not(I.unselectable).eq(0),i=t.length>0;i?(y.verbose("Moving selection to",t),t.addClass(A.selected)):(y.verbose("Moving selection to",n),n.addClass(A.selected))}},setup:{api:function(){var e={debug:S.debug,on:!1};y.verbose("First request, initializing API"),O.api(e)},layout:function(){O.is("select")&&y.setup.select(),y.is.search()&&!y.has.search()&&(y.verbose("Adding search input"),P=e("").addClass(A.search).insertBefore(F)),S.allowTab&&y.set.tabbable(),0===j.length&&(j=e("
").addClass(A.menu).appendTo(O))},select:function(){var t=y.get.selectValues();y.debug("Dropdown initialized on a select",t),O.is("select")&&(M=O),M.parent(I.dropdown).length>0?(y.debug("UI dropdown already exists. Creating dropdown menu only"),O=M.closest(I.dropdown),j=O.children(I.menu),y.setup.menu(t)):(y.debug("Creating entire dropdown from select"),O=e("
").attr("class",M.attr("class")).addClass(A.selection).addClass(A.dropdown).html(q.dropdown(t)).insertBefore(M),M.removeAttr("class").detach().prependTo(O)),M.is("[multiple]")&&y.set.multiple(),y.refresh()},menu:function(e){j.html(q.menu(e)),U=j.find(I.item)},reference:function(){var e,t,n=s.index(O);y.debug("Dropdown behavior was called on select, replacing with closest dropdown"),O=O.parent(I.dropdown),y.refresh(),e=s.slice(0,n),t=s.slice(n+1),s=e.add(O).add(t),f&&(B=y,y.invoke(m))}},refresh:function(){y.verbose("Refreshing selector cache"),F=O.find(I.text),P=O.find(I.search),M=O.find(I.input),z=O.find(I.icon),H=O.prev().find(I.text).length>0?O.prev().find(I.text):O.prev(),j=O.children(I.menu),U=j.find(I.item)},toggle:function(){y.verbose("Toggling menu visibility"),y.is.active()?y.hide():y.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},y.can.show()&&!y.is.active()){if(y.debug("Showing dropdown"),y.is.multiple()&&!y.has.search()&&y.is.allFiltered())return!0;y.animate.show(function(){y.can.click()&&y.bind.intent(),y.set.visible(),t.call(W)}),S.onShow.call(W)}},hide:function(t){t=e.isFunction(t)?t:function(){},y.is.active()&&(y.debug("Hiding dropdown"),y.animate.hide(function(){y.remove.visible(),t.call(W)}),S.onHide.call(W))},hideOthers:function(){y.verbose("Finding other dropdowns to hide"),s.not(O).has(I.menu+"."+A.visible).dropdown("hide")},hideMenu:function(){y.verbose("Hiding menu instantaneously"),y.remove.active(),y.remove.visible(),j.transition("hide")},hideSubMenus:function(){var e=j.children(I.item).find(I.menu);y.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){y.debug("Binding keyboard events"),O.on("keydown"+V,y.event.keydown),y.has.search()&&O.on(y.get.inputEvent()+V,I.search,y.event.input),y.is.multiple()&&r.on("keydown"+p,y.event.document.keydown)},touchEvents:function(){y.debug("Touch device detected binding additional touch events"),y.is.searchSelection()||O.on("touchstart"+V,y.event.test.toggle),j.on("touchstart"+V,I.item,y.event.item.mouseenter)},mouseEvents:function(){y.debug("Mouse detected binding mouse events"),y.is.multiple()&&O.on("click"+V,I.label,y.event.label.click).on("click"+V,I.remove,y.event.remove.click),y.is.searchSelection()?(O.on("mousedown"+V,I.menu,y.event.menu.mousedown).on("mouseup"+V,I.menu,y.event.menu.mouseup).on("click"+V,I.search,y.show).on("focus"+V,I.search,y.event.search.focus).on("blur"+V,I.search,y.event.search.blur).on("click"+V,I.text,y.event.text.focus),y.is.multiple()&&O.on("click"+V,y.event.click)):("click"==S.on?O.on("click"+V,y.event.test.toggle):"hover"==S.on?O.on("mouseenter"+V,y.delay.show).on("mouseleave"+V,y.delay.hide):O.on(S.on+V,y.toggle),O.on("mousedown"+V,y.event.mousedown).on("mouseup"+V,y.event.mouseup).on("focus"+V,y.event.focus).on("blur"+V,y.event.blur)),j.on("mouseenter"+V,I.item,y.event.item.mouseenter).on("mouseleave"+V,I.item,y.event.item.mouseleave).on("click"+V,I.item,y.event.item.click)},intent:function(){y.verbose("Binding hide intent event to document"),u&&r.on("touchstart"+p,y.event.test.touch).on("touchmove"+p,y.event.test.touch),r.on("click"+p,y.event.test.hide)}},unbind:{intent:function(){y.verbose("Removing hide intent event from document"),u&&r.off("touchstart"+p).off("touchmove"+p),r.off("click"+p)}},filter:function(e){var t=e!==i?e:y.get.query(),n=function(){y.is.multiple()&&y.filterActive(),y.select.firstUnfiltered(),y.has.allResultsFiltered()?S.onNoResults.call(W,t)?S.allowAdditions||(y.verbose("All items filtered, showing message",t),y.add.message(T.noResults)):(y.verbose("All items filtered, hiding dropdown",t),y.hideMenu()):y.remove.message(),S.allowAdditions&&y.add.userSuggestion(e),y.is.searchSelection()&&y.can.show()&&y.is.focusedOnSearch()&&y.show()};y.has.maxSelections()||(S.apiSettings?y.can.useAPI()?y.queryRemote(t,function(){n()}):y.error(R.noAPI):(y.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:S.throttle,cache:"local",urlData:{query:t},onError:function(){y.add.message(T.serverError),n()},onFailure:function(){y.add.message(T.serverError),n()},onSuccess:function(e){y.remove.message(),y.setup.menu({values:e.results}),n()}};O.api("get request")||y.setup.api(),i=e.extend(!0,{},i,S.apiSettings),O.api("setting",i).api("query")},filterItems:function(t){var n=t!==i?t:y.get.query(),a=e(),o=y.escape.regExp(n),s=new RegExp("^"+o,"igm");""===n?a=U:(y.verbose("Searching for matching values",n),U.each(function(){var t,i,o=e(this);if("both"==S.match||"text"==S.match){if(t=String(y.get.choiceText(o,!1)),-1!==t.search(s))return a=a.add(o),!0;if(S.fullTextSearch&&y.fuzzySearch(n,t))return a=a.add(o),!0}if("both"==S.match||"value"==S.match){if(i=String(y.get.choiceValue(o,t)),-1!==i.search(s))return a=a.add(o),!0;if(S.fullTextSearch&&y.fuzzySearch(n,i))return a=a.add(o),!0}})),y.debug("Showing only matched items",n),y.remove.filteredItem(),U.not(a).addClass(A.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(){S.useLabels&&U.filter("."+A.active).addClass(A.filtered)},focusSearch:function(){y.is.search()&&!y.is.focusedOnSearch()&&P[0].focus()},forceSelection:function(){var e=U.not(A.filtered).filter("."+A.selected).eq(0),t=U.not(A.filtered).filter("."+A.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(y.debug("Forcing partial selection to selected item",n),y.event.item.click.call(n)):y.hide()},event:{focus:function(){S.showOnFocus&&!N&&y.is.hidden()&&!b&&y.show()},click:function(t){var n=e(t.target);!n.is(O)&&!n.is(z)||y.is.focusedOnSearch()||y.focusSearch()},blur:function(e){b=n.activeElement===this,N||b||(y.remove.activeLabel(),y.hide())},mousedown:function(){N=!0},mouseup:function(){N=!1},search:{focus:function(){N=!0,y.is.multiple()&&y.remove.activeLabel(),S.showOnFocus&&y.show()},blur:function(e){b=n.activeElement===this,K||b||(y.is.multiple()?(y.remove.activeLabel(),y.hide()):S.forceSelection?y.forceSelection():y.hide())}},text:{focus:function(e){N=!0,y.focusSearch()}},input:function(e){(y.is.multiple()||y.is.searchSelection())&&y.set.filtered(),clearTimeout(y.timer),y.timer=setTimeout(y.search,S.delay.search)},label:{click:function(t){var n=e(this),i=O.find(I.label),a=i.filter("."+A.active),o=n.nextAll("."+A.active),s=n.prevAll("."+A.active),r=o.length>0?n.nextUntil(o).add(a).add(n):n.prevUntil(s).add(a).add(n);t.shiftKey?(a.removeClass(A.active),r.addClass(A.active)):t.ctrlKey?n.toggleClass(A.active):(a.removeClass(A.active),n.addClass(A.active)),S.onLabelSelect.apply(this,i.filter("."+A.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(A.active)?y.remove.activeLabels():y.remove.activeLabels(t)}},test:{toggle:function(e){var t=y.is.multiple()?y.show:y.toggle;y.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){y.determine.eventOnElement(e,function(){"touchstart"==e.type?y.timer=setTimeout(y.hide,S.delay.touch):"touchmove"==e.type&&clearTimeout(y.timer)}),e.stopPropagation()},hide:function(e){y.determine.eventInModule(e,y.hide)}},menu:{mousedown:function(){K=!0},mouseup:function(){K=!1}},item:{mouseenter:function(t){var n=e(this).children(I.menu),i=e(this).siblings(I.item).children(I.menu);n.length>0&&(clearTimeout(y.itemTimer),y.itemTimer=setTimeout(function(){y.verbose("Showing sub-menu",n),e.each(i,function(){y.animate.hide(!1,e(this))}),y.animate.show(!1,n)},S.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(I.menu);n.length>0&&(clearTimeout(y.itemTimer),y.itemTimer=setTimeout(function(){y.verbose("Hiding sub-menu",n),y.animate.hide(!1,n)},S.delay.hide))},click:function(t){var n=e(this),i=e(t?t.target:""),a=n.find(I.menu),o=y.get.choiceText(n),s=y.get.choiceValue(n,o),r=a.length>0,l=a.find(i).length>0;l||r&&!S.allowCategorySelection||(S.useLabels||y.remove.searchTerm(),y.determine.selectAction.call(this,o,s))}},document:{keydown:function(e){var t=e.which,n=y.get.shortcutKeys(),i=y.is.inObject(t,n);if(i){var a=O.find(I.label),o=a.filter("."+A.active),s=(o.data("value"),a.index(o)),r=a.length,l=o.length>0,c=o.length>1,u=0===s,d=s+1==r,v=y.is.searchSelection(),m=y.is.focusedOnSearch(),f=y.is.focused(),h=m&&0===y.get.caretPosition();if(v&&!l&&!m)return;t==n.leftArrow?!f&&!h||l?l&&(e.shiftKey?y.verbose("Adding previous label to selection"):(y.verbose("Selecting previous label"),a.removeClass(A.active)),u&&!c?o.addClass(A.active):o.prev(I.siblingLabel).addClass(A.active).end(),e.preventDefault()):(y.verbose("Selecting previous label"),a.last().addClass(A.active)):t==n.rightArrow?(f&&!l&&a.first().addClass(A.active),l&&(e.shiftKey?y.verbose("Adding next label to selection"):(y.verbose("Selecting next label"),a.removeClass(A.active)),d?v?m?a.removeClass(A.active):y.focusSearch():c?o.next(I.siblingLabel).addClass(A.active):o.addClass(A.active):o.next(I.siblingLabel).addClass(A.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?l?(y.verbose("Removing active labels"),d&&v&&!m&&y.focusSearch(),o.last().next(I.siblingLabel).addClass(A.active),y.remove.activeLabels(o),e.preventDefault()):h&&!l&&t==n.backspace&&(y.verbose("Removing last label on input backspace"),o=a.last().addClass(A.active),y.remove.activeLabels(o)):o.removeClass(A.active)}}},keydown:function(e){var t=e.which,n=y.get.shortcutKeys(),i=y.is.inObject(t,n);if(i){var a,o,s=U.not(I.unselectable).filter("."+A.selected).eq(0),r=j.children("."+A.active).eq(0),l=s.length>0?s:r,c=l.length>0?l.siblings(":not(."+A.filtered+")").andSelf():j.children(":not(."+A.filtered+")"),u=l.children(I.menu),d=l.closest(I.menu),v=d.hasClass(A.visible)||d.hasClass(A.animating)||d.parent(I.menu).length>0,m=u.length>0,f=l.length>0,h=l.not(I.unselectable).length>0;if(y.is.visible()){if((t==n.enter||t==n.delimiter)&&(t==n.enter&&f&&m&&!S.allowCategorySelection?(y.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):h&&(y.verbose("Selecting item from keyboard shortcut",l),y.event.item.click.call(l,e),S.useLabels&&y.is.searchSelection()?y.hideAndClear():y.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(o=d[0]!==j[0],o&&(y.verbose("Left key pressed, closing sub-menu"),y.animate.hide(!1,d),l.removeClass(A.selected),d.closest(I.item).addClass(A.selected),e.preventDefault())),t==n.rightArrow&&m&&(y.verbose("Right key pressed, opening sub-menu"),y.animate.show(!1,u),l.removeClass(A.selected),u.find(I.item).eq(0).addClass(A.selected),e.preventDefault()),t==n.upArrow){if(a=f&&v?l.prevAll(I.item+":not("+I.unselectable+")").eq(0):U.eq(0),c.index(a)<0)return y.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();y.verbose("Up key pressed, changing active item"),l.removeClass(A.selected),a.addClass(A.selected),y.set.scrollPosition(a),e.preventDefault()}if(t==n.downArrow){if(a=f&&v?a=l.nextAll(I.item+":not("+I.unselectable+")").eq(0):U.eq(0),0===a.length)return y.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();y.verbose("Down key pressed, changing active item"),U.removeClass(A.selected),a.addClass(A.selected),y.set.scrollPosition(a),e.preventDefault()}t==n.pageUp&&(y.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(y.scrollPage("down"),e.preventDefault()),t==n.escape&&(y.verbose("Escape key pressed, closing dropdown"),y.hide())}else t==n.delimiter&&e.preventDefault(),t==n.downArrow&&(y.verbose("Down key pressed, showing dropdown"),y.show(),e.preventDefault())}else y.is.selection()&&!y.is.search()&&y.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){y.verbose("Determining action",S.action),e.isFunction(y.action[S.action])?(y.verbose("Triggering preset action",S.action,t,n),y.action[S.action].call(this,t,n)):e.isFunction(S.action)?(y.verbose("Triggering user action",S.action,t,n),S.action.call(this,t,n)):y.error(R.action,S.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(O).length?(y.verbose("Triggering event",n),n(),!0):(y.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0===i.closest(j).length?(y.verbose("Triggering event",n),n(),!0):(y.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,y.set.selected(n,e(this)),(!y.is.multiple()||y.is.allFiltered())&&y.hideAndClear()},select:function(e,t){y.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,y.set.selected(n,e(this)),y.hideAndClear()},hide:function(){y.hideAndClear()}},get:{id:function(){return w},text:function(){return F.text()},query:function(){return e.trim(P.val())},searchWidth:function(e){return e*S.glyphWidth+"em"},selectionCount:function(){var t=y.get.values();return y.is.multiple()?e.isArray(t)?t.length:0:""!==y.get.value()?1:0},transition:function(e){return"auto"==S.transition?y.is.upward(e)?"slide up":"slide down":S.transition},userValues:function(){var t=y.get.values();return t?e.grep(t,function(e){return y.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=P.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(){return M.length>0?M.val():O.data(k.value)},values:function(){var e=y.get.value();return""===e?"":!M.is("select")&&y.is.multiple()?"string"==typeof e?e.split(S.delimiter):"":e},remoteValues:function(){var t=y.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=y.read.remoteData(t);y.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(e,t){return t=t!==i?t:S.preserveHTML,e?(e.find(I.menu).length>0&&(y.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(I.menu).remove(),e.find(I.menuIcon).remove()),e.data(k.text)!==i?e.data(k.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||y.get.choiceText(e),e?e.data(k.value)!==i?e.data(k.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=P[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],O.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"===S.placeholder&&""===s?t.placeholder=a:t.values.push({name:a,value:s,disabled:o})}),S.placeholder&&"auto"!==S.placeholder&&(y.debug("Setting placeholder value to",S.placeholder),t.placeholder=S.placeholder),S.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),y.debug("Retrieved and sorted values from select",t)):y.debug("Retreived values from select",t),t},activeItem:function(){return U.filter("."+A.active)},selectedItem:function(){var e=U.not(I.unselectable).filter("."+A.selected);return e.length>0?e:U.eq(0)},itemWithAdditions:function(e){var t=y.get.item(e),n=y.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:y.get.values()!==i?y.get.values():y.get.text(),a=o?t.length>0:t!==i&&""!==t&&null!==t,o=y.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,a&&U.each(function(){var a=e(this),r=y.get.choiceText(a),l=y.get.choiceValue(a,r);if(null!==l&&l!==i)if(o)(-1!==e.inArray(l.toString(),t)||-1!==e.inArray(r,t))&&(s=s?s.add(a):a);else if(n){if(y.verbose("Ambiguous dropdown value using strict type check",a,t),l===t||r===t)return s=a,!0}else if(l.toString()==t.toString()||r==t)return y.verbose("Found select item by value",l,t),s=a,!0}),s}},check:{maxSelections:function(e){return S.maxSelections?(e=e!==i?e:y.get.selectionCount(),e>=S.maxSelections?(y.debug("Maximum selection count reached"),U.addClass(A.filtered),y.add.message(T.maxSelections),!0):(y.verbose("No longer at maximum selection count"),y.remove.message(),y.remove.filteredItem(),y.is.searchSelection()&&y.filterItems(),!1)):!0}},restore:{defaults:function(){y.restore.defaultText(),y.restore.defaultValue()},defaultText:function(){var e=O.data(k.defaultText);y.debug("Restoring default text",e),y.set.text(e),F.addClass(A.placeholder)},defaultValue:function(){var e=O.data(k.defaultValue);e!==i&&(y.debug("Restoring default value",e),""!==e?(y.set.value(e),y.set.selected()):(y.remove.activeItem(),y.remove.selectedItem()))},labels:function(){S.allowAdditions&&(S.useLabels||(y.error(R.labels),S.useLabels=!0),y.debug("Restoring selected values"),y.create.userLabels()),y.check.maxSelections()},selected:function(){y.restore.values(),y.is.multiple()?(y.debug("Restoring previously selected values and labels"),y.restore.labels()):y.debug("Restoring previously selected values")},values:function(){y.set.initialLoad(),S.apiSettings?S.saveRemoteData?y.restore.remoteValues():y.clearValue():y.set.selected(),y.remove.initialLoad()},remoteValues:function(){var t=y.get.remoteValues();y.debug("Recreating selected from session data",t),t&&(y.is.single()?e.each(t,function(e,t){y.set.text(t)}):e.each(t,function(e,t){y.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void y.error(R.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){y.save.defaultText(),y.save.placeholderText(),y.save.defaultValue()},defaultValue:function(){O.data(k.defaultValue,y.get.value())},defaultText:function(){O.data(k.defaultText,F.text())},placeholderText:function(){F.hasClass(A.placeholder)&&O.data(k.placeholderText,F.text())},remoteData:function(e,n){return t.Storage===i?void y.error(R.noStorage):void sessionStorage.setItem(n,e)}},clear:function(){y.is.multiple()?y.remove.labels():(y.remove.activeItem(),y.remove.selectedItem()),y.set.placeholderText(),y.clearValue()},clearValue:function(){y.set.value("")},scrollPage:function(e,t){var n,i,a,t=t||y.get.selectedItem(),o=t.closest(I.menu),s=o.outerHeight(),r=o.scrollTop(),l=U.eq(0).outerHeight(),c=Math.floor(s/l),u=(o.prop("scrollHeight"),"up"==e?r-l*c:r+l*c),d=U.not(I.unselectable);a="up"==e?d.index(t)-c:d.index(t)+c,n="up"==e?a>=0:a0&&(y.debug("Scrolling page",e,i),t.removeClass(A.selected),i.addClass(A.selected),o.scrollTop(u))},set:{filtered:function(){var e=y.is.multiple(),t=y.is.searchSelection(),n=e&&t,i=t?y.get.query():"",a="string"==typeof i&&i.length>0,o=y.get.searchWidth(i.length),s=""!==i;e&&a&&(y.verbose("Adjusting input width",o,S.glyphWidth),P.css("width",o)),a||n&&s?(y.verbose("Hiding placeholder text"),F.addClass(A.filtered)):(!e||n&&!s)&&(y.verbose("Showing placeholder text"),F.removeClass(A.filtered))},loading:function(){O.addClass(A.loading)},placeholderText:function(e){y.debug("Restoring placeholder text"),e=e||O.data(k.placeholderText),y.set.text(e),F.addClass(A.placeholder)},tabbable:function(){y.has.search()?(y.debug("Added tabindex to searchable dropdown"),P.val("").attr("tabindex",0),j.attr("tabindex",-1)):(y.debug("Added tabindex to dropdown"),O.attr("tabindex")||(O.attr("tabindex",0),j.attr("tabindex",-1)))},initialLoad:function(){y.verbose("Setting initial load"),g=!0},scrollPosition:function(e,t){var n,a,o,s,r,l,c,u,d,v=5;e=e||y.get.selectedItem(),n=e.closest(I.menu),a=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&a&&(s=e.position().top,n.addClass(A.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),y.debug("Scrolling to active item",o),(t||u||d)&&n.scrollTop(o),n.removeClass(A.loading))},text:function(e){"select"!==S.action&&("combo"==S.action?(y.debug("Changing combo button text",e,H),S.preserveHTML?H.html(e):H.text(e)):(y.debug("Changing text",e,F),F.removeClass(A.filtered).removeClass(A.placeholder),S.preserveHTML?F.html(e):F.text(e)))},selectedLetter:function(t){var n=U.filter("."+A.selected),i=!1;U.each(function(){var n=e(this),a=y.get.choiceText(n,!1),o=String(a).charAt(0).toLowerCase(),s=t.toLowerCase();return o==s?(i=n,!1):void 0}),i&&(y.verbose("Scrolling to next value with letter",t),y.set.scrollPosition(i),n.removeClass(A.selected),i.addClass(A.selected))},direction:function(e){"auto"==S.direction?y.is.onScreen(e)?y.remove.upward(e):y.set.upward(e):"upward"==S.direction&&y.set.upward(e)},upward:function(e){var t=e||O;t.addClass(A.upward)},value:function(e,t,n){var i=M.length>0,a=(!y.has.value(e),y.get.values());if(i){if(e==a)return void y.verbose("Skipping value update already same value",e,a);y.debug("Updating input value",e,a),M.val(e).trigger("change")}else y.verbose("Storing value in metadata",e,M),e!==a&&O.data(k.value,e);S.fireOnInit===!1&&y.is.initialLoad()?y.verbose("No callback on initial load",S.onChange):S.onChange.call(W,e,t,n)},active:function(){O.addClass(A.active)},multiple:function(){O.addClass(A.multiple)},visible:function(){O.addClass(A.visible)},selected:function(t,n){var i=y.is.multiple();return(n=S.allowAdditions?n||y.get.itemWithAdditions(t):n||y.get.item(t))?(y.debug("Setting selected menu item to",n),y.is.single()?(y.remove.activeItem(),y.remove.selectedItem()):S.useLabels&&y.remove.selectedItem(),void n.each(function(){var t=e(this),a=y.get.choiceText(t),o=y.get.choiceValue(t,a),s=t.hasClass(A.filtered),r=t.hasClass(A.active),l=t.hasClass(A.addition),c=i&&1==n.length;i?!r||l?(S.apiSettings&&S.saveRemoteData&&y.save.remoteData(a,o),S.useLabels?(y.add.value(o,a,t),y.add.label(o,a,c),t.addClass(A.active),y.filterActive(),y.select.nextAvailable(n)):(y.add.value(o,a,t),y.set.text(y.add.variables(T.count)),t.addClass(A.active))):s||(y.debug("Selected active value, removing label"),y.remove.selected(o)):(S.apiSettings&&S.saveRemoteData&&y.save.remoteData(a,o),y.set.value(o,a,t),y.set.text(a),t.addClass(A.active).addClass(A.selected))})):!1}},add:{label:function(t,n,i){var a,o=y.is.searchSelection()?P:F;return a=e("").addClass(A.label).attr("data-value",t).html(q.label(t,n)),a=S.onLabelCreate.call(a,t,n),y.has.label(t)?void y.debug("Label already exists, skipping",t):(S.label.variation&&a.addClass(S.label.variation),void(i===!0?(y.debug("Animating in label",a),a.addClass(A.hidden).insertBefore(o).transition(S.label.transition,S.label.duration)):(y.debug("Adding selection label",a),a.insertBefore(o))))},message:function(t){var n=j.children(I.message),i=S.templates.message(y.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(A.message).appendTo(j)},optionValue:function(t){var n=M.find('option[value="'+t+'"]'),i=n.length>0;i||(C&&(C.disconnect(),y.verbose("Temporarily disconnecting mutation observer",t)),e("
").addClass("ui red pointing prompt label").html(t[0])}},rules:{checked:function(){return e(this).filter(":checked").length>0},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))},email:function(t){var n=new RegExp(e.fn.form.settings.regExp.email,"i");return n.test(t)},empty:function(t){return!(t===i||""===t||e.isArray(t)&&0===t.length)},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)},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},length:function(e,t){return e!==i?e.length>=t:!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},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},maxCount:function(t,n){return t=t.split(","),e.isArray(t)&&t.length<=n},exactCount:function(t,n){return t=t.split(","),e.isArray(t)&&t.length==n},minCount:function(t,n){return t=t.split(","),e.isArray(t)&&t.length>=n},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))},maxLength:function(e,t){return e!==i?e.length<=t:!1},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},url:function(t){return e.fn.form.settings.regExp.url.match(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(),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",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).find(v.label),w=e(this).find(v.input),k=x.data(y),S=this;m={initialize:function(){m.verbose("Initializing checkbox",f),m.create.label(),m.add.events(),m.set.tabbable(),m.setup(),m.observeChanges(),m.instantiate()},instantiate:function(){m.verbose("Storing instance of module",m),k=m,x.data(y,m)},destroy:function(){m.verbose("Destroying module"),m.remove.events(),x.removeData(y)},setup:function(){m.is.checked()?(m.debug("Setting initial value to checked"),m.set.checked(),f.fireOnInit&&f.onChecked.call(w[0])):(m.debug("Setting initial value to unchecked"),m.remove.checked(),f.fireOnInit&&f.onUnchecked.call(w[0]))},refresh:function(){C=x.find(v.label),w=x.find(v.input)},observeChanges:function(){"MutationObserver"in t&&(a=new MutationObserver(function(e){m.debug("DOM tree modified, updating selector cache"),m.refresh()}),a.observe(S,{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:{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(),e.preventDefault()),e.ctrlKey||t!=n.enter&&t!=n.space||(m.verbose("Enter key pressed, toggling checkbox"),m.toggle(),e.preventDefault())}},get:{radios:function(){return e('input[name="'+m.get.name()+'"]').closest(v.checkbox)},name:function(){return w.attr("name")}},is:{radio:function(){return w.hasClass(g.radio)||"radio"==w.attr("type")},checked:function(){return w.prop("checked")!==i&&w.prop("checked")},unchecked:function(){return!m.is.checked()}},can:{change:function(){return!(x.hasClass(g.disabled)||x.hasClass(g.readOnly)||w.prop("disabled"))},uncheck:function(){return"boolean"==typeof f.uncheckable?f.uncheckable:!m.is.radio()}},set:{checked:function(){var e;m.is.radio()&&(e=m.get.radios(),m.debug("Unchecking other radios",e),e.removeClass(g.checked)),x.addClass(g.checked)},tabbable:function(){w.attr("tabindex")===i&&w.attr("tabindex",0)}},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(){var p,v,h,b,y,x,C,w=e.isPlainObject(o)?e.extend(!0,{},e.fn.dropdown.settings,o):e.extend({},e.fn.dropdown.settings),k=w.className,S=w.message,T=w.metadata,A=w.namespace,P=w.regExp,R=w.selector,E=w.error,F=w.templates,O="."+A,D="module-"+A,q=e(this),z=q.find(R.text),j=q.find(R.search),I=q.find(R.input),N=q.find(R.icon),L=q.prev().find(R.text).length>0?q.prev().find(R.text):q.prev(),V=q.children(R.menu),H=V.find(R.item),M=!1,U=!1,W=this,B=q.data(D);C={initialize:function(){C.debug("Initializing dropdown",w),C.is.alreadySetup()?C.setup.reference():(C.setup.layout(),C.save.defaults(),C.restore.selected(),C.create.id(),l&&C.bind.touchEvents(),C.bind.mouseEvents(),C.bind.keyboardEvents(),C.observeChanges(),C.instantiate())},instantiate:function(){C.verbose("Storing instance of dropdown",C),B=C,q.data(D,C)},destroy:function(){C.verbose("Destroying previous dropdown for",q),C.remove.tabbable(),q.off(O).removeData(D),V.off(O),s.off(h),y&&y.disconnect(),x&&x.disconnect()},observeChanges:function(){"MutationObserver"in t&&(y=new MutationObserver(function(e){C.debug("").addClass(k.search).insertBefore(z)),w.allowTab&&C.set.tabbable(),0===V.length&&(V=e("
").addClass(k.menu).appendTo(q))},select:function(){var t=C.get.selectValues();C.debug("Dropdown initialized on a select",t),q.is("select")&&(I=q),I.parent(R.dropdown).length>0?(C.debug("UI dropdown already exists. Creating dropdown menu only"),q=I.closest(R.dropdown),V=q.children(R.menu),C.setup.menu(t)):(C.debug("Creating entire dropdown from select"),q=e("
").attr("class",I.attr("class")).addClass(k.selection).addClass(k.dropdown).html(F.dropdown(t)).insertBefore(I),I.removeAttr("class").detach().prependTo(q)),I.is("[multiple]")&&C.set.multiple(),C.refresh()},menu:function(e){V.html(F.menu(e)),H=V.find(R.item)},reference:function(){var e,t,n=r.index(q);C.debug("Dropdown behavior was called on select, replacing with closest dropdown"),q=q.parent(R.dropdown),C.refresh(),e=r.slice(0,n),t=r.slice(n+1),r=e.add(q).add(t),f&&(B=C,C.invoke(m))}},refresh:function(){C.verbose("Refreshing selector cache"),z=q.find(R.text),j=q.find(R.search),I=q.find(R.input),N=q.find(R.icon),L=q.prev().find(R.text).length>0?q.prev().find(R.text):q.prev(),V=q.children(R.menu),H=V.find(R.item)},toggle:function(){C.verbose("Toggling menu visibility"),C.is.active()?C.hide():C.show()},show:function(t){if(t=e.isFunction(t)?t:function(){},C.can.show()&&!C.is.active()){if(C.debug("Showing dropdown"),C.is.multiple()&&!C.has.search()&&C.is.allFiltered())return!0;C.animate.show(function(){C.can.click()&&C.bind.intent(),C.set.visible(),t.call(W)}),w.onShow.call(W)}},hide:function(t){t=e.isFunction(t)?t:function(){},C.is.active()&&(C.debug("Hiding dropdown"),C.animate.hide(function(){C.remove.visible(),t.call(W)}),w.onHide.call(W))},hideOthers:function(){C.verbose("Finding other dropdowns to hide"),r.not(q).has(R.menu+"."+k.visible).dropdown("hide")},hideMenu:function(){C.verbose("Hiding menu instantaneously"),C.remove.active(),C.remove.visible(),V.transition("hide")},hideSubMenus:function(){var e=V.children(R.item).find(R.menu);C.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){C.debug("Binding keyboard events"),q.on("keydown"+O,C.event.keydown),C.has.search()&&q.on(C.get.inputEvent()+O,R.search,C.event.input),C.is.multiple()&&s.on("keydown"+h,C.event.document.keydown)},touchEvents:function(){C.debug("Touch device detected binding additional touch events"),C.is.searchSelection()||q.on("touchstart"+O,C.event.test.toggle),V.on("touchstart"+O,R.item,C.event.item.mouseenter)},mouseEvents:function(){C.debug("Mouse detected binding mouse events"),C.is.multiple()&&q.on("click"+O,R.label,C.event.label.click).on("click"+O,R.remove,C.event.remove.click),C.is.searchSelection()?(q.on("mousedown"+O,R.menu,C.event.menu.mousedown).on("mouseup"+O,R.menu,C.event.menu.mouseup).on("click"+O,R.search,C.show).on("focus"+O,R.search,C.event.search.focus).on("blur"+O,R.search,C.event.search.blur).on("click"+O,R.text,C.event.text.focus),C.is.multiple()&&q.on("click"+O,C.event.click)):("click"==w.on?q.on("click"+O,C.event.test.toggle):"hover"==w.on?q.on("mouseenter"+O,C.delay.show).on("mouseleave"+O,C.delay.hide):q.on(w.on+O,C.toggle),q.on("mousedown"+O,C.event.mousedown).on("mouseup"+O,C.event.mouseup).on("focus"+O,C.event.focus).on("blur"+O,C.event.blur)),V.on("mouseenter"+O,R.item,C.event.item.mouseenter).on("mouseleave"+O,R.item,C.event.item.mouseleave).on("click"+O,R.item,C.event.item.click)},intent:function(){C.verbose("Binding hide intent event to document"),l&&s.on("touchstart"+h,C.event.test.touch).on("touchmove"+h,C.event.test.touch),s.on("click"+h,C.event.test.hide)}},unbind:{intent:function(){C.verbose("Removing hide intent event from document"),l&&s.off("touchstart"+h).off("touchmove"+h),s.off("click"+h)}},filter:function(e){var t=e!==i?e:C.get.query(),n=function(){C.is.multiple()&&C.filterActive(),C.select.firstUnfiltered(),C.has.allResultsFiltered()?w.onNoResults.call(W,t)?w.allowAdditions||(C.verbose("All items filtered, showing message",t),C.add.message(S.noResults)):(C.verbose("All items filtered, hiding dropdown",t),C.hideMenu()):C.remove.message(),w.allowAdditions&&C.add.userSuggestion(e),C.is.searchSelection()&&C.can.show()&&C.is.focusedOnSearch()&&C.show()};C.has.maxSelections()||(w.apiSettings?C.can.useAPI()?C.queryRemote(t,function(){n()}):C.error(E.noAPI):(C.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:w.throttle,cache:"local",urlData:{query:t},onError:function(){C.add.message(S.serverError),n()},onFailure:function(){C.add.message(S.serverError),n()},onSuccess:function(e){C.remove.message(),C.setup.menu({values:e.results}),n()}};q.api("get request")||C.setup.api(),i=e.extend(!0,{},i,w.apiSettings),q.api("setting",i).api("query")},filterItems:function(t){var n=t!==i?t:C.get.query(),o=e(),a=C.escape.regExp(n),r=new RegExp("^"+a,"igm");""===n?o=H:(C.verbose("Searching for matching values",n),H.each(function(){var t,i,a=e(this);if("both"==w.match||"text"==w.match){if(t=String(C.get.choiceText(a,!1)),-1!==t.search(r))return o=o.add(a),!0;if(w.fullTextSearch&&C.fuzzySearch(n,t))return o=o.add(a),!0}if("both"==w.match||"value"==w.match){if(i=String(C.get.choiceValue(a,t)),-1!==i.search(r))return o=o.add(a),!0;if(w.fullTextSearch&&C.fuzzySearch(n,i))return o=o.add(a),!0}})),C.debug("Showing only matched items",n),C.remove.filteredItem(),H.not(o).addClass(k.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(){w.useLabels&&H.filter("."+k.active).addClass(k.filtered)},focusSearch:function(){C.is.search()&&!C.is.focusedOnSearch()&&j[0].focus()},forceSelection:function(){var e=H.not(k.filtered).filter("."+k.selected).eq(0),t=H.not(k.filtered).filter("."+k.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(C.debug("Forcing partial selection to selected item",n),C.event.item.click.call(n)):C.hide()},event:{focus:function(){w.showOnFocus&&!M&&C.is.hidden()&&!v&&C.show()},click:function(t){var n=e(t.target);!n.is(q)&&!n.is(N)||C.is.focusedOnSearch()||C.focusSearch()},blur:function(e){v=n.activeElement===this,M||v||(C.remove.activeLabel(),C.hide())},mousedown:function(){M=!0},mouseup:function(){M=!1},search:{focus:function(){M=!0,C.is.multiple()&&C.remove.activeLabel(),w.showOnFocus&&C.show()},blur:function(e){v=n.activeElement===this,U||v||(C.is.multiple()?(C.remove.activeLabel(),C.hide()):w.forceSelection?C.forceSelection():C.hide())}},text:{focus:function(e){M=!0,C.focusSearch()}},input:function(e){(C.is.multiple()||C.is.searchSelection())&&C.set.filtered(),clearTimeout(C.timer),C.timer=setTimeout(C.search,w.delay.search)},label:{click:function(t){var n=e(this),i=q.find(R.label),o=i.filter("."+k.active),a=n.nextAll("."+k.active),r=n.prevAll("."+k.active),s=a.length>0?n.nextUntil(a).add(o).add(n):n.prevUntil(r).add(o).add(n);t.shiftKey?(o.removeClass(k.active),s.addClass(k.active)):t.ctrlKey?n.toggleClass(k.active):(o.removeClass(k.active),n.addClass(k.active)),w.onLabelSelect.apply(this,i.filter("."+k.active))}},remove:{click:function(){var t=e(this).parent();t.hasClass(k.active)?C.remove.activeLabels():C.remove.activeLabels(t)}},test:{toggle:function(e){var t=C.is.multiple()?C.show:C.toggle;C.determine.eventOnElement(e,t)&&e.preventDefault()},touch:function(e){C.determine.eventOnElement(e,function(){"touchstart"==e.type?C.timer=setTimeout(C.hide,w.delay.touch):"touchmove"==e.type&&clearTimeout(C.timer)}),e.stopPropagation()},hide:function(e){C.determine.eventInModule(e,C.hide)}},menu:{mousedown:function(){U=!0},mouseup:function(){U=!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(C.itemTimer),C.itemTimer=setTimeout(function(){C.verbose("Showing sub-menu",n),e.each(i,function(){C.animate.hide(!1,e(this))}),C.animate.show(!1,n)},w.delay.show),t.preventDefault())},mouseleave:function(t){var n=e(this).children(R.menu);n.length>0&&(clearTimeout(C.itemTimer),C.itemTimer=setTimeout(function(){C.verbose("Hiding sub-menu",n),C.animate.hide(!1,n)},w.delay.hide))},click:function(t){var n=e(this),i=e(t?t.target:""),o=n.find(R.menu),a=C.get.choiceText(n),r=C.get.choiceValue(n,a),s=o.length>0,c=o.find(i).length>0;c||s&&!w.allowCategorySelection||(w.useLabels||C.remove.searchTerm(),C.determine.selectAction.call(this,a,r))}},document:{keydown:function(e){var t=e.which,n=C.get.shortcutKeys(),i=C.is.inObject(t,n);if(i){var o=q.find(R.label),a=o.filter("."+k.active),r=(a.data("value"),o.index(a)),s=o.length,c=a.length>0,l=a.length>1,u=0===r,d=r+1==s,m=C.is.searchSelection(),f=C.is.focusedOnSearch(),g=C.is.focused(),p=f&&0===C.get.caretPosition();if(m&&!c&&!f)return;t==n.leftArrow?!g&&!p||c?c&&(e.shiftKey?C.verbose("Adding previous label to selection"):(C.verbose("Selecting previous label"),o.removeClass(k.active)),u&&!l?a.addClass(k.active):a.prev(R.siblingLabel).addClass(k.active).end(),e.preventDefault()):(C.verbose("Selecting previous label"),o.last().addClass(k.active)):t==n.rightArrow?(g&&!c&&o.first().addClass(k.active),c&&(e.shiftKey?C.verbose("Adding next label to selection"):(C.verbose("Selecting next label"),o.removeClass(k.active)),d?m?f?o.removeClass(k.active):C.focusSearch():l?a.next(R.siblingLabel).addClass(k.active):a.addClass(k.active):a.next(R.siblingLabel).addClass(k.active),e.preventDefault())):t==n.deleteKey||t==n.backspace?c?(C.verbose("Removing active labels"),d&&m&&!f&&C.focusSearch(),a.last().next(R.siblingLabel).addClass(k.active),C.remove.activeLabels(a),e.preventDefault()):p&&!c&&t==n.backspace&&(C.verbose("Removing last label on input backspace"),a=o.last().addClass(k.active),C.remove.activeLabels(a)):a.removeClass(k.active)}}},keydown:function(e){var t=e.which,n=C.get.shortcutKeys(),i=C.is.inObject(t,n);if(i){var o,a,r=H.not(R.unselectable).filter("."+k.selected).eq(0),s=V.children("."+k.active).eq(0),c=r.length>0?r:s,l=c.length>0?c.siblings(":not(."+k.filtered+")").andSelf():V.children(":not(."+k.filtered+")"),u=c.children(R.menu),d=c.closest(R.menu),m=d.hasClass(k.visible)||d.hasClass(k.animating)||d.parent(R.menu).length>0,f=u.length>0,g=c.length>0,p=c.not(R.unselectable).length>0;if(C.is.visible()){if((t==n.enter||t==n.delimiter)&&(t==n.enter&&g&&f&&!w.allowCategorySelection?(C.verbose("Pressed enter on unselectable category, opening sub menu"),t=n.rightArrow):p&&(C.verbose("Selecting item from keyboard shortcut",c),C.event.item.click.call(c,e),w.useLabels&&C.is.searchSelection()?C.hideAndClear():C.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(a=d[0]!==V[0],a&&(C.verbose("Left key pressed, closing sub-menu"),C.animate.hide(!1,d),c.removeClass(k.selected),d.closest(R.item).addClass(k.selected),e.preventDefault())),t==n.rightArrow&&f&&(C.verbose("Right key pressed, opening sub-menu"),C.animate.show(!1,u),c.removeClass(k.selected),u.find(R.item).eq(0).addClass(k.selected),e.preventDefault()),t==n.upArrow){if(o=g&&m?c.prevAll(R.item+":not("+R.unselectable+")").eq(0):H.eq(0),l.index(o)<0)return C.verbose("Up key pressed but reached top of current menu"),void e.preventDefault();C.verbose("Up key pressed, changing active item"),c.removeClass(k.selected),o.addClass(k.selected),C.set.scrollPosition(o),e.preventDefault()}if(t==n.downArrow){if(o=g&&m?o=c.nextAll(R.item+":not("+R.unselectable+")").eq(0):H.eq(0),0===o.length)return C.verbose("Down key pressed but reached bottom of current menu"),void e.preventDefault();C.verbose("Down key pressed, changing active item"),H.removeClass(k.selected),o.addClass(k.selected),C.set.scrollPosition(o),e.preventDefault()}t==n.pageUp&&(C.scrollPage("up"),e.preventDefault()),t==n.pageDown&&(C.scrollPage("down"),e.preventDefault()),t==n.escape&&(C.verbose("Escape key pressed, closing dropdown"),C.hide())}else t==n.delimiter&&e.preventDefault(),t==n.downArrow&&(C.verbose("Down key pressed, showing dropdown"),C.show(),e.preventDefault())}else C.is.selection()&&!C.is.search()&&C.set.selectedLetter(String.fromCharCode(t))}},determine:{selectAction:function(t,n){C.verbose("Determining action",w.action),e.isFunction(C.action[w.action])?(C.verbose("Triggering preset action",w.action,t,n),C.action[w.action].call(this,t,n)):e.isFunction(w.action)?(C.verbose("Triggering user action",w.action,t,n),w.action.call(this,t,n)):C.error(E.action,w.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(q).length?(C.verbose("Triggering event",n),n(),!0):(C.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0===i.closest(V).length?(C.verbose("Triggering event",n),n(),!0):(C.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,C.set.selected(n,e(this)),(!C.is.multiple()||C.is.allFiltered())&&C.hideAndClear()},select:function(e,t){C.action.activate.call(this)},combo:function(t,n){n=n!==i?n:t,C.set.selected(n,e(this)),C.hideAndClear()},hide:function(){C.hideAndClear()}},get:{id:function(){return b},text:function(){return z.text()},query:function(){return e.trim(j.val())},searchWidth:function(e){return e*w.glyphWidth+"em"},selectionCount:function(){var t=C.get.values();return C.is.multiple()?e.isArray(t)?t.length:0:""!==C.get.value()?1:0},transition:function(e){return"auto"==w.transition?C.is.upward(e)?"slide up":"slide down":w.transition},userValues:function(){var t=C.get.values();return t?e.grep(t,function(e){return C.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=j.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(){return I.length>0?I.val():q.data(T.value)},values:function(){var e=C.get.value();return""===e?"":!I.is("select")&&C.is.multiple()?"string"==typeof e?e.split(w.delimiter):"":e},remoteValues:function(){var t=C.get.values(),n=!1;return t&&("string"==typeof t&&(t=[t]),n={},e.each(t,function(e,t){var i=C.read.remoteData(t);C.verbose("Restoring value from session data",i,t),n[t]=i?i:t})),n},choiceText:function(e,t){return t=t!==i?t:w.preserveHTML,e?(e.find(R.menu).length>0&&(C.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(R.menu).remove(),e.find(R.menuIcon).remove()),e.data(T.text)!==i?e.data(T.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||C.get.choiceText(e),e?e.data(T.value)!==i?e.data(T.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=j[0];return e?e.oninput!==i?"input":e.onpropertychange!==i?"propertychange":"keyup":!1},selectValues:function(){var t={};return t.values=[],q.find("option").each(function(){var n=e(this).html(),o=e(this).attr("value")!==i?e(this).attr("value"):n;"auto"===w.placeholder&&""===o?t.placeholder=n:t.values.push({name:n,value:o})}),w.placeholder&&"auto"!==w.placeholder&&(C.debug("Setting placeholder value to",w.placeholder),t.placeholder=w.placeholder),w.sortSelect?(t.values.sort(function(e,t){return e.name>t.name?1:-1}),C.debug("Retrieved and sorted values from select",t)):C.debug("Retreived values from select",t),t},activeItem:function(){return H.filter("."+k.active)},selectedItem:function(){var e=H.not(R.unselectable).filter("."+k.selected);return e.length>0?e:H.eq(0)},itemWithAdditions:function(e){var t=C.get.item(e),n=C.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:C.get.values()!==i?C.get.values():C.get.text(),o=a?t.length>0:t!==i&&""!==t&&null!==t,a=C.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,o&&H.each(function(){var o=e(this),s=C.get.choiceText(o),c=C.get.choiceValue(o,s);if(null!==c&&c!==i)if(a)(-1!==e.inArray(c.toString(),t)||-1!==e.inArray(s,t))&&(r=r?r.add(o):o);else if(n){if(C.verbose("Ambiguous dropdown value using strict type check",o,t),c===t||s===t)return r=o,!0}else if(c.toString()==t.toString()||s==t)return C.verbose("Found select item by value",c,t),r=o,!0}),r}},check:{maxSelections:function(e){return w.maxSelections?(e=e!==i?e:C.get.selectionCount(),e>=w.maxSelections?(C.debug("Maximum selection count reached"),H.addClass(k.filtered),C.add.message(S.maxSelections),!0):(C.verbose("No longer at maximum selection count"),C.remove.message(),C.remove.filteredItem(),C.is.searchSelection()&&C.filterItems(),!1)):!0}},restore:{defaults:function(){C.restore.defaultText(),C.restore.defaultValue()},defaultText:function(){var e=q.data(T.defaultText);C.debug("Restoring default text",e),C.set.text(e),z.addClass(k.placeholder)},defaultValue:function(){var e=q.data(T.defaultValue);e!==i&&(C.debug("Restoring default value",e),""!==e?(C.set.value(e),C.set.selected()):(C.remove.activeItem(),C.remove.selectedItem()))},labels:function(){w.allowAdditions&&(w.useLabels||(C.error(E.labels),w.useLabels=!0),C.debug("Restoring selected values"),C.create.userLabels()),C.check.maxSelections()},selected:function(){C.restore.values(),C.is.multiple()?(C.debug("Restoring previously selected values and labels"),C.restore.labels()):C.debug("Restoring previously selected values")},values:function(){C.set.initialLoad(),w.apiSettings?w.saveRemoteData?C.restore.remoteValues():C.clearValue():C.set.selected(),C.remove.initialLoad()},remoteValues:function(){var t=C.get.remoteValues();C.debug("Recreating selected from session data",t),t&&(C.is.single()?e.each(t,function(e,t){C.set.text(t)}):e.each(t,function(e,t){C.add.label(e,t)}))}},read:{remoteData:function(e){var n;return t.Storage===i?void C.error(E.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){C.save.defaultText(),C.save.placeholderText(),C.save.defaultValue()},defaultValue:function(){q.data(T.defaultValue,C.get.value())},defaultText:function(){q.data(T.defaultText,z.text())},placeholderText:function(){z.hasClass(k.placeholder)&&q.data(T.placeholderText,z.text())},remoteData:function(e,n){return t.Storage===i?void C.error(E.noStorage):void sessionStorage.setItem(n,e)}},clear:function(){C.is.multiple()?C.remove.labels():(C.remove.activeItem(),C.remove.selectedItem()),C.set.placeholderText(),C.clearValue()},clearValue:function(){C.set.value("")},scrollPage:function(e,t){var n,i,o,t=t||C.get.selectedItem(),a=t.closest(R.menu),r=a.outerHeight(),s=a.scrollTop(),c=H.eq(0).outerHeight(),l=Math.floor(r/c),u=(a.prop("scrollHeight"),"up"==e?s-c*l:s+c*l),d=H.not(R.unselectable);o="up"==e?d.index(t)-l:d.index(t)+l,n="up"==e?o>=0:o0&&(C.debug("Scrolling page",e,i),t.removeClass(k.selected),i.addClass(k.selected),a.scrollTop(u))},set:{filtered:function(){var e=C.is.multiple(),t=C.is.searchSelection(),n=e&&t,i=t?C.get.query():"",o="string"==typeof i&&i.length>0,a=C.get.searchWidth(i.length),r=""!==i;e&&o&&(C.verbose("Adjusting input width",a,w.glyphWidth),j.css("width",a)),o||n&&r?(C.verbose("Hiding placeholder text"),z.addClass(k.filtered)):(!e||n&&!r)&&(C.verbose("Showing placeholder text"),z.removeClass(k.filtered))},loading:function(){q.addClass(k.loading)},placeholderText:function(e){C.debug("Restoring placeholder text"),e=e||q.data(T.placeholderText),C.set.text(e),z.addClass(k.placeholder)},tabbable:function(){C.has.search()?(C.debug("Added tabindex to searchable dropdown"),j.val("").attr("tabindex",0),V.attr("tabindex",-1)):(C.debug("Added tabindex to dropdown"),q.attr("tabindex")||(q.attr("tabindex",0),V.attr("tabindex",-1)))},initialLoad:function(){C.verbose("Setting initial load"),p=!0},scrollPosition:function(e,t){var n,o,a,r,s,c,l,u,d,m=5; - -e=e||C.get.selectedItem(),n=e.closest(R.menu),o=e&&e.length>0,t=t!==i?t:!1,e&&n.length>0&&o&&(r=e.position().top,n.addClass(k.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),C.debug("Scrolling to active item",a),(t||u||d)&&n.scrollTop(a),n.removeClass(k.loading))},text:function(e){"select"!==w.action&&("combo"==w.action?(C.debug("Changing combo button text",e,L),w.preserveHTML?L.html(e):L.text(e)):(C.debug("Changing text",e,z),z.removeClass(k.filtered).removeClass(k.placeholder),w.preserveHTML?z.html(e):z.text(e)))},selectedLetter:function(t){var n=H.filter("."+k.selected),i=!1;H.each(function(){var n=e(this),o=C.get.choiceText(n,!1),a=String(o).charAt(0).toLowerCase(),r=t.toLowerCase();return a==r?(i=n,!1):void 0}),i&&(C.verbose("Scrolling to next value with letter",t),C.set.scrollPosition(i),n.removeClass(k.selected),i.addClass(k.selected))},direction:function(e){"auto"==w.direction?C.is.onScreen(e)?C.remove.upward(e):C.set.upward(e):"upward"==w.direction&&C.set.upward(e)},upward:function(e){var t=e||q;t.addClass(k.upward)},value:function(e,t,n){var i=I.length>0,o=(!C.has.value(e),C.get.values());if(i){if(e==o)return void C.verbose("Skipping value update already same value",e,o);C.debug("Updating input value",e,o),I.val(e).trigger("change")}else C.verbose("Storing value in metadata",e,I),e!==o&&q.data(T.value,e);w.fireOnInit===!1&&C.is.initialLoad()?C.verbose("No callback on initial load",w.onChange):w.onChange.call(W,e,t,n)},active:function(){q.addClass(k.active)},multiple:function(){q.addClass(k.multiple)},visible:function(){q.addClass(k.visible)},selected:function(t,n){var i=C.is.multiple();return(n=w.allowAdditions?n||C.get.itemWithAdditions(t):n||C.get.item(t))?(C.debug("Setting selected menu item to",n),C.is.single()?(C.remove.activeItem(),C.remove.selectedItem()):w.useLabels&&C.remove.selectedItem(),void n.each(function(){var t=e(this),o=C.get.choiceText(t),a=C.get.choiceValue(t,o),r=t.hasClass(k.filtered),s=t.hasClass(k.active),c=t.hasClass(k.addition),l=i&&1==n.length;i?!s||c?(w.apiSettings&&w.saveRemoteData&&C.save.remoteData(o,a),w.useLabels?(C.add.value(a,o,t),C.add.label(a,o,l),t.addClass(k.active),C.filterActive(),C.select.nextAvailable(n)):(C.add.value(a,o,t),C.set.text(C.add.variables(S.count)),t.addClass(k.active))):r||(C.debug("Selected active value, removing label"),C.remove.selected(a)):(w.apiSettings&&w.saveRemoteData&&C.save.remoteData(o,a),C.set.value(a,o,t),C.set.text(o),t.addClass(k.active).addClass(k.selected))})):!1}},add:{label:function(t,n,i){var o,a=C.is.searchSelection()?j:z;return o=e("").addClass(k.label).attr("data-value",t).html(F.label(t,n)),o=w.onLabelCreate.call(o,t,n),C.has.label(t)?void C.debug("Label already exists, skipping",t):(w.label.variation&&o.addClass(w.label.variation),void(i===!0?(C.debug("Animating in label",o),o.addClass(k.hidden).insertBefore(a).transition(w.label.transition,w.label.duration)):(C.debug("Adding selection label",o),o.insertBefore(a))))},message:function(t){var n=V.children(R.message),i=w.templates.message(C.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(k.message).appendTo(V)},optionValue:function(t){var n=I.find('option[value="'+t+'"]'),i=n.length>0;i||(y&&(y.disconnect(),C.verbose("Temporarily disconnecting mutation observer",t)),e("
").html(a).data(A.value,r).addClass(S.addition).addClass(S.item),n=n===i?o:n.add(o),w.verbose("Creating user choices for value",r,o))}),n):!1},userLabels:function(t){var n=w.get.userValues();n&&(w.debug("Adding user labels",n),e.each(n,function(e,t){w.verbose("Adding custom user value"),w.add.label(t,t)}))}},search:function(e){e=e!==i?e:w.get.query(),w.verbose("Searching for query",e),w.filter(e)},select:{firstUnfiltered:function(){w.verbose("Selecting first non-filtered element"),w.remove.selectedItem(),M.not(E.unselectable).eq(0).addClass(S.selected)},nextAvailable:function(e){e=e.eq(0);var t=e.nextAll(E.item).not(E.unselectable).eq(0),n=e.prevAll(E.item).not(E.unselectable).eq(0),i=t.length>0;i?(w.verbose("Moving selection to",t),t.addClass(S.selected)):(w.verbose("Moving selection to",n),n.addClass(S.selected))}},setup:{api:function(){var e={debug:k.debug,on:!1};w.verbose("First request, initializing API"),z.api(e)},layout:function(){z.is("select")&&w.setup.select(),w.is.search()&&!w.has.search()&&(w.verbose("Adding search input"),I=e("").addClass(S.search).insertBefore(j)),k.allowTab&&w.set.tabbable(),0===H.length&&(H=e("
").addClass(S.menu).appendTo(z))},select:function(){var t=w.get.selectValues();w.debug("Dropdown initialized on a select",t),z.is("select")&&(N=z),N.parent(E.dropdown).length>0?(w.debug("UI dropdown already exists. Creating dropdown menu only"),z=N.closest(E.dropdown),H=z.children(E.menu),w.setup.menu(t)):(w.debug("Creating entire dropdown from select"),z=e("
").attr("class",N.attr("class")).addClass(S.selection).addClass(S.dropdown).html(O.dropdown(t)).insertBefore(N),N.removeAttr("class").detach().prependTo(z)),N.is("[multiple]")&&w.set.multiple(),w.refresh()},menu:function(e){H.html(O.menu(e)),M=H.find(E.item)},reference:function(){var e,t,n=r.index(z);w.debug("Dropdown behavior was called on select, replacing with closest dropdown"),z=z.parent(E.dropdown),w.refresh(),e=r.slice(0,n),t=r.slice(n+1),r=e.add(z).add(t),g&&(Q=w,w.invoke(f))}},refresh:function(){w.verbose("Refreshing selector cache"),j=z.find(E.text),I=z.find(E.search),N=z.find(E.input),L=z.find(E.icon),V=z.prev().find(E.text).length>0?z.prev().find(E.text):z.prev(),H=z.children(E.menu),M=H.find(E.item)},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.animate.show(function(){w.can.click()&&w.bind.intent(),w.set.visible(),t.call(B)}),k.onShow.call(B)}},hide:function(t){t=e.isFunction(t)?t:function(){},w.is.active()&&(w.debug("Hiding dropdown"),w.animate.hide(function(){w.remove.visible(),t.call(B)}),k.onHide.call(B))},hideOthers:function(){w.verbose("Finding other dropdowns to hide"),r.not(z).has(E.menu+"."+S.visible).dropdown("hide")},hideMenu:function(){w.verbose("Hiding menu instantaneously"),w.remove.active(),w.remove.visible(),H.transition("hide")},hideSubMenus:function(){var e=H.children(E.item).find(E.menu);w.verbose("Hiding sub menus",e),e.transition("hide")},bind:{keyboardEvents:function(){w.debug("Binding keyboard events"),z.on("keydown"+D,w.event.keydown),w.has.search()&&z.on(w.get.inputEvent()+D,E.search,w.event.input),w.is.multiple()&&s.on("keydown"+b,w.event.document.keydown)},touchEvents:function(){w.debug("Touch device detected binding additional touch events"),w.is.searchSelection()||z.on("touchstart"+D,w.event.test.toggle),H.on("touchstart"+D,E.item,w.event.item.mouseenter)},mouseEvents:function(){w.debug("Mouse detected binding mouse events"),w.is.multiple()&&z.on("click"+D,E.label,w.event.label.click).on("click"+D,E.remove,w.event.remove.click),w.is.searchSelection()?(z.on("mousedown"+D,E.menu,w.event.menu.mousedown).on("mouseup"+D,E.menu,w.event.menu.mouseup).on("click"+D,E.search,w.show).on("focus"+D,E.search,w.event.search.focus).on("blur"+D,E.search,w.event.search.blur).on("click"+D,E.text,w.event.text.focus),w.is.multiple()&&z.on("click"+D,w.event.click)):("click"==k.on?z.on("click"+D,w.event.test.toggle):"hover"==k.on?z.on("mouseenter"+D,w.delay.show).on("mouseleave"+D,w.delay.hide):z.on(k.on+D,w.toggle),z.on("mousedown"+D,w.event.mousedown).on("mouseup"+D,w.event.mouseup).on("focus"+D,w.event.focus).on("blur"+D,w.event.blur)),H.on("mouseenter"+D,E.item,w.event.item.mouseenter).on("mouseleave"+D,E.item,w.event.item.mouseleave).on("click"+D,E.item,w.event.item.click)},intent:function(){w.verbose("Binding hide intent event to document"),u&&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"),u&&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(B,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()};w.has.maxSelections()||(k.apiSettings?w.can.useAPI()?w.queryRemote(t,function(){n()}):w.error(F.noAPI):(w.filterItems(t),n()))},queryRemote:function(t,n){var i={errorDuration:!1,throttle:k.throttle,cache:"local",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");""===n?o=M:(w.verbose("Searching for matching values",n),M.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}})),w.debug("Showing only matched items",n),w.remove.filteredItem(),M.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&&M.filter("."+S.active).addClass(S.filtered)},focusSearch:function(){w.is.search()&&!w.is.focusedOnSearch()&&I[0].focus()},forceSelection:function(){var e=M.not(S.filtered).filter("."+S.selected).eq(0),t=M.not(S.filtered).filter("."+S.active).eq(0),n=e.length>0?e:t,i=n.size()>0;i?(w.debug("Forcing partial selection to selected item",n),w.event.item.click.call(n)):w.hide()},event:{focus:function(){k.showOnFocus&&!U&&w.is.hidden()&&!h&&w.show()},click:function(t){var n=e(t.target);!n.is(z)&&!n.is(L)||w.is.focusedOnSearch()||w.focusSearch()},blur:function(e){h=n.activeElement===this,U||h||(w.remove.activeLabel(),w.hide())},mousedown:function(){U=!0},mouseup:function(){U=!1},search:{focus:function(){U=!0,w.is.multiple()&&w.remove.activeLabel(),k.showOnFocus&&w.show()},blur:function(e){h=n.activeElement===this,W||h||(w.is.multiple()?(w.remove.activeLabel(),w.hide()):k.forceSelection?w.forceSelection():w.hide())}},text:{focus:function(e){U=!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(E.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(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(){W=!0},mouseup:function(){W=!1}},item:{mouseenter:function(t){var n=e(this).children(E.menu),i=e(this).siblings(E.item).children(E.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(E.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))},click:function(t){var n=e(this),i=e(t?t.target:""),o=n.find(E.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.searchTerm(),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(E.label),a=o.filter("."+S.active),r=(a.data("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(E.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(E.siblingLabel).addClass(S.active):a.addClass(S.active):a.next(E.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(E.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=M.not(E.unselectable).filter("."+S.selected).eq(0),s=H.children("."+S.active).eq(0),c=r.length>0?r:s,l=c.length>0?c.siblings(":not(."+S.filtered+")").andSelf():H.children(":not(."+S.filtered+")"),u=c.children(E.menu),d=c.closest(E.menu),m=d.hasClass(S.visible)||d.hasClass(S.animating)||d.parent(E.menu).length>0,f=u.length>0,g=c.length>0,p=c.not(E.unselectable).length>0;if(w.is.visible()){if((t==n.enter||t==n.delimiter)&&(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),k.useLabels&&w.is.searchSelection()?w.hideAndClear():w.remove.searchTerm()),e.preventDefault()),t==n.leftArrow&&(a=d[0]!==H[0],a&&(w.verbose("Left key pressed, closing sub-menu"),w.animate.hide(!1,d),c.removeClass(S.selected),d.closest(E.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(E.item).eq(0).addClass(S.selected),e.preventDefault()),t==n.upArrow){if(o=g&&m?c.prevAll(E.item+":not("+E.unselectable+")").eq(0):M.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(E.item+":not("+E.unselectable+")").eq(0):M.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"),M.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&&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(F.action,k.action)},eventInModule:function(t,n){return n=e.isFunction(n)?n:function(){},0===e(t.target).closest(z).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown, canceling callback"),!1)},eventOnElement:function(t,n){var i=e(t.target);return n=e.isFunction(n)?n:function(){},0===i.closest(H).length?(w.verbose("Triggering event",n),n(),!0):(w.verbose("Event occurred in dropdown menu, canceling callback"),!1)}},action:{nothing:function(){},activate:function(t,n){n=n!==i?n:t,w.set.selected(n,e(this)),(!w.is.multiple()||w.is.allFiltered())&&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(){w.hideAndClear()}},get:{id:function(){return y},text:function(){return j.text()},query:function(){return e.trim(I.val())},searchWidth:function(e){return e*k.glyphWidth+"em"},selectionCount:function(){var t=w.get.values();return w.is.multiple()?e.isArray(t)?t.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?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=I.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(){return N.length>0?N.val():z.data(A.value)},values:function(){var e=w.get.value();return""===e?"":!N.is("select")&&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(e,t){return t=t!==i?t:k.preserveHTML,e?(e.find(E.menu).length>0&&(w.verbose("Retreiving text of element with sub-menu"),e=e.clone(),e.find(E.menu).remove(),e.find(E.menuIcon).remove()),e.data(A.text)!==i?e.data(A.text):t?e.html().trim():e.text().trim()):void 0},choiceValue:function(e,t){return t=t||w.get.choiceText(e),e?e.data(A.value)!==i?e.data(A.value):"string"==typeof t?t.toLowerCase().trim():t:!1},inputEvent:function(){var e=I[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 M.filter("."+S.active)},selectedItem:function(){var e=M.not(E.unselectable).filter("."+S.selected);return e.length>0?e:M.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&&""!==t&&null!==t,a=w.is.multiple()&&e.isArray(t),n=""===t||0===t?!0:n||!1,o&&M.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(c.toString(),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(c.toString()==t.toString()||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"),M.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.restore.defaultText(),w.restore.defaultValue()},defaultText:function(){var e=z.data(A.defaultText);w.debug("Restoring default text",e),w.set.text(e),j.addClass(S.placeholder)},defaultValue:function(){var e=z.data(A.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(F.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(F.noStorage):(n=sessionStorage.getItem(e),n!==i?n:!1)}},save:{defaults:function(){w.save.defaultText(),w.save.placeholderText(),w.save.defaultValue()},defaultValue:function(){z.data(A.defaultValue,w.get.value())},defaultText:function(){z.data(A.defaultText,j.text())},placeholderText:function(){j.hasClass(S.placeholder)&&z.data(A.placeholderText,j.text())},remoteData:function(e,n){return t.Storage===i?void w.error(F.noStorage):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,t=t||w.get.selectedItem(),a=t.closest(E.menu),r=a.outerHeight(),s=a.scrollTop(),c=M.eq(0).outerHeight(),l=Math.floor(r/c),u=(a.prop("scrollHeight"),"up"==e?s-c*l:s+c*l),d=M.not(E.unselectable);o="up"==e?d.index(t)-l:d.index(t)+l,n="up"==e?o>=0:o0&&(w.debug("Scrolling page",e,i),t.removeClass(S.selected),i.addClass(S.selected),a.scrollTop(u))},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),I.css("width",a)),o||n&&r?(w.verbose("Hiding placeholder text"),j.addClass(S.filtered)):(!e||n&&!r)&&(w.verbose("Showing placeholder text"),j.removeClass(S.filtered))},loading:function(){z.addClass(S.loading)},placeholderText:function(e){w.debug("Restoring placeholder text"),e=e||z.data(A.placeholderText),w.set.text(e),j.addClass(S.placeholder)},tabbable:function(){w.has.search()?(w.debug("Added tabindex to searchable dropdown"),I.val("").attr("tabindex",0),H.attr("tabindex",-1)):(w.debug("Added tabindex to dropdown"),z.attr("tabindex")||(z.attr("tabindex",0),H.attr("tabindex",-1)))},initialLoad:function(){w.verbose("Setting initial load"),v=!0},scrollPosition:function(e,t){ +var n,o,a,r,s,c,l,u,d,m=5;e=e||w.get.selectedItem(),n=e.closest(E.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,V),k.preserveHTML?V.html(e):V.text(e)):(w.debug("Changing text",e,j),j.removeClass(S.filtered).removeClass(S.placeholder),k.preserveHTML?j.html(e):j.text(e)))},selectedLetter:function(t){var n=M.filter("."+S.selected),i=!1;M.each(function(){var n=e(this),o=w.get.choiceText(n,!1),a=String(o).charAt(0).toLowerCase(),r=t.toLowerCase();return a==r?(i=n,!1):void 0}),i&&(w.verbose("Scrolling to next value with letter",t),w.set.scrollPosition(i),n.removeClass(S.selected),i.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 i=N.length>0,o=(!w.has.value(e),w.get.values());if(i){if(e==o)return void w.verbose("Skipping value update already same value",e,o);w.debug("Updating input value",e,o),N.val(e).trigger("change")}else w.verbose("Storing value in metadata",e,N),e!==o&&z.data(A.value,e);k.fireOnInit===!1&&w.is.initialLoad()?w.verbose("No callback on initial load",k.onChange):k.onChange.call(B,e,t,n)},active:function(){z.addClass(S.active)},multiple:function(){z.addClass(S.multiple)},visible:function(){z.addClass(S.visible)},selected:function(t,n){var i=w.is.multiple();return(n=k.allowAdditions?n||w.get.itemWithAdditions(t):n||w.get.item(t))?(w.debug("Setting selected menu item to",n),w.is.single()?(w.remove.activeItem(),w.remove.selectedItem()):k.useLabels&&w.remove.selectedItem(),void 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),t.addClass(S.active),w.filterActive(),w.select.nextAvailable(n)):(w.add.value(a,o,t),w.set.text(w.add.variables(T.count)),t.addClass(S.active))):r||(w.debug("Selected active value, removing label"),w.remove.selected(a)):(k.apiSettings&&k.saveRemoteData&&w.save.remoteData(o,a),w.set.value(a,o,t),w.set.text(o),t.addClass(S.active).addClass(S.selected))})):!1}},add:{label:function(t,n,i){var o,a=w.is.searchSelection()?I:j;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=H.children(E.message),i=k.templates.message(w.add.variables(t));n.length>0?n.html(i):n=e("
").html(i).addClass(S.message).appendTo(H)},optionValue:function(t){var n=N.find('option[value="'+t+'"]'),i=n.length>0;i||(x&&(x.disconnect(),w.verbose("Temporarily disconnecting mutation observer",t)),e("