var updraft_restore_screen=!0;jQuery(function(p){var o,n,d,l=p("#updraftplus_ajax_restore_job_id").val(),e=p("#updraftplus_ajax_restore_action").val(),u=0,i=p("#updraftplus_ajax_restore_output"),_=p(".updraft_restore_components_list"),r=!1,c=0,f=0;function g(e,t){var r=new XMLHttpRequest,e="action="+t+"&updraftplus_ajax_restore=do_ajax_restore&job_id="+e,o=("updraft_ajaxrestore"===t&&(e+="&nonce="+updraft_credentialtest_nonce),0),n=!0,d=p("#updraftplus_ajax_restore_debug").length;r.open("POST",ajaxurl,!0),r.onprogress=function(e){if(200<=e.currentTarget.status&&e.currentTarget.status<300){if(-1!==e.currentTarget.responseText.indexOf(""+e.data.fileindex+"").replace("%s2",""+e.data.total_files+"")),"db"==e.stage&&e.data.hasOwnProperty("stage")&&("table"==e.data.stage?t.find(".updraft_component--progress").html(" — "+updraftlion.restore_db_table_progress.replace("%s",""+e.data.table+"")):"stored_routine"==e.data.stage?t.find(".updraft_component--progress").html(" — "+updraftlion.restore_db_stored_routine_progress.replace("%s",""+e.data.routine_name+"")):"finished"==e.data.stage?t.find(".updraft_component--progress").html(" — "+updraftlion.finished):"begun"==e.data.stage&&t.find(".updraft_component--progress").html(" — "+updraftlion.begun+"...")),n!==d&&(n&&((a=_.find("[data-component="+n+"]")).find(".updraft_component--progress").html(""),a.removeClass("active").addClass("done")),"finished"==d?(t.addClass("done"),_.find("[data-component]").each(function(e,t){($el=p(t)).is(".done")||$el.addClass("error")}),e.data.hasOwnProperty("actions")&&"object"==typeof e.data.actions&&(a=e.data.urls,s=[],p.each(a,function(e,t){var r=new XMLHttpRequest;r.open("GET",t,!1),r.send(null),404==r.status&&s.push(t)}),r=s,p.isEmptyObject(r)||(p(".updraft_restore_result").before(updraftlion.ajax_restore_404_detected),p.each(r,function(e,t){p(".updraft_missing_pages").append("
  • "+t+"
  • ")})),p.each(e.data.actions,function(e,t){_.after(''+e+"")}))):t.addClass("active")),n=d)}p("#updraft-restore-hidethis").remove(),g(l,e),p("#updraftplus_ajax_restore_progress").on("click","#updraft_restore_resume",function(e){e.preventDefault(),p("#updraftplus_ajax_restore_progress").slideUp(1e3,function(){p(this).remove()}),g(l,"updraft_ajaxrestore_continue")}),p(document).on("heartbeat-tick",function(e,t){t.hasOwnProperty("wp-auth-check")&&(t["wp-auth-check"]?(r&&t["wp-auth-check"]&&(u=Math.round(Date.now()/1e3),r=!1),t.hasOwnProperty("updraftplus")&&(t=t.updraftplus).hasOwnProperty("updraft_credentialtest_nonce")&&(updraft_credentialtest_nonce=t.updraft_credentialtest_nonce,u=Math.round(Date.now()/1e3))):r=!0)})});