(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/smb/app/progress"],{1155:(e,s,t)=>{"use strict";t.r(s);var r=t(148),n=t.n(r),o=t(144);class i extends o.Component{constructor(...e){super(...e),n()(this,"STATUS_STARTED",0),n()(this,"STATUS_NOT_STARTED",1),n()(this,"STATUS_DONE",2),n()(this,"STATUS_ERROR",3)}_initConfiguration(e){super._initConfiguration({locale:o.Locale.getSection("smb.components.elements.download"),...e}),setTimeout((()=>{this.updateProgress()}),1e3)}_initComponentElement(){this._progressTextElement=new Element("div",{class:"progress-label"}),this._progressBarElement=new Element("div",{class:"progress"}),this._progressBarElement.innerHTML='<div class="progress-bar"></div>',this._componentElement=new Element("div",{class:"progress-box app-progress-panel"}),this._componentElement.appendChild(this._progressTextElement),this._componentElement.appendChild(this._progressBarElement),this._update(0)}_update(e){e=Math.max(e,1),this._progressTextElement.innerHTML=this.lmsg("progress",{percents:e}),this._progressBarElement.querySelectorAll("div.progress-bar").forEach((s=>{s.style.width="".concat(e,"%")}))}updateProgress(){new Ajax.Request(this._getConfigParam("requestUrl"),{method:"get",onSuccess:e=>{try{const s=JSON.parse(e.responseText);if(s.progress&&this._update(s.progress),s.status===this.STATUS_STARTED||s.status===this.STATUS_NOT_STARTED)return void setTimeout((()=>{this.updateProgress()}),this._getConfigParam("timeout",1e3));s.url=s.url?s.url:this._getConfigParam("redirectUrl").replace("%packageId%",s.packageId).replace("%resourceId%",s.resourceId),s.method=this._getConfigParam("redirectMethod","get"),(0,o.redirect)(s)}catch(e){}}})}}s.default=e=>{new i(e)}}}]);
//# sourceMappingURL=progress.js.map?be7932bf8a6953d57d8e