module.exports = function (t) {
    var e = {};

    function i(n) {
        if (e[n]) return e[n].exports;
        var a = e[n] = {i: n, l: !1, exports: {}};
        return t[n].call(a.exports, a, a.exports, i), a.l = !0, a.exports
    }

    return i.m = t, i.c = e, i.d = function (t, e, n) {
        i.o(t, e) || Object.defineProperty(t, e, {enumerable: !0, get: n})
    }, i.r = function (t) {
        "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {value: "Module"}), Object.defineProperty(t, "__esModule", {value: !0})
    }, i.t = function (t, e) {
        if (1 & e && (t = i(t)), 8 & e) return t;
        if (4 & e && "object" == typeof t && t && t.__esModule) return t;
        var n = Object.create(null);
        if (i.r(n), Object.defineProperty(n, "default", {
            enumerable: !0,
            value: t
        }), 2 & e && "string" != typeof t) for (var a in t) i.d(n, a, function (e) {
            return t[e]
        }.bind(null, a));
        return n
    }, i.n = function (t) {
        var e = t && t.__esModule ? function () {
            return t.default
        } : function () {
            return t
        };
        return i.d(e, "a", e), e
    }, i.o = function (t, e) {
        return Object.prototype.hasOwnProperty.call(t, e)
    }, i.p = "", i(i.s = 209)
}([function (t, e, i) {
    t.exports = i(23)(65)
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(17), s = i(22), o = i(11), r = i(0), l = i(55);

    class u {
        constructor() {
            this.mThunderVersionStr = void 0, this.mThunderVersionNumber = void 0, this.mWebPluginVersion = void 0
        }

        init() {
            this.loadThunderVersion().catch(), this.loadWebPluginVersion().catch()
        }

        get pluginName() {
            return l.name
        }

        get pluginWebviewName() {
            return `${l.name}-webview`
        }

        get pluginDialogRendererName() {
            return `${l.name}-dialog-renderer`
        }

        get binName() {
            return "VipDownload"
        }

        get thunderVersionNumber() {
            return this.mThunderVersionNumber
        }

        get thunderVersionString() {
            return this.mThunderVersionStr
        }

        get clientName() {
            return "xl_xdas"
        }

        get pluginVersion() {
            return l.version
        }

        get webPluginVersion() {
            return this.mWebPluginVersion
        }

        get currentTime() {
            return Math.floor((new Date).getTime() / 1e3)
        }

        get currentMillisecond() {
            return (new Date).getTime()
        }

        combineUrlReferfromAidfrom(t, e, i) {
            return "" === i && (i = "0"), "" === e && (e = "0"), -1 !== t.indexOf("?") ? t += `&referfrom=${e}&aidfrom=${i}` : t += `?referfrom=${e}&aidfrom=${i}`, t
        }

        isUrlInDomains(t, e) {
            let i = !1;
            for (let n = 0; n < e.length; ++n) if (t.includes(e[n])) {
                i = !0;
                break
            }
            return i
        }

        isPeeridMatchSha256Region(t, e, i) {
            let n = !1, s = a.createHash("sha256");
            s.update(t);
            let o = s.digest("hex"), l = o[i = i ? o.length - i : o.length - 1];
            return l && (l = l.toUpperCase(), e.includes(l) && (n = !0)), r.default.getLogger("peer").info(o), n
        }

        loadThunderVersion() {
            return n(this, void 0, void 0, function* () {
                const {client: t} = yield Promise.resolve().then(() => i(2)),
                    e = yield t.callServerFunction("GetThunderVersion");
                this.mThunderVersionStr = e, this.mThunderVersionNumber = 0;
                let n = this.mThunderVersionStr.split(".");
                if (n && 4 === n.length) {
                    let t = Number(n[0]).valueOf(), e = Number(n[1]).valueOf(), i = Number(n[2]).valueOf(), a = 128;
                    this.mThunderVersionNumber = a * Math.pow(2, 24) + t * Math.pow(2, 16) + e * Math.pow(2, 8) + i
                }
            })
        }

        loadWebPluginVersion() {
            return n(this, void 0, void 0, function* () {
                this.mWebPluginVersion = "";
                let t = o.join(__rootDir, "../ThunderXWebXDAS/VERION.txt"), e = yield s.FileSystemAWNS.readFileAW(t);
                e && (this.mWebPluginVersion = e.toString())
            })
        }
    }

    e.PluginHelper = u, e.default = new u
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(9), s = i(56), o = i(29), r = i(36);

    function l(t) {
        r.information("on object freeer"), global.__xdasIPCClienInstance.notifyFreer(t.remoteId, t.callbackId)
    }

    let u = void 0;
    global.__xdasIPCClienInstance || (global.__xdasIPCClienInstance = new class extends a.EventEmitter {
        constructor() {
            super(), this.rid = 0, this.apis = {}, this.singletonMap = {}, this.retCallbackMap = {}, this.eventCallbackMaps = {}, this.contextCallbackMap = {}
        }

        start(t, e, i, n) {
            do {
                if (!i && this.client) break;
                if (e || (e = o.getDefaultPrex()), this.singletonMap.hasOwnProperty(e.toLowerCase())) break;
                if (global.__xdasPluginConfig && global.__xdasPluginConfig.name ? t = {
                    name: global.__xdasPluginConfig.name,
                    version: global.__xdasPluginConfig.version
                } : void 0 !== t && null !== t || (t = this.parseContext()), !t) {
                    if (!this.client || !this.client.getContext()) throw new Error("no suitable context for client, please specify context with start function");
                    t = {name: this.client.getContext().name, version: this.client.getContext().version}
                }
                if (t.name === o.serverContextName) throw new Error("client context must difference from server");
                if (i && !this.client) throw new Error("connect to other product must start self firstly");
                let a = new s.Client({context: t, socketPrex: e});
                this.singletonMap[e.toLowerCase()] = a, i || (this.client = a), a.on("message", t => {
                    if ("fire_event" === t.action) this.fireServerEvent(a, t.name, [t.__context].concat(t.args)); else if ("client_context_freer" === t.action) {
                        r.information("client on object freer", t);
                        do {
                            let e = t.rid;
                            if (e) {
                                if (!this.contextCallbackMap[e]) break;
                                delete this.contextCallbackMap[e]
                            }
                        } while (0)
                    } else if ("call_client_by_id" === t.action) this.callFunctionById(a, t.rid, t.s_rid, t.args); else if ("call_client_api" === t.action) this.callRegisterFunction(a, t); else if ("check_client_function" === t.action) {
                        let e = t.method, i = !0;
                        e && this.apis && this.apis[e] || (i = !1), this.sendAdapter(a, {
                            s_rid: t.s_rid,
                            action: "check_client_function_callback",
                            success: !0,
                            data: i
                        })
                    } else if (void 0 !== t.success && null !== t.success) {
                        let e = t;
                        this.client === a && this.emit("stat_call_function_back", a.getContext(), t);
                        const i = this.retCallbackMap[e.rid].callback;
                        i && (e.success ? i(null, e.data) : i(e.error, e.data)), delete this.retCallbackMap[e.rid]
                    }
                }), a.on("error", t => {
                    n && n("error", t), this.emit("socket-error", t, a.getContext(), i, a.isInprocess()), delete this.singletonMap[e.toLowerCase()]
                }), a.isInprocess() ? (n && n("connect"), this.emit("connect", a.getContext(), i, !0)) : a.on("connect", () => {
                    n && n("connect"), this.emit("connect", a.getContext(), i, !1)
                }), a.on("end", () => {
                    let t = a.isInprocess();
                    r.information("server is ended, and this client emit end", e, i, t), n && n("end", a.getContext(), i, t), this.emit("end", a.getContext(), i, t), delete this.singletonMap[e.toLowerCase()]
                }), this.registry(a)
            } while (0)
        }

        registerFunctions(t) {
            do {
                if (!t) break;
                let e = void 0;
                for (let i in t) if (this.apis.hasOwnProperty(i)) {
                    e = i;
                    break
                }
                if (e) throw new Error(`try to coverd function ${e}`);
                this.apis = Object.assign({}, this.apis, t)
            } while (0)
        }

        checkServerFunction(t) {
            return n(this, void 0, void 0, function* () {
                return this.internalCheckServerFunction(this.client, t)
            })
        }

        callServerFunction(t, ...e) {
            return n(this, void 0, void 0, function* () {
                let i = null, n = yield this.callServerFunctionEx(t, ...e);
                return n && (i = n[0]), i
            })
        }

        callServerFunctionEx(t, ...e) {
            return this.internalCallServerFunctionEx(this.client, t, ...e)
        }

        isRemoteClientExist(t) {
            return this.internalIsRemoteClientExist(this.client, t)
        }

        checkRemoteFunction(t, e) {
            return this.internalCheckRemoteFunction(this.client, t, e)
        }

        callRemoteClientFunction(t, e, ...i) {
            return this.internalCallRemoteClientFunction(this.client, t, e, ...i)
        }

        notifyFreer(t, e) {
            this.sendAdapter(this.client, {action: "client_context_freer", dst: t, rid: e})
        }

        callRemoteContextById(t, e, ...i) {
            this.sendAdapter(this.client, {dst: t, action: "call_remote_context_by_id", rid: e, args: i})
        }

        attachServerEvent(t, e) {
            return this.internalAttachServerEvent(this.client, t, e)
        }

        detachServerEvent(t, e) {
            this.internalDetachServerEvent(this.client, t, e)
        }

        broadcastEvent(t, ...e) {
            this.sendAdapter(this.client, {action: "broadcast", name: t, args: e})
        }

        crossCheckServerFunction(t, e) {
            return n(this, void 0, void 0, function* () {
                {
                    if (!t) throw new Error("An argument for 'productId' was not provided");
                    let i = this.singletonMap[t.toLowerCase()];
                    if (!i) throw new Error("Please call the 'start' interface first");
                    return this.internalCheckServerFunction(i, e)
                }
            })
        }

        crossCallServerFunction(t, e, ...i) {
            return n(this, void 0, void 0, function* () {
                let n = null, a = yield this.crossCallServerFunctionEx(t, e, ...i);
                return a && (n = a[0]), n
            })
        }

        crossCallServerFunctionEx(t, e, ...i) {
            {
                if (!t) throw new Error("An argument for 'productId' was not provided");
                let n = this.singletonMap[t.toLowerCase()];
                if (!n) throw new Error("Please call the 'start' interface first");
                if (!e) throw new Error("An argument for 'funcName' was not provided");
                return this.internalCallServerFunctionEx(n, e, ...i)
            }
        }

        crossIsRemoteClientExist(t, e) {
            return n(this, void 0, void 0, function* () {
                {
                    if (!t) throw new Error("An argument for 'productId' was not provided");
                    let i = this.singletonMap[t.toLowerCase()];
                    if (!i) throw new Error("Please call the 'start' interface first");
                    return this.internalIsRemoteClientExist(i, e)
                }
            })
        }

        crossCheckRemoteFunction(t, e, i) {
            return n(this, void 0, void 0, function* () {
                {
                    if (!t) throw new Error("An argument for 'productId' was not provided");
                    let n = this.singletonMap[t.toLowerCase()];
                    if (!n) throw new Error("Please call the 'start' interface first");
                    if (!e) throw new Error("An argument for 'remoteId' was not provided");
                    if (!i) throw new Error("An argument for 'funcName' was not provided");
                    return this.internalCheckRemoteFunction(n, e, i)
                }
            })
        }

        crossCallRemoteClientFunction(t, e, i, ...n) {
            {
                if (!t) throw new Error("An argument for 'productId' was not provided");
                let a = this.singletonMap[t.toLowerCase()];
                if (!a) throw new Error("Please call the 'start' interface first");
                if (!e) throw new Error("An argument for 'remoteId' was not provided");
                if (!i) throw new Error("An argument for 'funcName' was not provided");
                return this.internalCallRemoteClientFunction(a, e, i, ...n)
            }
        }

        crossAttachServerEvent(t, e, i) {
            let n = void 0;
            {
                if (!t) throw new Error("An argument for 'productId' was not provided");
                let a = this.singletonMap[t.toLowerCase()];
                if (!a) throw new Error("Please call the 'start' interface first");
                if (!e) throw new Error("An argument for 'eventName' was not provided");
                n = this.internalAttachServerEvent(a, e, i)
            }
            return n
        }

        crossDetachServerEvent(t, e, i) {
            {
                if (!t) throw new Error("An argument for 'productId' was not provided");
                let n = this.singletonMap[t.toLowerCase()];
                if (!n) throw new Error("Please call the 'start' interface first");
                if (!e) throw new Error("An argument for 'eventName' was not provided");
                this.internalDetachServerEvent(n, e, i)
            }
        }

        crossBroadcastEvent(t, e, ...i) {
            {
                if (!t) throw new Error("An argument for 'productId' was not provided");
                let n = this.singletonMap[t.toLowerCase()];
                if (!n) throw new Error("Please call the 'start' interface first");
                if (!e) throw new Error("An argument for 'eventName' was not provided");
                this.sendAdapter(n, {
                    action: "broadcast",
                    name: e,
                    args: i,
                    __context: Object.assign({}, this.client.getContext())
                })
            }
        }

        registry(t) {
            let e = this.getFullContextName(this.client);
            return new Promise((i, n) => {
                do {
                    if (!e) {
                        i(!1);
                        break
                    }
                    let n = this.generateId();
                    const a = {alias: e, action: "register", rid: n};
                    let s = (t, n) => {
                        t ? (r.error("register error", t.message), i(n)) : i(e)
                    };
                    this.retCallbackMap[n] = Object.assign({callback: s}, a), this.sendAdapter(t, a)
                } while (0)
            })
        }

        getNow() {
            return Date.now()
        }

        sendAdapter(t, e) {
            do {
                if (!e) break;
                let i = this.getNow();
                if (e.timestamp ? e.timestamp = [...e.timestamp].concat(i) : e.timestamp = [].concat(i), !e.__context) {
                    let i = t.getContext();
                    i && (e = Object.assign({__context: i}, e))
                }
                t.isInprocess() ? (r.information("send to server in process"), global.__xdasIPCServer.emit("message", e, t)) : t.send(e)
            } while (0)
        }

        parseContext() {
            let t = void 0;
            do {
                let e = "";
                for (let t = 0; t < process.argv.length; t++) {
                    let i = process.argv[t];
                    if (0 === i.indexOf("--xdas-plugin-name=", 0)) {
                        e = i.substr("--xdas-plugin-name=".length);
                        break
                    }
                }
                if (!e) break;
                t = {name: e}
            } while (0);
            return t
        }

        generateId() {
            return this.rid++
        }

        getFullContextName(t, e) {
            let i = "";
            do {
                if (e === o.serverContextName) {
                    i = e;
                    break
                }
                if (void 0 === e) {
                    i = `${t.getContext().productId}-${t.getContext().name}`.toLowerCase();
                    break
                }
                i = `${t.getContext().productId}-${e}`.toLowerCase()
            } while (0);
            return i
        }

        internalCheckServerFunction(t, e) {
            return new Promise((i, n) => {
                do {
                    if (!t) {
                        i(!1);
                        break
                    }
                    if (!e) {
                        i(!1);
                        break
                    }
                    let n = this.generateId();
                    const a = {action: "check_server_function_exist", method: e, rid: n};
                    let s = (t, e) => {
                        i(!t && e)
                    };
                    this.retCallbackMap[n] = Object.assign({callback: s}, a), this.sendAdapter(t, a)
                } while (0)
            })
        }

        internalCallServerFunctionEx(t, e, ...i) {
            return new Promise((n, a) => {
                do {
                    if (!t) {
                        n([null, "client doesn't ready"]);
                        break
                    }
                    if (!e) {
                        n([null, "funcName is not specifed"]);
                        break
                    }
                    t === this.client && this.emit("stat_call_function", this.client.getContext(), e);
                    let a = this.generateId();
                    if (i) for (let t = 0; t < i.length; t++) i[t] = this.convertFunction2IdEx(i[t]);
                    const s = {rid: a, method: e, args: i};
                    let o = (e, i) => {
                        e ? (r.error("callServerFunction error", e, t.getContext()), n([null, e])) : n([i, void 0])
                    };
                    this.retCallbackMap[a] = Object.assign({callback: o}, s), this.sendAdapter(t, s)
                } while (0)
            })
        }

        internalIsRemoteClientExist(t, e) {
            return new Promise((i, n) => {
                do {
                    if (!e) {
                        i([!1, "remote client alias is not specifed"]);
                        break
                    }
                    if (t === this.client && e.toLowerCase() === t.getContext().name.toLowerCase()) {
                        i([!0, "self is exist"]);
                        break
                    }
                    let n = this.generateId();
                    const a = {dst: this.getFullContextName(t, e), action: "check_client_exist", rid: n};
                    let s = (t, e) => {
                        i(t ? [!1, t] : [e, "success"])
                    };
                    this.retCallbackMap[n] = Object.assign({callback: s}, a), this.sendAdapter(t, a)
                } while (0)
            })
        }

        internalCheckRemoteFunction(t, e, i) {
            return new Promise((n, a) => {
                do {
                    if (!t) {
                        n(!1);
                        break
                    }
                    if (!e) {
                        n(!1);
                        break
                    }
                    if (!i) {
                        n(!1);
                        break
                    }
                    if (t === this.client && e.toLowerCase() === t.getContext().name.toLowerCase()) {
                        n(!(!this.apis || !this.apis[i]));
                        break
                    }
                    let a = this.generateId();
                    const s = {
                        action: "check_client_function_exist",
                        method: i,
                        rid: a,
                        src: this.getFullContextName(this.client),
                        dst: this.getFullContextName(t, e)
                    };
                    let o = (t, e) => {
                        n(!t && e)
                    };
                    this.retCallbackMap[a] = Object.assign({callback: o}, s), this.sendAdapter(t, s)
                } while (0)
            })
        }

        internalCallRemoteClientFunction(t, e, i, ...n) {
            return new Promise((a, s) => {
                do {
                    if (!t) {
                        a([null, "client doesn't ready"]);
                        break
                    }
                    if (!e) {
                        a([null, "remote client alias is not specifed"]);
                        break
                    }
                    if (!i) {
                        a([null, "funcName is not specifed"]);
                        break
                    }
                    let s = (t, e) => {
                        t ? (r.information("callRemoteClientFunction", t.message), a([null, t])) : a([e, void 0])
                    };
                    if (n) for (let t = 0; t < n.length; t++) n[t] = this.convertFunction2IdEx(n[t]);
                    let o = this.generateId();
                    const l = {
                        src: this.getFullContextName(this.client),
                        dst: this.getFullContextName(t, e),
                        action: "call_remote_client_api",
                        method: i,
                        args: n,
                        rid: o
                    };
                    this.retCallbackMap[o] = Object.assign({callback: s}, l), this.sendAdapter(t, l)
                } while (0)
            })
        }

        internalAttachServerEvent(t, e, i) {
            let n = t.getContext().productId.toLowerCase();
            this.eventCallbackMaps.hasOwnProperty(n) || (this.eventCallbackMaps[n] = {}), this.eventCallbackMaps[n].hasOwnProperty(e) || (this.eventCallbackMaps[n][e] = {}), o.isObjectEmpty(this.eventCallbackMaps[n][e]) && this.sendAdapter(t, {
                action: "attach_event",
                name: e
            });
            let a = this.generateId();
            return this.eventCallbackMaps[n][e][a] = i, a
        }

        internalDetachServerEvent(t, e, i) {
            let n = t.getContext().productId.toLowerCase();
            do {
                if (!this.eventCallbackMaps.hasOwnProperty(n)) break;
                if (!this.eventCallbackMaps[n].hasOwnProperty(e)) break;
                delete this.eventCallbackMaps[n][e][i], o.isObjectEmpty(this.eventCallbackMaps[n][e]) && this.sendAdapter(t, {
                    action: "detach_event",
                    name: e
                })
            } while (0)
        }

        fireServerEvent(t, e, ...i) {
            let n = t.getContext().productId.toLowerCase();
            do {
                if (!this.eventCallbackMaps.hasOwnProperty(n)) break;
                if (!this.eventCallbackMaps[n].hasOwnProperty(e)) break;
                let t = this.eventCallbackMaps[n][e];
                for (let e in t) {
                    let n = t[e];
                    n && n.apply(null, ...i)
                }
            } while (0)
        }

        callFunctionById(t, e, i, ...n) {
            let a = void 0, s = !1;
            do {
                const o = this.contextCallbackMap[e];
                if (!o) break;
                let r = void 0, l = void 0;
                try {
                    r = o.apply(null, ...n)
                } catch (t) {
                    l = t.message;
                    break
                }
                if (void 0 === i || null === i) break;
                if (a = {s_rid: i, action: "call_client_by_id_callback", success: !1}, void 0 !== l) {
                    a.error = l;
                    break
                }
                if (r && r.then) {
                    r.then(e => {
                        a.data = this.convertFunction2Id(e), a.success = !0, this.sendAdapter(t, a)
                    }).catch(e => {
                        a.error = e instanceof Error ? e.message : e, this.sendAdapter(t, a)
                    }), s = !0;
                    break
                }
                a.success = !0, a.data = this.convertFunction2Id(r)
            } while (0);
            !s && a && this.sendAdapter(t, a)
        }

        convertFunction2Id(t) {
            let e = t;
            if ("function" == typeof t) {
                let i = this.generateId();
                this.contextCallbackMap[i] = t, e = i
            } else if (t && "object" == typeof t) for (let e in t) {
                let i = t[e];
                if ("function" == typeof i) {
                    let n = this.generateId();
                    this.contextCallbackMap[n] = i, t[e] = n
                } else i && "object" == typeof i && (t[e] = this.convertFunction2Id(i))
            }
            return e
        }

        convertFunction2IdEx(t) {
            let e = t;
            if ("function" == typeof t) {
                let i = this.generateId();
                this.contextCallbackMap[i] = t, e = {"__nodeipc_callback_id__{A9C9D760-14E8-42CB-A3CB-9C0A0DDFD732}": i}
            } else if (t && "object" == typeof t) for (let e in t) {
                let i = t[e];
                if ("function" == typeof i) {
                    let n = this.generateId();
                    this.contextCallbackMap[n] = i, t[e] = {"__nodeipc_callback_id__{A9C9D760-14E8-42CB-A3CB-9C0A0DDFD732}": n}
                } else i && "object" == typeof i && (t[e] = this.convertFunction2IdEx(i))
            }
            return e
        }

        decodeParameter(t, e) {
            let i = t;
            do {
                if (!t) break;
                if ("object" != typeof t) break;
                let n = t["__nodeipc_callback_id__{A9C9D760-14E8-42CB-A3CB-9C0A0DDFD732}"];
                if (n) {
                    i = ((...t) => {
                        this.callRemoteContextById(e, n, ...t)
                    }), global.__xdasObjectLiftMonitor && global.__xdasObjectLiftMonitor.setObjectFreer(i, {
                        remoteId: e,
                        callbackId: n
                    }, l);
                    break
                }
                for (let i in t) {
                    let n = t[i];
                    t[i] = this.decodeParameter(n, e)
                }
            } while (0);
            return i
        }

        callRegisterFunction(t, e) {
            let i = void 0, n = !1;
            do {
                if (!e) break;
                let a = e.method;
                if (!a) break;
                let s = this.getNow();
                if (i = {
                    s_rid: e.s_rid,
                    action: "remote_client_callback",
                    success: !1,
                    rid: e.rid,
                    method: e.method,
                    src: e.src,
                    timestamp: e.timestamp ? e.timestamp.concat(s) : [].concat(s)
                }, !this.apis || !this.apis[a]) {
                    i.error = `callRegisterFunction ${a} is undefined`;
                    break
                }
                let o = void 0, r = this.decodeParameter(e.args, e.src);
                try {
                    o = this.apis[a].apply(null, [e.src].concat(r))
                } catch (t) {
                    i.error = t.message;
                    break
                }
                if (o && o.then) {
                    o.then(e => {
                        i.data = this.convertFunction2IdEx(e), i.success = !0, this.sendAdapter(t, i)
                    }).catch(e => {
                        i.error = e instanceof Error ? e.message : e, this.sendAdapter(t, i)
                    }), n = !0;
                    break
                }
                i.success = !0, i.data = this.convertFunction2IdEx(o)
            } while (0);
            r.information("callRegisterFunction", i), !n && i && this.sendAdapter(t, i)
        }
    }), u = global.__xdasIPCClienInstance, e.client = u
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(145), s = i(9), o = i(2), r = i(0).default.getLogger("VipDownload:user-info");
    var l;
    !function (t) {
        t.login = "OnLogin", t.logout = "OnLogout", t.authorityChanged = "OnAuthorityChanged", t.authorityChangedBegin = "OnAuthorityChangedBegin", t.cutlineCountChanged = "cutlineCountChanged"
    }(l = e.UserEventNS || (e.UserEventNS = {}));

    class u extends s.EventEmitter {
        constructor() {
            super(), this.mHasFlux = !1, this.mPeerId = void 0, this.mUserId = "0", this.mSessionId = void 0, this.mIsLogin = !1, this.mIsVip = !1, this.mVipLevel = 0, this.mVasType = 0, this.mIsYear = !1, this.mPreUserIsVip = !1, this.init()
        }

        init() {
            this.setMaxListeners(0), this.attachUserEvents().catch()
        }

        getPeerId() {
            return n(this, void 0, void 0, function* () {
                if (this.mPeerId) return this.mPeerId;
                {
                    let t = yield o.client.callServerFunction("GetPeerID");
                    return t && "" !== t && (this.mPeerId = t), this.mPeerId || ""
                }
            })
        }

        getSessionId() {
            return n(this, void 0, void 0, function* () {
                if (this.mSessionId) return this.mSessionId;
                {
                    let t = yield o.client.callServerFunction("GetSessionID");
                    return t && "" !== t && (this.mSessionId = t), this.mSessionId || "0"
                }
            })
        }

        getUserinfo() {
            return n(this, void 0, void 0, function* () {
                return yield o.client.callServerFunction("GetAllUserInfo")
            })
        }

        get jumpKey() {
            return ""
        }

        get userId() {
            return this.mUserId
        }

        get isLogin() {
            return this.mIsLogin
        }

        get isVip() {
            return this.mIsVip
        }

        get isPreUserIsVip() {
            return this.mPreUserIsVip
        }

        get isYear() {
            return this.mIsYear
        }

        get isPlatinumVip() {
            return this.isVip && this.vasType > 2
        }

        get isSuperVip() {
            return this.isVip && 5 === this.vasType
        }

        get hasFlux() {
            return this.mHasFlux
        }

        get vipLevel() {
            return this.mVipLevel
        }

        get vasType() {
            return this.mVasType
        }

        get userLevel() {
            return 1
        }

        get authority() {
            return this.isVip || this.hasFlux
        }

        get offlineAuthority() {
            return this.isLogin
        }

        queryFlux() {
            return n(this, void 0, void 0, function* () {
                let t = yield this.getPeerId(), e = {userId: this.userId, peerId: t, jumpKey: this.jumpKey},
                    i = yield(new a.UserHttpSession).queryFlux(e);
                i && 0 === i.result && i.capacity > 0 && (this.mHasFlux = !0)
            })
        }

        authorityChanged(t, e, i) {
            this.emit(l.authorityChangedBegin, t, e, i), this.emit(l.authorityChanged, t, e, i)
        }

        attachUserEvents() {
            return n(this, void 0, void 0, function* () {
                let t = yield o.client.callServerFunction("IsLogined");
                r.info("isLogined", t), t && this.onLogin(!0).catch(), o.client.attachServerEvent("onUserInfoChange", this.onUserInfoChange.bind(this)), o.client.attachServerEvent("onLoginStatusChange", this.onLoginStatusChange.bind(this))
            })
        }

        onLogin(t) {
            return n(this, void 0, void 0, function* () {
                r.info("--\x3eonLogin"), this.mPreUserIsVip = this.mIsVip, this.clear(), this.mIsLogin = !0, yield this.parseUserInfo(), this.emit(l.login), this.isVip || (yield this.queryFlux()), this.authorityChanged(this.authority, void 0, t), r.info("<--onLogin")
            })
        }

        onLogout() {
            r.info("--\x3eonLogout"), this.mPreUserIsVip = this.mIsVip, this.clear(), this.emit(l.logout), this.authorityChanged(!1), r.info("<--onLogout")
        }

        onUserInfoChange(t, e, i) {
            return n(this, void 0, void 0, function* () {
                r.info("--\x3eonUserInfoChange"), "vipinfo" === e && (r.info("data", i), yield this.parseUserInfo(), this.mIsVip && this.authorityChanged(this.authority, !0)), r.info("<--onUserInfoChange")
            })
        }

        onLoginStatusChange(t, e, i) {
            r.info("--\x3eonLoginStatusChange", "newStatus", i), "unlogin" === i || "offline" === i ? this.onLogout() : "online" === i && this.onLogin().catch(), r.info("<--onLoginStatusChange")
        }

        clear() {
            this.mUserId = "0", this.mSessionId = void 0, this.mHasFlux = !1, this.mIsVip = !1, this.mIsLogin = !1, this.mVasType = 0, this.mVipLevel = 0
        }

        parseUserInfo() {
            return n(this, void 0, void 0, function* () {
                let t = yield this.getUserinfo();
                if (r.info("userinfo", t), t) if (this.mUserId = t.userID || "0", t.vipList && t.vipList[0]) {
                    if (t.vipList[0].isVip) {
                        let e = Number(t.vipList[0].isVip).valueOf();
                        this.mIsVip = e > 0
                    } else this.mIsVip = !1;
                    if (t.vipList[0].vipLevel && (this.mVipLevel = Number(t.vipList[0].vipLevel).valueOf()), t.vipList[0].vasType && (this.mVasType = Number(t.vipList[0].vasType).valueOf()), t.vipList[0].isYear) {
                        let e = Number(t.vipList[0].isYear).valueOf();
                        this.mIsYear = 1 === e
                    }
                } else this.mIsVip = !1
            })
        }

        vipType() {
            let t = 0;
            return this.isSuperVip ? t = 5 : this.isPlatinumVip ? t = 3 : this.isVip && (t = 2), t
        }
    }

    e.UserHelper = u, e.default = new u
}, function (t, e, i) {
    "use strict";

    function n(t, e, i, n, a, s, o, r) {
        var l, u = "function" == typeof t ? t.options : t;
        if (e && (u.render = e, u.staticRenderFns = i, u._compiled = !0), n && (u.functional = !0), s && (u._scopeId = "data-v-" + s), o ? (l = function (t) {
            (t = t || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) || "undefined" == typeof __VUE_SSR_CONTEXT__ || (t = __VUE_SSR_CONTEXT__), a && a.call(this, t), t && t._registeredComponents && t._registeredComponents.add(o)
        }, u._ssrRegister = l) : a && (l = r ? function () {
            a.call(this, this.$root.$options.shadowRoot)
        } : a), l) if (u.functional) {
            u._injectStyles = l;
            var c = u.render;
            u.render = function (t, e) {
                return l.call(e), c(t, e)
            }
        } else {
            var d = u.beforeCreate;
            u.beforeCreate = d ? [].concat(d, l) : [l]
        }
        return {exports: t, options: u}
    }

    i.d(e, "a", function () {
        return n
    })
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(17), s = i(0).default.getLogger("Thunder.Util"), o = i(1), r = i(11);

    function l(t) {
        let e = t;
        return 0 === t.indexOf('"') && t.lastIndexOf('"') === t.length - 1 ? e = t.substring(1, t.length - 1) : 0 === t.indexOf("'") && t.lastIndexOf("'") === t.length - 1 && (e = t.substring(1, t.length - 1)), e
    }

    !function (t) {
        function e(t) {
            let e = null;
            do {
                if (void 0 === t || null === t) break;
                e = t.match(/[\/]?([^?]*)\?([^\s]*)/) ? RegExp.$2 : ""
            } while (0);
            return e
        }

        function i(t) {
            let e = {};
            do {
                if (void 0 === t || null === t) break;
                let i = /([^&=?]+)=([^&]*)/g;
                for (; i.exec(t);) e[RegExp.$1] = RegExp.$2
            } while (0);
            return e
        }

        function u(t) {
            return i(e(t))
        }

        function c(t) {
            let e = null;
            do {
                if (void 0 === t || null === t) break;
                e = t.match(/[\/]?([^?]*)\?([^\s]*)/) ? RegExp.$1 : t
            } while (0);
            return e
        }

        t.formatSize = function (t, e) {
            e = e || 2;
            let i = "0B";
            if ("number" == typeof t && t > 0) {
                let n = ["B", "KB", "MB", "GB", "TB"], a = 0, s = t;
                for (; s >= 1e3 && !(a >= 4);) s /= 1024, a += 1;
                i = -1 === String(s).indexOf(".") ? s + n[a] : s.toFixed(e) + n[a]
            }
            return i
        }, t.isDigital = function (t) {
            let e = !1;
            return /^\d+$/.test(t) && (e = !0), e
        }, t.isAlpha = function (t) {
            let e = !1;
            return /[A-Za-z]/.test(t) && (e = !0), e
        }, t.isUpperCase = function (t) {
            let e = !1;
            return /[A-Z]/.test(t) && (e = !0), e
        }, t.isLowerCase = function (t) {
            let e = !1;
            return /[a-z]/.test(t) && (e = !0), e
        }, t.isChinese = function (t) {
            let e = !1;
            return /[\u4E00-\u9FA5]/.test(t) && (e = !0), e
        }, t.replaceNonDigital = function (t) {
            return t.replace(/[^\d]/g, "")
        }, t.replaceNonAlpha = function (t) {
            return t.replace(/[^A-Za-z]/g, "")
        }, t.replaceNonWord = function (t) {
            return t.replace(/[^\W]/g, "")
        }, t.deepCopy = function (t) {
            let e = JSON.stringify(t), i = null;
            try {
                i = JSON.parse(e)
            } catch (t) {
                s.warn(t)
            }
            return i
        }, t.swap = function (t, e, i) {
            do {
                if (e < 0 || e >= t.length) break;
                if (i < 0 || i >= t.length) break;
                if (e === i) break;
                t[e] = t.splice(i, 1, t[e])[0]
            } while (0);
            return t
        }, t.compareNocase = function (t, e) {
            let i = !1;
            do {
                if (void 0 === t && void 0 === e) {
                    i = !0;
                    break
                }
                if (void 0 === t || void 0 === e) break;
                if ("string" != typeof t || "string" != typeof e) break;
                i = t.toLowerCase() === e.toLowerCase()
            } while (0);
            return i
        }, t.parseCommandLine = function (t) {
            let e = 0, i = "", n = !1, a = [], s = t.length;
            for (let o = 0; o < s; o++) {
                let r = t[o];
                if ('"' !== r && "'" !== r || ("" === i ? (n = !0, i = r) : i === r && (n = !1, i = "")), " " !== r || n || o === s - 1) {
                    if (o === s - 1) {
                        let i = t.substring(e);
                        "" !== i.trim() && a.push(l(i))
                    }
                } else {
                    let i = t.substring(e, o);
                    "" !== i.trim() && a.push(l(i)), e = o + 1
                }
            }
            return a
        }, t.setQueryString = function (t, e) {
            return Object.keys(e).forEach((i, n) => {
                t += 0 === n ? "?" : "&", t += `${i}=${e[i]}`
            }), t
        }, t.getQueryString = function (t, e) {
            return t && e && t.match(new RegExp(`(^${e}|[?|&]${e})=([^&#]+)`)) ? RegExp.$2 : ""
        }, t.isDef = function (t) {
            return void 0 !== t && null !== t
        }, t.isUndef = function (t) {
            return void 0 === t || null === t
        }, t.setCSSProperties = function (t, e) {
            Object.entries(e).forEach(([e, i]) => {
                t.style.setProperty(e, i)
            })
        }, t.versionCompare = function (t, e) {
            let i = t.split("."), n = e.split("."), a = 0;
            for (let t = 0; t < i.length; t++) {
                if (Number(i[t]) - Number(n[t]) > 0) {
                    a = 1;
                    break
                }
                if (Number(i[t]) - Number(n[t]) < 0) {
                    a = -1;
                    break
                }
            }
            return a
        }, t.parseDynamicUrlPath = e, t.parseDynamicUrlArgs = i, t.getUrlArgs = u, t.sleep = function (t) {
            return n(this, void 0, void 0, function* () {
                return new Promise(e => {
                    setTimeout(() => {
                        e()
                    }, t)
                })
            })
        }, t.getStaticPath = function () {
            let t = r.join(__rootDir, o.default.pluginVersion, "static").replace("\\", "/");
            for (; -1 !== t.indexOf("\\");) t = t.replace("\\", "/");
            return t
        }, t.genarateMd5 = function (t) {
            let e = void 0, i = a.createHash("md5");
            return null !== i && (e = i.update(t).digest("hex")), e
        }, t.GetUrlHost = c, t.RepleaseUrlArgs = function (t, e) {
            let i = Object.getOwnPropertyNames(t), n = u(e);
            i.forEach(e => {
                t[e] && (n[e] = t[e])
            }), i = Object.getOwnPropertyNames(n);
            let a = c(e);
            return i.forEach(t => {
                a.indexOf("?") > 0 ? a += `&${t}=${n[t]}` : a += `?${t}=${n[t]}`
            }), a
        }
    }(e.ThunderUtil || (e.ThunderUtil = {}))
}, function (t, e, i) {
    "use strict";
    var n = i(37), a = i(64), s = Object.prototype.toString;

    function o(t) {
        return "[object Array]" === s.call(t)
    }

    function r(t) {
        return null !== t && "object" == typeof t
    }

    function l(t) {
        return "[object Function]" === s.call(t)
    }

    function u(t, e) {
        if (null !== t && void 0 !== t) if ("object" != typeof t && (t = [t]), o(t)) for (var i = 0, n = t.length; i < n; i++) e.call(null, t[i], i, t); else for (var a in t) Object.prototype.hasOwnProperty.call(t, a) && e.call(null, t[a], a, t)
    }

    t.exports = {
        isArray: o, isArrayBuffer: function (t) {
            return "[object ArrayBuffer]" === s.call(t)
        }, isBuffer: a, isFormData: function (t) {
            return "undefined" != typeof FormData && t instanceof FormData
        }, isArrayBufferView: function (t) {
            return "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(t) : t && t.buffer && t.buffer instanceof ArrayBuffer
        }, isString: function (t) {
            return "string" == typeof t
        }, isNumber: function (t) {
            return "number" == typeof t
        }, isObject: r, isUndefined: function (t) {
            return void 0 === t
        }, isDate: function (t) {
            return "[object Date]" === s.call(t)
        }, isFile: function (t) {
            return "[object File]" === s.call(t)
        }, isBlob: function (t) {
            return "[object Blob]" === s.call(t)
        }, isFunction: l, isStream: function (t) {
            return r(t) && l(t.pipe)
        }, isURLSearchParams: function (t) {
            return "undefined" != typeof URLSearchParams && t instanceof URLSearchParams
        }, isStandardBrowserEnv: function () {
            return ("undefined" == typeof navigator || "ReactNative" !== navigator.product) && "undefined" != typeof window && "undefined" != typeof document
        }, forEach: u, merge: function t() {
            var e = {};

            function i(i, n) {
                "object" == typeof e[n] && "object" == typeof i ? e[n] = t(e[n], i) : e[n] = i
            }

            for (var n = 0, a = arguments.length; n < a; n++) u(arguments[n], i);
            return e
        }, extend: function (t, e, i) {
            return u(e, function (e, a) {
                t[a] = i && "function" == typeof e ? n(e, i) : e
            }), t
        }, trim: function (t) {
            return t.replace(/^\s*/, "").replace(/\s*$/, "")
        }
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e, i, n, a, s, o, r, l, u, c, d, h, f, p, g, S, y, T, k;
        !function (t) {
            t[t.Unkown = 0] = "Unkown", t[t.Create = 1] = "Create", t[t.InvaldParam = 2] = "InvaldParam", t[t.InvaldLink = 3] = "InvaldLink", t[t.InvaldConfig = 4] = "InvaldConfig", t[t.Timeout = 5] = "Timeout", t[t.VerifyData = 6] = "VerifyData", t[t.Forbidden = 7] = "Forbidden", t[t.RangeDispatch = 8] = "RangeDispatch", t[t.FilePathOverRanging = 9] = "FilePathOverRanging", t[t.FileCreate = 201] = "FileCreate", t[t.FileWrite = 202] = "FileWrite", t[t.FileRead = 203] = "FileRead", t[t.FileRename = 204] = "FileRename", t[t.FileFull = 205] = "FileFull", t[t.FileOccupied = 211] = "FileOccupied", t[t.FileAccessDenied = 212] = "FileAccessDenied", t[t.BtUploadExist = 601] = "BtUploadExist", t[t.ForbinddenResource = 701] = "ForbinddenResource", t[t.ForbinddenAccount = 702] = "ForbinddenAccount", t[t.ForbinddenArea = 703] = "ForbinddenArea", t[t.ForbinddenCopyright = 704] = "ForbinddenCopyright", t[t.ForbinddenReaction = 705] = "ForbinddenReaction", t[t.ForbinddenPorn = 706] = "ForbinddenPorn", t[t.DownloadSDKCrash = 10001] = "DownloadSDKCrash", t[t.torrentFileNotExist = 10002] = "torrentFileNotExist"
        }(e = t.TaskError || (t.TaskError = {})), function (t) {
            t[t.Unkown = -1] = "Unkown", t[t.Success = 0] = "Success", t[t.QueryFailed = 1] = "QueryFailed", t[t.ServerError = 2] = "ServerError", t[t.ResourceNotFound = 3] = "ResourceNotFound", t[t.AuthorizingFailed = 4] = "AuthorizingFailed", t[t.ForbidByCopyright = 5] = "ForbidByCopyright", t[t.ForbidByPorNoGraphy = 6] = "ForbidByPorNoGraphy", t[t.ForbidByReactionary = 7] = "ForbidByReactionary", t[t.ForbidByOtherFilter = 8] = "ForbidByOtherFilter"
        }(i = t.DcdnStatusCode || (t.DcdnStatusCode = {})), function (t) {
            t[t.Begin = -1] = "Begin", t[t.Unkown = 0] = "Unkown", t[t.StandBy = 1] = "StandBy", t[t.PreDownloading = 2] = "PreDownloading", t[t.StartWaiting = 3] = "StartWaiting", t[t.StartPending = 4] = "StartPending", t[t.Started = 5] = "Started", t[t.StopPending = 6] = "StopPending", t[t.Stopped = 7] = "Stopped", t[t.Succeeded = 8] = "Succeeded", t[t.Failed = 9] = "Failed", t[t.Seeding = 10] = "Seeding", t[t.DestroyPending = 11] = "DestroyPending", t[t.End = 12] = "End"
        }(n = t.TaskStatus || (t.TaskStatus = {})), function (t) {
            t[t.Begin = -1] = "Begin", t[t.StandBy = 0] = "StandBy", t[t.Stopped = 1] = "Stopped", t[t.Started = 2] = "Started", t[t.Complete = 3] = "Complete", t[t.Forbidden = 4] = "Forbidden", t[t.Error = 5] = "Error", t[t.End = 6] = "End"
        }(a = t.BtFileStatus || (t.BtFileStatus = {})), function (t) {
            t[t.DispatchStrategyNone = 0] = "DispatchStrategyNone", t[t.DispatchStrategyOrigin = 1] = "DispatchStrategyOrigin", t[t.DispatchStrategyP2s = 2] = "DispatchStrategyP2s", t[t.DispatchStrategyP2p = 4] = "DispatchStrategyP2p", t[t.DispatchStrategyAll = -1] = "DispatchStrategyAll"
        }(s = t.DispatchStrategy || (t.DispatchStrategy = {})), function (t) {
            t[t.Unkown = 0] = "Unkown", t[t.P2sp = 1] = "P2sp", t[t.Bt = 2] = "Bt", t[t.Emule = 3] = "Emule", t[t.Group = 4] = "Group", t[t.Magnet = 5] = "Magnet"
        }(o = t.TaskType || (t.TaskType = {})), function (t) {
            t.Unkown = "Unkown", t.Downloading = "Downloading", t.Completed = "Completed", t.Recycle = "Recycle"
        }(r = t.CategroyViewID || (t.CategroyViewID = {})), function (t) {
            t[t.Unknow = 0] = "Unknow", t[t.TaskCreated = 1] = "TaskCreated", t[t.InsertToCategoryView = 2] = "InsertToCategoryView", t[t.RemoveFromCategoryView = 3] = "RemoveFromCategoryView", t[t.StatusChanged = 4] = "StatusChanged", t[t.DetailChanged = 5] = "DetailChanged", t[t.ChannelInfoChanged = 6] = "ChannelInfoChanged", t[t.DcdnStatusChanged = 7] = "DcdnStatusChanged", t[t.TaskDescriptionChanged = 8] = "TaskDescriptionChanged", t[t.TaskUserRead = 9] = "TaskUserRead", t[t.TaskRenamed = 10] = "TaskRenamed", t[t.TaskMovedEnd = 11] = "TaskMovedEnd", t[t.TaskMovingStateChange = 12] = "TaskMovingStateChange", t[t.BtSubFileDetailChanged = 13] = "BtSubFileDetailChanged", t[t.BtSubFileLoaded = 14] = "BtSubFileLoaded", t[t.BtSubFileForbidden = 15] = "BtSubFileForbidden", t[t.BtSubFileDcdnStatusChanged = 16] = "BtSubFileDcdnStatusChanged", t[t.TaskCategoryMovedEnd = 17] = "TaskCategoryMovedEnd", t[t.GroupTaskSubFileDetailChanged = 18] = "GroupTaskSubFileDetailChanged", t[t.TaskDestroying = 19] = "TaskDestroying", t[t.TaskDestroyed = 20] = "TaskDestroyed"
        }(l = t.TaskEventType || (t.TaskEventType = {})), function (t) {
            t[t.NumberStrart = 0] = "NumberStrart", t[t.TaskId = 1] = "TaskId", t[t.VirtualId = 2] = "VirtualId", t[t.SrcTotal = 3] = "SrcTotal", t[t.SrcUsing = 4] = "SrcUsing", t[t.FileSize = 5] = "FileSize", t[t.ReceivedSize = 6] = "ReceivedSize", t[t.DownloadSize = 7] = "DownloadSize", t[t.TotalDownloadSize = 8] = "TotalDownloadSize", t[t.CreateTime = 9] = "CreateTime", t[t.CompletionTime = 10] = "CompletionTime", t[t.DownloadingPeriod = 11] = "DownloadingPeriod", t[t.Progress = 12] = "Progress", t[t.RecycleTime = 13] = "RecycleTime", t[t.FileCreated = 14] = "FileCreated", t[t.Forbidden = 15] = "Forbidden", t[t.CategoryId = 16] = "CategoryId", t[t.UserRead = 17] = "UserRead", t[t.OpenOnComplete = 18] = "OpenOnComplete", t[t.GroupTaskId = 19] = "GroupTaskId", t[t.DownloadSubTask = 20] = "DownloadSubTask", t[t.NameType = 21] = "NameType", t[t.OwnerProduct = 22] = "OwnerProduct", t[t.FileIndex = 23] = "FileIndex", t[t.NameFixed = 24] = "NameFixed", t[t.ValidDownloadSize = 25] = "ValidDownloadSize", t[t.RealDownloadSize = 26] = "RealDownloadSize", t[t.ResourceLegal = 27] = "ResourceLegal", t[t.TaskType = 28] = "TaskType", t[t.ErrorCode = 29] = "ErrorCode", t[t.NumberEnd = 30] = "NumberEnd", t[t.BooleanStart = 4096] = "BooleanStart", t[t.Destroyed = 4097] = "Destroyed", t[t.Background = 4098] = "Background", t[t.Moving = 4099] = "Moving", t[t.BooleanEnd = 4100] = "BooleanEnd", t[t.StringStart = 8192] = "StringStart", t[t.TaskName = 8193] = "TaskName", t[t.SavePath = 8194] = "SavePath", t[t.RelativePath = 8195] = "RelativePath", t[t.TaskUrl = 8196] = "TaskUrl", t[t.RefUrl = 8197] = "RefUrl", t[t.Cid = 8198] = "Cid", t[t.Gcid = 8199] = "Gcid", t[t.Cookie = 8200] = "Cookie", t[t.ProductInfo = 8201] = "ProductInfo", t[t.Origin = 8202] = "Origin", t[t.Description = 8203] = "Description", t[t.UserData = 8204] = "UserData", t[t.OriginName = 8205] = "OriginName", t[t.HTTPContentType = 8206] = "HTTPContentType", t[t.CategoryViewId = 8207] = "CategoryViewId", t[t.StringEnd = 8208] = "StringEnd", t[t.ObjectStart = 12288] = "ObjectStart", t[t.ObjectEnd = 12289] = "ObjectEnd"
        }(u = t.TaskAttribute || (t.TaskAttribute = {})), function (t) {
            t[t.UnKnown = 0] = "UnKnown", t[t.SrcTotal = 1] = "SrcTotal", t[t.SrcUsing = 2] = "SrcUsing", t[t.FileSize = 4] = "FileSize", t[t.ReceivedSize = 8] = "ReceivedSize", t[t.DownloadSize = 16] = "DownloadSize", t[t.CompletionTime = 32] = "CompletionTime", t[t.DownloadingPeriod = 64] = "DownloadingPeriod", t[t.Progress = 128] = "Progress", t[t.RecycleTime = 256] = "RecycleTime", t[t.FileCreated = 512] = "FileCreated", t[t.Forbidden = 1024] = "Forbidden", t[t.UserRead = 2048] = "UserRead", t[t.OpenOnComplete = 4096] = "OpenOnComplete", t[t.DownloadSubTask = 8192] = "DownloadSubTask", t[t.TaskName = 16384] = "TaskName", t[t.SavePath = 32768] = "SavePath", t[t.Cid = 65536] = "Cid", t[t.Gcid = 131072] = "Gcid", t[t.UserData = 262144] = "UserData", t[t.CategoryViewId = 524288] = "CategoryViewId", t[t.ErrorCode = 1048576] = "ErrorCode", t[t.TaskSpeed = 2097152] = "TaskSpeed", t[t.ChannelInfo = 4194304] = "ChannelInfo", t[t.ValidDownloadSize = 8388608] = "ValidDownloadSize", t[t.OriginName = 16777216] = "OriginName", t[t.HTTPContentType = 33554432] = "HTTPContentType"
        }(c = t.TaskDetailChangedFlags || (t.TaskDetailChangedFlags = {})), function (t) {
            t[t.UnKnown = 0] = "UnKnown"
        }(d = t.BtSubFileDetailChangedFlags || (t.BtSubFileDetailChangedFlags = {})), function (t) {
            t[t.UnKnown = 0] = "UnKnown"
        }(h = t.GroupTaskSubFileDetailChangedFlags || (t.GroupTaskSubFileDetailChangedFlags = {})), function (t) {
            t[t.NumberStrart = 0] = "NumberStrart", t[t.TaskId = 1] = "TaskId", t[t.FileStatus = 2] = "FileStatus", t[t.DownloadSize = 3] = "DownloadSize", t[t.FileSize = 4] = "FileSize", t[t.EnableDcdn = 5] = "EnableDcdn", t[t.ErrorCode = 6] = "ErrorCode", t[t.DcdnStatus = 7] = "DcdnStatus", t[t.RealIndex = 8] = "RealIndex", t[t.FileOffset = 9] = "FileOffset", t[t.Visible = 10] = "Visible", t[t.Download = 11] = "Download", t[t.NumberEnd = 12] = "NumberEnd", t[t.StringStart = 13] = "StringStart", t[t.FinalName = 14] = "FinalName", t[t.RelativePath = 15] = "RelativePath", t[t.FileName = 16] = "FileName", t[t.FilePath = 17] = "FilePath", t[t.Cid = 18] = "Cid", t[t.Gcid = 19] = "Gcid", t[t.UserRead = 20] = "UserRead", t[t.StringEnd = 21] = "StringEnd"
        }(f = t.BtFileAttribute || (t.BtFileAttribute = {})), function (t) {
            t[t.P2spUrl = 0] = "P2spUrl", t[t.BtInfoId = 1] = "BtInfoId", t[t.EmuleFileHash = 2] = "EmuleFileHash", t[t.MagnetUrl = 3] = "MagnetUrl", t[t.GroupTaskName = 4] = "GroupTaskName"
        }(p = t.KeyType || (t.KeyType = {})), function (t) {
            t[t.NameInclude = 1] = "NameInclude", t[t.BtDisplayNameInclude = 2] = "BtDisplayNameInclude"
        }(g = t.SearchKeyType || (t.SearchKeyType = {})), function (t) {
            t[t.ExtEqual = 1] = "ExtEqual", t[t.NameLikeAndExtEqual = 2] = "NameLikeAndExtEqual", t[t.TaskTypeEqual = 4] = "TaskTypeEqual"
        }(S = t.FilterKeyType || (t.FilterKeyType = {})), function (t) {
            t[t.All = 0] = "All", t[t.CommonForeground = 1] = "CommonForeground", t[t.CommonBackground = 2] = "CommonBackground", t[t.Temporary = 3] = "Temporary", t[t.PreDownload = 4] = "PreDownload", t[t.PrivateForeground = 5] = "PrivateForeground"
        }(y = t.KeyFilter || (t.KeyFilter = {})), function (t) {
            t[t.Unknown = -1] = "Unknown", t[t.LoadTaskBasic = 0] = "LoadTaskBasic", t[t.Create = 1] = "Create", t[t.Recycle = 2] = "Recycle", t[t.Recover = 3] = "Recover", t[t.ReDownload = 4] = "ReDownload", t[t.MoveThoughCategory = 5] = "MoveThoughCategory"
        }(T = t.TaskInsertReason || (t.TaskInsertReason = {})), function (t) {
            t[t.Unknown = -1] = "Unknown", t[t.ContextMenu = 0] = "ContextMenu", t[t.Button = 1] = "Button", t[t.TaskDetail = 2] = "TaskDetail", t[t.DownloadMagnet = 3] = "DownloadMagnet", t[t.ToolbarButton = 4] = "ToolbarButton", t[t.SelectDownloadLists = 5] = "SelectDownloadLists", t[t.DeleteTask = 6] = "DeleteTask"
        }(k = t.TaskStopReason || (t.TaskStopReason = {}))
    }(e.DownloadKernel || (e.DownloadKernel = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e, i, n, a, s, o, r, l, u;
        !function (t) {
            t.Unkown = "XgtType.Unkown", t.Try = "XgtType.Try", t.Ad = "XgtType.Ad", t.Baotuan = "XgtType.Baotuan", t.PlayGame = "XgtType.PlayGame", t.PackageTry = "XgtType.PackageTry", t.CloudWaiting = "XgtType.CloudWaiting", t.CloudDownloading = "XgtType.CloudDownloading"
        }(e = t.XgtType || (t.XgtType = {})), function (t) {
            t.Unkown = "XgtState.Unkown", t.Ready = "XgtState.Ready", t.Show = "XgtState.Show", t.Background = "XgtState.Background", t.Exit = "XgtState.Exit"
        }(i = t.XgtState || (t.XgtState = {})), function (t) {
            t[t.NoVip = -1] = "NoVip", t[t.Vip = 0] = "Vip", t[t.Try = 1] = "Try", t[t.Ad = 2] = "Ad"
        }(n = t.VipTaskType || (t.VipTaskType = {})), function (t) {
            t[t.PlatinumVip = 0] = "PlatinumVip", t[t.SuperVip = 1] = "SuperVip", t[t.MixVip = 2] = "MixVip"
        }(a = t.TryType || (t.TryType = {})), function (t) {
            t[t.Unkown = -1] = "Unkown", t[t.Init = 0] = "Init", t[t.CommitWait = 1] = "CommitWait", t[t.Commiting = 2] = "Commiting", t[t.CommitFailed = 3] = "CommitFailed", t[t.CommitSuccess = 4] = "CommitSuccess", t[t.AcclerateWait = 5] = "AcclerateWait", t[t.SearchResource = 6] = "SearchResource", t[t.AcclerateFailed = 7] = "AcclerateFailed", t[t.AcclerateStoped = 8] = "AcclerateStoped", t[t.Acclerating = 9] = "Acclerating", t[t.Finished = 10] = "Finished"
        }(s = t.VipTaskStatus || (t.VipTaskStatus = {})), function (t) {
            t[t.StatusOnly = 1] = "StatusOnly", t[t.TokenOnly = 2] = "TokenOnly", t[t.Others = 3] = "Others"
        }(o = t.QueryOption || (t.QueryOption = {})), function (t) {
            t[t.Before_All = 0] = "Before_All", t[t.Before_Novice = 1] = "Before_Novice", t[t.Before_Join = 2] = "Before_Join", t[t.Before_CutLine = 3] = "Before_CutLine", t[t.Doing_CutLineOut = 4] = "Doing_CutLineOut", t[t.Doing_Succeed = 5] = "Doing_Succeed", t[t.Doing_SucceedCutLineOut = 6] = "Doing_SucceedCutLineOut", t[t.Doing_SucceedOpenAuto = 7] = "Doing_SucceedOpenAuto", t[t.Doing_KickOut = 8] = "Doing_KickOut"
        }(r = t.BaotuanXgt || (t.BaotuanXgt = {})), function (t) {
            t.clickJoinBtn = "clickJoinBtn", t.clickJoinBtnByWeb = "clickJoinBtnByWeb", t.clickJoinBtnByMenu = "clickJoinBtnByMenu", t.clickCutLineBtn = "clickCutLineBtn", t.teamImmediately = "teamImmediately", t.statusCallbackEndAutoJoin = "statusCallbackEndAutoJoin", t.statusCallbackEndEnter = "statusCallbackEndEnter", t.authority = "authority", t.loginAutoJoin = "loginAutoJoin", t.taskStarted = "taskStarted", t.grayAutoJoin = "grayAutoJoin", t.restartAppJoin = "restartAppJoin", t.resumeBaotuan = "resumeBaotuan", t.packagetry = "packagetry"
        }(l = t.BaotuanEnterBy || (t.BaotuanEnterBy = {})), function (t) {
            t[t.Unkown = 0] = "Unkown", t[t.Showing = 1] = "Showing", t[t.Hiding = 2] = "Hiding", t[t.Clicked = 3] = "Clicked"
        }(u = t.PlayGameXgtState || (t.PlayGameXgtState = {}))
    }(e.VipDownloadDefineNS || (e.VipDownloadDefineNS = {}))
}, function (t, e) {
    t.exports = require("events")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(9), o = i(2), r = i(1), l = i(13),
        u = i(0).default.getLogger("VipDownload:download-kernel-helper");
    var c;
    !function (t) {
        t.taskInserted = "OnTaskInserted", t.taskCompleted = "OnTaskCompleted", t.taskRemoved = "OnTaskRemoved", t.taskStatusChanged = "OnTaskStatusChanged", t.taskDetailChanged = "OnTaskDetailChanged", t.taskDcdnStatusChanged = "OnTaskDcdnStatusChanged", t.btSubFileDcdnStatusChanged = "OnBtSubFileDcdnStatusChanged", t.btSubFileDetailChanged = "OnBtSubFileDetailChanged", t.btSubFileForbidden = "OnBtSubFileForbidden", t.downloadItemActive = "OnDownloadItemActive", t.downloadItemChosen = "OnDownloadItemChosen"
    }(c = e.DkEventNS || (e.DkEventNS = {}));

    class d extends s.EventEmitter {
        constructor() {
            super(), this.mPeerId = void 0, this.init()
        }

        init() {
            this.setMaxListeners(0), this.attachDkEvents()
        }

        getTpPeerId() {
            return n(this, void 0, void 0, function* () {
                if (this.mPeerId) return this.mPeerId;
                {
                    let t = yield o.client.callServerFunction("GetTpPeerId");
                    return t && "" !== t && (this.mPeerId = t), this.mPeerId || ""
                }
            })
        }

        getCurrentCategoryId() {
            return n(this, void 0, void 0, function* () {
                return yield o.client.callServerFunction("GetCurrentCategoryId")
            })
        }

        getTaskBaseInfo(t) {
            return n(this, void 0, void 0, function* () {
                return yield o.client.callServerFunction("GetTaskBaseInfo2", t)
            })
        }

        getTaskStatus(t) {
            return n(this, void 0, void 0, function* () {
                return yield o.client.callServerFunction("GetTaskStatus", t)
            })
        }

        IsTaskExist(t) {
            return n(this, void 0, void 0, function* () {
                return yield o.client.callServerFunction("IsTaskExist", t)
            })
        }

        getTaskDetail(t) {
            return n(this, void 0, void 0, function* () {
                let e = null, i = yield o.client.callServerFunction("GetTaskInfo", t, void 0, "taskDetail");
                u.info("getTaskDetail", i);
                do {
                    if (!i) break;
                    let t = null;
                    try {
                        t = JSON.parse(i)
                    } catch (t) {
                        u.warn(t)
                    }
                    if (!t || !t.fileList) break;
                    let n = t.infoId, s = t.type;
                    e = {infoId: n, files: new Map};
                    for (let i of t.fileList) {
                        let t = -1, o = i.url;
                        s === a.DownloadKernel.TaskType.Bt ? (t = i.index, o = this.createBtFileUrl(i.index, n)) : s === a.DownloadKernel.TaskType.Group && (t = i.taskId);
                        let r = {
                            subId: t,
                            taskStatus: i.status,
                            filePath: i.filePath,
                            fileName: i.fileName,
                            gcid: i.gcid,
                            cid: i.cid,
                            url: o,
                            refUrl: i.refUrl || "",
                            fileSize: i.fileSize,
                            downloadSize: i.downloadSize,
                            errCode: i.errCode,
                            isNeedDownload: i.isNeedDownload,
                            dcdnStatus: i.dcdnStatus
                        };
                        e.files.set(t, r)
                    }
                } while (0);
                return e
            })
        }

        createBtTaskUrl(t) {
            return "bt://" + t
        }

        createBtFileUrl(t, e) {
            let i = this.createBtTaskUrl(e);
            return i = i + "/" + t
        }

        getIsHDVideo(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1, i = yield o.client.callServerFunction("GetConfigModules", "HDVideo", "domains");
                return u.silly("HDVideo domains", i), i && 0 !== i.length || (i = ["hd.xunlei.com"]), t && (e = r.default.isUrlInDomains(t, i)), e
            })
        }

        getIsWeiDuanYouXi(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1, i = l.default.getValue("VipDownload", "WDYXDomains");
                return u.info("WDYXDomains domains", i), i && 0 !== i.length || (i = ["lx.patch1.9you.com"]), t && (e = r.default.isUrlInDomains(t, i)), e
            })
        }

        startTask(t) {
            this.operateTask(t, "continue")
        }

        stopTask(t) {
            this.operateTask(t, "pause")
        }

        enableDcdnWithVipCert(t, e, i) {
            return n(this, void 0, void 0, function* () {
                u.info("enableDcdnWithVipCert", "taskId", t, "index", e, "vipCert", i), yield o.client.callServerFunction("EnableDcdnWithVipCert", t, i, e)
            })
        }

        updateDcdnWithVipCert(t, e, i) {
            return n(this, void 0, void 0, function* () {
                u.info("updateDcdnWithVipCert", "taskId", t, "index", e, "vipCert", i), yield o.client.callServerFunction("UpdateDcdnWithVipCert", t, i, e)
            })
        }

        disableDcdnWithVipCert(t, e) {
            return n(this, void 0, void 0, function* () {
                u.info("disableDcdnWithVipCert", "taskId", t, "index", e), yield o.client.callServerFunction("DisableDcdnWithVipCert", t, e)
            })
        }

        selectCategoryView(t, e, i, n) {
            o.client.callServerFunction("SelectCategoryView", t, e, i, n).catch()
        }

        getDownloadingActiveTaskId() {
            return n(this, void 0, void 0, function* () {
                return yield o.client.callServerFunction("GetDownloadingActiveTaskId")
            })
        }

        attachDkEvents() {
            o.client.attachServerEvent("OnTaskInserted", this.onTaskInserted.bind(this)), o.client.attachServerEvent("OnTaskRemoved", this.onTaskRemoved.bind(this)), o.client.attachServerEvent("OnTaskStatusChanged", (t, e) => {
                {
                    let t = null;
                    try {
                        t = JSON.parse(e)
                    } catch (t) {
                        u.warn(t)
                    }
                    if (null !== t) for (let e in t) {
                        let i = t[e];
                        this.onTaskStatusChanged(Number(e), i)
                    }
                }
            }), o.client.attachServerEvent("OnTaskDetailChanged", (t, e) => {
                {
                    let t = null;
                    try {
                        t = JSON.parse(e)
                    } catch (t) {
                        u.warn(t)
                    }
                    if (null !== t) for (let e in t) {
                        let i = t[e];
                        this.onTaskDetailChanged(Number(e), i)
                    }
                }
            }), o.client.attachServerEvent("OnTaskDcdnStatusChanged", (t, e) => {
                {
                    let t = null;
                    try {
                        t = JSON.parse(e)
                    } catch (t) {
                        u.warn(t)
                    }
                    if (null !== t) for (let e in t) {
                        let i = t[e];
                        this.onTaskDcdnStatusChanged(Number(e), i)
                    }
                }
            }), o.client.attachServerEvent("OnBtSubFileDcdnStatusChanged", this.onBtSubFileDcdnStatusChanged.bind(this)), o.client.attachServerEvent("OnBtSubFileDetailChanged", (t, e, i) => {
                {
                    let t = null;
                    try {
                        t = JSON.parse(i)
                    } catch (t) {
                        u.warn(t)
                    }
                    null !== t && this.onBtSubFileDetailChanged(e, t)
                }
            }), o.client.attachServerEvent("OnBtSubFileForbidden", this.onBtSubFileForbidden.bind(this)), o.client.attachServerEvent("OnDownloadItemActive", (t, e, i, n, a, s) => {
                this.onDownloadItemActive(e, i, n)
            }), this.getDownloadingActiveTaskId().then(t => {
                t && this.onDownloadItemActive(a.DownloadKernel.CategroyViewID.Downloading, !0, t)
            }).catch()
        }

        operateTask(t, e, i) {
            o.client.callServerFunction("OperateTask", t, e, i).catch()
        }

        onTaskInserted(t, e, i, n) {
            u.info("onTaskInserted categoryId:", e, ", categoryViewId:", i);
            let s = null;
            if (n) {
                try {
                    s = JSON.parse(n)
                } catch (t) {
                    u.warn(t)
                }
                if (null !== s) switch (i) {
                    case a.DownloadKernel.CategroyViewID.Downloading:
                        for (let t of s) this.emit(c.taskInserted, t);
                        break;
                    case a.DownloadKernel.CategroyViewID.Completed:
                        for (let t of s) this.emit(c.taskCompleted, t)
                }
            }
        }

        onTaskRemoved(t, e, i, n) {
            u.info("onTaskRemoved categoryId:", e, ", categoryViewId:", i);
            let s = [];
            if (n) switch (s = JSON.parse(n), i) {
                case a.DownloadKernel.CategroyViewID.Downloading:
                case a.DownloadKernel.CategroyViewID.Completed:
                    for (let t of s) this.emit(c.taskRemoved, t)
            }
        }

        onTaskStatusChanged(t, e) {
            this.emit(c.taskStatusChanged, t, e)
        }

        onTaskDetailChanged(t, e) {
            this.emit(c.taskDetailChanged, t, e)
        }

        onTaskDcdnStatusChanged(t, e) {
            this.emit(c.taskDcdnStatusChanged, t, e)
        }

        onBtSubFileDcdnStatusChanged(t, e, i, n) {
            this.emit(c.btSubFileDcdnStatusChanged, e, i, n)
        }

        onBtSubFileDetailChanged(t, e) {
            this.emit(c.btSubFileDetailChanged, t, e)
        }

        onBtSubFileForbidden(t, e, i) {
            this.emit(c.btSubFileForbidden, e, i)
        }

        onDownloadItemActive(t, e, i) {
            this.emit(c.downloadItemActive, t, e, i)
        }
    }

    e.DkHelper = d, e.default = new d
}, function (t, e) {
    t.exports = require("path")
}, function (t, e, i) {
    t.exports = i(23)(155)
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(9), s = i(15), o = i(62), r = i(0).default.getLogger("VipDownload:config");
    var l;
    !function (t) {
        t.configGet = "OnConfigGet"
    }(l = e.ConfigEventNS || (e.ConfigEventNS = {}));

    class u extends a.EventEmitter {
        constructor() {
            super(), this.mConfig = new o.Config, this.mConfigInitFinish = !1, this.init().catch()
        }

        init() {
            return n(this, void 0, void 0, function* () {
                this.setMaxListeners(0);
                let t = !1, e = yield this.downloadConfig();
                e && (t = yield this.config.loadConfigData(e)), r.info("config init", "result", t), this.config.printConfigData(), this.mConfigInitFinish = !0, this.emit(l.configGet)
            })
        }

        isConfigInitFinish() {
            return this.mConfigInitFinish
        }

        getValue(t, e) {
            return this.config.getValue(t, e)
        }

        downloadConfig() {
            return n(this, void 0, void 0, function* () {
                return new Promise(t => {
                    let e = new s.HttpSession;
                    e.url = "http://media.info.client.xunlei.com/VipDownloadConfig.json", e.get(e => {
                        e && 200 === e.statusCode && e.body ? t(e.body) : t(null)
                    }, e => {
                        r.info("error", e), t(null)
                    })
                })
            })
        }

        get config() {
            return this.mConfig
        }
    }

    e.ConfigHelper = u, e.default = new u
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(9);
    !function (t) {
        t.taskExpand = "OnTaskExpand", t.taskStatusChanged = "OnTaskStatusChanged", t.subTaskStatusChanged = "OnSubTaskStatusChanged", t.btSubFileForbidden = "OnBtSubFileForbidden", t.taskAcclerateStatusChanged = "OnTaskAcclerateStatusChanged", t.vipTaskInfoChanged = "OnVipTaskInfoChanged", t.totalAcclerateStatusChanged = "OnTotalAcclerateStatusChanged", t.taskTryDetailChanged = "OnTaskTryDetailChanged", t.taskTokenQueryResult = "OnTaskTokenQueryResult", t.taskStatusQueryResult = "OnTaskStatusQueryResult", t.taskAcclerateTypeResult = "onTaskAcclerateTypeResult", t.showTaskTryTips = "OnShowTaskTryTips", t.showTaskTryMiniWeb = "OnShowTaskTryMiniWeb", t.taskAdDetailChanged = "OnTaskAdDetailChanged", t.adTotalChancesChanged = "OnAdTotalChancesChanged", t.baotuanLeftCountChanged = "OnBaotuanLeftCountChanged", t.taskTeamJoinSucceed = "OnTaskTeamJoinSucceed", t.taskRemoved = "OnTaskRemoved", t.taskSpeedZeroChange = "OnTaskSpeedZeroChange", t.showBaotuanPopupWnd = "OnShowBaotuanPopupWnd", t.enterBaotuanAcclerate = "OnEnterBaotuanAcclerate", t.taskBlockSecondInfo = "OnTaskBlockSecondInfo", t.taskKickOut = "OnTaskKickOut"
    }(e.TaskEventNS || (e.TaskEventNS = {}));

    class a extends n.EventEmitter {
        constructor() {
            super(), this.setMaxListeners(0)
        }
    }

    e.TaskEventContainer = a, e.default = new a
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(59), a = i(60), s = i(61), o = i(5),
        r = i(0).default.getLogger("http-session"), {isDef: l} = o.ThunderUtil;
    var u;
    !function (t) {
        t.HTTP = "HTTP", t.HTTPS = "HTTPS"
    }(u = e.Protocol || (e.Protocol = {}));
    e.HttpSession = class {
        constructor() {
            this.mRetries = 0, this.mHost = void 0, this.mPort = void 0, this.mPath = void 0, this.mAuth = void 0, this.mAccept = void 0, this.mBody = null, this.mUrl = void 0, this.mProtocol = u.HTTP, this.mTimeout = void 0, this.mCurRetries = 0
        }

        set host(t) {
            this.mHost = t
        }

        get host() {
            return this.mHost
        }

        set port(t) {
            this.mPort = t
        }

        get port() {
            let t = void 0;
            return t = l(this.mPort) ? this.mPort : this.protocol === u.HTTPS ? 443 : 80
        }

        set path(t) {
            this.mPath = t
        }

        get path() {
            return this.mPath
        }

        set url(t) {
            this.mUrl = t
        }

        get protocol() {
            return this.mProtocol
        }

        set protocol(t) {
            this.mProtocol = t
        }

        get url() {
            return this.mUrl
        }

        set auth(t) {
            this.mAuth = t
        }

        get auth() {
            return this.mAuth
        }

        set accept(t) {
            this.mAccept = t
        }

        get accept() {
            return this.mAccept
        }

        set body(t) {
            this.mBody = t
        }

        get body() {
            return this.mBody
        }

        set retries(t) {
            this.mRetries = t
        }

        get retries() {
            return this.mRetries
        }

        set timeout(t) {
            this.mTimeout = t
        }

        get timeout() {
            return this.mTimeout
        }

        post(t, e) {
            do {
                let i = this.body;
                if (!i) {
                    r.info("body is empty"), e(null);
                    break
                }
                let n = this.auth, a = this.accept, s = {
                    hostname: this.host,
                    port: this.port,
                    path: this.path || "/",
                    method: "POST",
                    auth: n || void 0,
                    headers: {"Content-Length": i ? i.length : 0, Accept: a || "*/*"}
                };
                r.verbose("option", s);
                try {
                    this.postImpl(i, s, t, i => {
                        this.mCurRetries < this.retries ? (this.mCurRetries++, r.info("mCurRetries", this.mCurRetries), this.post(t, e)) : e(i)
                    })
                } catch (t) {
                    r.warn("error ", t), e(null)
                }
            } while (0)
        }

        get(t, e) {
            let i = null;
            if (this.url) {
                let t = n.parse(this.url, !0);
                t && "https:" === t.protocol ? this.protocol = u.HTTPS : this.protocol = u.HTTP, i = this.url
            } else {
                let t = this.auth, e = this.accept;
                i = {
                    hostname: this.host,
                    port: this.port,
                    path: this.path || "/",
                    method: "GET",
                    auth: t || void 0,
                    headers: {Accept: e || "*/*"}
                }
            }
            r.verbose("option", i);
            try {
                this.getImpl(i, t, i => {
                    this.mCurRetries < this.retries ? (this.mCurRetries++, r.info("mCurRetries", this.mCurRetries), this.get(t, e)) : e(i)
                })
            } catch (t) {
                r.warn("error ", t), e(null)
            }
        }

        postImpl(t, e, i, n) {
            let o = (this.protocol === u.HTTPS ? s : a).request(e, t => {
                let e = null;
                t.on("data", t => {
                    e = e ? Buffer.concat([e, t]) : t
                }), t.on("end", () => {
                    r.info("statusCode", t.statusCode), r.info("headers", t.headers), i({
                        statusCode: t.statusCode,
                        headers: t.headers,
                        body: e
                    })
                })
            });
            o.on("error", t => {
                n(t)
            }), o.on("timeout", () => {
                o.abort()
            }), this.timeout && o.setTimeout(this.timeout), o.write(t), o.end()
        }

        getImpl(t, e, i) {
            (this.protocol === u.HTTPS ? s : a).get(t, t => {
                let i = null;
                t.on("data", t => {
                    i = i ? Buffer.concat([i, t]) : t
                }), t.on("end", () => {
                    r.info("statusCode", t.statusCode), r.info("headers", t.headers), e({
                        statusCode: t.statusCode,
                        headers: t.headers,
                        body: i
                    })
                })
            }).on("error", t => {
                i(t)
            })
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(1), s = i(10), o = i(2), r = i(0).default.getLogger("stat-utilities"), l = i(31);
    !function (t) {
        let e = "0", i = 0, u = 0, c = 0, d = "", h = 0;

        function f() {
            return n(this, void 0, void 0, function* () {
                e = "0", i = 0, u = 0, h = (yield o.client.callServerFunction("IsLogined")) ? 1 : 0;
                let t = yield o.client.callServerFunction("GetAllUserInfo");
                if (t) if (e = t.userID || "0", t.vipList && t.vipList[0]) {
                    if (t.vipList[0].isVip) {
                        let e = Number(t.vipList[0].isVip).valueOf();
                        u = e > 0 ? 1 : 0
                    } else u = 0;
                    t.vipList[0].vasType && (i = Number(t.vipList[0].vasType).valueOf())
                } else u = 0;
                yield function () {
                    return n(this, void 0, void 0, function* () {
                        if (c = 0, "0" == e) return;
                        let t = `https://soa-vip-ssl.xunlei.com/xlvip.common.mooseapi/querytags?sessionid=${yield function () {
                            return n(this, void 0, void 0, function* () {
                                if (d) return d;
                                {
                                    let t = yield o.client.callServerFunction("GetSessionID");
                                    return t && "" !== t && (d = t), d || "0"
                                }
                            })
                        }()}&userid=${e}&tags=usedToBeDLVip&platform=xlx`;
                        l.default.get(t, {timeout: 1e4}).then(t => {
                            let e = null;
                            r.info("queryUserTag response:", t), null !== t && 200 === t.status && null !== t.data && 1 === t.data.code && t.data.result && (e = t.data.result, r.info("userTag.usedToBeDLVip", e.usedToBeDLVip), c = 1 == e.usedToBeDLVip ? 0 : 1)
                        }).catch(t => {
                            r.error("err:", t)
                        })
                    })
                }()
            })
        }

        o.client.attachServerEvent("onUserInfoChange", (t, e, i) => n(this, void 0, void 0, function* () {
            yield f()
        })), o.client.attachServerEvent("onLoginStatusChange", (t, e, i) => n(this, void 0, void 0, function* () {
            yield f()
        })), f(), t.trackEvent = function (t, e) {
            return n(this, void 0, void 0, function* () {
                let n = (e = e || {}).attribute1 || "", l = e.attribute2 || "", d = e.extData || new Map;
                if (d.set("plugin_version", a.default.pluginVersion), !d.has("cpeerid")) {
                    let t = yield s.default.getTpPeerId();
                    d.set("cpeerid", t)
                }
                d.set("is_new_user", c), d.has("is_login") || d.set("is_login", h), d.has("is_vip") || d.has("isvip") || d.set("is_vip", u), d.has("vip_type") || d.has("vas_type") || (u && 5 === i ? d.set("vip_type", 5) : u && i > 2 ? d.set("vip_type", 3) : u ? d.set("vip_type", 2) : d.set("vip_type", 0));
                let f = function (t) {
                    let e = "";
                    return t.forEach((t, i) => {
                        "" !== e && (e += ","), e = e + i + "=" + t
                    }), e
                }(d);
                r.info("key", t), r.info("attribute1", n), r.info("attribute2", l), r.info("extData", f), f = encodeURIComponent(f), r.info("encode extData", f), yield o.client.callServerFunction("TrackEvent", t, n, l, 0, 0, 0, 0, f)
            })
        }
    }(e.StatUtilitiesNS || (e.StatUtilitiesNS = {}))
}, function (t, e) {
    t.exports = require("crypto")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(48), s = i(81), o = i(1), r = i(3), l = i(0).default.getLogger("json-crypto");
    !function (t) {
        t.getAuthorization = function (t, e, i, n, a) {
            let s = t + ":" + e;
            return i && (s = s + ":" + i), n && (s = s + ":" + n), a && (s = s + ":" + a), s
        }, t.getAccept = function () {
            return "application/json; version=1.0"
        }, t.getUriParam = function (t, e, i, a) {
            return n(this, void 0, void 0, function* () {
                let n = "client_name=" + o.default.clientName + "&client_version=" + o.default.thunderVersionNumber + "&client_sequence=" + t + "&r=" + e + "&isvip=" + Number(r.default.isVip) + "&release_version=" + o.default.pluginVersion;
                return void 0 !== i && (n = n + "&verify_type=" + i), void 0 !== a && (n = n + "&isgroup=" + a), n
            })
        }, t.getKey = function (t, e) {
            let i = o.default.clientName + o.default.thunderVersionNumber + t + e;
            return (i = s.ToolsUtilitiesAWNS.genarateMd5(i)).substr(0, 16).toUpperCase()
        }, t.encryptHttpBuffer = function (t, e) {
            l.verbose("key", e);
            let i = JSON.stringify(t);
            l.info("jsonStr", i);
            let n = a.Buffer.from(i);
            return s.ToolsUtilitiesAWNS.encryptBuffer(n, e)
        }, t.decryptHttpBuffer = function (t, e) {
            l.verbose("key", e);
            let i = null;
            if (t = s.ToolsUtilitiesAWNS.decryptBuffer(t, e)) {
                let e = t.toString();
                l.info("jsonStr", e);
                try {
                    i = JSON.parse(e)
                } catch (t) {
                    l.warn(t)
                }
            }
            return i
        }
    }(e.HttpJsonCryptoNS || (e.HttpJsonCryptoNS = {}))
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r, l, u, c, d, h, f, p = {}.hasOwnProperty;
        f = i(46), h = f.isObject, d = f.isFunction, c = f.isEmpty, o = null, e = null, n = null, a = null, s = null, l = null, u = null, r = null, t.exports = function () {
            function t(t) {
                this.parent = t, this.parent && (this.options = this.parent.options, this.stringify = this.parent.stringify), this.children = [], o || (o = i(95), e = i(96), n = i(97), a = i(98), s = i(99), l = i(104), u = i(105), r = i(106))
            }

            return t.prototype.element = function (t, e, i) {
                var n, a, s, o, r, l, u, f, g, S;
                if (l = null, null == e && (e = {}), e = e.valueOf(), h(e) || (i = (g = [e, i])[0], e = g[1]), null != t && (t = t.valueOf()), Array.isArray(t)) for (s = 0, u = t.length; s < u; s++) a = t[s], l = this.element(a); else if (d(t)) l = this.element(t.apply()); else if (h(t)) {
                    for (r in t) if (p.call(t, r)) if (S = t[r], d(S) && (S = S.apply()), h(S) && c(S) && (S = null), !this.options.ignoreDecorators && this.stringify.convertAttKey && 0 === r.indexOf(this.stringify.convertAttKey)) l = this.attribute(r.substr(this.stringify.convertAttKey.length), S); else if (!this.options.separateArrayItems && Array.isArray(S)) for (o = 0, f = S.length; o < f; o++) a = S[o], (n = {})[r] = a, l = this.element(n); else h(S) ? (l = this.element(r)).element(S) : l = this.element(r, S)
                } else l = !this.options.ignoreDecorators && this.stringify.convertTextKey && 0 === t.indexOf(this.stringify.convertTextKey) ? this.text(i) : !this.options.ignoreDecorators && this.stringify.convertCDataKey && 0 === t.indexOf(this.stringify.convertCDataKey) ? this.cdata(i) : !this.options.ignoreDecorators && this.stringify.convertCommentKey && 0 === t.indexOf(this.stringify.convertCommentKey) ? this.comment(i) : !this.options.ignoreDecorators && this.stringify.convertRawKey && 0 === t.indexOf(this.stringify.convertRawKey) ? this.raw(i) : !this.options.ignoreDecorators && this.stringify.convertPIKey && 0 === t.indexOf(this.stringify.convertPIKey) ? this.instruction(t.substr(this.stringify.convertPIKey.length), i) : this.node(t, e, i);
                if (null == l) throw new Error("Could not create any elements with: " + t);
                return l
            }, t.prototype.insertBefore = function (t, e, i) {
                var n, a, s;
                if (this.isRoot) throw new Error("Cannot insert elements at root level");
                return a = this.parent.children.indexOf(this), s = this.parent.children.splice(a), n = this.parent.element(t, e, i), Array.prototype.push.apply(this.parent.children, s), n
            }, t.prototype.insertAfter = function (t, e, i) {
                var n, a, s;
                if (this.isRoot) throw new Error("Cannot insert elements at root level");
                return a = this.parent.children.indexOf(this), s = this.parent.children.splice(a + 1), n = this.parent.element(t, e, i), Array.prototype.push.apply(this.parent.children, s), n
            }, t.prototype.remove = function () {
                var t;
                if (this.isRoot) throw new Error("Cannot remove the root element");
                return t = this.parent.children.indexOf(this), [].splice.apply(this.parent.children, [t, t - t + 1].concat([])), this.parent
            }, t.prototype.node = function (t, e, i) {
                var n, a;
                return null != t && (t = t.valueOf()), e || (e = {}), e = e.valueOf(), h(e) || (i = (a = [e, i])[0], e = a[1]), n = new o(this, t, e), null != i && n.text(i), this.children.push(n), n
            }, t.prototype.text = function (t) {
                var e;
                return e = new u(this, t), this.children.push(e), this
            }, t.prototype.cdata = function (t) {
                var i;
                return i = new e(this, t), this.children.push(i), this
            }, t.prototype.comment = function (t) {
                var e;
                return e = new n(this, t), this.children.push(e), this
            }, t.prototype.commentBefore = function (t) {
                var e, i;
                return e = this.parent.children.indexOf(this), i = this.parent.children.splice(e), this.parent.comment(t), Array.prototype.push.apply(this.parent.children, i), this
            }, t.prototype.commentAfter = function (t) {
                var e, i;
                return e = this.parent.children.indexOf(this), i = this.parent.children.splice(e + 1), this.parent.comment(t), Array.prototype.push.apply(this.parent.children, i), this
            }, t.prototype.raw = function (t) {
                var e;
                return e = new l(this, t), this.children.push(e), this
            }, t.prototype.instruction = function (t, e) {
                var i, n, a, s, o;
                if (null != t && (t = t.valueOf()), null != e && (e = e.valueOf()), Array.isArray(t)) for (s = 0, o = t.length; s < o; s++) i = t[s], this.instruction(i); else if (h(t)) for (i in t) p.call(t, i) && (n = t[i], this.instruction(i, n)); else d(e) && (e = e.apply()), a = new r(this, t, e), this.children.push(a);
                return this
            }, t.prototype.instructionBefore = function (t, e) {
                var i, n;
                return i = this.parent.children.indexOf(this), n = this.parent.children.splice(i), this.parent.instruction(t, e), Array.prototype.push.apply(this.parent.children, n), this
            }, t.prototype.instructionAfter = function (t, e) {
                var i, n;
                return i = this.parent.children.indexOf(this), n = this.parent.children.splice(i + 1), this.parent.instruction(t, e), Array.prototype.push.apply(this.parent.children, n), this
            }, t.prototype.declaration = function (t, e, i) {
                var n, s;
                return n = this.document(), s = new a(n, t, e, i), n.children[0] instanceof a ? n.children[0] = s : n.children.unshift(s), n.root() || n
            }, t.prototype.doctype = function (t, e) {
                var i, n, a, o, r, l, u, c, d;
                for (i = this.document(), n = new s(i, t, e), a = o = 0, l = (c = i.children).length; o < l; a = ++o) if (c[a] instanceof s) return i.children[a] = n, n;
                for (a = r = 0, u = (d = i.children).length; r < u; a = ++r) if (d[a].isRoot) return i.children.splice(a, 0, n), n;
                return i.children.push(n), n
            }, t.prototype.up = function () {
                if (this.isRoot) throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
                return this.parent
            }, t.prototype.root = function () {
                var t;
                for (t = this; t;) {
                    if (t.isDocument) return t.rootObject;
                    if (t.isRoot) return t;
                    t = t.parent
                }
            }, t.prototype.document = function () {
                var t;
                for (t = this; t;) {
                    if (t.isDocument) return t;
                    t = t.parent
                }
            }, t.prototype.end = function (t) {
                return this.document().end(t)
            }, t.prototype.prev = function () {
                var t;
                if ((t = this.parent.children.indexOf(this)) < 1) throw new Error("Already at the first node");
                return this.parent.children[t - 1]
            }, t.prototype.next = function () {
                var t;
                if (-1 === (t = this.parent.children.indexOf(this)) || t === this.parent.children.length - 1) throw new Error("Already at the last node");
                return this.parent.children[t + 1]
            }, t.prototype.importDocument = function (t) {
                var e;
                return (e = t.root().clone()).parent = this, e.isRoot = !1, this.children.push(e), this
            }, t.prototype.ele = function (t, e, i) {
                return this.element(t, e, i)
            }, t.prototype.nod = function (t, e, i) {
                return this.node(t, e, i)
            }, t.prototype.txt = function (t) {
                return this.text(t)
            }, t.prototype.dat = function (t) {
                return this.cdata(t)
            }, t.prototype.com = function (t) {
                return this.comment(t)
            }, t.prototype.ins = function (t, e) {
                return this.instruction(t, e)
            }, t.prototype.doc = function () {
                return this.document()
            }, t.prototype.dec = function (t, e, i) {
                return this.declaration(t, e, i)
            }, t.prototype.dtd = function (t, e) {
                return this.doctype(t, e)
            }, t.prototype.e = function (t, e, i) {
                return this.element(t, e, i)
            }, t.prototype.n = function (t, e, i) {
                return this.node(t, e, i)
            }, t.prototype.t = function (t) {
                return this.text(t)
            }, t.prototype.d = function (t) {
                return this.cdata(t)
            }, t.prototype.c = function (t) {
                return this.comment(t)
            }, t.prototype.r = function (t) {
                return this.raw(t)
            }, t.prototype.i = function (t, e) {
                return this.instruction(t, e)
            }, t.prototype.u = function () {
                return this.up()
            }, t.prototype.importXMLBuilder = function (t) {
                return this.importDocument(t)
            }, t
        }()
    }).call(this)
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(49), o = i(1), r = i(0), l = i(3), u = r.default.getLogger("VipDownload:item-vip-status");
    !function (t) {
        let e = {
                name: "高级设置",
                children: [{
                    name: "抱团下载",
                    classes: "xlx-setting-content__vertical",
                    children: [{
                        name: "GenericSettings-BaoTuan_AutoJoin",
                        type: "confCheckbox",
                        label: "开启自动抱团",
                        tip: "下载任务时，自动进行抱团下载",
                        tipClass: "xlx-setting-content__tips tip-text"
                    }, {
                        name: "GenericSettings-BaoTuan_AutoCutLine",
                        type: "confCheckbox",
                        label: "开启自动插队",
                        tip: "遇到人数已满的抱团，自动进行插队进入",
                        tipClass: "xlx-setting-content__tips tip-text"
                    }]
                }]
            }, i = {
                name: "高级设置",
                children: [{
                    name: "抱团下载",
                    classes: "xlx-setting-content__vertical",
                    children: [{
                        name: "GenericSettings-BaoTuan_AutoJoin",
                        type: "confCheckbox",
                        label: "开启自动抱团",
                        tip: "下载任务时，自动进行抱团下载",
                        tipClass: "xlx-setting-content__tips tip-text"
                    }]
                }]
            }, r = {
                "GenericSettings-BaoTuan_AutoJoin": {section: "GenericSettings", key: "BaoTuan_AutoJoin", value: !1},
                "GenericSettings-BaoTuan_AutoCutLine": {section: "GenericSettings", key: "BaoTuan_AutoCutLine", value: !1}
            }, c = {"GenericSettings-BaoTuan_AutoJoin": {section: "GenericSettings", key: "BaoTuan_AutoJoin", value: !1}},
            d = !1;

        function h() {
            return n(this, void 0, void 0, function* () {
                if (d = !1, yield a.client.callServerFunction("IsRemoteGlobalConfigInitFinish")) {
                    if (L = yield a.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "xl11_group_super_only", !1), d) return;
                    f()
                } else {
                    let t = a.client.attachServerEvent("OnRemoteGlobalConfigLoaded", () => n(this, void 0, void 0, function* () {
                        L = yield a.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "xl11_group_super_only", !1), a.client.detachServerEvent("OnRemoteGlobalConfigLoaded", t), d || f()
                    }))
                }
            })
        }

        function f() {
            u.info("AddConfigDelay", L), L ? (l.default.isSuperVip || U && l.default.isVip) && (e = i, r = c, a.client.callServerFunction("AddConfigSettingItemData", JSON.stringify(e), JSON.stringify(r))) : a.client.callServerFunction("AddConfigSettingItemData", JSON.stringify(e), JSON.stringify(r))
        }

        function p() {
            d = !0, a.client.callServerFunction("RemoveConfigSettingItemData", JSON.stringify(e), JSON.stringify(r))
        }

        t.AddConfigSet = h, t.RemoveConfigSet = p;
        let g = !1, S = !1;
        t.InitTeamSwitch = function () {
            return n(this, void 0, void 0, function* () {
                g = yield a.client.callServerFunction("GetValue", "VipDownload", "TeamEnteranceSwitch", !1).catch()
            })
        }, t.GetBaotuanSwitch = function () {
            return g
        }, t.GetShowTips = function () {
            return S
        }, t.WatchConfigValue = function () {
            a.client.attachServerEvent("OnConfigValueChanaged", (t, ...e) => n(this, void 0, void 0, function* () {
                let t = e[0], i = e[1], n = e[2], o = e[3];
                "BaoTuan_AutoCutLine" === i && (!0 === o ? a.client.callServerFunction("SetConfigValue", "GenericSettings", "BaoTuan_AutoJoin", !0).catch() : a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_AutoCutLine_Manual_Cancel", !0).catch(), "setting_center" === localStorage.getItem("SetSetupType") && s.BaotuanStatNS.openAutoCutline("setting_center", o ? "open" : "close")), "BaoTuan_AutoJoin" === i && (!1 === o && (a.client.callServerFunction("SetConfigValue", "GenericSettings", "BaoTuan_AutoCutLine", !1).catch(), a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_AutoJoin_Manual_Cancel", !0).catch()), "setting_center" === localStorage.getItem("SetSetupType") && s.BaotuanStatNS.openAutoJoin("setting_center", o ? "open" : "close")), u.info("OnConfigValueChanaged ~", t, i, n, o)
            }))
        }, t.IsBaoTuanSettingManualCancel = function () {
            return n(this, void 0, void 0, function* () {
                return !!(yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_AutoCutLine_Manual_Cancel", !1).catch()) || (yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_AutoJoin_Manual_Cancel", !1).catch())
            })
        }, t.WatchUserStatus = function () {
            l.default.addListener(l.UserEventNS.login, () => {
                L ? (l.default.isSuperVip || U && l.default.isVip) && h() : b() && h()
            }), l.default.addListener(l.UserEventNS.logout, () => {
                L ? p() : b() && p()
            })
        }, t.IsAutoCutLine = function () {
            return n(this, void 0, void 0, function* () {
                return a.client.callServerFunction("GetConfigValue", "GenericSettings", "BaoTuan_AutoCutLine", !1)
            })
        }, t.IsAutoJoin = function () {
            return n(this, void 0, void 0, function* () {
                return a.client.callServerFunction("GetConfigValue", "GenericSettings", "BaoTuan_AutoJoin", !1)
            })
        }, t.SetAutoJoinCutLine = function (t, e) {
            return n(this, void 0, void 0, function* () {
                s.BaotuanStatNS.openAutoJoin(e, t ? "open" : "close"), s.BaotuanStatNS.openAutoCutline(e, t ? "open" : "close"), localStorage.setItem("SetSetupType", e), yield a.client.callServerFunction("SetConfigValue", "GenericSettings", "BaoTuan_AutoJoin", t), yield a.client.callServerFunction("SetConfigValue", "GenericSettings", "BaoTuan_AutoCutLine", t), localStorage.setItem("SetSetupType", "setting_center")
            })
        };
        let y = void 0;

        function T() {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_SuccedCount", 0).catch()
            })
        }

        t.getNoviceJoinCount = function () {
            return n(this, void 0, void 0, function* () {
                return void 0 === y && (y = yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_NoviceJoinCount", 0).catch()), y
            })
        }, t.increaseNoviceJoinCount = function () {
            return n(this, void 0, void 0, function* () {
                void 0 === y ? y = 1 : y++, yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_NoviceJoinCount", y).catch()
            })
        }, t.getHaveShowNoviceGuid = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_HaveShowNoviceGuid", !1).catch()
            })
        }, t.setHaveShowNoviceGuid = function () {
            return n(this, void 0, void 0, function* () {
                yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_HaveShowNoviceGuid", !0).catch()
            })
        }, t.getOpenTeamRecommendCount = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_OpenTeamRecommendCount", 0).catch()
            })
        }, t.getOpenTeamRecommendLastTime = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_OpenTeamRecommendLastTime", 0).catch()
            })
        }, t.IncreaseOpenTeamRecommendCount = function () {
            return n(this, void 0, void 0, function* () {
                let t = yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_OpenTeamRecommendCount", 0).catch();
                yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_OpenTeamRecommendCount", t + 1).catch()
            })
        }, t.SetOpenTeamRecommendLastTime = function () {
            return n(this, void 0, void 0, function* () {
                yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_OpenTeamRecommendLastTime", o.default.currentTime).catch()
            })
        }, t.IsBaoTuanHaveSucceed = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_IsFirstSucceed", !1).catch()
            })
        }, t.SetBaoTuanSucceed = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_IsFirstSucceed", !0).catch()
            })
        }, t.GetBaoTuanSuccedCount = T, t.IncreaseBaoTuanSuccedCount = function () {
            return n(this, void 0, void 0, function* () {
                let t = (yield T()) + 1;
                return yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_SuccedCount", t).catch(), t
            })
        }, t.SetNeedShowRecommendAuto = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_NeedShowRecommendAuto", !0).catch()
            })
        }, t.GetNeedShowRecommendAuto = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_NeedShowRecommendAuto", !1).catch()
            })
        }, t.setShowTeamEnterance = function (t) {
            let e = (new Date).toDateString();
            a.client.callServerFunction("SetValue", "VipDownload", "ShowTeamEnteranceCount", t).catch(), a.client.callServerFunction("SetValue", "VipDownload", "ShowTeamEnteranceLastDate", e).catch()
        };
        let k = new Map, m = new Map;

        function v(t) {
            return !!k.has(t) && k.get(t)
        }

        function w(t) {
            return !!m.has(t) && m.get(t)
        }

        function _() {
            return n(this, void 0, void 0, function* () {
                if ((new Date).toDateString() !== (yield a.client.callServerFunction("GetValue", "VipDownload", "ShowTeamEnteranceLastDate", "").catch())) return -1;
                let t = yield a.client.callServerFunction("GetValue", "VipDownload", "ShowTeamEnteranceCount", -1).catch();
                return u.info("ShowTeamEnteranceCount", t), t
            })
        }

        t.setTaskShowXgtEnterance = function (t, e) {
            k.set(t, e)
        }, t.isTaskShowXgt = v, t.isTaskConsumeXgt = w, t.decreaseShowTeamEnterance = function (t) {
            return n(this, void 0, void 0, function* () {
                if (!v(t)) return;
                if (w(t)) return;
                m.set(t, !0);
                let e = yield _();
                e > 0 && e--, a.client.callServerFunction("SetValue", "VipDownload", "ShowTeamEnteranceCount", e).catch(), u.info("decreaseShowTeamEnterance")
            })
        }, t.increaseShowBaotuanEnterance = function () {
            return n(this, void 0, void 0, function* () {
                let t = yield _();
                t++, a.client.callServerFunction("SetValue", "VipDownload", "ShowTeamEnteranceCount", t).catch()
            })
        }, t.setTeamEnteranceSwitch = function (t) {
            return n(this, void 0, void 0, function* () {
                g = t, yield a.client.callServerFunction("SetValue", "VipDownload", "TeamEnteranceSwitch", t).catch()
            })
        }, t.setShowTips = function (t) {
            return n(this, void 0, void 0, function* () {
                S = t
            })
        }, t.getShowBaotuanEnteranceCount = _, t.getShowTeamEnteranceLastDate = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "ShowTeamEnteranceLastDate", "").catch()
            })
        }, t.isFirstShowTeamEnterance = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_FirstShow", !0).catch()
            })
        }, t.showedTeamEnterance = function () {
            return n(this, void 0, void 0, function* () {
                yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_FirstShow", !1).catch()
            })
        };
        let D = !1;

        function b() {
            return D
        }

        t.setLoginNeed = function (t) {
            D = t, localStorage.setItem("isLoginNeed", D ? "true" : "false")
        }, t.isLoginNeed = b, t.checkLogin = function (t) {
            return !D || t
        };
        let N = !1;
        t.setTeamEntranceBelowTask = function (t) {
            u.info("setTeamEntranceBelowTask", t), N = t
        }, t.getBaotuanEntranceBelowTask = function () {
            return N
        };
        let C = !1;
        t.setBelowTaskClickAB = function (t) {
            C = t
        }, t.getBelowTaskClickAB = function () {
            return C
        };
        let x = !1;
        t.setkickOutTaskAB = function (t) {
            x = t
        }, t.getkickOutTaskAB = function () {
            return x
        };
        let I = void 0, V = void 0, B = !1;
        t.isHaveCutlineCount = function () {
            return u.info("isHaveCutlineCount", I, V), void 0 === I || void 0 === V || ((new Date).toDateString() !== V || I > 0)
        }, t.reInitLeftCount = function () {
            I = void 0, V = void 0, u.info("reInitLeftCount")
        }, t.getCutlineLeftCount = function () {
            return I || 0
        }, t.setCutlineLeftCount = function (t) {
            void 0 !== t && null !== t && (I = t, V = (new Date).toDateString(), B = !0, u.info("setCutlineLeftCount", t, V))
        }, t.isHaveQueryLeftCount = function () {
            return B
        };
        let P = -1;
        t.isUserJoiningChangWei = function () {
            switch (P) {
                case 0:
                case 10:
                    return !0
            }
            return !1
        }, t.setUserChangWeiStatus = function (t) {
            P = t
        }, t.getUserChangWeiStatus = function () {
            return P
        };
        let E = !1, O = !1;
        t.setPriorityInner = function (t) {
            E = t
        }, t.getPriorityInner = function () {
            return E
        }, t.setPriorityOut = function (t) {
            O = t
        }, t.getPriorityOut = function () {
            return O
        };
        let F = !1;
        t.setFirstTeamEffectt = function (t) {
            F = t
        }, t.getFirstTeamEffect = function () {
            return F
        }, t.setBaotuanConfig = function (t) {
            localStorage.setItem("baotuanConfig", JSON.stringify(t))
        }, t.getBaotuanConfig = function () {
            let t = localStorage.getItem("baotuanConfig"),
                e = {chaoji_times: L ? 20 : 10, baijin_times: 3, putong_times: 1, year_times: 30};
            if (t) {
                let i = null;
                try {
                    i = JSON.parse(t)
                } catch (t) {
                }
                i && 0 === i.result && (i.year_times || (i.year_times = 30), e = i)
            }
            return e
        };
        let A = {};

        function R() {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("GetValue", "VipDownload", "BaoTuan_BeforeXgtShowCount", 0).catch()
            })
        }

        t.setBaotuanEntrance = function (t) {
            A = t, t && localStorage.setItem("baotuanEnterance", JSON.stringify(t))
        }, t.getBaotuanEntrance = function () {
            return A
        }, t.getBaotuanEntranceEx = function () {
            let t = localStorage.getItem("baotuanEnterance");
            if (t) try {
                return JSON.parse(t)
            } catch (t) {
            }
            return null
        }, t.getBeforeXgtShowCount = R, t.addBeforeXgtShowCount = function () {
            return n(this, void 0, void 0, function* () {
                let t = yield R();
                a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_BeforeXgtShowCount", t + 1).catch()
            })
        }, t.setGrayFailedAutoJoinCutLine = function () {
            return n(this, void 0, void 0, function* () {
                a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_GrayFailed", 1).catch()
            })
        }, t.getGrayFailedAutoJoinCutLine = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_GrayFailed", 0).catch()
            })
        }, t.setGraySucceedAutoJoinCutLine = function () {
            return n(this, void 0, void 0, function* () {
                a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_GraySucceed", 1).catch()
            })
        }, t.getGraySucceedAutoJoinCutLine = function () {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("SetValue", "VipDownload", "BaoTuan_GraySucceed", 0).catch()
            })
        };
        let L = void 0, U = void 0;
        t.checkIsSurperUserOnly = function () {
            return n(this, void 0, void 0, function* () {
                return !(U && l.default.isVip && !l.default.isSuperVip) && (void 0 === L && (yield a.client.callServerFunction("IsRemoteGlobalConfigInitFinish")) && (L = yield a.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "xl11_group_super_only", !1), u.info("xl11_group_super_only", L)), !0 === L)
            })
        }, t.getIsSurperUserOnly = function () {
            return L
        }, t.setIsOldUser = function (t) {
            U = t, l.default.isLogin ? L && (l.default.isSuperVip || U && l.default.isVip) && h() : L && p()
        }, t.getIsOldUser = function () {
            return U
        }
    }(e.BaoTuanSettingNS || (e.BaoTuanSettingNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(8), s = i(187), o = i(7), r = i(196), l = i(193), u = i(2), c = i(53), d = i(90), h = i(3), f = i(10),
        p = i(44), g = i(26), S = i(14), y = i(0), T = i(54), k = i(43), m = i(45),
        v = y.default.getLogger("VipDownload:download-manager");

    class w {
        constructor() {
            this.mExpandTaskId = void 0, this.mIsUpdateTotalAcclerateStatus = !1, this.mIsTotalAcclrating = !1, this.init().catch()
        }

        init() {
            return n(this, void 0, void 0, function* () {
                h.default.addListener(h.UserEventNS.authorityChanged, this.onUserAuthorityChanged.bind(this)), h.default.addListener(h.UserEventNS.logout, this.onUserLogout.bind(this)), this.attachDkEvents(), p.default.addListener(p.KuainiaoEventNS.statusChanged, this.onKuaiNiaoStatusChanged.bind(this)), S.default.addListener(S.TaskEventNS.taskAcclerateStatusChanged, this.onTaskAcclerateStatusChanged.bind(this)), S.default.addListener(S.TaskEventNS.taskSpeedZeroChange, this.onTaskSpeedZeroChange.bind(this)), k.default.addListener(m.PackageTryDefineNS.Event.stateChange, this.onPackageStateChange.bind(this)), k.default.addListener(m.PackageTryDefineNS.Event.acclerateUpdate, this.onPackageAcclerateUpdate.bind(this)), k.default.addListener(m.PackageTryDefineNS.Event.activeTaskDel, this.onPackageActiveTaskDel.bind(this)), k.default.addListener(m.PackageTryDefineNS.Event.exitXgt, this.onExitPackageXgt.bind(this));
                const t = yield f.default.getTpPeerId();
                t && (yield u.client.callServerFunction("SetValue", "VipDownload", "TpPeerId", t)), setInterval(() => n(this, void 0, void 0, function* () {
                    this.releaseTask().catch()
                }), 2e3)
            })
        }

        releaseTask() {
            return n(this, void 0, void 0, function* () {
                let t = g.default.getTasks();
                v.info("taskManager size", t.length);
                do {
                    if (0 === t.length) break;
                    let e = t.pop();
                    if (e) switch (yield f.default.getTaskStatus(e.getTaskId())) {
                        case o.DownloadKernel.TaskStatus.Succeeded:
                        case o.DownloadKernel.TaskStatus.Seeding:
                        case o.DownloadKernel.TaskStatus.DestroyPending:
                        case o.DownloadKernel.TaskStatus.End:
                            v.info("releaseTask", e.getTaskId()), this.onTaskCompleted(e.getTaskId())
                    }
                } while (0)
            })
        }

        get expandTaskId() {
            return this.mExpandTaskId
        }

        onTaskExpand(t) {
            return n(this, void 0, void 0, function* () {
                if (this.mExpandTaskId !== t) {
                    v.info("onTaskExpand", "taskId", t), this.mExpandTaskId = t, T.default.setExpandTaskId(t);
                    let e = yield g.default.createTask(t, "TaskExpand");
                    e && (e.onExpand(), S.default.emit(S.TaskEventNS.taskExpand, t))
                }
            })
        }

        onTaskUnExpand(t) {
            t === this.mExpandTaskId && (v.info("onTaskUnExpand", "taskId", t), this.mExpandTaskId = void 0, T.default.setExpandTaskId(void 0))
        }

        enterAcclerate(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = yield g.default.createTask(t, "EnterAcclerate");
                if (i) {
                    let t = i.getVipTask(), n = t.getVipTaskType(), s = t.getVipTaskStatus();
                    e !== n || s !== a.VipDownloadDefineNS.VipTaskStatus.Init && e !== a.VipDownloadDefineNS.VipTaskType.Ad || t.enter()
                }
            })
        }

        getVipTaskInfo(t) {
            let e = null, i = g.default.getTask(t);
            if (i) {
                e = i.getVipTask().getVipTaskInfo()
            }
            return e
        }

        getVipSubTaskInfo(t, e) {
            let i = null, n = g.default.getTask(t);
            return n && (i = n.getVipTask().getVipSubTaskInfo(e)), i
        }

        getAllVipSubTaskInfo(t) {
            let e = [], i = g.default.getTask(t);
            return i && (e = i.getVipTask().getAllVipSubTaskInfo()), e
        }

        getTryDetail(t) {
            let e = null, i = g.default.getTask(t);
            return i && (e = i.getVipTask().getTryDetail()), e
        }

        getBaotuanDetail(t) {
            let e = null, i = g.default.getTask(t);
            return i && (e = i.getVipTask().getBaotuanDetail()), e
        }

        getBaotuanNumber(t) {
            return n(this, void 0, void 0, function* () {
                let e = 0, i = g.default.getTask(t);
                return i && (e = yield i.getVipTask().getBaotuanOperation().getBaotuanNumber()), e
            })
        }

        getBaotuanDetailSt(t) {
            let e = {state: "not_in_group_dl", teamLeftCount: 0, teamStatus: 0}, i = g.default.getTask(t);
            return i && (e = i.getVipTask().getBaotuanDetailSt()), e
        }

        getBtErrorType(t) {
            let e = void 0, i = g.default.getTask(t);
            return i && (e = i.getBtErrorType()), e
        }

        attachDkEvents() {
            f.default.addListener(f.DkEventNS.taskCompleted, this.onTaskCompleted.bind(this)), f.default.addListener(f.DkEventNS.taskRemoved, this.onTaskRemoved.bind(this)), f.default.addListener(f.DkEventNS.taskStatusChanged, this.onTaskStatusChanged.bind(this)), f.default.addListener(f.DkEventNS.taskDetailChanged, this.onTaskDetailChanged.bind(this)), f.default.addListener(f.DkEventNS.taskDcdnStatusChanged, this.onTaskDcdnStatusChanged.bind(this)), f.default.addListener(f.DkEventNS.btSubFileDcdnStatusChanged, this.onBtSubFileDcdnStatusChanged.bind(this)), f.default.addListener(f.DkEventNS.btSubFileDetailChanged, this.onBtSubFileDetailChanged.bind(this)), f.default.addListener(f.DkEventNS.btSubFileForbidden, this.onBtSubFileForbidden.bind(this)), f.default.addListener(f.DkEventNS.downloadItemActive, this.onDownloadItemActive.bind(this))
        }

        onUserAuthorityChanged(t, e, i) {
            return n(this, void 0, void 0, function* () {
                if (t ? yield this.loadVipDataBase() : this.unloadVipDataBase(), h.default.offlineAuthority ? yield this.loadOfflineDataBase() : this.unloadOfflineDataBase(), yield s.Task.onUserAuthorityChangedEx(t, e, i), g.default.getTaskMap().forEach(function (i) {
                    i.onUserAuthorityChanged(t, e)
                }), this.mExpandTaskId) {
                    let t = g.default.getTask(this.mExpandTaskId);
                    t && t.onExpand()
                }
            })
        }

        onUserLogout() {
            g.default.getTaskMap().forEach(function (t) {
                t.getIsCloudTask() && k.default.delPackageTryTask(t, t.getVipTask().getLogger(), "onUserLogout").catch()
            })
        }

        loadVipDataBase() {
            return n(this, void 0, void 0, function* () {
                v.info("loadVipDataBase");
                let t = r.VipTaskDataBaseNS.getTable();
                yield t.init(h.default.userId);
                let e = yield t.getTaskIds();
                d.VipDownloadHelperNS.setDbTaskIds(e);
                for (let i of e) {
                    let e = yield f.default.IsTaskExist(i);
                    if (e) {
                        let t = yield f.default.getTaskStatus(i);
                        t !== o.DownloadKernel.TaskStatus.Succeeded && t !== o.DownloadKernel.TaskStatus.Seeding || (e = !1)
                    }
                    e || (yield t.removeTask(i, -2))
                }
            })
        }

        unloadVipDataBase() {
            r.VipTaskDataBaseNS.getTable().clear(), d.VipDownloadHelperNS.setDbTaskIds([])
        }

        loadOfflineDataBase() {
            return n(this, void 0, void 0, function* () {
                v.info("loadOfflineDataBase");
                let t = l.OfflineTaskDataBaseNS.getTable();
                yield t.init(h.default.userId);
                let e = yield t.getTaskIds();
                for (let i of e) {
                    let e = yield f.default.IsTaskExist(i);
                    if (e) {
                        let t = yield f.default.getTaskStatus(i);
                        t !== o.DownloadKernel.TaskStatus.Succeeded && t !== o.DownloadKernel.TaskStatus.Seeding || (e = !1)
                    }
                    e || (yield t.removeTask(i, -2))
                }
            })
        }

        unloadOfflineDataBase() {
            l.OfflineTaskDataBaseNS.getTable().clear()
        }

        onTaskCompleted(t) {
            let e = g.default.getTask(t);
            e && e.onTaskCompleted(), g.default.deleteTask(t), v.info("######", "onTaskCompleted", t)
        }

        onTaskRemoved(t) {
            let e = g.default.getTask(t);
            e && e.onTaskRemoved(), g.default.deleteTask(t), v.info("######", "onTaskRemoved", t)
        }

        onTaskStatusChanged(t, e) {
            return n(this, void 0, void 0, function* () {
                switch (yield this.releaseTask(), e) {
                    case o.DownloadKernel.TaskStatus.DestroyPending:
                    case o.DownloadKernel.TaskStatus.Succeeded:
                        break;
                    default:
                        let i = yield g.default.createTask(t, "TaskStatusChanged");
                        i && (yield i.onTaskStatusChanged(e))
                }
                e === o.DownloadKernel.TaskStatus.Started ? g.default.addDownloadingTask(t) : g.default.delDownloadingTask(t)
            })
        }

        onTaskDcdnStatusChanged(t, e) {
            let i = g.default.getTask(t);
            i && i.onTaskDcdnStatusChanged(-1, e)
        }

        onBtSubFileDcdnStatusChanged(t, e, i) {
            let n = g.default.getTask(t);
            n && n.onTaskDcdnStatusChanged(e, i)
        }

        onTaskDetailChanged(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = yield g.default.createTask(t, "TaskDetailChanged", e);
                i && i.onTaskDetailChanged(e)
            })
        }

        onBtSubFileDetailChanged(t, e) {
            let i = g.default.getTask(t);
            i && i.onBtSubFileDetailChanged(t, e)
        }

        onBtSubFileForbidden(t, e) {
            return n(this, void 0, void 0, function* () {
                v.info("onBtSubFileForbidden", t), e = e || "Error";
                let i = yield g.default.createTask(t, "BtSubFileForbidden");
                i && i.onBtSubFileForbidden(e), S.default.emit(S.TaskEventNS.btSubFileForbidden, t, e)
            })
        }

        onDownloadItemActive(t, e, i) {
            t === o.DownloadKernel.CategroyViewID.Downloading && (v.info("onDownloadItemActive", "taskId", i, "active", e), e ? this.onTaskExpand(i).catch() : this.onTaskUnExpand(i))
        }

        onKuaiNiaoStatusChanged(t) {
            g.default.getTaskMap().forEach(function (e) {
                if (!e.getIsCloudTask()) {
                    let i = e.getVipTask();
                    i.careKuaiNiao && i.onKuaiNiaoStatusChanged(t)
                }
            })
        }

        onTaskAcclerateStatusChanged() {
            this.mIsUpdateTotalAcclerateStatus || (this.mIsUpdateTotalAcclerateStatus = !0, setTimeout(() => {
                this.mIsUpdateTotalAcclerateStatus = !1;
                let t = !1;
                if (g.default.getTaskMap().forEach(function (e) {
                    let i = e.getVipTask().getVipTaskInfo();
                    i && i.enterStatus === a.VipDownloadDefineNS.VipTaskStatus.Acclerating && (t = !0)
                }), t !== this.mIsTotalAcclrating) {
                    let e = {acclerating: t};
                    u.client.broadcastEvent(c.BroadcastEventNS.totalAcclerateStatusChanged, e), this.mIsTotalAcclrating = t
                }
            }, 500))
        }

        getDownlodaingTaskCount() {
            let t = 0;
            return g.default.getTaskMap().forEach(e => {
                e.getTaskStatus() === o.DownloadKernel.TaskStatus.Started && t++
            }), t
        }

        onTaskSpeedZeroChange(t) {
            return n(this, void 0, void 0, function* () {
                g.default.getTaskMap().forEach(function (e) {
                    if (!e.getIsCloudTask()) {
                        e.getVipTask().onTaskSpeedZeroChange(t).catch()
                    }
                })
            })
        }

        onPackageStateChange(t) {
            return n(this, void 0, void 0, function* () {
                v.info("onPackageStateChange", t), g.default.getTaskMap().forEach(function (e) {
                    e.getVipTask().onPackageStateChange(t).catch()
                })
            })
        }

        onPackageAcclerateUpdate(t, e) {
            return n(this, void 0, void 0, function* () {
                v.info("onPackageAcclerateUpdate", t, e), g.default.getTaskMap().forEach(function (i) {
                    i.getVipTask().onPackageAcclerateUpdate(t, e)
                })
            })
        }

        onPackageActiveTaskDel(t) {
            v.info("onPackageActiveTaskDel", t), g.default.getTaskMap().forEach(function (e) {
                e.getVipTask().onPackageActiveTaskDel(t)
            })
        }

        onExitPackageXgt() {
            v.info("onExitPackageXgt"), g.default.getTaskMap().forEach(function (t) {
                t.getVipTask().onExitPackageXgt()
            })
        }
    }

    e.DownloadManager = w, e.default = new w
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(28), s = i(11), o = i(34).promisify, r = i(0).default.getLogger("fs-utilities");
    !function (t) {
        function e(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1;
                if (void 0 !== t) {
                    const i = o(a.access);
                    try {
                        yield i(t), e = !0
                    } catch (t) {
                        r.info(t)
                    }
                }
                return e
            })
        }

        function l(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1;
                if (void 0 !== t) {
                    const i = o(a.mkdir);
                    try {
                        yield i(t), e = !0
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return e
            })
        }

        function u(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1;
                if (void 0 !== t) {
                    const i = o(a.rmdir);
                    try {
                        yield i(t), e = !0
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return e
            })
        }

        function c(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1;
                if (void 0 !== t) {
                    const i = o(a.unlink);
                    try {
                        yield i(t), e = !0
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return e
            })
        }

        function d(t) {
            return n(this, void 0, void 0, function* () {
                let e = null;
                if (void 0 !== t) {
                    const i = o(a.readdir);
                    try {
                        e = yield i(t)
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return e
            })
        }

        function h(t) {
            return n(this, void 0, void 0, function* () {
                let e = null;
                if (void 0 !== t) {
                    const i = o(a.lstat);
                    try {
                        e = yield i(t)
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return e
            })
        }

        function f(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                if (void 0 !== t && void 0 !== e) {
                    let n = s.join(t, e), a = yield h(n);
                    i = null !== a && a.isDirectory() ? yield p(n) : yield c(n)
                }
                return i
            })
        }

        function p(t) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                if (void 0 !== t) {
                    if (yield e(t)) {
                        i = !0;
                        let e = yield d(t);
                        for (let n = 0; n < e.length; n++) i = (yield f(t, e[n])) && i;
                        (i || 0 === e.length) && (i = (yield u(t)) && i)
                    }
                }
                return i
            })
        }

        function g(t) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                return r.info("mkdirsAW", t), void 0 !== t && ((yield e(t)) ? i = !0 : s.dirname(t) === t ? i = !1 : (yield g(s.dirname(t))) && (i = yield l(t))), i
            })
        }

        function S(t, i) {
            return n(this, void 0, void 0, function* () {
                let n;
                if (t.toLowerCase() !== i.toLowerCase() && (yield e(t))) {
                    let e = a.createReadStream(t), s = a.createWriteStream(i);
                    n = new Promise(t => {
                        e.pipe(s).on("finish", () => {
                            t(!0)
                        })
                    })
                } else n = new Promise(t => {
                    t(!1)
                });
                return n
            })
        }

        t.readFileAW = function (t) {
            return n(this, void 0, void 0, function* () {
                let e = null;
                if (void 0 !== t) {
                    const i = o(a.readFile);
                    try {
                        e = yield i(t)
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return e
            })
        }, t.writeFileAW = function (t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                if (void 0 !== t && null !== e) {
                    const n = o(a.writeFile);
                    try {
                        yield n(t, e), i = !0
                    } catch (t) {
                        r.warn(t)
                    }
                }
                return i
            })
        }, t.existsAW = e, t.mkdirAW = l, t.rmdirAW = u, t.unlinkAW = c, t.readdirAW = d, t.lstatAW = h, t.rmdirsAW = p, t.mkdirsAW = g, t.renameAW = function (t, e) {
            return n(this, void 0, void 0, function* () {
                if (void 0 !== t && void 0 !== e) {
                    const i = o(a.rename);
                    try {
                        yield i(t, e)
                    } catch (t) {
                        r.warn(t)
                    }
                }
            })
        }, t.copyFileAW = S, t.copyDirsAW = function t(i, a) {
            return n(this, void 0, void 0, function* () {
                let n = !1, o = yield h(i);
                if (o.isDirectory()) {
                    n = yield g(a);
                    let r = yield d(i);
                    for (let l = 0; l < r.length; l++) {
                        let u = s.join(i, r[l]), c = s.join(a, r[l]);
                        (n = yield e(u)) && (n = (o = yield h(u)).isDirectory() ? yield t(u, c) : yield S(u, c))
                    }
                }
                return n
            })
        }, t.mkdtempAW = function () {
            return n(this, void 0, void 0, function* () {
                let t = !1;
                const e = o(a.mkdtemp), n = (yield Promise.resolve().then(() => i(35))).tmpdir();
                try {
                    t = yield e(`${n}${s.sep}`)
                } catch (t) {
                    r.warn(t)
                }
                return t
            })
        }
    }(e.FileSystemAWNS || (e.FileSystemAWNS = {}))
}, function (t, e) {
    t.exports = require("../vendor.js")
}, function (t, e, i) {
    "use strict";
    var n = i(6), a = i(66), s = {"Content-Type": "application/x-www-form-urlencoded"};

    function o(t, e) {
        !n.isUndefined(t) && n.isUndefined(t["Content-Type"]) && (t["Content-Type"] = e)
    }

    var r, l = {
        adapter: ("undefined" != typeof XMLHttpRequest ? r = i(25) : "undefined" != typeof process && (r = i(25)), r),
        transformRequest: [function (t, e) {
            return a(e, "Content-Type"), n.isFormData(t) || n.isArrayBuffer(t) || n.isBuffer(t) || n.isStream(t) || n.isFile(t) || n.isBlob(t) ? t : n.isArrayBufferView(t) ? t.buffer : n.isURLSearchParams(t) ? (o(e, "application/x-www-form-urlencoded;charset=utf-8"), t.toString()) : n.isObject(t) ? (o(e, "application/json;charset=utf-8"), JSON.stringify(t)) : t
        }],
        transformResponse: [function (t) {
            if ("string" == typeof t) try {
                t = JSON.parse(t)
            } catch (t) {
            }
            return t
        }],
        timeout: 0,
        xsrfCookieName: "XSRF-TOKEN",
        xsrfHeaderName: "X-XSRF-TOKEN",
        maxContentLength: -1,
        validateStatus: function (t) {
            return t >= 200 && t < 300
        }
    };
    l.headers = {common: {Accept: "application/json, text/plain, */*"}}, n.forEach(["delete", "get", "head"], function (t) {
        l.headers[t] = {}
    }), n.forEach(["post", "put", "patch"], function (t) {
        l.headers[t] = n.merge(s)
    }), t.exports = l
}, function (t, e, i) {
    "use strict";
    var n = i(6), a = i(67), s = i(69), o = i(70), r = i(71), l = i(38),
        u = "undefined" != typeof window && window.btoa && window.btoa.bind(window) || i(72);
    t.exports = function (t) {
        return new Promise(function (e, c) {
            var d = t.data, h = t.headers;
            n.isFormData(d) && delete h["Content-Type"];
            var f = new XMLHttpRequest, p = "onreadystatechange", g = !1;
            if ("undefined" == typeof window || !window.XDomainRequest || "withCredentials" in f || r(t.url) || (f = new window.XDomainRequest, p = "onload", g = !0, f.onprogress = function () {
            }, f.ontimeout = function () {
            }), t.auth) {
                var S = t.auth.username || "", y = t.auth.password || "";
                h.Authorization = "Basic " + u(S + ":" + y)
            }
            if (f.open(t.method.toUpperCase(), s(t.url, t.params, t.paramsSerializer), !0), f.timeout = t.timeout, f[p] = function () {
                if (f && (4 === f.readyState || g) && (0 !== f.status || f.responseURL && 0 === f.responseURL.indexOf("file:"))) {
                    var i = "getAllResponseHeaders" in f ? o(f.getAllResponseHeaders()) : null, n = {
                        data: t.responseType && "text" !== t.responseType ? f.response : f.responseText,
                        status: 1223 === f.status ? 204 : f.status,
                        statusText: 1223 === f.status ? "No Content" : f.statusText,
                        headers: i,
                        config: t,
                        request: f
                    };
                    a(e, c, n), f = null
                }
            }, f.onerror = function () {
                c(l("Network Error", t, null, f)), f = null
            }, f.ontimeout = function () {
                c(l("timeout of " + t.timeout + "ms exceeded", t, "ECONNABORTED", f)), f = null
            }, n.isStandardBrowserEnv()) {
                var T = i(73),
                    k = (t.withCredentials || r(t.url)) && t.xsrfCookieName ? T.read(t.xsrfCookieName) : void 0;
                k && (h[t.xsrfHeaderName] = k)
            }
            if ("setRequestHeader" in f && n.forEach(h, function (t, e) {
                void 0 === d && "content-type" === e.toLowerCase() ? delete h[e] : f.setRequestHeader(e, t)
            }), t.withCredentials && (f.withCredentials = !0), t.responseType) try {
                f.responseType = t.responseType
            } catch (e) {
                if ("json" !== t.responseType) throw e
            }
            "function" == typeof t.onDownloadProgress && f.addEventListener("progress", t.onDownloadProgress), "function" == typeof t.onUploadProgress && f.upload && f.upload.addEventListener("progress", t.onUploadProgress), t.cancelToken && t.cancelToken.promise.then(function (t) {
                f && (f.abort(), c(t), f = null)
            }), void 0 === d && (d = null), f.send(d)
        })
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(10), o = i(187), r = i(2), l = i(0), u = i(5), c = l.default.getLogger("TaskManager");

    class d {
        constructor() {
            this.categoryById = new Map, this.taskCreating = [], this.taskDownloading = [], this.mTasks = new Map, this.mDisableTaskIds = new Set
        }

        deleteTask(t) {
            this.mTasks.delete(t)
        }

        getTask(t) {
            return this.mTasks.get(t)
        }

        getTaskMap() {
            return this.mTasks
        }

        getTasks() {
            let t = [];
            return this.mTasks.forEach((e, i) => {
                t.push(e)
            }), t
        }

        getIsCloudTask(t) {
            let e = this.mTasks.get(t);
            return !!e && e.getIsCloudTask()
        }

        addDownloadingTask(t) {
            this.taskDownloading.includes(t) || this.taskDownloading.push(t)
        }

        delDownloadingTask(t) {
            this.taskDownloading = this.taskDownloading.filter(e => e !== t)
        }

        getDownloadingTaskCount() {
            return this.taskDownloading.length
        }

        createTask(t, e, i) {
            return n(this, void 0, void 0, function* () {
                for (; ;) {
                    if (!this.taskCreating.includes(t)) break;
                    c.info("createTask", "taskCreating", e), yield u.ThunderUtil.sleep(50)
                }
                let n = this.mTasks.get(t);
                if (!n) {
                    if (this.taskCreating.push(t), i || (i = yield s.default.getTaskBaseInfo(t)), !(n = this.mTasks.get(t)) && i && i.groupTaskId <= 0) {
                        if (!(yield this.isDisable(t, i))) {
                            let s = void 0;
                            switch (e) {
                                case"TaskExpand":
                                case"EnterAcclerate":
                                case"BtSubFileForbidden":
                                    break;
                                case"TaskDetailChanged":
                                case"TaskStatusChanged":
                                    switch (i.taskStatus) {
                                        case a.DownloadKernel.TaskStatus.Started:
                                        case a.DownloadKernel.TaskStatus.Failed:
                                            break;
                                        case a.DownloadKernel.TaskStatus.StartWaiting:
                                            if (!(s = yield this.checkIsYunTask(i.categoryId))) return this.taskCreating = this.taskCreating.filter(e => e !== t), null;
                                            break;
                                        default:
                                            return this.taskCreating = this.taskCreating.filter(e => e !== t), null
                                    }
                            }
                            if (yield this.isDisable(t, i)) return this.taskCreating = this.taskCreating.filter(e => e !== t), null;
                            void 0 === s && (s = yield this.checkIsYunTask(i.categoryId)), c.info("createTask", i.taskStatus, e), n = new o.Task(t, i, s), this.mTasks.set(t, n)
                        }
                    }
                    this.taskCreating = this.taskCreating.filter(e => e !== t)
                }
                return n
            })
        }

        checkIsYunTask(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.categoryById.get(t);
                return e || (e = yield r.client.callServerFunction("GetCategoryById", t), this.categoryById.set(t, e)), !(!e || "ThunderPanPlugin" !== e.name)
            })
        }

        isDisable(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                do {
                    if (e.taskType === a.DownloadKernel.TaskType.Group) break;
                    if (e.isBackground) {
                        if (this.mDisableTaskIds.has(t)) {
                            i = !0;
                            break
                        }
                        (i = !(e.taskType === a.DownloadKernel.TaskType.P2sp && e.refUrl && (yield s.default.getIsHDVideo(e.refUrl)))) && this.mDisableTaskIds.add(t)
                    }
                } while (0);
                return i
            })
        }
    }

    e.TaskManager = d, e.default = new d
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(1), a = i(194), s = i(3), o = i(5), r = i(0).default.getLogger("VipDownload:ui-configure.cache");
    var l;
    !function (t) {
        t[t.VipButton = 0] = "VipButton", t[t.SuperVipButton = 1] = "SuperVipButton", t[t.TryReadyIcon = 2] = "TryReadyIcon", t[t.TryingIcon = 3] = "TryingIcon", t[t.TryFinishIcon = 4] = "TryFinishIcon", t[t.TryReadyButton = 5] = "TryReadyButton", t[t.TryingButton = 6] = "TryingButton", t[t.TryFinishButton = 7] = "TryFinishButton", t[t.TryReadyText = 8] = "TryReadyText", t[t.TryingText = 9] = "TryingText", t[t.TryFinishText = 10] = "TryFinishText", t[t.SuperTryReadyButton = 11] = "SuperTryReadyButton", t[t.SuperTryingButton = 12] = "SuperTryingButton", t[t.SuperTryFinishButton = 13] = "SuperTryFinishButton", t[t.SuperTryReadyText = 14] = "SuperTryReadyText", t[t.SuperTryingText = 15] = "SuperTryingText", t[t.SuperTryFinishText = 16] = "SuperTryFinishText", t[t.MixTryReadyIcon = 17] = "MixTryReadyIcon", t[t.MixTryingIcon = 18] = "MixTryingIcon", t[t.MixTryReadyButton = 19] = "MixTryReadyButton", t[t.MixPlatinumTryingButton = 20] = "MixPlatinumTryingButton", t[t.MixSuperTryingButton = 21] = "MixSuperTryingButton", t[t.MixTryFinishButton = 22] = "MixTryFinishButton", t[t.MixTryReadyText = 23] = "MixTryReadyText", t[t.MixPlatinumTryingText = 24] = "MixPlatinumTryingText", t[t.MixSuperTryingText = 25] = "MixSuperTryingText", t[t.MixTryFinishText = 26] = "MixTryFinishText", t[t.VipHover = 27] = "VipHover", t[t.SuperVipHover = 28] = "SuperVipHover", t[t.TryHover = 29] = "TryHover", t[t.SuperTryHover = 30] = "SuperTryHover", t[t.MixTryHover = 31] = "MixTryHover", t[t.TryTipsButton = 32] = "TryTipsButton", t[t.TryTipsText = 33] = "TryTipsText", t[t.TryTipsBkg = 34] = "TryTipsBkg", t[t.TryTipsLabel = 35] = "TryTipsLabel", t[t.PlayGameText = 36] = "PlayGameText", t[t.PlayGameButton = 37] = "PlayGameButton"
    }(l = e.ItemName || (e.ItemName = {}));

    class u {
        constructor() {
            this.configures = new Map, this.secneData = [], this.configData = null, this.init()
        }

        init() {
            let t = "former_default", e = {
                text: "会员加速",
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin",
                referfrom: "v_pc_xl11_hytq_js",
                config: t,
                isSuper: !1
            };
            this.configures.set(l.VipButton, e), this.configures.set(l.VipHover, o.ThunderUtil.deepCopy(e));
            let i = {
                text: "超级加速",
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin&selectBizno=supervip&timeType=1006",
                referfrom: "v_pc_xl11_hytq_cjjs",
                config: t,
                isSuper: !1
            };
            this.configures.set(l.SuperVipButton, i), this.configures.set(l.SuperVipHover, o.ThunderUtil.deepCopy(i)), this.configures.set(l.TryReadyIcon, {text: "VIP"}), this.configures.set(l.TryingIcon, {text: "VIP"}), this.configures.set(l.TryFinishIcon, {text: "VIP"});
            let n = {text: "试用加速", config: t};
            this.configures.set(l.TryReadyButton, n), this.configures.set(l.TryHover, o.ThunderUtil.deepCopy(n)), this.configures.set(l.TryingButton, {
                text: "开通会员",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin",
                referfrom: "v_pc_xl11_hytq_gs_sy",
                aidfrom: "sying"
            }), this.configures.set(l.TryFinishButton, {
                text: "开通会员",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin",
                referfrom: "v_pc_xl11_hytq_gs_sy",
                aidfrom: "syend"
            }), this.configures.set(l.TryReadyText, {text: "恭喜获得一次免费会员试用资格"}), this.configures.set(l.TryingText, {text: "剩余试用加速流量：%s"}), this.configures.set(l.TryFinishText, {text: "试用结束，开通会员加速不限时"});
            let a = {text: "试用超会", config: t, isSuper: !0};
            this.configures.set(l.SuperTryReadyButton, a), this.configures.set(l.SuperTryHover, o.ThunderUtil.deepCopy(a)), this.configures.set(l.SuperTryingButton, {
                text: s.default.isVip ? "升级超会" : "开通超会",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin&selectBizno=supervip&timeType=1006",
                referfrom: "v_pc_xl11_hytq_cjjs_sy",
                aidfrom: "sying",
                isSuper: !0
            }), this.configures.set(l.SuperTryFinishButton, {
                text: s.default.isVip ? "升级超会" : "开通超会",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin&selectBizno=supervip&timeType=1006",
                referfrom: "v_pc_xl11_hytq_cjjs_sy",
                aidfrom: "syend",
                isSuper: !0
            }), this.configures.set(l.SuperTryReadyText, {
                text: "试用超级会员，享用超级加速",
                isSuper: !1
            }), this.configures.set(l.SuperTryingText, {
                text: void 0,
                isSuper: !0
            }), this.configures.set(l.SuperTryFinishText, {
                text: s.default.isVip ? "试用结束，立即升级为超级会员" : "试用结束，立即开通为超级会员",
                isSuper: !0
            }), this.configures.set(l.MixTryReadyIcon, {text: "VIP"}), this.configures.set(l.MixTryingIcon, {text: "VIP"});
            let r = {text: "试用加速", config: t};
            this.configures.set(l.MixTryReadyButton, r), this.configures.set(l.MixTryHover, o.ThunderUtil.deepCopy(r)), this.configures.set(l.MixPlatinumTryingButton, {
                text: "开通会员",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=baijin&mref=501",
                referfrom: "v_pc_xl11_hytq_cjjs_sy",
                aidfrom: "v2_bj_sying"
            }), this.configures.set(l.MixSuperTryingButton, {
                text: s.default.isVip ? "升级超会" : "开通超会",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=supervip&mref=501",
                referfrom: "v_pc_xl11_hytq_cjjs_sy",
                aidfrom: "v2_cj_sying"
            }), this.configures.set(l.MixTryFinishButton, {
                text: s.default.isVip ? "升级超会" : "开通超会",
                config: t,
                url: "https://pay.xunlei.com/pay.html?bizNo=supervip&mref=501",
                referfrom: "v_pc_xl11_hytq_cjjs_sy",
                aidfrom: "v2_cj_syend"
            }), this.configures.set(l.MixTryReadyText, {text: "免费试用会员加速和超级加速"}), this.configures.set(l.MixPlatinumTryingText, {text: "会员加速试用中,剩余流量 %s"}), this.configures.set(l.MixSuperTryingText, {text: "超级加速试用中,剩余流量 %s"}), this.configures.set(l.MixTryFinishText, {text: s.default.isVip ? "试用结束，立即升级为超级会员" : "试用结束，立即开通为超级会员"}), this.configures.set(l.TryTipsButton, {
                text: "去了解",
                config: t,
                url: "https://vip.xunlei.com/vip_service/privilege/",
                referfrom: "v_pc_xl11_hytq_gs_sy_finishpop",
                aidfrom: "finishpop_default"
            }), this.configures.set(l.TryTipsText, {text: "会员畅享提速特权"}), this.configures.set(l.TryTipsBkg, {img: ""}), this.configures.set(l.TryTipsLabel, {text: ""})
        }

        clear() {
            this.init()
        }

        setData(t) {
            this.configData = t, this.setSceneData(t), this.setTryData(t), this.setSuperTryData(t), this.setMixTryData(t), this.setTryTipsData(t), s.default.isSuperVip || (this.setSuperVipData(t), this.setSuperVipHoverData(t)), this.setPlayGameData(t)
        }

        cleanPlayGameData() {
            this.configures.delete(l.PlayGameText), this.configures.delete(l.PlayGameButton)
        }

        setPlayGameData(t) {
            if (t && t.v_pc_xlx_youtiao_game && t.v_pc_xlx_youtiao_game[0] && t.v_pc_xlx_youtiao_game[1]) {
                let e = t.v_pc_xlx_youtiao_game[0];
                this.configures.set(l.PlayGameText, {text: e.text}), e = t.v_pc_xlx_youtiao_game[1], this.configures.set(l.PlayGameButton, {
                    text: e.text,
                    url: e.url,
                    aidfrom: e.aidfrom,
                    referfrom: e.referfrom
                })
            }
        }

        setSuperVipData(t) {
            let e = this.configures.get(l.SuperVipButton);
            if (t && t.xl11_hytq_cjjs_task && t.xl11_hytq_cjjs_task[0]) {
                let i = t.xl11_hytq_cjjs_task[0];
                i.text && (e.text = i.text), i.url && (e.url = i.url), e.referfrom = i.referfrom, e.aidfrom = i.aidfrom, e.config = "tagsys"
            } else e.config = "tagsys_default";
            this.configures.set(l.SuperVipButton, e)
        }

        setSuperVipHoverData(t) {
            let e = this.configures.get(l.SuperVipHover);
            if (t && t.xl11_hytq_cjjs_hover && t.xl11_hytq_cjjs_hover[0]) {
                let i = t.xl11_hytq_cjjs_hover[0];
                i.text && (e.text = i.text), i.url && (e.url = i.url), e.referfrom = i.referfrom, e.aidfrom = i.aidfrom, e.config = "tagsys"
            } else e.config = "tagsys_default";
            this.configures.set(l.SuperVipHover, e)
        }

        setTryTipsData(t) {
            let e = 0, i = t && t.xl11_hytq_gs_sy_finishpop ? t.xl11_hytq_gs_sy_finishpop : null,
                n = this.configures.get(l.TryTipsText);
            if (i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryTipsText, n), e = 1, n = this.configures.get(l.TryTipsButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.TryTipsButton, n), e = 2, n = this.configures.get(l.TryTipsLabel), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryTipsLabel, n), e = 3, n = this.configures.get(l.TryTipsBkg), i && i[e] && i[e].img) {
                let t = i[e];
                n.img = t.img
            }
            this.configures.set(l.TryTipsBkg, n)
        }

        setSceneData(t) {
            if (this.secneData = [], t && t.xl11_push_gs) {
                let e = t.xl11_push_gs;
                for (let t = 0; t < e.length; t++) {
                    let i = new a.SceneHttpPackageNS.ItemData,
                        s = n.default.combineUrlReferfromAidfrom(e[t].url, e[t].referfrom, e[t].aidfrom);
                    r.info("pushgs_log  clickurl = ", s), i.id = 350003 + t, i.priority = 95, i.status = -1, i.type = 0, i.config = "tagsys", i.aidfrom = e[t].aidfrom, i.name = e[t].text, i.lineStr = s, this.secneData.push(i)
                }
            }
        }

        setTryData(t) {
            let e = 7, i = t && t.xl11_hytq_gs_sy ? t.xl11_hytq_gs_sy : null, n = this.configures.get(l.TryReadyIcon);
            if (i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryReadyIcon, n), e = 4, n = this.configures.get(l.TryingIcon), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryingIcon, n), e = 1, n = this.configures.get(l.TryFinishIcon), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryFinishIcon, n), e = 8, n = this.configures.get(l.TryReadyButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.TryReadyButton, n), e = 5, n = this.configures.get(l.TryingButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.TryingButton, n), e = 2, n = this.configures.get(l.TryFinishButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.TryFinishButton, n), e = 6, n = this.configures.get(l.TryReadyText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryReadyText, n), e = 3, n = this.configures.get(l.TryingText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.TryingText, n), e = 0, n = this.configures.get(l.TryFinishText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            this.configures.set(l.TryFinishText, n)
        }

        setSuperTryData(t) {
            let e = 8, i = t && t.xl11_hytq_cjjs_sy ? t.xl11_hytq_cjjs_sy : null,
                n = this.configures.get(l.SuperTryReadyButton);
            if (i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.SuperTryReadyButton, n), e = 5, n = this.configures.get(l.SuperTryingButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.SuperTryingButton, n), e = 2, n = this.configures.get(l.SuperTryFinishButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.SuperTryFinishButton, n), e = 6, n = this.configures.get(l.SuperTryReadyText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.SuperTryReadyText, n), e = 3, n = this.configures.get(l.SuperTryingText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.SuperTryingText, n), e = 0, n = this.configures.get(l.SuperTryFinishText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            this.configures.set(l.SuperTryFinishText, n)
        }

        setMixTryData(t) {
            let e = 10, i = t && t.xl11_hytq_newcjsy ? t.xl11_hytq_newcjsy : null,
                n = this.configures.get(l.MixTryReadyIcon);
            if (i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.MixTryReadyIcon, n), e = 7, n = this.configures.get(l.MixTryingIcon), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.MixTryingIcon, n), e = 11, n = this.configures.get(l.MixTryReadyButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.MixTryReadyButton, n), e = 8, n = this.configures.get(l.MixPlatinumTryingButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.MixPlatinumTryingButton, n), e = 5, n = this.configures.get(l.MixSuperTryingButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.MixSuperTryingButton, n), e = 2, n = this.configures.get(l.MixTryFinishButton), i && i[e]) {
                let t = i[e];
                t.text && (n.text = t.text), t.url && (n.url = t.url), n.referfrom = t.referfrom, n.aidfrom = t.aidfrom, n.config = "tagsys"
            } else n.config = "tagsys_default";
            if (this.configures.set(l.MixTryFinishButton, n), e = 9, n = this.configures.get(l.MixTryReadyText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.MixTryReadyText, n), e = 6, n = this.configures.get(l.MixPlatinumTryingText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.MixPlatinumTryingText, n), e = 3, n = this.configures.get(l.MixSuperTryingText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            if (this.configures.set(l.MixSuperTryingText, n), e = 0, n = this.configures.get(l.MixTryFinishText), i && i[e] && i[e].text) {
                let t = i[e];
                n.text = t.text
            }
            this.configures.set(l.MixTryFinishText, n)
        }

        getSceneData() {
            return this.secneData
        }

        getItemData(t) {
            return this.configures.get(t)
        }

        getData(t, e, i, n) {
            let a = t;
            try {
                if (this.configData.hasOwnProperty(e)) {
                    let t = this.configData[e];
                    if (t && t.length > i) {
                        let e = t[i];
                        e && e[n] && (a = e[n])
                    }
                }
            } catch (t) {
            }
            return a
        }
    }

    e.UiCache = u, e.default = new u
}, function (t, e) {
    t.exports = require("fs")
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(35), a = i(11);
    e.getDefaultPrex = function () {
        return a.basename(process.execPath, ".exe")
    }, e.getSockPath = function (t) {
        const e = n.tmpdir();
        let i = t;
        t || (i = a.basename(process.execPath, ".exe"));
        let s = a.join(e, `${i}-xunlei-node-net-ipc-{FD196984-2591-4588-AA6F-5C8AC1266290}.sock`);
        return "win32" === process.platform && (s = "\\\\.\\pipe\\" + (s = (s = s.replace(/^\//, "")).replace(/\//g, "-"))), s
    }, e.serverContextName = "xunlei-node-net-ipc-server-{46105371-DE78-4442-B59F-FDA1D6D7D430}", e.isObjectEmpty = function (t) {
        let e = !0;
        do {
            if (!t) break;
            if (0 === Object.keys(t).length) break;
            e = !1
        } while (0);
        return e
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(8), s = i(186), o = i(148), r = i(197), l = i(241), u = i(7), c = i(2), d = i(3), h = i(10), f = i(21),
        p = i(26), g = i(198), S = i(27), y = i(14), T = i(164), k = i(149), m = i(13), v = i(1), w = i(53), _ = i(5),
        D = i(195), b = i(20), N = i(49), C = i(31), x = i(11), {isDef: I} = _.ThunderUtil, V = i(0), B = i(92),
        P = i(22), E = i(43), O = i(86), F = i(45), A = V.default.getLogger("VipDownload:ui-helper"), R = "vipMiniWeb";
    var L, U, M;
    !function (t) {
        t.PRE_NEW_TASK = "pre-newtask-dlg", t.BT_NEW_TASK = "bt-newtask-dlg", t.NEW_TASK = "newtask-dlg", t.LOGIN = "login-dlg", t.BROWSER_GUIDE = "browser-guide-dlg", t.SIGN = "sign-dlg", t.THUNDER_PAN_IMPORT = "thunder-pan-import", t.VIP_RENEW = "vip-renew", t.LOGIN_NONE_VIP_ACTIVITY = "login-none-vip-activity", t.VIP_PACK_TRY_GUIDE = "vip-pack-try-guide", t.VIP_TRY_GUIDE = "vip-try-guide", t.VIP_HUDDLE_NOVICE_GUIDE = "vip-huddle-novice-guide", t.KUAINIAO_AUTO = "kuainiao-auto"
    }(L = e.PopView || (e.PopView = {})), function (t) {
        t[t.BaotuanCutLineOut = 1] = "BaotuanCutLineOut", t[t.BaotuanNoviceGuid = 2] = "BaotuanNoviceGuid", t[t.BaotuanBaoHuVip = 3] = "BaotuanBaoHuVip", t[t.BaotuanSurper = 4] = "BaotuanSurper", t[t.PackageTry = 5] = "PackageTry", t[t.PackageTryFinish = 6] = "PackageTryFinish"
    }(U = e.PopupWndType || (e.PopupWndType = {})), function (t) {
        t[t.GreenNotify = 0] = "GreenNotify", t[t.RedNotify = 1] = "RedNotify", t[t.RedCancelNotify = 2] = "RedCancelNotify"
    }(M || (M = {}));

    class X {
        constructor() {
            this.webWndOption = null, this.popupShowed = !1, this.kickOutTask = new Map, this.isShowingPayWnd = !1, this.payDialog = null, this.readPopupWndType = null, this.readPopupArgs = null, this.packageTryWnd = null, this.init()
        }

        init() {
            y.default.addListener(y.TaskEventNS.showTaskTryTips, this.onShowTaskTryTips.bind(this)), y.default.addListener(y.TaskEventNS.showTaskTryMiniWeb, this.onShowTaskTryMiniWeb.bind(this)), y.default.addListener(y.TaskEventNS.showBaotuanPopupWnd, this.onShowBaotuanPopupWnd.bind(this)), y.default.addListener(y.TaskEventNS.enterBaotuanAcclerate, this.enterBaotuanAcclerate.bind(this)), y.default.addListener(y.TaskEventNS.taskKickOut, this.onTaskKickOut.bind(this)), d.default.addListener(d.UserEventNS.login, this.onUserLogin.bind(this)), E.default.addListener(F.PackageTryDefineNS.Event.stateChange, this.onPackageStateChange.bind(this)), c.client.attachServerEvent("OnMainWindowVisibleChange", this.onMainWindowVisibleChange.bind(this))
        }

        clickVipAcclerateBtn(t, e, i) {
            return n(this, void 0, void 0, function* () {
                i = i || "task", o.VipStatNS.vipButtonClick(t, e, i, p.default.getIsCloudTask(t)), e.isSuper && !d.default.isSuperVip ? this.openVipAcclerateTab(e, i) : this.enterAcclerate(t, a.VipDownloadDefineNS.VipTaskType.Vip)
            })
        }

        clickTryAcclerateBtn(t, e, i) {
            do {
                i = i || "task";
                let n = f.default.getVipTaskInfo(t);
                if (!n || n.taskType !== a.VipDownloadDefineNS.VipTaskType.Try || n.taskStatus !== a.VipDownloadDefineNS.VipTaskStatus.Init) break;
                if (n.isMixTry) this.closeWebWnd(), r.TryStatNS.superTryButtonClick(t, e, i, !0), c.client.callServerFunction("FireEventFunction", w.BroadcastEventNS.taskEnterMixTry, t).catch(); else {
                    n.isSuper ? r.TryStatNS.superTryButtonClick(t, e, i) : r.TryStatNS.tryButtonClick(t, e, i)
                }
                "task" === i && e && e.url && "" !== e.url && this.openVipAcclerateTab(e), this.enterAcclerate(t, a.VipDownloadDefineNS.VipTaskType.Try)
            } while (0)
        }

        clickAdAcclerateBtn(t, e) {
            return n(this, void 0, void 0, function* () {
                A.info("clickAdAcclerateBtn", t, e);
                do {
                    let i = f.default.getVipTaskInfo(t);
                    if (!i || i.taskType !== a.VipDownloadDefineNS.VipTaskType.Ad) break;
                    l.AdStatNS.adButtonClick(t, e);
                    let n = T.default.getTask(t);
                    n && n.gcidLeftCount && n.gcidLeftCount > 0 ? this.showAdWebWnd(t).catch() : this.enterAdAcclerate(t)
                } while (0)
            })
        }

        clickPlayGameBtn(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = yield B.asyncRemoteCall.getCurrentWindow(), n = p.default.getTask(t);
                i && n && (n.getVipTask().getGameOperation().clickPlayGame(), c.client.callRemoteClientFunction(v.default.pluginWebviewName, "OpenPayVipUrl", e.url), i.maximize())
            })
        }

        clickScenceText(t, e) {
            let i = e.textlink;
            this.openNewTab(i), g.default.onClickScene(t), s.SceneStatNS.scenceClick(t, e)
        }

        clickTryOpenVipBtn(t, e, i, n) {
            A.info("clickTryOpenVipBtn");
            let s = f.default.getVipTaskInfo(t);
            if (!s) return;
            let o = "Finished" === e;
            if (o) {
                let e = p.default.getTask(t);
                if (e) {
                    let t = e.getVipTask().getOperation(a.VipDownloadDefineNS.VipTaskType.Try);
                    t && t.setFinishClickDispearDelay()
                }
            }
            if (s.isMixTry) {
                let e = "cjjssyend";
                o || (e = n ? "cjjsy_cj" : "cjjssy_bj"), r.TryStatNS.superTryOpenVipButtonClick(t, i, e, !0)
            } else if (n) {
                let e = o ? "cjjssyend" : "cjjssying";
                r.TryStatNS.superTryOpenVipButtonClick(t, i, e)
            } else {
                let e = o ? "syend" : "sying";
                r.TryStatNS.tryOpenVipButtonClick(t, i, e)
            }
            this.openVipAcclerateTab(i)
        }

        clickJoinBtn(t, e) {
            return n(this, void 0, void 0, function* () {
                if (A.info("clickJoinBtn", t, e), b.BaoTuanSettingNS.checkLogin(d.default.isLogin)) {
                    if (!(yield this.showNoviceGuid(t, "xgt"))) if (yield this.checkIsSurperOnlyBaotuan(t, e)) {
                        if (this.enterBaotuanAcclerate(e, t, a.VipDownloadDefineNS.BaotuanEnterBy.clickJoinBtn), b.BaoTuanSettingNS.isUserJoiningChangWei() && 0 === b.BaoTuanSettingNS.getUserChangWeiStatus()) {
                            let t = `https://msg-vip-ssl.xunlei.com/baotuan/active?userid=${d.default.userId}&sessionid=${yield d.default.getSessionId()}&client=xds`,
                                e = yield C.default.get(t, {timeout: 1e4});
                            if (null !== e && 200 === e.status && null !== e.data) switch (e.data.result) {
                                case 0:
                                case 10:
                                case 11:
                                case 12:
                                    b.BaoTuanSettingNS.setUserChangWeiStatus(10)
                            }
                        }
                    } else A.info("clickJoinBtnByWebOrMenu", "checkIsSurperOnlyBaotuan", "false", e)
                } else c.client.callServerFunction("ShowLoginDlg")
            })
        }

        clickJoinBtnByWeb(t, e) {
            return n(this, void 0, void 0, function* () {
                A.info("clickJoinBtnByWeb", t, e), this.clickJoinBtnByWebOrMenu(t, e)
            })
        }

        clickJoinBtnByMenu(t) {
            return n(this, void 0, void 0, function* () {
                A.info("clickJoinBtnByMenu", t), this.clickJoinBtnByWebOrMenu(t, "right_menu")
            })
        }

        clickJoinBtnByCarIdentify(t) {
            return n(this, void 0, void 0, function* () {
                A.info("clickJoinBtnByCarIdentify", t), this.clickJoinBtnByWebOrMenu(t, "car_identify")
            })
        }

        checkIsSurperOnlyBaotuan(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                do {
                    if (!(yield b.BaoTuanSettingNS.checkIsSurperUserOnly())) {
                        i = !0;
                        break
                    }
                    if (d.default.isSuperVip) {
                        if (d.default.isYear) {
                            i = !0;
                            break
                        }
                        if (b.BaoTuanSettingNS.getCutlineLeftCount() > 0) {
                            i = !0;
                            break
                        }
                    }
                } while (0);
                if (!i) {
                    let i = {aid: "group_dl_brfore_cutinline_pay", state_from: "group_before", entrance_from: e};
                    this.showPopupWnd(U.BaotuanSurper, i, t)
                }
                return i
            })
        }

        showNoviceGuid(t, e) {
            return n(this, void 0, void 0, function* () {
                if (yield b.BaoTuanSettingNS.getHaveShowNoviceGuid()) return !1;
                if ("gray_auto" === e && !(yield this.allowPopMutualNow(U.BaotuanNoviceGuid))) return !1;
                A.info("showNoviceGuid"), b.BaoTuanSettingNS.setHaveShowNoviceGuid();
                let i = b.BaoTuanSettingNS.getBaotuanEntrance().newer_window_default;
                return void 0 === i && (i = !0), b.BaoTuanSettingNS.getIsSurperUserOnly() && (i = !0), this.showOpenTeamWnd(e, t, i), N.BaotuanStatNS.showNoviceGuid(e, "gray_auto" === e), "car_identify" === e && this.openBaotuanDetailPage(t, "car_identify"), !0
            })
        }

        clickJoinBtnByWebOrMenu(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1, n = !1;
                do {
                    let s = {
                        result: -1,
                        message: "",
                        teamCount: 0,
                        isVip: d.default.isVip ? "1" : "0",
                        isPlatinumVip: d.default.isPlatinumVip ? "1" : "0",
                        isSuperVip: d.default.isSuperVip ? "1" : "0"
                    }, o = f.default.getBaotuanDetail(t);
                    if (b.BaoTuanSettingNS.checkLogin(d.default.isLogin)) {
                        if (p.default.getTask(t)) {
                            let i = p.default.getTask(t).getVipTask().getVipEnterType();
                            if (i === a.VipDownloadDefineNS.VipTaskType.Try || i === a.VipDownloadDefineNS.VipTaskType.Ad) {
                                if (s.result = 102, s.message = "会员加速试用中，请您稍后重试", !d.default.isSuperVip && o && o.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut) {
                                    let i = {isRightWnd: 0, entrance_from: e};
                                    this.showPopupWnd(U.BaotuanBaoHuVip, i, t);
                                    break
                                }
                                "car_identify" === e && this.openBaotuanDetailPage(t, "car_identify")
                            } else E.default.packageRuning && (s.result = 200, s.teamCount = 50, o && (s.teamCount = void 0 !== o.baotuanNumber && null !== o.baotuanNumber ? o.baotuanNumber : 50), s.message = "抱团下载中，当前抱团N人")
                        }
                    } else s.result = 101, s.message = "登录账号，团友助你下载更快乐", c.client.callServerFunction("ShowLoginDlg"), "car_identify" === e && this.openBaotuanDetailPage(t, "car_identify");
                    if (-1 === s.result && (yield this.showNoviceGuid(t, e))) break;
                    let r = !1;
                    if (-1 === s.result && o) switch (o.baotuanXgt) {
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                            r = !0
                    }
                    if (!r && 200 !== s.result && 102 !== s.result && !(yield this.checkIsSurperOnlyBaotuan(t, e))) return void A.info("clickJoinBtnByWebOrMenu", "checkIsSurperOnlyBaotuan", "false", e);
                    if (A.info("clickJoinBtnByWebOrMenu", e, JSON.stringify(o)), -1 === s.result && o) switch (s.teamCount = void 0 !== o.baotuanNumber && null !== o.baotuanNumber ? o.baotuanNumber : 0, o.baotuanXgt) {
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                            i = !0;
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                            s.result = 201, s.message = "当前抱团已满50人，您可插队加入", n = !0, i = !0;
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                            if (b.BaoTuanSettingNS.getCutlineLeftCount() < 1) {
                                s.result = 202, s.message = "插队次数已用完，开通会员享更多";
                                let i = {
                                    aid: "group_dl_after_no_cutinline_times",
                                    state_from: "group_before",
                                    entrance_from: e
                                };
                                d.default.isSuperVip && d.default.isYear || this.showPopupWnd(U.BaotuanCutLineOut, i, t)
                            } else s.result = 201, s.message = "当前抱团已满50人，您可插队加入", n = !0, i = !0;
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                            "car_identify" === e && this.openBaotuanDetailPage(t, "car_identify"), s.result = 200, s.message = "抱团下载中，当前抱团N人", h.default.startTask(t);
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                            if (s.result = 203, s.message = "您被白金会员挤出了，可开启抱团保护", !d.default.isSuperVip) {
                                let i = {isRightWnd: 0, entrance_from: e};
                                "car_identify" === e ? this.openBaotuanDetailPage(t, "car_identify") : this.showPopupWnd(U.BaotuanBaoHuVip, i, t)
                            }
                    }
                    -1 !== s.result ? "group_dl_detail" === e ? 0 !== s.result && 200 !== s.result && 102 !== s.result || this.showBaoTuanToastNotify(s) : "click_right_icon" === e || "comment_area" === e ? (A.info("BaoTuanTaskStatusChange", s), c.client.callServerFunction("FireEventFunction", "BaoTuanTaskStatusChange", JSON.stringify(s)), N.BaotuanStatNS.showTips(e)) : "right_menu" === e ? this.showBaoTuanToastNotify(s) : "car_identify" === e && this.showBaoTuanToastNotify(s) : i = !0
                } while (0);
                if (i) A.info("into acclerate"), this.enterBaotuanAcclerate(e, t, a.VipDownloadDefineNS.BaotuanEnterBy.clickJoinBtnByMenu); else {
                    let i = f.default.getBaotuanDetailSt(t);
                    if ("click_right_icon" === e) N.BaotuanStatNS.webClickBaoTuan(i.teamLeftCount, i.state, n); else if ("right_menu" === e) N.BaotuanStatNS.rightMenuClickBaoTuan(i.teamLeftCount, i.state, n); else if ("car_identify" === e) {
                        let e = p.default.getTask(t);
                        N.BaotuanStatNS.carIdentifyClickBaoTuan(i.teamLeftCount, i.state, n, e.getTaskStatus() === u.DownloadKernel.TaskStatus.Started)
                    }
                }
            })
        }

        clickAutoTeamBtn(t) {
            return n(this, void 0, void 0, function* () {
                yield b.BaoTuanSettingNS.SetAutoJoinCutLine(!0, "openguide_xgt"), b.BaoTuanSettingNS.IncreaseOpenTeamRecommendCount(), N.BaotuanStatNS.openAutoCutline("openguide_xgt", "open");
                let e = p.default.getTask(t);
                e && e.getVipTask().getBaotuanOperation().onSomeOperation("changeXgt", a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed, !1), this.showBaoTuanOpenAutoToastNotify()
            })
        }

        getVipAccelerateMenuState(t) {
            let e = !1, i = !1;
            for (let n of t) {
                let t = p.default.getTask(n.taskId);
                if (t) {
                    if (t.getTaskStatus() === u.DownloadKernel.TaskStatus.Failed) continue;
                    if (t.getVipTask().getVipTaskStatus() > a.VipDownloadDefineNS.VipTaskStatus.Init) {
                        i = !1;
                        continue
                    }
                    e = !1
                } else {
                    if (n.taskStatus === u.DownloadKernel.TaskStatus.Failed) continue;
                    switch (d.default.isVip || (e = !0), n.taskStatus) {
                        case u.DownloadKernel.TaskStatus.Started:
                            d.default.isVip && (i = !0);
                            break;
                        case u.DownloadKernel.TaskStatus.Stopped:
                            e = !0
                    }
                }
            }
            let n = "会员加速";
            return !e && i && (n = "已会员加速"), {
                enabled: e, label: n, click: () => {
                    this.clickBatchAcclerateBtn(t)
                }
            }
        }

        clickBatchAcclerateBtn(t, e) {
            e = e || "task";
            let i = !1, n = S.default.getItemData(S.ItemName.VipButton);
            t.length > 0 && o.VipStatNS.vipButtonClick(t[0].taskId, n, e, p.default.getIsCloudTask(t[0].taskId));
            let s = !1, r = !1;
            for (let e of t) {
                let t = p.default.getTask(e.taskId);
                if (t) {
                    let n = t.getTaskStatus();
                    if (n === u.DownloadKernel.TaskStatus.Failed) continue;
                    r = !0;
                    let s = t.getVipTask();
                    if (s.getVipTaskStatus() > a.VipDownloadDefineNS.VipTaskStatus.Init && n === u.DownloadKernel.TaskStatus.Started) continue;
                    let o = s.getVipTaskType();
                    if (o === a.VipDownloadDefineNS.VipTaskType.Vip && !d.default.authority) continue;
                    this.enterAcclerate(e.taskId, o), i = !0
                } else {
                    if (e.taskStatus === u.DownloadKernel.TaskStatus.Failed) continue;
                    switch (d.default.isVip || (s = !0), e.taskStatus) {
                        case u.DownloadKernel.TaskStatus.Stopped:
                            d.default.isVip && h.default.startTask(e.taskId)
                    }
                }
            }
            (!i && r || s) && this.openVipAcclerateTab(n, e)
        }

        getBaoTuanMenuState(t, e) {
            let i = 0;
            if (1 === t.length) {
                i = t[0].taskId, e = t[0].taskType !== u.DownloadKernel.TaskType.Group;
                let n = f.default.getBaotuanDetailSt(i);
                N.BaotuanStatNS.showRightMenuBaoTuan(n.teamLeftCount, n.state)
            }
            return {
                enabled: e,
                label: "抱团下载",
                icon: _.ThunderUtil.getStaticPath() + "/icon/rightmenu/baotuan.png",
                click: () => {
                    this.clickJoinBtnByMenu(i)
                }
            }
        }

        showTryReadyWebWnd(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield c.client.callServerFunction("GetValue", "VipDownload", "ShowTryReadyWebWnd", !1);
                if (A.info("showTryReadyWebWnd", e), !e && (yield this.allowPopMutualNow(U.PackageTry))) {
                    let e = "https://act-vip-ssl.xunlei.com/pc/vip/2019/thunder-x-trial/?type=3&time=" + v.default.currentTime;
                    A.info("url", e);
                    let i = {
                        url: e, callBackShow: () => n(this, void 0, void 0, function* () {
                            return r.TryStatNS.superTryReadyMiniWebShow(t), yield c.client.callServerFunction("SetValue", "VipDownload", "ShowTryReadyWebWnd", !0), yield c.client.callServerFunction("RegisterWebFunction", R, "ClickTryButton", () => n(this, void 0, void 0, function* () {
                                A.info("ClickTryButton"), r.TryStatNS.superTryReadyMiniWebClick(t), this.clickTryAcclerateBtn(t, null, "tips")
                            })), this.popMutualCreated(U.PackageTry, !0).catch(), !0
                        }), callBackClose: () => {
                            this.closePopMutual(U.PackageTry).catch()
                        }
                    };
                    yield this.createWebWnd(i)
                }
            })
        }

        showTryFinishWebWnd(t, e, i, a) {
            return n(this, void 0, void 0, function* () {
                A.info("showTryFinishWebWnd", e, i, a);
                let s = i - e, o = a - e;
                if (s <= 0 || o <= 0) return void A.info("platinumPromote or superPromote is less than 0");
                let l = m.default.getValue("VipDownload", "MixTryFinishMiniWebMinPromotePercent");
                if (e > 0 && (100 * s / e < l || 100 * o / e < l)) A.info("platinumPromote or superPromote is less than", l); else if (!(yield c.client.callServerFunction("GetValue", "VipDownload", "showTryFinishWebWnd", !1))) {
                    let s = m.default.getValue("VipDownload", "MixTryFinishMiniWeb"), o = v.default.currentTime,
                        l = "https://act-vip-ssl.xunlei.com/pc/vip/2019/thunder-x-trial/";
                    l = `${l}?type=${s}&normalSpeed=${e}&baijinSpeed=${i}&chaohuiSpeed=${a}&time=${o}`, A.info("url", l);
                    let u = {
                        url: l, callBackShow: () => n(this, void 0, void 0, function* () {
                            return r.TryStatNS.superTryFinishMiniWebShow(t, s), yield c.client.callServerFunction("SetValue", "VipDownload", "showTryFinishWebWnd", !0), yield c.client.callServerFunction("RegisterWebFunction", R, "OpenVipTab", (e, i) => {
                                A.info("OpenVipTab", e), r.TryStatNS.superTryFinishMiniWebClick(t, s, i), this.closeWebWnd(), this.openNewTab(e)
                            }), !0
                        })
                    };
                    yield this.createWebWnd(u)
                }
            })
        }

        showTryFinishTips(t, e, i) {
            return n(this, void 0, void 0, function* () {
                A.info("showTryFinishTips", e, i);
                let n = S.default.getItemData(S.ItemName.TryTipsBkg), a = n.img,
                    s = (n = S.default.getItemData(S.ItemName.TryTipsLabel)).text,
                    o = (n = S.default.getItemData(S.ItemName.TryTipsText)).text;
                n = S.default.getItemData(S.ItemName.TryTipsButton);
                let r = void 0;
                if (a) {
                    let t = !1, e = void 0, i = yield c.client.callServerFunction("GetProfilesDir");
                    if (i) {
                        try {
                            e = x.resolve(i, "VipDownload/try-tips") + "/" + a.substring(a.lastIndexOf("/") + 1), A.info("savePath", e)
                        } catch (t) {
                            A.info("savePath", "error", t)
                        }
                        e && (t = yield D.FileDownloadNS.downloadFile(a, e))
                    }
                    r = t ? e : "default"
                } else {
                    let t = i - e;
                    if (i <= 0) return void A.info("vipSpeed is less than 0");
                    let n = m.default.getValue("VipDownload", "MixTryFinishMiniWebMinPromotePercent");
                    if (e > 0 && 100 * t / e < n) return void A.info("platinumPromote or vipPromote is less than", n)
                }
                let l = `file:///${x.join(__dirname, "../")}try-tips-renderer/index.html`, u = {
                    vip_type: d.default.vasType,
                    is_login: Number(d.default.isLogin),
                    is_vip: Number(d.default.isVip),
                    gcid: k.StatHelperNS.taskGcid(t),
                    url: k.StatHelperNS.taskUrl(t),
                    filesize: k.StatHelperNS.taskFileSize(t),
                    taskid: t,
                    normalSpeed: e,
                    vipSpeed: i,
                    bkgImage: r,
                    tipText: o,
                    labelText: s,
                    buttonData: n
                }, h = JSON.stringify(u);
                A.info("params", h), l = l + "?params=" + (u = encodeURIComponent(h)), yield c.client.callServerFunction("ShowNotification", JSON.stringify({
                    width: 300,
                    height: 287,
                    name: "trytip",
                    priority: 0,
                    url: l
                }))
            })
        }

        showAdWebWnd(t) {
            return n(this, void 0, void 0, function* () {
                A.info("showAdWebWnd");
                let e = l.AdStatNS.getTaskGcid(t),
                    i = "http://static1.ssp.xunlei.com/external/rewarded-ad-speed/show.html";
                i = `${i}?task_id=${t}&gcid=${e}`, A.info("url", i);
                let s = {
                    url: i,
                    wndWidth: 900,
                    wndHeight: 600,
                    browserTopMargin: 0,
                    callBackShow: () => n(this, void 0, void 0, function* () {
                        return yield c.client.callServerFunction("RegisterWebFunction", R, "CloseDialog", () => {
                            A.info("CloseDialog"), this.closeWebWnd()
                        }), yield c.client.callServerFunction("RegisterWebFunction", R, "OnAdvertisementPlayDone", () => {
                            A.info("OnAdvertisementPlayDone");
                            let e = f.default.getVipTaskInfo(t);
                            e && e.taskType === a.VipDownloadDefineNS.VipTaskType.Ad && this.enterAdAcclerate(t)
                        }), !0
                    }),
                    browserEventHandler: (t, ...e) => {
                        if (A.info("showAdWebWnd browserEventHandler", "event", t), "OnNewBrowserPopup" === t) {
                            let t = e[0];
                            A.info("url", t), c.client.callServerFunction("OpenURLByIEorDefault", t).catch()
                        }
                        return !0
                    }
                };
                yield this.createWebWnd(s)
            })
        }

        enterAcclerate(t, e) {
            h.default.startTask(t), f.default.enterAcclerate(t, e).catch(), a.VipDownloadDefineNS.VipTaskType.Try === e && c.client.callServerFunction("SwitchDetail", t, "TaskChart")
        }

        enterAdAcclerate(t) {
            l.AdStatNS.startAcclerate(t), this.enterAcclerate(t, a.VipDownloadDefineNS.VipTaskType.Ad)
        }

        openVipAcclerateTab(t, e) {
            let i = t.url, n = t.referfrom, a = t.aidfrom || e;
            i = v.default.combineUrlReferfromAidfrom(i, n, a), this.openPayVipUrl(i)
        }

        openNewTab(t) {
            this.openPayVipUrl(t)
        }

        createWebWnd(t) {
            return n(this, void 0, void 0, function* () {
                t.wndWidth = t.wndWidth || 460, t.wndHeight = t.wndHeight || 360, t.browserLeftMargin = I(t.browserLeftMargin) ? t.browserLeftMargin : 0, t.browserRightMargin = I(t.browserRightMargin) ? t.browserRightMargin : 0, t.browserTopMargin = I(t.browserTopMargin) ? t.browserTopMargin : 30, t.browserBootomMargin = I(t.browserBootomMargin) ? t.browserBootomMargin : 0, (yield c.client.callServerFunction("IsMainWndShow")) ? yield this.showWebWnd(t) : this.webWndOption = t
            })
        }

        showWebWnd(t) {
            return n(this, void 0, void 0, function* () {
                A.info("showWebWnd", R, "", !0, JSON.stringify(t)), yield c.client.callServerFunction("ShowWebWnd", R, t.url, "", !0, t.wndWidth, t.wndHeight, t.browserLeftMargin, t.browserRightMargin, t.browserTopMargin, t.browserBootomMargin, null, t.callBackShow, t.callBackClose, t.browserEventHandler)
            })
        }

        closeWebWnd() {
            A.info("closeWebWnd"), c.client.callServerFunction("CloseWebWnd", R).catch()
        }

        onShowTaskTryTips(t, e, i) {
            E.default.openPackageTry || "ready" === t || "finish" === t && this.showTryFinishTips(e, i.normalSpeed, i.vipSpeed).catch()
        }

        onShowTaskTryMiniWeb(t, e, i) {
            E.default.openPackageTry || ("ready" === t ? this.showTryReadyWebWnd(e).catch() : "finish" === t && this.showTryFinishWebWnd(e, i.normalSpeed, i.platinumVipSpeed, i.superVipSpeed).catch())
        }

        onMainWindowVisibleChange(t, e) {
            e && this.webWndOption ? (this.showWebWnd(this.webWndOption).catch(), this.webWndOption = null) : e && this.readPopupWndType && this.showPopupWnd(this.readPopupWndType, this.readPopupArgs, 0)
        }

        showPopupWnd(t, e, a) {
            return n(this, void 0, void 0, function* () {
                if (!(yield c.client.callServerFunction("IsMainWndShow"))) return this.readPopupWndType = t, void (this.readPopupArgs = e);
                if (this.readPopupWndType = null, this.popupShowed) return;
                this.popupShowed = !0;
                let n = `file:///${__dirname}/../dialog-renderer/index.html?`;
                d.default.isVip ? n += "isVip=1" : n += "isVip=0", n += `&isLogin=${Number(d.default.isLogin)}`, n += `&vipType=${d.default.vasType}`;
                let s = 0, o = 0, r = void 0, l = void 0, u = !1, h = b.BaoTuanSettingNS.isUserJoiningChangWei(),
                    f = !1;
                switch (t) {
                    case U.BaotuanCutLineOut:
                        if (n += "&show=CutLineOut&aid=" + e.aid + "&entrance_from=" + e.entrance_from + "&state_from=" + e.state_from, s = 460, h ? (o = 372, n += "&isChangWei=1") : (o = 368, n += "&isChangWei=0"), "car_identify" === e.entrance_from && (this.openBaotuanDetailPage(a, "car_identify"), !b.BaoTuanSettingNS.getBelowTaskClickAB())) return void (this.popupShowed = !1);
                        break;
                    case U.BaotuanSurper:
                        n += "&show=BaotuanSurper&aid=" + e.aid + "&entrance_from=" + e.entrance_from + "&state_from=" + e.state_from, s = 460, o = 368;
                        break;
                    case U.BaotuanNoviceGuid:
                        n += `&show=NoviceGuid&taskId=${e.taskId}&checked=${e.checked}&from=${e.from}&isSurperOnly=${b.BaoTuanSettingNS.getIsSurperUserOnly()}`, n += `&isOldUser=${b.BaoTuanSettingNS.getIsOldUser()}`, s = 460, o = 352, "gray_auto" === e.from && (f = !0);
                        break;
                    case U.BaotuanBaoHuVip:
                        n += "&show=BaoHuVip&entrance_from=" + e.entrance_from, e.isRightWnd ? (s = 300, o = 292, r = screen.availWidth - s, l = screen.availHeight - o, n += "&isRightWnd=1", n += "&isChangWei=0") : (s = 460, h ? (o = 372, n += "&isChangWei=1") : (o = 368, n += "&isChangWei=0"), n += "&isRightWnd=0");
                        break;
                    case U.PackageTry:
                        n += `&show=PackageTry&isSurperPackage=${e[0] ? "true" : "false"}`, s = 420, o = 330, O.PackageTryStatNS.show(E.default.todayUseing, "popup", E.default.isSurperPackget, E.default.isHaveCloudTask).catch(), c.client.callServerFunction("SetValue", "VipDownload", "ShowPackageTryReadyWebWnd", !0).catch(), f = !0;
                        break;
                    case U.PackageTryFinish:
                        n += "&show=PackageTryFinish", n += `&normalSpeed=${e[0]}&vipSpeed=${e[1]}&isSurperPackage=${e[3] ? "true" : "false"}`, s = 420, o = 330, O.PackageTryStatNS.afterShow("popup", yield E.default.downloadNum(), E.default.accNum, E.default.groupNum, E.default.accBcNum, E.default.beforeSpeed, E.default.ingSpeed, E.default.gcidSet, E.default.isSurperPackget, E.default.isHaveCloudTask).catch(), c.client.callServerFunction("SetValue", "VipDownload", "ShowPackageTryFinishWebWnd", !0).catch()
                }
                if (void 0 === r) {
                    let t = yield(yield B.asyncRemoteCall.getCurrentWindow()).getBounds();
                    r = t.x + (t.width - s) / 2, l = t.y + (t.height - o) / 2, r + s > screen.availWidth && (r = screen.availWidth - s), r < 0 && (r = 0), l + o > screen.height && (l = screen.availHeight - o), l < 0 && (l = 0), u = !0
                }
                if (!u && !b.BaoTuanSettingNS.GetShowTips()) return void (this.popupShowed = !1);
                let p = yield new (yield B.asyncRemoteCall.getBrowserWindow())({
                    x: Math.round(r),
                    y: Math.round(l),
                    width: s,
                    height: o,
                    modal: !1,
                    resizable: !1,
                    skipTaskbar: !0,
                    frame: !1,
                    center: !0,
                    parent: yield B.asyncRemoteCall.getCurrentWindow(),
                    show: !1,
                    webPreferences: {nodeIntegration: !0}
                });
                return i(33).ipcRenderer.send("create-shadow-window", p.id), this.popMutualCreated(t, f), p.once("ready-to-show", () => {
                    p.show()
                }), A.info("openDialog", n), null !== e && void 0 !== e.onClose && p.on("close", e.onClose), p.on("close", () => {
                    this.popupShowed = !1, this.bringMainWndToTop(), this.closePopMutual(t)
                }), p.loadURL(n), p
            })
        }

        showOpenTeamWnd(t, e, i) {
            return n(this, void 0, void 0, function* () {
                localStorage.setItem("TeamImmediately", "false");
                let s = {
                    taskId: e, checked: i, from: t, onClose: () => n(this, void 0, void 0, function* () {
                        "true" === localStorage.getItem("TeamImmediately") && this.enterBaotuanAcclerate(t, s.taskId, a.VipDownloadDefineNS.BaotuanEnterBy.teamImmediately)
                    })
                };
                this.showPopupWnd(U.BaotuanNoviceGuid, s, e)
            })
        }

        onShowBaotuanPopupWnd(t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = yield c.client.callServerFunction("IsMainWndVisible");
                switch (t) {
                    case"CutLineOut":
                        this.showPopupWnd(U.BaotuanCutLineOut, i, e);
                        break;
                    case"BaoHuVip":
                        if (n) return;
                        this.showPopupWnd(U.BaotuanBaoHuVip, i, e);
                        break;
                    case"NoviceGuid":
                        this.showNoviceGuid(e, i.from)
                }
            })
        }

        showBaoTuanToastNotify(t) {
            return n(this, void 0, void 0, function* () {
                if (202 === t.result) {
                    if ("1" === t.isSuperVip) return;
                    "1" === t.isVip && (t.message = "插队次数已用完，升级超会享更多")
                } else if (203 === t.result) {
                    if ("1" === t.isSuperVip) return;
                    "1" === t.isVip && (t.message = "您被超级会员挤出了，可开启抱团保护")
                } else 0 === t.result ? t.message = "成功进入抱团下载，当前抱团" + t.teamCount + "人" : 200 === t.result && (t.message = "抱团下载中，当前抱团" + t.teamCount + "人");
                let e = {
                    type: M.GreenNotify, message: t.message, duration: 4e3, onCancle: () => {
                    }
                };
                yield c.client.callServerFunction("ShowToast", e)
            })
        }

        showBaoTuanOpenAutoToastNotify() {
            return n(this, void 0, void 0, function* () {
                let t = {
                    type: M.GreenNotify,
                    message: b.BaoTuanSettingNS.getIsSurperUserOnly() ? "已成功开启自动抱团" : "已成功开启自动抱团/插队",
                    duration: 4e3,
                    onCancle: () => {
                        console.log("click cancle")
                    }
                };
                yield c.client.callServerFunction("ShowToast", t)
            })
        }

        enterBaotuanAcclerate(t, e, i) {
            let n = p.default.getTask(e);
            if (n) {
                switch (n.getVipTask().getVipEnterType()) {
                    case a.VipDownloadDefineNS.VipTaskType.Try:
                    case a.VipDownloadDefineNS.VipTaskType.Ad:
                        return
                }
                n.getTaskStatus() === u.DownloadKernel.TaskStatus.Started ? n.getVipTask().getBaotuanOperation().enter(t, i) : (n.getVipTask().getBaotuanOperation().setClickTypeEx(t), h.default.startTask(e))
            }
        }

        getStaticPath() {
            return x.join(__rootDir, v.default.pluginVersion, "static")
        }

        onTaskKickOut(t) {
            return n(this, void 0, void 0, function* () {
                if (A.info("onTaskKickOut", t), !1 === b.BaoTuanSettingNS.getkickOutTaskAB()) return void A.info("服务端控制功能灰度，pid哈希256尾号 onTaskKickOut return", t);
                (yield this.notifyFrameOrTray()) && this.kickOutTask.set(t, !0)
            })
        }

        notifyFrameOrTray() {
            return n(this, void 0, void 0, function* () {
                let t = !0, e = yield c.client.callServerFunction("GetMainWindowStates");
                A.info("notifyFrameOrTray");
                do {
                    if (!e) break;
                    if (e.visible) {
                        if (e.focused && e.foreground) {
                            A.info("迅雷进程前台显示中，不做操作"), t = !1;
                            break
                        }
                        A.info("迅雷进程可见但不在前台，存在任务栏图标，任务栏闪烁"), N.BaotuanStatNS.showKickOutBigIcon(), yield c.client.callServerFunction("FlashFrame", () => {
                            A.info("FlashFrame on mainwindow active"), this.notifyBaotuanDetailWebPage("big_icon"), N.BaotuanStatNS.clickKickOutBigIcon()
                        })
                    } else N.BaotuanStatNS.showKickOutSmallIcon(), A.info("迅雷进程不可见且不存在任务栏图标，托盘图标闪烁"), yield c.client.callServerFunction("FlashTray", () => {
                        A.info("FlashTray on mainwindow active"), this.notifyBaotuanDetailWebPage("small_icon"), N.BaotuanStatNS.clickKickOutSmallIcon()
                    })
                } while (0);
                return t
            })
        }

        notifyBaotuanDetailWebPage(t) {
            return n(this, void 0, void 0, function* () {
                let e = -1, i = 1e3, n = !1;
                this.kickOutTask.forEach((t, s) => {
                    let o = p.default.getTask(s);
                    if (o) {
                        let t = o.getTaskBase(), r = t.downloadSize / t.fileSize, l = f.default.getBaotuanDetail(s);
                        n ? r < i && (e = s, i = r) : l && (o.getVipTask().getShowedXgt() === a.VipDownloadDefineNS.XgtType.Baotuan ? (n = !0, i = r, e = s) : r < i && (e = s, i = r))
                    }
                }), -1 !== e && this.openBaotuanDetailPage(e, t), this.kickOutTask.clear()
            })
        }

        openBaotuanDetailPage(t, e) {
            let i = p.default.getTask(t);
            i && i.select(), setTimeout(() => {
                c.client.callServerFunction("FireEventFunction", "OnSwitchDetail", t, "huddle", e)
            }, 500)
        }

        openVipTab(...t) {
            let e = "https://paypay.xunlei.com/pay.html?", i = JSON.parse(t[0]);
            if (i) {
                let t = Object.getOwnPropertyNames(i);
                for (const i in t) e += `${i}=${t[i]}&`
            }
            this.openPayVipUrl(e)
        }

        openPayVipUrl(t) {
            return n(this, void 0, void 0, function* () {
                A.info("openPayVipUrl", t);
                do {
                    if (-1 === t.indexOf("pay.xunlei.com")) {
                        c.client.callServerFunction("openNewTab", t), this.bringMainWndToTop();
                        break
                    }
                    if (yield this.isPayVipByDialog()) {
                        if (yield this.openPayDialog(t)) break;
                        if (!d.default.isLogin) return void c.client.callServerFunction("ShowLoginDlg");
                        let e = {
                            business: "PayVipDialog",
                            url: `${t}&is-pay-vip-by-dialog=1`,
                            title: "迅雷支付中心",
                            width: 860,
                            height: 550,
                            leftMargin: 0,
                            rightMargin: 0,
                            topMargin: 30,
                            bottomMargin: 0,
                            onShowCallback: () => n(this, void 0, void 0, function* () {
                                return yield c.client.callServerFunction("RegisterWebFunction", "PayVipDialog", "ClosePayVipDialog", () => {
                                    A.info("ClosePayVipDialog"), c.client.callServerFunction("CloseWebWnd", "PayVipDialog").catch()
                                }), !0
                            })
                        };
                        c.client.callServerFunction("CreateWebWndEx", e);
                        break
                    }
                    c.client.callServerFunction("openNewTab", `${t}&is-pay-vip-by-dialog=0`), this.bringMainWndToTop();
                    break
                } while (0)
            })
        }

        openPayDialog(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1;
                do {
                    if (this.isShowingPayWnd) {
                        e = !0, this.payDialog && this.payDialog.focus();
                        break
                    }
                    let n = x.join(__rootDir, "../VipPayCenter/config.json"), a = yield P.FileSystemAWNS.readFileAW(n);
                    if (a) try {
                        let n = JSON.parse(a.toString());
                        if (n && n.main && n.dialogWidth && n.dialogHeight) {
                            let a = x.join(__rootDir, "../VipPayCenter", n.main, "../pay.html");
                            if (!(yield P.FileSystemAWNS.existsAW(a))) {
                                A.info("payHtmlPath", a, "no exits");
                                break
                            }
                            if (t.indexOf("?") > 1) {
                                a += t.substring(t.indexOf("?"))
                            }
                            if (!1 !== n.isShowLoginDialog && !d.default.isLogin) {
                                c.client.callServerFunction("ShowLoginDlg");
                                break
                            }
                            let s = yield(yield B.asyncRemoteCall.getCurrentWindow()).getBounds(),
                                o = s.x + (s.width - n.dialogWidth) / 2, r = s.y + (s.height - n.dialogHeight) / 2;
                            o + n.dialogWidth > screen.availWidth && (o = screen.availWidth - n.dialogWidth), o < 0 && (o = 0), r + n.dialogHeight > screen.height && (r = screen.availHeight - n.dialogHeight), r < 0 && (r = 0);
                            let l = yield B.asyncRemoteCall.getBrowserWindow();
                            this.payDialog = yield new l({
                                icon: `${__rootDir}/../../static/thunder11.ico`,
                                x: Math.round(o),
                                y: Math.round(r),
                                width: n.dialogWidth,
                                height: n.dialogHeight,
                                modal: !1,
                                frame: !1,
                                center: !0,
                                parent: null,
                                show: !1,
                                resizable: !1,
                                webPreferences: {nodeIntegration: !0}
                            }), i(33).ipcRenderer.send("create-shadow-window", this.payDialog.id, 0), this.isShowingPayWnd = !0, this.payDialog.once("ready-to-show", () => {
                                this.payDialog.show()
                            }), this.payDialog.on("close", () => {
                                this.isShowingPayWnd = !1, this.payDialog = null
                            }), n.devtol && this.payDialog.webContents.openDevTools(), this.payDialog.loadURL(a), e = !0;
                            break
                        }
                    } catch (t) {
                    }
                } while (0);
                return e
            })
        }

        bringMainWndToTop() {
            c.client.callServerFunction("BringMainWndToTop")
        }

        isPayVipByDialog() {
            return n(this, void 0, void 0, function* () {
                let t = !1;
                if (yield c.client.callServerFunction("IsRemoteGlobalConfigInitFinish")) {
                    t = 1 === (yield c.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "pc_xlx_open_pay_switch", 0))
                }
                return t
            })
        }

        onPackageStateChange(t, ...e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                switch (t !== F.PackageTryDefineNS.State.ready && (this.packageTryWnd && !(yield this.packageTryWnd.isDestroyed()) && this.packageTryWnd.close(), this.packageTryWnd = null), t) {
                    case F.PackageTryDefineNS.State.ready:
                        i = yield c.client.callServerFunction("GetValue", "VipDownload", "ShowPackageTryReadyWebWnd", !1), A.info("ShowPackageTryReadyWebWnd", i), !i && (yield this.allowPopMutualNow(U.PackageTry)) && (this.packageTryWnd = yield this.showPopupWnd(U.PackageTry, e, 0));
                        break;
                    case F.PackageTryDefineNS.State.finish:
                        i = yield c.client.callServerFunction("GetValue", "VipDownload", "ShowPackageTryFinishWebWnd", !1), A.info("ShowPackageTryFinishWebWnd", i);
                        let n = Number(e[0]), a = Number(e[1]), s = a - n;
                        if (a <= 0) {
                            A.info("vipSpeed is less than 0");
                            break
                        }
                        let o = m.default.getValue("VipDownload", "MixTryFinishMiniWebMinPromotePercent");
                        if (n > 0 && 100 * s / n < o) {
                            A.info("platinumPromote or vipPromote is less than", o);
                            break
                        }
                        if (E.default.isBeginFromPlay) {
                            A.info("packagetry.isBeginFromPlay and not show packagetry finish");
                            break
                        }
                        i || this.showPopupWnd(U.PackageTryFinish, e, 0).catch()
                }
            })
        }

        onUserLogin(...t) {
            return n(this, void 0, void 0, function* () {
                this.isShowingPayWnd && this.payDialog && !(yield this.payDialog.isDestroyed()) && this.payDialog.focus()
            })
        }

        allowPopMutualNow(t) {
            return n(this, void 0, void 0, function* () {
                let e = !0, i = this.getPopViewFromPopupType(t);
                return i && (yield c.client.checkServerFunction("AllowPopMutualNow")) && (e = yield c.client.callServerFunction("AllowPopMutualNow", i)), A.info("allowPopMutualNow", t, i, e), e
            })
        }

        popMutualCreated(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = this.getPopViewFromPopupType(t);
                i && (yield c.client.checkServerFunction("PopMutualCreated")) && (A.info("PopMutualCreated", i), c.client.callServerFunction("PopMutualCreated", i, e ? "auto" : ""))
            })
        }

        closePopMutual(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.getPopViewFromPopupType(t);
                e && (yield c.client.checkServerFunction("ClosePopMutual")) && (A.info("ClosePopMutual", e), c.client.callServerFunction("ClosePopMutual", e))
            })
        }

        getPopViewFromPopupType(t) {
            let e = null;
            switch (t) {
                case U.BaotuanBaoHuVip:
                case U.BaotuanCutLineOut:
                    break;
                case U.BaotuanNoviceGuid:
                    e = L.VIP_HUDDLE_NOVICE_GUIDE;
                    break;
                case U.PackageTry:
                    e = L.VIP_TRY_GUIDE;
                    break;
                case U.PackageTryFinish:
            }
            return e
        }
    }

    e.UiHelper = X, e.default = new X
}, function (t, e, i) {
    t.exports = i(63)
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), e.assert = e.log = e.error = e.warn = e.info = e.trace = e.timeEnd = e.time = e.traceback = void 0;
    const n = i(11);
    let a, s = console;

    function o(t = 5) {
        let e = /at\s+(.*)\s+\((.*):(\d*):(\d*)\)/i, i = /at\s+()(.*):(\d*):(\d*)/i,
            a = (new Error).stack.split("\n").slice(t + 1);
        a.shift();
        let s = [];
        return a.forEach((t, a) => {
            let o = e.exec(t) || i.exec(t), r = {};
            o && 5 === o.length && (r.method = o[1], r.path = o[2], r.line = o[3], r.pos = o[4], r.file = n.basename(r.path), s.push(r))
        }), s
    }

    if (a = "renderer" === process.type ? "[Renderer] [async-remote]:" : "browser" === process.type ? "[Browser] [async-remote]:" : `[${process.type}] [async-remote]`, e.traceback = function (t = 5) {
        return o(t).map(t => t.method + "@(" + t.file + ")").join(" <= ")
    }, e.time = function (...t) {
        s.time(...t)
    }, e.timeEnd = function (...t) {
        s.timeEnd(...t)
    }, e.trace = function (...t) {
        let e = o(), i = "";
        e[0] && e[0].method && (i = i), s.trace(a, ...t)
    }, e.info = function (...t) {
        let e = o(), i = "anonymous";
        e[0] && e[0].method && (i = i), s.info(a, "[" + i + "]", t.join(","))
    }, e.warn = function (...t) {
        let e = o(), i = "";
        e[0] && e[0].method && (i = i), s.warn("<WARN>" + a, "[" + i + "]", t.join(","))
    }, e.error = function (...t) {
        let e = o(), i = "";
        e[0] && e[0].method && (i = i), s.error("<ERROR>" + a, "[" + i + "]", t.join(","))
    }, e.log = function (...t) {
        s.log(a, ...t)
    }, e.assert = function (t, e) {
        if (!t) throw new Error(e)
    }, !process.env.DEBUG_ASYNC_REMOTE) {
        let t = function () {
        };
        e.traceback = t, e.time = t, e.timeEnd = t, e.trace = t, e.info = t, e.warn = t, e.error = t, e.log = t, e.assert = t
    }
}, function (t, e) {
    t.exports = require("electron")
}, function (t, e) {
    t.exports = require("util")
}, function (t, e) {
    t.exports = require("os")
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), e.information = ((...t) => {
    }), e.error = ((...t) => {
    }), e.warning = ((...t) => {
    }), e.critical = ((...t) => {
    }), e.verbose = ((...t) => {
    })
}, function (t, e, i) {
    "use strict";
    t.exports = function (t, e) {
        return function () {
            for (var i = new Array(arguments.length), n = 0; n < i.length; n++) i[n] = arguments[n];
            return t.apply(e, i)
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = i(68);
    t.exports = function (t, e, i, a, s) {
        var o = new Error(t);
        return n(o, e, i, a, s)
    }
}, function (t, e, i) {
    "use strict";
    t.exports = function (t) {
        return !(!t || !t.__CANCEL__)
    }
}, function (t, e, i) {
    "use strict";

    function n(t) {
        this.message = t
    }

    n.prototype.toString = function () {
        return "Cancel" + (this.message ? ": " + this.message : "")
    }, n.prototype.__CANCEL__ = !0, t.exports = n
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(213), a = i(151), s = i(8), o = i(2), r = i(1);

    class l {
        constructor() {
            this.mTryTaskId = void 0, this.mLeftCount = 100, this.mTasks = new Map, this.mIsAdUser = !1
        }

        get taskId() {
            return this.mTryTaskId
        }

        get chances() {
            return this.mLeftCount
        }

        get isAdUser() {
            return this.mIsAdUser
        }

        setQueryData(t, e, i) {
            let n = this.createTask(t);
            void 0 !== i.leftCount && (this.mLeftCount = i.leftCount), this.mIsAdUser = i.isAdUser, 0 === i.result && (n.subId = e, n.trialKey = i.trialKey, n.createTime = r.default.currentTime, n.expireTime = i.expireTime, i.type === s.VipDownloadDefineNS.TryType.MixVip && (n.trySection = s.VipDownloadDefineNS.TryType.PlatinumVip), n.type = i.type, n.isAdUser = i.isAdUser, n.leftCount = i.leftCount)
        }

        setTaskId(t) {
            this.mTryTaskId = t
        }

        removeTaskId(t) {
            this.mTryTaskId === t && (this.mTryTaskId = void 0)
        }

        setCommitData(t, e) {
            let i = this.getTask(t);
            if (i) if (i.commited = !0, i.commitData = e, 0 !== e.result) i.error = e; else {
                i.error = null, i.trialVerify = e.verify, i.platinumVerify = e.baijinVerify, this.mLeftCount -= 1;
                let t = {tryDate: (new Date).toDateString(), tryType: i.type};
                a.TryTaskDataBaseNS.setTask(this.taskId, t);
                let n = r.default.currentTime;
                o.client.callServerFunction("SetValue", "VipDownload", "LastTryEnterTime", n).catch()
            }
        }

        createTask(t) {
            let e = new n.TaskCache;
            return this.mTasks.set(t, e), e
        }

        getTask(t) {
            return this.mTasks.get(t)
        }

        removeTask(t, e) {
            e && a.TryTaskDataBaseNS.removeTask(t), this.mTasks.delete(t)
        }
    }

    e.TryCacheManager = l, e.default = new l
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e;
        !function (t) {
            t[t.Commit = 0] = "Commit", t[t.Status = 1] = "Status", t[t.Token = 2] = "Token", t[t.Acclerate = 3] = "Acclerate"
        }(e = t.ErrorStep || (t.ErrorStep = {}))
    }(e.HttpDefineNS || (e.HttpDefineNS = {})), function (t) {
        let e = new Map;
        t.getMessage = function (t) {
            return e.get(t)
        }, t.errorOk = 0, e.set(t.errorOk, "成功"), t.errorConnect = -1, e.set(t.errorConnect, "服务器响应超时"), t.errorStatusCode = -2, e.set(t.errorStatusCode, "网络连接异常"), t.errorData = -3, e.set(t.errorData, "服务器响应异常"), t.errorPrase = -4, e.set(t.errorPrase, "服务器响应异常"), t.errorParam = -5, e.set(t.errorParam, "服务器响应异常")
    }(e.HttpErrorNS || (e.HttpErrorNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(0), o = i(93), r = i(162), l = i(9), u = i(13), c = i(3), d = i(1), h = i(163), f = i(7),
        p = i(86), g = i(44), S = i(54), y = i(45), T = s.default.getLogger("PackageTry");
    var k;
    !function (t) {
        t.running = "running", t.deleted = "deleted"
    }(k || (k = {}));

    class m extends l.EventEmitter {
        constructor() {
            super(...arguments), this.packageTimesResponse = null, this.downloadVipPack = {
                openswitch: !1,
                card_after_showtime: 300,
                blanking_time: 1800,
                xgt_show: 1,
                order: "112",
                s_openswitch: !1,
                sweep_light: !0,
                cloud_dl: !0
            }, this.state = y.PackageTryDefineNS.State.none, this.runningTimer = null, this.finishTimer = null, this.activeTask = null, this.activeTaskInto = !1, this.channelSpeeds = new Map, this.tasks = new Map, this.accleratedTasks = new Map, this.tryingTasks = new Map, this.baotuaningTasks = new Map, this.cloudTasks = new Map, this.pacageTryTick = 0, this.acclerated = !1, this.attachGlobal = !1, this.recordGlobal = !1, this.tasksGcid = new Map, this.ingSpeedShadow = null, this.limitTask = null, this.finishAfterOneMinTimer = null, this.trialLeftTimes = 0, this.trialUsedTimes = 0
        }

        init() {
            return n(this, void 0, void 0, function* () {
                (yield a.client.callServerFunction("IsRemoteGlobalConfigInitFinish")) ? this.loadVipDownloadVipPack().catch() : a.client.attachServerEvent("OnRemoteGlobalConfigLoaded", () => n(this, void 0, void 0, function* () {
                    this.loadVipDownloadVipPack().catch()
                })), this.packageTimesResponse = yield o.default.packageTimes(), T.info("packageTimesResponse", this.packageTimesResponse)
            })
        }

        loadVipDownloadVipPack() {
            return n(this, void 0, void 0, function* () {
                let t = yield a.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "download_vip_pack", this.downloadVipPack);
                this.downloadVipPack = {
                    openswitch: t.openswitch,
                    card_after_showtime: t.card_after_showtime,
                    blanking_time: u.default.getValue("VipDownload", "TryInterval"),
                    xgt_show: t.xgt_show,
                    order: t.order,
                    s_openswitch: t.s_openswitch,
                    sweep_light: void 0 === t.sweep_light || t.sweep_light,
                    cloud_dl: void 0 === t.cloud_dl || t.cloud_dl
                }, T.info("loadVipDownloadVipPack", this.downloadVipPack)
            })
        }

        get openPackageTry() {
            return c.default.isVip && !c.default.isSuperVip ? this.downloadVipPack.s_openswitch : (this.downloadVipPack.openswitch || this.downloadVipPack.s_openswitch) && !c.default.isVip
        }

        get cardAfterAhowtime() {
            return this.downloadVipPack.card_after_showtime
        }

        get responseOk() {
            return this.packageTimesResponse && 0 === this.packageTimesResponse.result
        }

        get packegTryTime() {
            return this.responseOk ? this.packageTimesResponse.try_length : 60
        }

        get leftTimes() {
            return this.responseOk ? this.packageTimesResponse.left : 0
        }

        get leftPlayTimes() {
            return this.trialLeftTimes
        }

        get sweepLight() {
            return this.downloadVipPack.sweep_light
        }

        get isPackageRunning() {
            return this.packageState === y.PackageTryDefineNS.State.runing
        }

        get xgtShowSwitch() {
            if (this.isBeginFromPlay) return y.PackageTryDefineNS.XgtShowSwitch.none;
            switch (this.downloadVipPack.xgt_show) {
                case 2:
                    return y.PackageTryDefineNS.XgtShowSwitch.justone;
                case 3:
                    return y.PackageTryDefineNS.XgtShowSwitch.alltask;
                default:
                    return y.PackageTryDefineNS.XgtShowSwitch.none
            }
        }

        get isBeginFromPlay() {
            return !1
        }

        get isSurperPackget() {
            if (!this.downloadVipPack.s_openswitch) return !1;
            if (!this.downloadVipPack.openswitch) return !0;
            if (c.default.isVip) return !0;
            let t = 0;
            switch (this.state) {
                case y.PackageTryDefineNS.State.none:
                case y.PackageTryDefineNS.State.ready:
                case y.PackageTryDefineNS.State.commiting:
                case y.PackageTryDefineNS.State.commifailed:
                    t = Number(this.packageTimesResponse ? this.packageTimesResponse.used : 0);
                    break;
                default:
                    t = Number(this.packageTimesResponse ? this.packageTimesResponse.used - 1 : 0)
            }
            return !!(this.downloadVipPack.order && this.downloadVipPack.order.length > t) && "2" === this.downloadVipPack.order.charAt(t)
        }

        tryShowPackageTry(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = "ok", n = !1;
                this.packageStop && (e.info("tryShowPackageTry", "PackageTryState.none"), this.packageState = y.PackageTryDefineNS.State.none);
                do {
                    if (!this.packageNone) {
                        i = "packageNone false " + this.state;
                        break
                    }
                    if (!this.openPackageTry) {
                        i = "openPackageTry false";
                        break
                    }
                    if (this.leftTimes <= 0) {
                        i = "leftTimes 0";
                        break
                    }
                    if (t.getVipTask().getIsCloudTask() && !this.downloadVipPack.cloud_dl) {
                        i = "IsCloudTask cloud_dl false";
                        break
                    }
                    if (t.getTaskStatus() !== f.DownloadKernel.TaskStatus.Started) {
                        i = "task no started";
                        break
                    }
                    let s = yield a.client.callServerFunction("GetValue", "VipDownload", "LastTryEnterTime", 0);
                    if (d.default.currentTime - s < this.downloadVipPack.blanking_time) {
                        i = "blanking_time";
                        break
                    }
                    if (!(yield this.canQueryBaotuan(t, e))) {
                        i = "baotuanPrepare false";
                        break
                    }
                    if (null !== this.activeTask) {
                        i = "have activeTask " + this.activeTask.taskTitle();
                        break
                    }
                    n = !0
                } while (0);
                return n && (this.clear("tryOk"), this.activeTask = t, this.packageState = y.PackageTryDefineNS.State.ready), e.info("tryShowPackageTry", i), n
            })
        }

        tryHidePackageTry(t, e) {
            e.info("tryHidePackageTry"), t.getTaskId() === this.activePackageTaskId && this.packageReady && this.clear("tryHidePackageTry")
        }

        get activePackageTask() {
            return this.activeTask
        }

        get activePackageTaskId() {
            return this.activeTask ? this.activeTask.getTaskId() : 0
        }

        get todayUseing() {
            return this.responseOk ? this.packageTimesResponse.used + 1 : 1
        }

        get isHaveCloudTask() {
            return S.default.startedCount > 0
        }

        isPackagetTryTask(t) {
            return this.tasks.has(t.getTaskId())
        }

        stopPackagTry(t) {
            this.clear("stopPackagTry " + t), this.state = y.PackageTryDefineNS.State.stop
        }

        clear(t) {
            T.info("clear", "PackageTryState.none", t), this.packageState = y.PackageTryDefineNS.State.none, this.emit(y.PackageTryDefineNS.Event.acclerateUpdate, -1, y.PackageTryDefineNS.Acclerate.none), this.activeTask = null, this.acclerated = !1, this.tasks.clear(), this.channelSpeeds.clear(), this.accleratedTasks.clear(), this.tryingTasks.clear(), this.baotuaningTasks.clear(), this.cloudTasks.clear(), this.tasksGcid.clear(), this.ingSpeedShadow = null, this.limitTask = null, this.runningTimer && (clearInterval(this.runningTimer), this.runningTimer = null), this.finishTimer && (clearTimeout(this.finishTimer), this.finishTimer = null), this.finishAfterOneMinTimer && (clearTimeout(this.finishAfterOneMinTimer), this.finishAfterOneMinTimer = null)
        }

        beginPackageTry(t, e) {
            return n(this, void 0, void 0, function* () {
                if (!this.packageReady) return void T.info("can not intoPackageTry by", t);
                this.limitTask = e || null, p.PackageTryStatNS.click(this.todayUseing, t, this.isSurperPackget, this.isHaveCloudTask).catch(), this.packageState = y.PackageTryDefineNS.State.commiting, T.info("intoPackageTry by", t), this.fireProgress();
                let i = yield o.default.setPackageTimes();
                if (!i || 0 !== i.result) return this.packageState = y.PackageTryDefineNS.State.commifailed, T.info("setPackageTimes failed", i), void this.clear("commifailed");
                this.packageTimesResponse.used = i.used, this.packageTimesResponse.left = i.left, this.packageState = y.PackageTryDefineNS.State.runing, a.client.callServerFunction("SetValue", "VipDownload", "LastTryEnterTime", d.default.currentTime).catch(), this.isSurperPackget && (T.info("kuainiaoManager enter"), g.default.enter().catch()), this.runningTimer && (clearInterval(this.runningTimer), this.runningTimer = null), this.pacageTryTick = 0, this.runningTimer = setInterval(() => {
                    let t = !0;
                    this.tasks.forEach(e => {
                        e.getTaskStatus() === f.DownloadKernel.TaskStatus.Started && (t = !1)
                    }), !t && this.acclerating && this.pacageTryTick++, this.fireProgress(), this.pacageTryTick > 0 && this.emit(y.PackageTryDefineNS.Event.progessUpdate, .5 * this.pacageTryTick, this.packegTryTime, this.accleratingNum, this.groupingNum, this.cloudTaskNum, this.pacageTryTick), (this.pacageTryTick >= 2 * this.packegTryTime || 0 === this.tasks.size && this.activeTaskInto) && (clearInterval(this.runningTimer), this.runningTimer = null, this.tasks.forEach(t => {
                        this.addSectionSpeed("vip", t, null)
                    }), this.packageState = y.PackageTryDefineNS.State.finish, this.emit(y.PackageTryDefineNS.Event.acclerateUpdate, -1, y.PackageTryDefineNS.Acclerate.none), this.finishTimer && (clearTimeout(this.finishTimer), this.finishTimer = null), this.finishTimer = setTimeout(() => {
                        this.packageState = y.PackageTryDefineNS.State.over, clearTimeout(this.finishTimer), this.finishTimer = null
                    }, 1e3 * this.cardAfterAhowtime), this.recordGlobalSpeed("after"), this.isBeginFromPlay ? this.fireFinishAfterOneMin() : setTimeout(() => n(this, void 0, void 0, function* () {
                        this.recordGlobal = !1, this.isBeginFromPlay || p.PackageTryStatNS.after3Min(yield this.downloadNum(), this.accNum, this.groupNum, this.accBcNum, this.beforeSpeed, this.ingSpeed, this.afterSpeed, this.gcidSet, this.isSurperPackget, this.isHaveCloudTask).catch()
                    }), 12e4))
                }, 500)
            })
        }

        fireFinishAfterOneMin() {
        }

        fireProgress() {
        }

        get packageRuning() {
            return this.state === y.PackageTryDefineNS.State.runing
        }

        get packageReady() {
            return this.state === y.PackageTryDefineNS.State.ready
        }

        get packageNone() {
            return this.state === y.PackageTryDefineNS.State.none
        }

        get packageOver() {
            return this.state === y.PackageTryDefineNS.State.over
        }

        get packageStop() {
            return this.state === y.PackageTryDefineNS.State.stop
        }

        get packageFinish() {
            return this.state === y.PackageTryDefineNS.State.finish
        }

        get packageCommifailed() {
            return this.state === y.PackageTryDefineNS.State.commifailed
        }

        get packageCommiting() {
            return this.state === y.PackageTryDefineNS.State.commiting
        }

        get packageState() {
            return this.state
        }

        get packageTryPlayNum() {
            return this.packageReady ? this.trialUsedTimes : this.trialUsedTimes + 1
        }

        get gcidSet() {
            let t = "";
            return this.tasksGcid.forEach(e => {
                "" === t ? t = e : t += `|${e}`
            }), t
        }

        reinit(t) {
            this.clear(t + " reinit")
        }

        set packageState(t) {
            switch (T.info("change packageState", this.state, t), this.state = t, t) {
                case y.PackageTryDefineNS.State.finish:
                    let e = this.getSectionSpeed();
                    this.emit(y.PackageTryDefineNS.Event.stateChange, t, e[0], e[1], this.getSaveTime(e[0]), this.isSurperPackget);
                    let i = u.default.getValue("VipDownload", "MixTryFinishMiniWebMinPromotePercent");
                    a.client.broadcastEvent(y.PackageTryDefineNS.Event.stateChange, t, {
                        beginFrom: "",
                        tryNum: this.packageTryPlayNum,
                        beforeSpeed: e[0],
                        tryingSpeed: e[1],
                        percent: i,
                        canPlayTry: !1,
                        isSurperPackget: this.isSurperPackget
                    });
                    break;
                default:
                    this.emit(y.PackageTryDefineNS.Event.stateChange, t, this.isSurperPackget);
                    let n = void 0;
                    t === y.PackageTryDefineNS.State.commiting && (n = this.beforeSpeed), a.client.broadcastEvent(y.PackageTryDefineNS.Event.stateChange, t, {
                        beginFrom: "",
                        canPlayTry: !1,
                        tryNum: this.packageTryPlayNum,
                        beforeSpeed: n,
                        isSurperPackget: this.isSurperPackget
                    })
            }
        }

        getChannelSpeed(t) {
            let e = 0;
            return t && t.length && t.forEach(t => {
                let i = 0;
                t.size && t.time && (i = Math.floor(t.size / t.time)), e += i
            }), e
        }

        getSectionSpeed() {
            let t = this.channelSpeeds.get("normal"), e = this.channelSpeeds.get("vip"),
                i = this.channelSpeeds.get("after");
            return [Math.max(this.getChannelSpeed(t), 10), Math.max(this.getChannelSpeed(e), 10), Math.max(this.getChannelSpeed(i), 10)]
        }

        getSaveTime(t) {
            let e = 0;
            this.tasks.forEach(t => {
                let i = t.getTaskBase();
                i && (e += i.fileSize)
            });
            let i = Math.floor(e / t * .2 / 60);
            return i < 5 && (i = 5 + Math.floor(d.default.currentTime % 4)), i
        }

        addSectionSpeed(t, e, i) {
            let n = e.getVipTask().getSectionSpeed();
            if (this.channelSpeeds.has(t)) {
                this.channelSpeeds.get(t).push(n.speed)
            } else {
                let e = [n.speed];
                this.channelSpeeds.set(t, e)
            }
            n.reset(), i ? i.info("addSectionSpeed", t, n) : T.info("addSectionSpeed", t, n)
        }

        addPackageTryTask(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                do {
                    if (!this.packageRuning) {
                        e.info("!packageRuning");
                        break
                    }
                    if (t.getVipTask().getIsCloudTask() && !this.downloadVipPack.cloud_dl) {
                        e.info("cloud_dl false");
                        break
                    }
                    if (t.getTaskBase().taskType === f.DownloadKernel.TaskType.Group) {
                        e.info("this task is group task!");
                        break
                    }
                    if (this.limitTask && t.getTaskId() !== this.limitTask.getTaskId()) {
                        e.info("not limit task", this.limitTask.getTaskId(), t.getTaskId());
                        break
                    }
                    if (t.getTaskStatus() === f.DownloadKernel.TaskStatus.Started) {
                        i = !0;
                        break
                    }
                    if (t.getTaskId() === this.activePackageTaskId) {
                        e.info("activePackageTaskId"), a.client.callServerFunction("OperateTask", this.activePackageTaskId, "continue", null).catch();
                        break
                    }
                } while (0);
                i && (e.info("addPackageTryTask"), this.tasks.set(t.getTaskId(), t), t.getVipTask().getIsCloudTask() ? (this.acclerated = !0, this.cloudTasks.set(t.getTaskId(), k.running), this.emit(y.PackageTryDefineNS.Event.acclerateUpdate, t.getTaskId(), y.PackageTryDefineNS.Acclerate.baotuan)) : (yield this.packagetryGotoBaotuan(t, e), yield this.packagetryGotoTry(t, e)), t.getTaskId() === this.activePackageTaskId && (this.activeTaskInto = !0))
            })
        }

        delPackageTryTask(t, e, i) {
            return n(this, void 0, void 0, function* () {
                e.info("delPackageTryTask", i, this.packageState, "taskId", t.getTaskId(), "activePackageTaskId", this.activePackageTaskId);
                let n = t.getTaskId();
                this.tasks.has(n) && (this.addSectionSpeed("vip", t, null), this.tasks.delete(n), this.accleratedTasks.delete(n), this.baotuaningTasks.set(n, k.deleted), this.tryingTasks.set(n, k.deleted), this.cloudTasks.delete(n), e.info("exitPackageTryTask", "by", i)), (this.packageReady || this.packageCommiting) && this.activePackageTaskId === n && (T.info("delPackageTryTask", "PackageTryState.none"), this.packageState = y.PackageTryDefineNS.State.none, this.activeTask = null, this.emit(y.PackageTryDefineNS.Event.activeTaskDel, n))
            })
        }

        onDcdnResultCallback(t, e, i, n) {
            if (this.tasks.has(t.getTaskId())) {
                switch (i) {
                    case f.DownloadKernel.DcdnStatusCode.Success:
                    case f.DownloadKernel.DcdnStatusCode.ResourceNotFound:
                    case f.DownloadKernel.DcdnStatusCode.ForbidByCopyright:
                    case f.DownloadKernel.DcdnStatusCode.ForbidByPorNoGraphy:
                    case f.DownloadKernel.DcdnStatusCode.ForbidByReactionary:
                    case f.DownloadKernel.DcdnStatusCode.ForbidByOtherFilter:
                        this.acclerated = !0, this.accleratedTasks.has(t.getTaskId()) || (this.accleratedTasks.set(t.getTaskId(), !0), this.addSectionSpeed("normal", t, n), this.emit(y.PackageTryDefineNS.Event.progessUpdate, .5 * this.pacageTryTick, this.packegTryTime, this.accleratingNum, this.groupingNum))
                }
                n.info("packageTry", "onDcdnResultCallback", i, this.acclerated)
            }
        }

        isTaskAcclerating(t) {
            return this.accleratedTasks.has(t)
        }

        isCloudAcclerating(t) {
            return this.cloudTasks.has(t)
        }

        get acclerating() {
            return this.acclerated
        }

        canQueryBaotuan(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                do {
                    let n = this.baotuanSubId(t, e);
                    if (void 0 === n) {
                        e.info("baotuanSubId is null");
                        break
                    }
                    let a = t.getTaskBase();
                    if (a.taskType === f.DownloadKernel.TaskType.Group) {
                        e.info("this task is group task!");
                        break
                    }
                    let s = t.getFile(n);
                    if (!a || !s) {
                        e.info("taskBase or file is null", a, s, n);
                        break
                    }
                    let o = "";
                    if (1 === (a.taskType === f.DownloadKernel.TaskType.Bt ? 1 : 0)) {
                        let i = t.getTaskDetail();
                        if (!i) {
                            e.info("taskDetail is null", a);
                            break
                        }
                        o = i.infoId
                    } else o = a.gcid;
                    if ("" === o) {
                        e.info("gcidOrInfohash is null");
                        break
                    }
                    i = !0
                } while (0);
                return i
            })
        }

        baotuanSubId(t, e) {
            let i = 0, n = void 0, a = t.getDownloadingFiles();
            for (let t of a) {
                let a = (t.fileSize || 0) - (t.downloadSize || 0);
                t.gcid && "" !== t.gcid && t.cid && "" !== t.cid && a > i ? (i = a, n = t.subId) : e.info("baotuanSubId gcid or cid null", t)
            }
            return n
        }

        packagetryGotoTry(t, e) {
            return n(this, void 0, void 0, function* () {
                e.info("packagetryGotoTry");
                do {
                    let i = this.findTrySubId(t);
                    if (void 0 === i) {
                        e.info("queryPackageTry subId undefined");
                        break
                    }
                    let a = t.getTaskBase(), s = t.getFile(i);
                    if (!a || !s) {
                        e.info("queryPackageTry subId taskBase or file null", "taskBase:", a, "file:", s);
                        break
                    }
                    let o = {
                        btTitle: 2 === a.taskType ? a.taskName : void 0,
                        file: s,
                        taskId: t.getTaskId(),
                        scene: "package_download"
                    }, r = new h.TryTaskHttpSession, l = yield r.query(o);
                    if (e.info("packagetryGotoTry query response", l), l && 0 === l.result && l.trialKey) {
                        let a = {trialKey: l.trialKey, file: s, scene: "package_download"};
                        r.commit(a).then(s => n(this, void 0, void 0, function* () {
                            e.info("packagetryGotoTry commit", "request", a, "response", s), s && 0 === s.result && (s.verify || s.baijinVerify) && (yield t.getVipTask().commitPackageTryToken([i], null, s.baijinVerify ? s.baijinVerify : s.verify), this.tryingTasks.set(t.getTaskId(), k.running), this.emit(y.PackageTryDefineNS.Event.acclerateUpdate, t.getTaskId(), y.PackageTryDefineNS.Acclerate.try))
                        })).catch()
                    }
                } while (0)
            })
        }

        findTrySubId(t) {
            let e = 0, i = void 0;
            let n = t.getDownloadingFiles();
            for (let t of n) {
                if (!t.isNeedDownload) continue;
                let n = (t.fileSize || 0) - (t.downloadSize || 0);
                t.gcid && "" !== t.gcid && t.cid && "" !== t.cid && n > 0 && n > e && (e = n, i = t.subId)
            }
            return i
        }

        packagetryGotoBaotuan(t, e) {
            return n(this, void 0, void 0, function* () {
                e.info("packagetryGotoBaotuan");
                do {
                    let i = t.getTaskBase(), a = new r.VipNetWorkData.BaoTuan.Request.Join;
                    if (a.logger = e, a.btFlag = i.taskType === f.DownloadKernel.TaskType.Bt ? 1 : 0, 1 === a.btFlag) {
                        let n = t.getTaskDetail();
                        if (!n) {
                            e.info("taskDetail is null", i);
                            break
                        }
                        a.gcidOrInfohash = n.infoId, a.url = "bt://" + n.infoId + "/0"
                    } else a.gcidOrInfohash = i.gcid, a.url = i.url;
                    if ("" === a.gcidOrInfohash) {
                        e.info("gcidOrInfohash is null");
                        break
                    }
                    this.tasksGcid.set(a.gcidOrInfohash, a.gcidOrInfohash), a.scene = "package_download", a.consume_times_flag = 0, yield o.default.join(a).then(i => n(this, void 0, void 0, function* () {
                        if (e.info("onJoinCallback", a, i), i && 0 === i.result) {
                            let e = {joinKey: i.key, isGroup: 1};
                            yield t.getVipTask().commitPackageTryToken(null, e), this.baotuaningTasks.set(t.getTaskId(), k.running), this.emit(y.PackageTryDefineNS.Event.acclerateUpdate, t.getTaskId(), y.PackageTryDefineNS.Acclerate.baotuan)
                        }
                    }))
                } while (0);
                e.info("packagetryGotoBaotuan end")
            })
        }

        downloadNum() {
            return n(this, void 0, void 0, function* () {
                let t = yield a.client.callRemoteClientFunction(d.default.pluginWebviewName, "GetDownloadingTaskCount");
                return t && t.length ? t[0] : 0
            })
        }

        get groupingNum() {
            let t = 0;
            return this.baotuaningTasks.forEach(e => {
                e === k.running && t++
            }), t
        }

        get accleratingNum() {
            let t = 0;
            return this.tryingTasks.forEach(e => {
                e === k.running && t++
            }), t
        }

        get cloudTaskNum() {
            return this.cloudTasks.size
        }

        get groupNum() {
            return this.baotuaningTasks.size
        }

        get accNum() {
            return this.tryingTasks.size
        }

        get accBcNum() {
            return Math.max(0, this.baotuaningTasks.size - this.tryingTasks.size)
        }

        get beforeSpeed() {
            return this.getSectionSpeed()[0]
        }

        get ingSpeed() {
            if (null === this.ingSpeedShadow) {
                let t = this.getSectionSpeed();
                this.ingSpeedShadow = t[1]
            }
            return this.ingSpeedShadow
        }

        get afterSpeed() {
            return this.getSectionSpeed()[2]
        }

        recordGlobalSpeed(t) {
            this.channelSpeeds.set(t, []), this.recordGlobal = !0, this.attachGlobal || (this.attachGlobal = !0, a.client.attachServerEvent("OnGlobalDownloadSpeedChanged", (e, i, a) => n(this, void 0, void 0, function* () {
                if (!this.recordGlobal) return;
                let e = {size: i, time: 1}, n = this.channelSpeeds.get(t);
                n && (0 === n.length ? n.push(e) : i && (e.size += n[0].size, e.time += n[0].time, n[0] = e))
            })))
        }

        exitPackageTryXgt() {
            this.emit(y.PackageTryDefineNS.Event.exitXgt)
        }
    }

    e.PackageTry = m, e.default = new m
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(94), s = i(9), o = i(3), r = i(2), l = i(5), u = i(0).default.getLogger("VipDownload:KuaiNiao"),
        c = "kuainiao", {isDef: d} = l.ThunderUtil;
    var h, f;
    !function (t) {
        t.statusChanged = "OnStatusChanged"
    }(h = e.KuainiaoEventNS || (e.KuainiaoEventNS = {})), function (t) {
        t[t.StatusInit = 0] = "StatusInit", t[t.StatusQueryPortal = 1] = "StatusQueryPortal", t[t.StatusQueryPortalFailed = 2] = "StatusQueryPortalFailed", t[t.StatusQueryPortalSuccess = 3] = "StatusQueryPortalSuccess", t[t.StatusQueryBand = 4] = "StatusQueryBand", t[t.StatusQueryBandFailed = 5] = "StatusQueryBandFailed", t[t.StatusQueryBandSuccess = 6] = "StatusQueryBandSuccess", t[t.StatusWaitTry = 7] = "StatusWaitTry", t[t.StatusWaitAcc = 8] = "StatusWaitAcc", t[t.StatusQueryTry = 9] = "StatusQueryTry", t[t.StatusNoTryNum = 10] = "StatusNoTryNum", t[t.StatusQueryTryFailed = 11] = "StatusQueryTryFailed", t[t.StatusQueryTrySuccess = 12] = "StatusQueryTrySuccess", t[t.StatusTrySpeedup = 13] = "StatusTrySpeedup", t[t.StatusSpeedup = 14] = "StatusSpeedup", t[t.StatusSpeedupFailed = 15] = "StatusSpeedupFailed", t[t.StatusSpeedupSuccess = 16] = "StatusSpeedupSuccess", t[t.StatusKeepAlive = 17] = "StatusKeepAlive", t[t.StatusKeepAliveFailed = 18] = "StatusKeepAliveFailed", t[t.StatusSpeeddown = 19] = "StatusSpeeddown", t[t.StatusSpeeddownFailed = 20] = "StatusSpeeddownFailed", t[t.StatusTrying = 21] = "StatusTrying", t[t.StatusTryDone = 22] = "StatusTryDone", t[t.StatusAlreadySpeedup = 23] = "StatusAlreadySpeedup", t[t.StatusBindConflict = 24] = "StatusBindConflict"
    }(f = e.KuaiNiaoStatusEnum || (e.KuaiNiaoStatusEnum = {}));

    class p extends s.EventEmitter {
        constructor() {
            super(), this.mType = a.KuaiNiaoDefineNS.KuaiNiaoType.Try, this.mStatus = a.KuaiNiaoDefineNS.KuaiNiaoStatus.Unkown, this.mDownstream = void 0, this.mCanNotTry = !1, this.mCanUseKuaiNiao = !1, this.init()
        }

        init() {
            u.info("init"), this.setMaxListeners(0), o.default.addListener(o.UserEventNS.login, () => n(this, void 0, void 0, function* () {
                yield this.onLogin()
            })), o.default.addListener(o.UserEventNS.logout, () => n(this, void 0, void 0, function* () {
                yield this.onLogout()
            })), r.client.attachServerEvent("KuaiNiaoStatusChanged", (t, e, i) => n(this, void 0, void 0, function* () {
                t && "kuainiao" === t.name && (yield this.onStatusChanged(i))
            }))
        }

        enter() {
            return n(this, void 0, void 0, function* () {
                this.mCanNotTry ? u.info("enter return mCanNotTry") : d(this.status) && this.status > a.KuaiNiaoDefineNS.KuaiNiaoStatus.Enable && this.status < a.KuaiNiaoDefineNS.KuaiNiaoStatus.Finish ? u.info("enter return status failed", this.status) : (u.info("enter"), this.status = a.KuaiNiaoDefineNS.KuaiNiaoStatus.Commiting, yield r.client.callRemoteClientFunction(c, "KuaiNiaoTrySpeed"))
            })
        }

        get status() {
            return this.mStatus
        }

        set status(t) {
            this.mStatus !== t && (this.mStatus = t, u.info(h.statusChanged, "status", t), this.emit(h.statusChanged, t))
        }

        get isTry() {
            return this.mType === a.KuaiNiaoDefineNS.KuaiNiaoType.Try
        }

        get downstreamString() {
            let t = 0;
            return this.mDownstream && (t = Math.floor(this.mDownstream / 1024)), t + "M"
        }

        get canUseKuaiNiao() {
            return this.mCanUseKuaiNiao
        }

        get authority() {
            return o.default.isSuperVip
        }

        updateKuaiNiaoType() {
            this.mType = this.authority ? a.KuaiNiaoDefineNS.KuaiNiaoType.Vip : a.KuaiNiaoDefineNS.KuaiNiaoType.Try
        }

        onLogin() {
            return n(this, void 0, void 0, function* () {
                this.updateKuaiNiaoType()
            })
        }

        onLogout() {
            return n(this, void 0, void 0, function* () {
                this.updateKuaiNiaoType()
            })
        }

        onStatusChanged(t) {
            return n(this, void 0, void 0, function* () {
                switch (u.info("KuaiNiaoStatusChanged", t), t) {
                    case f.StatusQueryBandSuccess:
                        try {
                            let t = (yield r.client.callRemoteClientFunction(c, "KuaiNiaoGetBandWidth"))[0],
                                e = JSON.parse(t);
                            u.info("bandWidth", e), e && (this.mDownstream = e.after)
                        } catch (t) {
                            u.error(t)
                        }
                        this.status = a.KuaiNiaoDefineNS.KuaiNiaoStatus.Enable, this.mCanUseKuaiNiao = !0;
                        break;
                    case f.StatusSpeedupSuccess:
                    case f.StatusTrying:
                        this.status = a.KuaiNiaoDefineNS.KuaiNiaoStatus.Alive, this.mCanUseKuaiNiao = !0;
                        break;
                    case f.StatusNoTryNum:
                    case f.StatusQueryPortalFailed:
                    case f.StatusQueryBandFailed:
                    case f.StatusQueryTryFailed:
                    case f.StatusSpeedupFailed:
                    case f.StatusBindConflict:
                        this.mCanUseKuaiNiao = !1, this.status = a.KuaiNiaoDefineNS.KuaiNiaoStatus.Failed, t === f.StatusNoTryNum && (this.mCanNotTry = !0);
                        break;
                    case f.StatusSpeeddown:
                    case f.StatusTryDone:
                        this.status = a.KuaiNiaoDefineNS.KuaiNiaoStatus.Finish
                }
            })
        }
    }

    e.KuainiaoManager = p, e.default = new p
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e, i, n, a, s;
        !function (t) {
            t.none = "PackageTry.XgtShowSwitch.none", t.justone = "PackageTry.XgtShowSwitch.justone", t.alltask = "PackageTry.XgtShowSwitch.alltask"
        }(e = t.XgtShowSwitch || (t.XgtShowSwitch = {})), function (t) {
            t.none = "PackageTry.State.none", t.ready = "PackageTry.State.ready", t.commiting = "PackageTry.State.commiting", t.commifailed = "PackageTry.State.commifailed", t.runing = "PackageTry.State.runing", t.stop = "PackageTry.State.stop", t.finish = "PackageTry.State.finish", t.over = "PackageTry.State.over"
        }(i = t.State || (t.State = {})), function (t) {
            t.none = "PackageTry.Acclerate.none", t.try = "PackageTry.Acclerate.try", t.baotuan = "PackageTry.Acclerate.baotuan", t.trybaotuan = "PackageTry.Acclerate.trybaotuan"
        }(n = t.Acclerate || (t.Acclerate = {})), function (t) {
            t.stateChange = "PackageTry.Event.stateChange", t.acclerateUpdate = "PackageTry.Event.acclerateUpdate", t.progessUpdate = "PackageTry.Event.progessUpdate", t.activeTaskDel = "PackageTry.Event.activeTaskDel", t.exitXgt = "PackageTry.Event.exitXgt", t.afterFinishOneMin = "PackageTry.Event.afterFinishOneMin"
        }(a = t.Event || (t.Event = {})), function (t) {
            t.xgt = "PackageTry.BeginFrom.xgt", t.xht = "PackageTry.BeginFrom.xht", t.play = "PackageTry.BeginFrom.play", t.popup = "PackageTry.BeginFrom.popup"
        }(s = t.BeginFrom || (t.BeginFrom = {}))
    }(e.PackageTryDefineNS || (e.PackageTryDefineNS = {}))
}, function (t, e) {
    (function () {
        var e, i, n, a, s, o, r = [].slice, l = {}.hasOwnProperty;
        e = function () {
            var t, e, i, n, s, o;
            if (o = arguments[0], s = 2 <= arguments.length ? r.call(arguments, 1) : [], a(Object.assign)) Object.assign.apply(null, arguments); else for (t = 0, i = s.length; t < i; t++) if (null != (n = s[t])) for (e in n) l.call(n, e) && (o[e] = n[e]);
            return o
        }, a = function (t) {
            return !!t && "[object Function]" === Object.prototype.toString.call(t)
        }, s = function (t) {
            var e;
            return !!t && ("function" == (e = typeof t) || "object" === e)
        }, i = function (t) {
            return a(Array.isArray) ? Array.isArray(t) : "[object Array]" === Object.prototype.toString.call(t)
        }, n = function (t) {
            var e;
            if (i(t)) return !t.length;
            for (e in t) if (l.call(t, e)) return !1;
            return !0
        }, o = function (t) {
            var e, i;
            return s(t) && (i = Object.getPrototypeOf(t)) && (e = i.constructor) && "function" == typeof e && e instanceof e && Function.prototype.toString.call(e) === Function.prototype.toString.call(Object)
        }, t.exports.assign = e, t.exports.isFunction = a, t.exports.isObject = s, t.exports.isArray = i, t.exports.isEmpty = n, t.exports.isPlainObject = o
    }).call(this)
}, , function (t, e) {
    t.exports = require("buffer")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(16), s = i(3), o = i(1), r = i(0).default.getLogger("baotuan-stat");
    !function (t) {
        let e = new Map;

        function i(t, i) {
            return !!e.has("key_" + i) || (e.set("key_" + i, "true"), !0)
        }

        function l() {
            let t = new Map, e = function () {
                let t = 0;
                s.default.isLogin && (t = 1);
                return t
            }(), i = function () {
                let t = 0;
                s.default.isVip && (t = 1);
                return t
            }(), n = function () {
                let t = 0;
                s.default.isSuperVip ? t = 5 : s.default.isPlatinumVip ? t = 3 : s.default.isVip && (t = 2);
                return t
            }();
            return t.set("is_login", e), t.set("is_vip", i), t.set("vip_type", n), t
        }

        t.showRightMenuBaoTuan = function (t, e) {
            r.info("showRightMenuBaoTuan");
            let i = l();
            i.set("state", e), i.set("remain_cut_in_line_times", t);
            let n = {attribute1: "group_dl_menu_show", extData: i};
            a.StatUtilitiesNS.trackEvent("download_leftpanel", n).catch()
        }, t.rightMenuClickBaoTuan = function (t, e, i) {
            r.info("rightMenuClickBaoTuan");
            let n = l();
            n.set("state", e), n.set("use_cut_in_line_times", i ? 1 : 0), n.set("remain_cut_in_line_times", t);
            let s = {attribute1: "group_dl_menu_click", extData: n};
            a.StatUtilitiesNS.trackEvent("download_leftpanel", s).catch()
        }, t.webShowBaoTuan = function (t, e) {
            r.info("webShowBaoTuan");
            let i = l();
            i.set("state", e), i.set("remain_cut_in_line_times", t);
            let n = {attribute1: "group_dl_right_dl_detail_icon_show", extData: i};
            a.StatUtilitiesNS.trackEvent("download_detail", n).catch()
        }, t.webClickBaoTuan = function (t, e, i) {
            r.info("webClickBaoTuan");
            let n = l();
            n.set("state", e), n.set("use_cut_in_line_times", i ? 1 : 0), n.set("remain_cut_in_line_times", t);
            let s = {attribute1: "group_dl_right_dl_detail_icon_click", extData: n};
            a.StatUtilitiesNS.trackEvent("download_detail", s).catch()
        }, t.hoverWebBaoTuan = function (t, e) {
            r.info("hoverWebBaoTuan");
            let i = l();
            i.set("state", e), i.set("remain_cut_in_line_times", t);
            let n = {attribute1: "group_dl_right_dl_detail_icon_hover", extData: i};
            a.StatUtilitiesNS.trackEvent("download_detail", n).catch()
        }, t.carIdentifyShowBaoTuan = function (t, e, i) {
            r.info("carIdentifyShowBaoTuan");
            let n = l();
            n.set("state", e), n.set("is_dl_begin", i ? 1 : 0), n.set("remain_cut_in_line_times", t);
            let s = {attribute1: "group_dl_identify_show", extData: n};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
        }, t.carIdentifyClickBaoTuan = function (t, e, i, n) {
            r.info("carIdentifyClickBaoTuan");
            let s = l();
            s.set("state", e), s.set("is_dl_begin", n ? 1 : 0), s.set("use_cut_in_line_times", i ? 1 : 0), s.set("remain_cut_in_line_times", t);
            let o = {attribute1: "group_dl_identify_click", extData: s};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", o).catch()
        }, t.showTips = function (t) {
            r.info("showTips");
            let e = l();
            e.set("from", t);
            let i = {attribute1: "group_dl_tips_show", extData: e};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", i).catch()
        }, t.showNoviceGuid = function (t, e) {
            r.info("showNoviceGuid");
            let i = l();
            i.set("from", t), i.set("trigger", e ? "auto" : "manual");
            let n = {attribute1: "group_dl_userguide_float_layer_show", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
        }, t.showTeamxgt = function (t, e) {
            if (!i(0, t)) return;
            r.info("showTeamxgt");
            let n = l();
            "" !== e && n.set("act_info", e);
            let s = {attribute1: "group_dl_group_dl_xgt_show", extData: n};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
        }, t.clickTeamxgt = function (t) {
            r.info("clickTeamxgt");
            let e = l();
            "" !== t && e.set("act_info", t);
            let i = {attribute1: "group_dl_group_dl_xgt_click", extData: e};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", i).catch()
        }, t.showCutlinexgt = function (t, e, n) {
            if (!i(0, e)) return;
            r.info("showCutlinexgt");
            let s = l();
            s.set("remain_cut_in_line_times", t), "" !== n && s.set("act_info", n);
            let o = {attribute1: "group_dl_cutinline_xgt_show", extData: s};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", o).catch()
        }, t.clickCutlinexgt = function (t, e) {
            r.info("clickCutlinexgt");
            let i = l();
            i.set("remain_cut_in_line_times", t), "" !== e && i.set("act_info", e);
            let n = {attribute1: "group_dl_cutinline_xgt_click", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
        }, t.showCutlineOutxgt = function (t, e, n) {
            if (!i(0, e)) return;
            r.info("showCutlineOutxgt");
            let s = l();
            s.set("type", t), "" !== n && s.set("act_info", n);
            let o = {attribute1: "group_dl_nodltimes_xgt_show", extData: s};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", o).catch()
        }, t.clickCutlineOutxgt = function (t, e) {
            r.info("clickCutlineOutxgt");
            let i = l();
            i.set("type", t), "" !== e && i.set("act_info", e);
            let n = {attribute1: "group_dl_nodltimes_xgt_click", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
        }, t.showOpenGuidXgt = function (t) {
            if (!i(0, t)) return;
            r.info("showOpenGuidXgt");
            let e = {attribute1: "group_dl_openguide_xgt_show", extData: l()};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", e).catch()
        }, t.clickOpenGuidXgt = function () {
            r.info("clickOpenGuidXgt");
            let t = {attribute1: "group_dl_openguide_xgt_click", extData: l()};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", t).catch()
        }, t.showKickoutXgt = function (t, e, n, s) {
            if (!i(0, e)) return;
            r.info("showKickoutXgt");
            let o = l();
            o.set("type", t), "" !== n && o.set("act_info", n), o.set("gcid", s);
            let u = {attribute1: "group_dl_delete_from_dl_xgt_show", extData: o};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", u).catch()
        }, t.clickKickoutXgt = function (t, e, i) {
            r.info("clickKickoutXgt");
            let n = l();
            n.set("type", t), "" !== e && n.set("act_info", e), n.set("gcid", i);
            let s = {attribute1: "group_dl_delete_from_dl_xgt_click", extData: n};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
        }, t.intoBaotuan = function (t, e, i, n, s, o, u, c, d, h, f) {
            r.info("intoBaotuan");
            let p = l();
            p.set("from", t), p.set("type", e), p.set("dl_avgspeed", i), p.set("resource_code", n), p.set("is_exit", s), p.set("is_exited", o), p.set("is_second", u), p.set("is_driver", c), p.set("filesize", d), p.set("restart", h), p.set("gcid", f);
            let g = {attribute1: "group_dl_join_success", extData: p};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", g).catch()
        }, t.afterIntoBaotuan = function (t, e, i, n, s, o, u, c, d, h, f) {
            r.info("afterIntoBaotuan");
            let p = l();
            p.set("from", t), p.set("type", e), p.set("dl_avgspeed", i), p.set("resource_code", n), p.set("is_exit", s), p.set("is_exited", o), p.set("is_second", u), p.set("is_driver", c), p.set("filesize", d), p.set("restart", h), p.set("gcid", f);
            let g = {attribute1: "group_dl_join_after_success", extData: p};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", g).catch()
        }, t.openAutoJoin = function (t, e) {
            r.info("openAutoJoin");
            let i = l();
            i.set("from", t), i.set("is_open", e);
            let n = {attribute1: "group_dl_open_auto_make_group", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
        }, t.openAutoCutline = function (t, e) {
            r.info("openAutoCutline");
            let i = l();
            i.set("from", t), i.set("is_open", e);
            let n = {attribute1: "group_dl_auto_cut_in_line", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
        }, t.showKickOutBigIcon = function () {
            r.info("showKickOutBigIcon");
            let t = {attribute1: "group_dl_delete_notice_big_show", extData: l()};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", t).catch()
        }, t.clickKickOutBigIcon = function () {
            r.info("showKickOutBigIcon");
            let t = {attribute1: "group_dl_delete_notice_big_click", extData: l()};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", t).catch()
        }, t.showKickOutSmallIcon = function () {
            r.info("showKickOutBigIcon");
            let t = {attribute1: "group_dl_delete_notice_small_show", extData: l()};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", t).catch()
        }, t.clickKickOutSmallIcon = function () {
            r.info("showKickOutBigIcon");
            let t = {attribute1: "group_dl_delete_notice_small_click", extData: l()};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", t).catch()
        }, t.taskStartDownload = function (t, e, i, s, u, c) {
            return n(this, void 0, void 0, function* () {
                r.info("taskStartDownload");
                let n = l();
                n.set("is_auto_group_open", t ? "open" : "close"), n.set("is_auto_cut_open", e ? "open" : "close"), null !== i && n.set("is_second", i ? 1 : 0), null !== s && n.set("is_driver", s ? 1 : 0), n.set("filesize", u), n.set("gcid", c), n.set("web_plugin_version", o.default.webPluginVersion);
                let d = {attribute1: "group_dl_task_dl_start", extData: n};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", d).catch()
            })
        }, t.succeedShowAni = function (t, e, i) {
            return n(this, void 0, void 0, function* () {
                r.info("succeedShowAni");
                let n = l();
                n.set("remain_cut_in_line_times", t), n.set("type", e), n.set("style", i);
                let s = {attribute1: "group_dl_first_succ_animation_show", extData: n};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
            })
        }, t.kickOut = function (t, e, i, s, o, u) {
            return n(this, void 0, void 0, function* () {
                r.info("group_dl_be_exit" === u ? "kickOut" : "KickOutAfter");
                let n = l();
                n.set("from", t), n.set("type", e), n.set("resource_code", s), n.set("dl_avgspeed", i), n.set("filesize", o);
                let c = {attribute1: u, extData: n};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", c).catch()
            })
        }
    }(e.BaotuanStatNS || (e.BaotuanStatNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(3), s = i(0).default.getLogger("VipDownload:ui-configure.abtest-helper"), o = i(9), r = i(2), l = i(10),
        u = i(1), c = i(27), d = i(31), h = i(20), f = i(195), p = i(22), g = i(11), S = i(17), y = i(13);
    var T;
    d.default.defaults.adapter = i(25), function (t) {
        t.configureReady = "OnConfigureReady"
    }(T = e.AbtestEventNS || (e.AbtestEventNS = {}));

    class k extends o.EventEmitter {
        constructor() {
            super(...arguments), this.mAbtest = !1, this.mAppVersion = void 0
        }

        attachUserEventsB() {
            s.info("监听B接口登录相关事件"), a.default.addListener(a.UserEventNS.login, () => n(this, void 0, void 0, function* () {
                yield this.getBinterfaceConfig("登录回调")
            })), a.default.addListener(a.UserEventNS.logout, () => n(this, void 0, void 0, function* () {
                yield this.getBinterfaceConfig("登出回调")
            }))
        }

        init() {
            return n(this, void 0, void 0, function* () {
                if (this.setMaxListeners(0), !y.default.isConfigInitFinish()) return s.info("isConfigInitFinish", !1), void y.default.once(y.ConfigEventNS.configGet, this.init.bind(this));
                this.mAbtest = !0, s.info("this.mAbtest = ", !0 === this.mAbtest), yield this.getBinterfaceConfig("Init 直接调用"), this.attachUserEventsB()
            })
        }

        getBinterfaceConfig(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.getThunderVersion(), i = u.default.thunderVersionNumber,
                    n = "xl11_hytq_gs_sy_finishpop";
                this.mAbtest && (n += ",xl11_hytq_gs_sy", n += ",xl11_hytq_cjjs_sy", n += ",xl11_hytq_cjjs_hover", n += ",xl11_hytq_cjjs_task", n += ",xl11_hytq_newcjsy", n += ",xl11_push_gs");
                let o = y.default.getValue("VipDownload", "PlayGameHash");
                o || (n += ",v_pc_xlx_youtiao_game"), n += ",xl11_vip_group_dl_right,xl11_vip_group_dl_center,xl11_vip_group_dl_before,xl11_vip_group_dl_after,xl11_vip_gdl_act", n += ",v_pc_xlx_hytq_dl_vip_pack,v_pc_xlx_hytq_dl_svip_pack", localStorage.removeItem("configdata.xlx_vip_group_dl_right"), localStorage.removeItem("configdata.xlx_vip_group_dl_center"), localStorage.removeItem("configdata.xlx_vip_group_dl_before"), localStorage.removeItem("configdata.xlx_vip_group_dl_after"), localStorage.removeItem("configdata.xlx_vip_gdl_act"), h.BaoTuanSettingNS.setUserChangWeiStatus(-1);
                let r = yield a.default.getPeerId(), d = "", f = a.default.userId, p = yield l.default.getTpPeerId();
                if (c.default.clear(), "0" !== f) {
                    d = `http://advertpay.vip.xunlei.com/xl11/advertisement?iver=${i}&over=${e}&userid=${f}&cpeerid=${p}&sessionid=${yield a.default.getSessionId()}&scene=${n}&deviceid=${r}&timestamp=${Date.now()}`
                } else d = `http://advertpay.vip.xunlei.com/xl11/advertisement?iver=${i}&over=${e}&cpeerid=${p}&scene=${n}&deviceid=${r}&timestamp=${Date.now()}`;
                s.info("请求B接口 source=", t), s.info(`请求B接口 geturl=${d}`);
                let g = yield this.query(d);
                if (c.default.setData(g), o && (yield this.getPlayGameConfig()), c.default.getItemData(c.ItemName.PlayGameText)) {
                    (yield this.queryUserHaveFinishGameTask()) && c.default.cleanPlayGameData()
                }
                this.emit(T.configureReady)
            })
        }

        getPlayGameConfig() {
            return n(this, void 0, void 0, function* () {
                let t = yield this.getThunderVersion(), e = u.default.thunderVersionNumber,
                    i = yield a.default.getPeerId(), n = S.createHash("sha256");
                n.update(i);
                let o = n.digest("hex");
                o && (i = o.toUpperCase());
                let r = "", h = a.default.userId, f = yield l.default.getTpPeerId(), p = "v_pc_xlx_youtiao_game";
                if ("0" !== h) {
                    r = `http://advertpay.vip.xunlei.com/xl11/advertisement?iver=${e}&over=${t}&userid=${h}&cpeerid=${f}&sessionid=${yield a.default.getSessionId()}&scene=${p}&deviceid=${i}&timestamp=${Date.now()}`
                } else r = `http://advertpay.vip.xunlei.com/xl11/advertisement?iver=${e}&over=${t}&cpeerid=${f}&scene=${p}&deviceid=${i}&timestamp=${Date.now()}`;
                d.default.get(r, {timeout: 1e4}).then(t => {
                    let e = null;
                    s.info("response PlayGameConfig:", t), null !== t && 200 === t.status && null !== t.data && 0 === t.data.result && t.data.data && (e = t.data.data, s.info("v_pc_xlx_youtiao_game", e.v_pc_xlx_youtiao_game), c.default.setPlayGameData(e))
                }).catch(t => {
                    s.error("err:", t)
                })
            })
        }

        query(t) {
            return n(this, void 0, void 0, function* () {
                return new Promise(e => {
                    d.default.get(t, {timeout: 1e4}).then(t => n(this, void 0, void 0, function* () {
                        let i = null;
                        if (s.info("response vipData:", t), null !== t && 200 === t.status && null !== t.data && 0 === t.data.result && t.data.data && (i = t.data.data, s.info("xl11_hytq_gs_sy_finishpop", i.xl11_hytq_gs_sy_finishpop), s.info("xl11_hytq_gs_sy", i.xl11_hytq_gs_sy), s.info("xl11_hytq_cjjs_sy", i.xl11_hytq_cjjs_sy), s.info("xl11_push_gs", i.xl11_push_gs), s.info("xl11_hytq_cjjs_hover", i.xl11_hytq_cjjs_hover), s.info("xl11_hytq_cjjs_task", i.xl11_hytq_cjjs_task), s.info("xl11_hytq_newcjsy", i.xl11_hytq_newcjsy), s.info("xl11_vip_group_dl_right", i.xl11_vip_group_dl_right), s.info("xl11_vip_group_dl_center", i.xl11_vip_group_dl_center), s.info("xl11_vip_group_dl_before", i.xl11_vip_group_dl_before), s.info("xl11_vip_group_dl_after", i.xl11_vip_group_dl_after), s.info("xl11_vip_gdl_act", i.xl11_vip_gdl_act), s.info("v_pc_xlx_youtiao_game", i.v_pc_xlx_youtiao_game), s.info("v_pc_xlx_hytq_dl_vip_pack", i.v_pc_xlx_hytq_dl_vip_pack), s.info("v_pc_xlx_hytq_dl_svip_pack", i.v_pc_xlx_hytq_dl_svip_pack), i.xl11_vip_group_dl_right && localStorage.setItem("configdata.xlx_vip_group_dl_right", JSON.stringify(i.xl11_vip_group_dl_right)), i.xl11_vip_group_dl_center && localStorage.setItem("configdata.xlx_vip_group_dl_center", JSON.stringify(i.xl11_vip_group_dl_center)), i.xl11_vip_group_dl_before && localStorage.setItem("configdata.xlx_vip_group_dl_before", JSON.stringify(i.xl11_vip_group_dl_before)), i.xl11_vip_group_dl_after && localStorage.setItem("configdata.xlx_vip_group_dl_after", JSON.stringify(i.xl11_vip_group_dl_after)), i.xl11_vip_gdl_act)) {
                            let t = yield this.queryCanJoinBaotuanChangWei();
                            h.BaoTuanSettingNS.setUserChangWeiStatus(t), h.BaoTuanSettingNS.isUserJoiningChangWei() && ((yield this.checkBaotuanResource(i.xl11_vip_gdl_act)) || h.BaoTuanSettingNS.setUserChangWeiStatus(-1))
                        }
                        e(i)
                    })).catch(t => {
                        s.error("err:", t), e(null)
                    })
                })
            })
        }

        get abTest() {
            return this.mAbtest
        }

        getThunderVersion() {
            return n(this, void 0, void 0, function* () {
                if (!this.mAppVersion) {
                    let t = yield r.client.callServerFunction("GetThunderVersion"), e = t.lastIndexOf(".");
                    this.mAppVersion = t.slice(0, e)
                }
                return this.mAppVersion
            })
        }

        queryCanJoinBaotuanChangWei() {
            return n(this, void 0, void 0, function* () {
                if ("" == a.default.userId) return -1;
                let t = `https://msg-vip-ssl.xunlei.com/baotuan/valid?userid=${a.default.userId}&sessionid=${yield a.default.getSessionId()}&client=xds`,
                    e = yield d.default.get(t, {timeout: 1e4});
                return s.info("queryCanJoinBaotuanChangWei:", e), null !== e && 200 === e.status && null !== e.data ? e.data.result : -1
            })
        }

        checkBaotuanResource(t) {
            return n(this, void 0, void 0, function* () {
                let e = [{id: "pop_pro_pic", downloadKey: "img"}, {
                    id: "pop_cut_pic",
                    downloadKey: "img"
                }, {id: "xgt_bef", downloadKey: "xgt_bpic"}, {id: "xgt_aft", downloadKey: "xgt_bpic"}, {
                    id: "xgt_pro",
                    downloadKey: "xgt_bpic"
                }], i = 0;
                for (; ;) {
                    let n = e[i];
                    if (!n) break;
                    if (!(yield this.downloadBaotuanResource(t, n.id, n.downloadKey))) return !1;
                    i++
                }
                return localStorage.setItem("configdata.xlx_vip_gdl_act", JSON.stringify(t)), !0
            })
        }

        downloadBaotuanResource(t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = 0;
                for (; ;) {
                    let a = t[n];
                    if (!a) break;
                    if (a.id === e) {
                        let t = a[i], e = void 0, n = yield r.client.callServerFunction("GetProfilesDir");
                        if (n) {
                            try {
                                e = g.resolve(n, "VipDownload/vipicon") + "/" + t.substring(t.lastIndexOf("/") + 1), s.info("savePath", e)
                            } catch (t) {
                                s.info("savePath", "error", t)
                            }
                            if (e) return a[i] = e, !!(yield p.FileSystemAWNS.existsAW(e)) || (yield f.FileDownloadNS.downloadFile(t, e))
                        }
                    }
                    n++
                }
                return !1
            })
        }

        queryUserHaveFinishGameTask() {
            return n(this, void 0, void 0, function* () {
                if ("" == a.default.userId) return !0;
                let t = !0,
                    e = `http://api-web-game-ssl.xunlei.com/game/user/task?userid=${a.default.userId}&sessionid=${yield a.default.getSessionId()}`;
                try {
                    let i = yield d.default.get(e, {timeout: 1e4});
                    if (s.info("queryUserHaveFinishGameTask:", i), null !== i && 200 === i.status && null !== i.data) {
                        let e = i.data;
                        if (0 === e.code && e.data) {
                            let i = e.data;
                            s.info("queryUserHaveFinishGameTask:taskData", i);
                            let n = 0;
                            for (; ;) {
                                let e = i[n];
                                if (!e) break;
                                0 === e.status && (t = !1), n++
                            }
                        }
                    }
                } catch (e) {
                    s.info("err", e), t = !0
                }
                return s.info("bFinish", t), t
            })
        }
    }

    e.AbtestHelper = k, e.default = new k
}, function (t, e) {
    t.exports = require("string_decoder")
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(28), a = i(11), s = i(0), o = i(1);
    let r = a.join(__rootDir, o.default.pluginVersion, "log-options.json");
    if (n.existsSync(r)) {
        const t = {label: __processName, options: r};
        s.default.start(t)
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        t.subTaskStatusChanged = "OnSubTaskStatusChanged", t.vipTaskInfoChanged = "OnVipTaskInfoChanged", t.vipSubTaskInfoChanged = "OnVipSubTaskInfoChanged", t.taskTryDetailChanged = "OnTaskTryDetailChanged", t.totalAcclerateStatusChanged = "OnTotalVipAcclerateStatusChanged", t.taskEnterMixTry = "OnTaskEnterMixTry", t.advertisementFluxGot = "onVipAdvertisementFluxGot"
    }(e.BroadcastEventNS || (e.BroadcastEventNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(5), s = i(7), o = i(2), r = i(0), l = i(3), u = i(8), c = i(10), d = r.default.getLogger("CloudTask");

    class h {
        constructor() {
            this.taskTitles = new Map, this.waitingXgtTaskId = null, this.downloadingXgtTaskId = null, this.waitingVipTask = null, this.downloadingVipTask = null, this.taskStared = [], this.taskWaiting = [], this.expandTaskId = null, this.cloudConfig = {
                fast_cloud_add: !1,
                sim_cloud_dl_tasks: {sim_cloud_dl_tasks_switch: !1, normal_tasks: 5, vip_tasks: 8, svip_tasks: 10}
            }, this.clickedDownlading = !1, this.clicedkWaitting = !1, this.taskManager = null, this.autoChangingConfig = !1, this.defaultTasks = 3, l.default.addListener(l.UserEventNS.authorityChanged, this.onUserChange.bind(this)), c.default.addListener(c.DkEventNS.taskRemoved, this.onTaskRemoved.bind(this)), this.resetDefaultTaskCount().catch(), this.initConfig().catch(), this.watchConfigValue()
        }

        init(t) {
            this.taskManager = t
        }

        initConfig() {
            return n(this, void 0, void 0, function* () {
                (yield o.client.callServerFunction("IsRemoteGlobalConfigInitFinish")) ? this.loadCloudGlobalConfig().catch() : o.client.attachServerEvent("OnRemoteGlobalConfigLoaded", () => n(this, void 0, void 0, function* () {
                    this.loadCloudGlobalConfig().catch()
                }))
            })
        }

        loadCloudGlobalConfig() {
            return n(this, void 0, void 0, function* () {
                this.cloudConfig.fast_cloud_add = yield o.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "fast_cloud_add", this.cloudConfig.fast_cloud_add), this.cloudConfig.sim_cloud_dl_tasks = yield o.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "sim_cloud_dl_tasks", this.cloudConfig.sim_cloud_dl_tasks), d.info("loadCloudGlobalConfig", this.cloudConfig)
            })
        }

        getCloudClassLimit() {
            return [this.cloudConfig.sim_cloud_dl_tasks.normal_tasks, this.cloudConfig.sim_cloud_dl_tasks.vip_tasks, this.cloudConfig.sim_cloud_dl_tasks.svip_tasks]
        }

        setExpandTaskId(t) {
            this.expandTaskId = t
        }

        onExpand(t, e) {
            return n(this, void 0, void 0, function* () {
                switch (this.loggerInfo(t, "onExpand").catch(), yield c.default.getTaskStatus(t)) {
                    case s.DownloadKernel.TaskStatus.Started:
                        this.addDownloadingXgt(t, e)
                }
            })
        }

        onTaskRemoved(t) {
            return n(this, void 0, void 0, function* () {
                this.loggerInfo(t, "onTaskRemoved").catch();
                let e = yield c.default.getTaskStatus(t);
                this.onTaskStatusChanged(t, this.getVipTask(t), e).catch()
            })
        }

        getVipTask(t) {
            let e = this.taskManager.getTask(t);
            return e ? e.getVipTask() : null
        }

        onTaskStatusChanged(t, e, i) {
            return n(this, void 0, void 0, function* () {
                switch (i) {
                    case s.DownloadKernel.TaskStatus.StartWaiting:
                        this.taskWaiting.push(t), this.loggerInfo(t, "taskWaiting", this.taskWaiting).catch(), this.addWaitingXgt(t, e);
                        break;
                    case s.DownloadKernel.TaskStatus.StartPending:
                        break;
                    default:
                        this.taskWaiting = this.taskWaiting.filter(e => e !== t), this.waitingXgtTaskId === t && (this.delWaitingXgt(t, e), this.taskWaiting.forEach(t => {
                            this.waitingXgtTaskId || this.addWaitingXgt(t, this.taskManager.getTask(t).getVipTask())
                        }))
                }
                switch (i) {
                    case s.DownloadKernel.TaskStatus.Started:
                        this.expandTaskId === t && this.addDownloadingXgt(t, e), this.taskStared.push(t);
                        break;
                    case s.DownloadKernel.TaskStatus.StopPending:
                    case s.DownloadKernel.TaskStatus.Stopped:
                        this.taskStared = this.taskStared.filter(e => e !== t);
                        break;
                    default:
                        this.taskStared = this.taskStared.filter(e => e !== t), this.delDownloadingXgt(t, e)
                }
            })
        }

        addWaitingXgt(t, e) {
            !l.default.isSuperVip && !this.clickWaitting && this.cloudConfig.sim_cloud_dl_tasks.sim_cloud_dl_tasks_switch && e && (this.loggerInfo(t, "addWaitingXgt").catch(), this.waitingXgtTaskId || e.changeXgtState(u.VipDownloadDefineNS.XgtType.CloudWaiting, u.VipDownloadDefineNS.XgtState.Ready, {select: !0}))
        }

        delWaitingXgt(t, e) {
            this.loggerInfo(t, "delWaitingXgt").catch(), this.waitingXgtTaskId === t && (this.waitingXgtTaskId = null, this.waitingVipTask = null, e && e.changeXgtState(u.VipDownloadDefineNS.XgtType.CloudWaiting, u.VipDownloadDefineNS.XgtState.Exit))
        }

        showReadyWaitingXgt(t, e) {
            return n(this, void 0, void 0, function* () {
                if (this.waitingXgtTaskId) return !1;
                return yield a.ThunderUtil.sleep(2e3), (yield c.default.getTaskStatus(t)) !== s.DownloadKernel.TaskStatus.StartWaiting ? (e.changeXgtState(u.VipDownloadDefineNS.XgtType.CloudWaiting, u.VipDownloadDefineNS.XgtState.Exit), !1) : (this.loggerInfo(t, "showReadyWaitingXgt").catch(), this.waitingXgtTaskId = t, this.waitingVipTask = e, !0)
            })
        }

        addDownloadingXgt(t, e) {
            !l.default.isVip && !this.clickDownloading && this.cloudConfig.fast_cloud_add && e && (this.loggerInfo(t, "addDownloadingXgt").catch(), this.downloadingXgtTaskId || (this.downloadingXgtTaskId = t, this.downloadingVipTask = e, e.changeXgtState(u.VipDownloadDefineNS.XgtType.CloudDownloading, u.VipDownloadDefineNS.XgtState.Ready)))
        }

        delDownloadingXgt(t, e) {
            this.loggerInfo(t, "delDownloadingXgt").catch(), this.downloadingXgtTaskId === t && (this.downloadingXgtTaskId = null, this.downloadingVipTask = null, e && e.changeXgtState(u.VipDownloadDefineNS.XgtType.CloudDownloading, u.VipDownloadDefineNS.XgtState.Exit))
        }

        set clickDownloading(t) {
            this.clickedDownlading = t, this.delDownloadingXgt(this.downloadingXgtTaskId, this.downloadingVipTask)
        }

        set clickWaitting(t) {
            this.clicedkWaitting = t, this.delWaitingXgt(this.waitingXgtTaskId, this.waitingVipTask)
        }

        get clickDownloading() {
            return this.clickedDownlading
        }

        get clickWaitting() {
            return this.clicedkWaitting
        }

        get waittingCount() {
            return this.taskWaiting.length
        }

        get startedCount() {
            return this.taskStared.length
        }

        loggerInfo(t, ...e) {
            return n(this, void 0, void 0, function* () {
                let i = this.taskTitles.get(t);
                if (!i) {
                    let e = yield c.default.getTaskBaseInfo(t);
                    e && (this.taskTitles.set(t, e.taskName), i = e.taskName)
                }
                d.info(i, ...e)
            })
        }

        onUserChange(t, e) {
            this.resetCloudTaskMaxCountConfigData().catch(), e && (l.default.isVip && this.delDownloadingXgt(this.downloadingXgtTaskId, this.downloadingVipTask), l.default.isSuperVip && this.delWaitingXgt(this.waitingXgtTaskId, this.waitingVipTask))
        }

        resetCloudTaskMaxCountConfigData() {
            return n(this, void 0, void 0, function* () {
                if (!this.cloudConfig.sim_cloud_dl_tasks.sim_cloud_dl_tasks_switch) return;
                let t = Number(this.cloudConfig.sim_cloud_dl_tasks.normal_tasks);
                l.default.isSuperVip ? t = Number(this.cloudConfig.sim_cloud_dl_tasks.svip_tasks) : l.default.isVip && (t = Number(this.cloudConfig.sim_cloud_dl_tasks.vip_tasks));
                let e = [];
                for (let i = 1; i <= t; ++i) e.push(i.toFixed());
                let i = {
                    name: "云盘设置",
                    classes: "xly-setting-cloud",
                    children: [{
                        name: "ThunderPanPlugin-MaxDownloadTaskNum",
                        label: "同时下载任务数",
                        type: "confText",
                        text: "同时下载任务数",
                        classes: "xly-setting-content__title",
                        liClasses: "xly-setting-content__align",
                        liStyles: "display: flex; align-items: center;",
                        children: [{
                            name: "ThunderPanPlugin-MaxDownloadTaskNum",
                            type: "confSelect",
                            label: "",
                            classes: "xly-select-size-1",
                            option: e
                        }]
                    }]
                }, n = yield o.client.callServerFunction("AddConfigSettingItemData", JSON.stringify(i), JSON.stringify({
                    "ThunderPanPlugin-MaxDownloadTaskNum": {
                        section: "ThunderPanPlugin",
                        key: "MaxDownloadTaskNum",
                        value: 5
                    }
                }));
                d.info("AddConfigSettingItemData", e, n);
                let a = yield o.client.callServerFunction("GetConfigValue", "ThunderPanPlugin", "MaxDownloadTaskNum", 5);
                Number(a) > t && (this.autoChangingConfig = !0, o.client.callServerFunction("SetConfigValue", "ThunderPanPlugin", "MaxDownloadTaskNum", t).catch(), setTimeout(() => {
                    this.autoChangingConfig = !1
                }, 5e3))
            })
        }

        watchConfigValue() {
            o.client.attachServerEvent("OnConfigValueChanaged", (t, ...e) => n(this, void 0, void 0, function* () {
                let t = e[0], i = e[1], n = e[2], a = e[3];
                "ThunderPanPlugin" !== t || "MaxDownloadTaskNum" !== i || (d.info("OnConfigValueChanaged", "autoChangingConfig", this.autoChangingConfig, n, a), this.autoChangingConfig)
            }))
        }

        resetDefaultTaskCount() {
            return n(this, void 0, void 0, function* () {
                (yield o.client.callServerFunction("GetValue", "VipDownload", "ResetedSimCloudDefault", !1)) || ((yield o.client.callServerFunction("GetConfigValue", "ThunderPanPlugin", "MaxDownloadTaskNum", 5)) < this.defaultTasks ? o.client.callServerFunction("SetValue", "VipDownload", "ResetedSimCloudDefault", !0).catch() : (this.autoChangingConfig = !0, o.client.callServerFunction("SetConfigValue", "ThunderPanPlugin", "MaxDownloadTaskNum", this.defaultTasks).catch(), setTimeout(() => {
                    this.autoChangingConfig = !1
                }, 5e3), o.client.callServerFunction("SetValue", "VipDownload", "ResetedSimCloudDefault", !0).catch()))
            })
        }
    }

    e.CloudTask = h, e.default = new h
}, function (t) {
    t.exports = {
        name: "vip-download",
        version: "4.6.3",
        author: "Xunlei",
        license: "",
        description: "",
        main: "4.6.3/index.js",
        clear: !0
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(57), a = i(9), s = i(36), o = i(58), r = i(29);
    e.Client = class extends a.EventEmitter {
        constructor(t) {
            if (t = t || {}, super(), this.inprocess = !1, this.context = void 0, t.context && (this.context = Object.assign({}, t.context), this.context.productId = t.socketPrex), t.socket) this.socket = t.socket, this.bind(); else if (global.__xdasIPCServer && global.__xdasIPCServer.getProductId().toLowerCase() === t.socketPrex.toLowerCase()) this.inprocess = !0; else {
                let e = r.getSockPath(t.socketPrex);
                this.socket = n.connect(e), this.bind()
            }
        }

        isInprocess() {
            return this.inprocess
        }

        getContext() {
            return this.context
        }

        bind() {
            const t = new o.Parser, e = this.socket;
            e.on("data", e => {
                t.feed(e)
            }), e.on("connect", () => {
                this.emit("connect")
            }), e.on("end", () => {
                s.information("socket is ended"), this.socket = null, this.emit("end")
            }), e.on("error", t => {
                this.socket = null, this.emit("error", t)
            }), t.on("message", t => {
                this.emit("message", t)
            }), this.parser = t
        }

        send(t) {
            if (this.socket) try {
                this.socket.write(this.parser.encode(t))
            } catch (t) {
                s.error(t.message)
            } else s.information("This socket has been ended by the other party")
        }
    }
}, function (t, e) {
    t.exports = require("net")
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(51), a = i(9);
    e.Parser = class extends a.EventEmitter {
        constructor() {
            super(), this.decoder = new n.StringDecoder("utf8"), this.jsonBuffer = ""
        }

        encode(t) {
            return JSON.stringify(t) + "\n"
        }

        feed(t) {
            let e = this.jsonBuffer, i = 0, n = (e += this.decoder.write(t)).indexOf("\n", i);
            for (; n >= 0;) {
                const t = e.slice(i, n), a = JSON.parse(t);
                this.emit("message", a), i = n + 1, n = e.indexOf("\n", i)
            }
            this.jsonBuffer = e.slice(i)
        }
    }
}, function (t, e) {
    t.exports = require("url")
}, function (t, e) {
    t.exports = require("http")
}, function (t, e) {
    t.exports = require("https")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(0).default.getLogger("VipDownload:config");
    e.Config = class {
        constructor() {
            this.configData = {}, this.configData = {
                VipDownload: {
                    TokenExpireAdvanceSecond: 300,
                    TokenExpireMinSecond: 20,
                    TokenDefaultQueryInterval: 300,
                    EnableTryMinSize: 209715200,
                    EnableTryMaxProgress: 40,
                    FileEnableTryMinSize: 52428800,
                    TryInterval: 1800,
                    TryMaxProgress: 20,
                    TryMaxSize: 1073741824,
                    TryFailDispearDelay: 5,
                    TryFinishDispearDelay: 1800,
                    TryFinishClickDispearDelay: 180,
                    NewSkinPeerid: [],
                    WarnStylePeerid: [],
                    BeforeBaotuanXgtStylePeerid: ["A"],
                    EnableSuperTryMinSize: 524288e3,
                    EnableSuperTryMaxProgress: 50,
                    SuperTryFinishDispearDelay: 180,
                    SuperTryFinishClickDispearDelay: 10,
                    MixTryFinishMiniWeb: 2,
                    MixTryFinishMiniWebMinPromotePercent: 5,
                    AdFinishDispearDelay: 180,
                    SceneChangeInterval: 10,
                    WDYXDomains: ["lx.patch1.9you.com"],
                    PlayGameXgtCount: 6,
                    PlayGameHash: !1,
                    SpeedZeroLimitSpeed: 1,
                    AuotShowBaotuanNoviceDelay: 60,
                    NoVipStatusQueryPeerid: ["0", "1"],
                    ReportGlobalSpeed: !0,
                    ReportGlobalSpeedTime: 60
                }
            }
        }

        getValue(t, e) {
            let i = void 0;
            do {
                if (!t || "" === t) break;
                if (!e || "" === e) break;
                let n = this.configData[t];
                if (!n) break;
                i = n[e]
            } while (0);
            return i
        }

        loadConfigData(t) {
            return n(this, void 0, void 0, function* () {
                let e = !1, i = null;
                try {
                    (i = JSON.parse(t.toString())) && (e = !0)
                } catch (t) {
                    a.warn(t)
                }
                return this.mergeConfigData(i), e
            })
        }

        printConfigData() {
            a.info("configData", this.configData)
        }

        mergeConfigData(t) {
            if (t) if (null === this.configData) this.configData = t; else for (let e in t) {
                let i = t[e];
                if (!i) break;
                for (let t in i) {
                    let n = i[t], a = this.configData[e];
                    if (a) a[t] = n; else {
                        let i = {};
                        i[t] = n, this.configData[e] = i
                    }
                }
            }
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6), a = i(37), s = i(65), o = i(24);

    function r(t) {
        var e = new s(t), i = a(s.prototype.request, e);
        return n.extend(i, s.prototype, e), n.extend(i, e), i
    }

    var l = r(o);
    l.Axios = s, l.create = function (t) {
        return r(n.merge(o, t))
    }, l.Cancel = i(40), l.CancelToken = i(79), l.isCancel = i(39), l.all = function (t) {
        return Promise.all(t)
    }, l.spread = i(80), t.exports = l, t.exports.default = l
}, function (t, e) {
    function i(t) {
        return !!t.constructor && "function" == typeof t.constructor.isBuffer && t.constructor.isBuffer(t)
    }

    /*!
 * Determine if an object is a Buffer
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */
    t.exports = function (t) {
        return null != t && (i(t) || function (t) {
            return "function" == typeof t.readFloatLE && "function" == typeof t.slice && i(t.slice(0, 0))
        }(t) || !!t._isBuffer)
    }
}, function (t, e, i) {
    "use strict";
    var n = i(24), a = i(6), s = i(74), o = i(75);

    function r(t) {
        this.defaults = t, this.interceptors = {request: new s, response: new s}
    }

    r.prototype.request = function (t) {
        "string" == typeof t && (t = a.merge({url: arguments[0]}, arguments[1])), (t = a.merge(n, {method: "get"}, this.defaults, t)).method = t.method.toLowerCase();
        var e = [o, void 0], i = Promise.resolve(t);
        for (this.interceptors.request.forEach(function (t) {
            e.unshift(t.fulfilled, t.rejected)
        }), this.interceptors.response.forEach(function (t) {
            e.push(t.fulfilled, t.rejected)
        }); e.length;) i = i.then(e.shift(), e.shift());
        return i
    }, a.forEach(["delete", "get", "head", "options"], function (t) {
        r.prototype[t] = function (e, i) {
            return this.request(a.merge(i || {}, {method: t, url: e}))
        }
    }), a.forEach(["post", "put", "patch"], function (t) {
        r.prototype[t] = function (e, i, n) {
            return this.request(a.merge(n || {}, {method: t, url: e, data: i}))
        }
    }), t.exports = r
}, function (t, e, i) {
    "use strict";
    var n = i(6);
    t.exports = function (t, e) {
        n.forEach(t, function (i, n) {
            n !== e && n.toUpperCase() === e.toUpperCase() && (t[e] = i, delete t[n])
        })
    }
}, function (t, e, i) {
    "use strict";
    var n = i(38);
    t.exports = function (t, e, i) {
        var a = i.config.validateStatus;
        i.status && a && !a(i.status) ? e(n("Request failed with status code " + i.status, i.config, null, i.request, i)) : t(i)
    }
}, function (t, e, i) {
    "use strict";
    t.exports = function (t, e, i, n, a) {
        return t.config = e, i && (t.code = i), t.request = n, t.response = a, t
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6);

    function a(t) {
        return encodeURIComponent(t).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]")
    }

    t.exports = function (t, e, i) {
        if (!e) return t;
        var s;
        if (i) s = i(e); else if (n.isURLSearchParams(e)) s = e.toString(); else {
            var o = [];
            n.forEach(e, function (t, e) {
                null !== t && void 0 !== t && (n.isArray(t) ? e += "[]" : t = [t], n.forEach(t, function (t) {
                    n.isDate(t) ? t = t.toISOString() : n.isObject(t) && (t = JSON.stringify(t)), o.push(a(e) + "=" + a(t))
                }))
            }), s = o.join("&")
        }
        return s && (t += (-1 === t.indexOf("?") ? "?" : "&") + s), t
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6),
        a = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"];
    t.exports = function (t) {
        var e, i, s, o = {};
        return t ? (n.forEach(t.split("\n"), function (t) {
            if (s = t.indexOf(":"), e = n.trim(t.substr(0, s)).toLowerCase(), i = n.trim(t.substr(s + 1)), e) {
                if (o[e] && a.indexOf(e) >= 0) return;
                o[e] = "set-cookie" === e ? (o[e] ? o[e] : []).concat([i]) : o[e] ? o[e] + ", " + i : i
            }
        }), o) : o
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6);
    t.exports = n.isStandardBrowserEnv() ? function () {
        var t, e = /(msie|trident)/i.test(navigator.userAgent), i = document.createElement("a");

        function a(t) {
            var n = t;
            return e && (i.setAttribute("href", n), n = i.href), i.setAttribute("href", n), {
                href: i.href,
                protocol: i.protocol ? i.protocol.replace(/:$/, "") : "",
                host: i.host,
                search: i.search ? i.search.replace(/^\?/, "") : "",
                hash: i.hash ? i.hash.replace(/^#/, "") : "",
                hostname: i.hostname,
                port: i.port,
                pathname: "/" === i.pathname.charAt(0) ? i.pathname : "/" + i.pathname
            }
        }

        return t = a(window.location.href), function (e) {
            var i = n.isString(e) ? a(e) : e;
            return i.protocol === t.protocol && i.host === t.host
        }
    }() : function () {
        return !0
    }
}, function (t, e, i) {
    "use strict";
    var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

    function a() {
        this.message = "String contains an invalid character"
    }

    a.prototype = new Error, a.prototype.code = 5, a.prototype.name = "InvalidCharacterError", t.exports = function (t) {
        for (var e, i, s = String(t), o = "", r = 0, l = n; s.charAt(0 | r) || (l = "=", r % 1); o += l.charAt(63 & e >> 8 - r % 1 * 8)) {
            if ((i = s.charCodeAt(r += .75)) > 255) throw new a;
            e = e << 8 | i
        }
        return o
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6);
    t.exports = n.isStandardBrowserEnv() ? {
        write: function (t, e, i, a, s, o) {
            var r = [];
            r.push(t + "=" + encodeURIComponent(e)), n.isNumber(i) && r.push("expires=" + new Date(i).toGMTString()), n.isString(a) && r.push("path=" + a), n.isString(s) && r.push("domain=" + s), !0 === o && r.push("secure"), document.cookie = r.join("; ")
        }, read: function (t) {
            var e = document.cookie.match(new RegExp("(^|;\\s*)(" + t + ")=([^;]*)"));
            return e ? decodeURIComponent(e[3]) : null
        }, remove: function (t) {
            this.write(t, "", Date.now() - 864e5)
        }
    } : {
        write: function () {
        }, read: function () {
            return null
        }, remove: function () {
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6);

    function a() {
        this.handlers = []
    }

    a.prototype.use = function (t, e) {
        return this.handlers.push({fulfilled: t, rejected: e}), this.handlers.length - 1
    }, a.prototype.eject = function (t) {
        this.handlers[t] && (this.handlers[t] = null)
    }, a.prototype.forEach = function (t) {
        n.forEach(this.handlers, function (e) {
            null !== e && t(e)
        })
    }, t.exports = a
}, function (t, e, i) {
    "use strict";
    var n = i(6), a = i(76), s = i(39), o = i(24), r = i(77), l = i(78);

    function u(t) {
        t.cancelToken && t.cancelToken.throwIfRequested()
    }

    t.exports = function (t) {
        return u(t), t.baseURL && !r(t.url) && (t.url = l(t.baseURL, t.url)), t.headers = t.headers || {}, t.data = a(t.data, t.headers, t.transformRequest), t.headers = n.merge(t.headers.common || {}, t.headers[t.method] || {}, t.headers || {}), n.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function (e) {
            delete t.headers[e]
        }), (t.adapter || o.adapter)(t).then(function (e) {
            return u(t), e.data = a(e.data, e.headers, t.transformResponse), e
        }, function (e) {
            return s(e) || (u(t), e && e.response && (e.response.data = a(e.response.data, e.response.headers, t.transformResponse))), Promise.reject(e)
        })
    }
}, function (t, e, i) {
    "use strict";
    var n = i(6);
    t.exports = function (t, e, i) {
        return n.forEach(i, function (i) {
            t = i(t, e)
        }), t
    }
}, function (t, e, i) {
    "use strict";
    t.exports = function (t) {
        return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)
    }
}, function (t, e, i) {
    "use strict";
    t.exports = function (t, e) {
        return e ? t.replace(/\/+$/, "") + "/" + e.replace(/^\/+/, "") : t
    }
}, function (t, e, i) {
    "use strict";
    var n = i(40);

    function a(t) {
        if ("function" != typeof t) throw new TypeError("executor must be a function.");
        var e;
        this.promise = new Promise(function (t) {
            e = t
        });
        var i = this;
        t(function (t) {
            i.reason || (i.reason = new n(t), e(i.reason))
        })
    }

    a.prototype.throwIfRequested = function () {
        if (this.reason) throw this.reason
    }, a.source = function () {
        var t;
        return {
            token: new a(function (e) {
                t = e
            }), cancel: t
        }
    }, t.exports = a
}, function (t, e, i) {
    "use strict";
    t.exports = function (t) {
        return function (e) {
            return t.apply(null, e)
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(17), s = i(28), o = i(22), r = i(0).default.getLogger("tools-utilities");
    !function (t) {
        t.genarateMd5 = function (t) {
            let e = void 0, i = a.createHash("md5");
            return null !== i && (e = i.update(t).digest("hex")), e
        }, t.calculateFileMd5Ex = function (t) {
            return n(this, void 0, void 0, function* () {
                let e;
                if (t && (yield o.FileSystemAWNS.existsAW(t))) {
                    let i = s.createReadStream(t), n = a.createHash("md5");
                    i.on("data", t => {
                        n.update(t)
                    }), e = new Promise(t => {
                        i.on("end", () => {
                            let e = n.digest("hex");
                            e = e.toUpperCase(), t(e)
                        })
                    })
                } else e = new Promise(t => {
                    t(void 0)
                });
                return e
            })
        }, t.encryptBuffer = function (t, e) {
            let i = null;
            try {
                let n = a.createCipheriv("aes-128-ecb", e, ""), s = n.update(t), o = n.final();
                i = Buffer.concat([s, o])
            } catch (t) {
                r.error("encryptBuffer", t)
            }
            return i
        }, t.decryptBuffer = function (t, e) {
            let i = null;
            try {
                let n = a.createDecipheriv("aes-128-ecb", e, ""), s = n.update(t), o = n.final();
                i = Buffer.concat([s, o])
            } catch (t) {
                r.error("decryptBuffer", t)
            }
            return i
        }, t.encryptSha1Buffer = function (t) {
            let e = null;
            try {
                e = a.createHash("sha1").update(t).digest("hex")
            } catch (t) {
                r.error("encryptSha1Buffer", t)
            }
            return e
        }
    }(e.ToolsUtilitiesAWNS || (e.ToolsUtilitiesAWNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(188), s = i(2), o = i(214), r = i(0).default.getLogger("sqlite-table"), l = "584C535343444E2E";

    class u {
        constructor() {
            this.mUserId = void 0, this.mName = "", this.mJsonify = !1, this.mEncrypt = !1, this.mEnable = !1
        }

        static execSqlite(t) {
            return n(this, void 0, void 0, function* () {
                return yield s.client.callServerFunction("ExecSqlite", t)
            })
        }

        static querySqlite(t) {
            return n(this, void 0, void 0, function* () {
                return yield s.client.callServerFunction("QuerySqlite", t)
            })
        }

        set enable(t) {
            this.mEnable = t
        }

        get enable() {
            return this.mEnable
        }

        set userId(t) {
            this.mUserId = t
        }

        get userId() {
            return this.mUserId
        }

        set name(t) {
            this.mName = t
        }

        get name() {
            return this.mName
        }

        get tableName() {
            let t = void 0;
            return this.userId && this.name && (t = "AccelerateTaskMap" + this.userId + "_" + this.name), t
        }

        get jsonify() {
            return this.mJsonify
        }

        set jsonify(t) {
            this.mJsonify = t
        }

        get encrypt() {
            return this.mEncrypt
        }

        set encrypt(t) {
            this.mEncrypt = t
        }

        init(t) {
            return n(this, void 0, void 0, function* () {
                this.userId = t;
                let e = yield this.isTableExist();
                r.info("table exist", e), e || (yield this.createTable()), this.enable = !0
            })
        }

        clear() {
            this.userId = void 0, this.enable = !1
        }

        createTable() {
            return n(this, void 0, void 0, function* () {
                let t = -1, e = this.tableName;
                if (e) {
                    let i = `create table ${e}(LocalTaskId BIGINT, AcclerateTaskId BIGINT, LocalSubFileIndex INT, UserData NVARCHAR, primary key(LocalTaskId,LocalSubFileIndex))`;
                    r.info("command", i), t = yield u.execSqlite(i), r.info("createTable", t)
                }
                return t
            })
        }

        isTableExist() {
            return n(this, void 0, void 0, function* () {
                let t = !1, e = this.tableName;
                if (e) {
                    let i = `select count(*) from sqlite_master where type='table' and name='${e}'`;
                    r.info("command", i);
                    let n = yield u.querySqlite(i);
                    if (n && n.length > 0) {
                        let e = n[0];
                        if (e && e.length > 0) {
                            let i = e[0].value;
                            i && Number(i).valueOf() > 0 && (t = !0)
                        }
                    }
                }
                return t
            })
        }

        setUserData(t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = -1, s = this.tableName;
                if (!this.enable || !s) return n;
                let c = "null";
                i && (c = this.jsonify ? JSON.stringify(i) : o.stringify(i), this.encrypt && (c = a.AesCryptoNS.encryptString(c, l)), c = `'${c}'`);
                let d = void 0, h = yield this.isTaskExist(t, e);
                return r.info("task exist", h), d = h ? `update ${s} set UserData=${c} where LocalTaskId=${t} and LocalSubFileIndex=${e}` : `insert into ${s} values(${t}, -1, ${e}, ${c})`, n = yield u.execSqlite(d), r.info("command", d, n), n
            })
        }

        getUserData(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = null, n = this.tableName;
                if (!this.enable || !n) return i;
                let s = `select UserData from ${n} where LocalTaskId=${t} and LocalSubFileIndex=${e}`,
                    o = yield u.querySqlite(s);
                if (r.info("command", s, o), o && o.length > 0) {
                    let t = o[0];
                    if (t && t.length > 0) {
                        let e = t[0].value;
                        if (e) if (this.encrypt && (e = a.AesCryptoNS.decryptString(e, l)), this.jsonify) try {
                            i = JSON.parse(e)
                        } catch (t) {
                            r.warn(t)
                        } else i = e
                    }
                }
                return i
            })
        }

        removeTask(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = -1, n = this.tableName;
                if (!this.enable || !n) return i;
                let a = void 0;
                return a = -2 === e ? `delete from ${n} where LocalTaskId=${t}` : `delete from ${n} where LocalTaskId=${t} and LocalSubFileIndex=${e}`, r.info("command", a), i = yield u.execSqlite(a), r.info("removeTask", i), i
            })
        }

        getTaskIds() {
            return n(this, void 0, void 0, function* () {
                let t = [], e = this.tableName;
                if (!this.enable || !e) return t;
                let i = `select distinct LocalTaskId from ${e}`;
                r.info("command", i);
                let n = yield u.querySqlite(i);
                return n && n.length > 0 && n.forEach(function (e) {
                    if (e && e.length > 0) {
                        let i = e[0];
                        if (i.value) {
                            let e = Number(i.value).valueOf();
                            t.push(e)
                        }
                    }
                }), t
            })
        }

        getTaskIndexs(t) {
            return n(this, void 0, void 0, function* () {
                let e = [], i = this.tableName;
                if (!this.enable || !i) return e;
                let n = `select distinct LocalSubFileIndex from ${i} where LocalTaskId=${t}`;
                r.info("command", n);
                let a = yield u.querySqlite(n);
                return a && a.length > 0 && a.forEach(function (t) {
                    if (t && t.length > 0) {
                        let i = t[0];
                        if (i.value) {
                            let t = Number(i.value).valueOf();
                            e.push(t)
                        }
                    }
                }), e
            })
        }

        isTaskExist(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1, n = this.tableName;
                if (!this.enable || !n) return i;
                let a = `select count(*) from ${n} where LocalTaskId=${t} and LocalSubFileIndex=${e}`;
                r.info("command", a);
                let s = yield u.querySqlite(a);
                if (s && s.length > 0) {
                    let t = s[0];
                    if (t && t.length > 0) {
                        let e = t[0].value;
                        e && Number(e).valueOf() > 0 && (i = !0)
                    }
                }
                return i
            })
        }
    }

    e.SqliteTable = u
}, function (t, e, i) {
    "use strict";
    var n;
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e, i;
        !function (t) {
            t.require = "AR_BROWSER_REQUIRE", t.builtIn = "AR_BROWSER_GET_BUILTIN", t.global = "AR_BROWSER_GET_GLOBAL", t.functionCall = "AR_BROWSER_FUNCTION_CALL", t.construct = "AR_BROWSER_CONSTRUCTOR", t.memberConstruct = "AR_BROWSER_MEMBER_CONSTRUCTOR", t.memberCall = "AR_BROWSER_MEMBER_CALL", t.memberSet = "AR_BROWSER_MEMBER_SET", t.memberGet = "AR_BROWSER_MEMBER_GET", t.currentWindow = "AR_BROWSER_CURRENT_WINDOW", t.currentWebContents = "AR_BROWSER_CURRENT_WEB_CONTENTS", t.clientWebContents = "AR_BROWSER_CLIENT_WEB_CONTENTS", t.webContents = "AR_BROWSER_WEB_CONTENTS", t.sync = "AR_BROWSER_SYNC", t.contextRelease = "AR_BROWSER_CONTEXT_RELEASE"
        }(e = t.browser || (t.browser = {})), function (t) {
            t.requireReturn = "AR_RENDERER_REQUIRE_RETURN", t.getBuiltInReturn = "AR_RENDERER_BUILTIN_RETURN", t.getGlobalReturn = "AR_RENDERER_GLOBAL_RETURN", t.functionCallReturn = "AR_RENDERER_FUNCTION_CALL_RETURN", t.memberConstructReturn = "AR_RENDERER_MEMBER_CONSTRUCTOR_RETURN", t.constructReturn = "AR_RENDERER_CONSTRUCTOR_RETURN", t.memberCallReturn = "AR_RENDERER_MEMBER_CALL_RETURN", t.memberSetReturn = "AR_RENDERER_MEMBER_SET_RETURN", t.memberGetReturn = "AR_RENDERER_MEMBER_GET_RETURN", t.currentWindowReturn = "AR_BROWSER_CURRENT_WINDOW_RETURN", t.currentWebContentsReturn = "AR_RENDERER_CURRENT_WEB_CONTENTS_RETURN", t.clientWebContentsReturn = "AR_RENDERER_CLIENT_WEB_CONTENTS_RETURN", t.webContentsReturn = "AR_RENDERER_WEB_CONTENTS_RETURN", t.syncReturn = "AR_RENDERER_SYNC_RETURN", t.callback = "AR_RENDERER_CALLBACK"
        }(i = t.renderer || (t.renderer = {}))
    }(n || (n = {})), e.default = n
}, function (t, e, i) {
    "use strict";
    var n;
    !function (t) {
        t.getRemoteObjectName = function (t) {
            let e = typeof t;
            if ("function" === e) e = t.name; else if ("object" === e) {
                let e = t.name;
                if ("string" != typeof e) {
                    let i = t.constructor;
                    e = i ? i.name : Object.toString.call(t)
                }
            }
            return e
        }, t.isPromise = function (t) {
            return t && t.then && t.then instanceof Function && t.constructor && t.constructor.reject && t.constructor.reject instanceof Function && t.constructor.resolve && t.constructor.resolve instanceof Function
        }
    }(n || (n = {})), t.exports = n
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(0);
    !function (t) {
        t.VipTask = "VipTask", t.Baotuan = "Baotuan", t.Game = "Game", t.PackageTry = "PackageTry"
    }(e.TaskLogHelpName || (e.TaskLogHelpName = {}));

    class a {
        constructor(t, e) {
            this.task = null, this.logger = null, this.task = e, this.logger = a.sLoggerMap.get(t), this.logger || (this.logger = n.default.getLogger(t), a.sLoggerMap.set(t, this.logger)), setTimeout(() => {
                this.task && this.logger.info("TaskLogHelp:", this.task.taskDescript())
            }, 0)
        }

        info(...t) {
            this.task ? this.logger.info(this.task.taskTitle(), ...t) : this.logger.info(...t)
        }

        static infoEx(t, ...e) {
            a.getLogger(t, null).info(...e)
        }

        static getLogger(t, e) {
            return new a(t, e)
        }
    }

    a.sLoggerMap = new Map, e.TaskLogHelp = a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(16), s = i(3), o = i(1), r = i(10), l = i(0), u = i(44), c = l.default.getLogger("packagetry-stat");
    !function (t) {
        function e() {
            return n(this, void 0, void 0, function* () {
                let t = new Map, e = function () {
                    let t = 0;
                    s.default.isLogin && (t = 1);
                    return t
                }(), i = function () {
                    let t = 0;
                    s.default.isVip && (t = 1);
                    return t
                }(), n = function () {
                    let t = 0;
                    s.default.isSuperVip ? t = 5 : s.default.isPlatinumVip ? t = 3 : s.default.isVip && (t = 2);
                    return t
                }();
                return t.set("is_login", e), t.set("is_vip", i), t.set("vip_type", n), t.set("plugin_version", o.default.pluginVersion), t.set("cpeerid", yield r.default.getTpPeerId()), t
            })
        }

        t.show = function (t, i, s, o) {
            return n(this, void 0, void 0, function* () {
                c.info("packagetryShow");
                let n = yield e();
                n.set("try_num", t), n.set("area", i), n.set("have_ypdl", o ? 1 : 0);
                let r = {
                    attribute1: s ? "download_svip_pack_before_try_show" : "download_vip_pack_before_try_show",
                    extData: n
                };
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", r).catch()
            })
        }, t.click = function (t, i, s, o) {
            return n(this, void 0, void 0, function* () {
                c.info("click");
                let n = yield e();
                n.set("try_num", t), n.set("area", i), n.set("have_ypdl", o ? 1 : 0);
                let r = {
                    attribute1: s ? "download_svip_pack_before_try_click" : "download_vip_pack_before_try_click",
                    extData: n
                };
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", r).catch()
            })
        }, t.showInitiatingXht = function (t, i) {
            return n(this, void 0, void 0, function* () {
                c.info("showInitiatingXht");
                let n = yield e();
                n.set("area", "xht"), n.set("have_ypdl", i ? 1 : 0);
                let s = {
                    attribute1: t ? "download_svip_pack_initiating_show" : "download_vip_pack_initiating_show",
                    extData: n
                };
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
            })
        }, t.clickInitiatingXht = function (t, i, o) {
            return n(this, void 0, void 0, function* () {
                c.info("clickInitiatingXht");
                let n = yield e();
                n.set("area", t ? "xgt" : "xht"), i ? (n.set("referfrom", u.default.canUseKuaiNiao ? "v_pc_xl11_hytq_dl_svip_pack_kn" : "v_pc_xlx_hytq_dl_svip_pack"), n.set("aidfrom", (s.default.isVip ? "bj_" : "nv_") + (t ? "xgt_initiating" : "xht_initiating"))) : (n.set("referfrom", "v_pc_xlx_hytq_dl_vip_pack"), n.set("aidfrom", t ? "xgt_initiating" : "xht_initiating")), n.set("have_ypdl", o ? 1 : 0);
                let r = {
                    attribute1: i ? "download_svip_pack_initiating_click" : "download_vip_pack_initiating_click",
                    extData: n
                };
                return a.StatUtilitiesNS.trackEvent("xlx_vip_event", r).catch(), n.get("aidfrom")
            })
        }, t.tryingShow = function (t, i, s, o, r, l, u, d) {
            return n(this, void 0, void 0, function* () {
                c.info("tryingShow");
                let n = yield e();
                n.set("area", l ? "xgt" : "xht"), n.set("download_num", t), n.set("acc_num", i), n.set("group_num", s), n.set("acc_bc_num", o), n.set("before_speed", Math.floor(r / 1024)), n.set("have_ypdl", d ? 1 : 0);
                let h = {
                    attribute1: u ? "download_svip_pack_trying_show" : "download_vip_pack_trying_show",
                    extData: n
                };
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", h).catch()
            })
        }, t.tryingClick = function (t, i, o, r, l, d, h, f) {
            return n(this, void 0, void 0, function* () {
                c.info("tryingClick");
                let n = yield e();
                n.set("area", d ? "xgt" : "xht"), n.set("download_num", t), n.set("acc_num", i), n.set("group_num", o), n.set("acc_bc_num", r), n.set("before_speed", Math.floor(l / 1024)), h ? (n.set("referfrom", u.default.canUseKuaiNiao ? "v_pc_xl11_hytq_dl_svip_pack_kn" : "v_pc_xlx_hytq_dl_svip_pack"), n.set("aidfrom", (s.default.isVip ? "bj_" : "nv_") + (d ? "xgt_trying" : "xht_trying"))) : (n.set("referfrom", "v_pc_xlx_hytq_dl_vip_pack"), n.set("aidfrom", d ? "xgt_trying" : "xht_trying")), n.set("have_ypdl", f ? 1 : 0);
                let p = {
                    attribute1: h ? "download_svip_pack_trying_click" : "download_vip_pack_trying_click",
                    extData: n
                };
                return t > 0 && a.StatUtilitiesNS.trackEvent("xlx_vip_event", p).catch(), n.get("aidfrom")
            })
        }, t.afterShow = function (t, i, s, o, r, l, u, d, h, f) {
            return n(this, void 0, void 0, function* () {
                c.info("afterShow");
                let n = yield e();
                n.set("area", t), n.set("download_num", i), n.set("acc_num", s), n.set("group_num", o), n.set("acc_bc_num", r), n.set("before_speed", Math.floor(l / 1024)), n.set("ing_speed", Math.floor(u / 1024)), n.set("gcid_set", d), n.set("have_ypdl", f ? 1 : 0);
                let p = {
                    attribute1: h ? "download_svip_pack_after_try_show" : "download_vip_pack_after_try_show",
                    extData: n
                };
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", p).catch()
            })
        }, t.afterClick = function (t, i, o, r, l, d, h, f, p) {
            return n(this, void 0, void 0, function* () {
                c.info("afterClick");
                let n = yield e();
                n.set("area", t), n.set("download_num", i), n.set("acc_num", o), n.set("group_num", r), n.set("acc_bc_num", l), n.set("before_speed", Math.floor(d / 1024)), n.set("ing_speed", Math.floor(h / 1024)), f ? (n.set("referfrom", u.default.canUseKuaiNiao ? "v_pc_xlx_hytq_dl_svip_pack_kn" : "v_pc_xlx_hytq_dl_svip_pack"), n.set("aidfrom", (s.default.isVip ? "bj_" : "nv_") + t + "_after")) : (n.set("referfrom", "v_pc_xlx_hytq_dl_vip_pack"), n.set("aidfrom", t + "_after")), n.set("have_ypdl", p ? 1 : 0);
                let g = {
                    attribute1: f ? "download_svip_pack_after_try_click" : "download_vip_pack_after_try_click",
                    extData: n
                };
                return a.StatUtilitiesNS.trackEvent("xlx_vip_event", g).catch(), n.get("aidfrom")
            })
        }, t.after3Min = function (t, i, s, o, r, l, u, d, h, f) {
            return n(this, void 0, void 0, function* () {
                c.info("after3Min");
                let n = yield e();
                n.set("download_num", t), n.set("acc_num", i), n.set("group_num", s), n.set("acc_bc_num", o), n.set("before_speed", Math.floor(r / 1024)), n.set("ing_speed", Math.floor(l / 1024)), n.set("after_speed", Math.floor(u / 1024)), n.set("gcid_set", d), n.set("have_ypdl", f ? 1 : 0);
                let p = {
                    attribute1: h ? "download_svip_pack_after_try_3min" : "download_vip_pack_after_try_3min",
                    extData: n
                };
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", p).catch()
            })
        }
    }(e.PackageTryStatNS || (e.PackageTryStatNS = {}))
}, function (t, e, i) {
    t.exports = i(23)(19)
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(48), a = i(147), s = i(17), o = i(81), r = i(0).default.getLogger("shub-crypto");
    !function (t) {
        function e(t) {
            let e = s.createHash("md5");
            return e.update(t), e.digest()
        }

        t.encryptHttpBuffer = function (t) {
            if (0 !== t.readUInt16LE(16)) {
                let e = n.Buffer.alloc(20);
                t.copy(e, 0, 0, 20);
                let i = n.Buffer.alloc(t.length - 20);
                t.copy(i, 0, 20);
                let s = a.deflateSync(i);
                t = n.Buffer.concat([e, s])
            }
            let i = n.Buffer.alloc(8);
            t.copy(i, 0, 0, 7), i = e(i);
            let s = n.Buffer.alloc(12);
            t.copy(s, 0, 0, 11);
            let r = n.Buffer.alloc(t.length - 12);
            t.copy(r, 0, 12), r = o.ToolsUtilitiesAWNS.encryptBuffer(r, i);
            let l = n.Buffer.concat([s, r]);
            return l.writeUInt32LE(r.length, 8), l
        }, t.decryptHttpBuffer = function (t) {
            let i = null;
            try {
                let s = n.Buffer.alloc(8);
                t.copy(s, 0, 0, 7), s = e(s);
                let l = n.Buffer.alloc(12);
                t.copy(l, 0, 0, 11);
                let u = n.Buffer.alloc(t.length - 12);
                if (t.copy(u, 0, 12), u = o.ToolsUtilitiesAWNS.decryptBuffer(u, s), 0 !== (i = n.Buffer.concat([l, u])).readUInt16LE(16)) {
                    let t = n.Buffer.alloc(20);
                    i.copy(t, 0, 0, 20);
                    let e = n.Buffer.alloc(i.length - 20);
                    i.copy(e, 0, 20);
                    let s = a.inflateSync(e);
                    i = n.Buffer.concat([t, s])
                }
            } catch (t) {
                r.error("decryptHttpBuffer", t)
            }
            return i
        }
    }(e.ShubCryptoNS || (e.ShubCryptoNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2);
    !function (t) {
        t.writeUInt64LE = function (t, e, i) {
            const n = ~~(e / 4294967295), a = e % 4294967295 - n;
            return i = t.writeUInt32LE(a, i), i = t.writeUInt32LE(n, i)
        }, t.writeString = function (t, e, i, s) {
            return n(this, void 0, void 0, function* () {
                let n = null;
                if ("gbk" === s) {
                    let t = 936, i = yield a.client.callServerFunction("Utf8StringEncodeToBinary", e, t);
                    n = Buffer.from(i, "binary")
                } else n = Buffer.from(e, s);
                i = t.writeUInt32LE(n.byteLength, i);
                let o = n.copy(t, i, 0);
                return i + o
            })
        }, t.readUInt64LE = function (t, e) {
            let i = t.readUInt32LE(e);
            e += 4;
            let n = t.readUInt32LE(e);
            return [e += 4, n * Math.pow(2, 32) + i]
        }, t.readString = function (t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = t.readUInt32LE(e);
                e += 4;
                let s = void 0;
                if ("gbk" === i) {
                    let i = 936, o = t.toString("binary", e, e + n);
                    s = yield a.client.callServerFunction("Utf8StringDecodeFromBinary", o, i)
                } else s = t.toString(i, e, e + n);
                return [e += n, s]
            })
        }
    }(e.BufferUtilitiesNS || (e.BufferUtilitiesNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(53), o = i(7), r = i(8), l = i(3), u = i(41), c = i(14), d = i(42),
        h = i(5), {isDef: f} = h.ThunderUtil, p = i(91), g = i(0), S = i(189),
        y = g.default.getLogger("VipDownload:vip-download-helper");
    !function (t) {
        let e = [];

        function i(t, e) {
            let i = t, n = e;
            return t === r.VipDownloadDefineNS.VipTaskType.NoVip && (i = r.VipDownloadDefineNS.VipTaskType.Vip, n = r.VipDownloadDefineNS.VipTaskStatus.Init), [i, n]
        }

        function h(t, e) {
            return e !== r.VipDownloadDefineNS.VipTaskStatus.Unkown && (t !== r.VipDownloadDefineNS.VipTaskType.NoVip || e === r.VipDownloadDefineNS.VipTaskStatus.Init)
        }

        t.setDbTaskIds = function (t) {
            e = t
        }, t.getDbTaskIds = function () {
            return e
        }, t.createStatusError = function (t) {
            return n(this, void 0, void 0, function* () {
                let e = t;
                if (e.errorStep = d.HttpDefineNS.ErrorStep.Status, e.result && e.result > 0) if (e.result >= 10 && e.result <= 30) {
                    e.isForbidResource = !0;
                    let t = yield p.default.getMessage(p.MessageCodeType.speed_code, e.result);
                    t && (e.message = t), (t = yield p.default.getMessage(p.MessageCodeType.speed_partunable_code, e.result)) && (e.messagePartForbid = t)
                } else e.result >= 201 && e.result <= 300 && (e.message = "正在查找资源", e.isNoResource = !0);
                return e
            })
        }, t.createTokenError = function (t) {
            return n(this, void 0, void 0, function* () {
                let e = t;
                return e.errorStep = d.HttpDefineNS.ErrorStep.Token, e
            })
        }, t.createDcdnError = function (t) {
            let e = void 0;
            switch (t) {
                case o.DownloadKernel.DcdnStatusCode.ResourceNotFound:
                    e = "正在查找资源";
                    break;
                case o.DownloadKernel.DcdnStatusCode.AuthorizingFailed:
                    e = "加速状态异常";
                    break;
                case o.DownloadKernel.DcdnStatusCode.ForbidByCopyright:
                case o.DownloadKernel.DcdnStatusCode.ForbidByPorNoGraphy:
                case o.DownloadKernel.DcdnStatusCode.ForbidByReactionary:
                case o.DownloadKernel.DcdnStatusCode.ForbidByOtherFilter:
                    e = "资源被屏蔽"
            }
            return {errorStep: d.HttpDefineNS.ErrorStep.Acclerate, result: t, message: e}
        }, t.getVipTaskTypePriority = function (t) {
            let e = 0;
            switch (t) {
                case r.VipDownloadDefineNS.VipTaskType.Vip:
                    e = 1;
                    break;
                case r.VipDownloadDefineNS.VipTaskType.Ad:
                    e = 2;
                    break;
                case r.VipDownloadDefineNS.VipTaskType.Try:
                    e = 3
            }
            return e
        }, t.trans2OuterVipTypeAndStatus = i, t.needFireOuterVipStatusEvent = h, t.isVipTaskTypeEnable = function (t, e) {
            let i = !0;
            switch (e) {
                case r.VipDownloadDefineNS.VipTaskType.NoVip:
                    i = !l.default.isVip;
                    break;
                case r.VipDownloadDefineNS.VipTaskType.Vip:
                    i = l.default.isLogin;
                    break;
                case r.VipDownloadDefineNS.VipTaskType.Try:
                    i = !1;
                    let n = u.default.getTask(t);
                    n && (i = n.type === r.VipDownloadDefineNS.TryType.PlatinumVip || n.trySection === r.VipDownloadDefineNS.TryType.PlatinumVip ? !l.default.authority : !l.default.isSuperVip);
                    break;
                case r.VipDownloadDefineNS.VipTaskType.Ad:
                    i = !l.default.authority
            }
            return i
        }, t.fireVipTaskInfoChanged = function (t, e, i, n) {
            c.default.emit(c.TaskEventNS.vipTaskInfoChanged, t, e, i), e.enterType === r.VipDownloadDefineNS.VipTaskType.NoVip && (e.packagetrying || e.baotuanDetail && (e.baotuanDetail.baotuanXgt === r.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed || e.baotuanDetail.baotuanXgt === r.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut || e.baotuanDetail.baotuanXgt === r.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto) || S.getQrCodeStatus(t) && (e.enterStatus = r.VipDownloadDefineNS.VipTaskStatus.Acclerating));
            a.client.broadcastEvent(s.BroadcastEventNS.vipTaskInfoChanged, t, e, i), a.client.callServerFunction("FireEventFunction", s.BroadcastEventNS.vipTaskInfoChanged, t, JSON.stringify(e), i).catch(), n.info(s.BroadcastEventNS.vipTaskInfoChanged, t, JSON.stringify(e), i)
        }, t.fireVipSubTaskInfoChanged = function (t, e, n, o, r) {
            let l = void 0, u = void 0;
            if (h(n, o) && ([l, u] = i(n, o)), f(l) && f(u) && e && e.length > 0) {
                let i = {subId: -1, enterType: l, enterStatus: u, error: r};
                a.client.broadcastEvent(s.BroadcastEventNS.vipSubTaskInfoChanged, t, e, i);
                let n = JSON.stringify(i);
                a.client.callServerFunction("FireEventFunction", s.BroadcastEventNS.vipSubTaskInfoChanged, t, JSON.stringify(e), n).catch(), y.info(s.BroadcastEventNS.vipSubTaskInfoChanged, t, e, n)
            }
        }, t.fireTaskAcclerateStatusChanged = function (t, e, n) {
            let a = void 0, s = void 0;
            h(e, n) && ([a, s] = i(e, n)), f(a) && f(s) && (c.default.emit(c.TaskEventNS.taskAcclerateStatusChanged, t, a, s), y.info(c.TaskEventNS.taskAcclerateStatusChanged, "taskId", t, a, s))
        }
    }(e.VipDownloadHelperNS || (e.VipDownloadHelperNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(1), o = i(5), r = i(0), l = i(215), u = r.default.getLogger("VipDownload:errorcode-config");
    !function (t) {
        t.none = "none", t.http_code = "http_code", t.speed_code = "speed_code", t.speed_partunable_code = "speed_partunable_code"
    }(e.MessageCodeType || (e.MessageCodeType = {}));

    class c {
        constructor() {
            this.codeMap = new Map, this.errorCodeEx = null
        }

        getMessage(t, e) {
            return n(this, void 0, void 0, function* () {
                u.info("getMessage", t, e);
                let i = void 0, n = this.codeMap.get(t);
                if (n || (n = yield this.initCode(t)), n) for (let t of n) if (t.min <= e && t.max >= e) {
                    i = t.message;
                    break
                }
                return i
            })
        }

        getMessageItem(t, e) {
            return n(this, void 0, void 0, function* () {
                u.info("getMessageItem", t, e);
                let i = void 0, n = this.codeMap.get(t);
                if (n || (n = yield this.initCode(t)), n) for (let t of n) if (t.min <= e && t.max >= e) {
                    i = t;
                    break
                }
                return i
            })
        }

        initCode(t) {
            return n(this, void 0, void 0, function* () {
                let e = null;
                o.ThunderUtil.versionCompare(s.default.thunderVersionString, "10.1.28.0") <= 0 ? (this.errorCodeEx || (this.errorCodeEx = new l.ErrorCodeConfigEx, yield this.errorCodeEx.init()), e = this.errorCodeEx.getData(t)) : e = yield a.client.callServerFunction("GetErrorCodeConfigData", t), u.info("jsonStr", e);
                let i = null;
                try {
                    i = JSON.parse(e)
                } catch (t) {
                    u.error(t)
                }
                let n = null;
                return i && (n = this.parseTypeData(i), this.codeMap.set(t, n)), n
            })
        }

        parseTypeData(t) {
            let e = [];
            for (let i of t) if (i.code) {
                let t = i.code.length, n = i.code.search(/\-/), a = 0, s = 0;
                n > 0 && n < t - 1 ? (a = Number(i.code.substring(0, n)), s = Number(i.code.substring(n + 1, t))) : (a = Number(i.code), s = Number(i.code)), e.push({
                    min: a,
                    max: s,
                    message: i.message,
                    url: i.url,
                    display: i.display,
                    hovermessage: i.hovermessage
                })
            }
            return e
        }
    }

    e.ErrorCodeConfig = c, e.default = new c
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(0).default.getLogger("async-remote-call"), s = i(154), o = i(9), r = i(34);
    e.asyncRemoteCall = new class extends o.EventEmitter {
        constructor() {
            super(), this.mapObj = new Map, this.mapObjIniting = new Map, "renderer" !== process.type && a.error('can not import "renderer-process-call" module in non-renderer process', process.type)
        }

        getAppName() {
            return n(this, void 0, void 0, function* () {
                if (void 0 === this.appName) {
                    let t = yield this.getApp();
                    this.appName = yield t.getName()
                }
                return this.appName
            })
        }

        getAppVersion() {
            return n(this, void 0, void 0, function* () {
                if (void 0 === this.appVersion) {
                    let t = yield this.getApp();
                    this.appVersion = yield t.getVersion()
                }
                return this.appVersion
            })
        }

        getProcess() {
            return n(this, void 0, void 0, function* () {
                return s.global.process.__resolve()
            })
        }

        getIpcMain() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("ipcMain")
            })
        }

        getDialog() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("dialog")
            })
        }

        getApp() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("app")
            })
        }

        getShell() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("shell")
            })
        }

        getMenu() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("Menu")
            })
        }

        getScreen() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("screen")
            })
        }

        getBrowserWindow() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("BrowserWindow")
            })
        }

        getGlobalShortcut() {
            return n(this, void 0, void 0, function* () {
                return this.getCurrentObject("globalShortcut")
            })
        }

        getCurrentWebContents() {
            return n(this, void 0, void 0, function* () {
                let t = this.mapObj.get("currentWebContents");
                return void 0 === t && (this.mapObjIniting.get("currentWebContents") ? t = yield new Promise(t => n(this, void 0, void 0, function* () {
                    this.on("OnInitCurrentWebContents", e => {
                        t(e)
                    })
                })) : (this.mapObjIniting.set("currentWebContents", !0), t = yield s.getCurrentWebContents().__resolve(), this.mapObjIniting.set("currentWebContents", !1), this.emit("OnInitCurrentWebContents", t), this.listeners("OnInitCurrentWebContents").forEach(t => {
                    this.removeListener("OnInitCurrentWebContents", t)
                })), this.mapObj.set("currentWebContents", t)), t
            })
        }

        getCurrentWindow() {
            return n(this, void 0, void 0, function* () {
                let t = this.mapObj.get("currentWindow");
                return void 0 === t && (this.mapObjIniting.get("currentWindow") ? t = yield new Promise(t => n(this, void 0, void 0, function* () {
                    this.on("OnInitCurrentWindow", e => {
                        t(e)
                    })
                })) : (this.mapObjIniting.set("currentWindow", !0), t = yield s.getCurrentWindow().__resolve(), this.mapObjIniting.set("currentWindow", !1), this.emit("OnInitCurrentWindow", t), this.listeners("OnInitCurrentWindow").forEach(t => {
                    this.removeListener("OnInitCurrentWindow", t)
                })), this.mapObj.set("currentWindow", t)), t
            })
        }

        getCurrentObject(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.mapObj.get(t);
                return r.isNullOrUndefined(e) && (this.mapObjIniting.get(t) ? e = yield new Promise(e => n(this, void 0, void 0, function* () {
                    this.on(t, t => {
                        e(t)
                    })
                })) : (this.mapObjIniting.set(t, !0), e = yield s.electron[t].__resolve(), this.mapObjIniting.set(t, !1), this.emit(t, e), this.listeners(t).forEach(e => {
                    this.removeListener(t, e)
                })), this.mapObj.set(t, e)), e
            })
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(162), s = i(15), o = i(3), r = i(1), l = i(18), u = i(191);

    class c {
        prepare(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = new s.HttpSession, n = ++c.sequence, a = o.default.userId, d = yield o.default.getSessionId(),
                    h = r.default.currentTime, f = yield l.HttpJsonCryptoNS.getUriParam(n, h);
                if (u.default.httpDebug(t.apiName.substr(1 + t.apiName.lastIndexOf("/"))) && (f += "&debug=true", t.debug = !0), i.retries = 2, i.timeout = 2e4, i.host = "team.speed.cdn.vip.xunlei.com", i.path = "/" + t.getApiName() + "?" + f, i.auth = l.HttpJsonCryptoNS.getAuthorization(a, d), i.accept = l.HttpJsonCryptoNS.getAccept(), t.userId = Number(a), t.peerId = yield o.default.getPeerId(), e && e(i), i.body = yield t.create(), t.logger.info(t.getDescript(), t.getApiName(), "request", t), "post" === t.getMethod()) {
                    return new Promise(e => {
                        i.post(i => {
                            let n = null;
                            if (t.debug ? t.logger.info(t.getDescript(), t.getApiName(), "data", i.body.toString()) : t.logger.info(t.getDescript(), t.getApiName(), "data", i), !t.careUserId || Number(o.default.userId) === t.userId) {
                                let e = i.headers["random-num"];
                                if (200 === i.statusCode && i.body && e) {
                                    let a = Number(e).valueOf();
                                    n = {userId: t.userId, r: a, body: i.body}
                                }
                            }
                            e(n)
                        }, i => {
                            t.logger.info(t.getDescript(), t.getApiName(), "error", i), e(null)
                        })
                    })
                }
                return new Promise(e => {
                    i.get(i => {
                        let n = null;
                        if (t.logger.info(t.getDescript(), t.getApiName(), "data", i), !t.careUserId || Number(o.default.userId) === t.userId) {
                            let e = i.headers["random-num"];
                            if (200 === i.statusCode && i.body && e) {
                                let a = Number(e).valueOf();
                                n = {userId: t.userId, r: a, body: i.body}
                            }
                        }
                        e(n)
                    }, i => {
                        t.logger.info(t.getDescript(), t.getApiName(), "error", i), e(null)
                    })
                })
            })
        }

        noviceJoin(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        join(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        cutLine(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        number(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        cutlineLeft(t) {
            return n(this, void 0, void 0, function* () {
                t || (t = new a.VipNetWorkData.BaoTuan.Request.CutlineLeft);
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        entrance(t) {
            return n(this, void 0, void 0, function* () {
                t || (t = new a.VipNetWorkData.BaoTuan.Request.Entrance);
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        config(t) {
            return n(this, void 0, void 0, function* () {
                t || (t = new a.VipNetWorkData.BaoTuan.Request.Config);
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        quit(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        packageTimes(t) {
            return n(this, void 0, void 0, function* () {
                t || (t = new a.VipNetWorkData.BaoTuan.Request.PackageTimes);
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }

        setPackageTimes(t) {
            return n(this, void 0, void 0, function* () {
                t || (t = new a.VipNetWorkData.BaoTuan.Request.SetPackageTimes);
                let e = yield this.prepare(t), i = null;
                return e && (i = t.parse(e.userId, e.r, e.body)), i
            })
        }
    }

    c.sequence = 0, e.BaotuanApi = c, e.default = new c
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e, i;
        !function (t) {
            t[t.Vip = 1] = "Vip", t[t.Try = 2] = "Try"
        }(e = t.KuaiNiaoType || (t.KuaiNiaoType = {})), function (t) {
            t[t.Unkown = -1] = "Unkown", t[t.Init = 0] = "Init", t[t.Enable = 1] = "Enable", t[t.Commiting = 2] = "Commiting", t[t.Failed = 3] = "Failed", t[t.Alive = 4] = "Alive", t[t.Finish = 5] = "Finish"
        }(i = t.KuaiNiaoStatus || (t.KuaiNiaoStatus = {}))
    }(e.KuaiNiaoDefineNS || (e.KuaiNiaoDefineNS = {}))
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r = {}.hasOwnProperty;
        o = i(46), s = o.isObject, a = o.isFunction, n = i(19), e = i(199), t.exports = function (t) {
            function i(t, e, n) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing element name");
                this.name = this.stringify.eleName(e), this.attributes = {}, null != n && this.attribute(n), t.isDocument && (this.isRoot = !0, this.documentObject = t, t.rootObject = this)
            }

            return function (t, e) {
                for (var i in e) r.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, n), i.prototype.clone = function () {
                var t, e, i, n;
                for (e in(i = Object.create(this)).isRoot && (i.documentObject = null), i.attributes = {}, n = this.attributes) r.call(n, e) && (t = n[e], i.attributes[e] = t.clone());
                return i.children = [], this.children.forEach(function (t) {
                    var e;
                    return (e = t.clone()).parent = i, i.children.push(e)
                }), i
            }, i.prototype.attribute = function (t, i) {
                var n, o;
                if (null != t && (t = t.valueOf()), s(t)) for (n in t) r.call(t, n) && (o = t[n], this.attribute(n, o)); else a(i) && (i = i.apply()), this.options.skipNullAttributes && null == i || (this.attributes[t] = new e(this, t, i));
                return this
            }, i.prototype.removeAttribute = function (t) {
                var e, i, n;
                if (null == t) throw new Error("Missing attribute name");
                if (t = t.valueOf(), Array.isArray(t)) for (i = 0, n = t.length; i < n; i++) e = t[i], delete this.attributes[e]; else delete this.attributes[t];
                return this
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).element(this)
            }, i.prototype.att = function (t, e) {
                return this.attribute(t, e)
            }, i.prototype.a = function (t, e) {
                return this.attribute(t, e)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing CDATA text");
                this.text = this.stringify.cdata(e)
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.clone = function () {
                return Object.create(this)
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).cdata(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing comment text");
                this.text = this.stringify.comment(e)
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.clone = function () {
                return Object.create(this)
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).comment(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a = {}.hasOwnProperty;
        n = i(46).isObject, e = i(19), t.exports = function (t) {
            function i(t, e, a, s) {
                var o;
                i.__super__.constructor.call(this, t), n(e) && (e = (o = e).version, a = o.encoding, s = o.standalone), e || (e = "1.0"), this.version = this.stringify.xmlVersion(e), null != a && (this.encoding = this.stringify.xmlEncoding(a)), null != s && (this.standalone = this.stringify.xmlStandalone(s))
            }

            return function (t, e) {
                for (var i in e) a.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, e), i.prototype.toString = function (t) {
                return this.options.writer.set(t).declaration(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r, l = {}.hasOwnProperty;
        r = i(46).isObject, o = i(19), e = i(100), a = i(101), n = i(102), s = i(103), t.exports = function (t) {
            function i(t, e, n) {
                var a, s;
                i.__super__.constructor.call(this, t), this.documentObject = t, r(e) && (e = (a = e).pubID, n = a.sysID), null == n && (n = (s = [e, n])[0], e = s[1]), null != e && (this.pubID = this.stringify.dtdPubID(e)), null != n && (this.sysID = this.stringify.dtdSysID(n))
            }

            return function (t, e) {
                for (var i in e) l.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, o), i.prototype.element = function (t, e) {
                var i;
                return i = new n(this, t, e), this.children.push(i), this
            }, i.prototype.attList = function (t, i, n, a, s) {
                var o;
                return o = new e(this, t, i, n, a, s), this.children.push(o), this
            }, i.prototype.entity = function (t, e) {
                var i;
                return i = new a(this, !1, t, e), this.children.push(i), this
            }, i.prototype.pEntity = function (t, e) {
                var i;
                return i = new a(this, !0, t, e), this.children.push(i), this
            }, i.prototype.notation = function (t, e) {
                var i;
                return i = new s(this, t, e), this.children.push(i), this
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).docType(this)
            }, i.prototype.ele = function (t, e) {
                return this.element(t, e)
            }, i.prototype.att = function (t, e, i, n, a) {
                return this.attList(t, e, i, n, a)
            }, i.prototype.ent = function (t, e) {
                return this.entity(t, e)
            }, i.prototype.pent = function (t, e) {
                return this.pEntity(t, e)
            }, i.prototype.not = function (t, e) {
                return this.notation(t, e)
            }, i.prototype.up = function () {
                return this.root() || this.documentObject
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e, n, a, s, o) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing DTD element name");
                if (null == n) throw new Error("Missing DTD attribute name");
                if (!a) throw new Error("Missing DTD attribute type");
                if (!s) throw new Error("Missing DTD attribute default");
                if (0 !== s.indexOf("#") && (s = "#" + s), !s.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");
                if (o && !s.match(/^(#FIXED|#DEFAULT)$/)) throw new Error("Default value only applies to #FIXED or #DEFAULT");
                this.elementName = this.stringify.eleName(e), this.attributeName = this.stringify.attName(n), this.attributeType = this.stringify.dtdAttType(a), this.defaultValue = this.stringify.dtdAttDefault(o), this.defaultValueType = s
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.toString = function (t) {
                return this.options.writer.set(t).dtdAttList(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a = {}.hasOwnProperty;
        n = i(46).isObject, e = i(19), t.exports = function (t) {
            function i(t, e, a, s) {
                if (i.__super__.constructor.call(this, t), null == a) throw new Error("Missing entity name");
                if (null == s) throw new Error("Missing entity value");
                if (this.pe = !!e, this.name = this.stringify.eleName(a), n(s)) {
                    if (!s.pubID && !s.sysID) throw new Error("Public and/or system identifiers are required for an external entity");
                    if (s.pubID && !s.sysID) throw new Error("System identifier is required for a public external entity");
                    if (null != s.pubID && (this.pubID = this.stringify.dtdPubID(s.pubID)), null != s.sysID && (this.sysID = this.stringify.dtdSysID(s.sysID)), null != s.nData && (this.nData = this.stringify.dtdNData(s.nData)), this.pe && this.nData) throw new Error("Notation declaration is not allowed in a parameter entity")
                } else this.value = this.stringify.dtdEntityValue(s)
            }

            return function (t, e) {
                for (var i in e) a.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, e), i.prototype.toString = function (t) {
                return this.options.writer.set(t).dtdEntity(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e, n) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing DTD element name");
                n || (n = "(#PCDATA)"), Array.isArray(n) && (n = "(" + n.join(",") + ")"), this.name = this.stringify.eleName(e), this.value = this.stringify.dtdElementValue(n)
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.toString = function (t) {
                return this.options.writer.set(t).dtdElement(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e, n) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing notation name");
                if (!n.pubID && !n.sysID) throw new Error("Public or system identifiers are required for an external entity");
                this.name = this.stringify.eleName(e), null != n.pubID && (this.pubID = this.stringify.dtdPubID(n.pubID)), null != n.sysID && (this.sysID = this.stringify.dtdSysID(n.sysID))
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.toString = function (t) {
                return this.options.writer.set(t).dtdNotation(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing raw text");
                this.value = this.stringify.raw(e)
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.clone = function () {
                return Object.create(this)
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).raw(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing element text");
                this.value = this.stringify.eleText(e)
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.clone = function () {
                return Object.create(this)
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).text(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n = {}.hasOwnProperty;
        e = i(19), t.exports = function (t) {
            function i(t, e, n) {
                if (i.__super__.constructor.call(this, t), null == e) throw new Error("Missing instruction target");
                this.target = this.stringify.insTarget(e), n && (this.value = this.stringify.insValue(n))
            }

            return function (t, e) {
                for (var i in e) n.call(e, i) && (t[i] = e[i]);

                function a() {
                    this.constructor = t
                }

                a.prototype = e.prototype, t.prototype = new a, t.__super__ = e.prototype
            }(i, e), i.prototype.clone = function () {
                return Object.create(this)
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).processingInstruction(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(108), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(2), r = i(8), l = i(259), u = i(260), c = i(261), d = i(262), h = i(263), f = i(265),
        p = i(266), g = i(7), S = i(10), y = i(14), T = i(3), k = i(21), m = i(16), v = i(5), w = i(20),
        _ = i(1), {isDef: D} = v.ThunderUtil, b = i(0).default.getLogger("VipDownload:item-vip-renderer");
    let N = class extends s.Vue {
        constructor() {
            super(...arguments), this.isLogin = !1, this.isVip = !1, this.vasType = 0, this.authority = !1, this.isShowChangWei = !1, this.userStateChange = !1, this.taskId = -1, this.taskUIStatus = "Init", this.btErrorType = "", this.taskInfo = null
        }

        onTaskIdChanged(t) {
            this.loadTaskInfo()
        }

        get isBaotuan() {
            return !!this.taskInfo && this.taskInfo.xgtType === r.VipDownloadDefineNS.XgtType.Baotuan
        }

        get isTry() {
            return !!this.taskInfo && this.taskInfo.xgtType === r.VipDownloadDefineNS.XgtType.Try
        }

        get isAd() {
            return !!this.taskInfo && this.taskInfo.xgtType === r.VipDownloadDefineNS.XgtType.Ad
        }

        get isGame() {
            return !!this.taskInfo && this.taskInfo.xgtType === r.VipDownloadDefineNS.XgtType.PlayGame
        }

        get isPackageTry() {
            return !!this.taskInfo && this.taskInfo.xgtType === r.VipDownloadDefineNS.XgtType.PackageTry
        }

        get isCloud() {
            if (this.taskInfo) {
                let t = !0, e = "CloudShowSpeedXgt";
                switch (this.taskInfo.xgtType) {
                    case r.VipDownloadDefineNS.XgtType.CloudWaiting:
                        e = "CloudShowWaittingXgt";
                        break;
                    case r.VipDownloadDefineNS.XgtType.CloudDownloading:
                        break;
                    default:
                        t = !1
                }
                if (t) {
                    let t = this.taskId;
                    setTimeout(() => {
                        o.client.callRemoteClientFunction(_.default.pluginWebviewName, e, t).catch()
                    }, 10)
                }
                return t
            }
            return !1
        }

        transTaskUIStatus(t) {
            let e = "Init";
            switch (t) {
                case r.VipDownloadDefineNS.VipTaskStatus.Init:
                    e = "Init";
                    break;
                case r.VipDownloadDefineNS.VipTaskStatus.CommitWait:
                case r.VipDownloadDefineNS.VipTaskStatus.Commiting:
                case r.VipDownloadDefineNS.VipTaskStatus.CommitSuccess:
                case r.VipDownloadDefineNS.VipTaskStatus.AcclerateWait:
                    e = "Wait";
                    break;
                case r.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped:
                    e = "Stoped";
                    break;
                case r.VipDownloadDefineNS.VipTaskStatus.Acclerating:
                    e = "Started";
                    break;
                case r.VipDownloadDefineNS.VipTaskStatus.SearchResource:
                    e = "Search";
                    break;
                case r.VipDownloadDefineNS.VipTaskStatus.CommitFailed:
                case r.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed:
                    e = "Failed";
                    break;
                case r.VipDownloadDefineNS.VipTaskStatus.Finished:
                    e = "Finished"
            }
            return e
        }

        loadTaskInfo() {
            let t = null;
            D(this.taskId) && this.taskId > 0 && (t = k.default.getVipTaskInfo(this.taskId)), this.onVipTaskInfoChanged(this.taskId, t);
            let e = k.default.getBtErrorType(this.taskId);
            e = e || "", this.onBtSubFileForbidden(this.taskId, e)
        }

        loadUserInfo() {
            return a(this, void 0, void 0, function* () {
                yield this.onUserAuthorityChanged()
            })
        }

        trackShow() {
            b.info("trackShow");
            let t = new Map;
            t.set("is_login", this.isLogin ? 1 : 0), t.set("is_vip", this.isVip ? 1 : 0), t.set("vip_type", this.vasType), t.set("plugin_name", _.default.pluginName), t.set("plugin_version", _.default.pluginVersion);
            let e = {attribute1: "plugin_show", extData: t};
            m.StatUtilitiesNS.trackEvent("xlx_vip_event", e)
        }

        onDownloadItemActive(t, e, i) {
            t === g.DownloadKernel.CategroyViewID.Downloading && (e ? this.taskId = i : i === this.taskId && (this.taskId = -1))
        }

        onBtSubFileForbidden(t, e) {
            t === this.taskId && (this.btErrorType = e)
        }

        onVipTaskInfoChanged(t, e) {
            if (t === this.taskId) {
                let t = e ? e.taskStatus : void 0;
                e && e.taskType === r.VipDownloadDefineNS.VipTaskType.Vip && e.taskStatus > r.VipDownloadDefineNS.VipTaskStatus.Init && (e.error || e.isPartialForbid) ? this.taskUIStatus = "Failed" : this.taskUIStatus = this.transTaskUIStatus(t), this.taskInfo = e, this.isShowChangWei = w.BaoTuanSettingNS.isUserJoiningChangWei()
            }
        }

        onUserAuthorityChanged(t) {
            return a(this, void 0, void 0, function* () {
                if (this.isLogin = yield o.client.callServerFunction("IsLogined"), this.isLogin) try {
                    let t = JSON.parse(yield o.client.callServerFunction("GetUserInfo", 2));
                    D(t) && (this.vasType = Number(t.vasType).valueOf(), this.isVip = Boolean("1" === t.isVip))
                } catch (t) {
                    b.info("onUserAuthorityChanged err", t)
                } else this.vasType = 0, this.isVip = !1;
                this.authority = t, this.userStateChange = !this.userStateChange
            })
        }

        created() {
            S.default.addListener(S.DkEventNS.downloadItemActive, this.onDownloadItemActive.bind(this)), T.default.addListener(T.UserEventNS.authorityChanged, this.onUserAuthorityChanged.bind(this)), y.default.addListener(y.TaskEventNS.btSubFileForbidden, this.onBtSubFileForbidden.bind(this)), y.default.addListener(y.TaskEventNS.vipTaskInfoChanged, this.onVipTaskInfoChanged.bind(this)), this.loadUserInfo().then(() => {
                this.trackShow()
            }).catch()
        }
    };
    n([s.Watch("taskId")], N.prototype, "onTaskIdChanged", null), N = n([s.Component({
        components: {
            ItemVipStatus: l.default,
            ItemTryStatus: u.default,
            ItemAdStatus: c.default,
            ItemBaotuanStatus: h.default,
            ItemGameStatus: d.default,
            ItemPackageTryStatus: f.default,
            ItemCloudStatus: p.default
        }
    })], N), e.default = N
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(110), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(30), r = i(198), l = i(186), u = i(5), c = i(148), d = i(2), {isUndef: h} = u.ThunderUtil,
        f = i(50), p = i(27), g = i(0), S = i(1), y = i(13), T = i(3),
        k = g.default.getLogger("VipDownload:item-vip-status");
    let m = class extends s.Vue {
        constructor() {
            super(...arguments), this.sceneItem = null, this.vipBtnType = -1, this.vipItemData = null, this.superItemData = null, this.isWarnStylePeerid = !1, this.isH = !1, this.isShowSurperJoin = !1, this.isStartedSwitch = !1
        }

        onAuthorityChange() {
            this.updateVipBtn()
        }

        onTaskUIStatusChange() {
            this.updateVipBtn()
        }

        onTaskIdChanged(t) {
            this.loadTaskScene(), this.updateVipBtn()
        }

        updateVipBtn() {
            do {
                if (h(this.taskId) || this.taskId < 0) break;
                let t = !1;
                if (this.isVip || (t = "Init" === this.taskUIStatus), t) {
                    this.vipBtnType = this.authority ? 0 : 1;
                    let t = 1 === this.vipBtnType ? this.superItemData : this.vipItemData;
                    c.VipStatNS.vipButtonShow(this.taskId, t, "task", !!this.taskInfo && this.taskInfo.isCloudTask)
                } else this.vipBtnType = -1
            } while (0)
        }

        clickScenceText() {
            o.default.clickScenceText(this.taskId, this.sceneItem)
        }

        clickErrorScenceText() {
            d.client.callServerFunction("SwitchDetail", this.taskId, "files").catch()
        }

        clickVipButton() {
            o.default.clickVipAcclerateBtn(this.taskId, this.vipItemData, "task")
        }

        clickSuperVipButton() {
            o.default.clickVipAcclerateBtn(this.taskId, this.superItemData, "task")
        }

        get isSuper() {
            return !!this.taskInfo && (this.taskInfo.isSuper || this.taskInfo.packagetrying && this.taskInfo.surperPackage && !this.taskInfo.isHResource)
        }

        get isSuperStarted() {
            return !(!this.isSuper || "Started" !== this.taskUIStatus)
        }

        get defaultSceneText() {
            let t = "开通会员，享更快下载速度";
            return this.isVip && (t = "超级会员，加速更给力"), t
        }

        get errorSceneText() {
            let t = "部分文件无法下载，点击查看";
            return "Forbidden" === this.btErrorType && (t = "含有敏感资源，部分文件无法下载"), t
        }

        get sceneText() {
            return this.sceneItem.text
        }

        get isDefaultScene() {
            return null === this.sceneItem
        }

        get isErrorScene() {
            return !(!this.btErrorType || "" === this.btErrorType)
        }

        startSwitch() {
            this.isStartedSwitch || (this.isStartedSwitch = !0, setInterval(() => {
                this.isShowSurperJoin = !this.isShowSurperJoin
            }, 3e3))
        }

        get showSurperIcon() {
            return "Started" === this.taskUIStatus && this.isSuper
        }

        get taskStatusText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Wait":
                    t = "加速准备中";
                    break;
                case"Started":
                    this.isSuper ? (this.startSwitch(), t = this.isShowSurperJoin ? "强力连通已开启" : "超级加速已开启") : t = "会员已加速";
                    break;
                case"Stoped":
                    this.taskInfo && this.taskInfo.isAcclerated && (t = "加速暂停中");
                    break;
                case"Search":
                    t = "正在查找资源";
                    break;
                case"Failed":
                    t = (t = this.taskErrorText).replace("，", ",")
            }
            return t
        }

        get taskErrorText() {
            let t = "";
            return this.isErrorScene || (t = "文件无法加速", this.taskInfo && (this.taskInfo.isPartialForbid ? (t = "部分资源疑似敏感", this.taskInfo.error && this.taskInfo.error.messagePartForbid && (t = this.taskInfo.error.messagePartForbid)) : this.taskInfo.error && this.taskInfo.error.message ? t = this.taskInfo.error.message : this.taskInfo.allSubTaskDcdnError || (t = ""))), t
        }

        get showFailed() {
            return !this.showWarn && "Failed" === this.taskUIStatus
        }

        get showWarn() {
            return !("Failed" !== this.taskUIStatus || !this.isWarnStylePeerid) && (!!(this.taskInfo && this.taskInfo.error && this.taskInfo.error.result >= 10 && this.taskInfo.error.result <= 30) && (!this.taskErrorText.startsWith(" ") && "" !== this.taskErrorText))
        }

        get vipBtnText() {
            let t = "会员加速";
            return this.vipItemData && (t = this.vipItemData.text), t
        }

        get superBtnText() {
            let t = "超级加速";
            return this.superItemData && (t = this.superItemData.text), t
        }

        loadTaskScene() {
            let t = r.default.getScene(this.taskId);
            t && this.onTaskSceneChanged(this.taskId, t)
        }

        onTaskSceneChanged(t, e) {
            t === this.taskId && (this.sceneItem = e, e && l.SceneStatNS.scenceShow(t, e))
        }

        onConfigureReady() {
            k.info("onConfigureReady"), this.vipItemData = p.default.getItemData(p.ItemName.VipButton), this.superItemData = p.default.getItemData(p.ItemName.SuperVipButton)
        }

        initWarnStyle(t, e) {
            return a(this, void 0, void 0, function* () {
                if (k.info("initWarnStyle"), y.default.isConfigInitFinish()) {
                    let t = yield T.default.getPeerId(), e = y.default.getValue("VipDownload", "WarnStylePeerid");
                    this.isWarnStylePeerid = S.default.isPeeridMatchSha256Region(t, e, 8), k.info("isWarnStylePeerid", t, this.isWarnStylePeerid)
                } else y.default.addListener(y.ConfigEventNS.configGet, this.onConfigGet.bind(this))
            })
        }

        onConfigGet() {
            return a(this, void 0, void 0, function* () {
                this.initWarnStyle(), y.default.removeListener(y.ConfigEventNS.configGet, this.onConfigGet)
            })
        }

        created() {
            this.onConfigureReady(), this.loadTaskScene(), this.updateVipBtn(), this.initWarnStyle(), r.default.addListener(r.SceneEventNS.taskSceneChanged, this.onTaskSceneChanged.bind(this)), f.default.addListener(f.AbtestEventNS.configureReady, this.onConfigureReady.bind(this))
        }

        destroyed() {
            r.default.removeListener(r.SceneEventNS.taskSceneChanged, this.onTaskSceneChanged), f.default.removeListener(f.AbtestEventNS.configureReady, this.onConfigureReady)
        }
    };
    n([s.Prop({})], m.prototype, "taskId", void 0), n([s.Prop({})], m.prototype, "taskUIStatus", void 0), n([s.Prop({})], m.prototype, "isVip", void 0), n([s.Prop({})], m.prototype, "authority", void 0), n([s.Prop({})], m.prototype, "btErrorType", void 0), n([s.Prop({})], m.prototype, "taskInfo", void 0), n([s.Watch("authority")], m.prototype, "onAuthorityChange", null), n([s.Watch("taskUIStatus")], m.prototype, "onTaskUIStatusChange", null), n([s.Watch("taskId")], m.prototype, "onTaskIdChanged", null), m = n([s.Component({})], m), e.default = m
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(112), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(8), r = i(14), l = i(30), u = i(44), c = i(21), d = i(50), h = i(27), f = i(1), p = i(13),
        g = i(3), S = i(5), {isDef: y} = S.ThunderUtil, T = i(0).default.getLogger("VipDownload:item-try-status");
    let k = new Map, m = class extends s.Vue {
        constructor() {
            super(...arguments), this.progress = 0, this.remainSize = 0, this.normalSpeed = 0, this.vipSpeed = 0, this.showedRocket = !1, this.tryReadyIconText = "", this.tryingIconText = "", this.tryFinishIconText = "", this.tryReadyText = "", this.tryingText = "", this.tryFinishText = "", this.tryReadyBtnText = "", this.tryingBtnText = "", this.tryFinishBtnText = "", this.superTryReadyBtnText = "", this.superTryingBtnText = "", this.superTryFinishBtnText = "", this.superTryReadyText = "", this.superTryingText = "", this.superTryFinishText = "", this.mixTryReadyIconText = "", this.mixTryingIconText = "", this.mixTryReadyText = "", this.mixPlatinumTryingText = "", this.mixSuperTryingText = "", this.mixTryFinishText = "", this.mixTryReadyBtnText = "", this.mixPlatinumTryingBtnText = "", this.mixSuperTryingBtnText = "", this.mixTryFinishBtnText = "", this.isBTest = !1
        }

        onTaskIdChanged(t) {
            this.loadTaskInfo()
        }

        loadTaskInfo() {
            if (y(this.taskId) && this.taskId > 0) {
                this.showedRocket = k.get(this.taskId);
                let t = c.default.getTryDetail(this.taskId);
                t && this.onTaskTryDetailChanged(this.taskId, t)
            }
        }

        clickVipButton() {
            let t, e = null;
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.isMixTry ? h.ItemName.MixTryReadyButton : this.isSuper ? h.ItemName.SuperTryReadyButton : h.ItemName.TryReadyButton, e = h.default.getItemData(t), l.default.clickTryAcclerateBtn(this.taskId, e, "task");
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.isMixTry ? this.isSuper ? h.ItemName.MixSuperTryingButton : h.ItemName.MixPlatinumTryingButton : this.isSuper ? h.ItemName.SuperTryingButton : h.ItemName.TryingButton, e = h.default.getItemData(t), l.default.clickTryOpenVipBtn(this.taskId, this.taskUIStatus, e, this.isSuper);
                    break;
                default:
                    t = this.isMixTry ? h.ItemName.MixTryFinishButton : this.isSuper ? h.ItemName.SuperTryFinishButton : h.ItemName.TryFinishButton, e = h.default.getItemData(t), l.default.clickTryOpenVipBtn(this.taskId, this.taskUIStatus, e, this.isSuper)
            }
        }

        get isSuper() {
            let t = !1;
            return this.taskInfo && (t = this.taskInfo.isSuper || this.taskInfo.trySection === o.VipDownloadDefineNS.TryType.SuperVip), t
        }

        get isMixTry() {
            let t = !1;
            return this.taskInfo && (t = this.taskInfo.isMixTry), t
        }

        get pluginVipClass() {
            return this.isSuper ? "xlx-plugin-vip--super" : "xlx-plugin-vip--ordinary"
        }

        get pluginVipClass2() {
            return this.isSuper ? "xlx-plugin-vip--super2" : "xlx-plugin-vip--ordinary2"
        }

        get taskStatusText() {
            return this.isMixTry ? this.mixStatusText : this.isSuper ? this.superStatusText : this.normalStatusText
        }

        get normalStatusText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.tryReadyText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.tryingText, y(t) && t.search("%s") >= 0 && (t = t.replace("%s", this.remainSizeFormat));
                    break;
                case"Failed":
                    t = "对不起，进入试用失败";
                    break;
                case"Finished":
                    t = this.tryFinishText
            }
            return t
        }

        get superStatusText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.superTryReadyText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    if (!(t = this.superTryingText)) if (this.taskInfo && this.taskInfo.careKuaiNiao) {
                        let e = u.default.downstreamString;
                        t = this.taskInfo.showKuaiNiao && "0M" !== e ? `快鸟已帮您将宽带提升至${e}` : "超级加速等待中"
                    } else t = "超级加速中，剩余流量：" + this.remainSizeFormat;
                    break;
                case"Failed":
                    t = "超级加速失败";
                    break;
                case"Finished":
                    t = this.superTryFinishText
            }
            return t
        }

        get mixStatusText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.mixTryReadyText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.isSuper ? this.mixSuperTryingText : this.mixPlatinumTryingText, y(t) && t.search("%s") >= 0 && (t = t.replace("%s", this.remainSizeFormat));
                    break;
                case"Failed":
                    t = "对不起，进入试用失败";
                    break;
                case"Finished":
                    t = this.mixTryFinishText
            }
            return t
        }

        get buttonText() {
            return this.isMixTry ? this.mixButtonText : this.isSuper ? this.superButtonText : this.normalButtonText
        }

        get buttonIcon2() {
            return this.isSuper ? "xlx-plugin-vip__logo-vip02" : "xlx-plugin-vip__logo-vip01"
        }

        get normalButtonText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.tryReadyBtnText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.tryingBtnText;
                    break;
                case"Failed":
                case"Finished":
                    t = this.tryFinishBtnText
            }
            return t
        }

        get mixButtonText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.mixTryReadyBtnText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.isSuper ? this.mixSuperTryingBtnText : this.mixPlatinumTryingBtnText;
                    break;
                case"Failed":
                case"Finished":
                    t = this.mixTryFinishBtnText
            }
            return t
        }

        get superButtonText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.superTryReadyBtnText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.superTryingBtnText;
                    break;
                case"Failed":
                case"Finished":
                    t = this.superTryFinishBtnText
            }
            return t
        }

        get iconText() {
            let t = "VIP";
            if (this.isMixTry) return this.mixIconText;
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.tryReadyIconText;
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    t = this.tryingIconText;
                    break;
                case"Failed":
                case"Finished":
                    t = this.tryFinishIconText
            }
            return t
        }

        get mixIconText() {
            let t = "VIP";
            switch (this.taskUIStatus) {
                case"Init":
                    t = this.mixTryReadyIconText;
                    break;
                default:
                    t = this.mixTryingIconText
            }
            return t
        }

        get showTrying() {
            return (!this.taskInfo || !this.taskInfo.careKuaiNiao) && ("Wait" === this.taskUIStatus || "Stoped" === this.taskUIStatus || "Started" === this.taskUIStatus)
        }

        get showRocketAni() {
            let t = !1;
            return !this.showedRocket && this.showTrying && this.taskInfo && this.taskInfo.isMixTry && (t = this.taskInfo.trySection === o.VipDownloadDefineNS.TryType.PlatinumVip) && k.set(this.taskId, !0), t
        }

        get isNormal() {
            let t = !1;
            return this.isSuper && (t = "Finished" === this.taskUIStatus || "Failed" === this.taskUIStatus), t
        }

        get isNormal2() {
            let t = !1;
            return this.isSuper && (t = "Failed" === this.taskUIStatus), t
        }

        get isError() {
            return "Failed" === this.taskUIStatus
        }

        get acceleratePercent() {
            let t = 0, e = this.vipSpeed || 0;
            return this.normalSpeed ? t = Math.floor(100 * e / this.normalSpeed) : e > 0 && (t = 200), t + "%"
        }

        get remainSizeFormat() {
            return this.formatSize(this.remainSize)
        }

        get progressPercent() {
            return (100 * (1 - this.progress)).toFixed(2) + "%"
        }

        get isSuperStarted() {
            return !(!this.isSuper || "Started" !== this.taskUIStatus)
        }

        formatSize(t) {
            let e = "0B";
            if ("number" == typeof t && t > 0) {
                let i = ["B", "K", "M", "G", "T"], n = 0, a = t;
                for (; a >= 1024 && !(n >= 4);) a /= 1024, n += 1;
                let s = a.toFixed(0);
                s.length > 6 && (s = s.substring(0, 6)), e = s + i[n]
            }
            return e
        }

        onTaskTryDetailChanged(t, e) {
            t === this.taskId && (this.remainSize = e.remainSize, this.progress = e.progress, this.normalSpeed = e.normalSpeed, this.vipSpeed = e.vipSpeed)
        }

        onAbtestConfigureReady() {
            T.info("onAbtestConfigureReady");
            let t = h.default.getItemData(h.ItemName.TryReadyIcon);
            this.tryReadyIconText = t.text, t = h.default.getItemData(h.ItemName.TryingIcon), this.tryingIconText = t.text, t = h.default.getItemData(h.ItemName.TryFinishIcon), this.tryFinishIconText = t.text, t = h.default.getItemData(h.ItemName.MixTryReadyIcon), this.mixTryReadyIconText = t.text, t = h.default.getItemData(h.ItemName.MixTryingIcon), this.mixTryingIconText = t.text, t = h.default.getItemData(h.ItemName.TryReadyButton), this.tryReadyBtnText = t.text, t = h.default.getItemData(h.ItemName.TryingButton), this.tryingBtnText = t.text, t = h.default.getItemData(h.ItemName.TryFinishButton), this.tryFinishBtnText = t.text, t = h.default.getItemData(h.ItemName.TryReadyText), this.tryReadyText = t.text, t = h.default.getItemData(h.ItemName.TryingText), this.tryingText = t.text, t = h.default.getItemData(h.ItemName.TryFinishText), this.tryFinishText = t.text, t = h.default.getItemData(h.ItemName.SuperTryReadyButton), this.superTryReadyBtnText = t.text, t = h.default.getItemData(h.ItemName.SuperTryingButton), this.superTryingBtnText = t.text, t = h.default.getItemData(h.ItemName.SuperTryFinishButton), this.superTryFinishBtnText = t.text, t = h.default.getItemData(h.ItemName.SuperTryReadyText), this.superTryReadyText = t.text, t = h.default.getItemData(h.ItemName.SuperTryingText), this.superTryingText = t.text, t = h.default.getItemData(h.ItemName.SuperTryFinishText), this.superTryFinishText = t.text, t = h.default.getItemData(h.ItemName.MixTryReadyButton), this.mixTryReadyBtnText = t.text, t = h.default.getItemData(h.ItemName.MixPlatinumTryingButton), this.mixPlatinumTryingBtnText = t.text, t = h.default.getItemData(h.ItemName.MixSuperTryingButton), this.mixSuperTryingBtnText = t.text, t = h.default.getItemData(h.ItemName.MixTryFinishButton), this.mixTryFinishBtnText = t.text, t = h.default.getItemData(h.ItemName.MixTryReadyText), this.mixTryReadyText = t.text, t = h.default.getItemData(h.ItemName.MixPlatinumTryingText), this.mixPlatinumTryingText = t.text, t = h.default.getItemData(h.ItemName.MixSuperTryingText), this.mixSuperTryingText = t.text, t = h.default.getItemData(h.ItemName.MixTryFinishText), this.mixTryFinishText = t.text
        }

        onConfigureGet() {
            return a(this, void 0, void 0, function* () {
                T.info("onConfigureGet");
                let t = yield g.default.getPeerId(), e = p.default.getValue("VipDownload", "NewSkinPeerid");
                this.isBTest = f.default.isPeeridMatchSha256Region(t, e), T.info("isBTest", this.isBTest)
            })
        }

        created() {
            return a(this, void 0, void 0, function* () {
                this.onConfigureGet(), this.onAbtestConfigureReady(), this.loadTaskInfo(), r.default.addListener(r.TaskEventNS.taskTryDetailChanged, this.onTaskTryDetailChanged.bind(this)), d.default.addListener(d.AbtestEventNS.configureReady, this.onAbtestConfigureReady.bind(this)), p.default.addListener(p.ConfigEventNS.configGet, this.onConfigureGet.bind(this))
            })
        }

        destroyed() {
            return a(this, void 0, void 0, function* () {
                r.default.removeListener(r.TaskEventNS.taskTryDetailChanged, this.onTaskTryDetailChanged), d.default.removeListener(d.AbtestEventNS.configureReady, this.onAbtestConfigureReady), p.default.removeListener(p.ConfigEventNS.configGet, this.onConfigureGet)
            })
        }
    };
    n([s.Prop({})], m.prototype, "taskId", void 0), n([s.Prop({})], m.prototype, "taskUIStatus", void 0), n([s.Prop({})], m.prototype, "isVip", void 0), n([s.Prop({})], m.prototype, "taskInfo", void 0), n([s.Watch("taskId")], m.prototype, "onTaskIdChanged", null), m = n([s.Component({})], m), e.default = m
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(114), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(14), r = i(30), l = i(21), u = i(164), c = i(5), {isDef: d} = c.ThunderUtil,
        h = i(0).default.getLogger("VipDownload:item-ad-status");
    let f = class extends s.Vue {
        constructor() {
            super(...arguments), this.progress = 0, this.remainSize = 0, this.normalSpeed = 0, this.vipSpeed = 0, this.gcidLeftCount = 0, this.leftCount = 100, this.sceneData = null
        }

        onTaskIdChanged(t) {
            this.loadTaskInfo()
        }

        get chances() {
            return Math.min(this.gcidLeftCount, this.leftCount)
        }

        loadTaskInfo() {
            if (d(this.taskId) && this.taskId > 0) {
                let t = l.default.getTryDetail(this.taskId);
                t && this.onTaskTryDetailChanged(this.taskId, t), this.sceneData = u.default.sceneData
            }
        }

        clickVipButton() {
            let t = "init";
            "Finished" === this.taskUIStatus ? t = "finish" : "Init" !== this.taskUIStatus && (t = "trial"), r.default.clickAdAcclerateBtn(this.taskId, t)
        }

        get taskStatusText() {
            let t = "";
            switch (this.taskUIStatus) {
                case"Init":
                    this.sceneData && (t = this.chances > 0 ? this.sceneData.readySceneText : this.sceneData.readyNoChanceText);
                    break;
                case"Wait":
                case"Stoped":
                case"Started":
                    this.chances > 0 ? this.sceneData && this.sceneData.acclerateSceneText && (t = this.sceneData.acclerateSceneText.replace("%s", this.remainSizeFormat)) : t = `加速流量剩余${this.remainSizeFormat}`;
                    break;
                case"Failed":
                    t = "任务加速失败";
                    break;
                case"Finished":
                    this.chances > 0 ? this.sceneData && this.sceneData.afterSceneText && (t = this.sceneData.afterSceneText) : t = "加速流量已用完"
            }
            return t
        }

        get buttonText() {
            let t = "";
            return this.sceneData && this.sceneData.buttonText && (t = this.sceneData.buttonText), t
        }

        get showTrying() {
            return "Wait" === this.taskUIStatus || "Stoped" === this.taskUIStatus || "Started" === this.taskUIStatus
        }

        get isNormal() {
            return !1
        }

        get isError() {
            return "Failed" === this.taskUIStatus
        }

        get isOver() {
            return "Init" !== this.taskUIStatus && this.chances <= 0
        }

        get showButton() {
            return !this.isError && !this.isOver
        }

        get acceleratePercent() {
            let t = 0, e = this.vipSpeed || 0;
            return this.normalSpeed ? t = Math.floor(100 * e / this.normalSpeed) : e > 0 && (t = 200), t + "%"
        }

        get remainSizeFormat() {
            return this.formatSize(this.remainSize)
        }

        get progressPercent() {
            return (100 * (1 - this.progress)).toFixed(2) + "%"
        }

        formatSize(t) {
            let e = "0B";
            if ("number" == typeof t && t > 0) {
                let i = ["B", "K", "M", "G", "T"], n = 0, a = t;
                for (; a >= 1024 && !(n >= 4);) a /= 1024, n += 1;
                e = a.toFixed(2) + i[n]
            }
            return e
        }

        onTaskTryDetailChanged(t, e) {
            t === this.taskId && (this.remainSize = e.remainSize, this.progress = e.progress, this.normalSpeed = e.normalSpeed, this.vipSpeed = e.vipSpeed, this.gcidLeftCount = e.gcidLeftCount || 0, h.info("gcidLeftCount", this.gcidLeftCount))
        }

        onAdTotalChancesChanged(t, e) {
            h.info("leftCount", e), this.leftCount = e
        }

        created() {
            return a(this, void 0, void 0, function* () {
                this.loadTaskInfo(), o.default.addListener(o.TaskEventNS.taskAdDetailChanged, this.onTaskTryDetailChanged.bind(this)), o.default.addListener(o.TaskEventNS.adTotalChancesChanged, this.onAdTotalChancesChanged.bind(this))
            })
        }

        destroyed() {
            return a(this, void 0, void 0, function* () {
                o.default.removeListener(o.TaskEventNS.taskAdDetailChanged, this.onTaskTryDetailChanged), o.default.removeListener(o.TaskEventNS.adTotalChancesChanged, this.onAdTotalChancesChanged)
            })
        }
    };
    n([s.Prop({})], f.prototype, "taskId", void 0), n([s.Prop({})], f.prototype, "taskUIStatus", void 0), n([s.Prop({})], f.prototype, "isVip", void 0), n([s.Prop({})], f.prototype, "taskInfo", void 0), n([s.Watch("taskId")], f.prototype, "onTaskIdChanged", null), f = n([s.Component({})], f), e.default = f
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(116), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(16), r = i(27), l = i(0), u = i(30), c = l.default.getLogger("VipDownload:item-ad-status");
    let d = class extends s.Vue {
        onTaskIdChanged(t) {
            this.loadTaskInfo()
        }

        loadTaskInfo() {
            c.info("loadTaskInfo")
        }

        clickGameButton() {
            let t = r.default.getItemData(r.ItemName.PlayGameButton);
            u.default.clickPlayGameBtn(this.taskId, t), this.trackGameClick(t.aidfrom)
        }

        get buttonText() {
            let t = r.default.getItemData(r.ItemName.PlayGameButton);
            return this.trackGameShow(t.aidfrom), t.text
        }

        get taskStatusText() {
            return r.default.getItemData(r.ItemName.PlayGameText).text
        }

        created() {
            return a(this, void 0, void 0, function* () {
                this.loadTaskInfo()
            })
        }

        getCommomExtData() {
            let t = new Map;
            return t.set("is_login", this.isLogin ? 1 : 0), t.set("is_vip", this.isVip ? 1 : 0), t.set("vip_type", this.vasType), t
        }

        trackGameShow(t) {
            c.info("trackGameShow");
            let e = this.getCommomExtData();
            e.set("actid", t);
            let i = {attribute1: "game_youtiao_xgt_show", extData: e};
            o.StatUtilitiesNS.trackEvent("xlx_ad_event", i)
        }

        trackGameClick(t) {
            c.info("trackGameClick");
            let e = this.getCommomExtData();
            e.set("actid", t);
            let i = {attribute1: "game_youtiao_xgt_click", extData: e};
            o.StatUtilitiesNS.trackEvent("xlx_ad_event", i)
        }

        destroyed() {
            return a(this, void 0, void 0, function* () {
            })
        }
    };
    n([s.Prop({})], d.prototype, "taskId", void 0), n([s.Prop({})], d.prototype, "taskInfo", void 0), n([s.Prop({})], d.prototype, "isLogin", void 0), n([s.Prop({})], d.prototype, "isVip", void 0), n([s.Prop({})], d.prototype, "vasType", void 0), n([s.Watch("taskId")], d.prototype, "onTaskIdChanged", null), d = n([s.Component({})], d), e.default = d
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(118), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(8), r = i(14), l = i(21), u = i(49), c = i(5), d = i(2), {isDef: h} = c.ThunderUtil,
        f = i(0), p = i(3), g = i(30), S = i(20), y = i(13), T = i(1),
        k = f.default.getLogger("VipDownload:item-team-status");
    let m = class extends s.Vue {
        constructor() {
            super(...arguments), this.baotuanNumber = 0, this.baotuanXgt = o.VipDownloadDefineNS.BaotuanXgt.Before_All, this.baotuanButtonText = "", this.baotuanStatusText = "", this.baotuanAnimate = !1, this.mImgSrc = "", this.mSpeedNum = 0, this.isBeforeBaotuanXgtStylePeerid = !1, this.actInfo = ""
        }

        onTaskIdChanged(t) {
            this.loadTaskInfo()
        }

        onIsShowChangWeiChanged(t) {
            this.updateChangWeiInfo()
        }

        updateChangWeiInfo() {
            this.updateImgSrc(), this.actInfo = "", this.isShowChangWei && (p.default.isVip ? p.default.isVip && !p.default.isSuperVip && (this.actInfo = "201") : this.actInfo = "101")
        }

        loadTaskInfo() {
            if (h(this.taskId) && this.taskId > 0) {
                let t = l.default.getBaotuanDetail(this.taskId);
                k.info("loadTaskInfo", t), t && this.onBaotuanInfoChanged(t)
            } else {
                k.info("loadTaskInfo null"), this.baotuanNumber = 0, this.baotuanXgt = o.VipDownloadDefineNS.BaotuanXgt.Before_All, this.baotuanAnimate = !1, this.updateBaotuanXgt();
                let t = {taskId: this.taskId, teamStatus: 0};
                d.client.callServerFunction("FireEventFunction", "BaoTuanTaskStatusChangeEx", t.taskId, t.teamStatus)
            }
        }

        clickBaotuanBtn() {
            switch (this.buttonText) {
                case"抱团下载":
                    g.default.clickJoinBtn(this.taskId, "xgt"), u.BaotuanStatNS.clickTeamxgt(this.actInfo), S.BaoTuanSettingNS.decreaseShowTeamEnterance(this.taskId);
                    break;
                case"立即开启":
                    g.default.clickAutoTeamBtn(this.taskId), u.BaotuanStatNS.clickOpenGuidXgt();
                    break;
                case"立即抱团":
                    if (this.baotuanXgt === o.VipDownloadDefineNS.BaotuanXgt.Before_CutLine || S.BaoTuanSettingNS.getCutlineLeftCount() > 0) g.default.clickJoinBtn(this.taskId, "xgt"); else {
                        if (!S.BaoTuanSettingNS.checkLogin(p.default.isLogin)) return void d.client.callServerFunction("ShowLoginDlg");
                        let t = {
                            aid: "group_dl_brfore_cutinline_pay",
                            entrance_from: "xgt",
                            state_from: "group_before"
                        };
                        g.default.showPopupWnd(g.PopupWndType.BaotuanCutLineOut, t, this.taskId)
                    }
                    S.BaoTuanSettingNS.decreaseShowTeamEnterance(this.taskId);
                    let t = l.default.getBaotuanDetailSt(this.taskId);
                    u.BaotuanStatNS.clickCutlinexgt(t.teamLeftCount, this.actInfo);
                    break;
                case"开通会员":
                    if ("插队次数已用完,开通会员享更多" == this.baotuanStatusText) {
                        let t = {
                            aid: "group_dl_after_no_cutinline_times",
                            entrance_from: "xgt",
                            state_from: "group_after"
                        };
                        this.isActionLink ? this.openCutlineOutLink(t) : g.default.showPopupWnd(g.PopupWndType.BaotuanCutLineOut, t, this.taskId), u.BaotuanStatNS.clickCutlineOutxgt("openvip", this.actInfo)
                    } else {
                        let t = {isRightWnd: 0, entrance_from: "xgt"};
                        this.isActionLink ? this.openBaoHuLink() : g.default.showPopupWnd(g.PopupWndType.BaotuanBaoHuVip, t, this.taskId), u.BaotuanStatNS.clickKickoutXgt("openvip", this.actInfo, this.gcid)
                    }
                    break;
                case"升级超会":
                    if ("插队次数已用完,升级超会享更多" == this.baotuanStatusText) {
                        let t = {
                            aid: "group_dl_after_no_cutinline_times",
                            entrance_from: "xgt",
                            state_from: "group_after"
                        };
                        this.isActionLink ? this.openCutlineOutLink(t) : g.default.showPopupWnd(g.PopupWndType.BaotuanCutLineOut, t, this.taskId), u.BaotuanStatNS.clickCutlineOutxgt("upgradevip", this.actInfo)
                    } else {
                        let t = {isRightWnd: 0, entrance_from: "xgt"};
                        this.isActionLink ? this.openBaoHuLink() : g.default.showPopupWnd(g.PopupWndType.BaotuanBaoHuVip, t, this.taskId), u.BaotuanStatNS.clickKickoutXgt("upgradevip", this.actInfo, this.gcid)
                    }
            }
        }

        get statusText() {
            if (this.isShowChangWei && ("插队次数已用完,升级超会享更多" == this.baotuanStatusText || "插队次数已用完,开通会员享更多" == this.baotuanStatusText)) {
                let t = this.ChangWeiXgtWords;
                if (t) return t
            }
            return this.baotuanStatusText
        }

        get buttonText() {
            return this.baotuanButtonText
        }

        get buttonTextEx() {
            let t = "";
            switch (this.baotuanXgt) {
                case o.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                    t = "获取更多";
                    break;
                case o.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                    t = "开启保护"
            }
            return t
        }

        get ChangWeiXgtWords() {
            let t = "";
            do {
                let e = "configdata.xlx_vip_gdl_act", i = localStorage.getItem(e);
                if (!i) break;
                let n = JSON.parse(i);
                if (!n) break;
                let a = 0;
                for (; ;) {
                    let e = n[a];
                    if (!e) break;
                    if ("xgt_aft" === e.id) {
                        t = e.xgt_words;
                        break
                    }
                    a++
                }
            } while (0);
            return t
        }

        get showTeaming() {
            return !0
        }

        get isVisible() {
            return 0 != this.buttonText.length
        }

        get gcid() {
            return this.taskInfo ? this.taskInfo.gcid : ""
        }

        get isOpenNow() {
            switch (this.buttonText) {
                case"立即开启":
                    return !0
            }
            return !1
        }

        get isVipUpdate() {
            switch (this.buttonText) {
                case"开通会员":
                case"升级超会":
                    return !0
            }
            return !1
        }

        get isUpdateVip() {
            switch (this.buttonText) {
                case"开通会员":
                    return !0
            }
            return !1
        }

        get isUpdateSVip() {
            switch (this.buttonText) {
                case"升级超会":
                    return !0
            }
            return !1
        }

        get isXgtNewStyle() {
            return this.isBeforeBaotuanXgtStylePeerid
        }

        updateBaotuanXgt() {
            return a(this, void 0, void 0, function* () {
                let t = this.buttonText, e = this.buttonText;
                switch (setTimeout(() => {
                    this.animateSpeedNum(100)
                }, 1e3), this.baotuanXgt) {
                    case o.VipDownloadDefineNS.BaotuanXgt.Before_All:
                        e = "", t = "";
                        break;
                    case o.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                    case o.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                        e = "抱团下载", t = void 0 !== this.baotuanNumber ? "当前抱团" + this.baotuanNumber + "人,一起下载更快乐" : "";
                        break;
                    case o.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                    case o.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                        e = "立即抱团", t = "当前抱团已满50人,您可插队加入";
                        break;
                    case o.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        p.default.isVip ? p.default.isSuperVip || (e = "升级超会", t = "插队次数已用完,升级超会享更多") : (e = "开通会员", t = "插队次数已用完,开通会员享更多");
                        break;
                    case o.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        e = "抱团成功", t = void 0 !== this.baotuanNumber ? "当前抱团" + this.baotuanNumber + "人,一起下载更快乐" : "";
                        break;
                    case o.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                        e = "立即开启", t = S.BaoTuanSettingNS.getIsSurperUserOnly() ? "开启自动抱团，获得排队优先级" : "开启自动抱团/插队，优先下载";
                        break;
                    case o.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                        p.default.isVip ? p.default.isSuperVip || (e = "升级超会", t = "您被超级会员挤出,可开启抱团保护") : (e = "开通会员", t = "您被白金会员挤出,可开启抱团保护")
                }
                this.baotuanStatusText = t, this.baotuanButtonText = e, k.info("UpdateUI", this.baotuanXgt, "baotuanNumber:", this.baotuanNumber, "StatusText:", this.baotuanStatusText, "ButtonText:", this.baotuanButtonText), this.updateChangWeiInfo()
            })
        }

        reportShowData() {
            return a(this, void 0, void 0, function* () {
                switch (this.buttonText) {
                    case"抱团下载":
                        u.BaotuanStatNS.showTeamxgt(this.taskId, this.actInfo);
                        break;
                    case"立即开启":
                        u.BaotuanStatNS.showOpenGuidXgt(this.taskId);
                        break;
                    case"立即抱团":
                        let t = l.default.getBaotuanDetailSt(this.taskId);
                        u.BaotuanStatNS.showCutlinexgt(t.teamLeftCount, this.taskId, this.actInfo);
                        break;
                    case"开通会员":
                        "插队次数已用完,开通会员享更多" == this.baotuanStatusText ? u.BaotuanStatNS.showCutlineOutxgt("openvip", this.taskId, this.actInfo) : (yield this.isWindowVisable()) ? u.BaotuanStatNS.showKickoutXgt("openvip", this.taskId, this.actInfo, this.gcid) : k.info("BaotuanStatNS.showKickoutXgt", "openvip", this.taskId, this.actInfo, this.gcid);
                        break;
                    case"升级超会":
                        "插队次数已用完,升级超会享更多" == this.baotuanStatusText ? u.BaotuanStatNS.showCutlineOutxgt("upgradevip", this.taskId, this.actInfo) : (yield this.isWindowVisable()) ? u.BaotuanStatNS.showKickoutXgt("upgradevip", this.taskId, this.actInfo, this.gcid) : k.info("BaotuanStatNS.showKickoutXgt", "upgradevip", this.taskId, this.actInfo, this.gcid)
                }
            })
        }

        onVipTaskInfoChanged(t, e) {
            t === this.taskId && (e ? this.onBaotuanInfoChanged(e.baotuanDetail) : this.onBaotuanInfoChanged(null))
        }

        onBaotuanInfoChanged(t) {
            if (t) {
                if (this.baotuanAnimate = t.animateXgt, this.baotuanXgt !== t.baotuanXgt) {
                    if (!(this.baotuanXgt !== o.VipDownloadDefineNS.BaotuanXgt.Before_CutLine && this.baotuanXgt !== o.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut || t.baotuanXgt !== o.VipDownloadDefineNS.BaotuanXgt.Before_CutLine && t.baotuanXgt !== o.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut)) return void (this.baotuanXgt = t.baotuanXgt);
                    k.info("baotuanInfoChanged", this.taskId, JSON.stringify(t)), this.baotuanNumber = t.baotuanNumber, this.baotuanXgt = t.baotuanXgt, this.updateBaotuanXgt(), this.reportShowData()
                }
            } else this.baotuanNumber = 0, this.baotuanXgt = o.VipDownloadDefineNS.BaotuanXgt.Before_All, this.baotuanAnimate = !1, this.updateBaotuanXgt()
        }

        created() {
            return a(this, void 0, void 0, function* () {
                this.loadTaskInfo(), this.initUserXgtStyle(), r.default.addListener(r.TaskEventNS.vipTaskInfoChanged, this.onVipTaskInfoChanged.bind(this))
            })
        }

        initUserXgtStyle() {
            return a(this, void 0, void 0, function* () {
                if (k.info("initUserXgtStyle"), y.default.isConfigInitFinish()) {
                    let t = yield p.default.getPeerId(),
                        e = y.default.getValue("VipDownload", "BeforeBaotuanXgtStylePeerid");
                    this.isBeforeBaotuanXgtStylePeerid = T.default.isPeeridMatchSha256Region(t, e, 4), k.info("isBeforeBaotuanXgtStylePeerid", t, this.isBeforeBaotuanXgtStylePeerid)
                } else y.default.addListener(y.ConfigEventNS.configGet, this.onConfigGet.bind(this))
            })
        }

        onConfigGet() {
            return a(this, void 0, void 0, function* () {
                this.initUserXgtStyle(), y.default.removeListener(y.ConfigEventNS.configGet, this.onConfigGet)
            })
        }

        destroyed() {
            return a(this, void 0, void 0, function* () {
                r.default.removeListener(r.TaskEventNS.vipTaskInfoChanged, this.onVipTaskInfoChanged)
            })
        }

        updateImgSrc() {
            if (this.mImgSrc = "", !this.isShowChangWei) return;
            let t = "";
            switch (this.buttonText) {
                case"抱团下载":
                    t = "xgt_bef";
                    break;
                case"立即开启":
                    t = "";
                    break;
                case"立即抱团":
                    t = "xgt_bef";
                    break;
                case"开通会员":
                    t = "插队次数已用完,开通会员享更多" == this.baotuanStatusText ? "xgt_aft" : "xgt_pro";
                    break;
                case"升级超会":
                    t = "插队次数已用完,升级超会享更多" == this.baotuanStatusText ? "xgt_aft" : "xgt_pro"
            }
            do {
                let e = "configdata.xlx_vip_gdl_act", i = localStorage.getItem(e);
                if (!i) break;
                let n = JSON.parse(i);
                if (!n) break;
                let a = 0;
                for (; ;) {
                    let e = n[a];
                    if (!e) break;
                    if (e.id === t) {
                        this.mImgSrc = e.xgt_bpic;
                        break
                    }
                    a++
                }
            } while (0)
        }

        isWindowVisable() {
            return a(this, void 0, void 0, function* () {
                let t = yield d.client.callServerFunction("GetMainWindowStates");
                return !(!t || !t.visible || !t.focused && !t.foreground)
            })
        }

        animateSpeedNum(t) {
            setTimeout(() => {
                this.speedNum = t, this.speedNum < 600 && this.animateSpeedNum(t + 100)
            }, 100)
        }

        get speedNum() {
            return this.mSpeedNum
        }

        set speedNum(t) {
            this.mSpeedNum = t
        }

        get showSucceedAni() {
            switch (this.baotuanXgt) {
                case o.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                case o.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                case o.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                    return this.baotuanAnimate;
                default:
                    return !1
            }
        }

        get showSucceedAniClass() {
            return this.isXgtNewStyle ? "xlx-plugin-vip-ex2 xlx-plugin-vip-ex--huddle xlx-plugin-vip-ex--huddle-s2 baotuan-success-ani" : "xlx-plugin-vip-ex2 xlx-plugin-vip-ex--huddle baotuan-success-ani"
        }

        get entrance() {
            return S.BaoTuanSettingNS.getBaotuanEntranceEx()
        }

        get isImageTextStyle() {
            let t = this.entrance;
            return !t || 0 !== t.result || 1 === t.tag_style
        }

        get isActionLink() {
            let t = this.entrance;
            return !(!t || 0 !== t.result) && 2 === t.vip_action
        }

        openCutlineOutLink(t) {
            return a(this, void 0, void 0, function* () {
                if (this.isVip) {
                    let e = "45616dd701", i = "v_pc_xlx_hytq_groupdownload", n = t.aid;
                    this.openCutlineOutTab(t.stateFrom, e, i, n)
                } else {
                    let e = "", i = "v_pc_xlx_hytq_groupdownload", n = t.aid;
                    this.openCutlineOutTab(t.stateFrom, e, i, n)
                }
            })
        }

        openCutlineOutTab(t, e, i, n) {
            let a = "https://pay.xunlei.com/pay.html?payconfid=" + e + "&referfrom=" + i + "&aidfrom=" + n,
                s = "group_before" === t ? "configdata.xlx_vip_group_dl_before" : "configdata.xlx_vip_group_dl_after",
                o = localStorage.getItem(s);
            if (o) {
                let t = JSON.parse(o);
                if (t[0] && t[0].aidfrom && t[0].referfrom && t[0].url) {
                    let e = String(t[0].url), i = c.ThunderUtil.getUrlArgs(e);
                    e = e.indexOf("?") < 0 ? e.trim() + "?" : e.trim(), e = i.referfrom ? e.replace("&referfrom=" + i.referfrom, "&referfrom=" + t[0].referfrom) : e + "&referfrom=" + t[0].referfrom, e = i.aidfrom ? e.replace("&aidfrom=" + i.aidfrom, "&aidfrom=" + t[0].aidfrom) : e + "&aidfrom=" + t[0].aidfrom, t[0].payParam && (e = i.payconfid ? e.replace("&payconfid=" + i.payconfid, "&payconfid=" + t[0].payParam) : e + "&payconfid=" + t[0].payParam), a = e
                }
            }
            if (this.isShowChangWei) {
                e = "", i = "", n = "", a = "https://pay.xunlei.com/pay.html?";
                do {
                    let t = "configdata.xlx_vip_gdl_act", s = localStorage.getItem(t);
                    if (!s) break;
                    let o = JSON.parse(s);
                    if (!o) break;
                    let r = 0;
                    for (; ;) {
                        let t = o[r];
                        if (!t) break;
                        if ("pop_cut" === t.id) {
                            t.url && (a = t.url), t.payParam && (e = t.payParam), t.referfrom && (i = t.referfrom), t.aidfrom && (n = t.aidfrom);
                            break
                        }
                        r++
                    }
                } while (0);
                let t = c.ThunderUtil.getUrlArgs(a);
                a = a.indexOf("?") < 0 ? a.trim() + "?" : a.trim(), i && (a = t.referfrom ? a.replace("&referfrom=" + t.referfrom, "&referfrom=" + i) : a + "&referfrom=" + i), n && (a = t.aidfrom ? a.replace("&aidfrom=" + t.aidfrom, "&aidfrom=" + n) : a + "&aidfrom=" + n), e && (a = t.payconfid ? a.replace("&payconfid=" + t.payconfid, "&payconfid=" + e) : a + "&payconfid=" + e)
            }
            return d.client.callRemoteClientFunction(T.default.pluginWebviewName, "OpenPayVipUrl", a), c.ThunderUtil.getUrlArgs(a)
        }

        openBaoHuLink() {
            return a(this, void 0, void 0, function* () {
                if (this.isVip) {
                    let t = "45616dd701", e = "v_pc_xlx_hytq_groupdownload", i = "group_dl_group_protect_center";
                    this.openBaohuTab(t, e, i)
                } else {
                    let t = "", e = "v_pc_xlx_hytq_groupdownload", i = "group_dl_group_protect_center";
                    this.openBaohuTab(t, e, i)
                }
            })
        }

        openBaohuTab(t, e, i) {
            let n = "https://pay.xunlei.com/pay.html?payconfid=" + t + "&referfrom=" + e + "&aidfrom=" + i,
                a = localStorage.getItem("configdata.xlx_vip_group_dl_center");
            if (a) {
                let t = JSON.parse(a);
                if (t[0] && t[0].aidfrom && t[0].referfrom && t[0].url) {
                    let e = String(t[0].url), i = c.ThunderUtil.getUrlArgs(e);
                    e = e.indexOf("?") < 0 ? e.trim() + "?" : e.trim(), e = i.referfrom ? e.replace("&referfrom=" + i.referfrom, "&referfrom=" + t[0].referfrom) : e + "&referfrom=" + t[0].referfrom, e = i.aidfrom ? e.replace("&aidfrom=" + i.aidfrom, "&aidfrom=" + t[0].aidfrom) : e + "&aidfrom=" + t[0].aidfrom, t[0].payParam && (e = i.payconfid ? e.replace("&payconfid=" + i.payconfid, "&payconfid=" + t[0].payParam) : e + "&payconfid=" + t[0].payParam), n = e
                }
            }
            if (this.isShowChangWei) {
                t = "", e = "", i = "", n = "https://pay.xunlei.com/pay.html?";
                do {
                    let a = "configdata.xlx_vip_gdl_act", s = localStorage.getItem(a);
                    if (!s) break;
                    let o = JSON.parse(s);
                    if (!o) break;
                    let r = 0;
                    for (; ;) {
                        let a = o[r];
                        if (!a) break;
                        if ("pop_pro" === a.id) {
                            a.url && (n = a.url), a.payParam && (t = a.payParam), a.referfrom && (e = a.referfrom), a.aidfrom && (i = a.aidfrom);
                            break
                        }
                        r++
                    }
                } while (0);
                let a = c.ThunderUtil.getUrlArgs(n);
                n = n.indexOf("?") < 0 ? n.trim() + "?" : n.trim(), e && (n = a.referfrom ? n.replace("&referfrom=" + a.referfrom, "&referfrom=" + e) : n + "&referfrom=" + e), i && (n = a.aidfrom ? n.replace("&aidfrom=" + a.aidfrom, "&aidfrom=" + i) : n + "&aidfrom=" + i), t && (n = a.payconfid ? n.replace("&payconfid=" + a.payconfid, "&payconfid=" + t) : n + "&payconfid=" + t)
            }
            return d.client.callRemoteClientFunction(T.default.pluginWebviewName, "OpenPayVipUrl", n), c.ThunderUtil.getUrlArgs(n)
        }

        bringMainWndToTop() {
            d.client.callServerFunction("BringMainWndToTop")
        }
    };
    n([s.Prop({})], m.prototype, "taskId", void 0), n([s.Prop({})], m.prototype, "taskUIStatus", void 0), n([s.Prop({})], m.prototype, "isVip", void 0), n([s.Prop({})], m.prototype, "taskInfo", void 0), n([s.Prop({})], m.prototype, "isShowChangWei", void 0), n([s.Watch("taskId")], m.prototype, "onTaskIdChanged", null), n([s.Watch("isShowChangWei")], m.prototype, "onIsShowChangWeiChanged", null), m = n([s.Component({})], m), e.default = m
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(120), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n, a = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, s = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const o = i(12), r = i(2), l = i(1), u = i(5), c = i(0), d = i(3), h = i(45),
        f = c.default.getLogger("ItemPackageTryStatus");
    let p = n = class extends o.Vue {
        constructor() {
            super(...arguments), this.btnText = "", this.btnTextReady = ""
        }

        created() {
            return s(this, void 0, void 0, function* () {
                let t = yield r.client.callRemoteClientFunction(l.default.pluginWebviewName, "GetAdvertPayData", this.taskInfo.surperPackage ? "开通超会" : "开通会员", this.sceneName, this.taskInfo.surperPackage ? 11 : 3, "text");
                this.btnText = t[0], t = yield r.client.callRemoteClientFunction(l.default.pluginWebviewName, "GetAdvertPayData", "免费试用", this.sceneName, 2, "text"), this.btnTextReady = t[0]
            })
        }

        clickPackageTry() {
            r.client.callRemoteClientFunction(l.default.pluginWebviewName, "ClickPackagetry", h.PackageTryDefineNS.BeginFrom.xgt).catch()
        }

        get sceneName() {
            return this.taskInfo && this.taskInfo.surperPackage ? "v_pc_xlx_hytq_dl_svip_pack" : "v_pc_xlx_hytq_dl_vip_pack"
        }

        clickOpenVip() {
            return s(this, void 0, void 0, function* () {
                let t = "";
                t = this.taskInfo.surperPackage ? this.isPackageFinish ? d.default.isVip ? "bj_xgt_after" : "nv_xgt_after" : d.default.isVip ? "bj_xgt_trying" : "nv_xgt_trying" : this.isPackageFinish ? "xgt_after" : "xgt_trying";
                let e = {
                        referfrom: (yield r.client.callRemoteClientFunction(l.default.pluginWebviewName, "GetAdvertPayData", this.sceneName, this.sceneName, 4, "referfrom"))[0],
                        aidfrom: t
                    }, i = "https://pay.xunlei.com/pay.html",
                    n = yield r.client.callRemoteClientFunction(l.default.pluginWebviewName, "GetAdvertPayData", i, this.sceneName, 4, "url");
                i = u.ThunderUtil.RepleaseUrlArgs(e, n[0]), this.taskInfo.surperPackage && (i += "&default_tab=supervip"), r.client.callRemoteClientFunction(l.default.pluginWebviewName, "OpenPayVipUrl", i).catch(), this.isPackageFinish ? (r.client.callRemoteClientFunction(l.default.pluginWebviewName, "ExitPackageTryXgt").catch(), r.client.callRemoteClientFunction(l.default.pluginWebviewName, "ClickAfterPackageTry", "xgt").catch()) : r.client.callRemoteClientFunction(l.default.pluginWebviewName, "PackageTryingClickOpenVip").catch()
            })
        }

        get packageText() {
            let t = "", e = !1, i = !1;
            if (this.taskInfo && this.taskInfo.packageTryState) {
                let n = this.taskInfo.surperPackage ? "超级会员" : "白金会员";
                switch (this.taskInfo.packageTryState) {
                    case h.PackageTryDefineNS.State.ready:
                        t = "免费试用" + n + "下载特权";
                        break;
                    case h.PackageTryDefineNS.State.commiting:
                    case h.PackageTryDefineNS.State.runing:
                        t = n + "下载特权试用中", e = !0;
                        break;
                    case h.PackageTryDefineNS.State.finish:
                        t = n + "下载特权试用结束", i = !0
                }
            }
            return setTimeout(() => s(this, void 0, void 0, function* () {
                if (e) {
                    let t = "trying_" + this.taskId;
                    if (n.showedXgt.includes(t)) return;
                    n.showedXgt.push(t), r.client.callRemoteClientFunction(l.default.pluginWebviewName, "PackageTryingXgtShow").catch()
                } else if (i) {
                    let t = "finish_" + this.taskId;
                    if (n.showedXgt.includes(t)) return;
                    n.showedXgt.push(t), r.client.callRemoteClientFunction(l.default.pluginWebviewName, "PackageAfterXgtShow").catch()
                }
            }), 200), f.info("下挂条显示", t, this.taskInfo ? this.taskInfo.packageTryState : "null"), t
        }

        get isPackageReady() {
            if (this.taskInfo && this.taskInfo.packageTryState) switch (this.taskInfo.packageTryState) {
                case h.PackageTryDefineNS.State.ready:
                    return !0
            }
            return !1
        }

        get isPackageFinish() {
            if (this.taskInfo && this.taskInfo.packageTryState) switch (this.taskInfo.packageTryState) {
                case h.PackageTryDefineNS.State.finish:
                    return !0
            }
            return !1
        }
    };
    p.showedXgt = [], a([o.Prop({})], p.prototype, "taskInfo", void 0), a([o.Prop({})], p.prototype, "taskId", void 0), p = n = a([o.Component({})], p), e.default = p
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(122), a = i.n(n);
    for (var s in n) "default" !== s && function (t) {
        i.d(e, t, function () {
            return n[t]
        })
    }(s);
    e.default = a.a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__decorate || function (t, e, i, n) {
        var a, s = arguments.length, o = s < 3 ? e : null === n ? n = Object.getOwnPropertyDescriptor(e, i) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) o = Reflect.decorate(t, e, i, n); else for (var r = t.length - 1; r >= 0; r--) (a = t[r]) && (o = (s < 3 ? a(o) : s > 3 ? a(e, i, o) : a(e, i)) || o);
        return s > 3 && o && Object.defineProperty(e, i, o), o
    }, a = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const s = i(12), o = i(2), r = i(1), l = i(8), u = i(0), c = i(3), d = u.default.getLogger("ItemCloudStatus");
    let h = class extends s.Vue {
        constructor() {
            super(...arguments), this.cloudText = "", this.cloudBtnText = ""
        }

        onUserStateChange(t) {
            this.initXgt().catch()
        }

        onTaskInfoChange(t) {
            this.initXgt().catch()
        }

        created() {
            return a(this, void 0, void 0, function* () {
                this.initXgt().catch()
            })
        }

        initXgt() {
            return a(this, void 0, void 0, function* () {
                let t = this.taskInfo.xgtType === l.VipDownloadDefineNS.XgtType.CloudWaiting, e = "",
                    i = yield o.client.callRemoteClientFunction(r.default.pluginWebviewName, "GetCloudDownloadTaskLimit"),
                    n = i[0];
                e = t ? c.default.isVip ? "超会享同时云盘下载{%d}个任务特权" : "白金会员享同时云盘下载{%d}个任务特权" : "会员享有极速云盘下载特权", e = (i = yield o.client.callRemoteClientFunction(r.default.pluginWebviewName, "GetAdvertPayData", e, "cloud", 0, "text"))[0];
                let a = c.default.isVip ? n[2] : n[1];
                this.cloudText = e.replace("{%d}", a.toFixed());
                let s = c.default.isVip ? "开通超会" : "开通会员";
                i = yield o.client.callRemoteClientFunction(r.default.pluginWebviewName, "GetAdvertPayData", s, "cloud", 1, "text"), this.cloudBtnText = i[0], d.info("initXgt", this.cloudText, this.cloudBtnText)
            })
        }

        clickOpenVip() {
            return a(this, void 0, void 0, function* () {
                let t = "", e = this.taskInfo.xgtType === l.VipDownloadDefineNS.XgtType.CloudWaiting;
                e ? (t = "https://pay.xunlei.com/pay.html?&referfrom=v_pc_xl11_hytq_dl_sim_cloud_taks&aidfrom=", this.isVip ? t += "open_super&default_tab=supervip" : t += "open_vip") : (t = "https://pay.xunlei.com/pay.html?&referfrom=v_pc_xlx_hytq_yp_cloudadd&aidfrom=", this.isVip ? t += "dl_open_super" : t += "dl_open_vip"), o.client.callRemoteClientFunction(r.default.pluginWebviewName, "OpenPayVipUrl", t).catch(), o.client.callRemoteClientFunction(r.default.pluginWebviewName, e ? "CloudClickWaittingXgt" : "CloudClickSpeedXgt", this.taskId).catch()
            })
        }
    };
    n([s.Prop({})], h.prototype, "taskInfo", void 0), n([s.Prop({})], h.prototype, "taskId", void 0), n([s.Prop({})], h.prototype, "isVip", void 0), n([s.Prop({})], h.prototype, "userStateChange", void 0), n([s.Watch("userStateChange")], h.prototype, "onUserStateChange", null), n([s.Watch("taskInfo")], h.prototype, "onTaskInfoChange", null), h = n([s.Component({})], h), e.default = h
}, , , , , , , , , , , , , , , , , , , , , , , function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(15), s = i(146), o = i(0).default.getLogger("VipDownload:user-info");
    e.UserHttpSession = class extends a.HttpSession {
        queryFlux(t) {
            return n(this, void 0, void 0, function* () {
                return this.host = "service.cdn.vip.xunlei.com", this.retries = 2, this.timeout = 15e3, this.body = yield s.UserHttpPackageNS.createUserFluxBuffer(t), new Promise(t => {
                    this.post(e => n(this, void 0, void 0, function* () {
                        let i = null;
                        200 === e.statusCode && e.body && e.body.length > 12 && (i = yield s.UserHttpPackageNS.praseUserFluxBuffer(e.body)), t(i)
                    }), e => {
                        o.info("error", e), t(null)
                    })
                })
            })
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(88), s = i(89), o = i(1), r = i(0).default.getLogger("VipDownload:user-info");
    !function (t) {
        t.createUserFluxBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                r.info("--\x3ecreateUserFluxBuffer");
                let e = 0, i = Buffer.alloc(1024);
                e = i.writeUInt32LE(0, e), r.info("protocolVersion:", 0), e = i.writeUInt32LE(1, e), r.info("sequence:", 1), e = i.writeUInt32LE(0, e), r.info("commandLegth:", 0);
                let n = o.default.thunderVersionNumber;
                e = i.writeUInt32LE(n, e), r.info("thunderVersion:", n), e = i.writeUInt16LE(0, e), r.info("compressFlag:", 0), e = i.writeUInt16LE(12, e), r.info("commandType:", 12);
                let l = Number(t.userId).valueOf();
                e = s.BufferUtilitiesNS.writeUInt64LE(i, l, e), r.info("userId:", l);
                let u = t.jumpKey;
                e = yield s.BufferUtilitiesNS.writeString(i, u, e, "gbk"), r.info("jumpKey:", u);
                let c = t.peerId;
                return e = yield s.BufferUtilitiesNS.writeString(i, c, e, "gbk"), r.info("peerId:", c), e = i.writeUInt32LE(0, e), r.info("taskCount:", 0), e = i.writeUInt32LE(0, e), r.info("businessFlag:", 0), i = i.slice(0, e), i = a.ShubCryptoNS.encryptHttpBuffer(i), r.info("<--createUserFluxBuffer"), i
            })
        }, t.praseUserFluxBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                r.info("--\x3epraseUserFluxBuffer");
                let e = null;
                try {
                    t = a.ShubCryptoNS.decryptHttpBuffer(t);
                    let i = 0, n = t.readUInt32LE(i);
                    r.info("protocolVersion:", n), i += 4;
                    let o = t.readUInt32LE(i);
                    r.info("sequence:", o), i += 4;
                    let l = t.readUInt32LE(i);
                    r.info("commandLegth:", l), i += 4;
                    let u = t.readUInt32LE(i);
                    r.info("thunderVersion:", u), i += 4;
                    let c = t.readUInt16LE(i);
                    r.info("compressFlag:", c), i += 2;
                    let d = t.readUInt16LE(i);
                    r.info("commandType:", d), i += 2;
                    let h = t.readUInt32LE(i);
                    r.info("result:", h), i += 4;
                    let f = yield s.BufferUtilitiesNS.readString(t, i, "gbk"), p = f[1];
                    r.info("message:", p), i = f[0];
                    let g = s.BufferUtilitiesNS.readUInt64LE(t, i), S = g[1];
                    r.info("capacity:", S), i = g[0];
                    let y = (g = s.BufferUtilitiesNS.readUInt64LE(t, i))[1];
                    r.info("remain:", y), i = g[0];
                    let T = (g = s.BufferUtilitiesNS.readUInt64LE(t, i))[1];
                    r.info("need:", T), i = g[0], e = {result: h, capacity: S}
                } catch (t) {
                    r.warn("praseUserFluxBuffer", t)
                }
                return r.info("<--praseUserFluxBuffer"), e
            })
        }
    }(e.UserHttpPackageNS || (e.UserHttpPackageNS = {}))
}, function (t, e) {
    t.exports = require("zlib")
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(16), a = i(149), s = i(0).default.getLogger("VipDownload:vip-task");
    !function (t) {
        t.vipButtonShow = function (t, e, i, o) {
            s.info("vipButtonShow"), e = e || {};
            let r = new Map, l = a.StatHelperNS.isLogin(), u = a.StatHelperNS.isVip(), c = a.StatHelperNS.vipType(),
                d = e.isSuper ? 1 : 0, h = a.StatHelperNS.taskGcid(t), f = e.config || "former_default",
                p = e.aidfrom || "0";
            r.set("is_login", l), r.set("is_vip", u), r.set("vip_type", c), r.set("is_cj_speed", d), r.set("taskid", t), r.set("gcid", h), r.set("btn_type", i), r.set("config", f), r.set("aidfrom", p), r.set("task_type", o ? "yp" : "dl");
            let g = {attribute1: "hyjs_show", extData: r};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", g).catch()
        }, t.vipButtonClick = function (t, e, i, o) {
            s.info("vipButtonClick"), e = e || {};
            let r = new Map, l = a.StatHelperNS.isLogin(), u = a.StatHelperNS.isVip(), c = a.StatHelperNS.vipType(),
                d = e.isSuper ? 1 : 0, h = a.StatHelperNS.taskGcid(t), f = e.config || "former_default",
                p = e.aidfrom || "0";
            r.set("is_login", l), r.set("is_vip", u), r.set("vip_type", c), r.set("is_cj_speed", d), r.set("taskid", t), r.set("gcid", h), r.set("clickid", i), r.set("config", f), r.set("aidfrom", p), r.set("task_type", o ? "yp" : "dl");
            let g = {attribute1: "hyjs_click", extData: r};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", g).catch()
        }, t.forbidIconShow = function (t, e) {
            s.info("forbidIconShow", e);
            let i = new Map, o = a.StatHelperNS.isLogin(), r = a.StatHelperNS.isVip(), l = a.StatHelperNS.vipType(),
                u = a.StatHelperNS.taskUrl(t);
            i.set("is_login", o), i.set("is_vip", r), i.set("vip_type", l), i.set("task_id", t), i.set("url", u), i.set("sensitive_type", e);
            let c = {attribute1: "dltab_bt_subtask_icon_show", extData: i};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", c).catch()
        }, t.forbidIconClick = function (t, e) {
            s.info("forbidIconClick", e);
            let i = new Map, o = a.StatHelperNS.isLogin(), r = a.StatHelperNS.isVip(), l = a.StatHelperNS.vipType(),
                u = a.StatHelperNS.taskUrl(t);
            i.set("is_login", o), i.set("is_vip", r), i.set("vip_type", l), i.set("task_id", t), i.set("url", u), i.set("sensitive_type", e);
            let c = {attribute1: "dltab_bt_subtask_icon_click", extData: i};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", c).catch()
        }
    }(e.VipStatNS || (e.VipStatNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(7), a = i(3), s = i(10), o = i(26);
    !function (t) {
        t.isLogin = function () {
            let t = 0;
            return a.default.isLogin && (t = 1), t
        }, t.isVip = function () {
            let t = 0;
            return a.default.isVip && (t = 1), t
        }, t.vipType = function () {
            let t = 0;
            return a.default.isSuperVip ? t = 5 : a.default.isPlatinumVip ? t = 3 : a.default.isVip && (t = 2), t
        }, t.taskGcid = function (t) {
            const e = o.default.getTask(t);
            let i = "";
            if (e) {
                const t = e.getTaskBase();
                !t || t.taskType !== n.DownloadKernel.TaskType.P2sp && t.taskType !== n.DownloadKernel.TaskType.Emule || (i = t.gcid)
            }
            return i
        }, t.taskFileSize = function (t) {
            const e = o.default.getTask(t);
            let i = 0;
            if (e) {
                const t = e.getTaskBase();
                t && (i = t.fileSize)
            }
            return i
        }, t.taskUrl = function (t) {
            let e = "";
            do {
                const i = o.default.getTask(t);
                if (!i) break;
                const a = i.getTaskBase();
                if (!a) break;
                if (a.taskType === n.DownloadKernel.TaskType.Bt) {
                    const t = i.getTaskDetail();
                    t && (e = s.default.createBtTaskUrl(t.infoId))
                } else e = a.url
            } while (0);
            return e
        }
    }(e.StatHelperNS || (e.StatHelperNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(8), s = i(90), o = i(216), r = i(152), l = i(3), u = i(85), c = i(43), d = i(20), h = i(1), f = i(54),
        p = i(93), g = i(153), S = i(86), y = i(45);

    class T {
        constructor(t, e) {
            this.vipTaskInfo = null, this.logger = null, this.isCloudTask = !1, this.lockedUpdate = !1, this.xgtStateMap = new Map, this.sectionSpeed = null, this.needShowNextReadyXgt = !1, this.needSelect = !1, this.packageAcclerate = y.PackageTryDefineNS.Acclerate.none, this.hidePackageTryXgtTimeOut = null, this.logger = new u.TaskLogHelp(u.TaskLogHelpName.VipTask, t), this.isCloudTask = e, this.taskId = t.getTaskId(), this.task = t, T.sVipTasArray.push(this), this.sectionSpeed = new o.TaskSectionSpeed(t), null === T.sLoopCheckTimer && (T.sLoopCheckTimer = setInterval(() => {
                T.showReadyXgtLoop(), T.checkSelectTask()
            }, 100))
        }

        onPackageStateChange(t) {
            return n(this, void 0, void 0, function* () {
                switch (this.hidePackageTryXgtTimeOut && (clearTimeout(this.hidePackageTryXgtTimeOut), this.hidePackageTryXgtTimeOut = null), yield this.onPackageStateChangeCallBack(t), t) {
                    case y.PackageTryDefineNS.State.none:
                        this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Exit);
                        break;
                    case y.PackageTryDefineNS.State.ready:
                        c.default.activePackageTaskId === this.taskId && (S.PackageTryStatNS.show(c.default.todayUseing, "xgt", c.default.isSurperPackget, c.default.isHaveCloudTask).catch(), this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Ready, {select: !0}), this.hidePackageTryXgtTimeOut = setTimeout(() => {
                            this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Background, {select: !1})
                        }, 3e5));
                        break;
                    case y.PackageTryDefineNS.State.runing:
                        c.default.addPackageTryTask(this.task, this.logger).catch();
                        break;
                    case y.PackageTryDefineNS.State.commiting:
                        switch (c.default.xgtShowSwitch) {
                            case y.PackageTryDefineNS.XgtShowSwitch.none:
                                c.default.activePackageTaskId === this.taskId && this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Exit);
                                break;
                            case y.PackageTryDefineNS.XgtShowSwitch.justone:
                            case y.PackageTryDefineNS.XgtShowSwitch.alltask:
                        }
                        break;
                    case y.PackageTryDefineNS.State.stop:
                        this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Exit);
                        break;
                    case y.PackageTryDefineNS.State.finish:
                        break;
                    case y.PackageTryDefineNS.State.over:
                        this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Exit)
                }
                this.updateVipTaskInfo()
            })
        }

        onPackageActiveTaskDel(t) {
            this.taskId !== t && this.tryShowPackageTry()
        }

        onExitPackageXgt() {
            this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Exit), this.updateVipTaskInfo()
        }

        onPackageAcclerateUpdate(t, e) {
            if (this.taskId === t || -1 === t) {
                switch (e) {
                    case y.PackageTryDefineNS.Acclerate.baotuan:
                        this.packageAcclerate === y.PackageTryDefineNS.Acclerate.try ? this.packageAcclerate = y.PackageTryDefineNS.Acclerate.trybaotuan : this.packageAcclerate = e;
                        break;
                    case y.PackageTryDefineNS.Acclerate.try:
                        this.packageAcclerate === y.PackageTryDefineNS.Acclerate.baotuan ? this.packageAcclerate = y.PackageTryDefineNS.Acclerate.trybaotuan : this.packageAcclerate = e;
                        break;
                    default:
                        this.packageAcclerate = e
                }
                switch (e) {
                    case y.PackageTryDefineNS.Acclerate.baotuan:
                        switch (c.default.packageState) {
                            case y.PackageTryDefineNS.State.runing:
                                switch (c.default.xgtShowSwitch) {
                                    case y.PackageTryDefineNS.XgtShowSwitch.none:
                                    case y.PackageTryDefineNS.XgtShowSwitch.justone:
                                        break;
                                    case y.PackageTryDefineNS.XgtShowSwitch.alltask:
                                        c.default.activePackageTaskId !== this.taskId && this.changeXgtState(a.VipDownloadDefineNS.XgtType.PackageTry, a.VipDownloadDefineNS.XgtState.Ready, {select: !1})
                                }
                        }
                        break;
                    case y.PackageTryDefineNS.Acclerate.none:
                }
                this.updateVipTaskInfo()
            }
        }

        getLogger() {
            return this.logger
        }

        getSectionSpeed() {
            return this.sectionSpeed
        }

        static showReadyXgtLoop() {
            if (d.BaoTuanSettingNS.getPriorityInner()) {
                if (T.sDeleayShowReadXgtTick > h.default.currentMillisecond) return;
                T.sVipTasArray.sort((t, e) => {
                    let i = t.getXgtArgs(a.VipDownloadDefineNS.XgtType.Baotuan),
                        n = e.getXgtArgs(a.VipDownloadDefineNS.XgtType.Baotuan), s = 0, o = 0;
                    return i && i.baotuanInnerPriority && (s = i.baotuanInnerPriority), n && n.baotuanInnerPriority && (o = n.baotuanInnerPriority), o - s
                })
            }
            let t = !1;
            T.sVipTasArray.forEach(function (e) {
                return n(this, void 0, void 0, function* () {
                    e.needShowNextReadyXgt && (t ? e.logger.info("other runing") : (t = !0, e.needShowNextReadyXgt = !1, yield e.showReadyXgt(), t = !1))
                })
            }), d.BaoTuanSettingNS.getPriorityInner() && t && (u.TaskLogHelp.infoEx(u.TaskLogHelpName.Baotuan, "sorted===>"), T.sVipTasArray.forEach(t => {
                let e = t.getXgtArgs(a.VipDownloadDefineNS.XgtType.Baotuan);
                t.logger.info("sorted", e ? e.baotuanInnerPriority : 0)
            }), u.TaskLogHelp.infoEx(u.TaskLogHelpName.Baotuan, "<===sorted"))
        }

        static checkSelectTask() {
            if (h.default.currentTime - T.sPreSelectTick < 5) return;
            let t = !1;
            T.sVipTasArray.forEach(function (e) {
                return n(this, void 0, void 0, function* () {
                    if (e.needSelect && !t) {
                        let i = e.getShowedXgt();
                        do {
                            if (i === a.VipDownloadDefineNS.XgtType.Unkown) {
                                e.needSelect = !1;
                                break
                            }
                            let n = 0;
                            switch (T.sPreSelectMap.has(i) && (n = T.sPreSelectMap.get(i)), i) {
                                case a.VipDownloadDefineNS.XgtType.PlayGame:
                                    h.default.currentTime - n < 60 && (e.needSelect = !1);
                                    break;
                                case a.VipDownloadDefineNS.XgtType.Baotuan:
                            }
                            e.needSelect && (e.task.select(), e.logger.info("SelectTask"), e.needSelect = !1, t = !0, T.sPreSelectTick = h.default.currentTime, T.sPreSelectMap.set(i, T.sPreSelectTick))
                        } while (0)
                    }
                })
            })
        }

        showReadyXgt() {
            return n(this, void 0, void 0, function* () {
                let t = 1e4, e = !1;
                for (; ;) {
                    let i = this.getNextReadyXgt(t);
                    t = i.xgtPriority;
                    let n = this.getXgtArgs(i.xgtType), s = {xgtState: a.VipDownloadDefineNS.XgtState.Show, args: n},
                        o = !1;
                    switch (i.xgtType) {
                        case a.VipDownloadDefineNS.XgtType.Try:
                            this.isCloudTask || (o = yield this.tryOperation.showTry(n));
                            break;
                        case a.VipDownloadDefineNS.XgtType.Ad:
                            this.isCloudTask || (o = this.adOperation.showAd(n));
                            break;
                        case a.VipDownloadDefineNS.XgtType.PlayGame:
                            this.isCloudTask || (o = this.gameOperation.showGame());
                            break;
                        case a.VipDownloadDefineNS.XgtType.Baotuan:
                            this.isCloudTask || (o = yield this.baotuanOperation.showBaotuan(n));
                            break;
                        case a.VipDownloadDefineNS.XgtType.PackageTry:
                            this.logger.info("展示打包试用下挂条"), o = !0;
                            break;
                        case a.VipDownloadDefineNS.XgtType.CloudWaiting:
                            o = yield f.default.showReadyWaitingXgt(this.taskId, this);
                            break;
                        case a.VipDownloadDefineNS.XgtType.CloudDownloading:
                            this.logger.info("展示云任务下载中下挂条"), o = !0;
                            break;
                        default:
                            return this.updateVipTaskInfo(), e
                    }
                    if (o) {
                        this.xgtStateMap.set(i.xgtType, s), this.updateVipTaskInfo();
                        let t = i.args;
                        t && !1 === t.select || this.select(), e = !0;
                        break
                    }
                    s.xgtState = a.VipDownloadDefineNS.XgtState.Ready, this.xgtStateMap.set(i.xgtType, s)
                }
                return e
            })
        }

        getNextReadyXgt(t) {
            let e = a.VipDownloadDefineNS.XgtType.Unkown, i = {xgtType: e, xgtPriority: 0, args: {}};
            if (this.isCloudTask || c.default.packageNone || c.default.packageReady || c.default.packageRuning || c.default.packageOver || this.taskId !== c.default.activePackageTaskId) {
                let n = 0, s = null;
                this.isCloudTask || (s = this.baotuanOperation.getBaotuanDetail());
                let o = this.getShowedXgt(), r = null;
                this.xgtStateMap.forEach(function (i, o) {
                    let l = 0;
                    if (i.xgtState === a.VipDownloadDefineNS.XgtState.Ready) switch (o) {
                        case a.VipDownloadDefineNS.XgtType.Try:
                            l = 10;
                            break;
                        case a.VipDownloadDefineNS.XgtType.Ad:
                            l = 30;
                            break;
                        case a.VipDownloadDefineNS.XgtType.PlayGame:
                            l = 20;
                            break;
                        case a.VipDownloadDefineNS.XgtType.Baotuan:
                            l = d.BaoTuanSettingNS.getPriorityOut() ? 50 : 5, s && s.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut && (l = 100);
                            break;
                        case a.VipDownloadDefineNS.XgtType.PackageTry:
                            l = 85;
                            break;
                        case a.VipDownloadDefineNS.XgtType.CloudDownloading:
                            l = 55;
                            break;
                        case a.VipDownloadDefineNS.XgtType.CloudWaiting:
                            l = 50
                    } else if (i.xgtState === a.VipDownloadDefineNS.XgtState.Show) switch (o) {
                        case a.VipDownloadDefineNS.XgtType.Try:
                            l = 60;
                            break;
                        case a.VipDownloadDefineNS.XgtType.Ad:
                            l = 70;
                            break;
                        case a.VipDownloadDefineNS.XgtType.PlayGame:
                            l = 80;
                            break;
                        case a.VipDownloadDefineNS.XgtType.Baotuan:
                            l = d.BaoTuanSettingNS.getPriorityOut() ? 50 : 5, s && s.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut && (l = 100);
                            break;
                        case a.VipDownloadDefineNS.XgtType.PackageTry:
                            l = 85;
                            break;
                        case a.VipDownloadDefineNS.XgtType.CloudDownloading:
                            l = 55;
                            break;
                        case a.VipDownloadDefineNS.XgtType.CloudWaiting:
                            l = 50
                    }
                    l > n && l < t && (e = o, n = l, r = i.args)
                }), i = {
                    xgtType: e,
                    xgtPriority: n,
                    args: r
                }, o === e && (i.xgtType = a.VipDownloadDefineNS.XgtType.Unkown)
            }
            return i
        }

        getXgtArgs(t) {
            let e = null;
            return this.xgtStateMap.has(t) && (e = this.xgtStateMap.get(t).args), e
        }

        select(t) {
            this.needSelect = void 0 === t || t
        }

        getVipTaskInfo() {
            return this.vipTaskInfo || (this.vipTaskInfo = this.createVipTaskInfo()), this.vipTaskInfo
        }

        updateVipTaskInfo() {
            if (this.lockedUpdate) return !1;
            let t = this.vipTaskInfo, e = this.createVipTaskInfo(), i = !1;
            return t && t.taskType === e.taskType && t.taskStatus === e.taskStatus && t.trySection === e.trySection && t.xgtType === e.xgtType || (i = !0), s.VipDownloadHelperNS.fireVipTaskInfoChanged(this.taskId, e, i, this.logger), i
        }

        changeXgtState(t, e, i) {
            let n = this.getShowedXgt();
            if (n !== t || e !== a.VipDownloadDefineNS.XgtState.Ready) {
                if (i ? i.tick = h.default.currentMillisecond : i = {tick: h.default.currentMillisecond}, this.xgtStateMap.set(t, {
                    xgtState: e,
                    args: i
                }), this.lockedUpdate || (this.needShowNextReadyXgt = !0), n === t && e === a.VipDownloadDefineNS.XgtState.Unkown) return this.select(!1), void this.logger.info("当前下挂条正在展示，切换回Unkown不选择");
                this.logger.info("下挂条状态改变：", n, t, e, i, this.needShowNextReadyXgt), t === a.VipDownloadDefineNS.XgtType.Try && e === a.VipDownloadDefineNS.XgtState.Ready && this.changeXgtState(a.VipDownloadDefineNS.XgtType.PlayGame, a.VipDownloadDefineNS.XgtState.Ready), t === a.VipDownloadDefineNS.XgtType.Ad && e === a.VipDownloadDefineNS.XgtState.Ready && this.changeXgtState(a.VipDownloadDefineNS.XgtType.PlayGame, a.VipDownloadDefineNS.XgtState.Ready)
            } else this.logger.info("当前下挂条更正在展示，切换回ready状态不作处理")
        }

        getShowedXgt() {
            let t = a.VipDownloadDefineNS.XgtType.Unkown;
            return this.xgtStateMap.forEach((e, i) => {
                e.xgtState === a.VipDownloadDefineNS.XgtState.Show && (t = i)
            }), t
        }

        getXgtState(t) {
            let e = a.VipDownloadDefineNS.XgtState.Unkown;
            return this.xgtStateMap.has(t) && (e = this.xgtStateMap.get(t).xgtState), e
        }

        static updateDeleayTick(t) {
            d.BaoTuanSettingNS.getPriorityInner() && (T.sDeleayShowReadXgtTick = h.default.currentMillisecond + t, u.TaskLogHelp.infoEx(u.TaskLogHelpName.Baotuan, "DeleayShowReadXgtTick", T.sDeleayShowReadXgtTick))
        }

        static onUserAuthorityChangedEx(t, e, i) {
            return n(this, void 0, void 0, function* () {
                l.default.isVip && !i && (c.default.packageRuning ? c.default.stopPackagTry("onUserAuthorityChangedEx") : c.default.packageNone || c.default.reinit("onUserAuthorityChangedEx")), yield T.loadBaotuanInfo(), yield T.loadSpeedZeroInfo(), T.sPreSelectMap.clear()
            })
        }

        static loadBaotuanInfo() {
            return n(this, void 0, void 0, function* () {
                d.BaoTuanSettingNS.reInitLeftCount();
                let t = yield p.default.cutlineLeft();
                t && 0 === t.result && (d.BaoTuanSettingNS.setCutlineLeftCount(t.cutlineLeftTimes), d.BaoTuanSettingNS.setIsOldUser(t.is_old_user), l.default.emit(l.UserEventNS.cutlineCountChanged))
            })
        }

        static loadSpeedZeroInfo() {
            return n(this, void 0, void 0, function* () {
                yield g.SpeedZeroDataBaseNS.initTable(l.default.userId), yield r.SpeedZero.reinitAllState(), yield r.SpeedZero.commitAllState()
            })
        }

        getIsCloudTask() {
            return this.isCloudTask
        }
    }

    T.sVipTasArray = new Array, T.sLoopCheckTimer = null, T.sPreSelectTick = 0, T.sPreSelectMap = new Map, T.sDeleayShowReadXgtTick = 0, e.VipTaskBase = T
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(82);
    !function (t) {
        const e = new a.SqliteTable;
        e.name = "try", e.encrypt = !0, e.jsonify = !0, e.init("0").catch();
        let i = new Map;
        t.setTask = function (t, n) {
            e.setUserData(t, -1, n).catch(), i.set(t, n)
        }, t.getTask = function (t) {
            return i.get(t)
        }, t.loadTask = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = yield e.getUserData(t, -1);
                n && i.set(t, n)
            })
        }, t.removeTask = function (t) {
            e.removeTask(t, -1).catch()
        }, t.getTable = function () {
            return e
        }
    }(e.TryTaskDataBaseNS || (e.TryTaskDataBaseNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(217), s = i(190), o = i(8), r = i(153), l = i(7), u = i(2), c = i(218), d = i(10), h = i(14), f = i(3),
        p = i(0), g = i(1), S = i(13), y = i(92), T = p.default.getLogger("VipDownload:speedzero");
    var k, m;
    !function (t) {
        t.NoviceGuid = "SpeedZeroNovice", t.RemindSucceed = "SpeedZeroRemindSucceed", t.RemindCountOut = "SpeedZeroRemindCountOut"
    }(k || (k = {})), function (t) {
        t[t.UnKnow = -1] = "UnKnow", t[t.None = 0] = "None", t[t.NoSpeed = 1] = "NoSpeed", t[t.NoSpeedRead = 2] = "NoSpeedRead", t[t.HaveCreate = 3] = "HaveCreate", t[t.CDNReady = 4] = "CDNReady", t[t.CDNReadyRead = 5] = "CDNReadyRead", t[t.CDNFailed = 6] = "CDNFailed", t[t.CDNFailedRead = 7] = "CDNFailedRead"
    }(m = e.SpeedZeroState || (e.SpeedZeroState = {}));

    class v {
        constructor(t) {
            this.task = null, this.zeroTime = 0, this.isNoRemind_ = !1, this.isCloseFailed_ = !1, this.speedCheckTimer = null, this.lastQueryStateTick = 0, this.szState = m.UnKnow, this.szStatePre = null, this.tokenKey = "", this.haveClickRemind_ = !1, this.vipTaskInfo_ = null, this.selected = !1, this.showedTip = !1, this.isBlockResource = void 0, this.task = t, v.szMap.set(t.getTaskId(), this), v.isRegisterExternalFunction || (v.registerExternalFunction(), v.registerPluginFunction(), v.isRegisterExternalFunction = !0), setTimeout(() => n(this, void 0, void 0, function* () {
                yield this.commitState()
            }), 5e3), d.default.addListener(d.DkEventNS.downloadItemActive, this.onDownloadItemActive.bind(this)), u.client.attachServerEvent(d.DkEventNS.downloadItemChosen, this.onDownloadItemChosen.bind(this)), f.default.addListener(f.UserEventNS.authorityChanged, this.onAuthorityChanged.bind(this)), h.default.addListener(h.TaskEventNS.taskBlockSecondInfo, this.onTaskBlockSecondInfo.bind(this)), this.initState()
        }

        initState() {
            return n(this, void 0, void 0, function* () {
                this.szState === m.UnKnow && ((yield this.haveCreate()) ? this.szState = m.HaveCreate : this.szState = m.None, this.notifyWebPage(!0), this.notifySpeedZeroState())
            })
        }

        onTaskBlockSecondInfo(t, e, i) {
            this.taskId === t && (this.isBlockResource = e)
        }

        set vipTaskInfo(t) {
            this.vipTaskInfo_ = t
        }

        getSpeedZeroState() {
            return this.szState
        }

        removeTask() {
            r.SpeedZeroDataBaseNS.removeTask(this.taskId)
        }

        static initConfig() {
            return n(this, void 0, void 0, function* () {
                do {
                    if (v.isInitConfig) break;
                    T.info("initConfig"), v.isInitConfig = !0;
                    let t = new a.SpeedZeroHttpSession;
                    v.config = yield t.queryConfig(), null === v.config && (v.isInitConfig = !1)
                } while (0)
            })
        }

        static getSwitch() {
            return !!v.config && v.config.switch
        }

        haveCreate() {
            return n(this, void 0, void 0, function* () {
                return r.SpeedZeroDataBaseNS.isTaskCreate(this.taskId)
            })
        }

        get isNoRemind() {
            return this.isNoRemind_
        }

        set isNoRemind(t) {
            this.isNoRemind_ = t
        }

        get haveClickRemind() {
            return this.haveClickRemind_
        }

        set haveClickRemind(t) {
            this.haveClickRemind_ = t
        }

        get isCloseFailed() {
            return this.isCloseFailed_
        }

        set isCloseFailed(t) {
            this.isCloseFailed_ = t
        }

        isSpeedZeroTask() {
            switch (this.szState) {
                case m.HaveCreate:
                case m.CDNReady:
                    return !0;
                default:
                    return !1
            }
        }

        isGroupTask() {
            let t = this.task.getTaskBase();
            return !(!t || t.taskType !== l.DownloadKernel.TaskType.Group)
        }

        onTaskStatusChanged(t) {
            return n(this, void 0, void 0, function* () {
                if (!this.isBlockResource && v.isInitConfig && v.config && v.config.switch && !this.isGroupTask()) switch (t) {
                    case l.DownloadKernel.TaskStatus.Started:
                        if (this.isNoRemind) return;
                        if (this.isCloseFailed) return;
                        this.szState === m.None && this.createSpeedCheckTimer();
                        break;
                    case l.DownloadKernel.TaskStatus.Succeeded:
                        if (this.szState === m.CDNReady) {
                            let t = yield this.avgSpeed();
                            c.SpeedZeroStatNS.downLoadFinish(this.taskGcid, t, this.taskUrl)
                        }
                        this.killSpeedCheckTimer();
                        break;
                    default:
                        this.killSpeedCheckTimer()
                }
            })
        }

        createSpeedCheckTimer() {
            this.speedCheckTimer = setInterval(() => {
                let t = this.task.getTaskBase(), e = S.default.getValue("VipDownload", "SpeedZeroLimitSpeed");
                do {
                    if (this.isBlockResource || this.isTryOrAdTask()) {
                        this.killSpeedCheckTimer();
                        break
                    }
                    t && t.downloadSpeed < e ? (this.zeroTime += 1, this.zeroTime >= v.config.zeroTime && f.default.isVip && !1 === this.isBlockResource && (T.info("notify speedzero task"), this.haveClickRemind = !1, this.szState = m.NoSpeed, this.notifyWebPage(!0), this.notifySpeedZeroState(), this.killSpeedCheckTimer(), c.SpeedZeroStatNS.taskMeetConditions(this.taskGcid, this.taskUrl))) : this.zeroTime = 0
                } while (0)
            }, 1e3)
        }

        killSpeedCheckTimer() {
            this.speedCheckTimer && (clearInterval(this.speedCheckTimer), this.speedCheckTimer = null, this.zeroTime = 0)
        }

        commitCreate() {
            return n(this, void 0, void 0, function* () {
                do {
                    T.info("commitCreate");
                    let t = this.task.getTaskBase(), e = new s.SpeedZeroHttpPackageNS.ICreateRequest;
                    e.filesize = t.fileSize, e.filename = "", e.selectedIndexs = [];
                    let i = "", o = t.taskType === l.DownloadKernel.TaskType.Bt;
                    if (o) {
                        let n = this.task.getTaskDetail();
                        if (!n) {
                            T.info("taskDetail is null", t);
                            break
                        }
                        e.url = "bt://" + n.infoId, i = n.infoId
                    } else e.url = t.url;
                    if ("" == e.url) {
                        T.info("request.url is null");
                        break
                    }
                    yield(new a.SpeedZeroHttpSession).queryCreate(e).then(t => n(this, void 0, void 0, function* () {
                        yield this.onCreateCallback(e, t, i, o)
                    }))
                } while (0)
            })
        }

        onCreateCallback(t, e, i, a) {
            return n(this, void 0, void 0, function* () {
                T.info("onCreateCallback", t, e);
                do {
                    if (!e) break;
                    switch (e.result) {
                        case 0:
                        case 54:
                            r.SpeedZeroDataBaseNS.createTask(this.taskId, i, this.taskGcid, a), this.openDialog(k.RemindSucceed, null), this.szState = m.HaveCreate, c.SpeedZeroStatNS.addToRemind(this.taskGcid, this.taskUrl, 1);
                            break;
                        case 53:
                            this.openDialog(k.RemindCountOut, null);
                            break;
                        case 50:
                        case 51:
                        case 55:
                        default:
                            this.szState = m.CDNFailed, c.SpeedZeroStatNS.addToRemind(this.taskGcid, this.taskUrl, 0)
                    }
                    this.notifyWebPage(!0), this.notifySpeedZeroState()
                } while (0)
            })
        }

        static reinitAllState() {
            return n(this, void 0, void 0, function* () {
                T.info("reinitAllState"), v.szMap.forEach(t => n(this, void 0, void 0, function* () {
                    t.szState !== m.NoSpeed && t.szState !== m.NoSpeedRead || (yield t.haveCreate()) ? (t.szState = m.UnKnow, t.lastQueryStateTick = 0, t.zeroTime = 0, yield t.initState()) : t.notifyWebPage()
                }))
            })
        }

        static commitAllState() {
            return n(this, void 0, void 0, function* () {
                T.info("commitAllState"), v.szMap.forEach(t => {
                    t.commitState()
                })
            })
        }

        commitState() {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.szState !== m.HaveCreate) break;
                    if (g.default.currentTime - this.lastQueryStateTick < 60) break;
                    this.lastQueryStateTick = g.default.currentTime, T.info("commitState", this.taskId);
                    let t = new s.SpeedZeroHttpPackageNS.IStateRequest, e = this.task.getTaskBase(),
                        i = e.taskType === l.DownloadKernel.TaskType.Bt;
                    if (t.url = i ? yield r.SpeedZeroDataBaseNS.getUrl(this.taskId) : e.url, "" == t.url) {
                        T.info("request.url is null", this.taskId);
                        break
                    }
                    yield(new a.SpeedZeroHttpSession).queryState(t).then(e => n(this, void 0, void 0, function* () {
                        yield this.onStateCallback(t, e)
                    }))
                } while (0)
            })
        }

        onStateCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                T.info("onStateCallback", t, e);
                do {
                    if (!e) break;
                    switch (r.SpeedZeroDataBaseNS.increaseQueryCount(this.taskId), e.result) {
                        case 0:
                            100 == e.progress && (this.szState = m.CDNReady, this.tokenKey = e.key);
                            break;
                        case 54:
                            break;
                        default:
                            this.szState = m.CDNFailed
                    }
                    this.notifyWebPage(!0), this.notifySpeedZeroState()
                } while (0)
            })
        }

        openDialog(t, e) {
            return n(this, void 0, void 0, function* () {
                let n = `file:///${__dirname}/../dialog-renderer/index.html?show=${t}&taskId=${this.taskId}`;
                f.default.isVip ? n += "&isVip=1" : n += "&isVip=0", n += `&isLogin=${Number(f.default.isLogin)}`, n += `&vipType=${f.default.vasType}`, n += `&gcid=${this.taskGcid}`;
                let a = 460, s = 368, o = void 0, r = void 0;
                switch (t) {
                    case k.NoviceGuid:
                        a = 460, s = 377;
                        break;
                    case k.RemindSucceed:
                        a = 460, s = 392;
                        break;
                    case k.RemindCountOut:
                        n += `&noVipCount=${Number(v.config.downloadLimit[0])}`, n += `&vipCount=${Number(v.config.downloadLimit[3])}`, n += `&supperVipCount=${Number(v.config.downloadLimit[5])}`, a = 460, s = 428
                }
                if (void 0 === o) {
                    let t = yield(yield y.asyncRemoteCall.getCurrentWindow()).getBounds();
                    o = t.x + (t.width - a) / 2, r = t.y + (t.height - s) / 2, o + a > screen.availWidth && (o = screen.availWidth - a), o < 0 && (o = 0), r + s > screen.height && (r = screen.availHeight - s), r < 0 && (r = 0)
                }
                if (v.showingDialog) return;
                v.showingDialog = !0;
                let l = yield new (yield y.asyncRemoteCall.getBrowserWindow())({
                    x: Math.round(o),
                    y: Math.round(r),
                    width: a,
                    height: s,
                    modal: !1,
                    resizable: !1,
                    skipTaskbar: !0,
                    frame: !1,
                    center: !0,
                    parent: yield y.asyncRemoteCall.getCurrentWindow(),
                    show: !1,
                    webPreferences: {nodeIntegration: !0}
                });
                i(33).ipcRenderer.send("create-shadow-window", l.id), T.info("openDialog", n), null !== e && void 0 !== e.onClose && l.on("close", e.onClose), l.once("ready-to-show", () => {
                    l.show()
                }), l.on("close", () => {
                    v.showingDialog = !1
                }), l.loadURL(n)
            })
        }

        static getSpeedZero(t) {
            return v.szMap.get(t)
        }

        static registerExternalFunction() {
            let t = {
                clickRemind: (...t) => n(this, void 0, void 0, function* () {
                    if (T.info("clickRemind"), !f.default.isLogin) return void u.client.callServerFunction("ShowLoginDlg");
                    let e = t[0], i = v.getSpeedZero(e);
                    if (!(yield i.haveShowNovice())) {
                        let t = null;
                        return i.openDialog(k.NoviceGuid, t)
                    }
                    i && (i.showedTip = !1, i.haveClickRemind = !0, i.commitCreate(), i.notifyWebPage())
                }), closeFailed: (...t) => {
                    T.info("closeFailed");
                    let e = t[0], i = v.getSpeedZero(e);
                    i && (i.showedTip = !1, i.isCloseFailed = !0, r.SpeedZeroDataBaseNS.removeTask(e), i.notifyWebPage())
                }, closeRemind: (...t) => {
                    T.info("closeRemind");
                    let e = t[0], i = v.getSpeedZero(e);
                    i && (i.isNoRemind = !0, i.showedTip = !1, i.notifyWebPage())
                }
            };
            u.client.callServerFunction("RegisterWebExternal", t)
        }

        static registerPluginFunction() {
            let t = {
                noviceClickOk: (...t) => n(this, void 0, void 0, function* () {
                    let e = Number(t[1]), i = v.getSpeedZero(e);
                    i && (yield i.setHaveShowNovice(), i.commitCreate())
                })
            };
            u.client.registerFunctions(t)
        }

        notifyWebPage(t) {
            return n(this, void 0, void 0, function* () {
                t && (this.showedTip = !0);
                {
                    let t = {
                        taskId: this.taskId,
                        result: -1,
                        status: this.isBlockResource ? 1 : 0,
                        queryCount: yield r.SpeedZeroDataBaseNS.getQueryCount(this.taskId),
                        pluginVersion: g.default.pluginVersion
                    };
                    switch (this.szState) {
                        case m.NoSpeed:
                        case m.NoSpeedRead:
                            t.result = 1;
                            break;
                        case m.HaveCreate:
                            t.result = 2;
                            break;
                        case m.CDNReady:
                        case m.CDNReadyRead:
                            t.result = 3;
                            break;
                        case m.CDNFailed:
                        case m.CDNFailedRead:
                            t.result = 4;
                            break;
                        default:
                            t.result = -1
                    }
                    this.showedTip && this.selected && f.default.isVip || (t.result = -1), yield u.client.callServerFunction("FireEventFunction", "SpeedZeroNotify", JSON.stringify(t)), T.info("SpeedZeroNotify", this.taskDescript(), t)
                }
            })
        }

        notifySpeedZeroState() {
            T.info("notifySpeedZeroState", this.taskId), h.default.emit(h.TaskEventNS.taskSpeedZeroChange, this.taskId), this.reportState()
        }

        reportState() {
            return n(this, void 0, void 0, function* () {
                if (this.szStatePre !== this.szState) {
                    let t = !1;
                    if ((yield u.client.callServerFunction("GetCategoryViewTaskList", "Downloading")).forEach(e => {
                        e === this.taskId && (t = !0)
                    }), !t) return;
                    switch (this.szState) {
                        case m.NoSpeed:
                        case m.NoSpeedRead:
                            break;
                        case m.HaveCreate:
                            c.SpeedZeroStatNS.showTaskCard(yield r.SpeedZeroDataBaseNS.getGcid(this.taskId), "join", this.taskUrl), T.info("join...", this.taskDescript(), yield r.SpeedZeroDataBaseNS.getGcid(this.taskId));
                            break;
                        case m.CDNReady:
                            c.SpeedZeroStatNS.showCdnReady(yield r.SpeedZeroDataBaseNS.getGcid(this.taskId), this.taskUrl), c.SpeedZeroStatNS.showTaskCard(yield r.SpeedZeroDataBaseNS.getGcid(this.taskId), "succ", this.taskUrl), T.info("succ...", this.taskDescript());
                            break;
                        case m.CDNReadyRead:
                            break;
                        case m.CDNFailed:
                            c.SpeedZeroStatNS.showTaskCard(yield r.SpeedZeroDataBaseNS.getGcid(this.taskId), "fail", this.taskUrl), T.info("fail...", this.taskDescript())
                    }
                    this.szStatePre = this.szState
                }
            })
        }

        getTokenKey() {
            return this.tokenKey
        }

        isTryOrAdTask() {
            if (this.vipTaskInfo_) {
                switch (this.vipTaskInfo_.enterType) {
                    case o.VipDownloadDefineNS.VipTaskType.Try:
                    case o.VipDownloadDefineNS.VipTaskType.Ad:
                        return !0
                }
                switch (this.vipTaskInfo_.taskType) {
                    case o.VipDownloadDefineNS.VipTaskType.Try:
                    case o.VipDownloadDefineNS.VipTaskType.Ad:
                        return !0
                }
            }
            return !1
        }

        select() {
            return n(this, void 0, void 0, function* () {
                let t = this.taskId;
                v.szMap.forEach(e => n(this, void 0, void 0, function* () {
                    e.taskId === t ? (e.selected = !0, e.notifyWebPage()) : e.selected = !1
                }))
            })
        }

        get taskId() {
            return this.task.getTaskId()
        }

        taskDescript() {
            return this.task.taskDescript()
        }

        get taskGcid() {
            let t = this.task.getTaskBase();
            if (t) {
                if (t.taskType !== l.DownloadKernel.TaskType.Bt) return t.gcid;
                {
                    let t = this.task.getTaskDetail();
                    if (t) return t.infoId
                }
            }
            return ""
        }

        get taskUrl() {
            let t = this.task.getTaskBase();
            if (t) {
                if (t.taskType !== l.DownloadKernel.TaskType.Bt) return t.url;
                {
                    let t = this.task.getTaskDetail();
                    if (t) return "bt://" + t.infoId
                }
            }
            return ""
        }

        avgSpeed() {
            return n(this, void 0, void 0, function* () {
                let t = yield u.client.callServerFunction("GetTaskInfo", this.taskId, void 0, "taskDetail");
                if (t) {
                    let e = JSON.parse(t);
                    if (e && e.averageSpeed) return e.averageSpeed
                }
                return 0
            })
        }

        haveShowNovice() {
            return n(this, void 0, void 0, function* () {
                return yield u.client.callServerFunction("GetValue", "VipDownload", "SpeedZero_HaveShowNovice", !1).catch()
            })
        }

        setHaveShowNovice() {
            return n(this, void 0, void 0, function* () {
                yield u.client.callServerFunction("SetValue", "VipDownload", "SpeedZero_HaveShowNovice", !0).catch()
            })
        }

        onDownloadItemActive(t, e, i) {
            t === l.DownloadKernel.CategroyViewID.Downloading && e && i === this.taskId && (this.szState === m.CDNReady && (this.szState = m.CDNReadyRead, this.notifyWebPage(), this.notifySpeedZeroState()), this.szState === m.NoSpeed && (this.szState = m.NoSpeedRead, this.notifyWebPage(), this.notifySpeedZeroState()), this.szState === m.CDNFailed && (this.szState = m.CDNFailedRead, this.notifyWebPage(), this.notifySpeedZeroState()))
        }

        onDownloadItemChosen(t, e, i, n, a) {
            e === l.DownloadKernel.CategroyViewID.Downloading && i && n === this.taskId && (this.szState === m.CDNReady && (this.szState = m.CDNReadyRead, this.notifyWebPage(), this.notifySpeedZeroState()), this.szState === m.NoSpeed && (this.szState = m.NoSpeedRead, this.notifyWebPage(), this.notifySpeedZeroState()), this.szState === m.CDNFailed && (this.szState = m.CDNFailedRead, this.notifyWebPage(), this.notifySpeedZeroState()))
        }

        onAuthorityChanged(t, e) {
            this.notifyWebPage(), this.notifySpeedZeroState()
        }
    }

    v.isInitConfig = !1, v.config = null, v.showingDialog = !1, v.isRegisterExternalFunction = !1, v.szMap = new Map, e.SpeedZero = v
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(82);
    !function (t) {
        let e = null, i = new Map;
        t.initTable = function (t) {
            return n(this, void 0, void 0, function* () {
                e && t === e.userId || (i.clear(), e = null, (e = new a.SqliteTable).name = "SpeedZero", e.encrypt = !0, e.jsonify = !0, yield e.init(t).catch())
            })
        }, t.removeTask = function (t) {
            e.removeTask(t, -2)
        }, t.createTask = function (t, n, a, s) {
            let o = {isCreate: !0, url: n, gcid: a, queryCount: 0, btFlag: s};
            e.setUserData(t, -1, o).catch(), i.set(t, o)
        }, t.isTaskCreate = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = i.get(t);
                return n ? n.isCreate : !!(n = yield e.getUserData(t, -1)) && (i.set(t, n), n.isCreate)
            })
        }, t.increaseQueryCount = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = i.get(t);
                n && (n.queryCount++, e.setUserData(t, -1, n).catch(), i.set(t, n))
            })
        }, t.getQueryCount = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = i.get(t);
                return n ? n.queryCount : (n = yield e.getUserData(t, -1)) ? (i.set(t, n), n.queryCount) : 0
            })
        }, t.getUrl = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = "", a = !1;
                do {
                    let s = i.get(t);
                    if (s) {
                        n = s.url, a = s.btFlag;
                        break
                    }
                    if (s = yield e.getUserData(t, -1)) {
                        i.set(t, s), n = s.url, a = s.btFlag;
                        break
                    }
                } while (0);
                return a && (n = "bt://" + n), n
            })
        }, t.getGcid = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = i.get(t);
                return n && n.gcid ? n.gcid : (n = yield e.getUserData(t, -1)) && n.gcid ? (i.set(t, n), n.gcid) : ""
            })
        }
    }(e.SpeedZeroDataBaseNS || (e.SpeedZeroDataBaseNS = {}))
}, function (t, e, i) {
    "use strict";
    const n = i(32);
    if ("renderer" === process.type) {
        if (n.info("client running"), !global.__xdasAsyncRemoteExports) {
            let t = {};
            global.__xdasAsyncRemoteExports = t;
            let e = i(155);
            t.require = e.require, t.getCurrentWebContents = e.getCurrentWebContents, t.getCurrentWindow = e.getCurrentWindow, t.Interest = e.Interest, t.global = new Proxy({}, {get: (t, i, n) => e.getGlobal(i)}), t.electron = new Proxy({}, {get: (t, i, n) => e.getBuiltin(i)}), Object.defineProperty(t, "currentWindow", {get: () => e.getCurrentWindow()}), Object.defineProperty(t, "currentWebContents", {get: () => e.getCurrentWebContents()}), Object.defineProperty(t, "process", {get: () => e.getGlobal("process")}), Object.defineProperty(t, "webContents", {get: () => e.getWebContents()})
        }
    } else if ("browser" === process.type && (n.info("server running"), !global.__xdasAsyncRemoteExports)) {
        let t = {};
        global.__xdasAsyncRemoteExports = t;
        const e = i(159);
        e.startServer(), t.getObjectRegistry = e.getObjectRegistry
    }
    t.exports = global.__xdasAsyncRemoteExports
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), e.getWebContents = e.getCurrentWebContents = e.getCurrentWindow = e.getGlobal = e.getBuiltin = e.remoteRequire = e.Interest = void 0;
    const n = i(33), a = i(48), s = i(156), o = i(157), r = i(83), l = i(158), u = i(32), c = i(84), d = n.ipcRenderer,
        h = process.electronBinding("v8_util"), f = new s.default, p = h.createIDWeakMap(),
        g = h.getHiddenValue(global, "contextId");

    class S {
        constructor(t) {
            if ("object" == typeof t ? (this.on = "object" == typeof t.on ? t.on : {}, this.once = "object" == typeof t.once ? t.once : {}) : (this.on = {}, this.once = {}), !this.check()) throw new Error("unexpected param")
        }

        check() {
            let t = !0;
            do {
                let e = Object.getOwnPropertyNames(this.on);
                if (e.forEach(e => {
                    "function" != typeof this.on[e] && (t = !1)
                }), !t) break;
                (e = Object.getOwnPropertyNames(this.once)).forEach(e => {
                    "function" != typeof this.once[e] && (t = !1)
                })
            } while (0);
            return t
        }
    }

    function y(t, e = new Set) {
        const i = t => {
            if (e.has(t)) return {type: "value", value: null};
            let n = t;
            if (Array.isArray(t)) {
                e.add(t);
                let i = {type: "array", value: y(t, e)};
                return e.delete(t), i
            }
            if (ArrayBuffer.isView(n)) return {type: "buffer", value: a.Buffer.from(t)};
            if (t instanceof Date) return {type: "date", value: t.getTime()};
            if (null != t && "object" == typeof t) {
                if (c.isPromise(t)) return {
                    type: "promise", then: i(function (e, i) {
                        t.then(e, i)
                    })
                };
                if (h.getHiddenValue(t, "__remote_id__")) return {
                    type: "remote-object",
                    id: h.getHiddenValue(t, "__remote_id__")
                };
                let n = {
                    type: t instanceof S ? "interest" : "object",
                    name: t.constructor ? t.constructor.name : "",
                    members: []
                };
                e.add(t);
                for (let e in t) n.members.push({name: e, value: i(t[e])});
                return e.delete(t), n
            }
            if ("function" == typeof t) {
                return {
                    type: "function",
                    id: f.add(t),
                    location: h.getHiddenValue(t, "__remote_call_location__"),
                    length: t.length
                }
            }
            return {type: "value", value: t}
        };
        return t.map(i)
    }

    function T(t, e, i) {
        c.isPromise(t) ? t.then(t => {
            e(t)
        }, t => {
            i(t)
        }) : e(t)
    }

    function k(t, e, i, n = !1) {
        const a = e => {
            if (t.hasOwnProperty(e.name) && !n) return;
            let i, a = {enumerable: e.enumerable, configurable: !0};
            if ("method" === e.type) {
                if (e.value.refId) {
                    if (p.has(e.value.refId) && (i = p.get(e.value.refId)), null == i) throw new Error("member refId pointer to null" + e.value.refId + "name: " + e.name)
                } else i = _(e.value, t, e.name);
                a.get = (() => i), a.set = (t => i = t)
            } else "get" === e.type && (a.get = (() => i), e.writable && (a.set = (t => {
                i = t
            })), i = _(e.value));
            Object.defineProperty(t, e.name, a)
        };
        if (Array.isArray(i)) {
            let t = i.length;
            for (let e = 0; e < t; e++) a(i[e])
        }
    }

    function m(t, e, i) {
        if (i) {
            let e = _(i);
            Object.setPrototypeOf(t, e)
        }
    }

    function v(t, e) {
        h.setHiddenValue(t, "__remote_id__", e)
    }

    function w(t) {
        return h.getHiddenValue(t, "__remote_id__")
    }

    function _(t, e, i) {
        const n = {
            value: () => t.value,
            array: () => t.members.map(t => _(t)),
            buffer: () => a.Buffer.from(t.value),
            promise: () => Promise.resolve({then: _(t.then)}),
            error: () => (function (t) {
                const e = (() => "error" === t.type ? new Error : {})();
                for (let i = 0; i < t.members.length; i++) {
                    let {name: n, value: a} = t.members[i];
                    e[n] = a
                }
                return e
            })(t),
            date: () => new Date(t.value),
            exception: () => {
                throw new Error(`${t.message}\n${t.stack}`)
            }
        };
        let s;
        return t.type in n ? s = n[t.type]() : t.refId ? p.has(t.refId) ? (h.addRemoteObjectRef(g, t.refId), s = p.get(t.refId)) : (u.warn("[metaToValue] refId point to null" + t.refId), s = "function" === t.type ? () => {
        } : {}) : t.id ? p.has(t.id) ? (h.addRemoteObjectRef(g, t.id), k(s = p.get(t.id), t.id, t.members, !0), m(s, t.id, t.proto)) : (s = "function" === t.type ? e ? function (t, e, i) {
            if (p.has(i.id)) return p.get(i.id);
            let n = w(t), a = function (...t) {
                throw Error("never should come to a proxied function")
            };
            Object.defineProperty(a, "name", {value: e, writable: !1, enumerable: !0});
            let s = new Proxy(a, {
                apply: (t, i, a) => new Promise((t, s) => {
                    let u = w(i);
                    if (u || (u = w(i.__remoteObj_)), !u) throw Error("is this function was a bound function?");
                    let c = r.default.browser.memberCall, h = l.default(c), f = y(a);
                    d.send(c, g, h, u, n, e, f), o.default.add(h, e => {
                        try {
                            T(_(e), t, s)
                        } catch (t) {
                            s(t)
                        }
                    })
                }), construct: (t, i, a) => new Promise((t, a) => {
                    let s = r.default.browser.memberConstruct, u = l.default(s);
                    d.send(s, g, u, n, e, y(i)), o.default.add(u, e => {
                        try {
                            let i = _(e);
                            t(i)
                        } catch (t) {
                            a(t)
                        }
                    })
                })
            });
            return h.setHiddenValue(a, "__remote_id__", i.id), s
        }(e, i, t) : function (t) {
            let e = t.id;
            const i = function (...t) {
                throw new Error("Should Never com to a remoteFunction PlaceHolder")
            };
            return v(i, e), new Proxy(i, {
                apply: (t, i, n) => new Promise((t, a) => {
                    let s = r.default.browser.functionCall, u = l.default(s), c = w(i);
                    d.send(s, g, u, c, e, y(n)), o.default.add(u, e => {
                        try {
                            T(_(e), t, a)
                        } catch (t) {
                            a(t)
                        }
                    })
                }), construct: (t, i, n) => new Promise((t, n) => {
                    let a = r.default.browser.construct, s = l.default(a);
                    d.send(a, g, s, e, y(i)), o.default.add(s, e => {
                        try {
                            let i = _(e);
                            t(i)
                        } catch (t) {
                            n(t)
                        }
                    })
                })
            })
        }(t) : {}, h.setRemoteObjectFreer(s, g, t.id), p.set(t.id, s), h.setHiddenValue(s, "__remote_id__", t.id), h.addRemoteObjectRef(g, t.id), function (t) {
            let e = w(t);
            Object.defineProperties(t, {
                __set: {
                    enumerable: !1, writable: !1, value: function (i, n) {
                        if ("function" == typeof n) throw new Error("set a function to a remote member is dangerous");
                        return new Promise((a, s) => {
                            let u = r.default.browser.memberSet, c = l.default(u), h = y([n]);
                            d.send(u, g, c, e, i, h), o.default.add(c, e => {
                                try {
                                    let o = _(e);
                                    t[i] = n, a(o)
                                } catch (t) {
                                    s(t)
                                }
                            })
                        })
                    }
                }, __get: {
                    enumerable: !1, writable: !1, value: function (i) {
                        return new Promise((n, a) => {
                            let s = r.default.browser.memberGet, u = l.default(s);
                            d.send(s, g, u, e, i), o.default.add(u, e => {
                                try {
                                    const s = _(e);
                                    t[i] = s, n(s)
                                } catch (t) {
                                    a(t)
                                }
                            })
                        })
                    }
                }, __sync: {
                    enumerable: !1, writable: !1, value: function () {
                        return new Promise((t, i) => {
                            let n = r.default.browser.sync, a = l.default(n);
                            d.send(n, g, a, e), o.default.add(a, n => {
                                try {
                                    if (n.id !== e) throw Error("SYNC_RETURN: remote id not match");
                                    let a = _(n);
                                    t(a)
                                } catch (t) {
                                    i(t)
                                }
                            })
                        })
                    }
                }
            })
        }(s), k(s, t.id, t.members), m(s, t.id, t.proto), Object.defineProperty(s.constructor, "name", {value: t.name}), t.extendedMemberNames && t.extendedMemberNames.forEach((t, e) => {
            let i = s[t], n = s.__proto__;
            for (; n;) {
                if (Object.prototype.hasOwnProperty.call(n, t)) {
                    delete n[t];
                    break
                }
                n = n.__proto__
            }
            Object.defineProperty(s, t, {value: i, enumerable: !1, writable: !1, configurable: !0})
        })) : u.error("no id of meta:", t), s
    }

    e.Interest = S;

    class D {
        constructor(...t) {
            if (this.__resolved_ = !1, this.__promise_ = null, this.__remoteObj_ = null, this.__what_ = "", this.__name_ = "", "string" === typeof arguments[0]) {
                let t = arguments[0], e = arguments[1];
                this.__what_ = t, this.__name_ = e || t, this.__resolved_ = !1, this.__remoteObj_ = null, this.__promise_ = new Promise((i, n) => {
                    let a = this.getChannel(t), s = l.default(a);
                    d.send(a, g, s, e), o.default.add(s, t => {
                        try {
                            let e = _(t);
                            this.__remoteObj_ = e, this.__resolved_ = !0, i(e)
                        } catch (t) {
                            n(t)
                        }
                    })
                })
            } else this.__remoteObj_ = arguments[0], this.__resolved_ = !0, this.__promise_ = null
        }

        getChannel(t) {
            let e = "";
            switch (t) {
                case"module":
                    e = r.default.browser.require;
                    break;
                case"builtin":
                    e = r.default.browser.builtIn;
                    break;
                case"global":
                    e = r.default.browser.global;
                    break;
                case"current_window":
                    e = r.default.browser.currentWindow;
                    break;
                case"current_web_contents":
                    e = r.default.browser.currentWebContents;
                    break;
                case"client_web_contents":
                    e = r.default.browser.clientWebContents;
                    break;
                case"web_contents":
                    e = r.default.browser.webContents
            }
            return e
        }

        __resolve() {
            let t = this.__promise_;
            if (null !== t) ; else {
                if (!this.__resolved_) throw Error("missing the promise for ayncnomously get remote object");
                t = new Promise((t, e) => {
                    t(this.__remoteObj_)
                }), this.__promise_ = t
            }
            return t
        }

        __isResolved() {
            return this.__resolved_
        }
    }

    function b(t, e, i) {
        try {
            o.default.invoke(e, i).remove(e)
        } finally {
            o.default.remove(e)
        }
    }

    d.on(r.default.renderer.requireReturn, b), d.on(r.default.renderer.getBuiltInReturn, b), d.on(r.default.renderer.getGlobalReturn, b), d.on(r.default.renderer.currentWindowReturn, b), d.on(r.default.renderer.currentWebContentsReturn, b), d.on(r.default.renderer.functionCallReturn, b), d.on(r.default.renderer.constructReturn, b), d.on(r.default.renderer.memberCallReturn, b), d.on(r.default.renderer.memberSetReturn, b), d.on(r.default.renderer.memberGetReturn, b), d.on(r.default.renderer.memberConstructReturn, b), d.on(r.default.renderer.callback, (t, e, i) => {
        f.apply(e, _(i))
    }), d.on(r.default.renderer.syncReturn, b), d.on("ELECTRON_RENDERER_RELEASE_CALLBACK", (t, e) => {
        u.info("[RELEASE_CALLBACK]: callbackId:", e), f.remove(e)
    }), process.on("exit", () => {
        d.send(r.default.browser.contextRelease)
    });
    const N = ["__resolve", "__isResolved"], C = ["__promise_", "__resolved_", "__remoteObj_", "__name_", "__what_"],
        x = t => {
            if (!t.__isResolved()) throw Error("Can not access the property of a remote module which has not Resolved yet.")
        };

    function I(t) {
        const e = function () {
        };
        Object.defineProperty(e, "name", {value: t.__name_}), Object.defineProperty(e, "what", {
            enumerable: !1,
            value: t.__what_
        });
        let i = new Proxy(e, {
            getPrototypeOf: e => (x(t), Reflect.getPrototypeOf(t.__remoteObj_)),
            setPrototypeOf: (t, e) => {
                throw new Error("changing prototype of remote object is forbidden")
            },
            isExtensible: e => (x(t), Reflect.isExtensible(t.__remoteObj_)),
            preventExtensions: e => (x(t), Reflect.preventExtensions(t)),
            getOwnPropertyDescriptor: (e, i) => (x(t), Reflect.getOwnPropertyDescriptor(t.__remoteObj_, i)),
            has: (e, i) => (x(t), Reflect.has(t.__remoteObj_, i)),
            deleteProperty: (e, i) => (x(e), Reflect.deleteProperty(t.__remoteObj_, i)),
            defineProperty: (e, i, n) => (x(t), Reflect.defineProperty(t.__remoteObj_, i, n)),
            get: (e, i, n) => {
                if ("string" == typeof i) {
                    if (String.prototype.includes.call(C, i)) {
                        return t[i]
                    }
                    if (String.prototype.includes.call(N, i)) {
                        return t[i]
                    }
                }
                return x(t), Reflect.get(t.__remoteObj_, i)
            },
            set: (e, i, n, a) => (x(t), Reflect.set(t.__remoteObj_, i, n, a)),
            ownKeys: e => (x(t), Reflect.ownKeys(t.__remoteObj_)),
            apply: (e, i, n) => {
                x(t), Reflect.apply(t.__remoteObj_, i, n)
            },
            construct: (e, i, n) => {
                if (x(t), "function" != typeof t.__remoteObj_) throw Error("operator new ONLY used for function");
                return new Promise((e, n) => {
                    let a = r.default.browser.construct, s = l.default(a),
                        u = h.getHiddenValue(t.__remoteObj_, "__remote_id__");
                    d.send(a, g, s, u, y(i)), o.default.add(s, t => {
                        try {
                            e(_(t))
                        } catch (t) {
                            n(t)
                        }
                    })
                })
            }
        });
        return t.__promise_.then(t => {
            let e = typeof t;
            if ("function" === e || "object" === e) {
                let e = w(t);
                e && v(i, e)
            }
        }), i
    }

    e.remoteRequire = function (t) {
        return I(new D("module", t))
    }, e.getBuiltin = function (t) {
        return I(new D("builtin", t))
    }, e.getGlobal = function (t) {
        return I(new D("global", t))
    }, e.getCurrentWindow = function () {
        return I(new D("current_window"))
    }, e.getCurrentWebContents = function () {
        return I(new D("current_web_contents"))
    }, e.getWebContents = function () {
        return I(new D("web_contents"))
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = process.electronBinding("v8_util");
    e.default = class {
        constructor() {
            this.nextId = 0, this.callbacks = {}
        }

        add(t) {
            let e = n.getHiddenValue(t, "__remote_callback_id__");
            if (null != e) return e;
            e = this.nextId -= 1;
            const i = /at (.*)/gi, a = (new Error).stack;
            let s, o = i.exec(a);
            for (; null !== o;) {
                const t = o[1];
                if (!t.includes("native") && !t.includes("electron.asar")) {
                    s = /([^/^)]*)\)?$/gi.exec(t)[1];
                    break
                }
                o = i.exec(a)
            }
            return this.callbacks[e] = t, n.setHiddenValue(t, "__remote_callback_id__", e), n.setHiddenValue(t, "__remote_call_location__", s), e
        }

        get(t) {
            return this.callbacks[t] || function () {
            }
        }

        apply(t, ...e) {
            return this.get(t).apply(global, ...e)
        }

        remove(t) {
            const e = this.callbacks[t];
            e && (n.deleteHiddenValue(e, "__remote_callback_id__"), delete this.callbacks[t])
        }
    }
}, function (t, e, i) {
    "use strict";
    var n;
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e = {};
        t.add = function (t, i, n) {
            e[t] = {func: i, thisArg: n}
        }, t.invoke = function (i, ...n) {
            let a = e[i];
            return a.thisArg ? a.func.apply(a.thisArg, ...n) : a.func(...n), t
        }, t.remove = function (t) {
            delete e[t]
        }
    }(n || (n = {})), e.default = n
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    let n = 0;
    e.default = function (t) {
        return t ? t.concat(".").concat(String(++n)) : String(++n)
    }
}, function (t, e, i) {
    "use strict";
    const n = i(33), a = i(160), s = i(83), o = i(161), r = i(32), l = i(84), u = n.ipcMain,
        c = process.electronBinding("v8_util");
    let d = c.createDoubleIDWeakMap();
    const h = new a.default;

    function f(t, e, i, n, a, s) {
        let o, l = !1, u = null, c = !1;
        do {
            try {
                o = e[n]
            } catch (t) {
                l = !0
            }
            if (l) try {
                o = i.value[n], l = !1, i.meta.extendedMemberNames.push(n), c = !0
            } catch (t) {
                r.error(`property ${n} untouchable, even try root[name]`)
            }
            if (l) break;
            let a = Object.getOwnPropertyDescriptor(e, n);
            if (void 0 === a) {
                r.warn(`descriptor of property ${n} is undefined`);
                break
            }
            u = {
                name: n,
                enumerable: a.enumerable,
                writable: !1,
                type: "get"
            }, void 0 === a.get && "function" == typeof o ? u.type = "method" : ((a.set || a.writable) && (u.writable = !0), u.type = "get"), c ? (u.configurable = !0, u.value = S(t, o, s, !1, null)) : u.value = S(t, o, s, !1, i)
        } while (0);
        return u
    }

    function p(t, e, i, n = null) {
        let a = Object.getOwnPropertyNames(e);
        "function" == typeof e && (a = a.filter(function (t) {
            return !String.prototype.includes.call(o.propertiesOfFunction, t)
        }));
        let s = [];
        do {
            if (0 === a.length) break;
            let o = a.length;
            for (let r = 0; r < o; r++) {
                let o = f(t, e, i, a[r], 0, n);
                o && s.push(o)
            }
        } while (0);
        return s
    }

    function g(t, e, i, n = null) {
        let a = null, s = Object.getPrototypeOf(e);
        return a = null === s || s === Object.prototype || s === Function.prototype ? null : S(t, s, n, !1, i)
    }

    function S(t, e, i = null, n = !1, a = null) {
        i = null === i ? {} : i;
        const s = {type: typeof e};
        "object" === s.type && (s.type = function (t, e) {
            let i = typeof t;
            if ("object" !== i) throw new Error("incorrect arg at index 0. non-object");
            return null === t ? i = "value" : ArrayBuffer.isView(t) ? i = "buffer" : Array.isArray(t) ? i = "array" : t instanceof Error ? i = "error" : t instanceof Date ? i = "date" : l.isPromise(t) ? i = "promise" : Object.prototype.hasOwnProperty.call(t, "callee") && null != t.length ? i = "array" : e && c.getHiddenValue(t, "simple") && (i = "value"), i
        }(e, n));
        do {
            if ("object" === s.type || "function" === s.type) {
                let n = h.getIdOfObject(e);
                if (n && i[n]) {
                    s.refId = n, h.add(t, e);
                    break
                }
            }
            "array" === s.type ? s.members = e.map(e => S(t, e, i)) : "object" === s.type || "function" === s.type ? (null == a && (s.extendedMemberNames = [], a = {
                value: e,
                meta: s
            }), s.name = e.constructor ? e.constructor.name : "", s.id = h.add(t, e), i[s.id] = !0, s.members = p(t, e, a, i), s.proto = g(t, e, a, i)) : "buffer" === s.type ? s.value = Buffer.from(e) : "promise" === s.type ? (e.then(function () {
            }, function () {
            }), s.then = S(t, function (t, i) {
                e.then(t, i)
            })) : "error" === s.type ? (s.members = y(e), s.members.push({
                name: "name",
                value: e.name
            })) : "date" === s.type ? s.value = e.getTime() : (s.type = "value", s.value = e)
        } while (0);
        return s
    }

    function y(t) {
        return Object.getOwnPropertyNames(t).map(e => ({name: e, value: t[e]}))
    }

    function T(t, e, i, a) {
        const o = function (a) {
            let l, u, f = 0, p = 0;
            switch (a.type) {
                case"value":
                    return a.value;
                case"remote-object":
                    return h.get(a.id);
                case"array":
                    return T(t, e, i, a.value);
                case"buffer":
                    return Buffer.from(a.value);
                case"date":
                    return new Date(a.value);
                case"promise":
                    return Promise.resolve({then: o(a.then)});
                case"object":
                case"interest": {
                    let t = {};
                    for (Object.defineProperty(t.constructor, "name", {value: a.name}), f = 0, p = (u = a.members).length; f < p; f++) t[(l = u[f]).name] = o(l.value);
                    return t
                }
                case"function": {
                    const o = t.id, l = [i, a.id];
                    if (r.info("renderer function id:" + l), d.has(l)) return d.get(l);
                    let u = function (...e) {
                        r.info("[CALLBACK] args", e);
                        let i = [...e];
                        t.isDestroyed() || o !== t.id ? function (t, e, i) {
                            let a = "Attempting to call a function in a renderer window that has been closed or released." + `\nFunction provided here: ${t.location}`;
                            if (e.length > 0 && e[0].sender && e[0].sender instanceof n.webContents.constructor) {
                                const {sender: t} = e[0], n = t.eventNames().filter(e => {
                                    let n = t.listeners(e), a = !1;
                                    return n.forEach(t => {
                                        t === i && (a = !0)
                                    }), a
                                });
                                n.length > 0 && (a += `\nRemote event names: ${n.join(", ")}`, n.forEach(e => {
                                    Object.getPrototypeOf(t).removeListener.call(t, e, i)
                                }))
                            }
                            r.warn(a)
                        }(a, i, u) : t.send(s.default.renderer.callback, a.id, S(t, i))
                    };
                    return Object.defineProperty(u, "length", {value: a.length}), c.setRemoteCallbackFreer(u, e, i, a.id, t), d.set(l, u), u
                }
                default:
                    throw new TypeError(`Unknown type: ${a.type}`)
            }
        };
        return a.map(o)
    }

    function k(t, e, i, n) {
        let a, s;
        try {
            return e.apply(i, n)
        } catch (t) {
            return s = e.name, new Error(`Could not call remote function '${a = null != s ? s : "anonymous"}'. Check that the function signature is correct. Underlying error: ${t.message}`)
        }
    }

    function m(t) {
        return {type: "exception", message: t.message, stack: t.stack || t}
    }

    function v(t) {
        const e = new Error(t);
        throw Object.defineProperty(e, "code", {value: "EBADRPC"}), Object.defineProperty(e, "errno", {value: -72}), e
    }

    var w;
    !function (t) {
        const e = (t, e, ...i) => {
            const n = t.sender;
            n.isDestroyed() ? r.warn("webcontext is destroyed, id=", n.id) : n.send(e, ...i)
        };
        t.startServer = function () {
            u.on(s.default.browser.require, (t, i, n) => {
                r.info(`[REQUIRE] module=${n} `);
                let a = process.mainModule.require(n), o = S(t.sender, a);
                e(t, s.default.renderer.requireReturn, i, o)
            }), u.on(s.default.browser.builtIn, (t, i, a, o) => {
                r.info(`[BUILTIN]: property=${o} contextId=${i}`);
                let l = n[o], u = S(t.sender, l);
                r.info(`[BUILTIN]: returns remoteId:${u.id}, type: ${typeof l}`), e(t, s.default.renderer.getBuiltInReturn, a, u)
            }), u.on(s.default.browser.global, (t, i, n, a) => {
                r.info(`[GLOBAL]: proerty:${a} contextId=${i}`);
                let o, l = global[a];
                o = S(t.sender, l), r.info(`[GLOBAL]: returns remoteid=${o.id}, obj=` + typeof l), e(t, s.default.renderer.getGlobalReturn, n, o)
            }), u.on(s.default.browser.currentWindow, (t, i, n, a) => {
                r.info(`[CURRENT_WINDOW]: property=${a} contextId=${i}`);
                let o = t.sender.getOwnerBrowserWindow.call(t.sender), l = S(t.sender, o);
                r.info(`[CURRENT_WINDOW]: returns remoteid=${l.id}, obj=` + o), e(t, s.default.renderer.currentWindowReturn, n, l)
            }), u.on(s.default.browser.currentWebContents, (t, i, n, a) => {
                e(t, s.default.renderer.currentWebContentsReturn, n, S(t.sender, t.sender))
            }), u.on(s.default.browser.webContents, (t, i, a, o) => {
                r.info(`[WebContents]: proerty:${o} contextId=${i}`);
                let l, u = n.webContents;
                l = S(t.sender, u), r.info(`[WebContents]: returns remoteid=${l.id}, obj=` + typeof u), e(t, s.default.renderer.webContentsReturn, a, l)
            });
            const t = (t, e) => {
                const i = (e, i) => {
                    e && Object.getOwnPropertyNames(e).forEach(n => {
                        i ? t.once(n, e[n]) : t.on(n, e[n])
                    })
                };
                e.on && i(e.on, !1), e.once && i(e.once, !0)
            };
            u.on(s.default.browser.construct, (i, n, a, o, l) => {
                let u, c = null;
                try {
                    r.info(`[CONSTRUCTOR]: remoteId=${o} `);
                    let d = l.length > 0 ? l[l.length - 1] : null;
                    l = T(i.sender, i.frameId, n, l);
                    let f = h.get(o);
                    null == f && v(`Cannot call constructor on missing remote object ${o}`), d && "interest" === d.type && (c = l.pop());
                    let p = new (Function.prototype.bind.apply(f, [null, ...l]));
                    p && c && t(p, c), u = S(i.sender, p, null, !1), r.info(`[CONSTRUCTOR]: returns remoteId =${u.id} name=${f.name} `)
                } catch (t) {
                    u = m(t)
                } finally {
                    e(i, s.default.renderer.constructReturn, a, u)
                }
            }), u.on(s.default.browser.functionCall, function (t, i, n, a, o, l) {
                let u;
                try {
                    r.info(`[FUNCTION_CALL]: remoteId=${o}`), l = T(t.sender, t.frameId, i, l);
                    let c = h.get(o);
                    if (null == c) r.error(`Cannot call function on missing remote object ${o}`), u = S(t.sender, void 0); else {
                        let e = a ? h.get(a) : global;
                        if (e) {
                            let i = k(0, c, e, l);
                            u = S(t.sender, i)
                        } else r.error(`Cannot call function(${o}) on missing context(${a})`), u = S(t.sender, void 0)
                    }
                    r.info(`[FUNCTION_CALL]: name=${c.name}`)
                } catch (t) {
                    u = m(t)
                } finally {
                    e(t, s.default.renderer.functionCallReturn, n, u)
                }
            }), u.on(s.default.browser.memberCall, function (t, i, n, a, o, l, u) {
                let c;
                r.info(`[MEMBER_CALL]: thisArg=${a}, remoteId=${o}, method=${l}, args count=${u.length}`);
                try {
                    u = T(t.sender, t.frameId, i, u);
                    let d = h.get(o);
                    null == d && v(`Cannot call function '${l}' on missing remote object ${o}`);
                    let f = a ? h.get(a) : d;
                    if (f) {
                        let e = k(0, d[l], f, u);
                        c = S(t.sender, e), r.info("[MEMBER_CALL]: return=" + e)
                    } else c = S(t.sender, void 0)
                } catch (t) {
                    c = m(t)
                } finally {
                    e(t, s.default.renderer.memberCallReturn, n, c)
                }
            }), u.on(s.default.browser.memberGet, function (t, i, n, a, o) {
                let l;
                try {
                    r.info(`[MEMBER_GET]: remoteId=${a}, property=`, o);
                    let i = h.get(a);
                    null == i && v(`Cannot get property '${Object.toString.call(o)}' on missing remote object ${a}`);
                    let u = i[o];
                    l = S(t.sender, u)
                } catch (t) {
                    l = m(t)
                } finally {
                    e(t, s.default.renderer.memberGetReturn, n, l)
                }
            }), u.on(s.default.browser.memberSet, function (t, i, n, a, o, l) {
                try {
                    r.info(`[MEMBER_SET]: remoteId=${a}, property=` + o), l = T(t.sender, t.frameId, i, l);
                    let u = h.get(a);
                    null == u && v(`Cannot set property '${Object.toString.call(o)}' on missing remote object ${a}`), u[o] = l[0], e(t, s.default.renderer.memberSetReturn, n, {
                        type: "value",
                        value: !0
                    })
                } catch (i) {
                    e(t, s.default.renderer.memberSetReturn, n, m(i))
                }
            }), u.on(s.default.browser.memberConstruct, function (i, n, a, o, l, u) {
                let c, d = null;
                try {
                    r.info(`[MEMBER_CONSTRUCTOR]: regId=${o}, method=${l}`);
                    let f = u.length > 0 ? u[u.length - 1] : null;
                    u = T(i.sender, i.frameId, n, u);
                    let p = h.get(o);
                    null == p && v(`Cannot call constructor '${l}' on missing remote object ${o}`), f && "interest" === f.type && (d = u.pop());
                    let g = p[l], y = new (Function.prototype.bind.apply(g, [null, ...u]));
                    y && d && t(y, d), c = S(i.sender, y)
                } catch (t) {
                    c = m(t)
                } finally {
                    e(i, s.default.renderer.memberConstructReturn, a, c)
                }
            }), u.on(s.default.browser.sync, function (t, i, n, a) {
                let o = h.get(a);
                e(t, s.default.renderer.syncReturn, n, S(t.sender, o))
            }), u.on("ELECTRON_BROWSER_DEREFERENCE", function (t, e) {
                let i = h.get(e);
                if (n.ipcMain.emit("log_to_renderer", "ELECTRON_BROWSER_DEREFERENCE", e, typeof i), i) {
                    let n = i.name;
                    n || (n = i.constructor ? i.constructor.name : ""), h.remove(t.sender.id, e)
                } else e < 0 && r.warn("remote id reference to nothing:", e)
            }), u.on(s.default.browser.contextRelease, t => {
                h.clear(t.sender.id)
            })
        }, t.getObjectRegistry = function () {
            return h
        }
    }(w || (w = {})), t.exports = w
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(32), a = -1 * Math.pow(2, 31), s = process.electronBinding("v8_util");
    e.default = class {
        constructor() {
            this.nextId = 0, this.storage = new Map, this.owners = new Map
        }

        add(t, e) {
            const i = this.saveToStorage(e), n = t.id;
            let a = this.owners.get(n);
            return a || (a = new Set, this.owners.set(n, a), this.registerDeleteListener(t, n)), a.has(i) || (a.add(i), this.storage.get(i).count++), i
        }

        getIdOfObject(t) {
            return s.getHiddenValue(t, "__remote_id__")
        }

        get(t) {
            const e = this.storage.get(t);
            if (void 0 !== e) return e.object
        }

        remove(t, e) {
            this.dereference(e);
            let i = this.owners.get(t);
            i && i.delete(e)
        }

        clear(t) {
            let e = this.owners.get(t);
            if (e) {
                for (let t of e) this.dereference(t);
                this.owners.delete(t)
            }
        }

        getStorageSize() {
            return this.storage.size
        }

        saveToStorage(t) {
            let e = s.getHiddenValue(t, "__remote_id__");
            if (!e) {
                if ((e = --this.nextId) <= a) throw new Error("object registry id overflow");
                this.storage.set(e, {object: t, count: 0}), s.setHiddenValue(t, "__remote_id__", e)
            }
            return e
        }

        dereference(t) {
            let e = this.storage.get(t);
            null != e && (e.count -= 1, 0 === e.count && (s.deleteHiddenValue(e.object, "__remote_id__"), this.storage.delete(t)))
        }

        registerDeleteListener(t, e) {
            const i = t.getProcessId(), a = (s, o) => {
                o === i && (n.info("render-view-deleted: processid=" + i), (() => {
                    n.info("before clear. objectsRegistry capacity=" + this.storage.size, "owners size:" + this.owners.size)
                })(), t.removeListener("render-view-deleted", a), this.clear(e))
            };
            t.on("render-view-deleted", a)
        }
    }
}, function (t, e, i) {
    "use strict";
    var n;
    !function (t) {
        t.propertiesOfFunction = ["length", "name", "arguments", "caller", "prototype", "apply", "bind", "call", "toString"]
    }(n || (n = {})), t.exports = n
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(1), o = i(85);
    !function (t) {
        let e;
        !function (t) {
            let e;
            !function (t) {
                class e {
                    constructor(t, e, i) {
                        this.debug = !1, this.apiName = t, this.descript = e, this.method = i || "post", this.careUserId = !0, this.logger = o.TaskLogHelp.getLogger(o.TaskLogHelpName.Baotuan, null)
                    }

                    create() {
                        return n(this, void 0, void 0, function* () {
                            let t = {};
                            if (void 0 !== this.userId && null !== this.userId && (t.user_id = this.userId), void 0 !== this.url && null !== this.url && (t.url = this.url), void 0 !== this.btFlag && null !== this.btFlag && (t.bt_flag = this.btFlag), void 0 !== this.gcidOrInfohash && null !== this.gcidOrInfohash && (t.gcid_or_infohash = this.gcidOrInfohash), void 0 !== this.peerId && null !== this.peerId && (t.peer_id = this.peerId), void 0 !== this.extrusionFlag && null !== this.extrusionFlag && (t.extrusion_flag = this.extrusionFlag), this.scene && (t.scene = this.scene), this.cost && (t.cost = this.cost), void 0 !== this.consume_times_flag && null !== this.consume_times_flag && (t.consume_times_flag = this.consume_times_flag), this.debug) {
                                return Buffer.from(JSON.stringify(t))
                            }
                            let e = a.HttpJsonCryptoNS.getKey(this.userId.toString(), s.default.currentTime);
                            return a.HttpJsonCryptoNS.encryptHttpBuffer(t, e)
                        })
                    }

                    getObject(t, e, i) {
                        try {
                            if (this.debug) return JSON.parse(i.toString())
                        } catch (t) {
                            return this.logger.info(t), null
                        }
                        let n = a.HttpJsonCryptoNS.getKey(t, e);
                        return a.HttpJsonCryptoNS.decryptHttpBuffer(i, n)
                    }

                    getApiName() {
                        return this.apiName
                    }

                    getDescript() {
                        return this.descript
                    }

                    getMethod() {
                        return this.method
                    }
                }

                t.Base = e;
                t.NoviceJoin = class extends e {
                    constructor() {
                        super("team_speed/novice_join", "新手抱团")
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {result: n.result, message: n.message, teamNumber: n.team_number, key: n.key};
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.Join = class extends e {
                    constructor() {
                        super("team_speed/join", "抱团")
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            teamTimes: n.team_number,
                            teamLeftTimes: n.team_left_times,
                            teamNumber: n.team_number,
                            taskDownloadProgress: n.task_download_progress,
                            teamDownloadProgress: n.team_download_progress,
                            key: n.key
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.CutLine = class extends e {
                    constructor() {
                        super("team_speed/cutline", "插队")
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            teamTimes: n.team_number,
                            teamLeftTimes: n.team_left_times,
                            teamNumber: n.team_number,
                            taskDownloadProgress: n.task_download_progress,
                            teamDownloadProgress: n.team_download_progress,
                            key: n.key
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.Number = class extends e {
                    constructor() {
                        super("team_speed/number", "抱团人数")
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            teamNumber: n.team_number,
                            teamUsedTimes: n.team_used_times,
                            teamLeftTimes: n.team_left_times,
                            isBlocked: n.is_blocked,
                            isSec: n.is_sec,
                            isOldUser: n.is_old_user
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.CutlineLeft = class extends e {
                    constructor() {
                        super("team_speed/number", "剩余插队次数"), this.btFlag = 0, this.gcidOrInfohash = "", this.url = ""
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            cutlineLeftTimes: n.team_left_times,
                            is_old_user: n.is_old_user
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.Entrance = class extends e {
                    constructor() {
                        super("team_speed/team_entrance", "抱团入口"), this.careUserId = !1
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            showSeamEntranceTimes: n.show_team_entrance_times,
                            showPcSqueezeOutTeamTips: n.show_pc_squeeze_out_team_tips,
                            supportNotLogin: n.support_not_login,
                            teamEntranceBelowTask: n.team_entrance_below_task,
                            taskEntranceSwitch: n.task_entrance_switch,
                            quitNotifySwitch: n.quit_notify_switch,
                            tagPriorityInner: n.tag_priority_inner,
                            tagPriorityOut: n.tag_priority_out,
                            firstTeamEffect: n.first_team_effect,
                            tag_style: n.tag_style,
                            newer_window: n.newer_window,
                            newer_window_default: n.newer_window_default,
                            failed_auto_join: n.failed_auto_join,
                            auto_after_join: n.auto_after_join,
                            vip_action: n.vip_action,
                            first_team_effect_tag: n.first_team_effect_tag
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.Config = class extends e {
                    constructor() {
                        super("team_speed/copywriting_config", "抱团配置", "post"), this.careUserId = !1
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return this.logger.info(this.descript, this.apiName, "getObject failed"), null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            chaoji_times: n.chaoji_times,
                            baijin_times: n.baijin_times,
                            putong_times: n.putong_times,
                            year_times: n.year_times
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.Quit = class extends e {
                    constructor(t) {
                        super("team_speed/quit", "退出抱团"), t && (this.logger = t)
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {result: n.result};
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.PackageTimes = class extends e {
                    constructor(t) {
                        super("package_times", "打包试用次数", "post"), this.scene = "download", this.careUserId = !1, t && (this.logger = t)
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            all_used: n.all_used,
                            used: n.used,
                            left: n.left,
                            try_length: n.try_length,
                            pack_type: n.pack_type,
                            use_attribute: n.use_attribute,
                            ad_pack: n.ad_pack
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                };
                t.SetPackageTimes = class extends e {
                    constructor(t) {
                        super("set_package_times", "消耗打包试用次数", "post"), this.scene = "download", this.cost = 1, this.careUserId = !1, t && (this.logger = t)
                    }

                    parse(t, e, i) {
                        let n = this.getObject(t, e, i);
                        if (!n) return null;
                        let a = {
                            result: n.result,
                            message: n.message,
                            used: n.used,
                            left: n.left,
                            try_length: n.try_length
                        };
                        return this.logger.info(this.descript, this.apiName, "response", a), a
                    }
                }
            }(e = t.Request || (t.Request = {}))
        }(e = t.BaoTuan || (t.BaoTuan = {}))
    }(e.VipNetWorkData || (e.VipNetWorkData = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(15), o = i(192), r = i(3), l = i(42), u = i(1),
        c = i(0).default.getLogger("VipDownload:try-operation");

    class d extends s.HttpSession {
        query(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++d.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = u.default.currentMillisecond, l = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                return this.host = "try.speed.cdn.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/speed_trial/query?" + l, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.random = s, this.body = yield o.TryTaskHttpPackageNS.createQueryBuffer(t), new Promise(e => {
                    this.post(n => {
                        let a = null;
                        if (r.default.userId === t.userId) {
                            let e = n.headers["random-num"];
                            if (c.info("random", e), 200 === n.statusCode && n.body && e) {
                                let s = Number(e).valueOf();
                                a = o.TryTaskHttpPackageNS.praseQueryBuffer(i, t.taskId, s, n.body)
                            }
                        }
                        e(a)
                    }, t => {
                        c.info("error", t), e(null)
                    })
                })
            })
        }

        commit(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++d.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = u.default.currentMillisecond, h = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                return this.host = "try.speed.cdn.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/speed_trial/commit?" + h, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.random = s, this.body = yield o.TryTaskHttpPackageNS.createCommitBuffer(t), new Promise(e => {
                    this.post(n => {
                        let a = null;
                        if (r.default.userId === t.userId && n) {
                            let t = n.headers["random-num"];
                            if (c.info("random", t), 200 === n.statusCode) if (n.body && t) {
                                let e = Number(t).valueOf();
                                (a = o.TryTaskHttpPackageNS.praseCommitBuffer(i, e, n.body)) || (a = this.createCommitResponse(l.HttpErrorNS.errorPrase))
                            } else a = this.createCommitResponse(l.HttpErrorNS.errorData); else a = this.createCommitResponse(l.HttpErrorNS.errorStatusCode);
                            a.statusCode = n.statusCode, e(a)
                        }
                    }, t => {
                        c.info("error", t);
                        let i = this.createCommitResponse(l.HttpErrorNS.errorConnect);
                        e(i)
                    })
                })
            })
        }

        createCommitResponse(t) {
            return {result: t, message: l.HttpErrorNS.getMessage(t)}
        }
    }

    d.sequence = 0, e.TryTaskHttpSession = d
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(233), a = i(14), s = i(5), {isDef: o} = s.ThunderUtil,
        r = i(0).default.getLogger("VipDownload:ad-operation.task-cache-manager");

    class l {
        constructor() {
            this.mTryTaskId = void 0, this.mTrySubId = void 0, this.mLeftCount = 100, this.mTasks = new Map, this.mSceneData = null
        }

        get taskId() {
            return this.mTryTaskId
        }

        get subId() {
            return this.mTrySubId
        }

        get chances() {
            return this.mLeftCount
        }

        set chances(t) {
            this.mLeftCount !== t && (this.mLeftCount = t, a.default.emit(a.TaskEventNS.adTotalChancesChanged, this.taskId, t))
        }

        set sceneData(t) {
            this.mSceneData = {
                result: -1,
                message: "",
                buttonText: "免费加速",
                readySceneText: "看广告，即可领300M加速流量",
                readyNoChanceText: "有没用完的流量，可继续使用",
                acclerateSceneText: "加速剩余%s，可继续领",
                afterSceneText: "加速流量已用完，可继续领",
                rewardTipsText: "任务完成获得加速流量300M"
            }, t && 0 === t.result && (this.mSceneData = t)
        }

        get sceneData() {
            return this.mSceneData
        }

        setTaskId(t, e) {
            this.mTryTaskId = t, this.mTrySubId = e
        }

        removeTaskId(t) {
            this.mTryTaskId === t && (this.mTryTaskId = void 0, this.mTrySubId = void 0)
        }

        setCommitData(t, e) {
            let i = this.getTask(t);
            0 !== e.result ? i.error = e : (this.chances = e.leftCount, i.error = null, i.gcidLeftCount = e.gcidLeftCount, i.maxProgress = e.maxProgress, i.maxSize = e.maxSize, r.info(t, "leftCount", e.leftCount, "gcidLeftCount", e.gcidLeftCount))
        }

        setQueryData(t, e, i) {
            let n = this.getTask(t, !0);
            0 === e.result && (this.chances = e.leftCount, o(i) && (n.subId = i), n.gcidLeftCount = e.gcidLeftCount, n.gcidUseLeftCount = e.gcidUseLeftCount, n.maxProgress = e.maxProgress, n.maxSize = e.maxSize, r.info(t, "leftCount", e.leftCount, "gcidLeftCount", e.gcidLeftCount, "gcidUseLeftCount", e.gcidUseLeftCount))
        }

        createTask(t) {
            let e = new n.TaskCache;
            return e.gcidLeftCount = 1, this.mTasks.set(t, e), e
        }

        getTask(t, e) {
            let i = this.mTasks.get(t);
            return e && !i && (i = this.createTask(t)), i
        }

        removeTask(t, e) {
            this.mTasks.delete(t)
        }
    }

    e.AdCacheManager = l, e.default = new l
}, function (t, e) {
    (function () {
        e.defaults = {
            .1: {
                explicitCharkey: !1,
                trim: !0,
                normalize: !0,
                normalizeTags: !1,
                attrkey: "@",
                charkey: "#",
                explicitArray: !1,
                ignoreAttrs: !1,
                mergeAttrs: !1,
                explicitRoot: !1,
                validator: null,
                xmlns: !1,
                explicitChildren: !1,
                childkey: "@@",
                charsAsChildren: !1,
                includeWhiteChars: !1,
                async: !1,
                strict: !0,
                attrNameProcessors: null,
                attrValueProcessors: null,
                tagNameProcessors: null,
                valueProcessors: null,
                emptyTag: ""
            },
            .2: {
                explicitCharkey: !1,
                trim: !1,
                normalize: !1,
                normalizeTags: !1,
                attrkey: "$",
                charkey: "_",
                explicitArray: !0,
                ignoreAttrs: !1,
                mergeAttrs: !1,
                explicitRoot: !0,
                validator: null,
                xmlns: !1,
                explicitChildren: !1,
                preserveChildrenOrder: !1,
                childkey: "$$",
                charsAsChildren: !1,
                includeWhiteChars: !1,
                async: !1,
                strict: !0,
                attrNameProcessors: null,
                attrValueProcessors: null,
                tagNameProcessors: null,
                valueProcessors: null,
                rootName: "root",
                xmldec: {version: "1.0", encoding: "UTF-8", standalone: !0},
                doctype: null,
                renderOpts: {pretty: !0, indent: "  ", newline: "\n"},
                headless: !1,
                chunkSize: 1e4,
                emptyTag: "",
                cdata: !1
            }
        }
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r, l, u, c, d, h, f, p, g = {}.hasOwnProperty;
        l = i(98), u = i(99), e = i(96), n = i(97), c = i(95), h = i(104), f = i(105), d = i(106), a = i(100), s = i(102), o = i(101), r = i(103), p = i(201), t.exports = function (t) {
            function i(t) {
                i.__super__.constructor.call(this, t)
            }

            return function (t, e) {
                for (var i in e) g.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, p), i.prototype.document = function (t) {
                var e, i, a, s, o;
                for (this.textispresent = !1, s = "", i = 0, a = (o = t.children).length; i < a; i++) e = o[i], s += function () {
                    switch (!1) {
                        case!(e instanceof l):
                            return this.declaration(e);
                        case!(e instanceof u):
                            return this.docType(e);
                        case!(e instanceof n):
                            return this.comment(e);
                        case!(e instanceof d):
                            return this.processingInstruction(e);
                        default:
                            return this.element(e, 0)
                    }
                }.call(this);
                return this.pretty && s.slice(-this.newline.length) === this.newline && (s = s.slice(0, -this.newline.length)), s
            }, i.prototype.attribute = function (t) {
                return " " + t.name + '="' + t.value + '"'
            }, i.prototype.cdata = function (t, e) {
                return this.space(e) + "<![CDATA[" + t.text + "]]>" + this.newline
            }, i.prototype.comment = function (t, e) {
                return this.space(e) + "\x3c!-- " + t.text + " --\x3e" + this.newline
            }, i.prototype.declaration = function (t, e) {
                var i;
                return i = this.space(e), i += '<?xml version="' + t.version + '"', null != t.encoding && (i += ' encoding="' + t.encoding + '"'), null != t.standalone && (i += ' standalone="' + t.standalone + '"'), i += this.spacebeforeslash + "?>", i += this.newline
            }, i.prototype.docType = function (t, i) {
                var l, u, c, h, f;
                if (i || (i = 0), h = this.space(i), h += "<!DOCTYPE " + t.root().name, t.pubID && t.sysID ? h += ' PUBLIC "' + t.pubID + '" "' + t.sysID + '"' : t.sysID && (h += ' SYSTEM "' + t.sysID + '"'), t.children.length > 0) {
                    for (h += " [", h += this.newline, u = 0, c = (f = t.children).length; u < c; u++) l = f[u], h += function () {
                        switch (!1) {
                            case!(l instanceof a):
                                return this.dtdAttList(l, i + 1);
                            case!(l instanceof s):
                                return this.dtdElement(l, i + 1);
                            case!(l instanceof o):
                                return this.dtdEntity(l, i + 1);
                            case!(l instanceof r):
                                return this.dtdNotation(l, i + 1);
                            case!(l instanceof e):
                                return this.cdata(l, i + 1);
                            case!(l instanceof n):
                                return this.comment(l, i + 1);
                            case!(l instanceof d):
                                return this.processingInstruction(l, i + 1);
                            default:
                                throw new Error("Unknown DTD node type: " + l.constructor.name)
                        }
                    }.call(this);
                    h += "]"
                }
                return h += this.spacebeforeslash + ">", h += this.newline
            }, i.prototype.element = function (t, i) {
                var a, s, o, r, l, u, p, S, y, T, k, m, v;
                for (p in i || (i = 0), v = !1, this.textispresent ? (this.newline = "", this.pretty = !1) : (this.newline = this.newlinedefault, this.pretty = this.prettydefault), S = "", S += (m = this.space(i)) + "<" + t.name, y = t.attributes) g.call(y, p) && (a = y[p], S += this.attribute(a));
                if (0 === t.children.length || t.children.every(function (t) {
                    return "" === t.value
                })) this.allowEmpty ? S += "></" + t.name + ">" + this.newline : S += this.spacebeforeslash + "/>" + this.newline; else if (this.pretty && 1 === t.children.length && null != t.children[0].value) S += ">", S += t.children[0].value, S += "</" + t.name + ">" + this.newline; else {
                    if (this.dontprettytextnodes) for (o = 0, l = (T = t.children).length; o < l; o++) if (null != (s = T[o]).value) {
                        this.textispresent++, v = !0;
                        break
                    }
                    for (this.textispresent && (this.newline = "", this.pretty = !1, m = this.space(i)), S += ">" + this.newline, r = 0, u = (k = t.children).length; r < u; r++) s = k[r], S += function () {
                        switch (!1) {
                            case!(s instanceof e):
                                return this.cdata(s, i + 1);
                            case!(s instanceof n):
                                return this.comment(s, i + 1);
                            case!(s instanceof c):
                                return this.element(s, i + 1);
                            case!(s instanceof h):
                                return this.raw(s, i + 1);
                            case!(s instanceof f):
                                return this.text(s, i + 1);
                            case!(s instanceof d):
                                return this.processingInstruction(s, i + 1);
                            default:
                                throw new Error("Unknown XML node type: " + s.constructor.name)
                        }
                    }.call(this);
                    v && this.textispresent--, this.textispresent || (this.newline = this.newlinedefault, this.pretty = this.prettydefault), S += m + "</" + t.name + ">" + this.newline
                }
                return S
            }, i.prototype.processingInstruction = function (t, e) {
                var i;
                return i = this.space(e) + "<?" + t.target, t.value && (i += " " + t.value), i += this.spacebeforeslash + "?>" + this.newline
            }, i.prototype.raw = function (t, e) {
                return this.space(e) + t.value + this.newline
            }, i.prototype.text = function (t, e) {
                return this.space(e) + t.value + this.newline
            }, i.prototype.dtdAttList = function (t, e) {
                var i;
                return i = this.space(e) + "<!ATTLIST " + t.elementName + " " + t.attributeName + " " + t.attributeType, "#DEFAULT" !== t.defaultValueType && (i += " " + t.defaultValueType), t.defaultValue && (i += ' "' + t.defaultValue + '"'), i += this.spacebeforeslash + ">" + this.newline
            }, i.prototype.dtdElement = function (t, e) {
                return this.space(e) + "<!ELEMENT " + t.name + " " + t.value + this.spacebeforeslash + ">" + this.newline
            }, i.prototype.dtdEntity = function (t, e) {
                var i;
                return i = this.space(e) + "<!ENTITY", t.pe && (i += " %"), i += " " + t.name, t.value ? i += ' "' + t.value + '"' : (t.pubID && t.sysID ? i += ' PUBLIC "' + t.pubID + '" "' + t.sysID + '"' : t.sysID && (i += ' SYSTEM "' + t.sysID + '"'), t.nData && (i += " NDATA " + t.nData)), i += this.spacebeforeslash + ">" + this.newline
            }, i.prototype.dtdNotation = function (t, e) {
                var i;
                return i = this.space(e) + "<!NOTATION " + t.name, t.pubID && t.sysID ? i += ' PUBLIC "' + t.pubID + '" "' + t.sysID + '"' : t.pubID ? i += ' PUBLIC "' + t.pubID + '"' : t.sysID && (i += ' SYSTEM "' + t.sysID + '"'), i += this.spacebeforeslash + ">" + this.newline
            }, i.prototype.openNode = function (t, e) {
                var i, n, a, s;
                if (e || (e = 0), t instanceof c) {
                    for (n in a = this.space(e) + "<" + t.name, s = t.attributes) g.call(s, n) && (i = s[n], a += this.attribute(i));
                    return a += (t.children ? ">" : "/>") + this.newline
                }
                return a = this.space(e) + "<!DOCTYPE " + t.rootNodeName, t.pubID && t.sysID ? a += ' PUBLIC "' + t.pubID + '" "' + t.sysID + '"' : t.sysID && (a += ' SYSTEM "' + t.sysID + '"'), a += (t.children ? " [" : ">") + this.newline
            }, i.prototype.closeNode = function (t, e) {
                switch (e || (e = 0), !1) {
                    case!(t instanceof c):
                        return this.space(e) + "</" + t.name + ">" + this.newline;
                    case!(t instanceof u):
                        return this.space(e) + "]>" + this.newline
                }
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return t.isCloud ? i("ItemCloudStatus", {
            attrs: {
                taskId: t.taskId,
                taskInfo: t.taskInfo,
                isVip: t.isVip,
                isLogin: t.isLogin,
                vasType: t.vasType
            }, nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        }) : t.isGame ? i("ItemGameStatus", {
            attrs: {
                taskId: t.taskId,
                taskInfo: t.taskInfo,
                isVip: t.isVip,
                isLogin: t.isLogin,
                vasType: t.vasType
            }, nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        }) : t.isPackageTry ? i("ItemPackageTryStatus", {
            attrs: {
                taskId: t.taskId,
                taskUIStatus: t.taskUIStatus,
                isVip: t.isVip,
                taskInfo: t.taskInfo
            }, nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        }) : t.isBaotuan ? i("ItemBaotuanStatus", {
            attrs: {
                taskId: t.taskId,
                taskUIStatus: t.taskUIStatus,
                taskInfo: t.taskInfo,
                isShowChangWei: t.isShowChangWei
            }, nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        }) : t.isTry ? i("ItemTryStatus", {
            attrs: {
                taskId: t.taskId,
                taskUIStatus: t.taskUIStatus,
                isVip: t.isVip,
                taskInfo: t.taskInfo
            }, nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        }) : t.isAd ? i("ItemAdStatus", {
            attrs: {taskId: t.taskId, taskUIStatus: t.taskUIStatus, taskInfo: t.taskInfo},
            nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        }) : i("ItemVipStatus", {
            attrs: {
                taskId: t.taskId,
                taskUIStatus: t.taskUIStatus,
                isVip: t.isVip,
                authority: t.authority,
                taskInfo: t.taskInfo,
                btErrorType: t.btErrorType
            }, nativeOn: {
                dragstart: function (t) {
                    t.preventDefault()
                }
            }
        })
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, , , function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", {staticClass: "xly-plugin-vip"}, [i("div", [t.isErrorScene ? i("p", {
            staticClass: "xly-plugin-vip__text is-error",
            on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickErrorScenceText(e)
                }
            }
        }, [t._v(t._s(t.errorSceneText))]) : t.isDefaultScene ? i("p", {staticClass: "xly-plugin-vip__link"}, [t._v(t._s(t.defaultSceneText))]) : i("a", {
            staticClass: "xly-plugin-vip__link",
            attrs: {href: " javascript:; "},
            on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickScenceText(e)
                }
            }
        }, [t._v(t._s(t.sceneText))])]), t._v(" "), i("div", [1 === t.vipBtnType ? i("button", {
            staticClass: "td-button td-button--small",
            on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickSuperVipButton(e)
                }
            }
        }, [t._v(t._s(t.superBtnText))]) : 0 === t.vipBtnType ? i("button", {
            staticClass: "td-button td-button--small",
            on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickVipButton(e)
                }
            }
        }, [t._v(t._s(t.vipBtnText))]) : i("p", {
            class: {
                "xly-plugin-vip__status": !t.isSuper,
                "xly-plugin-vip__status is-super": t.isSuper,
                "is-error": t.showFailed,
                "is-warn": t.showWarn
            }
        }, [t.showWarn ? i("i") : t._e(), t._v(" "), i("i", {
            directives: [{
                name: "show",
                rawName: "v-show",
                value: t.showSurperIcon && !t.isShowSurperJoin,
                expression: "showSurperIcon && !isShowSurperJoin"
            }], staticClass: "xly-icon-accelerate"
        }), t._v(" "), i("i", {
            directives: [{
                name: "show",
                rawName: "v-show",
                value: t.showSurperIcon && t.isShowSurperJoin,
                expression: "showSurperIcon && isShowSurperJoin"
            }], staticClass: "xly-icon-connect"
        }), t._v("\n      " + t._s(t.taskStatusText) + "\n    ")])])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", [i("div", {staticClass: "xly-plugin-vip"}, [t.isError ? t._e() : i("p", {staticClass: "xly-plugin-vip__text"}, [t._v(t._s(t.taskStatusText))]), t._v(" "), t.isError ? t._e() : i("button", {
            staticClass: "td-button is-vip td-button--small",
            class: {"is-vip": !t.isSuper, "is-super": t.isSuper},
            on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickVipButton(e)
                }
            }
        }, [t._v("\n      " + t._s(t.buttonText) + "\n    ")]), t._v(" "), t.isError ? i("p", {staticClass: "xly-plugin-vip__status is-error"}, [t._v(t._s(t.taskStatusText))]) : t._e()])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", {
            staticClass: "xlx-plugin-vip2 xlx-plugin-vip--ordinary2 is-advert2",
            class: {"is-trying": t.showTrying}
        }, [i("div", {
            directives: [{name: "show", rawName: "v-show", value: t.showTrying, expression: "showTrying"}],
            staticClass: "td-progress-bar"
        }, [i("div", {staticClass: "td-progress-bar__outer"}, [i("div", {
            staticClass: "td-progress-bar__inner",
            style: {width: t.progressPercent}
        })])]), t._v(" "), i("div", {staticClass: "xlx-plugin-vip__inner"}, [i("p", {
            staticClass: "xlx-plugin-vip__text",
            class: {"is-error": t.isError}
        }, [t._v(t._s(t.taskStatusText))]), t._v(" "), i("a", {
            directives: [{
                name: "show",
                rawName: "v-show",
                value: t.showButton,
                expression: "showButton"
            }], staticClass: "xlx-plugin-vip__button", attrs: {href: "javascript:;"}, on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickVipButton(e)
                }
            }
        }, [i("i", {staticClass: "xlx-plugin-vip__logo-gift"}), t._v(" "), i("span", {staticClass: "xlx-plugin-vip__button-text"}, [t._v(t._s(t.buttonText))])])])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", {
            staticClass: "xlx-plugin-vip2 xlx-plugin-vip--ordinary2 is-advert2",
            class: {"is-trying": t.showTrying}
        }, [i("div", {staticClass: "xlx-plugin-vip__inner"}, [i("p", {staticClass: "xlx-plugin-vip__text"}, [t._v(t._s(t.taskStatusText))]), t._v(" "), i("a", {
            staticClass: "xlx-plugin-vip__button",
            attrs: {href: "javascript:;"},
            on: {
                mousedown: function (t) {
                    t.stopPropagation()
                }, click: function (e) {
                    return e.stopPropagation(), t.clickGameButton(e)
                }
            }
        }, [i("i", {staticClass: "xlx-plugin-vip__logo-gift"}), t._v(" "), i("span", {staticClass: "xlx-plugin-vip__button-text"}, [t._v(t._s(t.buttonText))])])])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", {staticClass: "box"}, [i("div", {staticClass: "xly-plugin-vip"}, [i("p", {staticClass: "xly-plugin-vip__text"}, [t._v(t._s(t.statusText))]), t._v(" "), i("button", {
            staticClass: "td-button td-button--small",
            class: {"is-vip": !t.isUpdateSVip, "is-super": t.isUpdateSVip},
            on: {click: t.clickBaotuanBtn}
        }, [t._v("\n      " + t._s(t.buttonText) + "\n    ")])])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", {staticClass: "xly-plugin-vip"}, [i("p", {staticClass: "xly-plugin-vip__text"}, [t._v(t._s(t.packageText))]), t._v(" "), i("button", {
            directives: [{
                name: "show",
                rawName: "v-show",
                value: t.isPackageReady,
                expression: "isPackageReady"
            }], staticClass: "td-button is-vip td-button--small", on: {click: t.clickPackageTry}
        }, [t._v("\n    " + t._s(t.btnTextReady) + "\n  ")]), t._v(" "), i("button", {
            directives: [{
                name: "show",
                rawName: "v-show",
                value: !t.isPackageReady,
                expression: "!isPackageReady"
            }],
            staticClass: "td-button td-button--small",
            class: {"is-vip": !t.taskInfo.surperPackage, "is-super": t.taskInfo.surperPackage},
            on: {click: t.clickOpenVip}
        }, [t._v("\n    " + t._s(t.btnText) + "\n  ")])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, function (t, e, i) {
    "use strict";
    var n = function () {
        var t = this, e = t.$createElement, i = t._self._c || e;
        return i("div", {staticClass: "xly-plugin-vip"}, [i("p", {staticClass: "xly-plugin-vip__text"}, [t._v(t._s(t.cloudText))]), t._v(" "), i("button", {
            staticClass: "td-button td-button--small",
            class: {"is-vip": !t.isVip, "is-super": t.isVip},
            on: {click: t.clickOpenVip}
        }, [t._v("\n    " + t._s(t.cloudBtnText) + "\n  ")])])
    }, a = [];
    n._withStripped = !0, i.d(e, "a", function () {
        return n
    }), i.d(e, "b", function () {
        return a
    })
}, , , , , , , , , , function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(16), s = i(1), o = i(2), r = i(0).default.getLogger("VipDownload:task-scene"), l = i(3);

    function u() {
        let t = 0;
        return l.default.isSuperVip ? t = 5 : l.default.isPlatinumVip ? t = 3 : l.default.isVip && (t = 2), t
    }

    !function (t) {
        let e = new Map, i = new Map;
        t.scenceShow = function (t, i) {
            return n(this, void 0, void 0, function* () {
                let n = `${t},${i.id}`;
                if (e.get(n)) return;
                if (e.set(n, !0), !(yield o.client.callServerFunction("IsMainWndVisible"))) return;
                r.info("scenceShow");
                let c = new Map, d = l.default.vipLevel, h = u();
                c.set("vip_type", h), c.set("viplevel", d), c.set("groupid", t), c.set("type", "Normal"), c.set("id", i.id), c.set("version", s.default.pluginVersion), i.config ? c.set("config", i.config) : i.isBDefault ? c.set("config", "tagsys_default") : c.set("config", "former_default");
                let f = i.aidfrom || "0";
                c.set("aidfrom", f);
                let p = {attribute1: "sceneshow", extData: c};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", p).catch()
            })
        }, t.scenceClick = function (t, e) {
            let n = `${t},${e.id}`;
            if (i.get(n)) return;
            i.set(n, !0), r.info("scenceClick");
            let o = new Map, c = l.default.vipLevel, d = u();
            o.set("vip_type", d), o.set("viplevel", c), o.set("groupid", t), o.set("type", "Normal"), o.set("id", e.id), o.set("version", s.default.pluginVersion), e.config ? o.set("config", e.config) : e.isBDefault ? o.set("config", "tagsys_default") : o.set("config", "former_default");
            let h = e.aidfrom || "0";
            o.set("aidfrom", h);
            let f = {attribute1: "sceneclick", extData: o};
            a.StatUtilitiesNS.trackEvent("xlx_vip_event", f).catch()
        }
    }(e.SceneStatNS || (e.SceneStatNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(53), o = i(14), r = i(10), l = i(2), u = i(5), {deepCopy: c, isUndef: d} = u.ThunderUtil,
        h = i(0), f = i(212), p = i(219), g = i(150), S = h.default.getLogger("VipDownload:task");
    e.Task = class {
        constructor(t, e, i) {
            this.mTaskBase = null, this.mTaskStatus = void 0, this.mIsGcidOk = !1, this.mIsSubGcidOk = new Map, this.mIsHDVideo = new Map, this.mIsWeiDuanYouxi = new Map, this.mTaskDetail = null, this.mVipTask = null, this.mBtErrorType = void 0, this.mTaskName = void 0, this.isCloudTask = !1, this.haveStared = !1, this.mTaskId = t, this.mVipTask = i ? new f.VipTaskCloud(this, !0) : new p.VipTaskDownload(this, !1), this.isCloudTask = i, this.init(e).catch()
        }

        getIsCloudTask() {
            return this.isCloudTask
        }

        getTaskId() {
            return this.mTaskId
        }

        getTaskBase() {
            return this.mTaskBase
        }

        getTaskStatus() {
            return this.mTaskStatus
        }

        getTaskDetail() {
            return this.mTaskDetail
        }

        getVipTask() {
            return this.mVipTask
        }

        getBtErrorType() {
            return this.mBtErrorType
        }

        taskDescript() {
            return this.taskTitle() + " " + this.mTaskId
        }

        taskTitle() {
            if (void 0 === this.mTaskName) {
                let t = this.getTaskBase();
                t && (this.mTaskName = t.taskName)
            }
            return this.mTaskName
        }

        isHaveStared() {
            return this.haveStared
        }

        getIsHDVideo(t) {
            return n(this, void 0, void 0, function* () {
                if (this.isCloudTask) return !1;
                let e = this.mIsHDVideo.get(t);
                if (d(e)) {
                    let i = !1, n = this.getFile(t);
                    n && n.refUrl && (i = yield r.default.getIsHDVideo(n.refUrl)), e = i, S.info("taskId", this.mTaskId, "subId", t, "isHDVideo", e), this.mIsHDVideo.set(t, e)
                }
                return e
            })
        }

        getIsWeiDuanYouXi(t) {
            return n(this, void 0, void 0, function* () {
                if (this.isCloudTask) return !1;
                let e = this.mIsWeiDuanYouxi.get(t);
                if (d(e)) {
                    let i = !1, n = this.getFile(t);
                    n && n.refUrl && (i = yield r.default.getIsWeiDuanYouXi(n.refUrl)), !i && n && n.url && (i = yield r.default.getIsWeiDuanYouXi(n.url)), e = i, S.info("taskId", this.mTaskId, "subId", t, "isWeiDuanYouxi", e), this.mIsWeiDuanYouxi.set(t, e)
                }
                return e
            })
        }

        getFilesWithFilter(t, e) {
            let i = [];
            if (!this.mTaskBase) return i;
            let n = void 0, s = void 0;
            switch (e && (n = e.get("downloading"), s = e.get("select")), this.mTaskBase.taskType) {
                case a.DownloadKernel.TaskType.P2sp:
                case a.DownloadKernel.TaskType.Emule:
                    if (n && this.mTaskStatus !== a.DownloadKernel.TaskStatus.Started) break;
                    let o = this.getP2pFile();
                    i.push(o);
                    break;
                case a.DownloadKernel.TaskType.Bt:
                case a.DownloadKernel.TaskType.Group:
                    if (!this.mTaskDetail) break;
                    if (t) {
                        for (let e of t) {
                            let t = this.mTaskDetail.files.get(e);
                            t && (n && !this.isSubTaskDownloading(e) || s && 1 !== t.isNeedDownload || i.push(t))
                        }
                        break
                    }
                    this.mTaskDetail.files.forEach(t => {
                        n && !this.isSubTaskDownloading(t.subId) || s && 1 !== t.isNeedDownload || i.push(t)
                    })
            }
            return i
        }

        getAllFiles() {
            return this.getFilesWithFilter()
        }

        getSelectFiles(t) {
            let e = new Map;
            return e.set("select", !0), this.getFilesWithFilter(t, e)
        }

        getDownloadingFiles(t) {
            let e = new Map;
            return e.set("downloading", !0), this.getFilesWithFilter(t, e)
        }

        getFile(t) {
            let e = null;
            if (!this.mTaskBase) return e;
            switch (this.mTaskBase.taskType) {
                case a.DownloadKernel.TaskType.P2sp:
                case a.DownloadKernel.TaskType.Emule:
                    e = this.getP2pFile();
                    break;
                case a.DownloadKernel.TaskType.Bt:
                case a.DownloadKernel.TaskType.Group:
                    this.mTaskDetail && (e = this.mTaskDetail.files.get(t))
            }
            return e
        }

        isSubTaskDownloading(t) {
            if (!this.mTaskBase) return !1;
            let e = !1;
            switch (this.mTaskBase.taskType) {
                case a.DownloadKernel.TaskType.P2sp:
                case a.DownloadKernel.TaskType.Emule:
                    e = this.mTaskBase.taskStatus === a.DownloadKernel.TaskStatus.Started;
                    break;
                case a.DownloadKernel.TaskType.Bt:
                    if (this.mTaskDetail) {
                        let i = this.mTaskDetail.files.get(t);
                        i && (e = i.taskStatus === a.DownloadKernel.BtFileStatus.Started)
                    }
                    break;
                case a.DownloadKernel.TaskType.Group:
                    if (this.mTaskDetail) {
                        let i = this.mTaskDetail.files.get(t);
                        i && (e = i.taskStatus === a.DownloadKernel.TaskStatus.Started)
                    }
            }
            return e
        }

        remove() {
            this.mVipTask.remove()
        }

        select() {
            return n(this, void 0, void 0, function* () {
                let t = yield r.default.getCurrentCategoryId();
                t && r.default.selectCategoryView(t, a.DownloadKernel.CategroyViewID.Downloading, this.mTaskId)
            })
        }

        onExpand() {
            this.mVipTask.onExpand()
        }

        static onUserAuthorityChangedEx(t, e, i) {
            return n(this, void 0, void 0, function* () {
                yield g.VipTaskBase.onUserAuthorityChangedEx(t, e, i)
            })
        }

        onUserAuthorityChanged(t, e) {
            this.mVipTask.onUserAuthorityChanged(t, e)
        }

        onTaskStatusChanged(t) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (t === this.mTaskStatus) break;
                    switch (S.info("onTaskStatusChanged", "taskId", this.mTaskId, "taskStatus", t), this.mTaskStatus = t, o.default.emit(o.TaskEventNS.taskStatusChanged, this.mTaskId, t), t) {
                        case a.DownloadKernel.TaskStatus.Started:
                            this.haveStared = !0, yield this.initTaskDetail()
                    }
                    this.mVipTask.onTaskStatusChanged(t)
                } while (0)
            })
        }

        onTaskDetailChanged(t) {
            this.setTaskBase(t), this.mTaskBase && this.mTaskBase.taskType === a.DownloadKernel.TaskType.Group && r.default.getTaskDetail(this.mTaskId).then(t => {
                if (t && t.files) {
                    let e = {fileInfos: [], gcidSubIds: []};
                    t.files.forEach(t => {
                        this.setFile(t.subId, t, e)
                    }), e.fileInfos.length > 0 && !this.isCloudTask && this.mVipTask.onBatchSubTaskStatusChanged(e.fileInfos), e.gcidSubIds.length > 0 && !this.isCloudTask && this.onBatchCidGcidRetrieved(e.gcidSubIds)
                }
            }).catch()
        }

        onTaskDcdnStatusChanged(t, e) {
            t < 0 && this.mTaskBase && (this.mTaskBase.taskType === a.DownloadKernel.TaskType.Group || this.mTaskBase.taskType === a.DownloadKernel.TaskType.Bt) || (S.info("onTaskDcdnStatusChanged", "taskId", this.mTaskId, "subId", t, "dcdnStatus", e), this.isCloudTask || this.mVipTask.onTaskDcdnStatusChanged(t, e).catch())
        }

        onBtSubFileDetailChanged(t, e) {
            if (!this.mTaskDetail) return;
            if (this.isCloudTask) return;
            let i = {fileInfos: [], gcidSubIds: []};
            for (let t of e) {
                let e = t.realIndex, n = r.default.createBtFileUrl(e, this.mTaskDetail.infoId), a = {
                    subId: e,
                    taskStatus: t.fileStatus,
                    filePath: "",
                    fileName: t.finalName,
                    gcid: t.gcid,
                    cid: t.cid,
                    url: n,
                    refUrl: "",
                    fileSize: t.fileSize,
                    downloadSize: t.downloadSize,
                    errCode: t.errorCode
                };
                this.setFile(e, a, i)
            }
            i.fileInfos.length > 0 && this.mVipTask.onBatchSubTaskStatusChanged(i.fileInfos), i.gcidSubIds.length > 0 && this.onBatchCidGcidRetrieved(i.gcidSubIds)
        }

        onBtSubFileForbidden(t) {
            this.mBtErrorType = t
        }

        onBatchCidGcidRetrieved(t) {
            S.info("onBatchCidGcidRetrieved", this.mTaskId, t), this.isCloudTask || this.mVipTask.onBatchCidGcidRetrieved(t)
        }

        onTaskCompleted() {
            S.info("onTaskCompleted", "taskId", this.mTaskId), this.remove()
        }

        onTaskRemoved() {
            S.info("onTaskRemoved", "taskId", this.mTaskId), this.remove()
        }

        init(t) {
            return n(this, void 0, void 0, function* () {
                S.info("init"), this.onTaskDetailChanged(t);
                let e = yield r.default.getTaskStatus(this.mTaskId);
                yield this.onTaskStatusChanged(e)
            })
        }

        initTaskDetail() {
            return n(this, void 0, void 0, function* () {
                if (this.mTaskDetail = null, this.mTaskBase) {
                    let t = this.mTaskBase.taskType, e = t === a.DownloadKernel.TaskType.Bt,
                        i = t === a.DownloadKernel.TaskType.Group;
                    if (e || i) {
                        let t = yield r.default.getTaskDetail(this.mTaskId);
                        if (t && t.files) {
                            let n = [];
                            t.files.forEach(t => {
                                (e && t.taskStatus === a.DownloadKernel.BtFileStatus.Started || i && t.taskStatus === a.DownloadKernel.TaskStatus.Started) && (n.push([t.subId, t.taskStatus]), o.default.emit(o.TaskEventNS.subTaskStatusChanged, this.mTaskId, t.subId, t.taskStatus), l.client.broadcastEvent(s.BroadcastEventNS.subTaskStatusChanged, this.mTaskId, t.subId, t.taskStatus))
                            }), n.length > 0 && !this.isCloudTask && this.mVipTask.onBatchSubTaskStatusChanged(n)
                        }
                        this.mTaskDetail = t
                    }
                }
            })
        }

        setTaskBase(t) {
            this.mTaskBase = t, t && (t.taskType !== a.DownloadKernel.TaskType.P2sp && t.taskType !== a.DownloadKernel.TaskType.Emule || this.mIsGcidOk || t && t.gcid && "" !== t.gcid && t.cid && "" !== t.cid && (this.mIsGcidOk = !0, this.onBatchCidGcidRetrieved([-1])))
        }

        getP2pFile() {
            return this.mTaskBase ? {
                subId: -1,
                taskStatus: this.mTaskBase.taskStatus,
                filePath: this.mTaskBase.savePath,
                fileName: this.mTaskBase.taskName,
                gcid: this.mTaskBase.gcid,
                cid: this.mTaskBase.cid,
                url: this.mTaskBase.url,
                refUrl: this.mTaskBase.refUrl,
                fileSize: this.mTaskBase.fileSize,
                downloadSize: this.mTaskBase.downloadSize,
                isNeedDownload: 1
            } : null
        }

        setFile(t, e, i) {
            if (!this.mTaskDetail) return;
            let n = this.getFile(t), r = n ? c(n) : null;
            r = r ? Object.assign(r, e) : e, this.mTaskDetail.files.set(t, r), n && n.taskStatus === e.taskStatus || (i.fileInfos.push([t, e.taskStatus]), o.default.emit(o.TaskEventNS.subTaskStatusChanged, this.mTaskId, t, e.taskStatus), l.client.broadcastEvent(s.BroadcastEventNS.subTaskStatusChanged, this.mTaskId, t, e.taskStatus)), this.mIsSubGcidOk.get(t) || e.gcid && "" !== e.gcid && e.cid && "" !== e.cid && (this.mIsSubGcidOk.set(t, !0), i.gcidSubIds.push(t)), this.mTaskBase && this.mTaskBase.taskType === a.DownloadKernel.TaskType.Group && (n && n.dcdnStatus === e.dcdnStatus || this.onTaskDcdnStatusChanged(t, e.dcdnStatus))
        }
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(17), a = i(0).default.getLogger("aes-crypto");
    !function (t) {
        t.encryptString = function (t, e, i = "utf8", s = "hex") {
            let o = void 0;
            try {
                let r = n.createCipheriv("aes-128-ecb", e, "");
                o = r.update(t, i, s) + r.final(s)
            } catch (t) {
                a.error("encryptString", t)
            }
            return o
        }, t.decryptString = function (t, e, i = "hex", s = "utf8") {
            let o = void 0;
            try {
                let r = n.createDecipheriv("aes-128-ecb", e, "");
                o = r.update(t, i, s) + r.final(s)
            } catch (t) {
                a.error("decryptString", t)
            }
            return o
        }
    }(e.AesCryptoNS || (e.AesCryptoNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(0).default.getLogger("VipDownload:vip-speed-qrcode");
    let o = new Map;
    a.client.attachServerEvent("on_qrcode_update_item", (t, e, i, a) => n(this, void 0, void 0, function* () {
        switch (s.info("on_qrcode_update_item", a, e, i), a) {
            case"cleanup":
                o.delete(e);
                break;
            case"setup":
                o.set(e, i)
        }
    })), e.getQrCodeStatus = function (t) {
        return o.has(t) ? o.get(t) : null
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(1), o = i(0).default.getLogger("VipDownload:speedzero");
    !function (t) {
        t.parseConfigResponse = function (t) {
            o.info("--\x3eparseConfigResponse");
            let e = null;
            if (t) {
                let i = t.toString();
                o.info("jsonStr", i);
                try {
                    e = JSON.parse(i)
                } catch (t) {
                    o.warn(t)
                }
            }
            o.info("object", e);
            let i = null;
            return e && 0 === e.code && e.data && (i = {
                result: e.code,
                message: e.msg,
                switch: e.data.switch,
                zeroTime: e.data.zero_time,
                downloadLimit: e.data.download_limit
            }), o.info("<--parseConfigResponse"), i
        }, t.praseCreateBuffer = function (t, e, i) {
            o.info("--\x3epraseCreateBuffer");
            let n = a.HttpJsonCryptoNS.getKey(t, e), s = a.HttpJsonCryptoNS.decryptHttpBuffer(i, n);
            if (!s) return null;
            let r = {
                result: s.result,
                message: s.message,
                entrustDownloadLimit: s.entrust_download_limit,
                entrustQueueLimit: s.entrust_queue_limit
            };
            return o.info("<--praseCreateBuffer"), r
        }, t.praseStateBuffer = function (t, e, i) {
            o.info("--\x3epraseStateBuffer");
            let n = a.HttpJsonCryptoNS.getKey(t, e), s = a.HttpJsonCryptoNS.decryptHttpBuffer(i, n);
            if (!s) return null;
            let r = {result: s.result, message: s.message, progress: s.progress, key: s.key};
            return o.info("<--praseStateBuffer"), r
        };

        class e {
            createRequestBuffer() {
                return n(this, void 0, void 0, function* () {
                    return null
                })
            }
        }

        t.IRequest = e, t.createQueryBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                return t.createRequestBuffer()
            })
        };
        t.ICreateRequest = class extends e {
            createRequestBuffer() {
                return n(this, void 0, void 0, function* () {
                    o.info("--\x3ecreateRequestBuffer", "ICreateRequest");
                    let t = {
                            url: this.url,
                            filename: this.filename,
                            filesize: this.filesize,
                            selectedIndexs: this.selectedIndexs,
                            user_id: Number(this.userId),
                            peer_id: this.peerId
                        }, e = a.HttpJsonCryptoNS.getKey(this.userId, s.default.currentTime),
                        i = a.HttpJsonCryptoNS.encryptHttpBuffer(t, e);
                    return o.info("<--createRequestBuffer", "ICreateRequest"), i
                })
            }
        };
        t.IStateRequest = class extends e {
            createRequestBuffer() {
                return n(this, void 0, void 0, function* () {
                    o.info("--\x3ecreateRequestBuffer", "IStateRequest");
                    let t = {url: this.url, user_id: Number(this.userId), peer_id: this.peerId},
                        e = a.HttpJsonCryptoNS.getKey(this.userId, s.default.currentTime),
                        i = a.HttpJsonCryptoNS.encryptHttpBuffer(t, e);
                    return o.info("<--createRequestBuffer", "IStateRequest"), i
                })
            }
        }
    }(e.SpeedZeroHttpPackageNS || (e.SpeedZeroHttpPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(22), s = i(11), o = i(1);

    class r {
        constructor() {
            this.debugObj = {httpDebug: {}}
        }

        init() {
            return n(this, void 0, void 0, function* () {
                let t = s.join(__rootDir, o.default.pluginVersion, "debug.json"),
                    e = yield a.FileSystemAWNS.readFileAW(t);
                e && (this.debugObj = JSON.parse(e.toString()))
            })
        }

        httpDebug(t) {
            return this.debugObj.httpDebug[t]
        }
    }

    e.DebugHelp = r, e.default = new r
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(8), o = i(3), r = i(10), l = i(0).default.getLogger("VipDownload:try-operation");
    let u = new Map;
    !function (t) {
        t.createQueryBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                l.info("--\x3ecreateQueryBuffer");
                let e = {
                    peer_id: yield r.default.getTpPeerId(),
                    bt_title: t.btTitle,
                    url: t.file.url,
                    filename: t.file.fileName,
                    gcid: t.file.gcid,
                    cid: t.file.cid,
                    filesize: t.file.fileSize,
                    advertising_peer_id: yield o.default.getPeerId()
                };
                t.scene && (e.scene = t.scene);
                let i = a.HttpJsonCryptoNS.getKey(t.userId, t.random), n = a.HttpJsonCryptoNS.encryptHttpBuffer(e, i);
                return l.info("<--createQueryBuffer"), n
            })
        }, t.praseQueryBuffer = function (t, e, i, n) {
            l.info("--\x3epraseQueryBuffer");
            let r = a.HttpJsonCryptoNS.getKey(t, i), c = a.HttpJsonCryptoNS.decryptHttpBuffer(n, r);
            if (!c) return null;
            let d = void 0;
            void 0 !== e && null !== e && u.set(e, c.speed_type), d = 1 === c.speed_type ? s.VipDownloadDefineNS.TryType.SuperVip : 3 === c.speed_type ? s.VipDownloadDefineNS.TryType.MixVip : s.VipDownloadDefineNS.TryType.PlatinumVip;
            let h = !o.default.authority && 1 === c.advertising_user, f = {
                result: c.result,
                message: c.message,
                trialKey: c.trial_key,
                expireTime: c.trial_refresh_time,
                leftCount: c.trial_left_times,
                usedCount: c.trial_used_times,
                type: d,
                isAdUser: h
            };
            return l.info("<--praseQueryBuffer"), f
        }, t.createCommitBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                l.info("--\x3ecreateCommitBuffer");
                let e = {
                    peer_id: yield r.default.getTpPeerId(),
                    url: t.file.url,
                    filename: t.file.fileName,
                    gcid: t.file.gcid,
                    cid: t.file.cid,
                    filesize: t.file.fileSize,
                    trial_key: t.trialKey,
                    advertising_user: t.isAdUser ? 1 : 0,
                    advertising_peer_id: yield o.default.getPeerId()
                };
                t.scene && (e.scene = t.scene);
                let i = a.HttpJsonCryptoNS.getKey(t.userId, t.random), n = a.HttpJsonCryptoNS.encryptHttpBuffer(e, i);
                return l.info("<--createCommitBuffer"), n
            })
        }, t.praseCommitBuffer = function (t, e, i) {
            l.info("--\x3epraseCommitBuffer");
            let n = a.HttpJsonCryptoNS.getKey(t, e), s = a.HttpJsonCryptoNS.decryptHttpBuffer(i, n);
            if (!s) return null;
            let o = {
                result: s.result,
                message: s.message,
                verify: s.trial_verify_info,
                baijinVerify: s.baijin_trial_verify_info,
                trialLeftTimes: s.trial_left_times
            };
            return l.info("<--praseCommitBuffer"), o
        }, t.getSpeedType = function (t) {
            return u.get(t)
        }
    }(e.TryTaskHttpPackageNS || (e.TryTaskHttpPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(82);
    !function (t) {
        const e = new n.SqliteTable;
        e.name = "offline", e.encrypt = !0, e.jsonify = !0, t.getTable = function () {
            return e
        }
    }(e.OfflineTaskDataBaseNS || (e.OfflineTaskDataBaseNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(88), s = i(89), o = i(1), r = i(3), l = i(0).default.getLogger("VipDownload:task-scene-http-package");
    !function (t) {
        let e = 0;

        class i {
        }

        t.ItemData = i, t.createSceneBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                l.info("--\x3ecreateSceneBuffer");
                let i = 0, n = Buffer.alloc(1024);
                i = n.writeUInt32LE(11, i), l.info("    protocolVersion:", 11), i = n.writeUInt32LE(++e, i), l.info("    sequence:", e), i = n.writeUInt32LE(0, i), l.info("    commandLegth:", 0);
                let u = o.default.thunderVersionNumber;
                i = n.writeUInt32LE(u, i), l.info("    thunderFlag:", u), i = n.writeUInt16LE(256, i), l.info("    compressFlag:", 256), i = n.writeUInt16LE(1, i), l.info("    commandType:", 1);
                let c = Number(r.default.userId).valueOf();
                i = s.BufferUtilitiesNS.writeUInt64LE(n, c, i), l.info("    userId:", c);
                let d = r.default.vipLevel;
                i = n.writeInt8(d, i), l.info("    vipLevel:", d);
                let h = r.default.userLevel;
                i = n.writeUInt32LE(h, i), l.info("    userLevel:", h);
                let f = t.peerId;
                return i = yield s.BufferUtilitiesNS.writeString(n, f, i, "gbk"), l.info("    peerId:", f), i = yield s.BufferUtilitiesNS.writeString(n, "", i, "gbk"), l.info("    taskUrl:", ""), i = yield s.BufferUtilitiesNS.writeString(n, "", i, "gbk"), l.info("    referUrl:", ""), i = yield s.BufferUtilitiesNS.writeString(n, "", i, "gbk"), l.info("    gcid:", ""), i = yield s.BufferUtilitiesNS.writeString(n, "", i, "gbk"), l.info("    cid:", ""), i = s.BufferUtilitiesNS.writeUInt64LE(n, 0, i), l.info("    fileSize:", 0), i = yield s.BufferUtilitiesNS.writeString(n, "", i, "gbk"), l.info("    taskName:", ""), i = n.writeUInt32LE(0, i), l.info("    netStatus:", 0), i = s.BufferUtilitiesNS.writeUInt64LE(n, 0, i), l.info("    taskSpeed:", 0), i = s.BufferUtilitiesNS.writeUInt64LE(n, 0, i), l.info("    totalSpeed:", 0), i = s.BufferUtilitiesNS.writeUInt64LE(n, 0, i), l.info("    speedLimit:", 0), i = n.writeUInt32LE(0, i), l.info("    downloadingCount:", 0), i = n.writeUInt32LE(0, i), l.info("    resourceCount:", 0), i = n.writeUInt32LE(0, i), l.info("    downloadMode:", 0), i = n.writeUInt32LE(2, i), l.info("    queryType:", 2), i = n.writeUInt32LE(0, i), l.info("    ipProvince:", 0), i = n.writeUInt32LE(0, i), l.info("    ipCity:", 0), i = n.writeUInt32LE(0, i), l.info("    ipIsp:", 0), i = n.writeUInt32LE(0, i), l.info("    privilege:", 0), i = n.writeUInt32LE(0, i), l.info("    subNum:", 0), n = n.slice(0, i), n = a.ShubCryptoNS.encryptHttpBuffer(n), l.info("<--createSceneBuffer"), n
            })
        }, t.praseSceneBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                l.info("--\x3epraseSceneBuffer");
                let e = null;
                try {
                    t = a.ShubCryptoNS.decryptHttpBuffer(t);
                    let n = 0, o = t.readUInt32LE(n);
                    l.info("    protocolVersion:", o), n += 4;
                    let r = t.readUInt32LE(n);
                    l.info("    sequence:", r), n += 4;
                    let u = t.readUInt32LE(n);
                    l.info("    commandLegth:", u), n += 4;
                    let c = t.readUInt32LE(n);
                    l.info("    thunderVersion:", c), n += 4;
                    let d = t.readUInt16LE(n);
                    l.info("    compressFlag:", d), n += 2;
                    let h = t.readUInt16LE(n);
                    l.info("    commandType:", h), n += 2;
                    let f = t.readUInt32LE(n);
                    l.info("    result:", f), n += 4;
                    let p = yield s.BufferUtilitiesNS.readString(t, n, "gbk"), g = p[1];
                    l.info("    key:", g), n = p[0];
                    let S = t.readUInt32LE(n);
                    l.info("    queryAgain:", S), n += 4;
                    let y = t.readUInt32LE(n);
                    l.info("    tryListNum:", y), n += 4;
                    for (let e = 0; e < y; e++) {
                        l.info("");
                        let i = t.readUInt32LE(n);
                        l.info("      index", e, "size:", i), n += 4, n += i
                    }
                    let T = [], k = t.readUInt32LE(n);
                    l.info("    sceneListNum:", k), n += 4;
                    for (let e = 0; e < k; e++) {
                        l.info("");
                        let a = t.readUInt32LE(n);
                        l.info("      index", e, "size:", a), n += 4;
                        let o = new i, r = n;
                        o.id = t.readUInt32LE(r), l.info("      id:", o.id), r += 4, o.type = t.readUInt32LE(r), l.info("      type:", o.type), r += 4;
                        let u = yield s.BufferUtilitiesNS.readString(t, r, "gbk");
                        o.name = u[1], l.info("      name:", o.name), r = u[0], o.status = t.readInt32LE(r), l.info("      status:", o.status), r += 4;
                        let c = t.readUInt32LE(r);
                        l.info("      scoped:", c), r += 4, o.priority = t.readUInt32LE(r), l.info("      priority:", o.priority), r += 4;
                        let d = (u = yield s.BufferUtilitiesNS.readString(t, r, "gbk"))[1];
                        l.info("      clickStr:", d), r = u[0], u = yield s.BufferUtilitiesNS.readString(t, r, "gbk"), o.lineStr = u[1], l.info("      lineStr:", o.lineStr), r = u[0];
                        let h = (u = yield s.BufferUtilitiesNS.readString(t, r, "gbk"))[1];
                        l.info("      tipsStr:", h), r = u[0];
                        let f = t.readUInt32LE(r);
                        l.info("      indate:", f), r += 4;
                        let p = (u = yield s.BufferUtilitiesNS.readString(t, r, "gbk"))[1];
                        l.info("      matchStr:", p), r = u[0];
                        let g = (u = yield s.BufferUtilitiesNS.readString(t, r, "gbk"))[1];
                        l.info("      showStr:", g), r = u[0], T.push(o), n += a
                    }
                    e = {itemDatas: T}
                } catch (t) {
                    l.error("praseSceneBuffer", t)
                }
                return l.info("<--praseSceneBuffer"), e
            })
        }
    }(e.SceneHttpPackageNS || (e.SceneHttpPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(15), s = i(22), o = i(11), r = i(0).default.getLogger("file-download");
    !function (t) {
        t.downloadFile = function (t, e) {
            return n(this, void 0, void 0, function* () {
                let i = !1;
                r.info("downloadFile", "downloadUrl", t, "savePath", e);
                let l = yield function (t) {
                    return n(this, void 0, void 0, function* () {
                        let e = new Promise(e => {
                            let i = new a.HttpSession;
                            i.url = t, i.get(t => {
                                let i = null;
                                200 === t.statusCode && t.body && (i = t.body), e(i)
                            }, t => {
                                r.info("error", t), e(null)
                            })
                        });
                        return e
                    })
                }(t);
                if (l) {
                    let t = o.dirname(e);
                    (i = yield s.FileSystemAWNS.mkdirsAW(t)) && (i = yield s.FileSystemAWNS.writeFileAW(e, l))
                }
                return i
            })
        }
    }(e.FileDownloadNS || (e.FileDownloadNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(82);
    !function (t) {
        const e = new n.SqliteTable;
        e.name = "superspeed", e.encrypt = !0, e.jsonify = !0, t.getTable = function () {
            return e
        }
    }(e.VipTaskDataBaseNS || (e.VipTaskDataBaseNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(8), s = i(16), o = i(7), r = i(149), l = i(26), u = i(21), c = i(14), d = i(41), h = i(10), f = i(94),
        p = i(44), g = i(0), S = i(1), y = i(2), T = i(5), k = i(192),
        m = i(27), {isDef: v, isUndef: w} = T.ThunderUtil, _ = g.default.getLogger("VipDownload:try-task");
    !function (t) {
        let e = void 0, i = !1, g = !1, T = !1, D = [], b = !1, N = new Map, C = null, x = void 0, I = !1, V = !1,
            B = !1;

        function P(t, e, i) {
            _.info("tryButtonShow"), e = e || {};
            let n = new Map, a = r.StatHelperNS.isLogin(), o = r.StatHelperNS.taskGcid(t),
                l = r.StatHelperNS.taskUrl(t), u = r.StatHelperNS.taskFileSize(t),
                c = k.TryTaskHttpPackageNS.getSpeedType(t), d = e.config || "former_default", h = e.aidfrom || "0";
            n.set("is_login", a), n.set("vip_type", 0), n.set("taskid", t), n.set("gcid", o), n.set("btn_type", i), n.set("url", l), n.set("filesize", u), void 0 !== c && null !== c && n.set("server_rtn_code", c), n.set("config", d), n.set("aidfrom", h);
            let f = {attribute1: "jssy_show", extData: n};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", f).catch()
        }

        function E(t, e, i) {
            _.info("tryOpenVipButtonShow"), e = e || {};
            let n = new Map, a = r.StatHelperNS.isLogin(), o = r.StatHelperNS.taskGcid(t),
                l = r.StatHelperNS.taskUrl(t), u = r.StatHelperNS.taskFileSize(t), c = e.config || "former_default",
                d = e.aidfrom || "0";
            n.set("is_login", a), n.set("is_vip", 0), n.set("vip_type", 0), n.set("taskid", t), n.set("gcid", o), n.set("btn_type", i), n.set("url", l), n.set("filesize", u), n.set("config", c), n.set("aidfrom", d);
            let h = {attribute1: "jssy_kthy_show", extData: n};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", h).catch()
        }

        function O(t) {
            if (g) return;
            g = !0, _.info("trySuccess");
            let i = new Map, n = r.StatHelperNS.isLogin(), a = r.StatHelperNS.taskGcid(t),
                o = r.StatHelperNS.taskUrl(t), l = r.StatHelperNS.taskFileSize(t);
            i.set("is_login", n), i.set("is_vip", 0), i.set("vip_type", 0), i.set("taskid", t), i.set("gcid", a), i.set("btn_type", e), i.set("js_type", 3), i.set("url", o), i.set("filesize", l);
            let u = {attribute1: "jssy_succ", extData: i};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", u).catch()
        }

        function F(t, n, a) {
            if (!i) return;
            i = !1, _.info("tryEnd");
            let o = new Map, l = r.StatHelperNS.isLogin(), u = r.StatHelperNS.taskGcid(t),
                c = r.StatHelperNS.taskUrl(t), d = r.StatHelperNS.taskFileSize(t), h = n ? "fail" : "succ";
            o.set("is_login", l), o.set("is_vip", 0), o.set("vip_type", 0), o.set("taskid", t), o.set("gcid", u), o.set("btn_type", e), o.set("url", c), o.set("filesize", d), o.set("result", h), a && o.set("errcode", a);
            let f = H(t);
            f && (o.set("dl_duration", f.useTime), o.set("dl_avg_speed", f.speed));
            let p = {attribute1: "jssy_end", extData: o};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", p).catch(), G(t).catch()
        }

        function A(t, i, n) {
            _.info("tryEndAfter");
            let a = new Map, o = r.StatHelperNS.isLogin(), l = r.StatHelperNS.isVip(), u = r.StatHelperNS.vipType(),
                c = r.StatHelperNS.taskGcid(t), d = r.StatHelperNS.taskUrl(t), h = r.StatHelperNS.taskFileSize(t),
                f = i ? "fail" : "succ", p = B ? "v2" : "v1";
            a.set("is_login", o), a.set("is_vip", l), a.set("vip_type", u), a.set("taskid", t), a.set("gcid", c), a.set("btn_type", e), a.set("url", d), a.set("filesize", h), a.set("feat_type", p), a.set("result", f), n && a.set("errcode", n);
            let g = H(t);
            g && (a.set("dl_duration", g.useTime), a.set("dl_avg_speed", g.speed));
            let S = {attribute1: V ? "cjjs_afterend" : "jssy_afterend", extData: a};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", S).catch()
        }

        function R(t, e, i, n) {
            _.info("superTryButtonShow"), e = e || {};
            let a = new Map, o = r.StatHelperNS.isLogin(), l = r.StatHelperNS.isVip(), u = r.StatHelperNS.vipType(),
                c = r.StatHelperNS.taskGcid(t), d = r.StatHelperNS.taskUrl(t), h = r.StatHelperNS.taskFileSize(t),
                f = n ? "v2" : "v1", p = k.TryTaskHttpPackageNS.getSpeedType(t), g = e.config || "former_default",
                S = e.aidfrom || "0";
            a.set("is_login", o), a.set("is_vip", l), a.set("vip_type", u), a.set("taskid", t), a.set("gcid", c), a.set("btn_type", i), a.set("url", d), a.set("filesize", h), a.set("feat_type", f), void 0 !== p && null !== p && a.set("server_rtn_code", p), a.set("config", g), a.set("aidfrom", S);
            let y = {attribute1: "cjjssy_show", extData: a};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", y).catch()
        }

        function L(t, e, i, n) {
            _.info("superTryOpenVipButtonShow"), e = e || {};
            let a = new Map, o = r.StatHelperNS.isLogin(), l = r.StatHelperNS.isVip(), u = r.StatHelperNS.vipType(),
                c = 1 === l ? "vipsj" : "vipkt", d = r.StatHelperNS.taskGcid(t), h = r.StatHelperNS.taskUrl(t),
                f = r.StatHelperNS.taskFileSize(t), p = n ? "v2" : "v1", g = e.config || "former_default",
                S = e.aidfrom || "0";
            a.set("is_login", o), a.set("is_vip", l), a.set("vip_type", u), a.set("taskid", t), a.set("gcid", d), a.set("biz_type", c), a.set("btn_type", i), a.set("url", h), a.set("filesize", f), a.set("feat_type", p), a.set("config", g), a.set("aidfrom", S);
            let y = {attribute1: "cjjssy_ktch_show", extData: a};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", y).catch()
        }

        function U(t) {
            if (g) return;
            g = !0, _.info("superTrySuccess");
            let i = new Map, n = r.StatHelperNS.isLogin(), a = r.StatHelperNS.isVip(), o = r.StatHelperNS.vipType(),
                l = r.StatHelperNS.taskGcid(t), u = r.StatHelperNS.taskUrl(t), c = r.StatHelperNS.taskFileSize(t),
                d = p.default.status === f.KuaiNiaoDefineNS.KuaiNiaoStatus.Alive ? 1 : 3, h = B ? "v2" : "v1";
            i.set("is_login", n), i.set("is_vip", a), i.set("vip_type", o), i.set("taskid", t), i.set("gcid", l), i.set("btn_type", e), i.set("js_type", d), i.set("url", u), i.set("filesize", c), i.set("feat_type", h);
            let S = {attribute1: "cjjssy_succ", extData: i};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", S).catch()
        }

        function M(t, n, o) {
            if (!i) return;
            i = !1, _.info("superTryEnd");
            let u = new Map, c = r.StatHelperNS.isLogin(), d = r.StatHelperNS.isVip(), h = r.StatHelperNS.vipType(),
                f = r.StatHelperNS.taskGcid(t), p = r.StatHelperNS.taskUrl(t), g = r.StatHelperNS.taskFileSize(t),
                S = n ? "fail" : "succ", y = B ? "v2" : "v1";
            u.set("is_login", c), u.set("is_vip", d), u.set("vip_type", h), u.set("taskid", t), u.set("gcid", f), u.set("btn_type", e), u.set("url", p), u.set("filesize", g), u.set("feat_type", y), u.set("result", S), o && u.set("errcode", o);
            let T = H(t);
            T && (u.set("dl_duration", T.useTime), u.set("dl_avg_speed", T.speed));
            do {
                if (!B) break;
                const e = l.default.getTask(t);
                if (!e) break;
                const i = e.getVipTask().getOperation(a.VipDownloadDefineNS.VipTaskType.Try);
                if (!i) break;
                let n = 0, s = 0;
                const o = i.getChannelSpeed("platinumVip"), r = i.getChannelSpeed("superVip");
                o && o.size && o.time && (n = Math.floor(o.size / o.time), u.set("dl_bj_avg_speed", n), u.set("dl_bj_duration", o.time)), r && r.size && r.time && (s = Math.floor(r.size / r.time), u.set("dl_cj_avg_speed", s), u.set("dl_cj_duration", r.time))
            } while (0);
            let k = {attribute1: "cjjssy_end", extData: u};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", k).catch(), G(t).catch()
        }

        function X(t) {
            T = !1, b = !1, D = [], z(t, u.default.getVipTaskInfo(t))
        }

        function W(t, e, i) {
            if (!i) return;
            if (t === u.default.expandTaskId && z(t, e), e && e.taskType === a.VipDownloadDefineNS.VipTaskType.Try) switch (e.taskStatus) {
                case a.VipDownloadDefineNS.VipTaskStatus.Acclerating:
                    e.isSuper || e.isMixTry ? U(t) : O(t);
                    break;
                case a.VipDownloadDefineNS.VipTaskStatus.CommitFailed:
                case a.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed:
                    let i = d.default.getTask(t);
                    i && i.error && (e.isSuper || e.isMixTry ? M(t, i.error.errorStep, i.error.result) : F(t, i.error.errorStep, i.error.result));
                    break;
                case a.VipDownloadDefineNS.VipTaskStatus.Finished:
                case a.VipDownloadDefineNS.VipTaskStatus.Unkown:
                    e.isSuper || e.isMixTry ? M(t) : F(t)
            }
        }

        function j(t, e = !1) {
            return n(this, void 0, void 0, function* () {
                e && N.delete(t);
                let n = yield h.default.getTaskBaseInfo(t);
                if (!n || n.taskStatus !== o.DownloadKernel.TaskStatus.Started) return;
                let a = N.get(t) || {};
                i ? (w(a.startSize) && (a.startSize = n.receiveSize || 0), a.startTime = S.default.currentTime, a.useTime = a.useTime || 0) : (a.startSize = n.receiveSize, a.startTime = S.default.currentTime, a.useTime = 0), _.info("start record", t, a), N.set(t, a)
            })
        }

        function H(t) {
            let e = N.get(t);
            do {
                const i = l.default.getTask(t);
                if (!i) break;
                const n = i.getTaskBase();
                if (!n || w(n.receiveSize)) break;
                if (!e) break;
                if (e.startTime) {
                    let t = S.default.currentTime - e.startTime;
                    e.useTime = e.useTime + t
                }
                let a = n.receiveSize - e.startSize;
                _.info("calculateSpeed", "receiveSize", n.receiveSize, "useSize", a, "useTime", e.useTime), e.speed = e.useTime > 0 ? Math.round(a / e.useTime) : 0
            } while (0);
            return e
        }

        function G(t) {
            return n(this, void 0, void 0, function* () {
                yield j(t, !0);
                let e = yield h.default.getTaskBaseInfo(t);
                e && e.taskStatus === o.DownloadKernel.TaskStatus.Started ? C || (_.info("createTryEndSpeedTimer"), C = setTimeout(() => {
                    K(t)
                }, 18e4)) : _.info("task is not started")
            })
        }

        function K(t) {
            if (C) {
                _.info("killTryEndSpeedTimer"), clearTimeout(C), C = void 0;
                let e = void 0, i = void 0, n = d.default.getTask(t);
                n && n.error && (e = n.error.errorStep, i = n.error.result), A(t, e, i)
            }
            N.delete(t), I = !0
        }

        function z(t, e) {
            if (e && e.taskType === a.VipDownloadDefineNS.VipTaskType.Try) if (e.taskStatus === a.VipDownloadDefineNS.VipTaskStatus.Init) {
                let i = "task";
                if (e.isMixTry) {
                    R(t, m.default.getItemData(m.ItemName.MixTryReadyButton), i, !0)
                } else if (e.isSuper) {
                    R(t, m.default.getItemData(m.ItemName.SuperTryReadyButton), i)
                } else {
                    P(t, m.default.getItemData(m.ItemName.TryReadyButton), i)
                }
            } else if (e.taskStatus > a.VipDownloadDefineNS.VipTaskStatus.Init && e.taskStatus < a.VipDownloadDefineNS.VipTaskStatus.Finished) {
                if (e.isMixTry) {
                    if (v(e.trySection) && !D[e.trySection]) {
                        D[e.trySection] = !0;
                        let i = void 0, n = void 0;
                        e.trySection === a.VipDownloadDefineNS.TryType.SuperVip ? (i = m.ItemName.MixSuperTryingButton, n = "cjjsy_cj") : (i = m.ItemName.MixPlatinumTryingButton, n = "cjjssy_bj"), L(t, m.default.getItemData(i), n, !0)
                    }
                } else if (!T) if (T = !0, e.isSuper) {
                    L(t, m.default.getItemData(m.ItemName.SuperTryingButton), "cjjssying")
                } else {
                    E(t, m.default.getItemData(m.ItemName.TryingButton), "sying")
                }
            } else if (e.taskStatus === a.VipDownloadDefineNS.VipTaskStatus.Finished && !b) if (b = !0, e.isMixTry) {
                L(t, m.default.getItemData(m.ItemName.MixTryFinishButton), "cjjssyend", !0)
            } else if (e.isSuper) {
                L(t, m.default.getItemData(m.ItemName.SuperTryFinishButton), "cjjssyend")
            } else {
                E(t, m.default.getItemData(m.ItemName.TryFinishButton), "syend")
            }
        }

        c.default.addListener(c.TaskEventNS.vipTaskInfoChanged, W), c.default.addListener(c.TaskEventNS.taskExpand, X), c.default.addListener(c.TaskEventNS.taskStatusChanged, function (t, e) {
            return n(this, void 0, void 0, function* () {
                if (!I) switch (e) {
                    case o.DownloadKernel.TaskStatus.Started:
                        yield j(t);
                        break;
                    case o.DownloadKernel.TaskStatus.Stopped:
                        C && t === x ? K(t) : yield function (t) {
                            return n(this, void 0, void 0, function* () {
                                do {
                                    let e = yield h.default.getTaskBaseInfo(t);
                                    if (!e) break;
                                    let i = N.get(t);
                                    if (!i) break;
                                    let n = S.default.currentTime - i.startTime;
                                    return i.startTime = void 0, i.useTime = i.useTime + n, void _.info("pause record", t, i)
                                } while (0);
                                N.delete(t)
                            })
                        }(t)
                }
            })
        }), y.client.attachServerEvent("main-will-quit", () => {
            _.info("main-will-quit"), C && x && K(x)
        }), t.tryButtonShow = P, t.tryButtonClick = function (t, n, a) {
            _.info("tryButtonClick"), n = n || {}, i = !0, g = !1, x = t;
            let o = new Map, l = r.StatHelperNS.isLogin(), u = r.StatHelperNS.taskGcid(t),
                c = r.StatHelperNS.taskUrl(t), d = r.StatHelperNS.taskFileSize(t), h = n.config || "former_default",
                f = n.aidfrom || "0";
            o.set("is_login", l), o.set("vip_type", 0), o.set("taskid", t), o.set("gcid", u), o.set("clickid", a), o.set("url", c), o.set("filesize", d), o.set("config", h), o.set("aidfrom", f), e = a;
            let p = H(t);
            p && (o.set("dl_duration", p.useTime), o.set("dl_avg_speed", p.speed));
            let S = {attribute1: "jssy_click", extData: o};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", S).catch(), j(t, !0).catch()
        }, t.tryOpenVipButtonShow = E, t.tryOpenVipButtonClick = function (t, e, i) {
            _.info("tryOpenVipButtonClick"), e = e || {};
            let n = new Map, a = r.StatHelperNS.isLogin(), o = r.StatHelperNS.taskGcid(t),
                l = r.StatHelperNS.taskUrl(t), u = r.StatHelperNS.taskFileSize(t), c = e.config || "former_default",
                d = e.aidfrom || "0";
            n.set("is_login", a), n.set("is_vip", 0), n.set("vip_type", 0), n.set("taskid", t), n.set("gcid", o), n.set("clickid", i), n.set("url", l), n.set("filesize", u), n.set("config", c), n.set("aidfrom", d);
            let h = {attribute1: "jssy_kthy_click", extData: n};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", h).catch()
        }, t.trySuccess = O, t.tryEnd = F, t.tryEndAfter = A, t.superTryButtonShow = R, t.superTryButtonClick = function (t, n, a, o) {
            _.info("superTryButtonClick"), n = n || {}, i = !0, g = !1, V = !0, x = t;
            let l = new Map, u = r.StatHelperNS.isLogin(), c = r.StatHelperNS.isVip(), d = r.StatHelperNS.vipType(),
                h = r.StatHelperNS.taskGcid(t), f = r.StatHelperNS.taskUrl(t), p = r.StatHelperNS.taskFileSize(t),
                S = o ? "v2" : "v1", y = n.config || "former_default", T = n.aidfrom || "0";
            l.set("is_login", u), l.set("is_vip", c), l.set("vip_type", d), l.set("taskid", t), l.set("gcid", h), l.set("clickid", a), l.set("url", f), l.set("filesize", p), l.set("feat_type", S), l.set("config", y), l.set("aidfrom", T), e = a, B = o;
            let k = H(t);
            k && (l.set("dl_duration", k.useTime), l.set("dl_avg_speed", k.speed));
            let m = {attribute1: "cjjssy_click", extData: l};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", m).catch(), j(t, !0).catch()
        }, t.superTryOpenVipButtonShow = L, t.superTryOpenVipButtonClick = function (t, e, i, n) {
            _.info("superTryOpenVipButtonClick"), e = e || {};
            let a = new Map, o = r.StatHelperNS.isLogin(), l = r.StatHelperNS.isVip(), u = r.StatHelperNS.vipType(),
                c = 1 === l ? "vipsj" : "vipkt", d = r.StatHelperNS.taskGcid(t), h = r.StatHelperNS.taskUrl(t),
                f = r.StatHelperNS.taskFileSize(t), p = n ? "v2" : "v1", g = e.config || "former_default",
                S = e.aidfrom || "0";
            a.set("is_login", o), a.set("is_vip", l), a.set("vip_type", u), a.set("taskid", t), a.set("gcid", d), a.set("biz_type", c), a.set("clickid", i), a.set("url", h), a.set("filesize", f), a.set("feat_type", p), a.set("config", g), a.set("aidfrom", S);
            let y = {attribute1: "cjjssy_ktch_click", extData: a};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", y).catch()
        }, t.superTrySuccess = U, t.superTryEnd = M, t.superTryReadyMiniWebShow = function (t) {
            _.info("superTryReadyMiniWebShow");
            let e = new Map, i = r.StatHelperNS.isLogin(), n = r.StatHelperNS.isVip(), a = r.StatHelperNS.vipType(),
                o = r.StatHelperNS.taskGcid(t), l = r.StatHelperNS.taskUrl(t), u = r.StatHelperNS.taskFileSize(t);
            e.set("is_login", i), e.set("is_vip", n), e.set("vip_type", a), e.set("taskid", t), e.set("gcid", o), e.set("btn_type", "task"), e.set("url", l), e.set("filesize", u), e.set("tips_id", 1);
            let c = {attribute1: "cjjssy_trybefore_tips_show", extData: e};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", c).catch()
        }, t.superTryReadyMiniWebClick = function (t) {
            _.info("superTryReadyMiniWebClick");
            let e = new Map, i = r.StatHelperNS.isLogin(), n = r.StatHelperNS.isVip(), a = r.StatHelperNS.vipType(),
                o = r.StatHelperNS.taskGcid(t), l = r.StatHelperNS.taskUrl(t), u = r.StatHelperNS.taskFileSize(t);
            e.set("is_login", i), e.set("is_vip", n), e.set("vip_type", a), e.set("taskid", t), e.set("gcid", o), e.set("btn_type", "task"), e.set("url", l), e.set("filesize", u), e.set("tips_id", 1);
            let c = {attribute1: "cjjssy_trybefore_tips_click", extData: e};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", c).catch()
        }, t.superTryFinishMiniWebShow = function (t, e) {
            _.info("superTryFinishMiniWebShow");
            let i = new Map, n = r.StatHelperNS.isLogin(), a = r.StatHelperNS.isVip(), o = r.StatHelperNS.vipType(),
                l = r.StatHelperNS.taskGcid(t), u = r.StatHelperNS.taskUrl(t), c = r.StatHelperNS.taskFileSize(t);
            i.set("is_login", n), i.set("is_vip", a), i.set("vip_type", o), i.set("taskid", t), i.set("gcid", l), i.set("btn_type", "task"), i.set("url", u), i.set("filesize", c), i.set("tips_id", e);
            let d = {attribute1: "cjjssy_tryend_tips_show", extData: i};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", d).catch()
        }, t.superTryFinishMiniWebClick = function (t, e, i) {
            _.info("superTryFinishMiniWebClick");
            let n = new Map, a = r.StatHelperNS.isLogin(), o = r.StatHelperNS.isVip(), l = r.StatHelperNS.vipType(),
                u = r.StatHelperNS.taskGcid(t), c = r.StatHelperNS.taskUrl(t), d = r.StatHelperNS.taskFileSize(t);
            n.set("is_login", a), n.set("is_vip", o), n.set("vip_type", l), n.set("taskid", t), n.set("gcid", u), n.set("btn_type", "task"), n.set("url", c), n.set("filesize", d), n.set("tips_id", e), n.set("clickid", i);
            let h = {attribute1: "cjjssy_tryend_tips_click", extData: n};
            s.StatUtilitiesNS.trackEvent("xlx_vip_event", h).catch()
        }, t.onTaskExpand = X, t.onVipTaskInfoChanged = W
    }(e.TryStatNS || (e.TryStatNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(242), s = i(9), o = i(243), r = i(3), l = i(10), u = i(7), c = i(13), d = i(1), h = i(50), f = i(27),
        p = i(0).default.getLogger("VipDownload:scene-manager");
    var g;
    !function (t) {
        t.taskSceneChanged = "OnTaskSceneChanged"
    }(g = e.SceneEventNS || (e.SceneEventNS = {}));

    class S extends s.EventEmitter {
        constructor() {
            super(), this.mSelectTaskId = void 0, this.mRefreshTime = void 0, this.mSession = null, this.init()
        }

        init() {
            this.mSession = new a.SceneHttpSession, this.setMaxListeners(0), r.default.addListener(r.UserEventNS.authorityChanged, t => {
                p.info("authority", t), this.clear(), this.mSelectTaskId && this.activeTask(this.mSelectTaskId)
            }), p.info("pushgs_log 监听高速文字链更新事件"), h.default.addListener(h.AbtestEventNS.configureReady, () => {
                p.info("pushgs_log 接收到高速文字链更新事件："), this.clear(), this.mSelectTaskId && this.activeTask(this.mSelectTaskId)
            }), setInterval(() => {
                this.refresh()
            }, 5e3), this.attachDkEvents()
        }

        getScene(t) {
            let e = o.default.getTask(t);
            return e ? e.getItem() : null
        }

        onDownloadItemActive(t, e, i) {
            t === u.DownloadKernel.CategroyViewID.Downloading && (p.info("onDownloadItemActive", "taskId", i, "active", e), e ? this.onTaskExpand(i) : this.onTaskUnExpand(i))
        }

        onTaskExpand(t) {
            this.mSelectTaskId = t, this.activeTask(t)
        }

        onTaskUnExpand(t) {
            this.mSelectTaskId === t && (this.mSelectTaskId = void 0, this.mRefreshTime = void 0)
        }

        onClickScene(t) {
            this.changeToNextScene(t)
        }

        attachDkEvents() {
            l.default.addListener(l.DkEventNS.taskCompleted, t => {
                this.onTaskCompleted(t)
            }), l.default.addListener(l.DkEventNS.taskRemoved, t => {
                this.onTaskRemoved(t)
            }), l.default.addListener(l.DkEventNS.downloadItemActive, this.onDownloadItemActive.bind(this))
        }

        clear() {
            this.mSession.clear(), o.default.clear()
        }

        refresh() {
            let t = c.default.getValue("VipDownload", "SceneChangeInterval"), e = this.mSelectTaskId,
                i = this.mRefreshTime, n = d.default.currentTime;
            e && i && n - i >= t && this.changeToNextScene(e)
        }

        activeTask(t) {
            p.info("pushgs_log activeTask taskId = ", t);
            let e = o.default.getTask(t);
            if (p.info("pushgs_log task=", e), e) this.changeToNextScene(t); else {
                let e = h.default.abTest, i = f.default.getSceneData();
                if (e && i.length > 0) {
                    p.info("pushgs_log 走B接口");
                    let e = {itemDatas: i};
                    p.info("pushgs_log ：response = ", e), o.default.createTaskB(t, e).then(() => {
                        this.changeToNextScene(t)
                    }).catch()
                } else p.info("pushgs_log 走A接口"), this.mSession.queryTask(t, i => n(this, void 0, void 0, function* () {
                    i ? (i.isBDefault = e, p.info("response = ", i.itemDatas), yield o.default.createTask(t, i), this.changeToNextScene(t)) : (p.info("pushgs_log 走默认场景"), this.clear(), this.emit(g.taskSceneChanged, t, null))
                }))
            }
        }

        changeToNextScene(t) {
            if (this.mSelectTaskId === t) {
                p.info("changeToNextScene", t);
                let e = o.default.getTask(t);
                if (e) {
                    let i = e.getItem();
                    i && (this.emit(g.taskSceneChanged, t, i), p.info("item.text", i.text)), e.next()
                }
                this.mRefreshTime = d.default.currentTime
            }
        }

        onTaskRemoved(t) {
            this.removeTask(t)
        }

        onTaskCompleted(t) {
            this.removeTask(t)
        }

        removeTask(t) {
            o.default.deleteTask(t), this.mSession.removeTask(t), this.mSelectTaskId === t && (this.mSelectTaskId = void 0, this.mRefreshTime = void 0)
        }
    }

    e.SceneManager = S, e.default = new S
}, function (t, e) {
    (function () {
        t.exports = function () {
            function t(t, e, i) {
                if (this.options = t.options, this.stringify = t.stringify, null == e) throw new Error("Missing attribute name of element " + t.name);
                if (null == i) throw new Error("Missing attribute value for attribute " + e + " of element " + t.name);
                this.name = this.stringify.attName(e), this.value = this.stringify.attValue(i)
            }

            return t.prototype.clone = function () {
                return Object.create(this)
            }, t.prototype.toString = function (t) {
                return this.options.writer.set(t).attribute(this)
            }, t
        }()
    }).call(this)
}, function (t, e) {
    (function () {
        var e = function (t, e) {
            return function () {
                return t.apply(e, arguments)
            }
        }, i = {}.hasOwnProperty;
        t.exports = function () {
            function t(t) {
                var n, a, s;
                for (n in this.assertLegalChar = e(this.assertLegalChar, this), t || (t = {}), this.noDoubleEncoding = t.noDoubleEncoding, a = t.stringify || {}) i.call(a, n) && (s = a[n], this[n] = s)
            }

            return t.prototype.eleName = function (t) {
                return t = "" + t || "", this.assertLegalChar(t)
            }, t.prototype.eleText = function (t) {
                return t = "" + t || "", this.assertLegalChar(this.elEscape(t))
            }, t.prototype.cdata = function (t) {
                return t = (t = "" + t || "").replace("]]>", "]]]]><![CDATA[>"), this.assertLegalChar(t)
            }, t.prototype.comment = function (t) {
                if ((t = "" + t || "").match(/--/)) throw new Error("Comment text cannot contain double-hypen: " + t);
                return this.assertLegalChar(t)
            }, t.prototype.raw = function (t) {
                return "" + t || ""
            }, t.prototype.attName = function (t) {
                return "" + t || ""
            }, t.prototype.attValue = function (t) {
                return t = "" + t || "", this.attEscape(t)
            }, t.prototype.insTarget = function (t) {
                return "" + t || ""
            }, t.prototype.insValue = function (t) {
                if ((t = "" + t || "").match(/\?>/)) throw new Error("Invalid processing instruction value: " + t);
                return t
            }, t.prototype.xmlVersion = function (t) {
                if (!(t = "" + t || "").match(/1\.[0-9]+/)) throw new Error("Invalid version number: " + t);
                return t
            }, t.prototype.xmlEncoding = function (t) {
                if (!(t = "" + t || "").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) throw new Error("Invalid encoding: " + t);
                return t
            }, t.prototype.xmlStandalone = function (t) {
                return t ? "yes" : "no"
            }, t.prototype.dtdPubID = function (t) {
                return "" + t || ""
            }, t.prototype.dtdSysID = function (t) {
                return "" + t || ""
            }, t.prototype.dtdElementValue = function (t) {
                return "" + t || ""
            }, t.prototype.dtdAttType = function (t) {
                return "" + t || ""
            }, t.prototype.dtdAttDefault = function (t) {
                return null != t ? "" + t || "" : t
            }, t.prototype.dtdEntityValue = function (t) {
                return "" + t || ""
            }, t.prototype.dtdNData = function (t) {
                return "" + t || ""
            }, t.prototype.convertAttKey = "@", t.prototype.convertPIKey = "?", t.prototype.convertTextKey = "#text", t.prototype.convertCDataKey = "#cdata", t.prototype.convertCommentKey = "#comment", t.prototype.convertRawKey = "#raw", t.prototype.assertLegalChar = function (t) {
                var e;
                if (e = t.match(/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/)) throw new Error("Invalid character in string: " + t + " at index " + e.index);
                return t
            }, t.prototype.elEscape = function (t) {
                var e;
                return e = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g, t.replace(e, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\r/g, "&#xD;")
            }, t.prototype.attEscape = function (t) {
                var e;
                return e = this.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g, t.replace(e, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;").replace(/\t/g, "&#x9;").replace(/\n/g, "&#xA;").replace(/\r/g, "&#xD;")
            }, t
        }()
    }).call(this)
}, function (t, e) {
    (function () {
        var e = {}.hasOwnProperty;
        t.exports = function () {
            function t(t) {
                var i, n, a, s, o, r, l, u, c;
                for (i in t || (t = {}), this.pretty = t.pretty || !1, this.allowEmpty = null != (n = t.allowEmpty) && n, this.pretty ? (this.indent = null != (a = t.indent) ? a : "  ", this.newline = null != (s = t.newline) ? s : "\n", this.offset = null != (o = t.offset) ? o : 0, this.dontprettytextnodes = null != (r = t.dontprettytextnodes) ? r : 0) : (this.indent = "", this.newline = "", this.offset = 0, this.dontprettytextnodes = 0), this.spacebeforeslash = null != (l = t.spacebeforeslash) ? l : "", !0 === this.spacebeforeslash && (this.spacebeforeslash = " "), this.newlinedefault = this.newline, this.prettydefault = this.pretty, u = t.writer || {}) e.call(u, i) && (c = u[i], this[i] = c)
            }

            return t.prototype.set = function (t) {
                var i, n, a;
                for (i in t || (t = {}), "pretty" in t && (this.pretty = t.pretty), "allowEmpty" in t && (this.allowEmpty = t.allowEmpty), this.pretty ? (this.indent = "indent" in t ? t.indent : "  ", this.newline = "newline" in t ? t.newline : "\n", this.offset = "offset" in t ? t.offset : 0, this.dontprettytextnodes = "dontprettytextnodes" in t ? t.dontprettytextnodes : 0) : (this.indent = "", this.newline = "", this.offset = 0, this.dontprettytextnodes = 0), this.spacebeforeslash = "spacebeforeslash" in t ? t.spacebeforeslash : "", !0 === this.spacebeforeslash && (this.spacebeforeslash = " "), this.newlinedefault = this.newline, this.prettydefault = this.pretty, n = t.writer || {}) e.call(n, i) && (a = n[i], this[i] = a);
                return this
            }, t.prototype.space = function (t) {
                var e;
                return this.pretty && (e = (t || 0) + this.offset + 1) > 0 ? new Array(e).join(this.indent) : ""
            }, t
        }()
    }).call(this)
}, function (t, e) {
    (function () {
        "use strict";
        var t;
        t = new RegExp(/(?!xmlns)^.*:/), e.normalize = function (t) {
            return t.toLowerCase()
        }, e.firstCharLowerCase = function (t) {
            return t.charAt(0).toLowerCase() + t.slice(1)
        }, e.stripPrefix = function (e) {
            return e.replace(t, "")
        }, e.parseNumbers = function (t) {
            return isNaN(t) || (t = t % 1 == 0 ? parseInt(t, 10) : parseFloat(t)), t
        }, e.parseBooleans = function (t) {
            return /^(?:true|false)$/i.test(t) && (t = "true" === t.toLowerCase()), t
        }
    }).call(this)
}, , , , , , , function (t, e, i) {
    t.exports = i(210)
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(1), s = a.default.pluginWebviewName, o = i(2);
    o.client.start({name: s, version: a.default.pluginVersion}, "thunder"), a.default.init(), i(52);
    const r = i(0).default.getLogger("VipDownload:main");
    r.info("init"), i(211).PluginFunctionNS.registerPluginFunction(), i(257).NativeFunctionNS.registerNativeFunction(), i(50).default.init().catch();
    const l = i(87);
    i(317);
    const u = i(258);
    i(278), i(279), i(280), i(283);
    const c = i(20), d = i(285), h = i(93), f = i(3), p = i(153), g = i(26), S = i(191), y = i(43), T = i(286),
        k = i(5), m = i(54), v = i(152);
    i(287), S.default.init().catch(), m.default.init(g.default), function (t) {
        return n(this, void 0, void 0, function* () {
            if (t) return function () {
                return n(this, void 0, void 0, function* () {
                    c.BaoTuanSettingNS.setTeamEnteranceSwitch(!0).catch(), c.BaoTuanSettingNS.setShowTips(!1).catch(), c.BaoTuanSettingNS.setLoginNeed(!1);
                    let t = yield o.client.callServerFunction("IsLogined");
                    c.BaoTuanSettingNS.checkLogin(t) && c.BaoTuanSettingNS.AddConfigSet(), c.BaoTuanSettingNS.WatchConfigValue(), d.ExternalFunctionNS.registerExternalFunction(), c.BaoTuanSettingNS.setShowTeamEnterance(10), c.BaoTuanSettingNS.WatchUserStatus(), c.BaoTuanSettingNS.setTeamEntranceBelowTask(!0)
                })
            }();
            c.BaoTuanSettingNS.InitTeamSwitch().catch();
            let e = yield h.default.config();
            e && 0 === e.result && c.BaoTuanSettingNS.setBaotuanConfig(e);
            let i = 10, a = setInterval(() => n(this, void 0, void 0, function* () {
                let t = yield function () {
                    return n(this, void 0, void 0, function* () {
                        let t = yield h.default.entrance(), e = !1;
                        if (t) if (55 === t.result) c.BaoTuanSettingNS.setTeamEnteranceSwitch(!1).catch(), c.BaoTuanSettingNS.setShowTips(!1).catch(), e = !0; else if (0 === t.result) {
                            e = !0;
                            let i = yield c.BaoTuanSettingNS.getShowTeamEnteranceLastDate(),
                                n = (new Date).toDateString();
                            c.BaoTuanSettingNS.GetBaotuanSwitch() && (yield c.BaoTuanSettingNS.getHaveShowNoviceGuid()) && n === i || c.BaoTuanSettingNS.setShowTeamEnterance(t.showSeamEntranceTimes), c.BaoTuanSettingNS.setTeamEnteranceSwitch(!0).catch(), c.BaoTuanSettingNS.setShowTips(1 === t.showPcSqueezeOutTeamTips).catch(), c.BaoTuanSettingNS.setLoginNeed(0 === t.supportNotLogin);
                            let a = yield o.client.callServerFunction("IsLogined");
                            c.BaoTuanSettingNS.checkLogin(a) && c.BaoTuanSettingNS.AddConfigSet(), c.BaoTuanSettingNS.setBaotuanEntrance(t), c.BaoTuanSettingNS.setTeamEntranceBelowTask(1 === t.teamEntranceBelowTask), c.BaoTuanSettingNS.setBelowTaskClickAB(t.taskEntranceSwitch), c.BaoTuanSettingNS.setkickOutTaskAB(t.quitNotifySwitch), c.BaoTuanSettingNS.setPriorityInner(t.tagPriorityInner), c.BaoTuanSettingNS.setPriorityOut(t.tagPriorityOut), c.BaoTuanSettingNS.setFirstTeamEffectt(t.firstTeamEffect), c.BaoTuanSettingNS.WatchConfigValue(), d.ExternalFunctionNS.registerExternalFunction(), c.BaoTuanSettingNS.WatchUserStatus()
                        } else e = !1; else r.info("QueryTeamEntrance error"), c.BaoTuanSettingNS.setTeamEnteranceSwitch(!1).catch(), c.BaoTuanSettingNS.setShowTips(!1).catch();
                        return e
                    })
                }();
                o.client.callServerFunction("FireEventFunction", "ShowBaoTuanEnterance", t, c.BaoTuanSettingNS.isLoginNeed()).catch(), (t || --i < 1) && clearInterval(a)
            }), 1e3)
        })
    }(!1).catch(), y.default.init().catch(), T.AdPlatformNS.init(), p.SpeedZeroDataBaseNS.initTable(f.default.userId).catch(), setTimeout(() => n(this, void 0, void 0, function* () {
        if (yield v.SpeedZero.initConfig(), !v.SpeedZero.getSwitch()) return;
        let t = yield o.client.callServerFunction("GetCategoryViewTaskList", "Downloading");
        for (let e = 0; e < t.length; ++e) {
            let i = t[e];
            (yield p.SpeedZeroDataBaseNS.isTaskCreate(i)) && g.default.createTask(i).catch(), e % 20 == 0 && (yield k.ThunderUtil.sleep(5e3))
        }
    }), 2e3), new l.default({components: {App: u.default}, render: t => t("app")}).$mount("#app")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(8), o = i(7), r = i(30), l = i(21), u = i(20), c = i(151), d = i(26),
        h = i(5), {isUndef: f} = h.ThunderUtil, p = i(0), g = i(43), S = i(86), y = i(27), T = i(256), k = i(54),
        m = p.default.getLogger("VipDownload:plugin-function");
    !function (t) {
        const e = new class {
            constructor() {
                this.isRegister = !1
            }

            registerPluginFunction() {
                if (!this.isRegister) {
                    this.isRegister = !0;
                    let t = {
                        GetVipTaskInfo: this.getVipTaskInfo,
                        GetVipSubTaskInfo: this.getVipSubTaskInfo,
                        GetVipSpeedColor: this.getVipSpeedColor,
                        GetContextMenuExtra: this.getContextMenuExtra,
                        ClickTryAcclerateBtn: this.clickTryAcclerateBtn,
                        SetAutoJoinCutLine: this.setAutoJoinCutLine,
                        SetNeedShowRecommendAuto: this.setNeedShowRecommendAuto,
                        OpenPayVipUrl: this.openPayVipUrl,
                        GetPackageTryState: this.getPackageTryState,
                        GetPackageTryPlayNum: this.getPackageTryPlayNum,
                        ClearPackageTry: this.clearPackageTry,
                        ClickPackagetry: this.clickPackageTry,
                        ClickAfterPackageTry: this.clickAfterPackageTry,
                        PackageTryingClickOpenVip: this.packageTryingClickOpenVip,
                        PackageTryingXgtShow: this.packageTryingXgtShow,
                        PackageAfterXgtShow: this.packageAfterXgtShow,
                        ExitPackageTryXgt: this.exitPackageTryXgt,
                        GetDownloadingTaskCount: this.getDownloadingTaskCount,
                        GetAdvertPayData: this.getAdvertPayData,
                        CloudShowSpeedXgt: this.cloudShowSpeedXgt,
                        CloudClickSpeedXgt: this.cloudClickSpeedXgt,
                        CloudShowWaittingXgt: this.cloudShowWaittingXgt,
                        CloudClickWaittingXgt: this.cloudClickWaittingXgt,
                        GetCloudDownloadTaskLimit: this.getCloudDownloadTaskLimit
                    };
                    a.client.registerFunctions(t), a.client.callServerFunctionEx("RegisterMenuEvent", 3).catch();
                    let e = {IsPayVipByDialog: this.isPayVipByDialog, OpenPayVipUrl: this.openPayVipUrlExternal};
                    a.client.callServerFunction("RegisterWebExternal", e).catch()
                }
            }

            getVipTaskInfo(t, ...e) {
                let i = null;
                do {
                    if (f(e) || f(e[0])) break;
                    let t = e[0];
                    i = l.default.getVipTaskInfo(t)
                } while (0);
                return i
            }

            getVipSubTaskInfo(t, ...e) {
                let i = null;
                do {
                    if (f(e) || f(e[0]) || f(e[1])) break;
                    let t = e[0], n = e[1];
                    i = l.default.getVipSubTaskInfo(t, n)
                } while (0);
                return i
            }

            getVipSpeedColor(t, ...e) {
                let i = void 0;
                do {
                    if (f(e) || f(e[0])) break;
                    let t = e[0], n = c.TryTaskDataBaseNS.getTask(t),
                        a = n && n.tryType === s.VipDownloadDefineNS.TryType.MixVip, o = l.default.getVipTaskInfo(t);
                    a || o && o.isMixTry ? i = o.isShowSuperSpeed ? 2 : o.isShowVipSpeed ? 1 : 0 : n && n.tryType === s.VipDownloadDefineNS.TryType.SuperVip && o.isShowSuperSpeed && (i = 2)
                } while (0);
                return i
            }

            getContextMenuExtra(t, ...e) {
                let i = [];
                do {
                    if (f(e) || f(e[0]) || f(e[1]) || f(e[2])) break;
                    if (e[1] !== o.DownloadKernel.CategroyViewID.Downloading) break;
                    let t = e[2];
                    if (t.length > 0) {
                        let e = r.default.getVipAccelerateMenuState(t);
                        i.push(e)
                    }
                    if (1 === t.length) {
                        let e = !1, n = !0;
                        {
                            let i = d.default.getTask(t[0].taskId);
                            i && ((e = i.getVipTask().getBaotuanOperation().canShowBaotuanEnterance()) || (n = t[0].taskStatus === o.DownloadKernel.TaskStatus.Failed) || (e = !0))
                        }
                        if (e) {
                            let e = r.default.getBaoTuanMenuState(t, n);
                            i.push(e)
                        }
                    }
                } while (0);
                return i
            }

            clickTryAcclerateBtn(t, ...e) {
                do {
                    if (f(e) || f(e[0])) break;
                    let t = e[0], i = e[1];
                    r.default.clickTryAcclerateBtn(t, null, i)
                } while (0)
            }

            setAutoJoinCutLine(t, ...e) {
                m.info("setAutoJoinCutLine", t, e);
                do {
                    if (f(e) || f(e[0])) break;
                    let t = e[0], i = e[1];
                    u.BaoTuanSettingNS.SetAutoJoinCutLine(t, i).catch()
                } while (0)
            }

            setNeedShowRecommendAuto(t, ...e) {
                m.info("setNeedShowRecommendAuto", t, e), u.BaoTuanSettingNS.SetNeedShowRecommendAuto().catch()
            }

            openPayVipUrl(t, ...e) {
                m.info("openPayVipUrl", t, e), r.default.openPayVipUrl(e[0]).catch()
            }

            openPayVipUrlExternal(...t) {
                m.info("openPayVipUrlExternal", t), r.default.openPayVipUrl(t[0]).catch()
            }

            getPackageTryState(t, ...e) {
                return m.info("getPackageTryState", t, e), g.default.packageState
            }

            getPackageTryPlayNum(t, ...e) {
                return m.info("getPackageTryPlayNum", t, e), g.default.packageTryPlayNum
            }

            clearPackageTry(t) {
                g.default.clear(t)
            }

            clickPackageTry(t, ...e) {
                m.info("clickPackagetry", t, e);
                let i = null;
                e.length > 1 && (i = d.default.getTask(e[1])), g.default.beginPackageTry(e[0], i).catch()
            }

            clickAfterPackageTry(t, ...e) {
                return n(this, void 0, void 0, function* () {
                    m.info("clickAfterPackageTry", t, e), S.PackageTryStatNS.afterClick(e[0], yield g.default.downloadNum(), g.default.accNum, g.default.groupNum, g.default.accBcNum, g.default.beforeSpeed, g.default.ingSpeed, g.default.isSurperPackget, g.default.isHaveCloudTask).catch()
                })
            }

            exitPackageTryXgt(t, ...e) {
                return n(this, void 0, void 0, function* () {
                    g.default.exitPackageTryXgt()
                })
            }

            getDownloadingTaskCount() {
                return l.default.getDownlodaingTaskCount()
            }

            isPayVipByDialog(t, ...e) {
                return n(this, void 0, void 0, function* () {
                    let t = yield r.default.isPayVipByDialog();
                    return m.info("isPayVipByDialog", t), t
                })
            }

            getAdvertPayData(t, ...e) {
                return n(this, void 0, void 0, function* () {
                    return e.length < 4 ? null : y.default.getData(e[0], e[1], e[2], e[3])
                })
            }

            packageTryingClickOpenVip(t, ...e) {
                return n(this, void 0, void 0, function* () {
                    S.PackageTryStatNS.tryingClick(yield g.default.downloadNum(), g.default.accNum, g.default.groupNum, g.default.accBcNum, g.default.beforeSpeed, !0, g.default.isSurperPackget, g.default.isHaveCloudTask).catch()
                })
            }

            packageTryingXgtShow(t, ...e) {
                return n(this, void 0, void 0, function* () {
                    setTimeout(() => n(this, void 0, void 0, function* () {
                        let t = yield g.default.downloadNum();
                        S.PackageTryStatNS.tryingShow(t, g.default.accNum, g.default.groupNum, g.default.accBcNum, g.default.beforeSpeed, !0, g.default.isSurperPackget, g.default.isHaveCloudTask).catch()
                    }), 5e3)
                })
            }

            packageAfterXgtShow() {
                return n(this, void 0, void 0, function* () {
                    S.PackageTryStatNS.afterShow("xgt", yield g.default.downloadNum(), g.default.accNum, g.default.groupNum, g.default.accBcNum, g.default.beforeSpeed, g.default.ingSpeed, g.default.gcidSet, g.default.isSurperPackget, g.default.isHaveCloudTask).catch()
                })
            }

            cloudShowSpeedXgt(t, ...e) {
                T.CloudTaskStatNS.showSpeed(e[0]).catch()
            }

            cloudClickSpeedXgt(t, ...e) {
                T.CloudTaskStatNS.clickSpeed(e[0]).catch(), k.default.clickDownloading = !0
            }

            cloudShowWaittingXgt(t, ...e) {
                T.CloudTaskStatNS.showTaskCount(e[0], k.default.waittingCount).catch()
            }

            cloudClickWaittingXgt(t, ...e) {
                T.CloudTaskStatNS.clickTaskCount(e[0], k.default.waittingCount).catch(), k.default.clickWaitting = !0
            }

            getCloudDownloadTaskLimit(t, ...e) {
                return k.default.getCloudClassLimit()
            }
        };
        t.registerPluginFunction = function () {
            e.registerPluginFunction()
        }
    }(e.PluginFunctionNS || (e.PluginFunctionNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(8), o = i(150), r = i(3), l = i(5), u = i(54), c = i(43);
    e.VipTaskCloud = class extends o.VipTaskBase {
        constructor(t, e) {
            super(t, e);
            let i = {xgtState: s.VipDownloadDefineNS.XgtState.Unkown, args: null};
            this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.CloudDownloading, i), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.CloudWaiting, i), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.PackageTry, i), setTimeout(() => {
                this.updateVipTaskInfo()
            }, 5)
        }

        createVipTaskInfo() {
            let t = null, e = this.task.getTaskBase(), i = "";
            if (e) if (e.taskType === a.DownloadKernel.TaskType.Bt) {
                let t = this.task.getTaskDetail();
                t && (i = t.infoId)
            } else i = e.gcid;
            let n = c.default.packageRuning && c.default.isCloudAcclerating(this.taskId) && this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started;
            return (t = {
                xgtType: this.getShowedXgt(),
                taskType: s.VipDownloadDefineNS.VipTaskType.NoVip,
                isSuper: !1,
                taskStatus: s.VipDownloadDefineNS.VipTaskStatus.Unkown,
                isShowVipSpeed: !1,
                isShowSuperSpeed: !1,
                isShowSuperSpeedEx: !1,
                error: null,
                allSubTaskDcdnError: !1,
                isAcclerated: !1,
                careKuaiNiao: !1,
                showKuaiNiao: !1,
                kuaiNiaoStatus: null,
                enterType: s.VipDownloadDefineNS.VipTaskType.NoVip,
                enterStatus: s.VipDownloadDefineNS.VipTaskStatus.Unkown,
                isContinued: !1,
                isPartialForbid: !1,
                isMixTry: !1,
                trySection: void 0,
                baotuanDetail: null,
                taskBelowSrcImg: "",
                taskBelowHoverTip: "",
                gcid: i,
                speedZeroState: null,
                packagetrying: n,
                surperPackage: c.default.isSurperPackget,
                packageTryState: c.default.packageState,
                isCloudTask: !0,
                isPlayAndDownload: c.default.isBeginFromPlay,
                isHResource: !1
            }).xgtType === s.VipDownloadDefineNS.XgtType.CloudDownloading ? (t.taskBelowSrcImg = l.ThunderUtil.getStaticPath() + "/img/icon-speed.png", t.taskBelowHoverTip = "") : t.xgtType === s.VipDownloadDefineNS.XgtType.CloudWaiting ? (t.taskBelowSrcImg = `${l.ThunderUtil.getStaticPath()}/img/${r.default.isVip ? "icon-super" : "icon-vip"}.png`, t.taskBelowHoverTip = "") : (t.taskBelowSrcImg = "", t.taskBelowHoverTip = ""), this.vipTaskInfo = t, this.logger.info("createVipTaskInfo", t), t
        }

        remove() {
            o.VipTaskBase.updateDeleayTick(1e3);
            let t = new Array;
            o.VipTaskBase.sVipTasArray.forEach(e => {
                e !== this && t.push(e)
            }), o.VipTaskBase.sVipTasArray = t, this.clear(), c.default.delPackageTryTask(this.task, this.logger, "remove").catch()
        }

        clear() {
        }

        tryActiveAllXgt(t) {
            return n(this, void 0, void 0, function* () {
            })
        }

        onExpand() {
            u.default.onExpand(this.taskId, this).catch()
        }

        onUserAuthorityChanged(t, e) {
            return n(this, void 0, void 0, function* () {
                this.updateVipTaskInfo(), this.sectionSpeed.onUserAuthorityChanged(t)
            })
        }

        onTaskStatusChanged(t) {
            return n(this, void 0, void 0, function* () {
                switch (this.sectionSpeed.onTaskStatusChanged(t), u.default.onTaskStatusChanged(this.taskId, this, t).catch(), t) {
                    case a.DownloadKernel.TaskStatus.Started:
                        c.default.packageRuning ? c.default.addPackageTryTask(this.task, this.logger).catch() : this.tryShowPackageTry();
                        break;
                    case a.DownloadKernel.TaskStatus.Succeeded:
                        c.default.delPackageTryTask(this.task, this.logger, "Succeeded").catch()
                }
            })
        }

        show(t, e) {
            return !1
        }

        commit(t, e) {
            return n(this, void 0, void 0, function* () {
            })
        }

        commitPackageTryToken(t, e, i) {
            return n(this, void 0, void 0, function* () {
            })
        }

        fail(t, e, i) {
        }

        finish(t) {
        }

        onTaskVipEnterTypeChanged(t) {
        }

        enter() {
        }

        forceEnterVip() {
        }

        exit() {
        }

        getVipTaskType() {
            return null
        }

        getVipEnterType() {
            return null
        }

        getVipTaskStatus() {
            return null
        }

        getVipSubTaskInfo(t) {
            return null
        }

        getAllVipSubTaskInfo() {
            return null
        }

        getTryDetail() {
            return null
        }

        getStatusData(t) {
            return null
        }

        getTokenData(t) {
            return null
        }

        getOperation(t) {
            return null
        }

        getBaotuanDetail() {
            return null
        }

        getBaotuanDetailSt() {
            return null
        }

        getBaotuanOperation() {
            return null
        }

        getGameOperation() {
            return null
        }

        unAcclerate(t, e) {
            return null
        }

        onBaotuanStateChange(t) {
            return null
        }

        onPackageStateChangeCallBack(t) {
            return n(this, void 0, void 0, function* () {
            })
        }

        tryShowPackageTry() {
            c.default.tryShowPackageTry(this.task, this.logger).catch()
        }
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    e.TaskCache = class {
        constructor() {
            this.mSelectId = void 0, this.mTrialKey = void 0, this.mTrialVerify = void 0, this.mPlatinumVerify = void 0, this.mExpireTime = void 0, this.mCreateTime = void 0, this.mError = null, this.mCommited = !1, this.mTrySection = void 0, this.mIsAdUser = !1, this.mLeftCount = void 0, this.mCommitData = null
        }

        get subId() {
            return this.mSelectId
        }

        set subId(t) {
            this.mSelectId = t
        }

        set type(t) {
            this.mType = t
        }

        get type() {
            return this.mType
        }

        set trialKey(t) {
            this.mTrialKey = t
        }

        get trialKey() {
            return this.mTrialKey
        }

        set expireTime(t) {
            this.mExpireTime = t
        }

        get expireTime() {
            return this.mExpireTime
        }

        set createTime(t) {
            this.mCreateTime = t
        }

        get createTime() {
            return this.mCreateTime
        }

        set trialVerify(t) {
            this.mTrialVerify = t
        }

        get trialVerify() {
            return this.mTrialVerify
        }

        set platinumVerify(t) {
            this.mPlatinumVerify = t
        }

        get platinumVerify() {
            return this.mPlatinumVerify
        }

        set commited(t) {
            this.mCommited = t
        }

        get commited() {
            return this.mCommited
        }

        set trySection(t) {
            this.mTrySection = t
        }

        get trySection() {
            return this.mTrySection
        }

        set isAdUser(t) {
            this.mIsAdUser = t
        }

        get isAdUser() {
            return this.mIsAdUser
        }

        set error(t) {
            this.mError = t
        }

        get error() {
            return this.mError
        }

        set leftCount(t) {
            this.mLeftCount = t
        }

        get leftCount() {
            return this.mLeftCount
        }

        set commitData(t) {
            this.mCommitData = t
        }

        get commitData() {
            return this.mCommitData
        }
    }
}, function (t, e) {
    t.exports = require("querystring")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(31), s = i(5), o = i(1);
    let {isDef: r} = s.ThunderUtil;
    e.ErrorCodeConfigEx = class {
        constructor() {
            this.codeMap = new Map, this.codes = null
        }

        init() {
            return n(this, void 0, void 0, function* () {
                let t = yield this.getConfigs();
                t && 0 === t.result && t.task_info && t.task_info.pc_client && (this.codes = t.task_info.pc_client)
            })
        }

        getMessage(t, e) {
            let i = void 0, n = this.codeMap.get(t);
            return n && (i = n.get(e)), i
        }

        getData(t) {
            let e = void 0;
            return this.codes && this.codes[t] && (e = JSON.stringify(this.codes[t])), e
        }

        getConfigs() {
            return n(this, void 0, void 0, function* () {
                let t = o.default.thunderVersionNumber, e = Math.floor((new Date).getTime() / 1e3), n = Math.random(),
                    l = "!@#$%^&*()QAZxl_pc" + t + e + n;
                const u = `http://download.code.lixian.vip.xunlei.com/errcode?${"client_name=xl_pc&client_version=" + t + "&ts=" + e + "&r=" + n + "&key=" + (l = (l = s.ThunderUtil.genarateMd5(l)).toUpperCase())}`;
                let c = null;
                try {
                    a.default.defaults.adapter = i(25);
                    let t = yield a.default.get(u, {timeout: 15e3});
                    200 === t.status && r(t.data) && t.data instanceof Object && (c = t.data)
                } catch (t) {
                }
                return c
            })
        }
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(7), a = i(8), s = i(1), o = i(5), {isDef: r, isUndef: l} = o.ThunderUtil,
        u = i(0).default.getLogger("VipDownload:task-section-speed");
    e.TaskSectionSpeed = class {
        constructor(t) {
            this.mUseTime = 0, this.mTask = t
        }

        start() {
            u.info("start");
            let t = this.mTask.getTaskBase();
            if (t) {
                if (l(this.mStartSize)) {
                    let e = t.receiveSize || 0;
                    this.mStartSize = e || 0
                }
                this.mStartTime = s.default.currentTime, this.mUseTime = this.mUseTime || 0, u.info("startSize", this.mStartSize, "startTime", this.mStartTime, "useTime", this.mUseTime)
            }
        }

        pause() {
            if (u.info("pause"), r(this.mStartTime)) {
                let t = s.default.currentTime - this.mStartTime;
                this.mUseTime = this.mUseTime + t
            }
            this.mStartTime = void 0, u.info("startSize", this.mStartSize, "startTime", this.mStartTime, "useTime", this.mUseTime)
        }

        reset() {
            u.info("reset"), this.mStartSize = void 0, this.mStartTime = void 0, this.mUseTime = 0;
            let t = this.mTask.getTaskBase();
            t && t.taskStatus === n.DownloadKernel.TaskStatus.Started && this.start()
        }

        get speed() {
            let t = {size: 0, time: 0}, e = this.mTask.getTaskBase();
            if (!e || l(this.mStartSize)) return t;
            if (this.mStartTime) {
                let t = s.default.currentTime - this.mStartTime;
                this.mUseTime = this.mUseTime + t
            }
            let i = e.receiveSize || 0, n = Math.max(i - this.mStartSize, 0);
            return u.info("calculateSpeed", "receiveSize", i, "useSize", n, "useTime", this.mUseTime), t = {
                size: n,
                time: this.mUseTime
            }
        }

        onUserAuthorityChanged(t) {
            let e = this.mTask.getVipTask().getVipTaskInfo();
            e && e.taskStatus > a.VipDownloadDefineNS.VipTaskStatus.Init || this.reset()
        }

        onTaskStatusChanged(t) {
            switch (t) {
                case n.DownloadKernel.TaskStatus.Started:
                    this.start();
                    break;
                case n.DownloadKernel.TaskStatus.Stopped:
                    this.pause()
            }
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(15), o = i(190), r = i(3), l = i(1), u = i(0).default.getLogger("VipDownload:speedzero");

    class c extends s.HttpSession {
        queryConfig() {
            return n(this, void 0, void 0, function* () {
                let t = ++c.sequence, e = r.default.userId, i = yield r.default.getSessionId(),
                    n = l.default.currentTime, s = yield a.HttpJsonCryptoNS.getUriParam(t, n);
                return this.retries = 2, this.timeout = 2e4, this.host = "entrust.download.lixian.vip.xunlei.com", this.path = "/config?" + s + "&peer_id=" + (yield r.default.getPeerId()), this.auth = a.HttpJsonCryptoNS.getAuthorization(e, i), this.accept = a.HttpJsonCryptoNS.getAccept(), new Promise(t => {
                    this.get(e => {
                        let i = null;
                        200 === e.statusCode && (i = o.SpeedZeroHttpPackageNS.parseConfigResponse(e.body), u.info("queryConfig response:", i)), t(i)
                    }, e => {
                        u.info("error", e), t(null)
                    })
                })
            })
        }

        queryCreate(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++c.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = l.default.currentTime, d = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                return this.retries = 2, this.timeout = 2e4, this.host = "entrust.download.lixian.vip.xunlei.com", this.path = "/task/create?" + d, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.peerId = yield r.default.getPeerId(), this.body = yield o.SpeedZeroHttpPackageNS.createQueryBuffer(t), u.info("queryCreate", t), new Promise(e => {
                    this.post(n => {
                        let a = null;
                        if (u.info("queryCreate response:", n), r.default.userId === t.userId) {
                            let t = n.headers["random-num"];
                            if (200 === n.statusCode && n.body && t) {
                                let e = Number(t).valueOf();
                                a = o.SpeedZeroHttpPackageNS.praseCreateBuffer(i, e, n.body)
                            }
                        }
                        e(a)
                    }, t => {
                        u.info("error", t), e(null)
                    })
                })
            })
        }

        queryState(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++c.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = l.default.currentTime, d = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                return this.retries = 2, this.timeout = 2e4, this.host = "entrust.download.lixian.vip.xunlei.com", this.path = "/task/state?" + d, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.peerId = yield r.default.getPeerId(), this.body = yield o.SpeedZeroHttpPackageNS.createQueryBuffer(t), u.info("queryState", t), new Promise(e => {
                    this.post(n => {
                        let a = null;
                        if (u.info("queryState response:", n), r.default.userId === t.userId) {
                            let t = n.headers["random-num"];
                            if (u.info("random", t), 200 === n.statusCode && n.body && t) {
                                let e = Number(t).valueOf();
                                a = o.SpeedZeroHttpPackageNS.praseStateBuffer(i, e, n.body)
                            }
                        }
                        e(a)
                    }, t => {
                        u.info("error", t), e(null)
                    })
                })
            })
        }
    }

    c.sequence = 0, e.SpeedZeroHttpSession = c
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(16), a = i(3), s = i(1);
    !function (t) {
        function e() {
            let t = new Map, e = function () {
                let t = 0;
                a.default.isLogin && (t = 1);
                return t
            }(), i = function () {
                let t = 0;
                a.default.isVip && (t = 1);
                return t
            }(), n = function () {
                let t = 0;
                a.default.isSuperVip ? t = 5 : a.default.isPlatinumVip ? t = 3 : a.default.isVip && (t = 2);
                return t
            }();
            return t.set("is_login", e), t.set("is_vip", i), t.set("vip_type", n), t.set("vip_dl_plugin_version", s.default.pluginVersion), t.set("web_plugin_version", s.default.webPluginVersion), t
        }

        t.taskMeetConditions = function (t, i) {
            let a = e();
            a.set("gcid", t), a.set("url", i);
            let s = {attribute1: "entrust_dl_task_meet_conditions", extData: a};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
        }, t.showCdnReady = function (t, i) {
            let a = e();
            a.set("gcid", t), a.set("url", i), a.set("state", "succ");
            let s = {attribute1: "entrust_dl_right_up_point_show", extData: a};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
        }, t.showTaskCard = function (t, i, a) {
            let s = e();
            s.set("gcid", t), s.set("type", i), s.set("url", a);
            let o = {attribute1: "entrust_dl_task_card_show", extData: s};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", o).catch()
        }, t.downLoadFinish = function (t, i, a) {
            let s = e();
            s.set("gcid", t), s.set("avg_speed", i), s.set("url", a);
            let o = {attribute1: "entrust_dl_task_dl_finish", extData: s};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", o).catch()
        }, t.addToRemind = function (t, i, a) {
            let s = e();
            s.set("gcid", t), s.set("url", i), s.set("status", a);
            let o = {attribute1: "entrust_dl_task_add_to_remind", extData: s};
            n.StatUtilitiesNS.trackEvent("xlx_vip_event", o).catch()
        }
    }(e.SpeedZeroStatNS || (e.SpeedZeroStatNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(8), o = i(220), r = i(223), l = i(150), u = i(225), c = i(3),
        d = i(5), {isDef: h} = d.ThunderUtil, f = i(90), p = i(20), g = i(1), S = i(85), y = i(152), T = i(13),
        k = i(43), m = i(229), v = i(230), w = i(234), _ = i(240), D = i(94), b = i(44), N = i(196), C = i(45);
    var x, I;
    !function (t) {
        t[t.Normal = 0] = "Normal", t[t.HDVideo = 1] = "HDVideo", t[t.WDYX = 2] = "WDYX", t[t.SpeedZero = 3] = "SpeedZero"
    }(x = e.FileSpecialTag || (e.FileSpecialTag = {})), function (t) {
        t[t.NoVip = 0] = "NoVip", t[t.Vip = 1] = "Vip", t[t.SuperVip = 2] = "SuperVip", t[t.Baotuan = 3] = "Baotuan"
    }(I || (I = {}));

    class V extends l.VipTaskBase {
        constructor(t, e) {
            super(t, e), this.vipTaskType = s.VipDownloadDefineNS.VipTaskType.Vip, this.vipTaskStatus = s.VipDownloadDefineNS.VipTaskStatus.Init, this.vipEnterType = s.VipDownloadDefineNS.VipTaskType.NoVip, this.vipEnterStatus = s.VipDownloadDefineNS.VipTaskStatus.Unkown, this.vipSubTasks = new Map, this.partialForbid = !1, this.acclerated = !1, this.continued = !1, this.kuaiNiaoInit = !1, this.kuaiNiaoShow = !1, this.kuaiNiaoTimer = null, this.tokenQuery = null, this.tryOperation = null, this.adOperation = null, this.baotuanOperation = null, this.gameOperation = null, this.operations = new Map, this.offlineTask = null, this.speedZero = null, this.isSpeedZeroReady = !1, this.tryOperation = new m.TryOperation(this.task), this.adOperation = new v.AdOperation(this.task), this.operations.set(s.VipDownloadDefineNS.VipTaskType.Try, this.tryOperation), this.operations.set(s.VipDownloadDefineNS.VipTaskType.Ad, this.adOperation), this.baotuanOperation = new w.BaotuanOperation(this.task), this.gameOperation = new _.GameOperation(this.task), this.speedZero = new y.SpeedZero(this.task), this.tokenQuery = new o.TokenQuery(this.task), this.tokenQuery.addListener(o.TokenQueryEventNS.tokenExpired, this.onTokenExpired.bind(this)), this.vipEnterType = this.getOriginVipTaskType();
            let i = {xgtState: s.VipDownloadDefineNS.XgtState.Unkown, args: null};
            this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.Try, i), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.Ad, i), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.PlayGame, i), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.Baotuan, i), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.PackageTry, i)
        }

        setVipTaskType(t) {
            if (this.canSetVipTaskType(this.vipTaskType, t, this.vipTaskStatus)) {
                t === s.VipDownloadDefineNS.VipTaskType.NoVip && (t = s.VipDownloadDefineNS.VipTaskType.Vip);
                let e = this.getOperation(this.vipTaskType);
                return e && e.clear(), this.vipTaskType = t, this.logger.info("taskId", this.taskId, "vipTaskType", t), this.vipTaskStatus = s.VipDownloadDefineNS.VipTaskStatus.Init, this.updateVipTaskInfo(), !0
            }
            return !1
        }

        getVipTaskType() {
            return this.vipTaskType
        }

        setVipTaskStatus(t) {
            this.canSetVipTaskStatus(this.vipTaskStatus, t) && (this.vipTaskStatus = t, this.logger.info("taskId", this.taskId, "vipTaskStatus", t))
        }

        getVipTaskStatus() {
            return this.vipTaskStatus
        }

        setVipEnterType(t) {
            if (this.vipSubTasks.forEach(function (e, i) {
                e.vipEnterType = t
            }), this.canSetVipTaskType(this.vipEnterType, t, this.vipEnterStatus)) {
                if (this.baotuanOperation.isInBaotao() || this.baotuanOperation.getBaotuanXgt() === s.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut) {
                    let e = "setVipEnterType";
                    switch (t) {
                        case s.VipDownloadDefineNS.VipTaskType.Try:
                            e = "setVipEnterType.Try";
                            break;
                        case s.VipDownloadDefineNS.VipTaskType.Ad:
                            e = "setVipEnterType.Ad";
                            break;
                        case s.VipDownloadDefineNS.VipTaskType.Vip:
                            e = "setVipEnterType.Vip"
                    }
                    this.baotuanOperation.clear(e)
                }
                this.error = null, this.vipEnterType = t, this.logger.info("taskId", this.taskId, "vipEnterType", t), this.vipEnterStatus = s.VipDownloadDefineNS.VipTaskStatus.Unkown, this.saveDataBase().catch(), this.onTaskVipEnterTypeChanged(t)
            }
        }

        getVipEnterType() {
            return this.vipEnterType
        }

        setVipEnterStatus(t) {
            this.canSetVipTaskStatus(this.vipEnterStatus, t) && (this.vipEnterStatus = t, this.logger.info("taskId", this.taskId, "vipEnterStatus", t), f.VipDownloadHelperNS.fireTaskAcclerateStatusChanged(this.taskId, this.vipEnterType, t))
        }

        getVipEnterStatus() {
            return this.vipEnterStatus
        }

        getError() {
            return this.error
        }

        show(t, e) {
            let i = this.setVipTaskType(t);
            return this.logger.info("show", t, e, i), e && i && this.select(), i
        }

        getTryDetail() {
            let t = null;
            return this.vipTaskType === s.VipDownloadDefineNS.VipTaskType.Try ? t = this.tryOperation.getTryDetail() : this.vipTaskType === s.VipDownloadDefineNS.VipTaskType.Ad && (t = this.adOperation.getTryDetail()), t
        }

        getTokenData(t) {
            let e = null, i = this.getVipSubTask(t);
            return i && (e = i.tokenData), e
        }

        getBaotuanDetail() {
            return this.baotuanOperation.getBaotuanDetail()
        }

        getBaotuanDetailSt() {
            return this.baotuanOperation.getBaotuanDetailSt()
        }

        enter() {
            this.logger.info("enter"), this.vipTaskStatus !== s.VipDownloadDefineNS.VipTaskStatus.Init && (this.vipTaskStatus = s.VipDownloadDefineNS.VipTaskStatus.Unkown), this.setVipEnterType(this.vipTaskType), this.batchSetVipSubTaskStatus(null, s.VipDownloadDefineNS.VipTaskStatus.CommitWait);
            let t = this.getOperation(this.vipTaskType);
            t && t.enter(), this.kuaiNiaoInit = !0, this.startKuaiNiaoShow()
        }

        forceEnterVip() {
            let t = this.vipTaskType;
            this.vipTaskType = s.VipDownloadDefineNS.VipTaskType.Vip, this.logger.info("taskId", this.taskId, "vipTaskType", s.VipDownloadDefineNS.VipTaskType.Vip), this.vipTaskStatus = s.VipDownloadDefineNS.VipTaskStatus.Init, this.setVipEnterType(this.vipTaskType), this.batchSetVipSubTaskStatus(null, s.VipDownloadDefineNS.VipTaskStatus.CommitWait), this.kuaiNiaoInit = !0, this.startKuaiNiaoShow(), this.show(t, !0)
        }

        exit() {
            this.logger.info("exit"), this.killKuaiNiaoTimer(), this.vipEnterType === this.vipTaskType && this.change2OriginVipTaskType();
            let t = s.VipDownloadDefineNS.VipTaskStatus.Unkown;
            this.setVipTaskStatus(t), this.setVipTaskType(this.vipEnterType), this.setVipTaskStatus(t)
        }

        reset() {
            this.logger.info("reset"), this.tokenQuery.killTokenTimer(), this.continued = !0, this.partialForbid = !1
        }

        onKuaiNiaoStatusChanged(t) {
            t === D.KuaiNiaoDefineNS.KuaiNiaoStatus.Alive && (this.killKuaiNiaoTimer(), this.kuaiNiaoInit = !0, this.kuaiNiaoShow = !0, this.createKuaiNiaoTimer(3e3), this.updateVipTaskInfo())
        }

        get commitedIds() {
            let t = [];
            return this.vipSubTasks.forEach(function (e, i) {
                e.commited && t.push(i)
            }), t
        }

        getIdsWithType(t) {
            let e = [];
            return this.vipSubTasks.forEach(function (i, n) {
                i.vipEnterType === t && e.push(n)
            }), e
        }

        createVipSubTask(t) {
            let e = new r.VipSubTask(this.task, t);
            return e.vipEnterType = this.getOriginVipTaskType(), this.vipSubTasks.set(t, e), e
        }

        getVipSubTask(t, e) {
            let i = this.vipSubTasks.get(t);
            return e && !i && (i = this.createVipSubTask(t)), i
        }

        change2OriginVipTaskType(t) {
            this.logger.info("change2OriginVipTaskType", this.taskId, t);
            let e = this.getVipEnterType();
            t = t || this.getIdsWithType(e);
            let i = s.VipDownloadDefineNS.VipTaskStatus.Unkown;
            this.batchSetVipSubTaskStatus(t, i);
            let n = this.getOriginVipTaskType();
            this.setVipEnterType(n)
        }

        getOriginVipTaskType() {
            let t = s.VipDownloadDefineNS.VipTaskType.NoVip;
            if (c.default.isVip) t = s.VipDownloadDefineNS.VipTaskType.Vip; else {
                f.VipDownloadHelperNS.getDbTaskIds().includes(this.taskId) && (t = s.VipDownloadDefineNS.VipTaskType.Vip)
            }
            return t
        }

        batchSetVipSubTaskStatus(t, e, i) {
            t = t || this.commitedIds;
            let n = [];
            for (let a of t) {
                let t = this.getVipSubTask(a);
                if (!t) continue;
                let s = t.vipEnterStatus;
                t.vipEnterStatus = e, s !== t.vipEnterStatus ? (t.error = i, n.push(a)) : this.logger.info("status check", s, t.vipEnterStatus)
            }
            t.length > 0 && 0 === n.length ? this.logger.info("valids.length is 0", e, t, this.commitedIds) : (f.VipDownloadHelperNS.fireVipSubTaskInfoChanged(this.taskId, n, this.vipEnterType, e, i), this.error || (this.error = i), this.setVipEnterStatus(e), this.vipEnterType === this.vipTaskType && e !== s.VipDownloadDefineNS.VipTaskStatus.Unkown && this.setVipTaskStatus(e), this.checkPartialForbid(), this.updateVipTaskInfo())
        }

        createVipTaskInfo() {
            let t = null, e = !1, i = this.careKuaiNiao;
            this.task.getTaskStatus() !== a.DownloadKernel.TaskStatus.Started || i || (e = this.showSpeed);
            let n = !1, o = !1, r = void 0;
            this.vipTaskType === s.VipDownloadDefineNS.VipTaskType.Vip ? n = c.default.isSuperVip : this.vipTaskType === s.VipDownloadDefineNS.VipTaskType.Try && (n = this.tryOperation.tryType === s.VipDownloadDefineNS.TryType.SuperVip, o = this.tryOperation.tryType === s.VipDownloadDefineNS.TryType.MixVip, n && void 0 === this.tryOperation.trySection && (this.tryOperation.trySection = s.VipDownloadDefineNS.TryType.SuperVip), r = this.tryOperation.trySection);
            let l = !1, u = !1;
            (n && !i || r === s.VipDownloadDefineNS.TryType.PlatinumVip || r === s.VipDownloadDefineNS.TryType.SuperVip || r === s.VipDownloadDefineNS.TryType.MixVip) && this.vipTaskStatus > s.VipDownloadDefineNS.VipTaskStatus.Init && this.vipTaskStatus < s.VipDownloadDefineNS.VipTaskStatus.Finished && this.vipTaskStatus !== s.VipDownloadDefineNS.VipTaskStatus.CommitFailed && this.vipTaskStatus !== s.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed && (u = !0, r === s.VipDownloadDefineNS.TryType.SuperVip && (l = !0)), this.packageAcclerate !== C.PackageTryDefineNS.Acclerate.none && (l = !0);
            let [h, p] = f.VipDownloadHelperNS.trans2OuterVipTypeAndStatus(this.vipEnterType, this.vipEnterStatus),
                g = this.baotuanOperation.getBaotuanDetail();
            this.baotuanOperation.updateBaotuanEnterance();
            let S = this.getSpeedZeroRemindText(), y = this.task.getTaskBase(), T = "";
            if (y) if (y.taskType === a.DownloadKernel.TaskType.Bt) {
                let t = this.task.getTaskDetail();
                t && (T = t.infoId)
            } else T = y.gcid;
            let m = k.default.packageRuning && k.default.isTaskAcclerating(this.taskId) && this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started;
            return t = {
                xgtType: this.getShowedXgt(),
                taskType: this.vipTaskType,
                isSuper: n,
                taskStatus: this.vipTaskStatus,
                isShowVipSpeed: e,
                isShowSuperSpeed: l,
                isShowSuperSpeedEx: u,
                error: this.error,
                allSubTaskDcdnError: this.allSubTaskDcdnError,
                isAcclerated: this.acclerated,
                careKuaiNiao: i,
                showKuaiNiao: this.kuaiNiaoShow,
                kuaiNiaoStatus: b.default.status,
                enterType: h,
                enterStatus: m ? s.VipDownloadDefineNS.VipTaskStatus.Acclerating : p,
                isContinued: this.continued,
                isPartialForbid: this.partialForbid,
                isMixTry: o,
                trySection: r,
                baotuanDetail: g,
                taskBelowSrcImg: this.baotuanOperation.taskBelowSrcImg,
                taskBelowHoverTip: this.baotuanOperation.taskBelowHoverTip,
                gcid: T,
                speedZeroState: S,
                packagetrying: m,
                surperPackage: k.default.isSurperPackget,
                packageTryState: k.default.packageState,
                isCloudTask: !1,
                isPlayAndDownload: k.default.isBeginFromPlay,
                isHResource: this.baotuanOperation.isHResource
            }, this.packageAcclerate !== C.PackageTryDefineNS.Acclerate.none && (t.taskBelowSrcImg = d.ThunderUtil.getStaticPath() + "/img/baotuan_ing.gif", t.taskBelowHoverTip = "抱团下载中，一起下载更快乐"), this.vipTaskInfo = t, this.speedZero.vipTaskInfo = t, this.logger.info("createVipTaskInfo", t), t
        }

        canSetVipTaskType(t, e, i) {
            let n = !0;
            do {
                if (t === e) {
                    n = !1;
                    break
                }
                let a = f.VipDownloadHelperNS.getVipTaskTypePriority(t),
                    o = f.VipDownloadHelperNS.getVipTaskTypePriority(e),
                    r = f.VipDownloadHelperNS.isVipTaskTypeEnable(this.taskId, t);
                a >= o && r && i !== s.VipDownloadDefineNS.VipTaskStatus.Unkown && (n = !1)
            } while (0);
            return n
        }

        canSetVipTaskStatus(t, e) {
            let i = !1;
            do {
                if (t === e) break;
                e === s.VipDownloadDefineNS.VipTaskStatus.Unkown ? i = !0 : e === s.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped || t === s.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped ? i = !0 : e > t && (i = !0)
            } while (0);
            return i
        }

        checkPartialForbid() {
            this.partialForbid || this.error && this.error.isForbidResource && this.vipTaskStatus === s.VipDownloadDefineNS.VipTaskStatus.Acclerating && (this.partialForbid = !0)
        }

        saveDataBase() {
            return n(this, void 0, void 0, function* () {
                if (!c.default.isLogin || this.vipEnterType !== s.VipDownloadDefineNS.VipTaskType.Vip) return;
                const t = N.VipTaskDataBaseNS.getTable();
                let e = yield t.isTaskExist(this.taskId, -1);
                e || t.setUserData(this.taskId, -1).catch(), this.continued = e
            })
        }

        removeDataBase() {
            N.VipTaskDataBaseNS.getTable().removeTask(this.taskId, -2).catch()
        }

        startKuaiNiaoShow() {
            this.careKuaiNiao && (this.logger.info("startKuaiNiaoShow"), this.createKuaiNiaoTimer(5e3))
        }

        createKuaiNiaoTimer(t) {
            this.kuaiNiaoTimer || (this.logger.info("createKuaiNiaoTimer"), this.kuaiNiaoTimer = setTimeout(() => {
                this.logger.info("onKuaiNiaoTimer"), this.kuaiNiaoInit = !1, this.kuaiNiaoShow = !1, this.kuaiNiaoTimer = null, this.updateVipTaskInfo()
            }, t))
        }

        killKuaiNiaoTimer() {
            this.kuaiNiaoTimer && (this.logger.info("killKuaiNiaoTimer"), clearTimeout(this.kuaiNiaoTimer), this.kuaiNiaoInit = !1, this.kuaiNiaoShow = !1, this.kuaiNiaoTimer = null)
        }

        onTaskSpeedZeroChange(t) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (t !== this.taskId) break;
                    switch (this.speedZero.getSpeedZeroState()) {
                        case y.SpeedZeroState.NoSpeed:
                        case y.SpeedZeroState.HaveCreate:
                            break;
                        case y.SpeedZeroState.CDNReady:
                            c.default.isVip;
                            break;
                        case y.SpeedZeroState.CDNFailed:
                    }
                    this.updateVipTaskInfo()
                } while (0)
            })
        }

        getSpeedZeroRemindText() {
            let t = "";
            if (c.default.isVip) switch (this.speedZero.getSpeedZeroState()) {
                case y.SpeedZeroState.NoSpeed:
                case y.SpeedZeroState.NoSpeedRead:
                    t = "none";
                    break;
                case y.SpeedZeroState.HaveCreate:
                    t = "reminded";
                    break;
                case y.SpeedZeroState.CDNReady:
                    t = "online";
                    break;
                case y.SpeedZeroState.CDNReadyRead:
                    t = "online_read";
                    break;
                case y.SpeedZeroState.CDNFailed:
                    t = "fail";
                    break;
                case y.SpeedZeroState.CDNFailedRead:
                    t = "none"
            }
            return t
        }

        get allSubTaskDcdnError() {
            let t = !0;
            do {
                if (0 === this.vipSubTasks.size) {
                    t = !1;
                    break
                }
                this.vipSubTasks.forEach(e => {
                    if (this.task.isSubTaskDownloading(e.subId)) switch (e.dcdnStatus) {
                        case a.DownloadKernel.DcdnStatusCode.ResourceNotFound:
                        case a.DownloadKernel.DcdnStatusCode.AuthorizingFailed:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByCopyright:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByPorNoGraphy:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByReactionary:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByOtherFilter:
                            t = !1
                    }
                })
            } while (0);
            return t
        }

        tryShowPackageTry() {
            switch (this.baotuanOperation.getBaotuanXgt()) {
                case s.VipDownloadDefineNS.BaotuanXgt.Before_All:
                case s.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                case s.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                case s.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                case s.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                case s.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                    k.default.tryShowPackageTry(this.task, this.logger).catch();
                    break;
                case s.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                case s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                case s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                    k.default.tryHidePackageTry(this.task, this.logger)
            }
        }

        onPackageStateChangeCallBack(t) {
            return n(this, void 0, void 0, function* () {
                switch (t) {
                    case C.PackageTryDefineNS.State.none:
                        break;
                    case C.PackageTryDefineNS.State.ready:
                        this.changeXgtState(s.VipDownloadDefineNS.XgtType.Try, s.VipDownloadDefineNS.XgtState.Exit), this.changeXgtState(s.VipDownloadDefineNS.XgtType.Ad, s.VipDownloadDefineNS.XgtState.Exit), this.changeXgtState(s.VipDownloadDefineNS.XgtType.PlayGame, s.VipDownloadDefineNS.XgtState.Exit);
                        break;
                    case C.PackageTryDefineNS.State.runing:
                        this.baotuanOperation.clear(C.PackageTryDefineNS.State.runing);
                        break;
                    case C.PackageTryDefineNS.State.commiting:
                        break;
                    case C.PackageTryDefineNS.State.stop:
                        k.default.isPackagetTryTask(this.task) && this.unAcclerate();
                        break;
                    case C.PackageTryDefineNS.State.finish:
                        k.default.isPackagetTryTask(this.task) && (this.unAcclerate(), (yield this.baotuanOperation.tryResumeBaotuan()) || c.default.isVip && this.onTaskVipEnterTypeChanged(s.VipDownloadDefineNS.VipTaskType.Vip));
                        break;
                    case C.PackageTryDefineNS.State.over:
                }
            })
        }

        onBaotuanStateChange(t) {
            this.tryShowPackageTry()
        }

        getVipSubTaskInfo(t) {
            if (!this.task.getTaskBase()) return null;
            let e = s.VipDownloadDefineNS.VipTaskType.Vip, i = s.VipDownloadDefineNS.VipTaskStatus.Init, n = null,
                a = this.getVipSubTask(t);
            return a && (e = a.vipEnterType, i = a.vipEnterStatus, n = a.error), [e, i] = f.VipDownloadHelperNS.trans2OuterVipTypeAndStatus(e, i), {
                subId: t,
                enterType: e,
                enterStatus: i,
                error: n
            }
        }

        getAllVipSubTaskInfo() {
            let t = [], e = this.commitedIds;
            for (let i of e) {
                let e = this.getVipSubTaskInfo(i);
                e && t.push(e)
            }
            return t
        }

        getStatusData(t) {
            let e = null, i = this.getVipSubTask(t);
            return i && (e = i.statusData), e
        }

        getOperation(t) {
            return this.operations.get(t)
        }

        getBaotuanOperation() {
            return this.baotuanOperation
        }

        getGameOperation() {
            return this.gameOperation
        }

        get showSpeed() {
            let t = !1;
            if (this.vipEnterType > s.VipDownloadDefineNS.VipTaskType.NoVip) switch (this.vipEnterStatus) {
                case s.VipDownloadDefineNS.VipTaskStatus.Acclerating:
                    t = !0;
                    break;
                case s.VipDownloadDefineNS.VipTaskStatus.CommitFailed:
                case s.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed:
                    this.error && this.error.isForbidResource && (t = !0)
            }
            switch (this.packageAcclerate) {
                case C.PackageTryDefineNS.Acclerate.try:
                case C.PackageTryDefineNS.Acclerate.trybaotuan:
                    t = !0
            }
            return t
        }

        get careKuaiNiao() {
            return !(!this.kuaiNiaoInit || this.vipEnterType !== s.VipDownloadDefineNS.VipTaskType.Try) && this.tryOperation.enableKuaiNiao
        }

        remove() {
            this.offlineTask && this.offlineTask.remove(), this.operations.forEach(t => {
                t.remove()
            }), l.VipTaskBase.updateDeleayTick(1e3);
            let t = new Array;
            l.VipTaskBase.sVipTasArray.forEach(e => {
                e !== this && t.push(e)
            }), l.VipTaskBase.sVipTasArray = t, this.clear(), this.removeDataBase(), k.default.delPackageTryTask(this.task, this.logger, "remove").catch(), this.gameOperation.removeGame(), this.baotuanOperation.remove(), this.speedZero.removeTask()
        }

        tryActiveAllXgt(t) {
            return n(this, void 0, void 0, function* () {
                if (this.getShowedXgt() !== s.VipDownloadDefineNS.XgtType.Unkown) return void (t && !(yield this.baotuanOperation.isNeedAutoBaotuan()) && this.tryShowPackageTry());
                this.lockedUpdate = !0, k.default.openPackageTry ? (yield this.baotuanOperation.isNeedAutoBaotuan()) || this.tryShowPackageTry() : yield this.activeTry(), k.default.packageRuning || (yield this.baotuanOperation.tryShowBaotuan(!0, "tryActiveAllXgt"));
                let e = this.task.taskTitle();
                this.xgtStateMap.forEach(function (t, i) {
                    S.TaskLogHelp.infoEx("下挂条状态初始化：", e, i, t.xgtState)
                }), this.lockedUpdate = !1, this.needShowNextReadyXgt = !0
            })
        }

        fail(t, e, i) {
            this.logger.info("fail", this.taskId, t, e);
            let n = [t];
            h(e) && i && this.batchSetVipSubTaskStatus(n, e, i), this.change2OriginVipTaskType(n)
        }

        finish(t) {
            this.logger.info("finish", this.taskId, t);
            let e = s.VipDownloadDefineNS.VipTaskStatus.Finished, i = [t];
            this.batchSetVipSubTaskStatus(i, e), this.change2OriginVipTaskType(i), setTimeout(() => {
                this.baotuanOperation.tryResumeBaotuan().catch()
            }, 50)
        }

        commit(t, e) {
            return n(this, void 0, void 0, function* () {
                do {
                    this.logger.info("commit", "queryOption", e), this.batchSetVipSubTaskStatus(t, s.VipDownloadDefineNS.VipTaskStatus.CommitWait);
                    let i = this.task.getTaskBase();
                    if (!i) break;
                    let n = this.task.getDownloadingFiles(t);
                    this.logger.info("downloadingFiles", n);
                    let o = null, r = null, l = null, u = new Map,
                        c = i.taskType === a.DownloadKernel.TaskType.P2sp || i.taskType === a.DownloadKernel.TaskType.Group;
                    for (let t of n) if (t.gcid && "" !== t.gcid && t.cid && "" !== t.cid) {
                        let i = this.getVipSubTask(t.subId, !0);
                        i.commited = !0, this.batchSetVipSubTaskStatus([t.subId], s.VipDownloadDefineNS.VipTaskStatus.Commiting);
                        let n = null;
                        this.isSpeedZeroReady ? (l || (l = {
                            type: i.vipEnterType,
                            fSpecial: x.SpeedZero,
                            queryOption: e,
                            tokenFiles: [],
                            statusFiles: []
                        }), n = l) : i.vipEnterType === s.VipDownloadDefineNS.VipTaskType.NoVip && c && (yield this.task.getIsHDVideo(t.subId)) ? (o || (o = {
                            type: i.vipEnterType,
                            fSpecial: x.HDVideo,
                            queryOption: e,
                            tokenFiles: [],
                            statusFiles: []
                        }), n = o) : i.vipEnterType === s.VipDownloadDefineNS.VipTaskType.NoVip && c && (yield this.task.getIsWeiDuanYouXi(t.subId)) ? (r || (r = {
                            type: i.vipEnterType,
                            fSpecial: x.WDYX,
                            queryOption: e,
                            tokenFiles: [],
                            statusFiles: []
                        }), n = r) : (u.get(i.vipEnterType) || u.set(i.vipEnterType, {
                            type: i.vipEnterType,
                            fSpecial: x.Normal,
                            queryOption: e,
                            tokenFiles: [],
                            statusFiles: [],
                            baotuanOption: this.baotuanOperation.getBaotuanOption()
                        }), n = u.get(i.vipEnterType)), n.tokenFiles.push(t), t.isNeedDownload && n.statusFiles.push(t)
                    }
                    u.forEach(this.commitWithType.bind(this)), o && (yield this.commitWithType(o)), r && (yield this.commitWithType(r)), l && (yield this.commitWithType(l))
                } while (0)
            })
        }

        commitPackageTryToken(t, e, i) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.logger.info("commitPackageTryToken", "subIds", t, "baotuanOption", e), this.batchSetVipSubTaskStatus(t, s.VipDownloadDefineNS.VipTaskStatus.CommitWait), !this.task.getTaskBase()) break;
                    let n = this.task.getDownloadingFiles(t);
                    this.logger.info("downloadingFiles", n);
                    let a = {
                        type: null,
                        fSpecial: x.Normal,
                        queryOption: s.VipDownloadDefineNS.QueryOption.TokenOnly,
                        tokenFiles: [],
                        statusFiles: [],
                        baotuanOption: e,
                        oldTokens: [],
                        verify: i
                    };
                    for (let t of n) if (t.gcid && "" !== t.gcid && t.cid && "" !== t.cid) {
                        let e = this.getVipSubTask(t.subId, !0);
                        e.commited = !0, this.batchSetVipSubTaskStatus([t.subId], s.VipDownloadDefineNS.VipTaskStatus.Commiting), a.tokenFiles.push(t), a.oldTokens.push(e.tokenData ? e.tokenData.token : void 0)
                    }
                    e ? yield this.commitVipTask(a) : yield this.commitTryTask(a)
                } while (0)
            })
        }

        onExpand() {
            this.baotuanOperation.onExpand().catch(), this.speedZero.select().catch(), this.tryActiveAllXgt().catch()
        }

        onUserAuthorityChanged(t, e) {
            return n(this, void 0, void 0, function* () {
                this.updateVipTaskInfo(), this.logger.info("onUserAuthorityChanged", t, e), this.gameOperation.isPlayGameUser = !1;
                let i = !1, n = !1;
                this.select(!1), this.tokenQuery.killDelayTimer(), this.sectionSpeed.onUserAuthorityChanged(t);
                let a = this.getOriginVipTaskType();
                if (this.setVipTaskType(a), this.setVipEnterType(a), this.checkOffline().catch(), e || (this.getVipTaskType() !== s.VipDownloadDefineNS.VipTaskType.Try && this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.Try, {
                    xgtState: s.VipDownloadDefineNS.XgtState.Unkown,
                    args: null
                }), this.getVipTaskType() !== s.VipDownloadDefineNS.VipTaskType.Ad && this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.Ad, {
                    xgtState: s.VipDownloadDefineNS.XgtState.Unkown,
                    args: null
                }), this.xgtStateMap.set(s.VipDownloadDefineNS.XgtType.PlayGame, {
                    xgtState: s.VipDownloadDefineNS.XgtState.Unkown,
                    args: null
                })), this.baotuanOperation) if (this.baotuanOperation.setClickType(""), e) {
                    let t = this.baotuanOperation.getBaotuanDetail();
                    if (t) switch (t.baotuanXgt) {
                        case s.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                        case s.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                            i = !0;
                            break;
                        case s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        case s.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        case s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                            t.baotuanXgt === s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut && (t.baotuanXgt = s.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed, this.baotuanOperation.hideBaotuan(s.VipDownloadDefineNS.XgtState.Background, {description: "onUserAuthorityChanged_SucceedCutLineOut"})), n = !0
                    }
                } else {
                    this.baotuanOperation.clearRecordData("logout or login");
                    do {
                        if (!p.BaoTuanSettingNS.isLoginNeed() && !c.default.isPreUserIsVip && !c.default.isVip) break;
                        (this.baotuanOperation.isInBaotao() || this.baotuanOperation.getBaotuanXgt() === s.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut) && (this.baotuanOperation.clear("onUserAuthorityChanged"), this.changeXgtState(s.VipDownloadDefineNS.XgtType.Baotuan, s.VipDownloadDefineNS.XgtState.Unkown))
                    } while (0)
                }
                setTimeout(() => {
                    this.tryActiveAllXgt(!0).catch()
                }, 1e3), i ? this.baotuanOperation.enter(this.baotuanOperation.getClickType(), s.VipDownloadDefineNS.BaotuanEnterBy.authority).catch() : n ? this.baotuanOperation.queryToken().catch() : c.default.isLogin && !c.default.isVip && (yield this.baotuanOperation.isNeedAutoBaotuan()) && !this.baotuanOperation.isTaskInTry() && this.baotuanOperation.enter("auto", s.VipDownloadDefineNS.BaotuanEnterBy.loginAutoJoin).catch(), this.baotuanOperation.fireInfoToWebBaotuanPage()
            })
        }

        onTaskStatusChanged(t) {
            return n(this, void 0, void 0, function* () {
                switch (this.sectionSpeed.onTaskStatusChanged(t), t) {
                    case a.DownloadKernel.TaskStatus.Started:
                        k.default.packageRuning && k.default.addPackageTryTask(this.task, this.logger).catch(), yield this.baotuanOperation.onTaskStarted(), yield this.gameOperation.checkGameXgt(), this.error = null, this.tokenQuery.isDelay ? this.tokenQuery.addDelayTask(this.taskId, this) : k.default.packageRuning || this.commit().catch(), (yield this.baotuanOperation.tryRestartBaotuan()) || (this.baotuanOperation.isManaulEnter && !k.default.packageRuning ? this.baotuanOperation.enter(this.baotuanOperation.getClickType(), s.VipDownloadDefineNS.BaotuanEnterBy.taskStarted).then(() => {
                            !this.baotuanOperation.isInBaotao() && k.default.openPackageTry && this.tryShowPackageTry()
                        }) : c.default.isVip || !(yield this.baotuanOperation.isNeedAutoBaotuan()) || k.default.packageRuning || this.baotuanOperation.isManaulEnter || this.baotuanOperation.enter("auto", s.VipDownloadDefineNS.BaotuanEnterBy.taskStarted).then(() => {
                            !this.baotuanOperation.isInBaotao() && k.default.openPackageTry && this.tryShowPackageTry()
                        })), this.checkOffline().catch(), setTimeout(() => {
                            l.VipTaskBase.updateDeleayTick(2e3), this.tryActiveAllXgt().catch()
                        }, 1e3);
                        break;
                    case a.DownloadKernel.TaskStatus.Stopped:
                        this.baotuanOperation.setClickType(""), this.batchSetVipSubTaskStatus(null, s.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped), this.unAcclerate();
                        let e = new Map;
                        this.vipSubTasks.forEach((t, i) => {
                            t.vipEnterType !== s.VipDownloadDefineNS.VipTaskType.Try && t.vipEnterType !== s.VipDownloadDefineNS.VipTaskType.Ad || e.set(i, t)
                        }), this.vipSubTasks = e;
                        break;
                    case a.DownloadKernel.TaskStatus.Succeeded:
                        k.default.delPackageTryTask(this.task, this.logger, "Succeeded")
                }
                this.speedZero.onTaskStatusChanged(t)
            })
        }

        onBatchSubTaskStatusChanged(t) {
            let e = this.task.getTaskBase();
            if (e) {
                let i = [];
                for (let n of t) {
                    let [t, s] = n;
                    if (e.taskType === a.DownloadKernel.TaskType.Bt && s === a.DownloadKernel.BtFileStatus.Started || e.taskType === a.DownloadKernel.TaskType.Group && s === a.DownloadKernel.TaskStatus.Started) i.push(t); else if (e.taskType === a.DownloadKernel.TaskType.Bt && s === a.DownloadKernel.BtFileStatus.Stopped || e.taskType === a.DownloadKernel.TaskType.Group && s === a.DownloadKernel.TaskStatus.Stopped) {
                        let e = this.getVipSubTask(t);
                        e && e.unAcclerate()
                    }
                }
                i.length > 0 && this.commitSubTasks(e, i)
            }
        }

        onTaskDcdnStatusChanged(t, e) {
            return n(this, void 0, void 0, function* () {
                k.default.packageRuning && (k.default.onDcdnResultCallback(this.task, t, e, this.logger), this.updateVipTaskInfo());
                let i = this.getVipSubTask(t);
                if (!i) return;
                i.dcdnStatus = e;
                let n = this.task.getTaskStatus(), o = this.getVipEnterStatus();
                if (n === a.DownloadKernel.TaskStatus.Started && o > s.VipDownloadDefineNS.VipTaskStatus.Commiting && i.tokenEnable) {
                    let n = this.getOperation(i.vipEnterType);
                    switch (e) {
                        case void 0:
                        case a.DownloadKernel.DcdnStatusCode.Unkown:
                            break;
                        case a.DownloadKernel.DcdnStatusCode.Success:
                        case a.DownloadKernel.DcdnStatusCode.ResourceNotFound:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByCopyright:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByPorNoGraphy:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByReactionary:
                        case a.DownloadKernel.DcdnStatusCode.ForbidByOtherFilter:
                            this.acclerated = !0, this.batchSetVipSubTaskStatus([t], s.VipDownloadDefineNS.VipTaskStatus.Acclerating), n && n.onDcdnResultCallback(t, !0);
                            break;
                        default:
                            let i = f.VipDownloadHelperNS.createDcdnError(e);
                            this.batchSetVipSubTaskStatus([t], s.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed, i), n && n.onDcdnResultCallback(t, !1)
                    }
                }
            })
        }

        onBatchCidGcidRetrieved(t) {
            setTimeout(() => {
                this.tryActiveAllXgt().catch()
            }, 1e3);
            let e = this.task.getTaskBase();
            e && this.commitSubTasks(e, t)
        }

        onTaskVipEnterTypeChanged(t) {
            let e = this.getIdsWithType(t);
            if (e.length > 0) {
                this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started ? this.commit(e).catch() : this.batchSetVipSubTaskStatus(e, s.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped)
            }
        }

        commitSubTasks(t, e) {
            do {
                let t = this.task.getTaskStatus(), i = this.getVipEnterStatus();
                if (t !== a.DownloadKernel.TaskStatus.Started || i === s.VipDownloadDefineNS.VipTaskStatus.Init) break;
                let n = [];
                for (let t of e) {
                    let e = this.getVipSubTask(t);
                    e && e.commited || n.push(t)
                }
                n.length > 0 && (k.default.packageRuning ? k.default.addPackageTryTask(this.task, this.logger) : this.commit(n).catch())
            } while (0)
        }

        commitWithType(t, e) {
            return n(this, void 0, void 0, function* () {
                if (t.tokenFiles.length > 0) switch (this.logger.info("commitWithType", t.type), t.type) {
                    case s.VipDownloadDefineNS.VipTaskType.Try:
                    case s.VipDownloadDefineNS.VipTaskType.Ad:
                        yield this.commitTryTask(t);
                        break;
                    default:
                        yield this.commitVipTask(t)
                }
            })
        }

        commitVipTask(t) {
            return n(this, void 0, void 0, function* () {
                do {
                    this.logger.info("commitVipTask", t);
                    let e = this.task.getTaskBase();
                    if (!e) break;
                    let i = void 0, o = void 0;
                    if (e.taskType === a.DownloadKernel.TaskType.Bt) {
                        let t = this.task.getTaskDetail();
                        if (!t) {
                            this.logger.info("commitVipTask taskDetail is null");
                            break
                        }
                        i = e.taskName, o = t.infoId
                    }
                    let r = 0, l = void 0, u = void 0;
                    if (t.type === s.VipDownloadDefineNS.VipTaskType.NoVip || null === t.type) {
                        switch (t.fSpecial) {
                            case x.HDVideo:
                                r = 15;
                                break;
                            case x.WDYX:
                                r = 16;
                                break;
                            case x.SpeedZero:
                                r = 14;
                                break;
                            default:
                                r = 10
                        }
                        l = "client", u = "0"
                    }
                    if (t.queryOption !== s.VipDownloadDefineNS.QueryOption.TokenOnly && t.statusFiles.length > 0) {
                        let a = {
                            taskType: e.taskType,
                            files: t.statusFiles,
                            btTitle: i,
                            infoId: o,
                            verifyType: r,
                            sessiontype: l,
                            appid: u
                        };
                        if (t.type === s.VipDownloadDefineNS.VipTaskType.NoVip) {
                            if (void 0 === V.sIsNoVipStatusQueryPeerid) {
                                let t = yield c.default.getPeerId(),
                                    e = T.default.getValue("VipDownload", "NoVipStatusQueryPeerid");
                                V.sIsNoVipStatusQueryPeerid = g.default.isPeeridMatchSha256Region(t, e, 0)
                            }
                            V.sIsNoVipStatusQueryPeerid && (yield this.tokenQuery.queryStatus(a, t => n(this, void 0, void 0, function* () {
                                yield this.onNoVipStatusCallback(t)
                            })))
                        } else this.logger.info("queryStatus", a), yield this.tokenQuery.queryStatus(a, e => n(this, void 0, void 0, function* () {
                            yield this.onStatusCallback(t.type, e)
                        }))
                    }
                    if (t.queryOption !== s.VipDownloadDefineNS.QueryOption.StatusOnly) {
                        let a = void 0, s = void 0;
                        t.baotuanOption && t.baotuanOption.isGroup && (r = c.default.isVip ? 0 : 12, a = 1, s = t.baotuanOption.joinKey);
                        let d = {
                            taskType: e.taskType,
                            files: t.tokenFiles,
                            btTitle: i,
                            infoId: o,
                            verifyType: r,
                            sessiontype: l,
                            appid: u,
                            isGroup: a,
                            joinKey: s,
                            oldTokens: t.oldTokens
                        }, h = I.NoVip;
                        switch (r) {
                            case 10:
                                h = I.NoVip;
                                break;
                            case 0:
                            case 14:
                            case 15:
                            case 16:
                                h = c.default.isSuperVip ? I.SuperVip : I.Vip
                        }
                        a && (h = I.Baotuan), yield this.tokenQuery.queryToken(d, e => n(this, void 0, void 0, function* () {
                            this.logger.info("queryToken", d), yield this.onTokenCallback(t.type, e, h)
                        }))
                    }
                } while (0)
            })
        }

        commitTryTask(t) {
            return n(this, void 0, void 0, function* () {
                do {
                    let e = this.task.getTaskBase();
                    if (!e) break;
                    let i = t.verify ? t.verify : this.tryOperation.verify;
                    if (!i) return void this.logger.info("commitTryTask verify is null");
                    let o = void 0, r = void 0;
                    if (e.taskType === a.DownloadKernel.TaskType.Bt) {
                        let t = this.task.getTaskDetail();
                        if (!t) {
                            this.logger.info("commitTryTask taskDetail is null");
                            break
                        }
                        o = e.taskName, r = t.infoId
                    }
                    let l = 1;
                    if (t.queryOption !== s.VipDownloadDefineNS.QueryOption.TokenOnly && t.statusFiles.length > 0) {
                        let a = {
                            taskType: e.taskType,
                            files: t.statusFiles,
                            btTitle: o,
                            infoId: r,
                            verifyType: l,
                            verify: i
                        };
                        yield this.tokenQuery.queryStatus(a, e => n(this, void 0, void 0, function* () {
                            yield this.onStatusCallback(t.type, e)
                        }))
                    }
                    if (t.queryOption !== s.VipDownloadDefineNS.QueryOption.StatusOnly) {
                        let a = {
                            taskType: e.taskType,
                            files: t.tokenFiles,
                            btTitle: o,
                            infoId: r,
                            verifyType: l,
                            verify: i
                        }, u = I.Vip;
                        switch (this.tryOperation.trySection) {
                            case s.VipDownloadDefineNS.TryType.PlatinumVip:
                                u = I.Vip;
                                break;
                            case s.VipDownloadDefineNS.TryType.SuperVip:
                                u = I.SuperVip
                        }
                        yield this.tokenQuery.queryToken(a, e => n(this, void 0, void 0, function* () {
                            yield this.onTokenCallback(t.type, e, u)
                        }))
                    }
                } while (0)
            })
        }

        acclerate(t, e) {
            if (this.logger.info("acclerate", this.taskId, JSON.stringify(t)), this.task.getTaskBase()) for (let i of t) {
                let t = this.getVipSubTask(i);
                if (t && t.tokenData) {
                    t.tokenEnable = !0;
                    let n = t.dcdnStatus;
                    n === a.DownloadKernel.DcdnStatusCode.Success && this.onTaskDcdnStatusChanged(i, n).catch();
                    let s = new Map;
                    switch (s.set("vip_vipspeed", "0"), s.set("vip_superspeed", "0"), s.set("vip_group", "0"), s.set("vip_smooth", "0"), s.set("vip_zerospeed", "0"), e) {
                        case I.NoVip:
                            break;
                        case I.Vip:
                            s.set("vip_vipspeed", "1");
                            break;
                        case I.SuperVip:
                            s.set("vip_superspeed", "1");
                            break;
                        case I.Baotuan:
                            s.set("vip_group", "1")
                    }
                    t.acclerate(s)
                }
            }
        }

        unAcclerate(t, e) {
            if (this.logger.info("unAcclerate", this.taskId, JSON.stringify(t)), this.task.getTaskBase()) {
                t = t || this.commitedIds;
                for (let i of t) {
                    let t = this.getVipSubTask(i);
                    t && (void 0 === e ? t.unAcclerate() : t.vipEnterType === e && t.unAcclerate())
                }
                this.reset()
            }
        }

        onStatusCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onStatusCallback", t, e);
                let i = this.getOperation(t), n = this.task.getTaskStatus();
                if (this.baotuanOperation && this.baotuanOperation.onStatusCallbackBegin(), n === a.DownloadKernel.TaskStatus.Started) for (let t of e) {
                    let e = t.subId, n = 0, a = 0;
                    if (0 === t.result) this.batchSetVipSubTaskStatus([e], s.VipDownloadDefineNS.VipTaskStatus.CommitSuccess); else {
                        let i = yield f.VipDownloadHelperNS.createStatusError(t);
                        i.isForbidResource ? n = i.result : i.isNoResource && (a = i.result), this.batchSetVipSubTaskStatus([e], s.VipDownloadDefineNS.VipTaskStatus.CommitFailed, i)
                    }
                    let o = this.getVipSubTask(e);
                    o && (o.statusData = t, o.setStatusResult2Dk(n, a)), i && i.onStatusCallback(t.result), this.baotuanOperation && this.baotuanOperation.onStatusCallback(t.result, 0 === a)
                }
                this.baotuanOperation && this.baotuanOperation.onStatusCallbackEnd()
            })
        }

        onTokenCallback(t, e, i) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onTokenCallback", t, e, i);
                let n = this.getOperation(t);
                if (this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started) {
                    let t = [], a = null;
                    for (let i of e) {
                        let e = void 0, o = i.subId;
                        if (0 === i.result) t.push(o), e = i.interval, this.batchSetVipSubTaskStatus([o], s.VipDownloadDefineNS.VipTaskStatus.AcclerateWait); else {
                            let t = yield f.VipDownloadHelperNS.createTokenError(i);
                            this.batchSetVipSubTaskStatus([o], s.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed, t), a = t
                        }
                        let r = this.getVipSubTask(o);
                        r && (r.tokenData = i), n && n.onTokenCallback(i.result), this.tokenQuery.setExpireTime(o, e, a)
                    }
                    t.length > 0 && this.acclerate(t, i)
                }
            })
        }

        onNoVipStatusCallback(t) {
            return n(this, void 0, void 0, function* () {
                if (this.logger.info("onNoVipStatusCallback", t), this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started) for (let e of t) {
                    let t = e.subId, i = 0, n = 0;
                    if (0 === e.result) ; else {
                        let t = yield f.VipDownloadHelperNS.createStatusError(e);
                        t.isForbidResource ? i = t.result : t.isNoResource && (n = t.result)
                    }
                    let a = this.getVipSubTask(t);
                    a && a.setStatusResult2Dk(i, n)
                }
            })
        }

        onTokenExpired(t) {
            this.logger.info("onTokenExpired", this.taskId), this.commit(t, s.VipDownloadDefineNS.QueryOption.TokenOnly).catch()
        }

        activeTry() {
            return n(this, void 0, void 0, function* () {
                this.speedZero.isSpeedZeroTask() ? this.logger.info("activeTry this task is speedzero!") : yield this.tryOperation.active().catch()
            })
        }

        clear() {
            this.logger.info("clear"), this.reset()
        }

        checkOffline(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.task.getTaskStatus();
                c.default.offlineAuthority && e === a.DownloadKernel.TaskStatus.Started && (this.offlineTask || (this.offlineTask = new u.OfflineTask(this.task), t = !0), t && (yield this.offlineTask.loadData()), yield this.offlineTask.enter())
            })
        }
    }

    V.sIsNoVipStatusQueryPeerid = void 0, e.VipTaskDownload = V
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(221), s = i(8), o = i(13), r = i(42), l = i(9), u = i(7), c = i(1), d = i(3), h = i(10),
        f = i(0).default.getLogger("VipDownload:token-query");
    var p;
    !function (t) {
        t.tokenExpired = "OnTokenExpired"
    }(p = e.TokenQueryEventNS || (e.TokenQueryEventNS = {}));
    let g = new Map, S = setTimeout(() => n(this, void 0, void 0, function* () {
        if (f.info("onTokenDelayTimer"), S = null, !d.default.isLogin) {
            let t = g.keys();
            for (let e of t) {
                let t = g.get(e);
                if (t) {
                    let i = e;
                    (yield h.default.getTaskStatus(i)) === u.DownloadKernel.TaskStatus.Started && t.getVipTaskType() === s.VipDownloadDefineNS.VipTaskType.Vip && (f.info("onTokenDelayTimer", "commit"), yield t.commit())
                }
            }
        }
        g.clear()
    }), 5e3);
    e.TokenQuery = class extends l.EventEmitter {
        constructor(t) {
            super(), this.mTokenTimer = null, this.mExpireTimeMap = new Map, this.task = null, this.task = t, this.taskId = t.getTaskId(), this.setMaxListeners(0)
        }

        get isDelay() {
            return null !== S && !d.default.isLogin
        }

        addDelayTask(t, e) {
            f.info("addDelayTask", t), g.set(t, e)
        }

        killDelayTimer() {
            S && (f.info("killDelayTimer"), clearTimeout(S), S = null)
        }

        queryStatus(t, e) {
            return n(this, void 0, void 0, function* () {
                f.info("queyStatus");
                let i = yield(new a.VipTaskHttpSession).queryStatus(t);
                e(i)
            })
        }

        queryToken(t, e) {
            return n(this, void 0, void 0, function* () {
                f.info("queryToken");
                let i = yield(new a.VipTaskHttpSession).queryToken(t);
                e(i)
            })
        }

        setExpireTime(t, e, i) {
            if (e) {
                let t = o.default.getValue("VipDownload", "TokenExpireAdvanceSecond"),
                    i = o.default.getValue("VipDownload", "TokenExpireMinSecond");
                e -= t, e = Math.max(i, e), f.info("advance", t, "min", i)
            } else i && i.result === r.HttpErrorNS.errorConnect && (e = o.default.getValue("VipDownload", "TokenDefaultQueryInterval"));
            if (e) {
                let i = c.default.currentTime + e;
                this.mExpireTimeMap.set(t, i), this.createTokenTimer()
            }
        }

        killTokenTimer() {
            this.mTokenTimer && (f.info("killTokenTimer", "taskId", this.taskId), clearInterval(this.mTokenTimer), this.mTokenTimer = null, this.mExpireTimeMap.clear())
        }

        createTokenTimer() {
            this.mTokenTimer || (f.info("createTokenTimer", "taskId", this.taskId), this.mTokenTimer = setInterval(() => {
                this.onTokenTimer()
            }, 1e4))
        }

        onTokenTimer() {
            let t = this.mExpireTimeMap.keys();
            if (t.length <= 0) return void this.killTokenTimer();
            f.info("onTokenTimer", "taskId", this.taskId);
            let e = [], i = c.default.currentTime;
            for (let n of t) {
                let t = this.mExpireTimeMap.get(n);
                t && t <= i && (this.task.isSubTaskDownloading(n) && e.push(n), this.mExpireTimeMap.delete(n))
            }
            e.length > 0 && this.emit(p.tokenExpired, e)
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(42), o = i(15), r = i(222), l = i(3), u = i(1), c = i(91),
        d = i(0).default.getLogger("VipDownload:token-query");

    class h extends o.HttpSession {
        constructor() {
            super(...arguments), this.mGcidTaskMap = new Map
        }

        queryToken(t) {
            return n(this, void 0, void 0, function* () {
                return this.queryImpl(t)
            })
        }

        queryStatus(t) {
            return n(this, void 0, void 0, function* () {
                return this.queryImpl(t, !0)
            })
        }

        queryImpl(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = ++h.sequence, n = l.default.userId, s = t.verify || (yield l.default.getSessionId()),
                    o = u.default.currentMillisecond, c = t.verifyType,
                    d = yield a.HttpJsonCryptoNS.getUriParam(i, o, c, t.isGroup);
                this.host = "ali.pc-x.speed.auth.vip.xunlei.com", this.retries = 2, this.timeout = 2e4;
                let f = e ? "/speed/res_status?" : "/speed/speedup?";
                this.path = f + d;
                let p = t.sessiontype, g = t.appid;
                return this.auth = a.HttpJsonCryptoNS.getAuthorization(n, s, p, g, t.joinKey), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = n, t.random = o, this.mGcidTaskMap.clear(), this.body = yield r.VipTaskHttpPackageNS.createTokenBuffer(t, this.mGcidTaskMap, e), yield this.postTokenRequest(t, e)
            })
        }

        postTokenRequest(t, e) {
            return new Promise(i => {
                this.post(a => n(this, void 0, void 0, function* () {
                    let n = [];
                    if (l.default.userId === t.userId) {
                        let i = a.headers["random-num"];
                        d.info("random", i);
                        let o = null, l = void 0, u = void 0;
                        do {
                            if (200 !== (u = a.statusCode)) {
                                l = s.HttpErrorNS.errorStatusCode;
                                break
                            }
                            if (!a.body || !i) {
                                l = s.HttpErrorNS.errorData;
                                break
                            }
                            {
                                let n = Number(i).valueOf();
                                o = r.VipTaskHttpPackageNS.praseTokenBuffer(t.userId, n, a.body, e)
                            }
                            if (!o) {
                                l = s.HttpErrorNS.errorPrase;
                                break
                            }
                            l = s.HttpErrorNS.errorOk
                        } while (0);
                        n = yield this.createTokenResponse(l, t, u, o)
                    }
                    i(n)
                }), e => n(this, void 0, void 0, function* () {
                    d.info("error", e);
                    let n = [];
                    l.default.userId === t.userId && (n = yield this.createTokenResponse(s.HttpErrorNS.errorConnect, t)), i(n)
                }))
            })
        }

        createTokenResponse(t, e, i, a) {
            return n(this, void 0, void 0, function* () {
                let n = [];
                if (t === s.HttpErrorNS.errorOk) if (0 === a.result && a.task_infos && a.task_infos.length > 0) for (let t of a.task_infos) {
                    let e = this.getSubIdByGcid(t.gcid);
                    if (void 0 !== e) {
                        let s = {
                            subId: e,
                            result: t.result,
                            statusCode: i,
                            message: t.simple_msg,
                            detailMessage: t.message,
                            token: t.token,
                            interval: t.time_interval,
                            maxTime: a.speed_duration
                        };
                        n.push(s)
                    }
                } else for (let t of e.files) {
                    let e = {
                        subId: t.subId,
                        result: a.result,
                        statusCode: i,
                        message: a.message,
                        detailMessage: a.detailMessage
                    };
                    n.push(e)
                } else {
                    let a = void 0;
                    t === s.HttpErrorNS.errorStatusCode && (a = yield c.default.getMessage(c.MessageCodeType.http_code, i)), a || (a = s.HttpErrorNS.getMessage(t));
                    for (let s of e.files) {
                        let e = {subId: s.subId, result: t, statusCode: i, message: a};
                        n.push(e)
                    }
                }
                return n
            })
        }

        getSubIdByGcid(t) {
            return this.mGcidTaskMap.get(t)
        }
    }

    h.sequence = 0, e.VipTaskHttpSession = h
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(10), o = i(0).default.getLogger("VipDownload:token-query");
    !function (t) {
        t.createTokenBuffer = function (t, e, i) {
            return n(this, void 0, void 0, function* () {
                const n = i ? "createStatusBuffer" : "createTokenBuffer";
                o.info(`--\x3e${n}`);
                let r = [];
                for (let i = 0; i < t.files.length; ++i) {
                    let n = t.files[i], a = {
                        url: n.url,
                        filename: n.fileName,
                        gcid: n.gcid,
                        cid: n.cid,
                        filesize: n.fileSize,
                        refer_url: n.refUrl,
                        cookies: "",
                        file_index: 2 === t.taskType ? n.subId : void 0,
                        tokeninfo: t.oldTokens ? t.oldTokens[i] : ""
                    };
                    r.push(a), e.set(n.gcid, n.subId)
                }
                let l = {
                    peer_id: yield s.default.getTpPeerId(),
                    infohash: t.infoId,
                    bt_title: t.btTitle,
                    task_infos: r,
                    extra_infos: {bt_token_mode: 1}
                }, u = a.HttpJsonCryptoNS.getKey(t.userId, t.random), c = a.HttpJsonCryptoNS.encryptHttpBuffer(l, u);
                return o.info(`<--${n}`), c
            })
        }, t.praseTokenBuffer = function (t, e, i, n) {
            const s = n ? "praseStatusBuffer" : "praseTokenBuffer";
            o.info(`--\x3e${s}`);
            let r = a.HttpJsonCryptoNS.getKey(t, e), l = a.HttpJsonCryptoNS.decryptHttpBuffer(i, r), u = null;
            return l && ((u = l).detailMessage = l.message, u.message = l.simple_msg), o.info(`<--${s}`), u
        }
    }(e.VipTaskHttpPackageNS || (e.VipTaskHttpPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(8), a = i(90), s = i(224), o = i(7), r = i(14), l = i(41),
        u = i(0).default.getLogger("VipDownload:vip-sub-task");
    e.VipSubTask = class {
        constructor(t, e) {
            this.mFileProperty = 999, this.mHasVipResource = 999, this.mVipEnterType = n.VipDownloadDefineNS.VipTaskType.NoVip, this.mVipEnterStatus = n.VipDownloadDefineNS.VipTaskStatus.Unkown, this.mTokenEnable = !1, this.mTaskId = t.getTaskId(), this.mTask = t, this.mSubId = e
        }

        get subId() {
            return this.mSubId
        }

        set commited(t) {
            this.mCommited = t, t && this.setStatusResult2Dk(this.mFileProperty, this.mHasVipResource)
        }

        get commited() {
            return this.mCommited
        }

        set error(t) {
            this.mError = t
        }

        get error() {
            return this.mError
        }

        set tokenData(t) {
            this.mTokenData = t, r.default.emit(r.TaskEventNS.taskTokenQueryResult, this.mTaskId, this.mSubId, t.result, t.token)
        }

        get tokenData() {
            return this.mTokenData
        }

        set statusData(t) {
            this.mStatusData = t
        }

        get statusData() {
            return this.mStatusData
        }

        set dcdnStatus(t) {
            this.mDcdnStatus = t
        }

        get dcdnStatus() {
            return this.mDcdnStatus
        }

        set vipEnterType(t) {
            let e = this.vipEnterType;
            if (this.canSetVipTaskType(e, t)) {
                let i = a.VipDownloadHelperNS.getVipTaskTypePriority(e) > a.VipDownloadHelperNS.getVipTaskTypePriority(t);
                this.exit(i), this.mVipEnterType = t, u.info("taskId", this.mTaskId, "subId", this.subId, "vipEnterType", t), this.mVipEnterStatus = n.VipDownloadDefineNS.VipTaskStatus.Unkown
            }
        }

        get vipEnterType() {
            return this.mVipEnterType
        }

        set vipEnterStatus(t) {
            this.canSetVipTaskStatus(t) && (this.mVipEnterStatus = t)
        }

        get vipEnterStatus() {
            return this.mVipEnterStatus
        }

        set tokenEnable(t) {
            this.mTokenEnable = t
        }

        get tokenEnable() {
            return this.mTokenEnable
        }

        acclerate(t) {
            if (this.tokenData && this.tokenData.token) {
                let e = this.tokenData.token;
                this.enableTaskCert(e, t)
            }
        }

        unAcclerate() {
            this.disableTaskCert(), this.reset()
        }

        exit(t) {
            t && this.unAcclerate(), this.clear()
        }

        enableTaskCert(t, e) {
            let i = this.mTask.getTaskBase();
            if (i) {
                let n = this.mTaskId, a = this.mSubId;
                i.taskType === o.DownloadKernel.TaskType.Group && (n = this.mSubId, a = -1), this.mTokenEnable = !0, s.TaskCertOperationNS.enableTaskCert(n, a, t), r.default.emit(r.TaskEventNS.taskAcclerateTypeResult, n, a, e)
            }
        }

        disableTaskCert() {
            let t = this.mTask.getTaskBase();
            if (t) {
                let e = this.mTaskId, i = this.mSubId;
                t.taskType === o.DownloadKernel.TaskType.Group && (e = this.mSubId, i = -1), this.mDcdnStatus = void 0, this.mTokenEnable = !1, s.TaskCertOperationNS.disableTaskCert(e, i)
            }
        }

        setStatusResult2Dk(t, e) {
            this.mFileProperty = t, this.mHasVipResource = e, r.default.emit(r.TaskEventNS.taskStatusQueryResult, this.mTaskId, this.mSubId, t, e)
        }

        reset() {
            this.mError = null, this.mCommited = void 0
        }

        clear() {
            this.mError = null, this.mCommited = void 0, this.mTokenData = null, this.mStatusData = null, this.mTokenEnable = !1
        }

        isVipTaskTypeEnable(t) {
            let e = a.VipDownloadHelperNS.isVipTaskTypeEnable(this.mTaskId, t);
            if (e && (t === n.VipDownloadDefineNS.VipTaskType.Try || t === n.VipDownloadDefineNS.VipTaskType.Ad)) {
                let t = l.default.getTask(this.mTaskId);
                e = t && t.subId === this.subId
            }
            return e
        }

        canSetVipTaskType(t, e) {
            let i = !0;
            do {
                if (t === e) {
                    i = !1;
                    break
                }
                let s = a.VipDownloadHelperNS.getVipTaskTypePriority(t),
                    o = a.VipDownloadHelperNS.getVipTaskTypePriority(e), r = this.isVipTaskTypeEnable(t);
                if (s >= o && r && this.vipEnterStatus !== n.VipDownloadDefineNS.VipTaskStatus.Unkown) {
                    i = !1;
                    break
                }
                i = this.isVipTaskTypeEnable(e)
            } while (0);
            return i
        }

        canSetVipTaskStatus(t) {
            let e = !1;
            do {
                let i = this.vipEnterStatus;
                if (i === t) break;
                if (i === n.VipDownloadDefineNS.VipTaskStatus.CommitFailed && (t === n.VipDownloadDefineNS.VipTaskStatus.AcclerateWait || t === n.VipDownloadDefineNS.VipTaskStatus.AcclerateFailed || t === n.VipDownloadDefineNS.VipTaskStatus.Acclerating)) break;
                let a = this.mTask.getFile(this.subId);
                if (!a || !a.isNeedDownload) break;
                t === n.VipDownloadDefineNS.VipTaskStatus.Unkown ? e = !0 : t === n.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped || i === n.VipDownloadDefineNS.VipTaskStatus.AcclerateStoped ? e = !0 : t > i && (e = !0)
            } while (0);
            return e
        }
    }
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(10);
    !function (t) {
        let e = new Map;
        t.enableTaskCert = function (t, i, a) {
            let s = function (t, i) {
                let n = e.get(t);
                return !n && i && (n = new Map, e.set(t, n)), n
            }(t, !0);
            s.get(i) ? n.default.updateDcdnWithVipCert(t, i, a).catch() : (n.default.enableDcdnWithVipCert(t, i, a).catch(), s.set(i, !0))
        }, t.disableTaskCert = function (t, i) {
            let a = e.get(t);
            a && (n.default.disableDcdnWithVipCert(t, i).catch(), a.delete(i))
        }
    }(e.TaskCertOperationNS || (e.TaskCertOperationNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(226), o = i(228), r = i(10), l = i(0).default.getLogger("VipDownload:offline-page");
    var u;
    !function (t) {
        t[t.Init = 0] = "Init", t[t.CommitWait = 1] = "CommitWait", t[t.Commiting = 2] = "Commiting", t[t.CommitFailed = 3] = "CommitFailed", t[t.CommitSuccess = 4] = "CommitSuccess"
    }(u = e.OfflineTaskStatus || (e.OfflineTaskStatus = {}));
    e.OfflineTask = class {
        constructor(t) {
            this.mOfflineTaskStatus = void 0, this.mCache = null, this.mTaskId = t.getTaskId(), this.mTask = t, this.offlineTaskStatus = u.Init, this.mCache = new o.OfflineTaskCacheNS.Task(this.mTaskId)
        }

        get taskId() {
            return this.mTaskId
        }

        get task() {
            return this.mTask
        }

        get offlineTaskStatus() {
            return this.mOfflineTaskStatus
        }

        set offlineTaskStatus(t) {
            (void 0 === this.mOfflineTaskStatus || t === u.Init || t > this.mOfflineTaskStatus) && (this.mOfflineTaskStatus = t)
        }

        enter() {
            return n(this, void 0, void 0, function* () {
                this.offlineTaskStatus === u.Init && (yield this.commit())
            })
        }

        exit() {
            this.clear(), this.offlineTaskStatus = u.Init
        }

        remove() {
            this.clear(!0)
        }

        loadData() {
            return n(this, void 0, void 0, function* () {
                yield this.mCache.load()
            })
        }

        clear(t) {
            this.mCache.clear(t)
        }

        commit() {
            return n(this, void 0, void 0, function* () {
                l.info("commit"), this.offlineTaskStatus = u.CommitWait;
                let t = this.task.getTaskBase();
                if (!t) return null;
                let e = [];
                if (t.taskType === a.DownloadKernel.TaskType.Bt) this.mCache.getItem(-1) || e.push(-1); else {
                    let t = this.task.getSelectFiles();
                    for (let i of t) this.mCache.getItem(i.subId) || e.push(i.subId)
                }
                if (l.info("subIds", e), e.length > 0) {
                    this.offlineTaskStatus = u.Commiting;
                    for (let t of e) yield this.commitOneTask(t)
                }
            })
        }

        commitOneTask(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.task.getTaskBase();
                if (!e) return l.info("taskBase not exits!"), null;
                let i = null;
                if (e.taskType === a.DownloadKernel.TaskType.Bt) {
                    let t = this.task.getTaskDetail();
                    if (!t) return l.info("taskDetail not exits!"), null;
                    let n = [], a = this.task.getSelectFiles();
                    for (let t of a) n.push(t.subId);
                    i = {
                        url: r.default.createBtTaskUrl(t.infoId),
                        filename: e.taskName,
                        gcid: "",
                        cid: "",
                        filesize: e.fileSize,
                        file_indexs: n,
                        refer_url: e.refUrl || "",
                        cookies: ""
                    }
                } else {
                    let e = this.task.getFile(t);
                    if (!e) return l.info("file not exits!"), null;
                    i = {
                        url: e.url,
                        filename: e.fileName,
                        gcid: e.gcid,
                        cid: e.cid,
                        filesize: e.fileSize,
                        file_indexs: [],
                        refer_url: e.refUrl || "",
                        cookies: ""
                    }
                }
                let n = {taskInfo: i}, o = yield(new s.OfflineTaskHttpSession).commitTask(n);
                this.onCommitTaskCallback(t, o)
            })
        }

        onCommitTaskCallback(t, e) {
            e && (0 === e.result ? this.offlineTaskStatus = u.CommitSuccess : this.offlineTaskStatus = u.CommitFailed, this.mCache.setItemData(t))
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(15), o = i(227), r = i(3), l = i(1), u = i(81),
        c = i(0).default.getLogger("VipDownload:offline-page");
    e.OfflineTaskHttpSession = class extends s.HttpSession {
        commitTask(t) {
            return n(this, void 0, void 0, function* () {
                let e = r.default.userId, i = yield r.default.getSessionId(), n = l.default.thunderVersionNumber,
                    s = l.default.currentTime, d = Math.random(), h = "+]^%?#@COLL`(^POSTxl_pc" + n + s + d,
                    f = "client_name=xl_pc&client_version=" + n + "&ts=" + s + "&r=" + d + "&key=" + (h = u.ToolsUtilitiesAWNS.genarateMd5(h));
                return c.info("key", h), this.host = "api.zone.lixian.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/tasks/" + e + "?" + f, this.auth = e + ":" + i + ":client:0", this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = e, this.body = yield o.OfflineTaskHttpPackageNS.createCommitTaskBuffer(t), yield this.postCommitTaskRequest(t)
            })
        }

        postCommitTaskRequest(t) {
            return new Promise(e => {
                this.post(i => {
                    let n = null;
                    r.default.userId === t.userId && 200 === i.statusCode && i.body && (n = o.OfflineTaskHttpPackageNS.praseCommitTaskBuffer(i.body)), e(n)
                }, t => {
                    c.info("error", t), e(null)
                })
            })
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(0).default.getLogger("VipDownload:offline-page");
    !function (t) {
        t.createCommitTaskBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                a.info("--\x3ecreateCommitTaskBuffer");
                let e = {task_info: t.taskInfo}, i = JSON.stringify(e);
                a.info("jsonStr", i);
                let n = Buffer.from(i);
                return a.info("<--createCommitTaskBuffer"), n
            })
        }, t.praseCommitTaskBuffer = function (t) {
            a.info("--\x3epraseCommitTaskBuffer");
            let e = null;
            if (t) {
                let i = t.toString();
                a.info("jsonStr", i);
                try {
                    e = JSON.parse(i)
                } catch (t) {
                    a.warn(t)
                }
            }
            return a.info("<--praseCommitTaskBuffer"), e
        }
    }(e.OfflineTaskHttpPackageNS || (e.OfflineTaskHttpPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(193).OfflineTaskDataBaseNS.getTable();
    !function (t) {
        class e {
            constructor(t) {
                this.mSubId = t
            }

            get subId() {
                return this.mSubId
            }

            set itemData(t) {
                this.mData = t
            }

            get itemData() {
                return this.mData
            }
        }

        t.SubTask = e;
        t.Task = class {
            constructor(t) {
                this.mTaskId = void 0, this.mSubTasks = new Map, this.mTaskId = t
            }

            createItem(t) {
                let i = this.getItem(t);
                return i || (i = new e(t), this.mSubTasks.set(t, i)), i
            }

            deleteItem(t) {
                this.mSubTasks.delete(t)
            }

            getItem(t) {
                return this.mSubTasks.get(t)
            }

            setItemData(t, e) {
                this.createItem(t).itemData = e, this.save(t).catch()
            }

            load() {
                return n(this, void 0, void 0, function* () {
                    let t = yield a.getTaskIndexs(this.mTaskId);
                    for (let e of t) this.setItemData(e)
                })
            }

            save(t) {
                return n(this, void 0, void 0, function* () {
                    (yield a.isTaskExist(this.mTaskId, t)) || (yield a.setUserData(this.mTaskId, t))
                })
            }

            clear(t) {
                this.mSubTasks.clear(), t && a.removeTask(this.mTaskId, -2).catch()
            }
        }
    }(e.OfflineTaskCacheNS || (e.OfflineTaskCacheNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(8), o = i(163), r = i(14), l = i(2), u = i(151), c = i(42), d = i(53), h = i(13), f = i(1),
        p = i(3), g = i(41), S = i(44), y = i(5), {isDef: T} = y.ThunderUtil,
        k = i(0).default.getLogger("VipDownload:try-operation");
    e.TryOperation = class {
        constructor(t) {
            this.isChecking = !1, this.isShow = !1, this.isEnter = !1, this.isFinish = !1, this.tryTimer = null, this.tryFinishTimer = null, this.remainTime = void 0, this.remainSize = void 0, this.startSize = void 0, this.trySize = void 0, this.totalSize = void 0, this.detail = null, this.channelSpeeds = new Map, this.task = null, this.taskId = t.getTaskId(), this.task = t, u.TryTaskDataBaseNS.loadTask(this.taskId).catch(), r.default.addListener(r.TaskEventNS.subTaskStatusChanged, this.onSubTaskStatusChanged.bind(this))
        }

        onSomeOperation(t, ...e) {
            return n(this, void 0, void 0, function* () {
            })
        }

        get tryType() {
            let t = s.VipDownloadDefineNS.TryType.PlatinumVip;
            return this.cache && (t = this.cache.type), t
        }

        set trySection(t) {
            this.cache && (this.cache.trySection = t, this.task.getVipTask().updateVipTaskInfo())
        }

        get trySection() {
            let t = void 0;
            return this.cache && (t = this.cache.trySection), t
        }

        get verify() {
            let t = this.cache ? this.cache.trialVerify : "";
            return this.trySection === s.VipDownloadDefineNS.TryType.PlatinumVip && (t = this.cache.platinumVerify), t
        }

        get subId() {
            let t = void 0;
            return this.cache && (t = this.cache.subId), t
        }

        get enableKuaiNiao() {
            return this.tryType === s.VipDownloadDefineNS.TryType.SuperVip
        }

        getTryDetail() {
            return this.detail
        }

        getChannelSpeed(t) {
            return this.channelSpeeds.get(t)
        }

        remove() {
            k.info("remove"), this.clear(), g.default.removeTask(this.taskId, !0), r.default.removeListener(r.TaskEventNS.subTaskStatusChanged, this.onSubTaskStatusChanged)
        }

        clear() {
            k.info("clear"), this.killTryTimer(), this.killTryFinishTimer(), this.isEnter = !1, this.isShow = !1, g.default.removeTaskId(this.taskId), this.changeXgtState(s.VipDownloadDefineNS.XgtState.Exit)
        }

        active() {
            return n(this, void 0, void 0, function* () {
                if (this.isChecking) k.info("is checking try!"); else {
                    this.isChecking = !0;
                    do {
                        if (k.info("active"), this.adOperation && !this.adOperation.refreshAdShow()) break;
                        if (!(yield this.refreshTryShow())) break;
                        if (this.task.getTaskStatus() !== a.DownloadKernel.TaskStatus.Started) {
                            k.info("this task is not started!");
                            break
                        }
                        if (!(yield this.canQueryTry())) {
                            k.info("this task can not query try!");
                            break
                        }
                        let t = this.findTrySubId();
                        if (void 0 === t) {
                            k.info("subId invalid!");
                            break
                        }
                        yield this.queryTry(t)
                    } while (0);
                    this.isChecking = !1
                }
            })
        }

        enter() {
            return n(this, void 0, void 0, function* () {
                k.info("enter"), this.beforeEnter(), this.isEnter = !0, this.commitTry(), this.updateDetail(), this.kuaiNiaoAcclerate()
            })
        }

        setFinishClickDispearDelay() {
            let t = void 0;
            t = this.tryType === s.VipDownloadDefineNS.TryType.PlatinumVip ? h.default.getValue("VipDownload", "TryFinishClickDispearDelay") : h.default.getValue("VipDownload", "SuperTryFinishClickDispearDelay"), this.killTryFinishTimer(), this.createTryFinishTimer(t)
        }

        onStatusCallback(t) {
            return n(this, void 0, void 0, function* () {
                k.info("onStatusCallback"), this.isEnter && 0 !== t && this.failed()
            })
        }

        onTokenCallback(t) {
            return n(this, void 0, void 0, function* () {
                k.info("onTokenCallback"), this.isEnter && (0 === t ? this.remainTime = this.maxTime : this.failed())
            })
        }

        onDcdnResultCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                k.info("onDcdnResultCallback", t, e);
                let i = this.task.getTaskStatus();
                this.isEnter && !this.isFinish && T(t) && this.subId === t && i === a.DownloadKernel.TaskStatus.Started && (e ? this.createTryTimer() : this.failed())
            })
        }

        get cache() {
            return g.default.getTask(this.taskId)
        }

        get isInit() {
            return this.isShow && !this.isEnter
        }

        get maxTime() {
            let t = void 0, e = this.task.getVipTask().getTokenData(this.subId);
            return e && e.maxTime && (t = e.maxTime, this.trySection === s.VipDownloadDefineNS.TryType.PlatinumVip && (t = 2 * t / 3)), t
        }

        get adOperation() {
            return this.task.getVipTask().getOperation(s.VipDownloadDefineNS.VipTaskType.Ad)
        }

        removeTry() {
            k.info("removeTry"), this.exit()
        }

        refreshTryShow() {
            return n(this, void 0, void 0, function* () {
                let t = !0, e = f.default.currentTime, i = this.isShow, n = this.isInit;
                const a = g.default.getTask(this.taskId);
                n && a && a.createTime && a.expireTime && e - a.createTime > a.expireTime && (this.removeTry(), i = !1, n = !1);
                let o = !1;
                return a && (o = yield this.canShowTry(a.type)), n && !o ? (k.info("task can not show try anymore!"), this.removeTry(), !1) : i ? (k.info("task already show try!"), this.changeXgtState(s.VipDownloadDefineNS.XgtState.Ready, {type: a.type}), !1) : (a && (a.trialKey && !a.commited && !a.isAdUser && o ? (k.info("show try from cache"), this.changeXgtState(s.VipDownloadDefineNS.XgtState.Ready, {type: a.type})) : k.info("this task had query!"), t = !1), t)
            })
        }

        get userCanTry() {
            return !p.default.isSuperVip && !p.default.hasFlux
        }

        canQueryTry() {
            return n(this, void 0, void 0, function* () {
                if (!this.userCanTry) return k.info("this user can not try!"), !1;
                let t = this.task.getTaskBase();
                if (!t) return k.info("task base not exist!"), !1;
                if (t.taskType === a.DownloadKernel.TaskType.Group) return k.info("this task is group task!"), !1;
                if (yield this.task.getIsHDVideo(-1)) return k.info("this task is hd vedio!"), !1;
                if (yield this.task.getIsWeiDuanYouXi(-1)) return k.info("this task is weiduan youxi!"), !1;
                if (!g.default.isAdUser && g.default.chances <= 0) return k.info("no chances to try!", "chances:", g.default.chances), !1;
                let e = g.default.taskId;
                return !e || e === this.taskId || (k.info("another task trying!", "taskId:", e), !1)
            })
        }

        canShowTry(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.task.getTaskBase();
                if (!e) return k.info("task base not exist!"), !1;
                let i = f.default.currentTime,
                    n = yield l.client.callServerFunction("GetValue", "VipDownload", "LastTryEnterTime", 0),
                    a = h.default.getValue("VipDownload", "TryInterval");
                if (i - n < a) return k.info("interval time less than ", a), !1;
                let o = u.TryTaskDataBaseNS.getTask(this.taskId);
                if (o && o.tryDate) {
                    let t = (new Date).toDateString();
                    if (o.tryDate === t) return k.info("this task had try today!"), !1
                }
                if (!(yield this.canQueryTry())) return !1;
                if (t !== s.VipDownloadDefineNS.TryType.SuperVip) {
                    if (p.default.authority) return k.info("current user has superspeed authority!"), !1;
                    if (this.task.getVipTask().getVipTaskInfo().taskStatus !== s.VipDownloadDefineNS.VipTaskStatus.Init) return k.info("task already enter!"), !1
                }
                let r = 0, c = 0;
                t !== s.VipDownloadDefineNS.TryType.PlatinumVip ? (r = h.default.getValue("VipDownload", "EnableSuperTryMinSize"), c = h.default.getValue("VipDownload", "EnableSuperTryMaxProgress")) : (r = h.default.getValue("VipDownload", "EnableTryMinSize"), c = h.default.getValue("VipDownload", "EnableTryMaxProgress"));
                let d = e.fileSize || 0;
                return d < r ? (k.info("fileSize less than minSize!"), !1) : !(100 * (e.downloadSize || 0) / d > c && (k.info("progress more than maxProgress!"), 1))
            })
        }

        findTrySubId() {
            let t = 0, e = void 0;
            const i = h.default.getValue("VipDownload", "FileEnableTryMinSize");
            let n = this.task.getDownloadingFiles();
            for (let a of n) {
                if (!a.isNeedDownload) continue;
                let n = (a.fileSize || 0) - (a.downloadSize || 0);
                a.gcid && "" !== a.gcid && a.cid && "" !== a.cid && n > i && n > t && (t = n, e = a.subId)
            }
            return e
        }

        queryTry(t) {
            return n(this, void 0, void 0, function* () {
                k.info("queryTry", this.taskId, t);
                let e = this.task.getTaskBase(), i = this.task.getFile(t);
                if (!e || !i) return null;
                let n = {btTitle: 2 === e.taskType ? e.taskName : void 0, file: i, taskId: this.taskId},
                    a = yield(new o.TryTaskHttpSession).query(n);
                if (a) if (g.default.setQueryData(this.taskId, t, a), a.isAdUser) this.adOperation && (yield this.adOperation.active(t, n)); else if (0 === a.result && (yield this.canShowTry(a.type))) {
                    let t = !1;
                    a.type === s.VipDownloadDefineNS.TryType.MixVip && (t = !0), this.changeXgtState(s.VipDownloadDefineNS.XgtState.Ready, {
                        emitTryMiniWeb: t,
                        type: a.type
                    })
                }
            })
        }

        showTry(t) {
            return n(this, void 0, void 0, function* () {
                return !!(yield this.canShowTry(t.type)) && (g.default.taskId && this.taskId !== g.default.taskId ? (k.info("showingAnthoerTry", this.taskId, g.default.taskId), !1) : (k.info("showTry", this.taskId), this.isShow = !0, g.default.setTaskId(this.taskId), this.task.getVipTask().show(s.VipDownloadDefineNS.VipTaskType.Try, !0), t && !0 === t.emitTryMiniWeb && r.default.emit(r.TaskEventNS.showTaskTryMiniWeb, "ready", this.taskId), !0))
            })
        }

        hideTry() {
            k.info("hide", this.taskId), this.isShow = !1, g.default.removeTaskId(this.taskId)
        }

        beforeEnter() {
            this.totalSize = this.getTrySize(), this.trySize = this.totalSize, this.tryType === s.VipDownloadDefineNS.TryType.MixVip && (this.trySize /= 2), k.info("totalSize", this.totalSize, "trySize", this.trySize, "trySection", this.trySection), this.remainSize = this.trySize;
            let t = this.task.getVipTask().getSectionSpeed();
            this.channelSpeeds.set("normal", t.speed), t.reset()
        }

        commitTry() {
            if (k.info("commitTry"), !this.cache) return;
            let t = this.task.getFile(this.cache.subId);
            if (!t) return;
            let e = {trialKey: this.cache.trialKey, file: t};
            (new o.TryTaskHttpSession).commit(e).then(t => {
                this.onCommitCallback(t)
            }).catch()
        }

        commit(t) {
            return n(this, void 0, void 0, function* () {
                k.info("commit", this.taskId);
                let e = this.subId;
                T(e) && (yield this.task.getVipTask().commit([e], t))
            })
        }

        platinumFinish() {
            k.info("platinumFinish");
            let t = this.task.getTaskBase();
            if (!t || void 0 === t.receiveSize) return void k.info("taskBase.receiveSize not exist!");
            let e = this.task.getVipTask().getSectionSpeed();
            this.channelSpeeds.set("platinumVip", e.speed), e.reset(), this.trySection = s.VipDownloadDefineNS.TryType.SuperVip, this.remainTime = this.maxTime, this.startSize = t.receiveSize, this.remainSize = this.trySize, this.updateDetail(), this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started && (this.verify && this.commit(s.VipDownloadDefineNS.QueryOption.TokenOnly).catch(), this.kuaiNiaoAcclerate(!0))
        }

        finish() {
            k.info("finish"), this.killTryTimer();
            let t = void 0, e = this.task.getVipTask().getSectionSpeed();
            this.tryType === s.VipDownloadDefineNS.TryType.PlatinumVip ? (t = h.default.getValue("VipDownload", "TryFinishDispearDelay"), this.channelSpeeds.set("platinumVip", e.speed), e.reset()) : (t = h.default.getValue("VipDownload", "SuperTryFinishDispearDelay"), this.channelSpeeds.set("superVip", e.speed), e.reset()), this.showTryFinishTips(), this.createTryFinishTimer(t), this.isFinish = !0, this.task.getVipTask().finish(this.subId)
        }

        failed(t, e) {
            k.info("failed"), this.createTryFailTimer(), this.isFinish = !0, this.task.getVipTask().fail(this.subId, t, e)
        }

        exit() {
            k.info("exit"), this.clear(), this.task.getVipTask().exit()
        }

        kuaiNiaoAcclerate(t) {
            (this.enableKuaiNiao || t) && S.default.enter().catch()
        }

        updateDetail() {
            let t = this.task.getTaskBase();
            if (!t) return;
            let e = t.vipSpeed || 0, i = t.downloadSpeed || 0, n = Math.max(i - e, 0),
                a = this.trySize ? 1 - this.remainSize / this.trySize : 0;
            this.detail = {
                remainSize: this.remainSize,
                progress: a,
                normalSpeed: n,
                vipSpeed: e
            }, r.default.emit(r.TaskEventNS.taskTryDetailChanged, this.taskId, this.detail), l.client.broadcastEvent(d.BroadcastEventNS.taskTryDetailChanged, this.taskId, this.detail)
        }

        getTrySize() {
            let t = 0, e = this.task.getTaskBase();
            if (!e || !e.fileSize) return t;
            if (!this.cache || void 0 === this.cache.subId) return t;
            let i = this.task.getFile(this.cache.subId);
            if (!i) return t;
            const n = h.default.getValue("VipDownload", "TryMaxProgress"),
                a = h.default.getValue("VipDownload", "TryMaxSize");
            t = Math.floor(e.fileSize * n / 100), t = Math.min(t, a);
            let s = (i.fileSize || 0) - (i.downloadSize || 0);
            return k.info("remainSize", s), s >= 0 && (t = Math.min(t, s)), t
        }

        onSubTaskStatusChanged(t, e, i) {
            let n = this.task.getTaskBase();
            n && n.taskType === a.DownloadKernel.TaskType.Bt && e === this.subId && i === a.DownloadKernel.BtFileStatus.Complete && (k.info("onSubTaskStatusChanged", e, "Complete"), this.isEnter && !this.isFinish && this.finish())
        }

        onCommitCallback(t) {
            if (k.info("onCommitCallback"), this.isEnter && t) {
                let e = !1;
                if (e = this.tryType === s.VipDownloadDefineNS.TryType.MixVip ? Boolean(t.verify && t.baijinVerify) : Boolean(t.verify), 0 !== t.result || e || (t.result = c.HttpErrorNS.errorParam, t.message = c.HttpErrorNS.getMessage(t.result)), g.default.setCommitData(this.taskId, t), 0 === t.result) this.task.getTaskStatus() === a.DownloadKernel.TaskStatus.Started && this.commit().catch(); else {
                    let e = t;
                    e.errorStep = c.HttpDefineNS.ErrorStep.Commit, this.cache && (this.cache.error = e);
                    let i = s.VipDownloadDefineNS.VipTaskStatus.CommitFailed;
                    this.failed(i, e)
                }
            }
        }

        createTryTimer() {
            if (!this.tryTimer) {
                if (k.info("createTryTimer"), void 0 === this.maxTime) return void k.info("maxTime not exist!");
                k.info("maxTime", this.maxTime);
                let t = this.task.getTaskBase();
                if (!t || void 0 === t.receiveSize) return void k.info("taskBase.receiveSize not exist!");
                this.remainTime = this.maxTime, this.startSize = t.receiveSize, k.info("startSize", this.startSize), this.tryTimer = setInterval(() => {
                    this.onTryTimer()
                }, 1e3)
            }
        }

        onTryTimer() {
            this.remainTime -= 1;
            let t = this.task.getTaskBase();
            if (t && t.receiveSize) {
                k.info("receiveSize", t.receiveSize);
                let e = t.receiveSize - this.startSize;
                this.remainSize = this.trySize - e
            }
            k.info("remainSize", this.remainSize), k.info("remainTime", this.remainTime), this.remainSize <= 0 && (this.remainSize = 0, this.remainTime = 0), t.taskStatus === a.DownloadKernel.TaskStatus.Started && this.updateDetail(), this.remainTime <= 0 && (this.trySection === s.VipDownloadDefineNS.TryType.PlatinumVip ? this.platinumFinish() : this.finish())
        }

        killTryTimer() {
            this.tryTimer && (k.info("killTryTimer"), clearInterval(this.tryTimer), this.tryTimer = void 0)
        }

        createTryFinishTimer(t) {
            this.tryFinishTimer || (k.info("createTryFinishTimer"), this.tryFinishTimer = setTimeout(() => {
                this.killTryFinishTimer(), this.exit()
            }, 1e3 * t))
        }

        killTryFinishTimer() {
            this.tryFinishTimer && (k.info("killTryFinishTimer"), clearTimeout(this.tryFinishTimer), this.tryFinishTimer = void 0)
        }

        createTryFailTimer() {
            let t = h.default.getValue("VipDownload", "TryFailDispearDelay");
            this.createTryFinishTimer(t)
        }

        showTryFinishTips() {
            k.info("showTryFinishTips");
            let t = this.channelSpeeds.get("normal"), e = this.channelSpeeds.get("platinumVip"),
                i = this.channelSpeeds.get("superVip"), n = 0, a = 0, o = 0;
            t && t.size && t.time && (o = Math.floor(t.size / t.time)), e && e.size && e.time && (n = Math.floor(e.size / e.time)), i && i.size && i.time && (a = Math.floor(i.size / i.time));
            let l = a || n;
            o >= 0 && l > 0 && (r.default.emit(r.TaskEventNS.showTaskTryTips, "finish", this.taskId, {
                normalSpeed: o,
                vipSpeed: l
            }), this.tryType === s.VipDownloadDefineNS.TryType.MixVip && n > 0 && a > 0 && r.default.emit(r.TaskEventNS.showTaskTryMiniWeb, "finish", this.taskId, {
                normalSpeed: o,
                platinumVipSpeed: n,
                superVipSpeed: a
            }))
        }

        changeXgtState(t, e) {
            this.task.getVipTask().changeXgtState(s.VipDownloadDefineNS.XgtType.Try, t, e)
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(8), o = i(231), r = i(163), l = i(14), u = i(2), c = i(53), d = i(42), h = i(164), f = i(41),
        p = i(13), g = i(5), {isDef: S} = g.ThunderUtil, y = i(0).default.getLogger("VipDownload:ad-operation"),
        T = 52428800, k = 10;

    class m {
        constructor(t) {
            this.task = null, this.detail = null, this.tryTimer = null, this.tryFinishTimer = null, this.isShow = !1, this.isEnter = !1, this.isFinish = !1, this.remainTime = 0, this.remainSize = 0, this.startSize = 0, this.trySize = 0, this.chances = 0, this.canUses = 0, this.expireSize = 0, this.isQueryTry = !1, this.perSize = void 0, this.isReady = !1, this.canShowAdGlobal = !1, this.taskId = t.getTaskId(), this.task = t
        }

        onSomeOperation(t, ...e) {
            return n(this, void 0, void 0, function* () {
            })
        }

        getTryDetail() {
            return this.detail
        }

        enter() {
            return n(this, void 0, void 0, function* () {
                if (this.gcidLeftCount > 0) {
                    let t = this.getTrySize();
                    this.trySize += t, this.remainSize += t, this.expireSize += t, this.updateDetail()
                }
                this.isEnter = !0, this.isFinish = !1, this.commitAd()
            })
        }

        remove() {
            y.info("remove"), this.clear(), h.default.removeTask(this.taskId, !0), f.default.removeTask(this.taskId, !0), l.default.removeListener(l.TaskEventNS.subTaskStatusChanged, this.onSubTaskStatusChanged)
        }

        clear() {
            y.info("clear"), this.killTryTimer(), this.killTryFinishTimer(), this.isEnter = !1, this.isShow = !1, m.sShowingAd = !1, h.default.removeTaskId(this.taskId), f.default.removeTaskId(this.taskId)
        }

        active(t, e) {
            return n(this, void 0, void 0, function* () {
                y.info("active"), this.canShowAd(t) && (yield this.queryAd(e, !0))
            })
        }

        refreshAdShow() {
            if (this.isInit) {
                y.info("isInit");
                const t = h.default.getTask(this.taskId);
                if (!t) return y.info("cache is null"), this.removeAd(), !1;
                if (y.info("gcidUseLeftCount", t.gcidUseLeftCount, "chances", h.default.chances), t.gcidUseLeftCount <= 0 && h.default.chances <= 0) return y.info("can not show ad task any more!"), this.removeAd(), !1
            }
            return !0
        }

        onStatusCallback(t) {
            return n(this, void 0, void 0, function* () {
                y.info("onStatusCallback"), this.isEnter && 0 !== t && this.failed()
            })
        }

        onTokenCallback(t) {
            return n(this, void 0, void 0, function* () {
                y.info("onTokenCallback"), this.isEnter && (0 === t ? this.remainTime = this.maxTime : this.failed())
            })
        }

        onDcdnResultCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                y.info("onDcdnResultCallback", t, e);
                let i = this.task.getTaskStatus();
                this.isEnter && !this.isFinish && S(t) && this.subId === t && i === a.DownloadKernel.TaskStatus.Started && (e ? this.createTryTimer() : this.failed())
            })
        }

        get cache() {
            return h.default.getTask(this.taskId)
        }

        get tryCache() {
            return f.default.getTask(this.taskId)
        }

        get isInit() {
            return this.isShow && !this.isEnter
        }

        get subId() {
            let t = void 0;
            return this.tryCache && (t = this.tryCache.subId), t
        }

        get maxTime() {
            let t = void 0, e = this.task.getVipTask().getTokenData(this.subId);
            return e && e.maxTime && (t = e.maxTime), t
        }

        get gcidLeftCount() {
            let t = this.cache ? this.cache.gcidLeftCount : 0;
            return y.info("count", t, "chances", h.default.chances), t = Math.min(h.default.chances, t)
        }

        init() {
            if (y.info("init"), this.cache) {
                let t = this.cache.gcidUseLeftCount, e = this.getTrySize();
                this.trySize = e * t, this.remainSize = this.trySize, this.expireSize = Math.max(0, this.remainSize - e), this.chances = t, y.info("trySize", this.trySize)
            }
            this.updateDetail(), l.default.addListener(l.TaskEventNS.subTaskStatusChanged, this.onSubTaskStatusChanged.bind(this))
        }

        removeAd() {
            y.info("removeAd"), this.exit()
        }

        canShowAd(t) {
            if (!this.canShowAdGlobal) return !1;
            let e = this.task.getFile(t);
            if (!e) return y.info("task base not exist!"), !1;
            let i = e.fileSize || 0;
            return !(i < 209715200) || (y.info("fileSize less than minSize, fileSize =", i), !1)
        }

        queryAdScene() {
            return n(this, void 0, void 0, function* () {
                if (!h.default.sceneData) {
                    let t = new o.AdTaskHttpSession;
                    h.default.sceneData = yield t.queryScene()
                }
            })
        }

        commitAd() {
            y.info("commitAd");
            let t = h.default.subId, e = this.task.getTaskBase(), i = this.task.getFile(t);
            if (!e || !i) return void y.info("taskBase is null");
            let n = {btTitle: 2 === e.taskType ? e.taskName : void 0, file: i, taskId: this.taskId},
                a = this.gcidLeftCount > 0;
            if (y.info("enableGift", a), a) {
                (new o.AdTaskHttpSession).commit(n).then(t => {
                    this.onCommitAdCallback(n, t)
                }).catch()
            } else this.checkQueryTry().catch()
        }

        queryAd(t, e) {
            return n(this, void 0, void 0, function* () {
                y.info("queryAd");
                let i = yield(new o.AdTaskHttpSession).query(t);
                if (e) {
                    if (i && 0 === i.result && (i.gcidLeftCount > 0 || i.gcidUseLeftCount > 0)) {
                        const e = t.file.subId;
                        h.default.setQueryData(this.taskId, i, e), yield this.queryAdScene(), this.task.getVipTask().changeXgtState(s.VipDownloadDefineNS.XgtType.Ad, s.VipDownloadDefineNS.XgtState.Ready, {subId: e})
                    }
                } else if (this.isEnter && i) {
                    h.default.setQueryData(this.taskId, i);
                    let t = this.task.getVipTask().getVipTaskStatus();
                    t > s.VipDownloadDefineNS.VipTaskStatus.Init && t < s.VipDownloadDefineNS.VipTaskStatus.Finished && this.updateDetail()
                }
            })
        }

        checkQueryTry() {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.isQueryTry) {
                        y.info("is querying try");
                        break
                    }
                    if (this.chances <= 0) {
                        y.info("no chances to try");
                        break
                    }
                    if (this.canUses > 0) {
                        y.info("is trying");
                        break
                    }
                    if (this.task.getTaskStatus() !== a.DownloadKernel.TaskStatus.Started) return void y.info("task is not start");
                    if (y.info("remainSize", this.remainSize, "remainSize", this.expireSize, "remainTime", this.remainTime), this.remainSize < this.expireSize + T || this.remainTime < k) {
                        this.isQueryTry = !0;
                        let t = this.getTrySize();
                        this.expireSize = Math.max(0, this.expireSize - t), yield this.queryTry(), this.isQueryTry = !1
                    }
                } while (0)
            })
        }

        queryTry() {
            return n(this, void 0, void 0, function* () {
                y.info("queryTry"), this.chances--, this.canUses++;
                let t = h.default.subId, e = this.task.getTaskBase(), i = this.task.getFile(t);
                if (!e || !i) return null;
                let n = {btTitle: 2 === e.taskType ? e.taskName : void 0, file: i, taskId: this.taskId},
                    a = yield(new r.TryTaskHttpSession).query(n);
                do {
                    if (!this.isEnter) break;
                    if (a) {
                        let t = n.file.subId;
                        if (f.default.setQueryData(this.taskId, t, a), 0 === a.result) {
                            let t = {trialKey: a.trialKey, file: n.file};
                            yield this.commitTry(t);
                            break
                        }
                    }
                    let t = a;
                    t && this.cache && (t.errorStep = d.HttpDefineNS.ErrorStep.Commit, this.cache.error = t);
                    let e = s.VipDownloadDefineNS.VipTaskStatus.CommitFailed;
                    this.failed(e, t)
                } while (0)
            })
        }

        commitTry(t) {
            return n(this, void 0, void 0, function* () {
                y.info("commitTry");
                let e = new r.TryTaskHttpSession;
                t.isAdUser = !0;
                let i = yield e.commit(t);
                do {
                    if (!this.isEnter) break;
                    if (i) {
                        let t = Boolean(i.verify);
                        if (0 !== i.result || t || (i.result = d.HttpErrorNS.errorParam, i.message = d.HttpErrorNS.getMessage(i.result)), f.default.setCommitData(this.taskId, i), 0 === i.result) {
                            yield this.commit(), this.canUses--;
                            break
                        }
                    }
                    let t = i;
                    t && this.cache && (t.errorStep = d.HttpDefineNS.ErrorStep.Commit, this.cache.error = t);
                    let e = s.VipDownloadDefineNS.VipTaskStatus.CommitFailed;
                    this.failed(e, t)
                } while (0)
            })
        }

        commit(t) {
            return n(this, void 0, void 0, function* () {
                y.info("commit", this.taskId);
                let e = this.subId;
                S(e) && (yield this.task.getVipTask().commit([e], t))
            })
        }

        showAd(t) {
            return !m.sShowingAd && (y.info("showAd"), m.sShowingAd = !0, this.isShow = !0, h.default.setTaskId(this.taskId, t), this.isReady || (this.isReady = !0, this.init()), this.task.getVipTask().show(s.VipDownloadDefineNS.VipTaskType.Ad, !0), !0)
        }

        finish() {
            if (y.info("finish"), this.killTryTimer(), this.gcidLeftCount <= 0) {
                let t = p.default.getValue("VipDownload", "AdFinishDispearDelay");
                this.createTryFinishTimer(t)
            }
            this.isFinish = !0, this.trySize = 0, this.remainSize = 0, this.remainTime = 0, this.expireSize = 0, this.startSize = 0, m.sShowingAd = !1, this.task.getVipTask().finish(this.subId)
        }

        failed(t, e) {
            y.info("failed"), this.killTryTimer(), this.createTryFailTimer(), this.isFinish = !0, m.sShowingAd = !1, this.task.getVipTask().fail(this.subId, t, e)
        }

        exit() {
            y.info("exit"), this.clear(), this.task.getVipTask().exit()
        }

        onSubTaskStatusChanged(t, e, i) {
            let n = this.task.getTaskBase();
            n && n.taskType === a.DownloadKernel.TaskType.Bt && e === this.subId && i === a.DownloadKernel.BtFileStatus.Complete && (y.info("onSubTaskStatusChanged", e, "Complete"), this.isEnter && !this.isFinish && this.finish())
        }

        onCommitAdCallback(t, e) {
            if (y.info("onCommitAdCallback"), this.isEnter && e) if (h.default.setCommitData(this.taskId, e), 0 === e.result) this.chances++, this.gcidLeftCount > 0 && this.queryAd(t).catch(), this.updateDetail(), this.checkQueryTry().catch(), y.info("Broadcast", c.BroadcastEventNS.advertisementFluxGot, this.taskId), u.client.callServerFunction("FireEventWebFunction", "vipMiniWeb", c.BroadcastEventNS.advertisementFluxGot, this.taskId).catch(); else {
                let t = e;
                t.errorStep = d.HttpDefineNS.ErrorStep.Commit, this.cache && (this.cache.error = t);
                let i = s.VipDownloadDefineNS.VipTaskStatus.CommitFailed;
                this.failed(i, t)
            }
        }

        getTrySize() {
            let t = this.perSize;
            do {
                if (void 0 !== t) break;
                let e = this.task.getTaskBase();
                if (!e || !e.fileSize) break;
                if (!this.cache || void 0 === this.cache.subId) break;
                if (!this.task.getFile(this.cache.subId)) break;
                const i = this.cache.maxSize;
                if (i) t = 1024 * i * 1024; else {
                    const i = this.cache.maxProgress;
                    t = Math.floor(e.fileSize * i / 100)
                }
            } while (0);
            return this.perSize = t || 0, t
        }

        createTryTimer() {
            if (!this.tryTimer) {
                if (y.info("createTryTimer"), void 0 === this.maxTime) return void y.info("maxTime not exist!");
                y.info("maxTime", this.maxTime);
                let t = this.task.getTaskBase();
                if (!t || void 0 === t.receiveSize) return void y.info("taskBase.receiveSize not exist!");
                this.remainTime = this.maxTime, this.startSize = t.receiveSize, y.info("startSize", this.startSize), this.tryTimer = setInterval(() => {
                    this.onTryTimer()
                }, 1e3)
            }
        }

        onTryTimer() {
            this.remainTime -= 1;
            let t = this.task.getTaskBase();
            if (t && t.receiveSize) {
                y.info("receiveSize", t.receiveSize);
                let e = t.receiveSize - this.startSize;
                this.remainSize = this.trySize - e
            }
            y.info("remainSize", this.remainSize), y.info("remainTime", this.remainTime), this.remainSize <= 0 && (this.remainSize = 0, this.remainTime = 0), this.checkQueryTry().catch(), t.taskStatus === a.DownloadKernel.TaskStatus.Started && this.updateDetail(), this.remainTime <= 0 && this.finish()
        }

        killTryTimer() {
            this.tryTimer && (y.info("killTryTimer"), clearInterval(this.tryTimer), this.tryTimer = void 0)
        }

        createTryFinishTimer(t) {
            this.tryFinishTimer || (y.info("createTryFinishTimer"), this.tryFinishTimer = setTimeout(() => {
                this.killTryFinishTimer(), this.exit()
            }, 1e3 * t))
        }

        killTryFinishTimer() {
            this.tryFinishTimer && (y.info("killTryFinishTimer"), clearTimeout(this.tryFinishTimer), this.tryFinishTimer = void 0)
        }

        createTryFailTimer() {
            let t = p.default.getValue("VipDownload", "AdFinishDispearDelay");
            this.createTryFinishTimer(t)
        }

        updateDetail() {
            let t = this.task.getTaskBase();
            if (!t) return;
            let e = t.vipSpeed || 0, i = t.downloadSpeed || 0, n = Math.max(i - e, 0),
                a = this.trySize ? 1 - this.remainSize / this.trySize : 0;
            this.detail = {
                remainSize: this.remainSize,
                progress: a,
                normalSpeed: n,
                vipSpeed: e,
                gcidLeftCount: this.gcidLeftCount
            }, y.info("updateDetail", this.taskId, this.detail), l.default.emit(l.TaskEventNS.taskAdDetailChanged, this.taskId, this.detail)
        }
    }

    m.sShowingAd = !1, e.AdOperation = m
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(15), o = i(232), r = i(3), l = i(42), u = i(1),
        c = i(0).default.getLogger("VipDownload:ad-operation");

    class d extends s.HttpSession {
        query(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++d.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = u.default.currentMillisecond, l = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                return this.host = "watch.advertising.speed.cdn.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/advertising_speed_trial/query/?" + l, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.random = s, this.body = yield o.AdTaskHttpPackageNS.createQueryBuffer(t), new Promise(e => {
                    this.post(n => {
                        let a = null;
                        if (r.default.userId === t.userId) {
                            let e = n.headers["random-num"];
                            if (c.info("random", e), 200 === n.statusCode && n.body && e) {
                                let s = Number(e).valueOf();
                                a = o.AdTaskHttpPackageNS.praseQueryBuffer(i, t.taskId, s, n.body)
                            }
                        }
                        e(a)
                    }, t => {
                        c.info("error", t), e(null)
                    })
                })
            })
        }

        commit(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++d.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = u.default.currentMillisecond, h = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                return this.host = "watch.advertising.speed.cdn.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/advertising_speed_trial/gift?" + h, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.random = s, this.body = yield o.AdTaskHttpPackageNS.createCommitBuffer(t), new Promise(e => {
                    this.post(n => {
                        let a = null;
                        if (r.default.userId === t.userId) {
                            let t = n.headers["random-num"];
                            if (c.info("random", t), 200 === n.statusCode) if (n.body && t) {
                                let e = Number(t).valueOf();
                                (a = o.AdTaskHttpPackageNS.praseCommitBuffer(i, e, n.body)) || (a = this.createCommitResponse(l.HttpErrorNS.errorPrase))
                            } else a = this.createCommitResponse(l.HttpErrorNS.errorData); else a = this.createCommitResponse(l.HttpErrorNS.errorStatusCode);
                            e(a)
                        }
                    }, t => {
                        c.info("error", t);
                        let i = this.createCommitResponse(l.HttpErrorNS.errorConnect);
                        e(i)
                    })
                })
            })
        }

        queryScene() {
            return n(this, void 0, void 0, function* () {
                let t = ++d.sequence, e = r.default.userId, i = yield r.default.getSessionId(),
                    n = u.default.currentMillisecond, s = yield a.HttpJsonCryptoNS.getUriParam(t, n);
                return this.host = "watch.advertising.speed.cdn.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/advertising_speed_trial/copywriting_config/?" + s, this.auth = a.HttpJsonCryptoNS.getAuthorization(e, i), this.accept = a.HttpJsonCryptoNS.getAccept(), new Promise(t => {
                    this.get(i => {
                        let n = null, a = i.headers["random-num"];
                        if (c.info("random", a), 200 === i.statusCode && i.body && a) {
                            let t = Number(a).valueOf();
                            n = o.AdTaskHttpPackageNS.praseQuerySceneBuffer(e, t, i.body)
                        }
                        t(n)
                    }, e => {
                        c.info("error", e), t(null)
                    })
                })
            })
        }

        createCommitResponse(t) {
            return {result: t, message: l.HttpErrorNS.getMessage(t)}
        }
    }

    d.sequence = 0, e.AdTaskHttpSession = d
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(10), o = i(3), r = i(0).default.getLogger("VipDownload:ad-operation");
    !function (t) {
        t.createQueryBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                r.info("--\x3ecreateQueryBuffer");
                let e = {
                    peer_id: yield s.default.getTpPeerId(),
                    bt_title: t.btTitle,
                    url: t.file.url,
                    filename: t.file.fileName,
                    gcid: t.file.gcid,
                    cid: t.file.cid,
                    filesize: t.file.fileSize,
                    advertising_peer_id: yield o.default.getPeerId()
                }, i = a.HttpJsonCryptoNS.getKey(t.userId, t.random), n = a.HttpJsonCryptoNS.encryptHttpBuffer(e, i);
                return r.info("<--createQueryBuffer"), n
            })
        }, t.praseQueryBuffer = function (t, e, i, n) {
            r.info("--\x3epraseQueryBuffer");
            let s = a.HttpJsonCryptoNS.getKey(t, i), o = a.HttpJsonCryptoNS.decryptHttpBuffer(n, s);
            if (!o) return null;
            let l = {
                result: o.result,
                message: o.message,
                maxProgress: o.task_progress || 0,
                maxSize: o.task_size || 0,
                gcidLeftCount: o.gift_gcid_trial_left_times || 0,
                gcidUseLeftCount: o.used_gift_gcid_trial_left_times || 0,
                leftCount: o.gift_trial_left_times || 0
            };
            return r.info("<--praseQueryBuffer"), l
        }, t.createCommitBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                r.info("--\x3ecreateCommitBuffer");
                let e = {
                    peer_id: yield s.default.getTpPeerId(),
                    url: t.file.url,
                    filename: t.file.fileName,
                    gcid: t.file.gcid,
                    cid: t.file.cid,
                    filesize: t.file.fileSize,
                    advertising_peer_id: yield o.default.getPeerId()
                }, i = a.HttpJsonCryptoNS.getKey(t.userId, t.random), n = a.HttpJsonCryptoNS.encryptHttpBuffer(e, i);
                return r.info("<--createCommitBuffer"), n
            })
        }, t.praseCommitBuffer = function (t, e, i) {
            r.info("--\x3epraseCommitBuffer");
            let n = a.HttpJsonCryptoNS.getKey(t, e), s = a.HttpJsonCryptoNS.decryptHttpBuffer(i, n);
            if (!s) return null;
            let o = {
                result: s.result,
                message: s.message,
                gcidLeftCount: s.gift_gcid_trial_left_times || 0,
                leftCount: s.gift_trial_left_times || 0,
                rewardTips: s.try_reward_tips,
                maxProgress: s.task_progress || 0,
                maxSize: s.task_size || 0
            };
            return r.info("<--praseCommitBuffer"), o
        }, t.praseQuerySceneBuffer = function (t, e, i) {
            r.info("--\x3epraseQuerySceneBuffer");
            let n = a.HttpJsonCryptoNS.getKey(t, e), s = a.HttpJsonCryptoNS.decryptHttpBuffer(i, n);
            if (!s) return null;
            let o = {
                result: s.result,
                message: s.message,
                readySceneText: s.show_guide_copywriting,
                readyNoChanceText: s.reload_try_copywriting,
                acclerateSceneText: s.get_try_copywriting,
                afterSceneText: s.use_try_copywriting,
                buttonText: s.show_guide_button,
                rewardTipsText: s.try_reward_tips
            };
            return r.info("<--praseQuerySceneBuffer"), o
        }
    }(e.AdTaskHttpPackageNS || (e.AdTaskHttpPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    e.TaskCache = class {
        constructor() {
            this.mSelectId = void 0, this.mGcidLeftCount = 100, this.mGcidUseLeftCount = 0, this.mMaxProgress = 0, this.mMaxSize = 0, this.mError = null
        }

        get subId() {
            return this.mSelectId
        }

        set subId(t) {
            this.mSelectId = t
        }

        set gcidLeftCount(t) {
            this.mGcidLeftCount = t
        }

        get gcidLeftCount() {
            return this.mGcidLeftCount
        }

        set gcidUseLeftCount(t) {
            this.mGcidUseLeftCount = t
        }

        get gcidUseLeftCount() {
            return this.mGcidUseLeftCount
        }

        set maxProgress(t) {
            this.mMaxProgress = t
        }

        get maxProgress() {
            return this.mMaxProgress
        }

        set maxSize(t) {
            this.mMaxSize = t
        }

        get maxSize() {
            return this.mMaxSize
        }

        set error(t) {
            this.mError = t
        }

        get error() {
            return this.mError
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(8), s = i(93), o = i(162), r = i(7), l = i(235), u = i(20), c = i(2), d = i(14), h = i(49), f = i(237),
        p = i(3), g = i(1), S = i(5), y = i(50), T = i(85), k = i(13), m = i(238), v = i(91), w = i(45);

    class _ {
    }

    class D {
    }

    class b {
        constructor(t) {
            this.logger = null, this.task = null, this.taskResourceStatus = void 0, this.baotuanNumberResponse = null, this.queryingBaotuanNumber = !1, this.baotuanDetail = null, this.checkTaskCommitTimer = null, this.checkingTaskCommit = !1, this.isKickOut = !1, this.joinKey = "", this.needReportSpeed = !1, this.clickType = "", this.clickTypePre = "", this.startSize = void 0, this.clickTypeReport = "", this.succeedByCutLineReport = !1, this.startRecordSpeedTick = 0, this.speedStTimer = null, this.firstSucceed = !1, this.baotuanTimer = null, this.xgtTimer = null, this.taskSpeedInfoTimer = null, this.taskSpeedInfo = new _, this.taskBelowSrcImg_ = "", this.taskBelowHoverTip_ = "", this.hasVipResource = !1, this.canCommitCheckCount = 0, this.startTick = 0, this.startCheckGrayShowNoviceGuidTimer = null, this.onMainWindowVisibleChangeCookie = -1, this.animateXgtTimeOut = 2e3, this.isRestartBaotuan = !1, this.recordData = void 0, this.lastClearState = {
                lastClearReason: "",
                clickType: ""
            }, this.taskId = t.getTaskId(), this.task = t, this.logger = new T.TaskLogHelp(T.TaskLogHelpName.Baotuan, t), l.default.createTask(this.taskId), d.default.addListener(d.TaskEventNS.taskRemoved, this.onTaskRemoved.bind(this)), y.default.addListener(y.AbtestEventNS.configureReady, this.onConfigureReady.bind(this)), p.default.addListener(p.UserEventNS.cutlineCountChanged, this.onCutLineCountChanged.bind(this)), this.recordTaskSpeed(!0)
        }

        get cache() {
            return l.default.getTask(this.taskId)
        }

        get clickByWeb() {
            return "click_right_icon" === this.clickType
        }

        get clickByRightMenu() {
            return "right_menu" === this.clickType
        }

        get clickByCardIdentify() {
            return "car_identify" === this.clickType
        }

        isClickCardIdentify(t) {
            return "car_identify" === t
        }

        get clickByDlDetail() {
            return "group_dl_detail" === this.clickType
        }

        get clickByCommentArea() {
            return "comment_area" === this.clickType
        }

        get clickByXgt() {
            return "xgt" === this.clickType
        }

        setClickType(t) {
            this.clickType = t
        }

        setClickTypeEx(t) {
            this.clickType = t, this.clickTypePre = t
        }

        getClickType() {
            return this.clickType
        }

        getTaskLogHelp() {
            return this.logger
        }

        get isManaulEnter() {
            return !!(this.clickByWeb || this.clickByRightMenu || this.clickByCardIdentify || this.clickByDlDetail || this.clickByCommentArea || this.clickByXgt)
        }

        set isEnter(t) {
            t || (this.clickType = "")
        }

        remove() {
            this.logger.info("remove"), this.isEnter = !1, this.lastClearState.lastClearReason = "", this.lastClearState.clickType = "", this.clearRecordData("remove"), this.quitTeam(0), this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Exit, {description: "remove"}), d.default.emit(d.TaskEventNS.taskRemoved, this.taskId)
        }

        clear(t) {
            this.logger.info("clear", t), this.startCheckGrayShowNoviceGuidTimer && (clearTimeout(this.startCheckGrayShowNoviceGuidTimer), this.startCheckGrayShowNoviceGuidTimer = null), -1 !== this.onMainWindowVisibleChangeCookie && (c.client.detachServerEvent("OnMainWindowVisibleChange", this.onMainWindowVisibleChangeCookie), this.onMainWindowVisibleChangeCookie = -1), this.clearRecordData(`clear_${t}`), this.lastClearState.lastClearReason = `${p.default.userId}.${t}.${this.isInBaotao()}`, this.lastClearState.clickType = this.clickType, this.killBaotuanTimer(), this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Exit, {description: "clear"}), this.isEnter = !1, this.quitTeam(0), this.initDetail(!0)
        }

        enter(t, e) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("enter baotuan", t, e), this.checkTaskCommit(t, e)
            })
        }

        onStatusCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onStatusCallback", t), void 0 === this.taskResourceStatus && (this.taskResourceStatus = 0), t >= 10 && t <= 30 && (this.taskResourceStatus = t), this.hasVipResource = this.hasVipResource || e
            })
        }

        onStatusCallbackBegin() {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onStatusCallbackBegin"), this.taskResourceStatus = void 0
            })
        }

        get isHResource() {
            if (this.baotuanNumberResponse && void 0 !== this.baotuanNumberResponse.isBlocked) return this.baotuanNumberResponse.isBlocked
        }

        onStatusCallbackEnd() {
            return n(this, void 0, void 0, function* () {
                if (this.logger.info("onStatusCallbackEnd"), yield this.isNeedAutoBaotuan()) {
                    if (this.isTaskEnterTry()) return void this.logger.info("taskEnterTry dont auto baotuan");
                    this.logger.info("auto baotuan"), (yield this.prepareBaotuanResource()) && (this.isManaulEnter ? this.checkTaskCommit(this.clickType, a.VipDownloadDefineNS.BaotuanEnterBy.statusCallbackEndAutoJoin) : this.checkTaskCommit("auto", a.VipDownloadDefineNS.BaotuanEnterBy.statusCallbackEndAutoJoin))
                } else this.isEnter ? (yield this.prepareBaotuanResource()) && this.checkTaskCommit(this.clickType, a.VipDownloadDefineNS.BaotuanEnterBy.statusCallbackEndEnter) : this.tryShowBaotuan(!0, "onStatusCallbackEnd")
            })
        }

        onTokenCallback(t) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onTokenCallback")
            })
        }

        onDcdnResultCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onDcdnResultCallback", t, e)
            })
        }

        prepareBaotuanResource() {
            return n(this, void 0, void 0, function* () {
                return !1 === (yield this.queryBaotuanNumber()) ? (this.logger.info("prepareBaotuanResource, 抱团人数未获取成功"), !1) : !1 === (yield this.canQueryBaotuan()) ? (this.logger.info("prepareBaotuanResource, 查询抱团接口状态不满足"), !1) : this.isMaybeBackgroundTask() ? (this.logger.info("prepareBaotuanResource, 可能是后台任务"), !1) : (this.initDetail(!1), !0)
            })
        }

        isMaybeBackgroundTask() {
            let t = this.task.getTaskBase();
            return !(!t || !t.url || -1 == t.url.indexOf("static-xl9-ssl.xunlei.com")) && (this.logger.info("isMaybeBackgroundTask", t.url), !0)
        }

        checkTaskCommit(t, e) {
            return n(this, void 0, void 0, function* () {
                try {
                    if (!(yield this.canCommit()) && !this.checkTaskCommitTimer) return this.canCommitCheckCount++, this.canCommitCheckCount > 3 ? void (this.canCommitCheckCount = 0) : void (this.checkTaskCommitTimer = setTimeout(() => {
                        this.logger.info("timeOut checkTaskCommit", t, e), clearTimeout(this.checkTaskCommitTimer), this.checkTaskCommitTimer = void 0, this.checkTaskCommit(t, e)
                    }, 2e3));
                    if (this.checkingTaskCommit) return void this.logger.info("checkTaskCommit retun by commit checking!");
                    if (!this.baotuanDetail) return void this.logger.info("checkTaskCommit-detail-null", t, e);
                    if (this.checkingTaskCommit = !0, this.logger.info("checkTaskCommit", t, e, this.baotuanDetail.baotuanXgt), this.baotuanDetail.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Before_Novice && (yield this.initCacheStatus(), this.baotuanDetail.baotuanXgt = this.cache.baotuanXgt), this.isRestartBaotuan) {
                        if (this.setClickType(t), yield this.restartBaotuan()) return void this.logger.info("restartBaotuan", t, e);
                        this.setClickType("")
                    }
                    if (e === a.VipDownloadDefineNS.BaotuanEnterBy.resumeBaotuan) yield this.commitJoin(!1, e); else switch (this.baotuanDetail.baotuanXgt) {
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                            this.setClickType(t), (yield u.BaoTuanSettingNS.getNoviceJoinCount()) < 1 ? yield this.commitJoin(!0) : yield this.commitJoin(!1);
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                            if (!u.BaoTuanSettingNS.getBelowTaskClickAB() && this.isClickCardIdentify(t)) {
                                c.client.callServerFunction("FireEventFunction", "OnSwitchDetail", this.taskId, "huddle", "car_identify");
                                break
                            }
                            this.setClickType(t), yield this.commitJoin(!1);
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                            if (!u.BaoTuanSettingNS.getBelowTaskClickAB() && this.isClickCardIdentify(t)) {
                                c.client.callServerFunction("FireEventFunction", "OnSwitchDetail", this.taskId, "huddle", "car_identify");
                                break
                            }
                            this.setClickType(t), yield this.commitCutLine();
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                            if (!u.BaoTuanSettingNS.getBelowTaskClickAB() && this.isClickCardIdentify(t)) {
                                c.client.callServerFunction("FireEventFunction", "OnSwitchDetail", this.taskId, "huddle", "car_identify");
                                break
                            }
                            e === a.VipDownloadDefineNS.BaotuanEnterBy.authority && (this.setClickType(t), yield this.commitCutLine());
                            break;
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                    }
                    this.checkingTaskCommit = !1
                } catch (t) {
                    this.logger.info("checkTaskError", t), this.checkingTaskCommit = !1
                }
            })
        }

        canCommit() {
            return n(this, void 0, void 0, function* () {
                let t = !1;
                do {
                    if (!(yield this.prepareBaotuanResource())) break;
                    if (p.default.isVip && void 0 === this.taskResourceStatus) break;
                    if (this.task.getTaskStatus() !== r.DownloadKernel.TaskStatus.Started) {
                        this.logger.info("taskStatus is not started");
                        break
                    }
                    if (!this.cache) {
                        this.logger.info("cache is null");
                        break
                    }
                    let e = this.task.getDownloadingFiles();
                    this.logger.info("downloadingFiles", e);
                    for (let i of e) if (i.gcid && "" !== i.gcid && i.cid && "" !== i.cid) {
                        t = !0;
                        break
                    }
                } while (0);
                return t
            })
        }

        tryShowBaotuan(t, e) {
            return n(this, void 0, void 0, function* () {
                if (this.logger.info("tryShowBaotuan", t, e || ""), this.isMaybeBackgroundTask()) return this.logger.info("当前任务可能是后台任务，不展示抱团入口"), !1;
                if (this.task.getVipTask().getXgtState(a.VipDownloadDefineNS.XgtType.Baotuan) !== a.VipDownloadDefineNS.XgtState.Unkown) return p.default.isVip && 0 !== this.taskResourceStatus ? (this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Unkown, {description: "敏感资源不展示抱团入口"}), !1) : (this.logger.info("当前任务下挂条状态不为UnKnow，不展示抱团入口"), !1);
                if (this.isShowingXgt()) return this.logger.info("当前任务正在展示下挂条"), !1;
                if (yield this.isNeedAutoBaotuan()) return this.logger.info("自动抱团，不展示抱团入口"), !1;
                if (!1 === (yield this.queryBaotuanNumber())) return this.logger.info("抱团人数未获取成功，不展示抱团入口"), !1;
                if (!1 === (yield this.canQueryBaotuan())) return this.logger.info("查询抱团接口状态不满足, 不展示抱团入口"), !1;
                if (p.default.isVip && 0 !== this.taskResourceStatus) do {
                    let t = yield v.default.getMessage(v.MessageCodeType.speed_code, 11);
                    if (t && (t.startsWith(" ") || "" === t)) break;
                    return this.logger.info("敏感资源不展示抱团入口", this.taskResourceStatus), !1
                } while (0);
                if (!this.baotuanNumberResponse) return this.logger.info("baotuanNumberResponse null 不展示抱团入口"), !1;
                let i = this.cache, n = yield u.BaoTuanSettingNS.IsAutoJoin(),
                    s = yield u.BaoTuanSettingNS.IsAutoCutLine();
                switch (this.baotuanNumberResponse.result) {
                    case 50:
                        i.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine, (yield u.BaoTuanSettingNS.getNoviceJoinCount()) < 1 && (i.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Novice);
                        break;
                    case 51:
                        return this.logger.info("未找到队伍信息, 不展示抱团入口"), !1;
                    case 0:
                        if (n || s) return !1;
                        i.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Join, i.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Join, (yield u.BaoTuanSettingNS.getNoviceJoinCount()) < 1 && (i.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Novice)
                }
                return t && this.show(), !0
            })
        }

        show() {
            this.initDetail();
            this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "展示抱团入口"})
        }

        hideBaotuan(t, e) {
            let i = this.getXgtInfo();
            this.logger.info("hideXgt", e.description), i.bShowing = !1, b.sShowingBaoTuanTaskMap.set(this.taskId, i), this.changeXgtState(t, e)
        }

        showBaotuan(t) {
            return n(this, void 0, void 0, function* () {
                if (this.baotuanDetail.animateXgt) return this.logger.info("展示抱团成功动画下挂条", t.description), !0;
                let e = this.getXgtInfo(), i = t.description;
                if (t.hideByPriority) return this.logger.info("hideXgt", i), e.bShowing = !1, b.sShowingBaoTuanTaskMap.set(this.taskId, e), !1;
                if (this.isMaybeBackgroundTask()) return this.logger.info("showBaotuan", "当前任务可能是后台任务，不展示抱团入口", t), !1;
                switch (this.baotuanDetail.baotuanXgt) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        if (p.default.isSuperVip) return !1;
                        break;
                    default:
                        let t = yield u.BaoTuanSettingNS.getShowBaotuanEnteranceCount();
                        if (t <= 0) return this.logger.info("没有展示次数，不展示抱团入口", t, i), !1
                }
                if (p.default.isSuperVip && u.BaoTuanSettingNS.getCutlineLeftCount() < 1) return this.logger.info("超会没有插队次数，不展示抱团入口", i), !1;
                let s = null;
                if (this.isOtherShowingXgt()) {
                    let t = !0;
                    switch (this.baotuanDetail.baotuanXgt) {
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                        case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                            t = !1
                    }
                    if (t) {
                        s = this.getBeforeBaotuanXgt();
                        do {
                            if (u.BaoTuanSettingNS.getPriorityInner()) {
                                let t = this.getXgtInfo();
                                if (s && this.getBaotuanXgtPriority(t) > this.getBaotuanXgtPriority(s)) break;
                                return this.logger.info("当前有其它的下挂条, 不展示抱团入口", s && s.baotuanOperation ? s.baotuanOperation.taskDescript() : ""), !1
                            }
                            return this.logger.info("当前有其它的下挂条, 不展示抱团入口", s && s.baotuanOperation ? s.baotuanOperation.taskDescript() : ""), !1
                        } while (0)
                    }
                }
                let o = {description: ""}, r = !0, l = this.baotuanDetail;
                l.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Before_Novice && (yield this.initCacheStatus(), l.baotuanXgt = this.cache.baotuanXgt);
                let d = this.task.getVipTask().getXgtState(a.VipDownloadDefineNS.XgtType.Baotuan);
                switch (l.baotuanXgt) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                        if (d !== a.VipDownloadDefineNS.XgtState.Ready) {
                            r = !1;
                            break
                        }
                        if (this.xgtTimer && clearTimeout(this.xgtTimer), this.xgtTimer = setTimeout(() => {
                            o.description = "baotuan before after 5 min", this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Exit, o)
                        }, 3e5), u.BaoTuanSettingNS.setTaskShowXgtEnterance(this.taskId, !0), !this.startCheckGrayShowNoviceGuidTimer) {
                            let t = k.default.getValue("VipDownload", "AuotShowBaotuanNoviceDelay") - (g.default.currentTime - this.startTick);
                            this.startCheckGrayShowNoviceGuidTimer = setTimeout(() => n(this, void 0, void 0, function* () {
                                (yield this.checkGrayAutoShowNoviceGuid()) && this.tryShowNoviceGuid()
                            }), 1e3 * t)
                        }
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        r = !1;
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                        if (d !== a.VipDownloadDefineNS.XgtState.Ready) {
                            r = !1;
                            break
                        }
                        this.xgtTimer && clearTimeout(this.xgtTimer), this.xgtTimer = setTimeout(() => {
                            o.description = "CutLineOut", this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Exit, o)
                        }, 12e4), u.BaoTuanSettingNS.setTaskShowXgtEnterance(this.taskId, !0);
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                        if (d !== a.VipDownloadDefineNS.XgtState.Ready) {
                            r = !1;
                            break
                        }
                        this.xgtTimer && clearTimeout(this.xgtTimer), this.xgtTimer = setTimeout(() => {
                            o.description = "SucceedCutLineOut|SucceedOpenAuto" + l.baotuanXgt, this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Background, o)
                        }, 3e5);
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                        r = !1
                }
                if (!r) return !1;
                if (this.logger.info("showXgt", i), e.bShowing = !0, b.sShowingBaoTuanTaskMap.set(this.taskId, e), yield u.BaoTuanSettingNS.isFirstShowTeamEnterance()) {
                    u.BaoTuanSettingNS.showedTeamEnterance();
                    let t = {
                        result: 204,
                        message: "当前抱团N人，队员助你下载更快乐",
                        teamCount: this.baotuanDetail.baotuanNumber,
                        isVip: p.default.isVip ? "1" : "0",
                        isPlatinumVip: p.default.isPlatinumVip ? "1" : "0",
                        isSuperVip: p.default.isSuperVip ? "1" : "0"
                    };
                    this.logger.info("FirstTipsForBaoTuan!"), c.client.callServerFunction("FireEventFunction", "BaoTuanTaskStatusChange", JSON.stringify(t)), h.BaotuanStatNS.showTips("user_guide")
                }
                return s && setTimeout(() => {
                    s.baotuanOperation.hideBaotuan(a.VipDownloadDefineNS.XgtState.Unkown, {description: "by" + this.taskDescript() + "highPriority"})
                }, 10), !0
            })
        }

        queryBaotuanNumber() {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.baotuanNumberResponse) break;
                    if (this.queryingBaotuanNumber) break;
                    this.queryingBaotuanNumber = !0, this.logger.info("queryBaotuanNumber");
                    let t = this.task.getTaskBase(), e = new o.VipNetWorkData.BaoTuan.Request.Number;
                    if (e.logger = this.logger, e.btFlag = t.taskType === r.DownloadKernel.TaskType.Bt ? 1 : 0, 1 === e.btFlag) {
                        let t = this.task.getTaskDetail();
                        if (!t) {
                            this.logger.info("taskDetail is null");
                            break
                        }
                        e.gcidOrInfohash = t.infoId, e.url = "bt://" + t.infoId + "/0"
                    } else e.gcidOrInfohash = t.gcid, e.url = t.url;
                    if ("" == e.gcidOrInfohash) {
                        this.logger.info("gcidOrInfohash is null");
                        break
                    }
                    this.baotuanNumberResponse = yield s.default.number(e), this.baotuanNumberResponse && (u.BaoTuanSettingNS.setIsOldUser(this.baotuanNumberResponse.isOldUser), this.fireInfoToWebBaotuanPage(), u.BaoTuanSettingNS.setCutlineLeftCount(this.baotuanNumberResponse.teamLeftTimes), this.initCacheStatus(), d.default.emit(d.TaskEventNS.taskBlockSecondInfo, this.taskId, this.baotuanNumberResponse.isBlocked, this.baotuanNumberResponse.isSec))
                } while (0);
                return this.queryingBaotuanNumber = !1, !!this.baotuanNumberResponse
            })
        }

        canQueryBaotuan() {
            return n(this, void 0, void 0, function* () {
                let t = !1;
                do {
                    let e = this.baotuanSubId;
                    if (void 0 === e) {
                        this.logger.info("baotuanSubId is null");
                        break
                    }
                    let i = this.task.getTaskBase();
                    if (i.taskType === r.DownloadKernel.TaskType.Group) {
                        this.logger.info("this task is group task!");
                        break
                    }
                    let n = this.task.getFile(e);
                    if (!i || !n) {
                        this.logger.info("taskBase or file is null", i, n, e);
                        break
                    }
                    let a = "";
                    if (1 === (i.taskType === r.DownloadKernel.TaskType.Bt ? 1 : 0)) {
                        let t = this.task.getTaskDetail();
                        if (!t) {
                            this.logger.info("taskDetail is null", i);
                            break
                        }
                        a = t.infoId
                    } else a = i.gcid;
                    if ("" == a) {
                        this.logger.info("gcidOrInfohash is null");
                        break
                    }
                    t = !0
                } while (0);
                return t
            })
        }

        get baotuanSubId() {
            let t = 0, e = void 0, i = this.task.getDownloadingFiles();
            this.logger.info("teamSubId", i.length, i);
            for (let n of i) {
                let i = (n.fileSize || 0) - (n.downloadSize || 0);
                n.gcid && "" !== n.gcid && n.cid && "" !== n.cid && i > t ? (t = i, e = n.subId) : this.logger.info("baotuanSubId gcid or cid null", n)
            }
            return e
        }

        initCacheStatus() {
            return n(this, void 0, void 0, function* () {
                if (!this.baotuanNumberResponse) return;
                let t = this.cache;
                switch (t.baotuanCount = this.baotuanNumberResponse.teamNumber ? this.baotuanNumberResponse.teamNumber : 0, this.baotuanNumberResponse.result) {
                    case 50:
                        t.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine, (yield u.BaoTuanSettingNS.getNoviceJoinCount()) < 1 && (t.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Novice);
                        break;
                    case 51:
                        this.logger.info("mTeamNumberResponse response 未找到队伍信息");
                    case 0:
                        t.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Join, (yield u.BaoTuanSettingNS.getNoviceJoinCount()) < 1 && (t.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Novice)
                }
                this.logger.info("initCacheStatus", t.baotuanXgt)
            })
        }

        initDetail(t) {
            if (!0 !== t) {
                let t = !1;
                do {
                    if (!this.baotuanDetail) break;
                    if (this.baotuanDetail.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Before_All) break;
                    t = !0
                } while (0);
                if (t) return
            }
            let e = this.cache;
            this.baotuanDetail = {
                baotuanNumber: e.baotuanCount ? e.baotuanCount : 0,
                taskDownloadProgress: 0,
                baotuanDownloadProgress: 0,
                baotuanXgt: e.baotuanXgt,
                autoHideSucced: !0,
                succeedByCutLine: !1,
                animateXgt: !1
            }, this.logger.info("initDetail", this.baotuanDetail)
        }

        getBaotuanDetail() {
            return this.baotuanDetail
        }

        getBaotuanDetailSt() {
            let t = {state: "not_in_group_dl", teamLeftCount: u.BaoTuanSettingNS.getCutlineLeftCount(), teamStatus: 0};
            if (this.baotuanDetail) switch (this.baotuanDetail.baotuanXgt) {
                case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                    t.state = "not_in_group_dl", t.teamStatus = 0;
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                    t.state = "is_group_dl", t.teamStatus = 1;
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                    t.state = "delete_from_group_dl", t.teamStatus = 2
            }
            return t
        }

        getBaotuanXgt() {
            return this.baotuanDetail ? this.baotuanDetail.baotuanXgt : a.VipDownloadDefineNS.BaotuanXgt.Before_All
        }

        isOtherShowingXgt() {
            let t = !1, e = this.taskId;
            return b.sShowingBaoTuanTaskMap.forEach(function (i, n, a) {
                i.bShowing && n !== e && (i.baotuanOperation.logger.info("canShowBaotuanByBaoTuanXGT-Showing:false", n, "IsShowingXgt"), t = i.bShowing)
            }), t
        }

        isShowingXgt() {
            let t = b.sShowingBaoTuanTaskMap.get(this.taskId);
            return !!t && t.bShowing
        }

        getBeforeBaotuanXgt() {
            let t = null, e = this.taskId;
            return b.sShowingBaoTuanTaskMap.forEach(function (i, n, s) {
                if (i.bShowing && n !== e) switch (i.xgt) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                        t = i
                }
            }), t
        }

        getXgtInfo() {
            let t = new D;
            t.fileSize = 0, t.isPron = !1, t.bShowing = this.isShowingXgt(), this.baotuanNumberResponse && void 0 !== this.baotuanNumberResponse.isBlocked && (t.isPron = this.baotuanNumberResponse.isBlocked), this.baotuanNumberResponse && void 0 !== this.baotuanNumberResponse.isSec && (t.isSec = this.baotuanNumberResponse.isSec), t.xgt = this.baotuanDetail ? this.baotuanDetail.baotuanXgt : a.VipDownloadDefineNS.BaotuanXgt.Before_All;
            let e = this.task.getTaskBase();
            return e && e.downloadSize && (t.fileSize = Math.round(e.fileSize / 1024 / 1024)), t.baotuanOperation = this, t
        }

        getBaotuanXgtPriority(t) {
            return t.isPron && t.isSec && t.fileSize >= 100 ? 10 : t.isPron && (t.isSec || t.fileSize >= 100) ? 9 : t.isPron ? 8 : 0
        }

        taskDescript() {
            return this.task.taskDescript()
        }

        commitJoin(t, e) {
            return n(this, void 0, void 0, function* () {
                do {
                    this.logger.info("commitJoin");
                    let i = this.task.getTaskBase(), l = null;
                    if ((l = t ? new o.VipNetWorkData.BaoTuan.Request.NoviceJoin : new o.VipNetWorkData.BaoTuan.Request.Join).logger = this.logger, l.btFlag = i.taskType === r.DownloadKernel.TaskType.Bt ? 1 : 0, 1 === l.btFlag) {
                        let t = this.task.getTaskDetail();
                        if (!t) {
                            this.logger.info("taskDetail is null", i);
                            break
                        }
                        l.gcidOrInfohash = t.infoId, l.url = "bt://" + t.infoId + "/0"
                    } else l.gcidOrInfohash = i.gcid, l.url = i.url;
                    if ("" == l.gcidOrInfohash) {
                        this.logger.info("gcidOrInfohash is null");
                        break
                    }
                    e === a.VipDownloadDefineNS.BaotuanEnterBy.resumeBaotuan ? (l.scene = "superend", l.consume_times_flag = 0) : e === a.VipDownloadDefineNS.BaotuanEnterBy.packagetry && (l.scene = "package_download", l.consume_times_flag = 0), t ? (yield u.BaoTuanSettingNS.increaseNoviceJoinCount(), s.default.noviceJoin(l).then(t => n(this, void 0, void 0, function* () {
                        yield this.onNoviceJoinCallback(l, t)
                    }))) : s.default.join(l).then(t => n(this, void 0, void 0, function* () {
                        yield this.onJoinCallback(l, t)
                    }))
                } while (0)
            })
        }

        commitCutLine(t) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.logger.info("commitCutLine"), !u.BaoTuanSettingNS.isHaveCutlineCount()) {
                        void 0 !== t && (this.baotuanDetail.baotuanXgt = t), this.onCutLineCallback(null, {
                            result: 49,
                            teamTimes: 0,
                            teamLeftTimes: 0,
                            teamNumber: 0,
                            taskDownloadProgress: 0,
                            teamDownloadProgress: 0,
                            key: ""
                        }), this.logger.info("commitCutLine failed by out cutlineleftcount");
                        break
                    }
                    let e = this.task.getTaskBase(), i = new o.VipNetWorkData.BaoTuan.Request.CutLine;
                    if (i.logger = this.logger, i.btFlag = e.taskType === r.DownloadKernel.TaskType.Bt ? 1 : 0, 1 === i.btFlag) {
                        let t = this.task.getTaskDetail();
                        if (!t) {
                            this.logger.info("taskDetail is null");
                            break
                        }
                        i.gcidOrInfohash = t.infoId, i.url = "bt://" + t.infoId + "/0"
                    } else i.gcidOrInfohash = e.gcid, i.url = e.url;
                    if ("" == i.gcidOrInfohash) {
                        this.logger.info("gcidOrInfohash is null");
                        break
                    }
                    yield s.default.cutLine(i).then(t => n(this, void 0, void 0, function* () {
                        yield this.onCutLineCallback(i, t)
                    }))
                } while (0)
            })
        }

        onNoviceJoinCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.logger.info("onNoviceJoinCallback", t, e), null === e) {
                        this.logger.info("onNoviceJoinCallback response null"), this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Novice, yield this.notifyDetailChanged();
                        break
                    }
                    switch (this.baotuanDetail.baotuanNumber = e.teamNumber ? e.teamNumber : this.baotuanDetail.baotuanNumber, e.result) {
                        case 48:
                            yield this.commitJoin(!1);
                            break;
                        case 50:
                            yield this.commitCutLine();
                            break;
                        case 49:
                        case 51:
                            this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut;
                            break;
                        case 0:
                            this.baotuanDetail.succeedByCutLine = !1, this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed, this.baotuanDetail.autoHideSucced = !0, this.baotuanDetail.taskDownloadProgress = 100, this.baotuanDetail.baotuanDownloadProgress = 100, this.joinKey = e.key, this.isKickOut = !1, this.needReportSpeed = !0, this.saveState(), yield this.checkSucceed(), yield this.queryToken()
                    }
                    yield this.notifyDetailChanged()
                } while (0)
            })
        }

        onJoinCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.logger.info("onJoinCallback", t, e), null === e) {
                        this.logger.info("onJoinCallback response null"), this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Before_Join, yield this.notifyDetailChanged();
                        break
                    }
                    switch (e.result) {
                        case 48:
                        case 49:
                            this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut, this.isManaulEnter && this.showCutLineOut();
                            break;
                        case 50:
                            Number(e.teamLeftTimes).valueOf() > 0 ? yield this.commitCutLine(a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut) : this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut;
                            break;
                        case 51:
                            break;
                        case 0:
                            this.baotuanDetail.succeedByCutLine = !1, this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed, this.baotuanDetail.autoHideSucced = !0, this.baotuanDetail.baotuanNumber = e.teamNumber, u.BaoTuanSettingNS.setCutlineLeftCount(e.teamLeftTimes), this.baotuanDetail.taskDownloadProgress = e.taskDownloadProgress, this.baotuanDetail.baotuanDownloadProgress = e.teamDownloadProgress, this.isKickOut = !1, this.joinKey = e.key, this.needReportSpeed = !0, this.saveState(), yield this.checkSucceed(), yield this.queryToken()
                    }
                    yield this.notifyDetailChanged()
                } while (0)
            })
        }

        onCutLineCallback(t, e) {
            return n(this, void 0, void 0, function* () {
                do {
                    if (this.logger.info("onCutLineCallback", t, e), null === e) {
                        this.logger.info("onCutLineCallback response null"), this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut, yield this.notifyDetailChanged();
                        break
                    }
                    switch (e.result) {
                        case 49:
                        case 51:
                            this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut, 49 === e.result && (u.BaoTuanSettingNS.setCutlineLeftCount(0), this.isManaulEnter && this.showCutLineOut()), yield this.notifyDetailChanged();
                            break;
                        case 0:
                            this.baotuanDetail.succeedByCutLine = !0, this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed, this.baotuanDetail.taskDownloadProgress = e.taskDownloadProgress, this.baotuanDetail.baotuanDownloadProgress = e.teamDownloadProgress, this.baotuanDetail.baotuanNumber = e.teamNumber, this.isKickOut = !1, this.joinKey = e.key, this.needReportSpeed = !0, u.BaoTuanSettingNS.setCutlineLeftCount(e.teamLeftTimes), this.saveState(), yield this.checkSucceed(), yield this.notifyDetailChanged(), yield this.queryToken()
                    }
                } while (0)
            })
        }

        notifyDetailChanged() {
            return n(this, void 0, void 0, function* () {
                let t = {taskId: this.taskId, teamStatus: 0};
                switch (this.baotuanDetail.baotuanXgt) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                        t.teamStatus = 0;
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        t.teamStatus = 1;
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                        this.clearSpeedStTimer(!0, "kickout"), t.teamStatus = 2, this.showBaoHuVipRight()
                }
                if (c.client.callServerFunction("FireEventFunction", "BaoTuanTaskStatusChangeEx", t.taskId, t.teamStatus), this.logger.info("BaoTuanTaskStatusChangeEx", t.taskId, t.teamStatus), yield this.checkStatusChange(this.baotuanDetail, this.clickType), this.task.getVipTask().onBaotuanStateChange(this.baotuanDetail.baotuanXgt), this.fireInfoToWebBaotuanPage(), 1 === t.teamStatus) do {
                    if (this.isRestartBaotuan && !this.clickTypePre) break;
                    this.clickByRightMenu ? yield c.client.callServerFunction("ShowToast", {
                        type: 0,
                        message: "成功进入抱团下载，当前抱团" + this.baotuanDetail.baotuanNumber + "人",
                        duration: 4e3,
                        onCancle: () => {
                        }
                    }) : this.clickByCardIdentify ? (this.logger.info("OnSwitchDetail", this.taskId), c.client.callServerFunction("FireEventFunction", "OnSwitchDetail", this.taskId, "huddle", "car_identify"), yield c.client.callServerFunction("ShowToast", {
                        type: 0,
                        message: "成功进入抱团下载，当前抱团" + this.baotuanDetail.baotuanNumber + "人",
                        duration: 4e3,
                        onCancle: () => {
                        }
                    })) : this.clickByDlDetail && (yield c.client.callServerFunction("ShowToast", {
                        type: 0,
                        message: "成功进入抱团下载，当前抱团" + this.baotuanDetail.baotuanNumber + "人",
                        duration: 4e3,
                        onCancle: () => {
                        }
                    }))
                } while (0)
            })
        }

        checkStatusChange(t, e) {
            return n(this, void 0, void 0, function* () {
                switch (this.logger.info("checkStatusChange", JSON.stringify(t), e), t.baotuanXgt) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        yield this.showSucceedAni(), this.baotuanDetail.animateXgt ? (this.isShowingXgt() || this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "AnimateXgt"}), setTimeout(() => {
                            this.baotuanDetail.animateXgt = !1, this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Background, {description: "AnimateXgt"}), this.updateVipTaskInfo()
                        }, this.animateXgtTimeOut)) : this.isShowingXgt() && this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Background, {description: "succeed"});
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                        p.default.isSuperVip || this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "Doing_KickOut"}), this.task.getTaskStatus() === r.DownloadKernel.TaskStatus.Started && p.default.isVip && (this.logger.info("Auto Enter Vip Acclerate! By KickOut"), this.task.getVipTask().forceEnterVip());
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                        this.isManaulEnter && !p.default.isSuperVip ? this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "Doing_CutLineOut"}) : !this.isManaulEnter && this.isNeedAutoBaotuan() && this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {
                            description: "Doing_CutLineOut_AutoJoin",
                            select: !1
                        });
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                        let i = () => {
                            p.default.isSuperVip ? this.changeXgtState(a.VipDownloadDefineNS.XgtState.Background, {description: "Doing_SucceedCutLineOut"}) : this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "Doing_SucceedCutLineOut"})
                        };
                        yield this.showSucceedAni(), this.baotuanDetail.animateXgt ? (this.isShowingXgt() || this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "AnimateXgt"}), setTimeout(() => {
                            this.baotuanDetail.animateXgt = !1, i(), this.updateVipTaskInfo()
                        }, this.animateXgtTimeOut)) : i();
                        break;
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                        yield this.showSucceedAni(), this.baotuanDetail.animateXgt ? (this.isShowingXgt() || this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "AnimateXgt"}), setTimeout(() => {
                            this.baotuanDetail.animateXgt = !1, this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "Doing_SucceedOpenAuto"}), this.updateVipTaskInfo()
                        }, this.animateXgtTimeOut)) : this.changeXgtState(a.VipDownloadDefineNS.XgtState.Ready, {description: "Doing_SucceedOpenAuto"})
                }
                this.updateVipTaskInfo()
            })
        }

        showCutLineOut() {
            if (this.clickByDlDetail) return;
            if (p.default.isSuperVip && p.default.isYear) return;
            let t = "xgt";
            (this.clickByWeb || this.clickByRightMenu || this.clickByCommentArea || this.clickByCardIdentify) && (t = this.clickType);
            let e = {aid: "group_dl_brfore_cutinline_pay", state_from: "group_before", entrance_from: t};
            d.default.emit(d.TaskEventNS.showBaotuanPopupWnd, "CutLineOut", this.taskId, e)
        }

        showSucceedAni() {
            return n(this, void 0, void 0, function* () {
                let t = u.BaoTuanSettingNS.getBaotuanEntrance();
                do {
                    if (b.showingAni) break;
                    b.showingAni = !0;
                    let e = yield c.client.callServerFunction("GetValue", "VipDownload", "BaotuanSucceedAniDate", "").catch(),
                        i = (new Date).toDateString();
                    if (e === i) break;
                    if (t.first_team_effect_tag && (h.BaotuanStatNS.succeedShowAni(u.BaoTuanSettingNS.getCutlineLeftCount(), this.isManaulEnter ? "manual" : "auto", "xgt"), this.baotuanDetail.animateXgt = !0, yield c.client.callServerFunction("SetValue", "VipDownload", "BaotuanSucceedAniDate", i).catch()), !u.BaoTuanSettingNS.getFirstTeamEffect()) break;
                    yield c.client.callServerFunction("SetValue", "VipDownload", "BaotuanSucceedAniDate", i).catch();
                    let n = S.ThunderUtil.getStaticPath() + "/img/home-ani.png",
                        a = `.xlx-dialog-group-ani {\n        position: absolute;\n        width: 582px;\n        height: 200px;\n        z-index: 9;\n        pointer-events: none;\n      }\n\n      .xlx-dialog-group-ani:before {\n        content: "";\n        display: block;\n        background: url(${n = `'${n}'`}) no-repeat;\n        width: 582px;\n        height: 200px;\n        animation: ani 2.2s steps(19) both;\n      }\n\n      @keyframes ani {\n        0% {\n          background-position: 0 0;\n        }\n        90% {\n          opacity: 1;\n          background-position: -11058px 0px;\n        }\n        100% {\n          opacity: 0;\n          background-position: -11058px 0px;\n        }\n      }`;
                    yield c.client.callServerFunction("ShowAniCover", {
                        src: "xdas://res/xlx-dialog-group-ani",
                        innerHTML: a,
                        x: 100,
                        y: 120
                    }), h.BaotuanStatNS.succeedShowAni(u.BaoTuanSettingNS.getCutlineLeftCount(), this.isManaulEnter ? "manual" : "auto", "global")
                } while (0);
                b.showingAni = !1
            })
        }

        showBaoHuVipRight() {
            return n(this, void 0, void 0, function* () {
                d.default.emit(d.TaskEventNS.showBaotuanPopupWnd, "BaoHuVip", this.taskId, {
                    isRightWnd: 1,
                    entrance_from: "xgt"
                })
            })
        }

        clearSpeedStTimer(t, e) {
            this.speedStTimer && (clearTimeout(this.speedStTimer), this.speedStTimer = null, t && (this.logger.info(this.taskId, "reportSpeed by " + e), this.reportSpeed(this.clickTypeReport, this.succeedByCutLineReport)))
        }

        reportSpeed(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = "auto";
                i !== t && (i = t);
                let n = this.task.getTaskBase();
                if (!n || void 0 === n.downloadSize) return void this.logger.info("taskBase.downloadSize not exist! can no sent reportdata");
                let a = (n.downloadSize - this.startSize) / Math.max(g.default.currentTime - this.startRecordSpeedTick, 1),
                    s = yield this.getReportSpeedData();
                this.logger.info("afterIntoBaotuan"), h.BaotuanStatNS.afterIntoBaotuan(i, e ? "cut_in_line" : "nomal", Math.round(a), this.cache ? this.cache.resourceResult : 0, s.isExit, s.isExited, s.isSecond, s.isDriver, s.fileSize, this.isRestartBaotuan ? 1 : 0, s.gcid)
            })
        }

        onTaskRemoved(t) {
            if (t !== this.taskId) {
                let t = this.task.getVipTask().getXgtState(a.VipDownloadDefineNS.XgtType.Baotuan);
                t === a.VipDownloadDefineNS.XgtState.Ready ? this.changeXgtState(t, {description: "onTaskRemoved"}) : this.tryShowBaotuan(!0, "onTaskRemoved")
            } else this.clear("onTaskRemoved")
        }

        getBaotuanOption() {
            let t = {joinKey: p.default.isVip ? void 0 : this.joinKey, isGroup: 0};
            return 1 === this.getBaotuanDetailSt().teamStatus && (t.isGroup = 1), t
        }

        queryToken(t) {
            return n(this, void 0, void 0, function* () {
                yield this.task.getVipTask().commit(null, a.VipDownloadDefineNS.QueryOption.TokenOnly), this.clickTypeReport = this.clickType, this.succeedByCutLineReport = this.baotuanDetail.succeedByCutLine, !this.speedStTimer && this.needReportSpeed && (this.needReportSpeed = !1, this.startRecordSpeedTick = g.default.currentTime, this.speedStTimer = setTimeout(() => {
                    this.clearSpeedStTimer(!0, "2 min")
                }, 12e4)), this.createBaotuanTimer(t)
            })
        }

        reportJoinSucceed() {
            return n(this, void 0, void 0, function* () {
                let t = 0;
                this.taskSpeedInfoTimer && (t = this.taskSpeedInfo.speed);
                let e = this.clickType, i = yield this.getReportSpeedData();
                this.logger.info("intoBaotuan"), h.BaotuanStatNS.intoBaotuan(e, this.baotuanDetail.succeedByCutLine ? "cut_in_line" : "nomal", t, Number(this.taskResourceStatus ? this.taskResourceStatus : 0), i.isExit, i.isExited, i.isSecond, i.isDriver, i.fileSize, this.isRestartBaotuan ? 1 : 0, i.gcid)
            })
        }

        kickOutReport(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = 0;
                this.taskSpeedInfoTimer && (i = Math.round(this.taskSpeedInfo.speed / 1024)), void 0 === e && (e = this.clickType);
                let n = yield this.getReportSpeedData();
                return h.BaotuanStatNS.kickOut(e, this.baotuanDetail.succeedByCutLine ? "cut_in_line" : "nomal", i, Number(this.taskResourceStatus ? this.taskResourceStatus : 0), n.fileSize, t), e
            })
        }

        checkSucceed() {
            return n(this, void 0, void 0, function* () {
                if (this.baotuanDetail.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed) {
                    if (this.reportJoinSucceed(), this.recordTaskSpeed(!0), this.clickByWeb) h.BaotuanStatNS.webClickBaoTuan(u.BaoTuanSettingNS.getCutlineLeftCount(), "not_in_group_dl", this.baotuanDetail.succeedByCutLine); else if (this.clickByRightMenu) h.BaotuanStatNS.rightMenuClickBaoTuan(u.BaoTuanSettingNS.getCutlineLeftCount(), "not_in_group_dl", this.baotuanDetail.succeedByCutLine); else if (this.clickByCardIdentify) {
                        let t = this.task.getTaskStatus();
                        h.BaotuanStatNS.carIdentifyClickBaoTuan(u.BaoTuanSettingNS.getCutlineLeftCount(), "not_in_group_dl", this.baotuanDetail.succeedByCutLine, t === r.DownloadKernel.TaskStatus.Started)
                    }
                    let t = yield u.BaoTuanSettingNS.IsBaoTuanHaveSucceed();
                    t || (this.fireTaskInfoToWebpage(), this.firstSucceed = !0, u.BaoTuanSettingNS.SetBaoTuanSucceed());
                    let e = yield u.BaoTuanSettingNS.IncreaseBaoTuanSuccedCount(), i = !1;
                    if (u.BaoTuanSettingNS.isLoginNeed()) {
                        if (yield u.BaoTuanSettingNS.GetNeedShowRecommendAuto()) {
                            let e = yield u.BaoTuanSettingNS.IsAutoJoin(), n = yield u.BaoTuanSettingNS.IsAutoCutLine();
                            if (this.logger.info("isAutoJoin, isAutoCutLine", e, n), !e && !n) if (t) {
                                let t = yield u.BaoTuanSettingNS.getOpenTeamRecommendCount(),
                                    e = yield u.BaoTuanSettingNS.getOpenTeamRecommendLastTime();
                                (0 == t || t < 3 && g.default.currentTime > e + 86400) && (i = !0)
                            } else i = !0
                        }
                    } else if (!(yield u.BaoTuanSettingNS.IsBaoTuanSettingManualCancel())) {
                        let t = yield u.BaoTuanSettingNS.IsAutoJoin(), n = yield u.BaoTuanSettingNS.IsAutoCutLine();
                        if (this.logger.info("isAutoJoin, isAutoCutLine", t, n), !t && !n) {
                            let t = yield u.BaoTuanSettingNS.getOpenTeamRecommendCount(),
                                n = yield u.BaoTuanSettingNS.getOpenTeamRecommendLastTime();
                            (0 == t || t < 2 && g.default.currentTime > n + 86400) && (i = !0), i || e > 3 && t < 2 && (i = !0)
                        }
                    }
                    i && u.BaoTuanSettingNS.getIsSurperUserOnly() && (i = p.default.isSuperVip || p.default.isVip && u.BaoTuanSettingNS.getIsOldUser()), i && (yield u.BaoTuanSettingNS.SetOpenTeamRecommendLastTime(), yield u.BaoTuanSettingNS.IncreaseOpenTeamRecommendCount(), this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto), i || u.BaoTuanSettingNS.getCutlineLeftCount() < 1 && this.baotuanDetail.succeedByCutLine && (this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut)
                }
            })
        }

        fireTaskInfoToWebpage() {
            switch (this.baotuanDetail.baotuanXgt) {
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                    let t = {
                        result: 0,
                        message: "成功进入抱团下载，当前抱团N人",
                        teamCount: void 0 !== this.baotuanDetail.baotuanNumber ? this.baotuanDetail.baotuanNumber : 0,
                        isVip: p.default.isVip ? "1" : "0",
                        isPlatinumVip: p.default.isPlatinumVip ? "1" : "0",
                        isSuperVip: p.default.isSuperVip ? "1" : "0"
                    };
                    this.logger.info("FireEventFunction", "BaoTuanTaskStatusChange", t), c.client.callServerFunction("FireEventFunction", "BaoTuanTaskStatusChange", JSON.stringify(t)), h.BaotuanStatNS.showTips("user_guide")
            }
        }

        getJoinKey() {
            return this.joinKey
        }

        getIsKickOut() {
            return this.isKickOut
        }

        createBaotuanTimer(t) {
            return n(this, void 0, void 0, function* () {
                this.killBaotuanTimer(), this.logger.info("createBaotuanTimer");
                let e = this.task.getTaskBase();
                if (!e || void 0 === e.downloadSize) return void this.logger.info("taskBase.downloadSize not exist!");
                this.startSize = t ? t.startSize : e.downloadSize;
                let i = e.fileSize * this.baotuanDetail.baotuanDownloadProgress * .01,
                    n = e.fileSize * this.baotuanDetail.taskDownloadProgress * .01;
                this.logger.info("taskId, fileSize, mStartSize, downloadSizeByTeam, downloadSizeByTask", this.taskId, e.fileSize, this.startSize, i, n);
                let a = yield f.BaotuanDataBaseNS.isTaskKickOut(e.taskId);
                this.baotuanTimer = setInterval(() => {
                    this.onBaotuanTimer(a)
                }, 1e3)
            })
        }

        onBaotuanTimer(t) {
            return n(this, void 0, void 0, function* () {
                this.logger.info("onBaotuanTimer");
                let e = this.task.getTaskBase();
                if (t || p.default.isSuperVip) return this.logger.info("KickOutTest:", "NoNeed", "havKickOut", t, "isSuperVip", p.default.isSuperVip), void this.killBaotuanTimer();
                if (this.baotuanTimer && e && e.downloadSize && !p.default.isSuperVip) {
                    let i = e.fileSize * this.baotuanDetail.baotuanDownloadProgress * .01,
                        n = e.fileSize * this.baotuanDetail.taskDownloadProgress * .01,
                        s = e.downloadSize - this.startSize;
                    if (this.logger.info("KickOutTest:", s, s - i, e.downloadSize - n), !this.firstSucceed && !t && s > i && e.downloadSize > n && (f.BaotuanDataBaseNS.setKickOutTask(this.taskId), !this.isKickOut)) {
                        this.logger.info("KickOut"), d.default.emit(d.TaskEventNS.taskKickOut, this.taskId), this.isKickOut = !0, this.clearRecordData("TaskKickOut"), this.quitTeam(1), this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut, this.notifyDetailChanged(), this.disableAllTaskCert(), this.queryToken(), this.killBaotuanTimer();
                        let t = yield this.kickOutReport("group_dl_be_exit");
                        this.recordTaskSpeed(!0), setTimeout(() => {
                            this.kickOutReport("group_dl_after_be_exit", t)
                        }, 12e4)
                    }
                }
            })
        }

        killBaotuanTimer() {
            this.baotuanTimer && (this.logger.info("killBaotuanTimer"), clearInterval(this.baotuanTimer), this.baotuanTimer = void 0)
        }

        quitTeam(t) {
            return n(this, void 0, void 0, function* () {
                if (!this.isInBaotao()) return;
                let e = this.task.getTaskBase(), i = new o.VipNetWorkData.BaoTuan.Request.Quit(this.logger);
                if (i.btFlag = e.taskType === r.DownloadKernel.TaskType.Bt ? 1 : 0, i.extrusionFlag = t, 1 === i.btFlag) {
                    let t = this.task.getTaskDetail();
                    if (!t) return void this.logger.info("taskDetail is null");
                    i.gcidOrInfohash = t.infoId, i.url = "bt://" + t.infoId + "/0"
                } else i.gcidOrInfohash = e.gcid, i.url = e.url;
                "" != i.gcidOrInfohash ? yield s.default.quit(i) : this.logger.info("gcidOrInfohash is null")
            })
        }

        disableAllTaskCert() {
            this.task.getVipTask().unAcclerate(null, a.VipDownloadDefineNS.VipTaskType.Vip)
        }

        recordTaskSpeed(t) {
            t && (this.taskSpeedInfo.startSize = void 0, this.taskSpeedInfo.downloadSize = void 0, this.taskSpeedInfo.speed = 0, this.taskSpeedInfo.useTime = 0), this.taskSpeedInfoTimer || (this.taskSpeedInfoTimer = setInterval(() => {
                let t = this.task.getTaskBase();
                void 0 === this.taskSpeedInfo.downloadSize && t.downloadSize && (this.taskSpeedInfo.startSize = t.downloadSize, this.taskSpeedInfo.downloadSize = t.downloadSize), this.task.getTaskStatus() === r.DownloadKernel.TaskStatus.Started && (this.taskSpeedInfo.useTime += 1, this.taskSpeedInfo.downloadSize = t.downloadSize, this.taskSpeedInfo.speed = Math.round((this.taskSpeedInfo.downloadSize - this.taskSpeedInfo.startSize) / this.taskSpeedInfo.useTime), t && t.downloadSize && (this.taskSpeedInfo.downloadSize, t.downloadSize))
            }, 1e3))
        }

        isInBaotao() {
            return this.baotuanDetail && (this.baotuanDetail.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed || this.baotuanDetail.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut || this.baotuanDetail.baotuanXgt === a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto)
        }

        isNeedAutoBaotuan() {
            return n(this, void 0, void 0, function* () {
                switch (this.task.getVipTask().getShowedXgt()) {
                    case a.VipDownloadDefineNS.XgtType.Ad:
                    case a.VipDownloadDefineNS.XgtType.Try:
                        return !1
                }
                if (this.isMaybeBackgroundTask()) return !1;
                if (u.BaoTuanSettingNS.getIsSurperUserOnly()) do {
                    if (p.default.isSuperVip) break;
                    if (p.default.isVip && u.BaoTuanSettingNS.getIsOldUser()) break;
                    return !1
                } while (0);
                return !(!u.BaoTuanSettingNS.checkLogin(p.default.isLogin) || !(yield u.BaoTuanSettingNS.getHaveShowNoviceGuid()) || !(yield u.BaoTuanSettingNS.IsAutoJoin()) && !(yield u.BaoTuanSettingNS.IsAutoCutLine()))
            })
        }

        isTaskInTry() {
            if (this.task.getVipTask().getGameOperation().isShowPlayGame()) return !0;
            switch (this.task.getVipTask().getVipTaskType()) {
                case a.VipDownloadDefineNS.VipTaskType.Try:
                case a.VipDownloadDefineNS.VipTaskType.Ad:
                    return !0
            }
            switch (this.task.getVipTask().getVipEnterType()) {
                case a.VipDownloadDefineNS.VipTaskType.Try:
                case a.VipDownloadDefineNS.VipTaskType.Ad:
                    return !0
            }
            return !1
        }

        isTaskEnterTry() {
            switch (this.task.getVipTask().getVipEnterType()) {
                case a.VipDownloadDefineNS.VipTaskType.Try:
                case a.VipDownloadDefineNS.VipTaskType.Ad:
                    return !0
            }
            return !1
        }

        onSomeOperation(t, ...e) {
            return n(this, void 0, void 0, function* () {
                switch (t) {
                    case"changeXgt":
                        return yield this.changeXgt(e[0], e[1]);
                    case"gotopackagetry":
                        return yield this.commitJoin(!1, a.VipDownloadDefineNS.BaotuanEnterBy.packagetry)
                }
                return null
            })
        }

        changeXgt(t, e) {
            return n(this, void 0, void 0, function* () {
                let e = this.baotuanDetail.baotuanXgt;
                switch (t) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        if (e === a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto) return this.baotuanDetail.baotuanXgt = t, this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Background, {description: "clickSucceedOpenAuto"}), !0
                }
                return !1
            })
        }

        onExpand() {
            return n(this, void 0, void 0, function* () {
                let t = this.canShowBaotuanEnterance();
                if (c.client.callServerFunction("FireEventFunction", "ShowBaoTuanEnterance", t, u.BaoTuanSettingNS.isLoginNeed()), this.logger.info("onExpand", "ShowBaoTuanEnterance", t, u.BaoTuanSettingNS.isLoginNeed()), t) {
                    u.BaoTuanSettingNS.isHaveQueryLeftCount() || (yield b.queryCutlineLeftCount());
                    let t = this.getBaotuanDetailSt();
                    h.BaotuanStatNS.webShowBaoTuan(t.teamLeftCount, t.state), c.client.callServerFunction("FireEventFunction", "BaoTuanTaskStatusChangeEx", this.taskId, t.teamStatus), u.BaoTuanSettingNS.getBaotuanEntranceBelowTask() && (h.BaotuanStatNS.carIdentifyShowBaoTuan(t.teamLeftCount, t.state, this.task.getTaskStatus() === r.DownloadKernel.TaskStatus.Started), yield this.queryBaotuanNumber(), this.updateVipTaskInfo())
                }
            })
        }

        canShowBaotuanEnterance() {
            let t = !1;
            do {
                if (!u.BaoTuanSettingNS.GetBaotuanSwitch()) {
                    this.logger.info("canShowBaotuanEnterance", "BaotuanSwitch", !1);
                    break
                }
                let e = this.task.getTaskBase();
                if (e.taskType === r.DownloadKernel.TaskType.Group) {
                    this.logger.info("canShowBaotuanEnterance", "GroupTask", !1);
                    break
                }
                let i = !1;
                switch (e.taskStatus) {
                    case r.DownloadKernel.TaskStatus.Succeeded:
                    case r.DownloadKernel.TaskStatus.Failed:
                        i = !0, this.logger.info("canShowBaotuanEnterance", "GroupTask", e.taskStatus === r.DownloadKernel.TaskStatus.Failed ? "TaskStatus.Failed" : "TaskStatus.Succeeded")
                }
                if (i) break;
                t = !0
            } while (0);
            return t
        }

        getBaotuanNumber() {
            return n(this, void 0, void 0, function* () {
                return yield this.queryBaotuanNumber(), this.baotuanNumberResponse ? this.baotuanNumberResponse.teamNumber : 0
            })
        }

        static queryCutlineLeftCount() {
            return n(this, void 0, void 0, function* () {
                do {
                    if (b.sQueryCutlineLeftCounting) break;
                    b.sQueryCutlineLeftCounting = !0;
                    let t = yield s.default.cutlineLeft();
                    t && 0 === t.result && u.BaoTuanSettingNS.setCutlineLeftCount(t.cutlineLeftTimes), b.sQueryCutlineLeftCounting = !1
                } while (0)
            })
        }

        updateBaotuanEnterance() {
            if (!this.canShowBaotuanEnterance() || !u.BaoTuanSettingNS.getBaotuanEntranceBelowTask()) return this.taskBelowSrcImg_ = "", void (this.taskBelowHoverTip_ = "");
            let t = a.VipDownloadDefineNS.BaotuanXgt.Before_Join;
            do {
                if (this.baotuanDetail) {
                    t = this.baotuanDetail.baotuanXgt;
                    break
                }
                if (this.cache) {
                    t = this.cache.baotuanXgt;
                    break
                }
            } while (0);
            switch (t) {
                case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                    u.BaoTuanSettingNS.getIsSurperUserOnly() ? (this.taskBelowSrcImg_ = S.ThunderUtil.getStaticPath() + "/img/baotuan_join.gif", this.taskBelowHoverTip_ = "抱团下载，团友助你下载更快乐") : (this.taskBelowSrcImg_ = S.ThunderUtil.getStaticPath() + "/img/baotuan_cutline.gif", this.taskBelowHoverTip_ = "抱团下载，团友助你下载更快乐");
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                    this.taskBelowSrcImg_ = S.ThunderUtil.getStaticPath() + "/img/baotuan_ing.gif", this.taskBelowHoverTip_ = "抱团下载中，一起下载更快乐";
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                    this.taskBelowSrcImg_ = S.ThunderUtil.getStaticPath() + "/img/baotuan_kickout.gif", this.taskBelowHoverTip_ = "您被挤出抱团了，可开启抱团保护";
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                default:
                    this.taskBelowSrcImg_ = S.ThunderUtil.getStaticPath() + "/img/baotuan_join.gif", this.taskBelowHoverTip_ = "抱团下载，团友助你下载更快乐"
            }
        }

        get taskBelowSrcImg() {
            return this.taskBelowSrcImg_
        }

        get taskBelowHoverTip() {
            return this.taskBelowHoverTip_
        }

        fireInfoToWebBaotuanPage() {
            let t = {
                taskId: this.task.getTaskId(),
                teamCount: this.baotuanNumberResponse ? this.baotuanNumberResponse.teamNumber : 0,
                teamStatus: 0,
                isVip: p.default.isVip ? "1" : "0",
                isPlatinumVip: p.default.isPlatinumVip ? "1" : "0",
                isSuperVip: p.default.isSuperVip ? "1" : "0",
                isYear: p.default.isYear ? "1" : "0",
                teamLeftCount: u.BaoTuanSettingNS.getCutlineLeftCount(),
                needCutLine: 0,
                isTry: this.isTaskInTry() ? 1 : 0
            };
            if (this.baotuanDetail) switch (this.baotuanDetail.baotuanXgt) {
                case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                    t.teamStatus = 0;
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                    t.teamStatus = 0, t.needCutLine = 1;
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                    t.teamStatus = 1;
                    break;
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                    t.teamStatus = 2
            }
            this.logger.info("fireInfoToWebBaotuanPage", t), c.client.callServerFunction("FireEventFunction", "BaoTuanDetailInfoChange", JSON.stringify(t))
        }

        getReportSpeedData() {
            return n(this, void 0, void 0, function* () {
                let t = (yield f.BaotuanDataBaseNS.isTaskKickOut(this.taskId)) ? 1 : 0, e = 1;
                this.baotuanDetail && (100 !== this.baotuanDetail.taskDownloadProgress && 100 !== this.baotuanDetail.baotuanDownloadProgress || (e = 0));
                let i = 0;
                this.baotuanNumberResponse && void 0 !== this.baotuanNumberResponse.isSec && (i = this.baotuanNumberResponse.isSec ? 1 : 0);
                let n = 0;
                this.baotuanNumberResponse && void 0 !== this.baotuanNumberResponse.isBlocked && (n = this.baotuanNumberResponse.isBlocked ? 1 : 0);
                let a = {isExit: e, isExited: t, isSecond: i, isDriver: n, fileSize: 0, gcid: ""},
                    s = this.task.getTaskBase();
                if (s) {
                    let t = "";
                    if (1 === (s.taskType === r.DownloadKernel.TaskType.Bt ? 1 : 0)) {
                        let e = this.task.getTaskDetail();
                        e && (t = e.infoId)
                    } else t = s.gcid;
                    a.gcid = t
                }
                if (!s || void 0 === s.downloadSize) return a;
                let o = s.fileSize / 1024 / 1024;
                return a.fileSize = Math.round(o), a
            })
        }

        onConfigureReady() {
            this.updateVipTaskInfo()
        }

        updateVipTaskInfo() {
            this.task.getVipTask().updateVipTaskInfo()
        }

        onCutLineCountChanged() {
            if (p.default.isSuperVip && u.BaoTuanSettingNS.getCutlineLeftCount() < 1 && this.baotuanDetail) switch (this.baotuanDetail.baotuanXgt) {
                case a.VipDownloadDefineNS.BaotuanXgt.Before_All:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                case a.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                    this.hideBaotuan(a.VipDownloadDefineNS.XgtState.Unkown, {description: "onCutLineCountChanged"})
            }
            this.fireInfoToWebBaotuanPage()
        }

        changeXgtState(t, e) {
            let i = this.getXgtInfo();
            e.baotuanInnerPriority = this.getBaotuanXgtPriority(i), this.task.getVipTask().changeXgtState(a.VipDownloadDefineNS.XgtType.Baotuan, t, e)
        }

        onTaskStarted() {
            return n(this, void 0, void 0, function* () {
                this.queryBaotuanNumber(), void 0 === this.recordData && (this.recordData = yield m.default.loadData(this.taskId, p.default.userId), this.logger.info("loadData", this.recordData), (!this.recordData || this.recordData.taskId !== this.taskId || g.default.currentTime > this.recordData.createTime + 86400) && (m.default.delete({taskId: this.taskId}), this.recordData = null)), this.reportTaskStartSpeed(), 0 === this.startTick && (this.startTick = g.default.currentTime)
            })
        }

        reportTaskStartSpeed() {
            setTimeout(() => n(this, void 0, void 0, function* () {
                let t = yield this.getReportSpeedData();
                h.BaotuanStatNS.taskStartDownload(yield u.BaoTuanSettingNS.IsAutoJoin(), yield u.BaoTuanSettingNS.IsAutoCutLine(), t.isSecond, t.isDriver, t.fileSize, t.gcid)
            }), 3e3)
        }

        checkGrayAutoShowNoviceGuid() {
            return n(this, void 0, void 0, function* () {
                switch (this.baotuanDetail.baotuanXgt) {
                    case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                        break;
                    default:
                        return !1
                }
                if (!u.BaoTuanSettingNS.getBaotuanEntrance().newer_window) return !1;
                if (yield u.BaoTuanSettingNS.getHaveShowNoviceGuid()) return !1;
                if (0 !== (yield u.BaoTuanSettingNS.GetBaoTuanSuccedCount())) return !1;
                let t = this.task.getTaskBase();
                return !(!t || void 0 === t.downloadSize) && !(t.fileSize / 1024 / 1024 < 200)
            })
        }

        tryShowNoviceGuid() {
            return n(this, void 0, void 0, function* () {
                (yield c.client.callServerFunction("IsMainWndVisible")) ? (this.task.select(), d.default.emit(d.TaskEventNS.showBaotuanPopupWnd, "NoviceGuid", this.taskId, {from: "gray_auto"})) : this.onMainWindowVisibleChangeCookie = c.client.attachServerEvent("OnMainWindowVisibleChange", (t, e) => n(this, void 0, void 0, function* () {
                    e && (yield this.checkGrayAutoShowNoviceGuid()) && (this.task.select(), d.default.emit(d.TaskEventNS.showBaotuanPopupWnd, "NoviceGuid", this.taskId, {from: "gray_auto"}))
                }))
            })
        }

        grayTryAuto() {
            return n(this, void 0, void 0, function* () {
                if (0 !== (yield u.BaoTuanSettingNS.GetBaoTuanSuccedCount())) return;
                if (u.BaoTuanSettingNS.getBaotuanEntrance().failed_auto_join) {
                    switch (this.baotuanDetail.baotuanXgt) {
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                        case a.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                            break;
                        default:
                            return
                    }
                    (yield u.BaoTuanSettingNS.getBeforeXgtShowCount()) < 6 ? u.BaoTuanSettingNS.addBeforeXgtShowCount() : (d.default.emit(d.TaskEventNS.enterBaotuanAcclerate, "gray_auto", this.taskId, a.VipDownloadDefineNS.BaotuanEnterBy.grayAutoJoin), 0 === (yield u.BaoTuanSettingNS.getGrayFailedAutoJoinCutLine()) && ((yield u.BaoTuanSettingNS.IsBaoTuanSettingManualCancel()) || (u.BaoTuanSettingNS.SetAutoJoinCutLine(!0, "gray_failed_auto"), u.BaoTuanSettingNS.setGrayFailedAutoJoinCutLine())))
                }
            })
        }

        grayAutoConfig() {
            return n(this, void 0, void 0, function* () {
                u.BaoTuanSettingNS.IsAutoJoin() || u.BaoTuanSettingNS.IsAutoCutLine() || 0 === (yield u.BaoTuanSettingNS.getGraySucceedAutoJoinCutLine()) && this.getClickType() !== a.VipDownloadDefineNS.BaotuanEnterBy.teamImmediately && (u.BaoTuanSettingNS.SetAutoJoinCutLine(!0, "gray_succeed"), u.BaoTuanSettingNS.setGraySucceedAutoJoinCutLine())
            })
        }

        saveState() {
            if (p.default.isVip) {
                let t = this.task.getTaskBase();
                if (!t || void 0 === t.downloadSize) return void this.logger.info("taskBase.downloadSize not exist!");
                m.default.saveData(this.taskId, p.default.userId, {
                    taskId: this.taskId,
                    createTime: g.default.currentTime,
                    startSize: t.downloadSize,
                    baotuanDownloadProgress: this.baotuanDetail.baotuanDownloadProgress,
                    taskDownloadProgress: this.baotuanDetail.taskDownloadProgress,
                    from: this.clickType,
                    succeedByCutLine: this.baotuanDetail.succeedByCutLine
                })
            }
        }

        tryRestartBaotuan() {
            return n(this, void 0, void 0, function* () {
                return !(!p.default.isVip || !this.recordData) && (this.isRestartBaotuan = !0, "" !== this.clickTypePre && (this.recordData.from = this.clickTypePre), this.enter(this.recordData.from, a.VipDownloadDefineNS.BaotuanEnterBy.restartAppJoin), !0)
            })
        }

        tryResumeBaotuan() {
            return n(this, void 0, void 0, function* () {
                if (!p.default.isVip || this.lastClearState.lastClearReason !== `${p.default.userId}.setVipEnterType.Try.true` && this.lastClearState.lastClearReason !== `${p.default.userId}.${w.PackageTryDefineNS.State.runing}.true`) this.logger.info("tryResumeBaotuan", this.lastClearState.lastClearReason, !1); else {
                    if (p.default.isSuperVip || !(yield u.BaoTuanSettingNS.checkIsSurperUserOnly())) return this.logger.info("tryResumeBaotuan", this.lastClearState.lastClearReason, !0), this.enter(this.lastClearState.clickBy, a.VipDownloadDefineNS.BaotuanEnterBy.resumeBaotuan), !0;
                    this.logger.info("tryResumeBaotuan", this.lastClearState.lastClearReason, !1, "IsSurperUserOnly")
                }
                return !1
            })
        }

        restartBaotuan() {
            return n(this, void 0, void 0, function* () {
                return 1 !== this.getBaotuanDetailSt().teamStatus && (!!(this.recordData && p.default.isVip && this.baotuanNumberResponse && this.baotuanNumberResponse.teamNumber) && (this.baotuanDetail.succeedByCutLine = this.recordData.succeedByCutLine, this.baotuanDetail.baotuanXgt = a.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed, this.baotuanDetail.taskDownloadProgress = this.recordData.taskDownloadProgress, this.baotuanDetail.baotuanDownloadProgress = this.recordData.baotuanDownloadProgress, this.baotuanDetail.baotuanNumber = this.baotuanNumberResponse.teamNumber, this.isKickOut = !1, this.joinKey = "", this.needReportSpeed = !0, this.reportJoinSucceed(), this.recordTaskSpeed(!0), yield this.notifyDetailChanged(), yield this.queryToken(this.recordData), !0))
            })
        }

        clearRecordData(t) {
            this.lastClearState.lastClearReason = "", void 0 !== this.recordData ? (this.logger.info("clearRecordData", t), m.default.delete({taskId: this.taskId}), this.isRestartBaotuan = !1, this.recordData = null) : this.logger.info("clearRecordData", t, "break")
        }
    }

    b.sShowingBaoTuanTaskMap = new Map, b.sQueryCutlineLeftCounting = !1, b.showingAni = !1, e.BaotuanOperation = b
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(236), a = i(0).default.getLogger("VipDownload:baotuan-cache");

    class s {
        constructor() {
            this.mTasks = new Map
        }

        createTask(t) {
            let e = this.getTask(t);
            return e ? (a.info("createTask from cache:", t, e), e) : (e = new n.TaskCache, this.mTasks.set(t, e), e)
        }

        getTask(t) {
            return this.mTasks.get(t)
        }

        removeTask(t) {
            this.mTasks.delete(t)
        }
    }

    e.BaotuanCacheManager = s, e.default = new s
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(8);
    e.TaskCache = class {
        constructor() {
            this.mBaotuanCount = void 0, this.mBaotuanXgt = n.VipDownloadDefineNS.BaotuanXgt.Before_All, this.mResourceResult = 0
        }

        get baotuanXgt() {
            return this.mBaotuanXgt
        }

        set baotuanXgt(t) {
            this.mBaotuanXgt = t
        }

        get baotuanCount() {
            return this.mBaotuanCount
        }

        set baotuanCount(t) {
            this.mBaotuanCount = t
        }

        get resourceResult() {
            return this.mResourceResult
        }

        set resourceResult(t) {
            this.mResourceResult = t
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(82);
    !function (t) {
        const e = new a.SqliteTable;
        e.name = "TeamTaskKickOut", e.encrypt = !0, e.jsonify = !0, e.init("0").catch();
        let i = new Map;
        t.setKickOutTask = function (t) {
            let n = {isKickOut: !0};
            e.setUserData(t, -1, n).catch(), i.set(t, n)
        }, t.isTaskKickOut = function (t) {
            return n(this, void 0, void 0, function* () {
                let n = i.get(t);
                return n ? n.isKickOut : !!(n = yield e.getUserData(t, -1)) && (i.set(t, n), n.isKickOut)
            })
        }
    }(e.BaotuanDataBaseNS || (e.BaotuanDataBaseNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(239), s = i(188), o = "584C535343444E2E";

    class r extends a.SqliteTableBase {
        get tableName() {
            return "BaoTuan"
        }

        get fields() {
            return {taskId: "BIGINT", userId: "NVARCHAR", extData: "NVARCHAR"}
        }

        get primateKey() {
            return "taskId"
        }

        loadData(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = yield this.getOneRecord({taskId: t, userId: e}), n = null;
                if (i) try {
                    n = JSON.parse(s.AesCryptoNS.decryptString(i.extData, o))
                } catch (t) {
                    n = null
                }
                return n
            })
        }

        saveData(t, e, i) {
            return n(this, void 0, void 0, function* () {
                this.update({taskId: t}, {userId: e, extData: s.AesCryptoNS.encryptString(JSON.stringify(i), o)})
            })
        }
    }

    e.BaotuanDataBase = r, e.default = new r
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(0), o = i(29), r = s.default.getLogger("sqlite-table-base");
    e.SqliteTableBase = class {
        execSqlite(t) {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("ExecSqlite", t)
            })
        }

        querySqlite(t) {
            return n(this, void 0, void 0, function* () {
                return yield a.client.callServerFunction("QuerySqlite", t)
            })
        }

        constructor() {
            this.init()
        }

        init() {
            return n(this, void 0, void 0, function* () {
                (yield this.isTableExist()) || (yield this.createTable())
            })
        }

        dropTable() {
            return n(this, void 0, void 0, function* () {
                let t = yield this.isTableExist();
                if (r.info("table exist", t), t) {
                    let t = -1, e = this.tableName;
                    if (e) {
                        let i = `drop table ${e}`;
                        t = yield this.execSqlite(i), r.info(i, t)
                    }
                }
            })
        }

        clearTable() {
            return n(this, void 0, void 0, function* () {
                let t = this.tableName;
                if (t) {
                    let e = `delete from ${t}`, i = yield this.execSqlite(e);
                    r.info(e, i)
                }
            })
        }

        createTable() {
            return n(this, void 0, void 0, function* () {
                let t = -1, e = this.tableName;
                if (e) {
                    let i = "";
                    Object.getOwnPropertyNames(this.fields).forEach(t => {
                        "" === i ? i = `${t} ${this.fields[t]}` : i += `, ${t} ${this.fields[t]}`
                    });
                    let n = `create table ${e}(${i += `, primary key(${this.primateKey})`})`;
                    t = yield this.execSqlite(n), r.info(n, t)
                }
                return t
            })
        }

        modifyTable() {
            return n(this, void 0, void 0, function* () {
                let t = `PRAGMA table_info('${this.tableName}')`;
                t = `PRAGMA table_info('${this.tableName}')`;
                let e = yield this.querySqlite(t), i = {}, a = Object.getOwnPropertyNames(this.fields);
                return e && a.forEach(t => {
                    let n = !1;
                    e.forEach(e => {
                        e.forEach(e => {
                            "name" === e.key && t === e.value && (n = !0)
                        })
                    }), n || (i[t] = this.fields[t])
                }), Object.getOwnPropertyNames(i).forEach(t => n(this, void 0, void 0, function* () {
                    let n = `alter table ${this.tableName} add column ${t} ${i[t]}`;
                    e = yield this.querySqlite(n), r.info(n, e)
                })), !0
            })
        }

        isTableExist() {
            return n(this, void 0, void 0, function* () {
                let t = !1, e = this.tableName;
                if (e) {
                    let i = `select count(*) from sqlite_master where type='table' and name='${e}'`,
                        n = yield this.querySqlite(i);
                    if (r.info(i, n), n && n.length > 0) {
                        let e = n[0];
                        if (e && e.length > 0) {
                            let i = e[0].value;
                            i && Number(i).valueOf() > 0 && (t = !0)
                        }
                    }
                }
                return t
            })
        }

        update(t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = -1, a = void 0, s = yield this.isRecordExist(t);
                return r.info("condition exist", t, s), a = s ? this.getUpdateSql(t, i || e) : this.getInsertSql(t, e), n = yield this.execSqlite(a), r.info(a, n), n
            })
        }

        getOneRecord(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = {}, n = this.getSelectSql(t, e, [0, 1]), a = yield this.querySqlite(n);
                r.info(n, a);
                let s = Object.getOwnPropertyNames(this.fields);
                return a && a.forEach(t => {
                    t.forEach(t => {
                        s.forEach(e => {
                            if (e === t.key) switch (this.fields[e]) {
                                case"BIGINT":
                                case"INTEGER":
                                    i[t.key] = Number.parseInt(t.value);
                                    break;
                                case"NVARCHAR":
                                default:
                                    i[t.key] = t.value
                            }
                        })
                    })
                }), o.isObjectEmpty(i) ? null : i
            })
        }

        getRecord(t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = [], a = this.getSelectSql(t, e, i), s = yield this.querySqlite(a);
                r.info(a, s);
                let o = Object.getOwnPropertyNames(this.fields);
                return s && s.forEach(t => {
                    let e = {};
                    t.forEach(t => {
                        o.forEach(i => {
                            if (i === t.key) switch (this.fields[i]) {
                                case"BIGINT":
                                case"INTEGER":
                                    e[t.key] = Number.parseInt(t.value);
                                    break;
                                case"NVARCHAR":
                                default:
                                    e[t.key] = t.value
                            }
                        })
                    }), n.push(e)
                }), n
            })
        }

        getRecordCount(t) {
            return n(this, void 0, void 0, function* () {
                let e = this.getSelectSql(t, null, null, [`count(${this.primateKey})`]), i = yield this.querySqlite(e),
                    n = 0;
                if (r.info(e, i), i && i.length > 0) {
                    let t = i[0];
                    if (t && t.length > 0) {
                        let e = t[0].value;
                        e && Number(e).valueOf() > 0 && (n = Number(e).valueOf())
                    }
                }
                return n
            })
        }

        delete(t) {
            return n(this, void 0, void 0, function* () {
                let e = -1, i = this.getDeleteSql(t);
                return e = yield this.execSqlite(i), r.info(i, e), e
            })
        }

        isRecordExist(t) {
            return n(this, void 0, void 0, function* () {
                return (yield this.getRecordCount(t)) > 0
            })
        }

        getConditionSql(t) {
            let e = "";
            return Object.getOwnPropertyNames(t).forEach(i => {
                "object" == typeof t[i] ? "" === e ? e = `${i} ${t[i][0]} ${t[i][1]}` : e += ` and ${i} ${t[i][0]} ${t[i][1]}` : "string" == typeof t[i] ? "" === e ? e = `${i}='${t[i]}'` : e += ` and ${i}='${t[i]}'` : "" === e ? e = `${i}=${t[i]}` : e += ` and ${i}=${t[i]}`
            }), e
        }

        getValueSql(t) {
            let e = "";
            return Object.getOwnPropertyNames(t).forEach(i => {
                "string" == typeof t[i] ? "" === e ? e = `${i}='${t[i]}'` : e += `, ${i}='${t[i]}'` : "object" == typeof t[i] ? "" === e ? e = `${i}='${JSON.stringify(t[i])}'` : e += `, ${i}='${JSON.stringify(t[i])}'` : "" === e ? e = `${i}=${t[i]}` : e += `, ${i}=${t[i]}`
            }), e
        }

        getInsertSql(t, e) {
            let i = "", n = "", a = this.primateKey;
            return Object.getOwnPropertyNames(t).forEach(e => {
                e === a && (i = e, n = "string" == typeof t[e] ? `'${t[e]}'` : t[e])
            }), Object.getOwnPropertyNames(e).forEach(t => {
                t !== a && (i += `, ${t}`, "string" == typeof e[t] ? n += `, '${e[t]}'` : "object" == typeof e[t] ? n += `, '${JSON.stringify(e[t])}'` : n += `, ${e[t]}`)
            }), `INSERT INTO ${this.tableName} (${i}) values (${n})`
        }

        getUpdateSql(t, e) {
            return `update ${this.tableName} set ${this.getValueSql(e)} where ${this.getConditionSql(t)}`
        }

        getSelectSql(t, e, i, n) {
            let a = "*";
            n && n.forEach(t => {
                "*" === a ? a = t : a += `,${t}`
            });
            let s = `select ${a} from ${this.tableName} where ${this.getConditionSql(t)}`;
            if (e) {
                let t = "";
                Object.getOwnPropertyNames(e).forEach(i => {
                    "" === t ? t = `${i} ${e[i]}` : t += `, ${i} ${e[i]}`
                }), s += ` order by ${t}`
            }
            return i && (s += ` limit ${i[0]}, ${i[1]}`), s
        }

        getDeleteSql(t) {
            return `delete from ${this.tableName} where ${this.getConditionSql(t)}`
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(8), s = i(2), o = i(27), r = i(50), l = i(1), u = i(3), c = i(13), d = i(31);
    d.default.defaults.adapter = i(25);
    const h = i(85);

    class f {
        constructor(t) {
            this.logger = null, this.task = null, this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Unkown, this.xgtTimer = null, this.canShowGameGlobal = !1, this.taskId = t.getTaskId(), this.task = t, this.logger = new h.TaskLogHelp(h.TaskLogHelpName.Game, t), this.initShowGameChance(), u.default.addListener(u.UserEventNS.authorityChangedBegin, this.onAuthorityChangedBegin.bind(this)), r.default.addListener(r.AbtestEventNS.configureReady, this.onAbtestConfigureReady.bind(this))
        }

        getTaskId() {
            return this.taskId
        }

        showGame() {
            return !!this.canShowGameGlobal && (!!this.isShowPlayGame() || !!this.getShowGameChance("showGame") && (this.logger.info("showGame"), this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Showing, f.sIsPlayGameUser = !0, this.xgtTimer || (this.xgtTimer = setTimeout(() => {
                this.removeGame(), clearTimeout(this.xgtTimer), this.xgtTimer = null
            }, 18e5)), !0))
        }

        removeGame() {
            this.logger.info("removeGame"), this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Hiding, this.task.getVipTask().changeXgtState(a.VipDownloadDefineNS.XgtType.PlayGame, a.VipDownloadDefineNS.XgtState.Exit)
        }

        set isPlayGameUser(t) {
            f.sIsPlayGameUser = t
        }

        get isPlayGameUser() {
            return f.sIsPlayGameUser && this.canShowGameGlobal
        }

        getIsPlayGameUser() {
            return f.sIsPlayGameUser && this.canShowGameGlobal
        }

        isShowPlayGame() {
            switch (this.xgtState) {
                case a.VipDownloadDefineNS.PlayGameXgtState.Showing:
                case a.VipDownloadDefineNS.PlayGameXgtState.Clicked:
                    return !0
            }
            return !1
        }

        getXgtState() {
            return this.xgtState
        }

        initShowGameChance() {
            return n(this, void 0, void 0, function* () {
                if (null === f.sXgtCount) {
                    f.sXgtCount = 0;
                    let t = yield s.client.callServerFunction("GetValue", "VipDownload", "PlayGameDate", "0").catch(),
                        e = (new Date).toDateString();
                    t !== e ? (f.sXgtCount = c.default.getValue("VipDownload", "PlayGameXgtCount"), yield s.client.callServerFunction("SetValue", "VipDownload", "PlayGameDate", e).catch(), yield s.client.callServerFunction("SetValue", "VipDownload", "PlayGameXgtCount", f.sXgtCount).catch()) : f.sXgtCount = yield s.client.callServerFunction("GetValue", "VipDownload", "PlayGameXgtCount", 0).catch()
                }
            })
        }

        getShowGameChance(t) {
            if (this.logger.info("getShowGameChance", t), !o.default.getItemData(o.ItemName.PlayGameText)) return this.logger.info("getShowGameChance:", "noPlayGameUser"), !1;
            switch (this.xgtState) {
                case a.VipDownloadDefineNS.PlayGameXgtState.Unkown:
                    break;
                case a.VipDownloadDefineNS.PlayGameXgtState.Showing:
                case a.VipDownloadDefineNS.PlayGameXgtState.Clicked:
                    return !0;
                case a.VipDownloadDefineNS.PlayGameXgtState.Hiding:
                    return !1
            }
            let e = f.sXgtCount;
            return this.logger.info("getShowGameChance:", f.sXgtCount), f.sXgtCount > 0 && (f.sXgtCount--, s.client.callServerFunction("SetValue", "VipDownload", "PlayGameXgtCount", f.sXgtCount).catch()), e > 0
        }

        addShowGameChance() {
            f.sXgtCount++, s.client.callServerFunction("SetValue", "VipDownload", "PlayGameXgtCount", f.sXgtCount).catch(), this.logger.info("addShowGameChance:", f.sXgtCount)
        }

        getShowGameChanceCount() {
            return f.sXgtCount
        }

        clickPlayGame() {
            this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Clicked, this.xgtTimer && (clearTimeout(this.xgtTimer), this.xgtTimer = null)
        }

        checkGameXgt() {
            return n(this, void 0, void 0, function* () {
                if (o.default.getItemData(o.ItemName.PlayGameText) || this.isShowPlayGame()) {
                    (yield this.queryUserHaveFinishGameTask()) && (o.default.cleanPlayGameData(), this.isShowPlayGame() && (this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Hiding, this.task.getVipTask().updateVipTaskInfo()), this.xgtTimer && (clearTimeout(this.xgtTimer), this.xgtTimer = null))
                }
            })
        }

        queryUserHaveFinishGameTask() {
            return n(this, void 0, void 0, function* () {
                if ("" == u.default.userId) return !0;
                if (u.default.userId === f.sPreQueryGameTaskUserId && l.default.currentTime - f.sPreQueryGameTaskTick < 5 && null !== f.sIsFinishPlayGameTask) return f.sIsFinishPlayGameTask;
                f.sPreQueryGameTaskTick = l.default.currentTime, f.sPreQueryGameTaskUserId = u.default.userId;
                let t = !0,
                    e = `http://api-web-game-ssl.xunlei.com/game/user/task?userid=${u.default.userId}&sessionid=${yield u.default.getSessionId()}`;
                try {
                    let i = yield d.default.get(e, {timeout: 1e4});
                    if (this.logger.info("queryUserHaveFinishGameTask:", i), null !== i && 200 === i.status && null !== i.data) {
                        let e = i.data;
                        if (0 === e.code && e.data) {
                            let i = e.data;
                            this.logger.info("queryUserHaveFinishGameTask:taskData", i);
                            let n = 0;
                            for (; ;) {
                                let e = i[n];
                                if (!e) break;
                                0 === e.status && (t = !1), n++
                            }
                        }
                    }
                    f.sIsFinishPlayGameTask = t
                } catch (e) {
                    this.logger.info("err", e), t = !0, f.sIsFinishPlayGameTask = null
                }
                return this.logger.info("bFinish", t), t
            })
        }

        onAuthorityChangedBegin(t, e) {
            return n(this, void 0, void 0, function* () {
                f.sIsPlayGameUser = !1
            })
        }

        onAbtestConfigureReady() {
            return n(this, void 0, void 0, function* () {
                this.isShowPlayGame() && this.cleanGame(), this.task.getVipTask().getXgtState(a.VipDownloadDefineNS.XgtType.Try) !== a.VipDownloadDefineNS.XgtState.Ready && this.task.getVipTask().getXgtState(a.VipDownloadDefineNS.XgtType.Ad) !== a.VipDownloadDefineNS.XgtState.Ready || "0" !== u.default.userId && this.getShowGameChance("onAbtestConfigureReady") && this.task.getVipTask().changeXgtState(a.VipDownloadDefineNS.XgtType.PlayGame, a.VipDownloadDefineNS.XgtState.Ready)
            })
        }

        cleanGame() {
            this.logger.info("cleanGame"), this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Unkown, this.xgtTimer && (clearTimeout(this.xgtTimer), this.xgtTimer = null), this.task.getVipTask().changeXgtState(a.VipDownloadDefineNS.XgtType.PlayGame, a.VipDownloadDefineNS.XgtState.Exit)
        }

        resetGame() {
            this.logger.info("resetGame"), this.xgtState = a.VipDownloadDefineNS.PlayGameXgtState.Unkown, this.xgtTimer && (clearTimeout(this.xgtTimer), this.xgtTimer = null)
        }
    }

    f.sXgtCount = null, f.sIsPlayGameUser = !1, f.sIsFinishPlayGameTask = null, f.sPreQueryGameTaskTick = 0, f.sPreQueryGameTaskUserId = "", e.GameOperation = f
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(8), a = i(16), s = i(26), o = i(21), r = i(41), l = i(14),
        u = i(0).default.getLogger("VipDownload:ad-task");
    !function (t) {
        let e = !1, i = !1;

        function c(t, e) {
            u.info("adButtonShow");
            let i = new Map, n = f(t);
            i.set("taskid", t), i.set("gcid", n), i.set("download_status", e);
            let s = {attribute1: "adcelerate_banner_show", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_ad_event", s).catch()
        }

        function d(t) {
            e = !1, i = !1, p(t, o.default.getVipTaskInfo(t))
        }

        function h(t, e, i) {
            if (!i) return;
            t === o.default.expandTaskId && p(t, e)
        }

        function f(t) {
            const e = s.default.getTask(t);
            let i = "";
            do {
                if (!e) break;
                let n = r.default.getTask(t);
                if (!n) break;
                let a = e.getFile(n.subId);
                a && (i = a.gcid)
            } while (0);
            return i
        }

        function p(t, a) {
            if (!a || a.taskType !== n.VipDownloadDefineNS.VipTaskType.Ad) return;
            o.default.getTryDetail(t) ? a.taskStatus === n.VipDownloadDefineNS.VipTaskStatus.Init ? c(t, "init") : a.taskStatus > n.VipDownloadDefineNS.VipTaskStatus.Init && a.taskStatus < n.VipDownloadDefineNS.VipTaskStatus.Finished ? e || (e = !0, c(t, "trial")) : a.taskStatus === n.VipDownloadDefineNS.VipTaskStatus.Finished && (i || (i = !0, c(t, "finish"))) : u.info("detail is null")
        }

        l.default.addListener(l.TaskEventNS.vipTaskInfoChanged, h), l.default.addListener(l.TaskEventNS.taskExpand, d), t.adButtonShow = c, t.adButtonClick = function (t, e) {
            u.info("adButtonClick");
            let i = new Map, n = f(t);
            i.set("taskid", t), i.set("gcid", n), i.set("download_status", e);
            let s = {attribute1: "adcelerate_banner_click", extData: i};
            a.StatUtilitiesNS.trackEvent("xlx_ad_event", s).catch()
        }, t.startAcclerate = function (t) {
            u.info("startAcclerate");
            let e = new Map, i = f(t);
            e.set("taskid", t), e.set("gcid", i);
            let n = {attribute1: "adcelerate_task_speed_up", extData: e};
            a.StatUtilitiesNS.trackEvent("xlx_ad_event", n).catch()
        }, t.onTaskExpand = d, t.onVipTaskInfoChanged = h, t.getTaskGcid = f
    }(e.AdStatNS || (e.AdStatNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(15), s = i(194), o = i(3), r = i(0).default.getLogger("VipDownload:task-scene-http-session");
    e.SceneHttpSession = class extends a.HttpSession {
        constructor() {
            super(), this.mMapDoneTaskids = new Map, this.mListWaitTasks = [], this.mIsQuerying = !1
        }

        clear() {
            this.mMapDoneTaskids.clear(), this.mListWaitTasks = []
        }

        removeTask(t) {
            this.mMapDoneTaskids.delete(t)
        }

        queryTask(t, e) {
            this.mMapDoneTaskids.get(t) ? r.info("taskId already query!") : (this.mMapDoneTaskids.set(t, t), this.mListWaitTasks.push({
                taskId: t,
                callback: e
            }), this.queryNext().catch())
        }

        queryNext() {
            return n(this, void 0, void 0, function* () {
                if (!this.mIsQuerying && this.mListWaitTasks.length > 0) {
                    let t = this.mListWaitTasks[0], e = t.taskId, i = t.callback;
                    this.mListWaitTasks.splice(0, 1);
                    let n = -1, a = {peerId: yield o.default.getPeerId(), taskId: e, subId: n};
                    this.mIsQuerying = !0, i(yield this.query(a)), this.mIsQuerying = !1, this.queryNext().catch()
                }
            })
        }

        query(t) {
            return n(this, void 0, void 0, function* () {
                return this.host = "scene.vip.xunlei.com", this.port = 8e3, this.retries = 1, this.timeout = 15e3, this.body = yield s.SceneHttpPackageNS.createSceneBuffer(t), new Promise(t => {
                    this.post(e => n(this, void 0, void 0, function* () {
                        let i = null;
                        200 === e.statusCode && e.body && e.body.length > 12 && (i = yield s.SceneHttpPackageNS.praseSceneBuffer(e.body)), t(i)
                    }), e => {
                        r.info("error", e), t(null)
                    })
                })
            })
        }
    }
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(244);

    class s {
        constructor() {
            this.mTasks = new Map
        }

        createTask(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = this.getTask(t);
                return i || (yield(i = new a.TaskCache).setData(e), this.mTasks.set(t, i)), i
            })
        }

        createTaskB(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = this.getTask(t);
                return i || (yield(i = new a.TaskCache).setDataB(e), this.mTasks.set(t, i)), i
            })
        }

        deleteTask(t) {
            this.mTasks.delete(t)
        }

        getTask(t) {
            return this.mTasks.get(t)
        }

        clear() {
            this.mTasks.clear()
        }
    }

    e.SceneCacheManager = s, e.default = new s
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(245), s = i(34).promisify, o = i(0).default.getLogger("VipDownload:task-scene-task-cache");
    e.TaskCache = class {
        constructor() {
            this.mItems = [], this.mCursor = 0
        }

        next() {
            this.mCursor += 1
        }

        getItem() {
            let t = this.mItems.length;
            if (t > 0) {
                let e = this.mCursor % t;
                return this.mItems[e]
            }
            return null
        }

        setData(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.parseData(t);
                this.mItems = e
            })
        }

        setDataB(t) {
            return n(this, void 0, void 0, function* () {
                let e = yield this.parseDataB(t);
                this.mItems = e
            })
        }

        parseDataB(t) {
            return n(this, void 0, void 0, function* () {
                let e = [];
                for (let i of t.itemDatas) {
                    let t = {id: i.id, priority: i.priority};
                    t.text = i.name, t.textlink = i.lineStr, t.config = i.config, t.aidfrom = i.aidfrom, e.push(t)
                }
                return e
            })
        }

        parseData(t) {
            return n(this, void 0, void 0, function* () {
                let e = [];
                for (let i of t.itemDatas) if (-1 === i.status) {
                    let n = {explicitArray: !1}, r = yield s(a.parseString)(i.lineStr, n);
                    if (!r || !r.scene || !r.scene.element) {
                        o.info("scene elements is null");
                        continue
                    }
                    let l = null, u = r.scene.element;
                    if (u instanceof Array ? l = u : u instanceof Object && (l = [u]), !l) {
                        o.info("scene elements is null");
                        continue
                    }
                    let c = {id: i.id, priority: i.priority}, d = void 0, h = void 0;
                    for (let t of l) t.text && "" !== t.text && (d = t.text, t.code && "" !== t.code && (h = this.parseUrl(t.code)));
                    d && "" !== d && (c.text = d, c.textlink = h, c.isBDefault = t.isBDefault, e.push(c))
                }
                return e
            })
        }

        parseUrl(t) {
            let e = void 0, i = t.indexOf('GenerateJumpKey("');
            if (i < 0 || i >= t.length) return e;
            i += 17;
            let n = t.indexOf('")', i);
            return n <= i || n >= t.length ? e : e = t.substring(i, n)
        }
    }
}, function (t, e, i) {
    (function () {
        "use strict";
        var t, n, a, s, o = {}.hasOwnProperty;
        n = i(165), t = i(246), a = i(251), s = i(202), e.defaults = n.defaults, e.processors = s, e.ValidationError = function (t) {
            function e(t) {
                this.message = t
            }

            return function (t, e) {
                for (var i in e) o.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(e, Error), e
        }(), e.Builder = t.Builder, e.Parser = a.Parser, e.parseString = a.parseString
    }).call(this)
}, function (t, e, i) {
    (function () {
        "use strict";
        var t, n, a, s, o, r = {}.hasOwnProperty;
        t = i(247), n = i(165).defaults, s = function (t) {
            return "string" == typeof t && (t.indexOf("&") >= 0 || t.indexOf(">") >= 0 || t.indexOf("<") >= 0)
        }, o = function (t) {
            return "<![CDATA[" + a(t) + "]]>"
        }, a = function (t) {
            return t.replace("]]>", "]]]]><![CDATA[>")
        }, e.Builder = function () {
            function e(t) {
                var e, i, a;
                for (e in this.options = {}, i = n[.2]) r.call(i, e) && (a = i[e], this.options[e] = a);
                for (e in t) r.call(t, e) && (a = t[e], this.options[e] = a)
            }

            return e.prototype.buildObject = function (e) {
                var i, a, l, u, c, d;
                return i = this.options.attrkey, a = this.options.charkey, 1 === Object.keys(e).length && this.options.rootName === n[.2].rootName ? e = e[c = Object.keys(e)[0]] : c = this.options.rootName, d = this, l = function (t, e) {
                    var n, u, c, h, f, p;
                    if ("object" != typeof e) d.options.cdata && s(e) ? t.raw(o(e)) : t.txt(e); else if (Array.isArray(e)) {
                        for (h in e) if (r.call(e, h)) for (f in u = e[h]) c = u[f], t = l(t.ele(f), c).up()
                    } else for (f in e) if (r.call(e, f)) if (u = e[f], f === i) {
                        if ("object" == typeof u) for (n in u) p = u[n], t = t.att(n, p)
                    } else if (f === a) t = d.options.cdata && s(u) ? t.raw(o(u)) : t.txt(u); else if (Array.isArray(u)) for (h in u) r.call(u, h) && (t = "string" == typeof (c = u[h]) ? d.options.cdata && s(c) ? t.ele(f).raw(o(c)).up() : t.ele(f, c).up() : l(t.ele(f), c).up()); else "object" == typeof u ? t = l(t.ele(f), u).up() : "string" == typeof u && d.options.cdata && s(u) ? t = t.ele(f).raw(o(u)).up() : (null == u && (u = ""), t = t.ele(f, u.toString()).up());
                    return t
                }, u = t.create(c, this.options.xmldec, this.options.doctype, {
                    headless: this.options.headless,
                    allowSurrogateChars: this.options.allowSurrogateChars
                }), l(u, e).end(this.options.renderOpts)
            }, e
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r, l;
        l = i(46), o = l.assign, r = l.isFunction, e = i(248), n = i(249), s = i(166), a = i(250), t.exports.create = function (t, i, n, a) {
            var s, r;
            if (null == t) throw new Error("Root element needs a name");
            return a = o({}, i, n, a), r = (s = new e(a)).element(t), a.headless || (s.declaration(a), null == a.pubID && null == a.sysID || s.doctype(a)), r
        }, t.exports.begin = function (t, i, a) {
            var s;
            return r(t) && (i = (s = [t, i])[0], a = s[1], t = {}), i ? new n(t, i, a) : new e(t)
        }, t.exports.stringWriter = function (t) {
            return new s(t)
        }, t.exports.streamWriter = function (t, e) {
            return new a(t, e)
        }
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o = {}.hasOwnProperty;
        s = i(46).isPlainObject, e = i(19), a = i(200), n = i(166), t.exports = function (t) {
            function i(t) {
                i.__super__.constructor.call(this, null), t || (t = {}), t.writer || (t.writer = new n), this.options = t, this.stringify = new a(t), this.isDocument = !0
            }

            return function (t, e) {
                for (var i in e) o.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, e), i.prototype.end = function (t) {
                var e;
                return t ? s(t) && (e = t, t = this.options.writer.set(e)) : t = this.options.writer, t.document(this)
            }, i.prototype.toString = function (t) {
                return this.options.writer.set(t).document(this)
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r, l, u, c, d, h, f, p, g, S, y, T, k, m, v = {}.hasOwnProperty;
        m = i(46), T = m.isObject, y = m.isFunction, k = m.isPlainObject, d = i(95), n = i(96), a = i(97), f = i(104), S = i(105), h = i(106), u = i(98), c = i(99), s = i(100), r = i(101), o = i(102), l = i(103), e = i(199), g = i(200), p = i(166), t.exports = function () {
            function t(t, e, i) {
                var n;
                t || (t = {}), t.writer ? k(t.writer) && (n = t.writer, t.writer = new p(n)) : t.writer = new p(t), this.options = t, this.writer = t.writer, this.stringify = new g(t), this.onDataCallback = e || function () {
                }, this.onEndCallback = i || function () {
                }, this.currentNode = null, this.currentLevel = -1, this.openTags = {}, this.documentStarted = !1, this.documentCompleted = !1, this.root = null
            }

            return t.prototype.node = function (t, e, i) {
                var n;
                if (null == t) throw new Error("Missing node name");
                if (this.root && -1 === this.currentLevel) throw new Error("Document can only have one root node");
                return this.openCurrent(), t = t.valueOf(), null == e && (e = {}), e = e.valueOf(), T(e) || (i = (n = [e, i])[0], e = n[1]), this.currentNode = new d(this, t, e), this.currentNode.children = !1, this.currentLevel++, this.openTags[this.currentLevel] = this.currentNode, null != i && this.text(i), this
            }, t.prototype.element = function (t, e, i) {
                return this.currentNode && this.currentNode instanceof c ? this.dtdElement.apply(this, arguments) : this.node(t, e, i)
            }, t.prototype.attribute = function (t, i) {
                var n, a;
                if (!this.currentNode || this.currentNode.children) throw new Error("att() can only be used immediately after an ele() call in callback mode");
                if (null != t && (t = t.valueOf()), T(t)) for (n in t) v.call(t, n) && (a = t[n], this.attribute(n, a)); else y(i) && (i = i.apply()), this.options.skipNullAttributes && null == i || (this.currentNode.attributes[t] = new e(this, t, i));
                return this
            }, t.prototype.text = function (t) {
                var e;
                return this.openCurrent(), e = new S(this, t), this.onData(this.writer.text(e, this.currentLevel + 1)), this
            }, t.prototype.cdata = function (t) {
                var e;
                return this.openCurrent(), e = new n(this, t), this.onData(this.writer.cdata(e, this.currentLevel + 1)), this
            }, t.prototype.comment = function (t) {
                var e;
                return this.openCurrent(), e = new a(this, t), this.onData(this.writer.comment(e, this.currentLevel + 1)), this
            }, t.prototype.raw = function (t) {
                var e;
                return this.openCurrent(), e = new f(this, t), this.onData(this.writer.raw(e, this.currentLevel + 1)), this
            }, t.prototype.instruction = function (t, e) {
                var i, n, a, s, o;
                if (this.openCurrent(), null != t && (t = t.valueOf()), null != e && (e = e.valueOf()), Array.isArray(t)) for (i = 0, s = t.length; i < s; i++) n = t[i], this.instruction(n); else if (T(t)) for (n in t) v.call(t, n) && (a = t[n], this.instruction(n, a)); else y(e) && (e = e.apply()), o = new h(this, t, e), this.onData(this.writer.processingInstruction(o, this.currentLevel + 1));
                return this
            }, t.prototype.declaration = function (t, e, i) {
                var n;
                if (this.openCurrent(), this.documentStarted) throw new Error("declaration() must be the first node");
                return n = new u(this, t, e, i), this.onData(this.writer.declaration(n, this.currentLevel + 1)), this
            }, t.prototype.doctype = function (t, e, i) {
                if (this.openCurrent(), null == t) throw new Error("Missing root node name");
                if (this.root) throw new Error("dtd() must come before the root node");
                return this.currentNode = new c(this, e, i), this.currentNode.rootNodeName = t, this.currentNode.children = !1, this.currentLevel++, this.openTags[this.currentLevel] = this.currentNode, this
            }, t.prototype.dtdElement = function (t, e) {
                var i;
                return this.openCurrent(), i = new o(this, t, e), this.onData(this.writer.dtdElement(i, this.currentLevel + 1)), this
            }, t.prototype.attList = function (t, e, i, n, a) {
                var o;
                return this.openCurrent(), o = new s(this, t, e, i, n, a), this.onData(this.writer.dtdAttList(o, this.currentLevel + 1)), this
            }, t.prototype.entity = function (t, e) {
                var i;
                return this.openCurrent(), i = new r(this, !1, t, e), this.onData(this.writer.dtdEntity(i, this.currentLevel + 1)), this
            }, t.prototype.pEntity = function (t, e) {
                var i;
                return this.openCurrent(), i = new r(this, !0, t, e), this.onData(this.writer.dtdEntity(i, this.currentLevel + 1)), this
            }, t.prototype.notation = function (t, e) {
                var i;
                return this.openCurrent(), i = new l(this, t, e), this.onData(this.writer.dtdNotation(i, this.currentLevel + 1)), this
            }, t.prototype.up = function () {
                if (this.currentLevel < 0) throw new Error("The document node has no parent");
                return this.currentNode ? (this.currentNode.children ? this.closeNode(this.currentNode) : this.openNode(this.currentNode), this.currentNode = null) : this.closeNode(this.openTags[this.currentLevel]), delete this.openTags[this.currentLevel], this.currentLevel--, this
            }, t.prototype.end = function () {
                for (; this.currentLevel >= 0;) this.up();
                return this.onEnd()
            }, t.prototype.openCurrent = function () {
                if (this.currentNode) return this.currentNode.children = !0, this.openNode(this.currentNode)
            }, t.prototype.openNode = function (t) {
                if (!t.isOpen) return !this.root && 0 === this.currentLevel && t instanceof d && (this.root = t), this.onData(this.writer.openNode(t, this.currentLevel)), t.isOpen = !0
            }, t.prototype.closeNode = function (t) {
                if (!t.isClosed) return this.onData(this.writer.closeNode(t, this.currentLevel)), t.isClosed = !0
            }, t.prototype.onData = function (t) {
                return this.documentStarted = !0, this.onDataCallback(t)
            }, t.prototype.onEnd = function () {
                return this.documentCompleted = !0, this.onEndCallback()
            }, t.prototype.ele = function () {
                return this.element.apply(this, arguments)
            }, t.prototype.nod = function (t, e, i) {
                return this.node(t, e, i)
            }, t.prototype.txt = function (t) {
                return this.text(t)
            }, t.prototype.dat = function (t) {
                return this.cdata(t)
            }, t.prototype.com = function (t) {
                return this.comment(t)
            }, t.prototype.ins = function (t, e) {
                return this.instruction(t, e)
            }, t.prototype.dec = function (t, e, i) {
                return this.declaration(t, e, i)
            }, t.prototype.dtd = function (t, e, i) {
                return this.doctype(t, e, i)
            }, t.prototype.e = function (t, e, i) {
                return this.element(t, e, i)
            }, t.prototype.n = function (t, e, i) {
                return this.node(t, e, i)
            }, t.prototype.t = function (t) {
                return this.text(t)
            }, t.prototype.d = function (t) {
                return this.cdata(t)
            }, t.prototype.c = function (t) {
                return this.comment(t)
            }, t.prototype.r = function (t) {
                return this.raw(t)
            }, t.prototype.i = function (t, e) {
                return this.instruction(t, e)
            }, t.prototype.att = function () {
                return this.currentNode && this.currentNode instanceof c ? this.attList.apply(this, arguments) : this.attribute.apply(this, arguments)
            }, t.prototype.a = function () {
                return this.currentNode && this.currentNode instanceof c ? this.attList.apply(this, arguments) : this.attribute.apply(this, arguments)
            }, t.prototype.ent = function (t, e) {
                return this.entity(t, e)
            }, t.prototype.pent = function (t, e) {
                return this.pEntity(t, e)
            }, t.prototype.not = function (t, e) {
                return this.notation(t, e)
            }, t
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        var e, n, a, s, o, r, l, u, c, d, h, f, p, g = {}.hasOwnProperty;
        l = i(98), u = i(99), e = i(96), n = i(97), c = i(95), h = i(104), f = i(105), d = i(106), a = i(100), s = i(102), o = i(101), r = i(103), p = i(201), t.exports = function (t) {
            function i(t, e) {
                i.__super__.constructor.call(this, e), this.stream = t
            }

            return function (t, e) {
                for (var i in e) g.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(i, p), i.prototype.document = function (t) {
                var e, i, a, s, o, r, c, h;
                for (i = 0, s = (r = t.children).length; i < s; i++) (e = r[i]).isLastRootNode = !1;
                for (t.children[t.children.length - 1].isLastRootNode = !0, h = [], a = 0, o = (c = t.children).length; a < o; a++) switch (e = c[a], !1) {
                    case!(e instanceof l):
                        h.push(this.declaration(e));
                        break;
                    case!(e instanceof u):
                        h.push(this.docType(e));
                        break;
                    case!(e instanceof n):
                        h.push(this.comment(e));
                        break;
                    case!(e instanceof d):
                        h.push(this.processingInstruction(e));
                        break;
                    default:
                        h.push(this.element(e))
                }
                return h
            }, i.prototype.attribute = function (t) {
                return this.stream.write(" " + t.name + '="' + t.value + '"')
            }, i.prototype.cdata = function (t, e) {
                return this.stream.write(this.space(e) + "<![CDATA[" + t.text + "]]>" + this.endline(t))
            }, i.prototype.comment = function (t, e) {
                return this.stream.write(this.space(e) + "\x3c!-- " + t.text + " --\x3e" + this.endline(t))
            }, i.prototype.declaration = function (t, e) {
                return this.stream.write(this.space(e)), this.stream.write('<?xml version="' + t.version + '"'), null != t.encoding && this.stream.write(' encoding="' + t.encoding + '"'), null != t.standalone && this.stream.write(' standalone="' + t.standalone + '"'), this.stream.write(this.spacebeforeslash + "?>"), this.stream.write(this.endline(t))
            }, i.prototype.docType = function (t, i) {
                var l, u, c, h;
                if (i || (i = 0), this.stream.write(this.space(i)), this.stream.write("<!DOCTYPE " + t.root().name), t.pubID && t.sysID ? this.stream.write(' PUBLIC "' + t.pubID + '" "' + t.sysID + '"') : t.sysID && this.stream.write(' SYSTEM "' + t.sysID + '"'), t.children.length > 0) {
                    for (this.stream.write(" ["), this.stream.write(this.endline(t)), u = 0, c = (h = t.children).length; u < c; u++) switch (l = h[u], !1) {
                        case!(l instanceof a):
                            this.dtdAttList(l, i + 1);
                            break;
                        case!(l instanceof s):
                            this.dtdElement(l, i + 1);
                            break;
                        case!(l instanceof o):
                            this.dtdEntity(l, i + 1);
                            break;
                        case!(l instanceof r):
                            this.dtdNotation(l, i + 1);
                            break;
                        case!(l instanceof e):
                            this.cdata(l, i + 1);
                            break;
                        case!(l instanceof n):
                            this.comment(l, i + 1);
                            break;
                        case!(l instanceof d):
                            this.processingInstruction(l, i + 1);
                            break;
                        default:
                            throw new Error("Unknown DTD node type: " + l.constructor.name)
                    }
                    this.stream.write("]")
                }
                return this.stream.write(this.spacebeforeslash + ">"), this.stream.write(this.endline(t))
            }, i.prototype.element = function (t, i) {
                var a, s, o, r, l, u, p, S;
                for (l in i || (i = 0), S = this.space(i), this.stream.write(S + "<" + t.name), u = t.attributes) g.call(u, l) && (a = u[l], this.attribute(a));
                if (0 === t.children.length || t.children.every(function (t) {
                    return "" === t.value
                })) this.allowEmpty ? this.stream.write("></" + t.name + ">") : this.stream.write(this.spacebeforeslash + "/>"); else if (this.pretty && 1 === t.children.length && null != t.children[0].value) this.stream.write(">"), this.stream.write(t.children[0].value), this.stream.write("</" + t.name + ">"); else {
                    for (this.stream.write(">" + this.newline), o = 0, r = (p = t.children).length; o < r; o++) switch (s = p[o], !1) {
                        case!(s instanceof e):
                            this.cdata(s, i + 1);
                            break;
                        case!(s instanceof n):
                            this.comment(s, i + 1);
                            break;
                        case!(s instanceof c):
                            this.element(s, i + 1);
                            break;
                        case!(s instanceof h):
                            this.raw(s, i + 1);
                            break;
                        case!(s instanceof f):
                            this.text(s, i + 1);
                            break;
                        case!(s instanceof d):
                            this.processingInstruction(s, i + 1);
                            break;
                        default:
                            throw new Error("Unknown XML node type: " + s.constructor.name)
                    }
                    this.stream.write(S + "</" + t.name + ">")
                }
                return this.stream.write(this.endline(t))
            }, i.prototype.processingInstruction = function (t, e) {
                return this.stream.write(this.space(e) + "<?" + t.target), t.value && this.stream.write(" " + t.value), this.stream.write(this.spacebeforeslash + "?>" + this.endline(t))
            }, i.prototype.raw = function (t, e) {
                return this.stream.write(this.space(e) + t.value + this.endline(t))
            }, i.prototype.text = function (t, e) {
                return this.stream.write(this.space(e) + t.value + this.endline(t))
            }, i.prototype.dtdAttList = function (t, e) {
                return this.stream.write(this.space(e) + "<!ATTLIST " + t.elementName + " " + t.attributeName + " " + t.attributeType), "#DEFAULT" !== t.defaultValueType && this.stream.write(" " + t.defaultValueType), t.defaultValue && this.stream.write(' "' + t.defaultValue + '"'), this.stream.write(this.spacebeforeslash + ">" + this.endline(t))
            }, i.prototype.dtdElement = function (t, e) {
                return this.stream.write(this.space(e) + "<!ELEMENT " + t.name + " " + t.value), this.stream.write(this.spacebeforeslash + ">" + this.endline(t))
            }, i.prototype.dtdEntity = function (t, e) {
                return this.stream.write(this.space(e) + "<!ENTITY"), t.pe && this.stream.write(" %"), this.stream.write(" " + t.name), t.value ? this.stream.write(' "' + t.value + '"') : (t.pubID && t.sysID ? this.stream.write(' PUBLIC "' + t.pubID + '" "' + t.sysID + '"') : t.sysID && this.stream.write(' SYSTEM "' + t.sysID + '"'), t.nData && this.stream.write(" NDATA " + t.nData)), this.stream.write(this.spacebeforeslash + ">" + this.endline(t))
            }, i.prototype.dtdNotation = function (t, e) {
                return this.stream.write(this.space(e) + "<!NOTATION " + t.name), t.pubID && t.sysID ? this.stream.write(' PUBLIC "' + t.pubID + '" "' + t.sysID + '"') : t.pubID ? this.stream.write(' PUBLIC "' + t.pubID + '"') : t.sysID && this.stream.write(' SYSTEM "' + t.sysID + '"'), this.stream.write(this.spacebeforeslash + ">" + this.endline(t))
            }, i.prototype.endline = function (t) {
                return t.isLastRootNode ? "" : this.newline
            }, i
        }()
    }).call(this)
}, function (t, e, i) {
    (function () {
        "use strict";
        var t, n, a, s, o, r, l, u, c = function (t, e) {
            return function () {
                return t.apply(e, arguments)
            }
        }, d = {}.hasOwnProperty;
        l = i(252), a = i(9), t = i(254), r = i(202), u = i(255).setImmediate, n = i(165).defaults, s = function (t) {
            return "object" == typeof t && null != t && 0 === Object.keys(t).length
        }, o = function (t, e, i) {
            var n, a;
            for (n = 0, a = t.length; n < a; n++) e = (0, t[n])(e, i);
            return e
        }, e.Parser = function (i) {
            function h(t) {
                var i, a, s;
                if (this.parseString = c(this.parseString, this), this.reset = c(this.reset, this), this.assignOrPush = c(this.assignOrPush, this), this.processAsync = c(this.processAsync, this), !(this instanceof e.Parser)) return new e.Parser(t);
                for (i in this.options = {}, a = n[.2]) d.call(a, i) && (s = a[i], this.options[i] = s);
                for (i in t) d.call(t, i) && (s = t[i], this.options[i] = s);
                this.options.xmlns && (this.options.xmlnskey = this.options.attrkey + "ns"), this.options.normalizeTags && (this.options.tagNameProcessors || (this.options.tagNameProcessors = []), this.options.tagNameProcessors.unshift(r.normalize)), this.reset()
            }

            return function (t, e) {
                for (var i in e) d.call(e, i) && (t[i] = e[i]);

                function n() {
                    this.constructor = t
                }

                n.prototype = e.prototype, t.prototype = new n, t.__super__ = e.prototype
            }(h, a.EventEmitter), h.prototype.processAsync = function () {
                var t, e;
                try {
                    return this.remaining.length <= this.options.chunkSize ? (t = this.remaining, this.remaining = "", this.saxParser = this.saxParser.write(t), this.saxParser.close()) : (t = this.remaining.substr(0, this.options.chunkSize), this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length), this.saxParser = this.saxParser.write(t), u(this.processAsync))
                } catch (t) {
                    if (e = t, !this.saxParser.errThrown) return this.saxParser.errThrown = !0, this.emit(e)
                }
            }, h.prototype.assignOrPush = function (t, e, i) {
                return e in t ? (t[e] instanceof Array || (t[e] = [t[e]]), t[e].push(i)) : this.options.explicitArray ? t[e] = [i] : t[e] = i
            }, h.prototype.reset = function () {
                var t, e, i, n, a;
                return this.removeAllListeners(), this.saxParser = l.parser(this.options.strict, {
                    trim: !1,
                    normalize: !1,
                    xmlns: this.options.xmlns
                }), this.saxParser.errThrown = !1, this.saxParser.onerror = (a = this, function (t) {
                    if (a.saxParser.resume(), !a.saxParser.errThrown) return a.saxParser.errThrown = !0, a.emit("error", t)
                }), this.saxParser.onend = function (t) {
                    return function () {
                        if (!t.saxParser.ended) return t.saxParser.ended = !0, t.emit("end", t.resultObject)
                    }
                }(this), this.saxParser.ended = !1, this.EXPLICIT_CHARKEY = this.options.explicitCharkey, this.resultObject = null, n = [], t = this.options.attrkey, e = this.options.charkey, this.saxParser.onopentag = function (i) {
                    return function (a) {
                        var s, r, l, u, c;
                        if ((l = {})[e] = "", !i.options.ignoreAttrs) for (s in c = a.attributes) d.call(c, s) && (t in l || i.options.mergeAttrs || (l[t] = {}), r = i.options.attrValueProcessors ? o(i.options.attrValueProcessors, a.attributes[s], s) : a.attributes[s], u = i.options.attrNameProcessors ? o(i.options.attrNameProcessors, s) : s, i.options.mergeAttrs ? i.assignOrPush(l, u, r) : l[t][u] = r);
                        return l["#name"] = i.options.tagNameProcessors ? o(i.options.tagNameProcessors, a.name) : a.name, i.options.xmlns && (l[i.options.xmlnskey] = {
                            uri: a.uri,
                            local: a.local
                        }), n.push(l)
                    }
                }(this), this.saxParser.onclosetag = function (t) {
                    return function () {
                        var i, a, r, l, u, c, h, f, p, g;
                        if (c = n.pop(), u = c["#name"], t.options.explicitChildren && t.options.preserveChildrenOrder || delete c["#name"], !0 === c.cdata && (i = c.cdata, delete c.cdata), p = n[n.length - 1], c[e].match(/^\s*$/) && !i ? (a = c[e], delete c[e]) : (t.options.trim && (c[e] = c[e].trim()), t.options.normalize && (c[e] = c[e].replace(/\s{2,}/g, " ").trim()), c[e] = t.options.valueProcessors ? o(t.options.valueProcessors, c[e], u) : c[e], 1 === Object.keys(c).length && e in c && !t.EXPLICIT_CHARKEY && (c = c[e])), s(c) && (c = "" !== t.options.emptyTag ? t.options.emptyTag : a), null != t.options.validator && (g = "/" + function () {
                            var t, e, i;
                            for (i = [], t = 0, e = n.length; t < e; t++) l = n[t], i.push(l["#name"]);
                            return i
                        }().concat(u).join("/"), function () {
                            var e;
                            try {
                                c = t.options.validator(g, p && p[u], c)
                            } catch (i) {
                                return e = i, t.emit("error", e)
                            }
                        }()), t.options.explicitChildren && !t.options.mergeAttrs && "object" == typeof c) if (t.options.preserveChildrenOrder) {
                            if (p) {
                                for (r in p[t.options.childkey] = p[t.options.childkey] || [], h = {}, c) d.call(c, r) && (h[r] = c[r]);
                                p[t.options.childkey].push(h), delete c["#name"], 1 === Object.keys(c).length && e in c && !t.EXPLICIT_CHARKEY && (c = c[e])
                            }
                        } else l = {}, t.options.attrkey in c && (l[t.options.attrkey] = c[t.options.attrkey], delete c[t.options.attrkey]), !t.options.charsAsChildren && t.options.charkey in c && (l[t.options.charkey] = c[t.options.charkey], delete c[t.options.charkey]), Object.getOwnPropertyNames(c).length > 0 && (l[t.options.childkey] = c), c = l;
                        return n.length > 0 ? t.assignOrPush(p, u, c) : (t.options.explicitRoot && (f = c, (c = {})[u] = f), t.resultObject = c, t.saxParser.ended = !0, t.emit("end", t.resultObject))
                    }
                }(this), i = function (t) {
                    return function (i) {
                        var a, s;
                        if (s = n[n.length - 1]) return s[e] += i, t.options.explicitChildren && t.options.preserveChildrenOrder && t.options.charsAsChildren && (t.options.includeWhiteChars || "" !== i.replace(/\\n/g, "").trim()) && (s[t.options.childkey] = s[t.options.childkey] || [], (a = {"#name": "__text__"})[e] = i, t.options.normalize && (a[e] = a[e].replace(/\s{2,}/g, " ").trim()), s[t.options.childkey].push(a)), s
                    }
                }(this), this.saxParser.ontext = i, this.saxParser.oncdata = function (t) {
                    var e;
                    if (e = i(t)) return e.cdata = !0
                }
            }, h.prototype.parseString = function (e, i) {
                var n;
                null != i && "function" == typeof i && (this.on("end", function (t) {
                    return this.reset(), i(null, t)
                }), this.on("error", function (t) {
                    return this.reset(), i(t)
                }));
                try {
                    return "" === (e = e.toString()).trim() ? (this.emit("end", null), !0) : (e = t.stripBOM(e), this.options.async ? (this.remaining = e, u(this.processAsync), this.saxParser) : this.saxParser.write(e).close())
                } catch (t) {
                    if (n = t, !this.saxParser.errThrown && !this.saxParser.ended) return this.emit("error", n), this.saxParser.errThrown = !0;
                    if (this.saxParser.ended) throw n
                }
            }, h
        }(), e.parseString = function (t, i, n) {
            var a, s;
            return null != n ? ("function" == typeof n && (a = n), "object" == typeof i && (s = i)) : ("function" == typeof i && (a = i), s = {}), new e.Parser(s).parseString(t, a)
        }
    }).call(this)
}, function (t, e, i) {
    !function (t) {
        t.parser = function (t, e) {
            return new a(t, e)
        }, t.SAXParser = a, t.SAXStream = o, t.createStream = function (t, e) {
            return new o(t, e)
        }, t.MAX_BUFFER_LENGTH = 65536;
        var e,
            n = ["comment", "sgmlDecl", "textNode", "tagName", "doctype", "procInstName", "procInstBody", "entity", "attribName", "attribValue", "cdata", "script"];

        function a(e, i) {
            if (!(this instanceof a)) return new a(e, i);
            !function (t) {
                for (var e = 0, i = n.length; e < i; e++) t[n[e]] = ""
            }(this), this.q = this.c = "", this.bufferCheckPosition = t.MAX_BUFFER_LENGTH, this.opt = i || {}, this.opt.lowercase = this.opt.lowercase || this.opt.lowercasetags, this.looseCase = this.opt.lowercase ? "toLowerCase" : "toUpperCase", this.tags = [], this.closed = this.closedRoot = this.sawRoot = !1, this.tag = this.error = null, this.strict = !!e, this.noscript = !(!e && !this.opt.noscript), this.state = D.BEGIN, this.strictEntities = this.opt.strictEntities, this.ENTITIES = this.strictEntities ? Object.create(t.XML_ENTITIES) : Object.create(t.ENTITIES), this.attribList = [], this.opt.xmlns && (this.ns = Object.create(d)), this.trackPosition = !1 !== this.opt.position, this.trackPosition && (this.position = this.line = this.column = 0), N(this, "onready")
        }

        t.EVENTS = ["text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "opentagstart", "attribute", "opentag", "closetag", "opencdata", "cdata", "closecdata", "error", "end", "ready", "script", "opennamespace", "closenamespace"], Object.create || (Object.create = function (t) {
            function e() {
            }

            return e.prototype = t, new e
        }), Object.keys || (Object.keys = function (t) {
            var e = [];
            for (var i in t) t.hasOwnProperty(i) && e.push(i);
            return e
        }), a.prototype = {
            end: function () {
                B(this)
            }, write: function (e) {
                if (this.error) throw this.error;
                if (this.closed) return V(this, "Cannot write after close. Assign an onready handler.");
                if (null === e) return B(this);
                "object" == typeof e && (e = e.toString());
                var i = 0, a = "";
                for (; a = M(e, i++), this.c = a, a;) switch (this.trackPosition && (this.position++, "\n" === a ? (this.line++, this.column = 0) : this.column++), this.state) {
                    case D.BEGIN:
                        if (this.state = D.BEGIN_WHITESPACE, "\ufeff" === a) continue;
                        U(this, a);
                        continue;
                    case D.BEGIN_WHITESPACE:
                        U(this, a);
                        continue;
                    case D.TEXT:
                        if (this.sawRoot && !this.closedRoot) {
                            for (var s = i - 1; a && "<" !== a && "&" !== a;) (a = M(e, i++)) && this.trackPosition && (this.position++, "\n" === a ? (this.line++, this.column = 0) : this.column++);
                            this.textNode += e.substring(s, i - 1)
                        }
                        "<" !== a || this.sawRoot && this.closedRoot && !this.strict ? (S(a) || this.sawRoot && !this.closedRoot || P(this, "Text data outside of root node."), "&" === a ? this.state = D.TEXT_ENTITY : this.textNode += a) : (this.state = D.OPEN_WAKA, this.startTagPosition = this.position);
                        continue;
                    case D.SCRIPT:
                        "<" === a ? this.state = D.SCRIPT_ENDING : this.script += a;
                        continue;
                    case D.SCRIPT_ENDING:
                        "/" === a ? this.state = D.CLOSE_TAG : (this.script += "<" + a, this.state = D.SCRIPT);
                        continue;
                    case D.OPEN_WAKA:
                        if ("!" === a) this.state = D.SGML_DECL, this.sgmlDecl = ""; else if (S(a)) ; else if (k(h, a)) this.state = D.OPEN_TAG, this.tagName = a; else if ("/" === a) this.state = D.CLOSE_TAG, this.tagName = ""; else if ("?" === a) this.state = D.PROC_INST, this.procInstName = this.procInstBody = ""; else {
                            if (P(this, "Unencoded <"), this.startTagPosition + 1 < this.position) {
                                var o = this.position - this.startTagPosition;
                                a = new Array(o).join(" ") + a
                            }
                            this.textNode += "<" + a, this.state = D.TEXT
                        }
                        continue;
                    case D.SGML_DECL:
                        (this.sgmlDecl + a).toUpperCase() === r ? (C(this, "onopencdata"), this.state = D.CDATA, this.sgmlDecl = "", this.cdata = "") : this.sgmlDecl + a === "--" ? (this.state = D.COMMENT, this.comment = "", this.sgmlDecl = "") : (this.sgmlDecl + a).toUpperCase() === l ? (this.state = D.DOCTYPE, (this.doctype || this.sawRoot) && P(this, "Inappropriately located doctype declaration"), this.doctype = "", this.sgmlDecl = "") : ">" === a ? (C(this, "onsgmldeclaration", this.sgmlDecl), this.sgmlDecl = "", this.state = D.TEXT) : y(a) ? (this.state = D.SGML_DECL_QUOTED, this.sgmlDecl += a) : this.sgmlDecl += a;
                        continue;
                    case D.SGML_DECL_QUOTED:
                        a === this.q && (this.state = D.SGML_DECL, this.q = ""), this.sgmlDecl += a;
                        continue;
                    case D.DOCTYPE:
                        ">" === a ? (this.state = D.TEXT, C(this, "ondoctype", this.doctype), this.doctype = !0) : (this.doctype += a, "[" === a ? this.state = D.DOCTYPE_DTD : y(a) && (this.state = D.DOCTYPE_QUOTED, this.q = a));
                        continue;
                    case D.DOCTYPE_QUOTED:
                        this.doctype += a, a === this.q && (this.q = "", this.state = D.DOCTYPE);
                        continue;
                    case D.DOCTYPE_DTD:
                        this.doctype += a, "]" === a ? this.state = D.DOCTYPE : y(a) && (this.state = D.DOCTYPE_DTD_QUOTED, this.q = a);
                        continue;
                    case D.DOCTYPE_DTD_QUOTED:
                        this.doctype += a, a === this.q && (this.state = D.DOCTYPE_DTD, this.q = "");
                        continue;
                    case D.COMMENT:
                        "-" === a ? this.state = D.COMMENT_ENDING : this.comment += a;
                        continue;
                    case D.COMMENT_ENDING:
                        "-" === a ? (this.state = D.COMMENT_ENDED, this.comment = I(this.opt, this.comment), this.comment && C(this, "oncomment", this.comment), this.comment = "") : (this.comment += "-" + a, this.state = D.COMMENT);
                        continue;
                    case D.COMMENT_ENDED:
                        ">" !== a ? (P(this, "Malformed comment"), this.comment += "--" + a, this.state = D.COMMENT) : this.state = D.TEXT;
                        continue;
                    case D.CDATA:
                        "]" === a ? this.state = D.CDATA_ENDING : this.cdata += a;
                        continue;
                    case D.CDATA_ENDING:
                        "]" === a ? this.state = D.CDATA_ENDING_2 : (this.cdata += "]" + a, this.state = D.CDATA);
                        continue;
                    case D.CDATA_ENDING_2:
                        ">" === a ? (this.cdata && C(this, "oncdata", this.cdata), C(this, "onclosecdata"), this.cdata = "", this.state = D.TEXT) : "]" === a ? this.cdata += "]" : (this.cdata += "]]" + a, this.state = D.CDATA);
                        continue;
                    case D.PROC_INST:
                        "?" === a ? this.state = D.PROC_INST_ENDING : S(a) ? this.state = D.PROC_INST_BODY : this.procInstName += a;
                        continue;
                    case D.PROC_INST_BODY:
                        if (!this.procInstBody && S(a)) continue;
                        "?" === a ? this.state = D.PROC_INST_ENDING : this.procInstBody += a;
                        continue;
                    case D.PROC_INST_ENDING:
                        ">" === a ? (C(this, "onprocessinginstruction", {
                            name: this.procInstName,
                            body: this.procInstBody
                        }), this.procInstName = this.procInstBody = "", this.state = D.TEXT) : (this.procInstBody += "?" + a, this.state = D.PROC_INST_BODY);
                        continue;
                    case D.OPEN_TAG:
                        k(f, a) ? this.tagName += a : (E(this), ">" === a ? A(this) : "/" === a ? this.state = D.OPEN_TAG_SLASH : (S(a) || P(this, "Invalid character in tag name"), this.state = D.ATTRIB));
                        continue;
                    case D.OPEN_TAG_SLASH:
                        ">" === a ? (A(this, !0), R(this)) : (P(this, "Forward-slash in opening tag not followed by >"), this.state = D.ATTRIB);
                        continue;
                    case D.ATTRIB:
                        if (S(a)) continue;
                        ">" === a ? A(this) : "/" === a ? this.state = D.OPEN_TAG_SLASH : k(h, a) ? (this.attribName = a, this.attribValue = "", this.state = D.ATTRIB_NAME) : P(this, "Invalid attribute name");
                        continue;
                    case D.ATTRIB_NAME:
                        "=" === a ? this.state = D.ATTRIB_VALUE : ">" === a ? (P(this, "Attribute without value"), this.attribValue = this.attribName, F(this), A(this)) : S(a) ? this.state = D.ATTRIB_NAME_SAW_WHITE : k(f, a) ? this.attribName += a : P(this, "Invalid attribute name");
                        continue;
                    case D.ATTRIB_NAME_SAW_WHITE:
                        if ("=" === a) this.state = D.ATTRIB_VALUE; else {
                            if (S(a)) continue;
                            P(this, "Attribute without value"), this.tag.attributes[this.attribName] = "", this.attribValue = "", C(this, "onattribute", {
                                name: this.attribName,
                                value: ""
                            }), this.attribName = "", ">" === a ? A(this) : k(h, a) ? (this.attribName = a, this.state = D.ATTRIB_NAME) : (P(this, "Invalid attribute name"), this.state = D.ATTRIB)
                        }
                        continue;
                    case D.ATTRIB_VALUE:
                        if (S(a)) continue;
                        y(a) ? (this.q = a, this.state = D.ATTRIB_VALUE_QUOTED) : (P(this, "Unquoted attribute value"), this.state = D.ATTRIB_VALUE_UNQUOTED, this.attribValue = a);
                        continue;
                    case D.ATTRIB_VALUE_QUOTED:
                        if (a !== this.q) {
                            "&" === a ? this.state = D.ATTRIB_VALUE_ENTITY_Q : this.attribValue += a;
                            continue
                        }
                        F(this), this.q = "", this.state = D.ATTRIB_VALUE_CLOSED;
                        continue;
                    case D.ATTRIB_VALUE_CLOSED:
                        S(a) ? this.state = D.ATTRIB : ">" === a ? A(this) : "/" === a ? this.state = D.OPEN_TAG_SLASH : k(h, a) ? (P(this, "No whitespace between attributes"), this.attribName = a, this.attribValue = "", this.state = D.ATTRIB_NAME) : P(this, "Invalid attribute name");
                        continue;
                    case D.ATTRIB_VALUE_UNQUOTED:
                        if (!T(a)) {
                            "&" === a ? this.state = D.ATTRIB_VALUE_ENTITY_U : this.attribValue += a;
                            continue
                        }
                        F(this), ">" === a ? A(this) : this.state = D.ATTRIB;
                        continue;
                    case D.CLOSE_TAG:
                        if (this.tagName) ">" === a ? R(this) : k(f, a) ? this.tagName += a : this.script ? (this.script += "</" + this.tagName, this.tagName = "", this.state = D.SCRIPT) : (S(a) || P(this, "Invalid tagname in closing tag"), this.state = D.CLOSE_TAG_SAW_WHITE); else {
                            if (S(a)) continue;
                            m(h, a) ? this.script ? (this.script += "</" + a, this.state = D.SCRIPT) : P(this, "Invalid tagname in closing tag.") : this.tagName = a
                        }
                        continue;
                    case D.CLOSE_TAG_SAW_WHITE:
                        if (S(a)) continue;
                        ">" === a ? R(this) : P(this, "Invalid characters in closing tag");
                        continue;
                    case D.TEXT_ENTITY:
                    case D.ATTRIB_VALUE_ENTITY_Q:
                    case D.ATTRIB_VALUE_ENTITY_U:
                        var u, c;
                        switch (this.state) {
                            case D.TEXT_ENTITY:
                                u = D.TEXT, c = "textNode";
                                break;
                            case D.ATTRIB_VALUE_ENTITY_Q:
                                u = D.ATTRIB_VALUE_QUOTED, c = "attribValue";
                                break;
                            case D.ATTRIB_VALUE_ENTITY_U:
                                u = D.ATTRIB_VALUE_UNQUOTED, c = "attribValue"
                        }
                        ";" === a ? (this[c] += L(this), this.entity = "", this.state = u) : k(this.entity.length ? g : p, a) ? this.entity += a : (P(this, "Invalid character in entity name"), this[c] += "&" + this.entity + a, this.entity = "", this.state = u);
                        continue;
                    default:
                        throw new Error(this, "Unknown state: " + this.state)
                }
                this.position >= this.bufferCheckPosition && function (e) {
                    for (var i = Math.max(t.MAX_BUFFER_LENGTH, 10), a = 0, s = 0, o = n.length; s < o; s++) {
                        var r = e[n[s]].length;
                        if (r > i) switch (n[s]) {
                            case"textNode":
                                x(e);
                                break;
                            case"cdata":
                                C(e, "oncdata", e.cdata), e.cdata = "";
                                break;
                            case"script":
                                C(e, "onscript", e.script), e.script = "";
                                break;
                            default:
                                V(e, "Max buffer length exceeded: " + n[s])
                        }
                        a = Math.max(a, r)
                    }
                    var l = t.MAX_BUFFER_LENGTH - a;
                    e.bufferCheckPosition = l + e.position
                }(this);
                return this
            }
            /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */, resume: function () {
                return this.error = null, this
            }, close: function () {
                return this.write(null)
            }, flush: function () {
                var t;
                x(t = this), "" !== t.cdata && (C(t, "oncdata", t.cdata), t.cdata = ""), "" !== t.script && (C(t, "onscript", t.script), t.script = "")
            }
        };
        try {
            e = i(253).Stream
        } catch (t) {
            e = function () {
            }
        }
        var s = t.EVENTS.filter(function (t) {
            return "error" !== t && "end" !== t
        });

        function o(t, i) {
            if (!(this instanceof o)) return new o(t, i);
            e.apply(this), this._parser = new a(t, i), this.writable = !0, this.readable = !0;
            var n = this;
            this._parser.onend = function () {
                n.emit("end")
            }, this._parser.onerror = function (t) {
                n.emit("error", t), n._parser.error = null
            }, this._decoder = null, s.forEach(function (t) {
                Object.defineProperty(n, "on" + t, {
                    get: function () {
                        return n._parser["on" + t]
                    }, set: function (e) {
                        if (!e) return n.removeAllListeners(t), n._parser["on" + t] = e, e;
                        n.on(t, e)
                    }, enumerable: !0, configurable: !1
                })
            })
        }

        o.prototype = Object.create(e.prototype, {constructor: {value: o}}), o.prototype.write = function (t) {
            if ("function" == typeof Buffer && "function" == typeof Buffer.isBuffer && Buffer.isBuffer(t)) {
                if (!this._decoder) {
                    var e = i(51).StringDecoder;
                    this._decoder = new e("utf8")
                }
                t = this._decoder.write(t)
            }
            return this._parser.write(t.toString()), this.emit("data", t), !0
        }, o.prototype.end = function (t) {
            return t && t.length && this.write(t), this._parser.end(), !0
        }, o.prototype.on = function (t, i) {
            var n = this;
            return n._parser["on" + t] || -1 === s.indexOf(t) || (n._parser["on" + t] = function () {
                var e = 1 === arguments.length ? [arguments[0]] : Array.apply(null, arguments);
                e.splice(0, 0, t), n.emit.apply(n, e)
            }), e.prototype.on.call(n, t, i)
        };
        var r = "[CDATA[", l = "DOCTYPE", u = "http://www.w3.org/XML/1998/namespace",
            c = "http://www.w3.org/2000/xmlns/", d = {xml: u, xmlns: c},
            h = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,
            f = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,
            p = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,
            g = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;

        function S(t) {
            return " " === t || "\n" === t || "\r" === t || "\t" === t
        }

        function y(t) {
            return '"' === t || "'" === t
        }

        function T(t) {
            return ">" === t || S(t)
        }

        function k(t, e) {
            return t.test(e)
        }

        function m(t, e) {
            return !k(t, e)
        }

        var v, w, _, D = 0;
        for (var b in t.STATE = {
            BEGIN: D++,
            BEGIN_WHITESPACE: D++,
            TEXT: D++,
            TEXT_ENTITY: D++,
            OPEN_WAKA: D++,
            SGML_DECL: D++,
            SGML_DECL_QUOTED: D++,
            DOCTYPE: D++,
            DOCTYPE_QUOTED: D++,
            DOCTYPE_DTD: D++,
            DOCTYPE_DTD_QUOTED: D++,
            COMMENT_STARTING: D++,
            COMMENT: D++,
            COMMENT_ENDING: D++,
            COMMENT_ENDED: D++,
            CDATA: D++,
            CDATA_ENDING: D++,
            CDATA_ENDING_2: D++,
            PROC_INST: D++,
            PROC_INST_BODY: D++,
            PROC_INST_ENDING: D++,
            OPEN_TAG: D++,
            OPEN_TAG_SLASH: D++,
            ATTRIB: D++,
            ATTRIB_NAME: D++,
            ATTRIB_NAME_SAW_WHITE: D++,
            ATTRIB_VALUE: D++,
            ATTRIB_VALUE_QUOTED: D++,
            ATTRIB_VALUE_CLOSED: D++,
            ATTRIB_VALUE_UNQUOTED: D++,
            ATTRIB_VALUE_ENTITY_Q: D++,
            ATTRIB_VALUE_ENTITY_U: D++,
            CLOSE_TAG: D++,
            CLOSE_TAG_SAW_WHITE: D++,
            SCRIPT: D++,
            SCRIPT_ENDING: D++
        }, t.XML_ENTITIES = {amp: "&", gt: ">", lt: "<", quot: '"', apos: "'"}, t.ENTITIES = {
            amp: "&",
            gt: ">",
            lt: "<",
            quot: '"',
            apos: "'",
            AElig: 198,
            Aacute: 193,
            Acirc: 194,
            Agrave: 192,
            Aring: 197,
            Atilde: 195,
            Auml: 196,
            Ccedil: 199,
            ETH: 208,
            Eacute: 201,
            Ecirc: 202,
            Egrave: 200,
            Euml: 203,
            Iacute: 205,
            Icirc: 206,
            Igrave: 204,
            Iuml: 207,
            Ntilde: 209,
            Oacute: 211,
            Ocirc: 212,
            Ograve: 210,
            Oslash: 216,
            Otilde: 213,
            Ouml: 214,
            THORN: 222,
            Uacute: 218,
            Ucirc: 219,
            Ugrave: 217,
            Uuml: 220,
            Yacute: 221,
            aacute: 225,
            acirc: 226,
            aelig: 230,
            agrave: 224,
            aring: 229,
            atilde: 227,
            auml: 228,
            ccedil: 231,
            eacute: 233,
            ecirc: 234,
            egrave: 232,
            eth: 240,
            euml: 235,
            iacute: 237,
            icirc: 238,
            igrave: 236,
            iuml: 239,
            ntilde: 241,
            oacute: 243,
            ocirc: 244,
            ograve: 242,
            oslash: 248,
            otilde: 245,
            ouml: 246,
            szlig: 223,
            thorn: 254,
            uacute: 250,
            ucirc: 251,
            ugrave: 249,
            uuml: 252,
            yacute: 253,
            yuml: 255,
            copy: 169,
            reg: 174,
            nbsp: 160,
            iexcl: 161,
            cent: 162,
            pound: 163,
            curren: 164,
            yen: 165,
            brvbar: 166,
            sect: 167,
            uml: 168,
            ordf: 170,
            laquo: 171,
            not: 172,
            shy: 173,
            macr: 175,
            deg: 176,
            plusmn: 177,
            sup1: 185,
            sup2: 178,
            sup3: 179,
            acute: 180,
            micro: 181,
            para: 182,
            middot: 183,
            cedil: 184,
            ordm: 186,
            raquo: 187,
            frac14: 188,
            frac12: 189,
            frac34: 190,
            iquest: 191,
            times: 215,
            divide: 247,
            OElig: 338,
            oelig: 339,
            Scaron: 352,
            scaron: 353,
            Yuml: 376,
            fnof: 402,
            circ: 710,
            tilde: 732,
            Alpha: 913,
            Beta: 914,
            Gamma: 915,
            Delta: 916,
            Epsilon: 917,
            Zeta: 918,
            Eta: 919,
            Theta: 920,
            Iota: 921,
            Kappa: 922,
            Lambda: 923,
            Mu: 924,
            Nu: 925,
            Xi: 926,
            Omicron: 927,
            Pi: 928,
            Rho: 929,
            Sigma: 931,
            Tau: 932,
            Upsilon: 933,
            Phi: 934,
            Chi: 935,
            Psi: 936,
            Omega: 937,
            alpha: 945,
            beta: 946,
            gamma: 947,
            delta: 948,
            epsilon: 949,
            zeta: 950,
            eta: 951,
            theta: 952,
            iota: 953,
            kappa: 954,
            lambda: 955,
            mu: 956,
            nu: 957,
            xi: 958,
            omicron: 959,
            pi: 960,
            rho: 961,
            sigmaf: 962,
            sigma: 963,
            tau: 964,
            upsilon: 965,
            phi: 966,
            chi: 967,
            psi: 968,
            omega: 969,
            thetasym: 977,
            upsih: 978,
            piv: 982,
            ensp: 8194,
            emsp: 8195,
            thinsp: 8201,
            zwnj: 8204,
            zwj: 8205,
            lrm: 8206,
            rlm: 8207,
            ndash: 8211,
            mdash: 8212,
            lsquo: 8216,
            rsquo: 8217,
            sbquo: 8218,
            ldquo: 8220,
            rdquo: 8221,
            bdquo: 8222,
            dagger: 8224,
            Dagger: 8225,
            bull: 8226,
            hellip: 8230,
            permil: 8240,
            prime: 8242,
            Prime: 8243,
            lsaquo: 8249,
            rsaquo: 8250,
            oline: 8254,
            frasl: 8260,
            euro: 8364,
            image: 8465,
            weierp: 8472,
            real: 8476,
            trade: 8482,
            alefsym: 8501,
            larr: 8592,
            uarr: 8593,
            rarr: 8594,
            darr: 8595,
            harr: 8596,
            crarr: 8629,
            lArr: 8656,
            uArr: 8657,
            rArr: 8658,
            dArr: 8659,
            hArr: 8660,
            forall: 8704,
            part: 8706,
            exist: 8707,
            empty: 8709,
            nabla: 8711,
            isin: 8712,
            notin: 8713,
            ni: 8715,
            prod: 8719,
            sum: 8721,
            minus: 8722,
            lowast: 8727,
            radic: 8730,
            prop: 8733,
            infin: 8734,
            ang: 8736,
            and: 8743,
            or: 8744,
            cap: 8745,
            cup: 8746,
            int: 8747,
            there4: 8756,
            sim: 8764,
            cong: 8773,
            asymp: 8776,
            ne: 8800,
            equiv: 8801,
            le: 8804,
            ge: 8805,
            sub: 8834,
            sup: 8835,
            nsub: 8836,
            sube: 8838,
            supe: 8839,
            oplus: 8853,
            otimes: 8855,
            perp: 8869,
            sdot: 8901,
            lceil: 8968,
            rceil: 8969,
            lfloor: 8970,
            rfloor: 8971,
            lang: 9001,
            rang: 9002,
            loz: 9674,
            spades: 9824,
            clubs: 9827,
            hearts: 9829,
            diams: 9830
        }, Object.keys(t.ENTITIES).forEach(function (e) {
            var i = t.ENTITIES[e], n = "number" == typeof i ? String.fromCharCode(i) : i;
            t.ENTITIES[e] = n
        }), t.STATE) t.STATE[t.STATE[b]] = b;

        function N(t, e, i) {
            t[e] && t[e](i)
        }

        function C(t, e, i) {
            t.textNode && x(t), N(t, e, i)
        }

        function x(t) {
            t.textNode = I(t.opt, t.textNode), t.textNode && N(t, "ontext", t.textNode), t.textNode = ""
        }

        function I(t, e) {
            return t.trim && (e = e.trim()), t.normalize && (e = e.replace(/\s+/g, " ")), e
        }

        function V(t, e) {
            return x(t), t.trackPosition && (e += "\nLine: " + t.line + "\nColumn: " + t.column + "\nChar: " + t.c), e = new Error(e), t.error = e, N(t, "onerror", e), t
        }

        function B(t) {
            return t.sawRoot && !t.closedRoot && P(t, "Unclosed root tag"), t.state !== D.BEGIN && t.state !== D.BEGIN_WHITESPACE && t.state !== D.TEXT && V(t, "Unexpected end"), x(t), t.c = "", t.closed = !0, N(t, "onend"), a.call(t, t.strict, t.opt), t
        }

        function P(t, e) {
            if ("object" != typeof t || !(t instanceof a)) throw new Error("bad call to strictFail");
            t.strict && V(t, e)
        }

        function E(t) {
            t.strict || (t.tagName = t.tagName[t.looseCase]());
            var e = t.tags[t.tags.length - 1] || t, i = t.tag = {name: t.tagName, attributes: {}};
            t.opt.xmlns && (i.ns = e.ns), t.attribList.length = 0, C(t, "onopentagstart", i)
        }

        function O(t, e) {
            var i = t.indexOf(":") < 0 ? ["", t] : t.split(":"), n = i[0], a = i[1];
            return e && "xmlns" === t && (n = "xmlns", a = ""), {prefix: n, local: a}
        }

        function F(t) {
            if (t.strict || (t.attribName = t.attribName[t.looseCase]()), -1 !== t.attribList.indexOf(t.attribName) || t.tag.attributes.hasOwnProperty(t.attribName)) t.attribName = t.attribValue = ""; else {
                if (t.opt.xmlns) {
                    var e = O(t.attribName, !0), i = e.prefix, n = e.local;
                    if ("xmlns" === i) if ("xml" === n && t.attribValue !== u) P(t, "xml: prefix must be bound to " + u + "\nActual: " + t.attribValue); else if ("xmlns" === n && t.attribValue !== c) P(t, "xmlns: prefix must be bound to " + c + "\nActual: " + t.attribValue); else {
                        var a = t.tag, s = t.tags[t.tags.length - 1] || t;
                        a.ns === s.ns && (a.ns = Object.create(s.ns)), a.ns[n] = t.attribValue
                    }
                    t.attribList.push([t.attribName, t.attribValue])
                } else t.tag.attributes[t.attribName] = t.attribValue, C(t, "onattribute", {
                    name: t.attribName,
                    value: t.attribValue
                });
                t.attribName = t.attribValue = ""
            }
        }

        function A(t, e) {
            if (t.opt.xmlns) {
                var i = t.tag, n = O(t.tagName);
                i.prefix = n.prefix, i.local = n.local, i.uri = i.ns[n.prefix] || "", i.prefix && !i.uri && (P(t, "Unbound namespace prefix: " + JSON.stringify(t.tagName)), i.uri = n.prefix);
                var a = t.tags[t.tags.length - 1] || t;
                i.ns && a.ns !== i.ns && Object.keys(i.ns).forEach(function (e) {
                    C(t, "onopennamespace", {prefix: e, uri: i.ns[e]})
                });
                for (var s = 0, o = t.attribList.length; s < o; s++) {
                    var r = t.attribList[s], l = r[0], u = r[1], c = O(l, !0), d = c.prefix, h = c.local,
                        f = "" === d ? "" : i.ns[d] || "", p = {name: l, value: u, prefix: d, local: h, uri: f};
                    d && "xmlns" !== d && !f && (P(t, "Unbound namespace prefix: " + JSON.stringify(d)), p.uri = d), t.tag.attributes[l] = p, C(t, "onattribute", p)
                }
                t.attribList.length = 0
            }
            t.tag.isSelfClosing = !!e, t.sawRoot = !0, t.tags.push(t.tag), C(t, "onopentag", t.tag), e || (t.noscript || "script" !== t.tagName.toLowerCase() ? t.state = D.TEXT : t.state = D.SCRIPT, t.tag = null, t.tagName = ""), t.attribName = t.attribValue = "", t.attribList.length = 0
        }

        function R(t) {
            if (!t.tagName) return P(t, "Weird empty close tag."), t.textNode += "</>", void (t.state = D.TEXT);
            if (t.script) {
                if ("script" !== t.tagName) return t.script += "</" + t.tagName + ">", t.tagName = "", void (t.state = D.SCRIPT);
                C(t, "onscript", t.script), t.script = ""
            }
            var e = t.tags.length, i = t.tagName;
            t.strict || (i = i[t.looseCase]());
            for (var n = i; e--;) {
                if (t.tags[e].name === n) break;
                P(t, "Unexpected close tag")
            }
            if (e < 0) return P(t, "Unmatched closing tag: " + t.tagName), t.textNode += "</" + t.tagName + ">", void (t.state = D.TEXT);
            t.tagName = i;
            for (var a = t.tags.length; a-- > e;) {
                var s = t.tag = t.tags.pop();
                t.tagName = t.tag.name, C(t, "onclosetag", t.tagName);
                var o = {};
                for (var r in s.ns) o[r] = s.ns[r];
                var l = t.tags[t.tags.length - 1] || t;
                t.opt.xmlns && s.ns !== l.ns && Object.keys(s.ns).forEach(function (e) {
                    var i = s.ns[e];
                    C(t, "onclosenamespace", {prefix: e, uri: i})
                })
            }
            0 === e && (t.closedRoot = !0), t.tagName = t.attribValue = t.attribName = "", t.attribList.length = 0, t.state = D.TEXT
        }

        function L(t) {
            var e, i = t.entity, n = i.toLowerCase(), a = "";
            return t.ENTITIES[i] ? t.ENTITIES[i] : t.ENTITIES[n] ? t.ENTITIES[n] : ("#" === (i = n).charAt(0) && ("x" === i.charAt(1) ? (i = i.slice(2), a = (e = parseInt(i, 16)).toString(16)) : (i = i.slice(1), a = (e = parseInt(i, 10)).toString(10))), i = i.replace(/^0+/, ""), isNaN(e) || a.toLowerCase() !== i ? (P(t, "Invalid character entity"), "&" + t.entity + ";") : String.fromCodePoint(e))
        }

        function U(t, e) {
            "<" === e ? (t.state = D.OPEN_WAKA, t.startTagPosition = t.position) : S(e) || (P(t, "Non-whitespace before first tag."), t.textNode = e, t.state = D.TEXT)
        }

        function M(t, e) {
            var i = "";
            return e < t.length && (i = t.charAt(e)), i
        }

        D = t.STATE, String.fromCodePoint || (v = String.fromCharCode, w = Math.floor, _ = function () {
            var t, e, i = [], n = -1, a = arguments.length;
            if (!a) return "";
            for (var s = ""; ++n < a;) {
                var o = Number(arguments[n]);
                if (!isFinite(o) || o < 0 || o > 1114111 || w(o) !== o) throw RangeError("Invalid code point: " + o);
                o <= 65535 ? i.push(o) : (t = 55296 + ((o -= 65536) >> 10), e = o % 1024 + 56320, i.push(t, e)), (n + 1 === a || i.length > 16384) && (s += v.apply(null, i), i.length = 0)
            }
            return s
        }, Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
            value: _,
            configurable: !0,
            writable: !0
        }) : String.fromCodePoint = _)
    }(e)
}, function (t, e) {
    t.exports = require("stream")
}, function (t, e) {
    (function () {
        "use strict";
        e.stripBOM = function (t) {
            return "\ufeff" === t[0] ? t.substring(1) : t
        }
    }).call(this)
}, function (t, e) {
    t.exports = require("timers")
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(16), s = i(3), o = i(1), r = i(10);
    !function (t) {
        let e = new Map;

        function i(t, i) {
            return e.get(t + i)
        }

        function l(t, i) {
            e.set(t + i, !0)
        }

        function u(t) {
            return n(this, void 0, void 0, function* () {
                let e = new Map, i = function () {
                    let t = 0;
                    s.default.isLogin && (t = 1);
                    return t
                }(), n = function () {
                    let t = 0;
                    s.default.isVip && (t = 1);
                    return t
                }(), a = function () {
                    let t = 0;
                    s.default.isSuperVip ? t = 5 : s.default.isPlatinumVip ? t = 3 : s.default.isVip && (t = 2);
                    return t
                }();
                e.set("is_login", i), e.set("is_vip", n), e.set("vip_type", a), e.set("plugin_version", o.default.pluginVersion), e.set("cpeerid", yield r.default.getTpPeerId()), e.set("task_type", "yp");
                let l = yield r.default.getTaskBaseInfo(t);
                return e.set("gcid", l ? l.gcid : ""), e.set("url", l ? l.url : ""), e
            })
        }

        t.showSpeed = function (t) {
            return n(this, void 0, void 0, function* () {
                if (i("showSpeed", t)) return;
                l("showSpeed", t);
                let e = yield u(t);
                e.set("area", "xgt");
                let n = {attribute1: "download_fast_cloud_show", extData: e};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
            })
        }, t.clickSpeed = function (t) {
            return n(this, void 0, void 0, function* () {
                let e = yield u(t);
                e.set("area", "xgt"), e.set("referfrom", "v_pc_xlx_hytq_yp_cloudadd"), e.set("aidfrom", s.default.isVip ? "dl_open_super" : "dl_open_vip");
                let i = {attribute1: "download_fast_cloud_click", extData: e};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", i).catch()
            })
        }, t.showTaskCount = function (t, e) {
            return n(this, void 0, void 0, function* () {
                if (i("showTaskCount", t)) return;
                l("showTaskCount", t);
                let n = yield u(t);
                n.set("area", "xgt"), n.set("wait_nums", e);
                let s = {attribute1: "download_sim_cloud_taks_show", extData: n};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", s).catch()
            })
        }, t.clickTaskCount = function (t, e) {
            return n(this, void 0, void 0, function* () {
                let i = yield u(t);
                i.set("area", "xgt"), i.set("wait_nums", e), i.set("referfrom", "v_pc_xl11_hytq_dl_sim_cloud_taks"), i.set("aidfrom", s.default.isVip ? "open_super" : "open_vip"), i.set("click_id", s.default.isVip ? "open_super" : "open_vip");
                let n = {attribute1: "download_sim_cloud_taks_click", extData: i};
                a.StatUtilitiesNS.trackEvent("xlx_vip_event", n).catch()
            })
        }
    }(e.CloudTaskStatNS || (e.CloudTaskStatNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(2), a = i(21), s = i(5), {isUndef: o} = s.ThunderUtil,
        r = i(0).default.getLogger("VipDownload:native-function");
    !function (t) {
        const e = new class {
            constructor() {
                this.isRegister = !1
            }

            registerNativeFunction() {
                if (!this.isRegister) {
                    this.isRegister = !0;
                    let t = {GetAllVipSubTaskInfo: this.getAllVipSubTaskInfo};
                    n.client.callServerFunction("RegisterWebExternal", t).catch()
                }
            }

            getAllVipSubTaskInfo(...t) {
                let e = null;
                do {
                    if (o(t) || o(t[0])) break;
                    let i = Number(t[0]);
                    e = a.default.getAllVipSubTaskInfo(i), r.info("GetAllVipSubTaskInfo", i, e)
                } while (0);
                return JSON.stringify(e)
            }
        };
        t.registerNativeFunction = function () {
            e.registerNativeFunction()
        }
    }(e.NativeFunctionNS || (e.NativeFunctionNS = {}))
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(167), a = i(107);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    i(267), i(268), i(269), i(270), i(271), i(272), i(273), i(274), i(275), i(276), i(277);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/app.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(170), a = i(109);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-vip-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(171), a = i(111);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-try-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(172), a = i(113);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-ad-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(173), a = i(115);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-game-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(174), a = i(117);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    i(264);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-baotuan-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    var n = i(325);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(175), a = i(119);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-packagetry-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    i.r(e);
    var n = i(176), a = i(121);
    for (var s in a) "default" !== s && function (t) {
        i.d(e, t, function () {
            return a[t]
        })
    }(s);
    var o = i(4), r = Object(o.a)(a.default, n.a, n.b, !1, null, null, null);
    r.options.__file = "src/item-vip-renderer/views/item-cloud-status.vue", e.default = r.exports
}, function (t, e, i) {
    "use strict";
    var n = i(328);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(330);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(332);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(338);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(341);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(343);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(345);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(350);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(353);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(356);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = i(358);
    i.n(n).a
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(8), o = i(14), r = i(3), l = i(148), u = i(197), c = i(30), d = i(21), h = i(50), f = i(27),
        p = i(0), g = i(91), S = i(189), y = i(5), T = i(26),
        k = p.default.getLogger("VipDownload:vip-speed-and-hover");
    var m;
    !function (t) {
        t.Vip = "Vip", t.SuperVip = "SuperVip", t.Try = "Try", t.SuperTry = "SuperTry", t.MixTry = "MixTry"
    }(m || (m = {}));
    let v = !1, w = !1, _ = null, D = new Map, b = new Map;

    function N() {
        let t = void 0, e = x(t = !v && w ? m.Vip : m.SuperVip);
        _ = {
            isShowVipSpeed: !1,
            isShowSuperSpeed: v,
            isAcclerated: v,
            isShowVipHover: !0,
            isShowSuperHover: t === m.SuperVip,
            hoverText: e.text,
            hoverType: t,
            isSensitive: !1,
            sensitive: null,
            isHuddle: !1,
            huddle: {
                imgSrc: "", title: "", onClick: () => {
                }
            },
            remindType: "none"
        }, a.client.callServerFunctionEx("SetDefaultVipSpeedStatus", _).catch()
    }

    function C(t, e) {
        return n(this, void 0, void 0, function* () {
            let i = null;
            if (e) {
                let n = function (t) {
                    let e = void 0, i = s.VipDownloadDefineNS.VipTaskStatus.Init;
                    t && (i = t.taskStatus);
                    if (i !== s.VipDownloadDefineNS.VipTaskStatus.Init) return;
                    e = t && t.taskType === s.VipDownloadDefineNS.VipTaskType.Try ? t.isMixTry ? m.MixTry : t.isSuper ? m.SuperTry : m.Try : !v && w ? m.Vip : m.SuperVip;
                    return e
                }(e), o = x(n), u = null, d = g.MessageCodeType.none, h = !1;
                if (e.isPartialForbid ? d = g.MessageCodeType.speed_partunable_code : e.error && e.error.isForbidResource && (d = g.MessageCodeType.speed_code), d !== g.MessageCodeType.none && e.error) {
                    let i = yield g.default.getMessageItem(d, e.error.result);
                    i && i.display && i.hovermessage && (h = !0, u = {
                        context: `${i.hovermessage} `,
                        link: i.url ? "查看详情>" : "",
                        onAction: () => {
                            a.client.callServerFunction("OpenNewTab", i.url).catch(), l.VipStatNS.forbidIconClick(t, d === g.MessageCodeType.speed_code ? "all" : "part")
                        }
                    })
                }
                i = {
                    isShowVipSpeed: e.isShowVipSpeed,
                    isShowSuperSpeed: e.isShowVipSpeed || e.isShowSuperSpeed || e.isShowSuperSpeedEx || r.default.isVip,
                    isAcclerated: r.default.isVip || e.isAcclerated,
                    isShowVipHover: void 0 !== n,
                    isShowSuperHover: n === m.SuperVip || n === m.SuperTry,
                    hoverText: o.text,
                    hoverType: n,
                    isSensitive: h,
                    sensitive: u,
                    isHuddle: e.packagetrying && !e.isCloudTask && !e.isPlayAndDownload || e.baotuanDetail && (e.baotuanDetail.baotuanXgt === s.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed || e.baotuanDetail.baotuanXgt === s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut || e.baotuanDetail.baotuanXgt === s.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto),
                    huddle: {
                        imgSrc: e.taskBelowSrcImg, title: e.taskBelowHoverTip, onClick: () => {
                            switch (e.xgtType) {
                                case s.VipDownloadDefineNS.XgtType.CloudDownloading:
                                case s.VipDownloadDefineNS.XgtType.CloudWaiting:
                                    break;
                                default:
                                    c.default.clickJoinBtnByCarIdentify(t).catch()
                            }
                        }
                    },
                    remindType: e.speedZeroState,
                    packagetrying: e.packagetrying
                }
            }
            if (!i || !i.isHuddle && e.enterType === s.VipDownloadDefineNS.VipTaskType.NoVip) {
                let e = S.getQrCodeStatus(t);
                e && (i.isShowVipSpeed = e.isShowVipSpeed, i.hoverText = e.hoverText)
            }
            return i
        })
    }

    function x(t) {
        let e = {};
        return t === m.Vip ? e = f.default.getItemData(f.ItemName.VipHover) : t === m.SuperVip ? e = f.default.getItemData(f.ItemName.SuperVipHover) : t === m.Try ? e = f.default.getItemData(f.ItemName.TryHover) : t === m.SuperTry ? e = f.default.getItemData(f.ItemName.SuperTryHover) : t === m.MixTry && (e = f.default.getItemData(f.ItemName.MixTryHover)), e
    }

    N(), a.client.attachServerEvent("on_task_item_hover", (t, e, i, o) => n(this, void 0, void 0, function* () {
        if (k.info("on_task_item_hover", i, e), !e) return;
        let t = d.default.getVipTaskInfo(i), n = yield C(i, t);
        if (t || (n = {
            isShowVipSpeed: !1,
            isShowSuperSpeed: r.default.isVip,
            isAcclerated: r.default.isVip,
            isShowVipHover: !1,
            isShowSuperHover: !1,
            hoverText: "",
            hoverType: null,
            isSensitive: !1,
            sensitive: null,
            isHuddle: !1,
            huddle: null,
            remindType: null
        }), n && !function (t, e) {
            let i = !1;
            do {
                if (!t || !e) {
                    i = t === e;
                    break
                }
                i = t.isShowVipSpeed === e.isShowVipSpeed && t.isShowVipHover === e.isShowVipHover && t.isShowSuperSpeed === e.isShowSuperSpeed && t.isShowSuperHover === e.isShowSuperHover && t.isAcclerated === e.isAcclerated && t.isSensitive === e.isSensitive && t.hoverType === e.hoverType && t.hoverText === e.hoverText
            } while (0);
            return i
        }(o, n) && (o = n, a.client.callServerFunctionEx("UpdateVipSpeedStatus", {[i]: o}).catch()), !t || t.taskStatus !== s.VipDownloadDefineNS.VipTaskStatus.Init) return;
        if (o) {
            let e = x(o.hoverType);
            switch (o.hoverType) {
                case m.Vip:
                case m.SuperVip:
                    l.VipStatNS.vipButtonShow(i, e, "hover", t.isCloudTask);
                    break;
                case m.Try:
                    u.TryStatNS.tryButtonShow(i, e, "hover");
                    break;
                case m.SuperTry:
                    u.TryStatNS.superTryButtonShow(i, e, "hover");
                    break;
                case m.MixTry:
                    u.TryStatNS.superTryButtonShow(i, e, "hover", !0)
            }
        }
    })), a.client.attachServerEvent("on_vip_link_click", (t, e, i) => {
        if (k.info("on_vip_link_click", e), i) {
            let t = "hover", n = x(i.hoverType);
            switch (i.hoverType) {
                case m.Vip:
                case m.SuperVip:
                    c.default.clickVipAcclerateBtn(e, n, t).catch();
                    break;
                case m.Try:
                case m.SuperTry:
                case m.MixTry:
                    c.default.clickTryAcclerateBtn(e, n, t)
            }
        }
    }), r.default.addListener(r.UserEventNS.authorityChangedBegin, t => n(this, void 0, void 0, function* () {
        v = r.default.isVip, w = t, D.clear(), b.clear(), h.default.abTest || N();
        let e = yield a.client.callServerFunction("GetCategoryViewTaskList", "Downloading");
        for (let t = 0; t < e.length; ++t) {
            let i = e[t], n = {isShowSuperSpeed: r.default.isVip, isAcclerated: r.default.isVip};
            if (T.default.getTask(i)) return;
            a.client.callServerFunctionEx("UpdateVipSpeedStatus", {[i]: n}).catch(), t % 100 == 0 && (yield y.ThunderUtil.sleep(500))
        }
    })), h.default.addListener(h.AbtestEventNS.configureReady, () => {
        k.info(h.AbtestEventNS.configureReady), N()
    }), o.default.addListener(o.TaskEventNS.vipTaskInfoChanged, function (t, e) {
        return n(this, void 0, void 0, function* () {
            let i = yield C(t, e);
            k.info("vipSpeedStatus", i, JSON.stringify(e)), a.client.callServerFunctionEx("UpdateVipSpeedStatus", {[t]: i}).catch(), !D.get(t) && e.isPartialForbid ? (D.set(t, !0), l.VipStatNS.forbidIconShow(t, "part")) : !b.get(t) && e.error && e.error.isForbidResource && (b.set(t, !0), l.VipStatNS.forbidIconShow(t, "all"))
        })
    })
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(7), s = i(8), o = i(42), r = i(2), l = i(1), u = i(14), c = i(10), d = i(3), h = i(21), f = i(26),
        p = i(41), g = i(0).default.getLogger("VipDownload:download-kernel-stat");
    !function (t) {
        let e = new Map;

        function i(t, e) {
            return n(this, void 0, void 0, function* () {
                yield k(t, e, "vipversion", l.default.pluginVersion)
            })
        }

        function S(t, e) {
            return n(this, void 0, void 0, function* () {
                yield k(t, e, "startvip", "yes");
                let i = d.default.isVip ? "1" : "0";
                yield k(t, e, "vip_identify", i);
                const n = h.default.getVipTaskInfo(t);
                if (n) {
                    let i = n.enterType === s.VipDownloadDefineNS.VipTaskType.Try ? "vip_tryout_action" : "vip_action",
                        a = n.isContinued ? "1" : "0";
                    yield k(t, e, i, a)
                }
            })
        }

        function y(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = p.default.getTask(t);
                if (!i) return;
                let n = i.subId, a = void 0;
                e ? a = 0 : i.error && i.error.errorStep === o.HttpDefineNS.ErrorStep.Commit && (a = i.error.result), void 0 !== a && (yield k(t, n, "vip_tryout_commit", a.toString()))
            })
        }

        function T(t, e) {
            return n(this, void 0, void 0, function* () {
                let i = yield c.default.getTaskBaseInfo(t);
                if (!i) return null;
                let n = t, s = e;
                return i.taskType === a.DownloadKernel.TaskType.Group && (n = e, s = -1), [n, s]
            })
        }

        function k(t, e, i, a) {
            return n(this, void 0, void 0, function* () {
                let n = yield T(t, e);
                if (n) {
                    let t = n[0], e = n[1];
                    g.info("SetTaskExtStat", "taskId", t, "index", e, "key", i, "value", a), r.client.callServerFunction("SetTaskExtStat", t, e, i, a).catch()
                }
            })
        }

        u.default.addListener(u.TaskEventNS.taskStatusChanged, function (t, e) {
            return n(this, void 0, void 0, function* () {
                let n = yield c.default.getTaskBaseInfo(t);
                if (n && n.taskType !== a.DownloadKernel.TaskType.Group && n.taskType !== a.DownloadKernel.TaskType.Bt && !(n.groupTaskId && n.groupTaskId > 0)) switch (g.info("onTaskStatusChanged", t, e), e) {
                    case a.DownloadKernel.TaskStatus.Started:
                        yield i(t, -1)
                }
            })
        }), u.default.addListener(u.TaskEventNS.subTaskStatusChanged, function (t, e, o) {
            return n(this, void 0, void 0, function* () {
                let n = yield c.default.getTaskBaseInfo(t);
                if (!n) return;
                g.info("onSubTaskStatusChanged", t, e, o);
                const r = n.taskType === a.DownloadKernel.TaskType.Bt && o === a.DownloadKernel.BtFileStatus.Started,
                    l = n.taskType === a.DownloadKernel.TaskType.Group && o === a.DownloadKernel.TaskStatus.Started;
                if (r || l) {
                    yield i(t, e);
                    let n = h.default.getVipTaskInfo(t);
                    n && n.enterType === s.VipDownloadDefineNS.VipTaskType.Vip && (yield S(t, e))
                }
            })
        }), u.default.addListener(u.TaskEventNS.taskAcclerateStatusChanged, function (t, i, a) {
            return n(this, void 0, void 0, function* () {
                switch (a) {
                    case s.VipDownloadDefineNS.VipTaskStatus.Commiting:
                        if (i === s.VipDownloadDefineNS.VipTaskType.Try) {
                            let e = p.default.getTask(t);
                            if (e) {
                                let i = e.subId;
                                yield S(t, i)
                            }
                        } else if (i === s.VipDownloadDefineNS.VipTaskType.Vip) {
                            const e = f.default.getTask(t);
                            if (e) {
                                let i = e.getDownloadingFiles();
                                for (let e of i) yield S(t, e.subId)
                            }
                        }
                        e.delete(t);
                        break;
                    case s.VipDownloadDefineNS.VipTaskStatus.CommitSuccess:
                        i === s.VipDownloadDefineNS.VipTaskType.Try && (yield y(t, !0));
                        break;
                    case s.VipDownloadDefineNS.VipTaskStatus.CommitFailed:
                        i === s.VipDownloadDefineNS.VipTaskType.Try && (yield y(t, !1))
                }
            })
        }), u.default.addListener(u.TaskEventNS.taskTokenQueryResult, function (t, i, a, s) {
            return n(this, void 0, void 0, function* () {
                g.info("onTokenCallback", t, i, "result", a), function (t, i, n, a) {
                    let s = function (t, i) {
                        let n = function (t) {
                            return e.get(t)
                        }(t);
                        if (!n) return null;
                        return n.subTaskCacheMap.get(i)
                    }(t, i), o = s ? "vip_dcdn_certificate_re" : "vip_dcdn_certificate";
                    if (k(t, i, o, n.toString()).catch(), a) {
                        let e = a.split(".");
                        if (e && e.length >= 2) {
                            o = s ? "vip_dcdn_token_re" : "vip_dcdn_token";
                            let n = e[1];
                            k(t, i, o, n).catch()
                        }
                    }
                    let r = function (t, i) {
                        let n = function (t) {
                            let i = e.get(t);
                            i || (i = {subTaskCacheMap: new Map});
                            return e.set(t, i), i
                        }(t), a = n.subTaskCacheMap.get(i);
                        a || (a = {tokenQueryTotal: 0, tokenQuerySuccess: 0}, n.subTaskCacheMap.set(i, a));
                        return a
                    }(t, i);
                    r.tokenQueryTotal++, 0 === n && r.tokenQuerySuccess++;
                    if (r.tokenQueryTotal > 0) {
                        let e = r.tokenQuerySuccess / r.tokenQueryTotal;
                        k(t, i, "token_qurey_sucrate", e.toFixed(2)).catch()
                    }
                }(t, i, a, s)
            })
        }), u.default.addListener(u.TaskEventNS.taskStatusQueryResult, function (t, e, i, a) {
            return n(this, void 0, void 0, function* () {
                g.info("onStatusQueryCallback", t, e, "fileProperty", i, "hasVipResource", a), k(t, e, "FileProperty", i.toString()).catch(), k(t, e, "HasVipResource", a.toString()).catch()
            })
        }), u.default.addListener(u.TaskEventNS.taskAcclerateTypeResult, function (t, e, i) {
            return n(this, void 0, void 0, function* () {
                let n = yield T(t, e);
                if (n) {
                    let t = n[0], e = n[1];
                    i.forEach((i, n) => {
                        g.info("SetTaskExtStat", t, e, n, i), r.client.callServerFunction("SetTaskExtStat", t, e, n, i).catch()
                    })
                }
            })
        })
    }(e.DkStatNS || (e.DkStatNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(7), o = i(8), r = i(26), l = i(41), u = i(281), c = i(5), d = i(10),
        h = i(0).default.getLogger("VipDownload:information-collect");

    function f(t) {
        return n(this, void 0, void 0, function* () {
            let e = [];
            do {
                let i = t.getVipTask().getVipTaskInfo();
                if (t.getTaskStatus() !== s.DownloadKernel.TaskStatus.Started || !i.enterStatus || i.enterStatus <= o.VipDownloadDefineNS.VipTaskStatus.Init) break;
                let n = t.getTaskId(), a = [], r = i.enterType === o.VipDownloadDefineNS.VipTaskType.Try;
                if (r) {
                    let e = l.default.getTask(n);
                    if (e) {
                        let i = t.getFile(e.subId);
                        i && (a = [i])
                    }
                } else a = t.getDownloadingFiles();
                for (let i of a) {
                    let n = {};
                    n.gcid = i.gcid, n.url = i.url, n.fileSize = i.fileSize;
                    let a = {};
                    a = r ? S(t) : g(t, i.subId), n.query_info = a, n.download_info = yield p(t, i.subId), e.push(n)
                }
            } while (0);
            return e
        })
    }

    function p(t, e) {
        let i = t.getTaskId(), n = e, o = t.getTaskBase();
        return o && o.taskType === s.DownloadKernel.TaskType.Group && (i = e, n = -1), new Promise(t => {
            a.client.callServerFunction("GetTaskProfileLog", i, n, (e, a) => {
                h.silly("taskId", i, "index", n, "ret", e, "log", a);
                let s = null;
                try {
                    s = JSON.parse(a)
                } catch (t) {
                    h.error("GetTaskProfileLog json parse error:", t)
                }
                t(s)
            }).catch()
        })
    }

    function g(t, e) {
        let i = {}, n = {}, a = t.getVipTask();
        if (a) {
            let t = {}, i = a.getStatusData(e);
            i && (t.status_code = i.statusCode, t.result = i.result), n.res_status = t;
            let s = {}, o = a.getTokenData(e);
            o && (s.status_code = o.statusCode, s.result = o.result, s.data = {token: o.token}), n.speedup = s
        }
        return i.token = n, i
    }

    function S(t) {
        let e = {}, i = {}, n = {}, a = t.getTaskId(), s = l.default.getTask(a);
        if (s && c.ThunderUtil.isDef(s.subId)) {
            let e = {status_code: 200, result: 0, data: {trial_left_times: s.leftCount}};
            i.query = e;
            let a = {};
            s.commitData && (a.status_code = s.commitData.statusCode, a.result = s.commitData.result), i.commit = a;
            let o = t.getVipTask(), r = {}, l = o.getStatusData(s.subId);
            l && (r.status_code = l.statusCode, r.result = l.result), n.res_status = r;
            let u = {}, c = o.getTokenData(s.subId);
            c && (u.status_code = c.statusCode, u.result = c.result, u.data = {token: c.token}), n.speedup = u
        }
        return e.try_speed = i, e.token = n, e
    }

    (function () {
        return n(this, void 0, void 0, function* () {
            const t = yield a.client.callServerFunction("GetThunderVersion");
            let e = t.lastIndexOf("."), i = t.slice(0, e);
            return i
        })
    })().then(t => {
        let e = c.ThunderUtil.versionCompare(t, "10.1.23") >= 0;
        h.info("enable", e), e && a.client.attachServerEvent("DownloadDetectStart", (t, e) => n(this, void 0, void 0, function* () {
            if (h.info("DownloadDetectStart context,from:", t, e), "startButton" === e || "restartButton" === e) {
                let t = yield function () {
                    return n(this, void 0, void 0, function* () {
                        let t = [], e = r.default.getTaskMap();
                        for (let [i, n]of e.entries()) {
                            let e = yield f(n);
                            h.silly(i, "items.length", e.length), e.length > 0 && (t = t.concat(e))
                        }
                        return t
                    })
                }();
                if (t.length > 0) {
                    let e = {data: {peer_id: yield d.default.getTpPeerId(), res_info_list: t}};
                    yield(new u.InformationCollectHttpSession).sendCollect(e)
                }
            }
        }))
    }).catch()
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(15), o = i(282), r = i(3), l = i(1),
        u = i(0).default.getLogger("VipDownload:information-collect");

    class c extends s.HttpSession {
        sendCollect(t) {
            return n(this, void 0, void 0, function* () {
                let e = ++c.sequence, i = r.default.userId, n = yield r.default.getSessionId(),
                    s = l.default.currentTime, u = yield a.HttpJsonCryptoNS.getUriParam(e, s);
                this.host = "speedup.information.lixian.vip.xunlei.com", this.retries = 2, this.timeout = 2e4, this.path = "/report/peerInfo?" + u, this.auth = a.HttpJsonCryptoNS.getAuthorization(i, n, "client", "0"), this.accept = a.HttpJsonCryptoNS.getAccept(), t.userId = i, t.random = s, this.body = yield o.InformationCollectPackageNS.createCollectBuffer(t), this.postCollectRequest(t)
            })
        }

        postCollectRequest(t) {
            this.post(e => {
                if (r.default.userId === t.userId && e) {
                    let i = e.headers["random-num"];
                    if (u.info("random", i), u.info("statusCode", e.statusCode), 200 === e.statusCode && e.body && i) {
                        let n = Number(i).valueOf(),
                            a = o.InformationCollectPackageNS.praseCollectBuffer(t.userId, n, e.body);
                        u.info("response", a)
                    }
                }
            }, t => {
                u.info("error", t)
            })
        }
    }

    c.sequence = 0, e.InformationCollectHttpSession = c
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(18), s = i(0).default.getLogger("VipDownload:information-collect");
    !function (t) {
        t.createCollectBuffer = function (t) {
            return n(this, void 0, void 0, function* () {
                s.info("--\x3ecreateCollectBuffer");
                let e = a.HttpJsonCryptoNS.getKey(t.userId, t.random),
                    i = a.HttpJsonCryptoNS.encryptHttpBuffer(t.data, e);
                return s.info("<--createCollectBuffer"), i
            })
        }, t.praseCollectBuffer = function (t, e, i) {
            s.info("--\x3epraseCollectBuffer");
            let n = a.HttpJsonCryptoNS.getKey(t, e), o = a.HttpJsonCryptoNS.decryptHttpBuffer(i, n);
            return s.info("<--praseCollectBuffer"), o
        }
    }(e.InformationCollectPackageNS || (e.InformationCollectPackageNS = {}))
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0});
    const n = i(5), a = i(284), s = i(2), o = i(0).default.getLogger("VipDownload:init-skin");

    function r(t) {
        if (o.info("changeSkin", t), t.type === a.SkinHelperNS.SkinType.Default) document.body.classList.remove("is-theme"), n.ThunderUtil.setCSSProperties(document.body, {
            "--color-primary-theme": "",
            "--color-primary-control-1": "",
            "--color-primary-control-2": "",
            "--color-primary-control-3": "",
            "--color-primary-control-4": "",
            "--color-primary-gradient-1": "",
            "--color-primary-gradient-2": "",
            "--color-primary-text": "",
            "--color-search": "",
            "--color-secondary": "",
            "--color-gradient-background-1": "",
            "--color-gradient-background-2": "",
            "--color-gradient-foreground-1": "",
            "--color-gradient-foreground-2": "",
            "--color-accordion-1": "",
            "--color-accordion-2": "",
            "--default-opacity-1": "",
            "--default-opacity-2": ""
        }); else if (t.type === a.SkinHelperNS.SkinType.Color || t.type === a.SkinHelperNS.SkinType.Wallpaper) {
            document.body.classList.add("is-theme");
            let {colors: {colorPrimary: e, colorPrimaryControl1: i, colorPrimaryControl2: a, colorPrimaryControl3: s, colorPrimaryControl4: o, colorPrimaryGradient: r, colorPrimaryText: l, colorSearch: u, colorSecondary: c, colorGradientBackground: d, colorGradientForeground: h, colorAccordion: f}, opacity: p} = t;
            n.ThunderUtil.setCSSProperties(document.body, {
                "--color-primary-theme": `${e}`,
                "--color-primary-control-1": `${i}`,
                "--color-primary-control-2": `${a}`,
                "--color-primary-control-3": `${s}`,
                "--color-primary-control-4": `${o}`,
                "--color-primary-gradient-1": `${r[0]}`,
                "--color-primary-gradient-2": `${r[1]}`,
                "--color-primary-text": `${l}`,
                "--color-search": `${u}`,
                "--color-secondary": `${c}`,
                "--color-gradient-background-1": `${d[0]}`,
                "--color-gradient-background-2": `${d[1]}`,
                "--color-gradient-foreground-1": `${h[0]}`,
                "--color-gradient-foreground-2": `${h[1]}`,
                "--color-accordion-1": `${f[0]}`,
                "--color-accordion-2": `${f[1]}`,
                "--default-opacity-1": `${p - .1}`,
                "--default-opacity-2": `${p + .1}`
            })
        }
    }

    s.client.callServerFunction("GetSkinInfo").then(t => {
        r(t)
    }).catch(t => {
        o.warn(t)
    }), s.client.attachServerEvent("OnChangeSkin", (t, e) => {
        r(e)
    })
}, function (t, e, i) {
    "use strict";
    Object.defineProperty(e, "__esModule", {value: !0}), function (t) {
        let e;
        !function (t) {
            t[t.Default = 0] = "Default", t[t.Color = 1] = "Color", t[t.Wallpaper = 2] = "Wallpaper", t[t.Custom = 3] = "Custom"
        }(e = t.SkinType || (t.SkinType = {})), t.defaultSkinInfo = {type: e.Default, colorID: 0}
    }(e.SkinHelperNS || (e.SkinHelperNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(2), s = i(0).default.getLogger("VipDownload:plugin-function"), o = i(30), r = i(21), l = i(8), u = i(3),
        c = i(49);
    !function (t) {
        const e = new class {
            getBaotuanInfoEx(t) {
                return n(this, void 0, void 0, function* () {
                    let e = r.default.getBaotuanDetailSt(t);
                    c.BaotuanStatNS.hoverWebBaoTuan(e.teamLeftCount, e.state);
                    let i = r.default.getBaotuanDetail(t), n = r.default.getVipTaskInfo(t), a = {
                        teamCount: i ? i.baotuanNumber : yield r.default.getBaotuanNumber(t),
                        teamStatus: 0,
                        isVip: u.default.isVip ? "1" : "0",
                        isPlatinumVip: u.default.isPlatinumVip ? "1" : "0",
                        isSuperVip: u.default.isSuperVip ? "1" : "0",
                        teamLeftCount: e.teamLeftCount,
                        needCutLine: 0,
                        isTry: 0
                    };
                    if (n) {
                        switch (n.taskType) {
                            case l.VipDownloadDefineNS.VipTaskType.Try:
                            case l.VipDownloadDefineNS.VipTaskType.Ad:
                                a.isTry = 1
                        }
                        switch (n.enterType) {
                            case l.VipDownloadDefineNS.VipTaskType.Try:
                            case l.VipDownloadDefineNS.VipTaskType.Ad:
                                a.isTry = 1
                        }
                    }
                    if (i) switch (i.baotuanXgt) {
                        case l.VipDownloadDefineNS.BaotuanXgt.Before_All:
                        case l.VipDownloadDefineNS.BaotuanXgt.Before_Join:
                        case l.VipDownloadDefineNS.BaotuanXgt.Before_Novice:
                            a.teamStatus = 0;
                            break;
                        case l.VipDownloadDefineNS.BaotuanXgt.Before_CutLine:
                        case l.VipDownloadDefineNS.BaotuanXgt.Doing_CutLineOut:
                            a.teamStatus = 0, a.needCutLine = 1;
                            break;
                        case l.VipDownloadDefineNS.BaotuanXgt.Doing_Succeed:
                        case l.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedOpenAuto:
                        case l.VipDownloadDefineNS.BaotuanXgt.Doing_SucceedCutLineOut:
                            a.teamStatus = 1;
                            break;
                        case l.VipDownloadDefineNS.BaotuanXgt.Doing_KickOut:
                            a.teamStatus = 2
                    }
                    return a
                })
            }

            RegisterBaoTuanExternalFunction() {
                let t = {
                    clickBaoTuan: (...t) => {
                        s.info("click_baotuan");
                        let e = t[0], i = t[1];
                        switch (i) {
                            case"commentArea":
                                i = "comment_area";
                                break;
                            case"huddleDetail":
                                i = "group_dl_detail";
                                break;
                            default:
                                i = "click_right_icon"
                        }
                        o.default.clickJoinBtnByWeb(e, i)
                    }, getTaskInfo: (...t) => n(this, void 0, void 0, function* () {
                        let e = t[0], i = yield this.getBaotuanInfoEx(e);
                        if (i.teamCount) {
                            c.BaotuanStatNS.showTips("hover");
                            let t = JSON.stringify(i);
                            return s.info("getTaskInfo", e, t), t
                        }
                        return null
                    }), getBaotuanInfo: (...t) => n(this, void 0, void 0, function* () {
                        let e = t[0], i = yield this.getBaotuanInfoEx(e), n = JSON.stringify(i);
                        return s.info("getBaotuanInfo", e, n), n
                    })
                };
                a.client.callServerFunction("RegisterWebExternal", t)
            }
        };
        t.registerExternalFunction = function () {
            e.RegisterBaoTuanExternalFunction()
        }
    }(e.ExternalFunctionNS || (e.ExternalFunctionNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(5), s = i(11), o = i(2), r = i(43), l = i(86), u = i(30), c = i(27), d = i(0), h = i(3), f = i(44),
        p = i(94), g = i(45), S = d.default.getLogger("AdPlatform");
    !function (t) {
        let e, i, d, y;
        !function (t) {
            t.FunctionalHigh = "pack_using", t.Functional = "pack_before", t.Renew = "renew", t.Exactly = "exactly", t.AdPlatform = "adplatform"
        }(e = t.Type || (t.Type = {})), function (t) {
            t[t.Unknown = 0] = "Unknown", t[t.Click = 1] = "Click", t[t.Priority = 2] = "Priority", t[t.Expired = 3] = "Expired"
        }(i = t.CloseReason || (t.CloseReason = {})), function (t) {
            t.EnqueueAdPlatform = "EnqueueAdPlatform", t.CloseAdPlatform = "CloseAdPlatform"
        }(d = t.FunctionName || (t.FunctionName = {})), function (t) {
            t.OnAdPlatformShow = "OnAdPlatformShow", t.OnAdPlatformClose = "OnAdPlatformClose"
        }(y = t.EventName || (t.EventName = {}));
        let T = null;
        t.init = function () {
            (T = new m).init()
        };
        const k = "ad-packagetry-082220fa-1dde-41e5-85ee-33796bf63af4";

        class m {
            constructor() {
                this.commitingTimer = null, this.expiredHideTimer = null, this.showType = null, this.closed = !1, this.showedStat = new Map
            }

            init() {
                r.default.addListener(g.PackageTryDefineNS.Event.stateChange, this.onPackageStateChange.bind(this)), r.default.addListener(g.PackageTryDefineNS.Event.progessUpdate, this.onPackageProgessUpdate.bind(this)), h.default.addListener(h.UserEventNS.authorityChanged, this.onAuthorityChanged.bind(this))
            }

            getOrderContentOptions(t) {
                let e = {
                    msgid: k,
                    maintitle: "",
                    subtitle: "",
                    icon: s.join(a.ThunderUtil.getStaticPath(), "icon/adplatform/icon-vip.png"),
                    buttonText: "",
                    showProgress: !1,
                    progress: 0,
                    styleEx: {sweepLight: r.default.isPackageRunning && r.default.sweepLight},
                    onClick: t => {
                    }
                };
                return t && (e.styleEx = Object.assign(e.styleEx, {
                    background: "#32302f",
                    p_color: "#ffffff"
                }), e.icon = s.join(a.ThunderUtil.getStaticPath(), "icon/adplatform/icon-super.png")), e
            }

            showPackageTryXht(t, e) {
                S.info("showPackageTryXht", t, e), o.client.callServerFunction(d.EnqueueAdPlatform, t, e, () => n(this, void 0, void 0, function* () {
                    this.showType = t, S.info("show", t), r.default.packageReady && !this.showedStat.has("packageReady") ? (l.PackageTryStatNS.show(r.default.todayUseing, "xht", r.default.isSurperPackget, r.default.isHaveCloudTask), this.showedStat.set("packageReady", !0)) : r.default.packageCommiting && !this.showedStat.has("packageCommiting") && (l.PackageTryStatNS.showInitiatingXht(r.default.isSurperPackget, r.default.isHaveCloudTask), this.showedStat.set("packageCommiting", !0))
                }), (...e) => {
                    S.info("close", t, ...e), e[0] === i.Click && (this.closed = !0)
                })
            }

            closePackageTryXht(t) {
                S.info("closePackageTryXht", t), o.client.callServerFunction(d.CloseAdPlatform, this.showType, k, t)
            }

            onPackageStateChange(t, ...o) {
                return n(this, void 0, void 0, function* () {
                    let d = this.getOrderContentOptions(r.default.isSurperPackget && g.PackageTryDefineNS.State.ready !== t);
                    this.commitingTimer && (clearInterval(this.commitingTimer), this.commitingTimer = null), this.expiredHideTimer && (clearTimeout(this.expiredHideTimer), this.expiredHideTimer = null);
                    let h = r.default.isSurperPackget ? "v_pc_xlx_hytq_dl_svip_pack" : "v_pc_xlx_hytq_dl_vip_pack";
                    switch (t) {
                        case g.PackageTryDefineNS.State.ready:
                            if (this.closed) {
                                S.info("closed no show xht on PackageTryDefineNS.PackageTryState.ready");
                                break
                            }
                            d.subtitle = c.default.getData("加速下载更快哦", h, 1, "text"), d.buttonText = c.default.getData("免费试用", h, 2, "text"), d.icon = s.join(a.ThunderUtil.getStaticPath(), "icon/adplatform/icon-thunder.png"), r.default.isSurperPackget ? d.maintitle = c.default.getData("免费试用超级会员特权", h, 0, "text") : d.maintitle = c.default.getData("免费试用会员特权", h, 0, "text"), d.onClick = (t => {
                                r.default.beginPackageTry(g.PackageTryDefineNS.BeginFrom.xht)
                            }), this.showPackageTryXht(e.Functional, d);
                            break;
                        case g.PackageTryDefineNS.State.commiting:
                            if (r.default.isBeginFromPlay) {
                                this.closePackageTryXht(i.Expired), S.info("packagetry.isBeginFromPlay and not show xht");
                                break
                            }
                            let p = 0, y = ["正在开启会员加速...", "正在加入抱团（插队中）... "];
                            d.btnVisible = !1, r.default.isSurperPackget ? (d.maintitle = "正在开启超级会员加速", d.buttonText = c.default.getData("开通超会", h, 3, "text"), y[0] = "正在开启超级加速与强力连通...") : (d.maintitle = "正在开启白金会员加速", d.buttonText = c.default.getData("开通会员", h, 3, "text")), d.subtitle = y[p], f.default.canUseKuaiNiao && r.default.isSurperPackget && y.push(`宽带提速中（提升至${f.default.downstreamString}）`), d.onClick = (t => n(this, void 0, void 0, function* () {
                                let t = yield l.PackageTryStatNS.clickInitiatingXht(!1, r.default.isSurperPackget, r.default.isHaveCloudTask),
                                    e = {referfrom: c.default.getData(h, h, 3, "referfrom"), aidfrom: t},
                                    i = "https://pay.xunlei.com/pay.html";
                                i = c.default.getData(i, h, 3, "url"), i = a.ThunderUtil.RepleaseUrlArgs(e, i), r.default.isSurperPackget && (i += "&default_tab=supervip"), u.default.openPayVipUrl(i)
                            })), this.showPackageTryXht(e.FunctionalHigh, d), this.commitingTimer = setInterval(() => {
                                d.subtitle = y[++p % 2], this.showPackageTryXht(e.FunctionalHigh, d)
                            }, 2e3);
                            break;
                        case g.PackageTryDefineNS.State.finish:
                            if (r.default.isBeginFromPlay) {
                                S.info("packagetry.isBeginFromPlay and not show xht");
                                break
                            }
                            r.default.isSurperPackget ? (d.maintitle = "超级会员加速试用结束", d.buttonText = c.default.getData("开通超会", h, 3, "text")) : (d.maintitle = "白金会员加速试用结束", d.buttonText = c.default.getData("开通会员", h, 3, "text")), d.onClick = (t => n(this, void 0, void 0, function* () {
                                this.closePackageTryXht(i.Click);
                                let t = yield l.PackageTryStatNS.afterClick("xht", yield r.default.downloadNum(), r.default.accNum, r.default.groupNum, r.default.accBcNum, r.default.beforeSpeed, r.default.ingSpeed, r.default.isSurperPackget, r.default.isHaveCloudTask),
                                    e = {referfrom: c.default.getData(h, h, 3, "referfrom"), aidfrom: t},
                                    n = "https://pay.xunlei.com/pay.html";
                                n = c.default.getData(n, h, 3, "url"), n = a.ThunderUtil.RepleaseUrlArgs(e, n), r.default.isSurperPackget && (n += "&default_tab=supervip"), u.default.openPayVipUrl(n)
                            }));
                            let T = o[1], k = Math.min(o[2], 120), m = "";
                            m = T > 1048576 ? (T / 1024 / 1024).toFixed(1) + "MB/s" : (T / 1024).toFixed(0) + "Kb/s", d.btnVisible = !1, d.subtitle = `<p>试用均速 <span style="color: #ff7b5f">${m}</span></p> <p>节省 <span style="color: #ff7b5f">${k}分钟</span></p>`, this.showPackageTryXht(e.FunctionalHigh, d), l.PackageTryStatNS.afterShow("xht", yield r.default.downloadNum(), r.default.accNum, r.default.groupNum, r.default.accBcNum, r.default.beforeSpeed, r.default.ingSpeed, r.default.gcidSet, r.default.isSurperPackget, r.default.isHaveCloudTask);
                            break;
                        case g.PackageTryDefineNS.State.runing:
                            if (r.default.isBeginFromPlay) {
                                S.info("packagetry.isBeginFromPlay and not show xht");
                                break
                            }
                            let v = yield r.default.downloadNum();
                            setTimeout(() => {
                                l.PackageTryStatNS.tryingShow(v, r.default.accNum, r.default.groupNum, r.default.accBcNum, r.default.beforeSpeed, !1, r.default.isSurperPackget, r.default.isHaveCloudTask)
                            }, 5e3);
                            break;
                        case g.PackageTryDefineNS.State.stop:
                        case g.PackageTryDefineNS.State.over:
                            this.closePackageTryXht(i.Expired);
                            break;
                        case g.PackageTryDefineNS.State.none:
                            this.expiredHideTimer && (clearTimeout(this.expiredHideTimer), this.expiredHideTimer = null), this.expiredHideTimer = setTimeout(() => {
                                this.closePackageTryXht(i.Expired)
                            }, 200)
                    }
                })
            }

            onPackageProgessUpdate(t, i, s, o, d, h) {
                return n(this, void 0, void 0, function* () {
                    if (r.default.isBeginFromPlay) return void S.info("packagetry.isBeginFromPlay and not show xht");
                    let g = this.getOrderContentOptions(r.default.isSurperPackget), y = [];
                    if (s && o ? r.default.isSurperPackget ? (y.push(`<p>超级加速+强力连通任务：<span style="color: #ff7b5f">${s}个</span></p>`), y.push(`<p>抱团任务：<span style="color: #ff7b5f">${o}个</span></p>`)) : y.push(`<p>白金加速任务：<span style="color: #ff7b5f">${s}个</span></p> <p>抱团任务：<span style="color: #ff7b5f">${o}个</span></p>`) : o && y.push(`<p>抱团任务：<span style="color: #ff7b5f">${o}个</span></p>`), f.default.canUseKuaiNiao && r.default.isSurperPackget) switch (f.default.status) {
                        case p.KuaiNiaoDefineNS.KuaiNiaoStatus.Enable:
                        case p.KuaiNiaoDefineNS.KuaiNiaoStatus.Commiting:
                            y.push(`宽带提速中（提升至${f.default.downstreamString}）`);
                            break;
                        case p.KuaiNiaoDefineNS.KuaiNiaoStatus.Alive:
                            y.push(`宽带已提速至${f.default.downstreamString}`)
                    }
                    d && y.push(`<p>极速云盘下载任务：<span style="color: #ff7b5f">${d}个</span></p>`), g.subtitle = y[Math.floor(h / 4) % y.length];
                    let T = r.default.isSurperPackget ? "v_pc_xlx_hytq_dl_svip_pack" : "v_pc_xlx_hytq_dl_vip_pack";
                    r.default.isSurperPackget ? (g.maintitle = `超级会员加速试用中, 剩余${Math.floor(i - t)}秒`, g.buttonText = c.default.getData("开通超会", T, 3, "text")) : (g.maintitle = `白金会员加速试用中, 剩余${Math.floor(i - t)}秒`, g.buttonText = c.default.getData("开通会员", T, 3, "text")), g.showProgress = !0, g.progress = Math.floor(100 * t / i), g.onClick = (t => n(this, void 0, void 0, function* () {
                        setTimeout(() => n(this, void 0, void 0, function* () {
                            l.PackageTryStatNS.tryingClick(yield r.default.downloadNum(), r.default.accNum, r.default.groupNum, r.default.accBcNum, r.default.beforeSpeed, !1, r.default.isSurperPackget, r.default.isHaveCloudTask)
                        }), 3e3);
                        let t = yield l.PackageTryStatNS.tryingClick(-1, r.default.accNum, r.default.groupNum, r.default.accBcNum, r.default.beforeSpeed, !1, r.default.isSurperPackget, r.default.isHaveCloudTask),
                            e = {referfrom: c.default.getData(T, T, 3, "referfrom"), aidfrom: t},
                            i = "https://pay.xunlei.com/pay.html";
                        i = c.default.getData(i, T, 3, "url"), i = a.ThunderUtil.RepleaseUrlArgs(e, i), r.default.isSurperPackget && (i += "&default_tab=supervip"), u.default.openPayVipUrl(i)
                    })), this.showPackageTryXht(e.FunctionalHigh, g)
                })
            }

            onAuthorityChanged() {
                this.closed = !1, this.showedStat.clear()
            }
        }
    }(e.AdPlatformNS || (e.AdPlatformNS = {}))
}, function (t, e, i) {
    "use strict";
    var n = this && this.__awaiter || function (t, e, i, n) {
        return new (i || (i = Promise))(function (a, s) {
            function o(t) {
                try {
                    l(n.next(t))
                } catch (t) {
                    s(t)
                }
            }

            function r(t) {
                try {
                    l(n.throw(t))
                } catch (t) {
                    s(t)
                }
            }

            function l(t) {
                t.done ? a(t.value) : new i(function (e) {
                    e(t.value)
                }).then(o, r)
            }

            l((n = n.apply(t, e || [])).next())
        })
    };
    Object.defineProperty(e, "__esModule", {value: !0});
    const a = i(1), s = i(2), o = i(26), r = i(0), l = i(3), u = i(10), c = i(7),
        d = r.default.getLogger("GlobalSpeedReportNS");
    !function (t) {
        function e() {
            return n(this, void 0, void 0, function* () {
                let t = {switch: !1, sample_gap: 180, sample: 3};
                if (t = yield s.client.callServerFunction("GetRemoteGlobalConfigValue", "vip", "client_global_speed_report", t), d.info("globalSpeedReport", t), !t.switch) return;
                let e = !1, i = [], r = [], h = [], f = a.default.currentTime;
                s.client.attachServerEvent("OnGlobalDownloadSpeedChanged", (s, l, u) => n(this, void 0, void 0, function* () {
                    let n = a.default.currentTime;
                    if (e) if (r.length < t.sample) r.push(l), h.push(u); else {
                        e = !1;
                        let n = {
                            sample_gap: t.sample_gap,
                            ts: f,
                            sample: t.sample,
                            total_speed: 0,
                            vip_speed: 0,
                            task_num: o.default.getDownloadingTaskCount()
                        };
                        for (let e = 0; e < t.sample; ++e) n.total_speed += r[e], n.vip_speed += h[e];
                        n.total_speed = Math.floor(n.total_speed / t.sample), n.vip_speed = Math.floor(n.vip_speed / t.sample), i.push(n), r = [], h = []
                    } else n >= f + t.sample_gap && o.default.getDownloadingTaskCount() > 0 && (e = !0, f = n, r.push(l), h.push(u))
                })), u.default.addListener(u.DkEventNS.taskStatusChanged, (t, e) => n(this, void 0, void 0, function* () {
                    switch (e) {
                        case c.DownloadKernel.TaskStatus.Stopped:
                        case c.DownloadKernel.TaskStatus.Failed:
                        case c.DownloadKernel.TaskStatus.Succeeded:
                            let n = yield u.default.getTaskBaseInfo(t);
                            if (n && !n.isBackground && i.length) {
                                let t = "download_speed:(";
                                for (let e = 0; e < i.length; ++e) t += "sample_gap=" + i[e].sample_gap + ",", t += "ts=" + i[e].ts + ",", t += "sample=" + i[e].sample + ",", t += "total_speed=" + i[e].total_speed + ",", t += "vip_speed=" + i[e].vip_speed + ",", t += "task_num=" + i[e].task_num, e !== i.length - 1 ? t += ";" : t += ")";
                                i = [], d.info("download_speed", t);
                                let e = `vip_type=${l.default.vipType()},download_speed=${encodeURIComponent(t)}`;
                                s.client.callServerFunction("TrackEvent", "core_event", "client_global_speed_report", "", 0, 0, 0, 0, e).catch(), d.info("trackEvent", "core_event", "client_global_speed_report", e)
                            }
                    }
                }))
            })
        }

        (function () {
            return n(this, void 0, void 0, function* () {
                (yield s.client.callServerFunction("IsRemoteGlobalConfigInitFinish")) ? e().catch() : s.client.attachServerEvent("OnRemoteGlobalConfigLoaded", () => n(this, void 0, void 0, function* () {
                    e().catch()
                }))
            })
        })().catch()
    }(e.GlobalSpeedReportNS || (e.GlobalSpeedReportNS = {}))
}, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function (t, e) {
}, , , , , , , , function (t, e) {
}, , , function (t, e) {
}, , function (t, e) {
}, , function (t, e) {
}, , , , , , function (t, e) {
}, , , function (t, e) {
}, , function (t, e) {
}, , function (t, e) {
}, , , , , function (t, e) {
}, , , function (t, e) {
}, , , function (t, e) {
}, , function (t, e) {
}]);
//# sourceMappingURL=renderer.js.map