!function(){"use strict";document.addEventListener("DOMContentLoaded",(()=>{(()=>{const e=document.querySelector("#wpmastertoolkit-duplicate-menu-notice"),t=document.querySelector("#wp-mastertoolkit-duplicate-menu-source"),o=document.querySelector("#wp-mastertoolkit-duplicate-menu-destination"),s=document.querySelector("#wp-mastertoolkit-duplicate-menu-btn");o&&o.addEventListener("keyup",(()=>{o.classList.remove("red-border"),e.classList.remove("show")})),s&&s.addEventListener("click",(s=>{s.preventDefault();const n=t.value;if(null===n||""===n)return void t.classList.add("red-border");const c=o.value;if(null===c||""===c)return void o.classList.add("red-border");const a=new FormData;a.append("action",wpmastertoolkitDuplicateMenu.action),a.append("nonce",wpmastertoolkitDuplicateMenu.nonce),a.append("source",n),a.append("destination",c);const r={method:"POST",body:a,redirect:"follow"};fetch(wpmastertoolkitDuplicateMenu.ajaxUrl,r).then((e=>e.json())).then((t=>{t.success?(e.classList.add("success"),e.classList.add("show")):e.classList.add("show");const o=e.querySelector(".wp-mastertoolkit__section__notice__message");o&&(o.textContent=t.data.message)})).catch((e=>{console.log("Error...")}))}))})()}))}();