text: !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.selectivity=t()}}(function(){return function t(e,i,n){function s(o,l){if(!i[o]){if(!e[o]){var u="function"==typeof require&&require;if(!l&&u)return u(o,!0);if(r)return r(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var h=i[o]={exports:{}};e[o][0].call(h.exports,function(t){var i=e[o][1][t];return s(i?i:t)},h,h.exports,t,e,i,n)}return i[o].exports}for(var r="function"==typeof require&&require,o=0;o<n.length;o++)s(n[o]);return s}({1:[function(t,e,i){var n=t(5),s=n.Symbol;e.exports=s},{5:5}],2:[function(t,e,i){function n(t){if("string"==typeof t)return t;if(r(t))return u?u.call(t):"";var e=t+"";return"0"==e&&1/t==-o?"-0":e}var s=t(1),r=t(13),o=1/0,l=s?s.prototype:void 0,u=l?l.toString:void 0;e.exports=n},{1:1,13:13}],3:[function(t,e,i){function n(t){return t&&t.Object===Object?t:null}e.exports=n},{}],4:[function(t,e,i){function n(t){return s[t]}var s={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"};e.exports=n},{}],5:[function(t,e,i){(function(i){var n=t(3),s=n("object"==typeof i&&i),r=n("object"==typeof self&&self),o=n("object"==typeof this&&this),l=s||r||o||Function("return this")();e.exports=l}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{3:3}],6:[function(t,e,i){function n(t,e,i){function n(e){var i=y,n=w;return y=w=void 0,E=e,_=t.apply(n,i)}function h(t){return E=t,I=setTimeout(f,e),O?n(t):_}function c(t){var i=t-x,n=t-E,s=e-i;return S?a(s,b-n):s}function d(t){var i=t-x,n=t-E;return void 0===x||i>=e||i<0||S&&n>=b}function f(){var t=r();return d(t)?p(t):void(I=setTimeout(f,c(t)))}function p(t){return I=void 0,T&&y?n(t):(y=w=void 0,_)}function v(){E=0,y=x=w=I=void 0}function m(){return void 0===I?_:p(r())}function g(){var t=r(),i=d(t);if(y=arguments,w=this,x=t,i){if(void 0===I)return h(x);if(S)return I=setTimeout(f,e),n(x)}return void 0===I&&(I=setTimeout(f,e)),_}var y,w,b,_,I,x,E=0,O=!1,S=!1,T=!0;if("function"!=typeof t)throw new TypeError(l);return e=o(e)||0,s(i)&&(O=!!i.leading,S="maxWait"in i,b=S?u(o(i.maxWait)||0,e):b,T="trailing"in i?!!i.trailing:T),g.cancel=v,g.flush=m,g}var s=t(10),r=t(14),o=t(15),l="Expected a function",u=Math.max,a=Math.min;e.exports=n},{10:10,14:14,15:15}],7:[function(t,e,i){function n(t){return t=r(t),t&&l.test(t)?t.replace(o,s):t}var s=t(4),r=t(16),o=/[&<>"'`]/g,l=RegExp(o.source);e.exports=n},{16:16,4:4}],8:[function(t,e,i){var n=Array.isArray;e.exports=n},{}],9:[function(t,e,i){function n(t){var e=s(t)?u.call(t):"";return e==r||e==o}var s=t(10),r="[object Function]",o="[object GeneratorFunction]",l=Object.prototype,u=l.toString;e.exports=n},{10:10}],10:[function(t,e,i){function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}e.exports=n},{}],11:[function(t,e,i){function n(t){return!!t&&"object"==typeof t}e.exports=n},{}],12:[function(t,e,i){function n(t){return"string"==typeof t||!s(t)&&r(t)&&u.call(t)==o}var s=t(8),r=t(11),o="[object String]",l=Object.prototype,u=l.toString;e.exports=n},{11:11,8:8}],13:[function(t,e,i){function n(t){return"symbol"==typeof t||s(t)&&l.call(t)==r}var s=t(11),r="[object Symbol]",o=Object.prototype,l=o.toString;e.exports=n},{11:11}],14:[function(t,e,i){function n(){return Date.now()}e.exports=n},{}],15:[function(t,e,i){function n(t){if("number"==typeof t)return t;if(o(t))return l;if(r(t)){var e=s(t.valueOf)?t.valueOf():t;t=r(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(u,"");var i=h.test(t);return i||c.test(t)?d(t.slice(2),i?2:8):a.test(t)?l:+t}var s=t(9),r=t(10),o=t(13),l=NaN,u=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,c=/^0o[0-7]+$/i,d=parseInt;e.exports=n},{10:10,13:13,9:9}],16:[function(t,e,i){function n(t){return null==t?"":s(t)}var s=t(2);e.exports=n},{2:2}],17:[function(t,e,i){"use strict";function n(t){s.each(l,function(e,i){t.on(e,function(t){t.originalEvent&&i.forEach(function(e){t[e]=t.originalEvent[e]})})})}var s=window.jQuery||window.Zepto,r=t(12),o=t(33),l={change:["added","removed","value"],"selectivity-change":["added","removed","value"],"selectivity-highlight":["id","item"],"selectivity-selected":["id","item"],"selectivity-selecting":["id","item"]};s.fn.selectivity=function(t,e){var i,l=Array.prototype.slice.call(arguments,1);return this.each(function(){var u=this.selectivity;if(u){if("data"===t?t=l.length?"setData":"getData":"val"===t||"value"===t?t=l.length?"setValue":"getValue":r(t)||(l=[t],t="setOptions"),!s.isFunction(u[t]))throw new Error("Unknown method: "+t);void 0===i&&(i=u[t].apply(u,l))}else if(r(t)){if("destroy"!==t)throw new Error("Cannot call method on element without Selectivity instance")}else{e=s.extend({},t,{element:this});var a=s(this);a.is("select")&&a.prop("multiple")&&(e.multiple=!0);var h=o.Inputs,c=e.inputType||(e.multiple?"Multiple":"Single");if(!s.isFunction(c)){if(!h[c])throw new Error("Unknown Selectivity input type: "+c);c=h[c]}this.selectivity=new c(e),a=s(this.selectivity.el),n(a),void 0===i&&(i=a)}}),void 0===i?this:i},o.patchEvents=n},{12:12,33:33,jquery:"jquery"}],18:[function(t,e,i){"use strict";function n(t,e){for(;t&&!u(t,e);)t=t.parentElement;return t||null}function s(t,e){this.el=a(t.template("dropdown",{dropdownCssClass:t.options.dropdownCssClass,searchInputPlaceholder:t.options.searchInputPlaceholder,showSearchInput:e.showSearchInput})),this.resultsContainer=this.$(".selectivity-results-container"),this.hasMore=!1,this.highlightedResult=null,this.loadMoreHighlighted=!1,this.options=e,this.results=[],this.selectivity=t,this._closed=!1,this._lastMousePosition={},this.close=this.close.bind(this),this.position=this.position.bind(this),t.options.closeOnSelect!==!1&&t.events.on("selectivity-selecting",this.close),this.addToDom(),this.showLoading(),e.showSearchInput&&(t.initInput(this.$(".selectivity-search-input")),t.focus());var i={};i["click "+m]=this._loadMoreClicked,i["click "+g]=this._resultClicked,i["mouseenter "+m]=this._loadMoreHovered,i["mouseenter "+g]=this._resultHovered,this.events=new o(this.el,this),this.events.on(i),this._attachScrollListeners(),this._suppressWheel(),setTimeout(this.triggerOpen.bind(this),1)}var r=(window.jQuery||window.Zepto).extend,o=t(19),l=t(36),u=t(38),a=t(39),h=t(40),c=t(41),d=t(42),f=t(33),p="highlight",v="."+p,m=".selectivity-load-more",g=".selectivity-result-item",y=["scroll","touchend","touchmove"];r(s.prototype,{$:function(t){return this.el.querySelector(t)},addToDom:function(){this.selectivity.el.appendChild(this.el)},close:function(){this._closed||(this._closed=!0,h(this.el),this.selectivity.events.off("selectivity-selecting",this.close),this.triggerClose(),this._removeScrollListeners())},highlight:function(t,e){d(this.$(v),p,!1),d(this.$(l(g,t.id)),p,!0),this.highlightedResult=t,this.loadMoreHighlighted=!1,this.selectivity.triggerEvent("selectivity-highlight",{item:t,id:t.id,reason:e&&e.reason||"unspecified"})},highlightLoadMore:function(){d(this.$(v),p,!1),d(this.$(m),p,!0),this.highlightedResult=null,this.loadMoreHighlighted=!0},loadMore:function(){h(this.$(m)),this.resultsContainer.innerHTML+=this.selectivity.template("loading"),this.options.query({callback:function(t){if(!t||!t.results)throw new Error("callback must be passed a response object");this._showResults(f.processItems(t.results),{add:!0,hasMore:!!t.more})}.bind(this),error:this._showResults.bind(this,[],{add:!0}),offset:this.results.length,selectivity:this.selectivity,term:this.term})},position:function(){var t=this.options.position;t&&t(this.el,this.selectivity.el),this._scrolled()},renderItems:function(t){var e=this.selectivity;return t.map(function(t){var i=e.template(t.id?"resultItem":"resultLabel",t);return t.children&&(i+=e.template("resultChildren",{childrenHtml:this.renderItems(t.children)})),i},this).join("")},search:function(t){if(this.term=t,this.options.items){t=f.transformText(t);var e=this.selectivity.options.matcher||f.matcher;this._showResults(this.options.items.map(function(i){return e(i,t)}).filter(function(t){return!!t}),{term:t})}else this.options.query&&this.options.query({callback:function(e){if(!e||!e.results)throw new Error("callback must be passed a response object");this._showResults(f.processItems(e.results),{hasMore:!!e.more,term:t})}.bind(this),error:this.showError.bind(this),offset:0,selectivity:this.selectivity,term:t})},selectHighlight:function(){this.highlightedResult?this.selectItem(this.highlightedResult.id):this.loadMoreHighlighted&&this.loadMore()},selectItem:function(t){var e=f.findNestedById(this.results,t);if(e&&!e.disabled&&e.selectable!==!1){var i={id:t,item:e};this.selectivity.triggerEvent("selectivity-selecting",i)&&this.selectivity.triggerEvent("selectivity-selected",i)}},showError:function(t,e){this.resultsContainer.innerHTML=this.selectivity.template("error",{escape:!e||e.escape!==!1,message:t}),this.hasMore=!1,this.results=[],this.highlightedResult=null,this.loadMoreHighlighted=!1,this.position()},showLoading:function(){this.resultsContainer.innerHTML=this.selectivity.template("loading"),this.hasMore=!1,this.results=[],this.highlightedResult=null,this.loadMoreHighlighted=!1,this.position()},showResults:function(t,e){e.add?h(this.$(".selectivity-loading")):this.resultsContainer.innerHTML="";var i=this.renderItems(this.selectivity.filterResults(t));e.hasMore?i+=this.selectivity.template("loadMore"):i||e.add||(i=this.selectivity.template("noResults",{term:e.term})),this.resultsContainer.innerHTML+=i,this.results=e.add?this.results.concat(t):t,this.hasMore=e.hasMore;var n=this.selectivity.getValue();if(n&&!Array.isArray(n)){var s=f.findNestedById(t,n);s&&this.highlight(s,{reason:"current_value"})}else this.options.highlightFirstItem===!1||e.add&&!this.loadMoreHighlighted||this._highlightFirstItem(t);this.position()},triggerClose:function(){this.selectivity.triggerEvent("selectivity-close")},triggerOpen:function(){this.selectivity.triggerEvent("selectivity-open")},_attachScrollListeners:function(){for(var t=0;t<y.length;t++)window.addEventListener(y[t],this.position,!0);window.addEventListener("resize",this.position)},_highlightFirstItem:function(t){function e(t){for(var i=0,n=t.length;i<n;i++){var s=t[i];if(s.id)return s;if(s.children){var r=e(s.children);if(r)return r}}}var i=e(t);i?this.highlight(i,{reason:"first_result"}):(this.highlightedResult=null,this.loadMoreHighlighted=!1)},_loadMoreClicked:function(t){this.loadMore(),c(t)},_loadMoreHovered:function(t){void 0!==t.screenX&&t.screenX===this._lastMousePosition.x&&void 0!==t.screenY&&t.screenY===this._lastMousePosition.y||(this.highlightLoadMore(),this._recordMousePosition(t))},_recordMousePosition:function(t){this._lastMousePosition={x:t.screenX,y:t.screenY}},_removeScrollListeners:function(){for(var t=0;t<y.length;t++)window.removeEventListener(y[t],this.position,!0);window.removeEventListener("resize",this.position)},_resultClicked:function(t){this.selectItem(this.selectivity.getRelatedItemId(t)),c(t)},_resultHovered:function(t){if(!t.screenX||t.screenX!==this._lastMousePosition.x||!t.screenY||t.screenY!==this._lastMousePosition.y){var e=this.selectivity.getRelatedItemId(t),i=f.findNestedById(this.results,e);i&&!i.disabled&&this.highlight(i,{reason:"hovered"}),this._recordMousePosition(t)}},_scrolled:function(){var t=this.$(m);t&&t.offsetTop-this.resultsContainer.scrollTop<this.el.clientHeight&&this.loadMore()},_showResults:function(t,e){this.showResults(t,r({dropdown:this},e))},_suppressWheel:function(){var t=this.selectivity.options.suppressWheelSelector;if(null!==t){var e=t||".selectivity-results-container";this.events.on("wheel",e,function(t){function i(){c(t),t.preventDefault()}var s=0===t.deltaMode?t.deltaY:40*t.deltaY,r=n(t.target,e),o=r.clientHeight,l=r.scrollHeight,u=r.scrollTop;l>o&&(s<-u?(r.scrollTop=0,i()):s>l-o-u&&(r.scrollTop=l,i()))})}}}),e.exports=f.Dropdown=s},{19:19,33:33,36:36,38:38,39:39,40:40,41:41,42:42,"lodash/extend":"lodash/extend"}],19:[function(t,e,i){"use strict";function n(t,e){this.context=e||null,this.el=t,this.events={},this._onEvent=this._onEvent.bind(this)}var s=(window.jQuery||window.Zepto).extend,r=t(12),o=t(38),l=["blur","focus","mouseenter","mouseleave","scroll"];s(n.prototype,{destruct:function(){Object.keys(this.events).forEach(function(t){var e=l.indexOf(t)>-1;this.el.removeEventListener(t,this._onEvent,e)},this),this.context=null,this.el=null,this.events=null},off:function(t,e,i){if(r(e)||(i=e,e=""),i)for(var n=this.events[t][e],s=0;s<n.length;s++)n[s]===i&&(n.splice(s,1),s--);else this.events[t][e]=[]},on:function(t,e,i){if(r(t)){if(r(e)||(i=e,e=""),!this.events.hasOwnProperty(t)){var n=l.indexOf(t)>-1;this.el.addEventListener(t,this._onEvent,n),this.events[t]={}}this.events[t].hasOwnProperty(e)||(this.events[t][e]=[]),this.events[t][e].indexOf(i)<0&&this.events[t][e].push(i)}else{var s=t;for(var o in s)if(s.hasOwnProperty(o)){var u=o.split(" ");u.length>1?this.on(u[0],u[1],s[o]):this.on(u[0],s[o])}}},_onEvent:function(t){function e(e){for(var i=0;i<e.length;i++)e[i].call(s,t)}var i=!1,n=t.stopPropagation;t.stopPropagation=function(){n.call(t),i=!0};for(var s=this.context,r=t.target,l=this.events[t.type.toLowerCase()];r&&r!==this.el&&!i;){for(var u in l)u&&l.hasOwnProperty(u)&&o(r,u)&&e(l[u]);r=r.parentElement}!i&&l.hasOwnProperty("")&&e(l[""])}}),e.exports=n},{12:12,38:38,"lodash/extend":"lodash/extend"}],20:[function(t,e,i){"use strict";function n(t){var e=t.indexOf("@");if(e===-1||t.indexOf(" ")>-1)return!1;var i=t.lastIndexOf(".");return i===-1?e<t.length-2:!(i>e)||i<t.length-2}function s(t,e){e=void 0===e?t.length:e;for(var i=e-1;i>=0;i--)if(/\s/.test(t[i]))return t.slice(i+1,e);return t.slice(0,e)}function r(t,e){return t.charAt(0)===e[0]&&t.slice(-1)===e[1]?t.slice(1,-1).trim():t.trim()}function o(t){var e=s(t),i=t.slice(0,-e.length).trim();return n(e)?(e=r(r(e,"()"),"<>"),i=r(i,'""').trim()||e,{id:e,text:i}):t.trim()?{id:t,text:t}:null}function l(t,e,i){function r(t){if(t)for(var e=0,i=t.length;e<i;e++)switch(t[e]){case";":case",":case"\n":return!0;case" ":case"\t":if(n(s(t,e)))return!0;break;case'"':do e++;while(e<i&&'"'!==t[e]);break;default:continue}return!1}function l(t){for(var e=0,i=t.length;e<i;e++)switch(t[e]){case";":case",":case"\n":return{term:t.slice(0,e),input:t.slice(e+1)};case" ":case"\t":if(n(s(t,e)))return{term:t.slice(0,e),input:t.slice(e+1)};break;case'"':do e++;while(e<i&&'"'!==t[e]);break;default:continue}return{}}for(;r(t);){var u=l(t);if(u.term){var a=o(u.term);!a||a.id&&c.findById(e,a.id)||i(a)}t=u.input}return t}function u(t){h.call(this,a({createTokenItem:o,showDropdown:!1,tokenizer:l},t)),this.events.on("blur",function(){var t=this.input;t&&n(s(t.value))&&this.add(o(t.value))})}var a=(window.jQuery||window.Zepto).extend,h=t(21),c=t(33);c.inherits(u,h),e.exports=c.Inputs.Email=u},{21:21,33:33,"lodash/extend":"lodash/extend"}],21:[function(t,e,i){"use strict";function n(t){o.call(this,s({positionDropdown:function(t,e){var i=e.getBoundingClientRect(),n=t.clientHeight,r=i.bottom+n>window.innerHeight&&i.top-n>0;s(t.style,{left:i.left+"px",top:(r?i.top-n:i.bottom)+"px",width:i.width+"px"})},showSearchInputInDropdown:!1},t)),this._reset();var e={change:this.rerenderSelection,click:this._clicked,"selectivity-selected":this._resultSelected};e["change "+m]=c,e["click "+g]=this._itemClicked,e["click "+g+"-remove"]=this._itemRemoveClicked,e["keydown "+m]=this._keyHeld,e["keyup "+m]=this._keyReleased,e["paste "+m]=this._onPaste,this.events.on(e)}var s=(window.jQuery||window.Zepto).extend,r=t(12),o=t(33),l=t(36),u=t(37),a=t(39),h=t(40),c=t(41),d=t(42),f=8,p=46,v=13,m=".selectivity-multiple-input",g=".selectivity-multiple-selected-item",y="ontouchstart"in window,w=o.inherits(n,o,{add:function(t){var e=o.isValidId(t),i=e?t:this.validateItem(t)&&t.id;this._value.indexOf(i)===-1&&(this._value.push(i),e&&this.options.initSelection?this.options.initSelection([i],function(e){this._value.indexOf(i)>-1&&(t=this.validateItem(e[0]),this._data.push(t),this.triggerChange({added:t}))}.bind(this)):(e&&(t=this.getItemForId(i)),this._data.push(t),this.triggerChange({added:t}))),this.input.value="",this._updateInputWidth()},clear:function(){this.setData([])},filterResults:function(t){return t.filter(function(t){return!o.findById(this._data,t.id)},this)},getDataForValue:function(t){return t.map(this.getItemForId,this).filter(function(t){return!!t})},getValueForData:function(t){return t.map(function(t){return t.id})},remove:function(t){var e,i=t.id||t,n=o.findIndexById(this._data,i);n>-1&&(e=this._data[n],this._data.splice(n,1)),this._value[n]!==i&&(n=this._value.indexOf(i)),n>-1&&this._value.splice(n,1),e&&this.triggerChange({removed:e}),i===this._highlightedItemId&&(this._highlightedItemId=null),this._updateInputWidth()},rerenderSelection:function(t){t=t||{},t.added?(this._renderSelectedItem(t.added),this._scrollToBottom()):t.removed?h(this.$(l(g,t.removed.id))):(this._forEachSelectedItem(h),this._data.forEach(this._renderSelectedItem,this),this._updateInputWidth()),(t.added||t.removed)&&(this.dropdown&&this.dropdown.showResults(this.filterResults(this.dropdown.results),{hasMore:this.dropdown.hasMore}),y||this.focus()),this.positionDropdown(),this._updatePlaceholder()},search:function(t){this.options.tokenizer&&(t=this.options.tokenizer(t,this._data,this.add.bind(this),this.options),r(t)&&t!==this.input.value&&(this.input.value=t)),this._updateInputWidth(),this.dropdown&&w(this,"search",t)},setOptions:function(t){var e=this.enabled;w(this,"setOptions",t),e!==this.enabled&&this._reset()},validateData:function(t){if(null===t)return[];if(Array.isArray(t))return t.map(this.validateItem,this);throw new Error("Data for MultiSelectivity instance should be an array")},validateValue:function(t){if(null===t)return[];if(Array.isArray(t)){if(t.every(o.isValidId))return t;throw new Error("Value contains invalid IDs")}throw new Error("Value for MultiSelectivity instance should be an array")},_backspacePressed:function(){this.options.backspaceHighlightsBeforeDelete?this._highlightedItemId?this._deletePressed():this._value.length&&this._highlightItem(this._value.slice(-1)[0]):this._value.length&&this.remove(this._value.slice(-1)[0])},_clicked:function(t){this.enabled&&(this.options.showDropdown!==!1?this.open():this.focus(),c(t))},_createToken:function(){var t=this.input.value,e=this.options.createTokenItem;if(t&&e){var i=e(t);i&&this.add(i)}},_deletePressed:function(){this._highlightedItemId&&this.remove(this._highlightedItemId)},_forEachSelectedItem:function(t){Array.prototype.forEach.call(this.el.querySelectorAll(g),t)},_highlightItem:function(t){this._highlightedItemId=t,this._forEachSelectedItem(function(e){d(e,"highlighted",e.getAttribute("data-item-id")===t)}),y||this.focus()},_itemClicked:function(t){this.enabled&&this._highlightItem(this.getRelatedItemId(t))},_itemRemoveClicked:function(t){this.remove(this.getRelatedItemId(t)),c(t)},_keyHeld:function(t){this._originalValue=this.input.value,u(t)!==v||t.ctrlKey||t.preventDefault()},_keyReleased:function(t){var e=!!this._originalValue,i=u(t);i!==v||t.ctrlKey?i!==f||e?i!==p||e||this._deletePressed():this._backspacePressed():this._createToken()},_onPaste:function(){setTimeout(function(){this.search(this.input.value),this._createToken()}.bind(this),10)},_renderSelectedItem:function(t){var e=a(this.template("multipleSelectedItem",s({highlighted:t.id===this._highlightedItemId,removable:!this.options.readOnly},t)));this.input.parentNode.insertBefore(e,this.input)},_reset:function(){this.el.innerHTML=this.template("multipleSelectInput",{enabled:this.enabled}),this._highlightedItemId=null,this.initInput(this.$(m)),this.rerenderSelection()},_resultSelected:function(t){this._value.indexOf(t.id)===-1?this.add(t.item):this.remove(t.item)},_scrollToBottom:function(){var t=this.$(m+"-container");t.scrollTop=t.clientHeight},_updateInputWidth:function(){if(this.enabled){var t=this.input.value||!this._data.length&&this.options.placeholder||"";this.input.setAttribute("size",t.length+2),this.positionDropdown()}},_updatePlaceholder:function(){var t=!this._data.length&&this.options.placeholder||"";this.enabled?this.input.setAttribute("placeholder",t):this.$(".selectivity-placeholder").textContent=t}});e.exports=o.Inputs.Multiple=n},{12:12,33:33,36:36,37:37,39:39,40:40,41:41,42:42,"lodash/extend":"lodash/extend"}],22:[function(t,e,i){"use strict";function n(t){r.call(this,s({positionDropdown:function(t,e){var i=e.getBoundingClientRect(),n=i.bottom,r=Math.min(Math.max(n+t.clientHeight-window.innerHeight,0),i.top+i.height);s(t.style,{left:i.left+"px",top:n-r+"px",width:i.width+"px"})}},t)),this.el.innerHTML=this.template("singleSelectInput",this.options),this.rerenderSelection(),t.showSearchInputInDropdown===!1&&this.initInput(this.$(".selectivity-single-select-input"),{search:!1}),this.events.on({change:this.rerenderSelection,click:this._clicked,"click .selectivity-search-input":o,"click .selectivity-single-selected-item-remove":this._itemRemoveClicked,"focus .selectivity-single-select-input":this._focused,"selectivity-selected":this._resultSelected})}var s=(window.jQuery||window.Zepto).extend,r=t(33),o=t(41),l=r.inherits(n,r,{clear:function(){this.setData(null)},close:function(t){this._closing=!0,l(this,"close"),t&&t.keepFocus&&this.input&&this.input.focus(),this._closing=!1},getDataForValue:function(t){return this.getItemForId(t)},getValueForData:function(t){return t?t.id:null},rerenderSelection:function(){var t=this._data?"singleSelectedItem":"singleSelectPlaceholder",e=this._data?s({removable:this.options.allowClear&&!this.options.readOnly},this._data):{placeholder:this.options.placeholder};this.$(".selectivity-single-result-container").innerHTML=this.template(t,e)},validateData:function(t){return null===t?t:this.validateItem(t)},validateValue:function(t){if(null===t||r.isValidId(t))return t;throw new Error("Value for SingleSelectivity instance should be a valid ID or null")},_clicked:function(){this.enabled&&(this.dropdown?this.close({keepFocus:!0}):this.options.showDropdown!==!1&&this.open())},_focused:function(){!this.enabled||this._closing||this._opening||this.options.showDropdown===!1||this.open()},_itemRemoveClicked:function(t){this.setData(null),o(t)},_resultSelected:function(t){this.setData(t.item),this.close({keepFocus:!0})}});e.exports=r.Inputs.Single=n},{33:33,41:41,"lodash/extend":"lodash/extend"}],23:[function(t,e,i){"use strict";var n=t(7),s=t(33);e.exports=s.Locale={loading:"Loading...",loadMore:"Load more...",noResults:"No results found",ajaxError:function(t){return t?"Failed to fetch results for <b>"+n(t)+"</b>":"Failed to fetch results"},needMoreCharacters:function(t){return"Enter "+t+" more characters to search"},noResultsForTerm:function(t){return"No results for <b>"+n(t)+"</b>"}}},{33:33,7:7}],24:[function(t,e,i){"use strict";function n(t,e,i){return t+(t.indexOf("?")>-1?"&":"?")+e+"="+encodeURIComponent(i)}function s(t,e){var i={};return e.forEach(function(e){void 0!==t[e]&&(i[e]=t[e])}),i}function r(t,e){var i=t.fetch||window.fetch,r=e.term,o="function"==typeof t.url?t.url(e):t.url;if(t.params){var l=t.params(r,e.offset||0);for(var a in l)l.hasOwnProperty(a)&&(o=n(o,a,l[a]))}var h=s(t,["body","cache","credentials","headers","integrity","method","mode","redirect","referrer","referrerPolicy"]);i(o,h,e).then(function(t){if(t.ok)return t.json();if(Array.isArray(t)||t.results)return t;throw new Error("Unexpected AJAX response")}).then(function(t){Array.isArray(t)?e.callback({results:t,more:!1}):e.callback({results:t.results,more:!!t.more})}).catch(function(i){var n=t.formatError||u.ajaxError;e.error(n(r,i),{escape:!1})})}var o=t(6),l=t(33),u=t(23);l.OptionListeners.unshift(function(t,e){var i=e.ajax;if(i&&i.url){var n=i.quietMillis?o(r,i.quietMillis):r;e.query=function(t){var e=i.minimumInputLength-t.term.length;return e>0?void t.error(u.needMoreCharacters(e)):void n(i,t)}}})},{23:23,33:33,6:6}],25:[function(t,e,i){"use strict";var n=t(33),s=0;n.OptionListeners.push(function(t,e){var i=e.query;i&&!i._async&&(e.query=function(t){s++;var e=s,n=t.callback,r=t.error;t.callback=function(){e===s&&n.apply(null,arguments)},t.error=function(){e===s&&r.apply(null,arguments)},i(t)},e.query._async=!0)})},{33:33}],26:[function(t,e,i){"use strict";var n={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":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"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},s=t(33),r=s.transformText;s.transformText=function(t){for(var e="",i=0,s=t.length;i<s;i++){var o=t[i];e+=n[o]||o}return r(e)}},{33:33}],27:[function(t,e,i){"use strict";var n=window.jQuery||window.Zepto,s=t(33);s.OptionListeners.unshift(function(t,e){var i=e.ajax;i&&i.url&&!i.fetch&&n.Deferred&&(i.fetch=function(t,e){return n.ajax(t,{cache:"no-cache"!==e.cache,headers:e.headers||null,method:e.method||"GET",xhrFields:"include"===e.credentials?{withCredentials:!0}:null}).then(function(t){return{results:n.map(t,function(t){return t}),more:!1}},function(t,e,i){throw new Error("AJAX request returned: "+e+(i?", "+i:""))})})})},{33:33,jquery:"jquery"}],28:[function(t,e,i){"use strict";function n(t,e){var i=e.multiple?[]:null,n=function(){var t=r(this);if(t.is("option")){var s=t.text(),o=t.attr("value");
      if(void 0===o&&(o=s),t.prop("selected")){var l={id:o,text:s};e.multiple?i.push(l):i=l}return{id:o,text:t.attr("label")||s}}return{text:t.attr("label"),children:t.children("option,optgroup").map(n).get()}};e.allowClear="allowClear"in e?e.allowClear:!t.prop("required");var s=t.children("option,optgroup").map(n).get();e.data=i,e.items=e.query?null:s,e.placeholder=e.placeholder||t.data("placeholder")||"",e.tabIndex=void 0===e.tabIndex?t.attr("tabindex")||0:e.tabIndex;var o=(t.attr("class")||"selectivity-input").split(" ");o.indexOf("selectivity-input")<0&&o.push("selectivity-input");var l=r("<div>").attr({id:"s9y_"+t.attr("id"),class:o.join(" "),style:t.attr("style"),"data-name":t.attr("name")});return l.insertAfter(t),t.hide(),l[0]}function s(t){var e=r(t.el);e.on("change",function(t){var i=t.originalEvent.value;e.prev("select").val("array"===r.type(i)?i.slice(0):i).trigger(t)})}var r=window.jQuery||window.Zepto,o=t(33);o.OptionListeners.push(function(t,e){var i=r(t.el);i.is("select")&&(i.attr("autofocus")&&setTimeout(function(){t.focus()},1),t.el=n(i,e),t.el.selectivity=t,o.patchEvents(i),s(t))})},{33:33,jquery:"jquery"}],29:[function(t,e,i){"use strict";function n(t,e){function i(e,n){function o(){var t;e.highlightedResult?t=r(u,e.highlightedResult.id):e.loadMoreHighlighted&&(t=e.$(".selectivity-load-more")),t&&t.scrollIntoView(n<0)}var l=e.results;if(l.length){var u=[].slice.call(e.el.querySelectorAll(".selectivity-result-item"));if(e.submenu)return void i(e.submenu,n);var a=n>0?0:u.length-1,h=a,c=e.highlightedResult;if(c){var d=r(u,c.id);if(h=u.indexOf(d)+n,n>0?h>=u.length:h<0){if(e.hasMore)return e.highlightLoadMore(),void o();h=a}}var f=u[h],p=s.findNestedById(l,t.getRelatedItemId(f));p&&(e.highlight(p,{delay:!!p.submenu}),o())}}function n(n){var s=t.dropdown;if(s){var r=o(n);if(r===l){if(!e.value){if(s.submenu){for(var h=s.submenu;h.submenu;)h=h.submenu;v=h}n.preventDefault(),p=!0}}else r===u?i(s,1):r===d?i(s,-1):r===c?setTimeout(function(){t.close()},1):r===a&&n.preventDefault()}}function f(e){function i(){t.options.showDropdown!==!1&&t.open()}var n=t.dropdown,s=o(e);p?(e.preventDefault(),p=!1,v&&(v.close(),t.focus(),v=null)):s===l?!n&&t.options.allowClear&&t.clear():s!==a||e.ctrlKey?s===h?(t.close(),e.preventDefault()):s===u||s===d?(i(),e.preventDefault()):i():(n?n.selectHighlight():t.options.showDropdown!==!1&&i(),e.preventDefault())}var p=!1,v=null;e.addEventListener("keydown",n),e.addEventListener("keyup",f)}var s=t(33),r=t(35),o=t(37),l=8,u=40,a=13,h=27,c=9,d=38;s.InputListeners.push(n)},{33:33,35:35,37:37}],30:[function(t,e,i){"use strict";function n(t,e){this.parentMenu=e.parentMenu,s.call(this,t,e),this._closeSubmenuTimeout=0,this._openSubmenuTimeout=0}var s=t(18),r=t(33),o=t(35),l=r.inherits(n,s,{close:function(){this.submenu&&this.submenu.close(),l(this,"close"),this.parentMenu&&(this.parentMenu.submenu=null,this.parentMenu=null),clearTimeout(this._closeSubmenuTimeout),clearTimeout(this._openSubmenuTimeout)},highlight:function(t,e){e=e||{};var i=e.reason||"unspecified";e.delay?(l(this,"highlight",t),clearTimeout(this._openSubmenuTimeout),this._openSubmenuTimeout=setTimeout(this._doHighlight.bind(this,t,i),300)):this.submenu?this.highlightedResult&&this.highlightedResult.id===t.id?this._doHighlight(t,i):(clearTimeout(this._closeSubmenuTimeout),this._closeSubmenuTimeout=setTimeout(this._closeSubmenuAndHighlight.bind(this,t,i),100)):(this.parentMenu&&this.parentMenu._closeSubmenuTimeout&&(clearTimeout(this.parentMenu._closeSubmenuTimeout),this.parentMenu._closeSubmenuTimeout=0),e.openSubmenu===!1?l(this,"highlight",t):this._doHighlight(t,i))},search:function(t){if(this.submenu){var e=this.$(".selectivity-search-input");if(!e||e!==document.activeElement)return void this.submenu.search(t);this.submenu.close()}l(this,"search",t)},selectHighlight:function(){this.submenu?this.submenu.selectHighlight():l(this,"selectHighlight")},showResults:function(t,e){function i(t){t.children&&t.children.forEach(i),t.submenu&&(t.selectable=!!t.selectable)}this.submenu&&e.dropdown!==this?this.submenu.showResults(t,e):(t.forEach(i),l(this,"showResults",t,e))},triggerClose:function(){this.parentMenu?this.selectivity.triggerEvent("selectivity-close-submenu"):l(this,"triggerClose")},triggerOpen:function(){this.parentMenu?this.selectivity.triggerEvent("selectivity-open-submenu"):l(this,"triggerOpen")},_closeSubmenuAndHighlight:function(t,e){this.submenu&&this.submenu.close(),this._doHighlight(t,e)},_doHighlight:function(t,e){l(this,"highlight",t);var i=this.selectivity.options;if(!(!t.submenu||this.submenu||i.shouldOpenSubmenu&&i.shouldOpenSubmenu(t,e)===!1)){var n=i.dropdown||r.Dropdown;if(n){var s=this.el.querySelectorAll(".selectivity-result-item"),u=o(s,t.id),a=this.el;this.submenu=new n(this.selectivity,{highlightFirstItem:!t.selectable,items:t.submenu.items||null,parentMenu:this,position:function(e,i){if(t.submenu.positionDropdown)t.submenu.positionDropdown(e,i,u,a);else{var n=a.getBoundingClientRect(),s=n.right,r=n.width;s+r>document.body.clientWidth&&n.left-r>0&&(s=n.left-r+10),e.style.left=s+"px",e.style.top=u.getBoundingClientRect().top+"px",e.style.width=r+"px"}},query:t.submenu.query||null,showSearchInput:t.submenu.showSearchInput}),this.submenu.search("")}}}});r.Dropdown=n,e.exports=n},{18:18,33:33,35:35}],31:[function(t,e,i){"use strict";function n(t,e,i,n){function s(t){return!!t&&u.some(function(e){return t.indexOf(e)>-1})}function o(t){for(var e=0,i=t.length;e<i;e++)if(u.indexOf(t[e])>-1)return{term:t.slice(0,e),input:t.slice(e+1)};return{}}for(var l=n.createTokenItem||function(t){return t?{id:t,text:t}:null},u=n.tokenSeparators;s(t);){var a=o(t);if(a.term){var h=l(a.term);h&&!r.findById(e,h.id)&&i(h)}t=a.input}return t}var s=(window.jQuery||window.Zepto).extend,r=t(33);r.OptionListeners.push(function(t,e){e.tokenSeparators&&(e.allowedTypes=s({tokenSeparators:"array"},e.allowedTypes),e.tokenizer=e.tokenizer||n)})},{33:33,"lodash/extend":"lodash/extend"}],32:[function(t,e,i){t(18),t(20),t(21),t(22),t(23),t(24),t(25),t(26),t(27),t(28),t(29),t(30),t(31),t(34),t(17)},{17:17,18:18,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,34:34}],33:[function(t,e,i){"use strict";function n(t){this.dropdown=null,this.el=t.element,this.enabled=!t.readOnly&&!t.removeOnly,this.input=null,this.items=null,this.options={},this.templates=s({},n.Templates),this.term="",this.setOptions(t),t.value?this.setValue(t.value,{triggerChange:!1}):this.setData(t.data||null,{triggerChange:!1}),this.el.setAttribute("tabindex",t.tabIndex||0),this.events=new o(this.el,this),this.events.on({blur:this._blur,mouseenter:this._mouseenter,mouseleave:this._mouseleave,"selectivity-close":this._closed})}var s=(window.jQuery||window.Zepto).extend,r=t(12),o=t(19),l=t(42);s(n.prototype,{$:function(t){return this.el.querySelector(t)},close:function(){this._clearCloseTimeout(),this.dropdown&&(this.dropdown.close(),this.dropdown=null)},destroy:function(){this.events.destruct();for(var t=this.el;t.firstChild;)t.removeChild(t.firstChild);t.selectivity=null},filterResults:function(t){return t},focus:function(){this._clearCloseTimeout(),this._focusing=!0,this.input&&this.input.focus(),this._focusing=!1},getData:function(){return this._data},getItemForId:function(t){var e=this.items;return e?n.findNestedById(e,t):{id:t,text:""+t}},getRelatedItemId:function(t){for(var e=t.target||t;e&&!e.hasAttribute("data-item-id");)e=e.parentNode;if(!e)return null;var i=e.getAttribute("data-item-id");if(n.findById(this._data||[],i))return i;for(var s=this.dropdown;s;){if(n.findNestedById(s.results,i))return i;s=s.submenu}var r=parseInt(i,10);return""+r===i?r:i},getValue:function(){return this._value},initInput:function(t,e){this.input=t;var i=this,s=this.options.inputListeners||n.InputListeners;s.forEach(function(n){n(i,t,e)}),e&&e.search===!1||t.addEventListener("keyup",function(t){t.defaultPrevented||i.search(t.target.value)})},open:function(){if(!this._opening&&!this.dropdown&&this.triggerEvent("selectivity-opening")){this._opening=!0;var t=this.options.dropdown||n.Dropdown;t&&(this.dropdown=new t(this,{items:this.items,position:this.options.positionDropdown,query:this.options.query,showSearchInput:this.options.showSearchInputInDropdown!==!1})),this.search(""),this.focus(),l(this.el,"open",!0),this._opening=!1}},positionDropdown:function(){this.dropdown&&this.dropdown.position()},search:function(t){this.open(),this.dropdown&&this.dropdown.search(t)},setData:function(t,e){e=e||{},t=this.validateData(t),this._data=t,this._value=this.getValueForData(t),e.triggerChange!==!1&&this.triggerChange()},setOptions:function(t){t=t||{};var e=this;n.OptionListeners.forEach(function(i){i(e,t)}),"items"in t&&(this.items=t.items?n.processItems(t.items):null),"templates"in t&&s(this.templates,t.templates),s(this.options,t),this.enabled=!this.options.readOnly&&!this.options.removeOnly},setValue:function(t,e){e=e||{},t=this.validateValue(t),this._value=t,this.options.initSelection?this.options.initSelection(t,function(i){this._value===t&&(this._data=this.validateData(i),e.triggerChange!==!1&&this.triggerChange())}.bind(this)):(this._data=this.getDataForValue(t),e.triggerChange!==!1&&this.triggerChange())},template:function(t,e){var i=this.templates[t];if(!i)throw new Error("Unknown template: "+t);return"function"==typeof i?i(e):i.render?i.render(e):i.toString()},triggerChange:function(t){var e=s({value:this._value},t);this.triggerEvent("change",e),this.triggerEvent("selectivity-change",e)},triggerEvent:function(t,e){var i=document.createEvent("Event");return i.initEvent(t,!1,!0),s(i,e),this.el.dispatchEvent(i),!i.defaultPrevented},validateItem:function(t){if(t&&n.isValidId(t.id)&&r(t.text))return t;throw new Error("Item should have id (number or string) and text (string) properties")},_blur:function(){this._focusing||this.el.classList.contains("hover")||(this._clearCloseTimeout(),this._closeTimeout=setTimeout(this.close.bind(this),166))},_clearCloseTimeout:function(){this._closeTimeout&&(clearTimeout(this._closeTimeout),this._closeTimeout=0)},_closed:function(){this.dropdown=null,l(this.el,"open",!1)},_mouseleave:function(){l(this.el,"hover",!1)},_mouseenter:function(){l(this.el,"hover",!0)}}),n.Dropdown=null,n.InputListeners=[],n.Inputs={},n.OptionListeners=[],n.Templates={},n.findById=function(t,e){var i=n.findIndexById(t,e);return i>-1?t[i]:null},n.findIndexById=function(t,e){for(var i=0,n=t.length;i<n;i++)if(t[i].id===e)return i;return-1},n.findNestedById=function(t,e){for(var i=0,s=t.length;i<s;i++){var r,o=t[i];if(o.id===e?r=o:o.children?r=n.findNestedById(o.children,e):o.submenu&&o.submenu.items&&(r=n.findNestedById(o.submenu.items,e)),r)return r}return null},n.inherits=function(t,e,i){return t.prototype=s(Object.create(e.prototype),{constructor:t},i),function(t,i){e.prototype[i].apply(t,Array.prototype.slice.call(arguments,2))}},n.isValidId=function(t){return"number"==typeof t||r(t)},n.matcher=function(t,e){var i=null;if(n.transformText(t.text).indexOf(e)>-1)i=t;else if(t.children){var s=t.children.map(function(t){return n.matcher(t,e)}).filter(function(t){return!!t});s.length&&(i={id:t.id,text:t.text,children:s})}return i},n.processItem=function(t){if(n.isValidId(t))return{id:t,text:""+t};if(t&&(n.isValidId(t.id)||t.children)&&r(t.text))return t.children&&(t.children=n.processItems(t.children)),t;throw new Error("invalid item")},n.processItems=function(t){if(Array.isArray(t))return t.map(n.processItem);throw new Error("invalid items")},n.transformText=function(t){return t.toLowerCase()},e.exports=n},{12:12,19:19,42:42,"lodash/extend":"lodash/extend"}],34:[function(t,e,i){"use strict";var n=t(7),s=t(33),r=t(23);s.Templates={dropdown:function(t){var e=t.dropdownCssClass?" "+t.dropdownCssClass:"",i="";if(t.showSearchInput){e+=" has-search-input";var s=t.searchInputPlaceholder;i='<div class="selectivity-search-input-container"><input type="text" class="selectivity-search-input"'+(s?' placeholder="'+n(s)+'"':"")+"></div>"}return'<div class="selectivity-dropdown'+e+'">'+i+'<div class="selectivity-results-container"></div></div>'},error:function(t){return'<div class="selectivity-error">'+(t.escape?n(t.message):t.message)+"</div>"},loading:function(){return'<div class="selectivity-loading">'+r.loading+"</div>"},loadMore:function(){return'<div class="selectivity-load-more">'+r.loadMore+"</div>"},multipleSelectInput:function(t){return'<div class="selectivity-multiple-input-container">'+(t.enabled?'<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" class="selectivity-multiple-input">':'<div class="selectivity-multiple-input selectivity-placeholder"></div>')+'<div class="selectivity-clearfix"></div></div>'},multipleSelectedItem:function(t){var e=t.highlighted?" highlighted":"";return'<span class="selectivity-multiple-selected-item'+e+'" data-item-id="'+n(t.id)+'">'+(t.removable?'<a class="selectivity-multiple-selected-item-remove"><i class="fa fa-remove"></i></a>':"")+n(t.text)+"</span>"},noResults:function(t){return'<div class="selectivity-error">'+(t.term?r.noResultsForTerm(t.term):r.noResults)+"</div>"},resultChildren:function(t){return'<div class="selectivity-result-children">'+t.childrenHtml+"</div>"},resultItem:function(t){return'<div class="selectivity-result-item'+(t.disabled?" disabled":"")+'" data-item-id="'+n(t.id)+'">'+n(t.text)+(t.submenu?'<i class="selectivity-submenu-icon fa fa-chevron-right"></i>':"")+"</div>"},resultLabel:function(t){return'<div class="selectivity-result-label">'+n(t.text)+"</div>"},singleSelectInput:'<div class="selectivity-single-select"><input type="text" class="selectivity-single-select-input"><div class="selectivity-single-result-container"></div><i class="fa fa-sort-desc selectivity-caret"></i></div>',singleSelectPlaceholder:function(t){return'<div class="selectivity-placeholder">'+n(t.placeholder)+"</div>"},singleSelectedItem:function(t){return'<span class="selectivity-single-selected-item" data-item-id="'+n(t.id)+'">'+(t.removable?'<a class="selectivity-single-selected-item-remove"><i class="fa fa-remove"></i></a>':"")+n(t.text)+"</span>"},selectCompliance:function(t){var e=t.mode,i=t.name;return"multiple"===e&&"[]"!==i.slice(-2)&&(i+="[]"),'<select name="'+i+'"'+("multiple"===e?" multiple":"")+"></select>"},selectOptionCompliance:function(t){return'<option value="'+n(t.id)+'" selected>'+n(t.text)+"</option>"}}},{23:23,33:33,7:7}],35:[function(t,e,i){"use strict";e.exports=function(t,e){for(var i=0,n=t.length;i<n;i++){var s=t[i],r=s.getAttribute("data-item-id");if(("number"==typeof e?parseInt(r,10):r)===e)return s}return null}},{}],36:[function(t,e,i){"use strict";e.exports=function(t,e){var i='"'+(""+e).replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';return t+"[data-item-id="+i+"]"}},{}],37:[function(t,e,i){"use strict";e.exports=function(t){return t.which||t.keyCode||0}},{}],38:[function(t,e,i){"use strict";e.exports=function(t,e){var i=t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector;return i.call(t,e)}},{}],39:[function(t,e,i){"use strict";e.exports=function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstChild}},{}],40:[function(t,e,i){"use strict";e.exports=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)}},{}],41:[function(t,e,i){"use strict";e.exports=function(t){t.stopPropagation()}},{}],42:[function(t,e,i){"use strict";e.exports=function(t,e,i){t&&t.classList[i?"add":"remove"](e)}},{}]},{},[32])(32)});