jQuery(function(e){var t=wp.i18n.__,r=document.querySelector("#rollback-plugin"),a=e(r).find("button"),n=function(){"true"===a.attr("aria-busy")&&a.text(a.data("text")).data("text","").attr("aria-busy",!1).prop("disabled",!1).removeClass("is-busy")},o=function(e){var t;n(),GLSR.notices.error(null!==(t=e.error)&&void 0!==t?t:GLSR.text.rollback_error),console.error(e)},s=function(e){var r,a;_.isObject(e)&&!_.isFunction(e.always)?a=e.errorMessage:_.isString(e)&&"-1"===e?a=t("An error has occurred. Please reload the page and try again."):_.isString(e)?a=e:void 0!==e.readyState&&0===e.readyState?a=t("Connection lost or the server is busy. Please try again later."):_.isString(e.responseText)&&""!==e.responseText?a=e.responseText:_.isString(e.statusText)&&(a=e.statusText),a=a.replace(/<[\/a-z][^<>]*>/gi,""),GLSR.notices.error((null!==(r=e.error)&&void 0!==r?r:GLSR.text.rollback_error)+": "+a)},i=function(e){wp.ajax.send({data:e.data,error:s,success:function(){return window.location=e.url}}).always(function(e){n(),void 0!==e.debug&&_.map(e.debug,function(e){return console.info(e)})})};e(r).on("submit",function(e){e.preventDefault();var t={_ajax_request:!0,action:GLSR.action},n={_action:r.action.value,_nonce:r._wpnonce.value,version:r.version.value};t[GLSR.nameprefix]=n,function(){if(["false",void 0].includes(a.attr("aria-busy"))){var e=(a.data("loading")||a.data("text")).replace("%s","v"+r.version.value);a.addClass("is-busy").prop("disabled",!0).attr("aria-busy",!0).data("text",a.text()).text(e)}}(),wp.ajax.send({data:t,error:o,success:i})})});
