{"size": 15114, "ext": "js", "max_stars_repo_path": "plugin/FileRun/js/flow/all-standalone.min.js", "max_stars_repo_name": "nev3rmi/PHPTemplateV2", "max_stars_repo_stars_event_min_datetime": "2018-02-23T11:01:05.000Z", "max_stars_repo_stars_event_max_datetime": "2018-02-23T11:01:05.000Z", "max_issues_repo_path": "plugin/FileRun/js/flow/all-standalone.min.js", "max_issues_repo_name": "nev3rmi/PHPEasyTemplate", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "plugin/FileRun/js/flow/all-standalone.min.js", "max_forks_repo_name": "nev3rmi/PHPEasyTemplate", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 15114.0, "max_line_length": 15114, "alphanum_fraction": 0.7784173614}
function FlowChunk(a,b,c){this.flowObj=a,this.fileObj=b,this.fileObjSize=b.size,this.offset=c,this.retries=0,this.pendingRetry=!1,this.loaded=0,this._lastLoaded=0,this.total=0,this.flowObj.opts.chunkSize?this.startByte=b.offset+this.offset*this.flowObj.opts.chunkSize:this.startByte=0,this.flowObj.opts.chunkSize?this.endByte=Math.min(this.fileObjSize,this.startByte+this.flowObj.opts.chunkSize):this.endByte=this.fileObjSize,this.size=this.endByte-this.startByte,this.xhr=null;var d=this;this.progressHandler=function(a){if(a.lengthComputable){if(d.loaded=Math.min(a.loaded,d.size),d.total=Math.min(a.total,d.size),d.loaded>d._lastLoaded){var b=d.loaded-d._lastLoaded;d.fileObj.completedBytes+=b,d.flowObj.completedBytes+=b}d._lastLoaded=d.loaded}d.fileObj.chunkEvent("progress")},this.doneHandler=function(a){var b=d.status(),c=d.message();if("success"===b)d.retries=0,d.fileObj.completedChunks++,d.fileObj.chunkEvent("success",c);else if(d.fileObj.uploadingChunk=!1,d.abort(),"error"===b)d.retries=0,d.fileObj.chunkEvent("error",c);else if(d.retries<d.flowObj.opts.maxChunkRetries){d.retries++;var e=d.flowObj.opts.chunkRetryInterval;null!==e?(d.retries>1&&(e*=d.retries),setTimeout(function(){d.send()},e)):d.send()}else d.retries=0,d.fileObj.chunkEvent("error",c)}}function FlowFile(a,b){this.flowObj=a,this.file=b,this.size=b.size,this.name=b.fileName||b.name;var c=/(iPad|iPhone|iPod)/g.test(navigator.userAgent);if(c&&"image"==this.name.substring(0,5)&&(this.name="image_"+this.size+this.name.substring(5)),this.relativePath=b.relativePath||b.webkitRelativePath||!1,this.relativePath&&this.relativePath!=this.name){baseNameStartPos=this.relativePath.length-this.name.length;var d=this.relativePath.substring(baseNameStartPos);d==this.name&&(this.relativePath=this.relativePath.substring(0,baseNameStartPos))}this.uniqueIdentifier=a.generateUniqueIdentifier(b),this.offset=0,this.chunks=[],this.uploadingChunk=!1,this.completedChunks=0,this.completedBytes=0,this.lastCompletedBytes=0,this.complete=!1,this.uploading=!1,this.paused=!1,this.progress=0,this.queuePaused=!1,this.error=!1,this.averageSpeed=0,this.currentSpeed=0,this._lastProgressCallback=Date.now(),this._prevTransferredSize=0}function Flow(a){this.files=[],this.paused=!1,this.averageSpeed=0,this.completedFiles=0,this.uploadingFiles=0,this.size=0,this.completedBytes=0,this.defaults={chunkSize:!1,singleFile:!1,fileParameterName:"file",progressCallbacksInterval:500,speedSmoothingFactor:.1,query:{},headers:{},withCredentials:!1,target:"/",generateUniqueIdentifier:null,maxChunkRetries:0,resumeLargerThan:0,chunkRetryInterval:null,maxSimultaneous:1},this.opts={},this.events={};var b=this;this.onDrop=function(a){a.stopPropagation(),a.preventDefault();var c=a.dataTransfer;c||(c=a.clipboardData),c.items&&c.items[0]&&c.items[0].webkitGetAsEntry?b.webkitReadDataTransfer(a):b.addFiles(c.files,a)},this.opts=this.extend({},this.defaults,a||{})}FlowChunk.prototype={getParams:function(){var a={flowTotalSize:this.fileObjSize,flowIsFirstChunk:0==this.startByte?1:0,flowIsLastChunk:this.endByte==this.fileObjSize?1:0};return this.fileObj.relativePath&&(a.flowRelativePath=this.fileObj.relativePath),navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&(a.flowFilename=this.fileObj.name),a},getTarget:function(a){var b=this.flowObj.opts.target;return b+=b.indexOf("?")<0?"?":"&",b+a.join("&")},send:function(){this.fileObj.uploadingChunk=this,this.loaded=0,this._lastLoaded=0,this.total=0,this.pendingRetry=!1;var a=this.fileObj.file.slice?"slice":this.fileObj.file.mozSlice?"mozSlice":this.fileObj.file.webkitSlice?"webkitSlice":"slice",b=this.fileObj.file[a](this.startByte,this.endByte);this.xhr=new XMLHttpRequest,this.xhr.upload.addEventListener("progress",this.progressHandler,!1),this.xhr.addEventListener("load",this.doneHandler,!1),this.xhr.addEventListener("error",this.doneHandler,!1);var c=this.prepareXhrRequest(b);this.xhr.send(c)},abort:function(){this.xhr&&(this.xhr.abort(),this.loaded&&(this.fileObj.completedBytes-=this.loaded,this.flowObj.completedBytes-=this.loaded)),this.fileObj.chunkEvent("abort")},status:function(){return this.pendingRetry?"uploading":this.xhr?this.xhr.readyState<4?"uploading":this.flowObj.opts.validateChunkResponse.call(this.flowObj.opts.validateChunkResponseScope||this,this.xhr.status,this.xhr.responseText):"pending"},message:function(){return this.xhr?this.xhr.responseText:""},prepareXhrRequest:function(a){var b=this.flowObj.opts.query;"function"==typeof b&&(b=b(this.fileObj,this)),b=this.flowObj.extend(this.getParams(),b);var c=new FormData;return this.flowObj.each(b,function(a,b){c.append(b,a)}),c.append(this.flowObj.opts.fileParameterName,a,this.fileObj.name),this.xhr.open("POST",this.flowObj.opts.target),this.xhr.withCredentials=this.flowObj.opts.withCredentials,this.flowObj.each(this.flowObj.opts.headers,function(a,b){this.xhr.setRequestHeader(b,a)},this),c}},FlowFile.prototype={measureSpeed:function(){var a=Date.now()-this._lastProgressCallback;if(a){var b=this.flowObj.opts.speedSmoothingFactor;this.currentSpeed=Math.max((this.completedBytes-this._prevTransferredSize)/a*1e3,0),this.averageSpeed=b*this.currentSpeed+(1-b)*this.averageSpeed,this.flowObj.averageSpeed=this.averageSpeed,this._prevTransferredSize=this.completedBytes}},chunkEvent:function(a,b){switch(a){case"progress":if(Date.now()-this._lastProgressCallback<this.flowObj.opts.progressCallbacksInterval)break;this.reportProgress();break;case"error":this.error=!0,this.paused=!0,this.flowObj.paused=!0,this.flowObj.completedBytes-=this.completedBytes,this.completedBytes=0,this.reset(),this.flowObj.onFileError(this,b);break;case"success":this.error=!1,this.paused=!1,this.removeUploadingChunk(this.uploadingChunk),this.completedChunks==this.chunks.length?(this.reportProgress(),this.uploading=!1,this.complete=!0,this.currentSpeed=0,this.averageSpeed=0,this.flowObj.onFileSuccess(this,b),this.file=null):this.uploadNextChunk();break;case"retry":this.flowObj.fire("fileRetry",this)}},reportProgress:function(){this.measureProgress(),this.measureSpeed(),this.flowObj.fire("fileProgress",this),this.flowObj.fire("progress",this.flowObj),this._lastProgressCallback=Date.now()},uploadNextChunk:function(){this.paused||this.flowObj.each(this.chunks,function(a){if(a&&"pending"===a.status())return a.send(),!1})},getOffsetHandler:function(a){this.offset=0;var b=this.xhr.status,c=this.xhr.responseText;this.xhr=null;var d=this.flowObj.opts.validateGetOffsetResponse.call(this.flowObj.opts.validateGetOffsetResponseScope||this,this,b,c);d?(this.lastCompletedBytes=this.completedBytes,this.completedBytes=this.offset,this.lastCompletedBytes>0&&(this.flowObj.completedBytes-=this.lastCompletedBytes),this.flowObj.completedBytes+=this.offset,this.prepareChunks(),this.uploadNextChunk()):(this.error=!0,this.uploading=!1,this.flowObj.onFileError(this,c))},getOffset:function(){this.xhr=new XMLHttpRequest,this.xhr.addEventListener("load",this.getOffsetHandler.bind(this),!1),this.xhr.addEventListener("error",this.getOffsetHandler.bind(this),!1);var a=this.flowObj.opts.query;"function"==typeof a&&(a=a(this));var b={flowGetOffset:1,flowTotalSize:this.size,flowFilename:this.name};this.relativePath&&(b.flowRelativePath=this.relativePath),a=this.flowObj.extend(b,a);var c=this.flowObj.opts.target,d=new FormData;this.flowObj.each(a,function(a,b){d.append(b,a)}),this.xhr.open("POST",c),this.xhr.withCredentials=this.flowObj.opts.withCredentials,this.flowObj.each(this.flowObj.opts.headers,function(a,b){this.xhr.setRequestHeader(b,a)},this),this.xhr.send(d)},reset:function(){this.paused=!1,this.queuePaused=!1,this.uploading=!1,this.currentSpeed=0,this.averageSpeed=0,this.offset=0,this.uploadingChunk=!1,this.completedChunks=0,this.chunks=[]},pause:function(a){if(this.complete)return!1;var b;this.uploading&&(this.uploadingChunk&&this.uploadingChunk.abort(),b=!0),this.reset(),a&&(this.queuePaused=!0),this.paused=!0,this.flowObj.onFilePause(this,a,b)},start:function(){return!this.complete&&(this.reset(),this.uploading=!0,this.flowObj.onFileStart(),void(!this.flowObj.opts.chunkSize||this.size<this.flowObj.opts.chunkSize&&this.size<this.flowObj.opts.resumeLargerThan?(this.prepareChunks(),this.uploadNextChunk()):this.getOffset()))},prepareChunks:function(){if(this.flowObj.opts.chunkSize>0)var a=Math.max(Math.ceil((this.file.size-this.offset)/this.flowObj.opts.chunkSize),1);else var a=1;for(var b=0;b<a;b++)this.chunks.push(new FlowChunk(this.flowObj,this,b))},removeUploadingChunk:function(){for(var a=this.chunks.length,b=0;b<a;b++)if(this.chunks[b]==this.uploadingChunk)return this.uploadingChunk=null,this.chunks[b]=null,!0;return!1},measureProgress:function(){this.error?this.progress=0:this.complete?this.progress=1:0==this.size&&0==this.completedBytes?this.progress=1:this.progress=this.completedBytes/this.size},timeRemaining:function(){if(this.paused||this.error||this.complete)return 0;var a=this.size-this.completedBytes;return a&&!this.averageSpeed?Number.POSITIVE_INFINITY:a||this.averageSpeed?Math.floor(a/this.averageSpeed):0}},Flow.prototype={on:function(a,b){a=a.toLowerCase(),this.events.hasOwnProperty(a)||(this.events[a]=[]),this.events[a].push(b)},off:function(a,b){void 0!==a?(a=a.toLowerCase(),void 0!==b?this.events.hasOwnProperty(a)&&arrayRemove(this.events[a],b):delete this.events[a]):this.events={}},fire:function(a,b){b=Array.prototype.slice.call(arguments),a=a.toLowerCase();var c=!1;return this.events.hasOwnProperty(a)&&this.each(this.events[a],function(a){c=a.apply(this,b.slice(1))===!1||c}),"catchall"!=a&&(b.unshift("catchAll"),c=this.fire.apply(this,b)===!1||c),!c},webkitReadDataTransfer:function(a){function e(a){c+=a.length,b.each(a,function(a){if(a.isFile){var b=a.fullPath;a.file(function(a){f(a,b)},g)}else a.isDirectory&&a.createReader().readEntries(e,g)}),h()}function f(a,b){a.relativePath=b,d.push(a),h()}function g(a){throw a}function h(){0==--c&&b.addFiles(d,a)}var b=this,c=a.dataTransfer.items.length,d=[];this.each(a.dataTransfer.items,function(a){var b=a.webkitGetAsEntry();return b?void(b.isFile?f(a.getAsFile(),b.fullPath):b.createReader().readEntries(e,g)):void h()})},generateUniqueIdentifier:function(a){var b=this.opts.generateUniqueIdentifier;if("function"==typeof b)return b(a);var c=a.relativePath||a.webkitRelativePath||a.fileName||a.name;return a.size+"-"+c.replace(/[^0-9a-zA-Z_-]/gim,"")},browseFiles:function(a,b){FlowUtils.browseFiles({entireFolder:a,singleFile:b,onSelect:function(a,b){a.length>0&&this.addFiles(a,b)},scope:this})},start:function(){this.paused=!1,this.uploadNextFile(),this.fire("uploadStart")},uploadNextFile:function(){if(this.paused)return!1;var a=0,b=0,c=!0;this.each(this.files,function(d){if(!d.complete)if(d.queuePaused)a++;else if(d.uploading)b++;else{if(!(this.uploadingFiles<this.opts.maxSimultaneous))return!1;c=!1,d.start()}},this),!c||a||b||this.fire("complete")},pause:function(){this.paused=!0,this.each(this.files,function(a){a.queuePaused||a.paused||a.complete||a.pause()}),this.uploadingFiles=0},removeAll:function(){for(var a=this.files.length-1;a>=0;a--)this.removeFile(this.files[a]);this.averageSpeed=0,this.uploadingFiles=0},getProgress:function(){return 0==this.size&&0==this.completedBytes?1:this.completedBytes/this.size},onFileSuccess:function(a,b){this.uploadingFiles--,this.completedFiles++,this.fire("progress",this),this.fire("fileSuccess",a,b),this.uploadNextFile()},onFileError:function(a,b){this.uploadingFiles--,this.fire("fileError",a,b),this.fire("error",b,a)},onFilePause:function(a,b,c){c&&this.uploadingFiles--,b&&this.uploadNextFile(),this.fire("fileProgress",a)},onFileStart:function(){this.uploadingFiles++},addFile:function(a,b){this.addFiles([a],b)},addFiles:function(a,b){this.each(a,function(a){if(this.opts.singleFile&&this.files.length>0)return!1;if((a.size%4096!==0||"."!==a.name&&"."!==a.fileName)&&!this.getFromUniqueIdentifier(this.generateUniqueIdentifier(a))){var c=new FlowFile(this,a);this.fire("fileAdded",c,b)&&(this.files.push(c),this.size+=c.size)}},this),this.fire("filesSubmitted",this.files,b),this.opts.startOnSubmit&&this.start()},removeFile:function(a){for(var b=!1,c=this.files.length-1;c>=0;c--)this.files[c]===a&&(this.size-=a.size,a.uploading&&(a.uploadingChunk&&a.uploadingChunk.abort(),b=!0,this.uploadingFiles--),a.complete&&this.completedFiles--,this.completedBytes-=a.completedBytes,a=null,this.files.splice(c,1));return b&&this.uploadNextFile(),!0},getFromUniqueIdentifier:function(a){var b=!1;return this.each(this.files,function(c){c.uniqueIdentifier===a&&(b=c)}),b},timeRemaining:function(){var a=this.size-this.completedBytes;return a&&!this.averageSpeed?Number.POSITIVE_INFINITY:a||this.averageSpeed?Math.floor(a/this.averageSpeed):0},arrayRemove:function(a,b){var c=a.indexOf(b);c>-1&&a.splice(c,1)},extend:function(a,b){return this.each(arguments,function(b){b!==a&&this.each(b,function(b,c){a[c]=b})},this),a},each:function(a,b,c){if(a)if("undefined"!=typeof a.length){for(var d=0;d<a.length;d++)if(b.call(c,a[d],d)===!1)return}else for(var d in a)if(a.hasOwnProperty(d)&&b.call(c,a[d],d)===!1)return}};var FlowUtils={browserSupport:{files:"undefined"!=typeof window.File&&"undefined"!=typeof Blob&&"undefined"!=typeof window.FileList&&("undefined"!=typeof Blob.prototype.slice||"undefined"!=typeof Blob.prototype.webkitSlice||"undefined"!=typeof Blob.prototype.mozSlice),folders:!0},browseFiles:function(a){var b=document.createElement("input");b.setAttribute("type","file"),a.singleFile||(b.setAttribute("multiple","multiple"),a.entireFolder&&(b.setAttribute("webkitdirectory","webkitdirectory"),b.setAttribute("directory","directory"))),b.style.display="none",b.addEventListener("change",function(b){a.onSelect.call(a.scope,b.target.files,b),document.body.removeChild(this)},!1),document.body.appendChild(b),b.click()}};FlowUtils.DropZone=function(a){FlowUtils.browserSupport.files&&(this.opts=a,a.domNode.addEventListener("dragenter",function(a){a.preventDefault();var b=this.opts.findTarget.call(this.opts.scope,a,this);b&&this.manager.addHighLight(b,this.opts.overClass)}.bind(this),!1),a.domNode.addEventListener("dragover",function(a){a.dataTransfer.dropEffect="copy",a.stopPropagation(),a.preventDefault()}.bind(this),!1),a.domNode.addEventListener("drop",function(a){if(a.stopPropagation(),a.preventDefault(),this.manager.removeHighlight(),0==a.dataTransfer.files.length)return FR.UI.feedback&&FR.UI.feedback(FR.T("To upload files, drag them from your computer")),!1;var b=this.opts.findTarget.call(this.opts.scope,a,this);b&&this.opts.onDrop.call(this.opts.scope,a,b)}.bind(this),!1))},FlowUtils.DropZoneManager={zones:[],lastTarget:!1,add:function(a){if(FlowUtils.browserSupport.files){var b=new FlowUtils.DropZone(a);b.manager=this,this.zones.push(b),this.lastHighlight||(this.lastHighlight=new Ext.util.DelayedTask(function(){this.removeHighlight()},this))}},addHighLight:function(a,b){var c=this.lastTarget;c&&c.el.classList.remove(c.cls),a.el.classList.add(b),this.lastTarget={el:a.el,cls:b},this.lastHighlight.delay(3e3)},removeHighlight:function(){this.lastTarget&&this.lastTarget.el.classList.remove(this.lastTarget.cls)}};