text: function updraft_send_command(t,e,a,r){default_options={json_parse:!0,alert_on_error:!0,action:"updraft_ajax",nonce:updraft_credentialtest_nonce,nonce_key:"nonce",timeout:null,async:!0,type:"POST"},"undefined"==typeof r&&(r={});for(var n in default_options)r.hasOwnProperty(n)||(r[n]=default_options[n]);var o={action:r.action,subaction:t};if(o[r.nonce_key]=r.nonce,"object"==typeof e)for(var d in e)o[d]=e[d];else o.action_data=e;var u={type:r.type,url:ajaxurl,data:o,success:function(t,e){if(r.json_parse){try{var n=ud_parse_json(t)}catch(o){return"function"==typeof r.error_callback?r.error_callback(t,o,502,n):(console.log(o),console.log(t),void(r.alert_on_error&&alert(updraftlion.unexpectedresponse+" "+t)))}if(n.hasOwnProperty("fatal_error"))return"function"==typeof r.error_callback?r.error_callback(t,e,500,n):(console.error(n.fatal_error_message),r.alert_on_error&&alert(n.fatal_error_message),!1);"function"==typeof a&&a(n,e,t)}else"function"==typeof a&&a(t,e)},error:function(t,e,a){"function"==typeof r.error_callback?r.error_callback(t,e,a):(console.log("updraft_send_command: error: "+e+" ("+a+")"),console.log(t))},dataType:"text",async:r.async};null!=r.timeout&&(u.timeout=r.timeout),jQuery.ajax(u)}function updraft_delete(t,e,a){jQuery("#updraft_delete_timestamp").val(t),jQuery("#updraft_delete_nonce").val(e),a?jQuery("#updraft-delete-remote-section, #updraft_delete_remote").removeAttr("disabled").show():jQuery("#updraft-delete-remote-section, #updraft_delete_remote").hide().attr("disabled","disabled"),t.indexOf(",")>-1?(jQuery("#updraft_delete_question_singular").hide(),jQuery("#updraft_delete_question_plural").show()):(jQuery("#updraft_delete_question_plural").hide(),jQuery("#updraft_delete_question_singular").show()),jQuery("#updraft-delete-modal").dialog("open")}function updraft_remote_storage_tab_activation(t){jQuery(".updraftplusmethod").hide(),jQuery(".remote-tab").data("active",!1),jQuery(".remote-tab").removeClass("nav-tab-active"),jQuery(".updraftplusmethod."+t).show(),jQuery(".remote-tab-"+t).data("active",!0),jQuery(".remote-tab-"+t).addClass("nav-tab-active")}function updraft_check_overduecrons(){updraft_send_command("check_overdue_crons",null,function(t){t&&t.hasOwnProperty("m")&&jQuery("#updraft-insert-admin-warning").html(t.m)},{alert_on_error:!1})}function updraft_remote_storage_tabs_setup(){var t=0,e=jQuery(".updraft_servicecheckbox:checked");jQuery(e).each(function(a,r){var n=jQuery(r).val();"updraft_servicecheckbox_none"!=jQuery(r).attr("id")&&t++,jQuery(".remote-tab-"+n).show(),a==jQuery(e).length-1&&updraft_remote_storage_tab_activation(n)}),t>0?(jQuery(".updraftplusmethod.none").hide(),jQuery("#remote_storage_tabs").show()):jQuery("#remote_storage_tabs").hide(),jQuery(document).keyup(function(t){if((32===t.keyCode||13===t.keyCode)&&jQuery(document.activeElement).is("input.labelauty + label")){var e=jQuery(document.activeElement).attr("for");e&&jQuery("#"+e).change()}}),jQuery(".updraft_servicecheckbox").change(function(){var e=jQuery(this).attr("id");if("updraft_servicecheckbox_"==e.substring(0,24)){var a=e.substring(24);null!=a&&""!=a&&(jQuery(this).is(":checked")?(t++,jQuery(".remote-tab-"+a).fadeIn(),updraft_remote_storage_tab_activation(a)):(t--,jQuery(".remote-tab-"+a).hide(),1==jQuery(".remote-tab-"+a).data("active")&&updraft_remote_storage_tab_activation(jQuery(".remote-tab:visible").last().attr("name"))))}t<=0?(jQuery(".updraftplusmethod.none").fadeIn(),jQuery("#remote_storage_tabs").hide()):(jQuery(".updraftplusmethod.none").hide(),jQuery("#remote_storage_tabs").show())}),jQuery(".updraft_servicecheckbox:not(.multi)").change(function(){var t=jQuery(this).attr("value");jQuery(this).is(":not(:checked)")?(jQuery(".updraftplusmethod."+t).hide(),jQuery(".updraftplusmethod.none").fadeIn()):jQuery(".updraft_servicecheckbox").not(this).prop("checked",!1)});var a=jQuery(".updraft_servicecheckbox");if("function"==typeof a.labelauty){a.labelauty();var r=jQuery("label[for=updraft_servicecheckbox_updraftvault]"),n=jQuery('<div class="udp-info"><span class="info-trigger">?</span><div class="info-content-wrapper"><div class="info-content">'+updraftlion.updraftvault_info+"</div></div></div>");r.append(n)}}function updraft_remote_storage_test(t,e,a){var r,n;a?(r=jQuery("#updraft-"+t+"-test-"+a),n=".updraftplusmethod."+t+"-"+a):(r=jQuery("#updraft-"+t+"-test"),n=".updraftplusmethod."+t);var o=r.data("method_label");r.html(updraftlion.testing_settings.replace("%s",o));var d={method:t};jQuery("#updraft-navtab-settings-content "+n+" input[data-updraft_settings_test], #updraft-navtab-settings-content .expertmode input[data-updraft_settings_test]").each(function(t,e){var a=jQuery(e).data("updraft_settings_test"),r=jQuery(e).attr("type");if(a){r||(console.log("UpdraftPlus: settings test input item with no type found"),console.log(e),r="text");var n=null;"checkbox"==r?n=jQuery(e).is(":checked")?1:0:"text"==r||"password"==r?n=jQuery(e).val():(console.log("UpdraftPlus: settings test input item with unrecognised type ("+r+") found"),console.log(e)),d[a]=n}}),jQuery("#updraft-navtab-settings-content "+n+" textarea[data-updraft_settings_test], #updraft-navtab-settings-content "+n+" select[data-updraft_settings_test]").each(function(t,e){var a=jQuery(e).data("updraft_settings_test");d[a]=jQuery(e).val()}),updraft_send_command("test_storage_settings",d,function(t,a){r.html(updraftlion.test_settings.replace("%s",o)),"undefined"!=typeof e&&0!=e&&(e=e.call(this,t,a,d)),"undefined"!=typeof e&&!1===e&&(alert(updraftlion.settings_test_result.replace("%s",o)+" "+t.output),t.hasOwnProperty("data")&&console.log(t.data))},{error_callback:function(t,e,a,n){if(r.html(updraftlion.test_settings.replace("%s",o)),"undefined"!=typeof n&&n.hasOwnProperty("fatal_error"))console.error(n.fatal_error_message),alert(n.fatal_error_message);else{var d="updraft_send_command: error: "+e+" ("+a+")";console.log(d),alert(d),console.log(t)}}})}function backupnow_whichfiles_checked(t){return jQuery('#backupnow_includefiles_moreoptions input[type="checkbox"]').each(function(e){if(jQuery(this).is(":checked")){var a=jQuery(this).attr("name");if("updraft_include_"==a.substring(0,16)){var r=a.substring(16);""!=t&&(t+=","),t+=r}}}),t}function backupnow_whichtables_checked(t){var e=!1;return jQuery('#backupnow_database_moreoptions input[type="checkbox"]').each(function(t){if(!jQuery(this).is(":checked"))return void(e=!0)}),t=jQuery("input[name^='updraft_include_tables_']").serializeArray(),!e||t}function updraft_deleteallselected(){var t=0,e="",a="",r=0;jQuery("#updraft-navtab-backups-content .updraft_existing_backups .updraft_existing_backups_row.backuprowselected").each(function(n){t++;var o=jQuery(this).data("nonce");a&&(a+=","),a+=o;var d=jQuery(this).data("key");e&&(e+=","),e+=d;var u=jQuery(this).find(".updraftplus-remove").data("hasremote");u&&r++}),updraft_delete(e,a,r)}function updraft_open_main_tab(t){updraftlion.main_tabs_keys.forEach(function(e){t==e?(jQuery("#updraft-navtab-"+e+"-content").show(),jQuery("#updraft-navtab-"+e).addClass("nav-tab-active")):(jQuery("#updraft-navtab-"+e+"-content").hide(),jQuery("#updraft-navtab-"+e).removeClass("nav-tab-active")),updraft_console_focussed_tab=t})}function updraft_openrestorepanel(t){updraft_historytimertoggle(t),updraft_open_main_tab("backups")}function updraft_delete_old_dirs(){return!0}function updraft_initiate_restore(t){jQuery('#updraft-navtab-backups-content .updraft_existing_backups button[data-backup_timestamp="'+t+'"]').click()}function updraft_restore_setoptions(t){var e=0;jQuery('input[name="updraft_restore[]"]').each(function(a,r){var n=jQuery(r).val(),o=n+"=([0-9,]+)",d=new RegExp(o),u=t.match(d);u?(jQuery(r).removeAttr("disabled").data("howmany",u[1]).parent().show(),e++,"db"==n&&(e+=4.5),jQuery(r).is(":checked")&&jQuery("#updraft_restorer_"+n+"options").show()):jQuery(r).attr("disabled","disabled").parent().hide()});var a=t.match(/dbcrypted=1/);a?(jQuery("#updraft_restore_db").data("encrypted",1),jQuery(".updraft_restore_crypteddb").show()):(jQuery("#updraft_restore_db").data("encrypted",0),jQuery(".updraft_restore_crypteddb").hide()),jQuery("#updraft_restore_db").trigger("change");var r=t.match(/meta_foreign=([12])/);r?jQuery("#updraft_restore_meta_foreign").val(r[1]):jQuery("#updraft_restore_meta_foreign").val("0");var n=336+20*e;jQuery("#updraft-restore-modal").dialog("option","height",n)}function updraft_backup_dialog_open(t){t="undefined"==typeof t?"new":t,0==jQuery("#updraftplus_incremental_backup_link").data("incremental")&&"incremental"==t?(jQuery("#updraft-backupnow-modal .incremental-free-only").show(),t="new"):jQuery("#updraft-backupnow-modal .incremental-backups-only").hide(),jQuery("#backupnow_includefiles_moreoptions").hide(),updraft_settings_form_changed&&!window.confirm(updraftlion.unsavedsettingsbackup)||(jQuery("#backupnow_label").val(""),"incremental"==t?(update_file_entities_checkboxes(!0,impossible_increment_entities),jQuery("#backupnow_includedb").prop("checked",!1),jQuery("#backupnow_includefiles").prop("checked",!0),jQuery("#backupnow_includefiles_label").text(updraftlion.files_incremental_backup),jQuery("#updraft-backupnow-modal .new-backups-only").hide(),jQuery("#updraft-backupnow-modal .incremental-backups-only").show()):(update_file_entities_checkboxes(!1,impossible_increment_entities),jQuery("#backupnow_includedb").prop("checked",!0),jQuery("#backupnow_includefiles_label").text(updraftlion.files_new_backup),jQuery("#updraft-backupnow-modal .new-backups-only").show(),jQuery("#updraft-backupnow-modal .incremental-backups-only").hide()),jQuery("#updraft-backupnow-modal").data("backup-type",t),jQuery("#updraft-backupnow-modal").dialog("open"))}function update_file_entities_checkboxes(t,e){t?jQuery(e).each(function(t,e){jQuery("#backupnow_files_updraft_include_"+e).prop("checked",!1),jQuery("#backupnow_files_updraft_include_"+e).prop("disabled",!0)}):jQuery('#backupnow_includefiles_moreoptions input[type="checkbox"]').each(function(t){var e=jQuery(this).attr("name");if("updraft_include_"==e.substring(0,16)){var a=e.substring(16);jQuery("#backupnow_files_updraft_include_"+a).prop("disabled",!1),jQuery(this).is(":checked")&&jQuery("#backupnow_files_updraft_include_"+a).prop("checked",!0)}})}function updraft_check_page_visibility(t){"hidden"==document.visibilityState?updraft_page_is_visible=0:(updraft_page_is_visible=1,1!==t&&jQuery("#updraft-navtab-backups-content").length&&updraft_activejobs_update(!0))}function setup_migrate_tabs(){jQuery("#updraft_migrate .updraft_migrate_widget_module_content").each(function(t,e){var a=jQuery(e).find("h3").first().html(),r=jQuery(".updraft_migrate_intro"),n=jQuery('<button class="button button-primary button-hero" />').html(a).appendTo(r);n.on("click",function(t){t.preventDefault(),jQuery(e).show(),r.hide()})})}function updraft_backupnow_inpage_go(t,e,a,r,n,o,d){r="undefined"==typeof r?0:r,n="undefined"==typeof n?0:n,o="undefined"==typeof o?0:o,d="undefined"==typeof d?updraftlion.automaticbackupbeforeupdate:d,updraft_console_focussed_tab="backups",updraft_inpage_success_callback=t,updraft_activejobs_update_timer=setInterval(function(){updraft_activejobs_update(!1)},1250);var u={},s=jQuery("#updraft-backupnow-inpage-modal").length;s&&jQuery("#updraft-backupnow-inpage-modal").dialog("option","buttons",u),jQuery("#updraft_inpage_prebackup").hide(),s&&jQuery("#updraft-backupnow-inpage-modal").dialog("open"),jQuery("#updraft_inpage_backup").show(),updraft_activejobslist_backupnownonce_only=1,updraft_inpage_hasbegun=0,updraft_backupnow_go(r,n,o,e,a,d,"")}function updraft_get_downloaders(){var t="";return jQuery(".ud_downloadstatus .updraftplus_downloader, #ud_downloadstatus2 .updraftplus_downloader").each(function(e,a){var r=jQuery(a).data("downloaderfor");"object"==typeof r&&(""!=t&&(t+=":"),t=t+r.base+","+r.nonce+","+r.what+","+r.index)}),t}function updraft_poll_get_parameters(){var t={downloaders:updraft_get_downloaders()};try{jQuery("#updraft-poplog").dialog("isOpen")&&(t.log_fetch=1,t.log_nonce=updraft_poplog_log_nonce,t.log_pointer=updraft_poplog_log_pointer)}catch(e){console.log(e)}return updraft_activejobslist_backupnownonce_only&&"undefined"!=typeof updraft_backupnow_nonce&&""!=updraft_backupnow_nonce&&(t.thisjobonly=updraft_backupnow_nonce),t}function updraft_activejobs_update(t){var e=(jQuery,(new Date).getTime());if(!(0==t&&e<updraft_activejobs_nextupdate)){updraft_activejobs_nextupdate=e+5500;var a=updraft_poll_get_parameters();updraft_send_command("activejobs_list",a,function(t,e,r){updraft_process_status_check(t,r,a)},{type:"GET",error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),!0===updraftplus_activejobs_list_fatal_error_alert&&(updraftplus_activejobs_list_fatal_error_alert=!1,alert(this.alert_done+" "+r.fatal_error_message));else{var n=e==a?a:a+" ("+e+")";console.error(n),console.log(t)}return!1}})}}function updraft_show_success_modal(t){"string"==typeof t&&(t={message:t});var e=jQuery.extend({icon:"yes",close:updraftlion.close,message:"",classes:"success"},t);jQuery.blockUI({css:{width:"300px",border:"none","border-radius":"10px",left:"calc(50% - 150px)"},message:'<div class="updraft_success_popup '+e.classes+'"><span class="dashicons dashicons-'+e.icon+'"></span><div class="updraft_success_popup--message">'+e.message+'</div><button class="button updraft-close-overlay"><span class="dashicons dashicons-no-alt"></span>'+e.close+"</button></div>"}),setTimeout(jQuery.unblockUI,5e3),jQuery(".blockUI .updraft-close-overlay").on("click",function(){jQuery.unblockUI()})}function updraft_popuplog(t){var e=updraftlion.loading_log_file;t&&(e+=" (log."+t+".txt)"),jQuery("#updraft-poplog").dialog("option","title",e),jQuery("#updraft-poplog-content").html("<em>"+e+" ...</em> "),jQuery("#updraft-poplog").dialog("open"),updraft_send_command("get_log",t,function(t){updraft_poplog_log_pointer=t.pointer,updraft_poplog_log_nonce=t.nonce;var e="?page=updraftplus&action=downloadlog&force_download=1&updraftplus_backup_nonce="+t.nonce;jQuery("#updraft-poplog-content").html(t.log);var a={};a[updraftlion.downloadlogfile]=function(){window.location.href=e},a[updraftlion.close]=function(){jQuery(this).dialog("close")},jQuery("#updraft-poplog").dialog("option","buttons",a),jQuery("#updraft-poplog").dialog("option","title","log."+t.nonce+".txt"),updraft_poplog_lastscroll=-1},{type:"GET",timeout:6e4,error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),jQuery("#updraft-poplog-content").append(r.fatal_error_message);else{var n=e==a?a:a+" ("+e+")";jQuery("#updraft-poplog-content").append(n),console.log(t)}}})}function updraft_showlastbackup(){updraft_send_command("get_fragment","last_backup_html",function(t){response=t.output,lastbackup_laststatus==response?setTimeout(function(){updraft_showlastbackup()},7e3):jQuery("#updraft_last_backup").html(response),lastbackup_laststatus=response},{type:"GET"})}function updraft_historytimertoggle(t){updraft_historytimer&&1!=t?(clearTimeout(updraft_historytimer),updraft_historytimer=0):(updraft_updatehistory(0,0),updraft_historytimer=setInterval(function(){updraft_updatehistory(0,0)},3e4),calculated_diskspace||(updraftplus_diskspace(),calculated_diskspace=1))}function updraft_updatehistory(t,e,a){"undefined"==typeof a&&(a=jQuery("#updraft_debug_mode").is(":checked")?1:0);var r=Math.round((new Date).getTime()/1e3);if(1==t||1==e)updraft_historytimer_notbefore=r+30;else if(r<updraft_historytimer_notbefore)return void console.log("Update history skipped: "+r.toString()+" < "+updraft_historytimer_notbefore.toString());1==t&&(1==e?(updraft_history_lastchecksum=!1,jQuery("#updraft-navtab-backups-content .updraft_existing_backups").html('<p style="text-align:center;"><em>'+updraftlion.rescanningremote+"</em></p>")):(updraft_history_lastchecksum=!1,jQuery("#updraft-navtab-backups-content .updraft_existing_backups").html('<p style="text-align:center;"><em>'+updraftlion.rescanning+"</em></p>")));var n=e?"remotescan":!!t&&"rescan",o={operation:n,debug:a};updraft_send_command("rescan",o,function(t){if(t.hasOwnProperty("logs_exist")&&t.logs_exist&&jQuery("#updraft_lastlogmessagerow .updraft-log-link").show(),t.hasOwnProperty("migrate_tab")&&t.migrate_tab&&(jQuery("#updraft-navtab-migrate").hasClass("nav-tab-active")||(jQuery("#updraft_migrate_tab_alt").html(""),jQuery("#updraft_migrate").replaceWith(jQuery(t.migrate_tab).find("#updraft_migrate")),setup_migrate_tabs())),t.hasOwnProperty("web_server_disk_space")&&(""==t.web_server_disk_space?(console.log("UpdraftPlus: web_server_disk_space is empty"),jQuery("#updraft-navtab-backups-content .updraft-server-disk-space").length&&jQuery("#updraft-navtab-backups-content .updraft-server-disk-space").slideUp("slow",function(){jQuery(this).remove()})):jQuery("#updraft-navtab-backups-content .updraft-server-disk-space").length?jQuery("#updraft-navtab-backups-content  .updraft-server-disk-space").replaceWith(t.web_server_disk_space):jQuery("#updraft-navtab-backups-content .updraft-disk-space-actions").prepend(t.web_server_disk_space)),update_backupnow_modal(t),t.hasOwnProperty("backupnow_file_entities")&&(impossible_increment_entities=t.backupnow_file_entities),null!=t.n&&jQuery("#updraft-existing-backups-heading").html(t.n),null!=t.t){if(null!=t.cksum){if(t.cksum==updraft_history_lastchecksum)return;updraft_history_lastchecksum=t.cksum}jQuery("#updraft-navtab-backups-content .updraft_existing_backups").html(t.t),updraft_backups_selection.checkSelectionStatus(),t.data&&console.log(t.data)}})}function update_backupnow_modal(t){t.hasOwnProperty("modal_afterfileoptions")&&jQuery(".backupnow_modal_afterfileoptions").html(t.modal_afterfileoptions)}function updraft_exclude_entity_update(t){var e=[];jQuery("#updraft_include_"+t+"_exclude_container .updraft_exclude_entity_wrapper .updraft_exclude_entity_field").each(function(){var t=jQuery.trim(jQuery(this).data("val"));""!=t&&e.push(t)}),jQuery("#updraft_include_"+t+"_exclude").val(e.join(","))}function updraft_is_unique_exclude_rule(t,e){return existing_exclude_rules_str=jQuery("#updraft_include_"+e+"_exclude").val(),existing_exclude_rules=existing_exclude_rules_str.split(","),!(jQuery.inArray(t,existing_exclude_rules)>-1)||(alert(updraftlion.duplicate_exclude_rule_error_msg),!1)}function updraft_intervals_monthly_or_not(t,e){var a="#updraft-navtab-settings-content #"+t,r=jQuery(a+" option").length,n="monthly"==e,o=!1;if(r>10&&(o=!0),n||o){if(n&&o)return void("monthly"==e&&(jQuery(".updraft_monthly_extra_words_"+t).remove(),jQuery(a).before('<span class="updraft_monthly_extra_words_'+t+'">'+updraftlion.day+" </span>").after('<span class="updraft_monthly_extra_words_'+t+'"> '+updraftlion.inthemonth+" </span>")));if(jQuery(".updraft_monthly_extra_words_"+t).remove(),n){updraft_interval_week_val=jQuery(a+" option:selected").val(),jQuery(a).html(updraftlion.mdayselector).before('<span class="updraft_monthly_extra_words_'+t+'">'+updraftlion.day+" </span>").after('<span class="updraft_monthly_extra_words_'+t+'"> '+updraftlion.inthemonth+" </span>");var d=updraft_interval_month_val===!1?1:updraft_interval_month_val;d-=1,jQuery(a+" option:eq("+d+")").prop("selected",!0)}else{updraft_interval_month_val=jQuery(a+" option:selected").val(),jQuery(a).html(updraftlion.dayselector);var u=updraft_interval_week_val===!1?1:updraft_interval_week_val;jQuery(a+" option:eq("+u+")").prop("selected",!0)}}}function updraft_check_same_times(){var t=0,e=jQuery("#updraft-navtab-settings-content .updraft_interval").val();"manual"==e?jQuery("#updraft-navtab-settings-content .updraft_files_timings").hide():jQuery("#updraft-navtab-settings-content .updraft_files_timings").show(),"weekly"==e||"fortnightly"==e||"monthly"==e?(updraft_intervals_monthly_or_not("updraft_startday_files",e),jQuery("#updraft-navtab-settings-content #updraft_startday_files").show()):(jQuery(".updraft_monthly_extra_words_updraft_startday_files").remove(),jQuery("#updraft-navtab-settings-content #updraft_startday_files").hide());var a=jQuery("#updraft-navtab-settings-content .updraft_interval_database").val();"manual"==a&&(t=1,jQuery("#updraft-navtab-settings-content .updraft_db_timings").hide()),"weekly"==a||"fortnightly"==a||"monthly"==a?(updraft_intervals_monthly_or_not("updraft_startday_db",a),jQuery("#updraft-navtab-settings-content #updraft_startday_db").show()):(jQuery(".updraft_monthly_extra_words_updraft_startday_db").remove(),jQuery("#updraft-navtab-settings-content #updraft_startday_db").hide()),a==e?(jQuery("#updraft-navtab-settings-content .updraft_db_timings").hide(),0==t?jQuery("#updraft-navtab-settings-content .updraft_same_schedules_message").show():jQuery("#updraft-navtab-settings-content .updraft_same_schedules_message").hide()):(jQuery("#updraft-navtab-settings-content .updraft_same_schedules_message").hide(),0==t&&jQuery("#updraft-navtab-settings-content .updraft_db_timings").show())}function updraft_activejobs_delete(t){updraft_aborted_jobs[t]=1,jQuery("#updraft-jobid-"+t).closest(".updraft_row").addClass("deleting"),updraft_send_command("activejobs_delete",t,function(e){var a=jQuery("#updraft-jobid-"+t).closest(".updraft_row");a.addClass("deleting"),"Y"==e.ok?(jQuery("#updraft-jobid-"+t).html(e.m),a.remove(),jQuery("#updraft-backupnow-inpage-modal").dialog("isOpen")&&jQuery("#updraft-backupnow-inpage-modal").dialog("close"),updraft_show_success_modal({message:updraft_active_job_is_clone(t)?updraftlion.clone_backup_aborted:updraftlion.backup_aborted,icon:"no-alt",classes:"warning"})):"N"==e.ok?(a.removeClass("deleting"),alert(e.m)):(a.removeClass("deleting"),alert(updraftlion.unexpectedresponse),console.log(e))})}function updraftplus_diskspace_entity(t){jQuery("#updraft_diskspaceused_"+t).html("<em>"+updraftlion.calculating+"</em>"),updraft_send_command("get_fragment",{fragment:"disk_usage",data:t},function(e){jQuery("#updraft_diskspaceused_"+t).html(e.output)},{type:"GET"})}function updraft_active_job_is_clone(t){return updraft_clone_jobs.filter(function(e){return e==t}).length}function updraft_iframe_modal(t,e){var a=780,r=500;jQuery("#updraft-iframe-modal-innards").html('<iframe width="100%" height="430px" src="'+ajaxurl+"?action=updraft_ajax&subaction="+t+"&nonce="+updraft_credentialtest_nonce+'"></iframe>'),jQuery("#updraft-iframe-modal").dialog("option","title",e).dialog("option","width",a).dialog("option","height",r).dialog("open")}function updraft_html_modal(t,e,a,r){jQuery("#updraft-iframe-modal-innards").html(t);var n={};a<450&&(n[updraftlion.close]=function(){jQuery(this).dialog("close")}),jQuery("#updraft-iframe-modal").dialog("option","title",e).dialog("option","width",a).dialog("option","height",r).dialog("option","buttons",n).dialog("open")}function updraftplus_diskspace(){jQuery("#updraft-navtab-backups-content .updraft_diskspaceused").html("<em>"+updraftlion.calculating+"</em>"),updraft_send_command("get_fragment",{fragment:"disk_usage",data:"updraft"},function(t){jQuery("#updraft-navtab-backups-content .updraft_diskspaceused").html(t.output)},{type:"GET"})}function updraftplus_deletefromserver(t,e,a){a||(a=0);var r={stage:"delete",timestamp:t,type:e,findex:a};updraft_send_command("updraft_download_backup",r,null,{action:"updraft_download_backup",nonce:updraft_download_nonce,nonce_key:"_wpnonce"})}function updraftplus_downloadstage2(t,e,a){location.href=ajaxurl+"?_wpnonce="+updraft_download_nonce+"&timestamp="+t+"&type="+e+"&stage=2&findex="+a+"&action=updraft_download_backup"}function updraftplus_show_contents(t,e,a){var r='<div id="updraft_zip_files_container" class="hidden-in-updraftcentral" style="clear:left;"><div id="updraft_zip_info_container" class="updraft_jstree_info_container"><p><span id="updraft_zip_path_text">'+updraftlion.zip_file_contents_info+'</span> - <span id="updraft_zip_size_text"></span></p>'+updraftlion.browse_download_link+'</div><div id="updraft_zip_files_jstree_container"><input type="search" id="zip_files_jstree_search" name="zip_files_jstree_search" placeholder="'+updraftlion.search+'"><div id="updraft_zip_files_jstree" class="updraft_jstree"></div></div></div>';updraft_html_modal(r,updraftlion.zip_file_contents,780,500),zip_files_jstree("zipbrowser",t,e,a)}function zip_files_jstree(t,e,a,r){jQuery("#updraft_zip_files_jstree").jstree({core:{multiple:!1,data:function(n,o){updraft_send_command("get_jstree_directory_nodes",{entity:t,node:n,timestamp:e,type:a,findex:r},function(t){t.hasOwnProperty("error")?alert(t.error):o.call(this,t.nodes)},{error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),jQuery("#updraft_zip_files_jstree").html('<p style="color:red; margin: 5px;">'+r.fatal_error_message+"</p>"),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";jQuery("#updraft_zip_files_jstree").html('<p style="color:red; margin: 5px;">'+n+"</p>"),console.log(n),alert(n),console.log(t)}}})},error:function(t){alert(t),console.log(t)}},search:{show_only_matches:!0},plugins:["search","sort"]}),jQuery("#updraft_zip_files_jstree").on("ready.jstree",function(t,e){jQuery("#updraft-iframe-modal").dialog("option","title",updraftlion.zip_file_contents+": "+e.instance.get_node("#").children[0])});var n=!1;jQuery("#zip_files_jstree_search").keyup(function(){n&&clearTimeout(n),n=setTimeout(function(){var t=jQuery("#zip_files_jstree_search").val();jQuery("#updraft_zip_files_jstree").jstree(!0).search(t)},250)}),jQuery("#updraft_zip_files_jstree").on("changed.jstree",function(t,e){jQuery("#updraft_zip_path_text").text(e.node.li_attr.path),e.node.li_attr.size?(jQuery("#updraft_zip_size_text").text(e.node.li_attr.size),jQuery("#updraft_zip_download_item").show()):(jQuery("#updraft_zip_size_text").text(""),jQuery("#updraft_zip_download_item").hide())}),jQuery("#updraft_zip_download_item").click(function(t){t.preventDefault();var n=jQuery("#updraft_zip_path_text").text();updraft_send_command("get_zipfile_download",{path:n,timestamp:e,type:a,findex:r},function(t){t.hasOwnProperty("error")?alert(t.error):t.hasOwnProperty("path")?location.href=ajaxurl+"?_wpnonce="+updraft_download_nonce+"&timestamp="+e+"&type="+a+"&stage=2&findex="+r+"&filepath="+t.path+"&action=updraft_download_backup":alert(updraftlion.download_timeout)},{error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";console.log(n),alert(n),console.log(t)}}})})}function remove_updraft_downloader(t,e){jQuery(t).closest(".updraftplus_downloader").fadeOut().remove(),0==jQuery(".updraftplus_downloader_container_"+e+" .updraftplus_downloader").length&&jQuery(".updraftplus_downloader_container_"+e).remove()}function updraft_downloader(t,e,a,r,n,o,d){"string"!=typeof n&&(n=n.toString()),jQuery(".ud_downloadstatus").show();var n=n.split(","),u=o?o:e,s=jQuery("#updraft-navtab-backups-content .uddownloadform_"+a+"_"+e+"_"+n[0]).data("wp_nonce").toString();jQuery(".updraftplus_downloader_container_"+a).length||(jQuery(r).append('<div class="updraftplus_downloader_container_'+a+' postbox"></div>'),jQuery(".updraftplus_downloader_container_"+a).append('<strong style="clear:left; padding: 8px; margin-top: 4px;">'+updraftlion.download+" "+a+" ("+u+"):</strong>"));for(var i=0;i<n.length;i++){var l=t+e+"_"+a+"_"+n[i],p="."+l,_=parseInt(n[i]);_++;var c=0==n[i]?"":" ("+_+")";jQuery(p).length||(jQuery(".updraftplus_downloader_container_"+a).append('<div style="clear:left; padding: 8px; margin-top: 4px;" class="'+l+' updraftplus_downloader"><button onclick="remove_updraft_downloader(this, \''+a+'\');" type="button" style="float:right; margin-bottom: 8px;" class="ud_downloadstatus__close" aria-label="Close"><span class="dashicons dashicons-no-alt"></span></button><strong>'+a+c+'</strong>:<div class="raw">'+updraftlion.begunlooking+'</div><div class="file '+l+'_st"><div class="dlfileprogress" style="width: 0;"></div></div></div>'),jQuery(p).data("downloaderfor",{base:t,nonce:e,what:a,index:n[i]}),setTimeout(function(){updraft_activejobs_update(!0)},1500)),jQuery(p).data("lasttimebegan",(new Date).getTime())}d=!!d;var f={type:a,timestamp:e,findex:n},m={action:"updraft_download_backup",nonce_key:"_wpnonce",nonce:s,timeout:1e4,async:d};return updraft_send_command("updraft_download_backup",f,function(t){},m),!1}function ud_parse_json(t,e){if(e="undefined"!=typeof e,!e)try{var a=JSON.parse(t);return a}catch(r){console.log("UpdraftPlus: Exception when trying to parse JSON (1) - will attempt to fix/re-parse based upon first/last curly brackets"),console.log(t)}var n=t.indexOf("{"),o=t.lastIndexOf("}");if(n>-1&&o>-1){var d=t.slice(n,o+1);try{var u=JSON.parse(d);return e||console.log("UpdraftPlus: JSON re-parse successful"),e?{parsed:u,json_start_pos:n,json_last_pos:o}:u}catch(r){console.log("UpdraftPlus: Exception when trying to parse JSON (2) - will attempt to fix/re-parse based upon bracket counting");for(var s=n,i=0,l="",p=!1;(i>0||s==n)&&s<=o;){var _=t.charAt(s);p||"{"!=_?p||"}"!=_?'"'==_&&"\\"!=l&&(p=!p):i--:i++,l=_,s++}console.log("Started at cursor="+n+", ended at cursor="+s+" with result following:"),console.log(t.substring(n,s));try{var u=JSON.parse(t.substring(n,s));return console.log("UpdraftPlus: JSON re-parse successful"),e?{parsed:u,json_start_pos:n,json_last_pos:s}:u}catch(r){throw r}}}throw"UpdraftPlus: could not parse the JSON"}function updraft_restorer_checkstage2(t){var e=jQuery("#ud_downloadstatus2 .file").length;return e>0?void(t&&alert(updraftlion.stilldownloading)):(jQuery("#updraft-restore-modal-stage2a").html(updraftlion.processing),void updraft_send_command("restore_alldownloaded",{timestamp:jQuery("#updraft_restore_timestamp").val(),restoreopts:jQuery("#updraft_restore_form").serialize()},function(t,e,a){var r=null;jQuery("#updraft_restorer_restore_options").val("");try{if(null==t)return void jQuery("#updraft-restore-modal-stage2a").html(updraftlion.emptyresponse);var n=t.m;if(""!=t.w&&(n=n+"<p><strong>"+updraftlion.warnings+"</strong><br>"+t.w+"</p>"),""!=t.e?n=n+"<p><strong>"+updraftlion.errors+"</strong><br>"+t.e+"</p>":updraft_restore_stage=3,t.hasOwnProperty("i")){try{if(r=ud_parse_json(t.i),r.hasOwnProperty("addui")){console.log("Further UI options are being displayed");var o=r.addui;n+='<div id="updraft_restoreoptions_ui" style="clear:left; padding-top:10px;">'+o+"</div>","object"==typeof JSON&&"function"==typeof JSON.stringify&&(delete r.addui,t.i=JSON.stringify(r))}}catch(d){console.log(d),console.log(t)}jQuery("#updraft_restorer_backup_info").val(t.i)}else jQuery("#updraft_restorer_backup_info").val();jQuery("#updraft-restore-modal-stage2a").html(n),jQuery("#updraft-restore-modal-stage2a .updraft_select2").length>0&&jQuery("#updraft-restore-modal-stage2a .updraft_select2").select2()}catch(d){console.log(a),console.log(d),jQuery("#updraft-restore-modal-stage2a").text(updraftlion.jsonnotunderstood+" "+updraftlion.errordata+": "+a).html()}},{error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),jQuery("#updraft-restore-modal-stage2a").html('<p style="color: red;">'+r.fatal_error_message+"</p>"),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";jQuery("#updraft-restore-modal-stage2a").html('<p style="color: red;">'+n+"</p>"),console.log(n),alert(n),console.log(t)}}}))}function updraft_downloader_status(t,e,a,r){}function updraft_downloader_status_update(t,e){var a=0;return jQuery(t).each(function(t,r){if(""!=r.base){var n=r.base+r.timestamp+"_"+r.what+"_"+r.findex,o="."+n;if(null!=r.e)jQuery(o+" .raw").html("<strong>"+updraftlion.error+"</strong> "+r.e),console.log(r);else if(null!=r.p){if(jQuery(o+"_st .dlfileprogress").width(r.p+"%"),null!=r.a&&r.a>0){var d=(new Date).getTime(),u=jQuery(o).data("lasttimebegan"),s=d-u;if(r.a>90&&s>6e4){console.log(r.timestamp+" "+r.what+" "+r.findex+": restarting download: file_age="+r.a+", sincelastrestart_ms="+s),
  jQuery(o).data("lasttimebegan",(new Date).getTime());var i=jQuery("#updraft-navtab-backups-content .uddownloadform_"+r.what+"_"+r.timestamp+"_"+r.findex),l={type:r.what,timestamp:r.timestamp,findex:r.findex},p={action:"updraft_download_backup",nonce_key:"_wpnonce",nonce:i.data("wp_nonce").toString(),timeout:1e4};updraft_send_command("updraft_download_backup",l,function(t){},p),jQuery(o).data("lasttimebegan",(new Date).getTime())}}if(null!=r.m)if(r.p>=100&&"udrestoredlstatus_"==r.base)jQuery(o+" .raw").html(r.m),jQuery(o).fadeOut("slow",function(){remove_updraft_downloader(this,r.what),updraft_restorer_checkstage2(0)});else if(r.p<100||"uddlstatus_"!=r.base)jQuery(o+" .raw").html(r.m);else{var _=updraftlion.fileready+" "+updraftlion.actions+': \t\t\t\t<button class="button" type="button" onclick="updraftplus_downloadstage2(\''+r.timestamp+"', '"+r.what+"', '"+r.findex+"')\">"+updraftlion.downloadtocomputer+'</button> \t\t\t\t<button class="button" id="uddownloaddelete_'+r.timestamp+"_"+r.what+'" type="button" onclick="updraftplus_deletefromserver(\''+r.timestamp+"', '"+r.what+"', '"+r.findex+"')\">"+updraftlion.deletefromserver+"</button>";r.hasOwnProperty("can_show_contents")&&r.can_show_contents&&(_+=' <button class="button" type="button" onclick="updraftplus_show_contents(\''+r.timestamp+"', '"+r.what+"', '"+r.findex+"')\">"+updraftlion.browse_contents+"</button>"),jQuery(o+" .raw").html(_),jQuery(o+"_st").remove()}}else null!=r.m?jQuery(o+" .raw").html(r.m):(jQuery(o+" .raw").html(updraftlion.jsonnotunderstood+" ("+e+")"),a=1)}}),a}function updraft_backupnow_go(t,e,a,r,n,o,d){var u={backupnow_nodb:t,backupnow_nofiles:e,backupnow_nocloud:a,backupnow_label:o,extradata:n};if(""!=r&&(u.onlythisfileentity=r),""!=d&&(u.onlythesetableentities=d),u.always_keep="undefined"!=typeof n.always_keep?n.always_keep:0,delete n.always_keep,u.incremental="undefined"!=typeof n.incremental?n.incremental:0,delete n.incremental,!jQuery(".updraft_requeststart").length){var s=jQuery('<div class="updraft_requeststart" />').html('<span class="spinner"></span>'+updraftlion.requeststart);s.data("remove",!1),setTimeout(function(){s.data("remove",!0)},3e3),setTimeout(function(){s.remove()},75e3),jQuery("#updraft_activejobsrow").before(s)}updraft_activejobslist_backupnownonce_only=1,updraft_send_command("backupnow",u,function(t){return t.hasOwnProperty("error")?(jQuery(".updraft_requeststart").remove(),void alert(t.error)):(jQuery("#updraft_backup_started").html(t.m),t.hasOwnProperty("nonce")&&(updraft_backupnow_nonce=t.nonce,console.log("UpdraftPlus: ID of started job: "+updraft_backupnow_nonce)),void setTimeout(function(){updraft_activejobs_update(!0)},500))})}function updraft_process_status_check(t,e,a){if(t.hasOwnProperty("fatal_error"))return console.error(t.fatal_error_message),void(!0===updraftplus_activejobs_list_fatal_error_alert&&(updraftplus_activejobs_list_fatal_error_alert=!1,alert(this.alert_done+" "+t.fatal_error_message)));try{t.hasOwnProperty("l")&&(t.l?(jQuery("#updraft_lastlogmessagerow").show(),jQuery("#updraft_lastlogcontainer").html(t.l)):(jQuery("#updraft_lastlogmessagerow").hide(),jQuery("#updraft_lastlogcontainer").html("("+updraftlion.nothing_yet_logged+")")));var r=-1,n=jQuery(".updraft_requeststart");t.j&&n.length&&n.data("remove")&&n.remove();var o=jQuery(t.j);o.find(".updraft_jobtimings").each(function(t,e){var a=jQuery(e);if(a.data("jobid")){var r=a.data("jobid"),n=a.closest(".updraft_row");updraft_aborted_jobs[r]&&n.hide()}}),jQuery("#updraft_activejobsrow").html(o);var d=o.find('.job-id[data-isclone="1"]');if(d.length>0){if(0==jQuery(".updraftclone_action_box .updraftclone_network_info").length&&jQuery("#updraft_activejobsrow .job-id .updraft_clone_url").length>0){var u=jQuery("#updraft_activejobsrow .job-id .updraft_clone_url").data("clone_url");updraft_send_command("get_clone_network_info",{clone_url:u},function(t){t.hasOwnProperty("html")&&jQuery(".updraftclone_action_box").html(t.html)})}jQuery("#updraft_clone_activejobsrow").empty(),d.each(function(t,e){var a=jQuery(e);a.closest(".updraft_row").appendTo(jQuery("#updraft_clone_activejobsrow"))})}if(jQuery("#updraft_activejobs .updraft_jobtimings").each(function(t,e){var a=jQuery(e);if(a.data("lastactivity")&&a.data("jobid")){var n=a.data("jobid"),o=a.data("lastactivity");(r==-1||o<r)&&(r=o);var d=a.data("nextresumptionafter"),u=a.data("nextresumption");timenow=(new Date).getTime(),o>50&&u>0&&d<-30&&timenow>updraft_last_forced_when+1e5&&(updraft_last_forced_jobid!=n||u!=updraft_last_forced_resumption)&&(updraft_last_forced_resumption=u,updraft_last_forced_jobid=n,updraft_last_forced_when=timenow,console.log("UpdraftPlus: force resumption: job_id="+n+", resumption="+u),updraft_send_command("forcescheduledresumption",{resumption:u,job_id:n},function(t){console.log(t)},{json_parse:!1,alert_on_error:!1}))}}),timenow=(new Date).getTime(),updraft_activejobs_nextupdate=timenow+18e4,1==updraft_page_is_visible&&"backups"==updraft_console_focussed_tab&&(updraft_activejobs_nextupdate=r>-1?r<5?timenow+1750:timenow+5e3:lastlog_lastdata==e?timenow+7500:timenow+1750),d.length>0&&(updraft_activejobs_nextupdate=timenow+6e3),lastlog_lastdata=e,null!=t.j&&""!=t.j){if(jQuery("#updraft_activejobsrow").show(),d.length>0&&jQuery("#updraft_clone_activejobsrow").show(),a.hasOwnProperty("thisjobonly")&&!updraft_inpage_hasbegun&&jQuery("#updraft-jobid-"+a.thisjobonly).length?(updraft_inpage_hasbegun=1,console.log("UpdraftPlus: the start of the requested backup job has been detected")):!updraft_inpage_hasbegun&&updraft_activejobslist_backupnownonce_only&&jQuery(".updraft_jobtimings.isautobackup").length?(autobackup_nonce=jQuery(".updraft_jobtimings.isautobackup").first().data("jobid"),autobackup_nonce&&(updraft_inpage_hasbegun=1,updraft_backupnow_nonce=autobackup_nonce,a.thisjobonly=autobackup_nonce,console.log("UpdraftPlus: the start of the requested backup job has been detected; id: "+autobackup_nonce))):1==updraft_inpage_hasbegun&&jQuery("#updraft-jobid-"+a.thisjobonly+".updraft_finished").length&&(updraft_inpage_hasbegun=2,console.log("UpdraftPlus: the end of the requested backup job has been detected"),updraft_activejobs_update_timer&&clearInterval(updraft_activejobs_update_timer),"undefined"!=typeof updraft_inpage_success_callback&&""!=updraft_inpage_success_callback?updraft_inpage_success_callback.call(!1):jQuery("#updraft-backupnow-inpage-modal").dialog("close")),""==lastlog_jobs&&setTimeout(function(){jQuery("#updraft_backup_started").slideUp()},3500),a.hasOwnProperty("thisjobonly")&&updraft_backupnow_nonce&&a.thisjobonly===updraft_backupnow_nonce){jQuery(".updraft_requeststart").remove();var s=jQuery("#updraft-jobid-"+updraft_backupnow_nonce);s.is(".updraft_finished")&&(updraft_activejobslist_backupnownonce_only=0,updraft_aborted_jobs[updraft_backupnow_nonce]?updraft_aborted_jobs=updraft_aborted_jobs.filter(function(t,e){return t!=updraft_backupnow_nonce}):updraft_active_job_is_clone(updraft_backupnow_nonce)?(updraft_show_success_modal(updraftlion.clone_backup_complete),updraft_clone_jobs=updraft_clone_jobs.filter(function(t){return t!=updraft_backupnow_nonce})):updraft_show_success_modal(updraftlion.backup_complete),updraft_backupnow_nonce="",updraft_activejobs_update(!0))}}else jQuery("#updraft_activejobsrow").is(":hidden")||("undefined"!=typeof lastbackup_laststatus&&updraft_showlastbackup(),updraft_updatehistory(0,0),jQuery("#updraft_activejobsrow").hide());if(lastlog_jobs=t.j,null!=t.ds&&""!=t.ds&&updraft_downloader_status_update(t.ds,e),null!=t.u&&""!=t.u&&jQuery("#updraft-poplog").dialog("isOpen")){var i=t.u;if(i.nonce==updraft_poplog_log_nonce&&(updraft_poplog_log_pointer=i.pointer,null!=i.log&&""!=i.log)){var l=jQuery("#updraft-poplog").scrollTop();jQuery("#updraft-poplog-content").append(i.log),updraft_poplog_lastscroll!=l&&updraft_poplog_lastscroll!=-1||(jQuery("#updraft-poplog").scrollTop(jQuery("#updraft-poplog-content").prop("scrollHeight")),updraft_poplog_lastscroll=jQuery("#updraft-poplog").scrollTop())}}}catch(p){console.log(updraftlion.unexpectedresponse+" "+e),console.log(p)}}var onlythesefileentities=backupnow_whichfiles_checked("");""==onlythesefileentities?jQuery("#backupnow_includefiles_moreoptions").show():jQuery("#backupnow_includefiles_moreoptions").hide();var impossible_increment_entities,updraft_restore_stage=1,lastlog_lastmessage="",lastlog_lastdata="",lastlog_jobs="",updraft_activejobs_nextupdate=(new Date).getTime()+1e3,updraft_page_is_visible=1,updraft_console_focussed_tab=updraftlion.tab,updraft_settings_form_changed=!1;window.onbeforeunload=function(t){if(updraft_settings_form_changed)return updraftlion.unsavedsettings},"undefined"!=typeof document.hidden&&document.addEventListener("visibilitychange",function(){updraft_check_page_visibility(0)},!1),updraft_check_page_visibility(1);var updraft_poplog_log_nonce,updraft_poplog_log_pointer=0,updraft_poplog_lastscroll=-1,updraft_last_forced_jobid=-1,updraft_last_forced_resumption=-1,updraft_last_forced_when=-1,updraft_backupnow_nonce="",updraft_activejobslist_backupnownonce_only=0,updraft_inpage_hasbegun=0,updraft_activejobs_update_timer,updraft_aborted_jobs=[],updraft_clone_jobs=[],updraft_backups_selection={};!function(t){updraft_backups_selection.toggle=function(e){var a=t(e);a.is(".backuprowselected")?this.deselect(e):this.select(e)},updraft_backups_selection.select=function(e){t(e).addClass("backuprowselected"),t(e).find(".backup-select input").prop("checked",!0),this.checkSelectionStatus()},updraft_backups_selection.deselect=function(e){t(e).removeClass("backuprowselected"),t(e).find(".backup-select input").prop("checked",!1),this.checkSelectionStatus()},updraft_backups_selection.selectAll=function(){t("#updraft-navtab-backups-content .updraft_existing_backups .updraft_existing_backups_row").each(function(t,e){updraft_backups_selection.select(e)})},updraft_backups_selection.deselectAll=function(){t("#updraft-navtab-backups-content .updraft_existing_backups .updraft_existing_backups_row").each(function(t,e){updraft_backups_selection.deselect(e)})},updraft_backups_selection.checkSelectionStatus=function(){var e=t("#updraft-navtab-backups-content .updraft_existing_backups .updraft_existing_backups_row").length,a=t("#updraft-navtab-backups-content .updraft_existing_backups .updraft_existing_backups_row.backuprowselected").length;a>0?(t("#ud_massactions").addClass("active"),t(".js--deselect-all-backups, .js--delete-selected-backups").prop("disabled",!1)):(t("#ud_massactions").removeClass("active"),t(".js--deselect-all-backups, .js--delete-selected-backups").prop("disabled",!0)),e===a?t("#cb-select-all").prop("checked",!0):t("#cb-select-all").prop("checked",!1),e?t("#ud_massactions").show():t("#ud_massactions").hide()}}(jQuery);var updraftplus_activejobs_list_fatal_error_alert=!0,updraft_historytimer=0,calculated_diskspace=0,updraft_historytimer_notbefore=0,updraft_history_lastchecksum=!1,updraft_interval_week_val=!1,updraft_interval_month_val=!1;"undefined"!=typeof updraft_siteurl&&setInterval(function(){jQuery.get(updraft_siteurl+"/wp-cron.php")},21e4);var lastlog_lastmessage="";jQuery(document).ajaxError(function(t,e,a,r){if(null!=r&&""!=r&&null!=e.responseText&&""!=e.responseText&&(console.log("Error caught by UpdraftPlus ajaxError handler (follows) for "+a.url),console.log(r),0==a.url.search(ajaxurl)))if(a.url.search("subaction=downloadstatus")>=0){var n=a.url.match(/timestamp=\d+/),o=a.url.match(/type=[a-z]+/),d=a.url.match(/findex=\d+/),u=a.url.match(/base=[a-z_]+/);if(d=d instanceof Array?parseInt(d[0].substr(7)):0,o=o instanceof Array?o[0].substr(5):"",u=u instanceof Array?u[0].substr(5):"",n=n instanceof Array?parseInt(n[0].substr(10)):0,""!=u&&""!=o&&n>0){var s=u+n+"_"+o+"_"+d;jQuery("."+s+" .raw").html("<strong>"+updraftlion.error+"</strong> "+updraftlion.servererrorcode)}}else a.url.search("subaction=restore_alldownloaded")>=0&&jQuery("#updraft-restore-modal-stage2a").append("<br><strong>"+updraftlion.error+"</strong> "+updraftlion.servererrorcode+": "+r)}),jQuery(document).ready(function(t){function e(e){t('.expertmode .advanced_settings_container .advanced_tools:not(".'+e+'")').hide(),t(".expertmode .advanced_settings_container .advanced_tools."+e).fadeIn("slow"),t(".expertmode .advanced_settings_container .advanced_tools_button:not(#"+e+")").removeClass("active"),t(".expertmode .advanced_settings_container .advanced_tools_button#"+e).addClass("active")}function a(e){t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login_status").html("").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login .updraftplus_spinner.spinner").addClass("visible"),updraft_send_command("process_updraftplus_clone_login",e,function(e){try{if(t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login .updraftplus_spinner.spinner").removeClass("visible"),e.hasOwnProperty("status")&&"error"==e.status)return t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login_status").html(e.message).show(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 .tfa_fields").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 .non_tfa_fields").show(),void t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_two_factor_code").val("");e.hasOwnProperty("tfa_enabled")&&1==e.tfa_enabled&&(t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 .non_tfa_fields").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 .tfa_fields").show(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 input#temporary_clone_options_two_factor_code").focus()),"authenticated"===e.status&&(t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 .non_tfa_fields").show(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 .tfa_fields").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1 input#temporary_clone_options_two_factor_code").val(""),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage2").show(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage2").html(e.html))}catch(a){console.log(a)}})}function r(e){t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key_status").html("").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key .updraftplus_spinner.spinner").addClass("visible"),updraft_send_command("process_updraftplus_clone_login",e,function(e){try{if(t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key .updraftplus_spinner.spinner").removeClass("visible"),e.hasOwnProperty("status")&&"error"==e.status)return void t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key_status").html(e.message).show();"authenticated"===e.status&&(t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage1").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage2").show(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage2").html(e.html))}catch(a){console.log(a)}})}function n(t,e,a,r,n,o){var d={updraftplus_clone_backup:1,backupnow_nodb:0,backupnow_nofiles:0,backupnow_nocloud:0,backupnow_label:"UpdraftPlus Clone",extradata:"",onlythisfileentity:"plugins,themes,uploads,others",clone_id:t,secret_token:e,clone_url:a,key:r,backup_nonce:n,backup_timestamp:o};updraft_activejobslist_backupnownonce_only=1,updraft_send_command("backupnow",d,function(t){jQuery("#updraft_clone_progress .updraftplus_spinner.spinner").removeClass("visible"),jQuery("#updraft_backup_started").html(t.m),t.hasOwnProperty("nonce")&&(updraft_backupnow_nonce=t.nonce,updraft_clone_jobs.push(updraft_backupnow_nonce),updraft_inpage_success_callback=function(){jQuery("#updraft_clone_activejobsrow").hide(),updraft_aborted_jobs[updraft_backupnow_nonce]?jQuery("#updraft_clone_progress").html(updraftlion.clone_backup_aborted):jQuery("#updraft_clone_progress").html(updraftlion.clone_backup_complete)},console.log("UpdraftPlus: ID of started job: "+updraft_backupnow_nonce)),updraft_activejobs_update(!0)})}function o(t){var e=Handlebars.compile(updraftlion.remote_storage_templates[t]),a=updraftlion.remote_storage_options[t]["default"];a.instance_id="s-"+d(32),a.instance_enabled=1;var r=e(a);jQuery(r).hide().insertAfter("."+t+"_add_instance_container:first").show("slow")}function d(t){for(var e="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=0;r<t;r++)e+=a.charAt(Math.floor(Math.random()*a.length));return e}function u(t){var e=!!jQuery("#updraftcentral_mothership_other").is(":checked");e?(jQuery("#updraftcentral_keycreate_mothership").prop("disabled",!1),t?jQuery("#updraftcentral_keycreate_mothership_firewalled_container").show():(jQuery(".updraftcentral_wizard_self_hosted_stage2").show(),jQuery("#updraftcentral_keycreate_mothership_firewalled_container").slideDown(),jQuery("#updraftcentral_keycreate_mothership").focus())):(jQuery("#updraftcentral_keycreate_mothership").prop("disabled",!0),t||(jQuery(".updraftcentral_wizard_self_hosted_stage2").hide(),s()))}function s(){jQuery("#updraftcentral_wizard_stage1_error").text("");var t="";if(jQuery("#updraftcentral_mothership_updraftpluscom").is(":checked"))jQuery(".updraftcentral_keycreate_description").hide(),t="updraftplus.com";else if(jQuery("#updraftcentral_mothership_other").is(":checked")){jQuery(".updraftcentral_keycreate_description").show();var e=jQuery("#updraftcentral_keycreate_mothership").val();if(""==e)return void jQuery("#updraftcentral_wizard_stage1_error").text(updraftlion.updraftcentral_wizard_empty_url);try{var a=new URL(e);t=a.hostname}catch(r){if("undefined"==typeof URL&&(t=jQuery("<a>").prop("href",e).prop("hostname")),!t||"undefined"!=typeof URL)return void jQuery("#updraftcentral_wizard_stage1_error").text(updraftlion.updraftcentral_wizard_invalid_url)}}jQuery("#updraftcentral_keycreate_description").val(t),jQuery(".updraftcentral_wizard_stage1").hide(),jQuery(".updraftcentral_wizard_stage2").show()}function i(e,a,r,n){jQuery("#updraft-delete-modal").dialog("close");var o=e,d=a,u=r,s=n,l=jQuery("#updraft_delete_timestamp").val().split(","),p=jQuery("#updraft_delete_form").serializeArray(),_={};t.each(p,function(){void 0!==_[this.name]?(_[this.name].push||(_[this.name]=[_[this.name]]),_[this.name].push(this.value||"")):_[this.name]=this.value||""}),_.delete_remote?jQuery("#updraft-delete-waitwarning").find(".updraft-deleting-remote").show():jQuery("#updraft-delete-waitwarning").find(".updraft-deleting-remote").hide(),jQuery("#updraft-delete-waitwarning").slideDown().addClass("active"),_.remote_delete_limit=updraftlion.remote_delete_limit,delete _.action,delete _.subaction,delete _.nonce,updraft_send_command("deleteset",_,function(t){if(!t.hasOwnProperty("result")||null==t.result)return void jQuery("#updraft-delete-waitwarning").slideUp();if("error"==t.result)jQuery("#updraft-delete-waitwarning").slideUp(),alert(updraftlion.error+" "+t.message);else if("continue"==t.result){o=o+t.backup_local+t.backup_remote,d+=t.backup_local,u+=t.backup_remote,s+=t.backup_sets;for(var e=t.deleted_timestamps.split(","),a=0;a<e.length;a++){var r=e[a];jQuery("#updraft-navtab-backups-content .updraft_existing_backups_row_"+r).slideUp().remove()}jQuery("#updraft_delete_timestamp").val(t.timestamps),jQuery("#updraft-deleted-files-total").text(o+" "+updraftlion.remote_files_deleted),i(o,d,u,s)}else if("success"==t.result){setTimeout(function(){jQuery("#updraft-deleted-files-total").text(""),jQuery("#updraft-delete-waitwarning").slideUp()},500),update_backupnow_modal(t),t.hasOwnProperty("backupnow_file_entities")&&(impossible_increment_entities=t.backupnow_file_entities),t.hasOwnProperty("count_backups")&&jQuery("#updraft-existing-backups-heading").html(updraftlion.existing_backups+' <span class="updraft_existing_backups_count">'+t.count_backups+"</span>");for(var a=0;a<l.length;a++){var r=l[a];jQuery("#updraft-navtab-backups-content .updraft_existing_backups_row_"+r).slideUp().remove()}updraft_backups_selection.checkSelectionStatus(),updraft_history_lastchecksum=!1,d+=t.backup_local,u+=t.backup_remote,s+=t.backup_sets,setTimeout(function(){alert(t.set_message+" "+s+"\n"+t.local_message+" "+d+"\n"+t.remote_message+" "+u)},900)}})}function l(t,e){jQuery("#updraft-navtab-settings-content #updraft_include_"+t).is(":checked")?e?jQuery("#updraft-navtab-settings-content #updraft_include_"+t+"_exclude_container").show():jQuery("#updraft-navtab-settings-content #updraft_include_"+t+"_exclude_container").slideDown():e?jQuery("#updraft-navtab-settings-content #updraft_include_"+t+"_exclude").hide():jQuery("#updraft-navtab-settings-content #updraft_include_"+t+"_exclude_container").slideUp()}function p(){var t=new plupload.Uploader(updraft_plupload_config);t.bind("Init",function(t){var e=jQuery("#plupload-upload-ui");t.features.dragdrop?(e.addClass("drag-drop"),jQuery("#drag-drop-area").bind("dragover.wp-uploader",function(){e.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){e.removeClass("drag-over")})):(e.removeClass("drag-drop"),jQuery("#drag-drop-area").unbind(".wp-uploader"))}),t.init(),t.bind("FilesAdded",function(e,a){plupload.each(a,function(e){if(!/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-[\-a-z]+([0-9]+?)?(\.(zip|gz|gz\.crypt))?$/i.test(e.name)&&!/^log\.([0-9a-f]{12})\.txt$/.test(e.name)){for(var a=!1,r=0;r<updraft_accept_archivename.length;r++)if(updraft_accept_archivename[r].test(e.name))var a=!0;if(!a)return/\.(zip|tar|tar\.gz|tar\.bz2)$/i.test(e.name)||/\.sql(\.gz)?$/i.test(e.name)?(jQuery("#updraft-message-modal-innards").html("<p><strong>"+e.name+"</strong></p> "+updraftlion.notarchive2),jQuery("#updraft-message-modal").dialog("open")):alert(e.name+": "+updraftlion.notarchive),void t.removeFile(e)}jQuery("#filelist").append('<div class="file" id="'+e.id+'"><b>'+e.name+"</b> (<span>"+plupload.formatSize(0)+"</span>/"+plupload.formatSize(e.size)+') <div class="fileprogress"></div></div>')}),e.refresh(),e.start()}),t.bind("UploadProgress",function(t,e){jQuery("#"+e.id+" .fileprogress").width(e.percent+"%"),jQuery("#"+e.id+" span").html(plupload.formatSize(parseInt(e.size*e.percent/100))),e.size==e.loaded&&(jQuery("#"+e.id).html('<div class="file" id="'+e.id+'"><b>'+e.name+"</b> (<span>"+plupload.formatSize(parseInt(e.size*e.percent/100))+"</span>/"+plupload.formatSize(e.size)+") - "+updraftlion.complete+"</div>"),jQuery("#"+e.id+" .fileprogress").width(e.percent+"%"))}),t.bind("Error",function(t,e){console.log(e);var a;a="-200"==e.code?"\n"+updraftlion.makesure2:updraftlion.makesure;var r=updraftlion.uploaderr+" (code "+e.code+") : "+e.message;e.hasOwnProperty("status")&&e.status&&(r+=" ("+updraftlion.http_code+" "+e.status+")"),e.hasOwnProperty("response")&&(console.log("UpdraftPlus: plupload error: "+e.response),e.response.length<100&&(r+=" "+updraftlion.error+" "+e.response+"\n")),r+=" "+a,alert(r)}),t.bind("FileUploaded",function(t,e,a){if("200"==a.status)try{resp=ud_parse_json(a.response),resp.e?alert(updraftlion.uploaderror+" "+resp.e):resp.dm?(alert(resp.dm),updraft_updatehistory(1,0)):resp.m?updraft_updatehistory(1,0):alert("Unknown server response: "+a.response)}catch(r){console.log(a),alert(updraftlion.jsonnotunderstood)}else alert("Unknown server response status: "+a.code),console.log(a)})}function _(t){params={uri:jQuery("#updraftplus_httpget_uri").val()},params.curl=t,updraft_send_command("httpget",params,function(t){t.e&&alert(t.e),t.r?jQuery("#updraftplus_httpget_results").html("<pre>"+t.r+"</pre>"):console.log(t)},{type:"GET"})}function c(t,e,a){updraft_restore_setoptions(t),jQuery("#updraft_restore_timestamp").val(e),jQuery(".updraft_restore_date").html(a),updraft_restore_stage=1,jQuery("#updraft-restore-modal").dialog("open"),jQuery("#updraft-restore-modal-stage1").show(),jQuery("#updraft-restore-modal-stage2").hide(),jQuery("#updraft-restore-modal-stage2a").html(""),updraft_activejobs_update(!0)}function f(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e="[\\?&]"+t+"=([^&#]*)",a=new RegExp(e),r=a.exec(window.location.href);return null==r?"":decodeURIComponent(r[1].replace(/\+/g," "))}function m(e,a,r){jQuery("#updraft_upload_timestamp").val(e),jQuery("#updraft_upload_nonce").val(a);var n=r.split(",");jQuery(".updraft_remote_storage_destination").each(function(e){var a=jQuery(this).val();if(jQuery.inArray(a,n)==-1){jQuery(this).prop("checked",!1),jQuery(this).prop("disabled",!0);var r=t(this).prop("labels");jQuery(r).append(" "+updraftlion.already_uploaded)}}),jQuery("#updraft-upload-modal").dialog("open")}if(t(document).on("udp/checkout/done",function(e,a){a.hasOwnProperty("product")&&"updraftpremium"===a.product&&"complete"===a.status&&(t(".premium-upgrade-purchase-success").show(),t(".updraft_feat_table").closest("section").hide(),t(".updraft_premium_cta__action").hide())}),t(".expertmode .advanced_settings_container .advanced_tools_button").click(function(){e(t(this).attr("id"))}),jQuery.ui&&jQuery.ui.dialog&&jQuery.ui.dialog.prototype._allowInteraction){var g=jQuery.ui.dialog.prototype._allowInteraction;jQuery.ui.dialog.prototype._allowInteraction=function(t){return!!jQuery(t.target).closest(".select2-dropdown").length||g.apply(this,arguments)}}t("#updraftcentral_keys").on("click","a.updraftcentral_keys_show",function(e){e.preventDefault(),t(this).remove(),t("#updraftcentral_keys_table").slideDown()}),t("#updraftcentral_keycreate_altmethod_moreinfo_get").click(function(e){e.preventDefault(),t(this).remove(),t("#updraftcentral_keycreate_altmethod_moreinfo").slideDown()}),t("#updraft-navtab-settings-content #remote-storage-holder").on("change keyup paste",".updraft_webdav_settings",function(){var e=[];t(".updraft_webdav_settings").each(function(a,r){var n=t(r).attr("id");if(n&&"updraft_webdav_"==n.substring(0,15)){var o=n.substring(15);id_split=o.split("_"),o=id_split[0];var d=id_split[1];"undefined"==typeof e[d]&&(e[d]=[]),e[d][o]=this.value}});var a="",r="@",n="/",o=":",d=":";for(var u in e)(e[u].host.indexOf("@")>=0||""===e[u].host)&&(r=""),e[u].host.indexOf("/")>=0?t("#updraft_webdav_host_error").show():t("#updraft_webdav_host_error").hide(),0!=e[u].path.indexOf("/")&&""!==e[u].path||(n=""),""!==e[u].user&&""!==e[u].pass||(o=""),""!==e[u].host&&""!==e[u].port||(d=""),a=e[u].webdav+e[u].user+o+e[u].pass+r+encodeURIComponent(e[u].host)+d+e[u].port+n+e[u].path,t("#updraft_webdav_url_"+u).val(a)}),t("#updraft-navtab-backups-content").on("click",".js--delete-selected-backups",function(t){t.preventDefault(),updraft_deleteallselected()}),t("#updraft-navtab-backups-content").on("click",".updraft_existing_backups .backup-select input",function(e){updraft_backups_selection.toggle(t(this).closest(".updraft_existing_backups_row"))}),t("#updraft-navtab-backups-content").on("click","#cb-select-all",function(e){t(this).is(":checked")?updraft_backups_selection.selectAll():updraft_backups_selection.deselectAll()}),t("#updraft-navtab-backups-content").on("click",".js--select-all-backups",function(t){updraft_backups_selection.selectAll()}),t("#updraft-navtab-backups-content").on("click",".js--deselect-all-backups",function(t){updraft_backups_selection.deselectAll()}),t("#updraft-navtab-backups-content").on("click",".updraft_existing_backups .updraft_existing_backups_row",function(t){(t.ctrlKey||t.metaKey)&&updraft_backups_selection.toggle(this)}),updraft_backups_selection.checkSelectionStatus(),t("#updraft-navtab-addons-content .wrap").on("click",".updraftplus_com_login .ud_connectsubmit",function(e){e.preventDefault();var a=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_email").val(),r=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_password").val(),n=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_auto_updates").is(":checked")?1:0,o=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_auto_udc_connect").is(":checked")?1:0,d={email:a,password:r,auto_update:n,auto_udc_connect:o};h.submit(d)}),t("#updraft-navtab-addons-content .wrap").on("keydown",".updraftplus_com_login input",function(e){if(13==e.which){e.preventDefault();var a=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_email").val(),r=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_password").val(),n=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_auto_updates").is(":checked")?1:0,o=t("#updraft-navtab-addons-content .wrap .updraftplus_com_login #updraftplus-addons_options_auto_udc_connect").is(":checked")?1:0,d={email:a,password:r,auto_update:n,auto_udc_connect:o};h.submit(d)}}),t("#updraft-navtab-migrate-content").on("click",".updraftclone_show_step_1",function(e){t(".updraftplus-clone").addClass("opened"),t(".updraftclone_show_step_1").hide(),t(".updraft_migrate_widget_temporary_clone_stage1").show(),t(".updraft_migrate_widget_temporary_clone_stage0").hide()}),t("#updraft-navtab-migrate-content").on("click",".updraft_migrate_widget_temporary_clone_show_stage0",function(e){e.preventDefault(),t(".updraft_migrate_widget_temporary_clone_stage0").toggle()}),setup_migrate_tabs(),t("#updraft-navtab-migrate-content").on("click",".updraft_migrate_widget_module_content .close",function(e){t(".updraft_migrate_intro").show(),t(this).closest(".updraft_migrate_widget_module_content").hide()}),t("#updraft-navtab-migrate-content").on("click",".updraft_migrate_add_site--trigger",function(e){e.preventDefault(),t(".updraft_migrate_add_site").toggle()}),t("#updraft-navtab-migrate-content").on("click",".updraft_migrate_widget_module_content .updraftplus_com_login .ud_connectsubmit",function(e){e.preventDefault();var r=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_email").val(),n=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_password").val(),o=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_two_factor_code").val(),d=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login .temporary_clone_terms_and_conditions").is(":checked")?1:0,u={form_data:{email:r,password:n,two_factor_code:o,consent:d}};r&&n?a(u):t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login_status").html("<b>"+updraftlion.error+"</b> "+updraftlion.username_password_required).show()}),t("#updraft-navtab-migrate-content").on("keydown",".updraft_migrate_widget_module_content .updraftplus_com_login input",function(e){if(13==e.which){e.preventDefault();var r=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_email").val(),n=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_password").val(),o=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login #temporary_clone_options_two_factor_code").val(),d=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login .temporary_clone_terms_and_conditions").is(":checked")?1:0,u={
  form_data:{email:r,password:n,two_factor_code:o,consent:d}};r&&n?a(u):t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_login_status").html("<b>"+updraftlion.error+"</b> "+updraftlion.username_password_required).show()}}),t("#updraft-navtab-migrate-content").on("click",".updraft_migrate_widget_module_content .updraftplus_com_key .ud_key_connectsubmit",function(e){e.preventDefault();var a=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key #temporary_clone_options_key").val(),n=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key .temporary_clone_terms_and_conditions").is(":checked")?1:0,o={form_data:{clone_key:a,consent:n}};a?r(o):t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key_status").html("<b>"+updraftlion.error+"</b> "+updraftlion.clone_key_required).show()}),t("#updraft-navtab-migrate-content").on("keydown",".updraft_migrate_widget_module_content .updraftplus_com_key input",function(e){if(13==e.which){e.preventDefault();var a=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key #temporary_clone_options_key").val(),n=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key .temporary_clone_terms_and_conditions").is(":checked")?1:0,o={form_data:{clone_key:a,consent:n}};a?r(o):t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_com_key_status").html("<b>"+updraftlion.error+"</b> "+updraftlion.clone_key_required).show()}}),t("#updraft-navtab-migrate-content").on("change",".updraft_migrate_widget_module_content #updraftplus_clone_php_options",function(){var e=t(this).data("php_version"),a=t(this).val();a<e?t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status").html(updraftlion.clone_version_warning):t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status").html("")}),t("#updraft-navtab-migrate-content").on("change",".updraft_migrate_widget_module_content #updraftplus_clone_wp_options",function(){var e=t(this).data("wp_version"),a=t(this).val();a<e?t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status").html(updraftlion.clone_version_warning):t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status").html("")}),t("#updraft-navtab-migrate-content").on("click",".updraft_migrate_widget_module_content #updraft_migrate_createclone",function(e){e.preventDefault(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraft_migrate_createclone").prop("disabled",!0),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status").html(""),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_spinner.spinner").addClass("visible");var a=t(this).data("clone_id"),r=t(this).data("secret_token"),o=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_php_options").val(),d=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_wp_options").val(),u=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_region_options").val(),s=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_updraftclone_branch").val(),i=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_updraftplus_branch").val(),l=t(".updraftplus_clone_admin_login_options").is(":checked"),p={form_data:{clone_id:a,secret_token:r,install_info:{php_version:o,wp_version:d,region:u,admin_only:l,updraftclone_branch:"undefined"==typeof s?"":s,updraftplus_branch:"undefined"==typeof i?"":i}}};updraft_send_command("process_updraftplus_clone_create",p,function(e){try{if(t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraft_migrate_createclone").prop("disabled",!1),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_spinner.spinner").removeClass("visible"),e.hasOwnProperty("status")&&"error"==e.status)return void t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraftplus_clone_status").html(updraftlion.error+" "+e.message).show();if("success"===e.status){t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage2").hide(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage3").show(),t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content .updraft_migrate_widget_temporary_clone_stage3").html(e.html),jQuery("#updraft_clone_progress .updraftplus_spinner.spinner").addClass("visible");var o="current",d="current",u=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_backup_options").length,s=t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraftplus_clone_backup_options").find("option:selected");0!==u&&"undefined"!=typeof s&&(o=s.data("nonce"),d=s.data("timestamp")),n(a,r,e.url,e.key,o,d)}}catch(i){t("#updraft-navtab-migrate-content .updraft_migrate_widget_module_content #updraft_migrate_createclone").prop("disabled",!1),console.log("Error when processing the response of process_updraftplus_clone_create (as follows)"),console.log(i)}})});var h={};h.set_status=function(e){t("#updraft-navtab-addons-content .wrap").find(".updraftplus_spinner.spinner").text(e)},h.show_loader=function(){t("#updraft-navtab-addons-content .wrap").find(".updraftplus_spinner.spinner").addClass("visible"),t("#updraft-navtab-addons-content .wrap").find(".ud_connectsubmit").prop("disabled","disabled")},h.hide_loader=function(){t("#updraft-navtab-addons-content .wrap").find(".updraftplus_spinner.spinner").removeClass("visible").text(updraftlion.processing),t("#updraft-navtab-addons-content .wrap").find(".ud_connectsubmit").removeProp("disabled")},h.submit=function(e){if(t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html("").hide(),this.stage)switch(this.stage){case"connect_udc":case"connect_udc_TFA":var a=t("#updraftplus-addons_options_email").val(),r=t("#updraftplus-addons_options_password").val();this.login_data.email=a,this.login_data.password=r,this.connect_udc();break;case"create_key":this.create_key();break;default:this.stage=null,h.submit()}else this.set_status(updraftlion.connecting),this.show_loader(),updraft_send_command("updraftplus_com_login_submit",{data:e},function(a){a.hasOwnProperty("success")?t("#updraftplus-addons_options_auto_udc_connect").is(":checked")?(this.login_data={email:e.email,password:e.password,i_consent:1,two_factor_code:""},h.create_key()):(h.hide_loader(),t("#updraft-navtab-addons-content .wrap .updraftplus_com_login").submit()):a.hasOwnProperty("error")&&(h.hide_loader(),t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html(a.message).show())}.bind(this))},h.create_key=function(){this.stage="create_key",this.set_status(updraftlion.udc_cloud_connected),this.show_loader();var e={where_send:"__updraftpluscom",key_description:"",key_size:null,mothership_firewalled:0};updraft_send_command("updraftcentral_create_key",e,function(e){try{var a=ud_parse_json(e);if(a.hasOwnProperty("error"))return void console.log(a);a.hasOwnProperty("bundle")?(console.log("bundle",a.bundle),this.login_data.key=a.bundle,this.stage="connect_udc",h.connect_udc()):(a.hasOwnProperty("r")?(t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html(updraftlion.trouble_connecting).show(),alert(a.r)):(t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html(updraftlion.trouble_connecting).show(),console.log(a)),h.hide_loader())}catch(r){console.log(r),h.hide_loader()}}.bind(this),{json_parse:!1})},h.connect_udc=function(){var e=t("#updraft-navtab-addons-content .wrap");h.set_status(updraftlion.udc_cloud_key_created),h.show_loader(),"connect_udc_TFA"==this.stage&&(this.login_data.two_factor_code=e.find("input#updraftplus-addons_options_two_factor_code").val(),h.set_status(updraftlion.checking_tfa_code));var a={form_data:this.login_data};a.form_data.addons_options_connect=1,updraft_send_command("process_updraftcentral_login",a,function(a){try{var r=ud_parse_json(a);if(r.hasOwnProperty("error")){if("incorrect_password"===r.code&&(e.find(".tfa_fields").hide(),e.find(".non_tfa_fields").show(),e.find("input#updraftplus-addons_options_two_factor_code").val(""),e.find("input#updraftplus-addons_options_password").val("").focus()),"no_key_found"===r.code&&(this.stage="create_key"),"no_licences_available"!==r.code)return t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html(r.message).show(),t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").find("a").attr("target","_blank"),console.log(r),void h.hide_loader();t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html(updraftlion.login_udc_no_licences_short).show(),r.status="authenticated",e.find('input[name="_wp_http_referer"]').val(function(t,e){return e+"&udc_connect=0"})}r.hasOwnProperty("tfa_enabled")&&1==r.tfa_enabled&&(t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html("").hide(),e.find(".non_tfa_fields").hide(),e.find(".tfa_fields").show(),e.find("input#updraftplus-addons_options_two_factor_code").focus(),this.stage="connect_udc_TFA"),"authenticated"===r.status&&(e.find(".non_tfa_fields").hide(),e.find(".tfa_fields").hide(),e.find(".updraft-after-form-table").hide(),this.stage=null,t("#updraft-navtab-addons-content .wrap .updraftplus_com_login_status").html(updraftlion.login_successful_short).show().addClass("success"),setTimeout(function(){t("#updraft-navtab-addons-content .wrap form.updraftplus_com_login").submit()},1e3))}catch(n){console.log(n)}h.hide_loader()}.bind(this),{json_parse:!1})},t("#updraft-navtab-settings-content #remote-storage-holder").on("click",".updraftplusmethod a.updraft_add_instance",function(e){e.preventDefault(),updraft_settings_form_changed=!0;var a=t(this).data("method");o(a)}),t("#updraft-navtab-settings-content #remote-storage-holder").on("click",".updraftplusmethod a.updraft_delete_instance",function(e){e.preventDefault(),updraft_settings_form_changed=!0;var a=t(this).data("method"),r=t(this).data("instance_id");1===t("."+a+"_updraft_remote_storage_border").length&&o(a),t("."+a+"-"+r).hide("slow",function(){t(this).remove()})}),t("#updraft-navtab-settings-content #remote-storage-holder").on("click",".updraftplusmethod .updraft_edit_label_instance",function(e){t(this).find("span").hide(),t(this).attr("contentEditable",!0).focus()}),t("#updraft-navtab-settings-content #remote-storage-holder").on("keyup",".updraftplusmethod .updraft_edit_label_instance",function(e){var a=jQuery(this).data("method"),r=jQuery(this).data("instance_id"),n=jQuery(this).text();t("#updraft_"+a+"_instance_label_"+r).val(n)}),t("#updraft-navtab-settings-content #remote-storage-holder").on("blur",".updraftplusmethod .updraft_edit_label_instance",function(e){t(this).attr("contentEditable",!1),t(this).find("span").show()}),t("#updraft-navtab-settings-content #remote-storage-holder").on("keypress",".updraftplusmethod .updraft_edit_label_instance",function(e){13===e.which&&(t(this).attr("contentEditable",!1),t(this).find("span").show(),t(this).blur())}),jQuery("#updraft-navtab-settings-content #remote-storage-holder").on("change","input[class='updraft_instance_toggle']",function(){updraft_settings_form_changed=!0,jQuery(this).is(":checked")?jQuery(this).siblings("label").html(updraftlion.instance_enabled):jQuery(this).siblings("label").html(updraftlion.instance_disabled)}),jQuery("#updraft-navtab-settings-content #remote-storage-holder").on("click",".updraftplusmethod button.updraft-test-button",function(){var e=jQuery(this).data("method"),a=jQuery(this).data("instance_id");updraft_remote_storage_test(e,function(r,n,o){return"sftp"==e&&(o.hasOwnProperty("scp")&&o.scp?alert(updraftlion.settings_test_result.replace("%s","SCP")+" "+r.output):alert(updraftlion.settings_test_result.replace("%s","SFTP")+" "+r.output),r.hasOwnProperty("data")&&r.data&&r.data.hasOwnProperty("valid_md5_fingerprint")&&r.data.valid_md5_fingerprint&&t("#updraft_sftp_fingerprint_"+a).val(r.data.valid_md5_fingerprint),!0)},a)}),t("#updraft-navtab-settings-content select.updraft_interval, #updraft-navtab-settings-content select.updraft_interval_database").change(function(){updraft_check_same_times()}),t("#backupnow_includefiles_showmoreoptions").click(function(e){e.preventDefault(),t("#backupnow_includefiles_moreoptions").toggle()}),t("#backupnow_database_showmoreoptions").click(function(e){e.preventDefault(),t("#backupnow_database_moreoptions").toggle()}),t("#updraft-navtab-backups-content").on("click","a.updraft_diskspaceused_update",function(t){t.preventDefault(),updraftplus_diskspace()}),t(".advanced_settings_content a.updraft_diskspaceused_update").click(function(t){t.preventDefault(),jQuery(".advanced_settings_content .updraft_diskspaceused").html("<em>"+updraftlion.calculating+"</em>"),updraft_send_command("get_fragment",{fragment:"disk_usage",data:"updraft"},function(t){jQuery(".advanced_settings_content .updraft_diskspaceused").html(t.output)},{type:"GET"})}),t("#updraft-navtab-backups-content a.updraft_uploader_toggle").click(function(e){e.preventDefault(),t("#updraft-plupload-modal").slideToggle()}),t("#updraft-navtab-backups-content a.updraft_rescan_local").click(function(t){t.preventDefault(),updraft_updatehistory(1,0)}),t("#updraft-navtab-backups-content a.updraft_rescan_remote").click(function(t){t.preventDefault(),updraft_updatehistory(1,1)}),t("#updraftplus-remote-rescan-debug").click(function(t){t.preventDefault(),updraft_updatehistory(1,1,1)}),jQuery("#updraftcentral_keys").on("click",'input[type="radio"]',function(){u(!1)}),u(!0),jQuery("#updraftcentral_keys").on("click","#updraftcentral_view_log",function(t){t.preventDefault(),jQuery("#updraftcentral_view_log_container").block({message:'<div style="margin: 8px; font-size:150%;"><img src="'+updraftlion.ud_url+'/images/udlogo-rotating.gif" height="80" width="80" style="padding-bottom:10px;"><br>'+updraftlion.fetching+"</div>"});try{updraft_send_command("updraftcentral_get_log",null,function(t){jQuery("#updraftcentral_view_log_container").unblock(),t.hasOwnProperty("log_contents")?jQuery("#updraftcentral_view_log_contents").html('<div style="border:1px solid;padding: 2px;max-height: 400px; overflow-y:scroll;">'+t.log_contents+"</div>"):console.response(resp)},{error_callback:function(t,e,a,r){if(jQuery("#updraftcentral_view_log_container").unblock(),"undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";console.log(n),alert(n),console.log(t)}}})}catch(e){jQuery("#updraft_central_key").html(),console.log(e)}}),jQuery("#updraftcentral_keys").on("click","#updraftcentral_wizard_go",function(t){jQuery("#updraftcentral_wizard_go").hide(),jQuery(".updraftcentral_wizard_success").remove(),jQuery(".create_key_container").show()}),jQuery("#updraftcentral_keys").on("click","#updraftcentral_stage1_go",function(t){t.preventDefault(),jQuery(".updraftcentral_wizard_stage2").hide(),jQuery(".updraftcentral_wizard_stage1").show()}),jQuery("#updraftcentral_keys").on("click","#updraftcentral_stage2_go",function(t){t.preventDefault(),s()}),jQuery("#updraftcentral_keys").on("click","#updraftcentral_keycreate_go",function(t){t.preventDefault();var e=!!jQuery("#updraftcentral_mothership_other").is(":checked"),a=jQuery("#updraftcentral_keycreate_description").val(),r=jQuery("#updraftcentral_keycreate_keysize").val(),n="__updraftpluscom";if(data={key_description:a,key_size:r},e&&(n=jQuery("#updraftcentral_keycreate_mothership").val(),"http"!=n.substring(0,4)))return void alert(updraftlion.enter_mothership_url);data.mothership_firewalled=jQuery("#updraftcentral_keycreate_mothership_firewalled").is(":checked")?1:0,data.where_send=n,jQuery(".create_key_container").hide(),jQuery(".updraftcentral_wizard_stage1").show(),jQuery(".updraftcentral_wizard_stage2").hide(),jQuery("#updraftcentral_keys").block({message:'<div style="margin: 8px; font-size:150%;"><img src="'+updraftlion.ud_url+'/images/udlogo-rotating.gif" height="80" width="80" style="padding-bottom:10px;"><br>'+updraftlion.creating_please_allow+"</div>"});try{updraft_send_command("updraftcentral_create_key",data,function(t){jQuery("#updraftcentral_keys").unblock();try{if(t.hasOwnProperty("error"))return alert(t.error),void console.log(t);alert(t.r),t.hasOwnProperty("bundle")&&t.hasOwnProperty("keys_guide")?(jQuery("#updraftcentral_keys_content").html(t.keys_guide),jQuery("#updraftcentral_keys_content").append('<div class="updraftcentral_wizard_success">'+t.r+'<br><textarea onclick="this.select();" style="width:620px; height:165px; word-wrap:break-word; border: 1px solid #aaa; border-radius: 3px; padding:4px;">'+t.bundle+"</textarea></div>")):console.log(t),t.hasOwnProperty("keys_table")&&jQuery("#updraftcentral_keys_content").append(t.keys_table),jQuery("#updraftcentral_wizard_go").show()}catch(e){alert(updraftlion.unexpectedresponse+" "+response),console.log(e)}},{error_callback:function(t,e,a,r){if(jQuery("#updraftcentral_keys").unblock(),"undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";console.log(n),alert(n),console.log(t)}}})}catch(o){jQuery("#updraft_central_key").html(),console.log(o)}}),jQuery("#updraftcentral_keys").on("click",".updraftcentral_key_delete",function(t){t.preventDefault();var e=jQuery(this).data("key_id");return"undefined"==typeof e?void console.log("UpdraftPlus: .updraftcentral_key_delete clicked, but no key ID found"):(jQuery("#updraftcentral_keys").block({message:'<div style="margin: 8px; font-size:150%;"><img src="'+updraftlion.ud_url+'/images/udlogo-rotating.gif" height="80" width="80" style="padding-bottom:10px;"><br>'+updraftlion.deleting+"</div>"}),void updraft_send_command("updraftcentral_delete_key",{key_id:e},function(t){jQuery("#updraftcentral_keys").unblock(),t.hasOwnProperty("keys_table")&&jQuery("#updraftcentral_keys_content").html(t.keys_table)},{error_callback:function(t,e,a,r){if(jQuery("#updraftcentral_keys").unblock(),"undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";console.log(n),alert(n),console.log(t)}}}))}),jQuery("#updraft_reset_sid").click(function(t){t.preventDefault(),updraft_send_command("reset_site_id",null,function(t){jQuery("#updraft_show_sid").html(t)},{json_parse:!1})}),jQuery("#updraft-navtab-settings-content form input:not('.udignorechange'), #updraft-navtab-settings-content form select").change(function(t){updraft_settings_form_changed=!0}),jQuery("#updraft-navtab-settings-content form input[type='submit']").click(function(t){updraft_settings_form_changed=!1});var y=180;jQuery(".updraft-bigbutton").each(function(t,e){var a=jQuery(e).width();a>y&&(y=a)}),y>180&&jQuery(".updraft-bigbutton").width(y),jQuery("#updraft-navtab-backups-content").length&&setInterval(function(){updraft_activejobs_update(!1)},1250),setTimeout(function(){jQuery("#setting-error-settings_updated").slideUp()},5e3),jQuery("#updraft_restore_db").change(function(){jQuery("#updraft_restore_db").is(":checked")&&1==jQuery(this).data("encrypted")?jQuery("#updraft_restorer_dboptions").slideDown():jQuery("#updraft_restorer_dboptions").slideUp()}),updraft_check_same_times();var b={};b[updraftlion.close]=function(){jQuery(this).dialog("close")},jQuery("#updraft-message-modal").dialog({autoOpen:!1,height:350,width:520,modal:!0,buttons:b});var v={};v[updraftlion.deletebutton]=function(){i(0,0,0,0)},v[updraftlion.cancel]=function(){jQuery(this).dialog("close")},jQuery("#updraft-delete-modal").dialog({autoOpen:!1,height:322,width:430,modal:!0,buttons:v});var w={};w[updraftlion.restore]=function(){var t=0,e=[],a=0,r=jQuery("#updraft_restore_meta_foreign").val();if(jQuery('input[name="updraft_restore[]"]').each(function(n,o){if(jQuery(o).is(":checked")&&!jQuery(o).is(":disabled")){t=1;var d=jQuery(o).data("howmany"),u=jQuery(o).val();if((1==r||2==r&&"db"!=u)&&("wpcore"!=u&&(d=jQuery("#updraft_restore_form #updraft_restore_wpcore").data("howmany")),u="wpcore"),"wpcore"!=u||0==a){var s=[u,d];e.push(s),"wpcore"==u&&(a=1)}}}),1==t){if(1==updraft_restore_stage){jQuery("#updraft-restore-modal-stage1").slideUp("slow"),jQuery("#updraft-restore-modal-stage2").show(),updraft_restore_stage=2;var n=jQuery(".updraft_restore_date").first().text(),o=e,d=jQuery("#updraft_restore_timestamp").val();try{updraft_send_command("whichdownloadsneeded",{downloads:e,timestamp:d},function(t){if(t.hasOwnProperty("downloads")&&(console.log("UpdraftPlus: items which still require downloading follow"),o=t.downloads,console.log(o)),0==o.length)updraft_restorer_checkstage2(0);else for(var e=0;e<o.length;e++)updraft_downloader("udrestoredlstatus_",d,o[e][0],"#ud_downloadstatus2",o[e][1],n,!1)},{alert_on_error:!1,error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),jQuery("#updraft-restore-modal-stage2a").html('<p style="color:red;">'+r.fatal_error_message+"</p>");else{var n="updraft_send_command: error: "+e+" ("+a+")";jQuery("#updraft-restore-modal-stage2a").html('<p style="color:red; margin: 5px;">'+n+"</p>"),console.log(n),console.log(t)}}})}catch(u){console.log("UpdraftPlus: error (follows) when looking for items needing downloading"),console.log(u),alert(updraftlion.jsonnotunderstood)}}else if(2==updraft_restore_stage)updraft_restorer_checkstage2(1);else if(3==updraft_restore_stage){var s=1;if(jQuery("#updraft_restoreoptions_ui input.required").each(function(t){if(0!=s){var e=jQuery(this).val();if(""==e)alert(updraftlion.pleasefillinrequired),s=0;else if(""!=jQuery(this).attr("pattern")){var a=jQuery(this).attr("pattern"),r=new RegExp(a,"g");r.test(e)||(alert(jQuery(this).data("invalidpattern")),s=0)}}}),!s)return;var i=jQuery("#updraft_restoreoptions_ui select, #updraft_restoreoptions_ui input").serialize();console.log("Restore options: "+i),jQuery("#updraft_restorer_restore_options").val(i),jQuery("#updraft-restore-modal-stage2a").html(updraftlion.restore_proceeding),jQuery("#updraft_restore_form").submit(),updraft_restore_stage=4}}else alert(updraftlion.youdidnotselectany)},w[updraftlion.cancel]=function(){jQuery(this).dialog("close")},jQuery("#updraft-restore-modal").dialog({autoOpen:!1,height:505,width:590,modal:!0,buttons:w}),jQuery("#updraft-iframe-modal").dialog({autoOpen:!1,height:500,width:780,modal:!0}),jQuery("#updraft-backupnow-inpage-modal").dialog({autoOpen:!1,height:380,width:580,modal:!0});var j={};j[updraftlion.backupnow]=function(){var t=jQuery("#backupnow_includedb").is(":checked")?0:1,e=jQuery("#backupnow_includefiles").is(":checked")?0:1,a=jQuery("#backupnow_includecloud").is(":checked")?0:1,r=backupnow_whichtables_checked(""),n=jQuery("#always_keep").is(":checked")?1:0,o="incremental"==jQuery("#updraft-backupnow-modal").data("backup-type")?1:0;if(""==r&&0==t)return alert(updraftlion.notableschosen),void jQuery("#backupnow_includefiles_moreoptions").show();"boolean"==typeof r&&(r=null);var d=backupnow_whichfiles_checked("");return""==d&&0==e?(alert(updraftlion.nofileschosen),void jQuery("#backupnow_includefiles_moreoptions").show()):t&&e?void alert(updraftlion.excludedeverything):(jQuery(this).dialog("close"),setTimeout(function(){jQuery("#updraft_lastlogmessagerow").fadeOut("slow",function(){jQuery(this).fadeIn("slow")})},1700),void updraft_backupnow_go(t,e,a,d,{always_keep:n,incremental:o},jQuery("#backupnow_label").val(),r))},j[updraftlion.cancel]=function(){jQuery(this).dialog("close")},jQuery("#updraft-backupnow-modal").dialog({autoOpen:!1,height:472,width:610,modal:!0,buttons:j,create:function(){t(this).closest(".ui-dialog").find(".ui-dialog-buttonpane .ui-button:first").addClass("js-tour-backup-now-button")}}),jQuery("#updraft-poplog").dialog({autoOpen:!1,height:600,width:"75%",modal:!0}),jQuery("#updraft-navtab-settings-content .enableexpertmode").click(function(){return jQuery("#updraft-navtab-settings-content .expertmode").fadeIn(),jQuery("#updraft-navtab-settings-content .enableexpertmode").off("click"),!1}),jQuery("#updraft-navtab-settings-content .backupdirrow").on("click","a.updraft_backup_dir_reset",function(){return jQuery("#updraft_dir").val("updraft"),!1}),jQuery("#updraft-navtab-settings-content .updraft_include_entity").click(function(){var t=jQuery(this).data("toggle_exclude_field");t&&l(t,!1)}),jQuery(".updraft_exclude_entity_container").on("click",".updraft_exclude_entity_delete",function(t){if(t.preventDefault(),confirm(updraftlion.exclude_rule_remove_conformation_msg)){var e=jQuery(this).data("include-backup-file");jQuery.when(jQuery(this).closest(".updraft_exclude_entity_wrapper").remove()).then(updraft_exclude_entity_update(e))}}),jQuery(".updraft_exclude_entity_container").on("click",".updraft_exclude_entity_edit",function(t){t.preventDefault();var e=jQuery(this).hide().closest(".updraft_exclude_entity_wrapper"),a=e.find("input");a.removeProp("readonly").focus();var r=a.val();a.val(""),a.val(r),e.find(".updraft_exclude_entity_update").addClass("is-active").show()}),jQuery(".updraft_exclude_entity_container").on("click",".updraft_exclude_entity_update",function(t){t.preventDefault();var e=jQuery(this).closest(".updraft_exclude_entity_wrapper"),a=jQuery(this).data("include-backup-file"),r=jQuery.trim(e.find("input").val()),n=!1;r==e.find("input").data("val")?n=!0:updraft_is_unique_exclude_rule(r,a)&&(n=!0),n&&(jQuery(this).hide().removeClass("is-active"),jQuery.when(e.find("input").prop("readonly","readonly").data("val",r)).then(function(){e.find(".updraft_exclude_entity_edit").show(),updraft_exclude_entity_update(a)}))}),jQuery("#updraft_exclude_modal").dialog({autoOpen:!1,modal:!0,width:520,height:"auto",open:function(e,a){t(this).parent().focus()}}),jQuery(".updraft_exclude_container .updraft_add_exclude_item").click(function(t){t.preventDefault();var e=jQuery(this).data("include-backup-file");jQuery("#updraft_exclude_modal_for").val(e),jQuery("#updraft_exclude_modal_path").val(jQuery(this).data("path")),"uploads"==e&&jQuery("#updraft-exclude-file-dir-prefix").html(jQuery("#updraft-exclude-upload-base-dir").val()),jQuery(".updraft-exclude-modal-reset").trigger("click"),jQuery("#updraft_exclude_modal").dialog("open")}),jQuery(".updraft-exclude-link").click(function(t){t.preventDefault();var e=jQuery(this).data("panel");"file-dir"==e&&jQuery("#updraft_exclude_files_folders_jstree").jstree({core:{multiple:!1,data:function(t,e){updraft_send_command("get_jstree_directory_nodes",{entity:"filebrowser",node:t,path:jQuery("#updraft_exclude_modal_path").val(),findex:0,skip_root_node:!0},function(t){t.hasOwnProperty("error")?alert(t.error):e.call(this,t.nodes)},{error_callback:function(t,e,a,r){if("undefined"!=typeof r&&r.hasOwnProperty("fatal_error"))console.error(r.fatal_error_message),jQuery("#updraft_zip_files_jstree").html('<p style="color:red; margin: 5px;">'+r.fatal_error_message+"</p>"),alert(r.fatal_error_message);else{var n="updraft_send_command: error: "+e+" ("+a+")";jQuery("#updraft_zip_files_jstree").html('<p style="color:red; margin: 5px;">'+n+"</p>"),console.log(n),alert(n),console.log(t)}}})},error:function(t){alert(t),console.log(t)}},search:{show_only_matches:!0},plugins:["sort"]}),jQuery("#updraft_exclude_modal_main").slideUp(),jQuery(".updraft-exclude-panel").hide(),jQuery(".updraft-exclude-panel[data-panel="+e+"]").slideDown()}),jQuery(".updraft-exclude-modal-reset").click(function(t){t.preventDefault(),jQuery("#updraft_exclude_files_folders_jstree").jstree("destroy"),jQuery("#updraft_exclude_extension_field").val(""),jQuery("#updraft_exclude_prefix_field").val(""),jQuery(".updraft-exclude-panel").slideUp(),jQuery("#updraft_exclude_modal_main").slideDown()}),jQuery(".updraft-exclude-submit").click(function(){var t=jQuery(this).data("panel"),e="";switch(t){case"file-dir":var a=jQuery("#updraft_exclude_files_folders_jstree").jstree("get_selected");if(0==a.length)return void alert(updraftlion.exclude_select_file_or_folder_msg);var r=a[0],n=jQuery("#updraft_exclude_modal_path").val();r.substr(0,n.length)==n&&(r=r.substr(n.length,r.length)),"/"==r.charAt(0)&&(r=r.substr(1)),"/"==r.charAt(r.length-1)&&(r=r.substr(0,r.length-1)),e=r;break;case"extension":var o=jQuery("#updraft_exclude_extension_field").val();if(""==o)return void alert(updraftlion.exclude_type_ext_msg);if(!o.match(/^[0-9a-zA-Z]+$/))return void alert(updraftlion.exclude_ext_error_msg);e="ext:"+o;break;case"begin-with":var d=jQuery("#updraft_exclude_prefix_field").val();if(""==d)return void alert(updraftlion.exclude_type_prefix_msg);if(!d.match(/^\s*[a-z-_\d,\s]+\s*$/i))return void alert(updraftlion.exclude_prefix_error_msg);e="prefix:"+d;break;default:return}var u=jQuery("#updraft_exclude_modal_for").val();if(updraft_is_unique_exclude_rule(e,u)){var s='<div class="updraft_exclude_entity_wrapper"><input type="text" class="updraft_exclude_entity_field updraft_include_'+u+'_exclude_entity" name="updraft_include_'+u+'_exclude_entity[]" value="'+e+'" data-val="'+e+'" data-include-backup-file="'+u+'" readonly="readonly"><a href="#" class="updraft_exclude_entity_edit dashicons dashicons-edit" data-include-backup-file="'+u+'"></a><a href="#" class="updraft_exclude_entity_update dashicons dashicons-yes" data-include-backup-file="'+u+'" style="display: none;"></a><a href="#" class="updraft_exclude_entity_delete dashicons dashicons-no" data-include-backup-file="'+u+'"></a></div>';jQuery('.updraft_exclude_entity_container[data-include-backup-file="'+u+'"]').append(s),updraft_exclude_entity_update(u),jQuery("#updraft_exclude_modal").dialog("close")}}),jQuery("#updraft-navtab-settings-content .updraft-service").change(function(){var t=jQuery(this).val();jQuery("#updraft-navtab-settings-content .updraftplusmethod").hide(),jQuery("#updraft-navtab-settings-content ."+t).show()}),jQuery("#updraft-navtab-settings-content a.updraft_show_decryption_widget").click(function(t){t.preventDefault(),jQuery("#updraftplus_db_decrypt").val(jQuery("#updraft_encryptionphrase").val()),jQuery("#updraft-manualdecrypt-modal").slideToggle()}),jQuery("#updraftplus-phpinfo").click(function(t){t.preventDefault(),updraft_iframe_modal("phpinfo",updraftlion.phpinfo)}),jQuery("#updraftplus-rawbackuphistory").click(function(t){t.preventDefault(),updraft_iframe_modal("rawbackuphistory",updraftlion.raw)}),jQuery("#updraft-navtab-status").click(function(t){t.preventDefault(),updraft_open_main_tab("status"),updraft_page_is_visible=1,updraft_console_focussed_tab="status",updraft_activejobs_update(!0)}),jQuery("#updraft-navtab-expert").click(function(t){t.preventDefault(),updraft_open_main_tab("expert"),updraft_page_is_visible=1}),jQuery("#updraft-navtab-settings, #updraft-navtab-settings2, #updraft_backupnow_gotosettings").click(function(t){t.preventDefault(),jQuery(this).parents(".updraftmessage").remove(),jQuery("#updraft-backupnow-modal").dialog("close"),updraft_open_main_tab("settings"),updraft_page_is_visible=1}),jQuery("#updraft-navtab-addons").click(function(t){t.preventDefault(),jQuery(this).addClass("b#nav-tab-active"),updraft_open_main_tab("addons"),updraft_page_is_visible=1}),jQuery("#updraft-navtab-backups").click(function(t){t.preventDefault(),updraft_console_focussed_tab="backups",updraft_historytimertoggle(1),updraft_open_main_tab("backups")}),jQuery("#updraft-navtab-migrate").click(function(t){
  t.preventDefault(),jQuery("#updraft_migrate_tab_alt").html("").hide(),updraft_open_main_tab("migrate"),updraft_page_is_visible=1,jQuery("#updraft_migrate .updraft_migrate_widget_module_content").is(":visible")||jQuery(".updraft_migrate_intro").show()}),"migrate"==updraftlion.tab&&jQuery("#updraft-navtab-migrate").trigger("click"),updraft_send_command("ping",null,function(t,e){"success"==e&&"pong"!=t&&t.indexOf("pong")>=0&&(jQuery("#updraft-navtab-backups-content .ud-whitespace-warning").show(),console.log("UpdraftPlus: Extra output warning: response (which should be just (string)'pong') follows."),console.log(t))},{json_parse:!1,type:"GET"});try{"undefined"!=typeof updraft_plupload_config&&p()}catch(k){console.log(k)}if(jQuery("#updraftplus_httpget_go").click(function(t){t.preventDefault(),_(0)}),jQuery("#updraftplus_httpget_gocurl").click(function(t){t.preventDefault(),_(1)}),jQuery("#updraftplus_callwpaction_go").click(function(t){t.preventDefault(),params={wpaction:jQuery("#updraftplus_callwpaction").val()},updraft_send_command("call_wordpress_action",params,function(t){t.e?alert(t.e):t.s||(t.r?jQuery("#updraftplus_callwpaction_results").html(t.r):(console.log(t),alert(updraftlion.jsonnotunderstood)))})}),jQuery("#updraft_activejobs_table, #updraft-navtab-migrate-content").on("click",".updraft_jobinfo_delete",function(e){e.preventDefault();var a=jQuery(this).data("jobid");a?(t(this).addClass("disabled"),updraft_activejobs_delete(a)):console.log("UpdraftPlus: A stop job link was clicked, but the Job ID could not be found")}),jQuery("#updraft_activejobs_table, #updraft-navtab-backups-content .updraft_existing_backups, #updraft-backupnow-inpage-modal, #updraft-navtab-migrate-content").on("click",".updraft-log-link",function(t){t.preventDefault();var e=jQuery(this).data("fileid"),a=jQuery(this).data("jobid");e?updraft_popuplog(e):a?updraft_popuplog(a):console.log("UpdraftPlus: A log link was clicked, but the Job ID could not be found")}),jQuery("#updraft-navtab-backups-content .updraft_existing_backups").on("click","button.choose-components-button",function(t){var e=jQuery(this).data("entities"),a=jQuery(this).data("backup_timestamp"),r=jQuery(this).data("showdata");c(e,a,r)}),"initiate_restore"==f("udaction")){var Q=f("entities"),x=f("backup_timestamp"),O=f("showdata");c(Q,x,O)}var P={};P[updraftlion.uploadbutton]=function(){var t=jQuery("#updraft_upload_timestamp").val(),e=jQuery("#updraft_upload_nonce").val(),a="",r=!1;return jQuery(".updraft_remote_storage_destination").each(function(t){jQuery(this).is(":checked")&&(r=!0)}),r?(a=jQuery("input[name^='updraft_remote_storage_destination_']").serializeArray(),jQuery(this).dialog("close"),alert(updraftlion.local_upload_started),void updraft_send_command("upload_local_backup",{use_nonce:e,use_timestamp:t,services:a},function(t){})):void jQuery("#updraft-upload-modal-error").html(updraftlion.local_upload_error)},P[updraftlion.cancel]=function(){jQuery(this).dialog("close")},jQuery("#updraft-upload-modal").dialog({autoOpen:!1,height:322,width:430,modal:!0,buttons:P}),jQuery("#updraft-navtab-backups-content .updraft_existing_backups").on("click","button.updraft-upload-link",function(t){t.preventDefault();var e=jQuery(this).data("nonce").toString(),a=jQuery(this).data("key").toString(),r=jQuery(this).data("services").toString();e?m(a,e,r):console.log("UpdraftPlus: A upload link was clicked, but the Job ID could not be found")}),jQuery("#updraft-navtab-backups-content .updraft_existing_backups").on("click",".updraft-delete-link",function(t){t.preventDefault();var e=jQuery(this).data("hasremote"),a=jQuery(this).data("nonce").toString(),r=jQuery(this).data("key").toString();a?updraft_delete(r,a,e):console.log("UpdraftPlus: A delete link was clicked, but the Job ID could not be found")}),jQuery("#updraft-navtab-backups-content .updraft_existing_backups").on("click","button.updraft_download_button",function(t){t.preventDefault();var e="uddlstatus_",a=jQuery(this).data("backup_timestamp"),r=jQuery(this).data("what"),n=".ud_downloadstatus",o=jQuery(this).data("set_contents"),d=jQuery(this).data("prettydate"),u=!0;updraft_downloader(e,a,r,n,o,d,u)}),jQuery("#updraft-navtab-backups-content .updraft_existing_backups").on("dblclick",".updraft_existingbackup_date",function(t){t.preventDefault();var e=jQuery(this).data("rawbackup");null!=e&&""!=e&&updraft_html_modal(e,updraftlion.raw,780,500)})}),jQuery(document).ready(function(t){var e="#updraft-navtab-settings-content ";t(e+"#remote-storage-holder").on("click",".updraftvault_backtostart",function(a){a.preventDefault(),t(e+"#updraftvault_settings_showoptions").slideUp(),t(e+"#updraftvault_settings_connect").slideUp(),t(e+"#updraftvault_settings_connected").slideUp(),t(e+"#updraftvault_settings_default").slideDown()}),t(e).on("keypress","#updraftvault_settings_connect input",function(a){if(13==a.which)return t(e+"#updraftvault_connect_go").click(),!1}),t(e+"#remote-storage-holder").on("click","#updraftvault_recountquota",function(a){a.preventDefault(),t(e+"#updraftvault_recountquota").html(updraftlion.counting);try{updraft_send_command("vault_recountquota",{instance_id:t("#updraftvault_settings_connect").data("instance_id")},function(a){t(e+"#updraftvault_recountquota").html(updraftlion.updatequotacount),a.hasOwnProperty("html")&&(t(e+"#updraftvault_settings_connected").html(a.html),a.hasOwnProperty("connected")&&(a.connected?(t(e+"#updraftvault_settings_default").hide(),t(e+"#updraftvault_settings_connected").show()):(t(e+"#updraftvault_settings_connected").hide(),t(e+"#updraftvault_settings_default").show())))},{error_callback:function(a,r,n,o){if(t(e+"#updraftvault_recountquota").html(updraftlion.updatequotacount),"undefined"!=typeof o&&o.hasOwnProperty("fatal_error"))console.error(o.fatal_error_message),alert(o.fatal_error_message);else{var d="updraft_send_command: error: "+r+" ("+n+")";console.log(d),alert(d),console.log(a)}}})}catch(r){t(e+"#updraftvault_recountquota").html(updraftlion.updatequotacount),console.log(r)}}),t(e+"#remote-storage-holder").on("click","#updraftvault_disconnect",function(a){a.preventDefault(),t(e+"#updraftvault_disconnect").html(updraftlion.disconnecting);try{updraft_send_command("vault_disconnect",{immediate_echo:!0,instance_id:t("#updraftvault_settings_connect").data("instance_id")},function(a){t(e+"#updraftvault_disconnect").html(updraftlion.disconnect),a.hasOwnProperty("html")&&(t(e+"#updraftvault_settings_connected").html(a.html).slideUp(),t(e+"#updraftvault_settings_default").slideDown())},{error_callback:function(a,r,n,o){if(t(e+"#updraftvault_disconnect").html(updraftlion.disconnect),"undefined"!=typeof o&&o.hasOwnProperty("fatal_error"))console.error(o.fatal_error_message),alert(o.fatal_error_message);else{var d="updraft_send_command: error: "+r+" ("+n+")";console.log(d),alert(d),console.log(a)}}})}catch(r){t(e+"#updraftvault_disconnect").html(updraftlion.disconnect),console.log(r)}}),t(e+"#remote-storage-holder").on("click","#updraftvault_connect",function(a){a.preventDefault(),t(e+"#updraftvault_settings_default").slideUp(),t(e+"#updraftvault_settings_connect").slideDown()}),t(e+"#remote-storage-holder").on("click","#updraftvault_showoptions",function(a){a.preventDefault(),t(e+"#updraftvault_settings_default").slideUp(),t(e+"#updraftvault_settings_showoptions").slideDown()}),t("#remote-storage-holder").on("keyup",".updraftplus_onedrive_folder_input",function(e){var a=t(this).val(),r=t(this).closest("td");0==a.indexOf("https:")||0==a.indexOf("http:")?r.find(".onedrive_folder_error").length||r.append('<div class="onedrive_folder_error">'+updraftlion.onedrive_folder_url_warning+"</div>"):r.find(".onedrive_folder_error").slideUp("slow",function(){r.find(".onedrive_folder_error").remove()})}),t(e+"#remote-storage-holder").on("click","#updraftvault_connect_go",function(a){return t(e+"#updraftvault_connect_go").html(updraftlion.connecting),updraft_send_command("vault_connect",{email:t("#updraftvault_email").val(),pass:t("#updraftvault_pass").val(),instance_id:t("#updraftvault_settings_connect").data("instance_id")},function(a,r,n){t(e+"#updraftvault_connect_go").html(updraftlion.connect),a.hasOwnProperty("e")?(updraft_html_modal('<h4 style="margin-top:0px; padding-top:0px;">'+updraftlion.errornocolon+"</h4><p>"+a.e+"</p>",updraftlion.disconnect,400,250),a.hasOwnProperty("code")&&"no_quota"==a.code&&(t(e+"#updraftvault_settings_connect").slideUp(),t(e+"#updraftvault_settings_default").slideDown())):a.hasOwnProperty("connected")&&a.connected&&a.hasOwnProperty("html")?(t(e+"#updraftvault_settings_connect").slideUp(),t(e+"#updraftvault_settings_connected").html(a.html).slideDown()):(console.log(a),alert(updraftlion.unexpectedresponse+" "+n))},{error_callback:function(a,r,n,o){if(t(e+"#updraftvault_connect_go").html(updraftlion.connect),"undefined"!=typeof o&&o.hasOwnProperty("fatal_error"))console.error(o.fatal_error_message),alert(o.fatal_error_message);else{var d="updraft_send_command: error: "+r+" ("+n+")";console.log(d),alert(d),console.log(a)}}}),!1}),t("#updraft-iframe-modal").on("change","#always_keep_this_backup",function(){var e=t(this).data("backup_key"),a={backup_key:e,always_keep:t(this).is(":checked")?1:0};updraft_send_command("always_keep_this_backup",a,function(t){t.hasOwnProperty("rawbackup")&&(jQuery("#updraft-iframe-modal").dialog("close"),jQuery(".updraft_existing_backups_row_"+e+" .updraft_existingbackup_date").data("rawbackup",t.rawbackup),updraft_html_modal(jQuery(".updraft_existing_backups_row_"+e+" .updraft_existingbackup_date").data("rawbackup"),updraftlion.raw,780,500))})})}),jQuery(document).ready(function(t){function e(){var t=new plupload.Uploader(updraft_plupload_config2);t.bind("Init",function(t){var e=jQuery("#plupload-upload-ui2");t.features.dragdrop?(e.addClass("drag-drop"),jQuery("#drag-drop-area2").bind("dragover.wp-uploader",function(){e.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){e.removeClass("drag-over")})):(e.removeClass("drag-drop"),jQuery("#drag-drop-area2").unbind(".wp-uploader"))}),t.init(),t.bind("FilesAdded",function(e,a){plupload.each(a,function(e){return/^backup_([\-0-9]{15})_.*_([0-9a-f]{12})-db([0-9]+)?\.(gz\.crypt)$/i.test(e.name)?void jQuery("#filelist2").append('<div class="file" id="'+e.id+'"><b>'+e.name+"</b> (<span>"+plupload.formatSize(0)+"</span>/"+plupload.formatSize(e.size)+') <div class="fileprogress"></div></div>'):(alert(e.name+": "+updraftlion.notdba),void t.removeFile(e))}),e.refresh(),e.start()}),t.bind("UploadProgress",function(t,e){jQuery("#"+e.id+" .fileprogress").width(e.percent+"%"),jQuery("#"+e.id+" span").html(plupload.formatSize(parseInt(e.size*e.percent/100)))}),t.bind("Error",function(t,e){"-200"==e.code?err_makesure="\n"+updraftlion.makesure2:err_makesure=updraftlion.makesure,alert(updraftlion.uploaderr+" (code "+e.code+") : "+e.message+" "+err_makesure)}),t.bind("FileUploaded",function(t,e,a){"200"==a.status?"ERROR:"==a.response.substring(0,6)?alert(updraftlion.uploaderror+" "+a.response.substring(6)):"OK:"==a.response.substring(0,3)?(bkey=a.response.substring(3),jQuery("#"+e.id+" .fileprogress").hide(),jQuery("#"+e.id).append(updraftlion.uploaded+' <a href="?page=updraftplus&action=downloadfile&updraftplus_file='+bkey+"&decrypt_key="+encodeURIComponent(jQuery("#updraftplus_db_decrypt").val())+'">'+updraftlion.followlink+"</a> "+updraftlion.thiskey+" "+jQuery("#updraftplus_db_decrypt").val().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))):alert(updraftlion.unknownresp+" "+a.response):alert(updraftlion.ukrespstatus+" "+a.code)})}try{"undefined"!=typeof updraft_plupload_config2&&e()}catch(a){console.log(a)}if(jQuery("#updraft-hidethis").remove(),Handlebars.registerHelper("ifeq",function(t,e,a){return"string"!=typeof t&&"undefined"!=typeof t&&null!==t&&(t=t.toString()),"string"!=typeof e&&"undefined"!=typeof e&&null!==e&&(e=e.toString()),t===e?a.fn(this):a.inverse(this)}),t("#remote-storage-holder").length){var r="";for(var n in updraftlion.remote_storage_templates)if("undefined"!=typeof updraftlion.remote_storage_options[n]&&1<Object.keys(updraftlion.remote_storage_options[n]).length){var o=Handlebars.compile(updraftlion.remote_storage_templates[n]),d=!0;for(var u in updraftlion.remote_storage_options[n])if("default"!==u){var s=updraftlion.remote_storage_options[n][u];s.first_instance=d,"undefined"==typeof s.instance_enabled&&(s.instance_enabled=1),r+=o(s),d=!1}}else r+=updraftlion.remote_storage_templates[n];t("#remote-storage-holder").append(r).ready(function(){t(".updraftplusmethod").not(".none").hide(),updraft_remote_storage_tabs_setup(),t("#remote-storage-holder .updraftplus_onedrive_folder_input").trigger("keyup")})}}),jQuery(document).ready(function(t){function e(){var t=r("object"),e=new Date;t=JSON.stringify({version:"1.12.40",epoch_date:e.getTime(),local_date:e.toLocaleString(),network_site_url:updraftlion.network_site_url,data:t});var a=document.body.appendChild(document.createElement("a"));a.setAttribute("download",updraftlion.export_settings_file_name),a.setAttribute("style","display:none;"),a.setAttribute("href","data:text/json;charset=UTF-8,"+encodeURIComponent(t)),a.click()}function a(e){var a,r=decodeURIComponent(e);try{a=ud_parse_json(r)}catch(o){return t.unblockUI(),jQuery("#import_settings").val(""),console.log(r),console.log(o),void alert(updraftlion.import_invalid_json_file)}if(window.confirm(updraftlion.importing_data_from+" "+r.network_site_url+"\n"+updraftlion.exported_on+" "+r.local_date+"\n"+updraftlion.continue_import)){var d=JSON.stringify(a.data);updraft_send_command("importsettings",{settings:d,updraftplus_version:updraftlion.updraftplus_version},function(e,a,r){var o=n(e);!o.hasOwnProperty("saved")||o.saved?(updraft_settings_form_changed=!1,location.replace(updraftlion.updraft_settings_url)):(t.unblockUI(),o.hasOwnProperty("error_message")&&o.error_message&&alert(o.error_message))},{action:"updraft_importsettings",nonce:updraftplus_settings_nonce,error_callback:function(e,a,r,n){if(t.unblockUI(),"undefined"!=typeof n&&n.hasOwnProperty("fatal_error"))console.error(n.fatal_error_message),alert(n.fatal_error_message);else{var o="updraft_send_command: error: "+a+" ("+r+")";console.log(o),console.log(e),alert(o)}}})}else t.unblockUI()}function r(e){var a="",e="undefined"==typeof e?"string":e;return"object"==e?a=t("#updraft-navtab-settings-content form input[name!='action'][name!='option_page'][name!='_wpnonce'][name!='_wp_http_referer'], #updraft-navtab-settings-content form textarea, #updraft-navtab-settings-content form select, #updraft-navtab-settings-content form input[type=checkbox]").serializeJSON({checkboxUncheckedValue:"0",useIntKeysAsArrayIndex:!0}):(a=t("#updraft-navtab-settings-content form input[name!='action'], #updraft-navtab-settings-content form textarea, #updraft-navtab-settings-content form select").serialize(),t.each(t("#updraft-navtab-settings-content form input[type=checkbox]").filter(function(e){return 0==t(this).prop("checked")}),function(e,r){var n="0";a+="&"+t(r).attr("name")+"="+n})),a}function n(e,a){try{var r=(e.messages,e.backup_dir.writable),n=e.backup_dir.message,o=e.backup_dir.button_title}catch(d){return console.log(d),console.log(a),alert(updraftlion.jsonnotunderstood),t.unblockUI(),{}}if(e.hasOwnProperty("changed")){console.log("UpdraftPlus: savesettings: some values were changed after being filtered"),console.log(e.changed);for(prop in e.changed)if("object"==typeof e.changed[prop])for(innerprop in e.changed[prop])t("[name='"+innerprop+"']").is(":checkbox")||t("[name='"+prop+"["+innerprop+"]']").val(e.changed[prop][innerprop]);else t("[name='"+prop+"']").is(":checkbox")||t("[name='"+prop+"']").val(e.changed[prop])}return t("#updraft_writable_mess").html(n),0==r?(t("#updraft-backupnow-button").attr("disabled","disabled"),t("#updraft-backupnow-button").attr("title",o),t(".backupdirrow").css("display","table-row")):(t("#updraft-backupnow-button").removeAttr("disabled"),t("#updraft-backupnow-button").removeAttr("title")),e.hasOwnProperty("updraft_include_more_path")&&t("#backupnow_includefiles_moreoptions").html(e.updraft_include_more_path),e.hasOwnProperty("backup_now_message")&&t("#backupnow_remote_container").html(e.backup_now_message),t(".updraftmessage").remove(),t("#updraft_backup_started").before(e.messages),console.log(e),t("#updraft-next-files-backup-inner").html(e.files_scheduled),t("#updraft-next-database-backup-inner").html(e.database_scheduled),e}function o(){var t=!1;if(jQuery("#updraft-authenticate-modal-innards").html(""),jQuery("div[class*=updraft_authenticate_] a.updraft_authlink").each(function(){jQuery("#updraft-authenticate-modal-innards").append('<p><a href="'+jQuery(this).attr("href")+'">'+jQuery(this).html()+"</a></p>"),t=!0}),t){var e={};e[updraftlion.cancel]=function(){jQuery(this).dialog("close")},jQuery("#updraft-authenticate-modal").dialog({autoOpen:!0,modal:!0,resizable:!1,draggable:!1,buttons:e,width:"auto"}).dialog("open")}}var d=new Image;d.src=updraftlion.ud_url+"/images/notices/updraft_logo.png",t("#updraft-navtab-settings-content input.updraft_include_entity").change(function(e){var a=t(this).attr("id"),r=t(this).is(":checked"),n="#backupnow_files_"+a;t(n).prop("checked",r)}),t("#updraftplus-settings-save").click(function(e){e.preventDefault(),t.blockUI({css:{width:"300px",border:"none","border-radius":"10px",left:"calc(50% - 150px)",padding:"20px"},message:'<div style="margin: 8px; font-size:150%;" class="updraft_saving_popup"><img src="'+updraftlion.ud_url+'/images/notices/updraft_logo.png" height="80" width="80" style="padding-bottom:10px;"><br>'+updraftlion.saving+"</div>"});var a=r("string");updraft_send_command("savesettings",{settings:a,updraftplus_version:updraftlion.updraftplus_version},function(e,a,r){n(e,r),t("#updraft-wrap .fade").delay(6e3).fadeOut(2e3),window.updraft_main_tour&&!window.updraft_main_tour.canceled?(window.updraft_main_tour.show("settings_saved"),o()):t("html, body").animate({scrollTop:t("#updraft-wrap").offset().top},1e3,function(){o()}),t.unblockUI()},{action:"updraft_savesettings",error_callback:function(e,a,r,n){if(t.unblockUI(),"undefined"!=typeof n&&n.hasOwnProperty("fatal_error"))console.error(n.fatal_error_message),alert(n.fatal_error_message);else{var o="updraft_send_command: error: "+a+" ("+r+")";console.log(o),alert(o),console.log(e)}},nonce:updraftplus_settings_nonce})}),t("#updraftplus-settings-export").click(function(){updraft_settings_form_changed&&alert(updraftlion.unsaved_settings_export),e()}),t("#updraftplus-settings-import").click(function(){t.blockUI({css:{width:"300px",border:"none","border-radius":"10px",left:"calc(50% - 150px)",padding:"20px"},message:'<div style="margin: 8px; font-size:150%;" class="updraft_saving_popup"><img src="'+updraftlion.ud_url+'/images/notices/updraft_logo.png" height="80" width="80" style="padding-bottom:10px;"><br>'+updraftlion.importing+"</div>"});var e=document.getElementById("import_settings");if(0==e.files.length)return alert(updraftlion.import_select_file),void t.unblockUI();var r=e.files[0],n=new FileReader;n.onload=function(){a(this.result)},n.readAsText(r)}),t(".udp-replace-with-iframe--js").on("click",function(e){e.preventDefault();var a=t(this).prop("href"),r=t('<iframe width="356" height="200" allowfullscreen webkitallowfullscreen mozallowfullscreen>').attr("src",a);r.insertAfter(t(this)),t(this).remove()})}),jQuery(document).ready(function(t){function e(e,n,o,d){if("function"==typeof o){var u=t(d).find("#updraftcentral_cloud_form"),s=u.find('.form_hidden_fields input[name="key"]');if(s.length&&""!==s.val())return void o.apply(this,[s.val()]);var i={where_send:"__updraftpluscom",key_description:"",key_size:e,mothership_firewalled:n};a(d),updraft_send_command("updraftcentral_create_key",i,function(e){r(d);try{if(i=ud_parse_json(e),i.hasOwnProperty("error"))return void console.log(i);i.hasOwnProperty("bundle")?o.apply(this,[i.bundle]):i.hasOwnProperty("r")?(t(d).find(".updraftcentral_cloud_notices").html(updraftlion.trouble_connecting).addClass("updraftcentral_cloud_info"),alert(i.r)):console.log(i)}catch(a){console.log(a)}},{json_parse:!1})}}function a(e){t(e).find(".updraftplus_spinner.spinner").addClass("visible")}function r(e){t(e).find(".updraftplus_spinner.spinner").removeClass("visible")}function n(e,n){a(n),updraft_send_command("process_updraftcentral_registration",e,function(a){r(n);try{if(e=ud_parse_json(a),e.hasOwnProperty("error")){var o=e.message,u=["existing_user_email","email_exists"];return-1!==t.inArray(e.code,u)&&(o=e.message+" "+updraftlion.perhaps_login),t(n).find(".updraftcentral_cloud_notices").html(o).addClass("updraftcentral_cloud_error"),t(n).find(".updraftcentral_cloud_notices a").attr("target","_blank"),void console.log(e)}"registered"===e.status&&(t(n).find(".updraftcentral_cloud_form_container").hide(),t(n).find(".updraftcentral-subheading").hide(),t(n).find(".updraftcentral_cloud_notices").removeClass("updraftcentral_cloud_error"),d(n,e,updraftlion.registration_successful))}catch(s){console.log(s)}},{json_parse:!1})}function o(e,o){a(o),updraft_send_command("process_updraftcentral_login",e,function(a){r(o);try{if(data=ud_parse_json(a),data.hasOwnProperty("error")){if("incorrect_password"===data.code&&(t(o).find(".updraftcentral_cloud_form_container .tfa_fields").hide(),t(o).find(".updraftcentral_cloud_form_container .non_tfa_fields").show(),t(o).find("input#two_factor_code").val(""),t(o).find("input#password").val("").focus()),"email_not_registered"!==data.code)return t(o).find(".updraftcentral_cloud_notices").html(data.message).addClass("updraftcentral_cloud_error"),t(o).find(".updraftcentral_cloud_notices a").attr("target","_blank"),void console.log(data);n(e,o)}data.hasOwnProperty("tfa_enabled")&&1==data.tfa_enabled&&(t(o).find(".updraftcentral_cloud_notices").html("").removeClass("updraftcentral_cloud_error"),t(o).find(".updraftcentral_cloud_form_container .non_tfa_fields").hide(),t(o).find(".updraftcentral_cloud_form_container .tfa_fields").show(),t(o).find("input#two_factor_code").focus()),"authenticated"===data.status&&(t(o).find(".updraftcentral_cloud_form_container").hide(),t(o).find(".updraftcentral_cloud_notices").removeClass("updraftcentral_cloud_error"),d(o,data,updraftlion.login_successful))}catch(u){console.log(u)}},{json_parse:!1})}function d(e,a,r){var n=t(e).find("form#updraftcentral_cloud_redirect_form");n.attr("action",a.redirect_url),n.attr("target","_blank"),"undefined"!=typeof a.redirect_token&&n.append('<input type="hidden" name="redirect_token" value="'+a.redirect_token+'">'),a.hasOwnProperty("keys_table")&&a.keys_table&&t("#updraftcentral_keys_content").html(a.keys_table),t(".updraftplus-addons-connect-to-udc").remove(),$redirect_lnk='<a href="'+updraftlion.current_clean_url+'" class="updraftcentral_cloud_redirect_link">'+updraftlion.updraftcentral_cloud+"</a>",$close_lnk='<a href="'+updraftlion.current_clean_url+'" class="updraftcentral_cloud_close_link">'+updraftlion.close_wizard+"</a>",t(e).find(".updraftcentral_cloud_notices").html(r.replace("%s",$redirect_lnk)+" "+$close_lnk+"<br/><br/>"+updraftlion.control_udc_connections),t(e).find(".updraftcentral_cloud_notices .updraftcentral_cloud_redirect_link").off("click").on("click",function(a){a.preventDefault(),n.submit(),t(e).find(".updraftcentral_cloud_notices .updraftcentral_cloud_close_link").trigger("click")}),t(e).find(".updraftcentral_cloud_notices .updraftcentral_cloud_close_link").off("click").on("click",function(a){a.preventDefault(),t(e).dialog("close"),t("#updraftcentral_cloud_connect_container").hide()})}function u(e){var a=t(e).find("#updraftcentral_cloud_form"),r=a.find("input#email").val(),n=a.find("input#password").val(),o=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;t(e).find(".updraftcentral_cloud_notices").html("").removeClass("updraftcentral_cloud_error updraftcentral_cloud_info");var d=a.find('.updraftcentral-data-consent > input[name="i_consent"]').is(":checked");return d?0===r.length||0===n.length?(t(e).find(".updraftcentral_cloud_notices").html(updraftlion.username_password_required).addClass("updraftcentral_cloud_error"),!1):null!==r.match(o)||(t(e).find(".updraftcentral_cloud_notices").html(updraftlion.valid_email_required).addClass("updraftcentral_cloud_error"),!1):(t(e).find(".updraftcentral_cloud_notices").html(updraftlion.data_consent_required).addClass("updraftcentral_cloud_error"),!1)}function s(a,r){var d=t(a).find("#updraft_central_keysize").val(),u=t(a).find("#updraft_central_firewalled").is(":checked")?1:0;e(d,u,function(e){var d=t(a).find("#updraftcentral_cloud_form"),u=d.find('.form_hidden_fields input[name="key"]');0===u.length&&d.find(".form_hidden_fields").append('<input type="hidden" name="key" value="'+e+'">');var s=d.find("input").serialize(),i={form_data:s};"undefined"!=typeof r&&r?n(i,a):o(i,a)},a)}function i(){var e=t("#updraftcentral_cloud_login_form");if(e.length){t("#updraft-iframe-modal-innards").html(e.html());var a=t("#updraft-iframe-modal").dialog("option","title",updraftlion.updraftcentral_cloud).dialog("option","width",520).dialog("option","height",450).dialog("option","buttons",{});a.dialog("open");var r=a.find(".updraftcentral-data-consent"),n=r.find("input").attr("name");"undefined"!=typeof n&&n&&(r.find("input").attr("id",n),r.find("label").attr("for",n))}}jQuery("#updraft-restore-modal").on("change","#updraft_restorer_charset",function(e){if(t("#updraft_restorer_charset").length&&t("#updraft_restorer_collate").length&&t("#collate_change_on_charset_selection_data").length){var a=t("#updraft_restorer_charset").val();t("#updraft_restorer_collate option").show(),t("#updraft_restorer_collate option[data-charset!="+a+"]").hide(),updraft_send_command("collate_change_on_charset_selection",{collate_change_on_charset_selection_data:t("#collate_change_on_charset_selection_data").val(),updraft_restorer_charset:a,updraft_restorer_collate:t("#updraft_restorer_collate").val()},function(e){e.hasOwnProperty("is_action_required")&&1==e.is_action_required&&e.hasOwnProperty("similar_type_collate")&&t("#updraft_restorer_collate").val(e.similar_type_collate)})}}),t("#updraft-wrap #btn_cloud_connect").on("click",function(){i()}),t("#updraft-wrap a#self_hosted_connect").on("click",function(e){e.preventDefault(),t("h2.nav-tab-wrapper > a#updraft-navtab-expert").trigger("click"),t("div.advanced_settings_menu > #updraft_central").trigger("click")}),t("#updraft-iframe-modal").on("click","#updraftcentral_cloud_login",function(e){e.preventDefault();var a=t(this).closest("#updraft-iframe-modal");u(a)&&s(a)});var l={};t(document).on("heartbeat-send",function(t,e){l=updraft_poll_get_parameters(),e.updraftplus=l}),t(document).on("heartbeat-tick",function(t,e){if(null!==e&&e.hasOwnProperty("updraftplus")){var a=e.updraftplus,r=JSON.stringify(a);updraft_process_status_check(a,r,l)}})});