!function(a,t,e){a(t).ready((function(){var s=a(t),i=wp.i18n.__,n=wp.i18n._x,l=wp.i18n.sprintf;s.on("click",".install-now",(function(t){t.preventDefault();var e=a(this);if(!e.hasClass("updating-message")&&!e.hasClass("button-disabled")){var s=e.data("slug");wp.updates.shouldRequestFilesystemCredentials&&!wp.updates.ajaxLocked&&wp.updates.requestFilesystemCredentials(t),wp.updates.installPlugin({slug:s,clear_destination:!0})}})),s.on("click",".activate-now",(function(t){t.preventDefault();var s=a(this),o=s.closest(".ayyash-options-plugin-card__wrap");if(!s.hasClass("updating-message")&&!s.hasClass("button-disabled")){s.addClass("updating-message").attr("aria-label",l(n("Activating %s...","plugin"),s.data("name"))).text(i("Activating...")),wp.a11y.speak(i("Activating... please wait."));var d=s.data("mainfile");wp.ajax.post("ayyash_activate_plugin",{nonce:e.nonce,mainfile:d}).then((function(){s.removeClass("updating-message"),s.removeClass("activate-now"),s.removeClass("primary-button"),s.addClass("deactivate-now"),s.attr("aria-label",l(n("Deactivate %s...","plugin"),s.data("name"))).text(i("Deactivate")),o.addClass("plugin-activated")})).fail((function(a){s.addClass("button-disabled"),console.log({e:a})}))}})),s.on("click",".deactivate-now",(function(t){t.preventDefault();var s=a(this),o=s.closest(".ayyash-options-plugin-card__wrap");if(!s.hasClass("updating-message")&&!s.hasClass("button-disabled")){s.addClass("updating-message").attr("aria-label",l(n("Deactivating %s...","plugin"),s.data("name"))).text(i("Deactivating...")),wp.a11y.speak(i("Deactivating... please wait."));var d=s.data("mainfile");wp.ajax.post("ayyash_deactivate_plugin",{nonce:e.nonce,mainfile:d}).then((function(){s.removeClass("updating-message").removeClass("deactivate-now").addClass("activate-now").attr("aria-label",l(n("Activate %s...","plugin"),s.data("name"))).text(i("Activate")),o.removeClass("plugin-activated")})).fail((function(a){s.addClass("button-disabled"),console.log({e:a})}))}}));var o=window.location.hash||"#recommended-plugins",d=function(a){return window.location.hash=a},c=a(".ayyash-options-tabs"),u=c.find(".ayyash-options-tabs__nav"),r=c.find(".ayyash-options-tabs__content"),p=function(t){var e=a('a[href="'+t+'"]'),s="#"+t.substring(1),i=r.find(s);e.addClass("tab--is-active").siblings().removeClass("tab--is-active").blur(),i.addClass("tab--is-active").siblings().removeClass("tab--is-active")};u.on("click",".ayyash-options-tabs__nav-item",(function(t){var e=a(t.currentTarget),s=t.currentTarget.hash;if(e.is(".nav-item-is--link"))return!0;t.preventDefault(),d(s)})),o&&(window.location.hash?(u.find('a[href="'+o+'"]').click(),p(o)):d(o)),a(window).on("hashchange",(function(a){a.preventDefault(),p(window.location.hash)}))}))}(jQuery,document,ayyashOptions||{admin_ajax:"",nonce:""});