File "dashboard.min.js"
Full Path: /home/rfaztorb/public_html/wordpress/search/file/pomo/updraft/plugins-old/updraftcentral/js/dashboard.min.js
File size: 83.38 KB
MIME-type: text/plain
Charset: utf-8
function UpdraftCentral_Paginator(e,t,a){var r=this,n=t.current_page,i=t.total_pages,o=a;if(1<i){for(var t=e,s=[],d=1;d<=i;d++)s.push(d);r.element=jQuery(UpdraftCentral.template_replace("dashboard-paginator",{pages:s})),r.element.appendTo(t),r.element.on("click","a",function(e){e.preventDefault(),jQuery(this).hasClass("active")||(jQuery(this).hasClass("page_prev")?1<n&&l(--n):jQuery(this).hasClass("page_next")?n<i&&l(++n):jQuery(this).hasClass("page")&&(e=jQuery(this).data("page"),(e=e)!==n)&&l(n=e))}),l(n)}function l(a){r.element.find(".page").each(function(e,t){jQuery(this).removeClass("page_active"),jQuery(this).attr("aria-selected",!1),jQuery(this).data("page")===a&&(jQuery(this).addClass("page_active"),jQuery(this).attr("aria-selected",!0))}),r.element.find(".page_prev").removeClass("disabled"),r.element.find(".page_next").removeClass("disabled"),1===a?r.element.find(".page_prev").addClass("disabled"):a===i&&r.element.find(".page_next").addClass("disabled"),r.element.trigger("page_change",n),"function"==typeof o&&o(n)}this.page_change=function(e){o=e}}jQuery(function(e){(UpdraftCentral=UpdraftCentral()).init()});var UpdraftCentral=function(){var l,h="undefined"!=typeof udclion&&udclion.hasOwnProperty("debug_level")?udclion.debug_level:0,e=0<h?5e3:1e4,t=670,m=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,jQuery),p=this,n=new UpdraftCentral_Collection;function s(e){return e.site_id==this}function c(e,t,a){var r,n,i=m("#updraftcentral_modal_dialog");i.length&&(0<(r=i.find("#"+e+"-sections-list")).length&&(n=r.find(".nav-item.selected"),void 0!==t&&t?(0<(t=r.find("a."+e+'-section-link[data-section="'+t+'"]')).length?t:r.find("a."+e+'-section-link[data-section="description"]')).trigger("click"):n&&0!==n.length||r.find("a."+e+'-section-link[data-section="description"]').trigger("click"),0<(t=r.closest("#updraftcentral_modal").find("#"+e+"-sections.tab-content")).length)&&m(t).scrollTop(0),(n=i.find(".uc-"+e+"-screenshot-container.uc-info > img.uc-"+e+"-screenshot")).length)&&n.attr("src",n.data("src")),void 0!==a&&a&&a.call(this)}function o(e,t,a){var r=e.find(".updraft-sub-menu-arrow-left");r.is(":visible")?(r.hide(),e.find(".updraft-sub-menu-arrow-down").show(),t.appendTo(a).show()):(e.find(".updraft-sub-menu-arrow-down").hide(),r.show(),a.find(".updraft-sub-menu").appendTo(e).hide())}this.ajax_request_processing=!1,this.uc_action_triggered=!1,this.uc_action_data=[],this.event_trigger=new UpdraftCentral_Collection,this.uc_module,this.reloaded=!1,this.recorder=null,this.cached_data={},this.backup_disabled=new UpdraftCentral_Collection,this.backup_started=new UpdraftCentral_Collection,this.init=function(){UpdraftCentral.add_reload_listener(),UpdraftCentral.fill_content_area(),UpdraftCentral.init_recorder(),UpdraftCentral.init_keyboard_shortcuts(),UpdraftCentral.init_process_listener(),UpdraftCentral.init_tooltip(),UpdraftCentral.storage_purge(),UpdraftCentral.set_requested_mode(),UpdraftCentral.init_housekeeping()},this.refresh_available_updates_display=function(e){var t=UpdraftCentral.get_cached_response(e,"updates.get_updates");if(null!==t&&UpdraftCentral.is_data_good_to_use(t.created)){t=t.reply.data;if(void 0!==t&&t){e=m('.updraftcentral_site_row[data-site_id="'+e+'"');if(e.length){var a,r=e.find(".updraft_updates_count_container"),n={plugins:t.hasOwnProperty("plugins")?t.plugins:[],themes:t.hasOwnProperty("themes")?t.themes:[],core:t.hasOwnProperty("core")?t.core:[],translations:t.hasOwnProperty("translations")&&t.translations.hasOwnProperty("items")?t.translations.items:[]};if(r.length)if(0===n.core.length&&0===n.plugins.length&&0===n.themes.length&&0===n.translations.length)r.hasClass("updates_count_container_hidden")||r.addClass("updates_count_container_hidden");else for(var i in r.removeClass("updates_count_container_hidden"),n)(a=r.find(".updraft_available_"+i)).length&&(0===n[i].length?a.addClass("updates_count_item_hidden"):(a.removeClass("updates_count_item_hidden"),"plugins"!==i&&"themes"!==i||a.find(".updraft_"+i+"_count").html("("+n[i].length+")")))}}}},this.log_event=function(e,t,a,r,n,i){var o=m.Deferred(),s=!1,e={site_id:e,event_type:t,event_name:-1===a.indexOf(t+".")?t+"."+a:a,event_data:JSON.stringify(n),event_status:r,event_result_data:JSON.stringify(i)};return UpdraftCentral.send_ajax("log_event",e,null,"via_mothership_encrypting",UpdraftCentral.$site_row,function(e,t,a){"ok"===t&&e.hasOwnProperty("message")&&"success"===e.message&&(o.resolve(),s=!0),s||o.reject(e)}),o.promise()},this.bulk_log_event=function(e){var r=m.Deferred(),n=!1;return UpdraftCentral.send_ajax("log_event",{bulk:1,data:e},null,"via_mothership_encrypting",UpdraftCentral.$site_row,function(e,t,a){"ok"===t&&e.hasOwnProperty("message")&&"success"===e.message&&(r.resolve(),n=!0),n||r.reject(e)}),r.promise()},this.add_reload_listener=function(){window.addEventListener("beforeunload",function(){console.log("")}),m(window).on("beforeunload",function(){UpdraftCentral.reloaded=!0})},this.fill_content_area=function(){var e,t,a=m("#updraftcentral_dashboard_wrapper");void 0!==udclion.load_setting&&"inactive"===udclion.load_setting||(m("body").children(":not(script):not(style):not(link)").hide(),0===(e=m("body > #wrapper")).length&&0===(t=(e=m("<div/>",{id:"wrapper"}).prependTo(m("body"))).find("#content")).length&&(t=m("<div/>",{id:"content"}).appendTo(e)),m("body > #wrapper > #content")&&(0!==(t=m("body > #wrapper > #content")).length&&a.appendTo(t),t.is(":visible")||t.show(),e.is(":visible")||e.show()),m("body").addClass("updraftcentral-fill-view"))},this.clear_editor_container=function(e){var t;null!==e&&e.new_mode===e.previous_mode||void 0===(t=(e=m("#gutenberg_editor_container")).find("#editor"))||!t.length||t.is(":visible")||(void 0!==window._wpLoadBlockEditor&&delete window._wpLoadBlockEditor,"function"==typeof window.wp_data_unsubscribe&&window.wp_data_unsubscribe(),"undefined"!=typeof ReactDOM&&ReactDOM.hasOwnProperty("unmountComponentAtNode")&&ReactDOM.unmountComponentAtNode(t.get(0)),wp.element.unmountComponentAtNode(t.get(0)),t.remove(),e.remove())},this.init_housekeeping=function(){m("#updraftcentral_dashboard").on("updraftcentral_backup_started",function(e,t){t=t.hasOwnProperty("site_row")?"site"+t.site_row.data("site_id"):null;t&&!p.backup_started.exists(t)&&p.backup_started.add(t,!0)}),m("#updraftcentral_dashboard").on("updraftcentral_disable_backup_for_site",function(e,t){var a,r="site"+t.site_id;t.is_updraftplus_active?p.backup_disabled.exists(r)&&p.backup_disabled.remove(r):(p.backup_disabled.update(r,t),a=setInterval(function(){p.ajax_request_processing||(clearInterval(a),m("#updraftcentral_dashboard").trigger("updraftcentral_no_updraftplus",{site_id:t.site_id}))},100))}),m("#updraftcentral_dashboard").on("updraftcentral_no_updraftplus",function(e,t){var a,r="site"+t.site_id,n=m('.updraftcentral_site_row[data-site_id="'+t.site_id+'"]');p.backup_disabled.exists(r)&&n.length&&(-1!==m.inArray(UpdraftCentral.get_dashboard_mode(),["backups","updraftvault","advancedtools"])?(a={action:{install_and_activate:!(t=p.backup_disabled.item(r)).is_updraftplus_installed,activate:!(!t.is_updraftplus_installed||t.is_updraftplus_active),messages:{not_installed:vsprintf(udclion.plugin_not_installed,["UpdraftPlus"]),install_and_activate:udclion.plugin_install_and_activate,not_activated:vsprintf(udclion.plugin_not_activated,["UpdraftPlus"]),activate:udclion.plugin_activate}}},a=UpdraftCentral.template_replace("updraftplus-not_active",a),n.find(".updraftcentral_row_extracontents").html('<div class="updraftcentral_updraftplus_rows">'+a+"</div>")):"sites"==UpdraftCentral.get_dashboard_mode()?(UpdraftCentral.set_dashboard_mode("backups"),m("#updraftcentral_dashboard").trigger("updraftcentral_no_updraftplus",{site_id:t.site_id})):p.backup_started.exists(r)&&(m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_listener_finished_updraftplus_backup",{site_id:t.site_id,site_row:n,listener_row:null,listener_type:null}),UpdraftCentral.add_dashboard_notice(sprintf(udclion.backup_disabled,n.data("site_description")))))}),m("#updraftcentral_dashboard_existingsites").on("updraftcentral_listener_finished_updraftplus_backup",function(e,t){t="site"+t.site_id;p.backup_started.exists(t)&&p.backup_started.remove(t)}),m("#updraftcentral_dashboard_existingsites").on("updraftcentral_dashboard_mode_pre_set",function(){m("#updraftcentral_dashboard .more-option-container .show").each(function(){m(this).trigger("click")})}),m(".uc_site_alert_icon").length&&m(".uc_site_alert_icon").each(function(){m(this).tooltip({container:m("#updraftcentral_dashboard").get(0),trigger:"hover",placement:"top",boundary:"viewport"})}),m("#updraftcentral_dashboard_existingsites").on("updraftcentral_dashboard_mode_set_after",function(){UpdraftCentral.reset_site_selection()}),m("#updraftcentral_dashboard_existingsites .updraftcentral_site_row").each(function(){var e=m(this).data("cached_data");if("string"==typeof e&&e.length){var t,a=JSON.parse(atob(e));for(t in void 0===UpdraftCentral.cached_data&&(UpdraftCentral.cached_data={}),a)void 0===UpdraftCentral.cached_data[t]&&(UpdraftCentral.cached_data[t]=[]),a[t]&&UpdraftCentral.cached_data[t].push(a[t])}})},this.reset_site_selection=function(){var e=p.recorder.get_current_site();void 0!==e&&e&&(UpdraftCentral.$site_row.data("site_id")!=e.data("site_id")&&(UpdraftCentral.$site_row=e),e.hasClass("suspended"))&&(p.recorder.reset_recorder(),m(".updraftcentral-search-area").show(),m("#updraftcentral_dashboard_existingsites").find(".ui-sortable-handle").show(),m("#updraft-central-content button.updraftcentral_action_choose_another_site").hide())},this.cache_response=function(r,e,t,a){var n=m.Deferred(),i=!1,o={site_id:r,command:e,data:t,response_data:{caught_output:"",reply:a}},e=m('.updraftcentral_site_row[data-site_id="'+r+'"');return UpdraftCentral.send_ajax("cache_response",o,null,"via_mothership_encrypting",e,function(e,t,a){"ok"===t&&e.hasOwnProperty("data")&&(void 0===UpdraftCentral.cached_data[o.command]&&(UpdraftCentral.cached_data[o.command]=[]),-1!==(t=UpdraftCentral.cached_data[o.command].findIndex(s,o.site_id))?UpdraftCentral.cached_data[o.command][t]=e.data:UpdraftCentral.cached_data[o.command].push(e.data),e.data&&(t=btoa(JSON.stringify(e.data)),m('#updraftcentral_dashboard_existingsites .updraftcentral_site_row[data-site_id="'+r+'"').attr("data-cached_data",t)),n.resolve(e.data),i=!0),i||n.reject()}),n.promise()},this.get_cached_response=function(r,e){if(void 0!==UpdraftCentral.cached_data[e]&&UpdraftCentral.cached_data[e]){e=UpdraftCentral.cached_data[e];if(e.length){e=m.map(e,function(e,t){if(r!=e.site_id)return null;try{var a=JSON.parse(e.response);if(a.hasOwnProperty("reply")&&a.reply)return{created:e.created,reply:a.reply}}catch(e){return null}});if(e.length)return e[0]}}return null},this.is_data_good_to_use=function(e){return parseInt(dayjs().diff(dayjs.unix(e),"hour"))<12},this.set_requested_mode=function(){var e,t=window.location.href,a=[];if(-1!==t.indexOf("?")&&(a=t.slice(t.indexOf("?")+1).split("&")).length)for(var r,n=0;n<a.length;n++)"uc_module"===(r=a[n].split("="))[0]&&r[1].length&&void 0!==(e=m("#updraft-menu-item-"+r[1]))&&e&&e.length&&(p.uc_module=r[1],m("#updraftcentral_dashboard_existingsites").on("updraftcentral_sites_loaded",function(e,t){set_dashboard_mode(t.module)}));void 0===p.uc_module&&(p.uc_module=!1)},this.plupload_init=function(h,t){var n,i,s,o;function g(e,t){m("#filelist").find("div#"+t.id).remove(),i.removeFile(t),e.removeFile(t),e.stop(),e.start()}function d(t,a){var e,r,n;return void 0===a&&(a=jQuery.Deferred()),t.length?void 0!==(e=t.shift())&&(e=new UpdraftCentral_Site(e),s.exists(e.id)||(r=e,n=jQuery.Deferred(),o.load_credentials(r).then(function(e){var t=!1;(t=e.hasOwnProperty("request_filesystem_credentials")&&(e=e.request_filesystem_credentials).hasOwnProperty(h+"s")&&UpdraftCentral_Library.parseBool(e[h+"s"])?!0:t)?o.get_credentials(r).then(function(e){r.site_credentials=e.site_credentials,r.save_credentials_in_browser=e.save_credentials_in_browser,r.save_credentials_in_browser&&UpdraftCentral.storage_set("filesystem_credentials_"+r.site_hash,r.site_credentials,!0),n.resolve(r)}).fail(function(e){n.resolve({})}):n.resolve(r)}).fail(function(e){n.resolve(r)}),n.promise().then(function(e){e.hasOwnProperty("id")&&e.id&&s.add(e.id,{id:e.id,description:e.site_description,filesystem_credentials:e.site_credentials}),d(t,a)}))):a.resolve(),a.promise()}void 0!==h&&(n=JSON.parse(udclion[h].plupload_config),i=new plupload.Uploader(n),s=new UpdraftCentral_Collection,o=new UpdraftCentral_Credentials,i.bind("Init",function(e){var t=m("#plupload-upload-ui");e.features.dragdrop?(t.addClass("drag-drop"),m("#drag-drop-area").on("dragover.wp-uploader",function(){t.addClass("drag-over")}).on("dragleave.wp-uploader, drop.wp-uploader",function(){t.removeClass("drag-over")})):(t.removeClass("drag-drop"),m("#drag-drop-area").unbind(".wp-uploader"))}),i.init(),i.bind("FilesAdded",function(a,r){var e;n.hasOwnProperty("max_file_count")&&n.max_file_count&&(r.length&&(e=parseInt(n.max_file_count),r=r.splice(0,e)),i.files.length)&&(m.each(i.files,function(e,t){t.id!==r[0].id&&(i.removeFile(t),a.removeFile(t))}),m("#filelist").empty()),plupload.each(r,function(e){/\.zip$/.test(e.name)?m("#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>'):(UpdraftCentral_Library.dialog.alert("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+e.name+": "+udclion[h].notarchive+"</p>"),i.removeFile(e),a.removeFile(e))}),a.refresh(),a.start()}),i.bind("UploadProgress",function(e,t){m("#"+t.id+" .fileprogress").width(t.percent+"%"),m("#"+t.id+" span").html(plupload.formatSize(parseInt(t.size*t.percent/100)))}),i.bind("Error",function(e,t){UpdraftCentral_Library.dialog.alert("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+udclion[h].uploaderr+" (code "+t.code+") : "+t.message+" - "+udclion[h].makesure+"</p>"),e.refresh()}),i.bind("BeforeUpload",function(n,i){new UpdraftCentral_Credentials;var o,e=t.get_selected_sites();return e.hasOwnProperty("sites")&&e.sites.count()?(e=e.sites,o=m("#uc-install-status"),s.clear(),o.append('<span id="load-site-creds-msg">'+udclion[h].creds_check+"</span>"),o.append('<div class="injected-spinner updraftcentral_spinner"></div>'),d(e.get_items()).then(function(e){var t,a,r;o.find("span#load-site-creds-msg").remove(),o.find("div.injected-spinner").remove(),t=n,a=i,(r=s.get_items()).length?UpdraftCentral_Library.dialog.confirm("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+udclion[h].install_zip_message+'</p><p><label><input type="checkbox" name="plugin_theme_activation">'+udclion[h].install_zip_message2+"</label></p>",function(e){e?(e=m("input[name=plugin_theme_activation]").is(":checked")?1:0,m.extend(t.settings.multipart_params,{site_id:UpdraftCentral.$site_row.data("site_id"),activate:e,sites:btoa(JSON.stringify(r))}),e=UpdraftCentral.$site_row.find(".updraftcentral_row_extracontents"),UpdraftCentral.set_loading(e),a.status=plupload.UPLOADING,t.trigger("UploadFile",a)):g(t,a)},null,{confirm:udclion.yes_activate,cancel:udclion.do_not_activate}):g(t,a)})):g(n,i),!1}),i.bind("ChunkUploaded",function(a,r,e){var n,i,o,e=JSON.parse(e.response),s=r.status,d="",l=0;e.hasOwnProperty("e")&&e.e?(0<UpdraftCentral.get_debug_level()&&console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+r.name+"); "+udclion.message+" ("+e.e+");"),UpdraftCentral_Library.dialog.alert("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+vsprintf(udclion[h].upload_failed,[r.name,"<br/>",e.e])+"</p>"),a.removeFile(r),plupload.UPLOADING==s&&plupload.STARTED==a.state&&(a.stop(),a.start())):(m.each(e,function(e,t){n=t.site_description,((i=t.response).hasOwnProperty("error")&&i.error||i.hasOwnProperty("responsetype")&&"error"==i.responsetype)&&(o=udclion[h].upload_cutoff,i.hasOwnProperty("message")&&i.message?o=i.message:i.hasOwnProperty("data")&&i.data&&(o=i.data),0<UpdraftCentral.get_debug_level()&&console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+r.name+"); "+n+": "+o),l<3&&(d+=n+": "+o+"<br/>",l++),s=r.status,a.removeFile(r),plupload.UPLOADING==s)&&plupload.STARTED==a.state&&(a.stop(),a.start())}),0<l&&UpdraftCentral_Library.dialog.alert("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+vsprintf(udclion[h].upload_failed,[r.name,"<br/>",d])+"</p>"))}),i.bind("FileUploaded",function(t,a,r){var e=UpdraftCentral.$site_row.find(".updraftcentral_row_extracontents");if(UpdraftCentral.done_loading(e),"200"==r.status)try{var n,i,o,s,d,l,c=JSON.parse(r.response),_=0,p="",u="",f=0;c.hasOwnProperty("e")&&c.e?(0<UpdraftCentral.get_debug_level()&&console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+a.name+"); "+udclion.message+" ("+c.e+");"),u=c.e):m.each(c,function(e,t){n=t.site_description,(i=t.response).hasOwnProperty("installed")&&i.installed?(p=i.installed_data.Name,_++):(i.hasOwnProperty("message")&&i.message?(0<UpdraftCentral.get_debug_level()&&console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+a.name+"); "+n+": "+i.message),o=i.message):(o=sprintf(udclion[h].general_error,JSON.stringify(i)),i.hasOwnProperty("error")&&i.error&&i.hasOwnProperty("code")&&i.code&&(t=i.data,o=t&&t.hasOwnProperty("message")&&t.message?t.message:"string"==typeof t&&t.length?t:void 0!==udclion[h][i.code]?udclion[h][i.code]:sprintf(udclion[h].general_error,i.code)),0<UpdraftCentral.get_debug_level()&&console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+a.name+"); "+n+": "+o)),f<3&&(u+=n+": "+o+"<br/>",f++))}),_!==c.length?UpdraftCentral_Library.dialog.alert("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+vsprintf(udclion[h].upload_failed,[a.name,"<br/>",u])+"</p>"):(s=t.settings.multipart_params,d=udclion[h].installed,s.hasOwnProperty("activate")&&s.activate&&(d=udclion[h].installed_activated),l=vsprintf(udclion[h].install_success_message,[d,'"'+p+'"']),UpdraftCentral_Library.dialog.alert("<h2>"+udclion[h].install_zip_heading+"</h2><p>"+l+"</p>")),g(t,a)}catch(e){0<UpdraftCentral.get_debug_level()&&(console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+a.name+"); "+n+" - "+udclion[h].jsonnotunderstood),console.log(e),console.log(r)),g(t,a)}else 0<UpdraftCentral.get_debug_level()&&(console.log(udclion.error+": "+udclion[h].install_zip_heading.toLowerCase()+" ("+a.name+"); "+n+" ("+udclion[h].details_follows+"):"),console.log(r)),g(t,a)}))},this.init_tooltip=function(){var e=m("#updraft-central-sidebar-button span.arrow-left"),e=(e.data("animation",!1),e.tooltip({container:m("#updraftcentral_dashboard").get(0),trigger:"hover",placement:"top",title:udclion.collapse_menu,boundary:"viewport"}),m("#updraft-central-sidebar-button span.arrow-right"));e.data("animation",!1),e.tooltip({container:m("#updraftcentral_dashboard").get(0),trigger:"hover",placement:"top",title:udclion.expand_menu,boundary:"viewport"}),m('[data-toggle="tooltip"]').tooltip({container:m("#updraftcentral_dashboard").get(0),trigger:"hover",placement:"top",boundary:"viewport"}),m('[data-toggle="tooltip"]').tooltip("disable")},this.display_item_info=function(e,t,l,a,r){var n,i=e.data(t+"-info");i?(n=null,(i="translation"===t?{translations:i}:i).hasOwnProperty("slug")?n=i.slug:i.hasOwnProperty("update")&&(i.update.hasOwnProperty("slug")?n=i.update.slug:i.update.hasOwnProperty("theme")&&(n=i.update.theme)),e&&!m(".updraftcentral_spinner").is(":visible")&&m(e).prepend('<div class="updraftcentral_spinner"></div>'),i={entity:t,info:i,container:e,context:r,callback:void 0!==a&&a?a:null},UpdraftCentral.get_wporg_metadata(t,n,i,null).then(function(e){var t=e.data,a=e.passback.info,r=e.passback.entity,n=e.passback.container,i=e.passback.context,o=e.passback.callback;if(n&&n.children(".updraftcentral_spinner").remove(),void 0!==t&&t&&t.hasOwnProperty("sections")){if(a.sections=t.sections,a.short_description=t.short_description,t.hasOwnProperty("icons")&&(a.icons=t.icons,a.hasOwnProperty("update"))&&(a.update.icons=t.icons),t.hasOwnProperty("screenshot_url")&&(a.screenshot_url=t.screenshot_url),t.hasOwnProperty("tags")){var s="";if("object"==typeof t.tags)for(var d in t.tags)s+=0==s.length?t.tags[d]:", "+t.tags[d];a.tags=s}a.hasOwnProperty("update")&&(a.update.sections=t.sections,a.update.short_description=t.short_description)}e=void 0!==i&&"updates"===i?UpdraftCentral.template_replace("updates-"+r+"-update-info",a):UpdraftCentral.template_replace(r+"-"+r+"-info",a),e=m("<div></div>").html(e);"updates"===i&&(r=i),void 0!==i&&"updates"===i?UpdraftCentral.open_modal(udclion.updates.update_info,e.html(),!0,!1,function(){jQuery("#updraftcentral_modal ul#updates-sections-list li:first").addClass("selected")},!0,"modal-md",null,function(){c(r,l,o)}):UpdraftCentral.open_modal(udclion[r][r+"_info"],e.html(),!0,!1,null,!0,"modal-md",null,function(){c(r,l,o)})})):0<UpdraftCentral.get_debug_level()&&console.log(UpdraftCentral_Library.ucfirst(t)+" info not found")},this.get_wporg_metadata=function(r,n,i,o){var s=m.Deferred();return null===n||"translation"===r?s.resolve({data:null,passback:i}):UpdraftCentral_Storage.get_item("wporg_api_"+r+"_"+n,600).then(function(e){var a;e&&e.hasOwnProperty("name")?(o&&o.call(p,e,i),s.resolve({data:e,passback:i,fresh:!1})):(a="theme"==r?"https://api.wordpress.org/themes/info/1.1/":"https://api.wordpress.org/plugins/info/1.1/",jQuery.getJSON(a,{action:r+"_information",request:{slug:n,fields:"theme"===r?{description:!0,sections:!0,rating:!0,ratings:!0,downloaded:!0,downloadlink:!0,last_updated:!0,screenshot_url:!0,parent:!0}:{short_description:!0,icons:!0}}}).done(function(t){try{"string"==typeof t&&(t=JSON.parse(t)),UpdraftCentral_Storage.set_item("wporg_api_"+r+"_"+n,t,!0).then(function(e){o&&o.call(p,t,i),s.resolve({data:t,passback:i,fresh:!0})}).fail(function(e){s.resolve({data:null,passback:i,fresh:!0})})}catch(e){0<UpdraftCentral.get_debug_level()&&(console.log("UpdraftCentral::get_wporg_metadata: url="+a+"; type="+r+"; slug="+n+";"),console.log(e)),s.resolve({data:null,passback:i,fresh:!0})}}).fail(function(e,t,a){s.resolve({data:a,passback:i,fresh:!0,status:t})}))}).fail(function(e){0<UpdraftCentral.get_debug_level()&&(console.log('UpdraftCentral::get_wporg_metadata - Failed to retrieve item ("'+n+'") from local storage.'),console.log(e)),s.resolve({data:null,passback:i})}),s.promise()},this.search_wporg=function(e,t,a,r,n){var i="theme"===e?{description:!0,sections:!1,rating:!0,ratings:!0,downloaded:!0,downloadlink:!0,last_updated:!0,screenshot_url:!0,parent:!0}:{sections:!1,added:!1,tags:!1,compatibility:!1,donate_link:!1,icons:!0};n=void 0!==n?n:10,r=void 0!==r?r:1,jQuery.getJSON("https://api.wordpress.org/"+e+"s/info/1.1/",{action:"query_"+e+"s",request:{search:t,per_page:n,page:r,fields:i}},function(e,t){"success"==t&&a.call(this,e)})},this.save_timeout=function(e,t){var r=m.Deferred();return UpdraftCentral.send_ajax("save_timeout",{timeout:e},null,"via_mothership_encrypting",t,function(e,t,a){"ok"===t&&e.hasOwnProperty("message")&&("success"===e.message?r.resolve():r.reject())}),r.promise()},this.save_settings=function(e,t){var r=m.Deferred();return UpdraftCentral.send_ajax("save_settings",e,null,"via_mothership_encrypting",t,function(e,t,a){"ok"===t&&e.hasOwnProperty("message")&&("success"===e.message?r.resolve():r.reject())}),r.promise()},this.maybe_ask_credentials=function(e,t){var a=jQuery.Deferred(),r=new UpdraftCentral_Credentials,n=new UpdraftCentral_Site(e);return r.load_credentials(n).then(function(e){e=e.request_filesystem_credentials;void 0!==e[t]&&UpdraftCentral_Library.parseBool(e[t])?r.get_credentials(n).then(function(e){a.resolve({site:n,credentials_required:!0,credentials:e.site_credentials,store_credentials:e.save_credentials_in_browser})}).fail(function(e){a.reject(e)}):a.resolve({site:n,credentials_required:!1})}).fail(function(e){a.reject(e)}),a.promise()},this.is_plugin_active=function(e,t,a){var r=m.Deferred(),t={plugin:t};return void 0!==a&&a&&(t.slug=a),UpdraftCentral.send_site_rpc("plugin.is_plugin_installed",t,e,function(e,t,a){"ok"!==t||e.data.error?r.reject(e):r.resolve(e.data)}),r.promise()},this.activate_plugin=function(e,t,a){var r=m.Deferred(),t={plugin:t};return void 0!==a&&a&&(t.slug=a),UpdraftCentral.send_site_rpc("plugin.activate_plugin",t,e,function(e,t,a){"ok"!==t||e.data.error?r.reject(e):r.resolve(e.data)}),r.promise()},this.install_activate_plugin=function(t,a,r){var n=m.Deferred();return UpdraftCentral.maybe_ask_credentials(t,"plugins").then(function(e){e.credentials_required&&e.store_credentials&&UpdraftCentral.storage_set("filesystem_credentials_"+e.site.site_hash,e.credentials,!0);e={plugin:a,slug:r,filesystem_credentials:e.credentials};UpdraftCentral.send_site_rpc("plugin.install_activate_plugin",e,t,function(e,t,a){"ok"!==t||e.data.error?n.reject(e):n.resolve(e.data)})}).fail(function(e){n.reject(e)}),n.promise()},this.register_updraftplus_install_activate_handlers=function(r){UpdraftCentral.register_row_clicker("#btn-updraftplus-activate",function(a){m(this).addClass("btn_disabled").prop("disabled",!0),UpdraftCentral.activate_plugin(a,"","updraftplus").then(function(e){var t;e.activated?(t="site"+a.data("site_id"),UpdraftCentral.backup_disabled.exists(t)&&UpdraftCentral.backup_disabled.remove(t),a.find(".updraftcentral_row_extracontents").empty(),UpdraftCentral.invalidate_cached_content(a.data("site_id"),["backups","updraftvault","advancedtools"])):(UpdraftCentral.add_dashboard_notice(sprintf(udclion.attempt_to_activate_failed,a.data("site_description"))),0<UpdraftCentral.get_debug_level()&&(console.log('UpdraftCentral::activate_plugin - Failed to activate UpdraftPlus on the "'+a.data("site_description")+'". Remote response shown below:'),console.log(e))),void 0!==r&&r&&r.length&&(t=a.find(r)).length&&a.find(t).trigger("click")})},!0),UpdraftCentral.register_row_clicker("#btn-updraftplus-install-activate",function(a){m(this).addClass("btn_disabled").prop("disabled",!0),UpdraftCentral.install_activate_plugin(a,"","updraftplus").then(function(e){var t;e.activated?(t="site"+a.data("site_id"),UpdraftCentral.backup_disabled.exists(t)&&UpdraftCentral.backup_disabled.remove(t),a.find(".updraftcentral_row_extracontents").empty(),UpdraftCentral.invalidate_cached_content(a.data("site_id"),["backups","updraftvault","advancedtools"])):(UpdraftCentral.add_dashboard_notice(sprintf(udclion.attempt_to_activate_failed,a.data("site_description"))),0<UpdraftCentral.get_debug_level()&&(console.log('UpdraftCentral::install_activate_plugin - Failed to activate UpdraftPlus on the "'+a.data("site_description")+'". Remote response shown below:'),console.log(e))),void 0!==r&&r&&r.length&&(t=a.find(r)).length&&a.find(t).trigger("click")})},!0)},this.init_process_listener=function(){m("a.updraft-sub-menu-link").on("click",function(e){var t=m(this).attr("data-selector"),a=m(this).attr("data-module"),a=m("#updraft-menu-item-"+a),t=m(t);a.length&&a.trigger("click"),t.length&&t.trigger("click")}),m(".updraft-sub-menu-icon").on("click",function(e){e.stopPropagation();var e=m(this).find(".updraft-sub-menu"),t=m(this).closest(".updraft-menu-item-container"),n=t.find("button.updraft-menu-item");m(".updraft-menu-item-container > .updraft-sub-menu").each(function(){var e=m(this),t=m(this).closest(".updraft-menu-item-container"),a=t.find(".updraft-sub-menu-icon"),r=t.find("button.updraft-menu-item");n.attr("id")!==r.attr("id")&&o(a,e,t)}),o(m(this),e,t)}),m(document).ajaxStop(function(){0===m.active&&(p.ajax_request_processing=!1,p.uc_action_data=[],p.event_trigger.clear(),0<h)&&console.log("init_process_listener (ajaxStop): ajax_request_processing=false, uc_action_data=[], event_trigger=cleared; (reset flag/vars for in-progress blocking).")}),m(document).ajaxSend(function(e,t,a){p.ajax_request_processing=!0,0<h&&console.log("init_process_listener (ajaxSend): ajax_request_processing=true; (setting flag for in-progress blocking).")}),m("#updraftcentral_dashboard").on("updraftcentral_dialog_opened",function(e){var t;m.fullscreen.isFullScreen()&&(t=m("#updraftcentral_dashboard_wrapper.updraft-fullscreen").find("#updraftcentral_dashboard")).length&&0===t.find("div.modal-backdrop").length&&m(document.body).find(".modal-backdrop.show").appendTo(t)}),m("#updraftcentral_dashboard").on("updraftcentral_dialog_closed",function(e){var t,a,r;m.fullscreen.isFullScreen()&&(r=(t=m("#updraftcentral_dashboard_wrapper.updraft-fullscreen")).find("#updraftcentral_dashboard div.bootbox.modal.show"),a=t.find("#updraftcentral_dashboard #updraftcentral_modal_dialog.modal.show"),0===r.length)&&0===a.length&&(r=t.find("#updraftcentral_dashboard div.modal-backdrop.show")).length&&r.remove()}),m(window).on("resize",function(){var e;Math.max(document.documentElement.clientWidth,window.innerWidth||0)<=t?(e=m("#updraft-central-navigation-sidebar").css("width"),0<=m("#updraft-central-navigation-sidebar").position().left&&m("#updraft-mobile-menu").trigger("click"),"60px"===e&&m("#updraft-central-sidebar-button").trigger("click"),m("#updraft-central-navigation-sidebar").hasClass("active")&&m("#updraft-central-content").prepend('<div class="mobile-menu-backdrop"></div>'),m("#updraftcentral_dashboard").on("click",function(e){"updraft-central-navigation-sidebar"===m(e.target).attr("id")||m(e.target).hasClass("updraft-mobile-menu")||m("#updraft-central-navigation-sidebar").hasClass("active")&&(m("#updraft-central-navigation-sidebar").toggleClass("active"),m("#updraft-central-content > .mobile-menu-backdrop").remove())})):(m("#updraft-central-navigation-sidebar").removeClass("active"),m("#updraft-central-content > .mobile-menu-backdrop").remove())}),m(window).trigger("resize")},this.save_shortcut=function(e,t){var r=m.Deferred();return UpdraftCentral.send_ajax("shortcuts",{name:e,key:t},null,"via_mothership_encrypting",null,function(e,t,a){"ok"===t&&e.hasOwnProperty("message")&&("success"===e.message?r.resolve():r.reject())}),r.promise()},this.load_shortcuts=function(){var r=m.Deferred();return UpdraftCentral.send_ajax("shortcuts",{},null,"via_mothership_encrypting",null,function(e,t,a){"ok"===t&&e.hasOwnProperty("shortcuts")&&r.resolve(e.shortcuts)}),r.promise()},this.site_order=function(){m("#updraftcentral_dashboard_existingsites").sortable({axis:"y",start:function(e,t){m(".updraft_site_actions").removeClass("open")},stop:function(e,t){site_order_array=m(this).sortable("toArray",{attribute:"data-site_id"}),UpdraftCentral.send_ajax("manage_site_order",{site_order:site_order_array},null,"via_mothership_encrypting",null,function(e,t,a){"ok"==t?e.hasOwnProperty("message")&&"fail"===e.message&&UpdraftCentral_Library.dialog.alert(udclion.error_saving_site_order):(console.log("Expected site order data not found:"),console.log(e))})}})},this.site_order(),this.convertTo24HourFormat=function(e){var t,a,r,e=e.split(" ");return void 0!==e[1]?(r=e[1].split(":"),t=parseInt(r[0]),a=parseInt(r[1]),0!==(r=r[1].match(/\d{1,}(.*)/)[1]).length&&(r=1===r.length?r.toLowerCase()+"m":r.toLowerCase(),12==t&&"am"==r&&0<=a&&a<=59&&(t-=12),1<=t)&&t<=11&&"pm"==r&&0<=a&&a<=59&&(t+=12),t=t<10?"0"+t.toString():t.toString(),a=a<10?"0"+a.toString():a.toString(),e[0]+" "+t+":"+a):e[0]},Handlebars.registerHelper("sanitize_html",function(e){return new Handlebars.SafeString(UpdraftCentral_Library.sanitize_html(e))}),Handlebars.registerHelper("timeago",function(e,t){return void 0===e||void 0===t?"":("string"!=typeof t&&(t="YYYY-MM-DD HH:mm"),dayjs.extend(dayjs_plugin_relativeTime),e=UpdraftCentral.convertTo24HourFormat(e),new Handlebars.SafeString(dayjs(e,t).fromNow()))}),Handlebars.registerHelper("shorten",function(e){if(void 0===e)return"";var t,a={},r=1;for(t of e.matchAll(/<a.*?>(.*?)<\/a>/g)){var n="shorten_link_"+r;a[n]=-1===t[0].indexOf("target=")?t[0].replace("<a",'<a target="_blank"'):t[0],e=e.replace(t[0],n),r++}var i,o=e.split("."),s=o[0];for(i in s.length<150&&void 0!==o[1]&&(s+=". "+o[1]),a)-1!==s.indexOf(i)&&(s=s.replace(i,a[i]));return new Handlebars.SafeString(s+".")}),Handlebars.registerHelper("normalize",function(e){return void 0===e?"":(e=e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)}).replace(/&/g,"&"),new Handlebars.SafeString(e))}),Handlebars.registerHelper("toLocale",function(e){return void 0===e?"":new Handlebars.SafeString(e.toLocaleString())}),Handlebars.registerHelper("render_star",function(e,t){if(void 0===e||void 0===t)return"";for(var e=((e=parseInt(e))/20).toString().split("."),a=parseInt(e[0]),r=void 0!==e[1]?parseInt(e[1]):0,n="",i=!1,o=1;o<=5;o++)o<=a?n+='<span class="dashicons dashicons-star-filled"></span>':0===r||i?n+='<span class="dashicons dashicons-star-empty"></span>':(n+=8<=r?'<span class="dashicons dashicons-star-filled"></span>':r<=3?'<span class="dashicons dashicons-star-empty"></span>':'<span class="dashicons dashicons-star-half"></span>',i=!0);return new Handlebars.SafeString(n+" ("+t.toLocaleString()+")")}),Handlebars.registerHelper("strip_tags",function(e){var t;return void 0===e||"string"!=typeof e?"":((t=document.createElement("DIV")).innerHTML=e,new Handlebars.SafeString(t.innerText))}),Handlebars.registerHelper("sprintf",function(){var e,t="";return"function"==typeof sprintf&&void 0!==arguments&&(e=[].slice.call(arguments),t=sprintf.apply(null,e)),new Handlebars.SafeString(t)}),Handlebars.registerHelper("ifeq",function(e,t,a){return(e="string"!=typeof e&&null!=e?e.toString():e)===(t="string"!=typeof t&&null!=t?t.toString():t)?a.fn(this):a.inverse(this)}),Handlebars.registerHelper("ifneq",function(e,t,a){return(e="string"!=typeof e?e.toString():e)!==(t="string"!=typeof t?t.toString():t)?a.fn(this):a.inverse(this)}),Handlebars.registerHelper("isdefined",function(e,t){return void 0!==e?t.fn(this):t.inverse(this)}),Handlebars.registerHelper("ifset",function(e,t,a){return(e="string"!=typeof e?e.toString():e)===(t="string"!=typeof t?t.toString():t)?new Handlebars.SafeString(a+'="'+a+'"'):""}),Handlebars.registerHelper("ifempty",function(e,t){return void 0!==e&&e&&e.length?"":new Handlebars.SafeString(t)}),this.set_current_site_row=function(e){UpdraftCentral.$site_row=e},this.register_event_handler=function(e,t,a){jQuery(document).off(e,t).on(e,t,function(e){var t;p.check_processing_state(e)||(t=[],(t=void 0!==a.arguments&&a.arguments&&a.arguments.length?a.arguments:t).push(e),a.apply(this,t))})},this.set_loading=function(e){e.css("opacity","0.3"),UpdraftCentral_Library.disable_actions(),m(".updraftcentral_spinner").not(":visible")&&!m(".injected-spinner.updraftcentral_spinner").length&&m("#updraftcentral_dashboard").append('<div class="injected-spinner updraftcentral_spinner"></div>')},this.done_loading=function(e,t){var a=jQuery.Deferred();return e.css("opacity","1.0"),m(".injected-spinner.updraftcentral_spinner").length&&m(".injected-spinner.updraftcentral_spinner").remove(),UpdraftCentral_Library.enable_actions(),t?e.slideUp(500,function(){e.html(t),a.resolve()}).slideDown(500):a.resolve(),a.promise()},this.set_debug_level=function(e){h=e},this.get_debug_level=function(){return parseInt(h)},this.initiate_modal_close_listener=function(e){m('.modal-dialog button[data-bs-dismiss="modal"]').on("click",function(){"function"==typeof e&&e&&e.apply(null,[]),m('.modal-dialog button[data-bs-dismiss="modal"]').off("click"),m(".modal-backdrop.show").is(":visible")&&m(".modal-backdrop.show").remove()})},this.open_modal=function(e,t,a,r,n,i,o,s,d){r=void 0!==r?r:udclion.go,i=void 0===i||i,o=void 0!==o?o:"",m("#updraftcentral_modal_dialog .modal-dialog").removeClass().addClass("modal-dialog "+o),m("#updraftcentral_modal_dialog .modal-title").html(e),i&&(t=UpdraftCentral_Library.sanitize_html(t)),m("#updraftcentral_modal_dialog .modal-body").html(t),!1===r?m("#updraftcentral_modal_dialog button.updraft_modal_button_goahead").hide():m("#updraftcentral_modal_dialog button.updraft_modal_button_goahead").html(r).show(),l=a,null!=n&&n.call(this),UpdraftCentral.initiate_modal_close_listener(s),new bootstrap.Modal(m("#updraftcentral_modal_dialog").get(0)).show(),m("#updraftcentral_modal_dialog #updraftcentral_addsite_tabs").length&&m("#updraftcentral_addsite_tabs").tabs().addClass("ui-tabs-vertical ui-helper-clearfix"),m("#updraftcentral_dashboard").trigger("updraftcentral_dialog_opened"),null!=d&&d.call(this)},this.get_site_heading=function(e){var t=e.data("site_description"),e=e.data("site_url");return(t=t==e?"":t)?'<a href="'+e+'">'+t+"</a>":'<a href="'+e+'">'+e+"</a>"},this.close_modal=function(){m("#updraftcentral_modal_dialog").modal("hide"),m("#updraftcentral_dashboard").trigger("updraftcentral_dialog_closed")},this.register_row_clicker=function(r,n,i,o){o=void 0!==o?o:"click",i=void 0!==i&&i,params={},m("#updraftcentral_dashboard_existingsites_container").off(o,".updraftcentral_site_row "+r).on(o,".updraftcentral_site_row "+r,params,function(e){var t=UpdraftCentral_Library.md5("_key_"+m(this).get(0).className+"_"+r),a=UpdraftCentral_Library.md5("_key_"+e.target.className+"_"+e.type+"_"+e.target.nodeName);(p.event_trigger.exists(t)||p.event_trigger.exists(a))&&0!==m.active||".btn-group > button"!==r&&p.check_processing_state(e)||(p.event_trigger.add(t,1),p.event_trigger.add(a,1),"keypress"!=o&&e.preventDefault(),UpdraftCentral.$site_row=m(this).closest(".updraftcentral_site_row"),t=UpdraftCentral.$site_row.data("site_id"),i&&"sites"!==UpdraftCentral.get_dashboard_mode()&&(m('#updraftcentral_dashboard_existingsites .updraftcentral_site_row:not([data-site_id="'+t+'"]), #updraftcentral_dashboard_existingsites .updraftcentral_row_divider').slideUp(),m(".updraftcentral_mode_actions .updraftcentral_action_choose_another_site").show(),m("#updraftcentral_dashboard_existingsites").sortable("disable"),m("#updraftcentral-search-area").hide(),UpdraftCentral.$site_row.addClass("sortable-is-disabled")),n.call(this,UpdraftCentral.$site_row,t,e))})};var d=this.register_row_clicker,_=(this.register_modal_listener=function(e,t,a){a=void 0!==a?a:"click",params={},m("#updraftcentral_modal").off(a,e).on(a,e,params,function(e){t.call(this,e)})},m("#updraftcentral_modal_dialog button.updraft_modal_button_goahead").on("click",function(){!0===l?this.close_modal():l.call(this)}),{});this.register_listener_processor=function(e,t){_[e]=t},setInterval(function(){m("#updraftcentral_notice_container .updraftcentral_listener").each(function(e){var t,r,n=m(this).data("site_id"),a=m(this).data("type"),i=this,o=m('#updraftcentral_dashboard_existingsites .updraftcentral_site_row[data-site_id="'+n+'"');m(this).data("finished")||(1<h&&console.log("poll_listeners(): site_id="+n+", listener_type="+a),0<o.length&&_.hasOwnProperty(a)?0===(t=_[a].call(this,i,o,n))?(m(this).data("finished",!0),m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_listener_finished_"+a,{site_id:n,site_row:o,listener_row:i,listener_type:a}),m(i).clearQueue().delay(1e4).slideUp("slow",function(){m(this).remove()})):1===t?(m(this).data("finished",!0),m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_listener_finished_"+a,{site_id:n,site_row:o,listener_row:i,listener_type:a})):null!=t&&t.hasOwnProperty("call")&&(r=t.call,UpdraftCentral.send_site_rpc(t.call,t.data,o,function(e,t,a){"ok"==t&&!1!==e&&e.hasOwnProperty("data")&&(_.hasOwnProperty(r)?_[r].call(this,i,o,n,e.data):(console.log("UpdraftCentral: listener type "+r+" has no registered processor (dump of all registered processors follows)"),console.log(_)))})):0<o.length?(console.log("UpdraftCentral: listener type "+a+" has no registered processor (dump of all registered processors follows)"),console.log(_)):console.log("UpdraftCentral: listener for site_id="+n+" with type "+a+": site row not found"))})},e);var g=[];function u(e,t){var a=e.data("site_remote_public_key"),r=e.data("site_local_private_key"),n=this.get_contact_url(e),i=e.data("site_id"),o=e.data("key_name_indicator"),s=e.data("remote_user_id"),d=("via_mothership_encrypting"==(t=void 0===t||"direct_manual_auth"!=t&&"via_mothership"!=t&&"via_mothership_encrypting"!=t&&"direct_jquery_auth"!=t?"direct_default_auth":t)&&(console.warn("UpdraftCentral: A site ("+i+", "+n+") routed via_mothership_encrypting was passed into get_site_udrpc"),console.log(e)),!1),l=("direct_default_auth"==t?(navigator.userAgent.toLowerCase().indexOf("firefox"),connection_method="direct_jquery_auth"):"via_mothership"==(connection_method=t)&&(d={action:"updraftcentral_dashboard_ajax",subaction:"site_rpc",component:"dashboard",nonce:udclion.updraftcentral_dashboard_nonce,site_id:i,site_rpc_preencrypted:1}),e.data("send_cors_headers")),c=(void 0===l&&(l=1),"direct_manual_auth"==connection_method?"manual":"jquery"),_={},p=n;"via_mothership_encrypting"!=connection_method&&"via_mothership"!=connection_method?void 0!==(f=e.data("http_username"))&&f&&(_.username=f,void 0!==(f=e.data("http_password")))&&(_.password=f):p=udclion.ajaxurl,0<h&&(console.log("UDRPC communications method: site_id="+i+", name_indicator="+o+", site_url="+n+", comms_url="+p+", remote_user_id="+s+", connection_method="+t+"/"+connection_method+", send_cors_headers="+l),1<h)&&(console.log("Remote public key follows"),console.log(a));var u,e=i+" "+connection_method,f=o,n=a,s=r,t=p,i=l,o=_,a=c,r=d;return void 0!==g[e]?u=g[e]:(i=void 0===i||i,(u=new UpdraftPlus_Remote_Communications(f)).set_key_local(s),u.set_key_remote(n),u.activate_replay_protection(),/\/admin-ajax.php$/.test(t)&&(t+="?action=updraft_central"),u.set_destination_url(t),void 0!==o&&u.set_http_credentials(o),void 0!==a&&u.set_auth_method(a),void 0!==r&&!1!==r&&(u.set_message_wrapper(r),u.set_message_unwrapper(function(e){var t=v(e,2,!1);if(!0===t){if(e.hasOwnProperty("wrapped_response"))return e.wrapped_response;t="wrapped_response_not_found"}return console.error("UDRPC: Attempt to unwrap the message failed (code: "+t+")"),1<h&&console.log(e),!1})),u.set_cors_headers_wanted(i),g[e]=u),0<h&&(f=2<h?2:1,u.set_debug_level(f)),u}function f(e,t,a,r,n,i,o){if(!(UpdraftCentral.reloaded&&0<parseInt(m.active)&&"error"==t)){var s,d,l,c=void 0!==o&&o&&o.length?o.data("site_description")+" - ":"";if(i=void 0===i||i,"error"==t?(console.error("process_ajax_response: return code: "+t+", error_code: "+a+" - parsed response follows"),console.log(e)):0<h&&(console.log("process_ajax_response: return code: "+t+" - parsed response follows"),console.log(e)),r&&"ok"==t&&e.hasOwnProperty("response")&&"rpcerror"==e.response){if(t="error",a="rpc_unknown_error",e.hasOwnProperty("data")&&e.data.hasOwnProperty("code"))return a=e.data.code,console.error("UpdraftCentral: RPC: Error occurred ("+a+" - "+o.data("site_description")+"); data follows"),console.log(e.data),e=(o=e).data.data,!0!==n.call(this,e,t,a)&&(s=udclion.js_exception_occurred+" ("+a+")",udclion.rpcerrors.hasOwnProperty(a)&&(s="rpc_fatal_error"==a&&e.hasOwnProperty("message")?sprintf(udclion.rpcerrors[a],e.message):udclion.rpcerrors[a]),i)&&UpdraftCentral_Library.dialog.alert("<h2>"+c+udclion.communications_error+"</h2>"+s),void m("#updraftcentral_dashboard").trigger("updraftcentral_dashboard_error",[o]);e.hasOwnProperty("data")&&(e.data.hasOwnProperty("php_events")||e.data.hasOwnProperty("caught_output"))&&e.data.hasOwnProperty("previous_data")&&e.data.previous_data.hasOwnProperty("code")&&(a=e.data.previous_data.code)}"error"==t&&(s=udclion.general_js_comms_failure,o=!0,d=udclion.error,"json_parse_fail"==(a=2==r&&"unwrapper_failure"==a&&e.hasOwnProperty("code")?e.code:a)?-1<e.indexOf("<html")&&(console.error("UpdraftCentral: JSON parse fail: looks like html was returned - remote plugin is probably not installed/inactive/blocked"),s=udclion.general_js_comms_failure,d=udclion.communications_error):"response_empty"==a||"http_post_fail"==a?(s=udclion.general_js_comms_failure,d=udclion.communications_error):"timeout"==a?(s=udclion.comms_failure_timeout,d=udclion.communications_error+" - "+udclion.timeout):"unauthorized"==a?(s=udclion.comms_failure_unauthorised,d=udclion.communications_error):"unknown_response"==a?(s=udclion.unknown_response,d=udclion.communications_error):"cannot_contact_localdev"==a?(d=udclion.communications_error,s=e.message,e.hasOwnProperty("request_info")&&e.request_info.hasOwnProperty("method")&&e.request_info.hasOwnProperty("use_method")&&e.request_info.method!=e.request_info.use_method&&(s+="<br>"+udclion.localdev_can_work_better_with_https)):"unexpected_http_code"==a&&r&&e.hasOwnProperty("data")&&null!==e.data&&e.data.hasOwnProperty("headers")&&e.data.headers.hasOwnProperty("www-authenticate")&&0==e.data.headers["www-authenticate"].search(/Digest/i)?(s=e.message,s+="<br>"+udclion.digest_auth_not_supported):"unexpected_http_code"==a&&r&&e.hasOwnProperty("data")&&null!==e.data&&e.data.hasOwnProperty("response")&&e.data.response.hasOwnProperty("code")&&401==e.data.response.code?s=udclion.comms_failure_unauthorised+' <a href="#" class="updraftcentral_site_editdescription">'+udclion.open_site_configuration+"...</a>":e.hasOwnProperty("message")?(s=e.message,r||(o=!1)):(-1!==m.inArray(a,["plugin_install_failed","theme_install_failed"])&&e.data.hasOwnProperty("previous_data")&&(l=e.data.previous_data).hasOwnProperty("data")&&l.data.hasOwnProperty("error_message")&&(s=l.data.error_message),o=!1,s+="<br>"+udclion.error_code+": "+a),e.hasOwnProperty("status")&&401==e.status?s=udclion.comms_failure_unauthorised+' <a href="#" class="updraftcentral_site_editdescription">'+udclion.open_site_configuration+"...</a>":"ns_error_dom_bad_uri: access to restricted uri denied"==a&&(s=udclion.comms_failure_unauthorised_by_browser+' <a href="#" class="updraftcentral_site_editdescription">'+udclion.open_site_configuration+"...</a>"),s="<p>"+s+"</p>",o&&(s=(s+='<p><a href="'+udclion.common_urls.connection_checklist+'">'+udclion.go_here_for_connection_help+"</a></p>")+'<p><a href="#" class="updraftcentral_test_other_connection_methods">'+udclion.test_other_connection_methods+"</a></p>"),e.hasOwnProperty("status")&&200!=e.status&&0!=e.status&&(s+="<p>"+udclion.http_response_status+": "+e.status+"</p>"),i&&UpdraftCentral_Library.dialog.alert("<h2>"+c+d+"</h2>"+s),m("#updraftcentral_dashboard").trigger("updraftcentral_dashboard_error",[e,{code:t,message:s,title:d}])),r&&e.hasOwnProperty("data")&&null!=e.data&&(e.data.hasOwnProperty("php_events")&&m.each(e.data.php_events,function(e,t){console.log("UpdraftCentral: PHP event on remote side: "+t)}),e.data.hasOwnProperty("caught_output")&&console.log("UpdraftCentral: direct output on remote side: "+e.data.caught_output),e.data.hasOwnProperty("php_events")||e.data.hasOwnProperty("caught_output"))&&(e.data=e.data.previous_data),n.call(this,e,t,a)}}function v(e,t,a,r,n){return r=void 0===r||r,e.hasOwnProperty("responsetype")&&"error"==e.responsetype?(e.hasOwnProperty("message")&&console.error("UpdraftCentral error via AJAX: "+e.message),"cannot_contact_localdev"==e.code&&(e.request_info={method:method,use_method:use_method}),!1!==a&&f(e,"error",e.code,t,a,r,n),e.code):e.hasOwnProperty("message")||e.hasOwnProperty("code")?(1<h&&console.log(e.responsetype+": "+e.message),t&&(e.hasOwnProperty("php_events")&&m.each(e.php_events,function(e,t){console.info("UpdraftCentral: PHP event on remote side: "+t)}),e.hasOwnProperty("mothership_caught_output")&&console.info("UpdraftCentral: direct output on remote side: "+e.caught_output),e.hasOwnProperty("rpc_response"))&&(e=e.rpc_response),!1!==a&&f(e,"ok",null,t,a,r,n),!0):(console.log(e),!1!==a&&f(e,"error","unknown_response",t,a,r,n),"unknown_response")}function b(e,t){var a,r,n,i;return t.hasOwnProperty("data")&&(r=(a=t.data.hasOwnProperty("previous_data"))?t.data.previous_data:t.data).hasOwnProperty("extra")&&(n=m.extend({},r.extra),m("#updraftcentral_dashboard").trigger("updraftcentral_disable_backup_for_site",{site_id:e?e.data("site_id"):0,is_updraftplus_active:n.is_updraftplus_active,is_updraftplus_installed:n.is_updraftplus_installed}),delete r.extra,i=!1,e=m.map(r,function(e,t){return i||0!=t||(i=!0),isNaN(t)?null:e}),i)&&Object.keys(r).length==e.length&&(a?t.data.previous_data=e:t.data=e),t}function w(){var e=m("#updraftcentral_dashboard_existingsites .updraftcentral_site_row:not(.updraft_site_unlicensed)").length;m("#updraftcentral_licences_in_use").html(e)}function a(){var e=m("#updraftcentral_dashboard").outerWidth();m("body").toggleClass("updraftcentral-small",e<=800),m("body").toggleClass("updraftcentral-medium",800<e&&e<=1200),m("body").toggleClass("updraftcentral-large",1200<e)}function y(e){e.hasOwnProperty("how_many_licences_in_use")&&m(".updraftcentral_licences_in_use").html(e.how_many_licences_in_use),e.hasOwnProperty("how_many_licences_available")&&(e=e.how_many_licences_available<0?"∞":e.how_many_licences_available,m(".updraftcentral_licences_total").html(e))}function C(e,t){void 0!==e&&null!==e.match(/https?:\/\/updraft(plus|central)\.com/)&&(void 0!==t&&t.preventDefault(),t=window.open(e,"_blank"),UpdraftCentral_Library.focus_window_or_error(t))}this.get_contact_url=function(e){return e.data("admin_url").replace(/\/+$/,"")+"/admin-ajax.php"},this.send_ajax=function(i,e,o,t,s,d,a,l){var c=void 0!==o&&o&&o.length?o.data("site_description")+" - ":"",_=(t=void 0!==t?t:"direct_default_auth",a=void 0!==a?a:30,void 0!==udclion.user_defined_timeout&&udclion.user_defined_timeout&&(a=udclion.user_defined_timeout),s=void 0!==s?s:null,l=void 0===l||l,"via_mothership"==t||"via_mothership_encrypting"==t?"via_mothership"==t?"server_proxies":"server":"direct"),n=null!==o;if(n){var r=o.data("site_unlicensed");if(void 0!==r&&r)return void UpdraftCentral_Library.dialog.alert("<h2>"+c+udclion.error+"</h2>"+udclion.site_unlicensed_message)}if(!s||m(".updraftcentral_spinner").is(":visible")||m(s).prepend('<div class="updraftcentral_spinner"></div>'),"direct"==_&&"https:"==document.location.protocol&&"http:"==this.get_contact_url(o).substring(0,5).toLowerCase()&&(_="server"),0<h&&(console.log("send_message(ajax_method="+_+", requested_method="+t+", command="+i+", data(follows))"),console.log(e)),p.uc_action_data.push({command:i,data:e,website:c,connection_method:t}),"direct"==_||"server_proxies"==_){if(!n)throw"send_ajax() called with direct method ("+t+"), but no site row object passed in";u(o,t).send_message(i,e,a,function(e,t,a){if(s&&(m(s).removeClass("updraftcentral_spinner"),m(s).children(".updraftcentral_spinner").remove()),2<h&&(console.log("Raw response, pre-processing, follows"),console.log(e)),e.hasOwnProperty("data")&&e.data.hasOwnProperty("extra")){var r=e.data.extra;if(r.hasOwnProperty("is_updraftplus_active")&&e.hasOwnProperty("response")&&"rpcerror"==e.response){var n=i.split(".");if(-1!==m.inArray(n[0],["updraftplus","updraftvault"])&&!r.is_updraftplus_active)return m("#updraftcentral_dashboard").trigger("updraftcentral_disable_backup_for_site",{site_id:o.data("site_id"),is_updraftplus_active:r.is_updraftplus_active,is_updraftplus_installed:r.is_updraftplus_installed}),m(".updraftcentral_spinner").is(":visible")&&m(".updraftcentral_spinner").remove(),void o.find(".updraftcentral_row_extracontents").css("opacity","1.0")}}n="server_proxies"==_?2:1;try{f(e=b(o,e),t,a,n,d,l,o)}catch(e){UpdraftCentral_Library.dialog.alert("<h2>"+c+udclion.error+"</h2>"+udclion.js_exception_occurred+"<br>"+e.toString()),console.log(e),m("#updraftcentral_dashboard").trigger("updraftcentral_dashboard_error",[e.toString()])}})}else{r=0;null!==o&&(r=o.data("site_id"));t={type:"POST",url:udclion.ajaxurl,timeout:1e3*a,headers:{"X-Secondary-User-Agent":"UpdraftCentral-dashboard.js/"+udclion.udc_version},data:{action:"updraftcentral_dashboard_ajax",subaction:n?"site_rpc":i,component:"dashboard",nonce:udclion.updraftcentral_dashboard_nonce,site_id:r,data:n?{command:i,data:e}:e},dataType:"text",success:function(t){if(s&&m(s).children(".updraftcentral_spinner").remove(),void 0===t||""===t)console.log("UDRPC: the response from the remote site was empty"),f(t,"error","response_empty",n,d,l,o);else{try{var a=JSON.parse(t)}catch(e){var r=t.match(/\{"format":.*}/);if(null===r)return console.log(e),console.log(t),void f(t,"error","json_parse_fail",n,d,l,o);t=r[0];try{a=JSON.parse(t);console.log("UpdraftCentral: successfully parsed JSON after removing unwanted elements"),console.log(t)}catch(e){return console.log(e),console.log(t),void f(t,"error","json_parse_fail",n,d,l,o)}}v(t=b(o,a),n,d,l,o)}},error:function(e,t,a){if(s&&m(s).children(".updraftcentral_spinner").remove(),UpdraftCentral.reloaded||(console.error("UpdraftCentral: Error in AJAX operation"),console.log(e),console.log(t),console.error(a)),"function"==typeof(a=(a=""==a?"http_post_fail":a).hasOwnProperty("statusText")?a.statusText.toString():a).toLowerCase)a=a.toLowerCase();else try{var r=a.toString().toLowerCase();r&&(a=r)}catch(e){}f(e,"error",a,n,d,l,o)}};1<h&&(console.log("UpdraftCentral: jQuery POST: options follow:"),console.log(t)),jQuery.ajax(t)}},a(),m("#updraft-central-navigation-sidebar").on("collapse_expand_complete",a),m(window).on("resize",function(){var e=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;t<e&&m("#updraftcentral_dashboard #updraft-central-navigation-sidebar").show(),a()}),m("#updraftcentral_dashboard .updraft-mobile-menu").on("click",function(){(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<=t&&(m("#updraft-central-navigation-sidebar").toggleClass("active"),m("#updraft-central-navigation-sidebar").hasClass("active")?m("#updraft-central-content").prepend('<div class="mobile-menu-backdrop"></div>'):m("#updraft-central-content > .mobile-menu-backdrop").remove())}),this.set_existing_sites_to=function(e){var t=setInterval(function(){0===m.active&&(clearInterval(t),g=[],m("#updraftcentral_dashboard_existingsites").html(e),UpdraftCentral.set_dashboard_mode(!0,!0),w())},500)},this.add_dashboard_notice_singleton=function(e,t,a,r,n){return t=void 0===t?"notice":t,a=void 0===a?3e4:a,(r="undefined"==typeof extradata?{}:extradata).identifier=n=void 0===n?"":n,0===m('#updraftcentral_notice_container .updraftcentral_notice[data-identifier="'+n+'"]').length&&this.add_dashboard_notice(e,t,a,r)},this.add_dashboard_notice=function(e,t,a,r){a=void 0!==a?a:3e4,r=void 0!==r?r:{};var n="",i=("listener_"==(t=void 0!==t?t:"notice").substr(0,9)&&(n="updraftcentral_listener updraftcentral_listener_"+t.substr(9),r.type=t.substr(9),t="info"),$container=m("#updraftcentral_notice_container"),'<div class="updraftcentral_notice updraftcentral_notice_new updraftcentral_notice_level_'+t+" "+n+'"'),t=(m.each(r,function(e,t){i+="data-"+e+'="'+UpdraftCentral_Library.quote_attribute(t)+'"'}),m(i+'><button type="button" class="updraftcentral_notice_dismiss"></button><div class="updraftcentral_notice_contents">'+e+"</div></div>"));return $container.append(t),a?t.slideDown("medium").delay(3e4).slideUp("slow",function(){m(this).remove()}):t.slideDown("medium"),t},this.create_dashboard_listener=function(e,t,a,r,n){(r=void 0===r?{}:r).site_url=t.data("site_url"),r.site_id=t.data("site_id");t=void 0===n?"<h2>"+t.data("site_description")+"</h2>":n;return this.add_dashboard_notice(t+a,"listener_"+e,!1,r)},m("#updraftcentral_notice_container").on("click",".updraftcentral_notice > .updraftcentral_notice_dismiss",function(){m(this).parents(".updraftcentral_notice").clearQueue().slideUp("slow",function(){this.remove()})}),this.get_dashboard_mode=function(){return m("#updraftcentral_dashboard").data("updraftcentral_mode")},this.check_processing_state=function(e){this.get_dashboard_mode();return!(!p.ajax_request_processing||!p.uc_action_data.length||(void 0!==e&&e.preventDefault(),UpdraftCentral_Library.dialog.alert("<h2>"+udclion.notice_heading+"</h2>"+udclion.currently_processing),console.log("Action(s) that blocks progress (follows):"),console.log(p.uc_action_data),0))},this.set_dashboard_mode=function(e,t,a){var r;!p.check_processing_state()&&(t=void 0!==t,a=void 0!==a,m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_dashboard_mode_pre_set",{force:t,new_mode:e,reset:a}),a=this.get_dashboard_mode(),!0===e&&(e=a),t||e!=a)&&(r=m("#updraftcentral_dashboard_existingsites_container .updraftcentral_row_extracontents"),m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_dashboard_mode_set_before",{new_mode:e,previous_mode:a,force:t,extra_contents:r}),a&&m("#updraftcentral_dashboard").removeClass("updraftcentral_mode_"+a),m("#updraftcentral_dashboard_existingsites_container .updraftcentral_row_extracontents").empty(),m("#updraftcentral_dashboard_existingsites .updraftcentral_site_row, #updraftcentral_dashboard_existingsites .updraftcentral_row_divider").show(),m("#updraftcentral_dashboard").data("updraftcentral_mode",e),m("#updraftcentral_dashboard").addClass("updraftcentral_mode_"+e),m("#updraft-menu-item-"+a).removeClass("updraft-menu-item-links-active"),m("#updraft-menu-item-"+e).addClass("updraft-menu-item-links-active"),m("#updraftcentral_dashboard .updraftcentral-hide-in-other-tabs:not(.updraftcentral-show-in-tab-"+e+"), #updraftcentral_dashboard .updraftcentral-hide-in-tab-"+e).hide(),m("#updraftcentral_dashboard .updraftcentral-show-in-tab-"+e+" .updraftcentral-hide-in-tab-initially").hide(),m("#updraftcentral_dashboard .updraftcentral-show-in-tab-"+e+", #updraftcentral_dashboard .updraftcentral-show-in-other-tabs:not(.updraftcentral-hide-in-tab-"+e+")").slideDown(1),m("#updraftcentral_dashboard_existingsites_container").off(),m("#updraftcentral_modal").off(),m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_dashboard_mode_set",{new_mode:e,previous_mode:a}),m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_dashboard_mode_set_"+e,{new_mode:e,previous_mode:a}),m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_dashboard_mode_set_after",{new_mode:e,previous_mode:a}),m("#updraftcentral_dashboard_existingsites").sortable("enable"))},m(".updraftcentral_mode_actions .updraftcentral_action_choose_another_site").on("click",function(){void 0!==UpdraftCentral.$site_row&&UpdraftCentral.$site_row&&UpdraftCentral.$site_row.hasClass("sortable-is-disabled")&&UpdraftCentral.$site_row.removeClass("sortable-is-disabled"),UpdraftCentral.set_dashboard_mode(!0,!0,!0)}),m("#updraft-central-navigation-sidebar").off("click",".updraft-menu-item").on("click",".updraft-menu-item",function(e){e.stopPropagation();var e=m(this).attr("id");void 0!==e&&("updraft-menu-item-"!=e.substring(0,18)?(console.log("UDCentral: menu item without the ID in the expected format"),console.log(this)):(e=e.substring(18),UpdraftCentral.set_dashboard_mode(e),Math.max(document.documentElement.clientWidth,window.innerWidth||0)<=t&&(m("#updraft-central-navigation-sidebar").toggleClass("active"),m("#updraft-central-navigation-sidebar").hasClass("active"))?m("#updraft-central-content").prepend('<div class="mobile-menu-backdrop"></div>'):m("#updraft-central-content > .mobile-menu-backdrop").remove()))}),m("#updraft-central-sidebar-button").on("click",function(){var i=!1,e=60<m("#updraft-central-navigation-sidebar").width()?"60px":"200px",t=m(".updraft-sub-menu:visible");t.length&&t.closest(".updraft-menu-item-container").find(".updraft-sub-menu-icon").trigger("click"),m("#updraft-central-navigation-sidebar").animate({width:e},{step:function(e,t){var a=m("#"+t.elem.id).find("button.updraft-menu-item > span.menu-label"),t=m("#"+t.elem.id).find(".module-visibility"),r=m("#hidden-modules-container").find(".uc-hidden-modules-label"),n=m("#updraft-menu-item-all");e<120?(a.hide(),t.hide(),r.hide(),n.html('<span class="dashicons dashicons-visibility"></span>'),i=!0):(a.show(),t.show(),r.show(),n.html(udclion.show_all),i=!1,m("span.module-visibility > span.dashicons-hidden").show(),m("span.module-visibility > span.dashicons-visibility").show())},complete:function(){i?m('[data-toggle="tooltip"]').tooltip("enable"):m('[data-toggle="tooltip"]').tooltip("disable"),m("#updraft-central-navigation-sidebar").trigger("collapse_expand_complete")}}),m(".updraft-central-sidebar-button-icon").toggle()}),m("#updraftcentral_dashboard .updraftcentral_action_box .updraftcentral_action_manage_sites").on("click",function(){UpdraftCentral.set_dashboard_mode("sites")}),m("#updraftcentral_dashboard_newsite").on("click",function(){var e=UpdraftCentral.get_advanced_site_options_html({http_username:"",http_password:""}),t="",n=!1,a=null,i=[];"function"==typeof window.UpdraftCentral_Tag_Management&&(a=new window.UpdraftCentral_Tag_Management,i=a.get_all_tags_for_new_site(),t=UpdraftCentral.template_replace("tags-tags-container",{site_tags:i}),n=!0),UpdraftCentral.open_modal(udclion.add_site,UpdraftCentral.template_replace("sites-add-new-modal",{advanced_options:e,tag_ui:t,has_tag:n}),function(){var e,t,a,r=m("#updraftcentral_addsite_key").val();UpdraftCentral.close_modal(),i=[],n&&m("#updraftcentral_addsite_tags .udc_tag_item > span").each(function(){i.push(m(this).data("tag_name"))}),null!=r&&""!==r&&(e=UpdraftCentral_Library.get_serialized_options("#updraftcentral_modal #updraftcentral_editsite_expertoptions .expert_option"),t=m("#updraftcentral_modal #updraftcentral_site_send_cors_headers").is(":checked")?1:0,a=m("#updraftcentral_modal #updraftcentral_site_connection_method").val(),UpdraftCentral.send_ajax("newsite",{key:r,extra_site_info:e,send_cors_headers:t,connection_method:a,tags:i},null,"via_mothership_encrypting","#updraftcentral_dashboard_existingsites",function(e,t,a){var r,n;"ok"==t&&(e.hasOwnProperty("tags")&&"undefined"!=typeof udclion&&udclion.hasOwnProperty("tags")&&(e.tags.hasOwnProperty("site_tags")&&(udclion.tags.site_tags=e.tags.site_tags),e.tags.hasOwnProperty("site_tags_by_name")&&(udclion.tags.site_tags_by_name=e.tags.site_tags_by_name),e.tags.hasOwnProperty("all_tags"))&&(udclion.tags.all_tags=e.tags.all_tags),e.hasOwnProperty("message")&&(add_dashboard_notice(e.message,"info"),e.hasOwnProperty("sites_html")?UpdraftCentral.set_existing_sites_to(e.sites_html):(console.log("Expected sites_html data not found:"),console.log(e)),e.hasOwnProperty("status_info"))&&y(e.status_info),e.hasOwnProperty("key_needs_sending"))&&(t=e.key_needs_sending.key_site_id,r=e.key_needs_sending.url,t=m('#updraftcentral_dashboard_existingsites .updraftcentral_site_row[data-site_id="'+t+'"'),n=e.key_needs_sending.remote_public_key,m(t).prepend('<div class="updraftcentral_spinner"></div>'),t=r+"&action=updraftcentral_receivepublickey&updraft_key_index="+encodeURIComponent(e.key_needs_sending.updraft_key_index)+"&public_key="+encodeURIComponent(btoa(n)),r=window.top.outerHeight/2+(window.top.screenY-160),e=window.top.outerWidth/2+(window.top.screenX-300),n=window.open(t,"_blank","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=320,top="+r+",left="+e),UpdraftCentral_Library.focus_window_or_error(n))}))},udclion.add_site,function(){m("#updraftcentral_modal #updraftcentral_site_send_cors_headers").prop("checked",!0)},!1,"addsite_dialog",null,function(){m("#updraftcentral_addsite_key").trigger("focus"),n&&a.init_addsite_handlers()})}),m("body").on("change","#updraftcentral_import_file",function(){m(this).val().length&&m(".exportsettings_dialog button.updraft_modal_button_goahead").html(udclion.import_settings)}),m("#updraftcentral_dashboard_export_settings").on("click",function(){UpdraftCentral.open_modal(udclion.export_import_settings,UpdraftCentral.template_replace("sites-export-modal",{}),function(){var e,t,r,a,n,i=m("#updraftcentral_modal #updraftcentral_encryption_phrase").val(),o=m("#updraftcentral_modal #updraftcentral_import_file");void 0!==o&&o&&o.val().length?(o=o[0].files[0],e={phrase:i},r=m.Deferred(),t=void 0!==t?t:30,void 0!==udclion.user_defined_timeout&&udclion.user_defined_timeout&&(t=udclion.user_defined_timeout),(a=new FormData).append("action","updraftcentral_dashboard_ajax"),a.append("subaction","import_settings"),a.append("component","dashboard"),a.append("nonce",udclion.updraftcentral_dashboard_nonce),a.append("site_id",0),void 0!==o&&o&&a.append("file",o),void 0!==e&&e&&a.append("data",JSON.stringify(e)),(n=m(".exportsettings_dialog")).prepend('<div class="updraftcentral_spinner"></div>'),o={type:"POST",url:udclion.ajaxurl,timeout:1e3*t,headers:{"X-Secondary-User-Agent":"UpdraftCentral-dashboard.js/"+udclion.udc_version},data:a,contentType:!1,processData:!1,dataType:"text",success:function(e){n.children(".updraftcentral_spinner").remove(),r.resolve(e)},error:function(e,t,a){n.children(".updraftcentral_spinner").remove(),r.reject(a)}},jQuery.ajax(o),r.promise().then(function(e){e=JSON.parse(e);e.data.hasOwnProperty("errors")&&e.data.errors.length?UpdraftCentral_Library.dialog.alert("<h2>"+udclion.import_response_heading+"</h2>"+e.data.errors[0]):UpdraftCentral_Library.dialog.alert("<h2>"+udclion.import_response_heading+"</h2>"+udclion.import_successful,function(){UpdraftCentral.close_modal(),location.reload()})}).fail(function(e){UpdraftCentral_Library.dialog.alert("<h2>"+udclion.import_response_heading+"</h2>"+e)})):UpdraftCentral.send_ajax("export_settings",{phrase:i},null,"via_mothership_encrypting","#updraftcentral_dashboard_existingsites",function(e,t,a){"ok"==t&&e.hasOwnProperty("data")&&e.data.hasOwnProperty("json_data")&&(UpdraftCentral.close_modal(),(t=document.body.appendChild(document.createElement("a"))).setAttribute("download",e.data.file_name),t.setAttribute("style","display:none;"),t.setAttribute("href","data:text/json;charset=UTF-8,"+encodeURIComponent(e.data.json_data)),t.click())},null,!1)},udclion.export_settings,null,!1,"exportsettings_dialog",null,null)}),m("#updraftcentral_dashboard_existingsites").on("updraftcentral_dashboard_mode_set_sites",function(e){register_modal_listener("#updraftcentral_addsite_expertoptions_show",function(e){m(this).slideUp(),m("#updraftcentral_modal #updraftcentral_editsite_expertoptions .initially-hidden").show(),e.preventDefault()})}),m("#updraftcentral_notice_container").on("click","a",function(e){C(m(this).attr("href"),e)}),m("#updraftcentral_dashboard_existingsites").on("updraftcentral_dashboard_mode_set",function(e,t){var a=m("#updraft-menu-item-"+t.new_mode).find(".menu-label").html(),r=m(".updraftcentral_mode_actions");0===r.find("h2.screen-title").length&&r.prepend('<h2 class="screen-title"></h2>'),r.find("h2.screen-title").html(a),register_modal_listener("a",function(e){C(m(this).attr("href"),e)}),m("#updraftcentral_dashboard_existingsites_container").on("click",".updraftcentral_site_row a",function(e){C(m(this).attr("href"),e)}),register_modal_listener("#updraft_debug_empty_browser_cache",function(e){for(var t=0,a=0<h,r=localStorage.length;0<=r;--r){var n=localStorage.key(r);null!==n&&"updraftcentral_"==n.substr(0,15)&&(a&&console.log("UpdraftCentral: Removing key from local storage: "+n),localStorage.removeItem(n),t++)}0<t?UpdraftCentral_Library.dialog.alert("<h2>"+udclion.empty+" "+udclion.browser_cache+"</h2>"+sprintf(udclion.cache_emptied,t)):UpdraftCentral_Library.dialog.alert("<h2>"+udclion.empty+" "+udclion.browser_cache+"</h2>"+udclion.cache_no_contents)}),register_modal_listener("#updraft_debug_show_browser_cache",function(e){for(var t=0,a=0,r=localStorage.length;a<r;++a){var n=localStorage.key(a),i=localStorage.getItem(n);"updraftcentral_"==n.substr(0,15)&&(t++,console.log(n+": "+i))}0<t?UpdraftCentral_Library.dialog.alert("<h2>"+udclion.log_contents+"</h2>"+udclion.cache_contents_logged):UpdraftCentral_Library.dialog.alert("<h2>"+udclion.log_contents+"</h2>"+udclion.cache_no_contents)}),t&&t.hasOwnProperty("new_mode")&&"notices"==t.new_mode||(register_modal_listener(".updraftcentral_site_editdescription",function(e){e.preventDefault(),open_site_configuration(UpdraftCentral.$site_row)}),register_modal_listener(".updraftcentral_test_other_connection_methods",function(e){e.preventDefault(),UpdraftCentral_Library.open_connection_test(UpdraftCentral.$site_row)}),register_modal_listener("a.connection-test-switch",function(e){e.preventDefault();var e=m(this).data("connection_method"),t=(UpdraftCentral.close_modal(),m(this).data("site_id"));UpdraftCentral.send_ajax("edit_site_connection_method",{site_id:t,connection_method:e},null,"via_mothership_encrypting","#updraftcentral_dashboard_existingsites",function(e,t,a){"ok"==t&&(e.hasOwnProperty("message")&&add_dashboard_notice(e.message),e.hasOwnProperty("sites_html")?(UpdraftCentral.set_existing_sites_to(e.sites_html),w()):(console.log(e),add_dashboard_notice(udclion.unknown_response,"error")),e.hasOwnProperty("status_info"))&&y(e.status_info)})}),register_modal_listener(".updraftcentral_siteinfo_results .phpinfo",function(e){e.preventDefault(),UpdraftCentral.send_site_rpc("core.phpinfo",null,UpdraftCentral.$site_row,function(e,t,a){var r;"ok"==t&&e.data&&(r="",m.each(e.data,function(e,t){r+="<h3>"+e+"</h3>\n<table>\n",m.each(t,function(e,t){t.constructor===Array?r+="<tr><td>"+e+"</td><td>"+t[0]+"</td><td>"+t[1]+"</td></tr>\n":"string"==typeof t?UpdraftCentral_Library.is_numeric(e)?r+="<tr><td></td><td>"+t+"</td></tr>\n":r+="<tr><td>"+e+"</td><td>"+t+"</td></tr>\n":(console.log("UpdraftCentral: phpinfo: Unrecognised output for key "+e+" (follows)"),console.log(t))}),r+="</table>\n"}),UpdraftCentral.open_modal(udclion.phpinfo,'<div id="updraftcentral_phpinfo_results">'+r+"</div>",null,!1,null,!0,"modal-lg"))},m(this))}),register_modal_listener("#updraftcentral_site_connection_method",function(){var e=m("#updraftcentral_site_connection_method").val();null!=e&&("direct_"==e.substring(0,7)&&"https:"==document.location.protocol?m("#updraftcentral_site_connection_method_message").show().html(udclion.http_must_go_via_mothership):m("#updraftcentral_site_connection_method_message").hide())},"change"),d(".updraftcentral_site_adddescription",function(e){open_site_configuration(e)}),d(".updraftcentral_site_delete",function(t){UpdraftCentral_Library.dialog.confirm("<h2>"+udclion.remove_site+"</h2><p>"+UpdraftCentral_Library.escape_attrib(t.data("site_url"))+"</p><p>"+udclion.really_delete_site+"</p>",function(e){e&&(e=UpdraftCentral.$site_row.data("site_id"))&&(t.slideUp("slow"),UpdraftCentral.send_ajax("delete_site",{site_id:e},null,"via_mothership_encrypting","#updraftcentral_dashboard_existingsites",function(e,t,a){"ok"==t&&(e.hasOwnProperty("message")&&add_dashboard_notice(e.message),e.hasOwnProperty("sites_html")?UpdraftCentral.set_existing_sites_to(e.sites_html):(console.log(e),add_dashboard_notice(udclion.unknown_response,"error")),e.hasOwnProperty("status_info"))&&y(e.status_info)}))})}),d(".row_siteinfo",function(e){UpdraftCentral.send_site_rpc("core.site_info",null,e,function(e,t,a){var r,n;1<h&&(console.log("send_site_rpc(site_info): parsed response follows"),console.log(e)),"ok"==t&&!1!==e&&(t=e.data.versions,e=e.data.bloginfo,r=UpdraftCentral_Library.sanitize_html(e.url),UpdraftCentral_Library.sanitize_html(e.name),"none"==(n=t.ud)&&(n=udclion.updraftplus.version_none),n=sprintf(udclion.what_remote_running,t.wp,t.php,t.mysql,n,t.udrpc_php),UpdraftCentral.open_modal(UpdraftCentral_Library.sanitize_html(e.name),UpdraftCentral.template_replace("dashboard-siteinfo",{url:r,message:n,phpinfo:udclion.phpinfo}),null,!1))})}),d(".updraftcentral_site_dashboard",function(e){UpdraftCentral_Library.open_browser_at(e)}))}),this.get_advanced_site_options_html=function(e){return UpdraftCentral.template_replace("sites-advanced-site-options",e)},this.open_site_configuration=function(i){var e=i.data("site_url"),t=i.data("http_username"),a=(void 0===t&&(t=""),i.data("http_password")),r=(void 0===a&&(a=""),i.data("connection_method")),n=(void 0===r&&(r="direct_default_auth"),i.data("http_authentication_method")),o=(void 0===n&&(n="basic"),i.data("site_description")),s=(o==e&&(o=""),i.data("send_cors_headers")),t=(void 0!==s&&!s||(s=1),UpdraftCentral.get_advanced_site_options_html({http_username:t,http_password:a}));UpdraftCentral.open_modal(udclion.edit_site_configuration,UpdraftCentral.template_replace("sites-edit-configuration",{site_url:UpdraftCentral_Library.escape_attrib(e),advanced_options:t},{existing_description:o}),function(){var e,t=m("#updraftcentral-edit-site-description").val(),a=m("#updraftcentral_modal #updraftcentral_site_send_cors_headers").is(":checked")?1:0,r=m("#updraftcentral_modal #updraftcentral_site_connection_method").val(),n=i.data("site_id");n&&(UpdraftCentral.close_modal(),e=UpdraftCentral_Library.get_serialized_options("#updraftcentral_modal .expert_option"),UpdraftCentral.send_ajax("edit_site_configuration",{site_id:n,description:t,extra_site_info:e,send_cors_headers:a,connection_method:r},null,"via_mothership_encrypting","#updraftcentral_dashboard_existingsites",function(e,t,a){"ok"==t&&(e.hasOwnProperty("message")&&add_dashboard_notice(e.message),e.hasOwnProperty("sites_html")?(UpdraftCentral.set_existing_sites_to(e.sites_html),w()):(console.log(e),add_dashboard_notice(udclion.unknown_response,"error")),e.hasOwnProperty("status_info"))&&y(e.status_info)}))},udclion.edit,function(){m("#updraftcentral_modal #updraftcentral_site_connection_method").val(r).trigger("change"),s&&m("#updraftcentral_modal #updraftcentral_site_send_cors_headers").prop("checked",!0),m("#updraftcentral_modal #updraftcentral_addsite_http_authentication_method").val(n)},!1)},this.debugging_send_command=function(e,t,a,r){a=m("#updraftcentral_dashboard_existingsites").find('.updraftcentral_site_row[data-site_url="'+a+'"]').first();a.length<1?console.log("debugging_send_command: no corresponding row found for the specified URL"):UpdraftCentral.send_site_rpc(e,t,a,function(e,t,a){},null,r=void 0!==r?r:30)};function U(e){return!(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e&&void 0!==e&&!jQuery.isPlainObject(e)&&!Array.isArray(e))}this.is_serializable=function(e,t,a){var r=a=void 0===a?"data":a;if(!U(e))return void 0!==t&&t?{status:!1,data:e,error_path:a,error_field:t,error_type:typeof e[t],error_value:e[t]}:{status:!1};for(t in e){if(a+=a&&a.length?" -> "+t:t,!U(e[t]))return{status:!1,data:e,error_path:a,error_field:t,error_type:typeof e[t],error_value:e[t]};if("object"==typeof e[t]){var n=UpdraftCentral.is_serializable(e[t],t,a);if(n.hasOwnProperty("status")&&!n.status)return{status:!1,data:n.data,error_path:n.error_path,error_field:n.error_field,error_type:typeof n.data[n.error_field],error_value:n.data[n.error_field]};a=r}}return!0},this.send_site_rpc=function(t,e,a,r,n,i,o){var s=UpdraftCentral.is_serializable(e);if(null!==e&&s.hasOwnProperty("status")&&!s.status)console.log("UpdraftCentral: send_site_rpc("+t+") - the submitted data parameter contains unserializable types (follows)"),s.hasOwnProperty("error_field")&&s.error_field?(console.log("Error path: "+s.error_path),console.log("Error field: "+s.error_field),console.log("Error type: "+s.error_type),console.log("Error value follows:"),console.log(s.error_value)):console.log(e),r.call(this,{error:udclion.js_exception_occurred},"error",null);else{i=void 0!==i?i:30,a.data("site_id")||(console.log("UpdraftCentral: sent_site_rpc("+t+") command sent, but site ID could not be identified from the row (follows)"),console.log(a)),o=void 0===o?a.data("connection_method"):o,o=0===t.lastIndexOf("updraftclone.",0)?"via_mothership":o,null==n&&(n=a);try{return UpdraftCentral.send_ajax(t,e,a,o,n,r,i)}catch(e){n&&m(n).children(".updraftcentral_spinner").remove();s=r.call(this,{error:e.toString()},"error",null);void 0!==s&&s||(t=void 0!==a&&a.length?a.data("site_description")+" - ":"",UpdraftCentral_Library.dialog.alert("<h2>"+t+udclion.error+"</h2>"+udclion.js_exception_occurred+"<br>"+e.toString()),console.log(e)),m("#updraftcentral_dashboard").trigger("updraftcentral_dashboard_error",[e.toString()])}}},m("#updraftcentral_dashboard .updraft-central-logo img").on("dblclick",function(){UpdraftCentral_Library.toggle_fullscreen()}),m("#updraft-central-navigation button.updraft-full-screen").on("click",function(){UpdraftCentral_Library.toggle_fullscreen()}),m("#updraft-central-navigation button.updraftcentral-help").on("click",function(){UpdraftCentral_Library.dialog.alert(UpdraftCentral.template_replace("dashboard-help",{uc_version:udclion.updraftcentral_version+": "+udclion.udc_version,running_on:UpdraftCentral.version_info_as_text()}))}),this.subscribe_to_node_changes=function(e,t,a){var r;void 0!==a&&a&&!n.exists(a)&&void 0!==(r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)&&r&&((r=new r(t)).observe(m(e).get(0),{attributes:!1,childList:!0,characterData:!1,subtree:!1}),n.add(a,r))},this.unsubscribe_to_node_changes=function(e){void 0!==e&&e&&n.exists(e)&&(n.item(e).disconnect(),n.remove(e))},this.version_info_as_text=function(){return"WP/"+udclion.wp_version+" PHP/"+udclion.php_version+" MySQL/"+udclion.mysql_version+" Curl/"+udclion.curl_version},m("#updraft-central-navigation button.updraftcentral-settings").on("click",function(){p.check_processing_state()||UpdraftCentral.open_modal(udclion.settings,UpdraftCentral.template_replace("dashboard-settings",{uc_version:udclion.updraftcentral_version+": "+udclion.udc_version,running_on:UpdraftCentral.version_info_as_text(),timeout:udclion.user_defined_timeout,shortcut_status:udclion.shortcut_status,load_setting:udclion.load_setting}),function(){var e=m("#updraftcentral_settings_timeout").val(),a=(e.length&&UpdraftCentral_Library.is_numeric(e)&&!(e<30)||(e=30),$location=m("#updraftcentral_modal > .uc-settings-container"),{timeout:e,shortcut_status:m('input[name="uc-shortcuts-activate"]').is(":checked")?"active":"inactive",load_setting:m('input[name="uc-load-activate"]').is(":checked")?"active":"inactive"});UpdraftCentral.save_settings(a,$location).then(function(e){udclion.user_defined_timeout=a.timeout,udclion.shortcut_status=a.shortcut_status,udclion.load_setting=a.load_setting;var t=m("#updraftcentral_debug_level").val();0<=t&&t<=3&&UpdraftCentral.set_debug_level(t),UpdraftCentral.close_modal()})},udclion.save_settings,function(){m("#updraftcentral_debug_level").val(h)})}),m(".updraftcentral_row_extracontents").on("click",".dashicons-image-rotate",function(){m(".dashicons-image-rotate").addClass("dashicon-image-rotating")}),this.template_replace=function(e,a,t){return a=void 0===a?{}:a,UpdraftCentral_Handlebars.hasOwnProperty(e)||(console.log("UDCentral: UpdraftCentral_Handlebars template not found: "+e),console.log(UpdraftCentral_Handlebars)),void 0!==t&&m.each(t,function(e,t){a[e]=UpdraftCentral_Library.quote_attribute(t)}),a.udclion=udclion,"object"==typeof UpdraftCentral_Handlebars[e]?UpdraftCentral_Handlebars[e].handlebars(a):UpdraftCentral_Handlebars[e](a)},UpdraftCentral_Handlebars="undefined"==typeof UpdraftCentral_Handlebars?{}:UpdraftCentral_Handlebars,Handlebars.registerHelper("uc_each",function(e,t){var a="";if(void 0!==e)for(var r=0,n=e.length;r<n;r++){var i=e[r];i.hasOwnProperty("as_json")||(i.as_json=JSON.stringify(i)),i.hasOwnProperty("udclion")||(i.udclion=udclion),a+=t.fn(i)}return a}),udclion.hasOwnProperty("handlebars")&&udclion.handlebars.hasOwnProperty("compile")&&m.each(udclion.handlebars.compile,function(e,t){console.log("UpdraftCentral: in developer mode: compile template: "+e),UpdraftCentral_Handlebars[e]=Handlebars.compile(t)}),w();var r=setInterval(function(){"undefined"!==p.uc_module&&(clearInterval(r),set_dashboard_mode("sites"),!1!==p.uc_module)&&m("#updraftcentral_dashboard_existingsites").trigger("updraftcentral_sites_loaded",{module:p.uc_module})},100),k=("undefined"==typeof Modernizr||Modernizr.lastchild?(m("#updraftcentral_dashboard_loading").fadeOut(),m("#updraftcentral_dashboard_existingsites_container").fadeIn(),udclion.hasOwnProperty("show_licence_counts")&&udclion.show_licence_counts&&m(".updraftcentral_licence_info").show(),setInterval(function(){UpdraftCentral.send_ajax("sites_html",null,null,"via_mothership_encrypting","#updraftcentral_dashboard_existingsites",function(e,t,a){"ok"==t&&(e.hasOwnProperty("sites_html")?UpdraftCentral.set_existing_sites_to(e.sites_html):(console.log("Expected sites_html data not found:"),console.log(e)),e.hasOwnProperty("status_info"))&&y(e.status_info)})},864e5)):(console.log("UDCentral: Unsupported web browser"),m("#updraftcentral_dashboard_loading").fadeOut(),m("#updraftcentral_updraftplus_actions, #updraftcentral_sites_actions, #updraftcentral_dashboard_existingsites_container").remove(),this.add_dashboard_notice(udclion.unsupported_browser,"error",!1)),m("#updraftcentral_notice_container .updraftcentral_notice.remove_after_load").delay(3e4).slideUp("slow",function(){m(this).remove()}),m("#updraftcentral_modal_dialog").appendTo(document.body),this.storage_set=function(t,a,r){void 0!==r&&r&&(r=Math.floor(Date.now()/1e3),localStorage.setItem("updraftcentral_saved_at_"+t,r)),1<h&&console.log("UpdraftCentral.storage_set(key="+t+")");try{localStorage.setItem("updraftcentral_"+t,JSON.stringify(a))}catch(e){console.log(e);r=this.storage_purge();0<r&&(1<h&&console.log("UpdraftCentral.storage_set(key="+t+") failed; but purged "+r+" items, so trying again"),localStorage.setItem("updraftcentral_"+t,JSON.stringify(a)))}},this.storage_get=function(e,t){if(void 0!==t&&0<t){var a=localStorage.getItem("updraftcentral_saved_at_"+e);if(!a)return null;var r=Math.floor(Date.now()/1e3),n=r-a;if(1<UpdraftCentral.updraftcentral_debug_level&&console.log("UpdraftCentral.storage_get(key="+e+", maximum_age="+t+"): stored_at="+a+", epoch_time="+r+", stored_ago="+n),t<n)return null}a=localStorage.getItem("updraftcentral_"+e);if(void 0!==a)try{return JSON.parse(a)}catch(e){}return null},this.storage_purge=function(){var e=0;for(i=localStorage.length-1;0<=i;i--){var t,a,r=localStorage.key(i);null!==r&&(t=(new Date).getTime()/1e3,"updraftcentral_saved_at_wporg_api_"==r.substring(0,34)&&600<(a=t-localStorage.getItem(r)))&&(0<h&&console.log("UpdraftCentral::storage_purge(): purging key: "+r.substring(24)+" (age: "+a+" s)"),this.storage_remove(r.substring(24)),e++)}return e},this.storage_remove=function(e){localStorage.removeItem("updraftcentral_saved_at_"+e),localStorage.removeItem("updraftcentral_"+e)},this.init_recorder=function(){p.recorder=new UpdraftCentral_Recorder,recorder.load()},this.invalidate_cached_content=function(e,t){p.recorder.invalidate_cached_content(e,t)},this.init_keyboard_shortcuts=function(){(new UpdraftCentral_Keyboard_Shortcuts).init()},m("#visible-modules-container .updraft-menu-item-container")),x=m("#hidden-modules-container"),e=m(".module-visibility"),O=[],P=[],j="",S=m('<div class="updraft-menu-item-container"><button id="updraft-menu-item-all" class="updraft-menu-item">'+udclion.show_all+"</button></div>"),L=m("#hidden-modules-menu"),D=(L.hide(),m(".uc-hidden-modules-menu")),H=m(".uc-hidden-modules-close");function z(){0<m(this).find(".dashicons-visibility").length?(j=(j=m(this).children(".updraft-menu-item").prop("id")).replace("updraft-menu-item-",""),P.push(j),m(this).hide()):(j=(j=m(this).children(".updraft-menu-item").prop("id")).replace("updraft-menu-item-",""),O.push(j))}return H.hide(),k.each(z),0===P.length?x.hide():1<P.length&&S.appendTo(x.next()),x.find(".uc-hidden-modules-label").text(udclion.hidden_modules+"("+P.length+")"),e.on("mouseenter",function(){m(this).parent().find(".updraft-menu-item-links").addClass("updraft-menu-item-hover")}).on("mouseleave",function(){m(this).parent().find(".updraft-menu-item-links").removeClass("updraft-menu-item-hover")}),m("#updraft-central-navigation-sidebar").on("click",e,function(e){var r,n;(m(e.target).parent().hasClass("module-visibility")||m(e.target).hasClass("module-visibility"))&&(r=m(e.target).closest(".module-visibility"),j=(j=r.prev().attr("id")).replace("updraft-menu-item-",""),n=!1,0<r.find(".dashicons-visibility").length?(P=m.grep(P,function(e){return e!=j}),O.push(j),n=!0):(r.html('<span class="dashicons dashicons-visibility"></span>'),O=m.grep(O,function(e){return e!=j}),P.push(j)),UpdraftCentral.send_ajax("module_visibility",{module_id:j,visibility:n},null,"via_mothership_encrypting",null,function(e,t,a){"ok"===t&&(!1===n?(r.parent().clone().appendTo(L),r.prev().removeClass("updraft-menu-item-hover").parent().slideUp(),L.find(".updraft-menu-item-links").removeClass("updraft-menu-item-hover").removeClass("updraft-menu-item-links-active"),0<L.find(".updraft-menu-item-container").length&&(x.slideDown(),1<L.find(".updraft-menu-item-container").length)&&S.appendTo(x.next())):(r.parent().remove(),m(".updraft-menu-item-container").find(".updraft-menu-item-"+j).next().html('<span class="dashicons dashicons-hidden"></span>').parent().slideDown(),0===L.find(".updraft-menu-item-container").length?x.slideUp():L.find(".updraft-menu-item-container").length<2&&S.remove()),x.find(".uc-hidden-modules-label").text(udclion.hidden_modules+"("+P.length+")"))}))}),m("#updraft-central-navigation-sidebar").on("click","#updraft-menu-item-all",function(){UpdraftCentral.send_ajax("reset_modules_visibility","all",null,"via_mothership_encrypting",null,function(e,t,a){"ok"===t&&(k.each(z),k.each(function(){m(this).find(".updraft-menu-item").removeClass("updraft-menu-item-hover"),m(this).slideDown(),m(".module-visibility",this).html('<span class="dashicons dashicons-hidden"></span>')}),x.slideUp("normal",function(){H.hide(),D.show(),L.hide(),L.find(".updraft-menu-item-container").remove()}),P.length=0)})}),D.on("click",function(){L.slideToggle("normal",function(){H.show(),D.hide()})}),H.on("click",function(){L.slideToggle("normal",function(){H.hide(),D.show()})}),this};