!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g'),h=d(".progress-content").clone().addClass("hide"),i=d(".pro-version").addClass("hide");g.append(i);var j={migration:{model:{},view:{},$progress:{},$wrapper:{},$overlay:{},status:"active",title:"",text:"",timerCount:0,elapsedInterval:0,currentStageNum:0,counterDisplay:!1,originalTitle:document.title,setTitle:function(a){this.$progress.find(".progress-title").html(a),this.title=a},setStatus:function(a){this.$progress.removeClass(this.status).addClass("error"===a?"wpmdb-error":a),"error"===a&&this.$progress.find(".progress-text").addClass("migration-error"),this.status=a,this.updateTitleElem()},setText:function(a){"string"!=typeof a&&(a=""),0>=a.indexOf("wpmdb_error")&&(a=this.decodeErrorObject(a)),this.$progress.find(".progress-text").html(a),this.text=a},setState:function(a,b,c){null!==a&&this.setTitle(a),null!==b&&this.setText(b),null!==c&&this.setStatus(c)},startTimer:function(){this.timerCount=0,this.counterDisplay=d(".timer"),this.elapsedInterval=setInterval(this.incrementTimer,1e3)},pauseTimer:function(){clearInterval(this.elapsedInterval)},resumeTimer:function(){this.elapsedInterval=setInterval(this.incrementTimer,1e3)},incrementTimer:function(){wpmdb.current_migration.timerCount=wpmdb.current_migration.timerCount+1,wpmdb.current_migration.displayCount()},displayCount:function(){var a=Math.floor(this.timerCount/3600)%24,b=Math.floor(this.timerCount/60)%60,c=this.timerCount%60,d=this.pad(a,2,0)+":"+this.pad(b,2,0)+":"+this.pad(c,2,0);this.counterDisplay.html(d)},updateTitleElem:function(){var a=this.model.get("activeStageName"),b=this.model.getStageModel(a),c=Math.max(0,b.getTotalProgressPercent()),d=this.model.get("stages").length,e=this.currentStageNum,f=this.status,g=wpmdb_strings.title_progress;"complete"===b.get("status")&&0===b.get("totalSize")&&(c=100),g=g.replace("%1$s",c+"%"),g=g.replace("%2$s",e),g=g.replace("%3$s",d),1===d&&(g=c+"%"),wpmdb_strings["title_"+f]&&(g=wpmdb_strings["title_"+f]),g=g+" - "+this.originalTitle,document.title=g},restoreTitleElem:function(){document.title=this.originalTitle},pad:function(a,b,c){return c=c||"0",a+="",a.length>=b?a:new Array(b-a.length+1).join(c)+a},decodeErrorObject:function(a){var b=a.replace(/\{"/g,"{#q!#").replace(/\"}/g,"#q!#}").replace(/,"/g,",#q!#").replace(/":/g,"#q!#:").replace(/:"/g,":#q!#").replace(/"/g,'\\"').replace(/#q!#/g,'"').replace(/>/g,">").replace(/</g,"<");try{b=JSON.parse(b)}catch(c){return a}return"object"==typeof b&&"undefined"!=typeof b.body?b:a},fixProgressStageWidthForScrollBar:function(){var a=Math.abs(this.$wrapper[0].offsetWidth-this.$wrapper[0].clientWidth),b=this.$wrapper.find(".active .progress-items"),c=parseInt(b.css("padding-left"),10),d=parseInt(b.css("padding-right"),10);(0!==a||0===a&&d!==c)&&b.css("padding-right",c-a+"px")}},newMigration:function(a){d("#overlay").remove(),d(".progress-content").remove(),this.migration.$overlay=g.clone(),d("#wpwrap").append(this.migration.$overlay),this.migration.model=new e(a),this.migration.view=new f({model:this.migration.model}),this.migration.$progress=h.clone(),this.migration.$wrapper=this.migration.view.$el,this.migration.$progress.find(".migration-progress-stages").replaceWith(this.migration.$wrapper),this.migration.$proVersion=this.migration.$overlay.find(".pro-version");var b=this.migration.$proVersion.find("iframe").remove().clone();this.migration.$overlay.prepend(this.migration.$progress);var c=this;return setTimeout(function(){c.migration.$overlay.add(c.migration.$progress).add(c.migration.$proVersion).removeClass("hide").addClass("show"),c.migration.$proVersion.length&&setTimeout(function(){c.migration.$proVersion.find(".iframe").append(b)},500)},0),this.migration.currentStageNum=0,this.migration.$proVersion.on("click",".close-pro-version",function(){c.migration.$proVersion.find("iframe").remove(),c.migration.$proVersion.addClass("hide remove"),setTimeout(function(){c.migration.$proVersion.remove()},500)}),this.migration.model.on("migrationComplete",function(){c.utils.updateProgTableVisibilitySetting(),c.utils.updatePauseBeforeFinalizeSetting(),c.migration.pauseTimer()}),d(window).on("resize",_.debounce(this.migration.fixProgressStageWidthForScrollBar.bind(this.migration),100)),this.migration.model.on("change:activeStage",this.migration.fixProgressStageWidthForScrollBar.bind(this.migration)),this.migration},utils:a("MigrationProgress-utils")};b.exports=j},{"MigrationProgress-model":2,"MigrationProgress-utils":3,"MigrationProgress-view":4}],2:[function(a,b,c){var d=a("MigrationProgressStage-model"),e=jQuery,f=Backbone.Model.extend({defaults:{_initialStages:null,stages:null,activeStageName:null,stageModels:null,localTableRows:null,localTableSizes:null,remoteTableRows:null,remoteTableSizes:null,migrationStatus:"active",migrationIntent:"savefile"},initialize:function(){this.set("stageModels",{}),this.set("_initialStages",this.get("stages")),this.set("stages",[]),_.each(this.get("_initialStages"),function(a,b,c){this.addStage(a.name,b,c)},this)},addStage:function(a,b,c,d){var f,g=[];return _.each(b,function(a){var b,d;"remote"===c?(b=this.get("remoteTableSizes")[a],d=this.get("remoteTableRows")[a]):(b=this.get("localTableSizes")[a],d=this.get("localTableRows")[a]),g.push({name:a,size:b,rows:d})},this),f={name:a,items:g,dataType:c},"object"==typeof d&&(f=e.extend(f,d)),this.addStageModel(f),this.trigger("stage:added",this.get("stageModels")[a]),this.get("stageModels")[a].on("change",function(){this.trigger("change")},this),this.getStageModel(f.name)},addStageItem:function(a,b,c,d){this.getStageModel(a).addItem(b,c,d)},addStageModel:function(a){var b=this.get("stages"),c=this.get("stageModels"),e=new d(a);b.push(a),c[a.name]=e,this.set("stages",b),this.set("stageModels",c)},getStageModel:function(a){return this.get("stageModels")[a]},getStageItems:function(a,b){var c=this.getStageModel(a),d=c.get("items");return void 0===b?d:d.map(function(a){return a[b]})},setActiveStage:function(a){this.setStageComplete(),this.set("activeStageName",a),this.getStageModel(a).set("status","active"),this.trigger("change:activeStage")},setStageComplete:function(a){a||(a=this.get("activeStageName")),null!==a&&this.getStageModel(a).set("status","complete"),wpmdb.current_migration.currentStageNum=wpmdb.current_migration.currentStageNum+1},setMigrationComplete:function(){var a=this.getStageModel(this.get("activeStageName"));this.setStageComplete(),this.trigger("migrationComplete"),this.set("migrationStatus","complete"),a.activateTab()}});b.exports=f},{"MigrationProgressStage-model":5}],3:[function(a,b,c){var d=jQuery;b.exports={updateProgTableVisibilitySetting:function(){wpmdb_data.prog_tables_visibility_changed&&(wpmdb_data.prog_tables_visibility_changed=!1,d.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",nonce:wpmdb_data.nonces.save_setting,setting:"prog_tables_hidden",checked:Boolean(wpmdb_data.prog_tables_hidden)},error:function(a,b,c){console.log("Could not save progress item visibility setting",c)}}))},updatePauseBeforeFinalizeSetting:function(){wpmdb_data.pause_before_finalize_changed&&(wpmdb_data.pause_before_finalize_changed=!1,d.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",nonce:wpmdb_data.nonces.save_setting,setting:"pause_before_finalize",checked:Boolean(wpmdb_data.pause_before_finalize)},error:function(a,b,c){console.log("Could not save pause before finalize setting",c)}}))}}},{}],4:[function(a,b,c){var d=a("./MigrationProgressStage-view.js"),e=(jQuery,Backbone.View.extend({tagName:"div",className:"migration-progress-stages",id:"migration-progress-stages",self:this,initialize:function(){this.$el.empty(),this.model.on("stage:added",function(a){this.addStageView(a)},this),_.each(this.model.get("stageModels"),this.addStageView,this)},addStageView:function(a){var b=new d({model:a});a.trigger("view:initialized",b),this.$el.append(b.$el),this.$el.parent().find(".stage-tabs").append(b.$tabElem)}}));b.exports=e},{"./MigrationProgressStage-view.js":6}],5:[function(a,b,c){var d=jQuery,e=Backbone.Model.extend({defaults:{status:"queued",_initialItems:null,items:null,lookupItems:null,totalSize:0,totalTransferred:0,dataType:"local",name:"",itemsComplete:0,strings:null},initialize:function(){this.initStrings(),this.set("_initialItems",this.get("items").slice()),this.set("items",[]),this.set("lookupItems",{}),_.each(this.get("_initialItems"),function(a){this.addItem(a.name,a.size,a.rows)},this),this.on("view:initialized",this.triggerItemViewInit),this.on("change",function(){wpmdb.current_migration.updateTitleElem()})},initStrings:function(){var a={stage_title:this.get("name"),migrated:wpmdb_strings.migrated,queued:wpmdb_strings.queued,active:wpmdb_strings.running,complete:wpmdb_strings.complete,hide:wpmdb_strings.hide,show:wpmdb_strings.show,itemsName:wpmdb_strings.tables},b=this.get("strings");b="object"==typeof b?b:{},b=d.extend(a,b),b.items_migrated=b.itemsName+" "+b.migrated,b.hide_items=b.hide+" "+b.itemsName,b.show_items=b.show+" "+b.itemsName,this.set("strings",b)},addItem:function(a,b,c){var d=this.get("items"),e={name:a,size:b||1,rows:c||b,stageName:this.get("name"),$el:null,transferred:0,rowsTransferred:0,complete:!1};d.push(e),this.get("lookupItems")[a]=d.length-1,this.set("totalSize",parseInt(this.get("totalSize"))+parseInt(b)),this.trigger("item:added",e)},triggerItemViewInit:function(){var a=this.get("items"),b=this;_.each(a,function(a){b.trigger("item:added",a)})},getTotalSizeTransferred:function(){return this.get("totalTransferred")},countItemsComplete:function(){return this.get("itemsComplete")},getTotalProgressPercent:function(){var a=this.getTotalSizeTransferred(),b=this.get("totalSize");return 0>=a||0>=b?0:Math.min(100,Math.floor(a/b*100))},activateTab:function(){this.trigger("activateTab"),wpmdb.current_migration.model.trigger("change:activeStage")},setItemComplete:function(a){var b=this.getItemByName(a),c=this.get("totalTransferred"),d=this.get("itemsComplete");this.set("itemsComplete",++d),c+=b.size-b.transferred,this.set("totalTransferred",c),b.transferred=b.size,b.complete=!0,b.rowsTransferred=b.rows,this.trigger("change change:items",b)},setItemRowsTransferred:function(a,b){var c,d,e=this.getItemByName(a),f=this.get("totalTransferred");return c=-1===parseInt(b)?1:Math.min(1,b/e.rows),1===c?void this.setItemComplete(a):(d=e.size*c,f+=d-e.transferred,this.set("totalTransferred",f),e.transferred=d,e.rowsTransferred=b,void this.trigger("change change:items",e))},getItemByName:function(a){var b=this.get("items")[this.get("lookupItems")[a]]||{};return a===b.name?b:this.determineItemByName(a)},determineItemByName:function(a){for(var b=this.get("items"),c=0;c"),this.$el.append(this.$itemsContainer),this.initTabElem(),this.model.on("item:added",this.maybeAddElementToView,this),_.each(this.model.get("itemModels"),this.maybeAddElementToView,this),this.model.on("change",function(){this.updateProgressElem(),this.updateStageTotals()},this),this.model.on("change:status",function(a){this.$el.removeClass("queued active").addClass(this.model.get("status")),this.$totalProgressElem.removeClass("queued active").addClass(this.model.get("status")),this.$tabElem.removeClass("queued active").addClass(this.model.get("status")).find(".stage-status").text(this.model.get("strings")[this.model.get("status")])},this),this.model.on("change:items",function(a){a.name&&this.setItemProgress(a)},this),this.model.on("activateTab",function(){"complete"===wpmdb.current_migration.model.get("migrationStatus")&&(this.$totalProgressElem.addClass("active").siblings().removeClass("active"),this.$tabElem.addClass("active").siblings().removeClass("active"),this.$el.addClass("active").siblings().removeClass("active"))},this)},initTotalProgressElem:function(){this.initShowHideTablesElem(),this.initPauseBeforeFinalizeElem(),this.$totalProgressElem=d('
').append("0% "+this.model.get("strings").complete+" ").append("(0 MB / 0 MB) ").append("0 of 0 "+this.model.get("strings").items_migrated).append(this.$showHideTablesElem).append("
"),this.updateStageTotals()},initShowHideTablesElem:function(){this.$showHideTablesElem=d("").text(this.model.get("strings").show_items);var a=this;this.$showHideTablesElem.on("click show-hide-progress-tables",function(){var b;a.$el.hasClass("hide-tables")?(b=!1,a.$el.add(a.$el.siblings()).removeClass("hide-tables"),a.$showHideTablesElem.text(a.model.get("strings").hide_items)):(b=!0,a.$el.add(a.$el.siblings()).addClass("hide-tables"),a.$showHideTablesElem.text(a.model.get("strings").show_items)),Boolean(b)!==Boolean(wpmdb_data.prog_tables_hidden)&&(wpmdb_data.prog_tables_visibility_changed=!0,wpmdb_data.prog_tables_hidden=b)}),wpmdb_data.prog_tables_hidden||this.$showHideTablesElem.triggerHandler("show-hide-progress-tables"),this.model.on("change:status activateTab",function(){wpmdb_data.prog_tables_hidden?a.$showHideTablesElem.text(a.model.get("strings").show_items):a.$showHideTablesElem.text(a.model.get("strings").hide_items)})},initPauseBeforeFinalizeElem:function(){this.$pauseBeforeFinalizeElem=d(".pause-before-finalize"),this.$pauseBeforeFinalizeCheckbox=this.$pauseBeforeFinalizeElem.find("input[type=checkbox]");var a=this,b=!1,c=wpmdb.current_migration.model.get("migrationIntent");wpmdb_data.pause_before_finalize&&(b=!0),this.$pauseBeforeFinalizeCheckbox.prop("checked",b),-1!==d.inArray(c,["push","pull","find_replace"])?("find_replace"===c&&d("#pause-before-finalize-label").text(wpmdb_strings.pause_before_finalize_find_replace),this.$pauseBeforeFinalizeElem.show()):this.$pauseBeforeFinalizeElem.hide(),wpmdb.current_migration.model.on("change:activeStage",function(){"media"===wpmdb.current_migration.model.get("activeStageName")&&a.$pauseBeforeFinalizeElem.hide()}),this.$pauseBeforeFinalizeElem.on("click",function(){var b=Boolean(a.$pauseBeforeFinalizeCheckbox.is(":checked"));b!==Boolean(wpmdb_data.pause_before_finalize)&&(wpmdb_data.pause_before_finalize_changed=!0,wpmdb_data.pause_before_finalize=b)})},initTabElem:function(){var a=this;this.$tabElem=d("").append(""+this.model.get("strings").stage_title+" ").append(""+this.model.get("strings").queued+" ").on("click",function(){a.model.activateTab()})},updateProgressElem:function(){var a=Math.max(0,this.model.getTotalProgressPercent()),b=wpmdb.functions.convertKBSizeToHRFixed(Math.min(this.model.getTotalSizeTransferred(),this.model.get("totalSize"))),c=Math.min(this.model.countItemsComplete(),this.model.get("items").length);"complete"===this.model.get("status")&&0===this.model.get("totalSize")&&(a=100,this.$showHideTablesElem.fadeOut()),this.$totalProgressElem.find(".percent-complete").text(a),this.$totalProgressElem.find(".size-complete").text(b),this.$totalProgressElem.find(".tables-complete").text(wpmdb_add_commas(c)),this.$totalProgressElem.find(".progress-bar-wrapper .progress-bar").css({width:a+"%"})},updateStageTotals:function(){var a=this.model.get("items").length;this.$totalProgressElem.find(".tables-total").text(wpmdb_add_commas(a)),this.$totalProgressElem.find(".size-total").text(wpmdb.functions.convertKBSizeToHR(this.model.get("totalSize")))},initializeItemElement:function(a){var b=d('
'),c=d('
').css("width","0%"),e=d("

