Your IP : 3.131.13.161
(function(){var e=function(e,s,t,o){this.onDestroyEventName=null;this.shouldDestroyOnEnd=false;this.loaderContainer=BX.create("DIV",{props:{className:"mobile-uploader-rotating"}});this.cancelLayout=BX.create("DIV",{props:{className:"mobile-upload-cancel"},attrs:{"data-task-id":e}});this.loaderWrapper=BX.create("DIV",{props:{className:"mobile-uploader-loader-wrapper"},children:[this.loaderOverlay=BX.create("DIV",{attrs:{id:"container_"+e},props:{className:"mobile-uploader-loader"},children:[this.cancelLayout,this.loaderContainer]})]});if(!o){o=this.loaderWrapper}if(o){this.proccessingLabel=BX.create("DIV",{props:{className:"mobile-upload-processing"},attrs:{style:"display:none"},html:BX.message("MUI_PROCESSING")});this.loaderWrapper.appendChild(this.proccessingLabel)}BX.bind(this.loaderContainer,"click",BX.proxy(function(){if(this.bar.value()<1){BX.MobileUploadProvider.cancelTasks([e])}},this));this.imageLayout=t;if(this.imageLayout){BX.addClass(this.imageLayout,"mobile-uploader-img-blurred")}s.appendChild(this.loaderWrapper);this.createProgress();this.setProgress(4)};e.prototype.setProcessingVisibility=function(e,s){if(!this.proccessingLabel)return;if(e){BX.show(this.proccessingLabel)}else{if(s===true){this.proccessingLabel.style.opacity=0}else{BX.hide(this.proccessingLabel)}}};e.prototype.createProgress=function(){this.bar=new BX.ProgressBarJs.Circle(this.loaderContainer,{easing:"linear",strokeWidth:4,color:"#ffffff",from:{color:"#ffffff"},to:{color:"#ffffff"},step:BX.proxy(function(e,s){if(s.value()==1){this.isBeingEnd=true;this.cancelLayout.style.transform="scale(0)";setTimeout(BX.proxy(function(){BX.addClass(this.cancelLayout,"mobile-upload-done");setTimeout(BX.proxy(function(){this.cancelLayout.style.transform="scale(1)";this.isBeingEnd=false;if(this.shouldDestroyOnEnd){setTimeout(BX.proxy(this.destroy,this),300)}},this),200)},this),200);if(this.onDestroyEventName==null){this.destroy()}}},this)})};e.prototype.setProgress=function(e){console.log(e);this.bar.animate(e/100,{duration:500})};e.prototype.setByteSent=function(e,s){this.proccessingLabel.innerHTML=(e/1024/1024).toFixed(2)+" MB "+" / "+(s/1024/1024).toFixed(2)+" MB"};e.prototype.destroy=function(){if(this.isBeingEnd){this.shouldDestroyOnEnd=true}else{BX.removeClass(this.imageLayout,"mobile-uploader-img-blurred");this.loaderOverlay.style.opacity=0;this.setProcessingVisibility(false,true);this.bar.destroy()}};window.loader=e;BX.MobileUploaderConst={FILE_CREATED:"onfilecreated",FILE_CREATED_FAILED:"onerrorfilecreate",FILE_UPLOAD_PROGRESS:"onprogress",FILE_UPLOAD_START:"onloadstart",FILE_UPLOAD_FAILED:"onfileuploadfailed",FILE_READ_ERROR:"onfilereaderror",FILE_PROCESSING:"onfileprocessing",FILE_PROCESSING_DONE:"onfileprocessingdone",ALL_TASK_COMPLETED:"oncomplete",TASK_TOKEN_DEFINED:"ontasktokendefined",TASK_STARTED_FAILED:"onloadstartfailed",TASK_CREATED:"ontaskcreated",TASK_CANCELLED:"ontaskcancelled",TASK_NOT_FOUND:"ontasknotfound"};BX.MobileUploadProvider={setListener:function(e){this.listener=e},toBXUrl:function(e){return"bx"+e},cancelTasks:function(e){BXMobileApp.onCustomEvent("onFileUploadTaskCancel",{taskIds:e},true)},removeTasks:function(e){e.forEach(BX.proxy(function(e){if(this.loaders[e]){this.loaders[e].destroy();this.loaders[e]=null}var s=this.taskIds.indexOf(e);if(s>=0){if(this.taskIds.length==1){this.taskIds=[]}else{this.taskIds.splice(s,1)}}},this))},attachToTasks:function(e){this.registerTaskLoaders(e);BXMobileApp.onCustomEvent("onFileUploadTaskRequest",{files:e},true)},registerTaskLoaders:function(s){this.removeTasks(s.map(function(e){return e.taskId}));s.forEach(BX.proxy(function(s){if(s.progressNode){this.loaders[s.taskId]=new e(s.taskId,s.progressNode,s.imageNode,s.progressNode);if(s.onDestroyEventName){this.loaders[s.taskId].onDestroyEventName=s.onDestroyEventName}}this.taskIds.push(s.taskId)},this))},addTasks:function(e){this.registerTaskLoaders(e);BXMobileApp.onCustomEvent("onFileUploadTaskReceived",{files:e},true)},init:function(){this.taskIds=[];this.loaders={};BXMobileApp.addCustomEvent("onFileUploadStatusChanged",BX.proxy(function(e){if(this.loaders[e.taskId]){var s=this.loaders[e.taskId];if(e.event==this.loaders[e.taskId].onDestroyEventName){s.destroy()}else if(e.event==BX.MobileUploaderConst.FILE_UPLOAD_PROGRESS){if(e.data.byteTotal/1024/2024>2){s.setProcessingVisibility(true);s.setByteSent(e.data.byteSent,e.data.byteTotal)}else{s.setProcessingVisibility(false)}s.setProgress(e.data.percent)}else if(e.event==="onfileprocessing"){s.setProcessingVisibility(true)}}if(this.listener&&this.taskIds.indexOf(e.taskId)>-1){this.listener.call(null,e.event,e.data,e.taskId)}},this))}};BX.MobileUploadProvider.init()})();
//# sourceMappingURL=uploader.map.js