tt-uploader 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TTUploader=t():e.TTUploader=t()}("undefined"!=typeof self?self:this,function(){return function(r){var o={};function __webpack_require__(e){var t;return(o[e]||(t=o[e]={i:e,l:!1,exports:{}},r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t)).exports}return __webpack_require__.m=r,__webpack_require__.c=o,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(__webpack_require__.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)__webpack_require__.d(r,o,function(e){return t[e]}.bind(null,o));return r},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=9)}([function(e,t,r){"use strict";var o="object"==typeof Reflect?Reflect:null,c=o&&"function"==typeof o.apply?o.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};var n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)},i=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(r,o){return new Promise(function(e,t){function errorListener(e){r.removeListener(o,resolver),t(e)}function resolver(){"function"==typeof r.removeListener&&r.removeListener("error",errorListener),e([].slice.call(arguments))}eventTargetAgnosticAddListener(r,o,resolver,{once:!0}),"error"!==o&&function addErrorHandlerIfEventEmitter(e,t,r){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,r)}(r,errorListener,{once:!0})})},(EventEmitter.EventEmitter=EventEmitter).prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var s=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,r,o){var n,i;return checkListener(r),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,r.listener||r),n=e._events),i=n[t]),void 0===i?(i=n[t]=r,++e._eventsCount):("function"==typeof i?i=n[t]=o?[r,i]:[i,r]:o?i.unshift(r):i.push(r),0<(n=_getMaxListeners(e))&&i.length>n&&!i.warned&&(i.warned=!0,(o=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=i.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(o))),e}function _onceWrap(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function _listeners(e,t,r){var e=e._events;return void 0===e||void 0===(e=e[t])?[]:"function"==typeof e?r?[e.listener||e]:[e]:r?function unwrapListeners(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(e):arrayClone(e,e.length)}function listenerCount(e){var t=this._events;if(void 0!==t){t=t[e];if("function"==typeof t)return 1;if(void 0!==t)return t.length}return 0}function arrayClone(e,t){for(var r=new Array(t),o=0;o<t;++o)r[o]=e[o];return r}function eventTargetAgnosticAddListener(t,r,o,n){if("function"==typeof t.on)n.once?t.once(r,o):t.on(r,o);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(r,function wrapListener(e){n.once&&t.removeEventListener(r,wrapListener),o(e)})}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function setMaxListeners(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,n=this._events;if(void 0!==n)o=o&&void 0===n.error;else if(!o)return!1;if(o){if((i=0<t.length?t[0]:i)instanceof Error)throw i;o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var i=n[e];if(void 0===i)return!1;if("function"==typeof i)c(i,this,t);else for(var s=i.length,a=arrayClone(i,s),r=0;r<s;++r)c(a[r],this,t);return!0},EventEmitter.prototype.on=EventEmitter.prototype.addListener=function addListener(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.prependListener=function prependListener(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function once(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener=function removeListener(e,t){var r,o,n,i,s;if(checkListener(t),void 0!==(o=this._events)&&void 0!==(r=o[e]))if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;0<=i;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,n=i;break}if(n<0)return this;0===n?r.shift():function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(o[e]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t,r=this._events;if(void 0!==r)if(void 0===r.removeListener)0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]);else if(0===arguments.length){for(var o,n=Object.keys(r),i=0;i<n.length;++i)"removeListener"!==(o=n[i])&&this.removeAllListeners(o);this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;0<=i;i--)this.removeListener(e,t[i]);return this},EventEmitter.prototype.listeners=function listeners(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function rawListeners(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return 0<this._eventsCount?n(this._events):[]}},function(n,i,s){!function(r){var o;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"object"==_typeof(i)&&void 0!==n?n.exports=e():void 0!==(o="function"==typeof(o=e)?o.call(i,s,i,n):o)&&(n.exports=o)}(function(){"use strict";function e(e,t){for(var r,o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==_typeof(r=function(e){if("object"!=_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(n.key))?r:String(r),n)}}function t(e,t,r){return e(r={path:t,exports:{},require:function require(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var r=t(function(e,t){e.exports=function(u){var r=Object.create||function(){function e(){}return function(t){return e.prototype=t,t=new e,e.prototype=null,t}}(),e={},t=e.lib={},o=t.Base={extend:function extend(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function create(){var e=this.extend();return e.init.apply(e,arguments),e},init:function init(){},mixIn:function mixIn(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function clone(){return this.init.prototype.extend(this)}},l=t.WordArray=o.extend({init:function init(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function toString(e){return(e||s).stringify(this)},concat:function concat(e){var t=this.words,r=e.words,o=this.sigBytes,n=e.sigBytes;if(this.clamp(),o%4)for(var i=0;i<n;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[o+i>>>2]|=s<<24-(o+i)%4*8}else for(i=0;i<n;i+=4)t[o+i>>>2]=r[i>>>2];return this.sigBytes+=n,this},clamp:function clamp(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=u.ceil(t/4)},clone:function clone(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function random(e){for(var t=[],r=function i(e){var t=987654321,r=4294967295;return function(){return((((t=36969*(65535&t)+(t>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r)/4294967296+.5)*(.5<u.random()?1:-1)}},o=0;o<e;o+=4){var n=r(4294967296*(i||u.random())),i=987654071*n();t.push(4294967296*n()|0)}return new l.init(t,e)}}),n=e.enc={},s=n.Hex={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,o=[],n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push((i>>>4).toString(16)),o.push((15&i).toString(16))}return o.join("")},parse:function parse(e){for(var t=e.length,r=[],o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new l.init(r,t/2)}},a=n.Latin1={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,o=[],n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push(String.fromCharCode(i))}return o.join("")},parse:function parse(e){for(var t=e.length,r=[],o=0;o<t;o++)r[o>>>2]|=(255&e.charCodeAt(o))<<24-o%4*8;return new l.init(r,t)}},c=n.Utf8={stringify:function stringify(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function parse(e){return a.parse(unescape(encodeURIComponent(e)))}},p=t.BufferedBlockAlgorithm=o.extend({reset:function reset(){this._data=new l.init,this._nDataBytes=0},_append:function _append(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function _process(e){var t=this._data,r=t.words,o=t.sigBytes,n=this.blockSize,i=o/(4*n),s=(e?u.ceil(i):u.max((0|i)-this._minBufferSize,0))*n,e=u.min(4*s,o);if(s){for(var a=0;a<s;a+=n)this._doProcessBlock(r,a);var c=r.splice(0,s);t.sigBytes-=e}return new l.init(c,e)},clone:function clone(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(t.Hasher=p.extend({cfg:o.extend(),init:function init(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function reset(){p.reset.call(this),this._doReset()},update:function update(e){return this._append(e),this._process(),this},finalize:function finalize(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function _createHelper(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function _createHmacHelper(r){return function(e,t){return new f.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e}(Math)}),o=t(function(e,t){var c;e.exports=(c=r,function(i){var e=c,r=e.lib,o=r.WordArray,s=r.Hasher,r=e.algo,a=[],h=[],y=(!function(){function n(e){return 4294967296*(e-(0|e))|0}for(var e=2,t=0;t<64;)!function t(e){for(var r=i.sqrt(e),o=2;o<=r;o++)if(!(e%o))return;return 1}(e)||(t<8&&(a[t]=n(i.pow(e,.5))),h[t]=n(i.pow(e,1/3)),t++),e++}(),[]),r=r.SHA256=s.extend({_doReset:function _doReset(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function _doProcessBlock(e,t){for(var r=this._hash.words,o=r[0],n=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],p=0;p<64;p++){y[p]=p<16?0|e[t+p]:(((f=y[p-15])<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+y[p-7]+(((f=y[p-2])<<15|f>>>17)^(f<<13|f>>>19)^f>>>10)+y[p-16];var f=o&n^o&i^n&i,d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+h[p]+y[p],l=u,u=c,c=a,a=s+d|0,s=i,i=n,n=o,o=d+(((o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22))+f)|0}r[0]=r[0]+o|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+l|0},_doFinalize:function _doFinalize(){var e=this._data,t=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=i.floor(r/4294967296),t[15+(64+o>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function clone(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=s._createHelper(r),e.HmacSHA256=s._createHmacHelper(r)}(Math),c.SHA256)}),n=(t(function(e,t){var a;e.exports=(e=r.lib.Base,a=r.enc.Utf8,void(r.algo.HMAC=e.extend({init:function init(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var r=e.blockSize,o=4*r;(t=t.sigBytes>o?e.finalize(t):t).clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),n=e.words,i=t.words,s=0;s<r;s++)n[s]^=1549556828,i[s]^=909522486;e.sigBytes=t.sigBytes=o,this.reset()},reset:function reset(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function update(e){return this._hasher.update(e),this},finalize:function finalize(e){var t=this._hasher,e=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(e))}})))}),t(function(e,t){e.exports=r.HmacSHA256})),i=function hmac(e,t){return n(t,e)},s=function sha256(e){return o(e)},a=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id"],u=function a(e){try{return encodeURIComponent(e).replace(/[^A-Za-z0-9_.~\-%]+/g,escape).replace(/[*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())})}catch(e){return""}},l=function c(r){return Object.keys(r).sort().map(function(e){var t=r[e];if(null!=t){e=u(e);if(e)return Array.isArray(t)?"".concat(e,"=").concat(t.map(u).sort().join("&".concat(e,"="))):"".concat(e,"=").concat(u(t))}}).filter(function(e){return e}).join("&")};return function(){function t(e,r,o){!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.request=e,this.request.headers=e.headers||{},this.serviceName=r,this.signatureCache="boolean"!=typeof(o=o||{}).signatureCache||o.signatureCache,this.operation=o.operation,this.signatureVersion=o.signatureVersion,this.constant=o.isVolcengine?{algorithm:"HMAC-SHA256",v4Identifier:"request",dateHeader:"X-Date",tokenHeader:"x-security-token",contentSha256Header:"X-Content-Sha256",kDatePrefix:""}:{algorithm:"AWS4-HMAC-SHA256",v4Identifier:"aws4_request",dateHeader:"X-Amz-Date",tokenHeader:"x-amz-security-token",contentSha256Header:"X-Amz-Content-Sha256",kDatePrefix:"AWS4"},this.bodySha256=o.bodySha256,this.shouldSerializeBody="boolean"!=typeof o.shouldSerializeBody||o.shouldSerializeBody}var r=t;return e(r.prototype,[{key:"addAuthorization",value:function value(e,t){t=this.iso8601(t).replace(/[:\-]|\.\d{3}/g,"");this.addHeaders(e,t),this.request.headers.Authorization=this.authorization(e,t)}},{key:"addHeaders",value:function value(e,t){this.request.headers[this.constant.dateHeader]=t,e.sessionToken&&(this.request.headers[this.constant.tokenHeader]=e.sessionToken),this.request.body&&("string"!=typeof(t=this.request.body)&&this.shouldSerializeBody&&(t=t instanceof URLSearchParams?t.toString():JSON.stringify(t)),this.request.headers[this.constant.contentSha256Header]=this.bodySha256||s(t).toString())}},{key:"authorization",value:function value(e,t){var r=[],o=this.credentialString(t);return r.push("".concat(this.constant.algorithm," Credential=").concat(e.accessKeyId,"/").concat(o)),r.push("SignedHeaders=".concat(this.signedHeaders())),r.push("Signature=".concat(this.signature(e,t))),r.join(", ")}},{key:"signature",value:function value(e,t){e=this.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return i(e,this.stringToSign(t),"hex")}},{key:"stringToSign",value:function value(e){var t=[];return t.push(this.constant.algorithm),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")}},{key:"canonicalString",value:function value(){var e=[],t=this.request.pathname||"/";return e.push(this.request.method.toUpperCase()),e.push(t),e.push(l(this.request.params)||""),e.push("".concat(this.canonicalHeaders(),"\n")),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")}},{key:"canonicalHeaders",value:function value(){var r=this,t=[],o=(Object.keys(this.request.headers).forEach(function(e){t.push([e,r.request.headers[e]])}),t.sort(function(e,t){return e[0].toLowerCase()<t[0].toLowerCase()?-1:1}),[]);return t.forEach(function(e){var t=e[0].toLowerCase();if(r.isSignableHeader(t)){e=e[1];if(null==e||"function"!=typeof e.toString)throw new Error("Header ".concat(t," contains invalid value"));o.push("".concat(t,":").concat(r.canonicalHeaderValues(e.toString())))}}),o.join("\n")}},{key:"canonicalHeaderValues",value:function value(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}},{key:"signedHeaders",value:function value(){var t=this,r=[];return Object.keys(this.request.headers).forEach(function(e){e=e.toLowerCase(),t.isSignableHeader(e)&&r.push(e)}),r.sort().join(";")}},{key:"credentialString",value:function value(e){return this.createScope(e.substr(0,8),this.request.region,this.serviceName)}},{key:"hexEncodedHash",value:function value(e){return s(e)}},{key:"hexEncodedBodyHash",value:function value(){return this.request.headers[this.constant.contentSha256Header]||(this.request.body?this.hexEncodedHash(l(this.request.body)):this.hexEncodedHash(""))}},{key:"isSignableHeader",value:function value(e){return 0===e.toLowerCase().indexOf("x-amz-")||a.indexOf(e)<0}},{key:"iso8601",value:function value(e){return(e=void 0===e?new Date:e).toISOString().replace(/\.\d{3}Z$/,"Z")}},{key:"getSigningKey",value:function value(e,t,r,o){e=i("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey),t),t=i(e,r),e=i(t,o);return i(e,this.constant.v4Identifier)}},{key:"createScope",value:function value(e,t,r){return[e.substr(0,8),t,r,this.constant.v4Identifier].join("/")}}]),Object.defineProperty(r,"prototype",{writable:!1}),t}()})}.call(this,s(7))},function(e,t,r){e.exports=function(){var e=e||function(p,r){var o=Object.create||function(){function F(){}return function(e){var t;F.prototype=e;t=new F;F.prototype=null;return t}}();var e={};var t=e.lib={};var n=t.Base=function(){return{extend:function(e){var t=o(this);if(e)t.mixIn(e);if(!t.hasOwnProperty("init")||this.init===t.init)t.init=function(){t.$super.init.apply(this,arguments)};t.init.prototype=t;t.$super=this;return t},create:function(){var e=this.extend();e.init.apply(e,arguments);return e},init:function(){},mixIn:function(e){for(var t in e)if(e.hasOwnProperty(t))this[t]=e[t];if(e.hasOwnProperty("toString"))this.toString=e.toString},clone:function(){return this.init.prototype.extend(this)}}}();var f=t.WordArray=n.extend({init:function(e,t){e=this.words=e||[];if(t!=r)this.sigBytes=t;else this.sigBytes=e.length*4},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words;var r=e.words;var o=this.sigBytes;var n=e.sigBytes;this.clamp();if(o%4)for(var i=0;i<n;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[o+i>>>2]|=s<<24-(o+i)%4*8}else for(var i=0;i<n;i+=4)t[o+i>>>2]=r[i>>>2];this.sigBytes+=n;return this},clamp:function(){var e=this.words;var t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8;e.length=p.ceil(t/4)},clone:function(){var e=n.clone.call(this);e.words=this.words.slice(0);return e},random:function(e){var t=[];var r=function(t){var t=t;var r=987654321;var o=4294967295;return function(){r=36969*(r&65535)+(r>>16)&o;t=18e3*(t&65535)+(t>>16)&o;var e=(r<<16)+t&o;e/=4294967296;e+=.5;return e*(p.random()>.5?1:-1)}};for(var o=0,n;o<e;o+=4){var i=r((n||p.random())*4294967296);n=i()*987654071;t.push(i()*4294967296|0)}return new f.init(t,e)}});var i=e.enc={};var s=i.Hex={stringify:function(e){var t=e.words;var r=e.sigBytes;var o=[];for(var n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push((i>>>4).toString(16));o.push((i&15).toString(16))}return o.join("")},parse:function(e){var t=e.length;var r=[];for(var o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new f.init(r,t/2)}};var a=i.Latin1={stringify:function(e){var t=e.words;var r=e.sigBytes;var o=[];for(var n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push(String.fromCharCode(i))}return o.join("")},parse:function(e){var t=e.length;var r=[];for(var o=0;o<t;o++)r[o>>>2]|=(e.charCodeAt(o)&255)<<24-o%4*8;return new f.init(r,t)}};var c=i.Utf8={stringify:function(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return a.parse(unescape(encodeURIComponent(e)))}};var u=t.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new f.init;this._nDataBytes=0},_append:function(e){if(typeof e=="string")e=c.parse(e);this._data.concat(e);this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data;var r=t.words;var o=t.sigBytes;var n=this.blockSize;var i=n*4;var s=o/i;if(e)s=p.ceil(s);else s=p.max((s|0)-this._minBufferSize,0);var a=s*n;var c=p.min(a*4,o);if(a){for(var u=0;u<a;u+=n)this._doProcessBlock(r,u);var l=r.splice(0,a);t.sigBytes-=c}return new f.init(l,c)},clone:function(){var e=n.clone.call(this);e._data=this._data.clone();return e},_minBufferSize:0});var l=t.Hasher=u.extend({cfg:n.extend(),init:function(e){this.cfg=this.cfg.extend(e);this.reset()},reset:function(){u.reset.call(this);this._doReset()},update:function(e){this._append(e);this._process();return this},finalize:function(e){if(e)this._append(e);var t=this._doFinalize();return t},blockSize:512/32,_createHelper:function(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function(r){return function(e,t){return new d.HMAC.init(r,t).finalize(e)}}});var d=e.algo={};return e}(Math);return e}()},function(e,t,r){e.exports=function(c){return function(n){var e=c;var t=e.lib;var r=t.WordArray;var o=t.Hasher;var i=e.algo;var s=[];var x=[];(function(){function isPrime(e){var t=n.sqrt(e);for(var r=2;r<=t;r++)if(!(e%r))return false;return true}function getFractionalBits(e){return(e-(e|0))*4294967296|0}var e=2;var t=0;while(t<64){if(isPrime(e)){if(t<8)s[t]=getFractionalBits(n.pow(e,1/2));x[t]=getFractionalBits(n.pow(e,1/3));t++}e++}})();var k=[];var a=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(e,t){var r=this._hash.words;var o=r[0];var n=r[1];var i=r[2];var s=r[3];var a=r[4];var c=r[5];var u=r[6];var l=r[7];for(var p=0;p<64;p++){if(p<16)k[p]=e[t+p]|0;else{var f=k[p-15];var d=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3;var h=k[p-2];var y=(h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10;k[p]=d+k[p-7]+y+k[p-16]}var _=a&c^~a&u;var g=o&n^o&i^n&i;var m=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22);var v=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25);var b=l+v+_+x[p]+k[p];var w=m+g;l=u;u=c;c=a;a=s+b|0;s=i;i=n;n=o;o=b+w|0}r[0]=r[0]+o|0;r[1]=r[1]+n|0;r[2]=r[2]+i|0;r[3]=r[3]+s|0;r[4]=r[4]+a|0;r[5]=r[5]+c|0;r[6]=r[6]+u|0;r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data;var t=e.words;var r=this._nDataBytes*8;var o=e.sigBytes*8;t[o>>>5]|=128<<24-o%32;t[(o+64>>>9<<4)+14]=n.floor(r/4294967296);t[(o+64>>>9<<4)+15]=r;e.sigBytes=t.length*4;this._process();return this._hash},clone:function(){var e=o.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA256=o._createHelper(a);e.HmacSHA256=o._createHmacHelper(a)}(Math),c.SHA256}(r(2))},function(e,t,r){e.exports=function(e){return e.HmacSHA256}(r(2),(r(3),r(6)))},function(e,t,r){e.exports=function(){return r(8)('!function(_){var t={};function __webpack_require__(e){var r;return(t[e]||(r=t[e]={i:e,l:!1,exports:{}},_[e].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r)).exports}__webpack_require__.m=_,__webpack_require__.c=t,__webpack_require__.d=function(e,r,_){__webpack_require__.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:_})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(r,e){if(1&e&&(r=__webpack_require__(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var _=Object.create(null);if(__webpack_require__.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)__webpack_require__.d(_,t,function(e){return r[e]}.bind(null,t));return _},__webpack_require__.n=function(e){var r=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(e,r){function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}self.onmessage=function(e){var e=e.data,r=e[0],e=e[1],_=function crc32(e,r){for(var _=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],t=("undefined"!=typeof Int32Array&&(_=new Int32Array(_)),-1^~~r),n=(e=new Uint8Array(e)).length,u=0;u<n;u++)t=_[255&(t^e[u])]^t>>>8;return(-1^t)>>>0}(r,0);postMessage([r,dec2hex(_),e],[r])}}]);',null)}},function(e,t,r){e.exports=function(s){(function(){var e=s;var t=e.lib;var r=t.Base;var o=e.enc;var u=o.Utf8;var n=e.algo;var i=n.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init;if(typeof t=="string")t=u.parse(t);var r=e.blockSize;var o=r*4;if(t.sigBytes>o)t=e.finalize(t);t.clamp();var n=this._oKey=t.clone();var i=this._iKey=t.clone();var s=n.words;var a=i.words;for(var c=0;c<r;c++){s[c]^=1549556828;a[c]^=909522486}n.sigBytes=i.sigBytes=o;this.reset()},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey)},update:function(e){this._hasher.update(e);return this},finalize:function(e){var t=this._hasher;var r=t.finalize(e);t.reset();var o=t.finalize(this._oKey.clone().concat(r));return o}})})()}(r(2))},function(e,t){var r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=window.URL||window.webkitURL;e.exports=function(t,r){try{try{var o;try{(o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),o=o.getBlob()}catch(e){o=new Blob([t])}return new Worker(n.createObjectURL(o))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(e){if(r)return new Worker(r);throw Error("Inline worker is not supported")}}},function(O,r,o){"use strict";o.r(r),o.d(r,"default",function(){return Me});var r=o(0),n=o.n(r),S={debug:!1,region:"cn-north-1",initUploadFileUrl:"{tosDomain}/{oid}?uploads",uploadChunkedUrl:"{tosDomain}/{oid}?partNumber={number}&uploadID={uploadId}",uploadMergeUrl:"{tosDomain}/{oid}?uploadID={uploadId}",getUploadListUrl:"{tosDomain}/{oid}?uploadID={uploadId}",directUploadFileUrl:"{tosDomain}/{oid}",external:{},getSliceFunc:null,uploadSliceCount:5,retryUploadTime:3,retryProcess:!0,retryProcessTime:3,retryTaskTime:3,maxProcessPause:20,schema:"https",useLocalStorage:!0,log:{external:{},appId:"",userId:"",video_id:"",upload_video_url:"",upload_id:"",type:"",stage:"",video_size:0,part_count:0,slice_index:0,extra:{},msg:""},replace:{}};function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=function e(){return(s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function t(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(o=i.next()).done;)s.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function index_base_min_i(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(t(arguments[r]));return e}function Z4(e,a){var t,r=function r(e){var t=document.createElement("a");return t.href=e,t},o=window.screen.width,n=window.screen.height,i=window.navigator.appVersion,s=window.navigator.userAgent,c=window.navigator.language,u=document.referrer,l=u?r(u).hostname:"",p=function(e){var e=(e=r(e).search).slice(1),o={};return e.split("&").forEach(function(e){var t,r,e=e.split("=");e.length&&(t=e[0],r=e[1]),r=r&&r.replace(/\%/g,"%25"),o[t]=decodeURIComponent(void 0===r?"":r)}),o}(window.location.href),f="",d="",h="",y=""+parseFloat(i);-1!==(g=s.indexOf("Opera"))&&(h="Opera",y=s.substring(g+6),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)),-1!==(g=s.indexOf("Edge"))?(h="Microsoft Edge",y=s.substring(g+5)):-1!==(g=s.indexOf("MSIE"))?(h="Microsoft Internet Explorer",y=s.substring(g+5)):-1!==s.indexOf("Chrome")?-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("MQQBrowser"))?(h="qqbrowser",y=s.substring(g+11,g+15)):-1!==(g=s.indexOf("Chrome"))&&(h="Chrome",y=s.substring(g+7)):-1!==s.indexOf("Safari")?-1!==(g=s.indexOf("QQ"))?(h="qqbrowser",y=s.substring(g+10,g+16)):-1!==(g=s.indexOf("Safari"))&&(h="Safari",y=s.substring(g+7),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)):-1!==(g=s.indexOf("Firefox"))?(h="Firefox",y=s.substring(g+8)):-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("QQ"))&&(h="qqbrowser",y=s.substring(g+3,g+8)),-1!==(t=(y=-1!==(t=(y=-1!==(t=y.indexOf(";"))?y.substring(0,t):y).indexOf(" "))?y.substring(0,t):y).indexOf(")"))&&(y=y.substring(0,t));for(var _,g=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(i)?"wap":"web",m=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],v=0;v<m.length;v++){var b=m[v];if(b.r.test(s)){f=b.s;break}}function I(e,t){e=e.exec(t);return e&&e[1]?e[1]:""}switch(/Windows/.test(f)&&(d=I(/Windows (.*)/,f),f="windows"),f){case"Mac OS X":d=I(/Mac OS X (10[\.\_\d]+)/,s),f="mac";break;case"Android":d=I(/Android ([\.\_\d]+)/,_=s)||I(/Android\/([\.\_\d]+)/,_),f="android";break;case"iOS":d=(d=/OS (\d+)_(\d+)_?(\d+)?/.exec(i))?d[1]+"."+d[2]+"."+(0|d[3]):"",f="ios"}return e=e?function(){var e=a?"_tea_utm_cache_"+a:"_tea_utm_cache",t={},r={utm_source:p.utm_source,utm_medium:p.utm_medium,utm_campaign:p.utm_campaign,utm_term:p.utm_term,utm_content:p.utm_content};try{var o,n,i=window.sessionStorage,s=!1;for(o in r)r[o]&&(t[o]=r[o],s=!0);s?i.setItem(e,JSON.stringify(t)):(n=i.getItem(e))&&(t=JSON.parse(n))}catch(e){return r}return t}():{},{browser:h,browser_version:y,platform:g,os_name:f,os_version:d,userAgent:s,screen_width:o,screen_height:n,device_model:function(e){var t,r,o="";try{"android"===e?navigator.userAgent.split(";").forEach(function(e){-1<e.indexOf("Build/")&&(o=e.slice(0,e.indexOf("Build/")))}):"ios"!==e&&"mac"!==e||(r=(t=navigator.userAgent.replace("Mozilla/5.0 (","")).indexOf(";"),o=t.slice(0,r))}catch(e){}return o.trim()}(f),language:c,referrer:u,referrer_host:l,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,utm_term:e.utm_term,utm_content:e.utm_content,isSupportBeacon:("ios"!==f||"safari"!==h)&&(!(!window.navigator||!window.navigator.sendBeacon)||void 0)}}(function(e){e.exports=function i(){function e(){for(var e=0,t={};e<arguments.length;e++){var r,o=arguments[e];for(r in o)t[r]=o[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(u){function r(){}function o(t,o,n){if("undefined"!=typeof document){"number"==typeof(n=e({path:"/"},r.defaults,n)).expires&&(n.expires=new Date(+new Date+864e5*n.expires)),n.expires=n.expires?n.expires.toUTCString():"";try{var i=JSON.stringify(o);/^[\{\[]/.test(i)&&(o=i)}catch(e){}o=u.write?u.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s,a="";for(s in n)n[s]&&(a+="; "+s,!0!==n[s])&&(a+="="+n[s].split(";")[0]);return document.cookie=t+"="+o+a}}function s(e,r){if("undefined"!=typeof document){for(var o={},n=document.cookie?document.cookie.split("; "):[],i=0;i<n.length;i++){var s=n[i].split("="),a=s.slice(1).join("=");r||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var c=t(s[0]),a=(u.read||u)(a,c)||t(a);if(r)try{a=JSON.parse(a)}catch(e){}if(o[c]=a,e===c)break}catch(e){}}return e?o[e]:o}}return r.set=o,r.get=function(e){return s(e,!1)},r.getJSON=function(e){return s(e,!0)},r.remove=function(t,r){o(t,"",e(r,{expires:-1}))},r.defaults={},r.withConverter=i,r}(function(){})}()})(r={exports:{}});var C=r.exports,U=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e}(),I={getItem:function getItem(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||void 0}catch(e){}},setItem:function setItem(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(e){}},removeItem:function removeItem(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function getCookie(e){try{var t=document.cookie.match(new RegExp("(?:^|;)\\s*"+e+"=([^;]+)")),r=t?t[1]:"";return decodeURIComponent(r)}catch(e){return""}},setCookie:function setCookie(e,t,r){try{var o=+new Date+r;C.set(e,t,{expires:new Date(o),path:"/",domain:document.domain.split(".").slice(-2).join(".")})}catch(e){}},isSupportLS:function(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}()},j=function(){function e(e){this._storage=!e&&I.isSupportLS?I:new U}return e.prototype.getItem=function(e){return this._storage.getItem(e)},e.prototype.setItem=function(e,t){this._storage.setItem(e,t)},e.prototype.getCookie=function(e){return this._storage.getCookie(e)},e.prototype.setCookie=function(e,t,r){this._storage.setCookie(e,t,r)},e.prototype.removeItem=function(e){this._storage.removeItem(e)},e}(),T={cn:"https://mcs.snssdk.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},E="/v1/user/webid",f={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001},F=function _(e,t){return t?"__tea_cache_tokens_"+e:"__tea_cache_events_"+e},N=function p(r,o,n,i){try{var e=r.match(/\/v\d\//),t=e?e[0]:-1!==r.indexOf("/v1/")?"/v1/":"/v2/",s=r.split(t)[0];s?o.forEach(function(e){var e=function(e){var t,r="";for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&(r+="&"+t+"="+encodeURIComponent(JSON.stringify(e[t])));return"&"===r[0]?r.slice(1):r}(e),t=new Image(1,1);t.onload=function(){t=null,n&&n()},t.onerror=function(){t=null,i&&i(r,o,f.IMG_ON)},t.src=s+"/v1/gif?"+e}):i(r,o,f.NO_URL)}catch(n){i&&i(r,o,f.IMG_CATCH,n.message)}},L=function l(e,t,r,o,n,i,s,a){var c=window.navigator.userAgent,c=-1!==window.navigator.appName.indexOf("Microsoft Internet Explorer")&&(-1!==c.indexOf("MSIE 8.0")||-1!==c.indexOf("MSIE 9.0")),u=!!r;if(!u&&c)N(e,t,o,n);else if(!u&&s)return Z4(!1).isSupportBeacon?(a&&a(),void(window.navigator.sendBeacon(e,JSON.stringify(t))?o():n(e,t,f.BEACON_FALSE))):void N(e,t,o,n);i&&delete t.app_key,function(e,t,r,o,n){var i=new XMLHttpRequest;i.open("POST",""+e,!0),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),n&&i.setRequestHeader("X-MCS-AppKey",""+n),i.onload=function(){if(r){var t=null;if(i.responseText){try{t=JSON.parse(i.responseText)}catch(e){t={}}r(t)}}},i.onerror=function(){i.abort(),o&&o(t,f.XHR_ON)},i.send(JSON.stringify(t))}(e,t,o,n,r)};function g(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,g)}var B,z=function v(){return g().replace(/-/g,"").slice(0,19)},q=function(){function e(e,t){this.browser=Z4(!0,e.app_id),this.config=e,this.cfg=t,this.storage=new j(!1),this.appInfo=e.app_key||e.app_id,this.isNoWebid=e.disable_webid,this.isNoSsid=e.disable_webid||e.disable_ssid,this.domain=e.channel_domain||T[e.channel],this.tokenReady=!1,this.checkExp=e.checkExp||!1,this.enableCookie=e.cross_subdomain||!1,this.expiresTime=this.enableCookie?94608e6:0,this.fetchUrl=this.domain+E}return e.prototype._getToken=function(){this.tokensKey=F(this.appInfo,!0),this.cookieKey="__tea_cookie_tokens_"+this.appInfo;var e,t,r,o,n=this.storage.getItem(this.tokensKey);this.enableCookie?(o=this.storage.getCookie(this.cookieKey))?(o=decodeURIComponent(o),e=(o=JSON.parse(o)).user_unique_id,t=o.web_id,r=o.timestamp,o=o.ssid,this._setToken(t,e,o,r)):n?(this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(n)),this.expiresTime),this._checkLocal(n)):this._requestWebId():n?this._checkLocal(n):this._requestWebId()},e.prototype._checkLocal=function(e){e.web_id||(t=this.storage.getCookie("tt_webid"),n=this.storage.getCookie("__tea_sdk__ssid"),r=this.storage.getCookie("__tea_sdk__user_unique_id"),t&&n&&r&&(e={web_id:t,ssid:n,user_unique_id:r,timestamp:Date.now()},this.storage.setItem(this.tokensKey,e)));var t,r,e=this.storage.getItem(this.tokensKey),o=(r=e.user_unique_id,t=e.web_id,e.timestamp),n=e.ssid;t&&r?this._setToken(t,r,n,o):this._requestWebId()},e.prototype._setToken=function(e,t,r,o){if(this.uuid=t,this.web_id=e,this.ssid=r,this.checkExp){o=Date.now()-parseFloat(o);if(7344e6<o)return void this._requestWebId();if(432e7<o)return void this._updateWebId(e)}this._complete(e,t,r)},e.prototype._complete=function(e,t,r){this.cfg.envInfo.user.ssid=r,this.cfg.envInfo.user.web_id=e,this.cfg.envInfo.user.user_unique_id=t,this.tokenReady=!0},e.prototype._requestWebId=function(){this.isNoWebid?this._setwebId({web_id:z(),ssid:""}):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){e=this.domain+E+"/"+e+"/update";this._fetchWebId(e,!0)},e.prototype._fetchWebId=function(e,r){var o=this;this.isGetWebId=!0,L(e,{app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:this.browser.userAgent,referer:this.browser.referrer,user_unique_id:""},this.config.app_key,function(e){var t;e&&0===e.e?(r?(t={web_id:o.web_id,ssid:o.ssid,user_unique_id:o.uuid,timestamp:Date.now()},o.enableCookie&&o.storage.setCookie(o.cookieKey,encodeURIComponent(JSON.stringify(t)),o.expiresTime),o.storage.setItem(o.tokensKey,t),o._complete(o.web_id,o.uuid,o.ssid)):(o.isGetWebId=!1,o._setwebId(e)),o.isGetSsid?o._requestSsId():o.callback&&o.callback()):r?o._fetchWebId(o.fetchUrl,!1):o.isGetWebId=!1},function(){o.isGetWebId=!1},!0)},e.prototype._setwebId=function(e){var t=this.cfg.envInfo.user.web_id||e.web_id,r={web_id:t,ssid:e.ssid,user_unique_id:this._uuid||t,timestamp:Date.now()};this.enableCookie&&this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(r)),this.expiresTime),this.storage.setItem(this.tokensKey,r),this.cfg.envInfo.user.ssid=e.ssid,this.cfg.envInfo.user.web_id=t,this.cfg.envInfo.user.user_unique_id=this._uuid||t,this.uuid=this._uuid||t,this.web_id=t,this.ssid=e.ssid,this.tokenReady=!0},e.prototype._getSsid=function(e){e&&-1===["0","Null","None","","undefined"].indexOf(e)&&(this.uuid===e&&this.web_id&&this.ssid?this.tokenReady=!0:(this._uuid=e,this.uuid=e,this.cfg.envInfo.user.user_unique_id=e,this.isGetSsid=!0,this.isNoSsid||this.isGetWebId?this.callback&&this.callback():(this.tokenReady=!1,this.isGetSsid=!1,this._requestSsId())))},e.prototype._requestSsId=function(){var t=this,e=this.domain+"/v1/user/ssid";L(e,{app_key:this.config.app_key,app_id:this.config.app_id,web_id:this.web_id,user_unique_id:this.uuid},this.config.app_key,function(e){e&&0===e.e&&(t.cfg.envInfo.user.ssid=e.ssid,e={web_id:t.web_id,ssid:e.ssid,user_unique_id:t.uuid,timestamp:Date.now()},t.enableCookie&&t.storage.setCookie(t.cookieKey,encodeURIComponent(JSON.stringify(e)),t.expiresTime),t.storage.setItem(t.tokensKey,e)),t.tokenReady=!0,t.callback&&t.callback()},function(){t.tokenReady=!0,t.callback&&t.callback()},!0)},e.prototype.isTokenReady=function(){return this.tokenReady},e}(),H=function(){function t(e,t,r,o){this.cfg=t,this.config=e,this._token=r,this.appInfo=e.app_key||e.app_id,this.debugMode=!!e.log,this.evtDataKey=F(this.appInfo,!1);t=e.channel_domain||T[e.channel];this.reportUrl=e.report_url||t+"/v1/list",this.maxReport=e.max_report||20,this.storage=new j(!0),this.plugin=o,this.addListener()}return t.prototype.addListener=function(){var e=this;window.addEventListener("unload",function(){e.report(!0)},!1),window.addEventListener("beforeunload",function(){e.report(!0)},!1),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e.report(!0)},!1)},t.prototype.setReady=function(){this.isReady=!0,this.report()},t.prototype.event=function(e,t){var r=this,o=(void 0===e&&(e=[]),void 0===t&&(t=!1),this.storage.getItem(this.evtDataKey)||[]),t=t?index_base_min_i(e,o):index_base_min_i(o,e);this.storage.setItem(this.evtDataKey,t),this.reportTimer&&clearTimeout(this.reportTimer),t.length>=this.maxReport?this.report():this.reportTimer=setTimeout(function(){r.report(),r.reportTimer=null},30)},t.prototype.report=function(e){var t;void 0===e&&(e=!1),this._token.isTokenReady()&&this.isReady&&(t=this.storage.getItem(this.evtDataKey)||[],t=this._mergeEvents(t),this.storage.removeItem(this.evtDataKey),this._dealData(t,e))},t.prototype._mergeEvents=function(e){var t,r,o=this;return e.length?((t=this.cfg.get()).header.custom=JSON.stringify(t.header.custom),(r=[]).push(e),r.map(function(e){return{events:e.map(function(e){var t=s({},o.cfg.get("evtParams"),e.params);return delete t.__disable_storage__,s({},e,{params:JSON.stringify(t)})}),user:t.user,header:t.header,verbose:o.debugMode?1:void 0}})):e},t.prototype._dealData=function(e,r){var o=this;if(!e.length)return e;e.map(function(e){var t=[];return t.push(e),t}).forEach(function(e){var t=z();o._send(t,e,r)})},t.prototype._send=function(e,t,o){var n=this,i=(this.isSending=!0,function r(){n.isSending=!1});L(this.reportUrl,t,this.config.app_key,function(){i()},function(e,t){i(),n.cfg.get("reportErrorCallback")(e,t)},!1,o,i)},t}(),a=void 0,r=(new Date).getTimezoneOffset(),K=parseInt(""+-r/60,10),W=60*r,Q=function(){function t(e){e=Z4(!0,e);this.envInfo={user:{user_unique_id:a,user_type:a,user_id:a,user_is_auth:a,user_is_login:a,device_id:a,web_id:a,ip_addr_id:a,ssid:a},header:{app_id:a,app_name:a,app_install_id:a,install_id:a,app_package:a,app_channel:a,app_version:a,os_name:e.os_name,os_version:e.os_version,device_model:e.device_model,ab_client:a,ab_version:a,ab_sdk_version:a,traffic_type:a,client_ip:a,device_brand:a,os_api:a,access:a,language:e.language,region:a,app_language:a,app_region:a,creative_id:a,ad_id:a,campaign_id:a,log_type:a,rnd:a,platform:e.platform,sdk_version:"4.1.15",province:a,city:a,timezone:K,tz_offset:W,tz_name:a,sim_region:a,carrier:a,resolution:e.screen_width+"x"+e.screen_height,browser:e.browser,browser_version:e.browser_version,referrer:e.referrer,referrer_host:e.referrer_host,width:e.screen_width,height:e.screen_height,screen_width:e.screen_width,screen_height:e.screen_height,utm_term:e.utm_term,utm_content:e.utm_content,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,custom:{}}},this.evtParams={},this.reportErrorCallback=function(){}}return t.prototype.set=function(e,t){var r=this;if("disable_auto_pv"!==e)if("evtParams"===e||"_staging_flag"===e){var o="evtParams"===e?t:{_staging_flag:Number(t)},n=s({},o);Object.keys(n).forEach(function(e){r.evtParams[e]=n[e]})}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var i,o="";if(-1<e.indexOf(".")&&(o=(i=e.split("."))[0],e=i[1]),"user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("web_id"===(e="os_version"===e?""+t:e)){if(!t)return;(!this.envInfo.user.user_unique_id||this.envInfo.user.user_unique_id&&this.envInfo.user.user_unique_id===this.envInfo.user.web_id)&&(this.envInfo.user.user_unique_id=t)}o?"user"===o||"header"===o?this.envInfo[o][e]=t:this.envInfo.header.custom[e]=t:this.envInfo.user.hasOwnProperty(e)?-1<["user_type","device_id","ip_addr_id"].indexOf(e)?this.envInfo.user[e]=Number(t):-1<["user_id","web_id","user_unique_id","ssid"].indexOf(e)?this.envInfo.user[e]=String(t):-1<["user_is_auth","user_is_login"].indexOf(e)&&(this.envInfo.user[e]=Boolean(t)):this.envInfo.header.hasOwnProperty(e)?this.envInfo.header[e]=t:this.envInfo.header.custom[e]=t}},t.prototype.get=function(e){return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this.reportErrorCallback:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))},t}(),J=function(){function e(e,t){this.isLog=t,this.name=e||""}var t=e.prototype;return t.info=function(e){this.isLog&&console.log(this.name+" "+e)},t.warn=function(e){this.isLog&&console.warn(this.name+" "+e)},t.error=function(e){this.isLog&&console.error(this.name+" "+e)},t.throw=function(e){throw this.error(this.name),new Error(e)},e}(),V=index_base_min_i(["init","config","send","start"],[]),X=(B=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){function i(e){var r=this;this.predefinePageView=function(e){void 0===e&&(e={});var t=s({title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer},r._event.closeStorage?{}:{__disable_storage__:1}),t=s({},t,e);r.event("predefine_pageview",t,!0)},this.name=e,this._isSend=!1,this.autoPV=!0}return i.prototype.init=function(e){var t=this;if(!this._inited){if(this._inited=!0,!e||"object"!=_typeof(e))throw new Error("init参数有误,请检查");var r=e.app_id,o=e.app_key,n=e.log;this._config=new Q(r),this.logger=new J(this.name,n),o||r||this.logger.throw("没有传入 app_key 或 app_id "),r&&"number"!=typeof r&&this.logger.throw("app_id参数有误,请检查 "),o&&"string"!=typeof o&&this.logger.warn("app_key为空,如果有请传入"),e.channel_domain||-1!==["cn","sg","va"].indexOf(e.channel)||this.logger.throw("channel 变量只能是 `cn`, `sg`,`va`"),this._config.set("app_id",r),e.channel=e.channel||"cn",this._initConfig=e,this._token=new q(e,this._config),this._token.callback=function(){t.callbackSend&&t.start()},this._event=new H(e,this._config,this._token,this.plugin),this._token._getToken()}},i.prototype.config=function(e){if(this._inited)if(e&&"object"==_typeof(e)){if(e.user_unique_id){if("string"!=typeof e.user_unique_id)throw new Error("user_unique_id 只能是string");this._token._getSsid(e.user_unique_id)}for(var t in e.disable_auto_pv&&(this.autoPV=!1),e)this._config.set(t,e[t])}else this.logger.warn("config参数有误,请检查");else this.logger.warn("config应在init之后调用")},i.prototype.send=function(){this.start()},i.prototype.start=function(){this._token.isTokenReady()?this._isSend||(this._isSend=!0,this.logger.info("用户信息:"+JSON.stringify(this._config.get("user"))),this.autoPV&&this.predefinePageView(),this._event.setReady()):this.callbackSend=!0},i.prototype.event=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o="boolean"==typeof e[e.length-1]&&e[e.length-1],n="boolean"==typeof e[e.length-1]?e.slice(0,e.length-1):e,i=t(n,1)[0],s=[];"Array"!==Object.prototype.toString.call(i).slice(8,-1)?s[0]=n:s=n,s=s.map(function(e){return function(e,t){var r=e,e=(/^event\./.test(e)&&(r=e.slice(6)),t);return(e="object"!=_typeof(e)?{}:e).event_index=B+=1,{event:r,params:e,local_time_ms:+new Date,is_bav:0}}(e[0],e[1])}),this._event.event(s,o)},i}());function R(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}var G=function M(e){var i=this;return R(this,"_exportCollect",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._isProcess?i._executeCmd.apply(i,t):(i.cmdQueue.push(t),i._processCmd())}),R(this,"_processCmd",function(){var e,r,o;0!==i.cmdQueue.length&&(e=i.cmdQueue,r=-1,e.forEach(function(e,t){"init"===e[0]&&(r=t)}),-1!==(o=r))&&(i._isProcess=!0,i._executeCmd.apply(i,i.cmdQueue[o]),i.cmdQueue.forEach(function(e,t){t!==o&&i._executeCmd.apply(i,e)}),i.cmdQueue=[])}),R(this,"_executeCmd",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o,n=t[0];-1<V.indexOf(n)?(o=i.colloctor)[n].apply(o,t.slice(1)):(n=i.colloctor).event.apply(n,t)}),this.cmdQueue=[],this.name=e,this.colloctor=new X(e),this._isProcess=!1,this._alias={},this._processCmd(),V.forEach(function(e){i._exportCollect[e]=i._exportCollect.bind(i,e)}),this._exportCollect},c={},u={},d=function P(e){return u[e]||(u[e]=[]),u[e]},Z=function A(e){var e=t(e),r=e[0],e=e.slice(1),o=r.split(".");1===o.length?d("default").push(index_base_min_i([r],e)):2===o.length?"event"===o[0]?d("default").push(index_base_min_i([r],e)):d(o[0]).push(index_base_min_i([o[1]],e)):(r=o[0],o=[o[1],o[2]].join("."),d(r).push(index_base_min_i([o],e)))},$=function D(){h.q.forEach(function(e){e=[].slice.call(e);"Array"===Object.prototype.toString.call(e[0]).slice(8,-1)?e.forEach(function(e){Z(e)}):Z(e)}),Object.keys(u).forEach(function(t){u[t].forEach(function(e){!function(e){return c[e]||(c[e]=new G(e)),c[e]}(t).apply(void 0,index_base_min_i(e))}),u[t]=[]}),h.q=[]},h=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.q.push(t),$()},Y=(h.q=[],h.l=Date.now(),h._instanceMap=c,h._instanceCmdMap=u,V.forEach(function(e){h[e]=h.bind(null,e)}),function(e){var t,r;"undefined"!=typeof window&&(t=function(){if("undefined"!=typeof window)return window.TeaAnalyticsObject}())&&window[t]&&((r=window[t]).init||(e.q=r.q||[],e.l=r.l||Date.now(),window[t]=e))}(h),$(),h),ee={browserError:1e3,crc32:1e3,preUpload:1001,initUploadID:1002,process:1003,fileMerge:1004,complete:1005},te="video",y="image",_="object",re={video:"video_upload",image:"image_upload",object:"object_upload"},m=1,oe=2,ne=3,ie=2562,se=2643,ae={"cn-north-1":"cn-north-1","us-east-1":"us-east-1","ap-singapore-1":"ap-singapore-1",boe:"boe"},ce={"cn-north-1":"https://vod.volcengineapi.com","ap-singapore-1":"https://vod.byteplusapi.com"},ue={"cn-north-1":"https://imagex.volcengineapi.com","us-east-1":"https://imagex-us-east-1.volcengineapi.com","ap-singapore-1":"https://imagex-ap-singapore-1.volcengineapi.com"};function LoggerV5_typeof(e){return(LoggerV5_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function _toPropertyKey(e){e=function _toPrimitive(e,t){if("object"!==LoggerV5_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==LoggerV5_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===LoggerV5_typeof(e)?e:String(e)}(o.key),o)}}var le=function(){function Logger(e,t){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Logger),this.options=e,this.context=t,this.teaLog=Y,this.tea_app_id=ie,this.tea_channel="cn","ap-singapore-1"===this.options.region?(this.tea_app_id=se,this.tea_channel="sg"):(this.tea_app_id=ie,this.tea_channel="cn"),this.teaLog.init({app_id:this.tea_app_id,channel:this.tea_channel,log:!1,disable_sdk_monitor:!0}),this.teaLog.config({evtParams:{sdk_version:"1.0.26",line_app_id:this.options.appId,toB:!0},user_unique_id:this.options.userId,disable_auto_pv:!0}),this.teaLog.start()}return function _createClass(e,t,r){t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Logger,[{key:"send",value:function send(e){var t=this.context,r=e.key,t=t.tasks[r],o=ee[e.stage]||999,t=e.fileType||t.fileType,n=e.fileSize||0,i={toB:!0,log_type:re[t],stage:o,fk:r,fs:n,req:e.req,res:e.res,ts:Math.round(Date.now()/1e3),sst:e.stageStartTime,set:e.stageEndTime,dur:e.duration,tdur:e.totalDuration},s="".concat("image"===t?"image":"video","_")+("error"===e.type?"error":o);switch(o){case 1e3:this.teaLog(s,_extends({},i,{type:e.type,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,crc32Array:e.crc32Array,isDirect:e.isDirect})}));break;case 1001:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,sig:e.signature})}));break;case 1002:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,upid:e.uploadID})}));break;case 1003:e.isAllFinish||e.isDirect||(delete i.sst,delete i.set,delete i.dur),this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,si:e.slice_index,af:e.isAllFinish})}));break;case 1004:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}));break;case 1005:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,vid:e.uploadResult&&e.uploadResult.Vid})}));break;default:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}))}}},{key:"console",value:function(t){function console(e){return t.apply(this,arguments)}return console.toString=function(){return t.toString()},console}(function(e){this.options.debug&&console.log(e)})}]),Logger}(),r=o(4),pe=o.n(r),r=o(3),fe=o.n(r),b={resolveUri:function resolveUri(t){if(!t)return"";if(Array.isArray(t))return t.map(function(t){try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}});try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}},urlTemplate:function urlTemplate(t,r){var o;return r=r||{},Object.keys(r).forEach(function(e){o=new RegExp("{".concat(e,"}"),"g"),t=t.replace(o,r[e])}),t},toQueryString:function toQueryString(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=[];return Object.keys(r).map(function(t){var e=r[t];"[object Array]"===Object.prototype.toString.call(e)?e.forEach(function(e){o.push("".concat(t,"=").concat(encodeURIComponent(e)))}):o.push("".concat(t,"=").concat(encodeURIComponent(r[t])))}),o.join("&")},arrayToObject:function arrayToObject(e){var t={};return e&&e.forEach(function(e){t[e.Key.toLowerCase()]=e.Value}),t},supportChunked:function supportChunked(){var e=window.Blob||window.WebKitBlob;try{var t=e.prototype;return!(!FormData||!(t.slice||t.webkitSlice||t.mozSlice))}catch(e){return!1}},supportXhr:function supportXhr(){return!!window.FormData||window.ProgressEvent&&window.FileReader},supportCrc32:function supportCrc32(){var e=window.FileReader&&window.FileReader.prototype.readAsBinaryString;return"undefined"!=typeof Int32Array&&e&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice)},storage:function storage(e){var r=e,e={removeItem:function removeItem(e){delete r.cache[e]},setItem:function setItem(e,t){r.cache[e]=t},getItem:function getItem(e){return r.cache[e]},clear:function clear(){delete r.cache,r.cache={}}};if(!(1<arguments.length&&void 0!==arguments[1])||arguments[1])try{if(window.localStorage)return window.localStorage.setItem("",""),window.localStorage}catch(e){}return e},noop:function noop(){},getUnique:function getUnique(e){return"".concat(e,"_").concat((new Date).getTime(),"_").concat(parseInt(1e6*Math.random()))},getFileSliceLength:function getFileSliceLength(e,t){var r=e.size,o=1048576;return t&&"function"==typeof t?t(r)<5242880?5242880:t(r)||r:200*o<r?10*o:r<=200*o&&2*o<=r?5*o:e.size},getFileSuffix:function getFileSuffix(e){var t;return e&&"[object String]"===Object.prototype.toString.call(e)&&0<(t=e.lastIndexOf("."))?"."+e.substring(t+1):void 0},crypto:{hmac:function hmac(e,t){return pe()(t,e)},sha256:function sha256(e){return fe()(e)}},date:{iso8601:function iso8601(e){return(e=void 0===e?b.date.getDate():e).toISOString().replace(/\.\d{3}Z$/,"Z")}},Buffer:Uint8Array,buffer:{toBuffer:function toBuffer(e,t){return"function"==typeof b.Buffer.from&&b.Buffer.from!==Uint8Array.from?b.Buffer.from(e,t):new b.Buffer(e,t)},alloc:function alloc(e,t,r){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");return"function"==typeof b.Buffer.alloc?b.Buffer.alloc(e,t,r):(e=new b.Buffer(e),void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,r),e)},toStream:function toStream(t){b.Buffer.isBuffer(t)||(t=b.buffer.toBuffer(t));var r=new b.stream.Readable,o=0;return r._read=function(e){if(o>=t.length)return r.push(null);e=o+e;e>t.length&&(e=t.length),r.push(t.slice(o,e)),o=e},r},concat:function concat(e){for(var t,r=0,o=0,n=0;n<e.length;n++)r+=e[n].length;for(t=b.buffer.alloc(r),n=0;n<e.length;n++)e[n].copy(t,o),o+=e[n].length;return t}}},w=b;var x={crc32:function encrypt_crc32(e,t){for(var r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],o=("undefined"!=typeof Int32Array&&(r=new Int32Array(r)),-1^~~t),n=(e=new Uint8Array(e)).length,i=0;i<n;i++)o=r[255&(o^e[i])]^o>>>8;return(-1^o)>>>0},dec2hex:function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}};function Crc32_typeof(e){return(Crc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Crc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Crc32_toPropertyKey(e){e=function Crc32_toPrimitive(e,t){if("object"!==Crc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Crc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Crc32_typeof(e)?e:String(e)}(o.key),o)}}var de=function(){function Crc32(e,t,r,o){!function Crc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Crc32),this.file=e,this.successProcess=r,this.failProcess=o,this.sliceLength=t,this.retryTime=0,this.fileSize=e.size,this.crc32Array=[]}return function Crc32_createClass(e,t,r){t&&Crc32_defineProperties(e.prototype,t),r&&Crc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Crc32,[{key:"start",value:function start(){this.readFileCrc32(this.file)}},{key:"readFileCrc32",value:function readFileCrc32(t){var r=this,e=this.sliceLength,o=t.slice||t.webkitSlice||t.mozSlice,n=new FileReader,i=0,s=0,a=0;(function read(){s<t.size&&(s=Math.min(i+e,t.size),104857600<t.size)&&t.size-s<=5242880&&(s=t.size),n.readAsArrayBuffer(o.call(t,i,s)),n.onload=function(e){e=e.target.result;a=x.crc32(e,0),r.crc32Array.push({start:i,end:s,crc32:x.dec2hex(a),buffer:e}),(i=s)<t.size?read():r.success(r.crc32Array)}})()}},{key:"success",value:function success(e){this.successProcess(e)}},{key:"fail",value:function fail(e,t,r,o){3<=this.retryTime?this.failProcess():(this.readFileCrc32(e,t,r,o),this.retryTime++)}}]),Crc32}();function FileCrc32_typeof(e){return(FileCrc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileCrc32_extends(){return(FileCrc32_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function FileCrc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function FileCrc32_toPropertyKey(e){e=function FileCrc32_toPrimitive(e,t){if("object"!==FileCrc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileCrc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileCrc32_typeof(e)?e:String(e)}(o.key),o)}}var he=function(){function FileCrc32(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function FileCrc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileCrc32),this.context=e.context,this.key=e.key,this.isDirect=e.isDirect,this.isImageBatchUpload=e.isImageBatchUpload,this.file=e.file,this.type=(this.isImageBatchUpload?this.file[0]:this.file).type||"",this.sliceLength=w.getFileSliceLength(this.file,t.getSliceFunc),this.config=t}return function FileCrc32_createClass(e,t,r){t&&FileCrc32_defineProperties(e.prototype,t),r&&FileCrc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileCrc32,[{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.crc32(this.file,this.sliceLength)}},{key:"crc32",value:function crc32(e,t){var r=this;if(this.isImageBatchUpload)for(var o=e.length,n=[],i=0;i<o;i++)new de(e[i],e[i].size,function(e){n.push(e[0]),n.length===o&&r.success(n)},function(e){r.fail(e)}).start();else!e||!e.size||e.size<=0?this.fail({message:"There is a problem with the input file or fileSize."}):this.isDirect?new de(e,e.size,function(e){r.success(e)},function(e){r.fail(e)}).start():this.sliceFile(e,t,function(e){r.success(e)},function(e){r.fail(e)})}},{key:"sliceFile",value:function sliceFile(e,t,r,o){for(var n=[],i=t,s=e.size,a=new FileReader,c=e.slice||e.webkitSlice||e.mozSlice,u=0,l=0,p=0;l<s;)l=Math.min(u+i,s),s-l<=5242880&&(l=s),n.push({start:u,end:l,crc32:0}),u=l;try{!function read(t){u=n[t].start,l=n[t].end,a.readAsArrayBuffer(c.call(e,u,l)),a.onload=function(e){e=e.target.result,p=x.dec2hex(x.crc32(e,0)),n[t].crc32=p,l===s?r(n):read(n.length-1)},a.onerror=function(e){o(e)}}(0)}catch(e){o(e)}}},{key:"getCrc32Key",value:function getCrc32Key(e,t){t="[object Array]"===Object.prototype.toString.call(t)?_toConsumableArray(t):[t];return t.push(e[0].crc32,e[e.length-1].crc32),t.join("_")}},{key:"success",value:function success(e){var t=this.context,r=this.key,o=[],n=[];if(this.isImageBatchUpload)for(var i=0;i<this.file.length;i++)o.push(this.file[i].size),n.push(this.file[i].name);else o=this.file.size,n=this.file.name;var s=this.getCrc32Key(e,o),t=t.tasks[r];t&&this.successProcess(FileCrc32_extends(t,{key:r,crc32Array:e,crc32Key:s,sdkVersion:"1.0.26",sliceLength:this.sliceLength,extra:{message:"get crc32 success"},stage:"crc32",type:"success",fileSize:o,fileName:n,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st,isDirect:this.isDirect,isImageBatchUpload:this.isImageBatchUpload}))}},{key:"fail",value:function fail(e){var t=this.context,r=this.key,e=e&&e.message?e.message:"get crc32 error",t=FileCrc32_extends(t.tasks[r],{extra:{message:e},type:"error",stage:"crc32",stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st});this.failProcess(t)}}]),FileCrc32}();function Transport_typeof(e){return(Transport_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Transport_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Transport_toPropertyKey(e){e=function Transport_toPrimitive(e,t){if("object"!==Transport_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Transport_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Transport_typeof(e)?e:String(e)}(o.key),o)}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var o=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=_getPrototypeOf(r);return function _possibleConstructorReturn(e,t){{if(t&&("object"===Transport_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function _assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var k=function(){!function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}(Transport,n.a);var t=_createSuper(Transport);function Transport(){var e;return function Transport_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Transport),(e=t.call(this)).xhr=new XMLHttpRequest,e._data=null,e}return function Transport_createClass(e,t,r){t&&Transport_defineProperties(e.prototype,t),r&&Transport_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Transport,[{key:"_ajax",value:function _ajax(e){var t=this,r=this.xhr;r.upload.onprogress=function(e){t.emit("progress",e)},r.onreadystatechange=function(){4===r.readyState&&(r.upload.onprogress=w.noop,r.onreadystatechange=w.noop,r.params=e,t._data&&t._data.url&&(r.currentUrl=t._data.url),200<=r.status&&r.status<300?t.emit("complete",r):400<=r.status&&t.emit("error",r))},r.onerror=function(){r.errText="unknow net error",t.emit("error",r)},r.ontimeout=function(){r.errText="timeout",t.emit("error",r)},r.onabort=function(){r.errText="abort",t.emit("error",r)},r.send(e)}},{key:"send",value:function send(t){var r=this;return this._data=t,this.xhr.open(t.method||"POST",t.url||"",!0),t.headers&&Object.keys(t.headers).forEach(function(e){r.xhr.setRequestHeader(e,t.headers[e])}),this.xhr.timeout=t.timeout||0,t.ontimeout&&(this.xhr.ontimeout=t.ontimeout),t.binary?this.sendAsBinary(t):t.custom?"object"===Transport_typeof(t.custom)?this.sendAsCustom(JSON.stringify(t.custom)):"none"===t.custom?(delete t.custom,this.sendAsCustom()):this.sendAsCustom(t.custom):this.sendAsFormData(t)}},{key:"sendAsBinary",value:function sendAsBinary(e){return this.xhr.setRequestHeader("Content-Type","application/octet-stream"),this.xhr.setRequestHeader("Content-Disposition",'attachment; filename="'.concat(encodeURI(e.filename),'"')),this._ajax(e.file)}},{key:"sendAsFormData",value:function sendAsFormData(e){t=(t=e.formData?"function"==typeof e.formData?e.formData():e.formData:t)||[];for(var t,r=new FormData,o=0,n=t.length;o<n;o++){var i=t[o];r.append(i.name,i.value)}return e.file&&r.append(e.field,e.file,e.name),this._ajax(r)}},{key:"sendAsCustom",value:function sendAsCustom(e){return this._ajax(e)}},{key:"abort",value:function abort(){this.xhr.onreadystatechange=w.noop,this.xhr.abort()}},{key:"getResponse",value:function getResponse(){return this.xhr.response}},{key:"getText",value:function getText(){return this.xhr.responseText}},{key:"getJson",value:function getJson(){return JSON.parse(this.xhr.responseText)}}]),Transport}(),r=o(1),ye=o.n(r),_e=1000002,ge=1001e3,me=1002e3,ve=1003e3,be=1003003,we=1004e3,xe=1005e3,ke="The format of stsToken is incorrect.",Oe="An error occurred reading the file";function ApplyUpload_typeof(e){return(ApplyUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){!function _defineProperty(e,t,r){(t=ApplyUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ApplyUpload_extends(){return(ApplyUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function ApplyUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,ApplyUpload_toPropertyKey(o.key),o)}}function ApplyUpload_toPropertyKey(e){e=function ApplyUpload_toPrimitive(e,t){if("object"!==ApplyUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==ApplyUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===ApplyUpload_typeof(e)?e:String(e)}function ApplyUpload_setPrototypeOf(e,t){return(ApplyUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function ApplyUpload_createSuper(r){var o=function ApplyUpload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=ApplyUpload_getPrototypeOf(r);return function ApplyUpload_possibleConstructorReturn(e,t){{if(t&&("object"===ApplyUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function ApplyUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=ApplyUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function ApplyUpload_getPrototypeOf(e){return(ApplyUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Se=function(){!function ApplyUpload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ApplyUpload_setPrototypeOf(e,t)}(ApplyUpload,n.a);var o=ApplyUpload_createSuper(ApplyUpload);function ApplyUpload(e,t){var r;return function ApplyUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ApplyUpload),(r=o.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r}return function ApplyUpload_createClass(e,t,r){t&&ApplyUpload_defineProperties(e.prototype,t),r&&ApplyUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(ApplyUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this._st=Date.now();r=this.uploaderCtx._getCache(this.currFileCtx.crc32Key),t=r?JSON.parse(r):{};t.oid&&t.uploadID&&t.tosDomain?this.resumeFromCache(t):this.startPreUpload()}},{key:"startPreUpload",value:function startPreUpload(){var f=this,e=ae[this.config.region],t=new k,r=(t.on("complete",function(t){if(t.response)try{var e,r,o,n,i,s,a,c,u,l,p=JSON.parse(t.response);p.ResponseMetadata.Error?f.fail({xhr:t,errorCode:p.ResponseMetadata.Error.CodeN,error:p.ResponseMetadata.Error.Code,message:p.ResponseMetadata.Error.Message}):(e=p.Result,o=(r=(f.options.type===y&&f.config.imageConfig&&f.config.imageConfig.serviceId?e:e.Data).UploadAddress).StoreInfos,n=r.UploadHosts,i=r.SessionKey,a=void 0===(s=r.UploadHeader)?[]:s,c=[],u=[],f.isImageBatchUpload&&1<o.length?o.forEach(function(e){c.push(e.Auth),u.push(e.StoreUri)}):(c=o[0].Auth,u=o[0].StoreUri),l=ApplyUpload_extends(f.currFileCtx,{signature:c,type:"success",extra:{message:"prepare upload success"},stage:"preUpload",oid:w.resolveUri(u),tosDomain:"".concat(f.config.schema,"://").concat(n[0]),xhr:t,UploadHeader:a,SessionKey:i,stageStartTime:f._st,stageEndTime:Date.now(),duration:Date.now()-f._st,totalDuration:Date.now()-f._st+f.currFileCtx.totalDuration}),f.successProcess&&f.successProcess(l))}catch(e){f.fail({error:"catch error: ".concat(e.toString()),xhr:t})}else f.fail({error:"request fail: ".concat(t.statusText||t.errText||"UNKNOWN"),xhr:t})}),t.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};e.response&&(e=JSON.parse(e.response)).ResponseMetadata&&e.ResponseMetadata.Error&&(t.errorCode=e.ResponseMetadata.Error.CodeN,t.error=e.ResponseMetadata.Error.Code,t.message=e.ResponseMetadata.Error.Message),f.fail(t)}),""),o={},n=this.options.type===y&&this.config.imageConfig&&this.config.imageConfig.serviceId?(r=this.config.imageHost||ue[e],o={Action:"ApplyImageUpload",Version:"2018-08-01",ServiceId:this.options.serviceId||this.config.imageConfig.serviceId},this.currFileCtx.fileSize&&1<this.currFileCtx.fileSize.length&&(o.UploadNum=this.currFileCtx.fileSize.length),this.options.storeKey&&(n=this.options.storeKey,"[object Array]"===Object.prototype.toString.call(n)?o.StoreKeys=n:"[object String]"===Object.prototype.toString.call(n)&&(o.StoreKeys=[n])),"imagex"):(n=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(n=this.config.objectConfig.spaceName),r=this.config.videoHost||ce[e],o={Action:"ApplyUploadInfo",Version:"2022-01-01",SpaceName:n,FileSize:this.currFileCtx.fileSize,FileType:this.options.type},this.options.fileName&&(o.FileName=this.options.fileName),this.options.fileExtension&&(o.FileExtension=this.options.fileExtension),this.options.storageClass&&(o.StorageClass=this.options.storageClass),this.config.enOID&&(o.EnOID=1),"vod"),i=(this.config.useFileExtension&&this.currFileCtx.fileName&&(this.options.type===_||this.options.type===y)&&(i=this.currFileCtx.fileName,i=w.getFileSuffix(i))&&(o.FileExtension=i),this.config.accountId&&(o["X-Account-Id"]=this.config.accountId),o.s=Math.random().toString(36).substr(2),this.currFileCtx.proxyStsToken||this.config.stsToken),s=w.toQueryString(o),a=i.AccessKeyID,c=i.AccessKeyId,u=i.SecretAccessKey,i=i.SessionToken,r={method:"GET",url:"".concat(r,"?").concat(s),timeout:3e4,region:e,params:o};new ye.a(r,n,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:i},new Date),t.send(r)}},{key:"resumeFromCache",value:function resumeFromCache(i){var s=this,a=this.options.key,e=new k,t=(e.on("complete",function(e){try{var t,r,o,n=JSON.parse(e.response);0===n.success&&0<n.payload.partList.length?(t=s.confirmCache(n.payload.partList),r=!!i.hasMerge?5:t.isAllFinished?4:3,o=ApplyUpload_extends(s.currFileCtx,i,{key:a,xhr:e,extra:{message:"prepare upload from cache success"},stage:"preUpload",type:"success",percent:0,cacheTask:r,proxyStsToken:s.options.stsToken,currentTask:1,status:1,isBreak:1,crc32Array:t.crc32Array,stageStartTime:s._st,stageEndTime:Date.now(),duration:Date.now()-s._st,totalDuration:Date.now()-s._st+s.currFileCtx.totalDuration}),s.successProcess&&s.successProcess(o)):s.startPreUpload()}catch(e){s.startPreUpload()}}),e.on("error",function(e){400<=e.status?s.startPreUpload():s.fail({error:"request error",xhr:e})}),this.config.userId),r=ApplyUpload_extends(w.arrayToObject(i.UploadHeader),{"x-storage-mode":"gateway"});e.send({method:"get",url:w.urlTemplate(this.config.getUploadListUrl,{tosDomain:i.tosDomain,oid:i.oid,uploadId:i.uploadID}),headers:_objectSpread({authorization:i.signature,"x-storage-u":t},r),timeout:3e4})}},{key:"confirmCache",value:function confirmCache(e){var t=this.currFileCtx.crc32Array,r={},o=(e.forEach(function(e){var t=parseInt(e.partNumber)-1;isNaN(t)||void 0!==r[t]||(r[t]={tag:!0,crc32:e.crc32})}),!0),e=t.map(function(e,t){return r[t]&&r[t].tag&&r[t].crc32?(e.crc32=r[t].crc32,e.finished=!0,e.loaded=e.end-e.start):o=!1,e});return{isAllFinished:o,crc32Array:e}}},{key:"fail",value:function fail(e){var t=e.xhr,r=e.errorCode||ge,o="prepare upload error: UNKNOWN",o=(t&&(o=0===t.status?"prepare upload error: NETERROR":e.message||"prepare upload error: ".concat(t.status)),ApplyUpload_extends(this.currFileCtx,{extra:{message:o,error:e.error,errorCode:r},type:"error",stage:"preUpload",xhr:t,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(o)}}]),ApplyUpload}();function InitUploadID_typeof(e){return(InitUploadID_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function InitUploadID_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function InitUploadID_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?InitUploadID_ownKeys(Object(r),!0).forEach(function(e){!function InitUploadID_defineProperty(e,t,r){(t=InitUploadID_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):InitUploadID_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function InitUploadID_extends(){return(InitUploadID_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function InitUploadID_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,InitUploadID_toPropertyKey(o.key),o)}}function InitUploadID_toPropertyKey(e){e=function InitUploadID_toPrimitive(e,t){if("object"!==InitUploadID_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==InitUploadID_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===InitUploadID_typeof(e)?e:String(e)}function InitUploadID_setPrototypeOf(e,t){return(InitUploadID_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function InitUploadID_createSuper(r){var o=function InitUploadID_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=InitUploadID_getPrototypeOf(r);return function InitUploadID_possibleConstructorReturn(e,t){{if(t&&("object"===InitUploadID_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function InitUploadID_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=InitUploadID_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function InitUploadID_getPrototypeOf(e){return(InitUploadID_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ce=function(){!function InitUploadID_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&InitUploadID_setPrototypeOf(e,t)}(InitUploadID,n.a);var o=InitUploadID_createSuper(InitUploadID);function InitUploadID(e,t){var r;return function InitUploadID_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,InitUploadID),(r=o.call(this)).options=e,r.config=t,r.transport=new k,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.eventInit(),r}return function InitUploadID_createClass(e,t,r){t&&InitUploadID_defineProperties(e.prototype,t),r&&InitUploadID_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(InitUploadID,[{key:"initUpload",value:function initUpload(){var e=this.options.context,t=this.options.key,r={oid:e.tasks[t].oid,tosDomain:e.tasks[t].tosDomain},r=w.urlTemplate(this.config.initUploadFileUrl,r),o=this.config.userId,n=InitUploadID_extends(w.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:r,headers:InitUploadID_objectSpread({authorization:e.tasks[t].signature,"x-storage-u":o},n),timeout:3e4})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.initUpload()}},{key:"eventInit",value:function eventInit(){var n=this,i=this.options.context,s=this.options.key;this.transport.on("complete",function(t){try{var e,r=JSON.parse(t.response),o=r.payload.uploadID;0===r.success&&o?(e=InitUploadID_extends(i.tasks[s],{uploadID:o,percent:0,type:"success",extra:{message:"init upload id success"},stage:"initUploadID",xhr:t,stageStartTime:n._st,stageEndTime:Date.now(),duration:Date.now()-n._st,totalDuration:Date.now()-n._st+n.currFileCtx.totalDuration}),n.successProcess(e)):n.fail({error:"fail! res.success: ".concat(r.success,", uploadId:").concat(o),xhr:t})}catch(e){n.fail({error:"catch error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){n.fail({error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e})})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,t=InitUploadID_extends(t.tasks[r],{extra:{message:"init upload id error, ".concat(e.error),errorCode:me},type:"error",stage:"initUploadID",xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(t)}}]),InitUploadID}();function Uploader_typeof(e){return(Uploader_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uploader_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function Uploader_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Uploader_ownKeys(Object(r),!0).forEach(function(e){!function Uploader_defineProperty(e,t,r){(t=Uploader_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Uploader_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Uploader_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,Uploader_toPropertyKey(o.key),o)}}function Uploader_toPropertyKey(e){e=function Uploader_toPrimitive(e,t){if("object"!==Uploader_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Uploader_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Uploader_typeof(e)?e:String(e)}function Uploader_setPrototypeOf(e,t){return(Uploader_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Uploader_createSuper(r){var o=function Uploader_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Uploader_getPrototypeOf(r);return function Uploader_possibleConstructorReturn(e,t){{if(t&&("object"===Uploader_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Uploader_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Uploader_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Uploader_getPrototypeOf(e){return(Uploader_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=function(){!function Uploader_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Uploader_setPrototypeOf(e,t)}(Uploader,n.a);var u=Uploader_createSuper(Uploader);function Uploader(e){var t,r=e.sliceItem,o=e.crc32,n=e.url,i=e.signature,s=e.uploadHeader,a=e.userId,c=e.retryTime,c=void 0===c?0:c,e=e.method,e=void 0===e?"put":e;return function Uploader_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Uploader),(t=u.call(this)).fileSlice=r,t.crc32=o,t.uploadUrl=n,t.uploadHeader=s,t.signature=i,t.userId=a,t.retryTime=c,t.method=e,t.retryCount=0,t.ready=!1,t.cancel=!1,t.transport=new k,t.eventInit(),t}return function Uploader_createClass(e,t,r){t&&Uploader_defineProperties(e.prototype,t),r&&Uploader_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Uploader,[{key:"upload",value:function upload(){this.isParamsValid()&&(this._st=Date.now(),this.transport.send({method:this.method,url:this.uploadUrl,headers:Uploader_objectSpread({authorization:this.signature,"content-crc32":this.crc32,"x-storage-u":this.userId},this.uploadHeader),file:this.fileSlice,binary:1,timeout:18e5}))}},{key:"isParamsValid",value:function isParamsValid(){return this.fileSlice&&(this.fileSlice.size||this.fileSlice.byteLength)?this.crc32?!!this.uploadUrl||(this.emit("error",{message:"slice upload failed: NOURL",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCRC32",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCONTENT",crc32:this.crc32}),!1)}},{key:"eventInit",value:function eventInit(){var t=this;this.transport.on("complete",function(e){t.success(e)}),this.transport.on("error",function(e){t.fail(e)}),this.transport.on("progress",function(e){t.process(e)})}},{key:"success",value:function success(e){this.ready=!0;var t=Date.now()-this._st,r=this.fileSlice.size||this.fileSlice.byteLength;this.emit("complete",{crc32:this.crc32,size:r,speed:r/t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})}},{key:"fail",value:function fail(e){var t,r=this;this.cancel||(e&&401===e.status?this.emit("error",{message:"slice upload failed: UNAUTHORIZED",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st}):this.retryCount<this.retryTime?(setTimeout(function(){r.upload()},1e3),this.retryCount++):(t="slice upload failed: UNKNOWN",e&&(t=e.status?"slice upload failed: ".concat(e.status):"slice upload failed: NETERROR"),this.emit("error",{message:t,crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})))}},{key:"process",value:function process(e){this.cancel||this.emit("progress",{crc32:this.crc32,loaded:e.loaded||0,total:e.total||0})}},{key:"abort",value:function abort(){this.transport&&(this.cancel=!0,this.transport.abort())}},{key:"destroy",value:function destroy(){this.transport=null}}]),Uploader}(),r=o(5),Ue=o.n(r);function Upload_typeof(e){return(Upload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Upload_extends(){return(Upload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function Upload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Upload_toPropertyKey(e){e=function Upload_toPrimitive(e,t){if("object"!==Upload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Upload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Upload_typeof(e)?e:String(e)}(o.key),o)}}function Upload_setPrototypeOf(e,t){return(Upload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Upload_createSuper(r){var o=function Upload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Upload_getPrototypeOf(r);return function Upload_possibleConstructorReturn(e,t){{if(t&&("object"===Upload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Upload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Upload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Upload_getPrototypeOf(e){return(Upload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ie=function(){!function Upload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Upload_setPrototypeOf(e,t)}(Upload,n.a);var o=Upload_createSuper(Upload);function Upload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function Upload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Upload),(t=o.call(this)).file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.retryProcess=r.retryProcess,t.retryProcessTime=Number(r.retryProcessTime)||5,t.maxProcessPause=Number(r.maxProcessPause)||20,t.uploadSliceCount=Number(r.uploadSliceCount)||5,t.realtimeSpeedInterval=Number(r.realtimeSpeedInterval)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t.lastCalculateSpeedTime=-1,t.lastCalculateSpeedSize=0,t.uploadHandlers={},t}return function Upload_createClass(e,t,r){t&&Upload_defineProperties(e.prototype,t),r&&Upload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Upload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.errorLength=0,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this.uploadSliceCount=this.uploadSliceCount>this.crc32Array.length?this.crc32Array.length:this.uploadSliceCount,this.lastIndex=0,this.uploading=[],this._uploadSize=this.crc32Array.reduce(function(e,t){return e+(t.finished?0:t.end-t.start)},0),this._st=Date.now(),this._lastSaveTime=Date.now(),this.lastCalculateSpeedTime=this._st,this.initWorker(),this.threadUpload()}},{key:"initWorker",value:function initWorker(){var n,i=this;this.worker||(n=this.crc32Array,this.worker=new Ue.a,this.worker.onmessage=function(e){var t=e.data[0],r=e.data[2],o=n[r];o.crc32=e.data[1],i.upload(o,t,r)})}},{key:"read",value:function read(e,t){var r=this,o=this.file,n=o.slice||o.webkitSlice||o.mozSlice,i=new FileReader;i.onload=function(e){r.worker.postMessage([e.target.result,t],[e.target.result])},i.onerror=function(){r.stop(),r.fail({extra:{message:Oe,errorCode:be}})},i.readAsArrayBuffer(n.call(o,e.start,e.end))}},{key:"threadUpload",value:function threadUpload(){if(this.uploading.length<this.uploadSliceCount){var e=this.lastIndex,t=this.crc32Array[e];if(t){if(t.finished){if(-1===this.finishArr.indexOf(t.start)&&(this.finishArr.push(t.start),this.finishArr.length>=this.crc32Array.length))return this.stop(),void this.success()}else t.loaded=0,this.uploading.push(e),this.read(t,e);this.lastIndex++,this.threadUpload()}}}},{key:"stop",value:function stop(){var t=this;Object.keys(this.uploadHandlers).forEach(function(e){t.uploadHandlers[e].abort()}),this.worker&&this.worker.terminate(),this.worker=null,this.clearMonitor()}},{key:"clearMonitor",value:function clearMonitor(){this.progressMonitorInterval&&clearInterval(this.progressMonitorInterval)}},{key:"upload",value:function upload(t,e,r){var o=this,n=t.crc32,i={number:r+1,uploadId:this.currentCtx.uploadID,oid:this.currentCtx.oid,tosDomain:this.currentCtx.tosDomain},i=w.urlTemplate(this.config.uploadChunkedUrl,i),s=this.config.userId,a=Upload_extends(w.arrayToObject(this.currentCtx.UploadHeader),{"x-storage-mode":"gateway"}),e=new Pe({sliceItem:e,crc32:n,url:i,signature:this.currentCtx.signature,uploadHeader:a,userId:s,retryTime:this.retryUploadTime});e.on("complete",function(e){o.currentCtx.status===m&&(e.start=t.start,e.index=r,o.fileSliceSuccess(e))}),e.on("error",function(e){1===o.currentCtx.status&&(e.start=t.start,e.index=r,o.fail(e))}),e.on("progress",function(e){1===o.currentCtx.status&&(e.start=t.start,e.index=r,o.process(e))}),e.upload(),this.uploadHandlers[r]=e}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=Upload_extends(this.currentCtx,{type:"success",stage:"process",percent:100,extra:{message:"upload all success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._lastSaveTime+this.currentCtx.totalDuration,isAllFinish:!0});this.worker&&this.worker.terminate(),this.successProcess(t)}},{key:"fail",value:function fail(e){var t=this.currentCtx.totalDuration,r=Date.now()-this._st,o=e.crc32?{message:e.message,data:e.crc32,size:e.size}:e.extra,o=(o.errorCode=o.errorCode||ve,Upload_extends(this.currentCtx,{extra:o,type:"error",stage:"process",req:{},res:{},totalDuration:r+t}));e.xhr&&(r=e.xhr,o.req={url:e.xhr.currentUrl},o.res={status:r.status,body:r.responseText,header:r.getAllResponseHeaders()},delete e.xhr),void 0!==e.statusCode&&Upload_extends(this.currentCtx,{statusCode:e.statusCode}),this.errorLength||(t=e.index,this.context.logger.send(Upload_extends({},o,{slice_index:t})),this.stop(),this.context._broadcast("error",o),this.currentCtx.isBreak?this.context._cancel(this.key):this.context._pause(this.key),this.errorLength++)}},{key:"fileSliceSuccess",value:function fileSliceSuccess(e){var t,r=e.index,o=Date.now(),n=(-1===this.finishArr.indexOf(e.start)&&this.finishArr.push(e.start),this.crc32Array[r].finished=!0,this.crc32Array[r].speed=e.speed,{message:"slice upload success"});e.xhr&&(t=e.xhr,n.currentUrl=t.currentUrl||"",Upload_extends(this.currentCtx,{req:{url:t.currentUrl,param:t.params},res:{status:t.status,body:t.responseText,header:t.getAllResponseHeaders()}}),delete e.xhr),this.context.logger.send(Upload_extends(this.currentCtx,{stage:"process",type:"success",slice_index:r,extra:n,totalDuration:o-this._lastSaveTime+this.currentCtx.totalDuration})),this._lastSaveTime=o,this.finishArr.length>=this.crc32Array.length?(this.stop(),this.success(e.xhr)):(this.uploading.splice(this.uploading.indexOf(r),1),this.uploadHandlers[r]&&delete this.uploadHandlers[r],this.threadUpload())}},{key:"getFinishSize",value:function getFinishSize(e,t){var r=t.crc32,o=0;return e.forEach(function(e){e.crc32===r?(e.loaded=t.loaded,o+=t.loaded):(e.loaded||(e.loaded=0),o+=e.loaded)}),o}},{key:"process",value:function process(e){var t=this.currentCtx.realtimeSpeed||0,r=this.currentCtx.fileSize,o=(this.finishSize=this.getFinishSize(this.crc32Array,e),this.finishSize>this.lastFinishSize&&((e=new Date).getTime()-this.lastCalculateSpeedTime>1e3*this.realtimeSpeedInterval&&(n=e.getTime()-this.lastCalculateSpeedTime,o=this.finishSize-this.lastCalculateSpeedSize,t=Math.floor(o/n),this.lastCalculateSpeedTime=e.getTime(),this.lastCalculateSpeedSize=this.finishSize),this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/r*100*100)/100||0),n=Upload_extends(this.currentCtx,{stage:"process",percent:o,realtimeSpeed:t});o>this.lastProcessPercent&&100!==o&&(this.lastProcessPercent=o,this.context._broadcast("progress",n))}}]),Upload}();function FileMerge_typeof(e){return(FileMerge_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileMerge_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function FileMerge_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?FileMerge_ownKeys(Object(r),!0).forEach(function(e){!function FileMerge_defineProperty(e,t,r){(t=FileMerge_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FileMerge_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function FileMerge_extends(){return(FileMerge_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function FileMerge_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,FileMerge_toPropertyKey(o.key),o)}}function FileMerge_toPropertyKey(e){e=function FileMerge_toPrimitive(e,t){if("object"!==FileMerge_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileMerge_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileMerge_typeof(e)?e:String(e)}function FileMerge_setPrototypeOf(e,t){return(FileMerge_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function FileMerge_createSuper(r){var o=function FileMerge_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=FileMerge_getPrototypeOf(r);return function FileMerge_possibleConstructorReturn(e,t){{if(t&&("object"===FileMerge_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function FileMerge_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=FileMerge_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function FileMerge_getPrototypeOf(e){return(FileMerge_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var je=function(){!function FileMerge_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&FileMerge_setPrototypeOf(e,t)}(FileMerge,n.a);var o=FileMerge_createSuper(FileMerge);function FileMerge(e,t){var r;return function FileMerge_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileMerge),(r=o.call(this)).options=e,r.config=t,r.transport=new k,r.eventInit(),r.errorCount=0,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r}return function FileMerge_createClass(e,t,r){t&&FileMerge_defineProperties(e.prototype,t),r&&FileMerge_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileMerge,[{key:"mergeFile",value:function mergeFile(){for(var e={oid:this.currFileCtx.oid,uploadId:this.currFileCtx.uploadID,tosDomain:this.currFileCtx.tosDomain},t=this.currFileCtx.crc32Array,r="",o=0;o<t.length;o++)r=(r?"".concat(r,","):"").concat(o+1,":").concat(t[o].crc32);var e=w.urlTemplate(this.config.uploadMergeUrl,e),n=this.config.userId,i=FileMerge_extends(w.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:e,headers:FileMerge_objectSpread({authorization:this.currFileCtx.signature,"x-storage-u":n},i),custom:r})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.mergeFile()}},{key:"eventInit",value:function eventInit(){var r=this,o=this.options.stage;this.transport.on("complete",function(t){try{var e=JSON.parse(t.response);0===e.success&&e.payload.key?(FileMerge_extends(r.currFileCtx,{stage:o,type:"success",hasMerge:!0,extra:{message:"merge file success"},xhr:t,stageStartTime:r._st,stageEndTime:Date.now(),duration:Date.now()-r._st,totalDuration:Date.now()-r._st+r.currFileCtx.totalDuration}),r.successProcess(r.currFileCtx)):r.fail({error:"fail! result.success:".concat(e.success),xhr:t})}catch(e){r.fail({error:"response parse error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){r.fail({error:"request fail: ".concat(e.statusText||e.errText),xhr:e})})}},{key:"getProcessIndex",value:function getProcessIndex(e){var r=0;return e.forEach(function(e,t){"process"===e.stage&&(r=t)}),r}},{key:"fail",value:function fail(e){e=FileMerge_extends(this.currFileCtx,{extra:{message:"merge file error, ".concat(e.error),errorCode:we},type:"error",stage:this.options.stage,xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.failProcess(e)}}]),FileMerge}();function DirectUpload_typeof(e){return(DirectUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function DirectUpload_extends(){return(DirectUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function DirectUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function DirectUpload_toPropertyKey(e){e=function DirectUpload_toPrimitive(e,t){if("object"!==DirectUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==DirectUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===DirectUpload_typeof(e)?e:String(e)}(o.key),o)}}function DirectUpload_setPrototypeOf(e,t){return(DirectUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function DirectUpload_createSuper(r){var o=function DirectUpload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=DirectUpload_getPrototypeOf(r);return function DirectUpload_possibleConstructorReturn(e,t){{if(t&&("object"===DirectUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function DirectUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=DirectUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function DirectUpload_getPrototypeOf(e){return(DirectUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Te=function(){!function DirectUpload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&DirectUpload_setPrototypeOf(e,t)}(DirectUpload,n.a);var o=DirectUpload_createSuper(DirectUpload);function DirectUpload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function DirectUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,DirectUpload),(t=o.call(this)).options=e,t.file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t}return function DirectUpload_createClass(e,t,r){t&&DirectUpload_defineProperties(e.prototype,t),r&&DirectUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(DirectUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this._uploadSize=this.file.size,this.uploadHandlers={},this._st=Date.now(),this.upload()}},{key:"upload",value:function upload(){for(var t=this,r=this.crc32Array.length,o=0,n=0,e=0;e<r;e++){var i=this.crc32Array[e],s=i.buffer,i=i.crc32,a=this.currentCtx.oid,c=this.currentCtx.signature,a={oid:"[object Array]"===Object.prototype.toString.call(a)?a[e]:a,tosDomain:this.currentCtx.tosDomain},a=w.urlTemplate(this.config.directUploadFileUrl,a),u=this.config.userId,l=w.arrayToObject(this.currentCtx.UploadHeader),s=new Pe({sliceItem:s,crc32:i,url:a,signature:"[object Array]"===Object.prototype.toString.call(c)?c[e]:c,uploadHeader:l,userId:u,retryTime:this.retryUploadTime,method:"put"});s.on("complete",function(e){n+ ++o===r&&t.success(e.xhr)}),s.on("error",function(e){++n===r&&t.fail(e.xhr)}),s.on("progress",function(e){t.process(e)}),(this.uploadHandlers["".concat(i,"_").concat(Math.round(1e3*Math.random()))]=s).upload()}}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=DirectUpload_extends(this.currentCtx,{type:"success",stage:"process",percent:100,extra:{message:"direct upload success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.successProcess(t)}},{key:"fail",value:function fail(e){e=DirectUpload_extends(this.currentCtx,{extra:{message:"direct upload error",errorCode:ve},type:"error",stage:"process",xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.failProcess(e)}},{key:"process",value:function process(e){var t=this.currentCtx.fileSize,e=(this.finishSize=e.loaded,this.finishSize>this.lastFinishSize&&(this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/t*100*100)/100||0),t=DirectUpload_extends(this.currentCtx,{stage:"process",percent:e});e>this.lastProcessPercent&&100!==e&&(this.lastProcessPercent=e,this.context._broadcast("progress",t))}},{key:"stop",value:function stop(){Object.values(this.uploadHandlers).forEach(function(e){e.abort()})}}]),DirectUpload}();function CommitUpload_typeof(e){return(CommitUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CommitUpload_extends(){return(CommitUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function CommitUpload_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function CommitUpload_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?CommitUpload_ownKeys(Object(r),!0).forEach(function(e){!function CommitUpload_defineProperty(e,t,r){(t=CommitUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CommitUpload_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function CommitUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,CommitUpload_toPropertyKey(o.key),o)}}function CommitUpload_toPropertyKey(e){e=function CommitUpload_toPrimitive(e,t){if("object"!==CommitUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==CommitUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===CommitUpload_typeof(e)?e:String(e)}function CommitUpload_setPrototypeOf(e,t){return(CommitUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function CommitUpload_createSuper(r){var o=function CommitUpload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=CommitUpload_getPrototypeOf(r);return function CommitUpload_possibleConstructorReturn(e,t){{if(t&&("object"===CommitUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function CommitUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=CommitUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function CommitUpload_getPrototypeOf(e){return(CommitUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var De=function(){!function CommitUpload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&CommitUpload_setPrototypeOf(e,t)}(CommitUpload,n.a);var o=CommitUpload_createSuper(CommitUpload);function CommitUpload(e,t){var r;return function CommitUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,CommitUpload),(r=o.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.processAction=e.processAction,r.transport=new k,r.eventInit(),r}return function CommitUpload_createClass(e,t,r){t&&CommitUpload_defineProperties(e.prototype,t),r&&CommitUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(CommitUpload,[{key:"commitUpload",value:function commitUpload(){var t,e,r=this.options.key,r=this.options.context.tasks[r],o=ae[this.config.region],n="",i={},r=(this.options.type===y&&this.config.imageConfig&&this.config.imageConfig.serviceId?(n=this.config.imageHost||ue[o],i={Action:"CommitImageUpload",Version:"2018-08-01",SessionKey:r.SessionKey},this.options.serviceId||this.config.imageConfig&&this.config.imageConfig.serviceId?i.ServiceId=this.options.serviceId||this.config.imageConfig.serviceId:i.SpaceName=this.config.videoConfig&&this.config.videoConfig.spaceName,e="imagex"):(s=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(s=this.config.objectConfig.spaceName),n=this.config.videoHost||ce[o],i={Action:"CommitUploadInfo",Version:"2022-01-01"},e="vod",t={SpaceName:s,SessionKey:r.SessionKey,Functions:[]},s=this.config.videoConfig&&this.config.videoConfig.processAction,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.processAction&&(s=this.config.objectConfig.processAction),this.processAction&&(s=this.processAction),Array.isArray(s)&&0<s.length&&(t.Functions=s),(this.config.videoConfig&&this.config.videoConfig.callbackArgs||this.options.callbackArgs)&&(t.CallbackArgs=this.options.callbackArgs||this.config.videoConfig.callbackArgs)),this.config.accountId&&(i["X-Account-Id"]=this.config.accountId),w.toQueryString(i)),s=this.currFileCtx.proxyStsToken||this.config.stsToken,a=s.AccessKeyID,c=s.AccessKeyId,u=s.SecretAccessKey,s=s.SessionToken,n={method:"POST",url:"".concat(n,"?").concat(r),timeout:3e4,region:o,params:i,headers:{}};this.options.type===y&&this.config.imageConfig&&this.config.imageConfig.serviceId?(n.custom="none",n.headers["Content-Type"]="application/json"):(r=Object.keys(t).map(function(e){return"[object Array]"===Object.prototype.toString.call(t[e])||"[object Object]"===Object.prototype.toString.call(t[e])?"".concat(e,"=").concat(encodeURIComponent(JSON.stringify(t[e]))):"SessionKey"===e?"".concat(e,"=").concat(encodeURIComponent(t[e])):"".concat(e,"=").concat(t[e])}).join("&"),n.headers["Content-Type"]="application/x-www-form-urlencoded",n.body=r,n.custom=n.body),new ye.a(n,e,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:s},new Date),this.transport.send(n)}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now();try{this.commitUpload()}catch(e){this.fail({error:"catch error: ".concat(e.toString())})}}},{key:"eventInit",value:function eventInit(){var a=this;this.transport.on("complete",function(t){try{var e,r,o,n,i,s=JSON.parse(t.response);s.ResponseMetadata.Error?a.fail({xhr:t,errorCode:s.ResponseMetadata.Error.CodeN,error:s.ResponseMetadata.Error.Code,message:s.ResponseMetadata.Error.Message}):(e=s.Result,r={},a.options.type===y&&a.config.imageConfig&&a.config.imageConfig.serviceId?a.isImageBatchUpload?(o=e.Results,n=e.PluginResult||[],o.forEach(function(e,t){o[t]=CommitUpload_objectSpread(CommitUpload_objectSpread({},o[t]),n[t])}),r=o):CommitUpload_extends(r=e.Results[0],e.PluginResult&&e.PluginResult[0]):r=e.Data,i=CommitUpload_extends(a.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful"},uploadResult:r,xhr:t,stageStartTime:a._st,stageEndTime:Date.now(),duration:Date.now()-a._st,totalDuration:Date.now()-a._st+a.currFileCtx.totalDuration}),a.successProcess&&a.successProcess(i))}catch(e){a.fail({error:"catch error: ".concat(e.toString()),xhr:t})}}),this.transport.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};if(e.response)try{var r=JSON.parse(e.response);r.ResponseMetadata&&r.ResponseMetadata.Error&&(t.errorCode=r.ResponseMetadata.Error.CodeN,t.error=r.ResponseMetadata.Error.Code,t.message=r.ResponseMetadata.Error.Message)}catch(e){}a.fail(t)})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,o=e.xhr,n=e.errorCode||xe,i="commit upload error: UNKNOWN",t=(o&&(i=0===o.status?"commit upload error: NETERROR":e.message||"commit upload error: ".concat(o.status)),CommitUpload_extends(t.tasks[r],{extra:{message:i,error:e.error,errorCode:n},type:"error",stage:"complete",xhr:o,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.failProcess(t)}}]),CommitUpload}();function Queue_typeof(e){return(Queue_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Queue_extends(){return(Queue_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function Queue_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Queue_toPropertyKey(e){e=function Queue_toPrimitive(e,t){if("object"!==Queue_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Queue_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Queue_typeof(e)?e:String(e)}(o.key),o)}}function Queue_setPrototypeOf(e,t){return(Queue_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Queue_createSuper(r){var o=function Queue_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Queue_getPrototypeOf(r);return function Queue_possibleConstructorReturn(e,t){{if(t&&("object"===Queue_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Queue_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Queue_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Queue_getPrototypeOf(e){return(Queue_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ee=function(){!function Queue_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Queue_setPrototypeOf(e,t)}(Queue,n.a);var i=Queue_createSuper(Queue);function Queue(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0;return function Queue_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Queue),(t=i.call(this,e)).tasks=e,t.config=r,t.key=n,t.uploaderCtx=o,t.current=0,t.length=t.tasks.length,t.taskError={},t.uploadList=[],t.retryTaskTime=r.retryTaskTime||3,t}return function Queue_createClass(e,t,r){t&&Queue_defineProperties(e.prototype,t),r&&Queue_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Queue,[{key:"start",value:function start(){var e=this.tasks.shift();e&&(this.current=e.index,this.execTask(e))}},{key:"execTask",value:function execTask(r){var o=this,n=r.key,i=this.uploaderCtx,e=i.tasks[n].cacheTask,s=i.taskList[n].length;e&&0<r.index&&r.index<e?this.start():(i.tasks[n].currentTask=r.index,1===i.tasks[n].status&&r&&r.func.call(r.context,r.arg,function(e){var t=i.taskList[n][r.index+1];t&&0!==r.index?i._saveTask(n,{currentTask:t.index,stage:t.stage}):r.index===s-1&&i._removeTaskCache(n),o.success(e),0<o.tasks.length?o.start():i._queueSuccess(n)},function(e){e.xhr&&400<=e.xhr.status?o.fail(e):o.taskError[n]?o.taskError[n]<o.retryTaskTime?(o.taskError[n]++,o.execTask(r)):(e.key=n,o.fail(e)):(o.taskError[n]=1,o.execTask(r))}))}},{key:"addTask",value:function addTask(e){this.tasks.push(e)}},{key:"success",value:function success(e){var t;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},delete e.xhr),Queue_extends(e,{type:"success"});try{this.uploaderCtx._broadcast(e.stage,e)}catch(e){}this.uploaderCtx.logger.send(e)}},{key:"fail",value:function fail(e){var t,r=this.uploaderCtx;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},e.extra&&(e.extra.req=e.req,e.extra.res=e.res),delete e.xhr),Queue_extends(e,{type:"error"});try{r._broadcast("error",e)}catch(e){}r.logger.send(e),1!==e.currentTask&&(r.tasks[e.key].isBreak?r._cancel(e.key):r._pause(e.key))}},{key:"cancel",value:function cancel(e){var t=this.key,r=this.uploaderCtx.tasks[t].currentTask,r=this.uploaderCtx.tasks[t].isDirect?this.uploaderCtx.taskList[t][r-1]:this.uploaderCtx.taskList[t][r];e?r&&3===r.index&&(e=r.context,Object.values(e.uploadHandlers).forEach(function(e){e.abort()})):(this.tasks=[],r&&3===r.index&&r.context.stop(),this.uploaderCtx._removeTaskCache(t))}},{key:"restart",value:function restart(){this.uploadList.forEach(function(e){e.cancel=!1}),this.start()}}]),Queue}();function MainClass_typeof(e){return(MainClass_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MainClass_extends(){return(MainClass_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function MainClass_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function MainClass_toPropertyKey(e){e=function MainClass_toPrimitive(e,t){if("object"!==MainClass_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==MainClass_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===MainClass_typeof(e)?e:String(e)}(o.key),o)}}function MainClass_setPrototypeOf(e,t){return(MainClass_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function MainClass_createSuper(r){var o=function MainClass_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=MainClass_getPrototypeOf(r);return function MainClass_possibleConstructorReturn(e,t){{if(t&&("object"===MainClass_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return MainClass_assertThisInitialized(e)}(this,o?(e=MainClass_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function MainClass_assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MainClass_getPrototypeOf(e){return(MainClass_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(){!function MainClass_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&MainClass_setPrototypeOf(e,t)}(MainClass,n.a);var r=MainClass_createSuper(MainClass);function MainClass(e){var t;return function MainClass_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,MainClass),(t=r.call(this,e)).config=MainClass_extends({},S),t._mergeOptions(t.config,e),t.tasks={},t.taskList={},t.cache={},t.storage=w.storage(MainClass_assertThisInitialized(t),t.config.useLocalStorage),t.logger=t.config.noLog?{send:function send(){}}:new le(t.config,MainClass_assertThisInitialized(t)),t}return function MainClass_createClass(e,t,r){t&&MainClass_defineProperties(e.prototype,t),r&&MainClass_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(MainClass,[{key:"_mergeOptions",value:function _mergeOptions(t,r){r&&"object"===MainClass_typeof(r)&&(MainClass_extends(t,r),t.log.userId=r.userId||t.userId,t.log.appId=r.appId||t.appId,Object.keys(r).forEach(function(e){"vodDomain"===e&&(t.replace[e]=r[e])}))}},{key:"_setCache",value:function _setCache(e,t){this.storage.setItem(e,t)}},{key:"_getCache",value:function _getCache(e){return this.storage.getItem(e)}},{key:"_removeCache",value:function _removeCache(e){e?this.storage.removeItem(e):this.storage.clear()}},{key:"_addTask",value:function _addTask(e,t){var r=this.tasks,o=this.taskList;r[e]&&r[e].task?o[e].push(t):(o[e]=[],o[e].push(t),r[e]=r[e]||{},r[e].task=new Ee([],this.config,this,e)),r[e].task.addTask(t)}},{key:"_broadcast",value:function _broadcast(e,t){var r=this.tasks[t.key].status;if(r===m||0===r)try{this.emit(e,t)}catch(e){r=!("[object Error]"!==Object.prototype.toString.call(e));if(!r||"Error"===e.name)throw e}}},{key:"_addCrc32ProcessTask",value:function _addCrc32ProcessTask(e,t,r){var o=r.isDirect,r=r.isImageBatchUpload,e=new he({file:e.file,context:this,key:t,isDirect:o,isImageBatchUpload:r},this.config),o={context:e,func:e.start,arg:{},key:t,index:0,stage:"crc32"};this._addTask(t,o)}},{key:"_addPreUploadTask",value:function _addPreUploadTask(e,t,r){var o=r.isImageBatchUpload,r=r.serviceId,o={file:e.file,stsToken:e.stsToken,context:this,type:e.type||te,preUploadUriParams:e.preUploadUriParams||{},storeKey:e.storeKey,key:t,isImageBatchUpload:o,fileName:e.fileName||null,fileExtension:e.fileExtension||null,storageClass:e.storageClass||null,serviceId:r},e=new Se(o,this.config),r={context:e,func:e.start,arg:{},key:t,index:1,stage:"preUpload"};this._addTask(t,r)}},{key:"_addDirectUploadTask",value:function _addDirectUploadTask(e,t,r){r=r.isImageBatchUpload,e=new Te({file:e.file,context:this,key:t,isImageBatchUpload:r},this.config),r={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,r)}},{key:"_addInitUploadIDTask",value:function _addInitUploadIDTask(e,t){e=new Ce({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:2,stage:"initUploadID"};this._addTask(t,e)}},{key:"_addUploadProcessTask",value:function _addUploadProcessTask(e,t){e=new Ie({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,e)}},{key:"_mergeFileTask",value:function _mergeFileTask(e,t){e=new je({file:e.file,context:this,stage:"fileMerge",key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:4,stage:"fileMerge"};this._addTask(t,e)}},{key:"_getMetaInfoTask",value:function _getMetaInfoTask(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=r.isImageBatchUpload,r=r.serviceId,o={file:e.file,context:this,data:e.data,type:e.type||te,callbackArgs:e.callbackArgs,key:t,isImageBatchUpload:void 0!==o&&o,serviceId:r,processAction:e.processAction},r=new De(o,this.config),e={context:r,func:r.start,arg:{},key:t,index:5,stage:"complete"};this._addTask(t,e)}},{key:"_addAllUploadProcess",value:function _addAllUploadProcess(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,o=e.type===y&&"[object Array]"===Object.prototype.toString.call(e.file),n=(this.tasks[t]=this.tasks[t]||{},this.tasks[t].fileType=e.type||te,this.tasks[t].fileSize=e.file&&e.file.size,this.tasks[t].proxyStsToken=e.stsToken,e.file.size<10485760||o);this._addCrc32ProcessTask(e,t,{isDirect:n,isImageBatchUpload:o}),this._addPreUploadTask(e,t,{isImageBatchUpload:o,serviceId:r}),n?this._addDirectUploadTask(e,t,{isImageBatchUpload:o}):(this._addInitUploadIDTask(e,t),this._addUploadProcessTask(e,t),this._mergeFileTask(e,t)),this._getMetaInfoTask(e,t,{isImageBatchUpload:o,serviceId:r})}},{key:"_run",value:function _run(e){var t=this.tasks,r=navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);r&&r[1]&&Number(r[1])<=9?(this._broadcast("error",MainClass_extends(t[e],{key:e,status:0,stage:"browserError",extra:{message:"cannot support the browser below ie10"},type:"error"})),this.logger.send(t[e]),this._cancel(e)):t[e]?t[e].status===ne?this._restart(e):(r=new Date,t[e].startTime=r.getTime(),t[e].task&&t[e].status!==m&&t[e].task.tasks.length&&(t[e].status=m,this.logger.send(MainClass_extends({},t[e],{extra:{message:"start upload"},type:"start",key:e})),t[e].task.start())):console.warn("".concat(e," is not exit in object tasks, stop running..."))}},{key:"_restart",value:function _restart(r){var o,n,i=this,e=this.tasks;e[r]?(o=e[r].task,n=e[r].currentTask||0,this.taskList[r].forEach(function(e,t){e.index===n&&(o.tasks=i.taskList[r].slice(t))}),o&&e[r].status!==m&&o.tasks.length&&(e[r].status=m,o.restart())):console.warn("".concat(r," is not exit in object tasks"))}},{key:"_cancel",value:function _cancel(e){var t=this.tasks;t[e]?(t[e].status=oe,t[e].task.cancel(!1),this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_pause",value:function _pause(e){var t=this.tasks;t[e]?(t[e].status=ne,t[e].task.cancel(!0),this._saveTask(e)):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeTaskCache",value:function _removeTaskCache(e){var t=this.tasks;t[e]?(t=t[e].crc32Key)&&this._removeCache(t):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_saveTask",value:function _saveTask(e,t){e=MainClass_extends({},this.tasks[e],t||{}),t=e.crc32Key;if(t){var r={SessionKey:e.SessionKey,UploadHeader:e.UploadHeader,fileName:e.fileName,oid:e.oid,uploadID:e.uploadID,signature:e.signature,tosDomain:e.tosDomain,hasMerge:e.hasMerge};Object.keys(r).forEach(function(e){r[e]||delete r[e]});try{this._setCache(t,JSON.stringify(r))}catch(e){return[!1,e.message]}return[!0,""]}}},{key:"_queueSuccess",value:function _queueSuccess(e){var t,r=this.tasks;r[e]?(t=new Date,r[e].endTime=t.getTime(),r[e].time=r[e].endTime-r[e].startTime,r[e].status=0,this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeFile",value:function _removeFile(e){delete this.tasks[e]}},{key:"_batchAction",value:function _batchAction(t){var e=this.tasks;Object.keys(e).forEach(function(e){t&&t(e)})}},{key:"_refreshStsToken",value:function _refreshStsToken(o){var n=this,i=this.tasks;Object.keys(i).forEach(function(e){var e=i[e],t=MainClass_extends({},e,{proxyStsToken:o}),r=(e.proxyStsToken=o,t.crc32Key);r&&(delete t.task,delete t.xhr,delete t.crc32Array,e.proxyStsToken=o,n._setCache(r,JSON.stringify(t)))})}},{key:"_setOption",value:function _setOption(e){this._mergeOptions(this.config,e)}},{key:"_setServiceId",value:function _setServiceId(e){!this.config.imageConfig&&e?this.config.imageConfig={serviceId:e}:this.config.imageConfig.serviceId=e}},{key:"_getServiceId",value:function _getServiceId(){var e;return null==(e=this.config.imageConfig)?void 0:e.serviceId}},{key:"_getOption",value:function _getOption(e){var t=MainClass_extends({},this.config);return Object.keys(t).forEach(function(e){(-1<e.indexOf("Url")||"replace"===e||"log"===e)&&delete t[e]}),e?t[e]:t}},{key:"_userCancel",value:function _userCancel(e){var t=this,r=this.tasks;e?(this._cancel(e),this.logger.send(MainClass_extends({},r[e],{type:"cancel"}))):Object.keys(r).forEach(function(e){t._cancel(e),t.logger.send(MainClass_extends({},r[e],{type:"cancel"}))})}},{key:"_userPause",value:function _userPause(e){var t=this,r=this.tasks;e?(this._pause(e),this.logger.send(MainClass_extends({},r[e],{type:"pause"}))):Object.keys(r).forEach(function(e){t._pause(e),t.logger.send(MainClass_extends({},r[e],{type:"pause"}))})}}]),MainClass}(),Re={checkFile:function checkFile(){},checkStsToken:function checkStsToken(e){return!e||e.SessionToken&&e.SecretAccessKey&&(e.AccessKeyId||e.AccessKeyID)}};function entry_typeof(e){return(entry_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function entry_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function entry_toPropertyKey(e){e=function entry_toPrimitive(e,t){if("object"!==entry_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==entry_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===entry_typeof(e)?e:String(e)}(o.key),o)}}function entry_setPrototypeOf(e,t){return(entry_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function entry_createSuper(r){var o=function entry_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=entry_getPrototypeOf(r);return function entry_possibleConstructorReturn(e,t){{if(t&&("object"===entry_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function entry_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=entry_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function entry_getPrototypeOf(e){return(entry_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Me=function(){!function entry_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&entry_setPrototypeOf(e,t)}(TTUploader,Ae);var e=entry_createSuper(TTUploader);function TTUploader(){return function entry_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,TTUploader),e.apply(this,arguments)}return function entry_createClass(e,t,r){t&&entry_defineProperties(e.prototype,t),r&&entry_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(TTUploader,[{key:"start",value:function start(e){this.abort=!1,e?this._run(e):this._batchAction(this._run.bind(this))}},{key:"addFile",value:function addFile(e){var t;return e&&Re.checkStsToken(e.stsToken)?e.file?(t=w.getUnique("file"),this._addAllUploadProcess(e,t),t):null:(this.emit("error",{extra:{message:ke,errorCode:_e}}),null)}},{key:"addImageFile",value:function addImageFile(e){var t;return e&&Re.checkStsToken(e.stsToken)?e.file?(e.type=y,t=w.getUnique("file"),this._addAllUploadProcess(e,t),t):null:(this.emit("error",{extra:{message:ke,errorCode:_e}}),null)}},{key:"addImageXMaterial",value:function addImageXMaterial(e){var t;return e&&Re.checkStsToken(e.stsToken)?e.file?(e.type=e.type||y,t=w.getUnique("file"),this._addAllUploadProcess(e,t,e.serviceId),t):null:(this.emit("error",{extra:{message:ke,errorCode:_e}}),null)}},{key:"setServiceId",value:function setServiceId(e){this._setServiceId(e)}},{key:"getServiceId",value:function getServiceId(){return this._getServiceId()}},{key:"removeFile",value:function removeFile(e){e&&this._removeFile(e)}},{key:"cancel",value:function cancel(e){e?this._userCancel(e):this._batchAction(this._userCancel.bind(this))}},{key:"pause",value:function pause(e){this._userPause(e)}},{key:"restart",value:function restart(e){e?this._restart(e):this._batchAction(this._restart.bind(this))}},{key:"refreshAuth",value:function refreshAuth(e){this._refreshAuth(e)}},{key:"setOption",value:function setOption(e){this._setOption(e)}},{key:"getOption",value:function getOption(e){return this._getOption(e)}}]),TTUploader}()}]).default});
1
+ !function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.TTUploader=t():e.TTUploader=t()}("undefined"!=typeof self?self:this,function(){return function(r){var o={};function __webpack_require__(e){var t;return(o[e]||(t=o[e]={i:e,l:!1,exports:{}},r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t)).exports}return __webpack_require__.m=r,__webpack_require__.c=o,__webpack_require__.d=function(e,t,r){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(__webpack_require__.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)__webpack_require__.d(r,o,function(e){return t[e]}.bind(null,o));return r},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=9)}([function(e,t,r){"use strict";var o="object"==typeof Reflect?Reflect:null,c=o&&"function"==typeof o.apply?o.apply:function ReflectApply(e,t,r){return Function.prototype.apply.call(e,t,r)};var n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function ReflectOwnKeys(e){return Object.getOwnPropertyNames(e)},i=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(r,o){return new Promise(function(e,t){function errorListener(e){r.removeListener(o,resolver),t(e)}function resolver(){"function"==typeof r.removeListener&&r.removeListener("error",errorListener),e([].slice.call(arguments))}eventTargetAgnosticAddListener(r,o,resolver,{once:!0}),"error"!==o&&function addErrorHandlerIfEventEmitter(e,t,r){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,r)}(r,errorListener,{once:!0})})},(EventEmitter.EventEmitter=EventEmitter).prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var s=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,r,o){var n,i;return checkListener(r),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,r.listener||r),n=e._events),i=n[t]),void 0===i?(i=n[t]=r,++e._eventsCount):("function"==typeof i?i=n[t]=o?[r,i]:[i,r]:o?i.unshift(r):i.push(r),0<(n=_getMaxListeners(e))&&i.length>n&&!i.warned&&(i.warned=!0,(o=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",o.emitter=e,o.type=t,o.count=i.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(o))),e}function _onceWrap(e,t,r){e={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},t=function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(e);return t.listener=r,e.wrapFn=t}function _listeners(e,t,r){var e=e._events;return void 0===e||void 0===(e=e[t])?[]:"function"==typeof e?r?[e.listener||e]:[e]:r?function unwrapListeners(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(e):arrayClone(e,e.length)}function listenerCount(e){var t=this._events;if(void 0!==t){t=t[e];if("function"==typeof t)return 1;if(void 0!==t)return t.length}return 0}function arrayClone(e,t){for(var r=new Array(t),o=0;o<t;++o)r[o]=e[o];return r}function eventTargetAgnosticAddListener(t,r,o,n){if("function"==typeof t.on)n.once?t.once(r,o):t.on(r,o);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(r,function wrapListener(e){n.once&&t.removeEventListener(r,wrapListener),o(e)})}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function setMaxListeners(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var o="error"===e,n=this._events;if(void 0!==n)o=o&&void 0===n.error;else if(!o)return!1;if(o){if((i=0<t.length?t[0]:i)instanceof Error)throw i;o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var i=n[e];if(void 0===i)return!1;if("function"==typeof i)c(i,this,t);else for(var s=i.length,a=arrayClone(i,s),r=0;r<s;++r)c(a[r],this,t);return!0},EventEmitter.prototype.on=EventEmitter.prototype.addListener=function addListener(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.prependListener=function prependListener(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function once(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener=function removeListener(e,t){var r,o,n,i,s;if(checkListener(t),void 0!==(o=this._events)&&void 0!==(r=o[e]))if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,i=r.length-1;0<=i;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,n=i;break}if(n<0)return this;0===n?r.shift():function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(o[e]=r[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t,r=this._events;if(void 0!==r)if(void 0===r.removeListener)0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]);else if(0===arguments.length){for(var o,n=Object.keys(r),i=0;i<n.length;++i)"removeListener"!==(o=n[i])&&this.removeAllListeners(o);this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;0<=i;i--)this.removeListener(e,t[i]);return this},EventEmitter.prototype.listeners=function listeners(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function rawListeners(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return 0<this._eventsCount?n(this._events):[]}},function(n,i,s){!function(r){var o;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"object"==_typeof(i)&&void 0!==n?n.exports=e():void 0!==(o="function"==typeof(o=e)?o.call(i,s,i,n):o)&&(n.exports=o)}(function(){"use strict";function e(e,t){for(var r,o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==_typeof(r=function(e){if("object"!=_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(n.key))?r:String(r),n)}}function t(e,t,r){return e(r={path:t,exports:{},require:function require(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var r=t(function(e,t){e.exports=function(u){var r=Object.create||function(){function e(){}return function(t){return e.prototype=t,t=new e,e.prototype=null,t}}(),e={},t=e.lib={},o=t.Base={extend:function extend(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),(t.init.prototype=t).$super=this,t},create:function create(){var e=this.extend();return e.init.apply(e,arguments),e},init:function init(){},mixIn:function mixIn(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function clone(){return this.init.prototype.extend(this)}},l=t.WordArray=o.extend({init:function init(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function toString(e){return(e||s).stringify(this)},concat:function concat(e){var t=this.words,r=e.words,o=this.sigBytes,n=e.sigBytes;if(this.clamp(),o%4)for(var i=0;i<n;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[o+i>>>2]|=s<<24-(o+i)%4*8}else for(i=0;i<n;i+=4)t[o+i>>>2]=r[i>>>2];return this.sigBytes+=n,this},clamp:function clamp(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=u.ceil(t/4)},clone:function clone(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function random(e){for(var t=[],r=function i(e){var t=987654321,r=4294967295;return function(){return((((t=36969*(65535&t)+(t>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r)/4294967296+.5)*(.5<u.random()?1:-1)}},o=0;o<e;o+=4){var n=r(4294967296*(i||u.random())),i=987654071*n();t.push(4294967296*n()|0)}return new l.init(t,e)}}),n=e.enc={},s=n.Hex={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,o=[],n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push((i>>>4).toString(16)),o.push((15&i).toString(16))}return o.join("")},parse:function parse(e){for(var t=e.length,r=[],o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new l.init(r,t/2)}},a=n.Latin1={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,o=[],n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push(String.fromCharCode(i))}return o.join("")},parse:function parse(e){for(var t=e.length,r=[],o=0;o<t;o++)r[o>>>2]|=(255&e.charCodeAt(o))<<24-o%4*8;return new l.init(r,t)}},c=n.Utf8={stringify:function stringify(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function parse(e){return a.parse(unescape(encodeURIComponent(e)))}},p=t.BufferedBlockAlgorithm=o.extend({reset:function reset(){this._data=new l.init,this._nDataBytes=0},_append:function _append(e){"string"==typeof e&&(e=c.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function _process(e){var t=this._data,r=t.words,o=t.sigBytes,n=this.blockSize,i=o/(4*n),s=(e?u.ceil(i):u.max((0|i)-this._minBufferSize,0))*n,e=u.min(4*s,o);if(s){for(var a=0;a<s;a+=n)this._doProcessBlock(r,a);var c=r.splice(0,s);t.sigBytes-=e}return new l.init(c,e)},clone:function clone(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),f=(t.Hasher=p.extend({cfg:o.extend(),init:function init(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function reset(){p.reset.call(this),this._doReset()},update:function update(e){return this._append(e),this._process(),this},finalize:function finalize(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function _createHelper(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function _createHmacHelper(r){return function(e,t){return new f.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e}(Math)}),o=t(function(e,t){var c;e.exports=(c=r,function(i){var e=c,r=e.lib,o=r.WordArray,s=r.Hasher,r=e.algo,a=[],h=[],y=(!function(){function n(e){return 4294967296*(e-(0|e))|0}for(var e=2,t=0;t<64;)!function t(e){for(var r=i.sqrt(e),o=2;o<=r;o++)if(!(e%o))return;return 1}(e)||(t<8&&(a[t]=n(i.pow(e,.5))),h[t]=n(i.pow(e,1/3)),t++),e++}(),[]),r=r.SHA256=s.extend({_doReset:function _doReset(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function _doProcessBlock(e,t){for(var r=this._hash.words,o=r[0],n=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],p=0;p<64;p++){y[p]=p<16?0|e[t+p]:(((f=y[p-15])<<25|f>>>7)^(f<<14|f>>>18)^f>>>3)+y[p-7]+(((f=y[p-2])<<15|f>>>17)^(f<<13|f>>>19)^f>>>10)+y[p-16];var f=o&n^o&i^n&i,d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+h[p]+y[p],l=u,u=c,c=a,a=s+d|0,s=i,i=n,n=o,o=d+(((o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22))+f)|0}r[0]=r[0]+o|0,r[1]=r[1]+n|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+l|0},_doFinalize:function _doFinalize(){var e=this._data,t=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return t[o>>>5]|=128<<24-o%32,t[14+(64+o>>>9<<4)]=i.floor(r/4294967296),t[15+(64+o>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function clone(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=s._createHelper(r),e.HmacSHA256=s._createHmacHelper(r)}(Math),c.SHA256)}),n=(t(function(e,t){var a;e.exports=(e=r.lib.Base,a=r.enc.Utf8,void(r.algo.HMAC=e.extend({init:function init(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var r=e.blockSize,o=4*r;(t=t.sigBytes>o?e.finalize(t):t).clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),n=e.words,i=t.words,s=0;s<r;s++)n[s]^=1549556828,i[s]^=909522486;e.sigBytes=t.sigBytes=o,this.reset()},reset:function reset(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function update(e){return this._hasher.update(e),this},finalize:function finalize(e){var t=this._hasher,e=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(e))}})))}),t(function(e,t){e.exports=r.HmacSHA256})),i=function hmac(e,t){return n(t,e)},s=function sha256(e){return o(e)},a=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id"],u=function a(e){try{return encodeURIComponent(e).replace(/[^A-Za-z0-9_.~\-%]+/g,escape).replace(/[*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())})}catch(e){return""}},l=function c(r){return Object.keys(r).sort().map(function(e){var t=r[e];if(null!=t){e=u(e);if(e)return Array.isArray(t)?"".concat(e,"=").concat(t.map(u).sort().join("&".concat(e,"="))):"".concat(e,"=").concat(u(t))}}).filter(function(e){return e}).join("&")};return function(){function t(e,r,o){!function(e){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this),this.request=e,this.request.headers=e.headers||{},this.serviceName=r,this.signatureCache="boolean"!=typeof(o=o||{}).signatureCache||o.signatureCache,this.operation=o.operation,this.signatureVersion=o.signatureVersion,this.constant=o.isVolcengine?{algorithm:"HMAC-SHA256",v4Identifier:"request",dateHeader:"X-Date",tokenHeader:"x-security-token",contentSha256Header:"X-Content-Sha256",kDatePrefix:""}:{algorithm:"AWS4-HMAC-SHA256",v4Identifier:"aws4_request",dateHeader:"X-Amz-Date",tokenHeader:"x-amz-security-token",contentSha256Header:"X-Amz-Content-Sha256",kDatePrefix:"AWS4"},this.bodySha256=o.bodySha256,this.shouldSerializeBody="boolean"!=typeof o.shouldSerializeBody||o.shouldSerializeBody}var r=t;return e(r.prototype,[{key:"addAuthorization",value:function value(e,t){t=this.iso8601(t).replace(/[:\-]|\.\d{3}/g,"");this.addHeaders(e,t),this.request.headers.Authorization=this.authorization(e,t)}},{key:"addHeaders",value:function value(e,t){this.request.headers[this.constant.dateHeader]=t,e.sessionToken&&(this.request.headers[this.constant.tokenHeader]=e.sessionToken),this.request.body&&("string"!=typeof(t=this.request.body)&&this.shouldSerializeBody&&(t=t instanceof URLSearchParams?t.toString():JSON.stringify(t)),this.request.headers[this.constant.contentSha256Header]=this.bodySha256||s(t).toString())}},{key:"authorization",value:function value(e,t){var r=[],o=this.credentialString(t);return r.push("".concat(this.constant.algorithm," Credential=").concat(e.accessKeyId,"/").concat(o)),r.push("SignedHeaders=".concat(this.signedHeaders())),r.push("Signature=".concat(this.signature(e,t))),r.join(", ")}},{key:"signature",value:function value(e,t){e=this.getSigningKey(e,t.substr(0,8),this.request.region,this.serviceName,this.signatureCache);return i(e,this.stringToSign(t),"hex")}},{key:"stringToSign",value:function value(e){var t=[];return t.push(this.constant.algorithm),t.push(e),t.push(this.credentialString(e)),t.push(this.hexEncodedHash(this.canonicalString())),t.join("\n")}},{key:"canonicalString",value:function value(){var e=[],t=this.request.pathname||"/";return e.push(this.request.method.toUpperCase()),e.push(t),e.push(l(this.request.params)||""),e.push("".concat(this.canonicalHeaders(),"\n")),e.push(this.signedHeaders()),e.push(this.hexEncodedBodyHash()),e.join("\n")}},{key:"canonicalHeaders",value:function value(){var r=this,t=[],o=(Object.keys(this.request.headers).forEach(function(e){t.push([e,r.request.headers[e]])}),t.sort(function(e,t){return e[0].toLowerCase()<t[0].toLowerCase()?-1:1}),[]);return t.forEach(function(e){var t=e[0].toLowerCase();if(r.isSignableHeader(t)){e=e[1];if(null==e||"function"!=typeof e.toString)throw new Error("Header ".concat(t," contains invalid value"));o.push("".concat(t,":").concat(r.canonicalHeaderValues(e.toString())))}}),o.join("\n")}},{key:"canonicalHeaderValues",value:function value(e){return e.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")}},{key:"signedHeaders",value:function value(){var t=this,r=[];return Object.keys(this.request.headers).forEach(function(e){e=e.toLowerCase(),t.isSignableHeader(e)&&r.push(e)}),r.sort().join(";")}},{key:"credentialString",value:function value(e){return this.createScope(e.substr(0,8),this.request.region,this.serviceName)}},{key:"hexEncodedHash",value:function value(e){return s(e)}},{key:"hexEncodedBodyHash",value:function value(){return this.request.headers[this.constant.contentSha256Header]||(this.request.body?this.hexEncodedHash(l(this.request.body)):this.hexEncodedHash(""))}},{key:"isSignableHeader",value:function value(e){return 0===e.toLowerCase().indexOf("x-amz-")||a.indexOf(e)<0}},{key:"iso8601",value:function value(e){return(e=void 0===e?new Date:e).toISOString().replace(/\.\d{3}Z$/,"Z")}},{key:"getSigningKey",value:function value(e,t,r,o){e=i("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey),t),t=i(e,r),e=i(t,o);return i(e,this.constant.v4Identifier)}},{key:"createScope",value:function value(e,t,r){return[e.substr(0,8),t,r,this.constant.v4Identifier].join("/")}}]),Object.defineProperty(r,"prototype",{writable:!1}),t}()})}.call(this,s(7))},function(e,t,r){e.exports=function(){var e=e||function(p,r){var o=Object.create||function(){function F(){}return function(e){var t;F.prototype=e;t=new F;F.prototype=null;return t}}();var e={};var t=e.lib={};var n=t.Base=function(){return{extend:function(e){var t=o(this);if(e)t.mixIn(e);if(!t.hasOwnProperty("init")||this.init===t.init)t.init=function(){t.$super.init.apply(this,arguments)};t.init.prototype=t;t.$super=this;return t},create:function(){var e=this.extend();e.init.apply(e,arguments);return e},init:function(){},mixIn:function(e){for(var t in e)if(e.hasOwnProperty(t))this[t]=e[t];if(e.hasOwnProperty("toString"))this.toString=e.toString},clone:function(){return this.init.prototype.extend(this)}}}();var f=t.WordArray=n.extend({init:function(e,t){e=this.words=e||[];if(t!=r)this.sigBytes=t;else this.sigBytes=e.length*4},toString:function(e){return(e||s).stringify(this)},concat:function(e){var t=this.words;var r=e.words;var o=this.sigBytes;var n=e.sigBytes;this.clamp();if(o%4)for(var i=0;i<n;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[o+i>>>2]|=s<<24-(o+i)%4*8}else for(var i=0;i<n;i+=4)t[o+i>>>2]=r[i>>>2];this.sigBytes+=n;return this},clamp:function(){var e=this.words;var t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8;e.length=p.ceil(t/4)},clone:function(){var e=n.clone.call(this);e.words=this.words.slice(0);return e},random:function(e){var t=[];var r=function(t){var t=t;var r=987654321;var o=4294967295;return function(){r=36969*(r&65535)+(r>>16)&o;t=18e3*(t&65535)+(t>>16)&o;var e=(r<<16)+t&o;e/=4294967296;e+=.5;return e*(p.random()>.5?1:-1)}};for(var o=0,n;o<e;o+=4){var i=r((n||p.random())*4294967296);n=i()*987654071;t.push(i()*4294967296|0)}return new f.init(t,e)}});var i=e.enc={};var s=i.Hex={stringify:function(e){var t=e.words;var r=e.sigBytes;var o=[];for(var n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push((i>>>4).toString(16));o.push((i&15).toString(16))}return o.join("")},parse:function(e){var t=e.length;var r=[];for(var o=0;o<t;o+=2)r[o>>>3]|=parseInt(e.substr(o,2),16)<<24-o%8*4;return new f.init(r,t/2)}};var a=i.Latin1={stringify:function(e){var t=e.words;var r=e.sigBytes;var o=[];for(var n=0;n<r;n++){var i=t[n>>>2]>>>24-n%4*8&255;o.push(String.fromCharCode(i))}return o.join("")},parse:function(e){var t=e.length;var r=[];for(var o=0;o<t;o++)r[o>>>2]|=(e.charCodeAt(o)&255)<<24-o%4*8;return new f.init(r,t)}};var c=i.Utf8={stringify:function(e){try{return decodeURIComponent(escape(a.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return a.parse(unescape(encodeURIComponent(e)))}};var u=t.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new f.init;this._nDataBytes=0},_append:function(e){if(typeof e=="string")e=c.parse(e);this._data.concat(e);this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data;var r=t.words;var o=t.sigBytes;var n=this.blockSize;var i=n*4;var s=o/i;if(e)s=p.ceil(s);else s=p.max((s|0)-this._minBufferSize,0);var a=s*n;var c=p.min(a*4,o);if(a){for(var u=0;u<a;u+=n)this._doProcessBlock(r,u);var l=r.splice(0,a);t.sigBytes-=c}return new f.init(l,c)},clone:function(){var e=n.clone.call(this);e._data=this._data.clone();return e},_minBufferSize:0});var l=t.Hasher=u.extend({cfg:n.extend(),init:function(e){this.cfg=this.cfg.extend(e);this.reset()},reset:function(){u.reset.call(this);this._doReset()},update:function(e){this._append(e);this._process();return this},finalize:function(e){if(e)this._append(e);var t=this._doFinalize();return t},blockSize:512/32,_createHelper:function(r){return function(e,t){return new r.init(t).finalize(e)}},_createHmacHelper:function(r){return function(e,t){return new d.HMAC.init(r,t).finalize(e)}}});var d=e.algo={};return e}(Math);return e}()},function(e,t,r){e.exports=function(c){return function(n){var e=c;var t=e.lib;var r=t.WordArray;var o=t.Hasher;var i=e.algo;var s=[];var x=[];(function(){function isPrime(e){var t=n.sqrt(e);for(var r=2;r<=t;r++)if(!(e%r))return false;return true}function getFractionalBits(e){return(e-(e|0))*4294967296|0}var e=2;var t=0;while(t<64){if(isPrime(e)){if(t<8)s[t]=getFractionalBits(n.pow(e,1/2));x[t]=getFractionalBits(n.pow(e,1/3));t++}e++}})();var k=[];var a=i.SHA256=o.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(e,t){var r=this._hash.words;var o=r[0];var n=r[1];var i=r[2];var s=r[3];var a=r[4];var c=r[5];var u=r[6];var l=r[7];for(var p=0;p<64;p++){if(p<16)k[p]=e[t+p]|0;else{var f=k[p-15];var d=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3;var h=k[p-2];var y=(h<<15|h>>>17)^(h<<13|h>>>19)^h>>>10;k[p]=d+k[p-7]+y+k[p-16]}var _=a&c^~a&u;var g=o&n^o&i^n&i;var m=(o<<30|o>>>2)^(o<<19|o>>>13)^(o<<10|o>>>22);var v=(a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25);var b=l+v+_+x[p]+k[p];var w=m+g;l=u;u=c;c=a;a=s+b|0;s=i;i=n;n=o;o=b+w|0}r[0]=r[0]+o|0;r[1]=r[1]+n|0;r[2]=r[2]+i|0;r[3]=r[3]+s|0;r[4]=r[4]+a|0;r[5]=r[5]+c|0;r[6]=r[6]+u|0;r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data;var t=e.words;var r=this._nDataBytes*8;var o=e.sigBytes*8;t[o>>>5]|=128<<24-o%32;t[(o+64>>>9<<4)+14]=n.floor(r/4294967296);t[(o+64>>>9<<4)+15]=r;e.sigBytes=t.length*4;this._process();return this._hash},clone:function(){var e=o.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA256=o._createHelper(a);e.HmacSHA256=o._createHmacHelper(a)}(Math),c.SHA256}(r(2))},function(e,t,r){e.exports=function(e){return e.HmacSHA256}(r(2),(r(3),r(6)))},function(e,t,r){e.exports=function(){return r(8)('!function(_){var t={};function __webpack_require__(e){var r;return(t[e]||(r=t[e]={i:e,l:!1,exports:{}},_[e].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r)).exports}__webpack_require__.m=_,__webpack_require__.c=t,__webpack_require__.d=function(e,r,_){__webpack_require__.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:_})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(r,e){if(1&e&&(r=__webpack_require__(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var _=Object.create(null);if(__webpack_require__.r(_),Object.defineProperty(_,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)__webpack_require__.d(_,t,function(e){return r[e]}.bind(null,t));return _},__webpack_require__.n=function(e){var r=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(e,r){function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}self.onmessage=function(e){var e=e.data,r=e[0],e=e[1],_=function crc32(e,r){for(var _=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],t=("undefined"!=typeof Int32Array&&(_=new Int32Array(_)),-1^~~r),n=(e=new Uint8Array(e)).length,u=0;u<n;u++)t=_[255&(t^e[u])]^t>>>8;return(-1^t)>>>0}(r,0);postMessage([r,dec2hex(_),e],[r])}}]);',null)}},function(e,t,r){e.exports=function(s){(function(){var e=s;var t=e.lib;var r=t.Base;var o=e.enc;var u=o.Utf8;var n=e.algo;var i=n.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init;if(typeof t=="string")t=u.parse(t);var r=e.blockSize;var o=r*4;if(t.sigBytes>o)t=e.finalize(t);t.clamp();var n=this._oKey=t.clone();var i=this._iKey=t.clone();var s=n.words;var a=i.words;for(var c=0;c<r;c++){s[c]^=1549556828;a[c]^=909522486}n.sigBytes=i.sigBytes=o;this.reset()},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey)},update:function(e){this._hasher.update(e);return this},finalize:function(e){var t=this._hasher;var r=t.finalize(e);t.reset();var o=t.finalize(this._oKey.clone().concat(r));return o}})})()}(r(2))},function(e,t){var r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";var n=window.URL||window.webkitURL;e.exports=function(t,r){try{try{var o;try{(o=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),o=o.getBlob()}catch(e){o=new Blob([t])}return new Worker(n.createObjectURL(o))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(e){if(r)return new Worker(r);throw Error("Inline worker is not supported")}}},function(O,r,o){"use strict";o.r(r),o.d(r,"default",function(){return Ne});var r=o(0),n=o.n(r),S={debug:!1,region:"cn-north-1",initUploadFileUrl:"{tosDomain}/{oid}?uploads",uploadChunkedUrl:"{tosDomain}/{oid}?partNumber={number}&uploadID={uploadId}",uploadMergeUrl:"{tosDomain}/{oid}?uploadID={uploadId}",getUploadListUrl:"{tosDomain}/{oid}?uploadID={uploadId}",directUploadFileUrl:"{tosDomain}/{oid}",external:{},getSliceFunc:null,uploadSliceCount:5,retryUploadTime:3,retryProcess:!0,retryProcessTime:3,retryTaskTime:3,maxProcessPause:20,schema:"https",useLocalStorage:!0,log:{external:{},appId:"",userId:"",video_id:"",upload_video_url:"",upload_id:"",type:"",stage:"",video_size:0,part_count:0,slice_index:0,extra:{},msg:""},replace:{}};function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var s=function e(){return(s=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function t(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(o=i.next()).done;)s.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function index_base_min_i(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(t(arguments[r]));return e}function Z4(e,a){var t,r=function r(e){var t=document.createElement("a");return t.href=e,t},o=window.screen.width,n=window.screen.height,i=window.navigator.appVersion,s=window.navigator.userAgent,c=window.navigator.language,u=document.referrer,l=u?r(u).hostname:"",p=function(e){var e=(e=r(e).search).slice(1),o={};return e.split("&").forEach(function(e){var t,r,e=e.split("=");e.length&&(t=e[0],r=e[1]),r=r&&r.replace(/\%/g,"%25"),o[t]=decodeURIComponent(void 0===r?"":r)}),o}(window.location.href),f="",d="",h="",y=""+parseFloat(i);-1!==(g=s.indexOf("Opera"))&&(h="Opera",y=s.substring(g+6),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)),-1!==(g=s.indexOf("Edge"))?(h="Microsoft Edge",y=s.substring(g+5)):-1!==(g=s.indexOf("MSIE"))?(h="Microsoft Internet Explorer",y=s.substring(g+5)):-1!==s.indexOf("Chrome")?-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("MQQBrowser"))?(h="qqbrowser",y=s.substring(g+11,g+15)):-1!==(g=s.indexOf("Chrome"))&&(h="Chrome",y=s.substring(g+7)):-1!==s.indexOf("Safari")?-1!==(g=s.indexOf("QQ"))?(h="qqbrowser",y=s.substring(g+10,g+16)):-1!==(g=s.indexOf("Safari"))&&(h="Safari",y=s.substring(g+7),-1!==(g=s.indexOf("Version")))&&(y=s.substring(g+8)):-1!==(g=s.indexOf("Firefox"))?(h="Firefox",y=s.substring(g+8)):-1!==(g=s.indexOf("MicroMessenger"))?(h="weixin",y=s.substring(g+15,g+20)):-1!==(g=s.indexOf("QQ"))&&(h="qqbrowser",y=s.substring(g+3,g+8)),-1!==(t=(y=-1!==(t=(y=-1!==(t=y.indexOf(";"))?y.substring(0,t):y).indexOf(" "))?y.substring(0,t):y).indexOf(")"))&&(y=y.substring(0,t));for(var _,g=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(i)?"wap":"web",m=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],v=0;v<m.length;v++){var b=m[v];if(b.r.test(s)){f=b.s;break}}function I(e,t){e=e.exec(t);return e&&e[1]?e[1]:""}switch(/Windows/.test(f)&&(d=I(/Windows (.*)/,f),f="windows"),f){case"Mac OS X":d=I(/Mac OS X (10[\.\_\d]+)/,s),f="mac";break;case"Android":d=I(/Android ([\.\_\d]+)/,_=s)||I(/Android\/([\.\_\d]+)/,_),f="android";break;case"iOS":d=(d=/OS (\d+)_(\d+)_?(\d+)?/.exec(i))?d[1]+"."+d[2]+"."+(0|d[3]):"",f="ios"}return e=e?function(){var e=a?"_tea_utm_cache_"+a:"_tea_utm_cache",t={},r={utm_source:p.utm_source,utm_medium:p.utm_medium,utm_campaign:p.utm_campaign,utm_term:p.utm_term,utm_content:p.utm_content};try{var o,n,i=window.sessionStorage,s=!1;for(o in r)r[o]&&(t[o]=r[o],s=!0);s?i.setItem(e,JSON.stringify(t)):(n=i.getItem(e))&&(t=JSON.parse(n))}catch(e){return r}return t}():{},{browser:h,browser_version:y,platform:g,os_name:f,os_version:d,userAgent:s,screen_width:o,screen_height:n,device_model:function(e){var t,r,o="";try{"android"===e?navigator.userAgent.split(";").forEach(function(e){-1<e.indexOf("Build/")&&(o=e.slice(0,e.indexOf("Build/")))}):"ios"!==e&&"mac"!==e||(r=(t=navigator.userAgent.replace("Mozilla/5.0 (","")).indexOf(";"),o=t.slice(0,r))}catch(e){}return o.trim()}(f),language:c,referrer:u,referrer_host:l,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,utm_term:e.utm_term,utm_content:e.utm_content,isSupportBeacon:("ios"!==f||"safari"!==h)&&(!(!window.navigator||!window.navigator.sendBeacon)||void 0)}}(function(e){e.exports=function i(){function e(){for(var e=0,t={};e<arguments.length;e++){var r,o=arguments[e];for(r in o)t[r]=o[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(u){function r(){}function o(t,o,n){if("undefined"!=typeof document){"number"==typeof(n=e({path:"/"},r.defaults,n)).expires&&(n.expires=new Date(+new Date+864e5*n.expires)),n.expires=n.expires?n.expires.toUTCString():"";try{var i=JSON.stringify(o);/^[\{\[]/.test(i)&&(o=i)}catch(e){}o=u.write?u.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s,a="";for(s in n)n[s]&&(a+="; "+s,!0!==n[s])&&(a+="="+n[s].split(";")[0]);return document.cookie=t+"="+o+a}}function s(e,r){if("undefined"!=typeof document){for(var o={},n=document.cookie?document.cookie.split("; "):[],i=0;i<n.length;i++){var s=n[i].split("="),a=s.slice(1).join("=");r||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var c=t(s[0]),a=(u.read||u)(a,c)||t(a);if(r)try{a=JSON.parse(a)}catch(e){}if(o[c]=a,e===c)break}catch(e){}}return e?o[e]:o}}return r.set=o,r.get=function(e){return s(e,!1)},r.getJSON=function(e){return s(e,!0)},r.remove=function(t,r){o(t,"",e(r,{expires:-1}))},r.defaults={},r.withConverter=i,r}(function(){})}()})(r={exports:{}});var C=r.exports,U=function(){function e(){this.cache={}}return e.prototype.setItem=function(e,t){this.cache[e]=t},e.prototype.getItem=function(e){return this.cache[e]},e.prototype.removeItem=function(e){this.cache[e]=void 0},e}(),I={getItem:function getItem(e){try{var t=localStorage.getItem(e),r=t;try{t&&"string"==typeof t&&(r=JSON.parse(t))}catch(e){}return r||void 0}catch(e){}},setItem:function setItem(e,t){try{var r="string"==typeof t?t:JSON.stringify(t);localStorage.setItem(e,r)}catch(e){}},removeItem:function removeItem(e){try{localStorage.removeItem(e)}catch(e){}},getCookie:function getCookie(e){try{var t=document.cookie.match(new RegExp("(?:^|;)\\s*"+e+"=([^;]+)")),r=t?t[1]:"";return decodeURIComponent(r)}catch(e){return""}},setCookie:function setCookie(e,t,r){try{var o=+new Date+r;C.set(e,t,{expires:new Date(o),path:"/",domain:document.domain.split(".").slice(-2).join(".")})}catch(e){}},isSupportLS:function(){try{return localStorage.setItem("_ranger-test-key","hi"),localStorage.getItem("_ranger-test-key"),localStorage.removeItem("_ranger-test-key"),!0}catch(e){return!1}}()},j=function(){function e(e){this._storage=!e&&I.isSupportLS?I:new U}return e.prototype.getItem=function(e){return this._storage.getItem(e)},e.prototype.setItem=function(e,t){this._storage.setItem(e,t)},e.prototype.getCookie=function(e){return this._storage.getCookie(e)},e.prototype.setCookie=function(e,t,r){this._storage.setCookie(e,t,r)},e.prototype.removeItem=function(e){this._storage.removeItem(e)},e}(),T={cn:"https://mcs.snssdk.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},E="/v1/user/webid",f={NO_URL:4001,IMG_ON:4e3,IMG_CATCH:4002,BEACON_FALSE:4003,XHR_ON:500,RESPONSE:5001},F=function _(e,t){return t?"__tea_cache_tokens_"+e:"__tea_cache_events_"+e},N=function p(r,o,n,i){try{var e=r.match(/\/v\d\//),t=e?e[0]:-1!==r.indexOf("/v1/")?"/v1/":"/v2/",s=r.split(t)[0];s?o.forEach(function(e){var e=function(e){var t,r="";for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&(r+="&"+t+"="+encodeURIComponent(JSON.stringify(e[t])));return"&"===r[0]?r.slice(1):r}(e),t=new Image(1,1);t.onload=function(){t=null,n&&n()},t.onerror=function(){t=null,i&&i(r,o,f.IMG_ON)},t.src=s+"/v1/gif?"+e}):i(r,o,f.NO_URL)}catch(n){i&&i(r,o,f.IMG_CATCH,n.message)}},L=function l(e,t,r,o,n,i,s,a){var c=window.navigator.userAgent,c=-1!==window.navigator.appName.indexOf("Microsoft Internet Explorer")&&(-1!==c.indexOf("MSIE 8.0")||-1!==c.indexOf("MSIE 9.0")),u=!!r;if(!u&&c)N(e,t,o,n);else if(!u&&s)return Z4(!1).isSupportBeacon?(a&&a(),void(window.navigator.sendBeacon(e,JSON.stringify(t))?o():n(e,t,f.BEACON_FALSE))):void N(e,t,o,n);i&&delete t.app_key,function(e,t,r,o,n){var i=new XMLHttpRequest;i.open("POST",""+e,!0),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),n&&i.setRequestHeader("X-MCS-AppKey",""+n),i.onload=function(){if(r){var t=null;if(i.responseText){try{t=JSON.parse(i.responseText)}catch(e){t={}}r(t)}}},i.onerror=function(){i.abort(),o&&o(t,f.XHR_ON)},i.send(JSON.stringify(t))}(e,t,o,n,r)};function g(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,g)}var B,z=function v(){return g().replace(/-/g,"").slice(0,19)},q=function(){function e(e,t){this.browser=Z4(!0,e.app_id),this.config=e,this.cfg=t,this.storage=new j(!1),this.appInfo=e.app_key||e.app_id,this.isNoWebid=e.disable_webid,this.isNoSsid=e.disable_webid||e.disable_ssid,this.domain=e.channel_domain||T[e.channel],this.tokenReady=!1,this.checkExp=e.checkExp||!1,this.enableCookie=e.cross_subdomain||!1,this.expiresTime=this.enableCookie?94608e6:0,this.fetchUrl=this.domain+E}return e.prototype._getToken=function(){this.tokensKey=F(this.appInfo,!0),this.cookieKey="__tea_cookie_tokens_"+this.appInfo;var e,t,r,o,n=this.storage.getItem(this.tokensKey);this.enableCookie?(o=this.storage.getCookie(this.cookieKey))?(o=decodeURIComponent(o),e=(o=JSON.parse(o)).user_unique_id,t=o.web_id,r=o.timestamp,o=o.ssid,this._setToken(t,e,o,r)):n?(this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(n)),this.expiresTime),this._checkLocal(n)):this._requestWebId():n?this._checkLocal(n):this._requestWebId()},e.prototype._checkLocal=function(e){e.web_id||(t=this.storage.getCookie("tt_webid"),n=this.storage.getCookie("__tea_sdk__ssid"),r=this.storage.getCookie("__tea_sdk__user_unique_id"),t&&n&&r&&(e={web_id:t,ssid:n,user_unique_id:r,timestamp:Date.now()},this.storage.setItem(this.tokensKey,e)));var t,r,e=this.storage.getItem(this.tokensKey),o=(r=e.user_unique_id,t=e.web_id,e.timestamp),n=e.ssid;t&&r?this._setToken(t,r,n,o):this._requestWebId()},e.prototype._setToken=function(e,t,r,o){if(this.uuid=t,this.web_id=e,this.ssid=r,this.checkExp){o=Date.now()-parseFloat(o);if(7344e6<o)return void this._requestWebId();if(432e7<o)return void this._updateWebId(e)}this._complete(e,t,r)},e.prototype._complete=function(e,t,r){this.cfg.envInfo.user.ssid=r,this.cfg.envInfo.user.web_id=e,this.cfg.envInfo.user.user_unique_id=t,this.tokenReady=!0},e.prototype._requestWebId=function(){this.isNoWebid?this._setwebId({web_id:z(),ssid:""}):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){e=this.domain+E+"/"+e+"/update";this._fetchWebId(e,!0)},e.prototype._fetchWebId=function(e,r){var o=this;this.isGetWebId=!0,L(e,{app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:this.browser.userAgent,referer:this.browser.referrer,user_unique_id:""},this.config.app_key,function(e){var t;e&&0===e.e?(r?(t={web_id:o.web_id,ssid:o.ssid,user_unique_id:o.uuid,timestamp:Date.now()},o.enableCookie&&o.storage.setCookie(o.cookieKey,encodeURIComponent(JSON.stringify(t)),o.expiresTime),o.storage.setItem(o.tokensKey,t),o._complete(o.web_id,o.uuid,o.ssid)):(o.isGetWebId=!1,o._setwebId(e)),o.isGetSsid?o._requestSsId():o.callback&&o.callback()):r?o._fetchWebId(o.fetchUrl,!1):o.isGetWebId=!1},function(){o.isGetWebId=!1},!0)},e.prototype._setwebId=function(e){var t=this.cfg.envInfo.user.web_id||e.web_id,r={web_id:t,ssid:e.ssid,user_unique_id:this._uuid||t,timestamp:Date.now()};this.enableCookie&&this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(r)),this.expiresTime),this.storage.setItem(this.tokensKey,r),this.cfg.envInfo.user.ssid=e.ssid,this.cfg.envInfo.user.web_id=t,this.cfg.envInfo.user.user_unique_id=this._uuid||t,this.uuid=this._uuid||t,this.web_id=t,this.ssid=e.ssid,this.tokenReady=!0},e.prototype._getSsid=function(e){e&&-1===["0","Null","None","","undefined"].indexOf(e)&&(this.uuid===e&&this.web_id&&this.ssid?this.tokenReady=!0:(this._uuid=e,this.uuid=e,this.cfg.envInfo.user.user_unique_id=e,this.isGetSsid=!0,this.isNoSsid||this.isGetWebId?this.callback&&this.callback():(this.tokenReady=!1,this.isGetSsid=!1,this._requestSsId())))},e.prototype._requestSsId=function(){var t=this,e=this.domain+"/v1/user/ssid";L(e,{app_key:this.config.app_key,app_id:this.config.app_id,web_id:this.web_id,user_unique_id:this.uuid},this.config.app_key,function(e){e&&0===e.e&&(t.cfg.envInfo.user.ssid=e.ssid,e={web_id:t.web_id,ssid:e.ssid,user_unique_id:t.uuid,timestamp:Date.now()},t.enableCookie&&t.storage.setCookie(t.cookieKey,encodeURIComponent(JSON.stringify(e)),t.expiresTime),t.storage.setItem(t.tokensKey,e)),t.tokenReady=!0,t.callback&&t.callback()},function(){t.tokenReady=!0,t.callback&&t.callback()},!0)},e.prototype.isTokenReady=function(){return this.tokenReady},e}(),H=function(){function t(e,t,r,o){this.cfg=t,this.config=e,this._token=r,this.appInfo=e.app_key||e.app_id,this.debugMode=!!e.log,this.evtDataKey=F(this.appInfo,!1);t=e.channel_domain||T[e.channel];this.reportUrl=e.report_url||t+"/v1/list",this.maxReport=e.max_report||20,this.storage=new j(!0),this.plugin=o,this.addListener()}return t.prototype.addListener=function(){var e=this;window.addEventListener("unload",function(){e.report(!0)},!1),window.addEventListener("beforeunload",function(){e.report(!0)},!1),document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState&&e.report(!0)},!1)},t.prototype.setReady=function(){this.isReady=!0,this.report()},t.prototype.event=function(e,t){var r=this,o=(void 0===e&&(e=[]),void 0===t&&(t=!1),this.storage.getItem(this.evtDataKey)||[]),t=t?index_base_min_i(e,o):index_base_min_i(o,e);this.storage.setItem(this.evtDataKey,t),this.reportTimer&&clearTimeout(this.reportTimer),t.length>=this.maxReport?this.report():this.reportTimer=setTimeout(function(){r.report(),r.reportTimer=null},30)},t.prototype.report=function(e){var t;void 0===e&&(e=!1),this._token.isTokenReady()&&this.isReady&&(t=this.storage.getItem(this.evtDataKey)||[],t=this._mergeEvents(t),this.storage.removeItem(this.evtDataKey),this._dealData(t,e))},t.prototype._mergeEvents=function(e){var t,r,o=this;return e.length?((t=this.cfg.get()).header.custom=JSON.stringify(t.header.custom),(r=[]).push(e),r.map(function(e){return{events:e.map(function(e){var t=s({},o.cfg.get("evtParams"),e.params);return delete t.__disable_storage__,s({},e,{params:JSON.stringify(t)})}),user:t.user,header:t.header,verbose:o.debugMode?1:void 0}})):e},t.prototype._dealData=function(e,r){var o=this;if(!e.length)return e;e.map(function(e){var t=[];return t.push(e),t}).forEach(function(e){var t=z();o._send(t,e,r)})},t.prototype._send=function(e,t,o){var n=this,i=(this.isSending=!0,function r(){n.isSending=!1});L(this.reportUrl,t,this.config.app_key,function(){i()},function(e,t){i(),n.cfg.get("reportErrorCallback")(e,t)},!1,o,i)},t}(),a=void 0,r=(new Date).getTimezoneOffset(),K=parseInt(""+-r/60,10),W=60*r,Q=function(){function t(e){e=Z4(!0,e);this.envInfo={user:{user_unique_id:a,user_type:a,user_id:a,user_is_auth:a,user_is_login:a,device_id:a,web_id:a,ip_addr_id:a,ssid:a},header:{app_id:a,app_name:a,app_install_id:a,install_id:a,app_package:a,app_channel:a,app_version:a,os_name:e.os_name,os_version:e.os_version,device_model:e.device_model,ab_client:a,ab_version:a,ab_sdk_version:a,traffic_type:a,client_ip:a,device_brand:a,os_api:a,access:a,language:e.language,region:a,app_language:a,app_region:a,creative_id:a,ad_id:a,campaign_id:a,log_type:a,rnd:a,platform:e.platform,sdk_version:"4.1.15",province:a,city:a,timezone:K,tz_offset:W,tz_name:a,sim_region:a,carrier:a,resolution:e.screen_width+"x"+e.screen_height,browser:e.browser,browser_version:e.browser_version,referrer:e.referrer,referrer_host:e.referrer_host,width:e.screen_width,height:e.screen_height,screen_width:e.screen_width,screen_height:e.screen_height,utm_term:e.utm_term,utm_content:e.utm_content,utm_source:e.utm_source,utm_medium:e.utm_medium,utm_campaign:e.utm_campaign,custom:{}}},this.evtParams={},this.reportErrorCallback=function(){}}return t.prototype.set=function(e,t){var r=this;if("disable_auto_pv"!==e)if("evtParams"===e||"_staging_flag"===e){var o="evtParams"===e?t:{_staging_flag:Number(t)},n=s({},o);Object.keys(n).forEach(function(e){r.evtParams[e]=n[e]})}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var i,o="";if(-1<e.indexOf(".")&&(o=(i=e.split("."))[0],e=i[1]),"user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("web_id"===(e="os_version"===e?""+t:e)){if(!t)return;(!this.envInfo.user.user_unique_id||this.envInfo.user.user_unique_id&&this.envInfo.user.user_unique_id===this.envInfo.user.web_id)&&(this.envInfo.user.user_unique_id=t)}o?"user"===o||"header"===o?this.envInfo[o][e]=t:this.envInfo.header.custom[e]=t:this.envInfo.user.hasOwnProperty(e)?-1<["user_type","device_id","ip_addr_id"].indexOf(e)?this.envInfo.user[e]=Number(t):-1<["user_id","web_id","user_unique_id","ssid"].indexOf(e)?this.envInfo.user[e]=String(t):-1<["user_is_auth","user_is_login"].indexOf(e)&&(this.envInfo.user[e]=Boolean(t)):this.envInfo.header.hasOwnProperty(e)?this.envInfo.header[e]=t:this.envInfo.header.custom[e]=t}},t.prototype.get=function(e){return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this.reportErrorCallback:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))},t}(),J=function(){function e(e,t){this.isLog=t,this.name=e||""}var t=e.prototype;return t.info=function(e){this.isLog&&console.log(this.name+" "+e)},t.warn=function(e){this.isLog&&console.warn(this.name+" "+e)},t.error=function(e){this.isLog&&console.error(this.name+" "+e)},t.throw=function(e){throw this.error(this.name),new Error(e)},e}(),V=index_base_min_i(["init","config","send","start"],[]),X=(B=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){function i(e){var r=this;this.predefinePageView=function(e){void 0===e&&(e={});var t=s({title:document.title||location.pathname,url:location.href,url_path:location.pathname,time:Date.now(),referrer:window.document.referrer},r._event.closeStorage?{}:{__disable_storage__:1}),t=s({},t,e);r.event("predefine_pageview",t,!0)},this.name=e,this._isSend=!1,this.autoPV=!0}return i.prototype.init=function(e){var t=this;if(!this._inited){if(this._inited=!0,!e||"object"!=_typeof(e))throw new Error("init参数有误,请检查");var r=e.app_id,o=e.app_key,n=e.log;this._config=new Q(r),this.logger=new J(this.name,n),o||r||this.logger.throw("没有传入 app_key 或 app_id "),r&&"number"!=typeof r&&this.logger.throw("app_id参数有误,请检查 "),o&&"string"!=typeof o&&this.logger.warn("app_key为空,如果有请传入"),e.channel_domain||-1!==["cn","sg","va"].indexOf(e.channel)||this.logger.throw("channel 变量只能是 `cn`, `sg`,`va`"),this._config.set("app_id",r),e.channel=e.channel||"cn",this._initConfig=e,this._token=new q(e,this._config),this._token.callback=function(){t.callbackSend&&t.start()},this._event=new H(e,this._config,this._token,this.plugin),this._token._getToken()}},i.prototype.config=function(e){if(this._inited)if(e&&"object"==_typeof(e)){if(e.user_unique_id){if("string"!=typeof e.user_unique_id)throw new Error("user_unique_id 只能是string");this._token._getSsid(e.user_unique_id)}for(var t in e.disable_auto_pv&&(this.autoPV=!1),e)this._config.set(t,e[t])}else this.logger.warn("config参数有误,请检查");else this.logger.warn("config应在init之后调用")},i.prototype.send=function(){this.start()},i.prototype.start=function(){this._token.isTokenReady()?this._isSend||(this._isSend=!0,this.logger.info("用户信息:"+JSON.stringify(this._config.get("user"))),this.autoPV&&this.predefinePageView(),this._event.setReady()):this.callbackSend=!0},i.prototype.event=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var o="boolean"==typeof e[e.length-1]&&e[e.length-1],n="boolean"==typeof e[e.length-1]?e.slice(0,e.length-1):e,i=t(n,1)[0],s=[];"Array"!==Object.prototype.toString.call(i).slice(8,-1)?s[0]=n:s=n,s=s.map(function(e){return function(e,t){var r=e,e=(/^event\./.test(e)&&(r=e.slice(6)),t);return(e="object"!=_typeof(e)?{}:e).event_index=B+=1,{event:r,params:e,local_time_ms:+new Date,is_bav:0}}(e[0],e[1])}),this._event.event(s,o)},i}());function R(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}var G=function M(e){var i=this;return R(this,"_exportCollect",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i._isProcess?i._executeCmd.apply(i,t):(i.cmdQueue.push(t),i._processCmd())}),R(this,"_processCmd",function(){var e,r,o;0!==i.cmdQueue.length&&(e=i.cmdQueue,r=-1,e.forEach(function(e,t){"init"===e[0]&&(r=t)}),-1!==(o=r))&&(i._isProcess=!0,i._executeCmd.apply(i,i.cmdQueue[o]),i.cmdQueue.forEach(function(e,t){t!==o&&i._executeCmd.apply(i,e)}),i.cmdQueue=[])}),R(this,"_executeCmd",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o,n=t[0];-1<V.indexOf(n)?(o=i.colloctor)[n].apply(o,t.slice(1)):(n=i.colloctor).event.apply(n,t)}),this.cmdQueue=[],this.name=e,this.colloctor=new X(e),this._isProcess=!1,this._alias={},this._processCmd(),V.forEach(function(e){i._exportCollect[e]=i._exportCollect.bind(i,e)}),this._exportCollect},c={},u={},d=function P(e){return u[e]||(u[e]=[]),u[e]},Z=function A(e){var e=t(e),r=e[0],e=e.slice(1),o=r.split(".");1===o.length?d("default").push(index_base_min_i([r],e)):2===o.length?"event"===o[0]?d("default").push(index_base_min_i([r],e)):d(o[0]).push(index_base_min_i([o[1]],e)):(r=o[0],o=[o[1],o[2]].join("."),d(r).push(index_base_min_i([o],e)))},$=function D(){h.q.forEach(function(e){e=[].slice.call(e);"Array"===Object.prototype.toString.call(e[0]).slice(8,-1)?e.forEach(function(e){Z(e)}):Z(e)}),Object.keys(u).forEach(function(t){u[t].forEach(function(e){!function(e){return c[e]||(c[e]=new G(e)),c[e]}(t).apply(void 0,index_base_min_i(e))}),u[t]=[]}),h.q=[]},h=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.q.push(t),$()},Y=(h.q=[],h.l=Date.now(),h._instanceMap=c,h._instanceCmdMap=u,V.forEach(function(e){h[e]=h.bind(null,e)}),function(e){var t,r;"undefined"!=typeof window&&(t=function(){if("undefined"!=typeof window)return window.TeaAnalyticsObject}())&&window[t]&&((r=window[t]).init||(e.q=r.q||[],e.l=r.l||Date.now(),window[t]=e))}(h),$(),h),ee={browserError:1e3,crc32:1e3,preUpload:1001,initUploadID:1002,process:1003,fileMerge:1004,complete:1005},te="video",y="image",_="object",re={video:"video_upload",image:"image_upload",object:"object_upload"},m=1,oe=2,ne=3,ie="vod",b="imagex",se=2562,ae=2643,ce={"cn-north-1":"cn-north-1","us-east-1":"us-east-1","ap-singapore-1":"ap-singapore-1",boe:"boe"},ue={"cn-north-1":"https://vod.volcengineapi.com","ap-singapore-1":"https://vod.byteplusapi.com"},le={"cn-north-1":"https://imagex.volcengineapi.com","us-east-1":"https://imagex-us-east-1.volcengineapi.com","ap-singapore-1":"https://imagex-ap-singapore-1.volcengineapi.com"};function LoggerV5_typeof(e){return(LoggerV5_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function _toPropertyKey(e){e=function _toPrimitive(e,t){if("object"!==LoggerV5_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==LoggerV5_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===LoggerV5_typeof(e)?e:String(e)}(o.key),o)}}var pe=function(){function Logger(e,t){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Logger),this.options=e,this.context=t,this.teaLog=Y,this.tea_app_id=se,this.tea_channel="cn","ap-singapore-1"===this.options.region?(this.tea_app_id=ae,this.tea_channel="sg"):(this.tea_app_id=se,this.tea_channel="cn"),this.teaLog.init({app_id:this.tea_app_id,channel:this.tea_channel,log:!1,disable_sdk_monitor:!0}),this.teaLog.config({evtParams:{sdk_version:"1.0.27",line_app_id:this.options.appId,toB:!0},user_unique_id:this.options.userId,disable_auto_pv:!0}),this.teaLog.start()}return function _createClass(e,t,r){t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Logger,[{key:"send",value:function send(e){var t=this.context,r=e.key,t=t.tasks[r],o=ee[e.stage]||999,t=e.fileType||t.fileType,n=e.fileSize||0,i={toB:!0,log_type:re[t],stage:o,fk:r,fs:n,req:e.req,res:e.res,ts:Math.round(Date.now()/1e3),sst:e.stageStartTime,set:e.stageEndTime,dur:e.duration,tdur:e.totalDuration},s="".concat("image"===t?"image":"video","_")+("error"===e.type?"error":o);switch(o){case 1e3:this.teaLog(s,_extends({},i,{type:e.type,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,crc32Array:e.crc32Array,isDirect:e.isDirect})}));break;case 1001:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,sig:e.signature})}));break;case 1002:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,upid:e.uploadID})}));break;case 1003:e.isAllFinish||e.isDirect||(delete i.sst,delete i.set,delete i.dur),this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message,si:e.slice_index,af:e.isAllFinish})}));break;case 1004:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}));break;case 1005:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,err:e.extra&&e.extra.error,msg:e.extra&&e.extra.message,vid:e.uploadResult&&e.uploadResult.Vid})}));break;default:this.teaLog(s,_extends({},i,{type:e.type,oid:e.oid,upload_host:e.tosDomain,ex:JSON.stringify({errc:e.extra&&e.extra.errorCode,msg:e.extra&&e.extra.message})}))}}},{key:"console",value:function(t){function console(e){return t.apply(this,arguments)}return console.toString=function(){return t.toString()},console}(function(e){this.options.debug&&console.log(e)})}]),Logger}(),r=o(4),fe=o.n(r),r=o(3),de=o.n(r),w={resolveUri:function resolveUri(t){if(!t)return"";if(Array.isArray(t))return t.map(function(t){try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}});try{return t.split("/")[0]+"/"+encodeURIComponent(t.split("/").slice(1).join("/"))}catch(e){return t}},urlTemplate:function urlTemplate(t,r){var o;return r=r||{},Object.keys(r).forEach(function(e){o=new RegExp("{".concat(e,"}"),"g"),t=t.replace(o,r[e])}),t},toQueryString:function toQueryString(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=[];return Object.keys(r).map(function(t){var e=r[t];"[object Array]"===Object.prototype.toString.call(e)?e.sort().forEach(function(e){o.push("".concat(t,"=").concat(encodeURIComponent(e)))}):o.push("".concat(t,"=").concat(encodeURIComponent(r[t])))}),o.join("&")},arrayToObject:function arrayToObject(e){var t={};return e&&e.forEach(function(e){t[e.Key.toLowerCase()]=e.Value}),t},supportChunked:function supportChunked(){var e=window.Blob||window.WebKitBlob;try{var t=e.prototype;return!(!FormData||!(t.slice||t.webkitSlice||t.mozSlice))}catch(e){return!1}},supportXhr:function supportXhr(){return!!window.FormData||window.ProgressEvent&&window.FileReader},supportCrc32:function supportCrc32(){var e=window.FileReader&&window.FileReader.prototype.readAsBinaryString;return"undefined"!=typeof Int32Array&&e&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice)},storage:function storage(e){var r=e,e={removeItem:function removeItem(e){delete r.cache[e]},setItem:function setItem(e,t){r.cache[e]=t},getItem:function getItem(e){return r.cache[e]},clear:function clear(){delete r.cache,r.cache={}}};if(!(1<arguments.length&&void 0!==arguments[1])||arguments[1])try{if(window.localStorage)return window.localStorage.setItem("",""),window.localStorage}catch(e){}return e},noop:function noop(){},getUnique:function getUnique(e){return"".concat(e,"_").concat((new Date).getTime(),"_").concat(parseInt(1e6*Math.random()))},getFileSliceLength:function getFileSliceLength(e,t){var r=e.size,o=1048576;return t&&"function"==typeof t?t(r)<5242880?5242880:t(r)||r:200*o<r?10*o:r<=200*o&&2*o<=r?5*o:e.size},getFileSuffix:function getFileSuffix(e){var t;return e&&"[object String]"===Object.prototype.toString.call(e)&&0<(t=e.lastIndexOf("."))?"."+e.substring(t+1):void 0},crypto:{hmac:function hmac(e,t){return fe()(t,e)},sha256:function sha256(e){return de()(e)}},date:{iso8601:function iso8601(e){return(e=void 0===e?w.date.getDate():e).toISOString().replace(/\.\d{3}Z$/,"Z")}},Buffer:Uint8Array,buffer:{toBuffer:function toBuffer(e,t){return"function"==typeof w.Buffer.from&&w.Buffer.from!==Uint8Array.from?w.Buffer.from(e,t):new w.Buffer(e,t)},alloc:function alloc(e,t,r){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");return"function"==typeof w.Buffer.alloc?w.Buffer.alloc(e,t,r):(e=new w.Buffer(e),void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,r),e)},toStream:function toStream(t){w.Buffer.isBuffer(t)||(t=w.buffer.toBuffer(t));var r=new w.stream.Readable,o=0;return r._read=function(e){if(o>=t.length)return r.push(null);e=o+e;e>t.length&&(e=t.length),r.push(t.slice(o,e)),o=e},r},concat:function concat(e){for(var t,r=0,o=0,n=0;n<e.length;n++)r+=e[n].length;for(t=w.buffer.alloc(r),n=0;n<e.length;n++)e[n].copy(t,o),o+=e[n].length;return t}}},x=w;var he={crc32:function encrypt_crc32(e,t){for(var r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],o=("undefined"!=typeof Int32Array&&(r=new Int32Array(r)),-1^~~t),n=(e=new Uint8Array(e)).length,i=0;i<n;i++)o=r[255&(o^e[i])]^o>>>8;return(-1^o)>>>0},dec2hex:function dec2hex(e){if(void 0!==e)return function toEight(e){return e.length<8?toEight(e="0".concat(e)):e}(Number(e).toString(16))}};function Crc32_typeof(e){return(Crc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Crc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Crc32_toPropertyKey(e){e=function Crc32_toPrimitive(e,t){if("object"!==Crc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Crc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Crc32_typeof(e)?e:String(e)}(o.key),o)}}var ye=function(){function Crc32(e,t,r,o){!function Crc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Crc32),this.file=e,this.successProcess=r,this.failProcess=o,this.sliceLength=t,this.retryTime=0,this.fileSize=e.size,this.crc32Array=[]}return function Crc32_createClass(e,t,r){t&&Crc32_defineProperties(e.prototype,t),r&&Crc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Crc32,[{key:"start",value:function start(){this.readFileCrc32(this.file)}},{key:"readFileCrc32",value:function readFileCrc32(t){var r=this,e=this.sliceLength,o=t.slice||t.webkitSlice||t.mozSlice,n=new FileReader,i=0,s=0,a=0;(function read(){s<t.size&&(s=Math.min(i+e,t.size),104857600<t.size)&&t.size-s<=5242880&&(s=t.size),n.readAsArrayBuffer(o.call(t,i,s)),n.onload=function(e){e=e.target.result;a=he.crc32(e,0),r.crc32Array.push({start:i,end:s,crc32:he.dec2hex(a),buffer:e}),(i=s)<t.size?read():r.success(r.crc32Array)}})()}},{key:"success",value:function success(e){this.successProcess(e)}},{key:"fail",value:function fail(e,t,r,o){3<=this.retryTime?this.failProcess():(this.readFileCrc32(e,t,r,o),this.retryTime++)}}]),Crc32}();function FileCrc32_typeof(e){return(FileCrc32_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileCrc32_extends(){return(FileCrc32_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function FileCrc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function FileCrc32_toPropertyKey(e){e=function FileCrc32_toPrimitive(e,t){if("object"!==FileCrc32_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileCrc32_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileCrc32_typeof(e)?e:String(e)}(o.key),o)}}var _e=function(){function FileCrc32(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function FileCrc32_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileCrc32),this.context=e.context,this.key=e.key,this.isDirect=e.isDirect,this.isImageBatchUpload=e.isImageBatchUpload,this.file=e.file,this.type=(this.isImageBatchUpload?this.file[0]:this.file).type||"",this.sliceLength=x.getFileSliceLength(this.file,t.getSliceFunc),this.config=t}return function FileCrc32_createClass(e,t,r){t&&FileCrc32_defineProperties(e.prototype,t),r&&FileCrc32_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileCrc32,[{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.crc32(this.file,this.sliceLength)}},{key:"crc32",value:function crc32(e,t){var r=this;if(this.isImageBatchUpload)for(var o=e.length,n=[],i=0;i<o;i++)new ye(e[i],e[i].size,function(e){n.push(e[0]),n.length===o&&r.success(n)},function(e){r.fail(e)}).start();else!e||!e.size||e.size<=0?this.fail({message:"There is a problem with the input file or fileSize."}):this.isDirect?new ye(e,e.size,function(e){r.success(e)},function(e){r.fail(e)}).start():this.sliceFile(e,t,function(e){r.success(e)},function(e){r.fail(e)})}},{key:"sliceFile",value:function sliceFile(e,t,r,o){for(var n=[],i=t,s=e.size,a=new FileReader,c=e.slice||e.webkitSlice||e.mozSlice,u=0,l=0,p=0;l<s;)l=Math.min(u+i,s),s-l<=5242880&&(l=s),n.push({start:u,end:l,crc32:0}),u=l;try{!function read(t){u=n[t].start,l=n[t].end,a.readAsArrayBuffer(c.call(e,u,l)),a.onload=function(e){e=e.target.result,p=he.dec2hex(he.crc32(e,0)),n[t].crc32=p,l===s?r(n):read(n.length-1)},a.onerror=function(e){o(e)}}(0)}catch(e){o(e)}}},{key:"getCrc32Key",value:function getCrc32Key(e,t){t="[object Array]"===Object.prototype.toString.call(t)?_toConsumableArray(t):[t];return t.push(e[0].crc32,e[e.length-1].crc32),t.join("_")}},{key:"success",value:function success(e){var t=this.context,r=this.key,o=[],n=[];if(this.isImageBatchUpload)for(var i=0;i<this.file.length;i++)o.push(this.file[i].size),n.push(this.file[i].name);else o=this.file.size,n=this.file.name;var s=this.getCrc32Key(e,o),t=t.tasks[r];t&&this.successProcess(FileCrc32_extends(t,{key:r,crc32Array:e,crc32Key:s,sdkVersion:"1.0.27",sliceLength:this.sliceLength,extra:{message:"get crc32 success"},stage:"crc32",type:"success",fileSize:o,fileName:n,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st,isDirect:this.isDirect,isImageBatchUpload:this.isImageBatchUpload}))}},{key:"fail",value:function fail(e){var t=this.context,r=this.key,e=e&&e.message?e.message:"get crc32 error",t=FileCrc32_extends(t.tasks[r],{extra:{message:e},type:"error",stage:"crc32",stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st});this.failProcess(t)}}]),FileCrc32}();function Transport_typeof(e){return(Transport_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Transport_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Transport_toPropertyKey(e){e=function Transport_toPrimitive(e,t){if("object"!==Transport_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Transport_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Transport_typeof(e)?e:String(e)}(o.key),o)}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var o=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=_getPrototypeOf(r);return function _possibleConstructorReturn(e,t){{if(t&&("object"===Transport_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function _assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var k=function(){!function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}(Transport,n.a);var t=_createSuper(Transport);function Transport(){var e;return function Transport_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Transport),(e=t.call(this)).xhr=new XMLHttpRequest,e._data=null,e}return function Transport_createClass(e,t,r){t&&Transport_defineProperties(e.prototype,t),r&&Transport_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Transport,[{key:"_ajax",value:function _ajax(e){var t=this,r=this.xhr;r.upload.onprogress=function(e){t.emit("progress",e)},r.onreadystatechange=function(){4===r.readyState&&(r.upload.onprogress=x.noop,r.onreadystatechange=x.noop,r.params=e,t._data&&t._data.url&&(r.currentUrl=t._data.url),200<=r.status&&r.status<300?t.emit("complete",r):400<=r.status&&t.emit("error",r))},r.onerror=function(){r.errText="unknow net error",t.emit("error",r)},r.ontimeout=function(){r.errText="timeout",t.emit("error",r)},r.onabort=function(){r.errText="abort",t.emit("error",r)},r.send(e)}},{key:"send",value:function send(t){var r=this;return this._data=t,this.xhr.open(t.method||"POST",t.url||"",!0),t.headers&&Object.keys(t.headers).forEach(function(e){r.xhr.setRequestHeader(e,t.headers[e])}),this.xhr.timeout=t.timeout||0,t.ontimeout&&(this.xhr.ontimeout=t.ontimeout),t.binary?this.sendAsBinary(t):t.custom?"object"===Transport_typeof(t.custom)?this.sendAsCustom(JSON.stringify(t.custom)):"none"===t.custom?(delete t.custom,this.sendAsCustom()):this.sendAsCustom(t.custom):this.sendAsFormData(t)}},{key:"sendAsBinary",value:function sendAsBinary(e){return this.xhr.setRequestHeader("Content-Type","application/octet-stream"),this.xhr.setRequestHeader("Content-Disposition",'attachment; filename="'.concat(encodeURI(e.filename),'"')),this._ajax(e.file)}},{key:"sendAsFormData",value:function sendAsFormData(e){t=(t=e.formData?"function"==typeof e.formData?e.formData():e.formData:t)||[];for(var t,r=new FormData,o=0,n=t.length;o<n;o++){var i=t[o];r.append(i.name,i.value)}return e.file&&r.append(e.field,e.file,e.name),this._ajax(r)}},{key:"sendAsCustom",value:function sendAsCustom(e){return this._ajax(e)}},{key:"abort",value:function abort(){this.xhr.onreadystatechange=x.noop,this.xhr.abort()}},{key:"getResponse",value:function getResponse(){return this.xhr.response}},{key:"getText",value:function getText(){return this.xhr.responseText}},{key:"getJson",value:function getJson(){return JSON.parse(this.xhr.responseText)}}]),Transport}(),r=o(1),ge=o.n(r),me=1000002,ve=1001e3,be=1002e3,we=1003e3,xe=1003003,ke=1004e3,Oe=1005e3,Se="The format of stsToken is incorrect.",Ce="An error occurred reading the file";function ApplyUpload_typeof(e){return(ApplyUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(r),!0).forEach(function(e){!function _defineProperty(e,t,r){(t=ApplyUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function ApplyUpload_extends(){return(ApplyUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function ApplyUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,ApplyUpload_toPropertyKey(o.key),o)}}function ApplyUpload_toPropertyKey(e){e=function ApplyUpload_toPrimitive(e,t){if("object"!==ApplyUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==ApplyUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===ApplyUpload_typeof(e)?e:String(e)}function ApplyUpload_setPrototypeOf(e,t){return(ApplyUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function ApplyUpload_createSuper(r){var o=function ApplyUpload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=ApplyUpload_getPrototypeOf(r);return function ApplyUpload_possibleConstructorReturn(e,t){{if(t&&("object"===ApplyUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function ApplyUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=ApplyUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function ApplyUpload_getPrototypeOf(e){return(ApplyUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=function(){!function ApplyUpload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ApplyUpload_setPrototypeOf(e,t)}(ApplyUpload,n.a);var o=ApplyUpload_createSuper(ApplyUpload);function ApplyUpload(e,t){var r;return function ApplyUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ApplyUpload),(r=o.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.serviceName=e.serviceName||ie,r}return function ApplyUpload_createClass(e,t,r){t&&ApplyUpload_defineProperties(e.prototype,t),r&&ApplyUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(ApplyUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this._st=Date.now();r=this.uploaderCtx._getCache(this.currFileCtx.crc32Key),t=r?JSON.parse(r):{};t.oid&&t.uploadID&&t.tosDomain?this.resumeFromCache(t):this.startPreUpload()}},{key:"startPreUpload",value:function startPreUpload(){var f=this,e=ce[this.config.region],t=new k,r=(t.on("complete",function(t){if(t.response)try{var e,r,o,n,i,s,a,c,u,l,p=JSON.parse(t.response);p.ResponseMetadata.Error?f.fail({xhr:t,errorCode:p.ResponseMetadata.Error.CodeN,error:p.ResponseMetadata.Error.Code,message:p.ResponseMetadata.Error.Message}):(e=p.Result,o=(r=(f.options.type===y&&f.config.imageConfig&&f.config.imageConfig.serviceId?e:e.Data).UploadAddress).StoreInfos,n=r.UploadHosts,i=r.SessionKey,a=void 0===(s=r.UploadHeader)?[]:s,c=[],u=[],f.isImageBatchUpload&&1<o.length?o.forEach(function(e){c.push(e.Auth),u.push(e.StoreUri)}):(c=o[0].Auth,u=o[0].StoreUri),l=ApplyUpload_extends(f.currFileCtx,{signature:c,type:"success",extra:{message:"prepare upload success"},stage:"preUpload",oid:x.resolveUri(u),tosDomain:"".concat(f.config.schema,"://").concat(n[0]),xhr:t,UploadHeader:a,SessionKey:i,stageStartTime:f._st,stageEndTime:Date.now(),duration:Date.now()-f._st,totalDuration:Date.now()-f._st+f.currFileCtx.totalDuration}),f.successProcess&&f.successProcess(l))}catch(e){f.fail({error:"catch error: ".concat(e.toString()),xhr:t})}else f.fail({error:"request fail: ".concat(t.statusText||t.errText||"UNKNOWN"),xhr:t})}),t.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};e.response&&(e=JSON.parse(e.response)).ResponseMetadata&&e.ResponseMetadata.Error&&(t.errorCode=e.ResponseMetadata.Error.CodeN,t.error=e.ResponseMetadata.Error.Code,t.message=e.ResponseMetadata.Error.Message),f.fail(t)}),this.serviceName),o="",n={},i=(r===b?(o=this.config.imageHost||le[e],n={Action:"ApplyImageUpload",Version:"2018-08-01",ServiceId:this.options.serviceId||this.config.imageConfig.serviceId},this.currFileCtx.fileSize&&1<this.currFileCtx.fileSize.length&&(n.UploadNum=this.currFileCtx.fileSize.length),this.options.storeKey&&(i=this.options.storeKey,"[object Array]"===Object.prototype.toString.call(i)?n.StoreKeys=i:"[object String]"===Object.prototype.toString.call(i)&&(n.StoreKeys=[i])),this.options.prefix&&(n.Prefix=this.options.prefix)):(i=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(i=this.config.objectConfig.spaceName),o=this.config.videoHost||ue[e],n={Action:"ApplyUploadInfo",Version:"2022-01-01",SpaceName:i,FileSize:this.currFileCtx.fileSize,FileType:this.options.type},this.options.fileName&&(n.FileName=this.options.fileName),this.options.fileExtension&&(n.FileExtension=this.options.fileExtension),this.options.storageClass&&(n.StorageClass=this.options.storageClass),this.config.enOID&&(n.EnOID=1)),this.config.useFileExtension&&this.currFileCtx.fileName&&(this.options.type===_||this.options.type===y)&&(i=this.currFileCtx.fileName,i=x.getFileSuffix(i))&&(n.FileExtension=i),this.options.fileExtension&&(n.FileExtension=this.options.fileExtension),this.config.accountId&&(n["X-Account-Id"]=this.config.accountId),n.s=Math.random().toString(36).substr(2),this.currFileCtx.proxyStsToken||this.config.stsToken),s=x.toQueryString(n),a=i.AccessKeyID,c=i.AccessKeyId,u=i.SecretAccessKey,i=i.SessionToken,o={method:"GET",url:"".concat(o,"?").concat(s),timeout:3e4,region:e,params:n};new ge.a(o,r,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:i},new Date),t.send(o)}},{key:"resumeFromCache",value:function resumeFromCache(i){var s=this,a=this.options.key,e=new k,t=(e.on("complete",function(e){try{var t,r,o,n=JSON.parse(e.response);0===n.success&&0<n.payload.partList.length?(t=s.confirmCache(n.payload.partList),r=!!i.hasMerge?5:t.isAllFinished?4:3,o=ApplyUpload_extends(s.currFileCtx,i,{key:a,xhr:e,extra:{message:"prepare upload from cache success"},stage:"preUpload",type:"success",percent:0,cacheTask:r,proxyStsToken:s.options.stsToken,currentTask:1,status:1,isBreak:1,crc32Array:t.crc32Array,stageStartTime:s._st,stageEndTime:Date.now(),duration:Date.now()-s._st,totalDuration:Date.now()-s._st+s.currFileCtx.totalDuration}),s.successProcess&&s.successProcess(o)):s.startPreUpload()}catch(e){s.startPreUpload()}}),e.on("error",function(e){400<=e.status?s.startPreUpload():s.fail({error:"request error",xhr:e})}),this.config.userId),r=ApplyUpload_extends(x.arrayToObject(i.UploadHeader),{"x-storage-mode":"gateway"});e.send({method:"get",url:x.urlTemplate(this.config.getUploadListUrl,{tosDomain:i.tosDomain,oid:i.oid,uploadId:i.uploadID}),headers:_objectSpread({authorization:i.signature,"x-storage-u":t},r),timeout:3e4})}},{key:"confirmCache",value:function confirmCache(e){var t=this.currFileCtx.crc32Array,r={},o=(e.forEach(function(e){var t=parseInt(e.partNumber)-1;isNaN(t)||void 0!==r[t]||(r[t]={tag:!0,crc32:e.crc32})}),!0),e=t.map(function(e,t){return r[t]&&r[t].tag&&r[t].crc32?(e.crc32=r[t].crc32,e.finished=!0,e.loaded=e.end-e.start):o=!1,e});return{isAllFinished:o,crc32Array:e}}},{key:"fail",value:function fail(e){var t=e.xhr,r=e.errorCode||ve,o="prepare upload error: UNKNOWN",o=(t&&(o=0===t.status?"prepare upload error: NETERROR":e.message||"prepare upload error: ".concat(t.status)),ApplyUpload_extends(this.currFileCtx,{extra:{message:o,error:e.error,errorCode:r},type:"error",stage:"preUpload",xhr:t,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(o)}}]),ApplyUpload}();function InitUploadID_typeof(e){return(InitUploadID_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function InitUploadID_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function InitUploadID_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?InitUploadID_ownKeys(Object(r),!0).forEach(function(e){!function InitUploadID_defineProperty(e,t,r){(t=InitUploadID_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):InitUploadID_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function InitUploadID_extends(){return(InitUploadID_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function InitUploadID_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,InitUploadID_toPropertyKey(o.key),o)}}function InitUploadID_toPropertyKey(e){e=function InitUploadID_toPrimitive(e,t){if("object"!==InitUploadID_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==InitUploadID_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===InitUploadID_typeof(e)?e:String(e)}function InitUploadID_setPrototypeOf(e,t){return(InitUploadID_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function InitUploadID_createSuper(r){var o=function InitUploadID_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=InitUploadID_getPrototypeOf(r);return function InitUploadID_possibleConstructorReturn(e,t){{if(t&&("object"===InitUploadID_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function InitUploadID_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=InitUploadID_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function InitUploadID_getPrototypeOf(e){return(InitUploadID_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ue=function(){!function InitUploadID_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&InitUploadID_setPrototypeOf(e,t)}(InitUploadID,n.a);var o=InitUploadID_createSuper(InitUploadID);function InitUploadID(e,t){var r;return function InitUploadID_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,InitUploadID),(r=o.call(this)).options=e,r.config=t,r.transport=new k,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.eventInit(),r}return function InitUploadID_createClass(e,t,r){t&&InitUploadID_defineProperties(e.prototype,t),r&&InitUploadID_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(InitUploadID,[{key:"initUpload",value:function initUpload(){var e=this.options.context,t=this.options.key,r={oid:e.tasks[t].oid,tosDomain:e.tasks[t].tosDomain},r=x.urlTemplate(this.config.initUploadFileUrl,r),o=this.config.userId,n=InitUploadID_extends(x.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:r,headers:InitUploadID_objectSpread({authorization:e.tasks[t].signature,"x-storage-u":o},n),timeout:3e4})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.initUpload()}},{key:"eventInit",value:function eventInit(){var n=this,i=this.options.context,s=this.options.key;this.transport.on("complete",function(t){try{var e,r=JSON.parse(t.response),o=r.payload.uploadID;0===r.success&&o?(e=InitUploadID_extends(i.tasks[s],{uploadID:o,percent:0,type:"success",extra:{message:"init upload id success"},stage:"initUploadID",xhr:t,stageStartTime:n._st,stageEndTime:Date.now(),duration:Date.now()-n._st,totalDuration:Date.now()-n._st+n.currFileCtx.totalDuration}),n.successProcess(e)):n.fail({error:"fail! res.success: ".concat(r.success,", uploadId:").concat(o),xhr:t})}catch(e){n.fail({error:"catch error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){n.fail({error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e})})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,t=InitUploadID_extends(t.tasks[r],{extra:{message:"init upload id error, ".concat(e.error),errorCode:be},type:"error",stage:"initUploadID",xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.uploaderCtx._removeTaskCache(this.options.key),this.failProcess(t)}}]),InitUploadID}();function Uploader_typeof(e){return(Uploader_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uploader_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function Uploader_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Uploader_ownKeys(Object(r),!0).forEach(function(e){!function Uploader_defineProperty(e,t,r){(t=Uploader_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Uploader_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Uploader_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,Uploader_toPropertyKey(o.key),o)}}function Uploader_toPropertyKey(e){e=function Uploader_toPrimitive(e,t){if("object"!==Uploader_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Uploader_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Uploader_typeof(e)?e:String(e)}function Uploader_setPrototypeOf(e,t){return(Uploader_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Uploader_createSuper(r){var o=function Uploader_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Uploader_getPrototypeOf(r);return function Uploader_possibleConstructorReturn(e,t){{if(t&&("object"===Uploader_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Uploader_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Uploader_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Uploader_getPrototypeOf(e){return(Uploader_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ie=function(){!function Uploader_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Uploader_setPrototypeOf(e,t)}(Uploader,n.a);var u=Uploader_createSuper(Uploader);function Uploader(e){var t,r=e.sliceItem,o=e.crc32,n=e.url,i=e.signature,s=e.uploadHeader,a=e.userId,c=e.retryTime,c=void 0===c?0:c,e=e.method,e=void 0===e?"put":e;return function Uploader_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Uploader),(t=u.call(this)).fileSlice=r,t.crc32=o,t.uploadUrl=n,t.uploadHeader=s,t.signature=i,t.userId=a,t.retryTime=c,t.method=e,t.retryCount=0,t.ready=!1,t.cancel=!1,t.transport=new k,t.eventInit(),t}return function Uploader_createClass(e,t,r){t&&Uploader_defineProperties(e.prototype,t),r&&Uploader_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Uploader,[{key:"upload",value:function upload(){this.isParamsValid()&&(this._st=Date.now(),this.transport.send({method:this.method,url:this.uploadUrl,headers:Uploader_objectSpread({authorization:this.signature,"content-crc32":this.crc32,"x-storage-u":this.userId},this.uploadHeader),file:this.fileSlice,binary:1,timeout:18e5}))}},{key:"isParamsValid",value:function isParamsValid(){return this.fileSlice&&(this.fileSlice.size||this.fileSlice.byteLength)?this.crc32?!!this.uploadUrl||(this.emit("error",{message:"slice upload failed: NOURL",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCRC32",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength}),!1):(this.emit("error",{message:"slice upload failed: NOCONTENT",crc32:this.crc32}),!1)}},{key:"eventInit",value:function eventInit(){var t=this;this.transport.on("complete",function(e){t.success(e)}),this.transport.on("error",function(e){t.fail(e)}),this.transport.on("progress",function(e){t.process(e)})}},{key:"success",value:function success(e){this.ready=!0;var t=Date.now()-this._st,r=this.fileSlice.size||this.fileSlice.byteLength;this.emit("complete",{crc32:this.crc32,size:r,speed:r/t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})}},{key:"fail",value:function fail(e){var t,r=this;this.cancel||(e&&401===e.status?this.emit("error",{message:"slice upload failed: UNAUTHORIZED",crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st}):this.retryCount<this.retryTime?(setTimeout(function(){r.upload()},1e3),this.retryCount++):(t="slice upload failed: UNKNOWN",e&&(t=e.status?"slice upload failed: ".concat(e.status):"slice upload failed: NETERROR"),this.emit("error",{message:t,crc32:this.crc32,size:this.fileSlice.size||this.fileSlice.byteLength,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})))}},{key:"process",value:function process(e){this.cancel||this.emit("progress",{crc32:this.crc32,loaded:e.loaded||0,total:e.total||0})}},{key:"abort",value:function abort(){this.transport&&(this.cancel=!0,this.transport.abort())}},{key:"destroy",value:function destroy(){this.transport=null}}]),Uploader}(),r=o(5),je=o.n(r);function Upload_typeof(e){return(Upload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Upload_extends(){return(Upload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function Upload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Upload_toPropertyKey(e){e=function Upload_toPrimitive(e,t){if("object"!==Upload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Upload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Upload_typeof(e)?e:String(e)}(o.key),o)}}function Upload_setPrototypeOf(e,t){return(Upload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Upload_createSuper(r){var o=function Upload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Upload_getPrototypeOf(r);return function Upload_possibleConstructorReturn(e,t){{if(t&&("object"===Upload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Upload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Upload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Upload_getPrototypeOf(e){return(Upload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Te=function(){!function Upload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Upload_setPrototypeOf(e,t)}(Upload,n.a);var o=Upload_createSuper(Upload);function Upload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function Upload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Upload),(t=o.call(this)).file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.retryProcess=r.retryProcess,t.retryProcessTime=Number(r.retryProcessTime)||5,t.maxProcessPause=Number(r.maxProcessPause)||20,t.uploadSliceCount=Number(r.uploadSliceCount)||5,t.realtimeSpeedInterval=Number(r.realtimeSpeedInterval)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t.lastCalculateSpeedTime=-1,t.lastCalculateSpeedSize=0,t.uploadHandlers={},t}return function Upload_createClass(e,t,r){t&&Upload_defineProperties(e.prototype,t),r&&Upload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Upload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.errorLength=0,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this.uploadSliceCount=this.uploadSliceCount>this.crc32Array.length?this.crc32Array.length:this.uploadSliceCount,this.lastIndex=0,this.uploading=[],this._uploadSize=this.crc32Array.reduce(function(e,t){return e+(t.finished?0:t.end-t.start)},0),this._st=Date.now(),this._lastSaveTime=Date.now(),this.lastCalculateSpeedTime=this._st,this.initWorker(),this.threadUpload()}},{key:"initWorker",value:function initWorker(){var n,i=this;this.worker||(n=this.crc32Array,this.worker=new je.a,this.worker.onmessage=function(e){var t=e.data[0],r=e.data[2],o=n[r];o.crc32=e.data[1],i.upload(o,t,r)})}},{key:"read",value:function read(e,t){var r=this,o=this.file,n=o.slice||o.webkitSlice||o.mozSlice,i=new FileReader;i.onload=function(e){r.worker.postMessage([e.target.result,t],[e.target.result])},i.onerror=function(){r.stop(),r.fail({extra:{message:Ce,errorCode:xe}})},i.readAsArrayBuffer(n.call(o,e.start,e.end))}},{key:"threadUpload",value:function threadUpload(){if(this.uploading.length<this.uploadSliceCount){var e=this.lastIndex,t=this.crc32Array[e];if(t){if(t.finished){if(-1===this.finishArr.indexOf(t.start)&&(this.finishArr.push(t.start),this.finishArr.length>=this.crc32Array.length))return this.stop(),void this.success()}else t.loaded=0,this.uploading.push(e),this.read(t,e);this.lastIndex++,this.threadUpload()}}}},{key:"stop",value:function stop(){var t=this;Object.keys(this.uploadHandlers).forEach(function(e){t.uploadHandlers[e].abort()}),this.worker&&this.worker.terminate(),this.worker=null,this.clearMonitor()}},{key:"clearMonitor",value:function clearMonitor(){this.progressMonitorInterval&&clearInterval(this.progressMonitorInterval)}},{key:"upload",value:function upload(t,e,r){var o=this,n=t.crc32,i={number:r+1,uploadId:this.currentCtx.uploadID,oid:this.currentCtx.oid,tosDomain:this.currentCtx.tosDomain},i=x.urlTemplate(this.config.uploadChunkedUrl,i),s=this.config.userId,a=Upload_extends(x.arrayToObject(this.currentCtx.UploadHeader),{"x-storage-mode":"gateway"}),e=new Ie({sliceItem:e,crc32:n,url:i,signature:this.currentCtx.signature,uploadHeader:a,userId:s,retryTime:this.retryUploadTime});e.on("complete",function(e){o.currentCtx.status===m&&(e.start=t.start,e.index=r,o.fileSliceSuccess(e))}),e.on("error",function(e){1===o.currentCtx.status&&(e.start=t.start,e.index=r,o.fail(e))}),e.on("progress",function(e){1===o.currentCtx.status&&(e.start=t.start,e.index=r,o.process(e))}),e.upload(),this.uploadHandlers[r]=e}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=Upload_extends(this.currentCtx,{type:"success",stage:"process",percent:100,extra:{message:"upload all success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._lastSaveTime+this.currentCtx.totalDuration,isAllFinish:!0});this.worker&&this.worker.terminate(),this.successProcess(t)}},{key:"fail",value:function fail(e){var t=this.currentCtx.totalDuration,r=Date.now()-this._st,o=e.crc32?{message:e.message,data:e.crc32,size:e.size}:e.extra,o=(o.errorCode=o.errorCode||we,Upload_extends(this.currentCtx,{extra:o,type:"error",stage:"process",req:{},res:{},totalDuration:r+t}));e.xhr&&(r=e.xhr,o.req={url:e.xhr.currentUrl},o.res={status:r.status,body:r.responseText,header:r.getAllResponseHeaders()},delete e.xhr),void 0!==e.statusCode&&Upload_extends(this.currentCtx,{statusCode:e.statusCode}),this.errorLength||(t=e.index,this.context.logger.send(Upload_extends({},o,{slice_index:t})),this.stop(),this.context._broadcast("error",o),this.currentCtx.isBreak?this.context._cancel(this.key):this.context._pause(this.key),this.errorLength++)}},{key:"fileSliceSuccess",value:function fileSliceSuccess(e){var t,r=e.index,o=Date.now(),n=(-1===this.finishArr.indexOf(e.start)&&this.finishArr.push(e.start),this.crc32Array[r].finished=!0,this.crc32Array[r].speed=e.speed,{message:"slice upload success"});e.xhr&&(t=e.xhr,n.currentUrl=t.currentUrl||"",Upload_extends(this.currentCtx,{req:{url:t.currentUrl,param:t.params},res:{status:t.status,body:t.responseText,header:t.getAllResponseHeaders()}}),delete e.xhr),this.context.logger.send(Upload_extends(this.currentCtx,{stage:"process",type:"success",slice_index:r,extra:n,totalDuration:o-this._lastSaveTime+this.currentCtx.totalDuration})),this._lastSaveTime=o,this.finishArr.length>=this.crc32Array.length?(this.stop(),this.success(e.xhr)):(this.uploading.splice(this.uploading.indexOf(r),1),this.uploadHandlers[r]&&delete this.uploadHandlers[r],this.threadUpload())}},{key:"getFinishSize",value:function getFinishSize(e,t){var r=t.crc32,o=0;return e.forEach(function(e){e.crc32===r?(e.loaded=t.loaded,o+=t.loaded):(e.loaded||(e.loaded=0),o+=e.loaded)}),o}},{key:"process",value:function process(e){var t=this.currentCtx.realtimeSpeed||0,r=this.currentCtx.fileSize,o=(this.finishSize=this.getFinishSize(this.crc32Array,e),this.finishSize>this.lastFinishSize&&((e=new Date).getTime()-this.lastCalculateSpeedTime>1e3*this.realtimeSpeedInterval&&(n=e.getTime()-this.lastCalculateSpeedTime,o=this.finishSize-this.lastCalculateSpeedSize,t=Math.floor(o/n),this.lastCalculateSpeedTime=e.getTime(),this.lastCalculateSpeedSize=this.finishSize),this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/r*100*100)/100||0),n=Upload_extends(this.currentCtx,{stage:"process",percent:o,realtimeSpeed:t});o>this.lastProcessPercent&&100!==o&&(this.lastProcessPercent=o,this.context._broadcast("progress",n))}}]),Upload}();function FileMerge_typeof(e){return(FileMerge_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileMerge_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function FileMerge_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?FileMerge_ownKeys(Object(r),!0).forEach(function(e){!function FileMerge_defineProperty(e,t,r){(t=FileMerge_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):FileMerge_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function FileMerge_extends(){return(FileMerge_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function FileMerge_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,FileMerge_toPropertyKey(o.key),o)}}function FileMerge_toPropertyKey(e){e=function FileMerge_toPrimitive(e,t){if("object"!==FileMerge_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==FileMerge_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===FileMerge_typeof(e)?e:String(e)}function FileMerge_setPrototypeOf(e,t){return(FileMerge_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function FileMerge_createSuper(r){var o=function FileMerge_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=FileMerge_getPrototypeOf(r);return function FileMerge_possibleConstructorReturn(e,t){{if(t&&("object"===FileMerge_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function FileMerge_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=FileMerge_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function FileMerge_getPrototypeOf(e){return(FileMerge_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var De=function(){!function FileMerge_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&FileMerge_setPrototypeOf(e,t)}(FileMerge,n.a);var o=FileMerge_createSuper(FileMerge);function FileMerge(e,t){var r;return function FileMerge_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,FileMerge),(r=o.call(this)).options=e,r.config=t,r.transport=new k,r.eventInit(),r.errorCount=0,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r}return function FileMerge_createClass(e,t,r){t&&FileMerge_defineProperties(e.prototype,t),r&&FileMerge_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(FileMerge,[{key:"mergeFile",value:function mergeFile(){for(var e={oid:this.currFileCtx.oid,uploadId:this.currFileCtx.uploadID,tosDomain:this.currFileCtx.tosDomain},t=this.currFileCtx.crc32Array,r="",o=0;o<t.length;o++)r=(r?"".concat(r,","):"").concat(o+1,":").concat(t[o].crc32);var e=x.urlTemplate(this.config.uploadMergeUrl,e),n=this.config.userId,i=FileMerge_extends(x.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:e,headers:FileMerge_objectSpread({authorization:this.currFileCtx.signature,"x-storage-u":n},i),custom:r})}},{key:"start",value:function start(e,t,r){this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.mergeFile()}},{key:"eventInit",value:function eventInit(){var r=this,o=this.options.stage;this.transport.on("complete",function(t){try{var e=JSON.parse(t.response);0===e.success&&e.payload.key?(FileMerge_extends(r.currFileCtx,{stage:o,type:"success",hasMerge:!0,extra:{message:"merge file success"},xhr:t,stageStartTime:r._st,stageEndTime:Date.now(),duration:Date.now()-r._st,totalDuration:Date.now()-r._st+r.currFileCtx.totalDuration}),r.successProcess(r.currFileCtx)):r.fail({error:"fail! result.success:".concat(e.success),xhr:t})}catch(e){r.fail({error:"response parse error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){r.fail({error:"request fail: ".concat(e.statusText||e.errText),xhr:e})})}},{key:"getProcessIndex",value:function getProcessIndex(e){var r=0;return e.forEach(function(e,t){"process"===e.stage&&(r=t)}),r}},{key:"fail",value:function fail(e){e=FileMerge_extends(this.currFileCtx,{extra:{message:"merge file error, ".concat(e.error),errorCode:ke},type:"error",stage:this.options.stage,xhr:e.xhr,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.failProcess(e)}}]),FileMerge}();function DirectUpload_typeof(e){return(DirectUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function DirectUpload_extends(){return(DirectUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function DirectUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function DirectUpload_toPropertyKey(e){e=function DirectUpload_toPrimitive(e,t){if("object"!==DirectUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==DirectUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===DirectUpload_typeof(e)?e:String(e)}(o.key),o)}}function DirectUpload_setPrototypeOf(e,t){return(DirectUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function DirectUpload_createSuper(r){var o=function DirectUpload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=DirectUpload_getPrototypeOf(r);return function DirectUpload_possibleConstructorReturn(e,t){{if(t&&("object"===DirectUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function DirectUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=DirectUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function DirectUpload_getPrototypeOf(e){return(DirectUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ee=function(){!function DirectUpload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&DirectUpload_setPrototypeOf(e,t)}(DirectUpload,n.a);var o=DirectUpload_createSuper(DirectUpload);function DirectUpload(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return function DirectUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,DirectUpload),(t=o.call(this)).options=e,t.file=e.file,t.context=e.context,t.key=e.key,t.config=r,t.finishArr=[],t.errorLength=0,t.finishSize=0,t.retryUploadTime=Number(r.retryUploadTime)||5,t.processRetry=0,t.lastFinishSize=-1,t.lastProcessPercent=-1,t.lastIntervalSize=-1,t}return function DirectUpload_createClass(e,t,r){t&&DirectUpload_defineProperties(e.prototype,t),r&&DirectUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(DirectUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this.currentCtx=this.context.tasks[this.key],this.crc32Array=this.context.tasks[this.key].crc32Array,this._uploadSize=this.file.size,this.uploadHandlers={},this._st=Date.now(),this.upload()}},{key:"upload",value:function upload(){for(var t=this,r=this.crc32Array.length,o=0,n=0,e=0;e<r;e++){var i=this.crc32Array[e],s=i.buffer,i=i.crc32,a=this.currentCtx.oid,c=this.currentCtx.signature,a={oid:"[object Array]"===Object.prototype.toString.call(a)?a[e]:a,tosDomain:this.currentCtx.tosDomain},a=x.urlTemplate(this.config.directUploadFileUrl,a),u=this.config.userId,l=x.arrayToObject(this.currentCtx.UploadHeader),s=new Ie({sliceItem:s,crc32:i,url:a,signature:"[object Array]"===Object.prototype.toString.call(c)?c[e]:c,uploadHeader:l,userId:u,retryTime:this.retryUploadTime,method:"put"});s.on("complete",function(e){n+ ++o===r&&t.success(e.xhr)}),s.on("error",function(e){++n===r&&t.fail(e.xhr)}),s.on("progress",function(e){t.process(e)}),(this.uploadHandlers["".concat(i,"_").concat(Math.round(1e3*Math.random()))]=s).upload()}}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,t=DirectUpload_extends(this.currentCtx,{type:"success",stage:"process",percent:100,extra:{message:"direct upload success"},speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.successProcess(t)}},{key:"fail",value:function fail(e){e=DirectUpload_extends(this.currentCtx,{extra:{message:"direct upload error",errorCode:we},type:"error",stage:"process",xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currentCtx.totalDuration});this.failProcess(e)}},{key:"process",value:function process(e){var t=this.currentCtx.fileSize,e=(this.finishSize=e.loaded,this.finishSize>this.lastFinishSize&&(this.lastFinishSize=this.finishSize),Math.floor(this.finishSize/t*100*100)/100||0),t=DirectUpload_extends(this.currentCtx,{stage:"process",percent:e});e>this.lastProcessPercent&&100!==e&&(this.lastProcessPercent=e,this.context._broadcast("progress",t))}},{key:"stop",value:function stop(){Object.values(this.uploadHandlers).forEach(function(e){e.abort()})}}]),DirectUpload}();function CommitUpload_typeof(e){return(CommitUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CommitUpload_ownKeys(t,e){var r,o=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,r)),o}function CommitUpload_objectSpread(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?CommitUpload_ownKeys(Object(r),!0).forEach(function(e){!function CommitUpload_defineProperty(e,t,r){(t=CommitUpload_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):CommitUpload_ownKeys(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function CommitUpload_extends(){return(CommitUpload_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function CommitUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,CommitUpload_toPropertyKey(o.key),o)}}function CommitUpload_toPropertyKey(e){e=function CommitUpload_toPrimitive(e,t){if("object"!==CommitUpload_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==CommitUpload_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===CommitUpload_typeof(e)?e:String(e)}function CommitUpload_setPrototypeOf(e,t){return(CommitUpload_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function CommitUpload_createSuper(r){var o=function CommitUpload_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=CommitUpload_getPrototypeOf(r);return function CommitUpload_possibleConstructorReturn(e,t){{if(t&&("object"===CommitUpload_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function CommitUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=CommitUpload_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function CommitUpload_getPrototypeOf(e){return(CommitUpload_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(){!function CommitUpload_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&CommitUpload_setPrototypeOf(e,t)}(CommitUpload,n.a);var o=CommitUpload_createSuper(CommitUpload);function CommitUpload(e,t){var r;return function CommitUpload_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,CommitUpload),(r=o.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.processAction=e.processAction,r.skipCommit=e.skipCommit,r.serviceName=e.serviceName||ie,r.transport=new k,r.eventInit(),r}return function CommitUpload_createClass(e,t,r){t&&CommitUpload_defineProperties(e.prototype,t),r&&CommitUpload_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(CommitUpload,[{key:"commitUpload",value:function commitUpload(){var t,e=this.options.key,e=this.options.context.tasks[e],r=ce[this.config.region],o="",n={},i=this.serviceName,e=(i===b?(o=this.config.imageHost||le[r],n={Action:"CommitImageUpload",Version:"2018-08-01",SessionKey:e.SessionKey},this.options.skipMeta&&(n.SkipMeta=this.options.skipMeta),this.options.serviceId||this.config.imageConfig&&this.config.imageConfig.serviceId?n.ServiceId=this.options.serviceId||this.config.imageConfig.serviceId:n.SpaceName=this.config.videoConfig&&this.config.videoConfig.spaceName):(s=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(s=this.config.objectConfig.spaceName),o=this.config.videoHost||ue[r],n={Action:"CommitUploadInfo",Version:"2022-01-01"},t={SpaceName:s,SessionKey:e.SessionKey,Functions:[]},s=this.config.videoConfig&&this.config.videoConfig.processAction,this.options.type===_&&this.config.objectConfig&&this.config.objectConfig.processAction&&(s=this.config.objectConfig.processAction),this.processAction&&(s=this.processAction),Array.isArray(s)&&0<s.length&&(t.Functions=s),(this.config.videoConfig&&this.config.videoConfig.callbackArgs||this.options.callbackArgs)&&(t.CallbackArgs=this.options.callbackArgs||this.config.videoConfig.callbackArgs)),this.config.accountId&&(n["X-Account-Id"]=this.config.accountId),x.toQueryString(n)),s=this.currFileCtx.proxyStsToken||this.config.stsToken,a=s.AccessKeyID,c=s.AccessKeyId,u=s.SecretAccessKey,s=s.SessionToken,o={method:"POST",url:"".concat(o,"?").concat(e),timeout:3e4,region:r,params:n,headers:{}};this.options.type===y&&this.config.imageConfig&&this.config.imageConfig.serviceId?(o.custom="none",o.headers["Content-Type"]="application/json"):(e=Object.keys(t).map(function(e){return"[object Array]"===Object.prototype.toString.call(t[e])||"[object Object]"===Object.prototype.toString.call(t[e])?"".concat(e,"=").concat(encodeURIComponent(JSON.stringify(t[e]))):"SessionKey"===e?"".concat(e,"=").concat(encodeURIComponent(t[e])):"".concat(e,"=").concat(t[e])}).join("&"),o.headers["Content-Type"]="application/x-www-form-urlencoded",o.body=e,o.custom=o.body),new ge.a(o,i,{isVolcengine:!0}).addAuthorization({accessKeyId:c||a,secretAccessKey:u,sessionToken:s},new Date),this.transport.send(o)}},{key:"start",value:function start(e,t,r){if(this.successProcess=t,this.failProcess=r,this._st=Date.now(),this.skipCommit)return this.successProcess(CommitUpload_extends(this.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful, skip commit"},stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration,skipCommit:this.skipCommit}));try{this.commitUpload()}catch(e){this.fail({error:"catch error: ".concat(e.toString())})}}},{key:"eventInit",value:function eventInit(){var a=this;this.transport.on("complete",function(t){try{var e,r,o,n,i,s=JSON.parse(t.response);if(!s.ResponseMetadata.Error)return e=s.Result,r={},a.options.type===y&&a.config.imageConfig&&a.config.imageConfig.serviceId?a.isImageBatchUpload?(o=e.Results,n=e.PluginResult||[],o.forEach(function(e,t){o[t]=CommitUpload_objectSpread(CommitUpload_objectSpread({},o[t]),n[t])}),r=o):CommitUpload_extends(r=e.Results[0],e.PluginResult&&e.PluginResult[0]):r=e.Data,i=CommitUpload_extends(a.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful"},uploadResult:r,xhr:t,stageStartTime:a._st,stageEndTime:Date.now(),duration:Date.now()-a._st,totalDuration:Date.now()-a._st+a.currFileCtx.totalDuration}),a.successProcess(i);a.fail({xhr:t,errorCode:s.ResponseMetadata.Error.CodeN,error:s.ResponseMetadata.Error.Code,message:s.ResponseMetadata.Error.Message})}catch(e){a.fail({error:"catch error: ".concat(e.toString()),xhr:t})}}),this.transport.on("error",function(e){var t={error:"request fail: ".concat(e.statusText||e.errText||"UNKNOWN"),xhr:e};if(e.response)try{var r=JSON.parse(e.response);r.ResponseMetadata&&r.ResponseMetadata.Error&&(t.errorCode=r.ResponseMetadata.Error.CodeN,t.error=r.ResponseMetadata.Error.Code,t.message=r.ResponseMetadata.Error.Message)}catch(e){}a.fail(t)})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,o=e.xhr,n=e.errorCode||Oe,i="commit upload error: UNKNOWN",t=(o&&(i=0===o.status?"commit upload error: NETERROR":e.message||"commit upload error: ".concat(o.status)),CommitUpload_extends(t.tasks[r],{extra:{message:i,error:e.error,errorCode:n},type:"error",stage:"complete",xhr:o,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration}));this.failProcess(t)}}]),CommitUpload}();function Queue_typeof(e){return(Queue_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Queue_extends(){return(Queue_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function Queue_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function Queue_toPropertyKey(e){e=function Queue_toPrimitive(e,t){if("object"!==Queue_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==Queue_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===Queue_typeof(e)?e:String(e)}(o.key),o)}}function Queue_setPrototypeOf(e,t){return(Queue_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Queue_createSuper(r){var o=function Queue_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Queue_getPrototypeOf(r);return function Queue_possibleConstructorReturn(e,t){{if(t&&("object"===Queue_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function Queue_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=Queue_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function Queue_getPrototypeOf(e){return(Queue_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Me=function(){!function Queue_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Queue_setPrototypeOf(e,t)}(Queue,n.a);var i=Queue_createSuper(Queue);function Queue(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=2<arguments.length?arguments[2]:void 0,n=3<arguments.length?arguments[3]:void 0;return function Queue_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Queue),(t=i.call(this,e)).tasks=e,t.config=r,t.key=n,t.uploaderCtx=o,t.current=0,t.length=t.tasks.length,t.taskError={},t.uploadList=[],t.retryTaskTime=r.retryTaskTime||3,t}return function Queue_createClass(e,t,r){t&&Queue_defineProperties(e.prototype,t),r&&Queue_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(Queue,[{key:"start",value:function start(){var e=this.tasks.shift();e&&(this.current=e.index,this.execTask(e))}},{key:"execTask",value:function execTask(r){var o=this,n=r.key,i=this.uploaderCtx,e=i.tasks[n].cacheTask,s=i.taskList[n].length;e&&0<r.index&&r.index<e?this.start():(i.tasks[n].currentTask=r.index,1===i.tasks[n].status&&r&&r.func.call(r.context,r.arg,function(e){var t=i.taskList[n][r.index+1];t&&0!==r.index?i._saveTask(n,{currentTask:t.index,stage:t.stage}):r.index===s-1&&i._removeTaskCache(n),o.success(e),0<o.tasks.length?o.start():i._queueSuccess(n)},function(e){e.xhr&&400<=e.xhr.status?o.fail(e):o.taskError[n]?o.taskError[n]<o.retryTaskTime?(o.taskError[n]++,o.execTask(r)):(e.key=n,o.fail(e)):(o.taskError[n]=1,o.execTask(r))}))}},{key:"addTask",value:function addTask(e){this.tasks.push(e)}},{key:"success",value:function success(e){var t;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},delete e.xhr),Queue_extends(e,{type:"success"});try{this.uploaderCtx._broadcast(e.stage,e)}catch(e){}this.uploaderCtx.logger.send(e)}},{key:"fail",value:function fail(e){var t,r=this.uploaderCtx;e.xhr&&(t=e.xhr,e.req={url:t.currentUrl,param:t.params},e.res={status:t.status,header:t.getAllResponseHeaders(),body:t.responseText},e.extra&&(e.extra.req=e.req,e.extra.res=e.res),delete e.xhr),Queue_extends(e,{type:"error"});try{r._broadcast("error",e)}catch(e){}r.logger.send(e),1!==e.currentTask&&(r.tasks[e.key].isBreak?r._cancel(e.key):r._pause(e.key))}},{key:"cancel",value:function cancel(e){var t=this.key,r=this.uploaderCtx.tasks[t].currentTask,r=this.uploaderCtx.tasks[t].isDirect?this.uploaderCtx.taskList[t][r-1]:this.uploaderCtx.taskList[t][r];e?r&&3===r.index&&(e=r.context,Object.values(e.uploadHandlers).forEach(function(e){e.abort()})):(this.tasks=[],r&&3===r.index&&r.context.stop(),this.uploaderCtx._removeTaskCache(t))}},{key:"restart",value:function restart(){this.uploadList.forEach(function(e){e.cancel=!1}),this.start()}}]),Queue}();function MainClass_typeof(e){return(MainClass_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MainClass_extends(){return(MainClass_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r,o=arguments[t];for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function MainClass_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function MainClass_toPropertyKey(e){e=function MainClass_toPrimitive(e,t){if("object"!==MainClass_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==MainClass_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===MainClass_typeof(e)?e:String(e)}(o.key),o)}}function MainClass_setPrototypeOf(e,t){return(MainClass_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function MainClass_createSuper(r){var o=function MainClass_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=MainClass_getPrototypeOf(r);return function MainClass_possibleConstructorReturn(e,t){{if(t&&("object"===MainClass_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return MainClass_assertThisInitialized(e)}(this,o?(e=MainClass_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function MainClass_assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function MainClass_getPrototypeOf(e){return(MainClass_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Re=function(){!function MainClass_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&MainClass_setPrototypeOf(e,t)}(MainClass,n.a);var r=MainClass_createSuper(MainClass);function MainClass(e){var t;return function MainClass_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,MainClass),(t=r.call(this,e)).config=MainClass_extends({},S),t._mergeOptions(t.config,e),t.tasks={},t.taskList={},t.cache={},t.storage=x.storage(MainClass_assertThisInitialized(t),t.config.useLocalStorage),t.logger=t.config.noLog?{send:function send(){}}:new pe(t.config,MainClass_assertThisInitialized(t)),t}return function MainClass_createClass(e,t,r){t&&MainClass_defineProperties(e.prototype,t),r&&MainClass_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(MainClass,[{key:"_mergeOptions",value:function _mergeOptions(t,r){r&&"object"===MainClass_typeof(r)&&(MainClass_extends(t,r),t.log.userId=r.userId||t.userId,t.log.appId=r.appId||t.appId,Object.keys(r).forEach(function(e){"vodDomain"===e&&(t.replace[e]=r[e])}))}},{key:"_setCache",value:function _setCache(e,t){this.storage.setItem(e,t)}},{key:"_getCache",value:function _getCache(e){return this.storage.getItem(e)}},{key:"_removeCache",value:function _removeCache(e){e?this.storage.removeItem(e):this.storage.clear()}},{key:"_addTask",value:function _addTask(e,t){var r=this.tasks,o=this.taskList;r[e]&&r[e].task?o[e].push(t):(o[e]=[],o[e].push(t),r[e]=r[e]||{},r[e].task=new Me([],this.config,this,e)),r[e].task.addTask(t)}},{key:"_broadcast",value:function _broadcast(e,t){var r=this.tasks[t.key].status;if(r===m||0===r)try{this.emit(e,t)}catch(e){r=!("[object Error]"!==Object.prototype.toString.call(e));if(!r||"Error"===e.name)throw e}}},{key:"_addCrc32ProcessTask",value:function _addCrc32ProcessTask(e,t,r){var o=r.isDirect,r=r.isImageBatchUpload,e=new _e({file:e.file,context:this,key:t,isDirect:o,isImageBatchUpload:r},this.config),o={context:e,func:e.start,arg:{},key:t,index:0,stage:"crc32"};this._addTask(t,o)}},{key:"_addPreUploadTask",value:function _addPreUploadTask(e,t,r){var o=r.isImageBatchUpload,n=r.serviceId,r=r.serviceName,o={file:e.file,stsToken:e.stsToken,context:this,type:e.type||te,preUploadUriParams:e.preUploadUriParams||{},key:t,isImageBatchUpload:o,fileName:e.fileName||null,fileExtension:e.fileExtension||null,storageClass:e.storageClass||null,serviceId:n,prefix:e.prefix,storeKey:e.storeKey,serviceName:r},n=new Pe(o,this.config),e={context:n,func:n.start,arg:{},key:t,index:1,stage:"preUpload"};this._addTask(t,e)}},{key:"_addDirectUploadTask",value:function _addDirectUploadTask(e,t,r){r=r.isImageBatchUpload,e=new Ee({file:e.file,context:this,key:t,isImageBatchUpload:r},this.config),r={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,r)}},{key:"_addInitUploadIDTask",value:function _addInitUploadIDTask(e,t){e=new Ue({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:2,stage:"initUploadID"};this._addTask(t,e)}},{key:"_addUploadProcessTask",value:function _addUploadProcessTask(e,t){e=new Te({file:e.file,context:this,key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,e)}},{key:"_mergeFileTask",value:function _mergeFileTask(e,t){e=new De({file:e.file,context:this,stage:"fileMerge",key:t},this.config),e={context:e,func:e.start,arg:{},key:t,index:4,stage:"fileMerge"};this._addTask(t,e)}},{key:"_getMetaInfoTask",value:function _getMetaInfoTask(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=r.isImageBatchUpload,n=r.serviceId,i=r.skipCommit,r=r.serviceName,o={file:e.file,context:this,data:e.data,type:e.type||te,callbackArgs:e.callbackArgs,key:t,isImageBatchUpload:void 0!==o&&o,serviceId:n,processAction:e.processAction,skipCommit:i,skipMeta:e.skipMeta,serviceName:r},n=new Ae(o,this.config),i={context:n,func:n.start,arg:{},key:t,index:5,stage:"complete"};this._addTask(t,i)}},{key:"_addAllUploadProcess",value:function _addAllUploadProcess(e,t,r){var o=e.type===y&&"[object Array]"===Object.prototype.toString.call(e.file),n=(this.tasks[t]=this.tasks[t]||{},this.tasks[t].fileType=e.type||te,this.tasks[t].fileSize=e.file&&e.file.size,this.tasks[t].proxyStsToken=e.stsToken,e.file.size<10485760||o),n=(this._addCrc32ProcessTask(e,t,{isDirect:n,isImageBatchUpload:o}),this._addPreUploadTask(e,t,{isImageBatchUpload:o,serviceId:r===b?e.serviceId:null,serviceName:r}),n?this._addDirectUploadTask(e,t,{isImageBatchUpload:o}):(this._addInitUploadIDTask(e,t),this._addUploadProcessTask(e,t),this._mergeFileTask(e,t)),r===b&&e.skipCommit);this._getMetaInfoTask(e,t,{isImageBatchUpload:o,serviceId:r===b?e.serviceId:null,skipCommit:n,serviceName:r})}},{key:"_run",value:function _run(e){var t=this.tasks,r=navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);r&&r[1]&&Number(r[1])<=9?(this._broadcast("error",MainClass_extends(t[e],{key:e,status:0,stage:"browserError",extra:{message:"cannot support the browser below ie10"},type:"error"})),this.logger.send(t[e]),this._cancel(e)):t[e]?t[e].status===ne?this._restart(e):(r=new Date,t[e].startTime=r.getTime(),t[e].task&&t[e].status!==m&&t[e].task.tasks.length&&(t[e].status=m,this.logger.send(MainClass_extends({},t[e],{extra:{message:"start upload"},type:"start",key:e})),t[e].task.start())):console.warn("".concat(e," is not exit in object tasks, stop running..."))}},{key:"_restart",value:function _restart(r){var o,n,i=this,e=this.tasks;e[r]?(o=e[r].task,n=e[r].currentTask||0,this.taskList[r].forEach(function(e,t){e.index===n&&(o.tasks=i.taskList[r].slice(t))}),o&&e[r].status!==m&&o.tasks.length&&(e[r].status=m,o.restart())):console.warn("".concat(r," is not exit in object tasks"))}},{key:"_cancel",value:function _cancel(e){var t=this.tasks;t[e]?(t[e].status=oe,t[e].task.cancel(!1),this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_pause",value:function _pause(e){var t=this.tasks;t[e]?(t[e].status=ne,t[e].task.cancel(!0),this._saveTask(e)):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeTaskCache",value:function _removeTaskCache(e){var t=this.tasks;t[e]?(t=t[e].crc32Key)&&this._removeCache(t):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_saveTask",value:function _saveTask(e,t){e=MainClass_extends({},this.tasks[e],t||{}),t=e.crc32Key;if(t){var r={SessionKey:e.SessionKey,UploadHeader:e.UploadHeader,fileName:e.fileName,oid:e.oid,uploadID:e.uploadID,signature:e.signature,tosDomain:e.tosDomain,hasMerge:e.hasMerge};Object.keys(r).forEach(function(e){r[e]||delete r[e]});try{this._setCache(t,JSON.stringify(r))}catch(e){return[!1,e.message]}return[!0,""]}}},{key:"_queueSuccess",value:function _queueSuccess(e){var t,r=this.tasks;r[e]?(t=new Date,r[e].endTime=t.getTime(),r[e].time=r[e].endTime-r[e].startTime,r[e].status=0,this.taskList[e]=[]):console.warn("".concat(e," is not exit in object tasks"))}},{key:"_removeFile",value:function _removeFile(e){delete this.tasks[e]}},{key:"_batchAction",value:function _batchAction(t){var e=this.tasks;Object.keys(e).forEach(function(e){t&&t(e)})}},{key:"_refreshStsToken",value:function _refreshStsToken(o){var n=this,i=this.tasks;Object.keys(i).forEach(function(e){var e=i[e],t=MainClass_extends({},e,{proxyStsToken:o}),r=(e.proxyStsToken=o,t.crc32Key);r&&(delete t.task,delete t.xhr,delete t.crc32Array,e.proxyStsToken=o,n._setCache(r,JSON.stringify(t)))})}},{key:"_setOption",value:function _setOption(e){this._mergeOptions(this.config,e)}},{key:"_setServiceId",value:function _setServiceId(e){!this.config.imageConfig&&e?this.config.imageConfig={serviceId:e}:this.config.imageConfig.serviceId=e}},{key:"_getServiceId",value:function _getServiceId(){var e;return null==(e=this.config.imageConfig)?void 0:e.serviceId}},{key:"_getOption",value:function _getOption(e){var t=MainClass_extends({},this.config);return Object.keys(t).forEach(function(e){(-1<e.indexOf("Url")||"replace"===e||"log"===e)&&delete t[e]}),e?t[e]:t}},{key:"_userCancel",value:function _userCancel(e){var t=this,r=this.tasks;e?(this._cancel(e),this.logger.send(MainClass_extends({},r[e],{type:"cancel"}))):Object.keys(r).forEach(function(e){t._cancel(e),t.logger.send(MainClass_extends({},r[e],{type:"cancel"}))})}},{key:"_userPause",value:function _userPause(e){var t=this,r=this.tasks;e?(this._pause(e),this.logger.send(MainClass_extends({},r[e],{type:"pause"}))):Object.keys(r).forEach(function(e){t._pause(e),t.logger.send(MainClass_extends({},r[e],{type:"pause"}))})}}]),MainClass}(),Fe={checkFile:function checkFile(){},checkStsToken:function checkStsToken(e){return!e||e.SessionToken&&e.SecretAccessKey&&(e.AccessKeyId||e.AccessKeyID)}};function entry_typeof(e){return(entry_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function entry_defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,function entry_toPropertyKey(e){e=function entry_toPrimitive(e,t){if("object"!==entry_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);r=r.call(e,t||"default");if("object"!==entry_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"===entry_typeof(e)?e:String(e)}(o.key),o)}}function entry_setPrototypeOf(e,t){return(entry_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function entry_createSuper(r){var o=function entry_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=entry_getPrototypeOf(r);return function entry_possibleConstructorReturn(e,t){{if(t&&("object"===entry_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined")}return function entry_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e)}(this,o?(e=entry_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function entry_getPrototypeOf(e){return(entry_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ne=function(){!function entry_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&entry_setPrototypeOf(e,t)}(TTUploader,Re);var e=entry_createSuper(TTUploader);function TTUploader(){return function entry_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,TTUploader),e.apply(this,arguments)}return function entry_createClass(e,t,r){t&&entry_defineProperties(e.prototype,t),r&&entry_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1})}(TTUploader,[{key:"start",value:function start(e){this.abort=!1,e?this._run(e):this._batchAction(this._run.bind(this))}},{key:"addFile",value:function addFile(e){var t;return e&&Fe.checkStsToken(e.stsToken)?e.file?(t=x.getUnique("file"),this._addAllUploadProcess(e,t,ie),t):null:(this.emit("error",{extra:{message:Se,errorCode:me}}),null)}},{key:"addImageFile",value:function addImageFile(e){var t;return e&&Fe.checkStsToken(e.stsToken)?e.file?(e.type=y,t=x.getUnique("file"),this._addAllUploadProcess(e,t,b),t):null:(this.emit("error",{extra:{message:Se,errorCode:me}}),null)}},{key:"setServiceId",value:function setServiceId(e){this._setServiceId(e)}},{key:"getServiceId",value:function getServiceId(){return this._getServiceId()}},{key:"removeFile",value:function removeFile(e){e&&this._removeFile(e)}},{key:"cancel",value:function cancel(e){e?this._userCancel(e):this._batchAction(this._userCancel.bind(this))}},{key:"pause",value:function pause(e){this._userPause(e)}},{key:"restart",value:function restart(e){e?this._restart(e):this._batchAction(this._restart.bind(this))}},{key:"refreshAuth",value:function refreshAuth(e){this._refreshAuth(e)}},{key:"setOption",value:function setOption(e){this._setOption(e)}},{key:"getOption",value:function getOption(e){return this._getOption(e)}}]),TTUploader}()}]).default});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tt-uploader",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "a upload component",
5
5
  "main": "dist/index.js",
6
6
  "typings": "./types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -31,7 +31,7 @@ export interface Options {
31
31
  region?: 'cn-north-1' | 'us-east-1' | 'ap-singapore-1'
32
32
  videoConfig?: VideoConfig
33
33
  imageConfig?: ImageConfig
34
-
34
+ useLocalStorage?: boolean
35
35
  useFileExtension?: boolean
36
36
  noLog?: boolean
37
37
  }
