UNPKG

@mofiter/osc-file-uploader

Version:

文件上传模块

2 lines 56.8 kB
function _regeneratorRuntime(){_regeneratorRuntime=function(){return o};var o={},t=Object.prototype,u=t.hasOwnProperty,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",i=e.asyncIterator||"@@asyncIterator",n=e.toStringTag||"@@toStringTag";function s(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,i){return t[e]=i}}function a(t,e,i,r){var n,s,o,a,e=e&&e.prototype instanceof c?e:c,e=Object.create(e.prototype),r=new _(r||[]);return e._invoke=(n=t,s=i,o=r,a="suspendedStart",function(t,e){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===t)throw e;return E()}for(o.method=t,o.arg=e;;){var i=o.delegate;if(i){i=function t(e,i){var r=e.iterator[i.method];if(void 0===r){if(i.delegate=null,"throw"===i.method){if(e.iterator.return&&(i.method="return",i.arg=void 0,t(e,i),"throw"===i.method))return l;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}r=h(r,e.iterator,i.arg);if("throw"===r.type)return i.method="throw",i.arg=r.arg,i.delegate=null,l;r=r.arg;return r?r.done?(i[e.resultName]=r.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,l):r:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,l)}(i,o);if(i){if(i===l)continue;return i}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===a)throw a="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);a="executing";i=h(n,s,o);if("normal"===i.type){if(a=o.done?"completed":"suspendedYield",i.arg===l)continue;return{value:i.arg,done:o.done}}"throw"===i.type&&(a="completed",o.method="throw",o.arg=i.arg)}}),e}function h(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}o.wrap=a;var l={};function c(){}function f(){}function p(){}var e={},d=(s(e,r,function(){return this}),Object.getPrototypeOf),d=d&&d(d(T([]))),g=(d&&d!==t&&u.call(d,r)&&(e=d),p.prototype=c.prototype=Object.create(e));function v(t){["next","throw","return"].forEach(function(e){s(t,e,function(t){return this._invoke(e,t)})})}function S(o,a){var e;this._invoke=function(i,r){function t(){return new a(function(t,e){!function e(t,i,r,n){var s,t=h(o[t],o,i);if("throw"!==t.type)return(i=(s=t.arg).value)&&"object"==typeof i&&u.call(i,"__await")?a.resolve(i.__await).then(function(t){e("next",t,r,n)},function(t){e("throw",t,r,n)}):a.resolve(i).then(function(t){s.value=t,r(s)},function(t){return e("throw",t,r,n)});n(t.arg)}(i,r,t,e)})}return e=e?e.then(t,t):t()}}function y(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function m(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(y,this),this.reset(!0)}function T(e){if(e){var i,t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return i=-1,(t=function t(){for(;++i<e.length;)if(u.call(e,i))return t.value=e[i],t.done=!1,t;return t.value=void 0,t.done=!0,t}).next=t}return{next:E}}function E(){return{value:void 0,done:!0}}return s(g,"constructor",f.prototype=p),s(p,"constructor",f),f.displayName=s(p,n,"GeneratorFunction"),o.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,s(t,n,"GeneratorFunction")),t.prototype=Object.create(g),t},o.awrap=function(t){return{__await:t}},v(S.prototype),s(S.prototype,i,function(){return this}),o.AsyncIterator=S,o.async=function(t,e,i,r,n){void 0===n&&(n=Promise);var s=new S(a(t,e,i,r),n);return o.isGeneratorFunction(e)?s:s.next().then(function(t){return t.done?t.value:s.next()})},v(g),s(g,n,"Generator"),s(g,r,function(){return this}),s(g,"toString",function(){return"[object Generator]"}),o.keys=function(i){var t,r=[];for(t in i)r.push(t);return r.reverse(),function t(){for(;r.length;){var e=r.pop();if(e in i)return t.value=e,t.done=!1,t}return t.done=!0,t}},o.values=T,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(m),!t)for(var e in this)"t"===e.charAt(0)&&u.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(i){if(this.done)throw i;var r=this;function t(t,e){return s.type="throw",s.arg=i,r.next=t,e&&(r.method="next",r.arg=void 0),!!e}for(var e=this.tryEntries.length-1;0<=e;--e){var n=this.tryEntries[e],s=n.completion;if("root"===n.tryLoc)return t("end");if(n.tryLoc<=this.prev){var o=u.call(n,"catchLoc"),a=u.call(n,"finallyLoc");if(o&&a){if(this.prev<n.catchLoc)return t(n.catchLoc,!0);if(this.prev<n.finallyLoc)return t(n.finallyLoc)}else if(o){if(this.prev<n.catchLoc)return t(n.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return t(n.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;0<=i;--i){var r=this.tryEntries[i];if(r.tryLoc<=this.prev&&u.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var n=r;break}}var s=(n=n&&("break"===t||"continue"===t)&&n.tryLoc<=e&&e<=n.finallyLoc?null:n)?n.completion:{};return s.type=t,s.arg=e,n?(this.method="next",this.next=n.finallyLoc,l):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),m(i),l}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var i,r,n=this.tryEntries[e];if(n.tryLoc===t)return"throw"===(i=n.completion).type&&(r=i.arg,m(n)),r}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:T(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),l}},o}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function asyncGeneratorStep(t,e,i,r,n,s,o){try{var a=t[s](o),u=a.value}catch(t){return void i(t)}a.done?e(u):Promise.resolve(u).then(r,n)}function _asyncToGenerator(a){return function(){var t=this,o=arguments;return new Promise(function(e,i){var r=a.apply(t,o);function n(t){asyncGeneratorStep(r,e,i,n,s,"next",t)}function s(t){asyncGeneratorStep(r,e,i,n,s,"throw",t)}n(void 0)})}}var oproto=Object.prototype,aproto=Array.prototype,serialize=oproto.toString,isFunction=function(t){return"[object Function]"===serialize.call(t)},isArray=Array.isArray||function(t){return"[object Array]"===serialize.call(t)},isPlainObject=function(t){return"[object Object]"===serialize.call(t)&&Object.getPrototypeOf(t)===oproto},i=0,utils={uid:function(){return++i},noop:function(){},bind:function(t,e){return function(){return t.apply(e,arguments)}},preventEvent:function(t){t.preventDefault()},stop:function(t){t.preventDefault(),t.stopPropagation()},nextTick:function(t,e){setTimeout(utils.bind(t,e),0)},toArray:function(t,e,i){return void 0===i&&(i=t.length),aproto.slice.call(t,e=void 0===e?0:e,i)},isPlainObject:isPlainObject,isFunction:isFunction,isArray:isArray,isObject:function(t){return Object(t)===t},isString:function(t){return"string"==typeof t},isUndefined:function(t){return void 0===t},isDefined:function(t){return void 0!==t},each:function(t,e,i){if(utils.isDefined(t.length))for(var r=0,n=t.length;r<n&&!1!==e.call(i,t[r],r,t);r++);else for(var s in t)if(!1===e.call(i,t[s],s,t))break},evalOpts:function(t,e){return utils.isFunction(t)&&(e=utils.toArray(arguments),t=t.apply(null,e.slice(1))),t},extend:function(){var t,e,i,r,n,s=arguments[0]||{},o=1,a=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},o++),"object"===_typeof(s)||isFunction(s)||(s={}),o===a&&(s=this,o--);o<a;o++)if(null!=(t=arguments[o]))for(e in t)n=s[e],s!==(i=t[e])&&(u&&i&&(isPlainObject(i)||(r=isArray(i)))?(n=r?(r=!1,n&&isArray(n)?n:[]):n&&isPlainObject(n)?n:{},s[e]=utils.extend(u,n,i)):void 0!==i&&(s[e]=i));return s},formatSize:function(t){return t<1024?t.toFixed(0)+" bytes":t<1048576?(t/1024).toFixed(0)+" KB":t<1073741824?(t/1024/1024).toFixed(1)+" MB":(t/1024/1024/1024).toFixed(1)+" GB"},defineNonEnumerable:function(t,e,i){Object.defineProperty(t,e,{enumerable:!1,configurable:!0,writable:!0,value:i})}},each=utils.each,event={_eventData:null,on:function(t,e){this._eventData||(this._eventData={}),this._eventData[t]||(this._eventData[t]=[]);var i=!1;each(this._eventData[t],function(t){if(t===e)return!(i=!0)}),i||this._eventData[t].push(e)},off:function(i,r){this._eventData||(this._eventData={}),this._eventData[i]&&this._eventData[i].length&&(r?each(this._eventData[i],function(t,e){if(t===r)return this._eventData[i].splice(e,1),!1},this):this._eventData[i]=[])},trigger:function(t){var e,i;return this._eventData||(this._eventData={}),!this._eventData[t]||(e=this._eventData[t].slice.call(arguments,1),i=!1,each(this._eventData[t],function(t){i=!1===t.apply(this,e)||i},this),!i)}};function Chunk(t,e,i){utils.defineNonEnumerable(this,"uploader",t),utils.defineNonEnumerable(this,"file",e),utils.defineNonEnumerable(this,"bytes",null),this.offset=i,this.tested=!1,this.retries=0,this.pendingRetry=!1,this.preprocessState=0,this.readState=0,this.loaded=0,this.total=0,this.chunkSize=utils.evalOpts(t.opts.chunkSize,e,this),this.startByte=this.offset*this.chunkSize,this.endByte=this.computeEndByte(),this.xhr=null,this.needUpload=!0}var STATUS=Chunk.STATUS={PENDING:"pending",UPLOADING:"uploading",READING:"reading",SUCCESS:"success",ERROR:"error",COMPLETE:"complete",PROGRESS:"progress",RETRY:"retry"};function File(t,e,i){utils.defineNonEnumerable(this,"uploader",t),this.isRoot=this.isFolder=t===this,utils.defineNonEnumerable(this,"parent",i||null),utils.defineNonEnumerable(this,"files",[]),utils.defineNonEnumerable(this,"fileList",[]),utils.defineNonEnumerable(this,"chunks",[]),utils.defineNonEnumerable(this,"_errorFiles",[]),utils.defineNonEnumerable(this,"file",null),this.id=utils.uid(),this.isRoot||!e?this.file=null:utils.isString(e)?(this.isFolder=!0,this.file=null,this.path=e,this.parent.path&&(e=e.substr(this.parent.path.length)),this.name="/"===e.charAt(e.length-1)?e.substr(0,e.length-1):e):(this.file=e,this.fileType=this.file.type,this.name=e.fileName||e.name,this.size=e.size,this.relativePath=e.relativePath||e.webkitRelativePath||this.name,this._parseFile()),this.paused=t.opts.initialPaused,this.error=!1,this.allError=!1,this.aborted=!1,this.completed=!1,this.merged=!1,this.canMerge=!1,this.isTesting=!1,this.status=t.opts.autoUpload?File.FILE_STATUS.WAITING:File.FILE_STATUS.PENDING,this.averageSpeed=0,this.currentSpeed=0,this._lastProgressCallback=Date.now(),this._prevUploadedSize=0,this._prevProgress=0,this.bootstrap()}Chunk.REQUESTTYPE={TEST:1,UPLOAD:2,MERGE:3},utils.extend(Chunk.prototype,{_event:function(t,e){(e=utils.toArray(arguments)).unshift(this),this.file._chunkEvent.apply(this.file,e)},computeEndByte:function(){var t=Math.min(this.file.size,(this.offset+1)*this.chunkSize);return t=this.file.size-t<this.chunkSize&&!this.uploader.opts.forceChunkSize?this.file.size:t},getParams:function(){return{chunkNumber:this.offset+1,chunkSize:this.chunkSize,currentChunkSize:this.endByte-this.startByte,totalSize:this.file.size,identifier:this.file.uniqueIdentifier,filename:this.file.name,relativePath:this.file.relativePath,totalChunks:this.file.chunks.length}},getTarget:function(t,e){return e.length?(t.indexOf("?")<0?t+="?":t+="&",t+e.join("&")):t},test:function(){this.xhr=new XMLHttpRequest,this.xhr.addEventListener("load",function(t){var e=i.message();i.uploader.opts.processTest(e,function(t,e){i.file.isTesting=!1,i.xhr&&(i.processedState={err:t,res:e},(t=i.status(!0))===STATUS.ERROR?(i._event(t,e,Chunk.REQUESTTYPE.TEST),i.uploader.uploadNextChunk()):t===STATUS.SUCCESS?(i._event(t,e,Chunk.REQUESTTYPE.TEST),i.tested=!0):i.file.paused||(i.tested=!0,i.send()))},i.file)},!1),this.xhr.addEventListener("error",function(t){i.file.isTesting=!1,i._event(STATUS.ERROR,i.message(),Chunk.REQUESTTYPE.TEST)},!1);var t=utils.evalOpts(this.uploader.opts.testMethod,this.file,this),t=this.prepareXhrRequest(t,!0),i=(this.xhr.send(t),this)},preprocessFinished:function(){this.endByte=this.computeEndByte(),this.preprocessState=2,this.send()},readFinished:function(t){this.readState=2,this.bytes=t,this.send()},send:function(){var t,i,e=this.uploader.opts.preprocess,r=this.uploader.opts.readFileFn;if(utils.isFunction(e))switch(this.preprocessState){case 0:return this.preprocessState=1,void e(this);case 1:return}switch(this.readState){case 0:return this.readState=1,void r(this.file,this.file.fileType,this.startByte,this.endByte,this);case 1:return}function n(t){var e=i.message();i.processingResponse=!0,i.uploader.opts.processResponse(e,function(t,e){i.processingResponse=!1,i.xhr&&(i.processedState={err:t,res:e},(t=i.status())===STATUS.SUCCESS||t===STATUS.ERROR?(i._event(t,e,Chunk.REQUESTTYPE.UPLOAD),t===STATUS.ERROR&&i.uploader.uploadNextChunk()):(i._event(STATUS.RETRY,e,Chunk.REQUESTTYPE.UPLOAD),i.pendingRetry=!0,i.abort(),i.retries++,null!==(t=i.uploader.opts.chunkRetryInterval)?setTimeout(function(){i.send()},t):i.send()))},i.file,i)}this.uploader.opts.testChunks&&!this.tested?this.file.isTesting||(this.file.isTesting=!0,this.file._firstResponse=!1,this.test()):(this.loaded=0,this.total=0,this.pendingRetry=!1,this.xhr=new XMLHttpRequest,this.xhr.upload.addEventListener("progress",function(t){t.lengthComputable&&(i.loaded=t.loaded,i.total=t.total);i._event(STATUS.PROGRESS,t,Chunk.REQUESTTYPE.UPLOAD)},!1),this.xhr.addEventListener("load",n,!1),this.xhr.addEventListener("error",n,!1),t=utils.evalOpts(this.uploader.opts.uploadMethod,this.file,this),t=this.prepareXhrRequest(t,!1,this.uploader.opts.method,this.bytes),this.xhr.send(t),i=this)},merge:function(){this.xhr=new XMLHttpRequest,this.xhr.addEventListener("load",e,!1),this.xhr.addEventListener("error",e,!1);var t=utils.evalOpts(this.uploader.opts.mergeMethod,this.file,this),t=this.prepareXhrRequest(t,!1,this.uploader.opts.method,void 0,!0),i=(this.xhr.send(t),this);function e(t){var e=i.message();i.processingResponse=!0,i.uploader.opts.processMerge(e,function(t,e){i.processingResponse=!1,i.xhr&&(i.processedState={err:t,res:e},(t=i.status())===STATUS.SUCCESS||t===STATUS.ERROR?(i._event(t,e,Chunk.REQUESTTYPE.MERGE),t===STATUS.ERROR&&i.uploader.uploadNextChunk()):(i._event(STATUS.RETRY,e,Chunk.REQUESTTYPE.MERGE),i.pendingRetry=!0,i.abort(),i.retries++,null!==(t=i.uploader.opts.chunkRetryInterval)?setTimeout(function(){i.send()},t):i.send()))},i.file,i)}},abort:function(){var t=this.xhr;this.xhr=null,this.processingResponse=!1,this.processedState=null,t&&t.abort()},status:function(t){var e;return 1===this.readState?STATUS.READING:this.pendingRetry||1===this.preprocessState?STATUS.UPLOADING:this.xhr?this.xhr.readyState<4||this.processingResponse?STATUS.UPLOADING:(t=-1<this.uploader.opts.successStatuses.indexOf(this.xhr.status)?STATUS.SUCCESS:-1<this.uploader.opts.permanentErrors.indexOf(this.xhr.status)||!t&&this.retries>=this.uploader.opts.maxChunkRetries?STATUS.ERROR:(this.abort(),STATUS.PENDING),(e=this.processedState)&&e.err?STATUS.ERROR:t):STATUS.PENDING},message:function(){return this.xhr?this.xhr.responseText:""},progress:function(){var t;return this.pendingRetry?0:(t=this.status())===STATUS.SUCCESS||t===STATUS.ERROR?1:t!==STATUS.PENDING&&0<this.total?this.loaded/this.total:0},sizeUploaded:function(){var t=this.endByte-this.startByte;return t=this.status()!==STATUS.SUCCESS?this.progress()*t:t},prepareXhrRequest:function(t,e,i,r,n){var s,o=utils.evalOpts(this.uploader.opts.query,this.file,this,e),o=utils.extend(this.getParams(),o),n=(o=this.uploader.opts.processParams(o,this.file,this,e,n),utils.evalOpts(this.uploader.opts.target,this.file,this,e,n)),a=null;return"GET"===t||"octet"===i?(s=[],utils.each(o,function(t,e){s.push([encodeURIComponent(e),encodeURIComponent(t)].join("="))}),n=this.getTarget(n,s),a=r||null):(a=new FormData,utils.each(o,function(t,e){a.append(e,t)}),void 0!==r&&a.append(this.uploader.opts.fileParameterName,r,this.file.name)),this.xhr.open(t,n,!0),this.xhr.withCredentials=this.uploader.opts.withCredentials,utils.each(utils.evalOpts(this.uploader.opts.headers,this.file,this,e),function(t,e){this.xhr.setRequestHeader(e,t)},this),a}});var FILE_STATUS=File.FILE_STATUS={PENDING:"pending",WAITING:"waiting",CALCULATING:"calculating",UPLOADING:"uploading",PAUSED:"paused",MERGING:"merging",SUCCESS:"success",ERROR:"error"};function parsePaths(t){var e=[],i=t.split("/"),r=i.length,n=1;if(i.splice(r-1,1),r--,i.length)for(;n<=r;)e.push(i.slice(0,n++).join("/")+"/");return e}utils.extend(File.prototype,{_parseFile:function(){var r,n=parsePaths(this.relativePath);n.length?(r=this.uploader.filePaths,utils.each(n,function(t,e){var i=r[t];i||(i=new File(this.uploader,t,this.parent),r[t]=i,this._updateParentFileList(i)),(this.parent=i).files.push(this),n[e+1]||i.fileList.push(this)},this)):this._updateParentFileList()},_updateParentFileList:function(t){t=t||this;var e=this.parent;e&&e.fileList.push(t)},_eachAccess:function(i,t){this.isFolder?utils.each(this.files,function(t,e){return i.call(this,t,e)},this):t.call(this,this)},bootstrap:function(){if(!this.isFolder)for(var t=this.uploader.opts,e=(utils.isFunction(t.initFileFn)&&t.initFileFn.call(this,this),this.abort(!0),this._resetError(),this._prevProgress=0,t.forceChunkSize?Math.ceil:Math.floor),i=Math.max(e(this.size/t.chunkSize),1),r=0;r<i;r++)this.chunks.push(new Chunk(this.uploader,this,r))},_measureSpeed:function(){var t,e=this.uploader.opts.speedSmoothingFactor,i=Date.now()-this._lastProgressCallback;i&&(t=this.sizeUploaded(),this.currentSpeed=Math.max((t-this._prevUploadedSize)/i*1e3,0),this.averageSpeed=e*this.currentSpeed+(1-e)*this.averageSpeed,this._prevUploadedSize=t,this.parent&&this.parent._checkProgress()&&this.parent._measureSpeed())},_checkProgress:function(t){return Date.now()-this._lastProgressCallback>=this.uploader.opts.progressCallbacksInterval},_chunkEvent:function(t,e,i,r){function n(){u._measureSpeed(),o._trigger("fileProgress",h,u,t),u._lastProgressCallback=Date.now()}var s,o=this.uploader,a=Chunk.STATUS,u=this,h=this.getRoot();switch(e){case a.PROGRESS:this._checkProgress()&&n();break;case a.ERROR:this._error(),this.abort(!0),this.status=File.FILE_STATUS.ERROR,o._trigger("fileStatus",this,this.status,o.opts.statusText[this.status]),o._trigger("fileError",h,this,i,t);break;case a.SUCCESS:this._updateUploadedChunks(i,t,r),this.error||(r===Chunk.REQUESTTYPE.MERGE&&o._trigger("fileMergeEnd",this),clearTimeout(this._progeressId),this._progeressId=0,(s=Date.now()-this._lastProgressCallback)<o.opts.progressCallbacksInterval&&(this._progeressId=setTimeout(n,o.opts.progressCallbacksInterval-s)),this.isComplete()?(clearTimeout(this._progeressId),n(),this.currentSpeed=0,this.averageSpeed=0,this.status=File.FILE_STATUS.SUCCESS,o._trigger("fileStatus",this,this.status,o.opts.statusText[this.status]),o._trigger("fileSuccess",h,this,i,t),h.isComplete()&&o._trigger("fileComplete",h,this)):this._progeressId||n());break;case a.RETRY:o._trigger("fileRetry",h,this,t)}},_updateUploadedChunks:function(i,r,n){n===Chunk.REQUESTTYPE.UPLOAD&&(r.needUpload=!1);var s,o=this.uploader.opts.checkChunkUploadedByResponse;!o||(s=r.xhr,utils.each(this.chunks,function(t){var e;n===Chunk.REQUESTTYPE.TEST&&(e=o.call(this,t,i),t!==r||e||(t.xhr=null),e&&(t.xhr=s),t.tested=!0)},this),this._firstResponse)?this.uploader.uploadNextChunk():(this._firstResponse=!0,this.uploader.upload(!0))},_error:function(){this.error=this.allError=!0;for(var t=this.parent;t&&t!==this.uploader;)t._errorFiles.push(this),t.error=!0,t._errorFiles.length===t.files.length&&(t.allError=!0),t=t.parent},_resetError:function(){this.error=this.allError=!1;for(var t,e=this.parent;e&&e!==this.uploader;)t=e._errorFiles.indexOf(this),e._errorFiles.splice(t,1),e.allError=!1,e._errorFiles.length||(e.error=!1),e=e.parent},isComplete:function(){var r;return this.completed||(r=!1,this._eachAccess(function(t){if(!t.isComplete())return!(r=!0)},function(){var i;!this.error&&(this.isFolder||this.merged)?(i=Chunk.STATUS,utils.each(this.chunks,function(t){var e=t.status();if(e===i.ERROR||e===i.PENDING||e===i.UPLOADING||e===i.READING||1===t.preprocessState||1===t.readState)return!(r=!0)})):r=!0}),this.completed=!r),this.completed},isUploading:function(){var i=!1;return this._eachAccess(function(t){if(t.isUploading())return!(i=!0)},function(){var e=Chunk.STATUS.UPLOADING;utils.each(this.chunks,function(t){if(t.status()===e)return!(i=!0)})}),i},resume:function(){this._eachAccess(function(t){[File.FILE_STATUS.PENDING,File.FILE_STATUS.WAITING,File.FILE_STATUS.PAUSED].includes(t.status)&&t.resume()},function(){var t=this.uploader;this.status===File.FILE_STATUS.PAUSED?this.status=File.FILE_STATUS.UPLOADING:this.status===File.FILE_STATUS.PENDING&&(this.status=File.FILE_STATUS.WAITING),t._trigger("fileStatus",this,this.status,t.opts.statusText[this.status]),this.paused=!1,this.aborted=!1,this.uploader.upload()}),this.paused=!1,this.aborted=!1},pause:function(){this._eachAccess(function(t){["uploading"].includes(t.status)&&t.pause()},function(){utils.each(this.chunks,function(t){t.needUpload&&(t.tested=!1)}),this.paused=!0,this.abort();var t=this.uploader;this.status=File.FILE_STATUS.PAUSED,t._trigger("fileStatus",this,this.status,t.opts.statusText[this.status])}),this.paused=!0},cancel:function(){this.uploader.removeFile(this)},retry:function(t){t?t.bootstrap():this._eachAccess(function(t){t.error&&t.bootstrap()},function(){this.bootstrap()}),this.uploader.upload()},abort:function(t){var e,i;this.aborted||(this.currentSpeed=0,this.averageSpeed=0,this.aborted=!t,e=this.chunks,t&&(this.chunks=[]),i=Chunk.STATUS.UPLOADING,utils.each(e,function(t){t.status()===i&&(t.abort(),this.uploader.uploadNextChunk())},this))},progress:function(){var i=0,r=0,n=0;return this._eachAccess(function(t,e){i+=t.progress()*t.size,r+=t.size,e===this.files.length-1&&(n=0<r?i/r:this.isComplete()?1:0)},function(){var e,t;n=this.error?1:(1===this.chunks.length?this._prevProgress=Math.max(this._prevProgress,this.chunks[0].progress()):(e=0,utils.each(this.chunks,function(t){e+=t.progress()*(t.endByte-t.startByte)}),t=e/this.size,this._prevProgress=Math.max(this._prevProgress,t<1?t:.9999)),this._prevProgress)}),this.canMerge&&!this.merged?n=.9999:this.merged&&(n=1),n},getSize:function(){var e=0;return this._eachAccess(function(t){e+=t.size},function(){e+=this.size}),e},getFormatSize:function(){var t=this.getSize();return utils.formatSize(t)},getRoot:function(){if(!this.isRoot)for(var t=this.parent;t;){if(t.parent===this.uploader)return t;t=t.parent}return this},sizeUploaded:function(){var e=0;return this._eachAccess(function(t){e+=t.sizeUploaded()},function(){utils.each(this.chunks,function(t){e+=t.sizeUploaded()})}),e},timeRemaining:function(){var i=0,r=0,n=0;return this._eachAccess(function(t,e){t.paused||t.error||(r+=t.size-t.sizeUploaded(),n+=t.averageSpeed),e===this.files.length-1&&(i=s(r,n))},function(){var t;i=this.paused||this.error?0:(t=this.size-this.sizeUploaded(),s(t,this.averageSpeed))}),i;function s(t,e){return t&&!e?Number.POSITIVE_INFINITY:t||e?Math.floor(t/e):0}},removeFile:function(t){if(t.isFolder)for(;t.files.length;){var e=t.files[t.files.length-1];this._removeFile(e)}this._removeFile(t)},_delFilePath:function(t){t.path&&this.filePaths&&delete this.filePaths[t.path],utils.each(t.fileList,function(t){this._delFilePath(t)},this)},_removeFile:function(i){if(!i.isFolder){utils.each(this.files,function(t,e){if(t===i)return this.files.splice(e,1),!1},this),i.abort();for(var t,e=i.parent;e&&e!==this;)t=e.parent,e._removeFile(i),e=t}i.parent===this&&utils.each(this.fileList,function(t,e){if(t===i)return this.fileList.splice(e,1),!1},this),this.isRoot||!this.isFolder||this.files.length||(this.parent._removeFile(this),this.uploader._delFilePath(this)),i.parent=null},getType:function(){return this.isFolder?"folder":this.file.type&&this.file.type.split("/")[1]},getExtension:function(){return this.isFolder?"":this.name.substr(2+(~-this.name.lastIndexOf(".")>>>0)).toLowerCase()}});const t=new Uint8Array([0,97,115,109,1,0,0,0,1,48,8,96,3,127,127,127,0,96,3,127,127,127,1,127,96,2,127,127,0,96,2,127,126,0,96,1,127,1,127,96,1,127,1,126,96,3,127,127,126,1,126,96,3,126,127,127,1,126,3,11,10,1,1,2,0,4,6,7,3,0,5,5,3,1,0,1,7,85,9,3,109,101,109,2,0,5,120,120,104,51,50,0,0,6,105,110,105,116,51,50,0,2,8,117,112,100,97,116,101,51,50,0,3,8,100,105,103,101,115,116,51,50,0,4,5,120,120,104,54,52,0,5,6,105,110,105,116,54,52,0,7,8,117,112,100,97,116,101,54,52,0,8,8,100,105,103,101,115,116,54,52,0,9,10,211,23,10,242,1,1,4,127,32,0,32,1,106,33,3,32,1,65,16,79,4,127,32,3,65,16,107,33,6,32,2,65,168,136,141,161,2,106,33,3,32,2,65,247,148,175,175,120,106,33,4,32,2,65,177,243,221,241,121,107,33,5,3,64,32,0,40,2,0,65,247,148,175,175,120,108,32,3,106,65,13,119,65,177,243,221,241,121,108,33,3,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,32,4,106,65,13,119,65,177,243,221,241,121,108,33,4,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,32,2,106,65,13,119,65,177,243,221,241,121,108,33,2,32,0,65,4,106,34,0,40,2,0,65,247,148,175,175,120,108,32,5,106,65,13,119,65,177,243,221,241,121,108,33,5,32,0,65,4,106,34,0,32,6,77,13,0,11,32,2,65,12,119,32,5,65,18,119,106,32,4,65,7,119,106,32,3,65,1,119,106,5,32,2,65,177,207,217,178,1,106,11,32,1,106,32,0,32,1,65,15,113,16,1,11,146,1,0,32,1,32,2,106,33,2,3,64,32,1,65,4,106,32,2,75,69,4,64,32,1,40,2,0,65,189,220,202,149,124,108,32,0,106,65,17,119,65,175,214,211,190,2,108,33,0,32,1,65,4,106,33,1,12,1,11,11,3,64,32,1,32,2,79,69,4,64,32,1,45,0,0,65,177,207,217,178,1,108,32,0,106,65,11,119,65,177,243,221,241,121,108,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,65,15,118,32,0,115,65,247,148,175,175,120,108,34,0,32,0,65,13,118,115,65,189,220,202,149,124,108,34,0,32,0,65,16,118,115,11,63,0,32,0,65,8,106,32,1,65,168,136,141,161,2,106,54,2,0,32,0,65,12,106,32,1,65,247,148,175,175,120,106,54,2,0,32,0,65,16,106,32,1,54,2,0,32,0,65,20,106,32,1,65,177,243,221,241,121,107,54,2,0,11,211,4,1,6,127,32,1,32,2,106,33,6,32,0,65,24,106,33,5,32,0,65,40,106,40,2,0,33,3,32,0,32,0,40,2,0,32,2,106,54,2,0,32,0,65,4,106,34,4,32,4,40,2,0,32,2,65,16,79,32,0,40,2,0,65,16,79,114,114,54,2,0,32,2,32,3,106,65,16,73,4,64,32,3,32,5,106,32,1,32,2,252,10,0,0,32,0,65,40,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,5,106,32,1,65,16,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,40,2,0,32,5,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,12,106,34,3,40,2,0,32,5,65,4,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,16,106,34,3,40,2,0,32,5,65,8,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,20,106,34,3,40,2,0,32,5,65,12,106,40,2,0,65,247,148,175,175,120,108,106,65,13,119,65,177,243,221,241,121,108,33,4,32,3,32,4,54,2,0,32,0,65,40,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,32,6,65,16,107,77,4,64,32,6,65,16,107,33,8,32,0,65,8,106,40,2,0,33,2,32,0,65,12,106,40,2,0,33,3,32,0,65,16,106,40,2,0,33,4,32,0,65,20,106,40,2,0,33,7,3,64,32,1,40,2,0,65,247,148,175,175,120,108,32,2,106,65,13,119,65,177,243,221,241,121,108,33,2,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,32,3,106,65,13,119,65,177,243,221,241,121,108,33,3,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,32,4,106,65,13,119,65,177,243,221,241,121,108,33,4,32,1,65,4,106,34,1,40,2,0,65,247,148,175,175,120,108,32,7,106,65,13,119,65,177,243,221,241,121,108,33,7,32,1,65,4,106,34,1,32,8,77,13,0,11,32,0,65,8,106,32,2,54,2,0,32,0,65,12,106,32,3,54,2,0,32,0,65,16,106,32,4,54,2,0,32,0,65,20,106,32,7,54,2,0,11,32,1,32,6,73,4,64,32,5,32,1,32,6,32,1,107,34,1,252,10,0,0,32,0,65,40,106,32,1,54,2,0,11,11,97,1,1,127,32,0,65,16,106,40,2,0,33,1,32,0,65,4,106,40,2,0,4,127,32,1,65,12,119,32,0,65,20,106,40,2,0,65,18,119,106,32,0,65,12,106,40,2,0,65,7,119,106,32,0,65,8,106,40,2,0,65,1,119,106,5,32,1,65,177,207,217,178,1,106,11,32,0,40,2,0,106,32,0,65,24,106,32,0,65,40,106,40,2,0,16,1,11,157,4,2,1,127,3,126,32,0,32,1,106,33,3,32,1,65,32,79,4,126,32,3,65,32,107,33,3,32,2,66,135,149,175,175,152,182,222,155,158,127,124,66,207,214,211,190,210,199,171,217,66,124,33,4,32,2,66,207,214,211,190,210,199,171,217,66,124,33,5,32,2,66,0,124,33,6,32,2,66,135,149,175,175,152,182,222,155,158,127,125,33,2,3,64,32,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,4,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,4,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,5,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,5,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,6,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,0,65,8,106,34,0,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,2,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,2,32,0,65,8,106,34,0,32,3,77,13,0,11,32,6,66,12,137,32,2,66,18,137,124,32,5,66,7,137,124,32,4,66,1,137,124,32,4,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,5,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,6,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,2,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,5,32,2,66,197,207,217,178,241,229,186,234,39,124,11,32,1,173,124,32,0,32,1,65,31,113,16,6,11,137,2,0,32,1,32,2,106,33,2,3,64,32,1,65,8,106,32,2,77,4,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,27,137,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,33,0,32,1,65,8,106,33,1,12,1,11,11,32,1,65,4,106,32,2,77,4,64,32,1,53,2,0,66,135,149,175,175,152,182,222,155,158,127,126,32,0,133,66,23,137,66,207,214,211,190,210,199,171,217,66,126,66,249,243,221,241,153,246,153,171,22,124,33,0,32,1,65,4,106,33,1,11,3,64,32,1,32,2,73,4,64,32,1,49,0,0,66,197,207,217,178,241,229,186,234,39,126,32,0,133,66,11,137,66,135,149,175,175,152,182,222,155,158,127,126,33,0,32,1,65,1,106,33,1,12,1,11,11,32,0,66,33,136,32,0,133,66,207,214,211,190,210,199,171,217,66,126,34,0,32,0,66,29,136,133,66,249,243,221,241,153,246,153,171,22,126,34,0,32,0,66,32,136,133,11,88,0,32,0,65,8,106,32,1,66,135,149,175,175,152,182,222,155,158,127,124,66,207,214,211,190,210,199,171,217,66,124,55,3,0,32,0,65,16,106,32,1,66,207,214,211,190,210,199,171,217,66,124,55,3,0,32,0,65,24,106,32,1,55,3,0,32,0,65,32,106,32,1,66,135,149,175,175,152,182,222,155,158,127,125,55,3,0,11,132,5,2,3,127,4,126,32,1,32,2,106,33,5,32,0,65,40,106,33,4,32,0,65,200,0,106,40,2,0,33,3,32,0,32,0,41,3,0,32,2,173,124,55,3,0,32,2,32,3,106,65,32,73,4,64,32,3,32,4,106,32,1,32,2,252,10,0,0,32,0,65,200,0,106,32,2,32,3,106,54,2,0,15,11,32,3,4,64,32,3,32,4,106,32,1,65,32,32,3,107,34,2,252,10,0,0,32,0,65,8,106,34,3,41,3,0,32,4,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,16,106,34,3,41,3,0,32,4,65,8,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,24,106,34,3,41,3,0,32,4,65,16,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,32,106,34,3,41,3,0,32,4,65,24,106,41,3,0,66,207,214,211,190,210,199,171,217,66,126,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,3,32,6,55,3,0,32,0,65,200,0,106,65,0,54,2,0,32,1,32,2,106,33,1,11,32,1,65,32,106,32,5,77,4,64,32,5,65,32,107,33,2,32,0,65,8,106,41,3,0,33,6,32,0,65,16,106,41,3,0,33,7,32,0,65,24,106,41,3,0,33,8,32,0,65,32,106,41,3,0,33,9,3,64,32,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,6,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,6,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,7,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,7,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,8,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,8,32,1,65,8,106,34,1,41,3,0,66,207,214,211,190,210,199,171,217,66,126,32,9,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,33,9,32,1,65,8,106,34,1,32,2,77,13,0,11,32,0,65,8,106,32,6,55,3,0,32,0,65,16,106,32,7,55,3,0,32,0,65,24,106,32,8,55,3,0,32,0,65,32,106,32,9,55,3,0,11,32,1,32,5,73,4,64,32,4,32,1,32,5,32,1,107,34,1,252,10,0,0,32,0,65,200,0,106,32,1,54,2,0,11,11,200,2,1,5,126,32,0,65,24,106,41,3,0,33,1,32,0,41,3,0,34,2,66,32,90,4,126,32,0,65,8,106,41,3,0,34,3,66,1,137,32,0,65,16,106,41,3,0,34,4,66,7,137,124,32,1,66,12,137,32,0,65,32,106,41,3,0,34,5,66,18,137,124,124,32,3,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,4,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,1,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,32,5,66,207,214,211,190,210,199,171,217,66,126,66,0,124,66,31,137,66,135,149,175,175,152,182,222,155,158,127,126,133,66,135,149,175,175,152,182,222,155,158,127,126,66,227,220,202,149,252,206,242,245,133,127,124,5,32,1,66,197,207,217,178,241,229,186,234,39,124,11,32,2,124,32,0,65,40,106,32,2,66,31,131,167,16,6,11]);async function e(){const{exports:{mem:i,xxh32:r,xxh64:n,init32:e,update32:s,digest32:o,init64:a,update64:u,digest64:h}}=(await WebAssembly.instantiate(t))["instance"];let l=new Uint8Array(i.buffer);function c(t,e){i.buffer.byteLength<t+e&&(t=Math.ceil((t+e-i.buffer.byteLength)/65536),i.grow(t),l=new Uint8Array(i.buffer))}function f(i,t,e,r,n,s){c(i);const o=new Uint8Array(i);return l.set(o),e(0,t),o.set(l.slice(0,i)),{update(t){let e;return l.set(o),e="string"==typeof t?(c(3*t.length,i),v.encodeInto(t,l.subarray(i)).written):(c(t.byteLength,i),l.set(t,i),t.byteLength),r(0,i,e),o.set(l.slice(0,i)),this},digest:()=>(l.set(o),s(n(0)))}}function p(t){return t>>>0}const d=2n**64n-1n;function g(t){return t&d}const v=new TextEncoder,S=0n;function y(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return c(3*t.length,0),r(0,v.encodeInto(t,l).written,e)>>>0}function m(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:S;return c(3*t.length,0),g(n(0,v.encodeInto(t,l).written,e))}return{h32:y,h32ToString(t){return y(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:0).toString(16).padStart(8,"0")},h32Raw(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return c(t.byteLength,0),l.set(t),r(0,t.byteLength,e)>>>0},create32(){return f(48,0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e,s,o,p)},h64:m,h64ToString(t){return m(t,1<arguments.length&&void 0!==arguments[1]?arguments[1]:S).toString(16).padStart(16,"0")},h64Raw(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:S;return c(t.byteLength,0),l.set(t),g(n(0,t.byteLength,e))},create64(){return f(88,0<arguments.length&&void 0!==arguments[0]?arguments[0]:S,a,u,h,g)}}}function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var sparkMd5=createCommonjsModule(function(t,e){t.exports=function(l){var r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function h(t,e){var i=t[0],r=t[1],n=t[2],s=t[3];i+=(r&n|~r&s)+e[0]-680876936|0;i=(i<<7|i>>>25)+r|0;s+=(i&r|~i&n)+e[1]-389564586|0;s=(s<<12|s>>>20)+i|0;n+=(s&i|~s&r)+e[2]+606105819|0;n=(n<<17|n>>>15)+s|0;r+=(n&s|~n&i)+e[3]-1044525330|0;r=(r<<22|r>>>10)+n|0;i+=(r&n|~r&s)+e[4]-176418897|0;i=(i<<7|i>>>25)+r|0;s+=(i&r|~i&n)+e[5]+1200080426|0;s=(s<<12|s>>>20)+i|0;n+=(s&i|~s&r)+e[6]-1473231341|0;n=(n<<17|n>>>15)+s|0;r+=(n&s|~n&i)+e[7]-45705983|0;r=(r<<22|r>>>10)+n|0;i+=(r&n|~r&s)+e[8]+1770035416|0;i=(i<<7|i>>>25)+r|0;s+=(i&r|~i&n)+e[9]-1958414417|0;s=(s<<12|s>>>20)+i|0;n+=(s&i|~s&r)+e[10]-42063|0;n=(n<<17|n>>>15)+s|0;r+=(n&s|~n&i)+e[11]-1990404162|0;r=(r<<22|r>>>10)+n|0;i+=(r&n|~r&s)+e[12]+1804603682|0;i=(i<<7|i>>>25)+r|0;s+=(i&r|~i&n)+e[13]-40341101|0;s=(s<<12|s>>>20)+i|0;n+=(s&i|~s&r)+e[14]-1502002290|0;n=(n<<17|n>>>15)+s|0;r+=(n&s|~n&i)+e[15]+1236535329|0;r=(r<<22|r>>>10)+n|0;i+=(r&s|n&~s)+e[1]-165796510|0;i=(i<<5|i>>>27)+r|0;s+=(i&n|r&~n)+e[6]-1069501632|0;s=(s<<9|s>>>23)+i|0;n+=(s&r|i&~r)+e[11]+643717713|0;n=(n<<14|n>>>18)+s|0;r+=(n&i|s&~i)+e[0]-373897302|0;r=(r<<20|r>>>12)+n|0;i+=(r&s|n&~s)+e[5]-701558691|0;i=(i<<5|i>>>27)+r|0;s+=(i&n|r&~n)+e[10]+38016083|0;s=(s<<9|s>>>23)+i|0;n+=(s&r|i&~r)+e[15]-660478335|0;n=(n<<14|n>>>18)+s|0;r+=(n&i|s&~i)+e[4]-405537848|0;r=(r<<20|r>>>12)+n|0;i+=(r&s|n&~s)+e[9]+568446438|0;i=(i<<5|i>>>27)+r|0;s+=(i&n|r&~n)+e[14]-1019803690|0;s=(s<<9|s>>>23)+i|0;n+=(s&r|i&~r)+e[3]-187363961|0;n=(n<<14|n>>>18)+s|0;r+=(n&i|s&~i)+e[8]+1163531501|0;r=(r<<20|r>>>12)+n|0;i+=(r&s|n&~s)+e[13]-1444681467|0;i=(i<<5|i>>>27)+r|0;s+=(i&n|r&~n)+e[2]-51403784|0;s=(s<<9|s>>>23)+i|0;n+=(s&r|i&~r)+e[7]+1735328473|0;n=(n<<14|n>>>18)+s|0;r+=(n&i|s&~i)+e[12]-1926607734|0;r=(r<<20|r>>>12)+n|0;i+=(r^n^s)+e[5]-378558|0;i=(i<<4|i>>>28)+r|0;s+=(i^r^n)+e[8]-2022574463|0;s=(s<<11|s>>>21)+i|0;n+=(s^i^r)+e[11]+1839030562|0;n=(n<<16|n>>>16)+s|0;r+=(n^s^i)+e[14]-35309556|0;r=(r<<23|r>>>9)+n|0;i+=(r^n^s)+e[1]-1530992060|0;i=(i<<4|i>>>28)+r|0;s+=(i^r^n)+e[4]+1272893353|0;s=(s<<11|s>>>21)+i|0;n+=(s^i^r)+e[7]-155497632|0;n=(n<<16|n>>>16)+s|0;r+=(n^s^i)+e[10]-1094730640|0;r=(r<<23|r>>>9)+n|0;i+=(r^n^s)+e[13]+681279174|0;i=(i<<4|i>>>28)+r|0;s+=(i^r^n)+e[0]-358537222|0;s=(s<<11|s>>>21)+i|0;n+=(s^i^r)+e[3]-722521979|0;n=(n<<16|n>>>16)+s|0;r+=(n^s^i)+e[6]+76029189|0;r=(r<<23|r>>>9)+n|0;i+=(r^n^s)+e[9]-640364487|0;i=(i<<4|i>>>28)+r|0;s+=(i^r^n)+e[12]-421815835|0;s=(s<<11|s>>>21)+i|0;n+=(s^i^r)+e[15]+530742520|0;n=(n<<16|n>>>16)+s|0;r+=(n^s^i)+e[2]-995338651|0;r=(r<<23|r>>>9)+n|0;i+=(n^(r|~s))+e[0]-198630844|0;i=(i<<6|i>>>26)+r|0;s+=(r^(i|~n))+e[7]+1126891415|0;s=(s<<10|s>>>22)+i|0;n+=(i^(s|~r))+e[14]-1416354905|0;n=(n<<15|n>>>17)+s|0;r+=(s^(n|~i))+e[5]-57434055|0;r=(r<<21|r>>>11)+n|0;i+=(n^(r|~s))+e[12]+1700485571|0;i=(i<<6|i>>>26)+r|0;s+=(r^(i|~n))+e[3]-1894986606|0;s=(s<<10|s>>>22)+i|0;n+=(i^(s|~r))+e[10]-1051523|0;n=(n<<15|n>>>17)+s|0;r+=(s^(n|~i))+e[1]-2054922799|0;r=(r<<21|r>>>11)+n|0;i+=(n^(r|~s))+e[8]+1873313359|0;i=(i<<6|i>>>26)+r|0;s+=(r^(i|~n))+e[15]-30611744|0;s=(s<<10|s>>>22)+i|0;n+=(i^(s|~r))+e[6]-1560198380|0;n=(n<<15|n>>>17)+s|0;r+=(s^(n|~i))+e[13]+1309151649|0;r=(r<<21|r>>>11)+n|0;i+=(n^(r|~s))+e[4]-145523070|0;i=(i<<6|i>>>26)+r|0;s+=(r^(i|~n))+e[11]-1120210379|0;s=(s<<10|s>>>22)+i|0;n+=(i^(s|~r))+e[2]+718787259|0;n=(n<<15|n>>>17)+s|0;r+=(s^(n|~i))+e[9]-343485551|0;r=(r<<21|r>>>11)+n|0;t[0]=i+t[0]|0;t[1]=r+t[1]|0;t[2]=n+t[2]|0;t[3]=s+t[3]|0}function c(t){var e=[],i;for(i=0;i<64;i+=4)e[i>>2]=t.charCodeAt(i)+(t.charCodeAt(i+1)<<8)+(t.charCodeAt(i+2)<<16)+(t.charCodeAt(i+3)<<24);return e}function f(t){var e=[],i;for(i=0;i<64;i+=4)e[i>>2]=t[i]+(t[i+1]<<8)+(t[i+2]<<16)+(t[i+3]<<24);return e}function n(t){var e=t.length,i=[1732584193,-271733879,-1732584194,271733878],r,n,s,o,a,u;for(r=64;r<=e;r+=64)h(i,c(t.substring(r-64,r)));t=t.substring(r-64);n=t.length;s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<n;r+=1)s[r>>2]|=t.charCodeAt(r)<<(r%4<<3);s[r>>2]|=128<<(r%4<<3);if(r>55){h(i,s);for(r=0;r<16;r+=1)s[r]=0}o=e*8;o=o.toString(16).match(/(.*?)(.{0,8})$/);a=parseInt(o[2],16);u=parseInt(o[1],16)||0;s[14]=a;s[15]=u;h(i,s);return i}function s(t){var e=t.length,i=[1732584193,-271733879,-1732584194,271733878],r,n,s,o,a,u;for(r=64;r<=e;r+=64)h(i,f(t.subarray(r-64,r)));t=r-64<e?t.subarray(r-64):new Uint8Array(0);n=t.length;s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(r=0;r<n;r+=1)s[r>>2]|=t[r]<<(r%4<<3);s[r>>2]|=128<<(r%4<<3);if(r>55){h(i,s);for(r=0;r<16;r+=1)s[r]=0}o=e*8;o=o.toString(16).match(/(.*?)(.{0,8})$/);a=parseInt(o[2],16);u=parseInt(o[1],16)||0;s[14]=a;s[15]=u;h(i,s);return i}function i(t){var e="",i;for(i=0;i<4;i+=1)e+=r[t>>i*8+4&15]+r[t>>i*8&15];return e}function o(t){var e;for(e=0;e<t.length;e+=1)t[e]=i(t[e]);return t.join("")}if(o(n("hello"))!=="5d41402abc4b2a76b9719d911017c592");if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice)(function(){function h(t,e){t=t|0||0;if(t<0)return Math.max(t+e,0);return Math.min(t,e)}ArrayBuffer.prototype.slice=function(t,e){var i=this.byteLength,r=h(t,i),n=i,s,o,a,u;if(e!==l)n=h(e,i);if(r>n)return new ArrayBuffer(0);s=n-r;o=new ArrayBuffer(s);a=new Uint8Array(o);u=new Uint8Array(this,r,s);a.set(u);return o}})();function a(t){if(/[\u0080-\uFFFF]/.test(t))t=unescape(encodeURIComponent(t));return t}function e(t,e){var i=t.length,r=new ArrayBuffer(i),n=new Uint8Array(r),s;for(s=0;s<i;s+=1)n[s]=t.charCodeAt(s);return e?n:r}function u(t){return String.fromCharCode.apply(null,new Uint8Array(t))}function p(t,e,i){var r=new Uint8Array(t.byteLength+e.byteLength);r.set(new Uint8Array(t));r.set(new Uint8Array(e),t.byteLength);return i?r:r.buffer}function d(t){var e=[],i=t.length,r;for(r=0;r<i-1;r+=2)e.push(parseInt(t.substr(r,2),16));return String.fromCharCode.apply(String,e)}function g(){this.reset()}return g.prototype.append=function(t){this.appendBinary(a(t));return this},g.prototype.appendBinary=function(t){this._buff+=t;this._length+=t.length;var e=this._buff.length,i;for(i=64;i<=e;i+=64)h(this._hash,c(this._buff.substring(i-64,i)));this._buff=this._buff.substring(i-64);return this},g.prototype.end=function(t){var e=this._buff,i=e.length,r,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(r=0;r<i;r+=1)n[r>>2]|=e.charCodeAt(r)<<(r%4<<3);this._finish(n,i);s=o(this._hash);if(t)s=d(s);this.reset();return s},g.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this},g.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},g.prototype.setState=function(t){this._buff=t.buff;this._length=t.length;this._hash=t.hash;return this},g.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length},g.prototype._finish=function(t,e){var i=e,r,n,s;t[i>>2]|=128<<(i%4<<3);if(i>55){h(this._hash,t);for(i=0;i<16;i+=1)t[i]=0}r=this._length*8;r=r.toString(16).match(/(.*?)(.{0,8})$/);n=parseInt(r[2],16);s=parseInt(r[1],16)||0;t[14]=n;t[15]=s;h(this._hash,t)},g.hash=function(t,e){return g.hashBinary(a(t),e)},g.hashBinary=function(t,e){var i=n(t),r=o(i);return e?d(r):r},(g.ArrayBuffer=function(){this.reset()}).prototype.append=function(t){var e=p(this._buff.buffer,t,true),i=e.length,r;this._length+=t.byteLength;for(r=64;r<=i;r+=64)h(this._hash,f(e.subarray(r-64,r)));this._buff=r-64<i?new Uint8Array(e.buffer.slice(r-64)):new Uint8Array(0);return this},g.ArrayBuffer.prototype.end=function(t){var e=this._buff,i=e.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n,s;for(n=0;n<i;n+=1)r[n>>2]|=e[n]<<(n%4<<3);this._finish(r,i);s=o(this._hash);if(t)s=d(s);this.reset();return s},g.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this},g.ArrayBuffer.prototype.getState=function(){var t=g.prototype.getState.call(this);t.buff=u(t.buff);return t},g.ArrayBuffer.prototype.setState=function(t){t.buff=e(t.buff,true);return g.prototype.setState.call(this,t)},g.ArrayBuffer.prototype.destroy=g.prototype.destroy,g.ArrayBuffer.prototype._finish=g.prototype._finish,g.ArrayBuffer.hash=function(t,e){var i=s(new Uint8Array(t)),r=o(i);return e?d(r):r},g}()}),TEST_URL="http://localhost:8082/rest/store/v1/store/upload",UPLOAD_URL="http://localhost:8082/rest/store/v1/store/upload",MERGE_URL="http://localhost:8082/rest/store/v1/store/merge",uploadState={Success:1,AllowMerge:2,CurrentChunkFailed:3,BreakpointContinuation:4,CurrentChunkSuccess:5,DenyMerge:6,MergeFailed:7,VerifyFailed:8,CurrentChunkLocked:9,Uploading:10,UploadMinIOFailed:11,MinioCreatBucketFailed:12,CreateLocalTempDirFailed:13,InitDbFailed:14},version="__VERSION__",isServer="undefined"==typeof window,ie10plus=!isServer&&window.navigator.msPointerEnabled,support=function(){var e,t,i;return!isServer&&(e="slice",t=utils.isDefined(window.File)&&utils.isDefined(window.Blob)&&utils.isDefined(window.FileList),i=null,t&&(i=window.Blob.prototype,utils.each(["slice","webkitSlice","mozSlice"],function(t){if(i[t])return e=t,!1}),t=!!i[e]),t&&(Uploader.sliceName=e),i=null,t)}(),supportDirectory=function(){var t,e;return!isServer&&((e=window.document.createElement("input")).type="file",t="webkitdirectory"in e||"directory"in e,e=null,t)}();function Uploader(t){this.support=support,this.support&&(this.supportDirectory=supportDirectory,utils.defineNonEnumerable(this,"filePaths",{}),this.opts=utils.extend({},Uploader.defaults,t||{}),this.preventEvent=utils.bind(this._preventEvent,this),File.call(this,this))}var webAPIFileRead=function(t,e,i,r,n){n.readFinished(t.file[Uploader.sliceName](i,r,e))};Uploader.version=version,Uploader.defaults={chunkSize:5242880,forceChunkSize:!1,autoUpload:!1,simultaneousUploads:3,singleFile:!1,fileParameterName:"file",progressCallbacksInterval:500,speedSmoothingFactor:.1,query:{},headers:{},withCredentials:!1,hashType:"xxhash",preprocess:function(t){var e;""===t.file.hash||null==t.file.hash?"md5"===(e=t.uploader).opts.hashType?e._calcMd5(t):e._calcXxhash(t):t.preprocessFinished()},method:"multipart",testMethod:"GET",uploadMethod:"POST",mergeMethod:"POST",prioritizeFirstAndLastChunk:!1,allowDuplicateUploads:!1,target:function(t,e,i,r){return i?TEST_URL:r?MERGE_URL:UPLOAD_URL},testChunks:!0,generateUniqueIdentifier:null,generateUniqueFilePath:null,maxChunkRetries:3,chunkRetryInterval:null,permanentErrors:[400,404,415,500,501,502,503],successStatuses:[200,201,202],onDropStopPropagation:!1,initFileFn:null,readFileFn:webAPIFileRead,checkChunkUploadedByResponse:function(t,e){return(e=JSON.parse(e)).state===uploadState.Success?(t.needUpload=!1,t.file.merged||(t.file.merged=!0),!0):e.state===uploadState.AllowMerge?(t.needUpload=!1,t.file.canMerge||(t.file.canMerge=!0),!0):e.state===uploadState.BreakpointContinuation&&!e.notYetUpload.includes(t.offset+1)&&!(t.needUpload=!1)},initialPaused:!0,processTest:function(e,i,t){try{var r=JSON.parse(e);r.state===uploadState.MinioCreatBucketFailed||r.state===uploadState.CreateLocalTempDirFailed||r.state===uploadState.InitDbFailed?i(!0,e):i(null,e)}catch(t){i(!0,e)}},processResponse:function(t,e,i,r){e(null,t)},processMerge:function(e,i,t,r){try{var n=JSON.parse(e);n.state===uploadState.DenyMerge||n.state===uploadState.MergeFailed||n.state===uploadState.VerifyFailed?i(!0,e):(t.merged=!0,i(null,e))}catch(t){i(!0,e)}},processParams:function(t,e,i,r,n){return r?{fileName:t.filename,identifier:t.identifier,chunkNumber:t.chunkNumber,totalChunks:t.totalChunks,totalSize:t.totalSize,clientId:""}:n?{fileName:t.filename,identifier:t.identifier,totalChunks:t.totalChunks,totalSize:t.totalSize,clientId:""}:{fileName:t.filename,identifier:t.identifier,chunkNumber:t.chunkNumber,totalChunks:t.totalChunks,totalSize:t.totalSize,currentChunkSize:t.currentChunkSize,clientId:""}},statusText:{success:"上传成功",error:"上传出错",uploading:"上传中",paused:"上传暂停",pending:"等待上传",waiting:"等待上传",calculating:"正在计算唯一 id",merging:"合并中"}},Uploader.utils=utils,Uploader.event=event,Uploader.File=File,Uploader.Chunk=Chunk,Uploader.prototype=utils.extend({},File.prototype),utils.extend(Uploader.prototype,event),utils.extend(Uploader.prototype,{constructor:Uploader,_trigger:function(t){var e=utils.toArray(arguments),i=!this.trigger.apply(this,arguments);return"catchAll"!==t&&(e.unshift("catchAll"),i=!this.trigger.apply(this,e)||i),!i},_triggerAsync:function(){var t=arguments;utils.nextTick(function(){this._trigger.apply(this,t)},this)},addFiles:function(t,i){var r=[],e=this.fileList.length,t=(utils.each(t,function(t){var e;(!ie10plus||0<t.size)&&(t.size%4096!=0||"."!==t.name&&"."!==t.fileName)&&(e=this.generateUniqueFilePath(t),!this.opts.allowDuplicateUploads&&this.getFromUniqueFilePath(e)||((t=new File(this,t,this)).uniqueFilePath=e,this._trigger("fileAdded",t,i)?r.push(t):File.prototype.removeFile.call(this,t)))},this),this.fileList.slice(e));this._trigger("filesAdded",r,t,i)?(utils.each(r,function(t){this.opts.singleFile&&0<this.files.length&&this.removeFile(this.files[0]),this.files.push(t),this._trigger("fileStatus",t,t.status,this.opts.statusText[t.status])},this),this._trigger("filesSubmitted",r,t,i),this.opts.autoUpload&&this.resume()):utils.each(t,function(t){File.prototype.removeFile.call(this,t)},this)},addFile:function(t,e){this.addFiles([t],e)},cancel:function(){for(var t=this.fileList.length-1;0<=t;t--)this.fileList[t].cancel()},removeFile:function(t){File.prototype.removeFile.call(this,t),this._trigger("fileRemoved",t)},generateUniqueFilePath:function(t){var e=this.opts.generateUniqueFilePath;return utils.isFunction(e)?e(t):t.relativePath||t.webkitRelativePath||t.fileName||t.name},getFromUniqueFilePath:function(e){var i=!1;return utils.each(this.files,function(t){if(t.uniqueFilePath===e)return i=t,!1}),i},generateUniqueIdentifier:function(t){var e=this.opts.generateUniqueIdentifier;return utils.isFunction(e)?e(t):(e=t.relativePath||t.webkitRelativePath||t.fileName||t.name,t.size+"-"+e.replace(/[^0-9a-zA-Z_-]/gim,""))},getFromUniqueIdentifier:function(e){var i=!1;return utils.each(this.files,function(t){if(t.uniqueIdentifier===e)return i=t,!1}),i},uploadNextChunk:function(t){var i,e,r=!1,n=Chunk.STATUS.PENDING,s=this.uploader.opts.checkChunkUploadedByResponse;return this.opts.prioritizeFirstAndLastChunk&&(utils.each(this.files,function(t){if(!t.paused&&(!s||t._firstResponse||!t.isUploading()))return t.chunks.length&&t.chunks[0].status()===n?(t.chunks[0].send(),!(r=!0)):1<t.chunks.length&&t.chunks[t.chunks.length-1].status()===n?(t.chunks[t.chunks.length-1].send(),!(r=!0)):void 0}),r)?r:(utils.each((i=this).files,function(t){if(!t.paused&&t.status!==File.FILE_STATUS.SUCCESS&&t.status!==File.FILE_STATUS.ERROR){if(s&&!t._firstResponse&&t.isUploading())return;var e;utils.each(t.chunks,function(t){if(t.status()===n)return t.send(),!(r=!0)}),t.merged||(t.canMerge?t.status!==File.FILE_STATUS.MERGING&&(i._trigger("fileMergeStart",t),t.status=File.FILE_STATUS.MERGING,i._trigger("fileStatus",t,t.status,i.opts.statusText[t.status]),t.chunks[0]&&t.chunks[0].merge()):(e=!0,utils.each(t.chunks,function(t){if(t.needUpload)return e=!1}),e&&!t.isTesting&&(t.isTesting=!0,t.chunks[0]&&t.chunks[0].test())))}if(r)return!1}),!!r||(e=!1,utils.each(this.files,function(t){if(!t.isComplete())return!(e=!0)}),e||t||!this.files.length||this._triggerAsync("complete"),e))},upload:function(t){var e=this._shouldUploadNext();if(!1!==e){t||this._trigger("uploadStart");for(var i=!1,r=1;r<=this.opts.simultaneousUploads-e&&((i=this.uploadNextChunk(!t)||i)||!t);r++);i||t||this._triggerAsync("complete")}},_shouldUploadNext:function(){var e=0,i=!0,r=this.opts.simultaneousUploads,n=Chunk.STATUS.UPLOADING;return utils.each(this.files.filter(function(t){return"success"!==t.status}),function(t){return utils.each(t.chunks,function(t){if(t.status()===n&&r<=++e)return i=!1}),i}),i&&e},_calcXxhash:function(l){var c=l.uploader;new Promise(function(){var i=_asyncToGenerator(_regeneratorRuntime().mark(function t(i){var r,n,s,o,a,u,h;return _regeneratorRuntime().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return h=function(){var t=s*o,e=t+o>=l.file.size?l.file.size:t+o;u.readAsArrayBuffer(l.file.file[Uploader.sliceName].call(l.file.file,t,e))},c._trigger("calcHashStart",l.file),l.file.status=File.FILE_STATUS.CALCULATING,c._trigger("fileStatus",l.file,l.file.status,c.opts.statusText[l.file.status]),t.next=6,e();case 6:r=t.sent,r=r.create64,n=r(),(new Date).getTime(),s=0,o=5242880,a=Math.ceil(l.file.size/o),(u=new FileReader).onload=function(t){var t=new Uint8Array(t.target.result);n.update(t),s<a?(s++,h()):(t=n.digest().toString(16).padStart(16,"0"),i(t))},u.onerror=function(){},h();case 17:case"end":return t.stop()}},t)}));return function(t){return i.apply(this,arguments)}}()).then(function(t){l.file.hash=l.file.uniqueIdentifier=t,c._trigger("calcHashEnd",l.file,t),l.file.status=File.FILE_STATUS.UPLOADING,c._trigger("fileStatus",l.file,l.file.status,c.opts.statusText[l.file.status]),l.preprocessFinished()})},_calcMd5:function(u){var h=u.uploader;new Promise(function(e){h._trigger("calcHashStart",u.file),u.file.status=File.FILE_STATUS.CALCULATING,h._trigger("fileStatus",u.file,u.file.status,h.opts.statusText[u.file.status]);var i=new sparkMd5.ArrayBuffer,r=((new Date).getTime(),0),n=5242880,s=Math.ceil(u.file.size/n),o=new FileReader;function a(){var t=r*n,e=t+n>=u.file.size?u.file.size:t+n;o.readAsArrayBuffer(u.file.file[Uploader.sliceName].call(u.file.file,t,e))}o.onload=function(t){i.append(t.target.result),r<s?(r++,a()):(t=i.end(),e(t))},o.onerror=function(){},a()}).then(function(t){u.file.hash=u.file.uniqueIdentifier=t,h._trigger("calcHashEnd",u.file,t),u.file.status=File.FILE_STATUS.UPLOADING,h._trigger("fileStatus",u.file,u.file.status,h.opts.statusText[u.file.status]),u.preprocessFinished()})},assignBrowse:function(t,n,s,o){void 0===t.length&&(t=[t]),utils.each(t,function(e){"INPUT"===e.tagName&&"file"===e.type?i=e:((i=document.createElement("input")).setAttribute("type","file"),utils.extend(i.style,{visibility:"hidden",position:"absolute",width:"1px",height:"1px"}),e.appendChild(i),e.addEventListener("click",function(t){"label"!==e.tagName.toLowerCase()&&i.click()},!1)),this.opts.singleFile||s||i.setAttribute("multiple","multiple"),n&&i.setAttribute("webkitdirectory","webkitdirectory"),o&&utils.each(o,function(t,e){i.setAttribute(e,t)});var i,r=this;i.addEventListener("change",function(t){r._trigger(t.type,t),t.target.value&&(r.addFiles(t.target.files,t),t.target.value="")},!1)},this)},onDrop:function(t){this._trigger(t.type,t),this.opts.onDropStopPropagation&&t.stopPropagation(),t.preventDefault(),this._parseDataTransfer(t.dataTransfer,t)},_parseDataTransfer:function(t,e){t.items&&t.items[0]&&t.items[0].webkitGetAsEntry?this.webkitReadDataTransfer(t,e):this.addFiles(t.files,e)},webkitReadDataTransfer:function(t,e){var i=this,r=t.items.length,n=[];function s(t,e){t.relativePath=e.substring(1),n.push(t),a()}function o(t){throw t}function a(){0==--r&&i.addFiles(n,e)}utils.each(t.items,function(t){var e=t.webkitGetAsEntry();e?e.isFile?s(t.getAsFile(),e.fullPath):function i(e){e.readEntries(function(t){t.length?(r+=t.length,utils.each(t,function(t){var e;t.isFile?(e=t.fullPath,t.file(function(t){s(t,e)},o)):t.isDirectory&&i(t.createReader())}),i(e)):a()},o)}(e.createReader()):a()})},_assignHelper:function(t,e,i){void 0===t.length&&(t=[t]);var r=i?"removeEventListener":"addEventListener";utils.each(t,function(i){utils.each(e,function(t,e){i[r](e,t,!1)},this)},this)},_preventEvent:function(t){utils.preventEvent(t),this._trigger(t.type,t)},assignDrop:function(t){this._onDrop=utils.bind(this.onDrop,this),this._assignHelper(t,{dragover:this.preventEvent,dragenter:this.preventEvent,dragleave:this.preventEvent,drop:this._onDrop})},unAssignDrop:function(t){this._assignHelper(t,{dragover:this.preventEvent,dragenter:this.preventEvent,dragleave:this.preventEvent,drop:this._onDrop},!0),this._onDrop=null}});export{FILE_STATUS,Uploader as default};