mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
7 lines
52 KiB
JavaScript
7 lines
52 KiB
JavaScript
/*!
|
||
* Bootstrap-select v1.13.17 (https://developer.snapappointments.com/bootstrap-select)
|
||
*
|
||
* Copyright 2012-2020 SnapAppointments, LLC
|
||
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
|
||
*/
|
||
!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],(function(e){return t(e)})):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,(function(e){!function(e){"use strict";var t=["sanitize","whiteList","sanitizeFn"],i=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],s={"*":["class","dir","id","lang","role","tabindex","style",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},n=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function l(t,s){var l=t.nodeName.toLowerCase();if(-1!==e.inArray(l,s))return-1===e.inArray(l,i)||Boolean(t.nodeValue.match(n)||t.nodeValue.match(o));for(var r=e(s).filter((function(e,t){return t instanceof RegExp})),a=0,c=r.length;a<c;a++)if(l.match(r[a]))return!0;return!1}function r(e,t,i){if(i&&"function"==typeof i)return i(e);for(var s=Object.keys(t),n=0,o=e.length;n<o;n++)for(var r=e[n].querySelectorAll("*"),a=0,c=r.length;a<c;a++){var d=r[a],h=d.nodeName.toLowerCase();if(-1!==s.indexOf(h))for(var p=[].slice.call(d.attributes),u=[].concat(t["*"]||[],t[h]||[]),f=0,m=p.length;f<m;f++){var v=p[f];l(v,u)||d.removeAttribute(v.nodeName)}else d.parentNode.removeChild(d)}}"classList"in document.createElement("_")||function(t){if("Element"in t){var i=t.Element.prototype,s=Object,n=function(){var t=e(this);return{add:function(e){return e=Array.prototype.slice.call(arguments).join(" "),t.addClass(e)},remove:function(e){return e=Array.prototype.slice.call(arguments).join(" "),t.removeClass(e)},toggle:function(e,i){return t.toggleClass(e,i)},contains:function(e){return t.hasClass(e)}}};if(s.defineProperty){var o={get:n,enumerable:!0,configurable:!0};try{s.defineProperty(i,"classList",o)}catch(e){void 0!==e.number&&-2146823252!==e.number||(o.enumerable=!1,s.defineProperty(i,"classList",o))}}else s.prototype.__defineGetter__&&i.__defineGetter__("classList",n)}}(window);var a,c,d,h=document.createElement("_");if(h.classList.add("c1","c2"),!h.classList.contains("c2")){var p=DOMTokenList.prototype.add,u=DOMTokenList.prototype.remove;DOMTokenList.prototype.add=function(){Array.prototype.forEach.call(arguments,p.bind(this))},DOMTokenList.prototype.remove=function(){Array.prototype.forEach.call(arguments,u.bind(this))}}if(h.classList.toggle("c3",!1),h.classList.contains("c3")){var f=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return 1 in arguments&&!this.contains(e)==!t?t:f.call(this,e)}}function m(e,t){var i,s=e.selectedOptions,n=[];if(t){for(var o=0,l=s.length;o<l;o++)(i=s[o]).disabled||"OPTGROUP"===i.parentNode.tagName&&i.parentNode.disabled||n.push(i);return n}return s}function v(e,t){for(var i,s=[],n=t||e.selectedOptions,o=0,l=n.length;o<l;o++)(i=n[o]).disabled||"OPTGROUP"===i.parentNode.tagName&&i.parentNode.disabled||s.push(i.value);return e.multiple?s:s.length?s[0]:null}h=null,String.prototype.startsWith||(a=function(){try{var e={},t=Object.defineProperty,i=t(e,e,e)&&t}catch(e){}return i}(),c={}.toString,d=function(e){if(null==this)throw new TypeError;var t=String(this);if(e&&"[object RegExp]"==c.call(e))throw new TypeError;var i=t.length,s=String(e),n=s.length,o=arguments.length>1?arguments[1]:void 0,l=o?Number(o):0;l!=l&&(l=0);var r=Math.min(Math.max(l,0),i);if(n+r>i)return!1;for(var a=-1;++a<n;)if(t.charCodeAt(r+a)!=s.charCodeAt(a))return!1;return!0},a?a(String.prototype,"startsWith",{value:d,configurable:!0,writable:!0}):String.prototype.startsWith=d),Object.keys||(Object.keys=function(e,t,i){for(t in i=[],e)i.hasOwnProperty.call(e,t)&&i.push(t);return i}),HTMLSelectElement&&!HTMLSelectElement.prototype.hasOwnProperty("selectedOptions")&&Object.defineProperty(HTMLSelectElement.prototype,"selectedOptions",{get:function(){return this.querySelectorAll(":checked")}});var g={useDefault:!1,_set:e.valHooks.select.set};e.valHooks.select.set=function(t,i){return i&&!g.useDefault&&e(t).data("selected",!0),g._set.apply(this,arguments)};var b=null,w=function(){try{return new Event("change"),!0}catch(e){return!1}}();function I(e,t,i,s){for(var n=["display","subtext","tokens"],o=!1,l=0;l<n.length;l++){var r=n[l],a=e[r];if(a&&(a=a.toString(),"display"===r&&(a=a.replace(/<[^>]+>/g,"")),s&&(a=E(a)),a=a.toUpperCase(),o="contains"===i?a.indexOf(t)>=0:a.startsWith(t)))break}return o}function x(e){return parseInt(e,10)||0}e.fn.triggerNative=function(e){var t,i=this[0];i.dispatchEvent?(w?t=new Event(e,{bubbles:!0}):(t=document.createEvent("Event")).initEvent(e,!0,!1),i.dispatchEvent(t)):i.fireEvent?((t=document.createEventObject()).eventType=e,i.fireEvent("on"+e,t)):this.trigger(e)};var k={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"},y=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,$=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\u1ab0-\\u1aff\\u1dc0-\\u1dff]","g");function S(e){return k[e]}function E(e){return(e=e.toString())&&e.replace(y,S).replace($,"")}var C,O,z,T,N,A=(C={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},O=function(e){return C[e]},z="(?:"+Object.keys(C).join("|")+")",T=RegExp(z),N=RegExp(z,"g"),function(e){return e=null==e?"":""+e,T.test(e)?e.replace(N,O):e}),L={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"},D=27,H=13,P=32,W=9,B=38,R=40,M={success:!1,major:"3"};try{M.full=(e.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split("."),M.major=M.full[0],M.success=!0}catch(e){}var U=0,j=".bs.select",V={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",ICONBASE:"glyphicon",TICKICON:"glyphicon-ok"},F={MENU:"."+V.MENU},_={div:document.createElement("div"),span:document.createElement("span"),i:document.createElement("i"),subtext:document.createElement("small"),a:document.createElement("a"),li:document.createElement("li"),whitespace:document.createTextNode(" "),fragment:document.createDocumentFragment()};_.noResults=_.li.cloneNode(!1),_.noResults.className="no-results",_.a.setAttribute("role","option"),_.a.className="dropdown-item",_.subtext.className="text-muted",_.text=_.span.cloneNode(!1),_.text.className="text",_.checkMark=_.span.cloneNode(!1);var G=new RegExp(B+"|"+R),q=new RegExp("^"+W+"$|"+D),K={li:function(e,t,i){var s=_.li.cloneNode(!1);return e&&(1===e.nodeType||11===e.nodeType?s.appendChild(e):s.innerHTML=e),void 0!==t&&""!==t&&(s.className=t),null!=i&&s.classList.add("optgroup-"+i),s},a:function(e,t,i){var s=_.a.cloneNode(!0);return e&&(11===e.nodeType?s.appendChild(e):s.insertAdjacentHTML("beforeend",e)),void 0!==t&&""!==t&&s.classList.add.apply(s.classList,t.split(/\s+/)),i&&s.setAttribute("style",i),s},text:function(e,t){var i,s,n=_.text.cloneNode(!1);if(e.content)n.innerHTML=e.content;else{if(n.textContent=e.text,e.icon){var o=_.whitespace.cloneNode(!1);(s=(!0===t?_.i:_.span).cloneNode(!1)).className=this.options.iconBase+" "+e.icon,_.fragment.appendChild(s),_.fragment.appendChild(o)}e.subtext&&((i=_.subtext.cloneNode(!1)).textContent=e.subtext,n.appendChild(i))}if(!0===t)for(;n.childNodes.length>0;)_.fragment.appendChild(n.childNodes[0]);else _.fragment.appendChild(n);return _.fragment},label:function(e){var t,i,s=_.text.cloneNode(!1);if(s.innerHTML=e.display,e.icon){var n=_.whitespace.cloneNode(!1);(i=_.span.cloneNode(!1)).className=this.options.iconBase+" "+e.icon,_.fragment.appendChild(i),_.fragment.appendChild(n)}return e.subtext&&((t=_.subtext.cloneNode(!1)).textContent=e.subtext,s.appendChild(t)),_.fragment.appendChild(s),_.fragment}};function Y(e,t){e.length||(_.noResults.innerHTML=this.options.noneResultsText.replace("{0}",'"'+A(t)+'"'),this.$menuInner[0].firstChild.appendChild(_.noResults))}var Z=function(t,i){var s=this;g.useDefault||(e.valHooks.select.set=g._set,g.useDefault=!0),this.$element=e(t),this.$newElement=null,this.$button=null,this.$menu=null,this.options=i,this.selectpicker={main:{},search:{},current:{},view:{},isSearching:!1,keydown:{keyHistory:"",resetKeyHistory:{start:function(){return setTimeout((function(){s.selectpicker.keydown.keyHistory=""}),800)}}}},this.sizeInfo={},null===this.options.title&&(this.options.title=this.$element.attr("title"));var n=this.options.windowPadding;"number"==typeof n&&(this.options.windowPadding=[n,n,n,n]),this.val=Z.prototype.val,this.render=Z.prototype.render,this.refresh=Z.prototype.refresh,this.setStyle=Z.prototype.setStyle,this.selectAll=Z.prototype.selectAll,this.deselectAll=Z.prototype.deselectAll,this.destroy=Z.prototype.destroy,this.remove=Z.prototype.remove,this.show=Z.prototype.show,this.hide=Z.prototype.hide,this.init()};function J(i){var s,n=arguments,o=i;if([].shift.apply(n),!M.success){try{M.full=(e.fn.dropdown.Constructor.VERSION||"").split(" ")[0].split(".")}catch(e){Z.BootstrapVersion?M.full=Z.BootstrapVersion.split(" ")[0].split("."):(M.full=[M.major,"0","0"],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.",e))}M.major=M.full[0],M.success=!0}if("4"===M.major){var l=[];Z.DEFAULTS.style===V.BUTTONCLASS&&l.push({name:"style",className:"BUTTONCLASS"}),Z.DEFAULTS.iconBase===V.ICONBASE&&l.push({name:"iconBase",className:"ICONBASE"}),Z.DEFAULTS.tickIcon===V.TICKICON&&l.push({name:"tickIcon",className:"TICKICON"}),V.DIVIDER="dropdown-divider",V.SHOW="show",V.BUTTONCLASS="btn-light",V.POPOVERHEADER="popover-header",V.ICONBASE="",V.TICKICON="bs-ok-default";for(var r=0;r<l.length;r++){i=l[r];Z.DEFAULTS[i.name]=V[i.className]}}var a=this.each((function(){var i=e(this);if(i.is("select")){var l=i.data("selectpicker"),r="object"==typeof o&&o;if(l){if(r)for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(l.options[a]=r[a])}else{var c=i.data();for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&-1!==e.inArray(d,t)&&delete c[d];var h=e.extend({},Z.DEFAULTS,e.fn.selectpicker.defaults||{},c,r);h.template=e.extend({},Z.DEFAULTS.template,e.fn.selectpicker.defaults?e.fn.selectpicker.defaults.template:{},c.template,r.template),i.data("selectpicker",l=new Z(this,h))}"string"==typeof o&&(s=l[o]instanceof Function?l[o].apply(l,n):l.options[o])}}));return void 0!==s?s:a}Z.VERSION="1.13.17",Z.DEFAULTS={noneSelectedText:"Nothing selected",noneResultsText:"No results matched {0}",countSelectedText:function(e,t){return 1==e?"{0} item selected":"{0} items selected"},maxOptionsText:function(e,t){return[1==e?"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:V.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:V.ICONBASE,tickIcon:V.TICKICON,showTick:!1,template:{caret:'<span class="caret"></span>'},maxOptions:!1,mobile:!1,selectOnTab:!1,dropdownAlignRight:!1,windowPadding:0,virtualScroll:600,display:!1,sanitize:!0,sanitizeFn:null,whiteList:s},Z.prototype={constructor:Z,init:function(){var e=this,t=this.$element.attr("id");U++,this.selectId="bs-select-"+U,this.$element[0].classList.add("bs-select-hidden"),this.multiple=this.$element.prop("multiple"),this.autofocus=this.$element.prop("autofocus"),this.$element[0].classList.contains("show-tick")&&(this.options.showTick=!0),this.$newElement=this.createDropdown(),this.buildData(),this.$element.after(this.$newElement).prependTo(this.$newElement),this.$button=this.$newElement.children("button"),this.$menu=this.$newElement.children(F.MENU),this.$menuInner=this.$menu.children(".inner"),this.$searchbox=this.$menu.find("input"),this.$element[0].classList.remove("bs-select-hidden"),!0===this.options.dropdownAlignRight&&this.$menu[0].classList.add(V.MENURIGHT),void 0!==t&&this.$button.attr("data-id",t),this.checkDisabled(),this.clickListener(),this.options.liveSearch?(this.liveSearchListener(),this.focusedParent=this.$searchbox[0]):this.focusedParent=this.$menuInner[0],this.setStyle(),this.render(),this.setWidth(),this.options.container?this.selectPosition():this.$element.on("hide.bs.select",(function(){if(e.isVirtual()){var t=e.$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){e.$element.trigger("hide.bs.select",t)},"hidden.bs.dropdown":function(t){e.$element.trigger("hidden.bs.select",t)},"show.bs.dropdown":function(t){e.$element.trigger("show.bs.select",t)},"shown.bs.dropdown":function(t){e.$element.trigger("shown.bs.select",t)}}),e.$element[0].hasAttribute("required")&&this.$element.on("invalid.bs.select",(function(){e.$button[0].classList.add("bs-invalid"),e.$element.on("shown.bs.select.invalid",(function(){e.$element.val(e.$element.val()).off("shown.bs.select.invalid")})).on("rendered.bs.select",(function(){this.validity.valid&&e.$button[0].classList.remove("bs-invalid"),e.$element.off("rendered.bs.select")})),e.$button.on("blur.bs.select",(function(){e.$element.trigger("focus").trigger("blur"),e.$button.off("blur.bs.select")}))})),setTimeout((function(){e.buildList(),e.$element.trigger("loaded.bs.select")}))},createDropdown:function(){var t=this.multiple||this.options.showTick?" show-tick":"",i=this.multiple?' aria-multiselectable="true"':"",s="",n=this.autofocus?" autofocus":"";M.major<4&&this.$element.parent().hasClass("input-group")&&(s=" input-group-btn");var o,l="",r="",a="",c="";return this.options.header&&(l='<div class="'+V.POPOVERHEADER+'"><button type="button" class="close" aria-hidden="true">×</button>'+this.options.header+"</div>"),this.options.liveSearch&&(r='<div class="bs-searchbox"><input type="search" class="form-control" autocomplete="off"'+(null===this.options.liveSearchPlaceholder?"":' placeholder="'+A(this.options.liveSearchPlaceholder)+'"')+' role="combobox" aria-label="Search" aria-controls="'+this.selectId+'" aria-autocomplete="list"></div>'),this.multiple&&this.options.actionsBox&&(a='<div class="bs-actionsbox"><div class="btn-group btn-group-sm btn-block"><button type="button" class="actions-btn bs-select-all btn '+V.BUTTONCLASS+'">'+this.options.selectAllText+'</button><button type="button" class="actions-btn bs-deselect-all btn '+V.BUTTONCLASS+'">'+this.options.deselectAllText+"</button></div></div>"),this.multiple&&this.options.doneButton&&(c='<div class="bs-donebutton"><div class="btn-group btn-block"><button type="button" class="btn btn-sm '+V.BUTTONCLASS+'">'+this.options.doneButtonText+"</button></div></div>"),o='<div class="dropdown bootstrap-select'+t+s+'"><button type="button" tabindex="-1" class="'+this.options.styleBase+' dropdown-toggle" '+("static"===this.options.display?'data-display="static"':"")+'data-toggle="dropdown"'+n+' role="combobox" aria-owns="'+this.selectId+'" aria-haspopup="listbox" aria-expanded="false"><div class="filter-option"><div class="filter-option-inner"><div class="filter-option-inner-inner"></div></div> </div>'+("4"===M.major?"":'<span class="bs-caret">'+this.options.template.caret+"</span>")+'</button><div class="'+V.MENU+" "+("4"===M.major?"":V.SHOW)+'">'+l+r+a+'<div class="inner '+V.SHOW+'" role="listbox" id="'+this.selectId+'" tabindex="-1" '+i+'><ul class="'+V.MENU+" inner "+("4"===M.major?V.SHOW:"")+'" role="presentation"></ul></div>'+c+"</div></div>",e(o)},setPositionData:function(){this.selectpicker.view.canHighlight=[],this.selectpicker.view.size=0;for(var e=0;e<this.selectpicker.current.data.length;e++){var t=this.selectpicker.current.data[e],i=!0;"divider"===t.type?(i=!1,t.height=this.sizeInfo.dividerHeight):"optgroup-label"===t.type?(i=!1,t.height=this.sizeInfo.dropdownHeaderHeight):t.height=this.sizeInfo.liHeight,t.disabled&&(i=!1),this.selectpicker.view.canHighlight.push(i),i&&(this.selectpicker.view.size++,t.posinset=this.selectpicker.view.size),t.position=(0===e?0:this.selectpicker.current.data[e-1].position)+t.height}},isVirtual:function(){return!1!==this.options.virtualScroll&&this.selectpicker.main.elements.length>=this.options.virtualScroll||!0===this.options.virtualScroll},createView:function(t,i,s){var n,o,l=this,a=0,c=[];if(this.selectpicker.isSearching=t,this.selectpicker.current=t?this.selectpicker.search:this.selectpicker.main,this.setPositionData(),i)if(s)a=this.$menuInner[0].scrollTop;else if(!l.multiple){var d=l.$element[0],h=(d.options[d.selectedIndex]||{}).liIndex;if("number"==typeof h&&!1!==l.options.size){var p=l.selectpicker.main.data[h],u=p&&p.position;u&&(a=u-(l.sizeInfo.menuInnerHeight+l.sizeInfo.liHeight)/2)}}function f(e,i){var s,a,d,h,p,u,f,m,v,g,b=l.selectpicker.current.elements.length,w=[],I=!0,x=l.isVirtual();l.selectpicker.view.scrollTop=e,s=Math.ceil(l.sizeInfo.menuInnerHeight/l.sizeInfo.liHeight*1.5),a=Math.round(b/s)||1;for(var k=0;k<a;k++){var y=(k+1)*s;if(k===a-1&&(y=b),w[k]=[k*s+(k?1:0),y],!b)break;void 0===p&&e-1<=l.selectpicker.current.data[y-1].position-l.sizeInfo.menuInnerHeight&&(p=k)}if(void 0===p&&(p=0),u=[l.selectpicker.view.position0,l.selectpicker.view.position1],d=Math.max(0,p-1),h=Math.min(a-1,p+1),l.selectpicker.view.position0=!1===x?0:Math.max(0,w[d][0])||0,l.selectpicker.view.position1=!1===x?b:Math.min(b,w[h][1])||0,f=u[0]!==l.selectpicker.view.position0||u[1]!==l.selectpicker.view.position1,void 0!==l.activeIndex&&(o=l.selectpicker.main.elements[l.prevActiveIndex],c=l.selectpicker.main.elements[l.activeIndex],n=l.selectpicker.main.elements[l.selectedIndex],i&&(l.activeIndex!==l.selectedIndex&&l.defocusItem(c),l.activeIndex=void 0),l.activeIndex&&l.activeIndex!==l.selectedIndex&&l.defocusItem(n)),void 0!==l.prevActiveIndex&&l.prevActiveIndex!==l.activeIndex&&l.prevActiveIndex!==l.selectedIndex&&l.defocusItem(o),(i||f)&&(m=l.selectpicker.view.visibleElements?l.selectpicker.view.visibleElements.slice():[],l.selectpicker.view.visibleElements=!1===x?l.selectpicker.current.elements:l.selectpicker.current.elements.slice(l.selectpicker.view.position0,l.selectpicker.view.position1),l.setOptionStatus(),(t||!1===x&&i)&&(v=m,g=l.selectpicker.view.visibleElements,I=!(v.length===g.length&&v.every((function(e,t){return e===g[t]})))),(i||!0===x)&&I)){var $,S,E=l.$menuInner[0],C=document.createDocumentFragment(),O=E.firstChild.cloneNode(!1),z=l.selectpicker.view.visibleElements,T=[];E.replaceChild(O,E.firstChild);k=0;for(var N=z.length;k<N;k++){var A,L,D=z[k];l.options.sanitize&&(A=D.lastChild)&&(L=l.selectpicker.current.data[k+l.selectpicker.view.position0])&&L.content&&!L.sanitized&&(T.push(A),L.sanitized=!0),C.appendChild(D)}if(l.options.sanitize&&T.length&&r(T,l.options.whiteList,l.options.sanitizeFn),!0===x?($=0===l.selectpicker.view.position0?0:l.selectpicker.current.data[l.selectpicker.view.position0-1].position,S=l.selectpicker.view.position1>b-1?0:l.selectpicker.current.data[b-1].position-l.selectpicker.current.data[l.selectpicker.view.position1-1].position,E.firstChild.style.marginTop=$+"px",E.firstChild.style.marginBottom=S+"px"):(E.firstChild.style.marginTop=0,E.firstChild.style.marginBottom=0),E.firstChild.appendChild(C),!0===x&&l.sizeInfo.hasScrollBar){var H=E.firstChild.offsetWidth;if(i&&H<l.sizeInfo.menuInnerInnerWidth&&l.sizeInfo.totalMenuWidth>l.sizeInfo.selectWidth)E.firstChild.style.minWidth=l.sizeInfo.menuInnerInnerWidth+"px";else if(H>l.sizeInfo.menuInnerInnerWidth){l.$menu[0].style.minWidth=0;var P=E.firstChild.offsetWidth;P>l.sizeInfo.menuInnerInnerWidth&&(l.sizeInfo.menuInnerInnerWidth=P,E.firstChild.style.minWidth=l.sizeInfo.menuInnerInnerWidth+"px"),l.$menu[0].style.minWidth=""}}}if(l.prevActiveIndex=l.activeIndex,l.options.liveSearch){if(t&&i){var W,B=0;l.selectpicker.view.canHighlight[B]||(B=1+l.selectpicker.view.canHighlight.slice(1).indexOf(!0)),W=l.selectpicker.view.visibleElements[B],l.defocusItem(l.selectpicker.view.currentActive),l.activeIndex=(l.selectpicker.current.data[B]||{}).index,l.focusItem(W)}}else l.$menuInner.trigger("focus")}f(a,!0),this.$menuInner.off("scroll.createView").on("scroll.createView",(function(e,t){l.noScroll||f(this.scrollTop,t),l.noScroll=!1})),e(window).off("resize.bs.select."+this.selectId+".createView").on("resize.bs.select."+this.selectId+".createView",(function(){l.$newElement.hasClass(V.SHOW)&&f(l.$menuInner[0].scrollTop)}))},focusItem:function(e,t,i){if(e){t=t||this.selectpicker.main.data[this.activeIndex];var s=e.firstChild;s&&(s.setAttribute("aria-setsize",this.selectpicker.view.size),s.setAttribute("aria-posinset",t.posinset),!0!==i&&(this.focusedParent.setAttribute("aria-activedescendant",s.id),e.classList.add("active"),s.classList.add("active")))}},defocusItem:function(e){e&&(e.classList.remove("active"),e.firstChild&&e.firstChild.classList.remove("active"))},setPlaceholder:function(){var e=this,t=!1;if(this.options.title&&!this.multiple){this.selectpicker.view.titleOption||(this.selectpicker.view.titleOption=document.createElement("option")),t=!0;var i=this.$element[0],s=!1,n=!this.selectpicker.view.titleOption.parentNode,o=i.selectedIndex,l=i.options[o],r=window.performance&&window.performance.getEntriesByType("navigation");n&&(this.selectpicker.view.titleOption.className="bs-title-option",this.selectpicker.view.titleOption.value="",s=!l||0===o&&!1===l.defaultSelected&&void 0===this.$element.data("selected")),(n||0!==this.selectpicker.view.titleOption.index)&&i.insertBefore(this.selectpicker.view.titleOption,i.firstChild),s&&r.length&&"back_forward"!==r[0].type?i.selectedIndex=0:"complete"!==document.readyState&&window.addEventListener("pageshow",(function(){e.selectpicker.view.displayedValue!==i.value&&e.render()}))}return t},buildData:function(){var e=':not([hidden]):not([data-hidden="true"])',t=[],i=0,s=this.setPlaceholder()?1:0;this.options.hideDisabled&&(e+=":not(:disabled)");var n=this.$element[0].querySelectorAll("select > *"+e);function o(e){var i=t[t.length-1];i&&"divider"===i.type&&(i.optID||e.optID)||((e=e||{}).type="divider",t.push(e))}function l(e,i){if((i=i||{}).divider="true"===e.getAttribute("data-divider"),i.divider)o({optID:i.optID});else{var s=t.length,n=e.style.cssText,l=n?A(n):"",r=(e.className||"")+(i.optgroupClass||"");i.optID&&(r="opt "+r),i.optionClass=r.trim(),i.inlineStyle=l,i.text=e.textContent,i.content=e.getAttribute("data-content"),i.tokens=e.getAttribute("data-tokens"),i.subtext=e.getAttribute("data-subtext"),i.icon=e.getAttribute("data-icon"),e.liIndex=s,i.display=i.content||i.text,i.type="option",i.index=s,i.option=e,i.selected=!!e.selected,i.disabled=i.disabled||!!e.disabled,t.push(i)}}function r(n,r){var a=r[n],c=!(n-1<s)&&r[n-1],d=r[n+1],h=a.querySelectorAll("option"+e);if(h.length){var p,u,f={display:A(a.label),subtext:a.getAttribute("data-subtext"),icon:a.getAttribute("data-icon"),type:"optgroup-label",optgroupClass:" "+(a.className||"")};i++,c&&o({optID:i}),f.optID=i,t.push(f);for(var m=0,v=h.length;m<v;m++){var g=h[m];0===m&&(u=(p=t.length-1)+v),l(g,{headerIndex:p,lastIndex:u,optID:f.optID,optgroupClass:f.optgroupClass,disabled:a.disabled})}d&&o({optID:i})}}for(var a=n.length,c=s;c<a;c++){var d=n[c];"OPTGROUP"!==d.tagName?l(d,{}):r(c,n)}this.selectpicker.main.data=this.selectpicker.current.data=t},buildList:function(){var e=this,t=this.selectpicker.main.data,i=[],s=0;function n(t){var n,o=0;switch(t.type){case"divider":n=K.li(!1,V.DIVIDER,t.optID?t.optID+"div":void 0);break;case"option":(n=K.li(K.a(K.text.call(e,t),t.optionClass,t.inlineStyle),"",t.optID)).firstChild&&(n.firstChild.id=e.selectId+"-"+t.index);break;case"optgroup-label":n=K.li(K.label.call(e,t),"dropdown-header"+t.optgroupClass,t.optID)}t.element=n,i.push(n),t.display&&(o+=t.display.length),t.subtext&&(o+=t.subtext.length),t.icon&&(o+=1),o>s&&(s=o,e.selectpicker.view.widestOption=i[i.length-1])}!e.options.showTick&&!e.multiple||_.checkMark.parentNode||(_.checkMark.className=this.options.iconBase+" "+e.options.tickIcon+" check-mark",_.a.appendChild(_.checkMark));for(var o=t.length,l=0;l<o;l++){n(t[l])}this.selectpicker.main.elements=this.selectpicker.current.elements=i},findLis:function(){return this.$menuInner.find(".inner > li")},render:function(){var e,t,i=this.$element[0],s=this.setPlaceholder()&&0===i.selectedIndex,n=m(i,this.options.hideDisabled),o=n.length,l=this.$button[0],a=l.querySelector(".filter-option-inner-inner"),c=document.createTextNode(this.options.multipleSeparator),d=_.fragment.cloneNode(!1),h=!1;if(l.classList.toggle("bs-placeholder",this.multiple?!o:!v(i,n)),this.multiple||1!==n.length||(this.selectpicker.view.displayedValue=v(i,n)),"static"===this.options.selectedTextFormat)d=K.text.call(this,{text:this.options.title},!0);else if((e=this.multiple&&-1!==this.options.selectedTextFormat.indexOf("count")&&o>1)&&(e=(t=this.options.selectedTextFormat.split(">")).length>1&&o>t[1]||1===t.length&&o>=2),!1===e){if(!s){for(var p=0;p<o&&p<50;p++){var u=n[p],f=this.selectpicker.main.data[u.liIndex],g={};this.multiple&&p>0&&d.appendChild(c.cloneNode(!1)),u.title?g.text=u.title:f&&(f.content&&this.options.showContent?(g.content=f.content.toString(),h=!0):(this.options.showIcon&&(g.icon=f.icon),this.options.showSubtext&&!this.multiple&&f.subtext&&(g.subtext=" "+f.subtext),g.text=u.textContent.trim())),d.appendChild(K.text.call(this,g,!0))}o>49&&d.appendChild(document.createTextNode("..."))}}else{var b=':not([hidden]):not([data-hidden="true"]):not([data-divider="true"])';this.options.hideDisabled&&(b+=":not(:disabled)");var w=this.$element[0].querySelectorAll("select > option"+b+", optgroup"+b+" option"+b).length,I="function"==typeof this.options.countSelectedText?this.options.countSelectedText(o,w):this.options.countSelectedText;d=K.text.call(this,{text:I.replace("{0}",o.toString()).replace("{1}",w.toString())},!0)}if(null==this.options.title&&(this.options.title=this.$element.attr("title")),d.childNodes.length||(d=K.text.call(this,{text:void 0!==this.options.title?this.options.title:this.options.noneSelectedText},!0)),l.title=d.textContent.replace(/<[^>]*>?/g,"").trim(),this.options.sanitize&&h&&r([d],this.options.whiteList,this.options.sanitizeFn),a.innerHTML="",a.appendChild(d),M.major<4&&this.$newElement[0].classList.contains("bs3-has-addon")){var x=l.querySelector(".filter-expand"),k=a.cloneNode(!0);k.className="filter-expand",x?l.replaceChild(k,x):l.appendChild(k)}this.$element.trigger("rendered.bs.select")},setStyle:function(e,t){var i,s=this.$button[0],n=this.$newElement[0],o=this.options.style.trim();this.$element.attr("class")&&this.$newElement.addClass(this.$element.attr("class").replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi,"")),M.major<4&&(n.classList.add("bs3"),n.parentNode.classList&&n.parentNode.classList.contains("input-group")&&(n.previousElementSibling||n.nextElementSibling)&&(n.previousElementSibling||n.nextElementSibling).classList.contains("input-group-addon")&&n.classList.add("bs3-has-addon")),i=e?e.trim():o,"add"==t?i&&s.classList.add.apply(s.classList,i.split(" ")):"remove"==t?i&&s.classList.remove.apply(s.classList,i.split(" ")):(o&&s.classList.remove.apply(s.classList,o.split(" ")),i&&s.classList.add.apply(s.classList,i.split(" ")))},liHeight:function(t){if(t||!1!==this.options.size&&!Object.keys(this.sizeInfo).length){var i,s=_.div.cloneNode(!1),n=_.div.cloneNode(!1),o=_.div.cloneNode(!1),l=document.createElement("ul"),r=_.li.cloneNode(!1),a=_.li.cloneNode(!1),c=_.a.cloneNode(!1),d=_.span.cloneNode(!1),h=this.options.header&&this.$menu.find("."+V.POPOVERHEADER).length>0?this.$menu.find("."+V.POPOVERHEADER)[0].cloneNode(!0):null,p=this.options.liveSearch?_.div.cloneNode(!1):null,u=this.options.actionsBox&&this.multiple&&this.$menu.find(".bs-actionsbox").length>0?this.$menu.find(".bs-actionsbox")[0].cloneNode(!0):null,f=this.options.doneButton&&this.multiple&&this.$menu.find(".bs-donebutton").length>0?this.$menu.find(".bs-donebutton")[0].cloneNode(!0):null,m=this.$element.find("option")[0];if(this.sizeInfo.selectWidth=this.$newElement[0].offsetWidth,d.className="text",c.className="dropdown-item "+(m?m.className:""),s.className=this.$menu[0].parentNode.className+" "+V.SHOW,s.style.width=0,"auto"===this.options.width&&(n.style.minWidth=0),n.className=V.MENU+" "+V.SHOW,o.className="inner "+V.SHOW,l.className=V.MENU+" inner "+("4"===M.major?V.SHOW:""),r.className=V.DIVIDER,a.className="dropdown-header",d.appendChild(document.createTextNode("")),this.selectpicker.current.data.length)for(var v=0;v<this.selectpicker.current.data.length;v++){var g=this.selectpicker.current.data[v];if("option"===g.type){i=g.element;break}}else i=_.li.cloneNode(!1),c.appendChild(d),i.appendChild(c);if(a.appendChild(d.cloneNode(!0)),this.selectpicker.view.widestOption&&l.appendChild(this.selectpicker.view.widestOption.cloneNode(!0)),l.appendChild(i),l.appendChild(r),l.appendChild(a),h&&n.appendChild(h),p){var b=document.createElement("input");p.className="bs-searchbox",b.className="form-control",p.appendChild(b),n.appendChild(p)}u&&n.appendChild(u),o.appendChild(l),n.appendChild(o),f&&n.appendChild(f),s.appendChild(n),document.body.appendChild(s);var w,I=i.offsetHeight,k=a?a.offsetHeight:0,y=h?h.offsetHeight:0,$=p?p.offsetHeight:0,S=u?u.offsetHeight:0,E=f?f.offsetHeight:0,C=e(r).outerHeight(!0),O=!!window.getComputedStyle&&window.getComputedStyle(n),z=n.offsetWidth,T=O?null:e(n),N={vert:x(O?O.paddingTop:T.css("paddingTop"))+x(O?O.paddingBottom:T.css("paddingBottom"))+x(O?O.borderTopWidth:T.css("borderTopWidth"))+x(O?O.borderBottomWidth:T.css("borderBottomWidth")),horiz:x(O?O.paddingLeft:T.css("paddingLeft"))+x(O?O.paddingRight:T.css("paddingRight"))+x(O?O.borderLeftWidth:T.css("borderLeftWidth"))+x(O?O.borderRightWidth:T.css("borderRightWidth"))},A={vert:N.vert+x(O?O.marginTop:T.css("marginTop"))+x(O?O.marginBottom:T.css("marginBottom"))+2,horiz:N.horiz+x(O?O.marginLeft:T.css("marginLeft"))+x(O?O.marginRight:T.css("marginRight"))+2};o.style.overflowY="scroll",w=n.offsetWidth-z,document.body.removeChild(s),this.sizeInfo.liHeight=I,this.sizeInfo.dropdownHeaderHeight=k,this.sizeInfo.headerHeight=y,this.sizeInfo.searchHeight=$,this.sizeInfo.actionsHeight=S,this.sizeInfo.doneButtonHeight=E,this.sizeInfo.dividerHeight=C,this.sizeInfo.menuPadding=N,this.sizeInfo.menuExtras=A,this.sizeInfo.menuWidth=z,this.sizeInfo.menuInnerInnerWidth=z-N.horiz,this.sizeInfo.totalMenuWidth=this.sizeInfo.menuWidth,this.sizeInfo.scrollBarWidth=w,this.sizeInfo.selectHeight=this.$newElement[0].offsetHeight,this.setPositionData()}},getSelectPosition:function(){var t,i=e(window),s=this.$newElement.offset(),n=e(this.options.container);this.options.container&&n.length&&!n.is("body")?((t=n.offset()).top+=parseInt(n.css("borderTopWidth")),t.left+=parseInt(n.css("borderLeftWidth"))):t={top:0,left:0};var o=this.options.windowPadding;this.sizeInfo.selectOffsetTop=s.top-t.top-i.scrollTop(),this.sizeInfo.selectOffsetBot=i.height()-this.sizeInfo.selectOffsetTop-this.sizeInfo.selectHeight-t.top-o[2],this.sizeInfo.selectOffsetLeft=s.left-t.left-i.scrollLeft(),this.sizeInfo.selectOffsetRight=i.width()-this.sizeInfo.selectOffsetLeft-this.sizeInfo.selectWidth-t.left-o[1],this.sizeInfo.selectOffsetTop-=o[0],this.sizeInfo.selectOffsetLeft-=o[3]},setMenuSize:function(e){this.getSelectPosition();var t,i,s,n,o,l,r,a,c=this.sizeInfo.selectWidth,d=this.sizeInfo.liHeight,h=this.sizeInfo.headerHeight,p=this.sizeInfo.searchHeight,u=this.sizeInfo.actionsHeight,f=this.sizeInfo.doneButtonHeight,m=this.sizeInfo.dividerHeight,v=this.sizeInfo.menuPadding,g=0;if(this.options.dropupAuto&&(r=d*this.selectpicker.current.elements.length+v.vert,a=this.sizeInfo.selectOffsetTop-this.sizeInfo.selectOffsetBot>this.sizeInfo.menuExtras.vert&&r+this.sizeInfo.menuExtras.vert+50>this.sizeInfo.selectOffsetBot,!0===this.selectpicker.isSearching&&(a=this.selectpicker.dropup),this.$newElement.toggleClass(V.DROPUP,a),this.selectpicker.dropup=a),"auto"===this.options.size)n=this.selectpicker.current.elements.length>3?3*this.sizeInfo.liHeight+this.sizeInfo.menuExtras.vert-2:0,i=this.sizeInfo.selectOffsetBot-this.sizeInfo.menuExtras.vert,s=n+h+p+u+f,l=Math.max(n-v.vert,0),this.$newElement.hasClass(V.DROPUP)&&(i=this.sizeInfo.selectOffsetTop-this.sizeInfo.menuExtras.vert),o=i,t=i-h-p-u-f-v.vert;else if(this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size){for(var b=0;b<this.options.size;b++)"divider"===this.selectpicker.current.data[b].type&&g++;t=(i=d*this.options.size+g*m+v.vert)-v.vert,o=i+h+p+u+f,s=l=""}this.$menu.css({"max-height":o+"px",overflow:"hidden","min-height":s+"px"}),this.$menuInner.css({"max-height":t+"px","overflow-y":"auto","min-height":l+"px"}),this.sizeInfo.menuInnerHeight=Math.max(t,1),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),"auto"===this.options.dropdownAlignRight&&this.$menu.toggleClass(V.MENURIGHT,this.sizeInfo.selectOffsetLeft>this.sizeInfo.selectOffsetRight&&this.sizeInfo.selectOffsetRight<this.sizeInfo.totalMenuWidth-c),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 i=this,s=e(window);this.setMenuSize(),this.options.liveSearch&&this.$searchbox.off("input.setMenuSize propertychange.setMenuSize").on("input.setMenuSize propertychange.setMenuSize",(function(){return i.setMenuSize()})),"auto"===this.options.size?s.off("resize.bs.select."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize").on("resize.bs.select."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize",(function(){return i.setMenuSize()})):this.options.size&&"auto"!=this.options.size&&this.selectpicker.current.elements.length>this.options.size&&s.off("resize.bs.select."+this.selectId+".setMenuSize scroll"+j+"."+this.selectId+".setMenuSize")}this.createView(!1,!0,t)},setWidth:function(){var e=this;"auto"===this.options.width?requestAnimationFrame((function(){e.$menu.css("min-width","0"),e.$element.on("loaded.bs.select",(function(){e.liHeight(),e.setMenuSize();var t=e.$newElement.clone().appendTo("body"),i=t.css("width","auto").children("button").outerWidth();t.remove(),e.sizeInfo.selectWidth=Math.max(e.sizeInfo.totalMenuWidth,i),e.$newElement.css("width",e.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[0].classList.remove("fit-width")},selectPosition:function(){this.$bsContainer=e('<div class="bs-container" />');var t,i,s,n=this,o=e(this.options.container),l=function(l){var r={},a=n.options.display||!!e.fn.dropdown.Constructor.Default&&e.fn.dropdown.Constructor.Default.display;n.$bsContainer.addClass(l.attr("class").replace(/form-control|fit-width/gi,"")).toggleClass(V.DROPUP,l.hasClass(V.DROPUP)),t=l.offset(),o.is("body")?i={top:0,left:0}:((i=o.offset()).top+=parseInt(o.css("borderTopWidth"))-o.scrollTop(),i.left+=parseInt(o.css("borderLeftWidth"))-o.scrollLeft()),s=l.hasClass(V.DROPUP)?0:l[0].offsetHeight,(M.major<4||"static"===a)&&(r.top=t.top-i.top+s,r.left=t.left-i.left),r.width=l[0].offsetWidth,n.$bsContainer.css(r)};this.$button.on("click.bs.dropdown.data-api",(function(){n.isDisabled()||(l(n.$newElement),n.$bsContainer.appendTo(n.options.container).toggleClass(V.SHOW,!n.$button.hasClass(V.SHOW)).append(n.$menu))})),e(window).off("resize.bs.select."+this.selectId+" scroll"+j+"."+this.selectId).on("resize.bs.select."+this.selectId+" scroll"+j+"."+this.selectId,(function(){n.$newElement.hasClass(V.SHOW)&&l(n.$newElement)})),this.$element.on("hide.bs.select",(function(){n.$menu.data("height",n.$menu.height()),n.$bsContainer.detach()}))},setOptionStatus:function(e){if(this.noScroll=!1,this.selectpicker.view.visibleElements&&this.selectpicker.view.visibleElements.length)for(var t=0;t<this.selectpicker.view.visibleElements.length;t++){var i=this.selectpicker.current.data[t+this.selectpicker.view.position0],s=i.option;s&&(!0!==e&&this.setDisabled(i.index,i.disabled),this.setSelected(i.index,s.selected))}},setSelected:function(e,t){var i,s,n=this.selectpicker.main.elements[e],o=this.selectpicker.main.data[e],l=void 0!==this.activeIndex,r=this.activeIndex===e||t&&!this.multiple&&!l;o.selected=t,s=n.firstChild,t&&(this.selectedIndex=e),n.classList.toggle("selected",t),r?(this.focusItem(n,o),this.selectpicker.view.currentActive=n,this.activeIndex=e):this.defocusItem(n),s&&(s.classList.toggle("selected",t),t?s.setAttribute("aria-selected",!0):this.multiple?s.setAttribute("aria-selected",!1):s.removeAttribute("aria-selected")),r||l||!t||void 0===this.prevActiveIndex||(i=this.selectpicker.main.elements[this.prevActiveIndex],this.defocusItem(i))},setDisabled:function(e,t){var i,s=this.selectpicker.main.elements[e];this.selectpicker.main.data[e].disabled=t,i=s.firstChild,s.classList.toggle(V.DISABLED,t),i&&("4"===M.major&&i.classList.toggle(V.DISABLED,t),t?(i.setAttribute("aria-disabled",t),i.setAttribute("tabindex",-1)):(i.removeAttribute("aria-disabled"),i.setAttribute("tabindex",0)))},isDisabled:function(){return this.$element[0].disabled},checkDisabled:function(){this.isDisabled()?(this.$newElement[0].classList.add(V.DISABLED),this.$button.addClass(V.DISABLED).attr("aria-disabled",!0)):this.$button[0].classList.contains(V.DISABLED)&&(this.$newElement[0].classList.remove(V.DISABLED),this.$button.removeClass(V.DISABLED).attr("aria-disabled",!1))},clickListener:function(){var t=this,i=e(document);function s(){t.options.liveSearch?t.$searchbox.trigger("focus"):t.$menuInner.trigger("focus")}function n(){t.dropdown&&t.dropdown._popper&&t.dropdown._popper.state.isCreated?s():requestAnimationFrame(n)}i.data("spaceSelect",!1),this.$button.on("keyup",(function(e){/(32)/.test(e.keyCode.toString(10))&&i.data("spaceSelect")&&(e.preventDefault(),i.data("spaceSelect",!1))})),this.$newElement.on("show.bs.dropdown",(function(){M.major>3&&!t.dropdown&&(t.dropdown=t.$button.data("bs.dropdown"),t.dropdown._menu=t.$menu[0])})),this.$button.on("click.bs.dropdown.data-api",(function(){t.$newElement.hasClass(V.SHOW)||t.setSize()})),this.$element.on("shown.bs.select",(function(){t.$menuInner[0].scrollTop!==t.selectpicker.view.scrollTop&&(t.$menuInner[0].scrollTop=t.selectpicker.view.scrollTop),M.major>3?requestAnimationFrame(n):s()})),this.$menuInner.on("mouseenter","li a",(function(e){var i=this.parentElement,s=t.isVirtual()?t.selectpicker.view.position0:0,n=Array.prototype.indexOf.call(i.parentElement.children,i),o=t.selectpicker.current.data[n+s];t.focusItem(i,o,!0)})),this.$menuInner.on("click","li a",(function(i,s){var n=e(this),o=t.$element[0],l=t.isVirtual()?t.selectpicker.view.position0:0,r=t.selectpicker.current.data[n.parent().index()+l],a=r.index,c=v(o),d=o.selectedIndex,h=o.options[d],p=!0;if(t.multiple&&1!==t.options.maxOptions&&i.stopPropagation(),i.preventDefault(),!t.isDisabled()&&!n.parent().hasClass(V.DISABLED)){var u=r.option,f=e(u),g=u.selected,w=f.parent("optgroup"),I=w.find("option"),x=t.options.maxOptions,k=w.data("maxOptions")||!1;if(a===t.activeIndex&&(s=!0),s||(t.prevActiveIndex=t.activeIndex,t.activeIndex=void 0),t.multiple){if(u.selected=!g,t.setSelected(a,!g),n.trigger("blur"),!1!==x||!1!==k){var y=x<m(o).length,$=k<w.find("option:selected").length;if(x&&y||k&&$)if(x&&1==x)o.selectedIndex=-1,u.selected=!0,t.setOptionStatus(!0);else if(k&&1==k){for(var S=0;S<I.length;S++){var E=I[S];E.selected=!1,t.setSelected(E.liIndex,!1)}u.selected=!0,t.setSelected(a,!0)}else{var C="string"==typeof t.options.maxOptionsText?[t.options.maxOptionsText,t.options.maxOptionsText]:t.options.maxOptionsText,O="function"==typeof C?C(x,k):C,z=O[0].replace("{n}",x),T=O[1].replace("{n}",k),N=e('<div class="notify"></div>');O[2]&&(z=z.replace("{var}",O[2][x>1?0:1]),T=T.replace("{var}",O[2][k>1?0:1])),u.selected=!1,t.$menu.append(N),x&&y&&(N.append(e("<div>"+z+"</div>")),p=!1,t.$element.trigger("maxReached.bs.select")),k&&$&&(N.append(e("<div>"+T+"</div>")),p=!1,t.$element.trigger("maxReachedGrp.bs.select")),setTimeout((function(){t.setSelected(a,!1)}),10),N[0].classList.add("fadeOut"),setTimeout((function(){N.remove()}),1050)}}}else h&&(h.selected=!1),u.selected=!0,t.setSelected(a,!0);!t.multiple||t.multiple&&1===t.options.maxOptions?t.$button.trigger("focus"):t.options.liveSearch&&t.$searchbox.trigger("focus"),p&&(t.multiple||d!==o.selectedIndex)&&(b=[u.index,f.prop("selected"),c],t.$element.triggerNative("change"))}})),this.$menu.on("click","li."+V.DISABLED+" a, ."+V.POPOVERHEADER+", ."+V.POPOVERHEADER+" :not(.close)",(function(i){i.currentTarget==this&&(i.preventDefault(),i.stopPropagation(),t.options.liveSearch&&!e(i.target).hasClass("close")?t.$searchbox.trigger("focus"):t.$button.trigger("focus"))})),this.$menuInner.on("click",".divider, .dropdown-header",(function(e){e.preventDefault(),e.stopPropagation(),t.options.liveSearch?t.$searchbox.trigger("focus"):t.$button.trigger("focus")})),this.$menu.on("click","."+V.POPOVERHEADER+" .close",(function(){t.$button.trigger("click")})),this.$searchbox.on("click",(function(e){e.stopPropagation()})),this.$menu.on("click",".actions-btn",(function(i){t.options.liveSearch?t.$searchbox.trigger("focus"):t.$button.trigger("focus"),i.preventDefault(),i.stopPropagation(),e(this).hasClass("bs-select-all")?t.selectAll():t.deselectAll()})),this.$button.on("focus.bs.select",(function(e){var i=t.$element[0].getAttribute("tabindex");void 0!==i&&e.originalEvent&&e.originalEvent.isTrusted&&(this.setAttribute("tabindex",i),t.$element[0].setAttribute("tabindex",-1),t.selectpicker.view.tabindex=i)})).on("blur.bs.select",(function(e){void 0!==t.selectpicker.view.tabindex&&e.originalEvent&&e.originalEvent.isTrusted&&(t.$element[0].setAttribute("tabindex",t.selectpicker.view.tabindex),this.setAttribute("tabindex",-1),t.selectpicker.view.tabindex=void 0)})),this.$element.on("change.bs.select",(function(){t.render(),t.$element.trigger("changed.bs.select",b),b=null})).on("focus.bs.select",(function(){t.options.mobile||t.$button.trigger("focus")}))},liveSearchListener:function(){var e=this;this.$button.on("click.bs.dropdown.data-api",(function(){e.$searchbox.val()&&e.$searchbox.val("")})),this.$searchbox.on("click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api",(function(e){e.stopPropagation()})),this.$searchbox.on("input propertychange",(function(){var t=e.$searchbox.val();if(e.selectpicker.search.elements=[],e.selectpicker.search.data=[],t){var i=[],s=t.toUpperCase(),n={},o=[],l=e._searchStyle(),r=e.options.liveSearchNormalize;r&&(s=E(s));for(var a=0;a<e.selectpicker.main.data.length;a++){var c=e.selectpicker.main.data[a];n[a]||(n[a]=I(c,s,l,r)),n[a]&&void 0!==c.headerIndex&&-1===o.indexOf(c.headerIndex)&&(c.headerIndex>0&&(n[c.headerIndex-1]=!0,o.push(c.headerIndex-1)),n[c.headerIndex]=!0,o.push(c.headerIndex),n[c.lastIndex+1]=!0),n[a]&&"optgroup-label"!==c.type&&o.push(a)}a=0;for(var d=o.length;a<d;a++){var h=o[a],p=o[a-1],u=(c=e.selectpicker.main.data[h],e.selectpicker.main.data[p]);("divider"!==c.type||"divider"===c.type&&u&&"divider"!==u.type&&d-1!==a)&&(e.selectpicker.search.data.push(c),i.push(e.selectpicker.main.elements[h]))}e.activeIndex=void 0,e.noScroll=!0,e.$menuInner.scrollTop(0),e.selectpicker.search.elements=i,e.createView(!0),Y.call(e,i,t)}else e.$menuInner.scrollTop(0),e.createView(!1)}))},_searchStyle:function(){return this.options.liveSearchStyle||"contains"},val:function(e){var t=this.$element[0];if(void 0!==e){var i=v(t);if(b=[null,null,i],this.$element.val(e).trigger("changed.bs.select",b),this.$newElement.hasClass(V.SHOW))if(this.multiple)this.setOptionStatus(!0);else{var s=(t.options[t.selectedIndex]||{}).liIndex;"number"==typeof s&&(this.setSelected(this.selectedIndex,!1),this.setSelected(s,!0))}return this.render(),b=null,this.$element}return this.$element.val()},changeAll:function(e){if(this.multiple){void 0===e&&(e=!0);var t=this.$element[0],i=0,s=0,n=v(t);t.classList.add("bs-select-hidden");for(var o=0,l=this.selectpicker.current.data,r=l.length;o<r;o++){var a=l[o],c=a.option;c&&!a.disabled&&"divider"!==a.type&&(a.selected&&i++,c.selected=e,!0===e&&s++)}t.classList.remove("bs-select-hidden"),i!==s&&(this.setOptionStatus(),b=[null,null,n],this.$element.triggerNative("change"))}},selectAll:function(){return this.changeAll(!0)},deselectAll:function(){return this.changeAll(!1)},toggle:function(e){(e=e||window.event)&&e.stopPropagation(),this.$button.trigger("click.bs.dropdown.data-api")},keydown:function(t){var i,s,n,o,l,r=e(this),a=r.hasClass("dropdown-toggle"),c=(a?r.closest(".dropdown"):r.closest(F.MENU)).data("this"),d=c.findLis(),h=!1,p=t.which===W&&!a&&!c.options.selectOnTab,u=G.test(t.which)||p,f=c.$menuInner[0].scrollTop,m=!0===c.isVirtual()?c.selectpicker.view.position0:0;if(!(t.which>=112&&t.which<=123))if(!(s=c.$newElement.hasClass(V.SHOW))&&(u||t.which>=48&&t.which<=57||t.which>=96&&t.which<=105||t.which>=65&&t.which<=90)&&(c.$button.trigger("click.bs.dropdown.data-api"),c.options.liveSearch))c.$searchbox.trigger("focus");else{if(t.which===D&&s&&(t.preventDefault(),c.$button.trigger("click.bs.dropdown.data-api").trigger("focus")),u){if(!d.length)return;-1!==(i=(n=c.selectpicker.main.elements[c.activeIndex])?Array.prototype.indexOf.call(n.parentElement.children,n):-1)&&c.defocusItem(n),t.which===B?(-1!==i&&i--,i+m<0&&(i+=d.length),c.selectpicker.view.canHighlight[i+m]||-1===(i=c.selectpicker.view.canHighlight.slice(0,i+m).lastIndexOf(!0)-m)&&(i=d.length-1)):(t.which===R||p)&&(++i+m>=c.selectpicker.view.canHighlight.length&&(i=0),c.selectpicker.view.canHighlight[i+m]||(i=i+1+c.selectpicker.view.canHighlight.slice(i+m+1).indexOf(!0))),t.preventDefault();var v=m+i;t.which===B?0===m&&i===d.length-1?(c.$menuInner[0].scrollTop=c.$menuInner[0].scrollHeight,v=c.selectpicker.current.elements.length-1):h=(l=(o=c.selectpicker.current.data[v]).position-o.height)<f:(t.which===R||p)&&(0===i?(c.$menuInner[0].scrollTop=0,v=0):h=(l=(o=c.selectpicker.current.data[v]).position-c.sizeInfo.menuInnerHeight)>f),n=c.selectpicker.current.elements[v],c.activeIndex=c.selectpicker.current.data[v].index,c.focusItem(n),c.selectpicker.view.currentActive=n,h&&(c.$menuInner[0].scrollTop=l),c.options.liveSearch?c.$searchbox.trigger("focus"):r.trigger("focus")}else if(!r.is("input")&&!q.test(t.which)||t.which===P&&c.selectpicker.keydown.keyHistory){var g,b,w=[];t.preventDefault(),c.selectpicker.keydown.keyHistory+=L[t.which],c.selectpicker.keydown.resetKeyHistory.cancel&&clearTimeout(c.selectpicker.keydown.resetKeyHistory.cancel),c.selectpicker.keydown.resetKeyHistory.cancel=c.selectpicker.keydown.resetKeyHistory.start(),b=c.selectpicker.keydown.keyHistory,/^(.)\1+$/.test(b)&&(b=b.charAt(0));for(var x=0;x<c.selectpicker.current.data.length;x++){var k=c.selectpicker.current.data[x];I(k,b,"startsWith",!0)&&c.selectpicker.view.canHighlight[x]&&w.push(k.index)}if(w.length){var y=0;d.removeClass("active").find("a").removeClass("active"),1===b.length&&(-1===(y=w.indexOf(c.activeIndex))||y===w.length-1?y=0:y++),g=w[y],f-(o=c.selectpicker.main.data[g]).position>0?(l=o.position-o.height,h=!0):(l=o.position-c.sizeInfo.menuInnerHeight,h=o.position>f+c.sizeInfo.menuInnerHeight),n=c.selectpicker.main.elements[g],c.activeIndex=w[y],c.focusItem(n),n&&n.firstChild.focus(),h&&(c.$menuInner[0].scrollTop=l),r.trigger("focus")}}s&&(t.which===P&&!c.selectpicker.keydown.keyHistory||t.which===H||t.which===W&&c.options.selectOnTab)&&(t.which!==P&&t.preventDefault(),c.options.liveSearch&&t.which===P||(c.$menuInner.find(".active a").trigger("click",!0),r.trigger("focus"),c.options.liveSearch||(t.preventDefault(),e(document).data("spaceSelect",!0))))}},mobile:function(){this.options.mobile=!0,this.$element[0].classList.add("mobile-device")},refresh:function(){var t=e.extend({},this.options,this.$element.data());this.options=t,this.checkDisabled(),this.buildData(),this.setStyle(),this.render(),this.buildList(),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(j).removeData("selectpicker").removeClass("bs-select-hidden selectpicker"),e(window).off(".bs.select."+this.selectId)}};var Q=e.fn.selectpicker;function X(){if(e.fn.dropdown){var t=e.fn.dropdown.Constructor._dataApiKeydownHandler||e.fn.dropdown.Constructor.prototype.keydown;return t.apply(this,arguments)}}e.fn.selectpicker=J,e.fn.selectpicker.Constructor=Z,e.fn.selectpicker.noConflict=function(){return e.fn.selectpicker=Q,this},e(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api",':not(.bootstrap-select) > [data-toggle="dropdown"]',X).on("keydown.bs.dropdown.data-api",":not(.bootstrap-select) > .dropdown-menu",X).on("keydown.bs.select",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',Z.prototype.keydown).on("focusin.modal",'.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bootstrap-select .bs-searchbox input',(function(e){e.stopPropagation()})),e(window).on("load.bs.select.data-api",(function(){e(".selectpicker").each((function(){var t=e(this);J.call(t,t.data())}))}))}(e)})); |