@@ -42,7 +42,6 @@ export interface UpdateOptions {
42
42
  region?: 'cn-north-1' | 'us-east-1' | 'ap-singapore-1'
43
43
  videoConfig?: VideoConfig
44
44
  imageConfig?: ImageConfig
45
-
46
45
  useFileExtension?: boolean
47
46
  useLocalStorage?: boolean
48
47
  }
@@ -64,28 +63,27 @@ export interface ImageFileOption {
64
63
  stsToken: STSToken
65
64
  storeKey?: string | string[]
66
65
  type?: 'image'
67
- callbackArgs?: string
68
- }
69
-
70
- export interface ImageXMaterialOption {
71
- file: Blob
72
- stsToken: STSToken
73
- storeKey?: string
66
+ prefix?: string
67
+ skipMeta?: boolean
68
+ skipCommit?: boolean
74
69
  serviceId?: string
70
+ processAction?: Action[]
75
71
  }
76
72
 
73
+
74
+
77
75
  export default class TTUploader {
78
76
  constructor(options: Options)
79
-
80
77
  setOption(options: UpdateOptions): void
81
78
  addFile(fileOption: FileOption): string
82
79
  addImageFile(imageFileOption: ImageFileOption): string
83
- addImageXMaterial(ImageXMaterialOption: ImageXMaterialOption): string
84
80
  setServiceId(serviceId: string): string
85
81
  getServiceId(): string
86
82
  start(key?: string): void
83
+ restart(key?: string): void
87
84
  pause(key?: string): void
88
85
  cancel(key?: string): void
86
+ removeFile(key?: string): void
89
87
  on(eventName: 'complete' | 'error' | 'progress', callback: (info: object) => void): void
90
88
  once(eventName: 'complete' | 'error' | 'progress', callback: (info: object) => void): void
91
89
  removeListener(eventName: 'complete' | 'error' | 'progress', callback: (info: object) => void): void