").addClass("item-info").append(d('').text(a.name)).append(" ").append(d('').text("("+wpmdb.functions.convertKBSizeToHRFixed(a.size)+")"));return b.append(e),b.append(c),b.append(''),b.attr("id","item-"+a.name),b.attr("data-stage",this.model.get("name")),a.$el=b,a.$progress=c,a.$title=e,a},maybeAddElementToView:function(a){this.visibleDomNodes'+wpmdb_strings.progress_items_truncated_msg.replace("%1$s",''+wpmdb_add_commas(this.queuedElements.length)+"")+"

"),this.$truncationNoticeHiddenItems=this.$truncationNotice.find(".hidden-items"),this.$itemsContainer.after(this.$truncationNotice))},updateTruncationNotice:function(){this.$truncationNoticeHiddenItems.text(wpmdb_add_commas(this.queuedElements.length))},getNextElementForView:function(a){var b;return this.queuedElements.length&&(a&&this.queuedElements.push(a),b=this.queuedElements.shift(),a=b instanceof d?b:this.initializeItemElement(b).$el),a},setItemProgress:function(a){var b=Math.min(100,Math.ceil(100*(a.transferred/a.size)));a.$progress.css("width",b+"%"),b>=100&&this.elemComplete(a)},elemComplete:function(a){var b=a.$el.addClass("complete");if(1!==this.model.get("items").length){var c=this.getNextElementForView(b),d=b.height(),e=b.css("margin-bottom"),f=c.clone().css({height:0,marginBottom:0}).addClass("clone");f.appendTo(this.$itemsContainer),b.css({height:d,marginBottom:e}),setTimeout(function(){b.css({height:0,marginBottom:0}),f.css({height:d,marginBottom:e}),setTimeout(function(){b.css({height:"auto",marginBottom:e}).remove(),f.remove(),this.$itemsContainer.find(".item-progress:not(.clone)").last().after(c.css({height:"auto",marginBottom:e}))}.bind(this),250)}.bind(this),1e3)}}});b.exports=e},{}],7:[function(a,b,c){!function(b,c){function d(a,b){var c,d,e=[],f={},g=b.length;for(c=0;g>c;c++)f[b[c]]=!0;for(g=a.length,c=0;g>c;c++)d=a[c],d in f&&e.push(d);return e}function e(a){a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)"),c=b.exec(location.search);return null===c?"":decodeURIComponent(c[1].replace(/\+/g," "))}function f(a,c,d){var e=a.substr(0,a.indexOf(":"));return d!==e&&-1!==a.indexOf("https")?(b(".ssl-notice").show(),N=!0,a=a.replace("https","http"),void b(".pull-push-connection-info").val(a+"\n"+c)):void(N=!1)}function g(a){a!==wpmdb_data.this_prefix&&(b(".remote-prefix").html(a),M=!0,"pull"===wpmdb_migration_type()?b(".prefix-notice.pull").show():b(".prefix-notice.push").show())}function h(){if("undefined"!=typeof c.common.connection_data&&!1!==c.common.connection_data){var a=wpmdb_migration_type(),d=s(null,null);b(".mixed-case-table-name-notice").hide(),null!==d&&(d=d.join(""),d!==d.toLowerCase()&&("1"===c.common.connection_data.lower_case_table_names||"push"!==a&&"savefile"!==a)&&("1"!==wpmdb_data.lower_case_table_names&&"pull"===a||("push"===a||"savefile"===a?b(".mixed-case-table-name-notice.push").show():b(".mixed-case-table-name-notice.pull").show())))}}function i(a){var b=a,c=b.replace(/\/\/(.*)@/,"//").replace("http://","").replace("https://","").replace("www.","");return c}function j(a,b,c){var d=i(b);return"completed"===c?a.replace(/\%s\s?/,""+d+" "):a.replace(/\%s(\S*)\s?/,""+d+"$1 ")}function k(a,b,c){var d="",e="";switch(b){case"push":d=wpmdb_strings.push_migration_label_migrating,e=wpmdb_strings.push_migration_label_completed;break;case"pull":d=wpmdb_strings.pull_migration_label_migrating,e=wpmdb_strings.pull_migration_label_completed;break;case"find_replace":d=wpmdb_strings.find_replace_label_migrating,e=wpmdb_strings.find_replace_label_completed;break;case"savefile":d=wpmdb_strings.exporting_please_wait,e=wpmdb_strings.exporting_complete}var f=d;return"completed"===c&&(f=e),"push"!==b&&"pull"!==b||(f=j(f,a,c)),f}function l(a){return a.replace(/^https?:/i,"")}function m(){b(".option-group").each(function(a){b("input",this).attr("disabled","disabled"),b("label",this).css("cursor","default")})}function n(){b(".option-group").each(function(a){b("input",this).removeAttr("disabled"),b("label",this).css("cursor","pointer")})}function o(a,c,d,e){var f=c;void 0!==e&&(f=e),b(".slider",a).slider("value",parseInt(c)),b(".amount",a).html(wpmdb_add_commas(f)+" "+d)}function p(a){!0===U?(U=!1,F=!0,c.current_migration.setState(V,W,"active"),b(".pause-resume").html(wpmdb_strings.pause),c.current_migration.resumeTimer(),c.functions.execute_next_step()):(U=!0,F=!1,Z=wpmdb_strings.migration_paused,V=b(".progress-title").html(),W=b(".progress-text",".progress-wrapper-primary").html(),X=b(".progress-text",".progress-wrapper-secondary ").html(),"find_replace"===x&&(Z=wpmdb_strings.find_replace_paused),c.current_migration.setState(Z,wpmdb_strings.completing_current_request,null),b("body").off("click",".pause-resume"),b("body").off("click",".cancel"))}function q(a,c,d){var e=document.createElement("select");return b(e).attr({multiple:"multiple",name:"select_tables[]",id:"select-tables","class":"multiselect"}),0'+f+" ("+c[f]+")")}}),e}function r(a,b){var d=wpmdb_data.this_temp_prefix;return"pull"===wpmdb_migration_type()&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.temp_prefix&&(d=c.common.connection_data.temp_prefix),d===b.substring(0,d.length)?!0:a}function s(a,d){var e="",f=wpmdb_migration_type(),g=b("input[name=table_migrate_option]:checked").val();return"migrate_select"===g?e=b("#select-tables").val():("pull"!==f&&"undefined"!=typeof wpmdb_data.this_prefixed_tables&&(e=wpmdb_data.this_prefixed_tables),"pull"===f&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.prefixed_tables&&(e=c.common.connection_data.prefixed_tables)),e}function t(a,c){return b(".table-select-wrap .table-prefix").text()}function u(a){!0===a?(b('.replace-row.pin .replace-right-col input[type="text"]').attr("readonly","readonly"),b(".replace-row.pin .arrow-col").addClass("disabled")):(b('.replace-row.pin .replace-right-col input[type="text"]').removeAttr("readonly"),b(".replace-row.pin .arrow-col").removeClass("disabled"))}function v(a){c.common.previous_connection_data=c.common.connection_data,c.common.connection_data=a,b.wpmdb.do_action("wpmdb_connection_data_updated",a)}function w(a){var b={};return b.unit="MB",b.amount=(a/1024).toFixed(2),b}var x,y,z,A,B,C,D=!1,E="",F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=!1,M=!1,N=!1,O=!1,P=!1,Q=!1,R="",S="",T="",U=!1,V="",W="",X="",Y="",Z="",$=!1,_=!1,aa=0,ba=400,ca=!1,da=!1;c.migration_progress_controller=a("MigrationProgress-controller"),c.current_migration=null,c.migration_selection=wpmdb_migration_type();var ea=ajaxurl.replace("/admin-ajax.php",""),fa=ea+"/images/spinner";2';window.onbeforeunload=function(a){return Q?(a=a||window.event,a&&(a.returnValue=wpmdb_strings.sure),wpmdb_strings.sure):void 0},b.wpmdb.add_filter("wpmdb_exclude_table",r),b(document).ready(function(){function a(a){var c=!G;L=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_check_licence",licence:a,context:"all",nonce:wpmdb_data.nonces.check_licence},error:function(a,b,c){alert(wpmdb_strings.license_check_problem)},success:function(a){var d,e,f,g=b(".support-content"),h=b(".addons-content"),i=b(".licence-status:not(.notification-message)");if("undefined"!=typeof a.dbrains_api_down)e=a.dbrains_api_down+a.message,f=a.dbrains_api_down;else if("undefined"!=typeof a.errors){if("undefined"!=typeof a.errors.subscription_expired)d=a.errors.subscription_expired.licence,e=a.errors.subscription_expired.support,f=a.errors.subscription_expired.addons;else{var j="";for(var k in a.errors)j+=a.errors[k];e=j,f=j}"undefined"!=typeof a.addon_content&&(f+="\n"+a.addon_content)}else e=a.message,f=a.addon_content;c&&i.stop().fadeOut(ba,function(){"undefined"==typeof d&&(b(this).css({visibility:"hidden",display:"block"}).slideUp(),d=""),b(this).empty().html(d).stop().fadeIn(ba)}),g.stop().fadeOut(ba,function(){b(this).empty().html(e).stop().fadeIn(ba)}),h.stop().fadeOut(ba,function(){b(this).empty().html(f).stop().fadeIn(ba)})}})}function j(){void 0!==wpmdb_data&&void 0!==wpmdb_data.this_tables&&void 0!==wpmdb_data.this_table_sizes_hr&&(Aa=q(wpmdb_data.this_tables,wpmdb_data.this_table_sizes_hr,b(Aa).val())),void 0!==c.common.connection_data&&void 0!==c.common.connection_data.tables&&void 0!==c.common.connection_data.table_sizes_hr&&(Ba=q(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,b(Ba).val()))}function r(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Aa),b("#select-tables").change()}function V(){b("#select-tables").remove(),b(".select-tables-wrap").prepend(Ba),b("#select-tables").change()}function W(){b("#migrate-selected").parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(".table-select-wrap").show(),b("#migrate-only-with-prefix").prop("checked",!1),b("#migrate-selected").prop("checked",!0),b(".table-migrate-options").hide(),b(".select-tables-wrap").show()}function X(){b(".table-migrate-options").show()}function Z(){b("#select-tables").children("option").prop("selected",!0),b("#select-tables").change()}function ea(a,b){return l(wpmdb_data.this_url)}function ha(){var a=wpmdb_migration_type(),d=b.trim(b(".pull-push-connection-info").val()).split("\n");if("undefined"!=typeof wpmdb_default_profile&&!0!==wpmdb_default_profile&&"savefile"!==a&&"find_replace"!==a&&!F&&wpmdb_data.is_pro){F=!0,m(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var e=wpmdb_migration_type();b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:d[0],key:d[1],intent:e,nonce:wpmdb_data.nonces.verify_connection_to_remote_site,convert_post_type_selection:wpmdb_convert_post_type_selection,profile:wpmdb_data.profile},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#102)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){if(b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show());f(d[0],d[1],a.scheme),g(a.prefix),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),D=!0,v(a),na(),h();var e="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables&&(e=wpmdb_loaded_tables),Ba=q(c.common.connection_data.tables,c.common.connection_data.table_sizes_hr,e);var i="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_post_types&&("undefined"!=typeof a.select_post_types?(b("#exclude-post-types").attr("checked","checked"),b(".post-type-select-wrap").show(),i=a.select_post_types):i=wpmdb_loaded_post_types);var j=document.createElement("select");b(j).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){var d=b.inArray(c,i);d=-1!==d||!0===wpmdb_convert_exclude_revisions&&"revision"!==c?' selected="selected" ':" ",b(j).append("'+c+"")}),Da=j;var k="";!1===wpmdb_default_profile&&"undefined"!=typeof wpmdb_loaded_tables_backup&&(k=wpmdb_loaded_tables_backup);var l=document.createElement("select");b(l).attr({multiple:"multiple",name:"select_backup[]",id:"select-backup","class":"multiselect"}),b.each(c.common.connection_data.tables,function(a,d){var e=b.inArray(d,k);e=-1!==e?' selected="selected" ':" ",b(l).append("'+d+" ("+c.common.connection_data.table_sizes_hr[d]+")")}),Ea=l,"pull"===wpmdb_migration_type()?(b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Fa),b(".table-prefix").html(a.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),b.wpmdb.do_action("verify_connection_to_remote_site",c.common.connection_data)}})}}function ia(c,d){b(".licence-input, .register-licence").remove(),b(".licence-not-entered").prepend(c.masked_licence),b(".support-content").empty().html("

"+wpmdb_strings.fetching_license+'

'),a(d),b(".migrate-selection label").removeClass("disabled"),b(".migrate-selection input").removeAttr("disabled")}function ja(){b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_get_log",nonce:wpmdb_data.nonces.get_log},error:function(a,b,c){alert(wpmdb_strings.update_log_problem)},success:function(a){b(".debug-log-textarea").val(a)}})}function ka(){var a=b("#select-post-types").val(),c="",d=b(".exclude-post-types-warning"),e=d.find(".migrate-msg"),f=d.find(".find-replace-msg");"find_replace"===wpmdb_migration_type()?(e.hide(),f.show()):(f.hide(),e.show()),a?(c=""+a.join(", ")+"",b(".excluded-post-types").html(c),"0"===d.css("opacity")&&d.css({opacity:0}).slideDown(200).animate({opacity:1})):d.css({opacity:0}).slideUp(200).animate({opacity:0})}function la(){b("#overlay").removeClass("show").addClass("hide"),b("#overlay > div").removeClass("show").addClass("hide"),c.current_migration.$proVersion.find("iframe").remove(),setTimeout(function(){b("#overlay").remove()},500),P=!1}function ma(){var a;if(b(".save-settings-button").blur(),!I){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup); var c=!1;b("#create_new").is(":checked")&&(c=!0);var d=b(".create-new-profile").val();I=!0,a=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),b(".save-settings-button").attr("disabled","disabled").after(''),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_profile",profile:a,nonce:wpmdb_data.nonces.save_profile},error:function(a,c,d){F=!1,alert(wpmdb_strings.save_profile_problem),b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after(''+wpmdb_strings.saved+""),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),I=!1},success:function(a){var e=parseInt(b("#migrate-form input[name=save_migration_profile_option]:checked").val(),10)+1;if(F=!1,b(".save-settings-button").removeAttr("disabled"),b(".save-profile-ajax-spinner").remove(),b(".save-settings-button").after(''+wpmdb_strings.saved+""),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()}),I=!1,b(".create-new-profile").val(""),c){var f=parseInt(a,10),g=f+1,h=b('
  • ');h.find("label").append(document.createTextNode(" "+d)),e=g,b("#create_new").parents("li").before(h),b("#profile-"+g).attr("checked","checked")}var i=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile="+e,j=b("#migrate-form input[name=save_migration_profile_option]:checked").parent().text().trim();if("function"==typeof window.history.pushState){if(b("#migrate-form .crumbs").length)b("#migrate-form .crumbs .crumb:last").text(j);else{var k=b('
    ').append(' Saved Profiles ').append(''+j+"");b("#migrate-form").prepend(k)}window.history.pushState({updated_profile_id:e},null,i)}}})}}function na(){b(".connection-status").hide(),b(".prefix-notice").hide(),b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".step-two").show(),b(".backup-options").show(),b(".keep-active-plugins").show(),b(".directory-permission-notice").hide(),b("#create-backup").removeAttr("disabled"),b("#create-backup-label").removeClass("disabled"),b(".backup-option-disabled").hide(),b(".compatibility-older-mysql").hide();var a,d=b.trim(b(".pull-push-connection-info").val()).split("\n");if(wpmdb_toggle_migration_action_text(),b.wpmdb.do_action("move_connection_info_box",{migration_type:wpmdb_migration_type(),last_migration_type:E}),"pull"===wpmdb_migration_type()){if(b(".pull-list li").append(Ga),Ga.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),("push"===c.migration_selection||"savefile"===c.migration_selection)&&2===d.length)return c.force_reconnect=!0,b(".pull-list li").append(Ga),b(".pull-push-connection-info").removeClass("temp-disabled").attr("readonly","readonly"),b(".connect-button").hide(),void ta();D?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(c.common.connection_data.prefix),b(".backup-table-prefix").html(wpmdb_data.site_details.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir),!1===K&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===M&&b(".prefix-notice.pull").show(),!0===N&&b(".ssl-notice").show(),!0===O&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),!1===wpmdb_data.write_permission&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(wpmdb_data.this_upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())}else if("push"===wpmdb_migration_type()){if(b(".push-list li").append(Ga),Ga.show(function(){var a=b(this).find(".pull-push-connection-info");a.val()||a.focus()}),("pull"===c.migration_selection||"savefile"===c.migration_selection)&&2===d.length)return c.force_reconnect=!0,b(".push-list li").append(Ga),b(".pull-push-connection-info").removeClass("temp-disabled").attr("readonly","readonly"),b(".connect-button").hide(),void ta();D?(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".backup-table-prefix").html(c.common.connection_data.prefix),b(".uploads-dir").html(c.common.connection_data.uploads_dir),!1===K&&(a=i(c.common.connection_data.url),b(".create-new-profile").val(a)),!0===M&&b(".prefix-notice.push").show(),!0===N&&b(".ssl-notice").show(),!0===O&&(b(".different-plugin-version-notice").show(),b(".step-two").hide()),wpmdb_toggle_migration_action_text(),"0"===c.common.connection_data.write_permissions&&(b("#create-backup").prop("checked",!1),b("#create-backup").attr("disabled","disabled"),b("#create-backup-label").addClass("disabled"),b(".backup-option-disabled").show(),b(".upload-directory-location").html(c.common.connection_data.upload_dir_long))):(b(".connection-status").show(),b(".step-two").hide())}else if(("savefile"===wpmdb_migration_type()||"find_replace"===wpmdb_migration_type())&&(b(".connection-status").hide(),b(".step-two").show(),b(".table-prefix").html(wpmdb_data.this_prefix),b(".compatibility-older-mysql").show(),!1===K&&b(".create-new-profile").val(""),"find_replace"!==wpmdb_migration_type()&&b(".backup-options").hide(),b(".keep-active-plugins").hide(),!1===wpmdb_data.write_permission&&(b(".directory-permission-notice").show(),b(".step-two").hide()),"find_replace"===wpmdb_migration_type()&&"true"===wpmdb_data.is_multisite)){var e=b(".old-replace-col").eq(1);e.parent().removeClass("pin").find(".replace-remove-row").show(),e.find("input").removeAttr("readonly")}h()}function oa(){var a=null,d=null;null!==c.common.previous_connection_data&&"object"==typeof c.common.previous_connection_data&&c.common.previous_connection_data.url!==c.common.connection_data.url&&(a=l(c.common.previous_connection_data.url),d=c.common.previous_connection_data.path),"push"===wpmdb_migration_type()||"savefile"===wpmdb_migration_type()?("pull"===E?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"push"===E&&"push"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".replace-right-col input",this).val();e===d&&b(".replace-right-col input",this).val(c.common.connection_data.path),e===a&&b(".replace-right-col input",this).val(l(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Ca),ka(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)):"pull"===wpmdb_migration_type()&&(""===E||"push"===E||"savefile"===E?b(".replace-row").each(function(){var a=b(".old-replace-col input",this).val();b(".old-replace-col input",this).val(b(".replace-right-col input",this).val()),b(".replace-right-col input",this).val(a)}):"pull"===E&&"pull"===wpmdb_migration_type()&&null!==a&&null!==d&&b(".replace-row").each(function(){var e=b(".old-replace-col input",this).val();e===d&&b(".old-replace-col input",this).val(c.common.connection_data.path),e===a&&b(".old-replace-col input",this).val(l(c.common.connection_data.url))}),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),ka(),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Fa)),E=wpmdb_migration_type()}function pa(a,b,c){return wpmdbGetAjaxErrors(wpmdb_strings.connection_local_server_problem,b,a,c)}function qa(a){return/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]|:)+))\])|((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=])*)(:\d*)?)(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*|(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)|((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)){0})(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)}function ra(c,d){b(".nav-tab").removeClass("nav-tab-active"),b(".nav-tab."+c).addClass("nav-tab-active"),b(".content-tab").hide(),b("."+c+"-tab").show(),"settings"===c&&!0===sa()&&(b("p.licence-status").append("Checking License... ").append(ga),a()),"help"===c&&(ja(),!0===sa()&&(b(".support-content p").append(ga),a())),"addons"===c&&!0!==d&&!0===sa()&&(b(".addons-content p").append(ga),a())}function sa(){return!1===L&&"1"===wpmdb_data.has_licence&&"true"===wpmdb_data.is_pro}function ta(){var a=b(".pull-push-connection-info");if(!F&&!b(a).hasClass("temp-disabled")||!1!==c.force_reconnect){c.force_reconnect=!1;var d=b(".pull-push-connection-info").val(),e=b.trim(d).split("\n"),k=!1,o="";if(""===e&&(k=!0,o=wpmdb_strings.connection_info_missing),1===e.length&&!k){var p=b.trim(d).split(" ");2===p.length&&(e=p)}2===e.length||k||(k=!0,o=wpmdb_strings.connection_info_incorrect),k||qa(e[0])||(k=!0,o=wpmdb_strings.connection_info_url_invalid);var q=0;if("undefined"!=typeof e[1]&&(q=e[1].length),k||32===q||40===q||(k=!0,o=wpmdb_strings.connection_info_key_invalid),k||e[0]!==wpmdb_data.connection_info[0]||(k=!0,o=wpmdb_strings.connection_info_local_url),k||e[1]!==wpmdb_data.connection_info[1]||(k=!0,o=wpmdb_strings.connection_info_local_key),k)return b(".connection-status").html(o),void b(".connection-status").addClass("notification-message error-notice migration-error");var r=e[0]+"\n"+e[1];1===b.trim(d).split("\n").length&&b(".pull-push-connection-info").val(r),!1===wpmdb_data.openssl_available&&(e[0]=e[0].replace("https://","http://"),r=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(r)),M=!1,F=!0,m(),b(".basic-access-auth-wrapper").is(":visible")&&(e[0]=e[0].replace(/\/\/(.*)@/,"//"),e[0]=e[0].replace("//","//"+encodeURIComponent(b.trim(b(".auth-username").val()))+":"+encodeURIComponent(b.trim(b(".auth-password").val()))+"@"),r=e[0]+"\n"+e[1],b(".pull-push-connection-info").val(r),b(".basic-access-auth-wrapper").hide()),b(".step-two").hide(),b(".ssl-notice").hide(),b(".prefix-notice").hide(),b(".connection-status").show(),b(".connection-status").html(wpmdb_strings.establishing_remote_connection),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var s=wpmdb_migration_type();K=!1,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_verify_connection_to_remote_site",url:e[0],key:e[1],intent:s,nonce:wpmdb_data.nonces.verify_connection_to_remote_site},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#100)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){if(b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show(),void(b(".pull-push-connection-info").hasClass("temp-disabled")||b(".connect-button").is(":visible")||(b(".pull-push-connection-info").removeAttr("readonly"),b(".connect-button").show()));f(e[0],e[1],a.scheme);var d=i(a.url);b(".create-new-profile").val(d),b(".pull-push-connection-info").addClass("temp-disabled"),b(".pull-push-connection-info").attr("readonly","readonly"),b(".connect-button").hide(),b(".connection-status").hide(),b(".step-two").show(),g(a.prefix),D=!0,v(a),na(),oa(),h(),j(),Ea=b(Ba).clone(),b(Ea).attr({name:"select_backup[]",id:"select-backup"});var k=document.createElement("select");b(k).attr({multiple:"multiple",name:"select_post_types[]",id:"select-post-types","class":"multiselect"}),b.each(c.common.connection_data.post_types,function(a,c){b(k).append('")}),Da=k,b("#new-path-missing-warning, #new-url-missing-warning").hide(),"pull"===wpmdb_migration_type()?(b("#new-url").val(l(wpmdb_data.this_url)),b("#new-path").val(wpmdb_data.this_path),"true"===wpmdb_data.is_multisite&&(b("#new-domain").val(wpmdb_data.this_domain),b('.replace-row.pin .old-replace-col input[type="text"]').val(l(a.url))),b("#old-url").val(l(a.url)),b("#old-path").val(a.path),b.wpmdb.do_action("wpmdb_update_pull_table_select"),b("#select-post-types").remove(),b(".exclude-post-types-warning").after(Da),ka(),b(".table-prefix").html(a.prefix),b(".backup-table-prefix").html(wpmdb_data.site_details.prefix),b(".uploads-dir").html(wpmdb_data.this_uploads_dir)):(b("#new-url").val(l(a.url)),b("#new-path").val(a.path),"true"===wpmdb_data.is_multisite&&b('.replace-row.pin .old-replace-col input[type="text"]').val(l(wpmdb_data.this_url)),b.wpmdb.do_action("wpmdb_update_push_table_select"),b("#select-backup").remove(),b(".backup-tables-wrap").prepend(Ea)),c.common.next_step_in_migration={fn:b.wpmdb.do_action,args:["verify_connection_to_remote_site",c.common.connection_data]},c.functions.execute_next_step()}})}}function ua(a){$=!0,Y=wpmdb_strings.cancelling_migration,b(".migration-controls").css({visibility:"hidden"}),"find_replace"===x&&(Y=wpmdb_strings.cancelling_find_replace),c.current_migration.setState(Y,wpmdb_strings.completing_current_request,"cancelling"),!0===U&&(U=!1,c.functions.execute_next_step())}function va(a){var c=b("#"+a),d=c.find("input[type=checkbox]");c.toggleClass("on").find("span").toggleClass("checked");var e=c.find("span.on").hasClass("checked");d.attr("checked",e).trigger("change")}c.migration_state_id="",b("#plugin-compatibility").change(function(a){var c="1",d=b(this).closest("td").next("td").find(".setting-status");if(b(this).is(":checked")){var e=confirm(wpmdb_strings.mu_plugin_confirmation);if(!e)return void b(this).prop("checked",!1)}else c="0";b(".plugin-compatibility-wrap").toggle(),d.find(".ajax-success-msg").remove(),d.append(ga),b("#plugin-compatibility").attr("disabled","disabled"),b(".plugin-compatibility").addClass("disabled"),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_plugin_compatibility",install:c,nonce:wpmdb_data.nonces.plugin_compatibility},error:function(a,c,d){alert(wpmdb_strings.plugin_compatibility_settings_problem+"\r\n\r\n"+wpmdb_strings.status+" "+a.status+" "+a.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+a.responseText),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")},success:function(a){""!==b.trim(a)?alert(a):(d.append(''+wpmdb_strings.saved+""),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})),b(".ajax-spinner").remove(),b("#plugin-compatibility").removeAttr("disabled"),b(".plugin-compatibility").removeClass("disabled")}})}),b("#plugin-compatibility").is(":checked")&&b(".plugin-compatibility-wrap").show(),(0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Trident"))&&b(".ie-warning").show(),0===wpmdb_data.valid_licence&&b("#savefile").prop("checked",!0);var wa=b(".max-request-size"),xa=b(".slider",wa);xa.slider({range:"min",value:parseInt(wpmdb_data.max_request/1024),min:512,max:parseInt(wpmdb_data.bottleneck/1024),step:256,create:function(a,b){var c=w(wpmdb_data.max_request/1024);o(wa,wpmdb_data.max_request/1024,c.unit,c.amount)},slide:function(a,b){var c=w(b.value);o(wa,b.value,c.unit,c.amount)},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",wa).after(''),xa.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_max_request_size",max_request_size:parseInt(c.value),nonce:wpmdb_data.nonces.update_max_request_size},error:function(a,c,d){xa.slider("enable"),b(".slider-spinner",wa).remove(),alert(wpmdb_strings.max_request_size_problem);var e=w(wpmdb_data.max_request/1024);o(wa,wpmdb_data.max_request/1024,e.unit,e.amount),xa.slider("enable")},success:function(){xa.slider("enable"),b(".slider-label-wrapper",wa).append(''+wpmdb_strings.saved+""),b(".slider-success-msg",wa).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",wa).remove()}})}});var ya=b(".delay-between-requests"),za=b(".slider",ya);za.slider({range:"min",value:parseInt(wpmdb_data.delay_between_requests/1e3),min:0,max:10,step:1,create:function(a,b){o(ya,wpmdb_data.delay_between_requests/1e3,"s")},slide:function(a,b){o(ya,b.value,"s")},stop:function(a,c){b(".slider-success-msg").remove(),b(".amount",ya).after(''),za.slider("disable"),b.ajax({url:ajaxurl,type:"POST",cache:!1,data:{action:"wpmdb_update_delay_between_requests",delay_between_requests:parseInt(1e3*c.value),nonce:wpmdb_data.nonces.update_delay_between_requests},error:function(a,c,d){za.slider("enable"),b(".slider-spinner",ya).remove(),alert(wpmdb_strings.delay_between_requests_problem),o(ya,wpmdb_data.delay_between_requests/1e3,"s"),za.slider("enable")},success:function(){wpmdb_data.delay_between_requests=parseInt(1e3*c.value),za.slider("enable"),b(".slider-label-wrapper",ya).append(''+wpmdb_strings.saved+""),b(".slider-success-msg",ya).fadeOut(2e3,function(){b(this).remove()}),b(".slider-spinner",ya).remove()}})}});var Aa=b("#select-tables").clone(),Ba=b("#select-tables").clone(),Ca=b("#select-post-types").clone(),Da=b("#select-post-types").clone(),Ea=b("#select-backup").clone(),Fa=b("#select-backup").clone();b(".help-tab .video").each(function(){var a=b(this),c=b(".video-viewer");b("a",this).click(function(d){d.preventDefault(),c.attr("src","//www.youtube.com/embed/"+a.data("video-id")+"?autoplay=1"),c.show();var e=c.offset();b(window).scrollTop(e.top-50)})}),b(".backup-options").show(),b(".keep-active-plugins").show(),"savefile"===wpmdb_migration_type()&&(b(".backup-options").hide(),b(".keep-active-plugins").hide()),E=wpmdb_migration_type(),b(".content-tab").on("click",".check-my-licence-again",function(c){c.preventDefault(),L=!1,b(c.target).replaceWith("Checking... "+ga),a(null,"all")}),b.wpmdb.add_action("wpmdb_refresh_table_selects",j),b.wpmdb.add_action("wpmdb_update_push_table_select",r),b.wpmdb.add_action("wpmdb_update_pull_table_select",V),b.wpmdb.add_action("wpmdb_disable_table_migration_options",W),b.wpmdb.add_action("wpmdb_enable_table_migration_options",X),b.wpmdb.add_action("wpmdb_select_all_tables",Z),b.wpmdb.add_filter("wpmdb_base_old_url",ea),ha(),b("body").on("click",".js-action-link",function(a){a.preventDefault(),b(this).blur()}),b(".licence-input").keypress(function(a){13===a.which&&(a.preventDefault(),b(".register-licence").click())}),b("body").on("click",".register-licence",function(a){if(a.preventDefault(),!G){var c=b.trim(b(".licence-input").val()),d=b(".licence-status");if(d.removeClass("notification-message error-notice success-notice"),""===c)return void d.html('
    '+wpmdb_strings.enter_license_key+"
    ");d.empty().removeClass("success"),G=!0,b(".button.register-licence").after(''),b.ajax({url:ajaxurl,type:"POST",dataType:"JSON",cache:!1,data:{action:"wpmdb_activate_licence",licence_key:c,nonce:wpmdb_data.nonces.activate_licence,context:"licence"},error:function(a,c,e){G=!1,b(".register-licence-ajax-spinner").remove(),d.html(wpmdb_strings.register_license_problem)},success:function(a){if(b(".register-licence-ajax-spinner").remove(),"undefined"!=typeof a.errors){var e="";for(var f in a.errors)e+=a.errors[f];d.html(e),"undefined"!=typeof a.masked_licence&&(ia(a,c),b(".migrate-tab .invalid-licence").hide())}else"undefined"!=typeof a.wpmdb_error&&"undefined"!=typeof a.body?d.html(a.body):(1===Number(a.is_first_activation)&&(wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%1$s","https://deliciousbrains.com/wp-migrate-db-pro/doc/quick-start-guide/"),wpmdb_strings.welcome_text=wpmdb_strings.welcome_text.replace("%2$s","https://deliciousbrains.com/wp-migrate-db-pro/videos/"),d.after('

    '+wpmdb_strings.welcome_title+"

    "+wpmdb_strings.welcome_text+"

    ")),d.html(wpmdb_strings.license_registered).delay(5e3).fadeOut(1e3,function(){b(this).css({visibility:"hidden",display:"block"}).slideUp()}),d.addClass("success notification-message success-notice"),ia(a,c),b(".invalid-licence").hide());G=!1}})}}),b(".clear-log").click(function(){b(".ajax-spinner, .ajax-success-msg").remove(),b(this).after(ga),b(".debug-log-textarea").val(""),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_clear_log",nonce:wpmdb_data.nonces.clear_log},error:function(a,c,d){b(".ajax-spinner").remove(),alert(wpmdb_strings.clear_log_problem)},success:function(a){b(".ajax-spinner, .ajax-success-msg").remove(),ja(),b(".clear-log").after(''+wpmdb_strings.clear_error_log+""),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}),b(".multiselect-select-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).prop("selected",1),b(a).focus().trigger("change")}),b(".multiselect-deselect-all").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).removeAttr("selected"),b(a).focus().trigger("change")}),b(".multiselect-invert-selection").click(function(){var a=b(this).parents(".select-wrap").children(".multiselect");b("option",a).each(function(){b(this).attr("selected",!b(this).attr("selected"))}),b(a).focus().trigger("change")}),b(".option-group input[type=radio]").change(function(){var a=b(this).closest(".option-group");b("ul",a).hide();var c=b(this).closest("li");b("ul",c).show()}),b(".option-group").each(function(){b(".option-group input[type=radio]").each(function(){if(b(this).is(":checked")){var a=b(this).closest("li");b("ul",a).show()}})}),b(".header-expand-collapse").click(function(){b(".expand-collapse-arrow",this).hasClass("collapsed")?(b(".expand-collapse-arrow",this).removeClass("collapsed"),b(this).next().show()):(b(".expand-collapse-arrow",this).addClass("collapsed"),b(this).next().hide())}),b(".checkbox-label input[type=checkbox]").change(function(){b(this).is(":checked")?b(this).parent().next().show():b(this).parent().next().hide()}),b(".select-post-types-wrap").on("change","#select-post-types",function(){ka()}),b("#exclude-post-types").is(":checked")&&b("#select-post-types").val()&&b(".exclude-post-types-warning").css({display:"block",opacity:1}),b("#save-migration-profile").change(function(){c.functions.update_migrate_button_text(),b(this).is(":checked")?b(".save-settings-button").show():b(".save-settings-button").hide()}),b("#save-migration-profile").is(":checked")&&b(".save-settings-button").show(),b(".create-new-profile").focus(function(){b("#create_new").prop("checked",!0)}),b(".checkbox-label input[type=checkbox]").each(function(){b(this).is(":checked")&&b(this).parent().next().show()}),b(".migrate-db-button").click(function(a){if(b(this).blur(),a.preventDefault(),c.migration_state_id="",!1!==b.wpmdb.apply_filters("wpmdb_migration_profile_ready",!0)){if(b("#migrate-selected").is(":checked")&&null===b("#select-tables").val())return void alert(wpmdb_strings.please_select_one_table);if("savefile"!==wpmdb_migration_type()&&b("#backup-manual-select").is(":checked")&&null===b("#select-backup").val())return void alert(wpmdb_strings.please_select_one_table_backup);var e=!1,f=!1;if(b("#new-url").length&&!b("#new-url").val()&&(b("#new-url-missing-warning").show(),b("#new-url").focus(),b("html,body").scrollTop(0),e=!0),b("#new-path").length&&!b("#new-path").val()&&(b("#new-path-missing-warning").show(),!1===e&&(b("#new-path").focus(),b("html,body").scrollTop(0)),f=!0),!0!==e&&!0!==f){b("#save-migration-profile").is(":checked")&&ma(),A=b(b("#migrate-form")[0].elements).not(".auth-credentials").serialize(),x=wpmdb_migration_type(),B="backup","savefile"===x&&(B="migrate"),!1===b("#create-backup").is(":checked")&&(B="migrate"),c.current_migration=c.migration_progress_controller.newMigration({localTableSizes:wpmdb_data.this_table_sizes,localTableRows:wpmdb_data.this_table_rows,remoteTableSizes:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_sizes:null,remoteTableRows:"undefined"!=typeof c.common.connection_data?c.common.connection_data.table_rows:null,migrationIntent:wpmdb_migration_type()});var g=b("input[name=backup_option]:checked").val(),h=b("input[name=table_migrate_option]:checked").val(),i="",j="";"backup"===B&&("migrate_only_with_prefix"===h&&"backup_selected"===g&&(g="backup_only_with_prefix"),"push"===x?(j="remote","backup_only_with_prefix"===g?T=c.common.connection_data.prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),T=d(i,c.common.connection_data.tables)):"backup_manual_select"===g&&(T=b("#select-backup").val())):(j="local","backup_only_with_prefix"===g?T=wpmdb_data.this_prefixed_tables:"backup_selected"===g?(i=b("#select-tables").val(),i=b.wpmdb.apply_filters("wpmdb_backup_selected_tables",i),T=d(i,wpmdb_data.this_tables)):"backup_manual_select"===g&&(T=b("#select-backup").val())),c.current_migration.model.addStage("backup",T,j,{strings:{migrated:wpmdb_strings.backed_up}})),j=-1!==b.inArray(x,["push","savefile","find_replace"])?"local":"remote","find_replace"===x?("backup"!==B&&(B="find_replace"),c.current_migration.model.addStage("find_replace",s(null,null),j,{strings:{migrated:wpmdb_strings.searched,stage_title:wpmdb_strings.migrate_button_find_replace}})):c.current_migration.model.addStage("migrate",s(null,null),j),b.wpmdb.do_action("wpmdb_add_migration_stages",{data_type:j,tables_to_migrate:s(null,null)});var l=(b("input[name=table_migrate_option]:checked").val(),b.trim(b(".pull-push-connection-info").val()).split("\n"));y=l[0],z=l[1];var m=k(y,x,"migrating");C=k(y,x,"completed"),T="find_replace"===B?c.current_migration.model.getStageItems("find_replace","name"):"backup"===B?c.current_migration.model.getStageItems("backup","name"):c.current_migration.model.getStageItems("migrate","name"),c.current_migration.model.setActiveStage(B),c.current_migration.setTitle(m),c.current_migration.startTimer(),Q=!0,c.current_migration.setStatus("active");var n={action:"wpmdb_initiate_migration",intent:x,url:y,key:z,form_data:A,stage:B,nonce:wpmdb_data.nonces.initiate_migration};n.site_details={local:wpmdb_data.site_details},-1===b.inArray(x,["savefile","find_replace"])&&(n.temp_prefix=c.common.connection_data.temp_prefix,n.site_details.remote=c.common.connection_data.site_details),n.site_details=JSON.stringify(n.site_details),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:n,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_failed,pa(a.responseText,"(#112)",a),"error"),console.log(a),console.log(b),console.log(d),F=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){if(F=!1,"undefined"!=typeof a&&"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error)return c.common.migration_error=!0,c.functions.migration_complete_events(),void c.current_migration.setState(wpmdb_strings.migration_failed,a.body,"error");c.migration_state_id=a.migration_state_id;var d=0;aa=0,"savefile"!==x&&"undefined"!=typeof c.common.connection_data&&"undefined"!=typeof c.common.connection_data.delay_between_requests&&(aa=Math.max(parseInt(wpmdb_data.delay_between_requests),parseInt(c.common.connection_data.delay_between_requests))),c.functions.migrate_table_recursive=function(a,e){if(d>=T.length){if("backup"!==B)return b(".progress-label").removeClass("label-visible"),c.common.hooks=b.wpmdb.apply_filters("wpmdb_before_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete),c.common.hooks.push(c.functions.wpmdb_flush),c.common.hooks=b.wpmdb.apply_filters("wpmdb_after_migration_complete_hooks",c.common.hooks),c.common.hooks.push(c.functions.migration_complete_events),c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step();B="migrate","find_replace"===x&&(B="find_replace"),c.current_migration.model.setActiveStage(B),d=0,T=s(null,null)}var f=0;d===T.length-1&&(f=1);var g=0;"savefile"!==x&&"find_replace"!==x&&1===parseInt(c.common.connection_data.gzip)&&(g=1);var h={action:"wpmdb_migrate_table",migration_state_id:c.migration_state_id,table:T[d],stage:B,current_row:a,last_table:f,primary_keys:e,gzip:g,nonce:wpmdb_data.nonces.migrate_table};"savefile"!==x&&"find_replace"!==x&&(h.bottleneck=c.common.connection_data.bottleneck,h.prefix=c.common.connection_data.prefix),c.common.connection_data&&c.common.connection_data.path_current_site&&c.common.connection_data.domain&&(h.path_current_site=c.common.connection_data.path_current_site,h.domain_current_site=c.common.connection_data.domain),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,timeout:0,data:h,error:function(a,b,e){var f=wpmdb_strings.table_process_problem+" "+T[d]+"

    "+wpmdb_strings.status+": "+a.status+" "+a.statusText+"

    "+wpmdb_strings.response+":
    "+a.responseText;c.current_migration.setState(wpmdb_strings.migration_failed,f,"error"),F=!1,console.log(a),console.log(b),console.log(e),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){F=!1,a=b.trim(a);var e=wpmdb_parse_json(a),g="";return!1===e||null===e?(g=""===a||null===a?wpmdb_strings.table_process_problem_empty_response+" "+T[d]:pa(a,null,null),c.current_migration.setState(wpmdb_strings.migration_failed,g,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):"undefined"!=typeof e.wpmdb_error&&1===e.wpmdb_error?(c.current_migration.setState(wpmdb_strings.migration_failed,e.body,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.current_migration.setText(),c.current_migration.model.getStageModel(B).setItemRowsTransferred(T[d],e.current_row),1===f&&"savefile"===x&&("undefined"!=typeof e.dump_filename&&(R=e.dump_filename),"undefined"!=typeof e.dump_path&&(S=e.dump_path)),-1===parseInt(e.current_row)&&(d++,e.current_row="",e.primary_keys=""),c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:[e.current_row,e.primary_keys]},void c.functions.execute_next_step())}})},c.common.next_step_in_migration={fn:c.functions.migrate_table_recursive,args:["-1",""]},c.functions.execute_next_step()}})}}}), c.functions.migration_complete_events=function(){if(!1===c.common.migration_error)if(""===c.common.non_fatal_errors)if("savefile"!==x&&!0===b("#save_computer").is(":checked")&&c.current_migration.setText(),C+=' 
    ',!0===$){var a=wpmdb_strings.migration_cancelled_success;"find_replace"===x&&(a=wpmdb_strings.find_replace_cancelled_success),c.current_migration.setState(C,a,"cancelled")}else c.current_migration.setState(C,"","complete");else c.current_migration.setState(wpmdb_strings.completed_with_some_errors,c.common.non_fatal_errors,"error");b(".migration-controls").addClass("hidden"),c.common.hooks=[],c.common.call_stack=[],c.common.migration_error=!1,Q=!1,P=!0,U=!1,$=!1,F=!1,c.common.non_fatal_errors="",b(".progress-label").remove(),b(".migration-progress-ajax-spinner").remove(),b(".close-progress-content").show(),b("#overlay").css("cursor","pointer"),c.current_migration.model.setMigrationComplete()},c.functions.migration_complete=function(){if(b(".migration-controls").addClass("hidden"),"savefile"===x){Q=!1;var a=wpmdb_strings.migration_complete;if(b("#save_computer").is(":checked")){var d=wpmdb_data.this_download_url+encodeURIComponent(R);b("#gzip_file").is(":checked")&&(d+="&gzip=1"),window.location=d}else a=wpmdb_strings.completed_dump_located_at+" "+S;!1===c.common.migration_error&&(c.functions.migration_complete_events(),c.current_migration.setState(C,a,"complete"))}else{c.current_migration.setState(null,wpmdb_strings.finalizing_migration,"finalizing");var e={action:"wpmdb_finalize_migration",migration_state_id:c.migration_state_id,tables:T.join(","),nonce:wpmdb_data.nonces.finalize_migration};"find_replace"!==x&&(e.prefix=c.common.connection_data.prefix),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:e,error:function(a,b,d){F=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.finalize_tables_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}})}},c.functions.wpmdb_flush=function(){"savefile"!==x&&(c.current_migration.setText(wpmdb_strings.flushing),F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_flush",migration_state_id:c.migration_state_id,nonce:wpmdb_data.nonces.flush},error:function(a,b,d){F=!1,c.current_migration.setState(wpmdb_strings.migration_failed,wpmdb_strings.flush_problem,"error"),alert(a+" : "+b+" : "+d),c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,"1"!==b.trim(a)?(c.current_migration.setState(wpmdb_strings.migration_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(c.common.next_step_in_migration={fn:wpmdb_call_next_hook},void c.functions.execute_next_step())}}))},c.functions.update_migrate_button_text=function(){var a=wpmdb_migration_type(),c=b("#save-migration-profile").is(":checked")?"_save":"",d="migrate_button_"+("savefile"===a?"export":a)+c;b(".migrate-db .button-primary").val(wpmdb_strings[d])},c.functions.update_migrate_button_text(),b("body").on("click",".close-progress-content-button",function(a){la(),c.current_migration.restoreTitleElem()}),b("body").on("click","#overlay",function(a){!0===P&&a.target===this&&(la(),c.current_migration.restoreTitleElem())}),b(".save-settings-button").click(function(a){return a.preventDefault(),""===b.trim(b(".create-new-profile").val())&&b("#create_new").is(":checked")?(alert(wpmdb_strings.enter_name_for_profile),void b(".create-new-profile").focus()):void ma()});var Ga=b(".connection-info-wrapper");na(),b(".migrate-selection.option-group input[type=radio]").change(function(){na(),c.migration_selection=wpmdb_migration_type(),D&&oa(),c.functions.update_migrate_button_text()}),"pull"!==wpmdb_migration_type()&&"push"!==wpmdb_migration_type()||D||(b(".step-two").hide(),b(".connection-status").show()),b(".general-helper").click(function(a){a.preventDefault();var c=b(this),d=b(this).next();b(".helper-message").not(d).hide();var e=c.position();if(d.hasClass("bottom")){var f=1;b(this).is(":first-child")&&(f=3),d.css({left:e.left-d.width()/2-f+"px",top:e.top+c.height()+9+"px"})}else d.css({left:e.left+c.width()+9+"px",top:e.top+c.height()/2-18+"px"});d.toggle(),a.stopPropagation()}),b("body").click(function(){b(".helper-message").hide()}),b(".helper-message").click(function(a){a.stopPropagation()}),b("body").on("click",".show-errors-toggle",function(a){a.preventDefault(),b(this).next(".migration-php-errors").toggle()}),b(".nav-tab").click(function(){var a=b(this).attr("data-div-name");a=a.replace("-tab",""),window.location.hash=a,ra(a,!1)}),b("body").on("click",'a[href^="#"]',function(a){var c=b(a.target).attr("href"),d=c.substr(1);if(d){var e=b("."+d);1===e.length&&(e.trigger("click"),a.preventDefault())}}),b("body").on("click",".add-row",function(){var a=b(this).parents("tr");a.before(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),a.prev().find(".old-replace-col input").focus()}),b("body").on("click",".replace-remove-row",function(){b(this).parents("tr").remove(),2>=b(".replace-row").length&&b(".no-replaces-message").show();var a=b(this).prev().attr("id");"new-url"!==a&&"new-path"!==a||b("#"+a+"-missing-warning").hide()}),b("body").on("change","#new-url",function(){b("#new-url-missing-warning").hide()}).on("change","#new-path",function(){b("#new-path-missing-warning").hide()}),b("body").on("click",".arrow-col",function(){var a=this;if(!b(a).hasClass("disabled")){var c=b(a).prev("td").find("input").val(),d=b(a).next("td").find("input");d.val(c),"new-url"===d.prop("id")?b("#new-url-missing-warning").hide():"new-path"===d.prop("id")&&b("#new-path-missing-warning").hide()}}),b(".add-replace").click(function(){b(".replace-fields").prepend(b(".original-repeatable-field").clone().removeClass("original-repeatable-field")),b(".no-replaces-message").hide()}),b("#find-and-replace-sort tbody").sortable({items:"> tr:not(.pin)",handle:"td:first",start:function(){b(".sort-handle").css("cursor","-webkit-grabbing"),b(".sort-handle").css("cursor","-moz-grabbing")},stop:function(){b(".sort-handle").css("cursor","-webkit-grab"),b(".sort-handle").css("cursor","-moz-grab")}});var Ha="";window.location.hash&&(Ha=window.location.hash.substring(1),ra(Ha,!1)),""!==e("install-plugin")&&(Ha="addons",L=!0,ra(Ha,!0)),b(".notice-link").click(function(a){a.preventDefault(),b(this).closest(".inline-message").hide(),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_process_notice_link",nonce:wpmdb_data.nonces.process_notice_link,notice:b(this).data("notice"),type:b(this).data("type"),reminder:b(this).data("reminder")}})}),b("#connection_info").on("copy",function(a){var c=b(this),d=c.val().split("\n");if(2===d.length)try{a.originalEvent.clipboardData.setData("text/plain",d.join(" ")),a.preventDefault()}catch(e){}}),b(".reset-api-key").click(function(){var a=confirm(wpmdb_strings.reset_api_key);a&&!H&&(H=!0,b(".reset-api-key").after(''),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_reset_api_key",nonce:wpmdb_data.nonces.reset_api_key},error:function(a,c,d){alert(wpmdb_strings.reset_api_key_problem),b(".reset-api-key-ajax-spinner").remove(),H=!1},success:function(a){b(".reset-api-key-ajax-spinner").remove(),H=!1,b(".connection-info").html(a),wpmdb_data.connection_info=b.trim(a).split("\n")}}))}),b(".copy-api-key").click(function(){var a=b(this),c=b("#connection_info"),d=c.val(),e=d.replace("\n"," ");c.val(e),c.select();try{document.execCommand("copy"),c.blur(),a.css("color","transparent");var f=b(".copy-api-key-confirmation").show();setTimeout(function(){f.fadeOut("fast"),setTimeout(function(){a.css("color","")},200)},1e3)}catch(g){alert("please press Ctrl/Cmd+C to copy")}c.val(d)}),b("input.multiselect-toggle").change(function(){b(this).parents(".expandable-content").children(".select-wrap").toggle()}),b(".show-multiselect").each(function(){b(this).is(":checked")&&(b(this).parents(".option-section").children(".header-expand-collapse").children(".expand-collapse-arrow").removeClass("collapsed"),b(this).parents(".expandable-content").show(),b(this).parents(".expandable-content").children(".select-wrap").toggle())}),b("input[name=backup_option]").change(function(){b(".backup-tables-wrap").hide(),"backup_manual_select"===b(this).val()&&b(".backup-tables-wrap").show()}),b("#backup-manual-select").is(":checked")&&b(".backup-tables-wrap").show(),b(".plugin-compatibility-save").click(function(){if(!J){b(this).addClass("disabled");var a=b("#selected-plugins");b(a).attr("disabled","disabled"),b(".plugin-compatibility-success-msg").remove(),J=!0,b(this).after(''),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_blacklist_plugins",blacklist_plugins:b(a).val(),nonce:wpmdb_data.nonces.blacklist_plugins},error:function(c,d,e){alert(wpmdb_strings.blacklist_problem+"\r\n\r\n"+wpmdb_strings.status+" "+c.status+" "+c.statusText+"\r\n\r\n"+wpmdb_strings.response+"\r\n"+c.responseText),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),J=!1,b(".plugin-compatibility-spinner").remove()},success:function(c){""!==b.trim(c)&&alert(c),b(a).removeAttr("disabled"),b(".plugin-compatibility-save").removeClass("disabled"),J=!1,b(".plugin-compatibility-spinner").remove(),b(".plugin-compatibility-save").after(''+wpmdb_strings.saved+""),b(".plugin-compatibility-success-msg").fadeOut(2e3)}})}}),b("body").on("click",".delete-profile",function(){var a=b(this).next().clone();b("input",a).remove(),a=b.trim(b(a).html());var c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));if(c){var d=b(this).parent();if(d.find("input:checked").length){var e=d.siblings().last();if(e.find("input[type=radio]").prop("checked","checked"),e.find("input[type=text]").focus(),b("#migrate-form .crumbs .crumb:last").text("New Profile"),"function"==typeof window.history.pushState){var f=window.location.href.replace("#migrate","").replace(/&wpmdb-profile=-?\d+/,"")+"&wpmdb-profile=-1";window.history.pushState({updated_profile_id:-1},null,f)}}d.fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)},success:function(a){"-1"===a&&alert(wpmdb_strings.remove_profile_not_found)}})}}),b(".main-list-delete-profile-link").click(function(){var a=b(this).prev().html(),c=confirm(wpmdb_strings.remove_profile.replace("{{profile}}",a));c&&(b(this).parent().fadeOut(500),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_delete_migration_profile",profile_id:b(this).attr("data-profile-id"),nonce:wpmdb_data.nonces.delete_migration_profile},error:function(a,b,c){alert(wpmdb_strings.remove_profile_problem)}}))}),b("body").on("click",".temp-disabled",function(){var a=confirm(wpmdb_strings.change_connection_info);a&&(b(".ssl-notice").hide(),b(".different-plugin-version-notice").hide(),b(".migrate-db-button").show(),b(".temp-disabled").removeAttr("readonly"),b(".temp-disabled").removeClass("temp-disabled"),b(".connect-button").show(),b(".step-two").hide(),b(".connection-status").show().html(wpmdb_strings.enter_connection_info),D=!1)}),b(".settings-tab input[type=checkbox]").change(function(){if("plugin-compatibility"!==b(this).attr("id")){var a=b(this).is(":checked"),c=b(this).attr("id"),d=b(this).closest("td").next("td").find(".setting-status");b(".ajax-success-msg").remove(),d.after(ga),b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:{action:"wpmdb_save_setting",checked:a,setting:c,nonce:wpmdb_data.nonces.save_setting},error:function(a,c,d){alert(wpmdb_strings.save_settings_problem),b(".ajax-spinner").remove()},success:function(a){b(".ajax-spinner").remove(),d.append(''+wpmdb_strings.saved+""),b(".ajax-success-msg").fadeOut(2e3,function(){b(this).remove()})}})}}),b(".migrate-form").submit(function(a){a.preventDefault()}),b(".connect-button").click(function(a){a.preventDefault(),b(this).blur(),ta()}),b(".pull-push-connection-info").bind("paste",function(a){setTimeout(function(){ta()},0)}),b("body").on("click",".try-again",function(){b(".pull-push-connection-info").removeClass("temp-disabled"),ta()}),b("body").on("click",".try-http",function(){var a=b.trim(b(".pull-push-connection-info").val()).split("\n"),c=a[0].replace("https","http"),d=c+"\n"+a[1];b(".pull-push-connection-info").val(d),ta()}),b(".create-new-profile").change(function(){K=!0}),b("body").on("click",".temporarily-disable-ssl",function(){var a="";window.location.hash&&(a=window.location.hash.substring(1)),b(this).attr("href",b(this).attr("href")+"&hash="+a)}),b("body").on("click",".pause-resume",function(a){p(a)}),b("body").on("click",".cancel",function(a){ua(a)}),b(".enter-licence").click(function(){b(".settings").click(),b(".licence-input").focus()}),c.functions.execute_next_step=function(){if(aa>0&&!1===_)return void setTimeout(function(){_=!0,c.functions.execute_next_step()},aa);if(_=!1,!0===U){b(".migration-progress-ajax-spinner").hide(),c.current_migration.pauseTimer();var a="";return!0===da?(a=wpmdb_strings.paused_before_finalize,da=!1,"find_replace"===wpmdb_migration_type()&&(a=wpmdb_strings.find_replace_paused_before_finalize)):a=wpmdb_strings.paused,c.current_migration.setState(null,a,"paused"),b("body").on("click",".pause-resume",function(a){p(a)}),b("body").on("click",".cancel",function(a){ua(a)}),void b(".pause-resume").html(wpmdb_strings.resume)}if(!0===$){x=wpmdb_migration_type();var d;"savefile"===x?d=wpmdb_strings.removing_local_sql:"pull"===x?d="backup"===B?wpmdb_strings.removing_local_backup:wpmdb_strings.removing_local_temp_tables:"push"===x&&(d="backup"===B?wpmdb_strings.removing_remote_sql:wpmdb_strings.removing_remote_temp_tables),c.current_migration.setText(d);var e={action:"wpmdb_cancel_migration",migration_state_id:c.migration_state_id,nonce:wpmdb_data.nonces.cancel_migration};F=!0,b.ajax({url:ajaxurl,type:"POST",dataType:"text",cache:!1,data:e,error:function(a,b,d){c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,wpmdb_strings.manually_remove_temp_files+"

    "+wpmdb_strings.status+": "+a.status+" "+a.statusText+"

    "+wpmdb_strings.response+":
    "+a.responseText,"error"),console.log(a),console.log(b),console.log(d),F=!1,c.common.migration_error=!0,c.functions.migration_complete_events()},success:function(a){return F=!1,a=b.trim(a),"push"===x&&"1"!==a||"push"!==x&&""!==a?(c.current_migration.setState(wpmdb_strings.migration_cancellation_failed,a,"error"),c.common.migration_error=!0,void c.functions.migration_complete_events()):(C=wpmdb_strings.migration_cancelled,"find_replace"===x&&(C=wpmdb_strings.find_replace_cancelled),c.functions.migration_complete_events(),void c.current_migration.setStatus("cancelled"))}})}else c.common.next_step_in_migration.fn.apply(null,c.common.next_step_in_migration.args)},b("body").on("click",".copy-licence-to-remote-site",function(){b(".connection-status").html(wpmdb_strings.copying_license),b(".connection-status").removeClass("notification-message error-notice migration-error"),b(".connection-status").append(ga);var a=b.trim(b(".pull-push-connection-info").val()).split("\n");F=!0,m(),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_copy_licence_to_remote_site",url:a[0],key:a[1],nonce:wpmdb_data.nonces.copy_licence_to_remote_site},error:function(a,c,d){b(".connection-status").html(pa(a.responseText,"(#143)",a)),b(".connection-status").addClass("notification-message error-notice migration-error"),b(".ajax-spinner").remove(),F=!1,n()},success:function(a){return b(".ajax-spinner").remove(),F=!1,n(),"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?(b(".connection-status").html(a.body),b(".connection-status").addClass("notification-message error-notice migration-error"),void(a.body.indexOf("401 Unauthorized")>-1&&b(".basic-access-auth-wrapper").show())):void ta()}})}),b("body").on("click",".reactivate-licence",function(a){F=!0,b(".invalid-licence").empty().html(wpmdb_strings.attempting_to_activate_licence),b(".invalid-licence").append(ga),b.ajax({url:ajaxurl,type:"POST",dataType:"json",cache:!1,data:{action:"wpmdb_reactivate_licence",nonce:wpmdb_data.nonces.reactivate_licence},error:function(a,c,d){b(".invalid-licence").html(wpmdb_strings.activate_licence_problem),b(".invalid-licence").append("

    "+wpmdb_strings.status+": "+a.status+" "+a.statusText+"

    "+wpmdb_strings.response+"
    "+a.responseText),b(".ajax-spinner").remove(),F=!1},success:function(a){return b(".ajax-spinner").remove(),F=!1,"undefined"!=typeof a.wpmdb_error&&1===a.wpmdb_error?void b(".invalid-licence").html(a.body):"undefined"!=typeof a.wpmdb_dbrains_api_down&&1===a.wpmdb_dbrains_api_down?(b(".invalid-licence").html(wpmdb_strings.temporarily_activated_licence),void b(".invalid-licence").append(a.body)):(b(".invalid-licence").empty().html(wpmdb_strings.licence_reactivated),void location.reload())}})}),b("input[name=table_migrate_option]").change(function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b("body").on("change","#select-tables",function(){h(),b.wpmdb.do_action("wpmdb_tables_to_migrate_changed")}),b.wpmdb.add_filter("wpmdb_get_table_prefix",t),b.wpmdb.add_filter("wpmdb_get_tables_to_migrate",s),b.wpmdb.add_action("wpmdb_lock_replace_url",u),b.wpmdb.add_action("move_connection_info_box",ka),b.wpmdb.add_filter("wpmdb_before_migration_complete_hooks",function(a){return ca=!!b("input[name=pause_before_finalize]:checked").length,!0===ca&&"savefile"!==x&&(p(null),da=!0),a}),b(".wpmdb-switch").on("click",function(a){b(this).hasClass("disabled")||va(b(this).attr("id"))})})}(jQuery,wpmdb)},{"MigrationProgress-controller":1}]},{},[1,2,3,4,5,6,7]);