Current File : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/backwpup/assets/js//backup-downloader.min.js
window.BWU=window.BWU||{},function(e,t,i,s,n){var r,o,c;function a(){this.closeEventSource(),this.cleanUi(),this.decrypter&&this.decrypter.destruct()}function d(e){e&&(e.style.display="none")}function h(e){e&&(e.style.display="block")}s?"EventSource"in window?(c={showWaitingMessage:function(){h(this.waitingUi)},showProgressUi:function(){h(this.progressUi)},showSuccessMsg:function(){h(this.successUi)},hideWaitingMessage:function(){d(this.waitingUi)},hideProgressUi:function(){d(this.progressUi)},hideNotice:function(){i.Functions.removeMessages(this.containerUi)},hideSuccessMsg:function(){d(this.successUi)},cleanUi:function(){this.hideWaitingMessage(),this.hideProgressUi(),this.hideNotice(),this.hideSuccessMsg(),this.decrypter&&this.decrypter.hide()},done:function(){this.showSuccessMsg(),window.location.href=this.currentTarget.dataset.url,setTimeout(n,3e3)},onMessage:function(t){var s;try{switch((s=JSON.parse(t.data)).state){case i.States.DOWNLOADING:this.cleanUi(),this.showProgressUi(),e("#progresssteps").css({width:s.download_percent+"%"}).text(s.download_percent+"%");break;case i.States.DONE:this.done(s.message)}}catch(e){i.Functions.printMessageError(e.message,this.containerUi),a.call(this)}},onError:function(e){var t=JSON.parse(e.data);if(this.closeEventSource(),t.message===i.States.NEED_DECRYPTION_KEY)this.cleanUi(),this.decrypter&&this.decrypter.needDecryption(t.status);else i.Functions.printMessageError(t.message,this.containerUi),a.call(this);return this},initializeEventSource:function(){t.isUndefined(this.eventSource)&&(this.eventSource=new EventSource(s+"?action=download_backup_file&destination="+this.currentTarget.dataset.destination+"&jobid="+this.currentTarget.dataset.jobid+"&file="+this.currentTarget.dataset.file+"&local_file="+this.currentTarget.dataset.localFile+"&backwpup_action_nonce="+this.currentTarget.dataset.nonce),this.eventSource.onmessage=this.onMessage,this.eventSource.addEventListener("log",this.onError))},closeEventSource:function(){t.isUndefined(this.eventSource)||(this.eventSource.close(),this.eventSource=void 0)},startDirectDownload:function(e){const t=e.currentTarget.getAttribute("data-href"),i=document.createElement("a");i.href=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)},startDownload:function(e){tb_show("Download Backup",e.currentTarget.getAttribute("data-href"),!1),e.preventDefault(),this.currentTarget=e.currentTarget,this.showWaitingMessage(),this.initializeEventSource()},decrypt:function(){this.cleanUi(),this.decrypter&&this.decrypter.decrypt({backwpup_action_nonce:this.currentTarget.dataset.nonce,encrypted_file_path:this.currentTarget.dataset.localFile})},construct:function(e){var i=document.querySelector("#tb_container");return!!i&&(t.bindAll(this,"showWaitingMessage","hideWaitingMessage","showProgressUi","hideSuccessMsg","showSuccessMsg","done","onMessage","onError","initializeEventSource","closeEventSource","startDownload","addListeners","decrypt","hideNotice","cleanUi","init"),this.containerUi=i,this.waitingUi=this.containerUi.querySelector("#download-file-waiting"),this.progressUi=this.containerUi.querySelector(".progressbar"),this.successUi=this.containerUi.querySelector("#download-file-success"),this.currentTarget=void 0,this.eventSource=void 0,this.decrypter=e,this)},addListeners:function(){return t.forEach(document.querySelectorAll(".js-backwpup-direct-download-backup"),function(e){e.addEventListener("click",this.startDirectDownload)}.bind(this)),t.forEach(document.querySelectorAll(".js-backwpup-download-backup"),function(e){e.addEventListener("click",this.startDownload)}.bind(this)),e("#submit_decrypt_key").on("click",this.decrypt),e("body").on("thickbox:removed",function(){a.call(this)}.bind(this)),this.decrypter&&e("body").on(this.decrypter.ACTION_DECRYPTION_SUCCESS,this.done),this},init:function(){return this.addListeners(),this}},r=Object.create(c),t.isUndefined(i.DecrypterFactory)||(o=i.DecrypterFactory(s,document.querySelector("#decrypt_key"),document.querySelector("#decryption_key"))),r.construct(o)&&(window.BWU.downloader=r.init())):console.warn("Event Source does not exist in this browser"):console.warn("Missing ajaxurl value.")}(window.jQuery,window._,window.BWU,window.ajaxurl,window.tb_remove);