tt-uploader 1.0.17-alpha.0 → 1.0.18-alpha.2

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
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 n={};function __webpack_require__(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t.exports}return __webpack_require__.m=r,__webpack_require__.c=n,__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 n in t)__webpack_require__.d(r,n,function(e){return t[e]}.bind(null,n));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 n,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)};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)};var i=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(n,o){return new Promise(function(e,t){function eventListener(){void 0!==r&&n.removeListener("error",r),e([].slice.call(arguments))}var r;"error"!==o&&(r=function errorListener(e){n.removeListener(o,eventListener),t(e)},n.once("error",r)),n.once(o,eventListener)})},(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,n){var o,i;return checkListener(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener||r),o=e._events),i=o[t]),void 0===i?(i=o[t]=r,++e._eventsCount):("function"==typeof i?i=o[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),0<(r=_getMaxListeners(e))&&i.length>r&&!i.warned&&(i.warned=!0,(r=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",r.emitter=e,r.type=t,r.count=i.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(r))),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){e=e._events;if(void 0===e)return[];t=e[t];return void 0===t?[]:"function"==typeof t?r?[t.listener||t]:[t]: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}(t):arrayClone(t,t.length)}function listenerCount(e){var t=this._events;if(void 0!==t){e=t[e];if("function"==typeof e)return 1;if(void 0!==e)return e.length}return 0}function arrayClone(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}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 n,o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){if(0<t.length&&(n=t[0]),n instanceof Error)throw n;o=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw o.context=n,o}e=i[e];if(void 0===e)return!1;if("function"==typeof e)c(e,this,t);else for(var s=e.length,a=arrayClone(e,s),r=0;r<s;++r)c(a[r],this,t);return!0},EventEmitter.prototype.addListener=function addListener(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,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.removeListener=function removeListener(e,t){var r,n,o,i,s;if(checkListener(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;0<=i;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t,r=this._events;if(void 0===r)return this;if(void 0===r.removeListener)return 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]),this;if(0===arguments.length){for(var n,o=Object.keys(r),i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}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(r,n,o){(function(e){var t;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"object"==_typeof(n)&&void 0!==r?r.exports=e():void 0===(t="function"==typeof(t=e)?t.call(n,o,n,r):t)||(r.exports=t)}(function(){"use strict";function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,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}function Lb(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""}}function Mb(r){return Object.keys(r).sort().map(function(e){var t=r[e];if(null!=t){e=Lb(e);if(e)return Array.isArray(t)?"".concat(e,"=").concat(t.map(Lb).sort().join("&".concat(e,"="))):"".concat(e,"=").concat(Lb(t))}}).filter(function(e){return e}).join("&")}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={},n=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=n.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,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,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=n.clone.call(this);return e.words=this.words.slice(0),e},random:function random(e){for(var t=[],r=function i(t){var r=987654321,n=4294967295;return function(){var e=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return e/=4294967296,(e+=.5)*(.5<u.random()?1:-1)}},n=0;n<e;n+=4){var o=r(4294967296*(i||u.random())),i=987654071*o();t.push(4294967296*o()|0)}return new l.init(t,e)}}),o=e.enc={},s=o.Hex={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function parse(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new l.init(r,t/2)}},a=o.Latin1={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function parse(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new l.init(r,t)}},c=o.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)))}},f=t.BufferedBlockAlgorithm=n.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,n=t.sigBytes,o=this.blockSize,i=n/(4*o),s=(i=e?u.ceil(i):u.max((0|i)-this._minBufferSize,0))*o,n=u.min(4*s,n);if(s){for(var a=0;a<s;a+=o)this._doProcessBlock(r,a);var c=r.splice(0,s);t.sigBytes-=n}return new l.init(c,n)},clone:function clone(){var e=n.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),p=(t.Hasher=f.extend({cfg:n.extend(),init:function init(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function reset(){f.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 p.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e}(Math)}),n=t(function(e,t){var c;e.exports=(c=r,function(o){var e=c,r=e.lib,i=r.WordArray,s=r.Hasher,r=e.algo,a=[],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=o.sqrt(e),n=2;n<=r;n++)if(!(e%n))return;return 1}(e)||(t<8&&(a[t]=n(o.pow(e,.5))),y[t]=n(o.pow(e,1/3)),t++),e++}();var _=[],r=r.SHA256=s.extend({_doReset:function _doReset(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function _doProcessBlock(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],f=0;f<64;f++){f<16?_[f]=0|e[t+f]:(h=((d=_[f-15])<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,d=((p=_[f-2])<<15|p>>>17)^(p<<13|p>>>19)^p>>>10,_[f]=h+_[f-7]+d+_[f-16]);var p=n&o^n&i^o&i,h=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+y[f]+_[f],l=u,u=c,c=a,a=s+d|0,s=i,i=o,o=n,n=d+(h+p)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|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,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(64+n>>>9<<4)]=o.floor(r/4294967296),t[15+(64+n>>>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)}),o=(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,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),o=e.words,i=t.words,s=0;s<r;s++)o[s]^=1549556828,i[s]^=909522486;e.sigBytes=t.sigBytes=n,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 o(t,e)},s=function sha256(e){return n(e)},a=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id"];return function(){function t(e,r,n){!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,n=n||{},this.signatureCache="boolean"!=typeof n.signatureCache||n.signatureCache,this.operation=n.operation,this.signatureVersion=n.signatureVersion,this.constant=n.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=n.bodySha256}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(e=this.request.body)&&(e=e instanceof URLSearchParams?e.toString():JSON.stringify(e)),this.request.headers[this.constant.contentSha256Header]=this.bodySha256||s(e).toString())}},{key:"authorization",value:function value(e,t){var r=[],n=this.credentialString(t);return r.push("".concat(this.constant.algorithm," Credential=").concat(e.accessKeyId,"/").concat(n)),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(Mb(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=[];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});var n=[];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"));n.push("".concat(t,":").concat(r.canonicalHeaderValues(e.toString())))}}),n.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(Mb(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 void 0===e&&(e=new Date),e.toISOString().replace(/\.\d{3}Z$/,"Z")}},{key:"getSigningKey",value:function value(e,t,r,n){t=i("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey),t),r=i(t,r),n=i(r,n);return i(n,this.constant.v4Identifier)}},{key:"createScope",value:function value(e,t,r){return[e.substr(0,8),t,r,this.constant.v4Identifier].join("/")}}]),t}()})}).call(this,o(7))},function(e,t,r){e.exports=function(){var e=e||function(f,r){var n=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 o=t.Base=function(){return{extend:function(e){var t=n(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 p=t.WordArray=o.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 n=this.sigBytes;var o=e.sigBytes;this.clamp();if(n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(var i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];this.sigBytes+=o;return this},clamp:function(){var e=this.words;var t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8;e.length=f.ceil(t/4)},clone:function(){var e=o.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 n=4294967295;return function(){r=36969*(r&65535)+(r>>16)&n;t=18e3*(t&65535)+(t>>16)&n;var e=(r<<16)+t&n;e/=4294967296;e+=.5;return e*(f.random()>.5?1:-1)}};for(var n=0,o;n<e;n+=4){var i=r((o||f.random())*4294967296);o=i()*987654071;t.push(i()*4294967296|0)}return new p.init(t,e)}});var i=e.enc={};var s=i.Hex={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=[];for(var o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16));n.push((i&15).toString(16))}return n.join("")},parse:function(e){var t=e.length;var r=[];for(var n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new p.init(r,t/2)}};var a=i.Latin1={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=[];for(var o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){var t=e.length;var r=[];for(var n=0;n<t;n++)r[n>>>2]|=(e.charCodeAt(n)&255)<<24-n%4*8;return new p.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=o.extend({reset:function(){this._data=new p.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 n=t.sigBytes;var o=this.blockSize;var i=o*4;var s=n/i;if(e)s=f.ceil(s);else s=f.max((s|0)-this._minBufferSize,0);var a=s*o;var c=f.min(a*4,n);if(a){for(var u=0;u<a;u+=o)this._doProcessBlock(r,u);var l=r.splice(0,a);t.sigBytes-=c}return new p.init(l,c)},clone:function(){var e=o.clone.call(this);e._data=this._data.clone();return e},_minBufferSize:0});var l=t.Hasher=u.extend({cfg:o.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 h.HMAC.init(r,t).finalize(e)}}});var h=e.algo={};return e}(Math);return e}()},function(e,t,r){e.exports=function(s){return function(o){var e=s,t=e.lib,r=t.WordArray,n=t.Hasher,t=e.algo,i=[],y=[];!function(){function getFractionalBits(e){return 4294967296*(e-(0|e))|0}for(var e=2,t=0;t<64;)!function isPrime(e){for(var t=o.sqrt(e),r=2;r<=t;r++)if(!(e%r))return;return 1}(e)||(t<8&&(i[t]=getFractionalBits(o.pow(e,.5))),y[t]=getFractionalBits(o.pow(e,1/3)),t++),e++}();var _=[],t=t.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],f=0;f<64;f++){f<16?_[f]=0|e[t+f]:(h=((d=_[f-15])<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,d=((p=_[f-2])<<15|p>>>17)^(p<<13|p>>>19)^p>>>10,_[f]=h+_[f-7]+d+_[f-16]);var p=n&o^n&i^o&i,h=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+y[f]+_[f],l=u,u=c,c=a,a=s+d|0,s=i,i=o,o=n,n=d+(h+p)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|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,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(64+n>>>9<<4)]=o.floor(r/4294967296),t[15+(64+n>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(t),e.HmacSHA256=n._createHmacHelper(t)}(Math),s.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){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return _[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 r=e.data,_=r[0],e=r[1],r=function crc32(e,r){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];"undefined"!=typeof Int32Array&&(_=new Int32Array(_));for(var t=-1^~~r,n=(e=new Uint8Array(e)).length,u=0;u<n;u++)t=_[255&(t^e[u])]^t>>>8;return(-1^t)>>>0}(_,0);postMessage([_,dec2hex(r),e],[_])}}]);',null)}},function(e,t,r){e.exports=function(s){(function(){var e=s;var t=e.lib;var r=t.Base;var n=e.enc;var u=n.Utf8;var o=e.algo;var i=o.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 n=r*4;if(t.sigBytes>n)t=e.finalize(t);t.clamp();var o=this._oKey=t.clone();var i=this._iKey=t.clone();var s=o.words;var a=i.words;for(var c=0;c<r;c++){s[c]^=1549556828;a[c]^=909522486}o.sigBytes=i.sigBytes=n;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 n=t.finalize(this._oKey.clone().concat(r));return n}})})()}(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 o=window.URL||window.webkitURL;e.exports=function(t,r){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),n=n.getBlob()}catch(e){n=new Blob([t])}return new Worker(o.createObjectURL(n))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(e){if(!r)throw Error("Inline worker is not supported");return new Worker(r)}}},function(r,n,o){"use strict";o.r(n),o.d(n,"default",function(){return Pe});var n=o(0),s=o.n(n),a={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",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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c=function e(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.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 Wj(e,t){return t?"__tea_cache_tokens_"+e:"__tea_cache_events_"+e}function Xj(r,n,o,i){try{var e=r.match(/\/v\d\//),e=e?e[0]:-1!==r.indexOf("/v1/")?"/v1/":"/v2/",s=r.split(e)[0];if(!s)return void i(r,n,_);n.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,o&&o()},t.onerror=function(){t=null,i&&i(r,n,m)},t.src=s+"/v1/gif?"+e})}catch(o){i&&i(r,n,v,o.message)}}function Yj(e,t,r,n,o,i,s,a){var c=window.navigator.userAgent,u=-1!==window.navigator.appName.indexOf("Microsoft Internet Explorer")&&(-1!==c.indexOf("MSIE 8.0")||-1!==c.indexOf("MSIE 9.0"));if(!(c=!!r)&&u)Xj(e,t,n,o);else if(!c&&s)return l(!1).isSupportBeacon?(a&&a(),void(window.navigator.sendBeacon(e,JSON.stringify(t))?n():o(e,t,b))):void Xj(e,t,n,o);i&&delete t.app_key,function(e,t,r,n,o){var i=new XMLHttpRequest;i.open("POST",""+e,!0),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),o&&i.setRequestHeader("X-MCS-AppKey",""+o),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(),n&&n(t,w)},i.send(JSON.stringify(t))}(e,t,n,o,r)}var l=function n(e,s){function zl(e){var t=document.createElement("a");return t.href=e,t}var n,t=window.screen.width,r=window.screen.height,o=window.navigator.appVersion,i=window.navigator.userAgent,a=window.navigator.language,c=document.referrer,u=c?zl(c).hostname:"",l=function(e){var e=(e=zl(e).search).slice(1),n={};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"),n[t]=decodeURIComponent(void 0===r?"":r)}),n}(window.location.href),f="",p="",h="",d=""+parseFloat(o);-1!==(g=i.indexOf("Opera"))&&(h="Opera",d=i.substring(g+6),-1!==(g=i.indexOf("Version"))&&(d=i.substring(g+8))),-1!==(g=i.indexOf("Edge"))?(h="Microsoft Edge",d=i.substring(g+5)):-1!==(g=i.indexOf("MSIE"))?(h="Microsoft Internet Explorer",d=i.substring(g+5)):-1!==i.indexOf("Chrome")?-1!==(g=i.indexOf("MicroMessenger"))?(h="weixin",d=i.substring(g+15,g+20)):-1!==(g=i.indexOf("MQQBrowser"))?(h="qqbrowser",d=i.substring(g+11,g+15)):-1!==(g=i.indexOf("Chrome"))&&(h="Chrome",d=i.substring(g+7)):-1!==i.indexOf("Safari")?-1!==(g=i.indexOf("QQ"))?(h="qqbrowser",d=i.substring(g+10,g+16)):-1!==(g=i.indexOf("Safari"))&&(h="Safari",d=i.substring(g+7),-1!==(g=i.indexOf("Version"))&&(d=i.substring(g+8))):-1!==(g=i.indexOf("Firefox"))?(h="Firefox",d=i.substring(g+8)):-1!==(g=i.indexOf("MicroMessenger"))?(h="weixin",d=i.substring(g+15,g+20)):-1!==(g=i.indexOf("QQ"))&&(h="qqbrowser",d=i.substring(g+3,g+8)),-1!==(n=d.indexOf(";"))&&(d=d.substring(0,n)),-1!==(n=d.indexOf(" "))&&(d=d.substring(0,n)),-1!==(n=d.indexOf(")"))&&(d=d.substring(0,n));for(var y,_,g=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(o)?"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(i)){f=b.s;break}}function I(e,t){t=e.exec(t);return t&&t[1]?t[1]:""}switch(/Windows/.test(f)&&(p=I(/Windows (.*)/,f),f="windows"),f){case"Mac OS X":p=I(/Mac OS X (10[\.\_\d]+)/,i),f="mac";break;case"Android":(_=I(/Android ([\.\_\d]+)/,y=i))||(_=I(/Android\/([\.\_\d]+)/,y)),p=_,f="android";break;case"iOS":p=(p=/OS (\d+)_(\d+)_?(\d+)?/.exec(o))?p[1]+"."+p[2]+"."+(0|p[3]):"",f="ios"}e=e?function(){var e=s?"_tea_utm_cache_"+s:"_tea_utm_cache",t={},r={utm_source:l.utm_source,utm_medium:l.utm_medium,utm_campaign:l.utm_campaign,utm_term:l.utm_term,utm_content:l.utm_content};try{var n,o=window.sessionStorage,i=!1;for(n in r)r[n]&&(t[n]=r[n],i=!0);i?o.setItem(e,JSON.stringify(t)):(o=o.getItem(e))&&(t=JSON.parse(o))}catch(e){return r}return t}():{};return{browser:h,browser_version:d,platform:g,os_name:f,os_version:p,userAgent:i,screen_width:t,screen_height:r,device_model:function(e){var t,r,n="";try{"android"===e?navigator.userAgent.split(";").forEach(function(e){-1<e.indexOf("Build/")&&(n=e.slice(0,e.indexOf("Build/")))}):"ios"!==e&&"mac"!==e||(r=(t=navigator.userAgent.replace("Mozilla/5.0 (","")).indexOf(";"),n=t.slice(0,r))}catch(e){}return n.trim()}(f),language:a,referrer:c,referrer_host:u,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)}},u=(function(e){var t=function i(){function e(){for(var e=0,t={};e<arguments.length;e++){var r,n=arguments[e];for(r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(u){function r(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},r.defaults,o)).expires&&(o.expires=new Date(+new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var i=JSON.stringify(n);/^[\{\[]/.test(i)&&(n=i)}catch(e){}n=u.write?u.write(n,t):encodeURIComponent(String(n)).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 o)o[s]&&(a+="; "+s,!0!==o[s]&&(a+="="+o[s].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,r){if("undefined"!=typeof document){for(var n={},o=document.cookie?document.cookie.split("; "):[],i=0;i<o.length;i++){var s=o[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(n[c]=a,e===c)break}catch(e){}}return e?n[e]:n}}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(){})};e.exports=t()}(n={exports:{}}),n.exports),f=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}(),p={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+"=([^;]+)")),t=t?t[1]:"";return decodeURIComponent(t)}catch(e){return""}},setCookie:function setCookie(e,t,r){try{var n=+new Date+r;u.set(e,t,{expires:new Date(n),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}}()},h=function(){function e(e){this._storage=!e&&p.isSupportLS?p:new f}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}(),d={cn:"https://mcs.snssdk.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},y="/v1/user/webid",_=4001,m=4e3,v=4002,b=4003,w=500;function g(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,g)}function $j(){return g().replace(/-/g,"").slice(0,19)}var k,x=function(){function e(e,t){this.browser=l(!0,e.app_id),this.config=e,this.cfg=t,this.storage=new h(!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||d[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+y}return e.prototype._getToken=function(){this.tokensKey=Wj(this.appInfo,!0),this.cookieKey="__tea_cookie_tokens_"+this.appInfo;var e,t,r,n,o=this.storage.getItem(this.tokensKey);this.enableCookie?(n=this.storage.getCookie(this.cookieKey))?(n=decodeURIComponent(n),e=(n=JSON.parse(n)).user_unique_id,t=n.web_id,r=n.timestamp,n=n.ssid,this._setToken(t,e,n,r)):o?(this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(o)),this.expiresTime),this._checkLocal(o)):this._requestWebId():o?this._checkLocal(o):this._requestWebId()},e.prototype._checkLocal=function(e){var t,r;e.web_id||(t=this.storage.getCookie("tt_webid"),o=this.storage.getCookie("__tea_sdk__ssid"),r=this.storage.getCookie("__tea_sdk__user_unique_id"),t&&o&&r&&(n={web_id:t,ssid:o,user_unique_id:r,timestamp:Date.now()},this.storage.setItem(this.tokensKey,n)));var e=this.storage.getItem(this.tokensKey),n=(r=e.user_unique_id,t=e.web_id,e.timestamp),o=e.ssid;t&&r?this._setToken(t,r,o,n):this._requestWebId()},e.prototype._setToken=function(e,t,r,n){if(this.uuid=t,this.web_id=e,this.ssid=r,this.checkExp){n=Date.now()-parseFloat(n);if(7344e6<n)return void this._requestWebId();if(432e7<n)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:$j(),ssid:""}):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){e=this.domain+y+"/"+e+"/update";this._fetchWebId(e,!0)},e.prototype._fetchWebId=function(e,r){var n=this;this.isGetWebId=!0,Yj(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:n.web_id,ssid:n.ssid,user_unique_id:n.uuid,timestamp:Date.now()},n.enableCookie&&n.storage.setCookie(n.cookieKey,encodeURIComponent(JSON.stringify(t)),n.expiresTime),n.storage.setItem(n.tokensKey,t),n._complete(n.web_id,n.uuid,n.ssid)):(n.isGetWebId=!1,n._setwebId(e)),n.isGetSsid?n._requestSsId():n.callback&&n.callback()):r?n._fetchWebId(n.fetchUrl,!1):n.isGetWebId=!1},function(){n.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";Yj(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}(),O=function(){function t(e,t,r,n){this.cfg=t,this.config=e,this._token=r,this.appInfo=e.app_key||e.app_id,this.debugMode=!!e.log,this.evtDataKey=Wj(this.appInfo,!1);r=e.channel_domain||d[e.channel];this.reportUrl=e.report_url||r+"/v1/list",this.maxReport=e.max_report||20,this.storage=new h(!0),this.plugin=n,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;void 0===e&&(e=[]),void 0===t&&(t=!1);var n=this.storage.getItem(this.evtDataKey)||[],e=t?index_base_min_i(e,n):index_base_min_i(n,e);this.storage.setItem(this.evtDataKey,e),this.reportTimer&&clearTimeout(this.reportTimer),e.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 r=this;if(!e.length)return e;var t=this.cfg.get();t.header.custom=JSON.stringify(t.header.custom);var n=[];return n.push(e),n.map(function(e){return{events:e.map(function(e){var t=c({},r.cfg.get("evtParams"),e.params);return delete t.__disable_storage__,c({},e,{params:JSON.stringify(t)})}),user:t.user,header:t.header,verbose:r.debugMode?1:void 0}})},t.prototype._dealData=function(e,r){var n=this;if(!e.length)return e;e.map(function(e){var t=[];return t.push(e),t}).forEach(function(e){var t=$j();n._send(t,e,r)})},t.prototype._send=function(e,t,r){var n=this;this.isSending=!0;function tp(){n.isSending=!1}Yj(this.reportUrl,t,this.config.app_key,function(){tp()},function(e,t){tp(),n.cfg.get("reportErrorCallback")(e,t)},!1,r,tp)},t}(),S=void 0,n=(new Date).getTimezoneOffset(),C=parseInt(""+-n/60,10),P=60*n,U=function(){function t(e){e=l(!0,e);this.envInfo={user:{user_unique_id:S,user_type:S,user_id:S,user_is_auth:S,user_is_login:S,device_id:S,web_id:S,ip_addr_id:S,ssid:S},header:{app_id:S,app_name:S,app_install_id:S,install_id:S,app_package:S,app_channel:S,app_version:S,os_name:e.os_name,os_version:e.os_version,device_model:e.device_model,ab_client:S,ab_version:S,ab_sdk_version:S,traffic_type:S,client_ip:S,device_brand:S,os_api:S,access:S,language:e.language,region:S,app_language:S,app_region:S,creative_id:S,ad_id:S,campaign_id:S,log_type:S,rnd:S,platform:e.platform,sdk_version:"4.1.15",province:S,city:S,timezone:C,tz_offset:P,tz_name:S,sim_region:S,carrier:S,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 n="evtParams"===e?t:{_staging_flag:Number(t)},o=c({},n);Object.keys(o).forEach(function(e){r.evtParams[e]=o[e]})}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var i="";if(-1<e.indexOf(".")&&(i=(n=e.split("."))[0],e=n[1]),"user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("os_version"===e&&(e=""+t),"web_id"===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)}i?"user"===i||"header"===i?this.envInfo[i][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}(),I=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}(),T=index_base_min_i(["init","config","send","start"],[]),j=(k=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){return k+=1}),D=function(){function i(e){var r=this;this.predefinePageView=function(e){void 0===e&&(e={});var t=c({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}),e=c({},t,e);r.event("predefine_pageview",e,!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,n=e.app_key,o=e.log;this._config=new U(r),this.logger=new I(this.name,o),n||r||this.logger.throw("没有传入 app_key 或 app_id "),r&&"number"!=typeof r&&this.logger.throw("app_id参数有误,请检查 "),n&&"string"!=typeof n&&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 x(e,this._config),this._token.callback=function(){t.callbackSend&&t.start()},this._event=new O(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 n="boolean"==typeof e[e.length-1]&&e[e.length-1],o="boolean"==typeof e[e.length-1]?e.slice(0,e.length-1):e,i=t(o,1)[0],s=[];"Array"!==Object.prototype.toString.call(i).slice(8,-1)?s[0]=o:s=o,s=s.map(function(e){return function(e,t){var r=e;/^event\./.test(e)&&(r=e.slice(6));return"object"!=_typeof(t)&&(t={}),t.event_index=j(),{event:r,params:t,local_time_ms:+new Date,is_bav:0}}(e[0],e[1])}),this._event.event(s,n)},i}();function R(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lk(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,n;0!==i.cmdQueue.length&&(e=i.cmdQueue,r=-1,e.forEach(function(e,t){"init"===e[0]&&(r=t)}),-1!==(n=r)&&(i._isProcess=!0,i._executeCmd.apply(i,i.cmdQueue[n]),i.cmdQueue.forEach(function(e,t){t!==n&&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 n,o=t[0];-1<T.indexOf(o)?(n=i.colloctor)[o].apply(n,t.slice(1)):(n=i.colloctor).event.apply(n,t)}),this.cmdQueue=[],this.name=e,this.colloctor=new D(e),this._isProcess=!1,this._alias={},this._processCmd(),T.forEach(function(e){i._exportCollect[e]=i._exportCollect.bind(i,e)}),this._exportCollect}function ok(e){return A[e]||(A[e]=[]),A[e]}function pk(e){var r=t(e),n=r[0],e=r.slice(1);1===(r=n.split(".")).length?ok("default").push(index_base_min_i([n],e)):2===r.length?"event"===r[0]?ok("default").push(index_base_min_i([n],e)):ok(r[0]).push(index_base_min_i([r[1]],e)):(n=r[0],r=[r[1],r[2]].join("."),ok(n).push(index_base_min_i([r],e)))}function qk(){M.q.forEach(function(e){e=[].slice.call(e);"Array"===Object.prototype.toString.call(e[0]).slice(8,-1)?e.forEach(function(e){pk(e)}):pk(e)}),Object.keys(A).forEach(function(t){A[t].forEach(function(e){(function(e){return E[e]||(E[e]=new lk(e)),E[e]})(t).apply(void 0,index_base_min_i(e))}),A[t]=[]}),M.q=[]}var E={},A={},M=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.q.push(t),qk()};M.q=[],M.l=Date.now(),M._instanceMap=E,M._instanceCmdMap=A,T.forEach(function(e){M[e]=M.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))}(M),qk();var F=M,z={browserError:1e3,crc32:1e3,preUpload:1001,initUploadID:1002,process:1003,fileMerge:1004,complete:1005},L="video",N="image",q="object",B={video:"video_upload",image:"image_upload",object:"object_upload"},H=1,K=2,W=3,J={cn:2562,us:2643,sg:2643,boe:2562},Q={"cn-north-1":"cn-north-1","us-east-1":"us-east-1","ap-singapore-1":"ap-singapore-1",boe:"boe"},V={"cn-north-1":"https://vod.volcengineapi.com","ap-singapore-1":"https://vod.byteplusapi.com"},X={"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"},$=2097152;function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var G=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=F,this.tea_app_id=J.cn,this.tea_channel="cn","ap-singapore-1"===this.options.region?(this.tea_app_id=J.sg,this.tea_channel="sg"):(this.tea_app_id=J.cn,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.17-alpha.0",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)}(Logger,[{key:"send",value:function send(e){var t=this.context,r=e.key,n=t.tasks[r],o=z[e.stage]||999,t=e.fileType||n.fileType,n=e.fileSize||0,i={log_type:B[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}(),n=o(4),Z=o.n(n),n=o(3),Y=o.n(n),ee={urlTemplate:function urlTemplate(t,r){var n;return r=r||{},Object.keys(r).forEach(function(e){n=new RegExp("{".concat(e,"}"),"g"),t=t.replace(n,r[e])}),t},toQueryString:function toQueryString(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=[];return Object.keys(r).map(function(t){var e=r[t];"[object Array]"===Object.prototype.toString.call(e)?e.forEach(function(e){n.push("".concat(t,"=").concat(e))}):n.push("".concat(t,"=").concat(r[t]))}),n.join("&")},arrayToObject:function arrayToObject(e){var t={};return e&&e.forEach(function(e){t[e.Key]=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.slice||blob.webkitSlice||blob.mozSlice)},storage:function storage(t){var r=t,t={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={}}};try{if(window.localStorage)return window.localStorage.setItem("",""),window.localStorage}catch(e){return t}return t},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,n=1048576;return t&&"function"==typeof t?t(r)<$?$:t(r)||r:200*n<r?10*n:r<=200*n&&2*n<=r?5*n:e.size},getFileSuffix:function getFileSuffix(e){if(e&&"[object String]"===Object.prototype.toString.call(e)){var t=e.lastIndexOf(".");return 0<t?"."+e.substring(t+1):void 0}},crypto:{hmac:function hmac(e,t){return Z()(t,e)},sha256:function sha256(e){return Y()(e)}},date:{iso8601:function iso8601(e){return void 0===e&&(e=ee.date.getDate()),e.toISOString().replace(/\.\d{3}Z$/,"Z")}},Buffer:Uint8Array,buffer:{toBuffer:function toBuffer(e,t){return"function"==typeof ee.Buffer.from&&ee.Buffer.from!==Uint8Array.from?ee.Buffer.from(e,t):new ee.Buffer(e,t)},alloc:function alloc(e,t,r){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");if("function"==typeof ee.Buffer.alloc)return ee.Buffer.alloc(e,t,r);e=new ee.Buffer(e);return void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,r),e},toStream:function toStream(t){ee.Buffer.isBuffer(t)||(t=ee.buffer.toBuffer(t));var r=new ee.stream.Readable,n=0;return r._read=function(e){if(n>=t.length)return r.push(null);e=n+e;e>t.length&&(e=t.length),r.push(t.slice(n,e)),n=e},r},concat:function concat(e){for(var t,r=0,n=0,o=0;o<e.length;o++)r+=e[o].length;for(t=ee.buffer.alloc(r),o=0;o<e.length;o++)e[o].copy(t,n),n+=e[o].length;return t}}},te=ee;var re={crc32:function encrypt_crc32(e,t){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];"undefined"!=typeof Int32Array&&(r=new Int32Array(r));for(var n=-1^~~t,o=(e=new Uint8Array(e)).length,i=0;i<o;i++)n=r[255&(n^e[i])]^n>>>8;return(-1^n)>>>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_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var ne=function(){function Crc32(e,t,r,n){!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=n,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)}(Crc32,[{key:"start",value:function start(){this.readFileCrc32(this.file)}},{key:"readFileCrc32",value:function readFileCrc32(t){var r,n=this,e=this.sliceLength,o=t.slice||t.webkitSlice||t.mozSlice,i=new FileReader,s=0,a=0;(function read(){a<t.size&&(a=Math.min(s+e,t.size),104857600<t.size&&t.size-a<=5242880&&(a=t.size)),i.readAsArrayBuffer(o.call(t,s,a)),i.onload=function(e){e=e.target.result;r=re.crc32(e,0),n.crc32Array.push({start:s,end:a,crc32:re.dec2hex(r),buffer:e}),(s=a)<t.size?read():n.success(n.crc32Array)}})()}},{key:"success",value:function success(e){this.successProcess(e)}},{key:"fail",value:function fail(e,t,r,n){3<=this.retryTime?this.failProcess():(this.readFileCrc32(e,t,r,n),this.retryTime++)}}]),Crc32}();function FileCrc32_extends(){return(FileCrc32_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[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&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){if(!e)return;if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _arrayLikeToArray(e,t)}(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,n=new Array(t);r<t;r++)n[r]=e[r];return n}function FileCrc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var oe=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=te.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)}(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(n,e){var crc32,o=this;this.isImageBatchUpload?function(){for(var t=n.length,r=[],e=0;e<t;e++)new ne(n[e],n[e].size,function(e){r.push(e[0]),r.length===t&&o.success(r)},function(e){o.fail(e)}).start()}():!n||!n.size||n.size<=0?this.fail({message:"There is a problem with the input file or fileSize."}):this.isDirect?(crc32=new ne(n,n.size,function(e){o.success(e)},function(e){o.fail(e)}),crc32.start()):this.sliceFile(n,e,function(e){o.success(e)},function(e){o.fail(e)})}},{key:"sliceFile",value:function sliceFile(e,t,r,n){for(var o=[],i=t,s=e.size,a=new FileReader,c=e.slice||e.webkitSlice||e.mozSlice,u=0,l=0,f=0;l<s;)l=Math.min(u+i,s),104857600<s&&s-l<=5242880&&(l=s),o.push({start:u,end:l,crc32:0}),u=l;try{!function read(t){u=o[t].start,l=o[t].end,a.readAsArrayBuffer(c.call(e,u,l)),a.onload=function(e){e=e.target.result,f=re.dec2hex(re.crc32(e,0)),o[t].crc32=f,l===s?r(o):read(o.length-1)},a.onerror=function(e){n(e)}}(0)}catch(e){n(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,n=[],o=[];if(this.isImageBatchUpload)for(var i=0;i<this.file.length;i++)n.push(this.file[i].size),o.push(this.file[i].name);else n=this.file.size,o=this.file.name;var s=this.getCrc32Key(e,n),t=t.tasks[r];t&&this.successProcess(FileCrc32_extends(t,{key:r,crc32Array:e,crc32Key:s,sdkVersion:"1.0.17-alpha.0",sliceLength:this.sliceLength,extra:{message:"get crc32 success"},stage:"crc32",type:"success",fileSize:n,fileName:o,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",e=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(e)}}]),FileCrc32}();function Transport_typeof(e){return(Transport_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=_getPrototypeOf(r);return function _possibleConstructorReturn(e,t){return!t||"object"!==Transport_typeof(t)&&"function"!=typeof t?function _assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ie=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}}),t&&_setPrototypeOf(e,t)}(Transport,s.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)}(Transport,[{key:"_ajax",value:function _ajax(t){var r=this,n=this.xhr;n.upload.onprogress=function(e){r.emit("progress",e)},n.onreadystatechange=function(e){4===n.readyState&&(n.upload.onprogress=te.noop,n.onreadystatechange=te.noop,n.params=t,r._data&&r._data.url&&(n.currentUrl=r._data.url),200<=n.status&&n.status<300?r.emit("complete",n):400<=n.status&&r.emit("error",n))},n.onerror=function(){n.errText="unknow net error",r.emit("error",n)},n.ontimeout=function(){n.errText="timeout",r.emit("error",n)},n.onabort=function(){n.errText="abort",r.emit("error",n)},n.send(t)}},{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){var t;e.formData&&(t="function"==typeof e.formData?e.formData():e.formData),t=t||[];for(var r=new FormData,n=0,o=t.length;n<o;n++){var i=t[n];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=te.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}(),n=o(1),se=o.n(n),ae=1000002,ce=1001e3,ue=1002e3,le=1003e3,fe=1003003,pe=1004e3,he=1005e3,de="The format of stsToken is incorrect.",ye="An error occurred reading the file";function ApplyUpload_typeof(e){return(ApplyUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ApplyUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ApplyUpload_setPrototypeOf(e,t){return(ApplyUpload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function ApplyUpload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=ApplyUpload_getPrototypeOf(r);return function ApplyUpload_possibleConstructorReturn(e,t){return!t||"object"!==ApplyUpload_typeof(t)&&"function"!=typeof t?function ApplyUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _e=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}}),t&&ApplyUpload_setPrototypeOf(e,t)}(ApplyUpload,s.a);var n=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=n.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)}(ApplyUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this._st=Date.now();t=this.uploaderCtx._getCache(this.currFileCtx.crc32Key),t=t?JSON.parse(t):{};t.oid&&t.uploadID?this.resumeFromCache(t):this.startPreUpload()}},{key:"startPreUpload",value:function startPreUpload(){var a=this,e=Q[this.config.region],t=new ie;t.on("complete",function(t){if(t.response)try{var e,r,n,o,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}):(i=s.Result,e=(r=(a.options.type===N&&a.config.imageConfig&&a.config.imageConfig.serviceId?i:i.Data).UploadAddress).StoreInfos,s=r.UploadHosts,i=r.SessionKey,r=void 0===(r=r.UploadHeader)?[]:r,n=[],o=[],a.isImageBatchUpload&&1<e.length?e.forEach(function(e){n.push(e.Auth),o.push(e.StoreUri)}):(n=e[0].Auth,o=e[0].StoreUri),i=ApplyUpload_extends(a.currFileCtx,{signature:n,type:"success",extra:{message:"prepare upload success"},stage:"preUpload",oid:o,tosDomain:"".concat(a.config.schema,"://").concat(s[0]),xhr:t,UploadHeader:r,SessionKey:i,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})}else a.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),a.fail(t)});var r="",n={},o=this.options.type===N&&this.config.imageConfig&&this.config.imageConfig.serviceId?(r=this.config.imageHost||X[e],n={Action:"ApplyImageUpload",Version:"2018-08-01",ServiceId:this.config.imageConfig.serviceId},this.currFileCtx.fileSize&&1<this.currFileCtx.fileSize.length&&(n.UploadNum=this.currFileCtx.fileSize.length),this.options.storeKey&&(s=this.options.storeKey,"[object Array]"===Object.prototype.toString.call(s)?n.StoreKeys=s:"[object String]"===Object.prototype.toString.call(s)&&(n.StoreKeys=[s])),"imagex"):(c=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===q&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(c=this.config.objectConfig.spaceName),r=this.config.videoHost||V[e],n={Action:"ApplyUploadInfo",Version:"2021-01-01",SpaceName:c,FileSize:this.currFileCtx.fileSize,FileType:this.options.type},this.config.enOID&&(n.EnOID=1),"vod");this.config.useFileExtension&&this.currFileCtx.fileName&&this.options.type===q&&(u=this.currFileCtx.fileName,(l=te.getFileSuffix(u))&&(n.FileExtension=l)),this.config.accountId&&(n["X-Account-Id"]=this.config.accountId),n.s=Math.random().toString(36).substr(2);var i=this.currFileCtx.proxyStsToken||this.config.stsToken,s=te.toQueryString(n),c=i.AccessKeyID,u=i.AccessKeyId,l=i.SecretAccessKey,i=i.SessionToken,n={method:"GET",url:"".concat(r,"?").concat(s),timeout:3e4,region:e,params:n};new se.a(n,o,{isVolcengine:!0}).addAuthorization({accessKeyId:u||c,secretAccessKey:l,sessionToken:i},new Date),t.send(n)}},{key:"resumeFromCache",value:function resumeFromCache(n){var o=this,i=this.options.key,e=new ie;e.on("complete",function(e){try{var t,r=JSON.parse(e.response);0===r.success&&0<r.payload.partList.length?(t=o.confirmCache(r.payload.partList),r=!!n.hasMerge?5:t.isAllFinished?4:3,t=ApplyUpload_extends(o.currFileCtx,n,{key:i,xhr:e,extra:{message:"prepare upload from cache success"},stage:"preUpload",type:"success",percent:0,cacheTask:r,proxyStsToken:o.options.stsToken,currentTask:1,status:1,isBreak:1,crc32Array:t.crc32Array,stageStartTime:o._st,stageEndTime:Date.now(),duration:Date.now()-o._st,totalDuration:Date.now()-o._st+o.currFileCtx.totalDuration}),o.successProcess&&o.successProcess(t)):o.startPreUpload()}catch(e){o.startPreUpload()}}),e.on("error",function(e){400<=e.status?o.startPreUpload():o.fail({error:"request error",xhr:e})});var t=this.config.userId,r=te.arrayToObject(n.UploadHeader);e.send({method:"get",url:te.urlTemplate(this.config.getUploadListUrl,{tosDomain:n.tosDomain,oid:n.oid,uploadId:n.uploadID}),headers:_objectSpread({Authorization:n.signature,"X-Storage-U":t},r),timeout:3e4})}},{key:"confirmCache",value:function confirmCache(e){var t=this.currFileCtx.crc32Array,r={};e.forEach(function(e){void 0===r[e.partNumber-1]&&(r[e.partNumber-1]={tag:!0,crc32:e.crc32})});var n=!0,t=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):n=!1,e});return{isAllFinished:n,crc32Array:t}}},{key:"fail",value:function fail(e){var t=e.xhr,r=e.errorCode||ce,n="prepare upload error: UNKNOWN";t&&(n=0===t.status?"prepare upload error: NETERROR":e.message||"prepare upload error: ".concat(t.status));t=ApplyUpload_extends(this.currFileCtx,{extra:{message:n,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(t)}}]),ApplyUpload}();function InitUploadID_typeof(e){return(InitUploadID_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function InitUploadID_extends(){return(InitUploadID_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function InitUploadID_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function InitUploadID_setPrototypeOf(e,t){return(InitUploadID_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function InitUploadID_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=InitUploadID_getPrototypeOf(r);return function InitUploadID_possibleConstructorReturn(e,t){return!t||"object"!==InitUploadID_typeof(t)&&"function"!=typeof t?function InitUploadID_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ge=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}}),t&&InitUploadID_setPrototypeOf(e,t)}(InitUploadID,s.a);var n=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=n.call(this)).options=e,r.config=t,r.transport=new ie,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)}(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},n=te.urlTemplate(this.config.initUploadFileUrl,r),o=this.config.userId,r=te.arrayToObject(this.currFileCtx.UploadHeader);this.transport.send({method:"post",url:n,headers:InitUploadID_objectSpread({Authorization:e.tasks[t].signature,"X-Storage-U":o},r),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 o=this,i=this.options.context,s=this.options.key;this.transport.on("complete",function(t){try{var e,r=JSON.parse(t.response),n=r.payload.uploadID;0===r.success&&n?(e=InitUploadID_extends(i.tasks[s],{uploadID:n,percent:0,type:"success",extra:{message:"init upload id success"},stage:"initUploadID",xhr:t,stageStartTime:o._st,stageEndTime:Date.now(),duration:Date.now()-o._st,totalDuration:Date.now()-o._st+o.currFileCtx.totalDuration}),o.successProcess(e)):o.fail({error:"fail! res.success: ".concat(r.success,", uploadId:").concat(n),xhr:t})}catch(e){o.fail({error:"catch error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){o.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,e=InitUploadID_extends(t.tasks[r],{extra:{message:"init upload id error, ".concat(e.error),errorCode:ue},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(e)}}]),InitUploadID}();function Uploader_typeof(e){return(Uploader_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uploader_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Uploader_setPrototypeOf(e,t){return(Uploader_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Uploader_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Uploader_getPrototypeOf(r);return function Uploader_possibleConstructorReturn(e,t){return!t||"object"!==Uploader_typeof(t)&&"function"!=typeof t?function Uploader_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var me=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}}),t&&Uploader_setPrototypeOf(e,t)}(Uploader,s.a);var u=Uploader_createSuper(Uploader);function Uploader(e){var t=e.sliceItem,r=e.crc32,n=e.url,o=e.signature,i=e.uploadHeader,s=e.userId,a=e.retryTime,c=void 0===a?0:a,a=e.method,e=void 0===a?"put":a;return function Uploader_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Uploader),(a=u.call(this)).fileSlice=t,a.crc32=r,a.uploadUrl=n,a.uploadHeader=i,a.signature=o,a.userId=s,a.retryTime=c,a.method=e,a.retryCount=0,a.ready=!1,a.cancel=!1,a.transport=new ie,a.eventInit(),a}return function Uploader_createClass(e,t,r){t&&Uploader_defineProperties(e.prototype,t),r&&Uploader_defineProperties(e,r)}(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,t=r/t;this.emit("complete",{crc32:this.crc32,size:r,speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})}},{key:"fail",value:function fail(e){var t=this;if(!this.cancel)if(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});else{if(this.retryCount<this.retryTime)return setTimeout(function(){t.upload()},1e3),void this.retryCount++;var r="slice upload failed: UNKNOWN";e&&(r=e.status?"slice upload failed: ".concat(e.status):"slice upload failed: NETERROR"),this.emit("error",{message:r,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}(),n=o(5),ve=o.n(n);function Upload_typeof(e){return(Upload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Upload_extends(){return(Upload_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Upload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Upload_setPrototypeOf(e,t){return(Upload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Upload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Upload_getPrototypeOf(r);return function Upload_possibleConstructorReturn(e,t){return!t||"object"!==Upload_typeof(t)&&"function"!=typeof t?function Upload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var be=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}}),t&&Upload_setPrototypeOf(e,t)}(Upload,s.a);var n=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=n.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)}(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 o,i=this;this.worker||(o=this.crc32Array,this.worker=new ve.a,this.worker.onmessage=function(e){var t=e.data[0],r=e.data[2],n=o[r];n.crc32=e.data[1],i.upload(n,t,r)})}},{key:"read",value:function read(e,t){var r=this,n=this.file,o=n.slice||n.webkitSlice||n.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:ye,errorCode:fe}})},i.readAsArrayBuffer(o.call(n,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 n=this,o=t.crc32;this.context._saveTask(this.key,{crc32Array:this.crc32Array});var i={number:r+1,uploadId:this.currentCtx.uploadID,oid:this.currentCtx.oid,tosDomain:this.currentCtx.tosDomain},s=te.urlTemplate(this.config.uploadChunkedUrl,i),a=this.config.userId,i=te.arrayToObject(this.currentCtx.UploadHeader),a=new me({sliceItem:e,crc32:o,url:s,signature:this.currentCtx.signature,uploadHeader:i,userId:a,retryTime:this.retryUploadTime});a.on("complete",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.fileSliceSuccess(e))}),a.on("error",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.fail(e))}),a.on("progress",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.process(e))}),a.upload(),this.uploadHandlers[r]=a}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,e=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(e)}},{key:"fail",value:function fail(e){var t=this.currentCtx.totalDuration,r=Date.now()-this._st,n=e.crc32?{message:e.message,data:e.crc32,size:e.size}:e.extra;n.errorCode=n.errorCode||le;r=Upload_extends(this.currentCtx,{extra:n,type:"error",stage:"process",req:{},res:{},totalDuration:r+t});e.xhr&&(t=e.xhr,r.req={url:e.xhr.currentUrl},r.res={status:t.status,body:t.responseText,header:t.getAllResponseHeaders()},delete e.xhr),void 0!==e.statusCode&&Upload_extends(this.currentCtx,{statusCode:e.statusCode}),this.errorLength||(e=e.index,this.context.logger.send(Upload_extends({},r,{slice_index:e})),this.stop(),this.context._broadcast("error",r),this.currentCtx.isBreak?this.context._cancel(this.key):this.context._pause(this.key),this.errorLength++)}},{key:"fileSliceSuccess",value:function fileSliceSuccess(e){var t=e.index,r=Date.now();-1===this.finishArr.indexOf(e.start)&&this.finishArr.push(e.start),this.crc32Array[t].finished=!0,this.crc32Array[t].speed=e.speed;var n,o={message:"slice upload success"};if(e.xhr&&(n=e.xhr,o.currentUrl=n.currentUrl||"",Upload_extends(this.currentCtx,{req:{url:n.currentUrl,param:n.params},res:{status:n.status,body:n.responseText,header:n.getAllResponseHeaders()}}),delete e.xhr),this.context.logger.send(Upload_extends(this.currentCtx,{stage:"process",type:"success",slice_index:t,extra:o,totalDuration:r-this._lastSaveTime+this.currentCtx.totalDuration})),this._lastSaveTime=r,this.context._saveTask(this.key),this.finishArr.length>=this.crc32Array.length)return this.stop(),void this.success(e.xhr);this.uploading.splice(this.uploading.indexOf(t),1),this.uploadHandlers[t]&&delete this.uploadHandlers[t],this.threadUpload()}},{key:"getFinishSize",value:function getFinishSize(e,t){var r=t.crc32,n=0;return e.forEach(function(e){e.crc32===r?(e.loaded=t.loaded,n+=t.loaded):(e.loaded||(e.loaded=0),n+=e.loaded)}),n}},{key:"process",value:function process(e){var t,r,n=this.currentCtx.realtimeSpeed||0,o=this.currentCtx.fileSize;this.finishSize=this.getFinishSize(this.crc32Array,e),this.finishSize>this.lastFinishSize&&((t=new Date).getTime()-this.lastCalculateSpeedTime>1e3*this.realtimeSpeedInterval&&(r=t.getTime()-this.lastCalculateSpeedTime,e=this.finishSize-this.lastCalculateSpeedSize,n=Math.floor(e/r),this.lastCalculateSpeedTime=t.getTime(),this.lastCalculateSpeedSize=this.finishSize),this.lastFinishSize=this.finishSize);o=Math.floor(this.finishSize/o*100*100)/100||0,n=Upload_extends(this.currentCtx,{stage:"process",percent:o,realtimeSpeed:n});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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileMerge_extends(){return(FileMerge_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function FileMerge_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function FileMerge_setPrototypeOf(e,t){return(FileMerge_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function FileMerge_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=FileMerge_getPrototypeOf(r);return function FileMerge_possibleConstructorReturn(e,t){return!t||"object"!==FileMerge_typeof(t)&&"function"!=typeof t?function FileMerge_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var we=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}}),t&&FileMerge_setPrototypeOf(e,t)}(FileMerge,s.a);var n=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=n.call(this)).options=e,r.config=t,r.transport=new ie,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)}(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="",n=0;n<t.length;n++)r=(r?"".concat(r,","):"").concat(n+1,":").concat(t[n].crc32);var o=te.urlTemplate(this.config.uploadMergeUrl,e),i=this.config.userId,e=te.arrayToObject(this.currFileCtx.UploadHeader);this.transport.send({method:"post",url:o,headers:FileMerge_objectSpread({Authorization:this.currFileCtx.signature,"X-Storage-U":i},e),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,n=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:n,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:pe},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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function DirectUpload_extends(){return(DirectUpload_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function DirectUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function DirectUpload_setPrototypeOf(e,t){return(DirectUpload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function DirectUpload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=DirectUpload_getPrototypeOf(r);return function DirectUpload_possibleConstructorReturn(e,t){return!t||"object"!==DirectUpload_typeof(t)&&"function"!=typeof t?function DirectUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ke=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}}),t&&DirectUpload_setPrototypeOf(e,t)}(DirectUpload,s.a);var n=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=n.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)}(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._st=Date.now(),this.upload()}},{key:"upload",value:function upload(){for(var t=this,r=this.crc32Array.length,n=0,o=0,e=0;e<r;e++){var i=this.crc32Array[e],s=i.buffer,a=i.crc32,c=this.currentCtx.oid,u=this.currentCtx.signature,l={oid:"[object Array]"===Object.prototype.toString.call(c)?c[e]:c,tosDomain:this.currentCtx.tosDomain},i=te.urlTemplate(this.config.directUploadFileUrl,l),c=this.config.userId,l=te.arrayToObject(this.currentCtx.UploadHeader),c=new me({sliceItem:s,crc32:a,url:i,signature:"[object Array]"===Object.prototype.toString.call(u)?u[e]:u,uploadHeader:l,userId:c,retryTime:this.retryUploadTime,method:"put"});c.on("complete",function(e){o+ ++n===r&&t.success(e.xhr)}),c.on("error",function(e){++o===r&&t.fail(e.xhr)}),c.on("progress",function(e){t.process(e)}),c.upload()}}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,e=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(e)}},{key:"fail",value:function fail(e){e=DirectUpload_extends(this.currentCtx,{extra:{message:"direct upload error",errorCode:le},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;this.finishSize=e.loaded,this.finishSize>this.lastFinishSize&&(this.lastFinishSize=this.finishSize);e=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))}}]),DirectUpload}();function CommitUpload_typeof(e){return(CommitUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CommitUpload_extends(){return(CommitUpload_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function CommitUpload_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function CommitUpload_setPrototypeOf(e,t){return(CommitUpload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function CommitUpload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=CommitUpload_getPrototypeOf(r);return function CommitUpload_possibleConstructorReturn(e,t){return!t||"object"!==CommitUpload_typeof(t)&&"function"!=typeof t?function CommitUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xe=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}}),t&&CommitUpload_setPrototypeOf(e,t)}(CommitUpload,s.a);var n=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=n.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.transport=new ie,r.eventInit(),r}return function CommitUpload_createClass(e,t,r){t&&CommitUpload_defineProperties(e.prototype,t),r&&CommitUpload_defineProperties(e,r)}(CommitUpload,[{key:"commitUpload",value:function commitUpload(){var t,e,r=this.options.key,n=this.options.context.tasks[r],o=Q[this.config.region],i="",s={};this.options.type===N&&this.config.imageConfig&&this.config.imageConfig.serviceId?(i=this.config.imageHost||X[o],s={Action:"CommitImageUpload",Version:"2018-08-01",SessionKey:n.SessionKey},this.config.imageConfig&&this.config.imageConfig.serviceId?s.ServiceId=this.config.imageConfig.serviceId:s.SpaceName=this.config.videoConfig&&this.config.videoConfig.spaceName,e="imagex"):(c=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===q&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(c=this.config.objectConfig.spaceName),i=this.config.videoHost||V[o],s={Action:"CommitUploadInfo",Version:"2021-01-01"},e="vod",t={SpaceName:c,SessionKey:n.SessionKey,Functions:[]},u=this.config.videoConfig&&this.config.videoConfig.processAction,this.options.type===q&&this.config.objectConfig&&this.config.objectConfig.processAction&&(u=this.config.objectConfig.processAction),Array.isArray(u)&&0<u.length&&(t.Functions=u),(this.config.videoConfig&&this.config.videoConfig.callbackArgs||this.options.callbackArgs)&&(t.CallbackArgs=this.options.callbackArgs||this.config.videoConfig.callbackArgs)),this.config.accountId&&(s["X-Account-Id"]=this.config.accountId);var a=te.toQueryString(s),r=this.currFileCtx.proxyStsToken||this.config.stsToken,c=r.AccessKeyID,n=r.AccessKeyId,u=r.SecretAccessKey,r=r.SessionToken,o={method:"POST",url:"".concat(i,"?").concat(a),timeout:3e4,region:o,params:s,headers:{}};this.options.type===N&&this.config.imageConfig&&this.config.imageConfig.serviceId?(o.custom="none",o.headers["Content-Type"]="application/json"):(s=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(JSON.stringify(t[e])):"".concat(e,"=").concat(t[e])}).join("&"),o.headers["Content-Type"]="application/x-www-form-urlencoded",o.body=s,o.custom=o.body),new se.a(o,e,{isVolcengine:!0}).addAuthorization({accessKeyId:n||c,secretAccessKey:u,sessionToken:r},new Date),this.transport.send(o)}},{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 i=this;this.transport.on("complete",function(t){try{var e,r,n,o=JSON.parse(t.response);o.ResponseMetadata.Error?i.fail({xhr:t,errorCode:o.ResponseMetadata.Error.CodeN,error:o.ResponseMetadata.Error.Code,message:o.ResponseMetadata.Error.Message}):(e=o.Result,o={},i.options.type===N&&i.config.imageConfig&&i.config.imageConfig.serviceId?i.isImageBatchUpload?(r=e.Results,n=e.PluginResult||[],r.forEach(function(e,t){r[t]=CommitUpload_objectSpread(CommitUpload_objectSpread({},r[t]),n[t])}),o=r):CommitUpload_extends(o=e.Results[0],e.PluginResult&&e.PluginResult[0]):o=e.Data,o=CommitUpload_extends(i.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful"},uploadResult:o,xhr:t,stageStartTime:i._st,stageEndTime:Date.now(),duration:Date.now()-i._st,totalDuration:Date.now()-i._st+i.currFileCtx.totalDuration}),i.successProcess&&i.successProcess(o))}catch(e){i.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};!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),i.fail(t)})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,n=e.xhr,o=e.errorCode||he,i="commit upload error: UNKNOWN";n&&(i=0===n.status?"commit upload error: NETERROR":e.message||"commit upload error: ".concat(n.status));n=CommitUpload_extends(t.tasks[r],{extra:{message:i,error:e.error,errorCode:o},type:"error",stage:"complete",xhr:n,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.failProcess(n)}}]),CommitUpload}();function Queue_typeof(e){return(Queue_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Queue_extends(){return(Queue_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Queue_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Queue_setPrototypeOf(e,t){return(Queue_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Queue_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Queue_getPrototypeOf(r);return function Queue_possibleConstructorReturn(e,t){return!t||"object"!==Queue_typeof(t)&&"function"!=typeof t?function Queue_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Oe=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}}),t&&Queue_setPrototypeOf(e,t)}(Queue,s.a);var i=Queue_createSuper(Queue);function Queue(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,o=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=o,t.uploaderCtx=n,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)}(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 n=this,o=r.key,i=this.uploaderCtx,e=i.tasks[o].cacheTask,s=i.taskList[o].length;e&&0<r.index&&r.index<e?this.start():(i.tasks[o].currentTask=r.index,1===i.tasks[o].status&&r&&r.func.call(r.context,r.arg,function(e){var t=i.taskList[o][r.index+1];t&&0!==r.index?i._saveTask(o,{currentTask:t.index,stage:t.stage}):r.index===s-1&&i._removeTaskCache(o),0<n.tasks.length?n.start():i._queueSuccess(o),n.success(e)},function(e){e.xhr&&400<=e.xhr.status?n.fail(e):n.taskError[o]?n.taskError[o]<n.retryTaskTime?(n.taskError[o]++,n.execTask(r)):(e.key=o,n.fail(e)):(n.taskError[o]=1,n.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.tasks[e.key].isBreak?r._cancel(e.key):r._pause(e.key),r.logger.send(e)}},{key:"cancel",value:function cancel(e){var t;e||(t=this.key,e=this.uploaderCtx.tasks[t].currentTask,e=this.uploaderCtx.taskList[t][e],this.tasks=[],e&&3===e.index&&e.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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MainClass_extends(){return(MainClass_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function MainClass_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function MainClass_setPrototypeOf(e,t){return(MainClass_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function MainClass_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=MainClass_getPrototypeOf(r);return function MainClass_possibleConstructorReturn(e,t){return!t||"object"!==MainClass_typeof(t)&&"function"!=typeof t?MainClass_assertThisInitialized(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Se=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}}),t&&MainClass_setPrototypeOf(e,t)}(MainClass,s.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({},a),t._mergeOptions(t.config,e),t.tasks={},t.taskList={},t.cache={},t.storage=te.storage(MainClass_assertThisInitialized(t)),t.logger=t.config.noLog?{send:function send(){}}:new G(t.config,MainClass_assertThisInitialized(t)),t}return function MainClass_createClass(e,t,r){t&&MainClass_defineProperties(e.prototype,t),r&&MainClass_defineProperties(e,r)}(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,n=this.taskList;r[e]&&r[e].task?n[e].push(t):(n[e]=[],n[e].push(t),r[e]=r[e]||{},r[e].task=new Oe([],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===H||0===r)try{this.emit(e,t)}catch(e){r=!("[object Error]"!==Object.prototype.toString.call(e));if(!r||r&&"Error"===e.name)throw e}}},{key:"_addCrc32ProcessTask",value:function _addCrc32ProcessTask(e,t,r){var n=r.isDirect,r=r.isImageBatchUpload,r=new oe({file:e.file,context:this,key:t,isDirect:n,isImageBatchUpload:r},this.config),r={context:r,func:r.start,arg:{},key:t,index:0,stage:"crc32"};this._addTask(t,r)}},{key:"_addPreUploadTask",value:function _addPreUploadTask(e,t,r){r=r.isImageBatchUpload,r={file:e.file,stsToken:e.stsToken,context:this,type:e.type||L,preUploadUriParams:e.preUploadUriParams||{},storeKey:e.storeKey,key:t,isImageBatchUpload:r},r=new _e(r,this.config),r={context:r,func:r.start,arg:{},key:t,index:1,stage:"preUpload"};this._addTask(t,r)}},{key:"_addDirectUploadTask",value:function _addDirectUploadTask(e,t,r){r=r.isImageBatchUpload,r=new ke({file:e.file,context:this,key:t,isImageBatchUpload:r},this.config),r={context:r,func:r.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,r)}},{key:"_addInitUploadIDTask",value:function _addInitUploadIDTask(e,t){e=new ge({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 be({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 we({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]:{}).isImageBatchUpload,r=void 0!==r&&r,r={file:e.file,context:this,data:e.data,type:e.type||L,callbackArgs:e.callbackArgs,key:t,isImageBatchUpload:r},r=new xe(r,this.config),r={context:r,func:r.start,arg:{},key:t,index:5,stage:"complete"};this._addTask(t,r)}},{key:"_addAllUploadProcess",value:function _addAllUploadProcess(e,t){var r=e.type===N&&"[object Array]"===Object.prototype.toString.call(e.file);this.tasks[t]=this.tasks[t]||{},this.tasks[t].fileType=e.type||L,this.tasks[t].fileSize=e.file&&e.file.size,this.tasks[t].proxyStsToken=e.stsToken;var n=e.file.size<$||r;this._addCrc32ProcessTask(e,t,{isDirect:n,isImageBatchUpload:r}),this._addPreUploadTask(e,t,{isImageBatchUpload:r}),n?this._addDirectUploadTask(e,t,{isImageBatchUpload:r}):(this._addInitUploadIDTask(e,t),this._addUploadProcessTask(e,t),this._mergeFileTask(e,t)),this._getMetaInfoTask(e,t,{isImageBatchUpload:r})}},{key:"_run",value:function _run(e){var t=this.tasks,r=navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);if(r&&r[1]&&Number(r[1])<=9)return 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]),void this._cancel(e);t[e]?t[e].status===W?this._restart(e):(r=new Date,t[e].startTime=r.getTime(),t[e].task&&t[e].status!==H&&t[e].task.tasks.length&&(t[e].status=H,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 n,o,i=this,e=this.tasks;e[r]?(n=e[r].task,o=e[r].currentTask||0,this.taskList[r].forEach(function(e,t){e.index===o&&(n.tasks=i.taskList[r].slice(t))}),n&&e[r].status!==H&&n.tasks.length&&(e[r].status=H,n.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=K,t[e].task.cancel(),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=W,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;t&&(delete e.task,delete e.xhr,delete e.crc32Array,this._setCache(t,JSON.stringify(e)))}},{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(n){var o=this,i=this.tasks;Object.keys(i).forEach(function(e){var t=i[e],r=MainClass_extends({},t,{proxyStsToken:n});t.proxyStsToken=n;e=r.crc32Key;e&&(delete r.task,delete r.xhr,delete r.crc32Array,t.proxyStsToken=n,o._setCache(e,JSON.stringify(r)))})}},{key:"_setOption",value:function _setOption(e){this._mergeOptions(this.config,e)}},{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}(),Ce={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 _typeof(e){return typeof e}:function _typeof(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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function entry_setPrototypeOf(e,t){return(entry_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function entry_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=entry_getPrototypeOf(r);return function entry_possibleConstructorReturn(e,t){return!t||"object"!==entry_typeof(t)&&"function"!=typeof t?function entry_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Pe=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}}),t&&entry_setPrototypeOf(e,t)}(TTUploader,Se);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)}(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){if(!e||!Ce.checkStsToken(e.stsToken))return this.emit("error",{extra:{message:de,errorCode:ae}}),null;if(e.file){var t=te.getUnique("file");return this._addAllUploadProcess(e,t),t}return null}},{key:"addImageFile",value:function addImageFile(e){if(!e||!Ce.checkStsToken(e.stsToken))return this.emit("error",{extra:{message:de,errorCode:ae}}),null;if(e.file){e.type=e.type||N;var t=te.getUnique("file");return this._addAllUploadProcess(e,t),t}return null}},{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 n={};function __webpack_require__(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t.exports}return __webpack_require__.m=r,__webpack_require__.c=n,__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 n in t)__webpack_require__.d(r,n,function(e){return t[e]}.bind(null,n));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 n,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)};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)};var i=Number.isNaN||function NumberIsNaN(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}e.exports=EventEmitter,e.exports.once=function once(n,o){return new Promise(function(e,t){function eventListener(){void 0!==r&&n.removeListener("error",r),e([].slice.call(arguments))}var r;"error"!==o&&(r=function errorListener(e){n.removeListener(o,eventListener),t(e)},n.once("error",r)),n.once(o,eventListener)})},(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,n){var o,i;return checkListener(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener||r),o=e._events),i=o[t]),void 0===i?(i=o[t]=r,++e._eventsCount):("function"==typeof i?i=o[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),0<(r=_getMaxListeners(e))&&i.length>r&&!i.warned&&(i.warned=!0,(r=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",r.emitter=e,r.type=t,r.count=i.length,function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}(r))),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){e=e._events;if(void 0===e)return[];t=e[t];return void 0===t?[]:"function"==typeof t?r?[t.listener||t]:[t]: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}(t):arrayClone(t,t.length)}function listenerCount(e){var t=this._events;if(void 0!==t){e=t[e];if("function"==typeof e)return 1;if(void 0!==e)return e.length}return 0}function arrayClone(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}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 n,o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){if(0<t.length&&(n=t[0]),n instanceof Error)throw n;o=new Error("Unhandled error."+(n?" ("+n.message+")":""));throw o.context=n,o}e=i[e];if(void 0===e)return!1;if("function"==typeof e)c(e,this,t);else for(var s=e.length,a=arrayClone(e,s),r=0;r<s;++r)c(a[r],this,t);return!0},EventEmitter.prototype.addListener=function addListener(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,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.removeListener=function removeListener(e,t){var r,n,o,i,s;if(checkListener(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,i=r.length-1;0<=i;i--)if(r[i]===t||r[i].listener===t){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,o),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function removeAllListeners(e){var t,r=this._events;if(void 0===r)return this;if(void 0===r.removeListener)return 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]),this;if(0===arguments.length){for(var n,o=Object.keys(r),i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}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(r,n,o){(function(e){var t;function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(e){"object"==_typeof(n)&&void 0!==r?r.exports=e():void 0===(t="function"==typeof(t=e)?t.call(n,o,n,r):t)||(r.exports=t)}(function(){"use strict";function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,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}function Lb(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""}}function Mb(r){return Object.keys(r).sort().map(function(e){var t=r[e];if(null!=t){e=Lb(e);if(e)return Array.isArray(t)?"".concat(e,"=").concat(t.map(Lb).sort().join("&".concat(e,"="))):"".concat(e,"=").concat(Lb(t))}}).filter(function(e){return e}).join("&")}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={},n=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=n.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,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,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=n.clone.call(this);return e.words=this.words.slice(0),e},random:function random(e){for(var t=[],r=function i(t){var r=987654321,n=4294967295;return function(){var e=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return e/=4294967296,(e+=.5)*(.5<u.random()?1:-1)}},n=0;n<e;n+=4){var o=r(4294967296*(i||u.random())),i=987654071*o();t.push(4294967296*o()|0)}return new l.init(t,e)}}),o=e.enc={},s=o.Hex={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function parse(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new l.init(r,t/2)}},a=o.Latin1={stringify:function stringify(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function parse(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new l.init(r,t)}},c=o.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)))}},f=t.BufferedBlockAlgorithm=n.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,n=t.sigBytes,o=this.blockSize,i=n/(4*o),s=(i=e?u.ceil(i):u.max((0|i)-this._minBufferSize,0))*o,n=u.min(4*s,n);if(s){for(var a=0;a<s;a+=o)this._doProcessBlock(r,a);var c=r.splice(0,s);t.sigBytes-=n}return new l.init(c,n)},clone:function clone(){var e=n.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),p=(t.Hasher=f.extend({cfg:n.extend(),init:function init(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function reset(){f.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 p.HMAC.init(r,t).finalize(e)}}}),e.algo={});return e}(Math)}),n=t(function(e,t){var c;e.exports=(c=r,function(o){var e=c,r=e.lib,i=r.WordArray,s=r.Hasher,r=e.algo,a=[],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=o.sqrt(e),n=2;n<=r;n++)if(!(e%n))return;return 1}(e)||(t<8&&(a[t]=n(o.pow(e,.5))),y[t]=n(o.pow(e,1/3)),t++),e++}();var _=[],r=r.SHA256=s.extend({_doReset:function _doReset(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function _doProcessBlock(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],f=0;f<64;f++){f<16?_[f]=0|e[t+f]:(h=((d=_[f-15])<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,d=((p=_[f-2])<<15|p>>>17)^(p<<13|p>>>19)^p>>>10,_[f]=h+_[f-7]+d+_[f-16]);var p=n&o^n&i^o&i,h=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+y[f]+_[f],l=u,u=c,c=a,a=s+d|0,s=i,i=o,o=n,n=d+(h+p)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|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,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(64+n>>>9<<4)]=o.floor(r/4294967296),t[15+(64+n>>>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)}),o=(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,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var e=this._oKey=t.clone(),t=this._iKey=t.clone(),o=e.words,i=t.words,s=0;s<r;s++)o[s]^=1549556828,i[s]^=909522486;e.sigBytes=t.sigBytes=n,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 o(t,e)},s=function sha256(e){return n(e)},a=["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id"];return function(){function t(e,r,n){!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,n=n||{},this.signatureCache="boolean"!=typeof n.signatureCache||n.signatureCache,this.operation=n.operation,this.signatureVersion=n.signatureVersion,this.constant=n.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=n.bodySha256}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(e=this.request.body)&&(e=e instanceof URLSearchParams?e.toString():JSON.stringify(e)),this.request.headers[this.constant.contentSha256Header]=this.bodySha256||s(e).toString())}},{key:"authorization",value:function value(e,t){var r=[],n=this.credentialString(t);return r.push("".concat(this.constant.algorithm," Credential=").concat(e.accessKeyId,"/").concat(n)),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(Mb(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=[];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});var n=[];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"));n.push("".concat(t,":").concat(r.canonicalHeaderValues(e.toString())))}}),n.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(Mb(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 void 0===e&&(e=new Date),e.toISOString().replace(/\.\d{3}Z$/,"Z")}},{key:"getSigningKey",value:function value(e,t,r,n){t=i("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey),t),r=i(t,r),n=i(r,n);return i(n,this.constant.v4Identifier)}},{key:"createScope",value:function value(e,t,r){return[e.substr(0,8),t,r,this.constant.v4Identifier].join("/")}}]),t}()})}).call(this,o(7))},function(e,t,r){e.exports=function(){var e=e||function(f,r){var n=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 o=t.Base=function(){return{extend:function(e){var t=n(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 p=t.WordArray=o.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 n=this.sigBytes;var o=e.sigBytes;this.clamp();if(n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(var i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];this.sigBytes+=o;return this},clamp:function(){var e=this.words;var t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8;e.length=f.ceil(t/4)},clone:function(){var e=o.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 n=4294967295;return function(){r=36969*(r&65535)+(r>>16)&n;t=18e3*(t&65535)+(t>>16)&n;var e=(r<<16)+t&n;e/=4294967296;e+=.5;return e*(f.random()>.5?1:-1)}};for(var n=0,o;n<e;n+=4){var i=r((o||f.random())*4294967296);o=i()*987654071;t.push(i()*4294967296|0)}return new p.init(t,e)}});var i=e.enc={};var s=i.Hex={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=[];for(var o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16));n.push((i&15).toString(16))}return n.join("")},parse:function(e){var t=e.length;var r=[];for(var n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new p.init(r,t/2)}};var a=i.Latin1={stringify:function(e){var t=e.words;var r=e.sigBytes;var n=[];for(var o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){var t=e.length;var r=[];for(var n=0;n<t;n++)r[n>>>2]|=(e.charCodeAt(n)&255)<<24-n%4*8;return new p.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=o.extend({reset:function(){this._data=new p.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 n=t.sigBytes;var o=this.blockSize;var i=o*4;var s=n/i;if(e)s=f.ceil(s);else s=f.max((s|0)-this._minBufferSize,0);var a=s*o;var c=f.min(a*4,n);if(a){for(var u=0;u<a;u+=o)this._doProcessBlock(r,u);var l=r.splice(0,a);t.sigBytes-=c}return new p.init(l,c)},clone:function(){var e=o.clone.call(this);e._data=this._data.clone();return e},_minBufferSize:0});var l=t.Hasher=u.extend({cfg:o.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 h.HMAC.init(r,t).finalize(e)}}});var h=e.algo={};return e}(Math);return e}()},function(e,t,r){e.exports=function(s){return function(o){var e=s,t=e.lib,r=t.WordArray,n=t.Hasher,t=e.algo,i=[],y=[];!function(){function getFractionalBits(e){return 4294967296*(e-(0|e))|0}for(var e=2,t=0;t<64;)!function isPrime(e){for(var t=o.sqrt(e),r=2;r<=t;r++)if(!(e%r))return;return 1}(e)||(t<8&&(i[t]=getFractionalBits(o.pow(e,.5))),y[t]=getFractionalBits(o.pow(e,1/3)),t++),e++}();var _=[],t=t.SHA256=n.extend({_doReset:function(){this._hash=new r.init(i.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],c=r[5],u=r[6],l=r[7],f=0;f<64;f++){f<16?_[f]=0|e[t+f]:(h=((d=_[f-15])<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,d=((p=_[f-2])<<15|p>>>17)^(p<<13|p>>>19)^p>>>10,_[f]=h+_[f-7]+d+_[f-16]);var p=n&o^n&i^o&i,h=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),d=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&c^~a&u)+y[f]+_[f],l=u,u=c,c=a,a=s+d|0,s=i,i=o,o=n,n=d+(h+p)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|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,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(64+n>>>9<<4)]=o.floor(r/4294967296),t[15+(64+n>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(t),e.HmacSHA256=n._createHmacHelper(t)}(Math),s.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){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return _[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 r=e.data,_=r[0],e=r[1],r=function crc32(e,r){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];"undefined"!=typeof Int32Array&&(_=new Int32Array(_));for(var t=-1^~~r,n=(e=new Uint8Array(e)).length,u=0;u<n;u++)t=_[255&(t^e[u])]^t>>>8;return(-1^t)>>>0}(_,0);postMessage([_,dec2hex(r),e],[_])}}]);',null)}},function(e,t,r){e.exports=function(s){(function(){var e=s;var t=e.lib;var r=t.Base;var n=e.enc;var u=n.Utf8;var o=e.algo;var i=o.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 n=r*4;if(t.sigBytes>n)t=e.finalize(t);t.clamp();var o=this._oKey=t.clone();var i=this._iKey=t.clone();var s=o.words;var a=i.words;for(var c=0;c<r;c++){s[c]^=1549556828;a[c]^=909522486}o.sigBytes=i.sigBytes=n;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 n=t.finalize(this._oKey.clone().concat(r));return n}})})()}(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 o=window.URL||window.webkitURL;e.exports=function(t,r){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),n=n.getBlob()}catch(e){n=new Blob([t])}return new Worker(o.createObjectURL(n))}catch(e){return new Worker("data:application/javascript,"+encodeURIComponent(t))}}catch(e){if(!r)throw Error("Inline worker is not supported");return new Worker(r)}}},function(r,n,o){"use strict";o.r(n),o.d(n,"default",function(){return Se});var n=o(0),s=o.n(n),a={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",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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var c=function e(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(n=i.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.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 Wj(e,t){return t?"__tea_cache_tokens_"+e:"__tea_cache_events_"+e}function Xj(r,n,o,i){try{var e=r.match(/\/v\d\//),e=e?e[0]:-1!==r.indexOf("/v1/")?"/v1/":"/v2/",s=r.split(e)[0];if(!s)return void i(r,n,_);n.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,o&&o()},t.onerror=function(){t=null,i&&i(r,n,m)},t.src=s+"/v1/gif?"+e})}catch(o){i&&i(r,n,v,o.message)}}function Yj(e,t,r,n,o,i,s,a){var c=window.navigator.userAgent,u=-1!==window.navigator.appName.indexOf("Microsoft Internet Explorer")&&(-1!==c.indexOf("MSIE 8.0")||-1!==c.indexOf("MSIE 9.0"));if(!(c=!!r)&&u)Xj(e,t,n,o);else if(!c&&s)return l(!1).isSupportBeacon?(a&&a(),void(window.navigator.sendBeacon(e,JSON.stringify(t))?n():o(e,t,b))):void Xj(e,t,n,o);i&&delete t.app_key,function(e,t,r,n,o){var i=new XMLHttpRequest;i.open("POST",""+e,!0),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),o&&i.setRequestHeader("X-MCS-AppKey",""+o),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(),n&&n(t,w)},i.send(JSON.stringify(t))}(e,t,n,o,r)}var l=function n(e,s){function Al(e){var t=document.createElement("a");return t.href=e,t}var n,t=window.screen.width,r=window.screen.height,o=window.navigator.appVersion,i=window.navigator.userAgent,a=window.navigator.language,c=document.referrer,u=c?Al(c).hostname:"",l=function(e){var e=(e=Al(e).search).slice(1),n={};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"),n[t]=decodeURIComponent(void 0===r?"":r)}),n}(window.location.href),f="",p="",h="",d=""+parseFloat(o);-1!==(g=i.indexOf("Opera"))&&(h="Opera",d=i.substring(g+6),-1!==(g=i.indexOf("Version"))&&(d=i.substring(g+8))),-1!==(g=i.indexOf("Edge"))?(h="Microsoft Edge",d=i.substring(g+5)):-1!==(g=i.indexOf("MSIE"))?(h="Microsoft Internet Explorer",d=i.substring(g+5)):-1!==i.indexOf("Chrome")?-1!==(g=i.indexOf("MicroMessenger"))?(h="weixin",d=i.substring(g+15,g+20)):-1!==(g=i.indexOf("MQQBrowser"))?(h="qqbrowser",d=i.substring(g+11,g+15)):-1!==(g=i.indexOf("Chrome"))&&(h="Chrome",d=i.substring(g+7)):-1!==i.indexOf("Safari")?-1!==(g=i.indexOf("QQ"))?(h="qqbrowser",d=i.substring(g+10,g+16)):-1!==(g=i.indexOf("Safari"))&&(h="Safari",d=i.substring(g+7),-1!==(g=i.indexOf("Version"))&&(d=i.substring(g+8))):-1!==(g=i.indexOf("Firefox"))?(h="Firefox",d=i.substring(g+8)):-1!==(g=i.indexOf("MicroMessenger"))?(h="weixin",d=i.substring(g+15,g+20)):-1!==(g=i.indexOf("QQ"))&&(h="qqbrowser",d=i.substring(g+3,g+8)),-1!==(n=d.indexOf(";"))&&(d=d.substring(0,n)),-1!==(n=d.indexOf(" "))&&(d=d.substring(0,n)),-1!==(n=d.indexOf(")"))&&(d=d.substring(0,n));for(var y,_,g=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(o)?"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(i)){f=b.s;break}}function I(e,t){t=e.exec(t);return t&&t[1]?t[1]:""}switch(/Windows/.test(f)&&(p=I(/Windows (.*)/,f),f="windows"),f){case"Mac OS X":p=I(/Mac OS X (10[\.\_\d]+)/,i),f="mac";break;case"Android":(_=I(/Android ([\.\_\d]+)/,y=i))||(_=I(/Android\/([\.\_\d]+)/,y)),p=_,f="android";break;case"iOS":p=(p=/OS (\d+)_(\d+)_?(\d+)?/.exec(o))?p[1]+"."+p[2]+"."+(0|p[3]):"",f="ios"}e=e?function(){var e=s?"_tea_utm_cache_"+s:"_tea_utm_cache",t={},r={utm_source:l.utm_source,utm_medium:l.utm_medium,utm_campaign:l.utm_campaign,utm_term:l.utm_term,utm_content:l.utm_content};try{var n,o=window.sessionStorage,i=!1;for(n in r)r[n]&&(t[n]=r[n],i=!0);i?o.setItem(e,JSON.stringify(t)):(o=o.getItem(e))&&(t=JSON.parse(o))}catch(e){return r}return t}():{};return{browser:h,browser_version:d,platform:g,os_name:f,os_version:p,userAgent:i,screen_width:t,screen_height:r,device_model:function(e){var t,r,n="";try{"android"===e?navigator.userAgent.split(";").forEach(function(e){-1<e.indexOf("Build/")&&(n=e.slice(0,e.indexOf("Build/")))}):"ios"!==e&&"mac"!==e||(r=(t=navigator.userAgent.replace("Mozilla/5.0 (","")).indexOf(";"),n=t.slice(0,r))}catch(e){}return n.trim()}(f),language:a,referrer:c,referrer_host:u,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)}},u=(function(e){var t=function i(){function e(){for(var e=0,t={};e<arguments.length;e++){var r,n=arguments[e];for(r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function i(u){function r(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({path:"/"},r.defaults,o)).expires&&(o.expires=new Date(+new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var i=JSON.stringify(n);/^[\{\[]/.test(i)&&(n=i)}catch(e){}n=u.write?u.write(n,t):encodeURIComponent(String(n)).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 o)o[s]&&(a+="; "+s,!0!==o[s]&&(a+="="+o[s].split(";")[0]));return document.cookie=t+"="+n+a}}function s(e,r){if("undefined"!=typeof document){for(var n={},o=document.cookie?document.cookie.split("; "):[],i=0;i<o.length;i++){var s=o[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(n[c]=a,e===c)break}catch(e){}}return e?n[e]:n}}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(){})};e.exports=t()}(n={exports:{}}),n.exports),f=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}(),p={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+"=([^;]+)")),t=t?t[1]:"";return decodeURIComponent(t)}catch(e){return""}},setCookie:function setCookie(e,t,r){try{var n=+new Date+r;u.set(e,t,{expires:new Date(n),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}}()},h=function(){function e(e){this._storage=!e&&p.isSupportLS?p:new f}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}(),d={cn:"https://mcs.snssdk.com",sg:"https://sgali-mcs.byteoversea.com",va:"https://maliva-mcs.byteoversea.com"},y="/v1/user/webid",_=4001,m=4e3,v=4002,b=4003,w=500;function g(e){return e?(e^16*Math.random()>>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,g)}function $j(){return g().replace(/-/g,"").slice(0,19)}var x,k=function(){function e(e,t){this.browser=l(!0,e.app_id),this.config=e,this.cfg=t,this.storage=new h(!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||d[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+y}return e.prototype._getToken=function(){this.tokensKey=Wj(this.appInfo,!0),this.cookieKey="__tea_cookie_tokens_"+this.appInfo;var e,t,r,n,o=this.storage.getItem(this.tokensKey);this.enableCookie?(n=this.storage.getCookie(this.cookieKey))?(n=decodeURIComponent(n),e=(n=JSON.parse(n)).user_unique_id,t=n.web_id,r=n.timestamp,n=n.ssid,this._setToken(t,e,n,r)):o?(this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(o)),this.expiresTime),this._checkLocal(o)):this._requestWebId():o?this._checkLocal(o):this._requestWebId()},e.prototype._checkLocal=function(e){var t,r;e.web_id||(t=this.storage.getCookie("tt_webid"),o=this.storage.getCookie("__tea_sdk__ssid"),r=this.storage.getCookie("__tea_sdk__user_unique_id"),t&&o&&r&&(n={web_id:t,ssid:o,user_unique_id:r,timestamp:Date.now()},this.storage.setItem(this.tokensKey,n)));var e=this.storage.getItem(this.tokensKey),n=(r=e.user_unique_id,t=e.web_id,e.timestamp),o=e.ssid;t&&r?this._setToken(t,r,o,n):this._requestWebId()},e.prototype._setToken=function(e,t,r,n){if(this.uuid=t,this.web_id=e,this.ssid=r,this.checkExp){n=Date.now()-parseFloat(n);if(7344e6<n)return void this._requestWebId();if(432e7<n)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:$j(),ssid:""}):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){e=this.domain+y+"/"+e+"/update";this._fetchWebId(e,!0)},e.prototype._fetchWebId=function(e,r){var n=this;this.isGetWebId=!0,Yj(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:n.web_id,ssid:n.ssid,user_unique_id:n.uuid,timestamp:Date.now()},n.enableCookie&&n.storage.setCookie(n.cookieKey,encodeURIComponent(JSON.stringify(t)),n.expiresTime),n.storage.setItem(n.tokensKey,t),n._complete(n.web_id,n.uuid,n.ssid)):(n.isGetWebId=!1,n._setwebId(e)),n.isGetSsid?n._requestSsId():n.callback&&n.callback()):r?n._fetchWebId(n.fetchUrl,!1):n.isGetWebId=!1},function(){n.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";Yj(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}(),O=function(){function t(e,t,r,n){this.cfg=t,this.config=e,this._token=r,this.appInfo=e.app_key||e.app_id,this.debugMode=!!e.log,this.evtDataKey=Wj(this.appInfo,!1);r=e.channel_domain||d[e.channel];this.reportUrl=e.report_url||r+"/v1/list",this.maxReport=e.max_report||20,this.storage=new h(!0),this.plugin=n,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;void 0===e&&(e=[]),void 0===t&&(t=!1);var n=this.storage.getItem(this.evtDataKey)||[],e=t?index_base_min_i(e,n):index_base_min_i(n,e);this.storage.setItem(this.evtDataKey,e),this.reportTimer&&clearTimeout(this.reportTimer),e.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 r=this;if(!e.length)return e;var t=this.cfg.get();t.header.custom=JSON.stringify(t.header.custom);var n=[];return n.push(e),n.map(function(e){return{events:e.map(function(e){var t=c({},r.cfg.get("evtParams"),e.params);return delete t.__disable_storage__,c({},e,{params:JSON.stringify(t)})}),user:t.user,header:t.header,verbose:r.debugMode?1:void 0}})},t.prototype._dealData=function(e,r){var n=this;if(!e.length)return e;e.map(function(e){var t=[];return t.push(e),t}).forEach(function(e){var t=$j();n._send(t,e,r)})},t.prototype._send=function(e,t,r){var n=this;this.isSending=!0;function up(){n.isSending=!1}Yj(this.reportUrl,t,this.config.app_key,function(){up()},function(e,t){up(),n.cfg.get("reportErrorCallback")(e,t)},!1,r,up)},t}(),C=void 0,n=(new Date).getTimezoneOffset(),S=parseInt(""+-n/60,10),P=60*n,U=function(){function t(e){e=l(!0,e);this.envInfo={user:{user_unique_id:C,user_type:C,user_id:C,user_is_auth:C,user_is_login:C,device_id:C,web_id:C,ip_addr_id:C,ssid:C},header:{app_id:C,app_name:C,app_install_id:C,install_id:C,app_package:C,app_channel:C,app_version:C,os_name:e.os_name,os_version:e.os_version,device_model:e.device_model,ab_client:C,ab_version:C,ab_sdk_version:C,traffic_type:C,client_ip:C,device_brand:C,os_api:C,access:C,language:e.language,region:C,app_language:C,app_region:C,creative_id:C,ad_id:C,campaign_id:C,log_type:C,rnd:C,platform:e.platform,sdk_version:"4.1.15",province:C,city:C,timezone:S,tz_offset:P,tz_name:C,sim_region:C,carrier:C,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 n="evtParams"===e?t:{_staging_flag:Number(t)},o=c({},n);Object.keys(o).forEach(function(e){r.evtParams[e]=o[e]})}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var i="";if(-1<e.indexOf(".")&&(i=(n=e.split("."))[0],e=n[1]),"user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("os_version"===e&&(e=""+t),"web_id"===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)}i?"user"===i||"header"===i?this.envInfo[i][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}(),I=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}(),T=index_base_min_i(["init","config","send","start"],[]),j=(x=+Date.now()+Number((""+Math.random()).slice(2,8)),function(){return x+=1}),D=function(){function i(e){var r=this;this.predefinePageView=function(e){void 0===e&&(e={});var t=c({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}),e=c({},t,e);r.event("predefine_pageview",e,!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,n=e.app_key,o=e.log;this._config=new U(r),this.logger=new I(this.name,o),n||r||this.logger.throw("没有传入 app_key 或 app_id "),r&&"number"!=typeof r&&this.logger.throw("app_id参数有误,请检查 "),n&&"string"!=typeof n&&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 k(e,this._config),this._token.callback=function(){t.callbackSend&&t.start()},this._event=new O(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 n="boolean"==typeof e[e.length-1]&&e[e.length-1],o="boolean"==typeof e[e.length-1]?e.slice(0,e.length-1):e,i=t(o,1)[0],s=[];"Array"!==Object.prototype.toString.call(i).slice(8,-1)?s[0]=o:s=o,s=s.map(function(e){return function(e,t){var r=e;/^event\./.test(e)&&(r=e.slice(6));return"object"!=_typeof(t)&&(t={}),t.event_index=j(),{event:r,params:t,local_time_ms:+new Date,is_bav:0}}(e[0],e[1])}),this._event.event(s,n)},i}();function R(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function lk(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,n;0!==i.cmdQueue.length&&(e=i.cmdQueue,r=-1,e.forEach(function(e,t){"init"===e[0]&&(r=t)}),-1!==(n=r)&&(i._isProcess=!0,i._executeCmd.apply(i,i.cmdQueue[n]),i.cmdQueue.forEach(function(e,t){t!==n&&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 n,o=t[0];-1<T.indexOf(o)?(n=i.colloctor)[o].apply(n,t.slice(1)):(n=i.colloctor).event.apply(n,t)}),this.cmdQueue=[],this.name=e,this.colloctor=new D(e),this._isProcess=!1,this._alias={},this._processCmd(),T.forEach(function(e){i._exportCollect[e]=i._exportCollect.bind(i,e)}),this._exportCollect}function ok(e){return A[e]||(A[e]=[]),A[e]}function pk(e){var r=t(e),n=r[0],e=r.slice(1);1===(r=n.split(".")).length?ok("default").push(index_base_min_i([n],e)):2===r.length?"event"===r[0]?ok("default").push(index_base_min_i([n],e)):ok(r[0]).push(index_base_min_i([r[1]],e)):(n=r[0],r=[r[1],r[2]].join("."),ok(n).push(index_base_min_i([r],e)))}function qk(){M.q.forEach(function(e){e=[].slice.call(e);"Array"===Object.prototype.toString.call(e[0]).slice(8,-1)?e.forEach(function(e){pk(e)}):pk(e)}),Object.keys(A).forEach(function(t){A[t].forEach(function(e){(function(e){return E[e]||(E[e]=new lk(e)),E[e]})(t).apply(void 0,index_base_min_i(e))}),A[t]=[]}),M.q=[]}var E={},A={},M=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];e.q.push(t),qk()};M.q=[],M.l=Date.now(),M._instanceMap=E,M._instanceCmdMap=A,T.forEach(function(e){M[e]=M.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))}(M),qk();var F=M,L={browserError:1e3,crc32:1e3,preUpload:1001,initUploadID:1002,process:1003,fileMerge:1004,complete:1005},z="video",N="image",q="object",B={video:"video_upload",image:"image_upload",object:"object_upload"},H=1,K=2,W=3,J={cn:2562,us:2643,sg:2643,boe:2562},Q={"cn-north-1":"cn-north-1","us-east-1":"us-east-1","ap-singapore-1":"ap-singapore-1",boe:"boe"},V={"cn-north-1":"https://vod.volcengineapi.com","ap-singapore-1":"https://vod.byteplusapi.com"},X={"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 _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var $=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=F,this.tea_app_id=J.cn,this.tea_channel="cn","ap-singapore-1"===this.options.region?(this.tea_app_id=J.sg,this.tea_channel="sg"):(this.tea_app_id=J.cn,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.18-alpha.2",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)}(Logger,[{key:"send",value:function send(e){var t=this.context,r=e.key,n=t.tasks[r],o=L[e.stage]||999,t=e.fileType||n.fileType,n=e.fileSize||0,i={log_type:B[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}(),n=o(4),G=o.n(n),n=o(3),Z=o.n(n),Y={urlTemplate:function urlTemplate(t,r){var n;return r=r||{},Object.keys(r).forEach(function(e){n=new RegExp("{".concat(e,"}"),"g"),t=t.replace(n,r[e])}),t},toQueryString:function toQueryString(){var r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=[];return Object.keys(r).map(function(t){var e=r[t];"[object Array]"===Object.prototype.toString.call(e)?e.forEach(function(e){n.push("".concat(t,"=").concat(e))}):n.push("".concat(t,"=").concat(r[t]))}),n.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.slice||blob.webkitSlice||blob.mozSlice)},storage:function storage(t){var r=t,t={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={}}};try{if(window.localStorage)return window.localStorage.setItem("",""),window.localStorage}catch(e){return t}return t},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,n=1048576;return t&&"function"==typeof t?t(r)<5242880?5242880:t(r)||r:200*n<r?10*n:r<=200*n&&2*n<=r?5*n:e.size},getFileSuffix:function getFileSuffix(e){if(e&&"[object String]"===Object.prototype.toString.call(e)){var t=e.lastIndexOf(".");return 0<t?"."+e.substring(t+1):void 0}},crypto:{hmac:function hmac(e,t){return G()(t,e)},sha256:function sha256(e){return Z()(e)}},date:{iso8601:function iso8601(e){return void 0===e&&(e=Y.date.getDate()),e.toISOString().replace(/\.\d{3}Z$/,"Z")}},Buffer:Uint8Array,buffer:{toBuffer:function toBuffer(e,t){return"function"==typeof Y.Buffer.from&&Y.Buffer.from!==Uint8Array.from?Y.Buffer.from(e,t):new Y.Buffer(e,t)},alloc:function alloc(e,t,r){if("number"!=typeof e)throw new Error("size passed to alloc must be a number.");if("function"==typeof Y.Buffer.alloc)return Y.Buffer.alloc(e,t,r);e=new Y.Buffer(e);return void 0!==t&&"function"==typeof e.fill&&e.fill(t,void 0,void 0,r),e},toStream:function toStream(t){Y.Buffer.isBuffer(t)||(t=Y.buffer.toBuffer(t));var r=new Y.stream.Readable,n=0;return r._read=function(e){if(n>=t.length)return r.push(null);e=n+e;e>t.length&&(e=t.length),r.push(t.slice(n,e)),n=e},r},concat:function concat(e){for(var t,r=0,n=0,o=0;o<e.length;o++)r+=e[o].length;for(t=Y.buffer.alloc(r),o=0;o<e.length;o++)e[o].copy(t,n),n+=e[o].length;return t}}},ee=Y;var te={crc32:function encrypt_crc32(e,t){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];"undefined"!=typeof Int32Array&&(r=new Int32Array(r));for(var n=-1^~~t,o=(e=new Uint8Array(e)).length,i=0;i<o;i++)n=r[255&(n^e[i])]^n>>>8;return(-1^n)>>>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_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var re=function(){function Crc32(e,t,r,n){!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=n,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)}(Crc32,[{key:"start",value:function start(){this.readFileCrc32(this.file)}},{key:"readFileCrc32",value:function readFileCrc32(t){var r,n=this,e=this.sliceLength,o=t.slice||t.webkitSlice||t.mozSlice,i=new FileReader,s=0,a=0;(function read(){a<t.size&&(a=Math.min(s+e,t.size),104857600<t.size&&t.size-a<=5242880&&(a=t.size)),i.readAsArrayBuffer(o.call(t,s,a)),i.onload=function(e){e=e.target.result;r=te.crc32(e,0),n.crc32Array.push({start:s,end:a,crc32:te.dec2hex(r),buffer:e}),(s=a)<t.size?read():n.success(n.crc32Array)}})()}},{key:"success",value:function success(e){this.successProcess(e)}},{key:"fail",value:function fail(e,t,r,n){3<=this.retryTime?this.failProcess():(this.readFileCrc32(e,t,r,n),this.retryTime++)}}]),Crc32}();function FileCrc32_extends(){return(FileCrc32_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[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&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function _unsupportedIterableToArray(e,t){if(!e)return;if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _arrayLikeToArray(e,t)}(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,n=new Array(t);r<t;r++)n[r]=e[r];return n}function FileCrc32_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var ne=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=ee.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)}(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(n,e){var crc32,o=this;this.isImageBatchUpload?function(){for(var t=n.length,r=[],e=0;e<t;e++)new re(n[e],n[e].size,function(e){r.push(e[0]),r.length===t&&o.success(r)},function(e){o.fail(e)}).start()}():!n||!n.size||n.size<=0?this.fail({message:"There is a problem with the input file or fileSize."}):this.isDirect?(crc32=new re(n,n.size,function(e){o.success(e)},function(e){o.fail(e)}),crc32.start()):this.sliceFile(n,e,function(e){o.success(e)},function(e){o.fail(e)})}},{key:"sliceFile",value:function sliceFile(e,t,r,n){for(var o=[],i=t,s=e.size,a=new FileReader,c=e.slice||e.webkitSlice||e.mozSlice,u=0,l=0,f=0;l<s;)l=Math.min(u+i,s),s-l<=5242880&&(l=s),o.push({start:u,end:l,crc32:0}),u=l;try{!function read(t){u=o[t].start,l=o[t].end,a.readAsArrayBuffer(c.call(e,u,l)),a.onload=function(e){e=e.target.result,f=te.dec2hex(te.crc32(e,0)),o[t].crc32=f,l===s?r(o):read(o.length-1)},a.onerror=function(e){n(e)}}(0)}catch(e){n(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,n=[],o=[];if(this.isImageBatchUpload)for(var i=0;i<this.file.length;i++)n.push(this.file[i].size),o.push(this.file[i].name);else n=this.file.size,o=this.file.name;var s=this.getCrc32Key(e,n),t=t.tasks[r];t&&this.successProcess(FileCrc32_extends(t,{key:r,crc32Array:e,crc32Key:s,sdkVersion:"1.0.18-alpha.2",sliceLength:this.sliceLength,extra:{message:"get crc32 success"},stage:"crc32",type:"success",fileSize:n,fileName:o,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",e=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(e)}}]),FileCrc32}();function Transport_typeof(e){return(Transport_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(r){var n=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=_getPrototypeOf(r);return function _possibleConstructorReturn(e,t){return!t||"object"!==Transport_typeof(t)&&"function"!=typeof t?function _assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(e=_getPrototypeOf(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oe=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}}),t&&_setPrototypeOf(e,t)}(Transport,s.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)}(Transport,[{key:"_ajax",value:function _ajax(t){var r=this,n=this.xhr;n.upload.onprogress=function(e){r.emit("progress",e)},n.onreadystatechange=function(e){4===n.readyState&&(n.upload.onprogress=ee.noop,n.onreadystatechange=ee.noop,n.params=t,r._data&&r._data.url&&(n.currentUrl=r._data.url),200<=n.status&&n.status<300?r.emit("complete",n):400<=n.status&&r.emit("error",n))},n.onerror=function(){n.errText="unknow net error",r.emit("error",n)},n.ontimeout=function(){n.errText="timeout",r.emit("error",n)},n.onabort=function(){n.errText="abort",r.emit("error",n)},n.send(t)}},{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){var t;e.formData&&(t="function"==typeof e.formData?e.formData():e.formData),t=t||[];for(var r=new FormData,n=0,o=t.length;n<o;n++){var i=t[n];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=ee.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}(),n=o(1),ie=o.n(n),se=1000002,ae=1001e3,ce=1002e3,ue=1003e3,le=1003003,fe=1004e3,pe=1005e3,he="The format of stsToken is incorrect.",de="An error occurred reading the file";function ApplyUpload_typeof(e){return(ApplyUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ApplyUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ApplyUpload_setPrototypeOf(e,t){return(ApplyUpload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function ApplyUpload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=ApplyUpload_getPrototypeOf(r);return function ApplyUpload_possibleConstructorReturn(e,t){return!t||"object"!==ApplyUpload_typeof(t)&&"function"!=typeof t?function ApplyUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ye=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}}),t&&ApplyUpload_setPrototypeOf(e,t)}(ApplyUpload,s.a);var n=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=n.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)}(ApplyUpload,[{key:"start",value:function start(e,t,r){this.failProcess=r,this.successProcess=t,this._st=Date.now();t=this.uploaderCtx._getCache(this.currFileCtx.crc32Key),t=t?JSON.parse(t):{};t.oid&&t.uploadID?this.resumeFromCache(t):this.startPreUpload()}},{key:"startPreUpload",value:function startPreUpload(){var a=this,e=Q[this.config.region],t=new oe;t.on("complete",function(t){if(t.response)try{var e,r,n,o,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}):(i=s.Result,e=(r=(a.options.type===N&&a.config.imageConfig&&a.config.imageConfig.serviceId?i:i.Data).UploadAddress).StoreInfos,s=r.UploadHosts,i=r.SessionKey,r=void 0===(r=r.UploadHeader)?[]:r,n=[],o=[],a.isImageBatchUpload&&1<e.length?e.forEach(function(e){n.push(e.Auth),o.push(e.StoreUri)}):(n=e[0].Auth,o=e[0].StoreUri),i=ApplyUpload_extends(a.currFileCtx,{signature:n,type:"success",extra:{message:"prepare upload success"},stage:"preUpload",oid:o,tosDomain:"".concat(a.config.schema,"://").concat(s[0]),xhr:t,UploadHeader:r,SessionKey:i,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})}else a.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),a.fail(t)});var r="",n={},o=this.options.type===N&&this.config.imageConfig&&this.config.imageConfig.serviceId?(r=this.config.imageHost||X[e],n={Action:"ApplyImageUpload",Version:"2018-08-01",ServiceId:this.config.imageConfig.serviceId},this.currFileCtx.fileSize&&1<this.currFileCtx.fileSize.length&&(n.UploadNum=this.currFileCtx.fileSize.length),this.options.storeKey&&(s=this.options.storeKey,"[object Array]"===Object.prototype.toString.call(s)?n.StoreKeys=s:"[object String]"===Object.prototype.toString.call(s)&&(n.StoreKeys=[s])),"imagex"):(c=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===q&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(c=this.config.objectConfig.spaceName),r=this.config.videoHost||V[e],n={Action:"ApplyUploadInfo",Version:"2021-01-01",SpaceName:c,FileSize:this.currFileCtx.fileSize,FileType:this.options.type},this.config.enOID&&(n.EnOID=1),"vod");this.config.useFileExtension&&this.currFileCtx.fileName&&this.options.type===q&&(u=this.currFileCtx.fileName,(l=ee.getFileSuffix(u))&&(n.FileExtension=l)),this.config.accountId&&(n["X-Account-Id"]=this.config.accountId),n.s=Math.random().toString(36).substr(2);var i=this.currFileCtx.proxyStsToken||this.config.stsToken,s=ee.toQueryString(n),c=i.AccessKeyID,u=i.AccessKeyId,l=i.SecretAccessKey,i=i.SessionToken,n={method:"GET",url:"".concat(r,"?").concat(s),timeout:3e4,region:e,params:n};new ie.a(n,o,{isVolcengine:!0}).addAuthorization({accessKeyId:u||c,secretAccessKey:l,sessionToken:i},new Date),t.send(n)}},{key:"resumeFromCache",value:function resumeFromCache(n){var o=this,i=this.options.key,e=new oe;e.on("complete",function(e){try{var t,r=JSON.parse(e.response);0===r.success&&0<r.payload.partList.length?(t=o.confirmCache(r.payload.partList),r=!!n.hasMerge?5:t.isAllFinished?4:3,t=ApplyUpload_extends(o.currFileCtx,n,{key:i,xhr:e,extra:{message:"prepare upload from cache success"},stage:"preUpload",type:"success",percent:0,cacheTask:r,proxyStsToken:o.options.stsToken,currentTask:1,status:1,isBreak:1,crc32Array:t.crc32Array,stageStartTime:o._st,stageEndTime:Date.now(),duration:Date.now()-o._st,totalDuration:Date.now()-o._st+o.currFileCtx.totalDuration}),o.successProcess&&o.successProcess(t)):o.startPreUpload()}catch(e){o.startPreUpload()}}),e.on("error",function(e){400<=e.status?o.startPreUpload():o.fail({error:"request error",xhr:e})});var t=this.config.userId,r=ApplyUpload_extends(ee.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});e.send({method:"get",url:ee.urlTemplate(this.config.getUploadListUrl,{tosDomain:n.tosDomain,oid:n.oid,uploadId:n.uploadID}),headers:_objectSpread({authorization:n.signature,"x-storage-u":t},r),timeout:3e4})}},{key:"confirmCache",value:function confirmCache(e){var t=this.currFileCtx.crc32Array,r={};e.forEach(function(e){void 0===r[e.partNumber-1]&&(r[e.partNumber-1]={tag:!0,crc32:e.crc32})});var n=!0,t=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):n=!1,e});return{isAllFinished:n,crc32Array:t}}},{key:"fail",value:function fail(e){var t=e.xhr,r=e.errorCode||ae,n="prepare upload error: UNKNOWN";t&&(n=0===t.status?"prepare upload error: NETERROR":e.message||"prepare upload error: ".concat(t.status));t=ApplyUpload_extends(this.currFileCtx,{extra:{message:n,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(t)}}]),ApplyUpload}();function InitUploadID_typeof(e){return(InitUploadID_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function InitUploadID_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function InitUploadID_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function InitUploadID_setPrototypeOf(e,t){return(InitUploadID_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function InitUploadID_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=InitUploadID_getPrototypeOf(r);return function InitUploadID_possibleConstructorReturn(e,t){return!t||"object"!==InitUploadID_typeof(t)&&"function"!=typeof t?function InitUploadID_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _e=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}}),t&&InitUploadID_setPrototypeOf(e,t)}(InitUploadID,s.a);var n=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=n.call(this)).options=e,r.config=t,r.transport=new oe,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)}(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},n=ee.urlTemplate(this.config.initUploadFileUrl,r),o=this.config.userId,r=InitUploadID_extends(ee.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:n,headers:InitUploadID_objectSpread({authorization:e.tasks[t].signature,"x-storage-u":o},r),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 o=this,i=this.options.context,s=this.options.key;this.transport.on("complete",function(t){try{var e,r=JSON.parse(t.response),n=r.payload.uploadID;0===r.success&&n?(e=InitUploadID_extends(i.tasks[s],{uploadID:n,percent:0,type:"success",extra:{message:"init upload id success"},stage:"initUploadID",xhr:t,stageStartTime:o._st,stageEndTime:Date.now(),duration:Date.now()-o._st,totalDuration:Date.now()-o._st+o.currFileCtx.totalDuration}),o.successProcess(e)):o.fail({error:"fail! res.success: ".concat(r.success,", uploadId:").concat(n),xhr:t})}catch(e){o.fail({error:"catch error: ".concat(JSON.stringify(e)),xhr:t})}}),this.transport.on("error",function(e){o.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,e=InitUploadID_extends(t.tasks[r],{extra:{message:"init upload id error, ".concat(e.error),errorCode:ce},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(e)}}]),InitUploadID}();function Uploader_typeof(e){return(Uploader_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uploader_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Uploader_setPrototypeOf(e,t){return(Uploader_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Uploader_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Uploader_getPrototypeOf(r);return function Uploader_possibleConstructorReturn(e,t){return!t||"object"!==Uploader_typeof(t)&&"function"!=typeof t?function Uploader_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ge=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}}),t&&Uploader_setPrototypeOf(e,t)}(Uploader,s.a);var u=Uploader_createSuper(Uploader);function Uploader(e){var t=e.sliceItem,r=e.crc32,n=e.url,o=e.signature,i=e.uploadHeader,s=e.userId,a=e.retryTime,c=void 0===a?0:a,a=e.method,e=void 0===a?"put":a;return function Uploader_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Uploader),(a=u.call(this)).fileSlice=t,a.crc32=r,a.uploadUrl=n,a.uploadHeader=i,a.signature=o,a.userId=s,a.retryTime=c,a.method=e,a.retryCount=0,a.ready=!1,a.cancel=!1,a.transport=new oe,a.eventInit(),a}return function Uploader_createClass(e,t,r){t&&Uploader_defineProperties(e.prototype,t),r&&Uploader_defineProperties(e,r)}(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,t=r/t;this.emit("complete",{crc32:this.crc32,size:r,speed:t,xhr:e,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st})}},{key:"fail",value:function fail(e){var t=this;if(!this.cancel)if(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});else{if(this.retryCount<this.retryTime)return setTimeout(function(){t.upload()},1e3),void this.retryCount++;var r="slice upload failed: UNKNOWN";e&&(r=e.status?"slice upload failed: ".concat(e.status):"slice upload failed: NETERROR"),this.emit("error",{message:r,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}(),n=o(5),me=o.n(n);function Upload_typeof(e){return(Upload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Upload_extends(){return(Upload_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Upload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Upload_setPrototypeOf(e,t){return(Upload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Upload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Upload_getPrototypeOf(r);return function Upload_possibleConstructorReturn(e,t){return!t||"object"!==Upload_typeof(t)&&"function"!=typeof t?function Upload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ve=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}}),t&&Upload_setPrototypeOf(e,t)}(Upload,s.a);var n=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=n.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)}(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 o,i=this;this.worker||(o=this.crc32Array,this.worker=new me.a,this.worker.onmessage=function(e){var t=e.data[0],r=e.data[2],n=o[r];n.crc32=e.data[1],i.upload(n,t,r)})}},{key:"read",value:function read(e,t){var r=this,n=this.file,o=n.slice||n.webkitSlice||n.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:de,errorCode:le}})},i.readAsArrayBuffer(o.call(n,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 n=this,o=t.crc32;this.context._saveTask(this.key,{crc32Array:this.crc32Array});var i={number:r+1,uploadId:this.currentCtx.uploadID,oid:this.currentCtx.oid,tosDomain:this.currentCtx.tosDomain},s=ee.urlTemplate(this.config.uploadChunkedUrl,i),a=this.config.userId,i=Upload_extends(ee.arrayToObject(this.currentCtx.UploadHeader),{"x-storage-mode":"gateway"}),a=new ge({sliceItem:e,crc32:o,url:s,signature:this.currentCtx.signature,uploadHeader:i,userId:a,retryTime:this.retryUploadTime});a.on("complete",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.fileSliceSuccess(e))}),a.on("error",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.fail(e))}),a.on("progress",function(e){1===n.currentCtx.status&&(e.start=t.start,e.index=r,n.process(e))}),a.upload(),this.uploadHandlers[r]=a}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,e=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(e)}},{key:"fail",value:function fail(e){var t=this.currentCtx.totalDuration,r=Date.now()-this._st,n=e.crc32?{message:e.message,data:e.crc32,size:e.size}:e.extra;n.errorCode=n.errorCode||ue;r=Upload_extends(this.currentCtx,{extra:n,type:"error",stage:"process",req:{},res:{},totalDuration:r+t});e.xhr&&(t=e.xhr,r.req={url:e.xhr.currentUrl},r.res={status:t.status,body:t.responseText,header:t.getAllResponseHeaders()},delete e.xhr),void 0!==e.statusCode&&Upload_extends(this.currentCtx,{statusCode:e.statusCode}),this.errorLength||(e=e.index,this.context.logger.send(Upload_extends({},r,{slice_index:e})),this.stop(),this.context._broadcast("error",r),this.currentCtx.isBreak?this.context._cancel(this.key):this.context._pause(this.key),this.errorLength++)}},{key:"fileSliceSuccess",value:function fileSliceSuccess(e){var t=e.index,r=Date.now();-1===this.finishArr.indexOf(e.start)&&this.finishArr.push(e.start),this.crc32Array[t].finished=!0,this.crc32Array[t].speed=e.speed;var n,o={message:"slice upload success"};if(e.xhr&&(n=e.xhr,o.currentUrl=n.currentUrl||"",Upload_extends(this.currentCtx,{req:{url:n.currentUrl,param:n.params},res:{status:n.status,body:n.responseText,header:n.getAllResponseHeaders()}}),delete e.xhr),this.context.logger.send(Upload_extends(this.currentCtx,{stage:"process",type:"success",slice_index:t,extra:o,totalDuration:r-this._lastSaveTime+this.currentCtx.totalDuration})),this._lastSaveTime=r,this.context._saveTask(this.key),this.finishArr.length>=this.crc32Array.length)return this.stop(),void this.success(e.xhr);this.uploading.splice(this.uploading.indexOf(t),1),this.uploadHandlers[t]&&delete this.uploadHandlers[t],this.threadUpload()}},{key:"getFinishSize",value:function getFinishSize(e,t){var r=t.crc32,n=0;return e.forEach(function(e){e.crc32===r?(e.loaded=t.loaded,n+=t.loaded):(e.loaded||(e.loaded=0),n+=e.loaded)}),n}},{key:"process",value:function process(e){var t,r,n=this.currentCtx.realtimeSpeed||0,o=this.currentCtx.fileSize;this.finishSize=this.getFinishSize(this.crc32Array,e),this.finishSize>this.lastFinishSize&&((t=new Date).getTime()-this.lastCalculateSpeedTime>1e3*this.realtimeSpeedInterval&&(r=t.getTime()-this.lastCalculateSpeedTime,e=this.finishSize-this.lastCalculateSpeedSize,n=Math.floor(e/r),this.lastCalculateSpeedTime=t.getTime(),this.lastCalculateSpeedSize=this.finishSize),this.lastFinishSize=this.finishSize);o=Math.floor(this.finishSize/o*100*100)/100||0,n=Upload_extends(this.currentCtx,{stage:"process",percent:o,realtimeSpeed:n});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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function FileMerge_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function FileMerge_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function FileMerge_setPrototypeOf(e,t){return(FileMerge_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function FileMerge_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=FileMerge_getPrototypeOf(r);return function FileMerge_possibleConstructorReturn(e,t){return!t||"object"!==FileMerge_typeof(t)&&"function"!=typeof t?function FileMerge_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var be=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}}),t&&FileMerge_setPrototypeOf(e,t)}(FileMerge,s.a);var n=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=n.call(this)).options=e,r.config=t,r.transport=new oe,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)}(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="",n=0;n<t.length;n++)r=(r?"".concat(r,","):"").concat(n+1,":").concat(t[n].crc32);var o=ee.urlTemplate(this.config.uploadMergeUrl,e),i=this.config.userId,e=FileMerge_extends(ee.arrayToObject(this.currFileCtx.UploadHeader),{"x-storage-mode":"gateway"});this.transport.send({method:"post",url:o,headers:FileMerge_objectSpread({authorization:this.currFileCtx.signature,"x-storage-u":i},e),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,n=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:n,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:fe},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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function DirectUpload_extends(){return(DirectUpload_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function DirectUpload_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function DirectUpload_setPrototypeOf(e,t){return(DirectUpload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function DirectUpload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=DirectUpload_getPrototypeOf(r);return function DirectUpload_possibleConstructorReturn(e,t){return!t||"object"!==DirectUpload_typeof(t)&&"function"!=typeof t?function DirectUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var we=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}}),t&&DirectUpload_setPrototypeOf(e,t)}(DirectUpload,s.a);var n=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=n.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)}(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._st=Date.now(),this.upload()}},{key:"upload",value:function upload(){for(var t=this,r=this.crc32Array.length,n=0,o=0,e=0;e<r;e++){var i=this.crc32Array[e],s=i.buffer,a=i.crc32,c=this.currentCtx.oid,u=this.currentCtx.signature,l={oid:"[object Array]"===Object.prototype.toString.call(c)?c[e]:c,tosDomain:this.currentCtx.tosDomain},i=ee.urlTemplate(this.config.directUploadFileUrl,l),c=this.config.userId,l=ee.arrayToObject(this.currentCtx.UploadHeader),c=new ge({sliceItem:s,crc32:a,url:i,signature:"[object Array]"===Object.prototype.toString.call(u)?u[e]:u,uploadHeader:l,userId:c,retryTime:this.retryUploadTime,method:"put"});c.on("complete",function(e){o+ ++n===r&&t.success(e.xhr)}),c.on("error",function(e){++o===r&&t.fail(e.xhr)}),c.on("progress",function(e){t.process(e)}),c.upload()}}},{key:"success",value:function success(e){this.finishArr=[];var t=Date.now()-this._st,t=this._uploadSize/t,e=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(e)}},{key:"fail",value:function fail(e){e=DirectUpload_extends(this.currentCtx,{extra:{message:"direct upload error",errorCode:ue},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;this.finishSize=e.loaded,this.finishSize>this.lastFinishSize&&(this.lastFinishSize=this.finishSize);e=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))}}]),DirectUpload}();function CommitUpload_typeof(e){return(CommitUpload_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function CommitUpload_extends(){return(CommitUpload_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function CommitUpload_ownKeys(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}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 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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function CommitUpload_setPrototypeOf(e,t){return(CommitUpload_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function CommitUpload_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=CommitUpload_getPrototypeOf(r);return function CommitUpload_possibleConstructorReturn(e,t){return!t||"object"!==CommitUpload_typeof(t)&&"function"!=typeof t?function CommitUpload_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xe=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}}),t&&CommitUpload_setPrototypeOf(e,t)}(CommitUpload,s.a);var n=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=n.call(this)).options=e,r.config=t,r.uploaderCtx=e.context,r.currFileCtx=e.context.tasks[e.key],r.isImageBatchUpload=!!r.options.isImageBatchUpload,r.transport=new oe,r.eventInit(),r}return function CommitUpload_createClass(e,t,r){t&&CommitUpload_defineProperties(e.prototype,t),r&&CommitUpload_defineProperties(e,r)}(CommitUpload,[{key:"commitUpload",value:function commitUpload(){var t,e,r=this.options.key,n=this.options.context.tasks[r],o=Q[this.config.region],i="",s={};this.options.type===N&&this.config.imageConfig&&this.config.imageConfig.serviceId?(i=this.config.imageHost||X[o],s={Action:"CommitImageUpload",Version:"2018-08-01",SessionKey:n.SessionKey},this.config.imageConfig&&this.config.imageConfig.serviceId?s.ServiceId=this.config.imageConfig.serviceId:s.SpaceName=this.config.videoConfig&&this.config.videoConfig.spaceName,e="imagex"):(c=this.config.videoConfig&&this.config.videoConfig.spaceName,this.options.type===q&&this.config.objectConfig&&this.config.objectConfig.spaceName&&(c=this.config.objectConfig.spaceName),i=this.config.videoHost||V[o],s={Action:"CommitUploadInfo",Version:"2021-01-01"},e="vod",t={SpaceName:c,SessionKey:n.SessionKey,Functions:[]},u=this.config.videoConfig&&this.config.videoConfig.processAction,this.options.type===q&&this.config.objectConfig&&this.config.objectConfig.processAction&&(u=this.config.objectConfig.processAction),Array.isArray(u)&&0<u.length&&(t.Functions=u),(this.config.videoConfig&&this.config.videoConfig.callbackArgs||this.options.callbackArgs)&&(t.CallbackArgs=this.options.callbackArgs||this.config.videoConfig.callbackArgs)),this.config.accountId&&(s["X-Account-Id"]=this.config.accountId);var a=ee.toQueryString(s),r=this.currFileCtx.proxyStsToken||this.config.stsToken,c=r.AccessKeyID,n=r.AccessKeyId,u=r.SecretAccessKey,r=r.SessionToken,o={method:"POST",url:"".concat(i,"?").concat(a),timeout:3e4,region:o,params:s,headers:{}};this.options.type===N&&this.config.imageConfig&&this.config.imageConfig.serviceId?(o.custom="none",o.headers["Content-Type"]="application/json"):(s=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]))):"".concat(e,"=").concat(t[e])}).join("&"),o.headers["Content-Type"]="application/x-www-form-urlencoded",o.body=s,o.custom=o.body),new ie.a(o,e,{isVolcengine:!0}).addAuthorization({accessKeyId:n||c,secretAccessKey:u,sessionToken:r},new Date),this.transport.send(o)}},{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 i=this;this.transport.on("complete",function(t){try{var e,r,n,o=JSON.parse(t.response);o.ResponseMetadata.Error?i.fail({xhr:t,errorCode:o.ResponseMetadata.Error.CodeN,error:o.ResponseMetadata.Error.Code,message:o.ResponseMetadata.Error.Message}):(e=o.Result,o={},i.options.type===N&&i.config.imageConfig&&i.config.imageConfig.serviceId?i.isImageBatchUpload?(r=e.Results,n=e.PluginResult||[],r.forEach(function(e,t){r[t]=CommitUpload_objectSpread(CommitUpload_objectSpread({},r[t]),n[t])}),o=r):CommitUpload_extends(o=e.Results[0],e.PluginResult&&e.PluginResult[0]):o=e.Data,o=CommitUpload_extends(i.currFileCtx,{stage:"complete",type:"success",percent:100,extra:{message:"upload successful"},uploadResult:o,xhr:t,stageStartTime:i._st,stageEndTime:Date.now(),duration:Date.now()-i._st,totalDuration:Date.now()-i._st+i.currFileCtx.totalDuration}),i.successProcess&&i.successProcess(o))}catch(e){i.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};!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),i.fail(t)})}},{key:"fail",value:function fail(e){var t=this.options.context,r=this.options.key,n=e.xhr,o=e.errorCode||pe,i="commit upload error: UNKNOWN";n&&(i=0===n.status?"commit upload error: NETERROR":e.message||"commit upload error: ".concat(n.status));n=CommitUpload_extends(t.tasks[r],{extra:{message:i,error:e.error,errorCode:o},type:"error",stage:"complete",xhr:n,stageStartTime:this._st,stageEndTime:Date.now(),duration:Date.now()-this._st,totalDuration:Date.now()-this._st+this.currFileCtx.totalDuration});this.failProcess(n)}}]),CommitUpload}();function Queue_typeof(e){return(Queue_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Queue_extends(){return(Queue_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function Queue_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Queue_setPrototypeOf(e,t){return(Queue_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function Queue_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=Queue_getPrototypeOf(r);return function Queue_possibleConstructorReturn(e,t){return!t||"object"!==Queue_typeof(t)&&"function"!=typeof t?function Queue_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ke=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}}),t&&Queue_setPrototypeOf(e,t)}(Queue,s.a);var i=Queue_createSuper(Queue);function Queue(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,o=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=o,t.uploaderCtx=n,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)}(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 n=this,o=r.key,i=this.uploaderCtx,e=i.tasks[o].cacheTask,s=i.taskList[o].length;e&&0<r.index&&r.index<e?this.start():(i.tasks[o].currentTask=r.index,1===i.tasks[o].status&&r&&r.func.call(r.context,r.arg,function(e){var t=i.taskList[o][r.index+1];t&&0!==r.index?i._saveTask(o,{currentTask:t.index,stage:t.stage}):r.index===s-1&&i._removeTaskCache(o),0<n.tasks.length?n.start():i._queueSuccess(o),n.success(e)},function(e){e.xhr&&400<=e.xhr.status?n.fail(e):n.taskError[o]?n.taskError[o]<n.retryTaskTime?(n.taskError[o]++,n.execTask(r)):(e.key=o,n.fail(e)):(n.taskError[o]=1,n.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.tasks[e.key].isBreak?r._cancel(e.key):r._pause(e.key),r.logger.send(e)}},{key:"cancel",value:function cancel(e){var t;e||(t=this.key,e=this.uploaderCtx.tasks[t].currentTask,e=this.uploaderCtx.taskList[t][e],this.tasks=[],e&&3===e.index&&e.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 _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function MainClass_extends(){return(MainClass_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function MainClass_defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function MainClass_setPrototypeOf(e,t){return(MainClass_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function MainClass_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=MainClass_getPrototypeOf(r);return function MainClass_possibleConstructorReturn(e,t){return!t||"object"!==MainClass_typeof(t)&&"function"!=typeof t?MainClass_assertThisInitialized(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Oe=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}}),t&&MainClass_setPrototypeOf(e,t)}(MainClass,s.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({},a),t._mergeOptions(t.config,e),t.tasks={},t.taskList={},t.cache={},t.storage=ee.storage(MainClass_assertThisInitialized(t)),t.logger=t.config.noLog?{send:function send(){}}:new $(t.config,MainClass_assertThisInitialized(t)),t}return function MainClass_createClass(e,t,r){t&&MainClass_defineProperties(e.prototype,t),r&&MainClass_defineProperties(e,r)}(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,n=this.taskList;r[e]&&r[e].task?n[e].push(t):(n[e]=[],n[e].push(t),r[e]=r[e]||{},r[e].task=new ke([],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===H||0===r)try{this.emit(e,t)}catch(e){r=!("[object Error]"!==Object.prototype.toString.call(e));if(!r||r&&"Error"===e.name)throw e}}},{key:"_addCrc32ProcessTask",value:function _addCrc32ProcessTask(e,t,r){var n=r.isDirect,r=r.isImageBatchUpload,r=new ne({file:e.file,context:this,key:t,isDirect:n,isImageBatchUpload:r},this.config),r={context:r,func:r.start,arg:{},key:t,index:0,stage:"crc32"};this._addTask(t,r)}},{key:"_addPreUploadTask",value:function _addPreUploadTask(e,t,r){r=r.isImageBatchUpload,r={file:e.file,stsToken:e.stsToken,context:this,type:e.type||z,preUploadUriParams:e.preUploadUriParams||{},storeKey:e.storeKey,key:t,isImageBatchUpload:r},r=new ye(r,this.config),r={context:r,func:r.start,arg:{},key:t,index:1,stage:"preUpload"};this._addTask(t,r)}},{key:"_addDirectUploadTask",value:function _addDirectUploadTask(e,t,r){r=r.isImageBatchUpload,r=new we({file:e.file,context:this,key:t,isImageBatchUpload:r},this.config),r={context:r,func:r.start,arg:{},key:t,index:3,stage:"process"};this._addTask(t,r)}},{key:"_addInitUploadIDTask",value:function _addInitUploadIDTask(e,t){e=new _e({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 ve({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 be({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]:{}).isImageBatchUpload,r=void 0!==r&&r,r={file:e.file,context:this,data:e.data,type:e.type||z,callbackArgs:e.callbackArgs,key:t,isImageBatchUpload:r},r=new xe(r,this.config),r={context:r,func:r.start,arg:{},key:t,index:5,stage:"complete"};this._addTask(t,r)}},{key:"_addAllUploadProcess",value:function _addAllUploadProcess(e,t){var r=e.type===N&&"[object Array]"===Object.prototype.toString.call(e.file);this.tasks[t]=this.tasks[t]||{},this.tasks[t].fileType=e.type||z,this.tasks[t].fileSize=e.file&&e.file.size,this.tasks[t].proxyStsToken=e.stsToken;var n=e.file.size<10485760||r;this._addCrc32ProcessTask(e,t,{isDirect:n,isImageBatchUpload:r}),this._addPreUploadTask(e,t,{isImageBatchUpload:r}),n?this._addDirectUploadTask(e,t,{isImageBatchUpload:r}):(this._addInitUploadIDTask(e,t),this._addUploadProcessTask(e,t),this._mergeFileTask(e,t)),this._getMetaInfoTask(e,t,{isImageBatchUpload:r})}},{key:"_run",value:function _run(e){var t=this.tasks,r=navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/);if(r&&r[1]&&Number(r[1])<=9)return 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]),void this._cancel(e);t[e]?t[e].status===W?this._restart(e):(r=new Date,t[e].startTime=r.getTime(),t[e].task&&t[e].status!==H&&t[e].task.tasks.length&&(t[e].status=H,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 n,o,i=this,e=this.tasks;e[r]?(n=e[r].task,o=e[r].currentTask||0,this.taskList[r].forEach(function(e,t){e.index===o&&(n.tasks=i.taskList[r].slice(t))}),n&&e[r].status!==H&&n.tasks.length&&(e[r].status=H,n.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=K,t[e].task.cancel(),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=W,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;t&&(delete e.task,delete e.xhr,delete e.crc32Array,this._setCache(t,JSON.stringify(e)))}},{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(n){var o=this,i=this.tasks;Object.keys(i).forEach(function(e){var t=i[e],r=MainClass_extends({},t,{proxyStsToken:n});t.proxyStsToken=n;e=r.crc32Key;e&&(delete r.task,delete r.xhr,delete r.crc32Array,t.proxyStsToken=n,o._setCache(e,JSON.stringify(r)))})}},{key:"_setOption",value:function _setOption(e){this._mergeOptions(this.config,e)}},{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}(),Ce={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 _typeof(e){return typeof e}:function _typeof(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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function entry_setPrototypeOf(e,t){return(entry_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function entry_createSuper(r){var n=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 Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var e,t=entry_getPrototypeOf(r);return function entry_possibleConstructorReturn(e,t){return!t||"object"!==entry_typeof(t)&&"function"!=typeof t?function entry_assertThisInitialized(e){if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(e):t}(this,n?(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:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Se=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}}),t&&entry_setPrototypeOf(e,t)}(TTUploader,Oe);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)}(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){if(!e||!Ce.checkStsToken(e.stsToken))return this.emit("error",{extra:{message:he,errorCode:se}}),null;if(e.file){var t=ee.getUnique("file");return this._addAllUploadProcess(e,t),t}return null}},{key:"addImageFile",value:function addImageFile(e){if(!e||!Ce.checkStsToken(e.stsToken))return this.emit("error",{extra:{message:he,errorCode:se}}),null;if(e.file){e.type=e.type||N;var t=ee.getUnique("file");return this._addAllUploadProcess(e,t),t}return null}},{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.17-alpha.0",
3
+ "version": "1.0.18-alpha.2",
4
4
  "description": "a upload component",
5
5
  "main": "dist/index.js",
6
6
  "typings": "./types/index.d.ts",