jQuery(function(n){n(document).on("click",".sp-pagebuilder-btn-install",function(e){e.preventDefault();var a=n(this),s=a.closest("li").data("integration");n.ajax({type:"POST",url:"index.php?option=com_sppagebuilder&task=integrations.install&integration="+s,beforeSend:function(){a.html('<i class="fa fa-spinner fa-spin"></i> Installing...')},success:function(e){a.find("i").removeAttr("class");var s=n.parseJSON(e);s.success?(a.html('<i class="fa fa-check"></i> Installed'),setTimeout(function(){a.closest("li").removeAttr("class").addClass("installed")},500)):alert(s.message)}})}),n(document).on("click",".sp-pagebuilder-btn-enable",function(e){e.preventDefault();var a=n(this),s=a.closest("li").data("integration");n.ajax({type:"POST",url:"index.php?option=com_sppagebuilder&task=integrations.enable&integration="+s,beforeSend:function(){a.find("i").addClass("fa fa-spinner fa-spin")},success:function(e){a.find("i").removeAttr("class");var s=n.parseJSON(e);s.success?a.closest("li").removeAttr("class").addClass("enabled"):alert(s.message)}})}),n(document).on("click",".sp-pagebuilder-btn-disable",function(e){e.preventDefault();var a=n(this),s=a.closest("li").data("integration");n.ajax({type:"POST",url:"index.php?option=com_sppagebuilder&task=integrations.disable&integration="+s,beforeSend:function(){a.find("i").addClass("fa fa-spinner fa-spin")},success:function(e){a.find("i").removeAttr("class");var s=n.parseJSON(e);s.success?a.closest("li").removeAttr("class").addClass("installed"):alert(s.message)}})}),n(document).on("click",".sp-pagebuilder-btn-uninstall",function(e){e.preventDefault();var a=n(this),s=a.closest("li").data("integration");n.ajax({type:"POST",url:"index.php?option=com_sppagebuilder&task=integrations.uninstall&integration="+s,beforeSend:function(){a.html('<i class="fa fa-spinner fa-spin"></i> Uninstalling...')},success:function(e){a.find("i").remove();var s=n.parseJSON(e);s.success?(a.html('<i class="fa fa-check"></i> Uninstalled'),setTimeout(function(){a.html("Uninstall"),a.closest("li").removeAttr("class").addClass("available")},500)):alert(s.message)}})})});