(()=>{"use strict";document.addEventListener("DOMContentLoaded",(()=>{!function(e){const{activating:a,installing:s,done:t,activationUrl:c,redirectUrl:i,ajaxUrl:n,nonce:o,masteriyoRefNonce:d,masteriyoStatus:r}=eduacademyData,l=e(".eduacademy-welcome-notice #eduacademy-install-masteriyo"),m=e(".eduacademy-welcome-notice .notice-dismiss"),u=e(".eduacademy-welcome-notice"),y=l.find(".text"),w=l.find(".dashicons"),p=()=>{u.fadeTo(100,0,(()=>{u.slideUp(100,(()=>{u.remove()}))}))},v=async()=>{var s;y.text(a),await(s=c,new Promise((e=>{jQuery.get(s).done((()=>{e({success:!0})})).fail((()=>{e({success:!1})}))}))),await e.post(n,{nonce:d,action:"eduacademy_set_masteriyo_ref"}),w.removeClass("dashicons-update"),w.addClass("dashicons-yes"),y.text(t),setTimeout(p,1500),window.location.replace(i)};e(l).on("click",(async()=>{w.removeClass("hidden"),l.attr("disabled",!0),"active"!==r&&("installed"!==r?(y.text(s),await new Promise((e=>{wp.updates.ajax("install-plugin",{slug:"learning-management-system",success:()=>{e({success:!0})},error:a=>{e({success:!1,code:a.errorCode})}})})),await v()):await v())})),e(m).on("click",(()=>{e.post(n,{nonce:o,action:"eduacademy_dismiss_welcome_notice",success:p})}))}(jQuery)}))})();