/*! For license information please see npm.multi.js.347b0691cd1b6a13fbf9.js.LICENSE.txt */
"use strict";(self.webpackChunkpaper_admin=self.webpackChunkpaper_admin||[]).push([[9887],{8880:(e,t,n)=>{n.d(t,{Z:()=>o});var a,l,r,d,i,s=(a=!1,l=function(e,t){var n,l,r=t.limit;if(r>-1){var d=0;for(n=0;n<e.options.length;n++)e.options[n].selected&&d++;if(d===r)for(a=!0,"function"==typeof t.limit_reached&&t.limit_reached(),n=0;n<e.options.length;n++)(l=e.options[n]).selected||l.setAttribute("disabled",!0);else if(a){for(n=0;n<e.options.length;n++)"false"===(l=e.options[n]).getAttribute("data-origin-disabled")&&l.removeAttribute("disabled");a=!1}}},r=function(e,t,n){var a,r,d=e.options[t.target.getAttribute("multi-index")];d.disabled||(d.selected=!d.selected,l(e,n),a=e,(r=document.createEvent("HTMLEvents")).initEvent("change",!1,!0),a.dispatchEvent(r))},d=function(e){var t=document.createElement("div");if(t.className="item-group",e.label){var n=document.createElement("span");n.innerHTML=e.label,n.className="group-label",t.appendChild(n)}return t},i=function(e,t){var n;if(e.wrapper.selected.innerHTML="",e.wrapper.non_selected.innerHTML="",t.non_selected_header&&t.selected_header){var a=document.createElement("div"),l=document.createElement("div");a.className="header",l.className="header",a.innerText=t.non_selected_header,l.innerText=t.selected_header,e.wrapper.non_selected.appendChild(a),e.wrapper.selected.appendChild(l)}if(e.wrapper.search)var r=e.wrapper.search.value;var i=null,s=null,o=null,c=null;for(n=0;n<e.options.length;n++){var p=e.options[n],u=p.value,h=p.textContent||p.innerText,m=document.createElement("a");if(m.tabIndex=0,m.className="item",m.innerText=h,m.setAttribute("role","button"),m.setAttribute("data-value",u),m.setAttribute("multi-index",n),p.disabled&&(m.className+=" disabled"),p.parentNode===e&&(i=null,s=null),"OPTGROUP"===p.parentNode.nodeName&&p.parentNode!==s&&(s=p.parentNode,i=d(s),e.wrapper.non_selected.appendChild(i)),p.selected){m.className+=" selected";var v=m.cloneNode(!0);i?i!==c&&(c=i,o=d(s),e.wrapper.selected.appendChild(o)):(c=null,o=null),o?o.appendChild(v):e.wrapper.selected.appendChild(v)}p.parentNode===e&&(i=null,s=null),(!r||r&&h.toLowerCase().indexOf(r.toLowerCase())>-1)&&(null!=i?i.appendChild(m):e.wrapper.non_selected.appendChild(m))}if(t.hide_empty_groups){var f=document.getElementsByClassName("item-group");for(n=0;n<f.length;n++)f[n].childElementCount<2&&(f[n].style.display="none")}},function(e,t){if((t=void 0!==t?t:{}).enable_search=void 0===t.enable_search||t.enable_search,t.search_placeholder=void 0!==t.search_placeholder?t.search_placeholder:"Search...",t.non_selected_header=void 0!==t.non_selected_header?t.non_selected_header:null,t.selected_header=void 0!==t.selected_header?t.selected_header:null,t.limit=void 0!==t.limit?parseInt(t.limit):-1,isNaN(t.limit)&&(t.limit=-1),t.hide_empty_groups=void 0!==t.hide_empty_groups&&t.hide_empty_groups,null==e.dataset.multijs&&"SELECT"===e.nodeName&&e.multiple){e.style.display="none",e.setAttribute("data-multijs",!0);var n=document.createElement("div");if(n.className="multi-wrapper",t.enable_search){var a=document.createElement("input");a.className="search-input",a.type="text",a.setAttribute("autocomplete","off"),a.setAttribute("placeholder",t.search_placeholder),a.setAttribute("title",t.search_placeholder),a.addEventListener("input",(function(){i(e,t)})),n.appendChild(a),n.search=a}var d=document.createElement("div");d.className="non-selected-wrapper";var s=document.createElement("div");s.className="selected-wrapper",n.addEventListener("click",(function(n){n.target.getAttribute("multi-index")&&r(e,n,t)})),n.addEventListener("keypress",(function(n){var a=32===n.keyCode||13===n.keyCode;n.target.getAttribute("multi-index")&&a&&(n.preventDefault(),r(e,n,t))})),n.appendChild(d),n.appendChild(s),n.non_selected=d,n.selected=s,e.wrapper=n,e.parentNode.insertBefore(n,e.nextSibling);for(var o=0;o<e.options.length;o++){var c=e.options[o];c.setAttribute("data-origin-disabled",c.disabled)}l(e,t),i(e,t),e.addEventListener("change",(function(){i(e,t)}))}});"undefined"!=typeof jQuery&&function(e){e.fn.multi=function(t){return t=void 0!==t?t:{},this.each((function(){var n=e(this);s(n.get(0),t)}))}}(jQuery);const o=s}}]);
//# sourceMappingURL=npm.multi.js.347b0691cd1b6a13fbf9.js.map