function dselectUpdate(e,t,a){const d=e.dataset.dselectValue,o=e.closest(`.${t}`).previousElementSibling,f=o.nextElementSibling.getElementsByClassName(a)[0],i=o.nextElementSibling.querySelector("input");o.multiple?Array.from(o.options).filter(m=>m.value===d)[0].selected=!0:o.value=d,o.multiple&&f.click(),o.dispatchEvent(new Event("change")),f.focus(),i&&(i.value="")}function dselectRemoveTag(e,t,a){const d=e.parentNode.dataset.dselectValue,o=e.closest(`.${t}`).previousElementSibling,f=o.nextElementSibling.getElementsByClassName(a)[0],i=o.nextElementSibling.querySelector("input");Array.from(o.options).filter(m=>m.value===d)[0].selected=!1,o.dispatchEvent(new Event("change")),f.click(),i&&(i.value="")}function dselectSearch(e,t,a,d,o){const f=t.value.toLowerCase().trim(),i=t.nextElementSibling,m=i.querySelectorAll(".dropdown-header"),x=i.querySelectorAll(".dropdown-item"),p=i.nextElementSibling;m.forEach(c=>c.classList.add("d-none"));for(const c of x)if(c.textContent.toLowerCase().indexOf(f)>-1){c.classList.remove("d-none");let g=c;for(;g=g.previousElementSibling;)if(g.classList.contains("dropdown-header")){g.classList.remove("d-none");break}}else c.classList.add("d-none");if(Array.from(x).filter(c=>!c.classList.contains("d-none")&&!c.hasAttribute("hidden")).length<1){if(p.classList.remove("d-none"),i.classList.add("d-none"),o&&(p.innerHTML=`Press Enter to add "${t.value}"`,e.key==="Enter")){const c=t.closest(`.${a}`).previousElementSibling,h=c.nextElementSibling.getElementsByClassName(d)[0];c.insertAdjacentHTML("afterbegin",``),c.dispatchEvent(new Event("change")),t.value="",t.dispatchEvent(new Event("keyup")),h.click(),h.focus()}}else p.classList.add("d-none"),i.classList.remove("d-none")}function dselectClear(e,t){const a=e.closest(`.${t}`).previousElementSibling;Array.from(a.options).forEach(d=>d.selected=!1),a.dispatchEvent(new Event("change"))}function dselect(e,t={}){e.style.display="none";const a="dselect-wrapper",d="dselect-no-results",o="dselect-tag",f="dselect-tag-remove",i="dselect-placeholder",m="dselect-clear",x="dselect-clearable",p=!1,S=!1,c=!1,h="360px",g="",A=w("search")||t.search||p,k=w("creatable")||t.creatable||S,y=w("clearable")||t.clearable||c,M=e.dataset.dselectMaxHeight||t.maxHeight||h;let E=e.dataset.dselectSize||t.size||g;E=E!==""?` form-select-${E}`:"";const b=`form-select${E}`,H=A?``:"";function w(n){const l=`data-dselect-${n}`;return e.hasAttribute(l)?e.getAttribute(l).toLowerCase()==="true":null}function B(){e.nextElementSibling&&e.nextElementSibling.classList&&e.nextElementSibling.classList.contains(a)&&e.nextElementSibling.remove()}function $(n){return n.getAttribute("value")===""}function L(n,l){if(l){const s=Array.from(n).filter(r=>r.selected&&!$(r)),v=Array.from(n).filter(r=>$(r));let u=[];if(s.length===0){const r=v.length?v[0].textContent:" ";u.push(`${r}`)}else for(const r of s)u.push(`
${r.text}
`);return u.join("")}else{const s=n[n.selectedIndex];return $(s)?`${s.innerHTML}`:s.innerHTML}}function C(n){const l=n[n.selectedIndex];return $(l)?"":l.textContent}function T(n){let l=[];for(const s of n)if(s.tagName==="OPTGROUP")l.push(``);else{const v=$(s)?" hidden":"",u=s.selected?" active":"",r=e.multiple&&s.selected?" disabled":"",O=s.value,q=s.textContent;l.push(`${q}`)}return l=l.join(""),l}function z(){const n=e.multiple?' data-bs-auto-close="outside"':"",l=Array.from(e.classList).filter(u=>u!=="form-select"&&u!=="form-select-sm"&&u!=="form-select-lg").join(" "),s=y&&!e.multiple?` `:"",v=` `;B(),e.insertAdjacentHTML("afterend",v)}z();function N(){const n=e.nextElementSibling,l=n.getElementsByClassName(b)[0],s=n.getElementsByClassName("dselect-items")[0];l.innerHTML=L(e.options,e.multiple),s.innerHTML=T(e.querySelectorAll("*")),e.multiple||(l.dataset.dselectText=C(e.options))}e.addEventListener("change",N)}