function TEST() { var t, r; t = "undefined" != typeof self && self, r = function() { return function(e) { var t = {}; function r(n) { var i; return (t[n] || (i = t[n] = { i: n, l: !1, exports: {} }, e[n].call(i.exports, i, i.exports, r), i.l = !0, i)).exports } return r.m = e, r.c = t, r.d = function(e, t, n) { r.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: n }) } , r.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 }) } , r.t = function(e, t) { if (1 & t && (e = r(e)), 8 & t || 4 & t && "object" == typeof e && e && e.__esModule) return e; var n = Object.create(null); if (r.r(n), Object.defineProperty(n, "default", { enumerable: !0, value: e }), 2 & t && "string" != typeof e) for (var i in e) r.d(n, i, (function(t) { return e[t] } ).bind(null, i)); return n } , r.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e } ; return r.d(t, "a", t), t } , r.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) } , r.p = "", r(r.s = 11) }([function(e, t, r) { "use strict"; var n = "object" == typeof Reflect ? Reflect : null , i = n && "function" == typeof n.apply ? n.apply : function(e, t, r) { return Function.prototype.apply.call(e, t, r) } , o = n && "function" == typeof n.ownKeys ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) { return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)) } : function(e) { return Object.getOwnPropertyNames(e) } , s = Number.isNaN || function(e) { return e != e } ; function a() { a.init.call(this) } e.exports = a, e.exports.once = function(e, t) { return new Promise(function(r, n) { var i, o, s; function a(r) { e.removeListener(t, c), n(r) } function c() { "function" == typeof e.removeListener && e.removeListener("error", a), r([].slice.call(arguments)) } y(e, t, c, { once: !0 }), "error" !== t && (i = e, o = a, s = { once: !0 }, "function" == typeof i.on && y(i, "error", o, s)) } ) } , (a.EventEmitter = a).prototype._events = void 0, a.prototype._eventsCount = 0, a.prototype._maxListeners = void 0; var c = 10; function u(e) { if ("function" != typeof e) throw TypeError('The "listener" argument must be of type Function. Received type ' + typeof e) } function l(e) { return void 0 === e._maxListeners ? a.defaultMaxListeners : e._maxListeners } function f(e, t, r, n) { var i, o, s; return u(r), void 0 === (i = e._events) ? (i = e._events = Object.create(null), e._eventsCount = 0) : (void 0 !== i.newListener && (e.emit("newListener", t, r.listener || r), i = e._events), o = i[t]), void 0 === o ? (o = i[t] = r, ++e._eventsCount) : ("function" == typeof o ? o = i[t] = n ? [r, o] : [o, r] : n ? o.unshift(r) : o.push(r), 0 < (i = l(e)) && o.length > i && !o.warned && (o.warned = !0, (n = Error("Possible EventEmitter memory leak detected. " + o.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit")).name = "MaxListenersExceededWarning", n.emitter = e, n.type = t, n.count = o.length, s = n, console && console.warn && console.warn(s))), e } function p(e, t, r) { return (t = (function() { 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 = { fired: !1, wrapFn: void 0, target: e, type: t, listener: r })).listener = r, e.wrapFn = t } function h(e, t, r) { var e = e._events; return void 0 === e || void 0 === (e = e[t]) ? [] : "function" == typeof e ? r ? [e.listener || e] : [e] : r ? function(e) { for (var t = Array(e.length), r = 0; r < t.length; ++r) t[r] = e[r].listener || e[r]; return t }(e) : g(e, e.length) } function d(e) { var t = this._events; if (void 0 !== t) { if ("function" == typeof (t = t[e])) return 1; if (void 0 !== t) return t.length } return 0 } function g(e, t) { for (var r = Array(t), n = 0; n < t; ++n) r[n] = e[n]; return r } function y(e, t, r, n) { if ("function" == typeof e.on) n.once ? e.once(t, r) : e.on(t, r); else { if ("function" != typeof e.addEventListener) throw TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof e); e.addEventListener(t, function i(o) { n.once && e.removeEventListener(t, i), r(o) }) } } Object.defineProperty(a, "defaultMaxListeners", { enumerable: !0, get: function() { return c }, set: function(e) { if ("number" != typeof e || e < 0 || s(e)) throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + e + "."); c = e } }), a.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 } , a.prototype.setMaxListeners = function(e) { if ("number" != typeof e || e < 0 || s(e)) throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + "."); return this._maxListeners = e, this } , a.prototype.getMaxListeners = function() { return l(this) } , a.prototype.emit = function(e) { for (var t = [], r = 1; r < arguments.length; r++) t.push(arguments[r]); var n = "error" === e , o = this._events; if (void 0 !== o) n = n && void 0 === o.error; else if (!n) return !1; if (n) { if ((s = 0 < t.length ? t[0] : s)instanceof Error) throw s; throw (n = Error("Unhandled error." + (s ? " (" + s.message + ")" : ""))).context = s, n } var s = o[e]; if (void 0 === s) return !1; if ("function" == typeof s) i(s, this, t); else for (var a = s.length, c = g(s, a), r = 0; r < a; ++r) i(c[r], this, t); return !0 } , a.prototype.on = a.prototype.addListener = function(e, t) { return f(this, e, t, !1) } , a.prototype.prependListener = function(e, t) { return f(this, e, t, !0) } , a.prototype.once = function(e, t) { return u(t), this.on(e, p(this, e, t)), this } , a.prototype.prependOnceListener = function(e, t) { return u(t), this.prependListener(e, p(this, e, t)), this } , a.prototype.off = a.prototype.removeListener = function(e, t) { var r, n, i, o, s; if (u(t), void 0 !== (n = this._events) && void 0 !== (r = n[e])) { 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 (i = -1, o = r.length - 1; 0 <= o; o--) if (r[o] === t || r[o].listener === t) { s = r[o].listener, i = o; break } if (i < 0) return this; 0 === i ? r.shift() : function(e, t) { for (; t + 1 < e.length; t++) e[t] = e[t + 1]; e.pop() }(r, i), 1 === r.length && (n[e] = r[0]), void 0 !== n.removeListener && this.emit("removeListener", e, s || t) } } return this } , a.prototype.removeAllListeners = function(e) { var t, r = this._events; if (void 0 !== r) { if (void 0 === r.removeListener) 0 == arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== r[e] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete r[e]); else if (0 == arguments.length) { for (var n, i = Object.keys(r), o = 0; o < i.length; ++o) "removeListener" !== (n = i[o]) && this.removeAllListeners(n); this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0 } else if ("function" == typeof (t = r[e])) this.removeListener(e, t); else if (void 0 !== t) for (o = t.length - 1; 0 <= o; o--) this.removeListener(e, t[o]) } return this } , a.prototype.listeners = function(e) { return h(this, e, !0) } , a.prototype.rawListeners = function(e) { return h(this, e, !1) } , a.listenerCount = function(e, t) { return "function" == typeof e.listenerCount ? e.listenerCount(t) : d.call(e, t) } , a.prototype.listenerCount = d, a.prototype.eventNames = function() { return 0 < this._eventsCount ? o(this._events) : [] } } , function(e, t, r) { (function(t) { e.exports = function(e) { "use strict"; var r, n = (r = e) && "object" == typeof r && "default"in r ? r : { default: r }; function i(e, t) { for (var r, n, i = 0; i < t.length; i++) { var o = t[i]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value"in o && (o.writable = !0), Object.defineProperty(e, (r = o.key, n = void 0, "symbol" == typeof (n = function(e, t) { if ("object" != typeof e || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 !== r) { var n = r.call(e, t || "default"); if ("object" != typeof n) return n; throw TypeError("@@toPrimitive must return a primitive value.") } return ("string" === t ? String : Number)(e) }(r, "string")) ? n : String(n)), o) } } var o = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {}; function s(e, t, r) { return e(r = { path: t, exports: {}, require: function(e, t) { return function() { throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs") }(null == t && r.path) } }, r.exports), r.exports } var a = s(function(e, t) { var r; e.exports = r || function(e, t) { if ("undefined" != typeof window && window.crypto && (r = window.crypto), "undefined" != typeof self && self.crypto && (r = self.crypto), "undefined" != typeof globalThis && globalThis.crypto && (r = globalThis.crypto), !r && "undefined" != typeof window && window.msCrypto && (r = window.msCrypto), !r && void 0 !== o && o.crypto && (r = o.crypto), !r) try { r = n.default } catch (e) {} var r, i = function() { if (r) { if ("function" == typeof r.getRandomValues) try { return r.getRandomValues(new Uint32Array(1))[0] } catch (e) {} if ("function" == typeof r.randomBytes) try { return r.randomBytes(4).readInt32LE() } catch (e) {} } throw Error("Native crypto module could not be used to get secure random number.") }, s = Object.create || function() { function e() {} return function(t) { var r; return e.prototype = t, r = new e, e.prototype = null, r } }(), a = {}, c = a.lib = {}, u = c.Base = { extend: function(e) { var t = s(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, t.$super = this, t }, create: function() { var e = this.extend(); return e.init.apply(e, arguments), e }, init: function() {}, mixIn: function(e) { for (var t in e) e.hasOwnProperty(t) && (this[t] = e[t]); e.hasOwnProperty("toString") && (this.toString = e.toString) }, clone: function() { return this.init.prototype.extend(this) } }, l = c.WordArray = u.extend({ init: function(e, t) { e = this.words = e || [], this.sigBytes = null != t ? t : 4 * e.length }, toString: function(e) { return (e || p).stringify(this) }, concat: function(e) { var t = this.words , r = e.words , n = this.sigBytes , i = e.sigBytes; if (this.clamp(), n % 4) for (var o = 0; o < i; o++) { var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255; t[n + o >>> 2] |= s << 24 - (n + o) % 4 * 8 } else for (var a = 0; a < i; a += 4) t[n + a >>> 2] = r[a >>> 2]; return this.sigBytes += i, this }, clamp: function() { var t = this.words , r = this.sigBytes; t[r >>> 2] &= 0xffffffff << 32 - r % 4 * 8, t.length = e.ceil(r / 4) }, clone: function() { var e = u.clone.call(this); return e.words = this.words.slice(0), e }, random: function(e) { for (var t = [], r = 0; r < e; r += 4) t.push(i()); return new l.init(t,e) } }), f = a.enc = {}, p = f.Hex = { stringify: function(e) { for (var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++) { var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 255; n.push((o >>> 4).toString(16)), n.push((15 & o).toString(16)) } return n.join("") }, parse: function(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) } }, h = f.Latin1 = { stringify: function(e) { for (var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++) { var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 255; n.push(String.fromCharCode(o)) } return n.join("") }, parse: function(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) } }, d = f.Utf8 = { stringify: function(e) { try { return decodeURIComponent(escape(h.stringify(e))) } catch (e) { throw Error("Malformed UTF-8 data") } }, parse: function(e) { return h.parse(unescape(encodeURIComponent(e))) } }, g = c.BufferedBlockAlgorithm = u.extend({ reset: function() { this._data = new l.init, this._nDataBytes = 0 }, _append: function(e) { "string" == typeof e && (e = d.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes }, _process: function(t) { var r, n = this._data, i = n.words, o = n.sigBytes, s = this.blockSize, a = o / (4 * s), c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * s, u = e.min(4 * c, o); if (c) { for (var f = 0; f < c; f += s) this._doProcessBlock(i, f); r = i.splice(0, c), n.sigBytes -= u } return new l.init(r,u) }, clone: function() { var e = u.clone.call(this); return e._data = this._data.clone(), e }, _minBufferSize: 0 }); c.Hasher = g.extend({ cfg: u.extend(), init: function(e) { this.cfg = this.cfg.extend(e), this.reset() }, reset: function() { g.reset.call(this), this._doReset() }, update: function(e) { return this._append(e), this._process(), this }, finalize: function(e) { return e && this._append(e), this._doFinalize() }, blockSize: 16, _createHelper: function(e) { return function(t, r) { return new e.init(r).finalize(t) } }, _createHmacHelper: function(e) { return function(t, r) { return new y.HMAC.init(e,r).finalize(t) } } }); var y = a.algo = {}; return a }(Math) }) , c = s(function(e, t) { var r, n, i, o, s, c, u, l, f; e.exports = (r = Math, i = (n = a.lib).WordArray, o = n.Hasher, s = a.algo, c = [], u = [], function() { function e(e) { return 0x100000000 * (e - (0 | e)) | 0 } for (var t = 2, n = 0; n < 64; ) (function(e) { for (var t = r.sqrt(e), n = 2; n <= t; n++) if (!(e % n)) return !1; return !0 } )(t) && (n < 8 && (c[n] = e(r.pow(t, .5))), u[n] = e(r.pow(t, 1 / 3)), n++), t++ }(), l = [], f = s.SHA256 = o.extend({ _doReset: function() { this._hash = new i.init(c.slice(0)) }, _doProcessBlock: function(e, t) { for (var r = this._hash.words, n = r[0], i = r[1], o = r[2], s = r[3], a = r[4], c = r[5], f = r[6], p = r[7], h = 0; h < 64; h++) { if (h < 16) l[h] = 0 | e[t + h]; else { var d = l[h - 15] , g = (d << 25 | d >>> 7) ^ (d << 14 | d >>> 18) ^ d >>> 3 , y = l[h - 2] , m = (y << 15 | y >>> 17) ^ (y << 13 | y >>> 19) ^ y >>> 10; l[h] = g + l[h - 7] + m + l[h - 16] } var v = n & i ^ n & o ^ i & o , b = (n << 30 | n >>> 2) ^ (n << 19 | n >>> 13) ^ (n << 10 | n >>> 22) , _ = p + ((a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25)) + (a & c ^ ~a & f) + u[h] + l[h]; p = f, f = c, c = a, a = s + _ | 0, s = o, o = i, i = n, n = _ + (b + v) | 0 } r[0] = r[0] + n | 0, r[1] = r[1] + i | 0, r[2] = r[2] + o | 0, r[3] = r[3] + s | 0, r[4] = r[4] + a | 0, r[5] = r[5] + c | 0, r[6] = r[6] + f | 0, r[7] = r[7] + p | 0 }, _doFinalize: function() { var e = this._data , t = e.words , n = 8 * this._nDataBytes , i = 8 * e.sigBytes; return t[i >>> 5] |= 128 << 24 - i % 32, t[14 + (i + 64 >>> 9 << 4)] = r.floor(n / 0x100000000), t[15 + (i + 64 >>> 9 << 4)] = n, e.sigBytes = 4 * t.length, this._process(), this._hash }, clone: function() { var e = o.clone.call(this); return e._hash = this._hash.clone(), e } }), a.SHA256 = o._createHelper(f), a.HmacSHA256 = o._createHmacHelper(f), a.SHA256) }) , u = (s(function(e, t) { var r, n; e.exports = (r = a.lib.Base, n = a.enc.Utf8, void (a.algo.HMAC = r.extend({ init: function(e, t) { e = this._hasher = new e.init, "string" == typeof t && (t = n.parse(t)); var r = e.blockSize , i = 4 * r; t.sigBytes > i && (t = e.finalize(t)), t.clamp(); for (var o = this._oKey = t.clone(), s = this._iKey = t.clone(), a = o.words, c = s.words, u = 0; u < r; u++) a[u] ^= 0x5c5c5c5c, c[u] ^= 0x36363636; o.sigBytes = s.sigBytes = i, this.reset() }, reset: function() { var e = this._hasher; e.reset(), e.update(this._iKey) }, update: function(e) { return this._hasher.update(e), this }, finalize: function(e) { var t = this._hasher , r = t.finalize(e); return t.reset(), t.finalize(this._oKey.clone().concat(r)) } }))) }), s(function(e, t) { e.exports = a.HmacSHA256 })) , l = { hmac: function(e, t) { return u(t, e) }, sha256: function(e) { return c(e) } } , f = ["authorization", "content-type", "content-length", "user-agent", "presigned-expires", "expect", "x-amzn-trace-id"] , p = function(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 "" } } , h = function(e) { return Object.keys(e).sort().map(function(t) { var r = e[t]; if (null != r) { var n = p(t); if (n) return Array.isArray(r) ? "".concat(n, "=").concat(r.map(p).sort().join("&".concat(n, "="))) : "".concat(n, "=").concat(p(r)) } }).filter(function(e) { return e }).join("&") }; return function() { var e, t; function r(e, t, n) { !function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, r), this.request = e, this.request.headers = e.headers || {}, this.serviceName = t, 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, this.shouldSerializeBody = "boolean" != typeof n.shouldSerializeBody || n.shouldSerializeBody } return e = [{ key: "addAuthorization", value: function(e, t) { var r = this.iso8601(t).replace(/[:\-]|\.\d{3}/g, ""); this.addHeaders(e, r), this.request.headers.Authorization = this.authorization(e, r) } }, { key: "addHeaders", value: function(e, t) { if (this.request.headers[this.constant.dateHeader] = t, e.sessionToken && (this.request.headers[this.constant.tokenHeader] = e.sessionToken), this.request.body) { var r = this.request.body; "string" != typeof r && this.shouldSerializeBody && (r = r instanceof URLSearchParams ? r.toString() : JSON.stringify(r)), this.request.headers[this.constant.contentSha256Header] = this.bodySha256 || l.sha256(r).toString() } } }, { key: "authorization", value: function(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(e, t) { var r = this.getSigningKey(e, t.substr(0, 8), this.request.region, this.serviceName, this.signatureCache); return l.hmac(r, this.stringToSign(t), "hex") } }, { key: "stringToSign", value: function(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() { var e = [] , t = this.request.pathname || "/"; return e.push(this.request.method.toUpperCase()), e.push(t), e.push(h(this.request.params) || ""), e.push("".concat(this.canonicalHeaders(), "\n")), e.push(this.signedHeaders()), e.push(this.hexEncodedBodyHash()), e.join("\n") } }, { key: "canonicalHeaders", value: function() { var e = this , t = []; Object.keys(this.request.headers).forEach(function(r) { t.push([r, e.request.headers[r]]) }), t.sort(function(e, t) { return e[0].toLowerCase() < t[0].toLowerCase() ? -1 : 1 }); var r = []; return t.forEach(function(t) { var n = t[0].toLowerCase(); if (e.isSignableHeader(n)) { var i = t[1]; if (null == i || "function" != typeof i.toString) throw Error("Header ".concat(n, " contains invalid value")); r.push("".concat(n, ":").concat(e.canonicalHeaderValues(i.toString()))) } }), r.join("\n") } }, { key: "canonicalHeaderValues", value: function(e) { return e.replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "") } }, { key: "signedHeaders", value: function() { var e = this , t = []; return Object.keys(this.request.headers).forEach(function(r) { r = r.toLowerCase(), e.isSignableHeader(r) && t.push(r) }), t.sort().join(";") } }, { key: "credentialString", value: function(e) { return this.createScope(e.substr(0, 8), this.request.region, this.serviceName) } }, { key: "hexEncodedHash", value: function(e) { return l.sha256(e) } }, { key: "hexEncodedBodyHash", value: function() { return this.request.headers[this.constant.contentSha256Header] ? this.request.headers[this.constant.contentSha256Header] : this.request.body ? this.hexEncodedHash(h(this.request.body)) : this.hexEncodedHash("") } }, { key: "isSignableHeader", value: function(e) { return 0 === e.toLowerCase().indexOf("x-amz-") || 0 > f.indexOf(e) } }, { key: "iso8601", value: function(e) { return void 0 === e && (e = new Date), e.toISOString().replace(/\.\d{3}Z$/, "Z") } }, { key: "getSigningKey", value: function(e, t, r, n) { var i = l.hmac("".concat(this.constant.kDatePrefix).concat(e.secretAccessKey), t) , o = l.hmac(i, r) , s = l.hmac(o, n); return l.hmac(s, this.constant.v4Identifier) } }, { key: "createScope", value: function(e, t, r) { return [e.substr(0, 8), t, r, this.constant.v4Identifier].join("/") } }], i(r.prototype, e), t && i(r, t), Object.defineProperty(r, "prototype", { writable: !1 }), r }() }(r(9)) } ).call(this, r(5)) } , function(e, t, r) { e.exports = function() { return r(10)('!function(t){var n={};function __webpack_require__(r){var e;return(n[r]||(e=n[r]={i:r,l:!1,exports:{}},t[r].call(e.exports,e,e.exports,__webpack_require__),e.l=!0,e)).exports}__webpack_require__.m=t,__webpack_require__.c=n,__webpack_require__.d=function(r,e,t){__webpack_require__.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:t})},__webpack_require__.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},__webpack_require__.t=function(e,r){if(1&r&&(e=__webpack_require__(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(__webpack_require__.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)__webpack_require__.d(t,n,function(r){return e[r]}.bind(null,n));return t},__webpack_require__.n=function(r){var e=r&&r.__esModule?function getDefault(){return r.default}:function getModuleExports(){return r};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=9)}([function(r,e,y){!function(_){r.exports=function(){var r=r||function(u,t){var r;if(typeof window!=="undefined"&&window.crypto)r=window.crypto;if(typeof self!=="undefined"&&self.crypto)r=self.crypto;if(typeof globalThis!=="undefined"&&globalThis.crypto)r=globalThis.crypto;if(!r&&typeof window!=="undefined"&&window.msCrypto)r=window.msCrypto;if(!r&&typeof _!=="undefined"&&_.crypto)r=_.crypto;if(!r&&"function"==="function")try{r=y(11)}catch(r){}var n=function(){if(r){if(typeof r.getRandomValues==="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch(r){}if(typeof r.randomBytes==="function")try{return r.randomBytes(4).readInt32LE()}catch(r){}}throw new Error("Native crypto module could not be used to get secure random number.")};var i=Object.create||function(){function F(){}return function(r){var e;F.prototype=r;e=new F;F.prototype=null;return e}}();var e={};var a=e.lib={};var o=a.Base=function(){return{extend:function(r){var e=i(this);if(r)e.mixIn(r);if(!e.hasOwnProperty("init")||this.init===e.init)e.init=function(){e.$super.init.apply(this,arguments)};e.init.prototype=e;e.$super=this;return e},create:function(){var r=this.extend();r.init.apply(r,arguments);return r},init:function(){},mixIn:function(r){for(var e in r)if(r.hasOwnProperty(e))this[e]=r[e];if(r.hasOwnProperty("toString"))this.toString=r.toString},clone:function(){return this.init.prototype.extend(this)}}}();var h=a.WordArray=o.extend({init:function(r,e){r=this.words=r||[];if(e!=t)this.sigBytes=e;else this.sigBytes=r.length*4},toString:function(r){return(r||s).stringify(this)},concat:function(r){var e=this.words;var t=r.words;var n=this.sigBytes;var i=r.sigBytes;this.clamp();if(n%4)for(var a=0;a>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var c=0;c>>2]=t[c>>>2];this.sigBytes+=i;return this},clamp:function(){var r=this.words;var e=this.sigBytes;r[e>>>2]&=4294967295<<32-e%4*8;r.length=u.ceil(e/4)},clone:function(){var r=o.clone.call(this);r.words=this.words.slice(0);return r},random:function(r){var e=[];for(var t=0;t>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16));n.push((a&15).toString(16))}return n.join("")},parse:function(r){var e=r.length;var t=[];for(var n=0;n>>3]|=parseInt(r.substr(n,2),16)<<24-n%8*4;return new h.init(t,e/2)}};var f=c.Latin1={stringify:function(r){var e=r.words;var t=r.sigBytes;var n=[];for(var i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(r){var e=r.length;var t=[];for(var n=0;n>>2]|=(r.charCodeAt(n)&255)<<24-n%4*8;return new h.init(t,e)}};var v=c.Utf8={stringify:function(r){try{return decodeURIComponent(escape(f.stringify(r)))}catch(r){throw new Error("Malformed UTF-8 data")}},parse:function(r){return f.parse(unescape(encodeURIComponent(r)))}};var p=a.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new h.init;this._nDataBytes=0},_append:function(r){if(typeof r=="string")r=v.parse(r);this._data.concat(r);this._nDataBytes+=r.sigBytes},_process:function(r){var e;var t=this._data;var n=t.words;var i=t.sigBytes;var a=this.blockSize;var o=a*4;var c=i/o;if(r)c=u.ceil(c);else c=u.max((c|0)-this._minBufferSize,0);var s=c*a;var f=u.min(s*4,i);if(s){for(var v=0;v>>2]&255;r.sigBytes-=e}};var g=e.BlockCipher=u.extend({cfg:u.cfg.extend({mode:d,padding:y}),reset:function(){var r;u.reset.call(this);var e=this.cfg;var t=e.iv;var n=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)r=n.createEncryptor;else{r=n.createDecryptor;this._minBufferSize=1}if(this._mode&&this._mode.__creator==r)this._mode.init(this,t&&t.words);else{this._mode=r.call(n,this,t&&t.words);this._mode.__creator=r}},_doProcessBlock:function(r,e){this._mode.processBlock(r,e)},_doFinalize:function(){var r;var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);r=this._process(!!"flush")}else{r=this._process(!!"flush");e.unpad(r)}return r},blockSize:128/32});var w=e.CipherParams=t.extend({init:function(r){this.mixIn(r)},toString:function(r){return(r||this.formatter).stringify(this)}});var k=r.format={};var B=k.OpenSSL={stringify:function(r){var e;var t=r.ciphertext;var n=r.salt;if(n)e=s.create([1398893684,1701076831]).concat(n).concat(t);else e=t;return e.toString(c)},parse:function(r){var e;var t=c.parse(r);var n=t.words;if(n[0]==1398893684&&n[1]==1701076831){e=s.create(n.slice(2,4));n.splice(0,4);t.sigBytes-=16}return w.create({ciphertext:t,salt:e})}};var m=e.SerializableCipher=t.extend({cfg:t.extend({format:B}),encrypt:function(r,e,t,n){n=this.cfg.extend(n);var i=r.createEncryptor(t,n);var a=i.finalize(e);var o=i.cfg;return w.create({ciphertext:a,key:t,iv:o.iv,algorithm:r,mode:o.mode,padding:o.padding,blockSize:r.blockSize,formatter:n.format})},decrypt:function(r,e,t,n){n=this.cfg.extend(n);e=this._parse(e,n.format);var i=r.createDecryptor(t,n).finalize(e.ciphertext);return i},_parse:function(r,e){if(typeof r=="string")return e.parse(r,this);else return r}});var x=r.kdf={};var b=x.OpenSSL={execute:function(r,e,t,n,i){if(!n)n=s.random(64/8);if(!i)var a=v.create({keySize:e+t}).compute(r,n);else var a=v.create({keySize:e+t,hasher:i}).compute(r,n);var o=s.create(a.words.slice(e),t*4);a.sigBytes=e*4;return w.create({key:a,iv:o,salt:n})}};var S=e.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:b}),encrypt:function(r,e,t,n){n=this.cfg.extend(n);var i=n.kdf.execute(t,r.keySize,r.ivSize,n.salt,n.hasher);n.iv=i.iv;var a=m.encrypt.call(this,r,e,i.key,n);a.mixIn(i);return a},decrypt:function(r,e,t,n){n=this.cfg.extend(n);e=this._parse(e,n.format);var i=n.kdf.execute(t,r.keySize,r.ivSize,e.salt,n.hasher);n.iv=i.iv;var a=m.decrypt.call(this,r,e,i.key,n);return a}})}()}(t(0),t(5))},function(r,e,t){r.exports=function(a){return function(){var r=a;var e=r.lib;var t=e.BlockCipher;var n=r.algo;var v=[];var f=[];var u=[];var h=[];var p=[];var l=[];var d=[];var _=[];var y=[];var g=[];(function(){var r=[];for(var e=0;e<256;e++)if(e<128)r[e]=e<<1;else r[e]=e<<1^283;var t=0;var n=0;for(var e=0;e<256;e++){var i=n^n<<1^n<<2^n<<3^n<<4;i=i>>>8^i&255^99;v[t]=i;f[i]=t;var a=r[t];var o=r[a];var c=r[o];var s=r[i]*257^i*16843008;u[t]=s<<24|s>>>8;h[t]=s<<16|s>>>16;p[t]=s<<8|s>>>24;l[t]=s;var s=c*16843009^o*65537^a*257^t*16843008;d[i]=s<<24|s>>>8;_[i]=s<<16|s>>>16;y[i]=s<<8|s>>>24;g[i]=s;if(!t)t=n=1;else{t=a^r[r[r[c^a]]];n^=r[r[n]]}}})();var w=[0,1,2,4,8,16,32,64,128,27,54];var i=n.AES=t.extend({_doReset:function(){var r;if(this._nRounds&&this._keyPriorReset===this._key)return;var e=this._keyPriorReset=this._key;var t=e.words;var n=e.sigBytes/4;var i=this._nRounds=n+6;var a=(i+1)*4;var o=this._keySchedule=[];for(var c=0;c>>24;r=v[r>>>24]<<24|v[r>>>16&255]<<16|v[r>>>8&255]<<8|v[r&255];r^=w[c/n|0]<<24}else if(n>6&&c%n==4)r=v[r>>>24]<<24|v[r>>>16&255]<<16|v[r>>>8&255]<<8|v[r&255];o[c]=o[c-n]^r}var s=this._invKeySchedule=[];for(var f=0;f>>24]]^_[v[r>>>16&255]]^y[v[r>>>8&255]]^g[v[r&255]]}},encryptBlock:function(r,e){this._doCryptBlock(r,e,this._keySchedule,u,h,p,l,v)},decryptBlock:function(r,e){var t=r[e+1];r[e+1]=r[e+3];r[e+3]=t;this._doCryptBlock(r,e,this._invKeySchedule,d,_,y,g,f);var t=r[e+1];r[e+1]=r[e+3];r[e+3]=t},_doCryptBlock:function(r,e,t,n,i,a,o,c){var s=this._nRounds;var f=r[e]^t[0];var v=r[e+1]^t[1];var u=r[e+2]^t[2];var h=r[e+3]^t[3];var p=4;for(var l=1;l>>24]^i[v>>>16&255]^a[u>>>8&255]^o[h&255]^t[p++];var _=n[v>>>24]^i[u>>>16&255]^a[h>>>8&255]^o[f&255]^t[p++];var y=n[u>>>24]^i[h>>>16&255]^a[f>>>8&255]^o[v&255]^t[p++];var g=n[h>>>24]^i[f>>>16&255]^a[v>>>8&255]^o[u&255]^t[p++];f=d;v=_;u=y;h=g}var d=(c[f>>>24]<<24|c[v>>>16&255]<<16|c[u>>>8&255]<<8|c[h&255])^t[p++];var _=(c[v>>>24]<<24|c[u>>>16&255]<<16|c[h>>>8&255]<<8|c[f&255])^t[p++];var y=(c[u>>>24]<<24|c[h>>>16&255]<<16|c[f>>>8&255]<<8|c[v&255])^t[p++];var g=(c[h>>>24]<<24|c[f>>>16&255]<<16|c[v>>>8&255]<<8|c[u&255])^t[p++];r[e]=d;r[e+1]=_;r[e+2]=y;r[e+3]=g},keySize:256/32});r.AES=t._createHelper(i)}(),a.AES}(t(0),(t(12),t(13),t(5),t(1)))},function(r,e,t){r.exports=function(e){return e.mode.ECB=function(){var r=e.lib.BlockCipherMode.extend();r.Encryptor=r.extend({processBlock:function(r,e){this._cipher.encryptBlock(r,e)}});r.Decryptor=r.extend({processBlock:function(r,e){this._cipher.decryptBlock(r,e)}});return r}(),e.mode.ECB}(t(0),t(1))},function(r,e,t){r.exports=function(r){return r.enc.Utf8}(t(0))},function(r,e,t){r.exports=function(o){return function(){var r=o;var e=r.lib;var t=e.Base;var v=e.WordArray;var n=r.algo;var i=n.MD5;var a=n.EvpKDF=t.extend({cfg:t.extend({keySize:128/32,hasher:i,iterations:1}),init:function(r){this.cfg=this.cfg.extend(r)},compute:function(r,e){var t;var n=this.cfg;var i=n.hasher.create();var a=v.create();var o=a.words;var c=n.keySize;var s=n.iterations;while(o.length>>2]|=r[n]<<24-n%4*8;i.call(this,t,e)}else i.apply(this,arguments)};n.prototype=t}(),a.lib.WordArray}(t(0))},function(r,e,t){"use strict";t.r(e);var e=t(2),o=t.n(e),e=t(3),c=t.n(e),e=t(6),s=t.n(e),e=t(7),f=t.n(e),e=t(8),v=t.n(e),e=t(4),u=t.n(e);function crc32(r,e){for(var t=[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],n=("undefined"!=typeof Int32Array&&(t=new Int32Array(t)),-1^~~e),i=(r=new Uint8Array(r)).length,a=0;a>>8;return(-1^n)>>>0}function dec2hex(r){if(void 0!==r)return function toEight(r){return r.length<8?toEight(r="0".concat(r)):r}(Number(r).toString(16))}self.onmessage=function(r){var r=r.data,e=r[0],t=r[1],n=r[2],i=r[3],a=r[4],r=r[5];i?(i=v.a.create(e),i=crc32(r=function wordArrayToUint8Array(r){for(var e=r.sigBytes,t=r.words,n=new Uint8Array(e),i=0,a=0;i!==e;){var o=t[a++];if(n[i++]=(4278190080&o)>>>24,i===e)break;if(n[i++]=(16711680&o)>>>16,i===e)break;if(n[i++]=(65280&o)>>>8,i===e)break;n[i++]=255&o}return n}((r&&e.byteLength%16!=0?o.a.encrypt(i,u.a.parse(a),{mode:c.a,padding:s.a}):o.a.encrypt(i,u.a.parse(a),{mode:c.a,padding:f.a})).ciphertext),0),postMessage([r.buffer,dec2hex(i),t,n],[r.buffer])):(a=crc32(e,0),postMessage([e,dec2hex(a),t,n],[e]))}},function(r,e){var t=function(){return this}();try{t=t||new Function("return this")()}catch(r){"object"==typeof window&&(t=window)}r.exports=t},function(r,e){},function(r,e,t){r.exports=function(i){return function(){var r=i;var e=r.lib;var f=e.WordArray;var t=r.enc;var n=t.Base64={stringify:function(r){var e=r.words;var t=r.sigBytes;var n=this._map;r.clamp();var i=[];for(var a=0;a>>2]>>>24-a%4*8&255;var c=e[a+1>>>2]>>>24-(a+1)%4*8&255;var s=e[a+2>>>2]>>>24-(a+2)%4*8&255;var f=o<<16|c<<8|s;for(var v=0;v<4&&a+v*.75>>6*(3-v)&63))}var u=n.charAt(64);if(u)while(i.length%4)i.push(u);return i.join("")},parse:function(r){var e=r.length;var t=this._map;var n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i>>6-a%4*2;var s=o|c;n[i>>>2]|=s<<24-i%4*8;i++}return f.create(n,i)}}(),i.enc.Base64}(t(0))},function(r,e,t){r.exports=function(o){return function(v){var r=o;var e=r.lib;var t=e.WordArray;var n=e.Hasher;var i=r.algo;var F=[];(function(){for(var r=0;r<64;r++)F[r]=v.abs(v.sin(r+1))*4294967296|0})();var a=i.MD5=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(r,e){for(var t=0;t<16;t++){var n=e+t;var i=r[n];r[n]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360}var a=this._hash.words;var o=r[e+0];var c=r[e+1];var s=r[e+2];var f=r[e+3];var v=r[e+4];var u=r[e+5];var h=r[e+6];var p=r[e+7];var l=r[e+8];var d=r[e+9];var _=r[e+10];var y=r[e+11];var g=r[e+12];var w=r[e+13];var k=r[e+14];var B=r[e+15];var m=a[0];var x=a[1];var b=a[2];var S=a[3];m=FF(m,x,b,S,o,7,F[0]);S=FF(S,m,x,b,c,12,F[1]);b=FF(b,S,m,x,s,17,F[2]);x=FF(x,b,S,m,f,22,F[3]);m=FF(m,x,b,S,v,7,F[4]);S=FF(S,m,x,b,u,12,F[5]);b=FF(b,S,m,x,h,17,F[6]);x=FF(x,b,S,m,p,22,F[7]);m=FF(m,x,b,S,l,7,F[8]);S=FF(S,m,x,b,d,12,F[9]);b=FF(b,S,m,x,_,17,F[10]);x=FF(x,b,S,m,y,22,F[11]);m=FF(m,x,b,S,g,7,F[12]);S=FF(S,m,x,b,w,12,F[13]);b=FF(b,S,m,x,k,17,F[14]);x=FF(x,b,S,m,B,22,F[15]);m=GG(m,x,b,S,c,5,F[16]);S=GG(S,m,x,b,h,9,F[17]);b=GG(b,S,m,x,y,14,F[18]);x=GG(x,b,S,m,o,20,F[19]);m=GG(m,x,b,S,u,5,F[20]);S=GG(S,m,x,b,_,9,F[21]);b=GG(b,S,m,x,B,14,F[22]);x=GG(x,b,S,m,v,20,F[23]);m=GG(m,x,b,S,d,5,F[24]);S=GG(S,m,x,b,k,9,F[25]);b=GG(b,S,m,x,f,14,F[26]);x=GG(x,b,S,m,l,20,F[27]);m=GG(m,x,b,S,w,5,F[28]);S=GG(S,m,x,b,s,9,F[29]);b=GG(b,S,m,x,p,14,F[30]);x=GG(x,b,S,m,g,20,F[31]);m=HH(m,x,b,S,u,4,F[32]);S=HH(S,m,x,b,l,11,F[33]);b=HH(b,S,m,x,y,16,F[34]);x=HH(x,b,S,m,k,23,F[35]);m=HH(m,x,b,S,c,4,F[36]);S=HH(S,m,x,b,v,11,F[37]);b=HH(b,S,m,x,p,16,F[38]);x=HH(x,b,S,m,_,23,F[39]);m=HH(m,x,b,S,w,4,F[40]);S=HH(S,m,x,b,o,11,F[41]);b=HH(b,S,m,x,f,16,F[42]);x=HH(x,b,S,m,h,23,F[43]);m=HH(m,x,b,S,d,4,F[44]);S=HH(S,m,x,b,g,11,F[45]);b=HH(b,S,m,x,B,16,F[46]);x=HH(x,b,S,m,s,23,F[47]);m=II(m,x,b,S,o,6,F[48]);S=II(S,m,x,b,p,10,F[49]);b=II(b,S,m,x,k,15,F[50]);x=II(x,b,S,m,u,21,F[51]);m=II(m,x,b,S,g,6,F[52]);S=II(S,m,x,b,f,10,F[53]);b=II(b,S,m,x,_,15,F[54]);x=II(x,b,S,m,c,21,F[55]);m=II(m,x,b,S,l,6,F[56]);S=II(S,m,x,b,B,10,F[57]);b=II(b,S,m,x,h,15,F[58]);x=II(x,b,S,m,w,21,F[59]);m=II(m,x,b,S,v,6,F[60]);S=II(S,m,x,b,y,10,F[61]);b=II(b,S,m,x,s,15,F[62]);x=II(x,b,S,m,d,21,F[63]);a[0]=a[0]+m|0;a[1]=a[1]+x|0;a[2]=a[2]+b|0;a[3]=a[3]+S|0},_doFinalize:function(){var r=this._data;var e=r.words;var t=this._nDataBytes*8;var n=r.sigBytes*8;e[n>>>5]|=128<<24-n%32;var i=v.floor(t/4294967296);var a=t;e[(n+64>>>9<<4)+15]=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360;e[(n+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;r.sigBytes=(e.length+1)*4;this._process();var o=this._hash;var c=o.words;for(var s=0;s<4;s++){var f=c[s];c[s]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}return o},clone:function(){var r=n.clone.call(this);r._hash=this._hash.clone();return r}});function FF(r,e,t,n,i,a,o){var c=r+(e&t|~e&n)+i+o;return(c<>>32-a)+e}function GG(r,e,t,n,i,a,o){var c=r+(e&n|t&~n)+i+o;return(c<>>32-a)+e}function HH(r,e,t,n,i,a,o){var c=r+(e^t^n)+i+o;return(c<>>32-a)+e}function II(r,e,t,n,i,a,o){var c=r+(t^(e|~n))+i+o;return(c<>>32-a)+e}r.MD5=n._createHelper(a);r.HmacMD5=n._createHmacHelper(a)}(Math),o.MD5}(t(0))},function(r,e,t){r.exports=function(o){return function(){var r=o;var e=r.lib;var t=e.WordArray;var n=e.Hasher;var i=r.algo;var u=[];var a=i.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(r,e){var t=this._hash.words;var n=t[0];var i=t[1];var a=t[2];var o=t[3];var c=t[4];for(var s=0;s<80;s++){if(s<16)u[s]=r[e+s]|0;else{var f=u[s-3]^u[s-8]^u[s-14]^u[s-16];u[s]=f<<1|f>>>31}var v=(n<<5|n>>>27)+c+u[s];if(s<20)v+=(i&a|~i&o)+1518500249;else if(s<40)v+=(i^a^o)+1859775393;else if(s<60)v+=(i&a|i&o|a&o)-1894007588;else v+=(i^a^o)-899497514;c=o;o=a;a=i<<30|i>>>2;i=n;n=v}t[0]=t[0]+n|0;t[1]=t[1]+i|0;t[2]=t[2]+a|0;t[3]=t[3]+o|0;t[4]=t[4]+c|0},_doFinalize:function(){var r=this._data;var e=r.words;var t=this._nDataBytes*8;var n=r.sigBytes*8;e[n>>>5]|=128<<24-n%32;e[(n+64>>>9<<4)+14]=Math.floor(t/4294967296);e[(n+64>>>9<<4)+15]=t;r.sigBytes=e.length*4;this._process();return this._hash},clone:function(){var r=n.clone.call(this);r._hash=this._hash.clone();return r}});r.SHA1=n._createHelper(a);r.HmacSHA1=n._createHmacHelper(a)}(),o.SHA1}(t(0))},function(r,e,t){r.exports=function(o){(function(){var r=o;var e=r.lib;var t=e.Base;var n=r.enc;var f=n.Utf8;var i=r.algo;var a=i.HMAC=t.extend({init:function(r,e){r=this._hasher=new r.init;if(typeof e=="string")e=f.parse(e);var t=r.blockSize;var n=t*4;if(e.sigBytes>n)e=r.finalize(e);e.clamp();var i=this._oKey=e.clone();var a=this._iKey=e.clone();var o=i.words;var c=a.words;for(var s=0;s>> 2] >>> 24 - o % 4 * 8 & 255; t[n + o >>> 2] |= s << 24 - (n + o) % 4 * 8 } else for (var a = 0; a < i; a += 4) t[n + a >>> 2] = r[a >>> 2]; return this.sigBytes += i, this }, clamp: function() { var t = this.words , r = this.sigBytes; t[r >>> 2] &= 0xffffffff << 32 - r % 4 * 8, t.length = e.ceil(r / 4) }, clone: function() { var e = u.clone.call(this); return e.words = this.words.slice(0), e }, random: function(e) { for (var t = [], r = 0; r < e; r += 4) t.push(o()); return new l.init(t,e) } }), f = a.enc = {}, p = f.Hex = { stringify: function(e) { for (var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++) { var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 255; n.push((o >>> 4).toString(16)), n.push((15 & o).toString(16)) } return n.join("") }, parse: function(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) } }, h = f.Latin1 = { stringify: function(e) { for (var t = e.words, r = e.sigBytes, n = [], i = 0; i < r; i++) { var o = t[i >>> 2] >>> 24 - i % 4 * 8 & 255; n.push(String.fromCharCode(o)) } return n.join("") }, parse: function(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) } }, d = f.Utf8 = { stringify: function(e) { try { return decodeURIComponent(escape(h.stringify(e))) } catch (e) { throw Error("Malformed UTF-8 data") } }, parse: function(e) { return h.parse(unescape(encodeURIComponent(e))) } }, g = c.BufferedBlockAlgorithm = u.extend({ reset: function() { this._data = new l.init, this._nDataBytes = 0 }, _append: function(e) { "string" == typeof e && (e = d.parse(e)), this._data.concat(e), this._nDataBytes += e.sigBytes }, _process: function(t) { var r, n = this._data, i = n.words, o = n.sigBytes, s = this.blockSize, a = o / (4 * s), c = (a = t ? e.ceil(a) : e.max((0 | a) - this._minBufferSize, 0)) * s, u = e.min(4 * c, o); if (c) { for (var f = 0; f < c; f += s) this._doProcessBlock(i, f); r = i.splice(0, c), n.sigBytes -= u } return new l.init(r,u) }, clone: function() { var e = u.clone.call(this); return e._data = this._data.clone(), e }, _minBufferSize: 0 }); c.Hasher = g.extend({ cfg: u.extend(), init: function(e) { this.cfg = this.cfg.extend(e), this.reset() }, reset: function() { g.reset.call(this), this._doReset() }, update: function(e) { return this._append(e), this._process(), this }, finalize: function(e) { return e && this._append(e), this._doFinalize() }, blockSize: 16, _createHelper: function(e) { return function(t, r) { return new e.init(r).finalize(t) } }, _createHmacHelper: function(e) { return function(t, r) { return new y.HMAC.init(e,r).finalize(t) } } }); var y = a.algo = {}; return a }(Math) } ).call(this, r(5)) } , function(e, t, r) { var n; e.exports = (n = r(3), function(e) { var t = n.lib , r = t.WordArray , i = t.Hasher , o = n.algo , s = [] , a = []; (function() { function t(e) { return (e - (0 | e)) * 0x100000000 | 0 } for (var r = 2, n = 0; n < 64; ) (function(t) { for (var r = e.sqrt(t), n = 2; n <= r; n++) if (!(t % n)) return !1; return !0 } )(r) && (n < 8 && (s[n] = t(e.pow(r, .5))), a[n] = t(e.pow(r, 1 / 3)), n++), r++ } )(); var c = [] , u = o.SHA256 = i.extend({ _doReset: function() { this._hash = new r.init(s.slice(0)) }, _doProcessBlock: function(e, t) { for (var r = this._hash.words, n = r[0], i = r[1], o = r[2], s = r[3], u = r[4], l = r[5], f = r[6], p = r[7], h = 0; h < 64; h++) { if (h < 16) c[h] = 0 | e[t + h]; else { var d = c[h - 15] , g = (d << 25 | d >>> 7) ^ (d << 14 | d >>> 18) ^ d >>> 3 , y = c[h - 2] , m = (y << 15 | y >>> 17) ^ (y << 13 | y >>> 19) ^ y >>> 10; c[h] = g + c[h - 7] + m + c[h - 16] } var v = u & l ^ ~u & f , b = n & i ^ n & o ^ i & o , _ = (n << 30 | n >>> 2) ^ (n << 19 | n >>> 13) ^ (n << 10 | n >>> 22) , S = p + ((u << 26 | u >>> 6) ^ (u << 21 | u >>> 11) ^ (u << 7 | u >>> 25)) + v + a[h] + c[h] , x = _ + b; p = f, f = l, l = u, u = s + S | 0, s = o, o = i, i = n, n = S + x | 0 } r[0] = r[0] + n | 0, r[1] = r[1] + i | 0, r[2] = r[2] + o | 0, r[3] = r[3] + s | 0, r[4] = r[4] + u | 0, r[5] = r[5] + l | 0, r[6] = r[6] + f | 0, r[7] = r[7] + p | 0 }, _doFinalize: function() { var t = this._data , r = t.words , n = 8 * this._nDataBytes , i = 8 * t.sigBytes; return r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = e.floor(n / 0x100000000), r[(i + 64 >>> 9 << 4) + 15] = n, t.sigBytes = 4 * r.length, this._process(), this._hash }, clone: function() { var e = i.clone.call(this); return e._hash = this._hash.clone(), e } }); n.SHA256 = i._createHelper(u), n.HmacSHA256 = i._createHmacHelper(u) }(Math), n.SHA256) } , function(e, t) { var r = function() { return this }(); try { r = r || Function("return this")() } catch (e) { "object" == typeof window && (r = window) } e.exports = r } , function(e, t, r) { var n; e.exports = (n = r(3), r(4), r(8), n.HmacSHA256) } , function(e, t) {} , function(e, t, r) { var n, i, o; e.exports = void (i = (n = r(3)).lib.Base, o = n.enc.Utf8, n.algo.HMAC = i.extend({ init: function(e, t) { e = this._hasher = new e.init, "string" == typeof t && (t = o.parse(t)); var r = e.blockSize , n = 4 * r; t.sigBytes > n && (t = e.finalize(t)), t.clamp(); for (var i = this._oKey = t.clone(), s = this._iKey = t.clone(), a = i.words, c = s.words, u = 0; u < r; u++) a[u] ^= 0x5c5c5c5c, c[u] ^= 0x36363636; i.sigBytes = s.sigBytes = n, this.reset() }, reset: function() { var e = this._hasher; e.reset(), e.update(this._iKey) }, update: function(e) { return this._hasher.update(e), this }, finalize: function(e) { var t = this._hasher , r = t.finalize(e); return t.reset(), t.finalize(this._oKey.clone().concat(r)) } })) } , function(e, t) {} , function(e, t, r) { "use strict"; var n = window.URL || window.webkitURL; e.exports = function(e, t) { try { try { var r; try { (r = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder)).append(e), r = r.getBlob() } catch (t) { r = new Blob([e]) } return new Worker(n.createObjectURL(r)) } catch (t) { return new Worker("data:application/javascript," + encodeURIComponent(e)) } } catch (e) { if (t) return new Worker(t); throw Error("Inline worker is not supported") } } } , function(e, t, r) { "use strict"; r.r(t), r.d(t, "default", function() { return t7 }); var t = r(0) , n = r.n(t) , i = "{tosDomain}/upload/v1/{oid}?uploadid={uploadId}&part_number={part_number}&phase=transfer" , o = "{tosDomain}/upload/v1/{oid}" , s = { debug: !1, region: "cn-north-1", external: {}, getSliceFunc: null, uploadSliceCount: 3, retryUploadTime: 2, retryProcess: !0, retryProcessTime: 3, retryTaskTime: 2, progressMonitorTime: 1e4, progressMonitorSpeed: 50, schema: "https", enableDiskBreakpoint: !0, gatewayTimeout: 3e4, uploadTimeout: 18e5, realtimeSpeedInterval: 3e3, replace: {} } , a = function() { return (a = Object.assign || function(e) { for (var t, r = 1, n = arguments.length; r < n; r++) for (var i in t = arguments[r]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); return e } ).apply(this, arguments) }; function c() { for (var e = [], t = 0; t < arguments.length; t++) e = e.concat(function(e, t) { var r = "function" == typeof Symbol && e[Symbol.iterator]; if (!r) return e; var n, i, o = r.call(e), s = []; try { for (; (void 0 === t || 0 < t--) && !(n = o.next()).done; ) s.push(n.value) } catch (e) { i = { error: e } } finally { try { n && !n.done && (r = o.return) && r.call(o) } finally { if (i) throw i.error } } return s }(arguments[t])); return e } function u(e) { return null != e && "[object Object]" == Object.prototype.toString.call(e) } function l(e) { return function(e) { if ("string" == typeof e) { for (var t = [], r = e.split("z"), n = 0; n < r.length; n++) { var i = 64 ^ +parseInt(r[n], 25) , i = String.fromCharCode(i); t.push(i) } return t.join("") } }(e) } function f(e) { var t = document.createElement("a"); return t.href = e, t } function p(e) { var t = {}; try { var r = f(e).search; if (!r) return t; (r = r.slice(1)).split("&").forEach(function(e) { var r, n, i = e.split("="); i.length && (r = i[0], n = i[1]); try { t[r] = decodeURIComponent(void 0 === n ? "" : n) } catch (e) { t[r] = n } }) } catch (e) {} return t } function h(e) { for (var t = 0, r = 0, n = (e += "").length, i = 0; i < n; i++) (0x7fffffffffff < (t = 31 * t + e.charCodeAt(r++)) || t < -0x800000000000) && (t &= 0xffffffffffff); return t < 0 && (t += 0x7ffffffffffff), t } function d(e, t) { try { return e ? w.get(e, { domain: t || document.domain }) : w.get() } catch (e) { return "" } } function g(e, t, r, n) { try { var i = n || document.domain , o = +new Date + (r || 6048e5); w.set(e, t, { expires: new Date(o), path: "/", domain: i }) } catch (e) {} } function y() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) { var t = 16 * Math.random() | 0; return ("x" === e ? t : 3 & t | 8).toString(16) }) } function m() { return (function e(t) { return t ? (t ^ 16 * Math.random() >> t / 4).toString(10) : "10000000-1000-4000-8000-100000000000".replace(/[018]/g, e) } )().replace(/-/g, "").slice(0, 19) } var v, b, _, S, x = function() { function e() { this._hooks = {}, this._cache = [], this._hooksCache = {} } return e.prototype.on = function(e, t) { e && t && "function" == typeof t && (this._hooks[e] || (this._hooks[e] = []), this._hooks[e].push(t)) } , e.prototype.once = function(e, t) { var r = this; e && t && "function" == typeof t && this.on(e, function n(i) { t(i), r.off(e, n) }) } , e.prototype.off = function(e, t) { e && this._hooks[e] && this._hooks[e].length && (t ? -1 !== (t = this._hooks[e].indexOf(t)) && this._hooks[e].splice(t, 1) : this._hooks[e] = []) } , e.prototype.emit = function(e, t, r) { r ? e && (-1 !== this._cache.indexOf(r) ? this._emit(e, t) : (this._hooksCache.hasOwnProperty(r) || (this._hooksCache[r] = {}), this._hooksCache[r].hasOwnProperty(e) || (this._hooksCache[r][e] = []), this._hooksCache[r][e].push(t))) : this._emit(e, t) } , e.prototype._emit = function(e, t) { e && this._hooks[e] && this._hooks[e].length && c(this._hooks[e]).forEach(function(e) { try { e(t) } catch (e) {} }) } , e.prototype.set = function(e) { e && -1 === this._cache.indexOf(e) && this._cache.push(e) } , e }(), w = (_ = +Date.now() + Number(("" + Math.random()).slice(2, 8)), (t = { exports: {} }).exports = function() { 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 r(n) { function i() {} function o(t, r, o) { if ("undefined" != typeof document) { "number" == typeof (o = e({ path: "/" }, i.defaults, o)).expires && (o.expires = new Date(+new Date + 864e5 * o.expires)), o.expires = o.expires ? o.expires.toUTCString() : ""; try { var s = JSON.stringify(r); /^[\{\[]/.test(s) && (r = s) } catch (e) {} r = n.write ? n.write(r, t) : encodeURIComponent(String(r)).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 a, c = ""; for (a in o) o[a] && (c += "; " + a, !0 !== o[a]) && (c += "=" + o[a].split(";")[0]); return document.cookie = t + "=" + r + c } } function s(e, r) { if ("undefined" != typeof document) { for (var i = {}, o = document.cookie ? document.cookie.split("; ") : [], s = 0; s < o.length; s++) { var a = o[s].split("=") , c = a.slice(1).join("="); r || '"' !== c.charAt(0) || (c = c.slice(1, -1)); try { var u = t(a[0]) , c = (n.read || n)(c, u) || t(c); if (r) try { c = JSON.parse(c) } catch (e) {} if (i[u] = c, e === u) break } catch (e) {} } return e ? i[e] : i } } return i.set = o, i.get = function(e) { return s(e, !1) } , i.getJSON = function(e) { return s(e, !0) } , i.remove = function(t, r) { o(t, "", e(r, { expires: -1 })) } , i.defaults = {}, i.withConverter = r, i }(function() {}) }(), t.exports), k = 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.prototype.getCookie = function(e, t) { return d(e, t) } , e.prototype.setCookie = function(e, t, r, n) { g(e, t, r, n) } , e }(), E = { getItem: function(e) { try { var t = localStorage.getItem(e) , r = t; try { t && "string" == typeof t && (r = JSON.parse(t)) } catch (e) {} return r || {} } catch (e) {} return {} }, setItem: function(e, t) { try { var r = "string" == typeof t ? t : JSON.stringify(t); localStorage.setItem(e, r) } catch (e) {} }, removeItem: function(e) { try { localStorage.removeItem(e) } catch (e) {} }, getCookie: function(e, t) { return d(e, t) }, setCookie: function(e, t, r, n) { g(e, t, r, n) }, 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 } }() }, O = { getItem: function(e) { try { var t = sessionStorage.getItem(e) , r = t; try { t && "string" == typeof t && (r = JSON.parse(t)) } catch (e) {} return r || {} } catch (e) {} return {} }, setItem: function(e, t) { try { var r = "string" == typeof t ? t : JSON.stringify(t); sessionStorage.setItem(e, r) } catch (e) {} }, removeItem: function(e) { try { sessionStorage.removeItem(e) } catch (e) {} }, getCookie: function(e, t) { return d(e, t) }, setCookie: function(e, t, r, n) { g(e, t, r, n) }, isSupportSession: function() { try { return sessionStorage.setItem("_ranger-test-key", "hi"), sessionStorage.getItem("_ranger-test-key"), sessionStorage.removeItem("_ranger-test-key"), !0 } catch (e) { return !1 } }() }, T = function() { function e(e, t) { this._storage = t && "session" === t ? O : !e && E.isSupportLS ? E : new k } 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, t) { return this._storage.getCookie(e, t) } , e.prototype.setCookie = function(e, t, r, n) { this._storage.setCookie(e, t, r, n) } , e.prototype.removeItem = function(e) { this._storage.removeItem(e) } , e }(), C = function() { function e(e, t, r) { this.appid = e, this.domain = t, this.userAgent = window.navigator.userAgent, this.appVersion = window.navigator.appVersion, this.cookie_expire = r } return e.prototype.init = function() { var e = window.navigator.userAgent , t = window.navigator.language , r = document.referrer , n = r ? f(r).hostname : "" , i = p(window.location.href) , o = /Mobile|htc|mini|Android|iP(ad|od|hone)/.test(this.appVersion) ? "wap" : "web" , i = (this.utm = function(e, t, r, n) { var i = new T(!1) , o = new T(!1,"session") , s = e ? "_tea_utm_cache_" + e : "_tea_utm_cache" , a = e ? "_$utm_from_url_" + e : "_$utm_from_url" , c = {} , u = ["tr_shareuser", "tr_admaster", "tr_param1", "tr_param2", "tr_param3", "tr_param4", "$utm_from_url"] , l = { ad_id: Number(t.ad_id) || void 0, campaign_id: Number(t.campaign_id) || void 0, creative_id: Number(t.creative_id) || void 0, utm_source: t.utm_source, utm_medium: t.utm_medium, utm_campaign: t.utm_campaign, utm_term: t.utm_term, utm_content: t.utm_content, tr_shareuser: t.tr_shareuser, tr_admaster: t.tr_admaster, tr_param1: t.tr_param1, tr_param2: t.tr_param2, tr_param3: t.tr_param3, tr_param4: t.tr_param4 }; try { var f, p, h = !1; for (f in l) l[f] && (-1 !== u.indexOf(f) ? (c.hasOwnProperty("tracer_data") || (c.tracer_data = {}), c.tracer_data[f] = l[f]) : c[f] = l[f], h = !0); h ? (o.setItem(a, "1"), i.setCookie(s, JSON.stringify(c), n, r)) : (p = i.getCookie(s, r)) && (c = JSON.parse(p)), o.getItem(a) && (c.hasOwnProperty("tracer_data") || (c.tracer_data = {}), c.tracer_data.$utm_from_url = 1) } catch (e) { return l } return c }(this.appid, i, this.domain, this.cookie_expire), this.browser()) , s = this.os(); return { browser: i.browser, browser_version: i.browser_version, platform: o, os_name: s.os_name, os_version: s.os_version, userAgent: e, screen_width: window.screen && window.screen.width, screen_height: window.screen && window.screen.height, device_model: this.getDeviceModel(s.os_name), language: t, referrer: r, referrer_host: n, utm: this.utm, latest_data: this.last(r, n) } } , e.prototype.last = function(e, t) { var r = "" , n = "" , i = "" , o = location.hostname , s = !1; return e && t && o !== t && (n = t, s = !0, (o = p(r = e)).keyword) && (i = o.keyword), { $latest_referrer: r, $latest_referrer_host: n, $latest_search_keyword: i, isLast: s } } , e.prototype.browser = function() { var e, t = "", r = "" + parseFloat(this.appVersion), n = this.userAgent; return -1 !== n.indexOf("Edge") || -1 !== n.indexOf("Edg") ? (t = "Microsoft Edge", r = -1 !== n.indexOf("Edge") ? (e = n.indexOf("Edge"), n.substring(e + 5)) : (e = n.indexOf("Edg"), n.substring(e + 4))) : -1 !== (e = n.indexOf("MSIE")) ? (t = "Microsoft Internet Explorer", r = n.substring(e + 5)) : -1 !== (e = n.indexOf("Lark")) ? (t = "Lark", r = n.substring(e + 5, e + 11)) : -1 !== (e = n.indexOf("MetaSr")) ? (t = "sougoubrowser", r = n.substring(e + 7, e + 10)) : -1 !== n.indexOf("MQQBrowser") || -1 !== n.indexOf("QQBrowser") ? (t = "qqbrowser", -1 !== n.indexOf("MQQBrowser") ? (e = n.indexOf("MQQBrowser"), r = n.substring(e + 11, e + 15)) : -1 !== n.indexOf("QQBrowser") && (e = n.indexOf("QQBrowser"), r = n.substring(e + 10, e + 17))) : -1 !== n.indexOf("Chrome") ? -1 !== (e = n.indexOf("MicroMessenger")) ? (t = "weixin", r = n.substring(e + 15, e + 20)) : -1 !== (e = n.indexOf("360")) ? (t = "360browser", r = n.substring(n.indexOf("Chrome") + 7)) : -1 !== n.indexOf("baidubrowser") || -1 !== n.indexOf("BIDUBrowser") ? (-1 !== n.indexOf("baidubrowser") ? (e = n.indexOf("baidubrowser"), r = n.substring(e + 13, e + 16)) : -1 !== n.indexOf("BIDUBrowser") && (e = n.indexOf("BIDUBrowser"), r = n.substring(e + 12, e + 15)), t = "baidubrowser") : -1 !== (e = n.indexOf("xiaomi")) ? r = -1 !== n.indexOf("openlanguagexiaomi") ? (t = "openlanguage xiaomi", n.substring(e + 7, e + 13)) : (t = "xiaomi", n.substring(e - 7, e - 1)) : -1 !== (e = n.indexOf("TTWebView")) ? (t = "TTWebView", r = n.substring(e + 10, e + 23)) : -1 === (e = n.indexOf("Chrome")) && -1 === (e = n.indexOf("Chrome")) || (t = "Chrome", r = n.substring(e + 7)) : -1 !== n.indexOf("Safari") ? -1 !== (e = n.indexOf("QQ")) ? (t = "qqbrowser", r = n.substring(e + 10, e + 16)) : -1 !== (e = n.indexOf("Safari")) && (t = "Safari", r = n.substring(e + 7), -1 !== (e = n.indexOf("Version"))) && (r = n.substring(e + 8)) : -1 !== (e = n.indexOf("Firefox")) ? (t = "Firefox", r = n.substring(e + 8)) : -1 !== (e = n.indexOf("MicroMessenger")) ? (t = "weixin", r = n.substring(e + 15, e + 20)) : -1 !== (e = n.indexOf("QQ")) && (t = "qqbrowser", r = n.substring(e + 3, e + 8)), { browser: t, browser_version: r = -1 !== (n = (r = -1 !== (n = (r = -1 !== (n = r.indexOf(";")) ? r.substring(0, n) : r).indexOf(" ")) ? r.substring(0, n) : r).indexOf(")")) ? r.substring(0, n) : r } } , e.prototype.os = function() { for (var e = "", t = "", r = [{ s: "Windows 10", r: /(Windows 10.0|Windows NT 10.0|Windows NT 10.1)/ }, { 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: "iOS", r: /(iPhone|iPad|iPod)/ }, { s: "Mac OS X", r: /Mac OS X/ }, { s: "Mac OS", r: /(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ }, { s: "chromeOS", r: /CrOS/ }, { s: "Linux", r: /(Linux|X11)/ }, { s: "Sun OS", r: /SunOS/ }], n = 0; n < r.length; n++) { var i = r[n]; if (i.r.test(this.userAgent)) { "Mac OS X" === (e = i.s) && this.isNewIpad() && (e = "iOS"); break } } function o(e, t) { return (e = e.exec(t)) && e[1] ? e[1] : "" } function s(e, t) { return (e = RegExp("(?:^|[^A-Z0-9-_]|[^A-Z0-9-]_|sprd-)(?:" + e + ")", "i").exec(t)) ? e.slice(1)[0] : "" } switch (/Windows/.test(e) && (t = o(/Windows (.*)/, e), e = "windows"), e) { case "Mac OS X": t = s("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?", this.userAgent), e = "mac"; break; case "Android": t = o(/Android ([\.\_\d]+)/, a = this.userAgent) || o(/Android\/([\.\_\d]+)/, a), e = "android"; break; case "iOS": t = this.isNewIpad() ? s("Mac[ +]OS[ +]X(?:[ /](?:Version )?(\\d+(?:[_\\.]\\d+)+))?", this.userAgent) : (t = /OS (\d+)_(\d+)_?(\d+)?/.exec(this.appVersion)) ? t[1] + "." + t[2] + "." + (0 | t[3]) : "", e = "ios"; break; case "chromeOS": var a = this.userAgent.indexOf("x86_64") , t = this.userAgent.substring(a + 7, a + 16) } return { os_name: e, os_version: t } } , e.prototype.getDeviceModel = 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 && "windows" !== e || (n = this.isNewIpad() ? "iPad" : (r = (t = navigator.userAgent.replace("Mozilla/5.0 (", "")).indexOf(";"), t.slice(0, r))) } catch (e) {} return n.trim() } , e.prototype.isNewIpad = function() { return void 0 !== this.userAgent && "MacIntel" === navigator.platform && "number" == typeof navigator.maxTouchPoints && 1 < navigator.maxTouchPoints } , e }(), D = { cn: "1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k", va: "1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az1gz22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k", sg: "1fz22z22z1nz21z4mz4bz4bz22z1mz19z1jz1mz1ez4az22z1mz19z21z1lz21z21z1bz1iz4az1az1mz1k" }, j = { cn: "1fz22z22z1nz21z4mz4bz4bz1kz1az21z4az28z1gz1hz1gz1cz18z1nz1gz4az1az1mz1k", sg: "1fz22z22z1nz21z4mz4bz4bz21z1ez18z1jz1gz49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k", va: "1fz22z22z1nz21z4mz4bz4bz1kz18z1jz1gz24z18z49z1kz1az21z4az19z27z22z1cz1mz24z1cz20z21z1cz18z4az1az1mz1k" }, I = "5.1.11", P = function() { function e(e, t) { this.collector = e, this.config = t, this.eventNameWhiteList = ["__bav_page", "__bav_beat", "__bav_page_statistics", "__bav_click", "__bav_page_exposure"], this.paramsNameWhiteList = ["$inactive", "$inline", "$target_uuid_list", "$source_uuid", "$is_spider", "$source_id", "$is_first_time", "_staging_flag"], this.regStr = RegExp("^[a-zA-Z0-9][a-z0-9A-Z_.-]{1,255}$") } return e.prototype.checkVerify = function(e) { var t, r, n, i = this; return !!(e && e.length && (e = e[0]) && (t = e.events, r = e.header, t) && t.length) && (n = !0, t.forEach(function(e) { e ? (i.checkEventName(e.event) || (n = !1, e.checkEvent = "\u4E8B\u4EF6\u540D\u4E0D\u80FD\u4EE5 $ or __\u5F00\u5934"), i.checkEventParams(e.params) || (n = !1, e.checkParams = "\u5C5E\u6027\u540D\u4E0D\u80FD\u4EE5 $ or __\u5F00\u5934")) : (n = !1, e.checkEvent = "\u4E8B\u4EF6\u5F02\u5E38") }), n = !!this.checkEventParams(r) && n) } , e.prototype.checkEventName = function(e) { return !!e && this.calculate(e, "event") } , e.prototype.checkEventParams = function(e) { var t = e; if ("string" == typeof e && (t = JSON.parse(t)), Object.keys(t).length) for (var r in t) return !(!this.calculate(r, "params") || "string" == typeof t[r] && 1024 < t[r].length && (console.warn("params: " + r + " can not over 1024 byte, please check;"), 1)); return !0 } , e.prototype.calculate = function(e, t) { return -1 !== ("event" === t ? this.eventNameWhiteList : this.paramsNameWhiteList).indexOf(e) || !RegExp("^\\$").test(e) && !RegExp("^__").test(e) || (console.warn(("event" === t ? "event" : "params") + " name: " + e + " can not start with $ or __, pleace check;"), !1) } , e }(), A = ((v = J = J || {}).Init = "init", v.Config = "config", v.Start = "start", v.Ready = "ready", v.UnReady = "un-ready", v.TokenComplete = "token-complete", v.TokenStorage = "token-storage", v.TokenFetch = "token-fetch", v.TokenError = "token-error", v.ConfigUuid = "config-uuid", v.ConfigWebId = "config-webid", v.ConfigDomain = "config-domain", v.CustomWebId = "custom-webid", v.TokenChange = "token-change", v.TokenReset = "token-reset", v.ConfigTransform = "config-transform", v.EnvTransform = "env-transform", v.SessionReset = "session-reset", v.SessionResetTime = "session-reset-time", v.SetSessionId = "set-session-id", v.Event = "event", v.Events = "events", v.EventNow = "event-now", v.CleanEvents = "clean-events", v.BeconEvent = "becon-event", v.SubmitBefore = "submit-before", v.SubmitScuess = "submit-scuess", v.SubmitAfter = "submit-after", v.SubmitError = "submit-error", v.SubmitVerify = "submit-verify", v.Stay = "stay", v.ResetStay = "reset-stay", v.StayReady = "stay-ready", v.SetStay = "set-stay", v.RouteChange = "route-change", v.RouteReady = "route-ready", v.Ab = "ab", v.AbVar = "ab-var", v.AbAllVars = "ab-all-vars", v.AbConfig = "ab-config", v.AbExternalVersion = "ab-external-version", v.AbVersionChangeOn = "ab-version-change-on", v.AbVersionChangeOff = "ab-version-change-off", v.AbOpenLayer = "ab-open-layer", v.AbCloseLayer = "ab-close-layer", v.AbReady = "ab-ready", v.AbComplete = "ab-complete", v.AbTimeout = "ab-timeout", v.Profile = "profile", v.ProfileSet = "profile-set", v.ProfileSetOnce = "profile-set-once", v.ProfileUnset = "profile-unset", v.ProfileIncrement = "profile-increment", v.ProfileAppend = "profile-append", v.ProfileClear = "profile-clear", v.Autotrack = "autotrack", v.AutotrackReady = "autotrack-ready", v.CepReady = "cep-ready", v.TracerReady = "tracer-ready", v.sessionRecord = "session-record", v.SessionRecordStart = "session-record-start", v.SessionRecordPause = "session-record-pause", v.SessionRecordEnd = "session-record-end", v.SessionRecordReport = "session-record-report", v.DestoryInstance = "destory-instance", v.VisualCollectReady = "visual-collect-ready", v.VisualApiReady = "visual-api-ready", v.VisualApiUpdate = "visual-api-update", (b = S = S || {}).DEBUGGER_MESSAGE = "debugger-message", b.DEBUGGER_MESSAGE_SDK = "debugger-message-sdk", b.DEBUGGER_MESSAGE_FETCH = "debugger-message-fetch", b.DEBUGGER_MESSAGE_FETCH_RESULT = "debugger-message-fetch-result", b.DEBUGGER_MESSAGE_EVENT = "debugger-message-event", b.DEVTOOL_WEB_READY = "devtool-web-ready", J), R = void 0, t = (new Date).getTimezoneOffset(), z = parseInt("" + -t / 60, 10), B = 60 * t, U = function() { function e(e, t) { this.is_first_time = !0, this.configPersist = !1, this.initConfig = t, this.collect = e; var r = new C(t.app_id,t.cookie_domain || "",t.cookie_expire || 7776e6).init() , e = (this.eventCheck = new P(e,t), "__tea_cache_first_" + t.app_id) , t = (this.configKey = "__tea_cache_config_" + t.app_id, this.sessionStorage = new T(!1,"session"), this.localStorage = new T(!1,"local"), t.configPersist && (this.configPersist = !0, this.storage = 1 === t.configPersist ? this.sessionStorage : this.localStorage), this.localStorage.getItem(e)); t && 1 == t ? this.is_first_time = !1 : (this.is_first_time = !0, this.localStorage.setItem(e, "1")), this.envInfo = { user: { user_unique_id: R, user_type: R, user_id: R, user_is_auth: R, user_is_login: R, device_id: R, web_id: R, ip_addr_id: R, user_unique_id_type: R }, header: { app_id: R, app_name: R, app_install_id: R, install_id: R, app_package: R, app_channel: R, app_version: R, ab_version: R, os_name: r.os_name, os_version: r.os_version, device_model: r.device_model, ab_client: R, traffic_type: R, client_ip: R, device_brand: R, os_api: R, access: R, language: r.language, region: R, app_language: R, app_region: R, creative_id: r.utm.creative_id, ad_id: r.utm.ad_id, campaign_id: r.utm.campaign_id, log_type: R, rnd: R, platform: r.platform, sdk_version: I, sdk_lib: "js", province: R, city: R, timezone: z, tz_offset: B, tz_name: R, sim_region: R, carrier: R, resolution: r.screen_width + "x" + r.screen_height, browser: r.browser, browser_version: r.browser_version, referrer: r.referrer, referrer_host: r.referrer_host, width: r.screen_width, height: r.screen_height, screen_width: r.screen_width, screen_height: r.screen_height, utm_term: r.utm.utm_term, utm_content: r.utm.utm_content, utm_source: r.utm.utm_source, utm_medium: r.utm.utm_medium, utm_campaign: r.utm.utm_campaign, tracer_data: JSON.stringify(r.utm.tracer_data), custom: {}, wechat_unionid: R, wechat_openid: R } }, this.ab_version = "", this.evtParams = {}, this.reportErrorCallback = function() {} , this.isLast = !1, this.setCustom(r), this.initDomain(), this.initABData() } return e.prototype.initDomain = function() { var e = this.initConfig.channel_domain; e ? this.domain = e : (e = this.initConfig.channel, this.domain = l(j[e])) } , e.prototype.setDomain = function(e) { this.domain = e } , e.prototype.getDomain = function() { return this.domain } , e.prototype.initABData = function() { var e, t = "__tea_sdk_ab_version_" + this.initConfig.app_id, r = null; r = this.initConfig.ab_cross ? (e = this.localStorage.getCookie(t, this.initConfig.ab_cookie_domain)) ? JSON.parse(e) : null : this.localStorage.getItem(t), this.setAbCache(r) } , e.prototype.setAbCache = function(e) { this.ab_cache = e } , e.prototype.getAbCache = function() { return this.ab_cache } , e.prototype.setAbVersion = function(e) { this.ab_version = e } , e.prototype.getAbVersion = function() { return this.ab_version } , e.prototype.clearAbCache = function() { this.ab_version = "", this.ab_cache = {} } , e.prototype.getUrl = function(e) { var t = ""; switch (e) { case "event": t = "/list"; break; case "webid": t = "/webid"; break; case "tobid": t = "/tobid" } return e = "", this.initConfig.caller && (e = "?sdk_version=5.1.11&sdk_name=web&app_id=" + this.initConfig.app_id + "&caller=" + this.initConfig.caller), "" + this.getDomain() + t + e } , e.prototype.setCustom = function(e) { if (e && e.latest_data && e.latest_data.isLast) for (var t in delete e.latest_data.isLast, this.isLast = !0, e.latest_data) this.envInfo.header.custom[t] = e.latest_data[t] } , e.prototype.set = function(e) { var t = this; Object.keys(e).forEach(function(r) { var n, i, o; void 0 !== e[r] && null !== e[r] || t.delete(r); try { t.eventCheck.calculate(r, "config") } catch (e) {} "traffic_type" === r && t.isLast && (t.envInfo.header.custom.$latest_traffic_source_type = e[r]), "evtParams" === r ? t.evtParams = a({}, t.evtParams || {}, e.evtParams || {}) : "_staging_flag" === r ? t.evtParams = a({}, t.evtParams || {}, { _staging_flag: e._staging_flag }) : "reportErrorCallback" === r && "function" == typeof e[r] ? t.reportErrorCallback = e[r] : (o = i = "", -1 < r.indexOf(".") && (i = (n = r.split("."))[0], o = n[1]), i ? "user" === i || "header" === i ? t.envInfo[i][o] = e[r] : t.envInfo.header.custom[o] = e[r] : Object.hasOwnProperty.call(t.envInfo.user, r) ? -1 < ["user_type", "ip_addr_id"].indexOf(r) ? t.envInfo.user[r] = e[r] && Number(e[r]) : -1 < ["user_id", "web_id", "user_unique_id", "user_unique_id_type"].indexOf(r) ? t.envInfo.user[r] = e[r] && String(e[r]) : -1 < ["user_is_auth", "user_is_login"].indexOf(r) ? t.envInfo.user[r] = !!e[r] : "device_id" === r && (t.envInfo.user[r] = e[r]) : Object.hasOwnProperty.call(t.envInfo.header, r) ? t.envInfo.header[r] = e[r] : t.envInfo.header.custom[r] = e[r]) }) } , e.prototype.get = function(e) { try { return e ? "evtParams" === e ? this.evtParams : "reportErrorCallback" === e ? this[e] : Object.hasOwnProperty.call(this.envInfo.user, e) ? this.envInfo.user[e] : Object.hasOwnProperty.call(this.envInfo.header, e) ? this.envInfo.header[e] : JSON.parse(JSON.stringify(this.envInfo[e])) : JSON.parse(JSON.stringify(this.envInfo)) } catch (e) { console.log("get config stringify error "), this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } } , e.prototype.setStore = function(e) { try { var t, r; this.configPersist && (t = this.storage.getItem(this.configKey) || {}) && Object.keys(e).length && (r = Object.assign(e, t), this.storage.setItem(this.configKey, r)) } catch (e) { console.log("setStore error"), this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } } , e.prototype.getStore = function() { try { var e; return this.configPersist && (e = this.storage.getItem(this.configKey) || {}, Object.keys(e).length) ? e : null } catch (e) { return this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }), null } } , e.prototype.delete = function(e) { try { var t; this.configPersist && (t = this.storage.getItem(this.configKey) || {}) && Object.hasOwnProperty.call(t, e) && (delete t[e], this.storage.setItem(this.configKey, t)) } catch (e) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }), console.log("delete error") } } , e }(), M = function() { function e(e, t) { this.isLog = t || !1, this.name = e || "" } return e.prototype.info = function(e) { this.isLog && console.log("%c %s", "color: yellow; background-color: black;", "[AppLog WEB SDK] [instance: " + this.name + "] " + e) } , e.prototype.warn = function(e) { this.isLog && console.warn("[AppLog WEB SDK] [instance: " + this.name + "] " + e) } , e.prototype.error = function(e) { this.isLog && console.error("[AppLog WEB SDK] [instance: " + this.name + "] " + e) } , e.prototype.throw = function(e) { throw this.error(this.name), Error(e) } , e }(), G = function() { function e() { this.spiderBot = ["Baiduspider", "googlebot", "360Spider", "haosouspider", "YoudaoBot", "Sogou News Spider", "Yisouspider", "Googlebot", "Headless", "Applebot", "Bingbot", "PetalBot"] } return e.prototype.checkSpider = function(e) { var t, r; return !!e.enable_spider && (!(t = window.navigator.userAgent) || (r = !1, this.spiderBot.forEach(function(e) { -1 !== t.indexOf(e) && (r = !0) }), r)) } , e }(), F = function() { function e(e, t) { this.collect = e, this.native = t } var t = e.prototype; return t.bridgeInject = function() { try { return !!this.native && (AppLogBridge ? (console.log("AppLogBridge is injected"), !0) : (console.log("AppLogBridge is not inject"), !1)) } catch (e) { return console.log("AppLogBridge is not inject"), !1 } } , t.bridgeReady = function() { var e = this; return new Promise(function(t, r) { try { e.bridgeInject() ? AppLogBridge.hasStarted(function(e) { console.log("AppLogBridge is started? : " + e), e ? t(!0) : r(!1) }) : r(!1) } catch (e) { console.log("AppLogBridge, error:" + JSON.stringify(e.stack)), r(!1) } } ) } , t.setNativeAppId = function(e) { try { AppLogBridge.setNativeAppId(JSON.stringify(e)), console.log("change bridge appid, event report with appid: " + e) } catch (e) { console.error("setNativeAppId error") } } , t.setConfig = function(e) { var t = this; try { Object.keys(e).forEach(function(r) { "user_unique_id" === r ? t.setUserUniqueId(e[r]) : e[r] ? t.addHeaderInfo(r, e[r]) : t.removeHeaderInfo(r) }) } catch (e) { console.error("setConfig error") } } , t.setUserUniqueId = function(e) { try { AppLogBridge.setUserUniqueId(e) } catch (e) { console.error("setUserUniqueId error") } } , t.addHeaderInfo = function(e, t) { try { AppLogBridge.addHeaderInfo(e, t) } catch (e) { console.error("addHeaderInfo error") } } , t.setHeaderInfo = function(e) { try { AppLogBridge.setHeaderInfo(JSON.stringify(e)) } catch (e) { console.error("setHeaderInfo error") } } , t.removeHeaderInfo = function(e) { try { AppLogBridge.removeHeaderInfo(e) } catch (e) { console.error("removeHeaderInfo error") } } , t.reportPv = function(e) { this.onEventV3("predefine_pageview", e) } , t.onEventV3 = function(e, t) { try { AppLogBridge.onEventV3(e, t), this.collect.emit(DebuggerMesssge.DEBUGGER_MESSAGE, { type: DebuggerMesssge.DEBUGGER_MESSAGE_EVENT, info: "bridge\u57CB\u70B9\u4E0A\u62A5", time: Date.now(), data: [{ events: [{ event: e, params: t }] }], code: 200, status: "success" }) } catch (e) { console.error("onEventV3 error") } } , t.profileSet = function(e) { try { AppLogBridge.profileSet(e) } catch (e) { console.error("profileSet error") } } , t.profileSetOnce = function(e) { try { AppLogBridge.profileSetOnce(e) } catch (e) { console.error("profileSetOnce error") } } , t.profileIncrement = function(e) { try { AppLogBridge.profileIncrement(e) } catch (e) { console.error("profileIncrement error") } } , t.profileUnset = function(e) { try { AppLogBridge.profileUnset(e) } catch (e) { console.error("profileUnset error") } } , t.profileAppend = function(e) { try { AppLogBridge.profileAppend(e) } catch (e) { console.error("profileAppend error") } } , e }(), N = function() { function e() {} return e.prototype.apply = function(e, t) { var r = this; this.collect = e, this.storage = new T(!1,"session"), this.sessionKey = "__tea_session_id_" + t.app_id, this.expireTime = t.expireTime || 18e5, this.disableSession = t.disable_session, this.disableSessionTimeCheck = t.disable_session_check, this.disableSession || (this.setSessionId(), this.collect.on(A.SessionReset, function(e) { r.resetSessionId(e) }), this.collect.on(A.SessionResetTime, function() { r.updateSessionIdTime() })) } , e.prototype.updateSessionIdTime = function() { var e, t = this.storage.getItem(this.sessionKey); t && t.sessionId && (e = t.timestamp, Date.now() - e > this.expireTime ? t = { sessionId: y(), timestamp: Date.now() } : t.timestamp = Date.now(), this.storage.setItem(this.sessionKey, t), this.resetExpTime()) } , e.prototype.setSessionId = function() { var e = this , t = this.storage.getItem(this.sessionKey); t && t.sessionId ? t.timestamp = Date.now() : t = { sessionId: y(), timestamp: Date.now() }, this.storage.setItem(this.sessionKey, t), this.disableSessionTimeCheck || (this.sessionExp = setInterval(function() { e.checkEXp() }, this.expireTime)) } , e.prototype.getSessionId = function() { var e = this.storage.getItem(this.sessionKey); return !this.disableSession && e && e.sessionId ? e.sessionId : "" } , e.prototype.resetExpTime = function() { var e = this; this.sessionExp && (clearInterval(this.sessionExp), this.sessionExp = setInterval(function() { e.checkEXp() }, this.expireTime)) } , e.prototype.resetSessionId = function(e) { e = { sessionId: e || y(), timestamp: Date.now() }, this.storage.setItem(this.sessionKey, e) } , e.prototype.checkEXp = function() { var e = this.storage.getItem(this.sessionKey); e && e.sessionId && Date.now() - e.timestamp + 30 >= this.expireTime && (e = { sessionId: y(), timestamp: Date.now() }, this.storage.setItem(this.sessionKey, e)) } , e }(), H = function() { function e() { this.eventLimit = 50, this.enable_ttwebid = !1, this.eventCache = [], this.beconEventCache = [] } return e.prototype.apply = function(e, t) { var r = this , n = (this.collect = e, this.config = t, this.configManager = e.configManager, this.eventCheck = new P(e,t), this.cacheStorgae = new T(!0), this.localStorage = new T(!1), this.maxReport = t.max_report || 10, this.reportTime = t.reportTime || t.report_time || 30, this.timeout = t.timeout || 1e5, this.enable_ttwebid = t.enable_ttwebid, this.reportUrl = t.report_url || this.configManager.getUrl("event"), this.eventKey = "__tea_cache_events_" + this.configManager.get("app_id"), this.beconKey = "__tea_cache_events_becon_" + this.configManager.get("app_id"), this.abKey = "__tea_sdk_ab_version_" + this.configManager.get("app_id"), this.refer_key = "__tea_cache_refer_" + this.configManager.get("app_id"), this.pageId = y(), this.collect.on(A.Ready, function() { r.reportAll(!1) }), this.collect.on(A.ConfigDomain, function() { r.reportUrl = r.configManager.getUrl("event") }), this.collect.on(A.Event, function(e) { r.event(e) }), this.collect.on(A.BeconEvent, function(e) { r.beconEvent(e) }), this.collect.on(A.CleanEvents, function() { r.reportAll(!1) }), this.linster()); this.collect.on(A.DestoryInstance, function() { n && n() }) } , e.prototype.linster = function() { function e() { n.reportAll(!0) } function t() { "hidden" === document.visibilityState && n.reportAll(!0) } var r, n = this; return window.addEventListener("unload", e, !1), r = e, navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/) ? window.addEventListener("pagehide", r, !1) : window.addEventListener("beforeunload", r, !1), document.addEventListener("visibilitychange", t, !1), function() { window.removeEventListener("unload", e), window.removeEventListener("pagehide", e, !1), window.removeEventListener("beforeunload", e, !1), document.removeEventListener("visibilitychange", t, !1) } } , e.prototype.reportAll = function(e) { this.report(e), this.reportBecon() } , e.prototype.event = function(e) { var t = this; try { var r, n = c(e, this.cacheStorgae.getItem(this.eventKey) || []); this.cacheStorgae.setItem(this.eventKey, n), this.reportTimeout && clearTimeout(this.reportTimeout), n.length >= this.maxReport ? this.report(!1) : (r = this.reportTime, this.reportTimeout = setTimeout(function() { t.report(!1), t.reportTimeout = null }, r)) } catch (e) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } } , e.prototype.beconEvent = function(e) { e = c(e, this.cacheStorgae.getItem(this.beconKey) || []), this.cacheStorgae.setItem(this.beconKey, e), this.collect.destroy || this.collect.sdkStop || this.collect.tokenManager.getReady() && this.collect.sdkReady && (this.cacheStorgae.removeItem(this.beconKey), this.send(this.split(this.merge(e)), !0)) } , e.prototype.reportBecon = function() { var e; !this.collect.destroy && !this.collect.sdkStop && this.collect.tokenManager.getReady() && this.collect.sdkReady && (e = this.cacheStorgae.getItem(this.beconKey) || []) && e.length && (this.cacheStorgae.removeItem(this.beconKey), this.send(this.split(this.merge(e)), !0)) } , e.prototype.report = function(e) { var t; !this.collect.destroy && !this.collect.sdkStop && this.collect.tokenManager.getReady() && this.collect.sdkReady && (t = this.cacheStorgae.getItem(this.eventKey) || []).length && (this.cacheStorgae.removeItem(this.eventKey), this.sliceEvent(t, e)) } , e.prototype.sliceEvent = function(e, t) { if (e.length > this.eventLimit) for (var r = 0; r < e.length; r += this.eventLimit) { var n = e.slice(r, r + this.eventLimit) , i = this.split(this.merge(n)); this.send(i, t) } else i = this.split(this.merge(e)), this.send(i, t) } , e.prototype.handleRefer = function() { var e, t = ""; try { t = (this.config.spa || this.config.autotrack) && (e = this.localStorage.getItem(this.refer_key) || {}).routeChange ? e.refer_key : this.configManager.get("referrer") } catch (e) { t = document.referrer } return t } , e.prototype.merge = function(e, t) { var r = this , n = this.configManager.get() , i = n.header , o = n.user , s = (this.config.enable_pageid && (i.custom.page_id = this.pageId), i.referrer = this.handleRefer(), i.custom = JSON.stringify(i.custom), this.configManager.get("evtParams")) , c = this.configManager.get("user_unique_id_type") , n = e.map(function(e) { try { Object.keys(s).length && !t && (e.params = a({}, s, e.params)), c && (e.params.$user_unique_id_type = c); var n = r.configManager.getAbCache() , i = o[r.config.ab_user_mode] || o.user_unique_id; return n && n.uuid && n.uuid === i && r.configManager.getAbVersion() && (e.ab_sdk_version = r.configManager.getAbVersion()), e.session_id = r.collect.sessionManager.getSessionId(), e.params = JSON.stringify(e.params), e } catch (t) { return r.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: t.message }), e } }) , e = JSON.parse(JSON.stringify({ events: n, user: o, header: i })) , n = (e.local_time = Math.floor(Date.now() / 1e3), e.user_unique_type = this.config.enable_ttwebid ? this.config.user_unique_type : void 0, e.verbose = 1, []); return n.push(e), n } , e.prototype.split = function(e) { return e.map(function(e) { var t = []; return t.push(e), t }) } , e.prototype.send = function(e, t) { var r = this; e.length && !this.config.disable_track_event && e.forEach(function(e) { try { var n, i = JSON.parse(JSON.stringify(e)), o = (!r.config.filter || (i = r.config.filter(i)) || console.warn("filter must return data !!"), r.collect.eventFilter && i && ((i = r.collect.eventFilter(i)) || console.warn("filterEvent api must return data !!")), i || e), s = JSON.parse(JSON.stringify(o)); r.eventCheck.checkVerify(s), o.length && (n = !0, o.forEach(function(e) { e.events.length || (n = !1) }), n && (r.collect.emit(A.SubmitBefore, o), r.collect.requestManager.useRequest({ url: r.reportUrl, data: o, success: function(e, t) { e && 0 !== e.e ? (r.collect.emit(A.SubmitError, { type: "f_data", eventData: t, errorCode: e.e, response: e }), r.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_EVENT, info: "\u57CB\u70B9\u4E0A\u62A5\u5931\u8D25", time: Date.now(), data: s, code: e.e, failType: "\u6570\u636E\u5F02\u5E38\u5931\u8D25", status: "fail" })) : (r.collect.emit(A.SubmitScuess, { eventData: t, res: e }), r.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_EVENT, info: "\u57CB\u70B9\u4E0A\u62A5\u6210\u529F", time: Date.now(), data: s, code: 200, status: "success" })) }, fail: function(e, t) { r.configManager.get("reportErrorCallback")(e, t), r.collect.emit(A.SubmitError, { type: "f_net", eventData: e, errorCode: t }), r.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_EVENT, info: "\u57CB\u70B9\u4E0A\u62A5\u7F51\u7EDC\u5F02\u5E38", time: Date.now(), data: s, code: t, failType: "\u7F51\u7EDC\u5F02\u5E38\u5931\u8D25", status: "fail" }) }, timeout: r.timeout, useBeacon: t, withCredentials: r.enable_ttwebid }), r.collect.emit(A.SubmitAfter, o))) } catch (e) { console.warn("something error, " + JSON.stringify(e.stack)), r.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } }) } , e }(), L = function() { function e() { this.cacheToken = {}, this.enableCookie = !1, this.enable_ttwebid = !1, this.enableCustomWebid = !1 } return e.prototype.apply = function(e, t) { var r = this; this.collect = e, this.config = t, this.configManager = this.collect.configManager, this.storage = new T(!1), this.tokenKey = "__tea_cache_tokens_" + t.app_id, this.enable_ttwebid = t.enable_ttwebid, this.enableCustomWebid = t.enable_custom_webid, this.collect.on(A.ConfigUuid, function(e) { r.setUuid(e) }), this.collect.on(A.ConfigWebId, function(e) { r.setWebId(e) }), this.enableCookie = t.cross_subdomain, this.expiresTime = t.cookie_expire || 6048e5, this.cookieDomain = t.cookie_domain || "", this.checkStorage() } , e.prototype.checkStorage = function() { var e, t = this; this.enableCookie ? (e = this.storage.getCookie(this.tokenKey, this.cookieDomain), this.cacheToken = e && "string" == typeof e ? JSON.parse(e) : {}) : this.cacheToken = this.storage.getItem(this.tokenKey) || {}, this.tokenType = this.cacheToken && this.cacheToken._type_ ? this.cacheToken._type_ : "default", "custom" !== this.tokenType || this.enableCustomWebid ? this.enableCustomWebid ? this.collect.on(A.CustomWebId, function() { t.tokenReady = !0, t.collect.emit(A.TokenComplete) }) : this.checkEnv() || (this.enable_ttwebid ? this.completeTtWid(this.cacheToken) : this.check()) : this.remoteWebid() } , e.prototype.check = function() { this.cacheToken && this.cacheToken.web_id ? this.complete(this.cacheToken) : this.config.disable_webid ? this.complete({ web_id: m(), user_unique_id: this.configManager.get("user_unique_id") || m() }) : this.remoteWebid() } , e.prototype.checkEnv = function() { var e = window.navigator.userAgent; return (-1 !== e.indexOf("miniProgram") || -1 !== e.indexOf("MiniProgram")) && !(!(e = p(window.location.href)) || !e.Web_ID || (this.complete({ web_id: "" + e.Web_ID, user_unique_id: this.configManager.get("user_unique_id") || "" + e.Web_ID }), 0)) } , e.prototype.remoteWebid = function() { var e = this , t = this.configManager.getUrl("webid") , r = { app_key: this.config.app_key, app_id: this.config.app_id, url: location.href, user_agent: window.navigator.userAgent, referer: document.referrer, user_unique_id: "" }; this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u53D1\u8D77WEBID\u8BF7\u6C42", logType: "fetch", level: "info", time: Date.now(), data: r }), this.collect.requestManager.useRequest({ url: t, data: r, success: function(t) { var r, n; t && 0 === t.e ? (n = t.web_id, e.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "WEBID\u8BF7\u6C42\u6210\u529F", logType: "fetch", level: "info", time: Date.now(), data: t })) : (r = m(), e.collect.configManager.set({ localWebId: n = r }), e.collect.emit(A.TokenError), e.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "WEBID\u8BF7\u6C42\u8FD4\u56DE\u503C\u5F02\u5E38", logType: "fetch", level: "warn", time: Date.now(), data: t }), e.collect.logger.warn("appid: " + e.config.app_id + " get webid error, use local webid~")), e.complete({ web_id: e.configManager.get("web_id") || n, user_unique_id: e.configManager.get("user_unique_id") || n }) }, fail: function() { var t = m(); e.complete({ web_id: e.configManager.get("web_id") || t, user_unique_id: e.configManager.get("user_unique_id") || t }), e.collect.configManager.set({ localWebId: t }), e.collect.emit(A.TokenError), e.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "WEBID\u8BF7\u6C42\u7F51\u7EDC\u5F02\u5E38", logType: "fetch", level: "error", time: Date.now(), data: null }), e.collect.logger.warn("appid: " + e.config.app_id + ", get webid error, use local webid~") }, timeout: 3e5 }) } , e.prototype.complete = function(e) { var t = e.web_id , r = e.user_unique_id; e.timestamp = Date.now(), this.collect.configManager.set({ web_id: t, user_unique_id: r }), this.setStorage(e), this.tokenReady = !0, this.collect.emit(A.TokenComplete) } , e.prototype.completeTtWid = function(e) { var t = e.user_unique_id || "" , r = this.configManager.get("user_unique_id"); (r || t) && this.configManager.set({ user_unique_id: r || t }), this.setStorage(e), this.tokenReady = !0, this.collect.emit(A.TokenComplete) } , e.prototype.setUuid = function(e) { var t, r; e && -1 === ["null", "undefined", "Null", "None"].indexOf(e) ? (e = String(e), t = this.configManager.get("user_unique_id"), r = this.cacheToken && this.cacheToken.user_unique_id, e === t && e === r || (this.configManager.set({ user_unique_id: e }), this.cacheToken || (this.cacheToken = {}), this.cacheToken.user_unique_id = e, this.cacheToken.timestamp = Date.now(), this.setStorage(this.cacheToken), this.collect.emit(A.TokenChange, "uuid"), this.collect.emit(A.SessionReset))) : this.clearUuid() } , e.prototype.clearUuid = function() { this.config.enable_ttwebid || this.configManager.get("web_id") && this.configManager.get("user_unique_id") !== this.configManager.get("web_id") && (this.configManager.set({ user_unique_id: this.configManager.get("web_id") }), this.cacheToken && this.cacheToken.web_id && (this.cacheToken.user_unique_id = this.cacheToken.web_id, this.cacheToken.timestamp = Date.now(), this.setStorage(this.cacheToken)), this.collect.emit(A.TokenReset, "uuid")) } , e.prototype.setWebId = function(e) { var t, r; e && !this.config.enable_ttwebid && (this.cacheToken && this.cacheToken.web_id ? this.cacheToken.web_id !== e && (this.cacheToken.user_unique_id = this.cacheToken.web_id === this.cacheToken.user_unique_id ? e : this.cacheToken.user_unique_id, this.cacheToken.web_id = e) : (this.cacheToken = {}, this.cacheToken.web_id = e, this.cacheToken.user_unique_id = e), this.cacheToken.timestamp = Date.now(), t = this.configManager.get("web_id"), (r = this.configManager.get("user_unique_id")) && r !== t || (this.configManager.set({ user_unique_id: e }), this.collect.emit(A.TokenChange, "uuid")), t !== e && (this.configManager.set({ web_id: e }), this.collect.emit(A.TokenChange, "webid")), this.setStorage(this.cacheToken)) } , e.prototype.setStorage = function(e) { e._type_ = this.enableCustomWebid ? "custom" : "default", delete e["diss".split("").reverse().join("")], this.enableCookie || this.enable_ttwebid ? (this.storage.setCookie(this.tokenKey, e, this.expiresTime, this.cookieDomain), this.enable_ttwebid && (delete e.web_id, this.storage.setItem(this.tokenKey, e))) : this.storage.setItem(this.tokenKey, e), this.cacheToken = e } , e.prototype.getReady = function() { return this.tokenReady } , e.prototype.getTobId = function() { var e = this; return new Promise(function(t) { e.collect.requestManager.useRequest({ url: e.configManager.getUrl("tobid"), data: { app_id: e.config.app_id, user_unique_id: e.configManager.get("user_unique_id"), web_id: e.configManager.get("web_id"), user_unique_id_type: e.configManager.get("user_unique_id_type") }, success: function(e) { e && 0 === e.e ? t(e.tobid) : t("") }, fail: function() { t("") }, time: 3e4, withCredentials: e.enable_ttwebid }) } ) } , e }(), K = function() { function e(e, t) { this.collector = e, this.config = t, this.requestType = t.request_type || "xhr", this.supportBeacon = !(!window.navigator || !window.navigator.sendBeacon), this.errorCode = { NO_URL: 4001, IMG_ON: 4e3, IMG_CATCH: 4002, BEACON_FALSE: 4003, XHR_ON: 500, RESPONSE: 5001, TIMEOUT: 5005 }, this.customHeader = t.custom_request_header || {} } return e.prototype.useFetch = function(e) { var t = e.url , r = e.data , n = e.method , i = e.success , o = e.fail , s = { "Content-Type": "application/json; charset=utf-8" }; if (Object.keys(this.customHeader).length) for (var a in this.customHeader) s[a] = this.customHeader[a]; window.fetch ? fetch(t, { method: n || "POST", headers: s, body: JSON.stringify(r) }).then(function(e) { return e.json() }).then(function(e) { i && i(e) }).catch(function(e) { o && o(r, e) }) : (this.requestType = "xhr", console.log("your brwoser not support fetch, use xhr"), this.useRequest({ url: t, data: r, method: n, success: i, fail: o })) } , e.prototype.useBeacon = function(e) { var t = e.url , r = e.data , n = e.success , e = e.fail; window.navigator.sendBeacon(t, JSON.stringify(r)) ? n && n() : e && e(r, this.errorCode.BEACON_FALSE) } , e.prototype.useRequest = function(e) { var t = this , r = e.url , n = e.data , i = e.method , o = e.success , s = e.fail , a = e.timeout , c = e.useBeacon , u = e.withCredentials , l = e.app_key , f = e.forceXhr; if (c && this.supportBeacon) this.useBeacon({ url: r, data: n, method: i, success: o, fail: s }); else if ("fetch" !== this.requestType || f) try { var p = new XMLHttpRequest , h = i || "POST"; if (p.open(h, "" + r, !0), p.setRequestHeader("Content-Type", "application/json; charset=utf-8"), l && p.setRequestHeader("X-MCS-AppKey", "" + l), Object.keys(this.customHeader).length) for (var d in this.customHeader) p.setRequestHeader(d, this.customHeader[d]); u && (p.withCredentials = !0), a && (p.timeout = a, p.ontimeout = function() { s && s(n, t.errorCode.TIMEOUT) } ), p.onload = function() { if (o) { var e = null; if (p.responseText) { try { e = JSON.parse(p.responseText) } catch (t) { e = {} } o(e, n) } } } , p.onerror = function() { p.abort(), s && s(n, t.errorCode.XHR_ON) } , p.send(JSON.stringify(n)) } catch (e) {} else this.useFetch({ url: r, data: n, method: i, success: o, fail: s }) } , e }(), q = function() { function e(e, t) { var r; this.devToolReady = !1, this.devToolOrigin = "*", this.sendAlready = !1, this.eventVerifyReady = !1, t.enable_debug && (r = e.adapters.storage, this.collect = e, this.config = t, this.app_id = t.app_id, this.cacheStorgae = new r(!1,"session"), this.eventVerifyInfo = [], this.sdk_type = I.includes("tob") ? "tob" : "inner", this.filterEvent = ["__bav_page", "__bav_beat", "__bav_page_statistics", "__bav_click", "__bav_page_exposure", "bav2b_page", "bav2b_beat", "bav2b_page_statistics", "bav2b_click", "bav2b_page_exposure", "_be_active", "predefine_pageview", "__profile_set", "__profile_set_once", "__profile_increment", "__profile_unset", "__profile_append", "predefine_page_alive", "predefine_page_close", "abtest_exposure"], this.load()) } return e.prototype.loadScript = function(e) { try { var t = document.createElement("script"); t.src = e, t.onerror = function() { console.log("load DevTool render fail") } , t.onload = function() { console.log("load DevTool render success") } , document.getElementsByTagName("body")[0].appendChild(t) } catch (e) { console.log("devTool load fail, " + e.message) } } , e.prototype.parseUrl = function() { var e = {}; try { var t = window.location.href.split("?")[1].split("&"); t.length && t.forEach(function(t) { t = t.split("="), e[decodeURIComponent(t[0])] = decodeURIComponent(t[1]) }) } catch (e) {} return e } , e.prototype.load = function() { var e, t, r; return e = this, r = function() { var e; return function(e, t) { var r, n, i, o = { label: 0, sent: function() { if (1 & i[0]) throw i[1]; return i[1] }, trys: [], ops: [] }, s = { next: a(0), throw: a(1), return: a(2) }; return "function" == typeof Symbol && (s[Symbol.iterator] = function() { return this } ), s; function a(s) { return function(a) { return function(s) { if (r) throw TypeError("Generator is already executing."); for (; o; ) try { if (r = 1, n && (i = 2 & s[0] ? n.return : s[0] ? n.throw || ((i = n.return) && i.call(n), 0) : n.next) && !(i = i.call(n, s[1])).done) return i; switch (n = 0, (s = i ? [2 & s[0], i.value] : s)[0]) { case 0: case 1: i = s; break; case 4: return o.label++, { value: s[1], done: !1 }; case 5: o.label++, n = s[1], s = [0]; continue; case 7: s = o.ops.pop(), o.trys.pop(); continue; default: if (!(i = 0 < (i = o.trys).length && i[i.length - 1]) && (6 === s[0] || 2 === s[0])) { o = 0; continue } if (3 === s[0] && (!i || s[1] > i[0] && s[1] < i[3])) o.label = s[1]; else if (6 === s[0] && o.label < i[1]) o.label = i[1], i = s; else { if (!(i && o.label < i[2])) { i[2] && o.ops.pop(), o.trys.pop(); continue } o.label = i[2], o.ops.push(s) } } s = t.call(e, o) } catch (e) { s = [6, e], n = 0 } finally { r = i = 0 } if (5 & s[0]) throw s[1]; return { value: s[0] ? s[1] : void 0, done: !0 } }([s, a]) } } }(this, function(t) { switch (t.label) { case 0: if (t.trys.push([0, 2, , 3]), (e = this.parseUrl()).open_devtool_web && e.app_id) { if (parseInt(e.app_id) !== this.app_id) return [2] } else if (!this.getStorage()) return [2]; return this.loadBaseInfo(), this.loadHook(), this.setStorage(), this.addLintener(), this.loadDebuggerModule(), this.loadDevTool(), [4, this.fetchEventInfo()]; case 1: return e = t.sent(), this.sendData("devtool:web:verify", e.verifyStatus), this.eventVerifyInfo = e.data, [3, 3]; case 2: return console.log("debug fail, " + t.sent().message), [3, 3]; case 3: return [2] } }) } , new (t = void 0, t = Promise)(function(n, i) { function o(e) { try { a(r.next(e)) } catch (e) { i(e) } } function s(e) { try { a(r.throw(e)) } catch (e) { i(e) } } function a(e) { e.done ? n(e.value) : new t(function(t) { t(e.value) } ).then(o, s) } a((r = r.apply(e, [])).next()) } ) } , e.prototype.getStorage = function() { var e = this.cacheStorgae.getItem("__applog_devtool_web"); return e && parseInt(e) === this.app_id } , e.prototype.setStorage = function() { this.cacheStorgae.setItem("__applog_devtool_web", this.app_id) } , e.prototype.loadDevTool = function() { this.loadScript("https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/devtool/debug-web.0.0.2.js") } , e.prototype.loadBaseInfo = function() { var e = this; this.info = [{ title: "\u57FA\u672C\u4FE1\u606F", type: 1, infoName: { app_id: this.config.app_id, channel: this.config.channel, \u4E0A\u62A5\u57DF\u540D: this.collect.configManager.getDomain(), SDK\u7248\u672C: I, SDK\u5F15\u5165\u65B9\u5F0F: "npm" } }, { title: "\u7528\u6237\u4FE1\u606F", type: 2, infoName: { uuid: this.collect.configManager.get("user").user_unique_id || "", web_id: this.collect.configManager.get("user").web_id || "", ssid: "\u70B9\u51FB\u83B7\u53D6SSID" } }, { title: "\u516C\u5171\u53C2\u6570\u4FE1\u606F", type: 2, infoName: { \u6D4F\u89C8\u5668: this.collect.configManager.get("browser"), \u6D4F\u89C8\u5668\u7248\u672C: this.collect.configManager.get("browser_version"), \u5E73\u53F0: this.collect.configManager.get("platform"), \u8BBE\u5907\u578B\u53F7: this.collect.configManager.get("device_model"), \u64CD\u4F5C\u7CFB\u7EDF: this.collect.configManager.get("os_name"), \u64CD\u4F5C\u7CFB\u7EDF\u7248\u672C: this.collect.configManager.get("os_version"), \u5C4F\u5E55\u5206\u8FA8\u7387: this.collect.configManager.get("resolution"), \u6765\u6E90: this.collect.configManager.get("referrer"), \u81EA\u5B9A\u4E49\u4FE1\u606F: "" } }, { title: "\u914D\u7F6E\u4FE1\u606F", type: 3, infoName: { \u5168\u57CB\u70B9: !!this.config.autotrack, \u505C\u7559\u65F6\u957F: !!this.config.enable_stay_duration } }, { title: "A/B\u914D\u7F6E\u4FE1\u606F", type: 4, infoName: { "A/B\u5B9E\u9A8C": !!this.config.enable_ab_test } }, { title: "\u5BA2\u6237\u7AEF\u4FE1\u606F", type: 3, infoName: { \u6253\u901A\u5F00\u5173: !!this.config.Native } }], this.log = [], this.event = [], this.collect.on(A.Ready, function() { e.info[1].infoName.uuid = e.collect.configManager.get("user").user_unique_id, e.info[1].infoName.web_id = e.collect.configManager.get("user").web_id, e.info[2].infoName["\u81EA\u5B9A\u4E49\u4FE1\u606F"] = JSON.stringify(e.collect.configManager.get("custom")), e.config.enable_ab_test && (e.info[4].infoName["\u5DF2\u66DD\u5149VID"] = e.collect.configManager.getAbVersion(), e.info[4].infoName["A/B\u57DF\u540D"] = e.config.ab_channel_domain || l(D[e.config.channel]), e.info[4].infoName["\u5168\u90E8\u914D\u7F6E"] = e.collect.configManager.getAbData()), e.config.Native && (e.info[5].infoName["\u662F\u5426\u6253\u901A"] = !!e.collect.bridgeReport) }) } , e.prototype.loadHook = function() { var e = this; this.collect.stop(), this.collect.on(S.DEBUGGER_MESSAGE, function(t) { switch (t.type) { case S.DEBUGGER_MESSAGE_SDK: var r = { time: t.time, type: t.logType || "sdk", level: t.level, name: t.info, show: !0, levelShow: !0, needDesc: !!t.data }; return t.data && (r.desc = { content: JSON.stringify(t.data) }), e.updateLog(r), t.secType && "AB" === t.secType ? (e.info[4].infoName["\u5DF2\u66DD\u5149VID"] = e.collect.configManager.getAbVersion(), e.info[4].infoName["\u5168\u90E8\u914D\u7F6E"] = e.collect.configManager.getAbData()) : "USER" === t.secType && (e.info[1].infoName.uuid = e.collect.configManager.get("user").user_unique_id, e.info[1].infoName.web_id = e.collect.configManager.get("user").web_id), void e.updateInfo(); case S.DEBUGGER_MESSAGE_EVENT: if (t.data && t.data.length) { var r = t.data[0] , n = r.events , i = r.header; if (i.custom = JSON.parse(i.custom), !n.length) return; n.forEach(function(r) { r.checkShow = !0, r.searchShow = !0, r.type = -1 !== e.filterEvent.indexOf(r.event) ? "sdk" : "cus", r.type = e.collect.bridgeReport ? "bridge" : r.type, r.params = JSON.parse(r.params), "fail" === t.status && (r.info = { message: "code: " + t.code + "\uFF0C msg: " + t.failType }, r.failType = t.failType); var n = !1 , i = !1 , o = []; e.eventVerifyInfo && e.eventVerifyInfo.length && (e.eventVerifyInfo.forEach(function(e) { e.eventStatus = !1 }), e.eventVerifyInfo.forEach(function(t) { r.event === t.name && (n = i = !0, r.verifyStatus = t.status, Object.keys(r.params).forEach(function(n) { var s; "event_index" !== n && ((s = {}).paramsKey = n, s.paramsKeyValue = r.params["" + n], s.paramsStatus = !1, s.paramsStatusInfo = "\u5C5E\u6027\u672A\u5F55\u5165", t.params.forEach(function(t) { n === t.name && (t.checked = !0, typeof r.params["" + n] !== e.formatParamsType(t.value_type) ? s.paramsStatusInfo = "\u5C5E\u6027\u7C7B\u578B\u9519\u8BEF\uFF0C\u5E94\u4E3A" + e.formatParamsType(t.value_type) : (s.paramsStatus = !0, s.paramsStatusInfo = "")) }), o.push(s), s.paramsStatusInfo) && (i = !1) }), t.params.forEach(function(e) { e.checked || (i = !1, o.push({ paramsKey: e.name, paramsStatus: !1, paramsStatusInfo: "\u7F3A\u5C11\u5C5E\u6027" + e.name })) })) })), r.reportStatus = "success" === t.status, r.paramsInfo = o, r.eventStatus = i && "success" === t.status, r.eventRecord = n }), e.updateEvent(r) } return } }) } , e.prototype.formatParamsType = function(e) { switch (e) { case 0: return "string"; case 1: case 2: return "number"; case 3: return "boolean" } } , e.prototype.fetchEventInfo = function() { var e = this; try { return new Promise(function(t) { var r = l("1fz22z22z1nz21z4mz4bz4bz18z1nz1nz1jz1mz1ez1fz1mz1kz1cz4az19z27z22z1cz1bz18z1lz1az1cz4az1lz1cz22z4bz18z1nz1nz1jz1mz1ez1bz1cz24z22z1mz1mz1jz21z4bz1mz1nz1cz1lz18z1nz1gz4bz24z4dz4bz18z1nz1nz16z1jz1mz1ez16z1kz1cz22z18") + "?app_id=" + e.app_id + "&t=" + e.sdk_type + "&nc=false"; e.collect.requestManager.useRequest({ url: r, method: "GET", success: function(r) { e.eventVerifyReady = !0, e.collect.reStart(), t({ data: r.data, verifyStatus: !0 }) }, fail: function() { e.eventVerifyReady = !0, e.collect.reStart(), t({ data: [], verifyStatus: !1 }) }, timeout: 3e3 }) } ) } catch (e) { return { data: [], verifyStatus: !1 } } } , e.prototype.addLintener = function() { var e = this; window.addEventListener("message", function(t) { if (t.origin === location.origin) { if (t && t.data && "devtool:web:ready" === t.data.type) { if (e.devToolOrigin = t.origin, e.devToolReady = !0, e.sendAlready) return; e.sendData("devtool:web:init", { info: e.info, log: e.log, event: e.event, appid: e.app_id }), e.sendAlready = !0 } t && t.data && "devtool:web:ssid" === t.data.type && e.collect.getToken(function(t) { e.info[1].infoName.ssid = t.tobid, e.updateInfo() }), t && t.data && t.data.type } }) } , e.prototype.sendData = function(e, t) { try { (window.opener || window.parent).postMessage({ type: e, payload: t }, this.devToolOrigin) } catch (e) {} } , e.prototype.updateInfo = function() { this.devToolReady && this.sendData("devtool:web:info", this.info) } , e.prototype.updateLog = function(e) { this.devToolReady ? this.sendData("devtool:web:log", e) : this.log.push(e) } , e.prototype.updateEvent = function(e) { this.devToolReady || this.eventVerifyReady ? this.sendData("devtool:web:event", e) : this.event.push(e) } , e.prototype.loadDebuggerModule = function() { var e = document.head || document.getElementsByTagName("head")[0] , t = document.createElement("style") , e = (t.appendChild(document.createTextNode("#debugger-applog-web {\n position: fixed;\n width: 50px;\n height: 50px;\n background-image: url('https://lf-cdn-tos.bytescm.com/obj/static/log-sdk/collect/devtool/applog.png');;\n bottom: 5%;\n right: 10%;\n cursor: pointer;\n z-index:100;\n background-size: 50px;\n }")), e.appendChild(t), document.createElement("div")) , t = (e.innerHTML = '
', document.createElement("div")); t.innerHTML = '
', document.getElementsByTagName("body")[0].appendChild(e), document.getElementsByTagName("body")[0].appendChild(t), document.getElementById("debugger-applog-web").addEventListener("click", function() { (window.opener || window.parent).postMessage({ type: "devtool:web:open-draw" }, location.origin) }) } , e }(), V = { autotrack: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/autotrack.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/autotrack.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/autotrack.js" }, object: "LogAutoTrack" }, ab: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/ab.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/ab.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/ab.js" }, object: "LogAb" }, stay: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/stay.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/stay.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/stay.js" }, object: "LogStay" }, route: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/route.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/route.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/route.js" }, object: "LogRoute" }, cep: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/cep.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/cep.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/cep.js" }, object: "LogCep" }, tracer: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/tracer.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/tracer.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/tracer.js" }, object: "LogTracer" }, retry: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/retry.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/retry.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/retry.js" }, object: "LogRetry" }, visual: { src: { cn: "https://lf3-cdn-tos.bytescm.com/obj/static/log-sdk/collect/5.0/plugin/visual.js", sg: "https://sf16-scmcdn-sg.ibytedtos.com/obj/static-sg/log-sdk/collect/5.0/plugin/visual.js", va: "https://sf16-scmcdn-va.ibytedtos.com/obj/static-us/log-sdk/collect/5.0/plugin/visual.js" }, object: "LogVisual" } }, W = ["et", "profile", "heartbeat", "monitor"], J = function() { function e(e) { this.disableAutoPageView = !1, this.bridgeReport = !1, this.staging = !1, this.pluginInstances = [], this.sended = !1, this.started = !1, this.destroy = !1, this.sdkReady = !1, this.adapters = {}, this.loadType = "base", this.sdkStop = !1, this.name = e, this.hook = new x, this.remotePlugin = new Map, this.Types = A, this.adapters.storage = T } return e.usePlugin = function(t, r, n) { if (r) { for (var i = !1, o = 0, s = e.plugins.length; o < s; o++) if (e.plugins[o].name === r) { e.plugins[o].plugin = t, e.plugins[o].options = n || {}, i = !0; break } i || e.plugins.push({ name: r, plugin: t, options: n }) } else e.plugins.push({ plugin: t }) } , e.prototype.usePlugin = function(e, t, r) { e && ("full" === this.loadType && W.includes(e) ? console.info("your sdk version has " + e + " plugin already ~") : t ? "string" == typeof t ? this.remotePlugin.get(e) || this.remotePlugin.set(e, { src: t, call: r }) : this.remotePlugin.get(e) || this.remotePlugin.set(e, { instance: t }) : this.remotePlugin.get(e) || this.remotePlugin.set(e, "sdk")) } , e.prototype.init = function(t) { var r, n = this; this.logger = new M(this.name,t.log), this.inited ? this.logger.warn("[instance: " + this.name + "], every instance's api: init, can be call only one time!") : t && u(t) ? t.app_id && "number" == typeof (r = t.app_id) && !isNaN(r) ? t.app_key && "string" != typeof t.app_key ? this.logger.warn("app_key param is error, must be string, please check!") : (t.channel_domain || -1 !== ["cn", "sg", "va"].indexOf(t.channel) || (this.logger.warn("channel must be `cn`, `sg`,`va` !"), t.channel = "cn"), this.spider = new G, this.spider.checkSpider(t) ? this.logger.warn("your env may be a spider, can not report!") : (this.appBridge = new F(this,t.enable_native), this.requestManager = new K(this,t), this.bridgeReport = this.appBridge.bridgeInject(), this.configManager = new U(this,t), this.debugger = new q(this,t), this.initConfig = t, this.emit(A.Init), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CINIT", data: t, level: "info", time: Date.now() }), this.destroy = !1, t.disable_auto_pv && (this.disableAutoPageView = !0), this.bridgeReport || (this.configManager.set({ app_id: t.app_id }), this.eventManager = new H, this.tokenManager = new L, this.sessionManager = new N, Promise.all([new Promise(function(e) { n.once(A.TokenComplete, function() { e(!0) }) } ), new Promise(function(e) { n.once(A.Start, function() { e(!0) }) } )]).then(function() { try { e.plugins.reduce(function(e, t) { var r = t.plugin , t = t.options , t = Object.assign(n.initConfig, t) , r = new r; return r.apply(n, t), e.push(r), e }, n.pluginInstances) } catch (e) { console.warn("load plugin error, " + e.message), n.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } n.sdkReady = !0, n.emit(A.Ready), n.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u521D\u59CB\u5316\u5B8C\u6210", time: Date.now(), level: "info", data: n.configManager.get("user") }), n.logger.info("appid: " + t.app_id + ", userInfo:" + JSON.stringify(n.configManager.get("user"))), n.logger.info("appid: " + t.app_id + ", sdk is ready, version type is " + n.loadType + ", version is " + I + ", you can report now !!!"), t.disable_auto_pv && (n.disableAutoPageView = !0); try { "full" === n.loadType && (t.enable_ab_test || t.autotrack) && (window.opener || window.parent).postMessage("[tea-sdk]ready", "*") } catch (e) { n.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } n.pageView(), n.on(A.TokenChange, function(e) { "webid" === e && n.pageView(), n.logger.info("appid: " + t.app_id + " token change, new userInfo:" + JSON.stringify(n.configManager.get("user"))), n.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u8BBE\u7F6E\u4E86\u7528\u6237\u4FE1\u606F", time: Date.now(), secType: "USER", level: "info", data: n.configManager.get("user") }) }), n.on(A.TokenReset, function() { n.logger.info("appid: " + t.app_id + " token reset, new userInfo:" + JSON.stringify(n.configManager.get("user"))), n.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u91CD\u7F6E\u4E86\u7528\u6237\u4FE1\u606F", time: Date.now(), secType: "USER", level: "info", data: n.configManager.get("user") }) }), n.on(A.RouteChange, function(e) { e.init || t.disable_route_report || n.pageView() }) }), this.tokenManager.apply(this, t), this.eventManager.apply(this, t), this.sessionManager.apply(this, t)), this.inited = !0)) : this.logger.warn("app_id param is error, must be number, please check!") : this.logger.warn("init params error,please check!") } , e.prototype.config = function(e) { var t, r; this.inited ? e && u(e) ? this.bridgeReport ? this.appBridge.setConfig(e) : (e._staging_flag && 1 === e._staging_flag && (this.staging = !0), e.disable_auto_pv && (this.disableAutoPageView = !0, delete e.disable_auto_pv), t = a({}, e), r = this.initConfig.configPersist || this.initConfig.config_persist || !1, this.initConfig && r && ((r = this.configManager.getStore()) && (t = Object.assign(r, e)), this.configManager.setStore(e)), t.web_id, t.user_unique_id, r = function(e, t) { var r = {}; for (i in e) Object.prototype.hasOwnProperty.call(e, i) && 0 > t.indexOf(i) && (r[i] = e[i]); if (null != e && "function" == typeof Object.getOwnPropertySymbols) for (var n = 0, i = Object.getOwnPropertySymbols(e); n < i.length; n++) 0 > t.indexOf(i[n]) && (r[i[n]] = e[i[n]]); return r }(t, ["web_id", "user_unique_id"]), this.configManager.set(r), t.hasOwnProperty("web_id") && this.emit(A.ConfigWebId, t.web_id), t.hasOwnProperty("user_unique_id") && this.emit(A.ConfigUuid, t.user_unique_id), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CCONFIG", level: "info", time: Date.now(), data: t })) : console.warn("config params is error, please check") : console.warn("config must be use after function init") } , e.prototype.setUserUniqueID = function(e) { this.config({ user_unique_id: e }) } , e.prototype.setHeaderInfo = function(e, t) { var r = {}; r[e] = t, this.config(r) } , e.prototype.removeHeaderInfo = function(e) { var t = {}; t[e] = void 0, this.config(t) } , e.prototype.setDomain = function(e) { this.configManager && this.configManager.setDomain(e), this.emit(A.ConfigDomain) } , e.prototype.getConfig = function(e) { return this.configManager.get(e) } , e.prototype.send = function() { this.start() } , e.prototype.start = function() { this.inited && !this.sended && (this.sended = !0, this.started = !0, this.emit(A.Start), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CSTART", level: "info", time: Date.now() }), this.bridgeReport) && (this.pageView(), this.emit(A.Ready)) } , e.prototype.event = function(e, t) { var r = this; try { var n = []; if (Array.isArray(e)) e.forEach(function(e) { (e = r.processEvent(e[0], e[1] || {})) && n.push(e) }); else { var i = this.processEvent(e, t); if (!i) return; n.push(i) } this.bridgeReport ? n.forEach(function(e) { var t = e.event , e = e.params; r.appBridge.onEventV3(t, JSON.stringify(e)) }) : n.length && (this.emit(A.Event, n), this.emit(A.SessionResetTime)) } catch (e) { this.logger.warn("something error, please check"), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } } , e.prototype.beconEvent = function(e, t) { var r; Array.isArray(e) ? console.warn("beconEvent not support batch report, please check") : (r = [], (e = this.processEvent(e, t || {})) && (r.push(e), r.length) && (this.emit(A.BeconEvent, r), this.emit(A.SessionResetTime))) } , e.prototype.beaconEvent = function(e, t) { this.beconEvent(e, t) } , e.prototype.processEvent = function(e, t) { void 0 === t && (t = {}); try { var r, n, i; return e ? (/^event\./.test(r = e) && (r = e.slice(6)), i = void ((n = "object" != typeof (n = t) ? {} : n).profile ? delete n.profile : n.event_index = _ += 1), n.local_ms ? (i = n.local_ms, delete n.local_ms) : i = +new Date, { event: r, params: n, local_time_ms: i, is_bav: this.initConfig && this.initConfig.autotrack ? 1 : 0 }) : (console.warn("eventName is null\uFF0C please check"), null) } catch (r) { return this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: r.message }), { event: e, params: t } } } , e.prototype.filterEvent = function(e) { this.eventFilter = e } , e.prototype.on = function(e, t) { this.hook.on(e, t) } , e.prototype.once = function(e, t) { this.hook.once(e, t) } , e.prototype.off = function(e, t) { this.hook.off(e, t) } , e.prototype.emit = function(e, t, r) { this.hook.emit(e, t, r) } , e.prototype.set = function(e) { this.hook.set(e) } , e.prototype.stop = function() { this.sdkStop = !0 } , e.prototype.reStart = function() { this.sdkStop = !1 } , e.prototype.pageView = function() { this.disableAutoPageView || this.predefinePageView() } , e.prototype.predefinePageView = function(e) { var t; void 0 === e && (e = {}), this.inited ? (t = { title: document.title || location.pathname, url: location.href, url_path: location.pathname, time: Date.now(), referrer: window.document.referrer, $is_first_time: "" + (this.configManager && this.configManager.is_first_time || !1) }, t = a({}, t, e), this.event("predefine_pageview", t)) : console.warn("predefinePageView must be use after function init") } , e.prototype.clearEventCache = function() { this.emit(A.CleanEvents) } , e.prototype.setWebIDviaUnionID = function(e) { var t; e && (t = h(e), this.config({ web_id: "" + t, wechat_unionid: e }), this.emit(A.CustomWebId)) } , e.prototype.setWebId = function(e) { this.config({ web_id: "" + e }) } , e.prototype.setWebIDviaOpenID = function(e) { var t; e && (t = h(e), this.config({ web_id: "" + t, wechat_openid: e }), this.emit(A.CustomWebId)) } , e.prototype.setNativeAppId = function(e) { this.bridgeReport && this.appBridge.setNativeAppId(e) } , e.prototype.getSessionId = y, e.prototype.setSessionId = function(e) { this.emit(A.SessionReset, e) } , e.prototype.resetStayDuration = function(e, t, r) { this.emit(A.ResetStay, { url_path: e, title: t, url: r }, A.Stay) } , e.prototype.resetStayParams = function(e, t, r) { this.emit(A.SetStay, { url_path: e = void 0 === e ? "" : e, title: t = void 0 === t ? "" : t, url: r = void 0 === r ? "" : r }, A.Stay) } , e.prototype.getToken = function(e, t) { var r, n, i, o = this; this.inited ? (r = !1, n = function(t) { var n; if (!r) return r = !0, n = o.configManager.get().user, t && (n.tobid = t, n["diss".split("").reverse().join("")] = t), e(a({}, n)) } , i = function() { o.tokenManager.getTobId().then(function(e) { n(e) }) } , this.sdkReady ? i() : (t && setTimeout(function() { n() }, t), this.on(A.Ready, function() { i() }))) : console.warn("getToken must be use after function init") } , e.prototype.profileSet = function(e) { this.bridgeReport ? this.appBridge.profileSet(JSON.stringify(e)) : this.emit(A.ProfileSet, e, A.Profile), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CprofileSet", level: "info", time: Date.now(), data: e }) } , e.prototype.profileSetOnce = function(e) { this.bridgeReport ? this.appBridge.profileSetOnce(JSON.stringify(e)) : this.emit(A.ProfileSetOnce, e, A.Profile), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CprofileSetOnce", level: "info", time: Date.now(), data: e }) } , e.prototype.profileIncrement = function(e) { this.bridgeReport ? this.appBridge.profileIncrement(JSON.stringify(e)) : this.emit(A.ProfileIncrement, e, A.Profile), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CprofileIncrement", level: "info", time: Date.now(), data: e }) } , e.prototype.profileUnset = function(e) { this.bridgeReport ? this.appBridge.profileUnset(e) : this.emit(A.ProfileUnset, e, A.Profile), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CprofileUnset", level: "info", time: Date.now(), data: e }) } , e.prototype.profileAppend = function(e) { this.bridgeReport ? this.appBridge.profileAppend(JSON.stringify(e)) : this.emit(A.ProfileAppend, e, A.Profile), this.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "SDK \u6267\u884CprofileAppend", level: "info", time: Date.now(), data: e }) } , e.prototype.setExternalAbVersion = function(e) { this.emit(A.AbExternalVersion, "string" == typeof e && e ? ("" + e).trim() : null, A.Ab) } , e.prototype.getVar = function(e, t, r) { this.emit(A.AbVar, { name: e, defaultValue: t, callback: r }, A.Ab) } , e.prototype.getABconfig = function(e, t) { this.emit(A.AbConfig, { params: e, callback: t }, A.Ab) } , e.prototype.getAbSdkVersion = function() { return this.configManager.getAbVersion() } , e.prototype.onAbSdkVersionChange = function(e) { var t = this; return this.emit(A.AbVersionChangeOn, e, A.Ab), function() { t.emit(A.AbVersionChangeOff, e, A.Ab) } } , e.prototype.offAbSdkVersionChange = function(e) { this.emit(A.AbVersionChangeOff, e, A.Ab) } , e.prototype.openOverlayer = function() { this.emit(A.AbOpenLayer, "", A.Ab) } , e.prototype.closeOverlayer = function() { this.emit(A.AbCloseLayer, "", A.Ab) } , e.prototype.getAllVars = function(e) { this.emit(A.AbAllVars, e, A.Ab) } , e.prototype.destoryInstace = function() { this.destroy || (this.destroy = !0, this.off(A.TokenComplete), this.emit(A.DestoryInstance)) } , e.prototype.destroyInstance = function() { this.destroy || (this.destroy = !0, this.off(A.TokenComplete), this.emit(A.DestoryInstance)) } , e.plugins = [], e }(), t = function() { function e() {} return e.prototype.apply = function(e, t) { var r = this; t.event_verify_url && ("string" == typeof t.event_verify_url ? (this.url = t.event_verify_url + "/v1/list_test", e.on(e.Types.SubmitBefore, function(t) { e.requestManager.useBeacon({ url: r.url, data: t }) })) : console.log("please use correct et_test url")) } , e }(), Q = function() { function e() {} return e.prototype.apply = function(e, t) { var r = this , n = (this.collect = e, this.config = t, this.duration = 6e4, this.reportUrl = e.configManager.getDomain() + "/profile/list", e.Types); this.eventCheck = new P(e,t), this.cache = {}, this.collect.on(n.ProfileSet, function(e) { r.setProfile(e) }), this.collect.on(n.ProfileSetOnce, function(e) { r.setOnceProfile(e) }), this.collect.on(n.ProfileUnset, function(e) { r.unsetProfile(e) }), this.collect.on(n.ProfileIncrement, function(e) { r.incrementProfile(e) }), this.collect.on(n.ProfileAppend, function(e) { r.appendProfile(e) }), this.collect.on(n.ProfileClear, function() { r.cache = {} }), this.ready(n.Profile) } , e.prototype.ready = function(e) { var t = this; if (this.collect.set(e), this.collect.hook._hooksCache.hasOwnProperty(e)) { var r = this.collect.hook._hooksCache[e]; if (Object.keys(r).length) for (var n in r) !function(e) { r[e].length && r[e].forEach(function(r) { t.collect.hook.emit(e, r) }) }(n) } } , e.prototype.report = function(e, t) { void 0 === t && (t = {}); try { var r, n; this.config.disable_track_event || ((r = []).push(this.collect.processEvent(e, t)), n = this.collect.eventManager.merge(r), this.collect.requestManager.useRequest({ url: this.reportUrl, data: n }), this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_EVENT, info: "\u57CB\u70B9\u4E0A\u62A5\u6210\u529F", time: Date.now(), data: n, code: 200, status: "success" })) } catch (e) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } } , e.prototype.setProfile = function(e) { (e = this.formatParams(e)) && Object.keys(e).length && (this.pushCache(e), this.report("__profile_set", a({}, e, { profile: !0 }))) } , e.prototype.setOnceProfile = function(e) { (e = this.formatParams(e, !0)) && Object.keys(e).length && (this.pushCache(e), this.report("__profile_set_once", a({}, e, { profile: !0 }))) } , e.prototype.incrementProfile = function(e) { e ? this.report("__profile_increment", a({}, e, { profile: !0 })) : console.warn("please check the params, must be object!!!") } , e.prototype.unsetProfile = function(e) { var t; e ? ((t = {})[e] = "1", this.report("__profile_unset", a({}, t, { profile: !0 }))) : console.warn("please check the key, must be string!!!") } , e.prototype.appendProfile = function(e) { if (e) { var t, r = {}; for (t in e) "string" == typeof e[t] || "Array" === Object.prototype.toString.call(e[t]).slice(8, -1) ? r[t] = e[t] : console.warn("please check the value of param: " + t + ", must be string or array !!!"); Object.keys(r).length && this.report("__profile_append", a({}, r, { profile: !0 })) } else console.warn("please check the params, must be object!!!") } , e.prototype.pushCache = function(e) { var t = this; Object.keys(e).forEach(function(r) { t.cache[r] = { val: t.clone(e[r]), timestamp: Date.now() } }) } , e.prototype.formatParams = function(e, t) { var r = this; void 0 === t && (t = !1); try { if (e && "[object Object]" === Object.prototype.toString.call(e)) { var n, i = {}; for (n in e) "string" == typeof e[n] || "number" == typeof e[n] || "Array" === Object.prototype.toString.call(e[n]).slice(8, -1) ? i[n] = e[n] : console.warn("please check the value of params:" + n + ", must be string,number,Array !!!"); var o, s = Object.keys(i); if (s.length && this.eventCheck.checkEventParams(i)) return o = Date.now(), s.filter(function(n) { var i = r.cache[n]; return t ? !i : !(i && r.compare(i.val, e[n]) && o - i.timestamp < r.duration) }).reduce(function(e, t) { return e[t] = i[t], e }, {}) } else console.warn("please check the params type, must be object !!!") } catch (e) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }), console.log("error") } } , e.prototype.compare = function(e, t) { try { return JSON.stringify(e) === JSON.stringify(t) } catch (e) { return this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }), !1 } } , e.prototype.clone = function(e) { try { return JSON.parse(JSON.stringify(e)) } catch (t) { return this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: t.message }), e } } , e.prototype.unReady = function() { console.warn("sdk is not ready, please use this api after start") } , e }(), X = function() { function e() { var e = this; this.setInterval = function() { var t, r, n, i; e.clearIntervalFunc = (t = function() { e.isSessionhasEvent && e.endCurrentSession() } , r = e.sessionInterval, void 0 === t && (t = function() {} ), void 0 === r && (r = 1e3), n = Date.now() + r, i = window.setTimeout(function e() { var o = Date.now() - n; t(), n += r, i = window.setTimeout(e, Math.max(0, r - o)) }, r), function() { window.clearTimeout(i) } ) } , this.clearInterval = function() { e.clearIntervalFunc && e.clearIntervalFunc() } } return e.prototype.apply = function(e, t) { var r = this; this.collect = e, t.disable_heartbeat || (this.sessionInterval = 6e4, this.startTime = 0, this.lastTime = 0, this.setInterval(), e = this.collect.Types, this.collect.on(e.SessionResetTime, function() { r.process() })) } , e.prototype.endCurrentSession = function() { this.collect.event("_be_active", { start_time: this.startTime, end_time: this.lastTime, url: window.location.href, referrer: window.document.referrer, title: document.title || location.pathname }), this.isSessionhasEvent = !1, this.startTime = 0 } , e.prototype.process = function() { this.isSessionhasEvent || (this.isSessionhasEvent = !0, this.startTime = +new Date); var e = this.lastTime || +new Date; this.lastTime = +new Date, this.lastTime - e > this.sessionInterval && (this.clearInterval(), this.endCurrentSession(), this.setInterval()) } , e }(), $ = function() { function e() {} return e.prototype.apply = function(e, t) { var r = this; t.channel_domain || t.disable_track_event || t.disable_sdk_monitor || (this.collect = e, this.config = t, this.url = e.configManager.getUrl("event"), this.collect.on(e.Types.Ready, function() { r.sdkOnload() }), this.collect.on(e.Types.SubmitError, function(e) { var t = e.type , n = e.eventData , e = e.errorCode; "f_data" === t && r.sdkError(n, e) })) } , e.prototype.sdkOnload = function() { var e = this; try { var t = this.collect.configManager.get() , r = t.header , n = t.user , i = r.app_id , o = r.app_name , s = r.sdk_version , a = n.web_id , c = { events: [{ event: "onload", params: JSON.stringify({ app_id: i, app_name: o || "", sdk_version: s, sdk_type: "npm", sdk_config: this.config, sdk_desc: "TOC", url: location.href }), local_time_ms: Date.now() }], user: { user_unique_id: a }, header: {} }; setTimeout(function() { e.collect.requestManager.useRequest({ url: e.url, data: [c], timeout: 3e4, app_key: "566f58151b0ed37e", forceXhr: !0 }) }, 16) } catch (e) {} } , e.prototype.sdkError = function(e, t) { var r = this; try { var n = e[0] , i = n.user , o = n.header , s = [] , a = (e.forEach(function(e) { e.events.forEach(function(e) { s.push(e) }) }), { events: s.map(function(e) { return { event: "on_error", params: JSON.stringify({ error_code: t, app_id: o.app_id, app_name: o.app_name || "", error_event: e.event, sdk_version: o.sdk_version, local_time_ms: e.local_time_ms, tea_event_index: Date.now(), params: e.params, header: JSON.stringify(o), user: JSON.stringify(i) }), local_time_ms: Date.now() } }), user: { user_unique_id: i.user_unique_id }, header: {} }); setTimeout(function() { r.collect.requestManager.useRequest({ url: r.url, data: [a], timeout: 3e4, app_key: "566f58151b0ed37e", forceXhr: !0 }) }, 16) } catch (e) {} } , e }(), Z = "undefined" != typeof window ? (window.LogPluginObject || (window.LogPluginObject = {}), window.LogPluginObject) : null, Y = function() { function e() {} return e.prototype.apply = function(e, t) { this._plugin = {}, this.config = t, this.collect = e, this.channel = t.channel || "cn", this.loadExtend() } , e.prototype.loadExtend = function() { var e = this; try { this.collect.remotePlugin.forEach(function(t, r) { var n, i; "sdk" === t ? V.hasOwnProperty(r) ? (n = V[r].object, i = V[r].src[e.channel] + "?query=" + Date.now(), e.exist(r, n, i)) : console.warn("your " + r + " is not exist\uFF0Cplease check plugin name") : "object" == typeof t && (t.src ? e.exist(r, t.call, t.src) : e.process(r, t.instance, "INSTANCE")) }) } catch (e) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }), console.log("load extend error") } } , e.prototype.exist = function(e, t, r) { var n = this; Z[t] ? (this.process(e, Z[t]), console.log("\u5DF2\u6709" + e + "\u63D2\u4EF6\uFF0C\u907F\u514D\u91CD\u590D\u52A0\u8F7D~")) : this.loadPlugin(e, r, function() { n.process(e, Z[t]), console.log(" %c %s %s %s", "color: yellow; background-color: black;", "\u2013", "load plugin:" + e + " success", "-") }, function() { console.log(" %c %s %s %s", "color: red; background-color: yellow;", "\u2013", "load plugin:" + e + " error", "-") }) } , e.prototype.process = function(e, t, r) { try { var n; r ? ((n = new t).apply && n.apply(this.collect, this.config), console.log("excude " + e + " success")) : t && t(this.collect, this.config) } catch (t) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: t.message }), console.log("excude " + e + " error, message:" + t.message) } } , e.prototype.loadPlugin = function(e, t, r, n) { var i = this; try { var o = document.createElement("script"); o.src = t, this._plugin[e] || (this._plugin[e] = []), this._plugin[e].push(r), o.onerror = function() { n(t) } , o.onload = function() { i._plugin[e].forEach(function(e) { e() }) } , document.getElementsByTagName("head")[0].appendChild(o) } catch (e) { this.collect.emit(S.DEBUGGER_MESSAGE, { type: S.DEBUGGER_MESSAGE_SDK, info: "\u53D1\u751F\u4E86\u5F02\u5E38", level: "error", time: Date.now(), data: e.message }) } } , e }(), Y = (J.usePlugin(Y, "extend"), J.usePlugin(t, "et"), J.usePlugin(Q, "profile"), J.usePlugin(X, "heartbeat"), J.usePlugin($, "monitor"), new J("default")), ee = Y, et = { selectRoute: 900, browserError: 1e3, crc32: 1e3, preUpload: 1001, initUploadID: 1002, process: 1003, fileMerge: 1004, complete: 1005 }, er = "video", en = "image", ei = "object", eo = { video: "video_upload", image: "image_upload", object: "object_upload" }, es = "imagex"; function ea(e) { return (ea = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function ec() { return (ec = Object.assign ? Object.assign.bind() : 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 eu(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== ea(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== ea(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === ea(n) ? n : String(n)), i) } } var el = function() { var e, t, r; function n(e, t) { switch (!function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, n), this.options = e, this.context = t, this.teaLog = ee, this.tea_app_id = 2562, this.tea_channel = "cn", this.options.region) { case "us-east-1": case "us-east-red": case "gcp": case "US-TTP": this.tea_app_id = 2643, this.tea_channel = "va"; break; case "boei18n": case "ap-singapore-1": this.tea_app_id = 2643, this.tea_channel = "sg"; break; default: this.tea_app_id = 2562, this.tea_channel = "cn" } this.teaLog.init({ app_id: this.tea_app_id, channel: this.tea_channel, log: !1, disable_sdk_monitor: !0, disable_auto_pv: !0 }), this.teaLog.config({ evtParams: { sdk_version: "2.0.9", line_app_id: this.options.appId }, user_unique_id: this.options.userId }), this.teaLog.start() } return e = n, t = [{ key: "send", value: function(e) { var t = this.context , r = e.key , t = t.tasks[r] , n = et[e.stage] || 999 , t = e.fileType || t && t.fileType , i = e.fileSize || 0 , r = { log_type: eo[t], stage: n, fk: r, fs: i, req: e.req, res: e.res, ts: Math.round(Date.now() / 1e3), sst: e.stageStartTime, set: e.stageEndTime, dur: e.duration, tdur: e.totalDuration, durs: e.duration / 1e3, tdurs: e.totalDuration / 1e3, eslr: e.enableSelectRoute, ucsrr: e.useClientSelectRouteResult, skipCommit: !!e.skipCommit } , i = e.type , o = "error" === i || "retry" === i ? i : n , t = "".concat("image" === t ? "image" : "video", "_").concat(o); "success" === i ? this.sendSuccessLog(t, e, r, n) : this.teaLog.event(t, ec({}, r, { type: e.type, oid: e.oid, upload_host: e.tosDomain, errc: e.extra && e.extra.errorCode, ex: JSON.stringify({ errc: e.extra && e.extra.errorCode, msg: e.extra && e.extra.message }) })) } }, { key: "sendSuccessLog", value: function(e, t, r, n) { switch (r.type = t.type, n) { case et.selectRoute: this.teaLog.event(e, ec({}, r, { race_info: t.raceInfo, client_ip: t.lastClientIp, uc: t.useCache, ex: JSON.stringify({ msg: t.extra && t.extra.message }) })); break; case et.crc32: this.teaLog.event(e, ec({}, r, { ex: JSON.stringify({ msg: t.extra && t.extra.message, crc32Array: t.crc32Array, isDirect: t.isDirect }) })); break; case et.preUpload: this.teaLog.event(e, ec({}, r, { oid: t.oid, upload_host: t.tosDomain, ex: JSON.stringify({ msg: t.extra && t.extra.message, sig: t.signature, stk: t.proxyStsToken }) })); break; case et.initUploadID: this.teaLog.event(e, ec({}, r, { oid: t.oid, upload_host: t.tosDomain, ex: JSON.stringify({ msg: t.extra && t.extra.message, upid: t.UploadID }) })); break; case et.process: t.isAllFinish || t.isDirect || (delete r.sst, delete r.set, delete r.dur), this.teaLog.event(e, ec({}, r, { oid: t.oid, upload_host: t.tosDomain, af: t.isAllFinish, cst: t.crc32StartTime, cet: t.crc32EndTime, cdur: t.crc32Duration, slst: t.sliceStartTime, slet: t.sliceEndTime, sldurs: t.sliceDuration && t.sliceDuration / 1e3, ex: JSON.stringify({ msg: t.extra && t.extra.message, si: t.sliceIndex, af: t.isAllFinish }) })); break; case et.fileMerge: this.teaLog.event(e, ec({}, r, { oid: t.oid, upload_host: t.tosDomain, ex: JSON.stringify({ msg: t.extra && t.extra.message }) })); break; case et.complete: this.teaLog.event(e, ec({}, r, { oid: t.oid, upload_host: t.tosDomain, speed: Math.round(t.fileSize / (t.totalDuration / 1e3) / 1024), ex: JSON.stringify({ msg: t.extra && t.extra.message, vid: t.uploadResult && t.uploadResult.Vid }) })) } } }, { key: "console", value: function(e) { function t(t) { return e.apply(this, arguments) } return t.toString = function() { return e.toString() } , t }(function(e) { this.options.debug && console.log(e) }) }], eu(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), n }() , t = r(6) , ef = r.n(t) , Q = r(4) , ep = r.n(Q) , eh = { urlTemplate: function(e, t) { var r; return Object.keys(t = t || {}).forEach(function(n) { r = RegExp("{".concat(n, "}"), "g"), e = e.replace(r, t[n]) }), e }, toQueryString: function() { var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; return Object.keys(e).map(function(t) { return "".concat(t, "=").concat(encodeURIComponent(e[t])) }).join("&") }, supportChunked: function() { 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() { return !!window.FormData || window.ProgressEvent && window.FileReader }, supportCrc32: function() { var e = window.FileReader && window.FileReader.prototype.readAsBinaryString; return "undefined" != typeof Int32Array && e && (Blob.prototype.slice || Blob.prototype.webkitSlice || Blob.prototype.mozSlice) }, storage: function(e) { var t = e , e = { removeItem: function(e) { delete t.cache[e] }, setItem: function(e, r) { t.cache[e] = r }, getItem: function(e) { return t.cache[e] }, clear: function() { delete t.cache, t.cache = {} } }; if (!(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]) try { if (window.localStorage) return window.localStorage.setItem("", ""), window.localStorage } catch (e) {} return e }, noop: function() {}, getUnique: function(e) { return "".concat(e, "_").concat((new Date).getTime(), "_").concat(parseInt(1e6 * Math.random())) }, getFileSliceLength: function(e, t) { var r = e.size; return t && "function" == typeof t ? 2097152 > t(r) ? 2097152 : t(r) || r : 0xc800000 < r ? 0xa00000 : r <= 0xc800000 && 2097152 <= r ? 5242880 : e.size }, getFileSuffix: function(e) { if (e && "[object String]" === Object.prototype.toString.call(e)) { var t = e.lastIndexOf("."); return 0 < t && (e = ".".concat(e.substring(t + 1))).length <= 8 ? e : "" } }, fileSlice: function(e, t, r) { return (e.slice || e.webkitSlice || e.mozSlice).call(e, t, r) }, getPathByURL: function(e) { return /^(?:(https?:)\/\/)?(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/.exec(e)[5] || "/" }, crypto: { hmac: function(e, t) { return ef()(t, e) }, sha256: function(e) { return ep()(e) } }, date: { iso8601: function(e) { return (e = void 0 === e ? eh.date.getDate() : e).toISOString().replace(/\.\d{3}Z$/, "Z") } }, Buffer: Uint8Array, generateKey: function(e) { for (var t = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", n = r.length, i = 0; i < e; i++) t += r.charAt(Math.floor(Math.random() * n)); return t } }; function ed(e) { return (ed = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function eg(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== ed(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== ed(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === ed(n) ? n : String(n)), i) } } function ey(e, t) { return (ey = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function em(e) { return (em = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var ev = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && ey(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = em(e); return function(e, t) { if (t && ("object" === ed(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, em(this).constructor) : r.apply(this, arguments)) } ); function a() { var e; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (e = s.call(this)).xhr = new XMLHttpRequest, e._data = null, e } return r = a, i = [{ key: "_ajax", value: function(e) { var t = this , r = this.xhr; r.upload.onprogress = function(e) { t.emit("progress", e) } , r.onreadystatechange = function() { 4 === r.readyState && (r.upload.onprogress = eh.noop, r.onreadystatechange = eh.noop, r.params = e, t._data && t._data.url && (r.currentUrl = t._data.url), r.status >= 200 && r.status < 300 || 304 === r.status ? t.emit("complete", r) : r.status >= 400 && t.emit("error", r)) } , r.onerror = function() { r.errText = "unknow net error", t.emit("error", r) } , r.ontimeout = function() { r.errText = "timeout", t.emit("error", r) } , r.onabort = function() { r.errText = "abort", t.emit("error", r) } , r.send(e) } }, { key: "send", value: function(e) { var t = this; return this._data = e, this.xhr.open(e.method || "POST", e.url || "", !0), e.headers && Object.keys(e.headers).forEach(function(r) { t.xhr.setRequestHeader(r, e.headers[r]) }), this.xhr.timeout = e.timeout || 0, e.ontimeout && (this.xhr.ontimeout = e.ontimeout), e.binary ? this.sendAsBinary(e) : e.custom ? "object" === ed(e.custom) ? this.sendAsCustom(JSON.stringify(e.custom)) : "none" === e.custom ? (delete e.custom, this.sendAsCustom()) : this.sendAsCustom(e.custom) : this.sendAsFormData(e) } }, { key: "sendAsBinary", value: function(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(e) { t = (t = e.formData ? "function" == typeof e.formData ? e.formData() : e.formData : t) || []; for (var t, r = new FormData, n = 0, i = t.length; n < i; n++) { var o = r[n]; r.append(o.name, o.value) } return e.file && r.append(e.field, e.file, e.name), this._ajax(r) } }, { key: "sendAsCustom", value: function(e) { return this._ajax(e) } }, { key: "abort", value: function() { this.xhr.onreadystatechange = eh.noop, this.xhr.abort() } }, { key: "getResponse", value: function() { return this.xhr.response } }, { key: "getText", value: function() { return this.xhr.responseText } }, { key: "getJson", value: function() { return JSON.parse(this.xhr.responseText) } }], eg(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }() , X = r(1) , eb = r.n(X); function e_(e) { return (e_ = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function eS(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function ex(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? eS(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = eE(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : eS(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e } function ew() { return (ew = Object.assign ? Object.assign.bind() : 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 ek(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, eE(n.key), n) } } function eE(e) { return e = function(e, t) { if ("object" !== e_(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== e_(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === e_(e) ? e : String(e) } function eO(e, t) { return (eO = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function eT(e) { return (eT = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var eC = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && eO(e, t) }(c, n.a); var e, t, r, i, s, a = (e = c, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = eT(e); return function(e, t) { if (t && ("object" === e_(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, eT(this).constructor) : r.apply(this, arguments)) } ); function c(e, t) { var r; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, c), (r = a.call(this)).options = e, r.config = t, r.uploaderCtx = e.context, r.file = e.file, r.cacheKey = "__bd_uploader_cache", r } return r = c, i = [{ key: "start", value: function(e, t) { this._st = Date.now(), this.uploaderCtx._broadcast("startSelectRoute", null, !0), this.clientIp = e.clientIp, this.selectRouteTimeout = e.selectRouteTimeout || 5e3, this.selectRouteCacheTime = e.selectRouteCacheTime || 36e5, this.selectRouteFileSize = e.selectRouteFileSize || 0x80000000, this.completeCallback = t, (e = this.checkSelect({ clientIp: this.clientIp })) ? this.success(e, null, !0) : this.startSelectRoute() } }, { key: "checkSelect", value: function(e) { var e = e.clientIp , t = null; try { t = JSON.parse(this.uploaderCtx.storage.getItem(this.cacheKey)) } catch (e) { return null } if (t) { var r = t.lastClientIp , n = t.lastSelectRouteTime; if (e && e !== r) return null; if ((new Date).getTime() - n < this.selectRouteCacheTime) return t } return null } }, { key: "startSelectRoute", value: function() { var e = this , t = this.config.region , r = new ev , n = (r.on("complete", function(t) { if (t.response) try { var r, n = JSON.parse(t.response); n.ResponseMetadata.Error ? e.fail({ xhr: t, errorCode: n.ResponseMetadata.Error.CodeN, error: n.ResponseMetadata.Error.Code, message: n.ResponseMetadata.Error.Message }) : (r = n.Result.Domains, e.race(r, t)) } catch (r) { e.fail({ error: "catch error: ".concat(r.toString()), xhr: t }) } else e.fail({ error: "request fail: ".concat(t.statusText || t.errText || "UNKNOWN"), xhr: t }) }), r.on("error", function(t) { var r = { error: "request fail: ".concat(t.statusText || t.errText || "UNKNOWN"), xhr: t }; t.response && (t = JSON.parse(t.response)).ResponseMetadata && t.ResponseMetadata.Error && (r.errorCode = t.ResponseMetadata.Error.CodeN, r.error = t.ResponseMetadata.Error.Code, r.message = t.ResponseMetadata.Error.Message), e.fail(r) }), this.config.videoHost) , i = this.config.videoConfig && this.config.videoConfig.spaceName , o = { Action: "GetUploadCandidates", Version: "2020-11-19", SpaceName: i = this.options.type === ei && null != (o = this.config.objectConfig) && o.spaceName ? null == (o = this.config.objectConfig) ? void 0 : o.spaceName : i } , i = this.options.stsToken , s = eh.toQueryString(o) , a = i.AccessKeyID , c = i.AccessKeyId , u = i.SecretAccessKey , l = i.SessionToken , i = i.CurrentTime , n = { method: "GET", url: "".concat(n, "?").concat(s), timeout: this.config.gatewayTimeout, region: t, params: o } , s = new eb.a(n,"vod") , t = (this.config.useServerCurrentTime && Math.abs(new Date(i) - new Date) > 6e4 && (this.systemTimeGap = new Date(i) - new Date), this.systemTimeGap ? new Date((new Date).getTime() + this.systemTimeGap) : new Date); s.addAuthorization({ accessKeyId: c || a, secretAccessKey: u, sessionToken: l }, t), r.send(n) } }, { key: "race", value: function(e, t) { var r = this , n = this.file , i = (n.slice || n.webkitSlice || n.mozSlice).call(n, 0, Math.min(this.selectRouteFileSize, n.size)) , s = e.map(function(e) { return { domainName: e.Name, domainInfo: e, percent: 0, startTime: (new Date).getTime(), endTime: (new Date).getTime(), complete: !1 } }) , a = 0 , c = s.length; s.forEach(function(e, n) { var i = new ev; i.on("complete", function() { s[n].endTime = (new Date).getTime(), s[n].complete = !0, s.forEach(function(e, t) { n !== t && e.transport && e.transport.abort() }), r.formatRaceInfo(s, t) }), i.on("error", function(e) { s[n].endTime = (new Date).getTime(), s[n].complete = !0, s[n].error = e.errText, c <= ++a && r.formatRaceInfo(s, t) }), i.on("progress", function(e) { e = e.loaded / e.total, s[n].percent = e }), s[n].transport = i }), s.forEach(function(e) { var t = e.domainInfo , n = { oid: t.StoreID, tosDomain: "".concat(r.config.schema, "://").concat(t.Name) } , n = "".concat(eh.urlTemplate(o, n), "?speedtest") , t = t.Sign; e.transport.send({ method: "post", url: n, headers: { Authorization: t, "Content-CRC32": "ignore" }, file: i, binary: 1, timeout: r.selectRouteTimeout }) }) } }, { key: "formatRaceInfo", value: function(e, t) { e.sort(function(e, t) { return e.percent < t.percent ? 1 : e.percent > t.percent ? -1 : e.error ? 1 : t.error ? -1 : 0 }), e.forEach(function(e) { delete e.transport }), e = { lastClientIp: this.clientIp, lastSelectRouteTime: (new Date).getTime(), raceInfo: e, type: "success" }, this.uploaderCtx.storage.setItem(this.cacheKey, JSON.stringify(e)), this.success(e, t) } }, { key: "success", value: function(e, t) { var r = 2 < arguments.length && void 0 !== arguments[2] && arguments[2] , t = t && this.formatXhr(t); this.uploaderCtx.logger.send(ew(ex(ex({ stage: "selectRoute", stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, fileSize: this.file && this.file.size }, t), {}, { useCache: r }), e)), this.uploaderCtx._broadcast("completeSelectRoute", ex(ex({}, e), {}, { useCache: r }), !0), this.completeCallback({ selectRouteResult: e.raceInfo }) } }, { key: "fail", value: function(e) { var t = { error: e.error, errorCode: e.errorCode, message: e.message }; this.uploaderCtx.logger.send(ew(ex({ stage: "selectRoute", stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, fileSize: this.file && this.file.size, extra: t, type: "warn" }, this.formatXhr(e.xhr)))), this.uploaderCtx._broadcast("completeSelectRoute", ex({ type: "warn" }, t), !0), this.completeCallback() } }, { key: "formatXhr", value: function(e) { return { req: { url: e.currentUrl, param: e.params }, res: { status: e.status, header: e.getAllResponseHeaders(), body: e.responseText } } } }], ek(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), c }() , eD = { crc32: function(e, t) { for (var r = [0, 0x77073096, 0xee0e612c, 0x990951ba, 0x76dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0xedb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x9b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x1db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x6b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0xf00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x86d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x3b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x4db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0xd6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0xa00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x26d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x5005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0xcb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0xbdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 936918e3, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d], n = ("undefined" != typeof Int32Array && (r = new Int32Array(r)), -1 ^ ~~t), i = (e = new Uint8Array(e)).length, o = 0; o < i; o++) n = r[255 & (n ^ e[o])] ^ n >>> 8; return (-1 ^ n) >>> 0 }, dec2hex: function(e) { if (void 0 !== e) return function e(t) { return t.length < 8 ? e(t = "0".concat(t)) : t }(Number(e).toString(16)) } }; function ej(e) { return (ej = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function eI(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== ej(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== ej(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === ej(n) ? n : String(n)), i) } } var eP = function() { var e, t, r; function n(e, t, r, i) { !function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, n), this.file = e, this.successProcess = r, this.failProcess = i, this.sliceLength = t, this.retryTime = 0, this.fileSize = e.size, this.crc32Array = [] } return e = n, t = [{ key: "start", value: function() { this.readFileCrc32(this.file) } }, { key: "readFileCrc32", value: function(e) { var t = this , r = this.sliceLength , n = e.slice || e.webkitSlice || e.mozSlice , i = new FileReader , o = 0 , s = 0 , a = 0; (function c() { s < e.size && (s = Math.min(o + r, e.size), e.size > 0x6400000) && (s = e.size), i.readAsArrayBuffer(n.call(e, o, s)), i.onload = function(r) { r = r.target.result, a = eD.crc32(r, 0), t.crc32Array.push({ start: o, end: s, crc32: eD.dec2hex(a), buffer: r }), (o = s) < e.size ? c() : t.success(t.crc32Array) } } )() } }, { key: "success", value: function(e) { this.successProcess(e) } }, { key: "fail", value: function(e, t, r, n) { 3 <= this.retryTime ? this.failProcess() : (this.readFileCrc32(e, t, r, n), this.retryTime++) } }], eI(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), n }() , eA = "The format of stsToken is incorrect."; function eR(e) { return (eR = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function ez() { return (ez = Object.assign ? Object.assign.bind() : 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 eB(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r]; return n } function eU(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== eR(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== eR(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === eR(n) ? n : String(n)), i) } } var eM = function() { var e, t, r; function n(e) { var t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; !function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, n), this.context = e.context, this.key = e.key, this.isDirect = e.isDirect, this.isImageBatchUpload = e.isImageBatchUpload, this.file = e.file, this.type = (this.isImageBatchUpload ? null == (e = this.file[0]) ? void 0 : e.type : null == (e = this.file) ? void 0 : e.type) || "", this.sliceLength = eh.getFileSliceLength(this.file, t.getSliceFunc), this.config = t } return e = n, t = [{ key: "start", value: function(e, t, r) { this.successProcess = t, this.failProcess = r, this._st = Date.now(), this.crc32(this.file, this.sliceLength) } }, { key: "crc32", value: function(e, t) { var r = this; if (this.isImageBatchUpload) for (var n = e.length, i = [], o = function(t) { new eP(e[t],e[t].size,function(e) { i[t] = e[0], i.filter(function(e) { return !!e }).length === n && r.success(i) } ,function(e) { r.fail(e) } ).start() }, s = 0; s < n; s++) o(s); else e && e.size && !(e.size <= 0) ? this.isDirect ? new eP(e,e.size,function(e) { r.success(e) } ,function(e) { r.fail({ errorCode: 1000003, message: "get crc32 error: ".concat(e && e.message) }) } ).start() : this.sliceFile(e, t, function(e) { r.success(e) }, function(e) { r.fail(e) }) : this.fail({ errorCode: 1000003, message: "There is a problem with the input file or fileSize." }) } }, { key: "sliceFile", value: function(e, t, r, n) { for (var i = [], o = e.size, s = e.slice || e.webkitSlice || e.mozSlice, a = 0, c = 0, u = 0; c < o; ) c = Math.min(a + t, o), 0x6400000 < o && o - c <= 5242880 && (c = o), i.push({ start: a, end: c, crc32: 0 }), a = c; try { !function t(a) { var c = new FileReader , l = i[a].start , f = i[a].end; c.readAsArrayBuffer(s.call(e, l, f)), c.onload = function(e) { e = e.target.result, u = eD.dec2hex(eD.crc32(e, 0)), i[a].crc32 = u, f === o ? r(i) : t(i.length - 1) } , c.onerror = function(e) { var t = e.target.error.name , e = e.target.error.message; n({ crc32Array: i, errorCode: 1000003, message: "".concat(t, ": ").concat(e) }) } }(0) } catch (e) { n({ message: e && e.toString() }) } } }, { key: "getCrc32Key", value: function(e, t) { var r; return (t = "[object Array]" === Object.prototype.toString.call(t) ? function(e) { if (Array.isArray(e)) return eB(e) }(r = t) || function(e) { if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e) }(r) || function(e, t) { var r; if (e) return "string" == typeof e ? eB(e, void 0) : "Map" === (r = "Object" === (r = Object.prototype.toString.call(e).slice(8, -1)) && e.constructor ? e.constructor.name : r) || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? eB(e, t) : void 0 }(r) || function() { throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }() : [t]).push(e[0].crc32, e[e.length - 1].crc32), this.config.instanceId && t.push(this.config.instanceId), t.join("_") } }, { key: "success", value: function(e) { var t = this.context , r = this.key , n = [] , i = []; if (this.isImageBatchUpload) for (var o = 0; o < this.file.length; o++) n.push(this.file[o].size), i.push(this.file[o].name); else n = this.file.size, i = this.file.name; var s = this.getCrc32Key(e, n) , t = t.tasks[r]; t && this.successProcess(ez(t, { key: r, crc32Array: e, crc32Key: s, sdkVersion: "2.0.9", sliceLength: this.sliceLength, extra: { message: "get crc32 success" }, stage: "crc32", type: "success", fileSize: n, fileName: i, 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(e) { var t = this.context , r = this.key , n = e && e.message ? e.message : "get crc32 error" , i = e && e.errorCode , e = e && e.crc32Array , t = ez(t.tasks[r], { crc32Array: e, extra: { message: n, errorCode: i }, type: "error", stage: "crc32", stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st }); this.failProcess(t) } }], eU(e.prototype, t), Object.defineProperty(e, "prototype", { writable: !1 }), n }() , eG = { checkStsToken: function(e) { return !e || e.SessionToken && e.SecretAccessKey && (e.AccessKeyId || e.AccessKeyID) }, checkServiceName: function(e, t, r) { if ("vod" === r || r === es) return r; if (e !== er) { if (e === en) return es; if (e === ei) { if (t.objectConfig && t.objectConfig.spaceName) return "vod"; if (t.objectConfig && t.objectConfig.serviceId) return es; if (t.videoConfig && t.videoConfig.spaceName) return "vod"; if (t.imageConfig && t.imageConfig.serviceId) return es } } return "vod" } }; function eF(e) { return (eF = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function eN(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function eH() { return (eH = Object.assign ? Object.assign.bind() : 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 eL(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, eK(n.key), n) } } function eK(e) { return e = function(e, t) { if ("object" !== eF(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== eF(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === eF(e) ? e : String(e) } function eq(e, t) { return (eq = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function eV(e) { return (eV = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var eW = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && eq(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = eV(e); return function(e, t) { if (t && ("object" === eF(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, eV(this).constructor) : r.apply(this, arguments)) } ); function a(e, t) { var r; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (r = s.call(this)).options = e, r.config = t, r.uploaderCtx = e.context, r.currFileCtx = e.context.tasks[e.key], r.systemTimeGap = 0, r.retryTime = t.retryTaskTime, r.hasRetryTime = 0, r.isImageBatchUpload = !!r.options.isImageBatchUpload, r.isDirect = r.options.isDirect, r.serviceName = eG.checkServiceName(r.options.type, r.config, r.options.serviceType), r } return r = a, i = [{ key: "start", value: function(e, t, r) { this.startOptions = e, this.failProcess = r, this.successProcess = t, this._st = Date.now(), r = (e = this.uploaderCtx._getCache(this.currFileCtx.crc32Key)) ? JSON.parse(e) : {}, !this.isDirect && r.oid && r.UploadID ? this.resumeFromCache(r) : this.startPreUpload() } }, { key: "startPreUpload", value: function() { var e = this , t = this.config.region , r = new ev , n = (r.on("complete", function(t) { e.success(t) }), r.on("error", function(t) { e.handleError(t) }), "") , i = {} , o = this.uploaderCtx.useBackupDomain , s = eG.checkServiceName(this.options.type, this.config, this.options.serviceType) , i = s === es ? (n = o ? this.config.imageFallbackHost : this.config.imageHost, this.createImageXParams()) : (n = o ? this.config.videoFallbackHost : this.config.videoHost, this.createVodParams()) , o = (this.currFileCtx.fileSize && (i.FileSize = this.currFileCtx.fileSize), this.config.useFileExtension && this.currFileCtx.fileName && (this.options.type === ei || this.options.type === en) && (o = this.currFileCtx.fileName, o = eh.getFileSuffix(o)) && (i.FileExtension = o), this.options.fileExtension && (i.FileExtension = this.options.fileExtension), this.config.accountId && (i["X-Account-Id"] = this.config.accountId), this.options.type !== er && this.config.bizType && (i.BizType = this.config.bizType, i.AppID = this.config.appId, i.UserID = this.config.userId), this.config.openExperiment && (i.app_id = this.config.appId, i.user_id = this.config.userId), i.s = Math.random().toString(36).substring(2), this.options.fileSize && (i.FileSize = this.options.fileSize), this.currFileCtx.proxyStsToken || this.config.stsToken) , a = eh.toQueryString(i) , c = o.AccessKeyID , u = o.AccessKeyId , l = o.SecretAccessKey , f = o.SessionToken , o = o.CurrentTime , a = { method: "GET", url: "".concat(n, "?").concat(a), timeout: this.config.gatewayTimeout || 0, region: t, params: i, pathname: eh.getPathByURL(n) } , t = new eb.a(a,s) , i = (this.config.useServerCurrentTime && Math.abs(new Date(o) - new Date) > 6e4 && (this.systemTimeGap = new Date(o) - new Date), this.systemTimeGap ? new Date((new Date).getTime() + this.systemTimeGap) : new Date); t.addAuthorization({ accessKeyId: u || c, secretAccessKey: l, sessionToken: f }, i), r.send(a) } }, { key: "createImageXParams", value: function() { var e, t = { Action: "ApplyImageUpload", Version: "2018-08-01" }; return this.options.type === en && (this.config.imageConfig && this.config.imageConfig.serviceId ? t.ServiceId = this.config.imageConfig.serviceId : t.SpaceName = this.config.videoConfig && this.config.videoConfig.spaceName), this.options.type === ei && (t.ServiceId = this.config.objectConfig && this.config.objectConfig.serviceId || this.config.imageConfig && this.config.imageConfig.serviceId), this.currFileCtx.fileSize && 1 < this.currFileCtx.fileSize.length && (t.UploadNum = this.currFileCtx.fileSize.length), this.options.storeKey && (e = this.options.storeKey, "[object Array]" === Object.prototype.toString.call(e) ? t.StoreKeys = e : "[object String]" === Object.prototype.toString.call(e) && (t.StoreKeys = [e])), t } }, { key: "createVodParams", value: function() { var e = this.config.videoConfig && this.config.videoConfig.spaceName , t = { Action: "ApplyUploadInner", Version: "2020-11-19", SpaceName: e = this.options.type === ei && null != (t = this.config.objectConfig) && t.spaceName ? null == (t = this.config.objectConfig) ? void 0 : t.spaceName : e, FileType: this.options.type, IsInner: 1 }; return this.config.enOID && (t.EnOID = 1), (this.options.testHost || this.config.testHost) && (t.TestHost = this.options.testHost || this.config.testHost), this.startOptions && this.startOptions.selectRouteResult && (e = this.startOptions.selectRouteResult, t.ClientBestHosts = e.map(function(e) { return e.domainName }).join(",")), t } }, { key: "resumeFromCache", value: function(e) { var t = this , r = this.options.key , n = new ev , i = (n.on("complete", function(n) { var i = null; try { var o = JSON.parse(n.response); if (!(2e3 === o.code && 0 < o.data.partlist.length)) return t.startPreUpload(); var s = t.confirmCache(o.data.partlist) , a = e.hasMerge ? 5 : s.isAllFinished ? 4 : 3 , i = eH(t.currFileCtx, e, { key: r, xhr: n, extra: { message: "prepare upload from cache success" }, stage: "preUpload", type: "success", percent: 0, cacheTask: a, proxyStsToken: t.options.stsToken, currentTask: 1, status: 1, isBreak: 1, crc32Array: s.crc32Array, stageStartTime: t._st, stageEndTime: Date.now(), duration: Date.now() - t._st, totalDuration: Date.now() - t._st + t.currFileCtx.totalDuration }) } catch (e) { return t.startPreUpload() } t.successProcess(i) }), n.on("error", function(e) { e.status >= 400 ? t.startPreUpload() : t.fail({ error: "request error", xhr: e }) }), this.config.userId); n.send({ method: "get", url: eh.urlTemplate("{tosDomain}/upload/v1/{oid}?uploadid={uploadId}&action=part_list", { tosDomain: e.tosDomain, oid: e.oid, uploadId: e.UploadID }), headers: function(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? eN(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = eK(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : eN(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e }({ Authorization: e.signature, "X-Storage-U": encodeURIComponent(i) }, e.UploadHeader), timeout: 3e4 }) } }, { key: "confirmCache", value: function(e) { var t = this.currFileCtx.crc32Array , r = {} , n = (e.forEach(function(e) { void 0 === r[e.num - 1] && (r[e.num - 1] = { tag: !0, crc32: e.crc32 }) }), !0) , e = t.map(function(e, t) { return r[t] && r[t].tag && r[t].crc32 ? (e.crc32 = r[t].crc32, e.finished = !0, e.loaded = e.end - e.start) : n = !1, e }); return { isAllFinished: n, crc32Array: e } } }, { key: "handleError", value: function(e) { if ((this.options.type === en && this.config.imageFallbackHost || this.options.type === er && this.config.videoFallbackHost) && !this.uploaderCtx.useBackupDomain) this.hasRetryTime < this.retryTime - 1 ? this.hasRetryTime++ : this.uploaderCtx.useBackupDomain = !0, this.startPreUpload(); else { var t = { error: "request fail: ".concat(e.statusText || e.errText || "UNKNOWN"), xhr: e }; if (e.response) try { var r = JSON.parse(e.response); r.ResponseMetadata && r.ResponseMetadata.Error && (t.errorCode = r.ResponseMetadata.Error.CodeN, t.error = r.ResponseMetadata.Error.Code, t.message = r.ResponseMetadata.Error.Message) } catch (r) { t.error = e.response.toString(), t.message = e.response.toString() } this.fail(t) } } }, { key: "success", value: function(e) { if (e.response) { var t = null; try { var r = JSON.parse(e.response); if (r.ResponseMetadata.Error) return this.fail({ xhr: e, errorCode: r.ResponseMetadata.Error.CodeN, error: r.ResponseMetadata.Error.Code, message: r.ResponseMetadata.Error.Message }); var n, i, o, s, a, c, u, l = this.serviceName, f = r.Result, p = l === es ? f.UploadAddress : f.InnerUploadAddress.UploadNodes[0], h = p.StoreInfos, d = p.UploadHosts, g = p.SessionKey, y = p.UploadHeader, m = l === es ? d[0] : p.UploadHost, v = null == (n = h[0]) ? void 0 : n.UploadID, b = [], _ = []; this.isImageBatchUpload && 1 < h.length ? h.forEach(function(e) { b.push(e.Auth), _.push(e.StoreUri) }) : (b = h[0].Auth, _ = h[0].StoreUri), "vod" === l && (i = f.InnerUploadAddress.UploadNodes).length && 1 < i.length && (s = { SessionKey: (o = i[1]).SessionKey, UploadHeader: o.UploadHeader, StoreInfo: o.StoreInfos[0], UploadHost: o.UploadHost }), this.startOptions && this.startOptions.enableSelectRoute && (u = !0, this.startOptions.selectRouteResult) && (c = !(((a = this.startOptions.selectRouteResult)[0] && a[0].domainName) !== m)), t = eH(this.currFileCtx, { key: this.options.key, useBackupDomain: this.uploaderCtx.useBackupDomain, signature: b, type: "success", extra: { message: "prepare upload success" }, stage: "preUpload", oid: _, systemTimeGap: this.systemTimeGap, tosDomain: "".concat(this.config.schema, "://").concat(m), xhr: e, UploadHeader: void 0 === y ? {} : y, SessionKey: g, UploadID: v, fallbackStoreInfo: s, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currFileCtx.totalDuration, useClientSelectRouteResult: c, enableSelectRoute: u }) } catch (t) { return this.fail({ error: "catch error: ".concat(t.message || t.toString()), xhr: e }) } return this.successProcess(t) } return this.fail({ error: "request fail: ".concat(e.statusText || e.errText || "UNKNOWN"), xhr: e }) } }, { key: "fail", value: function(e) { var t = this , r = e.xhr , n = e.errorCode || 1001e3 , i = "prepare upload error: UNKNOWN" , i = (r && (i = 0 === r.status ? "prepare upload error: NETERROR" : e.message || "prepare upload error: ".concat(r.status)), eH(this.currFileCtx, { extra: { message: i, error: e.error, errorCode: n }, type: "error", stage: "preUpload", xhr: r, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currFileCtx.totalDuration })); this.isImageBatchUpload && (i.successImage = [], i.failImage = null == (e = this.currFileCtx) ? void 0 : e.crc32Array.map(function(e, r) { return { crc32: e.crc32, fileSize: null == (e = t.currFileCtx) ? void 0 : e.fileSize[r], fileName: null == (e = t.currFileCtx) ? void 0 : e.fileName[r], finishSize: 0, success: !1 } })), this.uploaderCtx._removeTaskCache(this.options.key), this.failProcess(i) } }], eL(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }(); function eJ(e) { return (eJ = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function eQ(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function eX() { return (eX = Object.assign ? Object.assign.bind() : 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 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, eZ(n.key), n) } } function eZ(e) { return e = function(e, t) { if ("object" !== eJ(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== eJ(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === eJ(e) ? e : String(e) } function eY(e, t) { return (eY = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function e0(e) { return (e0 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var e1 = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && eY(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = e0(e); return function(e, t) { if (t && ("object" === eJ(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, e0(this).constructor) : r.apply(this, arguments)) } ); function a(e, t) { var r; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (r = s.call(this)).options = e, r.config = t, r.transport = new ev, r.uploaderCtx = e.context, r.currFileCtx = e.context.tasks[e.key], r.eventInit(), r } return r = a, i = [{ key: "initUpload", value: function(e) { e && (e = this.currFileCtx.fallbackStoreInfo) && eX(this.currFileCtx, { oid: e.StoreInfo.StoreUri, tosDomain: "".concat(this.config.schema, "://").concat(e.UploadHost), signature: e.StoreInfo.Auth, UploadHeader: e.UploadHeader, SessionKey: e.SessionKey }); var e = { oid: this.currFileCtx.oid, tosDomain: this.currFileCtx.tosDomain } , e = eh.urlTemplate("{tosDomain}/upload/v1/{oid}?uploadmode=part&phase=init", e) , t = this.config.userId; this.transport.send({ method: "post", url: e, headers: function(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? eQ(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = eZ(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : eQ(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e }({ Authorization: this.currFileCtx.signature, "X-Storage-U": encodeURIComponent(t) }, this.currFileCtx.UploadHeader), timeout: this.config.gatewayTimeout }) } }, { key: "start", value: function(e, t, r) { this.successProcess = t, this.failProcess = r, this._st = Date.now(), this.initUpload(e && e.changeNodeRetry) } }, { key: "eventInit", value: function() { var e = this; this.transport.on("complete", function(t) { var r = null; try { var n, i = JSON.parse(t.response), o = null == (n = i.data) ? void 0 : n.uploadid; if (2e3 !== i.code || !o) return e.fail({ error: "fail! response.code: ".concat(i.code, ", fail message: ").concat(i.message), xhr: t, errorCode: null == i ? void 0 : i.code }); r = eX(e.currFileCtx, { UploadID: o, percent: 0, type: "success", extra: { message: "init upload id success" }, stage: "initUploadID", xhr: t, stageStartTime: e._st, stageEndTime: Date.now(), duration: Date.now() - e._st, totalDuration: Date.now() - e._st + e.currFileCtx.totalDuration }) } catch (r) { return e.fail({ error: "catch error: ".concat(r.message || JSON.stringify(r)), xhr: t }) } return e.successProcess(r) }), this.transport.on("error", function(t) { e.fail({ error: "request fail: ".concat(t.statusText || t.errText || "UNKNOWN"), xhr: t }) }) } }, { key: "fail", value: function(e) { var t = this.options.context , r = this.options.key , t = eX(t.tasks[r], { extra: { message: "init upload id error, ".concat(e.error), errorCode: e.errorCode || 1002e3 }, type: "error", stage: "initUploadID", xhr: e.xhr, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currFileCtx.totalDuration }); this.uploaderCtx._removeTaskCache(this.options.key), this.failProcess(t) } }], e$(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }(); function e2(e) { return (e2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function e3(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function e4(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? e3(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = e6(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : e3(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e } function e5(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, e6(n.key), n) } } function e6(e) { return e = function(e, t) { if ("object" !== e2(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== e2(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === e2(e) ? e : String(e) } function e8(e, t) { return (e8 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function e7(e) { return (e7 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var e9 = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && e8(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = e7(e); return function(e, t) { if (t && ("object" === e2(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, e7(this).constructor) : r.apply(this, arguments)) } ); function a(e) { var t, r = e.sliceItem, n = e.crc32, i = e.url, o = e.signature, c = e.uploadHeader, u = e.userId, l = e.retryTime, f = e.timeout, e = e.method, e = void 0 === e ? "POST" : e; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (t = s.call(this)).fileSlice = r, t.crc32 = n, t.uploadUrl = i, t.uploadHeader = c, t.signature = o, t.userId = u, t.retryTime = l || 0, t.method = e, t.retryCount = 0, t.timeout = f, t.ready = !1, t.cancel = !1, t.transport = new ev, t.eventInit(), t } return r = a, i = [{ key: "upload", value: function(e, t) { this.isParamsValid() && (this._st = Date.now(), this.transport && this.transport.send({ method: this.method, url: this.uploadUrl, headers: e4({ Authorization: this.signature, "Content-CRC32": this.crc32, "X-Storage-U": encodeURIComponent(this.userId) }, this.uploadHeader), file: this.fileSlice, binary: 1, timeout: this.timeout }), e) && this.emit("retry", t) } }, { key: "isParamsValid", value: function() { 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() { var e = this; this.transport.on("complete", function(t) { try { var r = JSON.parse(t.response); 2e3 === r.code ? e.success(t) : e.fail(t, r) } catch (r) { e.fail(t) } }), this.transport.on("error", function(t) { e.fail(t) }), this.transport.on("progress", function(t) { e.process(t) }) } }, { key: "success", value: function(e) { this.ready = !0; var t = Date.now() - this._st , r = this.fileSlice.size || this.fileSlice.byteLength; this.emit("complete", { crc32: this.crc32, size: r, speed: r / t, xhr: e, sliceStartTime: this._st, sliceEndTime: Date.now(), sliceDuration: Date.now() - this._st }) } }, { key: "fail", value: function(e) { var t, r, n = this, i = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : null; this.cancel || (t = { crc32: this.crc32, size: this.fileSlice.size || this.fileSlice.byteLength, xhr: e, sliceStartTime: this._st, sliceEndTime: Date.now(), sliceDuration: Date.now() - this._st }, e && 401 === e.status ? this.emit("error", e4({ message: "slice upload failed: UNAUTHORIZED" }, t)) : (r = "slice upload failed: UNKNOWN", e && (r = e.status ? "slice upload failed: ".concat((null == i ? void 0 : i.message) || e.status) : "slice upload failed: NETERROR"), this.retryCount < this.retryTime ? (setTimeout(function() { n.upload(!0, e4({ message: r }, t)) }, 1e3), this.retryCount++) : this.emit("error", e4({ message: r, errorCode: null == i ? void 0 : i.code }, t)))) } }, { key: "process", value: function(e) { this.cancel || this.emit("progress", { crc32: this.crc32, loaded: e.loaded || 0, total: e.total || 0 }) } }, { key: "abort", value: function() { this.transport && (this.cancel = !0, this.transport.abort()) } }, { key: "destroy", value: function() { this.transport = null } }], e5(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }() , $ = r(2) , te = r.n($); function tt(e) { return (tt = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tr() { return (tr = Object.assign ? Object.assign.bind() : 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 tn(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r]; return n } function ti(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== tt(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== tt(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === tt(n) ? n : String(n)), i) } } function to(e, t) { return (to = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function ts(e) { return (ts = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var ta = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && to(e, t) }(c, n.a); var e, t, r, o, s, a = (e = c, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = ts(e); return function(e, t) { if (t && ("object" === tt(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, ts(this).constructor) : r.apply(this, arguments)) } ); function c(e) { var t, r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, c), (t = a.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), t.progressMonitorTime = Number(r.progressMonitorTime), t.progressMonitorSpeed = Number(r.progressMonitorSpeed), t.uploadSliceCount = Number(r.uploadSliceCount), t.realtimeSpeedInterval = Number(r.realtimeSpeedInterval), t.processRetry = 0, t.lastFinishSize = -1, t.lastProcessPercent = -1, t.lastIntervalSize = -1, t.lastCalculateSpeedTime = -1, t.lastCalculateSpeedSize = 0, t.uploadHandlers = {}, t } return r = c, o = [{ key: "start", value: function(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.setProgressMonitor(), this.threadUpload() } }, { key: "initWorker", value: function() { var e, t = this; this.worker || (e = this.crc32Array, this.worker = new te.a, this.worker.onmessage = function(r) { var n, i, r = (n = r.data, i = 4, function(e) { if (Array.isArray(e)) return e }(n) || function(e, t) { var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (null != r) { var n, i, o, s, a = [], c = !0, u = !1; try { if (o = (r = r.call(e)).next, 0 === t) { if (Object(r) !== r) return; c = !1 } else for (; !(c = (n = o.call(r)).done) && (a.push(n.value), a.length !== t); c = !0) ; } catch (e) { u = !0, i = e } finally { try { if (!c && null != r.return && (s = r.return(), Object(s) !== s)) return } finally { if (u) throw i } } return a } }(n, 4) || function(e, t) { var r; if (e) return "string" == typeof e ? tn(e, t) : "Map" === (r = "Object" === (r = Object.prototype.toString.call(e).slice(8, -1)) && e.constructor ? e.constructor.name : r) || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? tn(e, t) : void 0 }(n, i) || function() { throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }()), o = r[0], s = r[1], a = r[2], r = r[3], c = (new Date).getTime(), u = e[a]; u.crc32 = s, u.crc32StartTime = r, u.crc32EndTime = c, u.crc32Duration = c - r, t.upload(u, o, a) } ) } }, { key: "read", value: function(e, t) { var r = this , n = this.file , i = n.slice || n.webkitSlice || n.mozSlice , o = new FileReader; o.onload = function(e) { var n = (new Date).getTime(); r.worker.postMessage([e.target.result, t, n, !!r.config.clientEncrypt, r.currentCtx.clientEncryptKey, r.crc32Array.length - 1 === t], [e.target.result]) } , o.onerror = function() { r.stop(), r.fail({ extra: { message: "An error occurred reading the file", errorCode: 1003003 } }) } , o.readAsArrayBuffer(i.call(n, e.start, e.end)) } }, { key: "threadUpload", value: function() { 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() { var e = this; Object.keys(this.uploadHandlers).forEach(function(t) { e.uploadHandlers[t].abort(), e.uploadHandlers[t].destroy() }), this.uploadHandlers = {}, this.worker && this.worker.terminate(), this.worker = null, this.clearMonitor() } }, { key: "setProgressMonitor", value: function() { var e = this; this.progressMonitorInterval = setInterval(function() { var t, r = e.finishSize; r - e.lastIntervalSize < e.progressMonitorTime / 1e3 * e.progressMonitorSpeed * 1024 ? (t = tr(e.currentCtx, { stage: "process", type: "warn", extra: { message: "percent are not updated in ".concat(e.progressMonitorTime, " seconds") } }), e.context.logger.send(t), e.context._broadcast("slowProgress", t), e.clearMonitor()) : e.lastIntervalSize = r }, this.progressMonitorTime) } }, { key: "clearMonitor", value: function() { this.progressMonitorInterval && clearInterval(this.progressMonitorInterval) } }, { key: "upload", value: function(e, t, r) { var n = this , o = e.crc32 , s = { part_number: r + 1, uploadId: this.currentCtx.UploadID, oid: this.currentCtx.oid, tosDomain: this.currentCtx.tosDomain } , s = eh.urlTemplate(i, s) , a = this.config.userId , t = (this.config.clientEncrypt || (t = eh.fileSlice(this.file, e.start, e.end)), new e9({ sliceItem: t, crc32: o, url: s, signature: this.currentCtx.signature, uploadHeader: this.currentCtx.UploadHeader, userId: a, method: "POST", retryTime: this.retryUploadTime, timeout: this.config.uploadTimeout })); t.on("complete", function(t) { 1 === n.currentCtx.status && (t.start = e.start, t.crc32StartTime = e.crc32StartTime, t.crc32EndTime = e.crc32EndTime, t.crc32Duration = e.crc32Duration, t.index = r, n.fileSliceSuccess(t)) }), t.on("error", function(t) { 1 === n.currentCtx.status && (t.start = e.start, t.crc32StartTime = e.crc32StartTime, t.crc32EndTime = e.crc32EndTime, t.crc32Duration = e.crc32Duration, t.index = r, n.fail(t)) }), t.on("progress", function(t) { 1 === n.currentCtx.status && (t.start = e.start, t.index = r, n.process(t)) }), t.on("retry", function(t) { 1 === n.currentCtx.status && (t.start = e.start, t.index = r, n.retry(t)) }), t.upload(), this.uploadHandlers[r] = t } }, { key: "success", value: function(e) { this.finishArr = []; var t = Date.now() - this._st , t = this._uploadSize / t , t = tr(this.currentCtx, { type: "success", stage: "process", percent: 100, extra: { message: "upload all success" }, speed: t, xhr: e, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._lastSaveTime + this.currentCtx.totalDuration, isAllFinish: !0 }); this.worker && this.worker.terminate(), this.successProcess(t) } }, { key: "fail", value: function(e) { var t = this.errorFormat(e); t.type = "error", void 0 !== e.statusCode && tr(this.currentCtx, { statusCode: e.statusCode }), this.errorLength || (this.context.logger.send(tr({}, t)), this.stop(), this.context._broadcast("error", t), this.currentCtx.isBreak ? this.context._cancel(this.key) : this.context._pause(this.key), this.errorLength++) } }, { key: "retry", value: function(e) { e = this.errorFormat(e), this.context.logger.send(tr({}, e, { type: "retry" })) } }, { key: "fileSliceSuccess", value: function(e) { var t, r = e.index, n = Date.now(), i = (-1 === this.finishArr.indexOf(e.start) && this.finishArr.push(e.start), this.crc32Array[r].finished = !0, this.crc32Array[r].speed = e.speed, { message: "slice upload success" }); e.xhr && (t = e.xhr, i.currentUrl = t.currentUrl || "", tr(this.currentCtx, { req: { url: t.currentUrl, param: t.params }, res: { status: t.status, body: t.responseText, header: t.getAllResponseHeaders() } }), delete e.xhr), this.context.logger.send(tr(this.currentCtx, { stage: "process", type: "success", sliceIndex: r, extra: i, totalDuration: n - this._lastSaveTime + this.currentCtx.totalDuration, sliceStartTime: e.sliceStartTime, sliceEndTime: e.sliceEndTime, sliceDuration: e.sliceDuration, crc32StartTime: e.crc32StartTime, crc32EndTime: e.crc32EndTime, crc32Duration: e.crc32Duration })), this._lastSaveTime = n, this.uploading.splice(this.uploading.indexOf(r), 1), this.uploadHandlers[r] && delete this.uploadHandlers[r], this.finishArr.length >= this.crc32Array.length ? (this.stop(), this.success(e.xhr)) : this.threadUpload() } }, { key: "getFinishSize", value: function(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(e) { var t = this.currentCtx.realtimeSpeed || 0 , r = this.currentCtx.fileSize , n = (this.finishSize = this.getFinishSize(this.crc32Array, e), this.finishSize > this.lastFinishSize && ((e = new Date).getTime() - this.lastCalculateSpeedTime > this.realtimeSpeedInterval && (i = e.getTime() - this.lastCalculateSpeedTime, t = Math.floor((n = this.finishSize - this.lastCalculateSpeedSize) / i), this.lastCalculateSpeedTime = e.getTime(), this.lastCalculateSpeedSize = this.finishSize), this.lastFinishSize = this.finishSize), Math.floor(this.finishSize / r * 100) || 0) , i = tr(this.currentCtx, { stage: "process", percent: n, realtimeSpeed: t }); n > this.lastProcessPercent && 100 !== n && (this.lastProcessPercent = n, this.context._broadcast("progress", i)) } }, { key: "errorFormat", value: function(e) { var t = this.currentCtx.totalDuration , r = Date.now() - this._st , n = e.index , i = e.crc32 ? { message: e.message, data: e.crc32, size: e.size } : e.extra , o = (i.errorCode = (null == (o = e.extra) ? void 0 : o.errorCode) || e.errorCode || 1003e3, tr(this.currentCtx, { extra: i, sliceIndex: n, stage: "process", req: {}, res: {}, totalDuration: r + t, sliceStartTime: e.sliceStartTime, sliceEndTime: e.sliceEndTime, sliceDuration: e.sliceDuration, crc32StartTime: e.crc32StartTime, crc32EndTime: e.crc32EndTime, crc32Duration: e.crc32Duration })); return e.xhr && (i = e.xhr, o.req = { url: e.xhr.currentUrl }, o.res = { status: i.status, body: i.responseText, header: i.getAllResponseHeaders() }, delete e.xhr), o } }], ti(r.prototype, o), Object.defineProperty(r, "prototype", { writable: !1 }), c }(); function tc(e) { return (tc = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tu() { return (tu = Object.assign ? Object.assign.bind() : 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 tl(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function tf(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, tp(n.key), n) } } function tp(e) { return e = function(e, t) { if ("object" !== tc(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== tc(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === tc(e) ? e : String(e) } function th(e, t) { return (th = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function td(e) { return (td = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var tg = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && th(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = td(e); return function(e, t) { if (t && ("object" === tc(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, td(this).constructor) : r.apply(this, arguments)) } ); function a(e, t) { var r; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (r = s.call(this)).options = e, r.config = t, r.transport = new ev, r.eventInit(), r.errorCount = 0, r.uploaderCtx = e.context, r.currFileCtx = e.context.tasks[e.key], r } return r = a, i = [{ key: "mergeFile", value: function() { 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 e = eh.urlTemplate("{tosDomain}/upload/v1/{oid}?uploadmode=part&phase=finish&uploadid={uploadId}", e) , i = this.config.userId , i = function(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? tl(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = tp(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tl(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e }({ Authorization: this.currFileCtx.signature, "X-Storage-U": encodeURIComponent(i) }, this.currFileCtx.UploadHeader); this.config.clientEncrypt && (i["x-upload-encryption-mode"] = 2, i["x-upload-encryption-key"] = btoa(this.currFileCtx.clientEncryptKey)), this.transport.send({ method: "post", url: e, headers: i, custom: r }) } }, { key: "start", value: function(e, t, r) { this.successProcess = t, this.failProcess = r, this._st = Date.now(), this.mergeFile() } }, { key: "eventInit", value: function() { var e = this , t = this.options.stage; this.transport.on("complete", function(r) { var n = null; try { var i, o = JSON.parse(r.response); if (2e3 !== o.code || null == (i = o.data) || !i.key) return e.fail({ error: "fail! response.code: ".concat(o.code, ", fail message: ").concat(o.message), xhr: r, errorCode: o.code }); n = tu(e.currFileCtx, { stage: t, type: "success", hasMerge: !0, extra: { message: "merge file success" }, xhr: r, stageStartTime: e._st, stageEndTime: Date.now(), duration: Date.now() - e._st, totalDuration: Date.now() - e._st + e.currFileCtx.totalDuration }) } catch (t) { return e.fail({ error: "response parse error: ".concat(t.message || JSON.stringify(t)), xhr: r }) } return e.successProcess(n) }), this.transport.on("error", function(t) { e.fail({ error: "request fail: ".concat(t.statusText || t.errText), xhr: t }) }) } }, { key: "getProcessIndex", value: function(e) { var t = 0; return e.forEach(function(e, r) { "process" === e.stage && (t = r) }), t } }, { key: "fail", value: function(e) { e = tu(this.currFileCtx, { extra: { message: "merge file error, ".concat(e.error), errorCode: e.errorCode || 1004e3 }, 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) } }], tf(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }(); function ty(e) { return (ty = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tm() { return (tm = Object.assign ? Object.assign.bind() : 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 tv(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== ty(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== ty(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === ty(n) ? n : String(n)), i) } } function tb(e, t) { return (tb = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function t_(e) { return (t_ = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var tS = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && tb(e, t) }(c, n.a); var e, t, r, i, s, a = (e = c, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = t_(e); return function(e, t) { if (t && ("object" === ty(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, t_(this).constructor) : r.apply(this, arguments)) } ); function c(e) { var t, r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, c), (t = a.call(this)).options = e, t.file = e.file, t.context = e.context, t.key = e.key, t.isImageBatchUpload = e.isImageBatchUpload, t.config = r, t.finishArr = [], t.errorLength = 0, t.finishSize = 0, t.retryUploadTime = t.config.retryUploadTime || 0, t.processRetry = 0, t.lastFinishSize = -1, t.lastProcessPercent = -1, t.lastIntervalSize = -1, t.uploader = {}, t._uploadProcessMap = {}, t } return r = c, i = [{ key: "start", value: function(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.isImageBatchUpload ? this.currentCtx.fileSize.reduce(function(e, t) { return e + t }) : this.file.size, this._st = Date.now(), this.upload() } }, { key: "stop", value: function() { var e = this; this.uploader && Object.keys(this.uploader).forEach(function(t) { e.uploader[t] && (e.uploader[t].abort(), e.uploader[t].destroy()) }) } }, { key: "upload", value: function() { for (var e = this, t = this.crc32Array.length, r = 0, n = 0, i = 0; i < t; i++) { var s = this.crc32Array[i] , a = s.buffer , s = s.crc32 , c = this.currentCtx.signature , c = "[object Array]" === Object.prototype.toString.call(c) ? c[i] : c , u = this.currentCtx.oid , u = "[object Array]" === Object.prototype.toString.call(u) ? u[i] : u , l = { oid: u, tosDomain: this.currentCtx.tosDomain } , l = eh.urlTemplate(o, l) , f = this.config.userId , p = void 0 , h = this.isImageBatchUpload ? (p = this.currentCtx.fileSize[i], this.currentCtx.fileName[i]) : (p = this.file.size, this.file.name); this._uploadProcessMap[s] && this._uploadProcessMap[s].success ? r += 1 : (this._uploadProcessMap[s] = { crc32: s, fileSize: p, fileName: h, oid: u, finishSize: 0, success: !1 }, (p = new e9({ sliceItem: a, crc32: s, url: l, signature: c, uploadHeader: this.currentCtx.UploadHeader, userId: f, retryTime: this.retryUploadTime, method: "POST", timeout: this.config.uploadTimeout })).on("complete", function(i) { r++, e._uploadProcessMap[i.crc32].finishSize = i.size, e._uploadProcessMap[i.crc32].success = !0, n + r === t && e.success(i.xhr) }), p.on("error", function(r) { ++n === t && e.fail(r) }), p.on("progress", function(t) { e.process(t) }), p.upload(), this.uploader[s] = p) } } }, { key: "success", value: function(e) { this.finishArr = []; var t = Date.now() - this._st , t = this._uploadSize / t , r = tm(this.currentCtx, { type: "success", stage: "process", percent: 99, 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.isImageBatchUpload && (r.successImage = [], r.failImage = [], Object.values(this._uploadProcessMap).forEach(function(e) { (e.success ? r.successImage : r.failImage).push(e) })), this.uploader = null, this._uploadProcessMap = null, this.successProcess(r) } }, { key: "fail", value: function(e) { e = tm(this.currentCtx, { extra: { message: "direct upload error: ".concat(e.message || e.xhr.errText), errorCode: e.errorCode || 1003e3 }, type: "error", stage: "process", xhr: e.xhr, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currentCtx.totalDuration }), this.isImageBatchUpload && (e.failImage = Object.values(this._uploadProcessMap)), this.uploader = null, this._uploadProcessMap = null, this.failProcess(e) } }, { key: "process", value: function(e) { var t = this._uploadSize , e = (this._uploadProcessMap[e.crc32].finishSize = Math.max(this._uploadProcessMap[e.crc32].finishSize, e.loaded), this.finishSize = Object.values(this._uploadProcessMap).reduce(function(e, t) { return e + t.finishSize }, 0), this.finishSize > this.lastFinishSize && (this.lastFinishSize = this.finishSize), Math.floor(this.finishSize / t * 100) || 0) , t = tm(this.currentCtx, { stage: "process", percent: e }); e > this.lastProcessPercent && 100 !== e && (this.lastProcessPercent = e, this.context._broadcast("progress", t)) } }], tv(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), c }(); function tx(e) { return (tx = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tw() { return (tw = Object.assign ? Object.assign.bind() : 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 tk(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== tx(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== tx(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === tx(n) ? n : String(n)), i) } } function tE(e, t) { return (tE = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function tO(e) { return (tO = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var tT = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && tE(e, t) }(c, n.a); var e, t, r, o, s, a = (e = c, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = tO(e); return function(e, t) { if (t && ("object" === tx(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, tO(this).constructor) : r.apply(this, arguments)) } ); function c(e) { var t, r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, c), (t = a.call(this)).options = e, t.file = e.file, t.context = e.context, t.key = e.key, t.config = r, t.errorLength = 0, t.retryUploadTime = Number(r.retryUploadTime), t.maxUploadSliceCount = Number(r.uploadSliceCount), t.uploadQueue = [], t.crc32Array = [], t.uploadSliceCount = 0, t.isCalcCrc32 = !1, t.isFileReading = !1, t.hasStarted = !1, t.hasCompleteUpload = !1, t } return r = c, o = [{ key: "start", value: function(e, t, r) { this.failProcess = r, this.successProcess = t, this.currentCtx = this.context.tasks[this.key], this.hasStarted = !0, this._st = Date.now(), this.initWorker() } }, { key: "initWorker", value: function() { var e = this; this.worker || (this.worker = new te.a, this.worker.onmessage = function(t) { e.isCalcCrc32 = !1; var r = t.data[0] , n = t.data[2] , i = t.data[1]; e.uploadQueue.forEach(function(t, o) { t.index === n && (e.uploadQueue[o].crc32 = i, e.uploadQueue[o].fileSliceBuffer = r, e.crc32Array[n] = { crc32: i }) }), e.startUploadQueue() } , this.startUploadQueue()) } }, { key: "addStreamSlice", value: function(e) { var t = this , r = e.fileSlice , n = e.index , e = (this.isFileReading = !0, new FileReader); e.readAsArrayBuffer(r), e.onload = function(e) { t.isFileReading = !1, e = e.target.result, t.uploadQueue.push({ fileSliceBuffer: e, index: n }), t.hasStarted && t.startUploadQueue() } } }, { key: "completeStreamUpload", value: function() { this.hasCompleteUpload = !0, 0 !== this.uploadQueue.length || this.isFileReading || this.success() } }, { key: "startUploadQueue", value: function() { var e; this.uploadSliceCount <= this.maxUploadSliceCount && 0 < this.uploadQueue.length && this.uploadQueue[0].crc32 ? (e = this.uploadQueue.shift(), this.uploadSliceCount++, this.upload({ sliceItem: e.fileSliceBuffer, index: e.index, crc32: e.crc32 })) : 0 < this.uploadQueue.length && !this.uploadQueue[0].crc32 && this.startCrc32Queue() } }, { key: "startCrc32Queue", value: function() { if (!this.isCalcCrc32) for (var e = 0; e < this.uploadQueue.length; e++) { var t = this.uploadQueue[e]; if (!t.crc32) { this.isCalcCrc32 = !0, this.worker.postMessage([t.fileSliceBuffer, t.index], [t.fileSliceBuffer]); break } } } }, { key: "upload", value: function(e) { var t = this , r = e.sliceItem , n = e.index , e = e.crc32 , o = this.currentCtx.signature , s = { part_number: n + 1, uploadId: this.currentCtx.UploadID, oid: this.currentCtx.oid, tosDomain: this.currentCtx.tosDomain } , s = eh.urlTemplate(i, s) , a = this.config.userId , r = new e9({ sliceItem: r, crc32: e, url: s, signature: o, uploadHeader: this.currentCtx.UploadHeader, userId: a, retryTime: this.retryUploadTime, method: "POST", timeout: this.config.uploadTimeout }); r.on("complete", function(e) { 1 === t.currentCtx.status && (e.index = n, t.fileSliceSuccess(e)) }), r.on("error", function(e) { 1 === t.currentCtx.status && (e.index = n, t.fail(e)) }), r.upload() } }, { key: "fileSliceSuccess", value: function(e) { var t = e.index , r = Date.now() , n = { message: "stream slice upload success" } , i = (e.xhr && (i = e.xhr, n.currentUrl = i.currentUrl || "", tw(this.currentCtx, { req: { url: i.currentUrl, param: i.params }, res: { status: i.status, body: i.responseText, header: i.getAllResponseHeaders() } }), delete e.xhr), this.context.logger.send(tw(this.currentCtx, { stage: "process", type: "success", sliceIndex: t, extra: n, totalDuration: r - this._lastSaveTime + this.currentCtx.totalDuration })), tw(this.currentCtx, { uploadQueueLength: this.uploadQueue.length, sliceIndex: t })); this.context._broadcast("stream-progress", i), this.uploadSliceCount--, this.hasCompleteUpload && 0 === this.uploadQueue.length ? this.success(e.xhr) : this.startUploadQueue() } }, { key: "success", value: function(e) { this.isAllSuccess || (e = tw(this.currentCtx, { type: "success", stage: "process", percent: 100, extra: { message: "all slice upload success" }, crc32Array: this.crc32Array, 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(e) { var t = e.index , e = tw(this.currentCtx, { extra: { message: "stream slice upload error" }, type: "error", stage: "process", xhr: e.xhr, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currentCtx.totalDuration, sliceIndex: t }); this.context.logger.send(tw({}, e)), this.context._broadcast("error", e) } }], tk(r.prototype, o), Object.defineProperty(r, "prototype", { writable: !1 }), c }(); function tC(e) { return (tC = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tD(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function tj(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? tD(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = tz(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tD(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e } function tI() { return (tI = Object.assign ? Object.assign.bind() : 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 tP(e, t) { return function(e) { if (Array.isArray(e)) return e }(e) || function(e, t) { var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"]; if (null != r) { var n, i, o, s, a = [], c = !0, u = !1; try { if (o = (r = r.call(e)).next, 0 === t) { if (Object(r) !== r) return; c = !1 } else for (; !(c = (n = o.call(r)).done) && (a.push(n.value), a.length !== t); c = !0) ; } catch (e) { u = !0, i = e } finally { try { if (!c && null != r.return && (s = r.return(), Object(s) !== s)) return } finally { if (u) throw i } } return a } }(e, t) || function(e, t) { var r; if (e) return "string" == typeof e ? tA(e, t) : "Map" === (r = "Object" === (r = Object.prototype.toString.call(e).slice(8, -1)) && e.constructor ? e.constructor.name : r) || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? tA(e, t) : void 0 }(e, t) || function() { throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.") }() } function tA(e, t) { (null == t || t > e.length) && (t = e.length); for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r]; return n } function tR(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, tz(n.key), n) } } function tz(e) { return e = function(e, t) { if ("object" !== tC(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== tC(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === tC(e) ? e : String(e) } function tB(e, t) { return (tB = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function tU(e) { return (tU = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var tM = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && tB(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = tU(e); return function(e, t) { if (t && ("object" === tC(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, tU(this).constructor) : r.apply(this, arguments)) } ); function a(e, t) { var r; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (r = s.call(this)).options = e, r.config = t, r.uploaderCtx = e.context, r.currFileCtx = e.context.tasks[e.key], r.isImageBatchUpload = !!r.options.isImageBatchUpload, r.skipCommit = e.skipCommit, r.transport = new ev, r.eventInit(), r } return r = a, i = [{ key: "commitUpload", value: function() { var e, t, r = this.config.region, n = "", i = {}, o = this.uploaderCtx.useBackupDomain, s = eG.checkServiceName(this.options.type, this.config, this.options.serviceType), o = (s === es && (n = o ? this.config.imageFallbackHost : this.config.imageHost, i = (t = tP(this.createImageXParams(), 3))[0], e = t[1], t = t[2]), "vod" === s && (n = o ? this.config.videoFallbackHost : this.config.videoHost, i = (o = tP(this.createVodParams(), 3))[0], e = o[1], t = o[2]), this.config.accountId && (i["X-Account-Id"] = this.config.accountId), this.config.openExperiment && (i.app_id = this.config.appId, i.user_id = this.config.userId), eh.toQueryString(i)), a = this.currFileCtx.proxyStsToken || this.config.stsToken, c = a.AccessKeyID, u = a.AccessKeyId, l = a.SecretAccessKey, a = a.SessionToken, o = { method: "POST", url: "".concat(n, "?").concat(o), timeout: this.config.gatewayTimeout, region: r, params: i, headers: {}, pathname: eh.getPathByURL(n) }, r = (o.custom = t, o.body = e, s === es && (o.headers["Content-Type"] = "application/json"), new eb.a(o,s)), i = this.currFileCtx.systemTimeGap, n = i ? new Date((new Date).getTime() + i) : new Date; r.addAuthorization({ accessKeyId: u || c, secretAccessKey: l, sessionToken: a }, n), this.transport.send(o) } }, { key: "createImageXParams", value: function() { var e = { Action: "CommitImageUpload", Version: "2018-08-01" } , t = { SessionKey: this.currFileCtx.SessionKey } , r = (this.options.type === en && (this.config.imageConfig && this.config.imageConfig.serviceId ? e.ServiceId = this.config.imageConfig.serviceId : e.SpaceName = this.config.videoConfig && this.config.videoConfig.spaceName, Array.isArray(r = this.config.imageConfig && this.config.imageConfig.processAction) && 0 < r.length && (t.Functions = r), this.config.skipMeta) && (e.SkipMeta = !0), this.options.type === ei && (e.ServiceId = this.config.objectConfig && this.config.objectConfig.serviceId || this.config.imageConfig && this.config.imageConfig.serviceId), JSON.stringify(t)); return [e, t, r] } }, { key: "createVodParams", value: function() { var e = null == (e = this.config.videoConfig) ? void 0 : e.spaceName , t = { Action: "CommitUploadInner", Version: "2020-11-19", SpaceName: e = this.options.type === ei && null != (t = this.config.objectConfig) && t.spaceName ? null == (t = this.config.objectConfig) ? void 0 : t.spaceName : e } , e = { SessionKey: this.currFileCtx.SessionKey, Functions: [] } , r = this.config.videoConfig && this.config.videoConfig.processAction , n = (this.options.type === ei && null != (n = this.config.objectConfig) && n.processAction && (r = null == (n = this.config.objectConfig) ? void 0 : n.processAction), Array.isArray(r) && 0 < r.length && (e.Functions = r), (this.config.videoConfig && this.config.videoConfig.callbackArgs || this.options.callbackArgs) && (e.CallbackArgs = this.options.callbackArgs || this.config.videoConfig.callbackArgs), this.options.type === er && this.config.skipDownload && (t.SkipDownload = !0), this.options.type === ei && this.options.objectSync && (e.ObjectSync = this.options.objectSync), this.options.type === er && this.options.needExactFormat && (e.needExactFormat = this.options.needExactFormat), JSON.stringify(e)); return [t, e, n] } }, { key: "start", value: function(e, t, r) { if (this.successProcess = t, this.failProcess = r, this._st = Date.now(), this.skipCommit) return this.successProcess(tI(this.currFileCtx, { stage: "complete", type: "success", percent: 100, extra: { message: "upload successful, skip commit" }, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currFileCtx.totalDuration, skipCommit: this.skipCommit })); try { this.commitUpload() } catch (e) { this.fail({ error: "catch error: ".concat(e.toString()) }) } } }, { key: "eventInit", value: function() { var e = this; this.transport.on("complete", function(t) { var r = null; try { var n = JSON.parse(t.response); if (n.ResponseMetadata.Error) return e.fail({ xhr: t, errorCode: n.ResponseMetadata.Error.CodeN, error: n.ResponseMetadata.Error.Code, message: n.ResponseMetadata.Error.Message }); var i, o, s = eG.checkServiceName(e.options.type, e.config, e.options.serviceType), a = n.Result, c = {}; s === es ? e.isImageBatchUpload ? (i = a.Results, o = a.PluginResult || [], i.forEach(function(e, t) { i[t] = tj(tj({}, i[t]), o[t]) }), c = i) : tI(c = a.Results[0], a.PluginResult && a.PluginResult[0]) : c = a.Results[0], r = tI(e.currFileCtx, { stage: "complete", type: "success", percent: 100, extra: { message: "upload successful" }, uploadResult: c, xhr: t, stageStartTime: e._st, stageEndTime: Date.now(), duration: Date.now() - e._st, totalDuration: Date.now() - e._st + e.currFileCtx.totalDuration, skipCommit: e.skipCommit }) } catch (r) { return e.fail({ error: "catch error: ".concat(r.message || r.toString()), xhr: t }) } return e.successProcess(r) }), this.transport.on("error", function(t) { var r = { error: "request fail: ".concat(t.statusText || t.errText || "UNKNOWN"), xhr: t }; if (t.response) try { var n = JSON.parse(t.response); n.ResponseMetadata && n.ResponseMetadata.Error && (r.errorCode = n.ResponseMetadata.Error.CodeN, r.error = n.ResponseMetadata.Error.Code, r.message = n.ResponseMetadata.Error.Message) } catch (e) { r.error = t.response.toString(), r.message = t.response.toString() } e.fail(r) }) } }, { key: "fail", value: function(e) { var t = e.xhr , r = e.errorCode || 1005e3 , n = "commit upload error: UNKNOWN" , n = (t && (n = 0 === t.status ? "commit upload error: NETERROR" : e.message || "commit upload error: ".concat(t.status)), tI(this.currFileCtx, { extra: { message: n, error: e.error, errorCode: r }, type: "error", stage: "complete", xhr: t, stageStartTime: this._st, stageEndTime: Date.now(), duration: Date.now() - this._st, totalDuration: Date.now() - this._st + this.currFileCtx.totalDuration, skipCommit: this.skipCommit })); this.failProcess(n) } }], tR(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }(); function tG(e) { return (tG = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tF(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function tN(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? tF(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = tK(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tF(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e } function tH() { return (tH = Object.assign ? Object.assign.bind() : 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 tL(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, tK(n.key), n) } } function tK(e) { return e = function(e, t) { if ("object" !== tG(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== tG(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === tG(e) ? e : String(e) } function tq(e, t) { return (tq = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function tV(e) { return (tV = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var tW = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && tq(e, t) }(a, n.a); var e, t, r, i, o, s = (e = a, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = tV(e); return function(e, t) { if (t && ("object" === tG(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, tV(this).constructor) : r.apply(this, arguments)) } ); function a(e, t, r, n) { var i; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, a), (i = s.call(this, e)).tasks = e, i.config = t, i.key = n, i.uploaderCtx = r, i.current = 0, i.length = i.tasks.length, i.taskError = {}, i.uploadList = [], i.retryTaskTime = t.retryTaskTime, i } return r = a, i = [{ key: "start", value: function(e) { var t = this.tasks.shift(); t && (this.current = t.index, this.execTask(t, e)) } }, { key: "execTask", value: function(e, t) { var r, n, i = this, o = e.key, s = this.uploaderCtx, a = s.tasks[o]; a && (r = a.cacheTask, n = s.taskList[o].length, r && 0 < e.index && e.index < r ? this.start() : (a.currentTask = e.index, 1 === a.status && (1 !== e.index && "initUploadID" !== e.stage || (e.arg = tH(e.arg, t)), e) && e.func.call(e.context, e.arg, function(r) { var c; s.taskList[o] && ((c = s.taskList[o][e.index + 1]) && 0 !== e.index && !a.isDirect && i.config.enableDiskBreakpoint ? s._saveTask(o, { currentTask: c.index, stage: c.stage }) : e.index === n - 1 && s._removeTaskCache(o), i.success(r), 0 < i.tasks.length ? i.start(t) : s._queueSuccess(o)) }, function(r) { var n; r.xhr && r.xhr.status >= 400 || 3 === e.index && r.isDirect ? i.fail(r) : !i.taskError[o] || i.taskError[o] < i.retryTaskTime ? (i.taskError[o] ? i.taskError[o]++ : i.taskError[o] = 1, n = i.errorFormat(r, !0), i.uploaderCtx.logger.send(n), "initUploadID" === e.stage ? i.execTask(e, tN(tN({}, t), {}, { changeNodeRetry: !0 })) : i.execTask(e, t)) : (r.key = o, i.fail(r)) }))) } }, { key: "addTask", value: function(e) { this.tasks.push(e) } }, { key: "success", value: function(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), tH(e, { type: "success" }); try { this.uploaderCtx._broadcast(e.stage, e) } catch (e) { console.error(e) } this.uploaderCtx.logger.send(e) } }, { key: "fail", value: function(e) { var t = this.uploaderCtx , r = e.key , e = this.errorFormat(e); try { t._broadcast("error", e) } catch (e) {} t.tasks[r].isBreak ? t._cancel(r) : t._pause(r), t.logger.send(e) } }, { key: "cancel", value: function(e) { var t, r = this.key, n = this.uploaderCtx.tasks[r].currentTask; this.uploaderCtx.taskList[r].forEach(function(e) { n === e.index && (t = e) }), e ? 3 === n && this.uploaderCtx.tasks[r].isDirect && t && null != (e = t) && null != (e = e.context) && e.stop() : (this.tasks = [], t && 3 === t.index && t.context.stop(), this.uploaderCtx._removeTaskCache(r)) } }, { key: "restart", value: function() { this.uploadList.forEach(function(e) { e.cancel = !1 }), this.start() } }, { key: "errorFormat", value: function(e, t) { var r, t = { type: t ? "retry" : "error" }; return e.xhr && (r = e.xhr, e.req = { url: r.currentUrl, param: r.params }, e.res = { status: r.status, header: r.getAllResponseHeaders(), body: r.responseText }, e.extra && (e.extra.req = e.req, e.extra.res = e.res), delete e.xhr), tH(e, t) } }], tL(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), a }(); function tJ(e) { return (tJ = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function tQ() { return (tQ = Object.assign ? Object.assign.bind() : 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 tX(e, t) { for (var r = 0; r < t.length; r++) { var n, i = t[r]; i.enumerable = i.enumerable || !1, i.configurable = !0, "value"in i && (i.writable = !0), Object.defineProperty(e, (n = function(e, t) { if ("object" !== tJ(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== tJ(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(n = i.key, "string"), "symbol" === tJ(n) ? n : String(n)), i) } } function t$(e, t) { return (t$ = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function tZ(e) { if (void 0 === e) throw ReferenceError("this hasn't been initialised - super() hasn't been called"); return e } function tY(e) { return (tY = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var t0 = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && t$(e, t) }(c, n.a); var e, t, r, i, o, a = (e = c, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = tY(e); return function(e, t) { if (t && ("object" === tJ(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return tZ(e) }(this, t ? Reflect.construct(r, arguments, tY(this).constructor) : r.apply(this, arguments)) } ); function c(e) { var t; return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, c), (t = a.call(this, e)).config = tQ({}, s), t._mergeOptions(t.config, e), t.tasks = {}, t.taskList = {}, t.cache = {}, t.storage = eh.storage(tZ(t), t.config.enableDiskBreakpoint), t.logger = t.config.noLog ? { send: function() { return !0 } } : new el(t.config,tZ(t)), t } return r = c, i = [{ key: "_mergeOptions", value: function(e, t) { t && "object" === tJ(t) && (tQ(e, t), Object.keys(t).forEach(function(r) { "vodDomain" === r && (e.replace[r] = t[r]) })) } }, { key: "_setCache", value: function(e, t) { this.storage.setItem(e, t) } }, { key: "_getCache", value: function(e) { return this.storage.getItem(e) } }, { key: "_removeCache", value: function(e) { e ? this.storage.removeItem(e) : this.storage.clear() } }, { key: "_addTask", value: function(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 tW([],this.config,this,e)), r[e].task.addTask(t) } }, { key: "_broadcast", value: function(e, t, r) { (r || 1 === (r = this.tasks[t.key].status) || 0 === r) && this.emit(e, t) } }, { key: "_addCrc32ProcessTask", value: function(e, t) { var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {} , n = r.isDirect , r = r.isImageBatchUpload , e = new eM({ file: e.file, context: this, key: t, isDirect: n, isImageBatchUpload: void 0 !== r && r },this.config) , n = { context: e, func: e.start, arg: {}, key: t, index: 0, stage: "crc32" }; this._addTask(t, n) } }, { key: "_addPreUploadTask", value: function(e, t) { var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {} , n = r.isDirect , r = r.isImageBatchUpload , n = { file: e.file, stsToken: e.stsToken, context: this, type: e.type || er, preUploadUriParams: e.preUploadUriParams || {}, storeKey: e.storeKey, testHost: e.testHost, key: t, isDirect: n, isImageBatchUpload: void 0 !== r && r, fileSize: e.fileSize, serviceType: e.serviceType || null, fileExtension: e.fileExtension } , r = new eW(n,this.config) , e = { context: r, func: r.start, arg: {}, key: t, index: 1, stage: "preUpload" }; this._addTask(t, e) } }, { key: "_addDirectUploadTask", value: function(e, t) { var r = (2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}).isImageBatchUpload , e = new tS({ file: e.file, context: this, key: t, isImageBatchUpload: void 0 !== r && r },this.config) , r = { context: e, func: e.start, arg: {}, key: t, index: 3, stage: "process" }; this._addTask(t, r) } }, { key: "_addInitUploadIDTask", value: function(e, t) { e = { context: e = new e1({ file: e.file, context: this, key: t },this.config), func: e.start, arg: {}, key: t, index: 2, stage: "initUploadID" }, this._addTask(t, e) } }, { key: "_addUploadProcessTask", value: function(e, t) { e = { context: e = new ta({ file: e.file, context: this, key: t },this.config), func: e.start, arg: {}, key: t, index: 3, stage: "process" }, this._addTask(t, e) } }, { key: "_addStreamUploadTask", value: function(e, t) { this.streamUploadTask = new tT({ context: this, key: t },this.config); var r = { context: this.streamUploadTask, func: this.streamUploadTask.start, arg: {}, key: t, index: 3, stage: "process" }; this._addTask(t, r) } }, { key: "_mergeFileTask", value: function(e, t) { e = { context: e = new tg({ file: e.file, context: this, stage: "fileMerge", key: t },this.config), func: e.start, arg: {}, key: t, index: 4, stage: "fileMerge" }, this._addTask(t, e) } }, { key: "_getMetaInfoTask", value: function(e, t) { var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {} , n = r.isImageBatchUpload , r = r.skipCommit , n = { file: e.file, context: this, data: e.data, type: e.type || er, callbackArgs: e.callbackArgs, objectSync: e.objectSync, needExactFormat: e.needExactFormat, key: t, isImageBatchUpload: void 0 !== n && n, skipCommit: void 0 !== r && r, serviceType: e.serviceType || null } , r = new tM(n,this.config) , e = { context: r, func: r.start, arg: {}, key: t, index: 5, stage: "complete" }; this._addTask(t, e) } }, { key: "_addAllUploadProcess", value: function(e, t) { var r = e.type === en && "[object Array]" === Object.prototype.toString.call(e.file) , n = (this.tasks[t] = this.tasks[t] || {}, this.tasks[t].fileType = e.type || er, this.tasks[t].fileSize = e.file && e.file.size, this.tasks[t].proxyStsToken = e.stsToken, this.lastStsToken = e.stsToken, this.lastFile = e.file, e.file.size <= eh.getFileSliceLength(e.file) || r) , n = (e.useDirectUpload && (n = !0), this._addCrc32ProcessTask(e, t, { isDirect: n, isImageBatchUpload: r }), this._addPreUploadTask(e, t, { isDirect: n, isImageBatchUpload: r }), n ? this._addDirectUploadTask(e, t, { isImageBatchUpload: r }) : (this._addInitUploadIDTask(e, t), this._addUploadProcessTask(e, t), this._mergeFileTask(e, t)), !(!this.config.skipCommit || eG.checkServiceName(e.type, this.config) !== es)); this._getMetaInfoTask(e, t, { isImageBatchUpload: r, skipCommit: n }) } }, { key: "_addAllUploadProcessClientEncrypt", value: function(e) { var t, r = this; return e.type === en && Array.isArray(e.file) ? (t = [], e.file.forEach(function(n) { t.push(r._createClientEncryptTask({ stsToken: e.stsToken, type: e.type, file: n })) }), t) : this._createClientEncryptTask(e) } }, { key: "_createClientEncryptTask", value: function(e) { var t = eh.getUnique("file") , r = (this.tasks[t] = this.tasks[t] || {}, this.tasks[t].fileType = e.type || er, this.tasks[t].fileSize = e.file && e.file.size, this.tasks[t].proxyStsToken = e.stsToken, this.tasks[t].clientEncryptKey = eh.generateKey(16), this._addCrc32ProcessTask(e, t, { isDirect: !1, isImageBatchUpload: !1 }), this._addPreUploadTask(e, t, { isDirect: !1, isImageBatchUpload: !1 }), this._addInitUploadIDTask(e, t), this._addUploadProcessTask(e, t), this._mergeFileTask(e, t), !(!this.config.skipCommit || eG.checkServiceName(e.type, this.config) !== es)); return this._getMetaInfoTask(e, t, { isImageBatchUpload: !1, skipCommit: r }), t } }, { key: "_addAllStreamUploadProcess", value: function(e, t) { this.tasks[t] = this.tasks[t] || {}, this.tasks[t].fileType = e.type || er, this.tasks[t].proxyStsToken = e.stsToken, this._addPreUploadTask(e, t), this._addInitUploadIDTask(e, t), this._addStreamUploadTask(e, t), this._mergeFileTask(e, t), this._getMetaInfoTask(e, t) } }, { key: "_addStreamSlice", value: function(e) { var t = e.fileSlice , e = e.index; this.streamUploadTask.addStreamSlice({ fileSlice: t, index: e }) } }, { key: "_completeStreamUpload", value: function() { this.streamUploadTask.completeStreamUpload() } }, { key: "_run", value: function(e, t) { var r = this.tasks , n = navigator.userAgent.toLowerCase().match(/msie ([\d.]+)/); n && n[1] && 9 >= Number(n[1]) ? (this._broadcast("error", tQ(r[e], { key: e, status: 0, stage: "browserError", extra: { message: "cannot support the browser below ie10" }, type: "error" })), this.logger.send(r[e]), this._cancel(e)) : r[e] ? 3 === r[e].status ? this._restart(e) : (r[e].startTime = (new Date).getTime(), r[e].task && 1 !== r[e].status && r[e].task.tasks.length && (r[e].status = 1, this.logger.send(tQ({}, r[e], { extra: { message: "start upload" }, type: "start", key: e })), r[e].task.start(t))) : console.warn("".concat(e, " is not exit in object tasks, stop running...")) } }, { key: "_selectRoute", value: function(e, t) { new eC({ stsToken: this.lastStsToken, context: this, type: er, file: this.lastFile },this.config).start(e, t) } }, { key: "_restart", value: function(e) { var t, r, n = this, i = this.tasks; i[e] ? (t = i[e].task, r = i[e].currentTask || 0, this.taskList[e].forEach(function(i, o) { i.index === r && (t.tasks = n.taskList[e].slice(o)) }), t && 1 !== i[e].status && t.tasks.length && (i[e].status = 1, t.restart())) : console.warn("".concat(e, " is not exit in object tasks")) } }, { key: "_cancel", value: function(e) { var t = this.tasks; t[e] ? (t[e].status = 2, t[e].task.cancel(), delete this.taskList[e]) : console.warn("".concat(e, " is not exit in object tasks")) } }, { key: "_pause", value: function(e) { var t = this.tasks; t[e] ? (t[e].status = 3, t[e].task.cancel(!0), t[e].isDirect || this._saveTask(e)) : console.warn("".concat(e, " is not exit in object tasks")) } }, { key: "_removeTaskCache", value: function(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(e, t) { t = (e = tQ({}, this.tasks[e], t || {})).crc32Key; try { t && this._setCache(t, this.serializeCacheInfo(e)) } catch (e) { console.warn(e) } } }, { key: "serializeCacheInfo", value: function(e) { var t = ""; delete e.task, delete e.xhr, delete e.crc32Array; try { t = JSON.stringify(e) } catch (n) { var r = {}; Object.keys(e).forEach(function(t) { "task" !== t && "xhr" !== t && "crc32Array" !== t && (r[t] = e[t]) }), t = JSON.stringify(r) } return t } }, { key: "_queueSuccess", value: function(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, delete this.taskList[e], delete r[e]) : console.warn("".concat(e, " is not exit in object tasks")) } }, { key: "_removeFile", value: function(e) { delete this.tasks[e] } }, { key: "_batchAction", value: function(e, t) { Object.keys(this.tasks).forEach(function(r) { e && e(r, t) }) } }, { key: "_refreshSTSToken", value: function(e) { var t = this , r = this.tasks; Object.keys(r).forEach(function(n) { var n = r[n] , i = tQ({}, n, { proxyStsToken: e }) , o = (n.proxyStsToken = e, i.crc32Key); o && (n.proxyStsToken = e, t._setCache(o, t.serializeCacheInfo(i))) }) } }, { key: "_setOption", value: function(e) { this._mergeOptions(this.config, e) } }, { key: "_getOption", value: function(e) { var t = tQ({}, 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(e) { var t = this , r = this.tasks; e ? (this._cancel(e), this.logger.send(tQ({}, r[e], { type: "cancel" })), delete this.tasks[e]) : Object.keys(r).forEach(function(e) { t._cancel(e), t.logger.send(tQ({}, r[e], { type: "cancel" })), delete t.tasks[e] }) } }, { key: "_userPause", value: function(e) { var t = this , r = this.tasks; e ? (this._pause(e), this.logger.send(tQ({}, r[e], { type: "pause" }))) : Object.keys(r).forEach(function(e) { t._pause(e), t.logger.send(tQ({}, r[e], { type: "pause" })) }) } }], tX(r.prototype, i), Object.defineProperty(r, "prototype", { writable: !1 }), c }(); function t1(e) { return (t1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) { return typeof e } : function(e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e } )(e) } function t2(e, t) { var r, n = Object.keys(e); return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(e), t && (r = r.filter(function(t) { return Object.getOwnPropertyDescriptor(e, t).enumerable })), n.push.apply(n, r)), n } function t3(e) { for (var t = 1; t < arguments.length; t++) { var r = null != arguments[t] ? arguments[t] : {}; t % 2 ? t2(Object(r), !0).forEach(function(t) { var n, i, o; n = e, i = t, o = r[t], (i = t5(i))in n ? Object.defineProperty(n, i, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : n[i] = o }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : t2(Object(r)).forEach(function(t) { Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t)) }) } return e } function t4(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, t5(n.key), n) } } function t5(e) { return e = function(e, t) { if ("object" !== t1(e) || null === e) return e; var r = e[Symbol.toPrimitive]; if (void 0 === r) return ("string" === t ? String : Number)(e); if (r = r.call(e, t || "default"), "object" !== t1(r)) return r; throw TypeError("@@toPrimitive must return a primitive value.") }(e, "string"), "symbol" === t1(e) ? e : String(e) } function t6(e, t) { return (t6 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) { return e.__proto__ = t, e } )(e, t) } function t8(e) { return (t8 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) { return e.__proto__ || Object.getPrototypeOf(e) } )(e) } var t7 = function() { !function(e, t) { if ("function" != typeof t && null !== t) throw TypeError("Super expression must either be null or a function"); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, writable: !0, configurable: !0 } }), Object.defineProperty(e, "prototype", { writable: !1 }), t && t6(e, t) }(s, t0); var e, t, r, n, i, o = (e = s, t = function() { if ("undefined" == typeof Reflect || !Reflect.construct || Reflect.construct.sham) return !1; if ("function" == typeof Proxy) return !0; try { return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0 } catch (e) { return !1 } }(), function() { var r = t8(e); return function(e, t) { if (t && ("object" === t1(t) || "function" == typeof t)) return t; if (void 0 !== t) throw TypeError("Derived constructors may only return object or undefined"); return function(e) { if (void 0 !== e) return e; throw ReferenceError("this hasn't been initialised - super() hasn't been called") }(e) }(this, t ? Reflect.construct(r, arguments, t8(this).constructor) : r.apply(this, arguments)) } ); function s() { return function(e, t) { if (!(e instanceof t)) throw TypeError("Cannot call a class as a function") }(this, s), o.apply(this, arguments) } return r = s, n = [{ key: "start", value: function(e) { var t = this , r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}; this.abort = !1, r.selectRoute ? this._selectRoute(r, function(r) { r = t3(t3({}, r), {}, { enableSelectRoute: !0 }), e ? t._run(e, r) : t._batchAction(t._run.bind(t), r) }) : e ? this._run(e) : this._batchAction(this._run.bind(this)) } }, { key: "addFile", value: function(e) { var t; return e && eG.checkStsToken(e.stsToken) ? e.file && this.config.clientEncrypt ? this._addAllUploadProcessClientEncrypt(e) : e.file ? (t = eh.getUnique("file"), this._addAllUploadProcess(e, t), t) : null : (this.emit("error", { extra: { message: eA, errorCode: 1000002 } }), null) } }, { key: "addImageFile", value: function(e) { var t; return e && eG.checkStsToken(e.stsToken) ? e.file ? (e.type = e.type || en, t = eh.getUnique("file"), this._addAllUploadProcess(e, t), t) : null : (this.emit("error", { extra: { message: eA, errorCode: 1000002 } }), null) } }, { key: "addStreamUploadTask", value: function(e) { var t; return e && eG.checkStsToken(e.stsToken) ? (t = eh.getUnique("file"), this._addAllStreamUploadProcess(e, t), t) : (this.emit("error", { extra: { message: eA, errorCode: 1000002 } }), null) } }, { key: "addStreamSlice", value: function(e) { var t = e.fileSlice , e = e.index; this._addStreamSlice({ fileSlice: t, index: e }) } }, { key: "completeStreamUpload", value: function() { this._completeStreamUpload() } }, { key: "removeFile", value: function(e) { e && this._removeFile(e) } }, { key: "cancel", value: function(e) { e ? this._userCancel(e) : this._batchAction(this._userCancel.bind(this)) } }, { key: "pause", value: function(e) { this._userPause(e) } }, { key: "restart", value: function(e) { e ? this._restart(e) : this._batchAction(this._restart.bind(this)) } }, { key: "refreshSTSToken", value: function(e) { this._refreshSTSToken(e) } }, { key: "setOption", value: function(e) { this._setOption(e) } }, { key: "getOption", value: function(e) { return this._getOption(e) } }], t4(r.prototype, n), Object.defineProperty(r, "prototype", { writable: !1 }), s }() } ]).default } , window.TR = new r(), window.TT = t, console.log("TR", window.TR) // e.exports = window.TT } TEST();