text: !function(e,t,i){"use strict";function n(e){return e?String(e).replace(/[&<>"']/g,function(e){return{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}[e]}):""}var s=i("#single-select-box").find("option").map(function(){return this.textContent}).get(),r=i("#multiple-select-box").find("optgroup").map(function(){return{text:this.getAttribute("label"),children:i(this).find("option").map(function(){return{id:parseInt(this.getAttribute("value"),10),text:this.textContent}}).get()}}).get(),o=i("#multiple-select-box").find("option").map(function(){return{id:this.textContent,timezone:this.getAttribute("data-timezone")}}).get(),u=i.fn.selectivity.transformText;function l(e){var t,i=e.selectivity,r=e.term,n=e.offset||0;if("single-input-with-submenus"===i.$el.attr("id")){if(!i.dropdown)return void e.callback({more:!1,results:[]});var l=i.dropdown.highlightedResult.id;t=o.filter(function(e){return-1<u(e.id).indexOf(u(r))&&e.timezone===l}).map(function(e){return e.id})}else t=s.filter(function(e){return-1<u(e).indexOf(u(r))});t.sort(function(e,t){e=u(e),t=u(t);var i=e.slice(0,r.length)===r,n=t.slice(0,r.length)===r;return i?n&&t<e?1:-1:n?1:t<e?1:-1}),setTimeout(function(){e.callback({more:t.length>n+10,results:t.slice(n,n+10)})},500)}i(".single-input").selectivity({allowClear:!0,placeholder:"No city selected",query:l,searchInputPlaceholder:"Type to search a city"}),i(".single-input-without-search").selectivity({allowClear:!0,items:s,placeholder:"No city selected"}),i(".single-input-with-labels").selectivity({allowClear:!0,items:r,placeholder:"No city selected",searchInputPlaceholder:"Type to search a city"});var c={query:l,showSearchInput:!0};i(".single-input-with-submenus").selectivity({allowClear:!0,items:[{text:"Western European Time Zone",id:"+00:00",submenu:c},{text:"Central European Time Zone",id:"+01:00",submenu:c},{text:"Eastern European Time Zone",id:"+02:00",submenu:c}],placeholder:"No city selected",showSearchInputInDropdown:!1}),i(".multiple-input").selectivity({multiple:!0,placeholder:"Type to search cities",query:l}),i(".tags-input").selectivity({items:["red","green","blue"],multiple:!0,tokenSeparators:[" "],value:["brown","red","green"]}),i(".emails-input").selectivity({inputType:"Email",placeholder:"Type or paste email addresses"}),i(".single-select-box").selectivity(),i(".without-search-box").selectivity({showSearchInputInDropdown:!1}),i(".multiple-select-box").selectivity(),i(".repository-input").selectivity({ajax:{url:"https://api.github.com/search/repositories",dataType:"json",minimumInputLength:3,quietMillis:250,params:function(e,t){return{q:e,page:1+Math.floor(t/30)}},processItem:function(e){return{id:e.id,text:e.name,description:e.description}},results:function(e,t){return{results:e.items,more:e.total_count>t+e.items.length}}},placeholder:"Search for a repository",templates:{resultItem:function(e){return'<div class="selectivity-result-item" data-item-id="'+e.id+'"><b>'+n(e.text)+"</b><br>"+n(e.description)+"</div>"}}})}(window,document,jQuery);