(function(){"use strict";/**
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */Joomla=window.Joomla||{},function(e){e.submitbutton=function(d){if(d==="module.cancel"||document.formvalidator.isValid(document.getElementById("module-form"))){e.submitform(d,document.getElementById("module-form"));var i=e.getOptions("module-edit");if(window.self!==window.top){if(window.parent.viewLevels){var l=document.getElementById("jform_position").value,u=document.getElementById("jform_title").value,a=document.querySelector("#jform_assignment").value,c=document.querySelector("#jform_published").value,f=document.querySelector("#jform_access").value,s=window.parent.document.getElementById("menus-"+i.itemId),n=window.parent.document.getElementById("tr-"+i.itemId),r=window.parent.document.getElementById("status-"+i.itemId);window.parent.inMenus=[],window.parent.numMenus=[].slice.call(document.querySelectorAll('input[name="jform[assigned][]"]')).length,[].slice.call(document.querySelectorAll('input[name="jform[assigned][]"]')).forEach(function(t){a>0&&t.checked&&window.parent.inMenus.push(parseInt(t.value,10)),a<0&&(t.checked||window.parent.inMenus.push(parseInt(t.value,10)))}),a==="-"&&(s.innerHTML=e.sanitizeHtml('<span class="badge bg-danger">'+e.Text._("JNO")+"</span>"),(!n.classList.contains("no")||n.classList.length===0)&&n.classList.add("no")),parseInt(a,10)===0&&(s.innerHTML=e.sanitizeHtml('<span class="badge bg-info">'+e.Text._("JALL")+"</span>"),n.classList.contains("no")&&n.classList.remove("no")),parseInt(a,10)>0&&(window.parent.inMenus.indexOf(window.parent.menuId)>=0&&(window.parent.numMenus===window.parent.inMenus.length?(s.innerHTML=e.sanitizeHtml('<span class="badge bg-info">'+e.Text._("JALL")+"</span>"),(n.classList.contains("no")||n.classList.length===0)&&n.classList.remove("no")):(s.innerHTML=e.sanitizeHtml('<span class="badge bg-success">'+e.Text._("JYES")+"</span>"),n.classList.contains("no")&&n.classList.remove("no"))),window.parent.inMenus.indexOf(window.parent.menuId)<0&&(s.innerHTML=e.sanitizeHtml('<span class="badge bg-danger">'+e.Text._("JNO")+"</span>"),n.classList.contains("no")||n.classList.add("no"))),parseInt(a,10)<0&&(window.parent.inMenus.indexOf(window.parent.menuId)>=0&&(window.parent.numMenus===window.parent.inMenus.length?(s.innerHTML=e.sanitizeHtml('<span class="badge bg-info">'+e.Text._("JALL")+"</span>"),n.classList.contains("no")&&n.classList.remove("no")):(s.innerHTML=e.sanitizeHtml('<span class="badge bg-success">'+e.Text._("JYES")+"</span>"),n.classList.contains("no")&&n.classList.remove("no"))),window.parent.inMenus.indexOf(window.parent.menuId)<0&&(s.innerHTML=e.sanitizeHtml('<span class="badge bg-danger">'+e.Text._("JNO")+"</span>"),(!n.classList.contains("no")||n.classList.length===0)&&n.classList.add("no"))),parseInt(c,10)===1&&(r.innerHTML=e.sanitizeHtml('<span class="badge bg-success">'+e.Text._("JYES")+"</span>"),n.classList.contains("unpublished")&&n.classList.remove("unpublished")),parseInt(c,10)===0&&(r.innerHTML=e.sanitizeHtml('<span class="badge bg-danger">'+e.Text._("JNO")+"</span>"),(!n.classList.contains("unpublished")||n.classList.length===0)&&n.classList.add("unpublished")),parseInt(c,10)===-2&&(r.innerHTML=e.sanitizeHtml('<span class="badge bg-secondary">'+e.Text._("JTRASHED")+"</span>"),(!n.classList.contains("unpublished")||n.classList.length===0)&&n.classList.add("unpublished")),document.formvalidator.isValid(document.getElementById("module-form"))&&(window.parent.document.querySelector("#title-"+i.itemId).innerText=u,window.parent.document.querySelector("#position-"+i.itemId).innerText=l,window.parent.document.querySelector("#access-"+i.itemId).innerHTML=e.sanitizeHtml(window.parent.viewLevels[f]))}d!=="module.apply"&&window.parent.Joomla.Modal.getCurrent().close()}}}}(Joomla)})();
