!function(n,t){void 0===n&&void 0!==window&&(n=window);"function"==typeof define&&define.amd?define(["jquery"],function(n){return t(n)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(n.jQuery)}(this,function(n){!function(n){"use strict";function l(n){var i,r=[],u=n&&n.options,t,f;if(n.multiple)for(t=0,f=u.length;t<f;t++)(i=u[t]).selected&&r.push(i.value||i.text);else r=n.value;return r}function g(n,t,i,r){for(var e,u,o=["content","subtext","tokens"],s=!1,f=0;f<o.length;f++)if(e=o[f],u=n[e],u&&(u=u.toString(),"content"===e&&(u=u.replace(/<[^>]+>/g,"")),r&&(u=ft(u)),u=u.toUpperCase(),s="contains"===i?0<=u.indexOf(t):u.startsWith(t)))break;return s}function u(n){return parseInt(n,10)||0}function ft(t){return n.each([{re:/[\xC0-\xC6]/g,ch:"A"},{re:/[\xE0-\xE6]/g,ch:"a"},{re:/[\xC8-\xCB]/g,ch:"E"},{re:/[\xE8-\xEB]/g,ch:"e"},{re:/[\xCC-\xCF]/g,ch:"I"},{re:/[\xEC-\xEF]/g,ch:"i"},{re:/[\xD2-\xD6]/g,ch:"O"},{re:/[\xF2-\xF6]/g,ch:"o"},{re:/[\xD9-\xDC]/g,ch:"U"},{re:/[\xF9-\xFC]/g,ch:"u"},{re:/[\xC7-\xE7]/g,ch:"c"},{re:/[\xD1]/g,ch:"N"},{re:/[\xF1]/g,ch:"n"}],function(){t=t?t.replace(this.re,this.ch):""}),t}function rt(u){var e,o=arguments,f=u,s;if([].shift.apply(o),!r.success){try{r.full=(n.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".")}catch(u){r.full=i.BootstrapVersion.split(" ")[0].split(".")}r.major=r.full[0];r.success=!0;"4"===r.major&&(t.DIVIDER="dropdown-divider",t.SHOW="show",t.BUTTONCLASS="btn-light",i.DEFAULTS.style=t.BUTTONCLASS="btn-light",t.POPOVERHEADER="popover-header")}return s=this.each(function(){var u=n(this),t,r,s,h;if(u.is("select")){if(t=u.data("selectpicker"),r="object"==typeof f&&f,t){if(r)for(s in r)r.hasOwnProperty(s)&&(t.options[s]=r[s])}else h=n.extend({},i.DEFAULTS,n.fn.selectpicker.defaults||{},u.data(),r),h.template=n.extend({},i.DEFAULTS.template,n.fn.selectpicker.defaults?n.fn.selectpicker.defaults.template:{},u.data().template,r.template),u.data("selectpicker",t=new i(this,h));"string"==typeof f&&(e=t[f]instanceof Function?t[f].apply(t,o):t.options[f])}}),void 0!==e?e:s}var s,w,c,b=document.createElement("_"),k,f,e,d,t,p,ut;(b.classList.toggle("c3",!1),b.classList.contains("c3"))&&(k=DOMTokenList.prototype.toggle,DOMTokenList.prototype.toggle=function(n,t){return 1 in arguments&&!this.contains(n)==!t?t:k.call(this,n)});String.prototype.startsWith||(s=function(){try{var n={},t=Object.defineProperty,i=t(n,n,n)&&t}catch(n){}return i}(),w={}.toString,c=function(n){var r,u,i;if(null==this)throw new TypeError;if(r=String(this),n&&"[object RegExp]"==w.call(n))throw new TypeError;var f=r.length,e=String(n),o=e.length,s=1<arguments.length?arguments[1]:void 0,t=s?Number(s):0;if(t!=t&&(t=0),u=Math.min(Math.max(t,0),f),f<o+u)return!1;for(i=-1;++i<o;)if(r.charCodeAt(u+i)!=e.charCodeAt(i))return!1;return!0},s?s(String.prototype,"startsWith",{value:c,configurable:!0,writable:!0}):String.prototype.startsWith=c);Object.keys||(Object.keys=function(n,t,i){for(t in i=[],n)i.hasOwnProperty.call(n,t)&&i.push(t);return i});f={useDefault:!1,_set:n.valHooks.select.set};n.valHooks.select.set=function(t,i){return i&&!f.useDefault&&n(t).data("selected",!0),f._set.apply(this,arguments)};e=null;d=function(){try{return new Event("change"),!0}catch(n){return!1}}();n.fn.triggerNative=function(n){var t,i=this[0];i.dispatchEvent?(d?t=new Event(n,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(n,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=n,i.fireEvent("on"+n,t)):this.trigger(n)};var nt=function(n){var i=function(t){return n[t]},t="(?:"+Object.keys(n).join("|")+")",r=RegExp(t),u=RegExp(t,"g");return function(n){return n=null==n?"":""+n,r.test(n)?n.replace(u,i):n}},h=nt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"}),et=nt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x60;":"`"}),ot={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},tt=27,it=13,o=32,a=9,v=38,y=40,r={success:!1,major:"3"};try{r.full=(n.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".");r.major=r.full[0];r.success=!0}catch(s){console.warn("There was an issue retrieving Bootstrap's version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.",s)}t={DISABLED:"disabled",DIVIDER:"divider",SHOW:"open",DROPUP:"dropup",MENU:"dropdown-menu",MENURIGHT:"dropdown-menu-right",MENULEFT:"dropdown-menu-left",BUTTONCLASS:"btn-default",POPOVERHEADER:"popover-title"};p={MENU:"."+t.MENU};"4"===r.major&&(t.DIVIDER="dropdown-divider",t.SHOW="show",t.BUTTONCLASS="btn-light",t.POPOVERHEADER="popover-header");var st=new RegExp(v+"|"+y),ht=new RegExp("^"+a+"$|"+tt),i=(new RegExp(it+"|"+o),function(t,r){var e=this,u;f.useDefault||(n.valHooks.select.set=f._set,f.useDefault=!0);this.$element=n(t);this.$newElement=null;this.$button=null;this.$menu=null;this.options=r;this.selectpicker={main:{map:{newIndex:{},originalIndex:{}}},current:{map:{}},search:{map:{}},view:{},keydown:{keyHistory:"",resetKeyHistory:{start:function(){return setTimeout(function(){e.selectpicker.keydown.keyHistory=""},800)}}}};null===this.options.title&&(this.options.title=this.$element.attr("title"));u=this.options.windowPadding;"number"==typeof u&&(this.options.windowPadding=[u,u,u,u]);this.val=i.prototype.val;this.render=i.prototype.render;this.refresh=i.prototype.refresh;this.setStyle=i.prototype.setStyle;this.selectAll=i.prototype.selectAll;this.deselectAll=i.prototype.deselectAll;this.destroy=i.prototype.destroy;this.remove=i.prototype.remove;this.show=i.prototype.show;this.hide=i.prototype.hide;this.init()});i.VERSION="1.13.2";i.BootstrapVersion=r.major;i.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(n){return 1==n?"{0} item selected":"{0} items selected"},maxOptionsText:function(n,t){return[1==n?"Limit reached ({n} item max)":"Limit reached ({n} items max)",1==t?"Group limit reached ({n} item max)":"Group limit reached ({n} items max)"]},selectAllText:"Select All",deselectAllText:"Deselect All",doneButton:!1,doneButtonText:"Close",multipleSeparator:", ",styleBase:"btn",style:t.BUTTONCLASS,size:"auto",title:null,selectedTextFormat:"values",width:!1,container:!1,hideDisabled:!1,showSubtext:!1,showIcon:!0,showContent:!0,dropupAuto:!0,header:!1,liveSearch:!1,liveSearchPlaceholder:null,liveSearchNormalize:!1,liveSearchStyle:"contains",actionsBox:!1,iconBase:"glyphicon",tickIcon:"glyphicon-ok",showTick:!1,template:{caret:'<span class="caret"><\/span>'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1};"4"===r.major&&(i.DEFAULTS.style="btn-light",i.DEFAULTS.iconBase="",i.DEFAULTS.tickIcon="bs-ok-default");i.prototype={constructor:i,init:function(){var n=this,i=this.$element.attr("id");this.$element.addClass("bs-select-hidden");this.multiple=this.$element.prop("multiple");this.autofocus=this.$element.prop("autofocus");this.$newElement=this.createDropdown();this.createLi();this.$element.after(this.$newElement).prependTo(this.$newElement);this.$button=this.$newElement.children("button");this.$menu=this.$newElement.children(p.MENU);this.$menuInner=this.$menu.children(".inner");this.$searchbox=this.$menu.find("input");this.$element.removeClass("bs-select-hidden");!0===this.options.dropdownAlignRight&&this.$menu.addClass(t.MENURIGHT);void 0!==i&&this.$button.attr("data-id",i);this.checkDisabled();this.clickListener();this.options.liveSearch&&this.liveSearchListener();this.render();this.setStyle();this.setWidth();this.options.container?this.selectPosition():this.$element.on("hide.bs.select",function(){if(n.isVirtual()){var t=n.$menuInner[0],i=t.firstChild.cloneNode(!1);t.replaceChild(i,t.firstChild);t.scrollTop=0}});this.$menu.data("this",this);this.$newElement.data("this",this);this.options.mobile&&this.mobile();this.$newElement.on({"hide.bs.dropdown":function(t){n.$menuInner.attr("aria-expanded",!1);n.$element.trigger("hide.bs.select",t)},"hidden.bs.dropdown":function(t){n.$element.trigger("hidden.bs.select",t)},"show.bs.dropdown":function(t){n.$menuInner.attr("aria-expanded",!0);n.$element.trigger("show.bs.select",t)},"shown.bs.dropdown":function(t){n.$element.trigger("shown.bs.select",t)}});n.$element[0].hasAttribute("required")&&this.$element.on("invalid",function(){n.$button.addClass("bs-invalid");n.$element.on({"shown.bs.select":function(){n.$element.val(n.$element.val()).off("shown.bs.select")},"rendered.bs.select":function(){this.validity.valid&&n.$button.removeClass("bs-invalid");n.$element.off("rendered.bs.select")}});n.$button.on("blur.bs.select",function(){n.$element.focus().blur();n.$button.off("blur.bs.select")})});setTimeout(function(){n.$element.trigger("loaded.bs.select")})},createDropdown:function(){var i=this.multiple||this.options.showTick?" show-tick":"",u=this.autofocus?" autofocus":"",f=this.options.header?'<div class="'+t.POPOVERHEADER+'"><button type="button" class="close" aria-hidden="true">&times;<\/button>'+this.options.header+"<\/div>":"",e=this.options.liveSearch?'<div class="bs-searchbox"><input type="text" class="form-control" autocomplete="off"'+(null===this.options.liveSearchPlaceholder?"":' placeholder="'+h(this.options.liveSearchPlaceholder)+'"')+' role="textbox" aria-label="Search"><\/div>':"",o=this.multiple&&this.options.actionsBox?'<div class="bs-actionsbox"><div class="btn-group btn-group-sm btn-block"><button type="button" class="actions-btn bs-select-all btn '+t.BUTTONCLASS+'">'+this.options.selectAllText+'<\/button><button type="button" class="actions-btn bs-deselect-all btn '+t.BUTTONCLASS+'">'+this.options.deselectAllText+"<\/button><\/div><\/div>":"",s=this.multiple&&this.options.doneButton?'<div class="bs-donebutton"><div class="btn-group btn-block"><button type="button" class="btn btn-sm '+t.BUTTONCLASS+'">'+this.options.doneButtonText+"<\/button><\/div><\/div>":"",c='<div class="dropdown bootstrap-select'+i+'"><button type="button" class="'+this.options.styleBase+' dropdown-toggle" '+("static"===this.options.display?'data-display="static"':"")+'data-toggle="dropdown"'+u+' role="button"><div class="filter-option"><div class="filter-option-inner"><div class="filter-option-inner-inner"><\/div><\/div> <\/div>'+("4"===r.major?"":'<span class="bs-caret">'+this.options.template.caret+"<\/span>")+'<\/button><div class="'+t.MENU+" "+("4"===r.major?"":t.SHOW)+'" role="combobox">'+f+e+o+'<div class="inner '+t.SHOW+'" role="listbox" aria-expanded="false" tabindex="-1"><ul class="'+t.MENU+" inner "+("4"===r.major?t.SHOW:"")+'"><\/ul><\/div>'+s+"<\/div><\/div>";return n(c)},setPositionData:function(){var t,n,i;for(this.selectpicker.view.canHighlight=[],t=0;t<this.selectpicker.current.data.length;t++)n=this.selectpicker.current.data[t],i=!0,"divider"===n.type?(i=!1,n.height=this.sizeInfo.dividerHeight):"optgroup-label"===n.type?(i=!1,n.height=this.sizeInfo.dropdownHeaderHeight):n.height=this.sizeInfo.liHeight,n.disabled&&(i=!1),this.selectpicker.view.canHighlight.push(i),n.position=(0===t?0:this.selectpicker.current.data[t-1].position)+n.height},isVirtual:function(){return!1!==this.options.virtualScroll&&this.selectpicker.main.elements.length>=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(t,i){function o(n,i){var y,p,nt,tt,b,it,rt,k,d,s=r.selectpicker.current.elements.length,g=[],h=void 0,ut=!0,l=r.isVirtual(),o,w,ht,a,v;for(r.selectpicker.view.scrollTop=n,!0===l&&r.sizeInfo.hasScrollBar&&r.$menu[0].offsetWidth>r.sizeInfo.totalMenuWidth&&(r.sizeInfo.menuWidth=r.$menu[0].offsetWidth,r.sizeInfo.totalMenuWidth=r.sizeInfo.menuWidth+r.sizeInfo.scrollBarWidth,r.$menu.css("min-width",r.sizeInfo.menuWidth)),y=Math.ceil(r.sizeInfo.menuInnerHeight/r.sizeInfo.liHeight*1.5),p=Math.round(s/y)||1,o=0;o<p;o++){if(w=(o+1)*y,o===p-1&&(w=s),g[o]=[o*y+(o?1:0),w],!s)break;void 0===h&&n<=r.selectpicker.current.data[w-1].position-r.sizeInfo.menuInnerHeight&&(h=o)}if(void 0===h&&(h=0),b=[r.selectpicker.view.position0,r.selectpicker.view.position1],nt=Math.max(0,h-1),tt=Math.min(p-1,h+1),r.selectpicker.view.position0=Math.max(0,g[nt][0])||0,r.selectpicker.view.position1=Math.min(s,g[tt][1])||0,it=b[0]!==r.selectpicker.view.position0||b[1]!==r.selectpicker.view.position1,void 0!==r.activeIndex&&(f=r.selectpicker.current.elements[r.selectpicker.current.map.newIndex[r.prevActiveIndex]],e=r.selectpicker.current.elements[r.selectpicker.current.map.newIndex[r.activeIndex]],u=r.selectpicker.current.elements[r.selectpicker.current.map.newIndex[r.selectedIndex]],i&&(r.activeIndex!==r.selectedIndex&&(e.classList.remove("active"),e.firstChild&&e.firstChild.classList.remove("active")),r.activeIndex=void 0),r.activeIndex&&r.activeIndex!==r.selectedIndex&&u&&u.length&&(u.classList.remove("active"),u.firstChild&&u.firstChild.classList.remove("active"))),void 0!==r.prevActiveIndex&&r.prevActiveIndex!==r.activeIndex&&r.prevActiveIndex!==r.selectedIndex&&f&&f.length&&(f.classList.remove("active"),f.firstChild&&f.firstChild.classList.remove("active")),(i||it)&&(rt=r.selectpicker.view.visibleElements?r.selectpicker.view.visibleElements.slice():[],r.selectpicker.view.visibleElements=r.selectpicker.current.elements.slice(r.selectpicker.view.position0,r.selectpicker.view.position1),r.setOptionStatus(),(t||!1===l&&i)&&(k=rt,d=r.selectpicker.view.visibleElements,ut=!(k.length===d.length&&k.every(function(n,t){return n===d[t]}))),(i||!0===l)&&ut)){var ft,et,c=r.$menuInner[0],ot=document.createDocumentFragment(),ct=c.firstChild.cloneNode(!1),st=!0===l?r.selectpicker.view.visibleElements:r.selectpicker.current.elements;for(c.replaceChild(ct,c.firstChild),o=0,ht=st.length;o<ht;o++)ot.appendChild(st[o]);!0===l&&(ft=0===r.selectpicker.view.position0?0:r.selectpicker.current.data[r.selectpicker.view.position0-1].position,et=r.selectpicker.view.position1>s-1?0:r.selectpicker.current.data[s-1].position-r.selectpicker.current.data[r.selectpicker.view.position1-1].position,c.firstChild.style.marginTop=ft+"px",c.firstChild.style.marginBottom=et+"px");c.firstChild.appendChild(ot)}(r.prevActiveIndex=r.activeIndex,r.options.liveSearch)?t&&i&&(v=0,r.selectpicker.view.canHighlight[v]||(v=1+r.selectpicker.view.canHighlight.slice(1).indexOf(!0)),a=r.selectpicker.view.visibleElements[v],r.selectpicker.view.currentActive&&(r.selectpicker.view.currentActive.classList.remove("active"),r.selectpicker.view.currentActive.firstChild&&r.selectpicker.view.currentActive.firstChild.classList.remove("active")),a&&(a.classList.add("active"),a.firstChild&&a.firstChild.classList.add("active")),r.activeIndex=r.selectpicker.current.map.originalIndex[v]):r.$menuInner.focus()}var r,u,f,e;i=i||0;r=this;this.selectpicker.current=t?this.selectpicker.search:this.selectpicker.main;e=[];this.setPositionData();o(i,!0);this.$menuInner.off("scroll.createView").on("scroll.createView",function(n,t){r.noScroll||o(this.scrollTop,t);r.noScroll=!1});n(window).off("resize.createView").on("resize.createView",function(){o(r.$menuInner[0].scrollTop)})},createLi:function(){var w,s=this,e=[],y=0,b=0,u=[],o=0,p=0,f=-1,v;this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option"));var i={span:document.createElement("span"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode(" ")},k=i.span.cloneNode(!1),c=document.createDocumentFragment();k.className=s.options.iconBase+" "+s.options.tickIcon+" check-mark";i.a.appendChild(k);i.a.setAttribute("role","option");i.subtext.className="text-muted";i.text=i.span.cloneNode(!1);i.text.className="text";var l=function(n,t,r,u){var f=i.li.cloneNode(!1);return n&&(1===n.nodeType||11===n.nodeType?f.appendChild(n):f.innerHTML=n),void 0!==r&&""!==r&&(f.className=r),null!=u&&f.classList.add("optgroup-"+u),f},d=function(n,t,u){var f=i.a.cloneNode(!0);return n&&(11===n.nodeType?f.appendChild(n):f.insertAdjacentHTML("beforeend",n)),void 0!==t&""!==t&&(f.className=t),"4"===r.major&&f.classList.add("dropdown-item"),u&&f.setAttribute("style",u),f},g=function(n){var r,u,t=i.text.cloneNode(!1),f;return n.optionContent?t.innerHTML=n.optionContent:((t.textContent=n.text,n.optionIcon)&&(f=i.whitespace.cloneNode(!1),(u=i.span.cloneNode(!1)).className=s.options.iconBase+" "+n.optionIcon,c.appendChild(u),c.appendChild(f)),n.optionSubtext&&((r=i.subtext.cloneNode(!1)).innerHTML=n.optionSubtext,t.appendChild(r))),c.appendChild(t),c};if(this.options.title&&!this.multiple){f--;var a=this.$element[0],nt=!1,tt=!this.selectpicker.view.titleOption.parentNode;tt&&(this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",nt=void 0===n(a.options[a.selectedIndex]).attr("selected")&&void 0===this.$element.data("selected"));(tt||0!==this.selectpicker.view.titleOption.index)&&a.insertBefore(this.selectpicker.view.titleOption,a.firstChild);nt&&(a.selectedIndex=0)}v=this.$element.find("option");v.each(function(r){var et=n(this),pt,wt,ii,tt,it,rt;if(f++,!et.hasClass("bs-title-option")){var k,ot,a=et.data(),bt=this.className||"",kt=h(this.style.cssText),st=a.content,ht=this.textContent,dt=a.tokens,ct=a.subtext,at=a.icon,ut=et.parent(),ft=ut[0],vt="OPTGROUP"===ft.tagName,gt=vt&&ft.disabled,lt=this.disabled||gt,nt=this.previousElementSibling&&"OPTGROUP"===this.previousElementSibling.tagName,yt=ut.data();if(!0===a.hidden||s.options.hideDisabled&&(lt&&!vt||gt))k=a.prevHiddenIndex,et.next().data("prevHiddenIndex",void 0!==k?k:r),f--,nt||void 0!==k&&(tt=v[k].previousElementSibling)&&"OPTGROUP"===tt.tagName&&!tt.disabled&&(nt=!0),nt&&"divider"!==u[u.length-1].type&&(f++,e.push(l(!1,0,t.DIVIDER,o+"div")),u.push({type:"divider",optID:o}));else{if(vt&&!0!==a.divider){if(s.options.hideDisabled&&lt&&(void 0===yt.allOptionsDisabled&&(pt=ut.children(),ut.data("allOptionsDisabled",pt.filter(":disabled").length===pt.length)),ut.data("allOptionsDisabled")))return void f--;if(wt=" "+ft.className||"",!this.previousElementSibling){o+=1;var ri=ft.label,ni=h(ri),ti=yt.subtext,ui=yt.icon;0!==r&&0<e.length&&(f++,e.push(l(!1,0,t.DIVIDER,o+"div")),u.push({type:"divider",optID:o}));f++;ii=function(n){var r,u,t=i.text.cloneNode(!1),f;return(t.innerHTML=n.labelEscaped,n.labelIcon)&&(f=i.whitespace.cloneNode(!1),(u=i.span.cloneNode(!1)).className=s.options.iconBase+" "+n.labelIcon,c.appendChild(u),c.appendChild(f)),n.labelSubtext&&((r=i.subtext.cloneNode(!1)).textContent=n.labelSubtext,t.appendChild(r)),c.appendChild(t),c}({labelEscaped:ni,labelSubtext:ti,labelIcon:ui});e.push(l(ii,0,"dropdown-header"+wt,o));u.push({content:ni,subtext:ti,type:"optgroup-label",optID:o});p=f-1}if(s.options.hideDisabled&&lt||!0===a.hidden)return void f--;ot=g({text:ht,optionContent:st,optionSubtext:ct,optionIcon:at});e.push(l(d(ot,"opt "+bt+wt,kt),0,"",o));u.push({content:st||ht,subtext:ct,tokens:dt,type:"option",optID:o,headerIndex:p,lastIndex:p+ft.childElementCount,originalIndex:r,data:a});y++}else!0===a.divider?(e.push(l(!1,0,t.DIVIDER)),u.push({type:"divider",originalIndex:r,data:a})):(!nt&&s.options.hideDisabled&&void 0!==(k=a.prevHiddenIndex)&&(tt=v[k].previousElementSibling)&&"OPTGROUP"===tt.tagName&&!tt.disabled&&(nt=!0),nt&&"divider"!==u[u.length-1].type&&(f++,e.push(l(!1,0,t.DIVIDER,o+"div")),u.push({type:"divider",optID:o})),ot=g({text:ht,optionContent:st,optionSubtext:ct,optionIcon:at}),e.push(l(d(ot,bt,kt))),u.push({content:st||ht,subtext:ct,tokens:dt,type:"option",originalIndex:r,data:a}),y++);s.selectpicker.main.map.newIndex[r]=f;s.selectpicker.main.map.originalIndex[f]=r;it=u[u.length-1];it.disabled=lt;rt=0;it.content&&(rt+=it.content.length);it.subtext&&(rt+=it.subtext.length);at&&(rt+=1);b<rt&&(b=rt,w=e[e.length-1])}}});this.selectpicker.main.elements=e;this.selectpicker.main.data=u;this.selectpicker.current=this.selectpicker.main;this.selectpicker.view.widestOption=w;this.selectpicker.view.availableOptionsCount=y},findLis:function(){return this.$menuInner.find(".inner > li")},render:function(){var i=this,v=this.$element.find("option"),r=[],e=[],f,h,n,c,l,u,a,t,o,s;for(this.togglePlaceholder(),this.tabIndex(),f=0,h=this.selectpicker.main.elements.length;f<h;f++)if(n=v[this.selectpicker.main.map.originalIndex[f]],n&&n.selected&&(r.push(n),e.length<100&&"count"!==i.options.selectedTextFormat||1===r.length)){if(i.options.hideDisabled&&(n.disabled||"OPTGROUP"===n.parentNode.tagName&&n.parentNode.disabled))return;u=this.selectpicker.main.data[f].data;a=u.icon&&i.options.showIcon?'<i class="'+i.options.iconBase+" "+u.icon+'"><\/i> ':"";c=i.options.showSubtext&&u.subtext&&!i.multiple?' <small class="text-muted">'+u.subtext+"<\/small>":"";l=n.title?n.title:u.content&&i.options.showContent?u.content.toString():a+n.innerHTML.trim()+c;e.push(l)}t=this.multiple?e.join(this.options.multipleSeparator):e[0];(50<r.length&&(t+="..."),this.multiple&&-1!==this.options.selectedTextFormat.indexOf("count"))&&(o=this.options.selectedTextFormat.split(">"),(1<o.length&&r.length>o[1]||1===o.length&&2<=r.length)&&(s=this.selectpicker.view.availableOptionsCount,t=("function"==typeof this.options.countSelectedText?this.options.countSelectedText(r.length,s):this.options.countSelectedText).replace("{0}",r.length.toString()).replace("{1}",s.toString())));null==this.options.title&&(this.options.title=this.$element.attr("title"));"static"==this.options.selectedTextFormat&&(t=this.options.title);t||(t=void 0!==this.options.title?this.options.title:this.options.noneSelectedText);this.$button[0].title=et(t.replace(/<[^>]*>?/g,"").trim());this.$button.find(".filter-option-inner-inner")[0].innerHTML=t;this.$element.trigger("rendered.bs.select")},setStyle:function(n,t){this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,""));var i=n||this.options.style;"add"==t?this.$button.addClass(i):"remove"==t?this.$button.removeClass(i):(this.$button.removeClass(this.options.style),this.$button.addClass(i))},liHeight:function(i){var d;if(i||!1!==this.options.size&&!this.sizeInfo){this.sizeInfo||(this.sizeInfo={});var c=document.createElement("div"),e=document.createElement("div"),a=document.createElement("div"),s=document.createElement("ul"),k=document.createElement("li"),l=document.createElement("li"),nt=document.createElement("li"),v=document.createElement("a"),y=document.createElement("span"),p=this.options.header&&0<this.$menu.find("."+t.POPOVERHEADER).length?this.$menu.find("."+t.POPOVERHEADER)[0].cloneNode(!0):null,h=this.options.liveSearch?document.createElement("div"):null,w=this.options.actionsBox&&this.multiple&&0<this.$menu.find(".bs-actionsbox").length?this.$menu.find(".bs-actionsbox")[0].cloneNode(!0):null,b=this.options.doneButton&&this.multiple&&0<this.$menu.find(".bs-donebutton").length?this.$menu.find(".bs-donebutton")[0].cloneNode(!0):null;(this.sizeInfo.selectWidth=this.$newElement[0].offsetWidth,y.className="text",v.className="dropdown-item "+this.$element.find("option")[0].className,c.className=this.$menu[0].parentNode.className+" "+t.SHOW,c.style.width=this.sizeInfo.selectWidth+"px","auto"===this.options.width&&(e.style.minWidth=0),e.className=t.MENU+" "+t.SHOW,a.className="inner "+t.SHOW,s.className=t.MENU+" inner "+("4"===r.major?t.SHOW:""),k.className=t.DIVIDER,l.className="dropdown-header",y.appendChild(document.createTextNode("Inner text")),v.appendChild(y),nt.appendChild(v),l.appendChild(y.cloneNode(!0)),this.selectpicker.view.widestOption&&s.appendChild(this.selectpicker.view.widestOption.cloneNode(!0)),s.appendChild(nt),s.appendChild(k),s.appendChild(l),p&&e.appendChild(p),h)&&(d=document.createElement("input"),h.className="bs-searchbox",d.className="form-control",h.appendChild(d),e.appendChild(h));w&&e.appendChild(w);a.appendChild(s);e.appendChild(a);b&&e.appendChild(b);c.appendChild(e);document.body.appendChild(c);var tt,rt=v.offsetHeight,ut=l?l.offsetHeight:0,ft=p?p.offsetHeight:0,et=h?h.offsetHeight:0,ot=w?w.offsetHeight:0,st=b?b.offsetHeight:0,ht=n(k).outerHeight(!0),f=!!window.getComputedStyle&&window.getComputedStyle(e),it=e.offsetWidth,o=f?null:n(e),g={vert:u(f?f.paddingTop:o.css("paddingTop"))+u(f?f.paddingBottom:o.css("paddingBottom"))+u(f?f.borderTopWidth:o.css("borderTopWidth"))+u(f?f.borderBottomWidth:o.css("borderBottomWidth")),horiz:u(f?f.paddingLeft:o.css("paddingLeft"))+u(f?f.paddingRight:o.css("paddingRight"))+u(f?f.borderLeftWidth:o.css("borderLeftWidth"))+u(f?f.borderRightWidth:o.css("borderRightWidth"))},ct={vert:g.vert+u(f?f.marginTop:o.css("marginTop"))+u(f?f.marginBottom:o.css("marginBottom"))+2,horiz:g.horiz+u(f?f.marginLeft:o.css("marginLeft"))+u(f?f.marginRight:o.css("marginRight"))+2};a.style.overflowY="scroll";tt=e.offsetWidth-it;document.body.removeChild(c);this.sizeInfo.liHeight=rt;this.sizeInfo.dropdownHeaderHeight=ut;this.sizeInfo.headerHeight=ft;this.sizeInfo.searchHeight=et;this.sizeInfo.actionsHeight=ot;this.sizeInfo.doneButtonHeight=st;this.sizeInfo.dividerHeight=ht;this.sizeInfo.menuPadding=g;this.sizeInfo.menuExtras=ct;this.sizeInfo.menuWidth=it;this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth;this.sizeInfo.scrollBarWidth=tt;this.sizeInfo.selectHeight=this.$newElement[0].offsetHeight;this.setPositionData()}},getSelectPosition:function(){var t,r=n(window),f=this.$newElement.offset(),u=n(this.options.container),i;this.options.container&&!u.is("body")?((t=u.offset()).top+=parseInt(u.css("borderTopWidth")),t.left+=parseInt(u.css("borderLeftWidth"))):t={top:0,left:0};i=this.options.windowPadding;this.sizeInfo.selectOffsetTop=f.top-t.top-r.scrollTop();this.sizeInfo.selectOffsetBot=r.height()-this.sizeInfo.selectOffsetTop-this.sizeInfo.selectHeight-t.top-i[2];this.sizeInfo.selectOffsetLeft=f.left-t.left-r.scrollLeft();this.sizeInfo.selectOffsetRight=r.width()-this.sizeInfo.selectOffsetLeft-this.sizeInfo.selectWidth-t.left-i[1];this.sizeInfo.selectOffsetTop-=i[0];this.sizeInfo.selectOffsetLeft-=i[3]},setMenuSize:function(){var u;this.getSelectPosition();var r,n,f,e,o,s,v,w=this.sizeInfo.selectWidth,y=this.sizeInfo.liHeight,h=this.sizeInfo.headerHeight,c=this.sizeInfo.searchHeight,l=this.sizeInfo.actionsHeight,a=this.sizeInfo.doneButtonHeight,b=this.sizeInfo.dividerHeight,i=this.sizeInfo.menuPadding,p=0;if(this.options.dropupAuto&&(v=y*this.selectpicker.current.elements.length+i.vert,this.$newElement.toggleClass(t.DROPUP,this.sizeInfo.selectOffsetTop-this.sizeInfo.selectOffsetBot>this.sizeInfo.menuExtras.vert&&v+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot)),"auto"===this.options.size)e=3<this.selectpicker.current.elements.length?3*this.sizeInfo.liHeight+this.sizeInfo.menuExtras.vert-2:0,n=this.sizeInfo.selectOffsetBot-this.sizeInfo.menuExtras.vert,f=e+h+c+l+a,s=Math.max(e-i.vert,0),this.$newElement.hasClass(t.DROPUP)&&(n=this.sizeInfo.selectOffsetTop-this.sizeInfo.menuExtras.vert),r=(o=n)-h-c-l-a-i.vert;else if(this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size){for(u=0;u<this.options.size;u++)"divider"===this.selectpicker.current.data[u].type&&p++;r=(n=y*this.options.size+p*b+i.vert)-i.vert;o=n+h+c+l+a;f=s=""}"auto"===this.options.dropdownAlignRight&&this.$menu.toggleClass(t.MENURIGHT,this.sizeInfo.selectOffsetLeft>this.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRight<this.$menu[0].offsetWidth-w);this.$menu.css({"max-height":o+"px",overflow:"hidden","min-height":f+"px"});this.$menuInner.css({"max-height":r+"px","overflow-y":"auto","min-height":s+"px"});this.sizeInfo.menuInnerHeight=r;this.selectpicker.current.data.length&&this.selectpicker.current.data[this.selectpicker.current.data.length-1].position>this.sizeInfo.menuInnerHeight&&(this.sizeInfo.hasScrollBar=!0,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth+this.sizeInfo.scrollBarWidth,this.$menu.css("min-width",this.sizeInfo.totalMenuWidth));this.dropdown&&this.dropdown._popper&&this.dropdown._popper.update()},setSize:function(t){if(this.liHeight(t),this.options.header&&this.$menu.css("padding-top",0),!1!==this.options.size){var u,i=this,f=n(window),r=0;this.setMenuSize();"auto"===this.options.size?(this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",function(){return i.setMenuSize()}),f.off("resize.setMenuSize scroll.setMenuSize").on("resize.setMenuSize scroll.setMenuSize",function(){return i.setMenuSize()})):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&(this.$searchbox.off("input.setMenuSize propertychange.setMenuSize"),f.off("resize.setMenuSize scroll.setMenuSize"));t?r=this.$menuInner[0].scrollTop:i.multiple||"number"==typeof(u=i.selectpicker.main.map.newIndex[i.$element[0].selectedIndex])&&!1!==i.options.size&&(r=(r=i.sizeInfo.liHeight*u)-i.sizeInfo.menuInnerHeight/2+i.sizeInfo.liHeight/2);i.createView(!1,r)}},setWidth:function(){var n=this;"auto"===this.options.width?requestAnimationFrame(function(){n.$menu.css("min-width","0");n.liHeight();n.setMenuSize();var t=n.$newElement.clone().appendTo("body"),i=t.css("width","auto").children("button").outerWidth();t.remove();n.sizeInfo.selectWidth=Math.max(n.sizeInfo.totalMenuWidth,i);n.$newElement.css("width",n.sizeInfo.selectWidth+"px")}):"fit"===this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width","").addClass("fit-width")):this.options.width?(this.$menu.css("min-width",""),this.$newElement.css("width",this.options.width)):(this.$menu.css("min-width",""),this.$newElement.css("width",""));this.$newElement.hasClass("fit-width")&&"fit"!==this.options.width&&this.$newElement.removeClass("fit-width")},selectPosition:function(){this.$bsContainer=n('<div class="bs-container" />');var e,f,o,i=this,u=n(this.options.container),s=function(s){var h={},c=i.options.display||n.fn.dropdown.Constructor.Default.display;i.$bsContainer.addClass(s.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(t.DROPUP,s.hasClass(t.DROPUP));e=s.offset();u.is("body")?f={top:0,left:0}:((f=u.offset()).top+=parseInt(u.css("borderTopWidth"))-u.scrollTop(),f.left+=parseInt(u.css("borderLeftWidth"))-u.scrollLeft());o=s.hasClass(t.DROPUP)?0:s[0].offsetHeight;(r.major<4||"static"===c)&&(h.top=e.top-f.top+o,h.left=e.left-f.left);h.width=s[0].offsetWidth;i.$bsContainer.css(h)};this.$button.on("click.bs.dropdown.data-api",function(){i.isDisabled()||(s(i.$newElement),i.$bsContainer.appendTo(i.options.container).toggleClass(t.SHOW,!i.$button.hasClass(t.SHOW)).append(i.$menu))});n(window).on("resize scroll",function(){s(i.$newElement)});this.$element.on("hide.bs.select",function(){i.$menu.data("height",i.$menu.height());i.$bsContainer.detach()})},setOptionStatus:function(){var n=this,e=this.$element.find("option"),r,i,t,u,f;if(n.noScroll=!1,n.selectpicker.view.visibleElements&&n.selectpicker.view.visibleElements.length)for(r=0;r<n.selectpicker.view.visibleElements.length;r++)i=n.selectpicker.current.map.originalIndex[r+n.selectpicker.view.position0],t=e[i],t&&(u=this.selectpicker.main.map.newIndex[i],f=this.selectpicker.main.elements[u],n.setDisabled(i,t.disabled||"OPTGROUP"===t.parentNode.tagName&&t.parentNode.disabled,u,f),n.setSelected(i,t.selected,u,f))},setSelected:function(n,t,i,r){var o,u,f,s=void 0!==this.activeIndex,e=this.activeIndex===n||t&&!this.multiple&&!s;i||(i=this.selectpicker.main.map.newIndex[n]);r||(r=this.selectpicker.main.elements[i]);f=r.firstChild;t&&(this.selectedIndex=n);r.classList.toggle("selected",t);r.classList.toggle("active",e);e&&(this.selectpicker.view.currentActive=r,this.activeIndex=n);f&&(f.classList.toggle("selected",t),f.classList.toggle("active",e),f.setAttribute("aria-selected",t));e||!s&&t&&void 0!==this.prevActiveIndex&&(o=this.selectpicker.main.map.newIndex[this.prevActiveIndex],(u=this.selectpicker.main.elements[o]).classList.toggle("selected",t),u.classList.remove("active"),u.firstChild&&(u.firstChild.classList.toggle("selected",t),u.firstChild.classList.remove("active")))},setDisabled:function(n,i,u,f){var e;u||(u=this.selectpicker.main.map.newIndex[n]);f||(f=this.selectpicker.main.elements[u]);e=f.firstChild;f.classList.toggle(t.DISABLED,i);e&&("4"===r.major&&e.classList.toggle(t.DISABLED,i),e.setAttribute("aria-disabled",i),i?e.setAttribute("tabindex",-1):e.setAttribute("tabindex",0))},isDisabled:function(){return this.$element[0].disabled},checkDisabled:function(){var n=this;this.isDisabled()?(this.$newElement.addClass(t.DISABLED),this.$button.addClass(t.DISABLED).attr("tabindex",-1).attr("aria-disabled",!0)):(this.$button.hasClass(t.DISABLED)&&(this.$newElement.removeClass(t.DISABLED),this.$button.removeClass(t.DISABLED).attr("aria-disabled",!1)),-1!=this.$button.attr("tabindex")||this.$element.data("tabindex")||this.$button.removeAttr("tabindex"));this.$button.click(function(){return!n.isDisabled()})},togglePlaceholder:function(){var t=this.$element[0],i=t.selectedIndex,n=-1===i;n||t.options[i].value||(n=!0);this.$button.toggleClass("bs-placeholder",n)},tabIndex:function(){this.$element.data("tabindex")!==this.$element.attr("tabindex")&&-98!==this.$element.attr("tabindex")&&"-98"!==this.$element.attr("tabindex")&&(this.$element.data("tabindex",this.$element.attr("tabindex")),this.$button.attr("tabindex",this.$element.data("tabindex")));this.$element.attr("tabindex",-98)},clickListener:function(){function f(){i.options.liveSearch?i.$searchbox.focus():i.$menuInner.focus()}function o(){i.dropdown&&i.dropdown._popper&&i.dropdown._popper.state.isCreated?f():requestAnimationFrame(o)}var i=this,u=n(document);u.data("spaceSelect",!1);this.$button.on("keyup",function(n){/(32)/.test(n.keyCode.toString(10))&&u.data("spaceSelect")&&(n.preventDefault(),u.data("spaceSelect",!1))});this.$newElement.on("show.bs.dropdown",function(){3<r.major&&!i.dropdown&&(i.dropdown=i.$button.data("bs.dropdown"),i.dropdown._menu=i.$menu[0])});this.$button.on("click.bs.dropdown.data-api",function(){i.$newElement.hasClass(t.SHOW)||i.setSize()});this.$element.on("shown.bs.select",function(){i.$menuInner[0].scrollTop!==i.selectpicker.view.scrollTop&&(i.$menuInner[0].scrollTop=i.selectpicker.view.scrollTop);3<r.major?requestAnimationFrame(o):f()});this.$menuInner.on("click","li a",function(r,u){var w=n(this),et=i.isVirtual()?i.selectpicker.view.position0:0,s=i.selectpicker.current.map.originalIndex[w.parent().index()+et],it=l(i.$element[0]),ot=i.$element.prop("selectedIndex"),b=!0,k,d,c,ft;if(i.multiple&&1!==i.options.maxOptions&&r.stopPropagation(),r.preventDefault(),!i.isDisabled()&&!w.parent().hasClass(t.DISABLED)){var a=i.$element.find("option"),h=a.eq(s),rt=h.prop("selected"),y=h.parent("optgroup"),ut=y.find("option"),f=i.options.maxOptions,o=y.data("maxOptions")||!1;if(s===i.activeIndex&&(u=!0),u||(i.prevActiveIndex=i.activeIndex,i.activeIndex=void 0),i.multiple){if((h.prop("selected",!rt),i.setSelected(s,!rt),w.blur(),!1!==f||!1!==o)&&(k=f<a.filter(":selected").length,d=o<y.find("option:selected").length,f&&k||o&&d))if(f&&1==f){for(a.prop("selected",!1),h.prop("selected",!0),c=0;c<a.length;c++)i.setSelected(c,!1);i.setSelected(s,!0)}else if(o&&1==o){for(y.find("option:selected").prop("selected",!1),h.prop("selected",!0),c=0;c<ut.length;c++)ft=ut[c],i.setSelected(a.index(ft),!1);i.setSelected(s,!0)}else{var g="string"==typeof i.options.maxOptionsText?[i.options.maxOptionsText,i.options.maxOptionsText]:i.options.maxOptionsText,v="function"==typeof g?g(f,o):g,nt=v[0].replace("{n}",f),tt=v[1].replace("{n}",o),p=n('<div class="notify"><\/div>');v[2]&&(nt=nt.replace("{var}",v[2][1<f?0:1]),tt=tt.replace("{var}",v[2][1<o?0:1]));h.prop("selected",!1);i.$menu.append(p);f&&k&&(p.append(n("<div>"+nt+"<\/div>")),b=!1,i.$element.trigger("maxReached.bs.select"));o&&d&&(p.append(n("<div>"+tt+"<\/div>")),b=!1,i.$element.trigger("maxReachedGrp.bs.select"));setTimeout(function(){i.setSelected(s,!1)},10);p.delay(750).fadeOut(300,function(){n(this).remove()})}}else a.prop("selected",!1),h.prop("selected",!0),i.setSelected(s,!0);!i.multiple||i.multiple&&1===i.options.maxOptions?i.$button.focus():i.options.liveSearch&&i.$searchbox.focus();b&&(it!=l(i.$element[0])&&i.multiple||ot!=i.$element.prop("selectedIndex")&&!i.multiple)&&(e=[s,h.prop("selected"),it],i.$element.triggerNative("change"))}});this.$menu.on("click","li."+t.DISABLED+" a, ."+t.POPOVERHEADER+", ."+t.POPOVERHEADER+" :not(.close)",function(t){t.currentTarget==this&&(t.preventDefault(),t.stopPropagation(),i.options.liveSearch&&!n(t.target).hasClass("close")?i.$searchbox.focus():i.$button.focus())});this.$menuInner.on("click",".divider, .dropdown-header",function(n){n.preventDefault();n.stopPropagation();i.options.liveSearch?i.$searchbox.focus():i.$button.focus()});this.$menu.on("click","."+t.POPOVERHEADER+" .close",function(){i.$button.click()});this.$searchbox.on("click",function(n){n.stopPropagation()});this.$menu.on("click",".actions-btn",function(t){i.options.liveSearch?i.$searchbox.focus():i.$button.focus();t.preventDefault();t.stopPropagation();n(this).hasClass("bs-select-all")?i.selectAll():i.deselectAll()});this.$element.on({change:function(){i.render();i.$element.trigger("changed.bs.select",e);e=null},focus:function(){i.$button.focus()}})},liveSearchListener:function(){var n=this,t=document.createElement("li");this.$button.on("click.bs.dropdown.data-api",function(){n.$searchbox.val()&&n.$searchbox.val("")});this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",function(n){n.stopPropagation()});this.$searchbox.on("input propertychange",function(){var o=n.$searchbox.val(),r,i,s;if(n.selectpicker.search.map.newIndex={},n.selectpicker.search.map.originalIndex={},n.selectpicker.search.elements=[],n.selectpicker.search.data=[],o){var e=[],a=o.toUpperCase(),u={},f=[],v=n._searchStyle(),y=n.options.liveSearchNormalize;for(n._$lisSelected=n.$menuInner.find(".selected"),r=0;r<n.selectpicker.main.data.length;r++)i=n.selectpicker.main.data[r],u[r]||(u[r]=g(i,a,v,y)),u[r]&&void 0!==i.headerIndex&&-1===f.indexOf(i.headerIndex)&&(0<i.headerIndex&&(u[i.headerIndex-1]=!0,f.push(i.headerIndex-1)),u[i.headerIndex]=!0,f.push(i.headerIndex),u[i.lastIndex+1]=!0),u[r]&&"optgroup-label"!==i.type&&f.push(r);for(r=0,s=f.length;r<s;r++){var c=f[r],p=f[r-1],l=(i=n.selectpicker.main.data[c],n.selectpicker.main.data[p]);("divider"!==i.type||"divider"===i.type&&l&&"divider"!==l.type&&s-1!==r)&&(n.selectpicker.search.data.push(i),e.push(n.selectpicker.main.elements[c]),i.hasOwnProperty("originalIndex")&&(n.selectpicker.search.map.newIndex[i.originalIndex]=e.length-1,n.selectpicker.search.map.originalIndex[e.length-1]=i.originalIndex))}n.activeIndex=void 0;n.noScroll=!0;n.$menuInner.scrollTop(0);n.selectpicker.search.elements=e;n.createView(!0);e.length||(t.className="no-results",t.innerHTML=n.options.noneResultsText.replace("{0}",'"'+h(o)+'"'),n.$menuInner[0].firstChild.appendChild(t))}else n.$menuInner.scrollTop(0),n.createView(!1)})},_searchStyle:function(){return this.options.liveSearchStyle||"contains"},val:function(n){return void 0!==n?(this.$element.val(n).triggerNative("change"),this.$element):this.$element.val()},changeAll:function(n){var i,f,t;if(this.multiple){void 0===n&&(n=!0);var o=this.$element.find("option"),r=0,u=0,s=l(this.$element[0]);for(this.$element.addClass("bs-select-hidden"),i=0;i<this.selectpicker.current.elements.length;i++)f=this.selectpicker.current.data[i],t=o[this.selectpicker.current.map.originalIndex[i]],t&&!t.disabled&&"divider"!==f.type&&(t.selected&&r++,t.selected=n,t.selected&&u++);this.$element.removeClass("bs-select-hidden");r!==u&&(this.setOptionStatus(),this.togglePlaceholder(),e=[null,null,s],this.$element.triggerNative("change"))}},selectAll:function(){return this.changeAll(!0)},deselectAll:function(){return this.changeAll(!1)},toggle:function(n){(n=n||window.event)&&n.stopPropagation();this.$button.trigger("click.bs.dropdown.data-api")},keydown:function(i){var u,et,f,s,k,h=n(this),at=h.hasClass("dropdown-toggle"),r=(at?h.closest(".dropdown"):h.closest(p.MENU)).data("this"),c=r.findLis(),d=!1,ct=i.which===a&&!at&&!r.options.selectOnTab,vt=st.test(i.which)||ct,ut=r.$menuInner[0].scrollTop,yt=r.isVirtual(),e=!0===yt?r.selectpicker.view.position0:0,l,lt,nt,w,rt,ft,b;if(!(et=r.$newElement.hasClass(t.SHOW))&&(vt||48<=i.which&&i.which<=57||96<=i.which&&i.which<=105||65<=i.which&&i.which<=90)&&r.$button.trigger("click.bs.dropdown.data-api"),i.which===tt&&et&&(i.preventDefault(),r.$button.trigger("click.bs.dropdown.data-api").focus()),vt){if(!c.length)return;void 0===(u=!0===yt?c.index(c.filter(".active")):r.selectpicker.current.map.newIndex[r.activeIndex])&&(u=-1);-1!==u&&((f=r.selectpicker.current.elements[u+e]).classList.remove("active"),f.firstChild&&f.firstChild.classList.remove("active"));i.which===v?(-1!==u&&u--,u+e<0&&(u+=c.length),r.selectpicker.view.canHighlight[u+e]||-1==(u=r.selectpicker.view.canHighlight.slice(0,u+e).lastIndexOf(!0)-e)&&(u=c.length-1)):(i.which===y||ct)&&(++u+e>=r.selectpicker.view.canHighlight.length&&(u=0),r.selectpicker.view.canHighlight[u+e]||(u=u+1+r.selectpicker.view.canHighlight.slice(u+e+1).indexOf(!0)));i.preventDefault();l=e+u;i.which===v?0===e&&u===c.length-1?(r.$menuInner[0].scrollTop=r.$menuInner[0].scrollHeight,l=r.selectpicker.current.elements.length-1):d=(k=(s=r.selectpicker.current.data[l]).position-s.height)<ut:(i.which===y||ct)&&(0===u?l=r.$menuInner[0].scrollTop=0:d=ut<(k=(s=r.selectpicker.current.data[l]).position-r.sizeInfo.menuInnerHeight));(f=r.selectpicker.current.elements[l])&&(f.classList.add("active"),f.firstChild&&f.firstChild.classList.add("active"));r.activeIndex=r.selectpicker.current.map.originalIndex[l];r.selectpicker.view.currentActive=f;d&&(r.$menuInner[0].scrollTop=k);r.options.liveSearch?r.$searchbox.focus():h.focus()}else if(!h.is("input")&&!ht.test(i.which)||i.which===o&&r.selectpicker.keydown.keyHistory){for(w=[],i.preventDefault(),r.selectpicker.keydown.keyHistory+=ot[i.which],r.selectpicker.keydown.resetKeyHistory.cancel&&clearTimeout(r.selectpicker.keydown.resetKeyHistory.cancel),r.selectpicker.keydown.resetKeyHistory.cancel=r.selectpicker.keydown.resetKeyHistory.start(),nt=r.selectpicker.keydown.keyHistory,/^(.)\1+$/.test(nt)&&(nt=nt.charAt(0)),rt=0;rt<r.selectpicker.current.data.length;rt++)ft=r.selectpicker.current.data[rt],g(ft,nt,"startsWith",!0)&&r.selectpicker.view.canHighlight[rt]&&(ft.index=rt,w.push(ft.originalIndex));w.length&&(b=0,c.removeClass("active").find("a").removeClass("active"),1===nt.length&&(-1===(b=w.indexOf(r.activeIndex))||b===w.length-1?b=0:b++),lt=r.selectpicker.current.map.newIndex[w[b]],0<ut-(s=r.selectpicker.current.data[lt]).position?(k=s.position-s.height,d=!0):(k=s.position-r.sizeInfo.menuInnerHeight,d=s.position>ut+r.sizeInfo.menuInnerHeight),(f=r.selectpicker.current.elements[lt]).classList.add("active"),f.firstChild&&f.firstChild.classList.add("active"),r.activeIndex=w[b],f.firstChild.focus(),d&&(r.$menuInner[0].scrollTop=k),h.focus())}et&&(i.which===o&&!r.selectpicker.keydown.keyHistory||i.which===it||i.which===a&&r.options.selectOnTab)&&(i.which!==o&&i.preventDefault(),r.options.liveSearch&&i.which===o||(r.$menuInner.find(".active a").trigger("click",!0),h.focus(),r.options.liveSearch||(i.preventDefault(),n(document).data("spaceSelect",!0))))},mobile:function(){this.$element.addClass("mobile-device")},refresh:function(){var t=n.extend({},this.options,this.$element.data());this.options=t;this.selectpicker.main.map.newIndex={};this.selectpicker.main.map.originalIndex={};this.createLi();this.checkDisabled();this.render();this.setStyle();this.setWidth();this.setSize(!0);this.$element.trigger("refreshed.bs.select")},hide:function(){this.$newElement.hide()},show:function(){this.$newElement.show()},remove:function(){this.$newElement.remove();this.$element.remove()},destroy:function(){this.$newElement.before(this.$element).remove();this.$bsContainer?this.$bsContainer.remove():this.$menu.remove();this.$element.off(".bs.select").removeData("selectpicker").removeClass("bs-select-hidden selectpicker")}};ut=n.fn.selectpicker;n.fn.selectpicker=rt;n.fn.selectpicker.Constructor=i;n.fn.selectpicker.noConflict=function(){return n.fn.selectpicker=ut,this};n(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.select",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bs-searchbox input',i.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bs-searchbox input',function(n){n.stopPropagation()});n(window).on("load.bs.select.data-api",function(){n(".selectpicker").each(function(){var t=n(this);rt.call(t,t.data())})})}(n)})