function utTeam(id, s) {
    //en/team/summary
    //en/team/teamsche
    return "/"+toThaiUri("team")+"/{0}/{1}".format(s ? "teamsche" : "summary", id);
}

function utLea(id) {
    return "/"+ toThaiUri('leagueinfo') +"/{0}".format(id);
}

function changeGif(url) {
    return url;
}

function _$(n) {
    return document.getElementById(n);
}

function _$$(n) {
    return document.getElementsByName(n);
}

function getCookie(n) {
    var t,
        i = new RegExp("(^| )" + n + "=([^;]*)(;|$)");
    return (t = document.cookie.match(i)) ? unescape(t[2]) : null;
}

function writeCookie(n, t, i) {
    if (
        typeof _appModule != "undefined" &&
        (_appModule == "Ind" || _appModule == "Bola")
    ) {
        writeShareCookie(n, t, i);
        return;
    }
    var r = i;
    r == undefined && (r = new Date(new Date().getTime() + 1314e6));
    r = ";path=/;expires=" + r.toGMTString();
    document.cookie = n + "=" + escape(t) + r;
}

function clearCookie(n) {
    writeCookie(n, "", new Date());
}

function getDoMain() {
    var n = location.href.split("/")[2].split(".");
    var domain = n[0] === "www"
    ? n.slice(1).join(".")
    : n
        .map((element, index) =>
            index === n.length - 1 ? element.split(":")[0] : element
        )
        .join(".");
    return domain;
}

function writeShareCookie(n, t, i) {
    var r = i;
    r == undefined && (r = new Date(new Date().getTime() + 1314e6));
    r = ";path=/;expires=" + r.toGMTString() + ";domain=" + getDoMain();
    document.cookie = n + "=" + escape(t) + r;
}

function WriteTmpCookie(n, t) {
    document.cookie = n + "=" + escape(t) + ";path=/;expires=-1";
}

function WriteSession(n, t) {
    window.sessionStorage.setItem(n, t);
}

function GetSession(n) {
    return window.sessionStorage.getItem(n);
}

function MM_findObj(n, t) {
    var u, r, i;
    for (
        t || (t = document),
        (u = n.indexOf("?")) > 0 &&
        parent.frames.length &&
        ((t = parent.frames[n.substring(u + 1)].document),
            (n = n.substring(0, u))),
        (i = t[n]) || !t.all || (i = t.all[n]),
            r = 0;
        !i && r < t.forms.length;
        r++
    )
        i = t.forms[r][n];
    for (r = 0; !i && t.layers && r < t.layers.length; r++)
        i = MM_findObj(n, t.layers[r].document);
    return !i && t.getElementById && (i = t.getElementById(n)), i;
}

function MM_showHideLayers() {
    for (
        var n, t, r = MM_showHideLayers.arguments, i = 0;
        i < r.length - 2;
        i += 3
    )
        (t = MM_findObj(r[i])) != null &&
        ((n = r[i + 2]),
        t.style &&
        ((t = t.style),
            (n = n == "show" ? "visible" : n == "hide" ? "hidden" : n)),
            (n = n == "hide" ? "hide" : n == "hide" ? "visible" : n),
            n == "none" || n == "block" ? (t.display = n) : (t.visibility = n));
}

function getIENumber() {
    var n = 0;
    try {
        return (
            document.all &&
            typeof document.documentMode != "undefined" &&
            (n = document.documentMode),
                n
        );
    } catch (t) {
        return (n = 0);
    }
}

function getNodeContent(n) {
    try {
        if (!n) return null;
        var t = n.textContent;
        return t ? t : n.text;
    } catch(e) {
        console.log('getNodeContent', e)
    }
}

function ShowCHWindow(n) {
    imagewidth = 460;
    imageheight = 55;
    x = 280;
    x = (screen.width - imagewidth) / 2;
    y = 1;
    oPopupBody = oPopup.document.body;
    oPopupBody.innerHTML = n;
    oPopupBody.style.cursor = "pointer";
    oPopupBody.title = "Hit to close";
    oPopupBody.onclick = dismisspopup;
    oPopupBody.oncontextmenu = dismisspopup;
    pop_TC = 40;
    pop();
}

function pop() {
    try {
        oPopup.show(x, y, imagewidth, imageheight);
        startani_A = setTimeout("pop()", 300);
        pop_TC < 0 && dismisspopup();
        pop_TC = pop_TC - 1;
    } catch (n) {
    }
}

function dismisspopup() {
    clearTimeout(startani_A);
    oPopup.hide();
}

function ShowCHWindow123(n) {
    document.getElementById("div_goal").innerHTML = n;
    document.getElementById("div_goal").style.display = "";
    document.getElementById("div_goal").style.left =
        document.body.parentElement.offsetWidth / 2 - 230 + "px";
    goal = 20;
    window.clearTimeout(goalTime);
    showTime();
}

function showTime(n) {
    if ((n == 1 && (goal = -1), goal < 0)) {
        document.getElementById("div_goal").innerHTML = "";
        document.getElementById("div_goal").style.display = "none";
        window.clearTimeout(goalTime);
        return;
    }
    goal -= 1;
    goalTime = window.setTimeout("showTime()", 1e3);
}

function convertIntToTimeText(n, i, r, u, f, e, o) {
    var s = new Date(n, i, r, u, f, e),
        h;
    t = ToLocalTime(s);
    h =
        "<span name='timeData' data-t='" +
        s +
        "' data-tf='14'>" +
        timeToText(ToLocalTime(s), 14) +
        "</span>";
    o == 1
        ? (h =
            "<span name='timeData' data-t='" +
            s +
            "' data-tf='6'>" +
            timeToText(ToLocalTime(s), 6) +
            "</span>")
        : o == 2
            ? (h =
                "<span name='timeData' data-t='" +
                s +
                "' data-tf='16'>" +
                timeToText(ToLocalTime(s), 16) +
                "</span>")
            : o == 3
                ? (h =
                    "<span name='timeData' data-t='" +
                    s +
                    "' data-tf='19'>" +
                    timeToText(ToLocalTime(s), 21) +
                    "</span>")
                : o == 4 &&
                (h =
                    "<span name='timeData' data-t='" +
                    s +
                    "' data-tf='19'>" +
                    timeToText(ToLocalTime(s), 19) +
                    "</span>");
    document.write(h);
}

function skipHtmlTagBoth(n) {
    return n != null && (n = n.replace(/<.*>.*<\/.*>/gi, "")), n;
}

function skipHtmlTag(n) {
    return n != null && (n = n.replace(/<[^>]+>/g, "")), n;
}

function isTouch() {
    return (
        /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent) ||
        /Android/i.test(navigator.userAgent)
    );
}

function OpenMobile() {
    CheckEmpty(_touchWebDomain) ||
    (_appModule == "Nir" ||
    _appModule == "Pt" ||
    _appModule == "World" ||
    _appModule == "Kor"
        ? window.open(_touchWebDomain + "?from=pc")
        : window.open(_touchWebDomain));
}

function OpenFreeApp() {
    CheckEmpty(_freeAppDomain) || window.open(_freeAppDomain);
}

function OpenFbSclass(n) {
    if (n == null || n == "" || n == 0) return !1;
    window.open(_footballWebDomain + toThaiUri('leagueinfo-pop-up') + "/" + n);
}

function goFbInfoRank(n, t = '') {
    n = toThaiSlug(n)
    if (n == null) return !1;
    if(t == 'SubLeague') window.open(_footballWebDomain + toThaiUri('subleastanding') + "/" + n);
    else window.open(_footballWebDomain + toThaiUri('leastanding') + "/" + n);
}

function goBkInfoRank(n) {
    if (n == null) return !1;
    window.open(_basketballWebDomain + toThaiUri('leastanding') + "/" + n);
}

function zXmlHttp() {
}

function GetLocalTime(n) {
    var t = n.split(","),
        i = new Date(t[0], t[1], t[2], t[3], t[4], t[5]);
    return new Date(
        Date.UTC(
            i.getFullYear(),
            i.getMonth(),
            i.getDate(),
            i.getHours(),
            i.getMinutes(),
            i.getSeconds()
        )
    );
}

function formatDate(n, t) {
    var u = "",
        r = n.split(","),
        i = new Date(r[0], eval(r[1]), r[2], r[3], r[4], r[5]);
    i = new Date(
        Date.UTC(
            i.getFullYear(),
            i.getMonth(),
            i.getDate(),
            i.getHours(),
            i.getMinutes(),
            i.getSeconds()
        )
    );
    u =
        t == 1
            ? timeToText(i, 13)
            : t == 2
                ? timeToText(i, 18)
                : t == 3
                    ? timeToText(i, 2)
                    : t == 4
                        ? timeToText(i, 4)
                        : t == 6
                            ? timeToText(i, 6)
                            : t == 7
                                ? timeToText(i, 7)
                                : t == 20
                                    ? timeToText(i, 20)
                                    : timeToText(i, 1);
    document.write(u);
}

function formatTime2(n) {
    var t = n.getHours(),
        i = n.getMinutes();
    return t < 10 && (t = "0" + t), i < 10 && (i = "0" + i), t + ":" + i;
}

function convertTime(n, t) {
    var i = t == 1 ? 1 : 0,
        n;
    return (
        n.indexOf(":") != -1 &&
        ((n = n.replace(/-/g, ",").replace(/\ /g, ",").replace(/:/g, ",")),
            (i = 1)),
            (n = n.split(",")),
            (n[1] = eval(n[1]) - i),
            new Date(n[0], n[1], n[2], n[3], n[4])
    );
}

function ParseTime(n, t) {
    var i = "",
        r = new Date(
            n.substr(0, 4),
            parseInt(n.substr(4, 2).replace(/0(\d)/, "$1")) - 1,
            n.substr(6, 2),
            n.substr(8, 2),
            n.substr(10, 2)
        ),
        u = new Date(r.getTime() + _timeZone * 36e5 - 288e5);
    return (t && (u = new Date(r.getTime() + _timeZone * 36e5)), (i = u), i)
        ? i
        : n;
}

function dateToTime(n) {
    return /(\d{2})-(\d{1,2})-(\d{1,2})([\s\d\:]*)/.test(n)
        ? ((n = ("20" + n).replaceAll("-", "/")), timeToText(new Date(n), 2))
        : n;
}

function timeToText(n, t) {
    t = t || 0;
    var i = [
        "dd-MM-yyyy hh:mm:ss",
        "dd-MM-yyyy hh:mm:ss",
        "dd-MM-yyyy",
        "dd-MM",
        "hh:mm",
        "t2 dd",
        "dd-MM hh:mm",
        "dd-MM-yy",
        "yyyy",
        "dd.MM.yyyy",
        "t2 dd hh:mm",
        "hh:mm,ww,dd-MM-yyyy",
        "dd-MM-yyyy(w)",
        "dd-MM-yyyy hh:mm w",
        "dd-MM hh:mm",
        "dd-MM hh:mm",
        "dd-MM-yy",
        "dd-MM-yyyy",
        "dd-MM-yyyy hh:mm",
        "d-M-yyyy hh:mm",
        "yyyy.MM.dd hh:mm",
        "M-d hh:mm",
        "dd t2 yyyy,hh:mm",
        "dd/MM/yyyy hh:mm",
    ];
    return dateFtt(i[t] || i[0], n);
}

function setTimeByFormat() {
    for (
        var n, r, i = document.querySelectorAll("[data-time]"), t = 0;
        t < i.length;
        t++
    )
        (n = i[t]),
            (r = getTimeByUtcStr(n.getAttribute("data-time"))),
            (n.innerHTML = timeToText(r, n.getAttribute("data-fmt")));
}

function setPublishTime() {
    $("[data-pubtime]").each(function () {
        var n = this.getAttribute("data-pubtime");
        this.innerHTML = publishTimeDesc(n, this.getAttribute("data-fmt"));
    });
}

function publishTimeDesc(n, t) {
    var f = null,
        e,
        u;
    f = n instanceof Date ? n : getTimeByUtcStr(n);
    e = -(new Date().getTimezoneOffset() / 60);
    u = getCookie("Time_Zone");
    u != undefined && u != "" && (e = u);
    var i = new Date(),
        o = new Date(
            i.getUTCFullYear(),
            i.getUTCMonth(),
            i.getUTCDate(),
            i.getUTCHours(),
            i.getUTCMinutes(),
            i.getUTCSeconds()
        ),
        s = new Date(o.getTime() + e * 36e5),
        h = _locModel.T.T_JustBefore || "Just now",
        c = _locModel.T.T_FM_HoursBefore || "{0} Hours Ago",
        l = _locModel.T.T_FM_MinutesBefore || "{0} Minutes Ago",
        r = (s - f) / 36e5;
    return r < 0.1
        ? h
        : r < 1
            ? l.replace("{0}", (parseFloat(r).toFixed(2) * 60).toFixed(0))
            : r < 24
                ? c.replace("{0}", parseInt(r))
                : timeToText(f, t);
}

function getTimeByUtcStr(n) {
    var i = splitTime(n),
        u = -(new Date().getTimezoneOffset() / 60),
        r = getCookie("Time_Zone"),
        t;
    return (
        r != undefined && r != "" && (u = r),
            (t = new Date(i[0], i[1], i[2], i[3], i[4], i[5])),
            (t = new Date(
                t.getFullYear(),
                t.getMonth(),
                t.getDate(),
                t.getHours(),
                t.getMinutes(),
                t.getSeconds()
            )),
            new Date(t.getTime() + u * 36e5)
    );
}

function splitTime(n) {
    var t = 0,
        n;
    return (
        n.indexOf(":") != -1 && ((n = n.replace(/(-|\s|:)/g, ",")), (t = 1)),
            (n = n.split(",")),
            (n[1] = eval(n[1]) - t),
            n
    );
}

function dateFtt(n, t) {
    var r, i;
    _hasInitDateFormat == 0 &&
    ((_months2 =
        typeof _locModel != "undefined" &&
        typeof _locModel.T.T_S_Jan != "undefined"
            ? [
                _locModel.T.T_S_Jan,
                _locModel.T.T_S_Feb,
                _locModel.T.T_S_Mar,
                _locModel.T.T_S_Apr,
                _locModel.T.T_S_May,
                _locModel.T.T_S_Jun,
                _locModel.T.T_S_Jul,
                _locModel.T.T_S_Aug,
                _locModel.T.T_S_Sep,
                _locModel.T.T_S_Oct,
                _locModel.T.T_S_Nov,
                _locModel.T.T_S_Dec,
            ]
            : [
                "Jan",
                "Feb",
                "Mar",
                "Apr",
                "May",
                "Jun",
                "Jul",
                "Aug",
                "Sep",
                "Oct",
                "Nov",
                "Dec",
            ]),
        (_weeks =
            typeof _locModel != "undefined" &&
            typeof _locModel.T.T_Sunday != "undefined"
                ? [
                    _locModel.T.T_Sunday,
                    _locModel.T.T_Monday,
                    _locModel.T.T_Tuesday,
                    _locModel.T.T_Wednesday,
                    _locModel.T.T_Thursday,
                    _locModel.T.T_Friday,
                    _locModel.T.T_Saturday,
                ]
                : [
                    "Sunday",
                    "Monday",
                    "Tuesday",
                    "Wednesday",
                    "Thursday",
                    "Friday",
                    "Saturday",
                ]),
        (_weeks2 =
            typeof _locModel != "undefined" &&
            typeof _locModel.T.T_S_Sunday != "undefined"
                ? [
                    _locModel.T.T_S_Sunday,
                    _locModel.T.T_S_Monday,
                    _locModel.T.T_S_Tuesday,
                    _locModel.T.T_S_Wednesday,
                    _locModel.T.T_S_Thursday,
                    _locModel.T.T_S_Friday,
                    _locModel.T.T_S_Saturday,
                ]
                : ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."]),
        (_hasInitDateFormat = 1));
    r = {
        "M+": t.getMonth() + 1,
        "d+": t.getDate(),
        "h+": t.getHours(),
        "m+": t.getMinutes(),
        "s+": t.getSeconds(),
        t1: _months[t.getMonth()],
        t2: _months2[t.getMonth()],
        "w+": _weeks[t.getDay()],
    };
    /(y+)/.test(n) &&
    (n = n.replace(
        RegExp.$1,
        (t.getFullYear() + "").substr(4 - RegExp.$1.length)
    ));
    for (i in r)
        new RegExp("(" + i + ")").test(n) &&
        (n = n.replace(
            RegExp.$1,
            RegExp.$1.length == 1 || /[tw]/.test(i)
                ? r[i]
                : ("00" + r[i]).substr(("" + r[i]).length)
        ));
    return n;
}

function ToLocalTime(n) {
    n = typeof n != "string" ? new Date(n) : new Date(n.replace(/-/g, "/"));
    return new Date(n.getTime() + _timeZone * 36e5);
}

function ServiceTimeToLocal(n) {
    return (localT = new Date(n * 1e3 - 288e5 + _timeZone * 36e5));
}

function checkExlink(n) {
    var i = "$",
        t;
    return n.indexOf(i) != -1
        ? ((t = n.split(i)), t.length == 3 ? t[0] + t[2] : t[0])
        : n;
}

function showExplain(n, t, i) {
    var r, f, u;
    return (
        (t = t.replace(/<[^>].*?>/g, "")),
            (i = i.replace(/<[^>].*?>/g, "")),
            (t = t.replace("(N)", "")),
            (i = i.replace("(N)", "")),
            (r = ""),
        n != "" &&
        n.indexOf("|") > -1 &&
        ((f = n.split("|")),
        f[1].split(";")[0] != "" &&
        ((r += _locModel.T.T_KickOff + "("),
            f[1].split(";")[0] == "1"
                ? (r += t + ")")
                : f[1].split(";")[0] == "2" && (r += i + ")")),
        f[1].split(";")[1] != "" &&
        window.location.href.toLowerCase().indexOf("asianbookie") ==
        -1 &&
        window.location.href.toLowerCase().indexOf("free") == -1 &&
        (f[1].split(";")[1] == "3" ||
            f[1].split(";")[1] == "4" ||
            f[1].split(";")[1] == "5") &&
        (r != "" && (r += "<br />"),
            (r +=
                "<a href=http://tv.nowgoal.com/ target=_blank><font class=blue>[Live TV]</font></a>")),
        f[2].split(";")[0] != "" &&
        (r != "" && (r += "<br />"),
            (r += _locModel.T.T_Corner + "(" + f[2].split(";")[0] + ") | "),
            (r += _locModel.T.T_Corner + "(" + f[2].split(";")[1] + ")")),
            (u = f[3].split(";")),
        u[0] != "" &&
        (r != "" && (r += "<br />"),
            (r +=
                u[0].split(",")[0] +
                _locModel.T.T_S_Minutes +
                "[" +
                u[0].split(",")[1] +
                "], "),
        u[1] != "" &&
        (r += _locModel.T.T_TwoRounds + "[" + u[1] + "], "),
        u[2] != "" &&
        (r +=
            u[2].split(",")[0] == "1"
                ? "120" +
                _locModel.T.T_S_Minutes +
                "[" +
                u[2].split(",")[1] +
                "], "
                : _locModel.T.T_ST_Ot +
                "[" +
                u[2].split(",")[1] +
                "], "),
        u[3] != "" &&
        (r += _locModel.T.T_Explain_Pen + "[" + u[3] + "], "),
        u[4] != "" &&
        (u[4] == "1"
            ? (r += t + " " + _locModel.T.T_Win)
            : u[4] == "2" && (r += i + " " + _locModel.T.T_Win)))),
            r
    );
}

function getTopHeight() {
    return document.documentElement && document.documentElement.scrollTop
        ? document.documentElement.scrollTop
        : document.body
            ? document.body.scrollTop
            : window.pageYOffset;
}

function getPageHeight() {
    var n = window.innerHeight;
    return (
        typeof pageWindth != "number" &&
        (n =
            document.compatMode == "CSS1Compat"
                ? document.documentElement.clientHeight
                : document.body.clientHeight),
            n
    );
}

function getElementPos(n, t) {
    var e = navigator.userAgent.toLowerCase(),
        l = e.indexOf("opera") != -1,
        a = e.indexOf("msie") != -1 && !l,
        i = document.getElementById(n),
        r,
        u,
        f,
        o,
        s,
        h,
        c;
    if (!i) return;
    if (i && (t && (i = t), i.parentNode === null || i.style.display == "none"))
        return !1;
    if (i && ((r = null), (u = []), i.getBoundingClientRect))
        return (
            (f = i.getBoundingClientRect()),
                (o = Math.max(
                    document.documentElement.scrollTop,
                    document.body.scrollTop
                )),
                (s = Math.max(
                    document.documentElement.scrollLeft,
                    document.body.scrollLeft
                )),
                {
                    x: f.left + s,
                    y: f.top + o,
                }
        );
    if (document.getBoxObjectFor)
        (f = document.getBoxObjectFor(i)),
            (h = i.style.borderLeftWidth
                ? parseInt(i.style.borderLeftWidth)
                : 0),
            (c = i.style.borderTopWidth ? parseInt(i.style.borderTopWidth) : 0),
            (u = [f.x - h, f.y - c]);
    else {
        if (((u = [i.offsetLeft, i.offsetTop]), (r = i.offsetParent), r != i))
            while (r)
                (u[0] += r.offsetLeft),
                    (u[1] += r.offsetTop),
                    (r = r.offsetParent);
        (e.indexOf("opera") != -1 ||
            (e.indexOf("safari") != -1 && i.style.position == "absolute")) &&
        ((u[0] -= document.body.offsetLeft),
            (u[1] -= document.body.offsetTop));
    }
    for (
        r = i.parentNode ? i.parentNode : null;
        r && r.tagName != "BODY" && r.tagName != "HTML";
    )
        (u[0] -= r.scrollLeft),
            (u[1] -= r.scrollTop),
            (r = r.parentNode ? r.parentNode : null);
    return {
        x: u[0],
        y: u[1],
    };
}

function returnTop() {
    var t = getTopHeight(),
        i = document.documentElement.scrollHeight || document.body.scrollHeight,
        r = document.documentElement.clientHeight || document.body.clientHeight,
        u = i - t - r,
        f = document.getElementById("backTop"),
        n = document.getElementById("toBottom");
        if (!f) return;
    f.style.display = t > 150 ? "" : "none";
    u == 0 && n ? (n.style.display = "none") : n && (n.style.display = "");
    setTimeout("returnTop();", 100);
}

function GetHandicapType() {
    var n = 1,
        t = getCookie("Handicap_Type");
    return t && (n = parseInt(t)), n;
}

function initHandicap() {
    _handicapType = GetHandicapType();
    _handicapType <= _handicapTypeArray.length &&
    ((_handicapGive = _handicapTypeArray[_handicapType - 1].split("/")[0]),
        (_handicapAccept =
            _handicapTypeArray[_handicapType - 1].split("/")[1]));
}

function Goal2GoalCn(n) {
    if ((!n && n != "0") || isNaN(n)) return "";
    if (n > 14) return _handicapGive + Math.abs(n);
    if (n < -14) return _handicapAccept + Math.abs(n);
    var t = Math.abs(parseInt(n * 4));
    return n >= 0
        ? GoalCn[t].replace("{0}", _handicapGive)
        : GoalCn[t].replace("{0}", _handicapAccept);
}

function Goal2GoalCn2(n) {
    return Goal2GoalCn(n);
}

function Goal2CnOU(n) {
    return (!n && n != "0") || isNaN(n)
        ? ""
        : n > 14 || n < -14
            ? _ouTrimEndZero
                ? parseFloat(n).toString()
                : n
            : GoalCnOU[Math.abs(parseInt(n * 4))];
}

function Goal2Num(n) {
    var t, i;
    return typeof n == "undefined"
        ? ""
        : !isNaN(n) || n.indexOf("/") == -1
            ? parseFloat(n)
            : ((t = !1),
            n.indexOf("-") > -1 && (t = !0),
                (n = n.replace("+", "").replace("-", "")),
                (i = n.split("/")),
                (n = (parseFloat(i[0]) + parseFloat(i[1])) / 2),
                t ? 0 - n : n);
}

function insertAfter(n, t) {
    var i = t.parentNode;
    i.lastChild == t ? i.appendChild(n) : i.insertBefore(n, t.nextSibling);
}

function IsMobile() {
    return navigator.userAgent.toLowerCase().indexOf("android") != -1 ||
    navigator.userAgent.toLowerCase().indexOf("iphone") != -1 ||
    navigator.userAgent.toLowerCase().indexOf("mobile") != -1
        ? !0
        : !1;
}

function showCountDefer() {
    var n, t;
    if (!_cnzzLoaded) {
        for (
            n = document.getElementById("allCnzz"),
                n.removeChild(n.firstChild),
                t = 0;
            t < _cnzzUrls.length;
            t++
        )
            addScript(n, _cnzzUrls[t]);
        _cnzzLoaded = !0;
    }
}

function addScript(n, t) {
    var i = document.createElement("script");
    i.src = t;
    n.appendChild(i, "script");
}

function GetBasketState(n, t) {
    var i;
    switch (n) {
        case -5:
            i = _locModel.T.T_ST_Postp;
            break;
        case -4:
            i = _locModel.T.T_ST_Cancel;
            break;
        case -3:
            i = "<font class=blue>" + _locModel.T.T_ST_Interrupt + "</font>";
            break;
        case -2:
            i = "<font class=blue>" + _locModel.T.T_ST_Pend + "</font>";
            break;
        case -1:
            i = "<strong class=red>" + _locModel.T.T_ST_Finish + "</strong>";
            break;
        case 0:
            i = "&nbsp;";
            break;
        case 1:
            i = _locModel.T.T_ST_Qtr1;
            break;
        case 2:
            i = _locModel.T.T_ST_Qtr2;
            break;
        case 3:
            i = t == 2 ? _locModel.T.T_ST_Qtr1 : _locModel.T.T_ST_Qtr3;
            break;
        case 4:
            i = _locModel.T.T_ST_Qtr4;
            break;
        case 5:
            i = _locModel.T.T_ST_Ot;
            break;
        case 6:
            i = _locModel.T.T_ST_Ot;
            break;
        case 7:
            i = _locModel.T.T_ST_Ot;
            break;
        case 50:
            i = _locModel.T.T_ST_Halftime;
    }
    return i;
}

function OpenBkSclass(n) {
    if (n == null || n == "" || n == 0) return !1;
    window.open(`/${toThaiUri("basketball")}/${toThaiUri("leagueinfo")}/${n}` );
}

function getQueryVariable(n) {
    for (
        var i, u = window.location.search.substring(1), r = u.split("&"), t = 0;
        t < r.length;
        t++
    )
        if (((i = r[t].split("=")), i[0] == n)) return i[1];
    return !1;
}

function HashMap() {
    var t = 0,
        n = {};
    this.isEmpty = function () {
        return t == 0;
    };
    this.containsKey = function (t) {
        return t in n;
    };
    this.containsValue = function (t) {
        for (var i in n) if (n[i] == t) return !0;
        return !1;
    };
    this.put = function (i, r) {
        this.containsKey(i) || t++;
        n[i] = r;
    };
    this.get = function (t) {
        return this.containsKey(t) ? n[t] : null;
    };
    this.remove = function (i) {
        this.containsKey(i) && delete n[i] && t--;
    };
    this.values = function () {
        var t = [];
        for (var i in n) t.push(n[i]);
        return t;
    };
    this.keySet = function () {
        var t = [];
        for (var i in n) t.push(i);
        return t;
    };
    this.size = function () {
        return t;
    };
    this.clear = function () {
        t = 0;
        n = {};
    };
}

function MonitorError() {
    var n, t, i;
    getQueryVariable("mode") == "debug" &&
    ((n = getQueryVariable("report")),
        (window.onerror = function (t) {
            n == 1 && alert("运行异常" + t);
        }),
        window.addEventListener(
            "error",
            function (t) {
                var i = t.target.src || t.target.href;
                i && n == 1 && alert("资源加载异常:" + i);
            },
            !0
        ),
        (t = 0),
        (i = 0),
        window.addEventListener("ajaxReadyStateChange", function (r) {
            var u = r.detail,
                e = u.status,
                f = u.readyState;
            f === 1 && (t = new Date().getTime());
            f === 4 && (i = new Date().getTime() - t);
            f === 4 &&
            (e === 200 || (n == 1 && alert("异常接口：" + u.responseURL)));
        }));
}

function addLoadEvent(n) {
    var t = window.onload;
    window.onload =
        typeof onload != "function"
            ? n
            : function () {
                t();
                n();
            };
}

function NoDataHtml(n) {
    return n == 2
        ? "<div class='DataTips'>" + _locModel.T.T_Tip_NoMatch + "</div>"
        : "<div class='DataTips'>" + _locModel.T.T_Tip_NoData + "</div>";
}

function LoadDark() {
    var n = getCookie("dark_mode") == null ? dark_mode : getCookie("dark_mode");
    GetSession("dark_mode") != null &&
    GetSession("dark_mode") != "" &&
    (n = GetSession("dark_mode"));
    document.getElementsByTagName("body").length > 0
        ? n != null && n == 1
            ? (document.getElementsByTagName("body")[0].classList.add("dark"),
            document.getElementById("flash") != null &&
            window.frames.flash.contentWindow.document.body.classList.add(
                "dark"
            ))
            : (document
                .getElementsByTagName("body")[0]
                .classList.remove("dark"),
            document.getElementById("flash") != null &&
            window.frames.flash.contentWindow.document.body.classList.remove(
                "dark"
            ))
        : addLoadEvent(LoadDark);
}

function SwithcDark(id = '') {
    document.getElementById("DarkModeCheck" + id).checked ? (dark_mode = 1,
        writeShareCookie("dark_mode", 1)) : (dark_mode = 0,
        writeShareCookie("dark_mode", 0));
    LoadDark()
}

function SyncDarkCheck() {
    var n = getCookie("dark_mode");
    n == null && (n = dark_mode);
    n == 1 &&
    document.getElementById("DarkModeCheck") &&
    (document.getElementById("DarkModeCheck").checked = !0);
    document.getElementById("DarkModeCheck") &&
    (document.getElementById("DarkModeCheck").style.display = "");

    // document.getElementById("DarkModeCheck1") &&
    // (document.getElementById("DarkModeCheck1").checked = !0);
    // document.getElementById("DarkModeCheck1") &&
    // (document.getElementById("DarkModeCheck1").style.display = "");
}

function setGoalCnFormat(n) {
    var t, r, i;
    if (
        n != null &&
        ((t = document.querySelectorAll("#" + n + " [data-o]")),
        t != null && t.length != 0)
    )
        for (r = 0; r < t.length; r++)
            (i = t[r]),
            (!i.innerHTML.trim() || i.getAttribute("data-o")) &&
            ((t2 = Goal2GoalCn(i.getAttribute("data-o"))),
                (i.innerHTML = t2));
}

function CheckEmpty(n) {
    return typeof n != "undefined" && n != "undefined" && n && /[^\s]/.test(n)
        ? !1
        : !0;
}

function BomHelper() {
    this.ie = "";
    this.firefox = "";
    this.chrome = "";
    this.opera = "";
    this.safari = "";
    this.operaMini = "";
    this.uc = "";
    this.ios = "";
    this.android = {};
    this.pc = "";
    this.kv = function (n, t, i) {
        return {
            key: n,
            value: t,
            opt: i || 1,
        };
    };
}

function GetAvatar(n) {
    // addScript(document.head, n + ssoAvataUrl);
}

function LoginSuccess() {
    RefreshIcon();
}

function RefreshIcon() {
    window.ssoContent &&
    document.getElementById("login_icon") &&
    (document.getElementById("login_icon").innerHTML = ssoContent);
}

function escapeChar(n = '') {
    return n.replace(/\'/g, "&acute;");
}

function createXml(n) {
    if (document.all) {
        var t = new ActiveXObject("Microsoft.XMLDOM");
        return t.loadXML(n), t;
    }
    return new DOMParser().parseFromString(n, "text/xml");
}

function oddsCompare(n, t) {
    n = n ? n.toString() : "";
    t = t ? t.toString() : "";
    var i = parseFloat(n),
        r = parseFloat(t);
    return (n &&
    n.indexOf("/") != -1 &&
    (i =
        ((n.indexOf("-") == -1 ? 1 : -1) *
            (parseFloat(n.replace("-", "").split("/")[0]) +
                parseFloat(n.replace("-").split("/")[1]))) /
        2),
    n &&
    n.indexOf("/") != -1 &&
    (r =
        ((t.indexOf("-") == -1 ? 1 : -1) *
            (parseFloat(t.replace("-", "").split("/")[0]) +
                parseFloat(t.replace("-").split("/")[1]))) /
        2),
    r > i)
        ? 1
        : r == i
            ? 0
            : -1;
}

function showDate(n, t, i, r, u, f) {
    var e = new Date(n, t, i, r, u, f),
        o = timeToText(ToLocalTime(e), 6);
    document.write(
        "<span name='timeData' data-t='" + e + "' data-tf='6'>" + o + "</span>"
    );
}

function getDate(n) {
    var t = n.split(","),
        i = new Date(t[0], eval(t[1]), t[2], t[3], t[4], t[5]);
    return timeToText(ToLocalTime(i), 6);
}

function openLqEuroDetail(n, t, i) {
    var r = "/nba/oddsdetail/" + n + "?cid=" + t + "&company=" + i;
    window.open(
        r,
        "",
        "width=470,height=280,top=40,left=100,resizable=yes,scrollbars=yes"
    );
}

function switchSlide(n) {
    $(n).hasClass("on") ? $(n).removeClass("on") : $(n).addClass("on");
}

function loadCnzz(n, t) {
    return false;
    var i = [],
        r,
        f,
        u;
    switch (n) {
        case "Go":
            t == "free"
                ? i.push(
                    "https://hm.baidu.com/hm.js?998b4b916882edc0b2b7eecec94104bc"
                )
                : t == "predictions"
                    ? i.push(
                        "https://hm.baidu.com/hm.js?b8888b32680b36c8a4374c5047fa543c"
                    )
                    : i.push(
                        "https://hm.baidu.com/hm.js?0693021a2027f4cca3f49d3f0f20e6f9"
                    );
            break;
        case "Ida":
            t == "free"
                ? i.push(
                    "https://hm.baidu.com/hm.js?b453f8eb63705a9582189c42424c81cc"
                )
                : i.push(
                    "https://hm.baidu.com/hm.js?c57fe7914ae690ea33f8205d3335dc8a"
                );
            break;
        case "Jpn":
            if (t == "free") return;
            i.push(
                "https://hm.baidu.com/hm.js?d1e718dd70673d07769bdac0f7241fbc"
            );
            break;
        case "Kor":
            i.push(
                "https://hm.baidu.com/hm.js?e1d9c0df9e35f494323ddfbd82277559"
            );
            break;
        case "Ng":
            t == "free"
                ? i.push(
                    "https://hm.baidu.com/hm.js?5efd491623b40b873bd358921a98b9bd"
                )
                : t == "sixMix" ||
                t == "euroOdds" ||
                t == "threeMix" ||
                t == "odds1x2"
                    ? i.push(
                        "https://hm.baidu.com/hm.js?1e9081fdbfab81573ecb13c42dd9e8f9"
                    )
                    : _isForApp
                        ? i.push(
                            "https://hm.baidu.com/hm.js?0499887593fd8230bf848b7c44fd119e"
                        )
                        : i.push(
                            "https://hm.baidu.com/hm.js?0394be8d23ef30dfa25c2fe6e78fb15b"
                        );
            break;
        case "Thai":
            t == "free"
                ? i.push(
                    "https://hm.baidu.com/hm.js?722573e28f7b9fe1e4843285f3fb4a63"
                )
                : i.push(
                    "https://hm.baidu.com/hm.js?5242f9b8ab7db0f4fb2b72ebcf095aee"
                );
            break;
        case "Vn":
            t == "free"
                ? new RegExp(_freeWebDomain).test(window.location.href)
                    ? i.push(
                        "https://hm.baidu.com/hm.js?3f405e68a1a8c3348551dc65a89f0306"
                    )
                    : i.push(
                        "https://hm.baidu.com/hm.js?67778a0cf669a83a8081aaf63738c3b5"
                    )
                : i.push(
                    "https://hm.baidu.com/hm.js?b4b4d38d2acca9743375d67d21b194a8"
                );
            break;
        case "World":
            t == "predictions"
                ? i.push(
                    "https://hm.baidu.com/hm.js?0e27f55c02dc467b819204ca7e286ba0"
                )
                : t == "free"
                    ? i.push(
                        "https://hm.baidu.com/hm.js?170d50b4a6c6e3e00a4fbbfd24d60725"
                    )
                    : i.push(
                        "https://hm.baidu.com/hm.js?34970a8b45866cac1c2ae248660974c5"
                    );
            break;
        case "Ind":
        case "Bola":
            t == "free" || window.location.href.indexOf("www.bola020.com") != -1
                ? i.push(
                    "https://hm.baidu.com/hm.js?611ef76c4b99cc9da7339458b2f9bc46"
                )
                : _isForApp
                    ? i.push(
                        "https://hm.baidu.com/hm.js?2e4cc9113426365bc3c2ebfd27fce3bb"
                    )
                    : i.push(
                        "https://hm.baidu.com/hm.js?5e4861e04471e78ba4af68975b6af418"
                    );
            break;
        case "Nir":
            t == "free"
                ? i.push(
                    "https://hm.baidu.com/hm.js?7173e8d8c8c94580389082a913743d2f"
                )
                : (i.push(
                    "https://hm.baidu.com/hm.js?5e57a19f98fab5a2a034f00fdaf64fb6"
                ),
                    i.push(
                        "https://hm.baidu.com/hm.js?359753d0aad1733a2908c43cc83a4055"
                    ));
            break;
        case "Pt":
            i.push(
                "https://hm.baidu.com/hm.js?b82accf27f602aaa0e2e7c440c842596"
            );
    }
    for (r = 0; r < i.length; r++)
        (f = i[r]),
            (u = document.createElement("script")),
            (u.type = "text/javascript"),
            (u.src = f),
            document.getElementById("tongji").appendChild(u);
    typeof cnzzModel != "undefined" && loadIndexCnzz(cnzzModel);
}

function loadIndexCnzz(n) {
    return false;
    var t = [],
        i,
        u,
        r;
    switch (n.module) {
        case "Go":
            n.cnz == -1
                ? t.push(
                    "https://hm.baidu.com/hm.js?89e7c8fbaf5d3d647e8267c796214602"
                )
                : n.cnz == -2
                    ? t.push(
                        "https://hm.baidu.com/hm.js?be3d23ad34a80aa2d7fe820105848b5c"
                    )
                    : n.cnz == -4
                        ? t.push(
                            "https://hm.baidu.com/hm.js?a1898b075645f60b6b656697f0ecc72e"
                        )
                        : n.cnz == 6
                            ? t.push(
                                "https://hm.baidu.com/hm.js?ed3f9af9720f8f11df24c7a594c89d82"
                            )
                            : n.cnz == 7 &&
                            t.push(
                                "https://hm.baidu.com/hm.js?4959af1b23b133597f91a3d99b943431"
                            );
            break;
        case "Ida":
            n.cnz == 1
                ? t.push(
                    "https://hm.baidu.com/hm.js?be3874681be7fd94603c09bbb5d04be6"
                )
                : n.cnz == 2
                    ? t.push(
                        "https://hm.baidu.com/hm.js?5e69d3987154d1434cdd4ccefe45ebeb"
                    )
                    : n.cnz == 3 &&
                    t.push(
                        "https://hm.baidu.com/hm.js?e7a24a8c086976f4e9efc2cbc6017c27"
                    );
            break;
        case "Kor":
            n.cnz == 1
                ? t.push(
                    "https://hm.baidu.com/hm.js?76886a99e4d07d579205cf483c1ac0ec"
                )
                : n.cnz == 3
                    ? t.push(
                        "https://hm.baidu.com/hm.js?2e782eadb331abe8c556e6a0b03fb638"
                    )
                    : n.cnz == 2
                        ? t.push(
                            "https://hm.baidu.com/hm.js?c1f99c0939d137dcd06db203adbeac28"
                        )
                        : n.cnz == 5
                            ? t.push(
                                "https://hm.baidu.com/hm.js?28187798fb5056b75f4f6fcf15ff590f"
                            )
                            : n.cnz == 6
                                ? t.push(
                                    "https://hm.baidu.com/hm.js?a928fc54952aecdcae36d692d516cdc9"
                                )
                                : n.cnz == 7
                                    ? t.push(
                                        "https://hm.baidu.com/hm.js?726f34cb18edad66a912d365da3ad5f1"
                                    )
                                    : n.cnz == 10 &&
                                    t.push(
                                        "https://hm.baidu.com/hm.js?b4da2c5b3c074f7fa8800a6b1700de3b"
                                    );
            break;
        case "Ng":
            n.cnz == 6
                ? t.push(
                    "https://hm.baidu.com/hm.js?8bccb0280e3f6ed086fc60f37fb42c63"
                )
                : n.cnz == 7
                    ? t.push(
                        "https://hm.baidu.com/hm.js?309c5fee5a5f7abfb08c52029eaf7135"
                    )
                    : n.cnz == 8
                        ? t.push(
                            "https://hm.baidu.com/hm.js?0e233d88fc68bc0203927c2840545095"
                        )
                        : n.cnz == 9 &&
                        t.push(
                            "https://hm.baidu.com/hm.js?2458232562f01b7712d92a58b35ff09d"
                        );
            break;
        case "Thai":
            n.cz == 1 &&
            t.push(
                "https://hm.baidu.com/hm.js?3fb77540779d1ff6153767ddc5ed5243"
            );
            n.cnz == 2
                ? t.push(
                    "https://hm.baidu.com/hm.js?6dc9d98b51001ed19d9760b287ff2059"
                )
                : n.cnz == 3
                    ? t.push(
                        "https://hm.baidu.com/hm.js?ea63e7f36511012fc5858668e320f54d"
                    )
                    : n.cnz == 5
                        ? t.push(
                            "https://hm.baidu.com/hm.js?ad9a96dc1790b9a7fffdf6f71322f355"
                        )
                        : n.cnz == 4
                            ? t.push(
                                "https://hm.baidu.com/hm.js?e18b755289da9b979ea4a390719eaefd"
                            )
                            : n.cnz == 6 &&
                            t.push(
                                "https://hm.baidu.com/hm.js?94f139dcf25e0d0511bfc5efc9bd6889"
                            );
            break;
        case "Vn":
            n.cnz == 1
                ? t.push(
                    "https://hm.baidu.com/hm.js?e64df6d433b87cb740880b71374a8f01"
                )
                : n.cnz == 2
                    ? t.push(
                        "https://hm.baidu.com/hm.js?dfc496f39b81c8cb572c350b0c5ed77c"
                    )
                    : n.cnz == 5
                        ? t.push(
                            "https://hm.baidu.com/hm.js?4042853ae3eee9357aed73a139fbbd8b"
                        )
                        : n.cnz == 6
                            ? t.push(
                                "https://hm.baidu.com/hm.js?4a2b53d70e4dc33e09c954a95739972e"
                            )
                            : n.cnz == 7
                                ? t.push(
                                    "https://hm.baidu.com/hm.js?5e4a1a935f66b75172bc7590a0224b99"
                                )
                                : n.cnz == 8
                                    ? t.push(
                                        "https://hm.baidu.com/hm.js?d43cb098a34cb0a1cee6a753b97c660e"
                                    )
                                    : n.cnz == 11
                                        ? t.push(
                                            "https://hm.baidu.com/hm.js?409a3ff81b1c90846c081427452e88bc"
                                        )
                                        : n.cnz == 12 &&
                                        t.push(
                                            "https://hm.baidu.com/hm.js?c59b6cd3cc99dcc40a1de5e635feafcd"
                                        );
            break;
        case "World":
            n.cnz == 1
                ? t.push(
                    "https://hm.baidu.com/hm.js?ffea2cc0b30dc483aa3ca25f479d4058"
                )
                : (n.cnz == 2 || n.cnz == -2) &&
                t.push(
                    "https://hm.baidu.com/hm.js?bf80e82c45ec28d38b89b2591460838c"
                );
            break;
        case "Ind":
        case "Bola":
            n.cnz == 1
                ? t.push(
                    "https://hm.baidu.com/hm.js?8f6e7f68435a93e0a5f3c09531005a05"
                )
                : n.cnz == 2
                    ? t.push(
                        "https://hm.baidu.com/hm.js?59f42b11489917270bdae335f62fece9"
                    )
                    : n.cnz == 3 &&
                    t.push(
                        "https://hm.baidu.com/hm.js?b6bbe9dd615a9f236f288dd42e7a5f73"
                    );
            break;
        case "Pt":
            n.cnz == 2
                ? t.push(
                    "https://hm.baidu.com/hm.js?d535ebac9082d881242e11c3b099093f"
                )
                : n.cnz == 3 &&
                t.push(
                    "https://hm.baidu.com/hm.js?6b92ff5bd5d8037ae9fa57e3619f5ea9"
                );
    }
    for (i = 0; i < t.length; i++)
        (u = t[i]),
            (r = document.createElement("script")),
            (r.type = "text/javascript"),
            (r.src = u),
            document.getElementById("tongji").appendChild(r);
}

function cancelBubble(n) {
    var t = n ? n : window.event;
    t && (window.event ? (t.cancelBubble = !0) : t.stopPropagation());
}

function handleBackFromBf2(n) {
    var t = location.href;
    if (t.indexOf('?returnurl=') === -1) {
        location.href = n + "?returnurl=" + t;
    }
}

function settingDiff() {
}

function departmentDiff() {
    switch (_appModule) {
        case "Ng":
        case "Vn":
        case "Kor":
        case "Ida":
            return !0;
        case "Go":
        case "Thai":
        case "Ind":
            return !1;
    }
    return !0;
}

function loadStatsCode() {
}

function buildTags(n, t) {
    return n.replace(/\{\$(\w+)\}/g, function (n, i) {
        return i in t ? t[i] : "";
    });
}

// function countFavMatch() {
//     $("#favCount")[0] &&
//         (CheckEmpty(Config.getFavMatchIds() + Config.getFavTeamIds())
//             ? ($("#favCount").html(""), $("#favCount").removeClass("fav_count"))
//             : $.ajax({
//                   url: "/football/api/base/fav-ids",
//                   method: "get",
//                   success: function (n) {
//                       var i = JSON.parse(n),
//                           t;
//                       if (i.ErrCode != -1 && !CheckEmpty(i.Data)) {
//                           var r = i.Data.id.split(","),
//                               e = i.Data.hid.split(","),
//                               o = i.Data.gid.split(","),
//                               u = 0,
//                               s = Config.getFavMatchIds(),
//                               f = Config.getFavTeamIds();
//                           if (r != null && r.length > 0)
//                               for (t = 0; t < r.length; t++)
//                                   (s.contains(r[t]) ||
//                                       f.contains(e[t]) ||
//                                       f.contains(o[t])) &&
//                                       u++;
//                           u == 0
//                               ? ($("#favCount").html(""),
//                                 $("#favCount").removeClass("fav_count"))
//                               : u > 99
//                               ? ($("#favCount").html("99+"),
//                                 $("#favCount").addClass("fav_count"))
//                               : ($("#favCount").html(u),
//                                 $("#favCount").addClass("fav_count"));
//                       }
//                   },
//               }),
//         clearTimeout(_counFavMatchTimmer),
//         (_counFavMatchTimmer = window.setTimeout("countFavMatch()", 3e4)));
// }
function countFavMatch() {
    try {
        var favCount = $("#favCount")[0];
        var favCountMb = $(".favCount-mobile")[0];

        if (favCount || favCountMb) {
            // if (CheckEmpty(Config.getFavMatchIds() + Config.getFavTeamIds() + Config.getFavLeagueIds())) {
            if (CheckEmpty(Config.getFavMatchIds())) {
                if (favCount) {
                    $("#favCount").html("");
                    $("#favCount").removeClass("fav_count");
                }
                if (favCountMb) {
                    $(".favCount-mobile").html("");
                    $(".favCount-mobile").removeClass("fav_count");
                }
            } else {
                $.ajax({
                    url: "/ajax/FavAjax?type=4",
                    method: "post",
                    success: function (n) {
                        var i = JSON.parse(n), t;

                        if (i.ErrCode != -1 && !CheckEmpty(i.Data)) {
                            var r = i.Data.id.split(",")
                            let e = i.Data.hid.split(",")
                            let o = i.Data.gid.split(",")
                            let u = 0
                            let matchs = s = Config.getFavMatchIds()
                            let leagues = f = Config.getFavLeagueIds()
                            const teams = Config.getFavTeamIds();

                            const total = matchs.length // + leagues.length + teams.length
                            if (total == 0) {
                                if (favCount) {
                                    $("#favCount").html("");
                                    $("#favCount").removeClass("fav_count");
                                }
                                if (favCountMb) {
                                    $(".favCount-mobile").html("");
                                    $(".favCount-mobile").removeClass("fav_count");
                                }
                            } else if (total > 99) {
                                if (favCount) {
                                    $("#favCount").html("99+");
                                    $("#favCount").addClass("fav_count");
                                }
                                if (favCountMb) {
                                    $(".favCount-mobile").html("99+");
                                    $(".favCount-mobile").addClass("fav_count");
                                }
                            } else {
                                if (favCount) {
                                    $("#favCount").html(total);
                                    $("#favCount").addClass("fav_count");
                                }
                                if (favCountMb) {
                                    $(".favCount-mobile").html(total);
                                    $(".favCount-mobile").addClass("fav_count");
                                }
                            }
                        }
                    }
                });
            }
            clearTimeout(_counFavMatchTimmer);
            _counFavMatchTimmer = window.setTimeout("countFavMatch()", 3e4);
        }
    } catch (error) {}
}

function mathOdds(odds) {
    // if (_oddsType != 1) return odds
    // if (odds > 1) return (-1/odds).toFixed(2);
    return odds
}

function countLqFavMatch() {
    _$("favCount") &&
    (CheckEmpty(LqConfig.getFavMatchIds() + LqConfig.getFavTeamIds())
        ? ($("#favCount").html(""), $("#favCount").removeClass("fav_count"))
        : $.ajax({
            url: "/ajax/FavAjax?type=14",
            method: "post",
            success: function (n) {
                var i = JSON.parse(n),
                    t;
                if (i.ErrCode != -1 && !CheckEmpty(i.Data)) {
                    var r = i.Data.id.split(","),
                        e = i.Data.hid.split(","),
                        o = i.Data.gid.split(","),
                        u = 0,
                        s = LqConfig.getFavMatchIds(),
                        f = LqConfig.getFavTeamIds();
                    if (r != null && r.length > 0)
                        for (t = 0; t < r.length; t++)
                            (s.contains(r[t]) ||
                                f.contains(e[t]) ||
                                f.contains(o[t])) &&
                            u++;
                    u == 0
                        ? ($("#favCount").html(""),
                            $("#favCount").removeClass("fav_count"))
                        : u > 99
                            ? ($("#favCount").html("99+"),
                                $("#favCount").addClass("fav_count"))
                            : ($("#favCount").html(u),
                                $("#favCount").addClass("fav_count"));
                }
            },
        }),
        clearTimeout(_counFavMatchTimmer),
        (_counFavMatchTimmer = window.setTimeout("countLqFavMatch()", 3e4)));
}

function getUTCTime() {
    const n = new Date();
    return new Date(n.getTime() + n.getTimezoneOffset() * 6e4);
}

function handleCutZero(n) {
    var i = n.toString();
    let t = i,
        r = i.length - i.indexOf(".") - 1;
    if (i.indexOf(".") > -1)
        for (let n = r; n > 0; n--)
            if (t.lastIndexOf("0") > -1 && t.substr(t.length - 1, 1) == 0) {
                let n = t.lastIndexOf("0");
                if (t.charAt(n - 1) == ".") return t.substring(0, n - 1);
                t = t.substring(0, n);
            } else return t;
    return i;
}

function switchShowHide(n) {
    if (_$(n)) {
        var t = $("#" + n);
        t.is(":hidden") ? t.show() : t.hide();
    }
}

function appendUrlParameter(n, t, i) {
    var r = document.createElement("a"),
        f,
        u;
    return (
        (r.href = n),
            (f = r.search.length > 0),
            f
                ? ((u = new URLSearchParams(r.search)),
                    u.set(t, i),
                    (r.search = u.toString()))
                : (r.search = "?" + t + "=" + i),
            r.href
    );
}

function appOpenBrowserUrl(n) {
    return appendUrlParameter(n, "openbrowser", "1");
}

function SetOddType(n) {
    writeShareCookie("Odds_Type", n);
}

function GetOddType() {
    var t = _defaultOddsType,
        n = getCookie("Odds_Type");
    return (
        !n == null ||
        n == "" ||
        n == undefined ||
        isNaN(n) ||
        (t = parseInt(n)),
            t
    );
}

function SetTimeZone(n) {
    writeShareCookie("Time_Zone", n);
    writeShareCookie("Default_TimeZone", n);
}

function GetTimeZone() {
    var i = 0 - new Date().getTimezoneOffset() / 60,
        t = i,
        n = getCookie("Time_Zone");
    return (
        n == null ||
        n == "" ||
        n == undefined ||
        isNaN(n) ||
        (t = parseFloat(n)),
            writeCookie("Default_TimeZone", t),
            t
    );
}

function showHideLocale(o) {
    var locale = document.getElementById('ddLocale');
    var isHide = locale.style.display == "none";
    if (isHide) {
        locale.style.display = "";

    } else {
        locale.style.display = "none";
    }
}


function initSetting() {
    var r = document.getElementById("selectedOddsType"),
        u = document.getElementById("oddsType_" + _oddsType),
        n,
        t,
        i;
    if (
        (r && u && (r.innerText = u.innerText),
            (n = document.getElementById("selectedTimeZone")),
            (t = getCookie("Time_Zone")),
        n && (t == null || t == ""))
    ) {
        // Default GMT +7. Get innerText của GMT +7 để set vào selectedTimeZone
        n.innerText = document.getElementById("timeZone_7").innerText;
        return;
    }
    i = document.getElementById("timeZone_" + _timeZone);
    n && n && i && (n.innerText = i.innerText);
}

function overDropDownBG(n) {
    n.style.backgroundColor = "#226204";
}

function leaveDropDownBG(n) {
    n.style.backgroundColor = "";
}

function changeTopTimeZone(n) {
    var t, i;
    (_timeZone !== n ||
        document.getElementById("selectedTimeZone").innerText ==
        document.getElementById("timeZone_auto").innerText) &&
    ((t = n === ""),
    t && (SetTimeZone(""), (n = GetTimeZone())),
        (i = t ? "timeZone_auto" : "timeZone_" + n),
        (document.getElementById("selectedTimeZone").innerText =
            document.getElementById(i).innerText),
        (_timeZone = parseFloat(n)),
    t || SetTimeZone(n),
        changeTimeZone(),
        setTimeByFormat(),
        setPublishTime());
    if (window.triggerHandleFetchGMT) window.triggerHandleFetchGMT();
    if (window.handleGetData) window.handleGetData();
}

function changeTopOddsType(n) {
    if (_oddsType != n) {
        document.getElementById("selectedOddsType").innerText = document.getElementById("oddsType_" + n).innerText
        _oddsType = parseInt(n)
        SetOddType(n)
        changeOddsType()
        window.triggerHandleFetchData()
    }
}

function changeTimeZone() {
    for (
        var n, r, t, u = document.getElementsByName("timeData"), i = 0;
        i < u.length;
        i++
    )
        ((n = u[i]), (r = n.getAttribute("data-t")), r) &&
        ((t = n.getAttribute("data-tf")),
        t || (t = "0"),
            (n.innerText = timeToText(ToLocalTime(r), parseInt(t))));
}

function changeOddsType() {
    for (
        var n, i, u, r = document.getElementsByName("oddsData"), t = 0;
        t < r.length;
        t++
    )
        ((n = r[t]), (i = n.getAttribute("data-o")), i) &&
        ((u = n.getAttribute("data-e") == !0),
            (n.innerText = oTool.changePL(_oddsType, i, u)));
}

function showHideTimeZone(n, classexcluded = 'chooseTimeZone1') {
    var t = document.getElementById("ddlTimeZone"),
        i = t.style.display == "none";
    i
        ? (document.getElementById("chooseOddsType") != null &&
        (document.getElementById("chooseOddsType").className =
            "Choose-tool"),
        document.getElementById("ddlOddsType") != null &&
        (document.getElementById("ddlOddsType").style.display = "none"),
            (n.className = "Choose-tool on "  + classexcluded),
            (t.style.display = ""))
        : ((n.className = "Choose-tool " + classexcluded), (t.style.display = "none"));

    if(i && document.getElementById("ddLocale") !== null) {
        document.getElementById("ddLocale").style.display = "none";
    }
}

function showHideOddsType(n) {
    var t = document.getElementById("ddlOddsType"),
        i = t.style.display == "none";
    i
        ? ((document.getElementById("chooseTimeZone").className =
            "Choose-tool"),
            (document.getElementById("ddlTimeZone").style.display = "none"),
            (n.className = "Choose-tool on"),
            (t.style.display = ""))
        : ((n.className = "Choose-tool"), (t.style.display = "none"));

      if (i && document.getElementById("ddLocale") !== null) {
          document.getElementById("ddLocale").style.display = "none";
      }
}

function showHideLangueWebSite(n) {
    var t = document.getElementById("ddlBolaWebSite"),
        i = t.style.display == "none";
    i
        ? ((document.getElementById("chooseTimeZone").className =
            "Choose-tool"),
            (document.getElementById("ddlTimeZone").style.display = "none"),
            (document.getElementById("chooseOddsType").className = "Choose-tool"),
            (document.getElementById("ddlOddsType").style.display = "none"),
        document.getElementById("chooseBolaWebSite") &&
        ((document.getElementById("chooseBolaWebSite").className =
            "Choose-tool"),
            (document.getElementById("ddlBolaWebSite").style.display =
                "none")),
            (n.className = "Choose-tool on"),
            (t.style.display = ""))
        : ((n.className = "Choose-tool"), (t.style.display = "none"));
}

function GotoLangueWebSite(n, t, i) {
    writeShareCookie("bolaValInt", n);
    window.location.href = t + i;
}

function checkHide(n) {
    var c = document.getElementById("selectedOddsType"),
        l = document.getElementById("selectedTimeZone"),
        a = document.getElementById("selectedBolaWebSite"),
        v = document.getElementById("countryImg"),
        r = document.getElementById("ddlOddsType"),
        u = document.getElementById("ddlTimeZone"),
        f = document.getElementById("ddlBolaWebSite"),
        e = document.getElementById("chooseOddsType"),
        o = document.getElementById("chooseTimeZone"),
        s = document.getElementById("chooseBolaWebSite"),
        i = $("#switchLeagueBlock").find(".pop")[0],
        y = $("#switchLeagueBlock").find(".btn")[0],
        h = $("#switchVersion").find(".pop")[0],
        p = $("#switchVersion").find(".btn")[0],
        w = r != null ? r.style.display == "none" : "",
        b = u != null ? u.style.display == "none" : "",
        k = f != null ? f.style.display == "none" : "",
        d = i != null ? i.style.display == "none" : "",
        t;
    (w && b && k && d) ||
    (((t = n.srcElement),
        t != c &&
        t != l &&
        t != a &&
        t != v &&
        t != e &&
        t != o &&
        t != e &&
        t != s &&
        t != i &&
        t != y &&
        t != h &&
        t != p &&
        (t == t.tagName) != "I") &&
        (r && (r.style.display = "none"),
        u && (u.style.display = "none"),
        f && (f.style.display = "none"),
        i &&
        ((i.style.display = "none"),
            writeCookie(
                _leagueBlock.tipCookie,
                1,
                new Date(new Date().getTime() + 864e5)
            )),
        h &&
        ((h.style.display = "none"),
            writeShareCookie(
                _soccerInpageTipCookie,
                1,
                new Date(new Date().getTime() + 31536e6)
            )),
        e && (e.className = "Choose-tool"),
        o && (o.className = "Choose-tool"),
        s && (s.className = "Choose-tool")));
}

function getBkHdpDetailUrl(n, t, i, r) {
    return (
        _basketballWebDomain +
        "team/handicapdetail?sclassid=" +
        n +
        "&teamid=" +
        t +
        "&matchseason=" +
        i +
        "&halforall=" +
        r
    );
}

function getBkOuDetailUrl(n, t, i, r) {
    return (
        _basketballWebDomain +
        "team/ouhandicapdetail?sclassid=" +
        n +
        "&teamid=" +
        t +
        "&matchseason=" +
        i +
        "&halforall=" +
        r
    );
}

function getBkTeamUrl(n) {
    return _basketballWebDomain + `${toThaiUri('team')}/${toThaiUri('summary')}/` + n;
}

function openBkTeam(n) {
    window.open(getBkTeamUrl(n));
}

function getFbTeamUrl(n) {
    console.log("🚀 ~ getFbTeamUrl ~ n:", n)
    return _footballWebDomain + toThaiUri('team') +"/"+toThaiUri('summary')+"/" + n;
}

function openFbTeam(n) {
    console.log("🚀 ~ getFbTeamUrl ~ n:", n)

    // window.open(getFbTeamUrl(n));
}

function getFbPanluUrl(n, t) {
    var i = "/soccer/oddsstats/" + n;
    return typeof t != "undefined" && t != "" && (i += "?cid=" + t), i;
}

function openFbPanlu(n, t) {
    window.open(
        getFbPanluUrl(n, t),
        "",
        "scrollbars=yes,resizable=yes,width=662, height=650,left=50,top=100"
    );
}

function getHistoryCornerUrl(n) {
    return "/history/corner/" + n;
}

function openHistoryCornerUrl(n) {
    window.open(getHistoryCornerUrl(n));
}

function getBk2in1OddsUrl(n, t, i) {
    var r = "/2in1odds/" + n + "?t=" + t;
    return i && (r += "&cid=" + i), r;
}

function getBkOddsDetail(n, t, i) {
    var r = "/nba/oddsdetail/" + n + "?cid=" + t;
    return i && (r += "&flag=" + i), r;
}

function getFb1x2OddsHistory(n, t, i, r, u) {
    return (
        "/ty-le-1x2/" +
        n +
        "?cid=" +
        t +
        "&company=" +
        i.replaceAll(" ", "").toLowerCase() +
        "&r1=" +
        r.replaceAll(" ", "").toLowerCase() +
        "&r2=" +
        u.replaceAll(" ", "").toLowerCase()
    );
}

function getEuroOddsUrl(n, t) {
    return (
        "/football/1x2/?id=" +
        n +
        "&company" +
        t.replace("Mansion88.com", "M88")
    );
}

function openTreeMix() {
}

function getLeaUrl(n) {
    return _footballWebDomain + toThaiUri('leagueinfo') + "/" + n;
}

function openLeaUrl(n, t) {
    window.open(getLeaUrl(n, t));
}

function getMatchTipsUrl(n) {
    return _cmsWebDomain + toThaiUri('football') + "/" + toThaiUri('match') + "/" + match  + n;
}

function openMatchTipsUrl(n) {
    window.open(getMatchTipsUrl(n));
}

function getBkLeaUrl(n) {
    return _basketballWebDomain + toThaiUri('leagueinfo') + "/" + n;
}

function openBkLeaUrl(n) {
    window.open(getBkLeaUrl(n));
}

function GetFilterOption() {
    return 1;
}

function GetOrderbyOption() {
    return "time";
}

function convertToSlug(text) {
    return text
        .toLowerCase()                      // Convert to lowercase
        .trim()                             // Remove leading and trailing whitespace
        .replace(/[\s_]+/g, '-')            // Replace spaces and underscores with a hyphen
        .replace(/[^\w\-]+/g, '')           // Remove all non-word characters
        .replace(/\-\-+/g, '-');            // Replace multiple hyphens with a single hyphen
}

const tlt = typeof _locModel != "undefined" &&
        typeof _locModel.T.T_TIL_DataComparison != "undefined" ?  _locModel.T.T_TIL_DataComparison  : 'So sánh số liệu';
var _mainWebDomain = window.config.url,
    _livescoreWebDomain = "/",
    _dataWebDomain = "/data/",
    _basketballWebDomain = "/basketball/",
    _footballWebDomain = window.config.url + toThaiUri('football') + "/",
    _cmsWebDomain = "/tips/",
    _infoWebDomain = "/" + toThaiUri('football') + "/",
    _touchWebDomain = "/mobi/",
    _freeWebDomain = "/free/",
    _freeAppDomain = "/app/",
    _domain = "thscore",
    _tail = "vip",
    _defaultOddsType = "1",
    _defaultTimeZone = "8",
    _leagueNameIdx = "8",
    _isNewOddsTxt = "1",
    _upDownColorType = "1",
    _oddsOrder = "1-2-3",
    _moduleKey = "Thai",
    _websocket = !0,
    _wsUrl = "www.thscore.to:9800",
    _cdnWebDomain = "//img_cms.thscore.fun/",
    _substationType = 0,
    _isForApp = !1,
    ICONFONT = {
        DETAIL: "<i class='icon iconfont icon-icon-detail'></i>",
        LINEUP: "<i class='icon iconfont icon-font-lineup'></i>",
        ANALYSIS: "<i class='icon iconfont icon-analysis'></i>",
        ODDS: `<i title='${tlt}' class='icon iconfont icon-odds '></i>`,
        FLASH: "<i class='icon iconfont icon-matchdata'></i>",
        FLASH_V2: "<img src='/images/football-vn/btn-live-v2.svg' alt='btn-live-v2.svg' />",
        FLASHON: "<i class='icon iconfont icon-matchdata on'></i>",
        BASKETBALL: "<i class='icon iconfont icon-font-basketballclass'></i>",
        HIGHLIGHT: "<i class='icon iconfont icon-icon-live1'></i>",
        FLASH_LQ: "<i class='icon iconfont icon-b-ant-on'></i>",
        FLASHON_LQ: "<i class='icon iconfont icon-b-ant-on on'></i>",
        FAV_MATCH:
            "<i id='favM_{$MatchID}' mid='{$MatchID}' class='icon iconfont icon-font-collect-off add-info favM'></i>",
        FAV_LEAGUE:
            "<i id='favL_{$LeagueID}' lid='{$LeagueID}' class='icon iconfont icon-font-collect-off add-info-l l0 favL'></i>",
    },
    ODDSTYPE = {
        NONE: 0,
        AH: 1,
        OP: 2,
        OU: 3,
        CORNEROU: 4,
        BODAN: 5,
        EUROAH: 6,
        DOUBLECHANCE: 7,
    },
    LQHANDICAP,
    headtime,
    timeZone,
    startani_C,
    startani_A,
    startani_B,
    pop_TC,
    oPopup,
    goal,
    goalTime,
    zXml,
    X2,
    _cnzzLoaded,
    _cnzzUrls,
    dark_mode,
    bomHelper,
    ssoAvataUrl,
    _share,
    _counFavMatchTimmer,
    Storage,
    _oddsType,
    _timeZone,
    wsUtil;
Object.freeze(ODDSTYPE);
LQHANDICAP = {
    FIRST: 1,
    SECOND: 2,
    HALF: 3,
    THREE: 4,
    FOUR: 5,
    FULL: 6,
    RUNNING: 7,
};
Object.freeze(LQHANDICAP);
headtime = new Date();
timeZone = new Date().getTimezoneOffset() / -60;
try {
    oPopup = window.createPopup();
} catch (e) {
}
goal = 0;
zXml = {
    useActiveX: typeof ActiveXObject != "undefined",
    useXmlHttp: typeof XMLHttpRequest != "undefined",
};
zXml.ARR_XMLHTTP_VERS = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
zXmlHttp.createRequest = function () {
    if (zXml.useXmlHttp) return new XMLHttpRequest();
    if (zXml.useActiveX) {
        if (!zXml.XMLHTTP_VER)
            for (var n = 0; n < zXml.ARR_XMLHTTP_VERS.length; n++)
                try {
                    new ActiveXObject(zXml.ARR_XMLHTTP_VERS[n]);
                    zXml.XMLHTTP_VER = zXml.ARR_XMLHTTP_VERS[n];
                    break;
                } catch (t) {
                }
        if (zXml.XMLHTTP_VER) return new ActiveXObject(zXml.XMLHTTP_VER);
    }
    alert(
        "Sorry，XML object unsupported by your computer,please setup XML object or change explorer."
    );
};
var _months2 =
        typeof _locModel != "undefined" &&
        typeof _locModel.T.T_S_Jan != "undefined"
            ? [
                _locModel.T.T_S_Jan,
                _locModel.T.T_S_Feb,
                _locModel.T.T_S_Mar,
                _locModel.T.T_S_Apr,
                _locModel.T.T_S_May,
                _locModel.T.T_S_Jun,
                _locModel.T.T_S_Jul,
                _locModel.T.T_S_Aug,
                _locModel.T.T_S_Sep,
                _locModel.T.T_S_Oct,
                _locModel.T.T_S_Nov,
                _locModel.T.T_S_Dec,
            ]
            : [
                "Jan",
                "Feb",
                "Mar",
                "Apr",
                "May",
                "Jun",
                "Jul",
                "Aug",
                "Sep",
                "Oct",
                "Nov",
                "Dec",
            ],
    _months = [
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "August",
        "September",
        "October",
        "November",
        "December",
    ],
    _weeks =
        typeof _locModel != "undefined" &&
        typeof _locModel.T.T_Sunday != "undefined"
            ? [
                _locModel.T.T_Sunday,
                _locModel.T.T_Monday,
                _locModel.T.T_Tuesday,
                _locModel.T.T_Wednesday,
                _locModel.T.T_Thursday,
                _locModel.T.T_Friday,
                _locModel.T.T_Saturday,
            ]
            : [
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thursday",
                "Friday",
                "Saturday",
            ],
    _weeks2 =
        typeof _locModel != "undefined" &&
        typeof _locModel.T.T_S_Sunday != "undefined"
            ? [
                _locModel.T.T_S_Sunday,
                _locModel.T.T_S_Monday,
                _locModel.T.T_S_Tuesday,
                _locModel.T.T_S_Wednesday,
                _locModel.T.T_S_Thursday,
                _locModel.T.T_S_Friday,
                _locModel.T.T_S_Saturday,
            ]
            : ["Sun.", "Mon.", "Tue.", "Wed.", "Thu.", "Fri.", "Sat."],
    _hasInitDateFormat = 0;
Array.prototype.contains = function (n) {
    for (var t = this.length; t--;) if (this[t] == n) return !0;
    return !1;
};
Array.prototype.indexOf ||
(Array.prototype.indexOf = function (n) {
    var i = this.length >>> 0,
        t = Number(arguments[1]) || 0;
    for (
        t = t < 0 ? Math.ceil(t) : Math.floor(t), t < 0 && (t += i);
        t < i;
        t++
    )
        if (t in this && this[t] === n) return t;
    return -1;
});
window.ActiveXObject ||
(HTMLElement.prototype.insertAdjacentElement = function (n, t) {
    if (t)
        switch (n) {
            case "beforeBegin":
                this.parentNode.insertBefore(t, this);
                break;
            case "afterBegin":
                this.insertBefore(t, this.firstChild);
                break;
            case "beforeEnd":
                this.appendChild(t);
                break;
            case "afterEnd":
                this.nextSibling
                    ? this.parentNode.insertBefore(t, this.nextSibling)
                    : this.parentNode.appendChild(t);
        }
});
X2 = {};
X2.Eval = function (n) {
    window.attachEvent && !window.opera ? execScript(n) : window.eval(n);
};
var FloatHelper = {
        DecimalLength: function (n) {
            var t = n.toString().split(/[eE]/),
                i = (t[0].split(".")[1] || "").length - Number(t[1] || 0);
            return i > 0 ? i : 0;
        },
        Operator: function (n, t, i) {
            var f = this.DecimalLength(n),
                e = this.DecimalLength(t),
                u = Math.max(f, e),
                r = Math.pow(10, u);
            switch (i) {
                case "*":
                case 2:
                    u = f + e;
                    rv =
                        (n * Math.pow(10, f) * t * Math.pow(10, e)) /
                        Math.pow(10, u);
                    break;
                case "/":
                case 3:
                    u < 3 && (u = 3);
                    rv = (n * r) / (t * r);
                    break;
                case "%":
                case 4:
                    rv = ((n * r) % (t * r)) / r;
                    break;
                case "-":
                case 1:
                    rv = (n * r - t * r) / r;
                    break;
                default:
                    rv = (n * r + t * r) / r;
            }
            return parseFloat(rv.toFixed(u));
        },
    },
    oTool = {
        USJson: {
            0.22: -450,
            0.28: -350,
            0.33: -300,
            0.36: -275,
            0.38: -267,
            0.44: -225,
            0.47: -212.5,
            0.53: -187.5,
            0.57: -175,
            0.62: -162.5,
            0.63: -160,
            0.66: -150,
            0.72: -137.5,
            0.83: -120,
            0.88: -114,
            0.91: -110,
            0.95: -105,
        },
        fractionJson: {
            0.22: "2/9",
            0.28: "2/7",
            0.33: "1/3",
            0.36: "4/11",
            0.38: "3/8",
            0.44: "4/9",
            0.47: "40/85",
            0.53: "8/15",
            0.57: "4/7",
            0.62: "8/13",
            0.63: "5/8",
            0.66: "4/6",
            0.72: "8/11",
            0.83: "5/6",
            0.88: "7/8",
            0.91: "10/11",
            0.95: "20/21",
        },
        getPL: function (n, t, i, r, u) { //u => euro (1x2)
            if (u && n != 3 && n != "3" && n != 6 && n != "6")
                return [
                    this.toFixZero(t),
                    this.toFixZero(i),
                    this.toFixZero(r),
                ];
            if (!u) {
                t = mathOdds(t)
                r = mathOdds(r)
            }
            switch (n) {
                case 1:
                case "1":
                    return [t, i, r];
                case 2:
                case "2":
                    return u ? [t, i, r] : [this.toIN(t), i, this.toIN(r)];
                case 3:
                case "3":
                    return u
                        ? [this.toUSEu(t), this.toUSEu(i), this.toUSEu(r)]
                        : [this.toUS(t), i, this.toUS(r)];
                case 4:
                case "4":
                    return [this.toEU(t), i, this.toEU(r)];
                case 5:
                case "5":
                    return u ? [t, i, r] : [this.toML(t), i, this.toML(r)];
                case 6:
                case "6":
                    return u
                        ? [
                            this.toFractionEu(t),
                            this.toFractionEu(i),
                            this.toFractionEu(r),
                        ]
                        : [this.toFraction(t), i, this.toFraction(r)];
            }
        },
        changePL: function (n, t, i) {
            if (!parseFloat(t)) return t;
            if (i && n != 3 && n != "3" && n != 6 && n != "6")
                return this.toFixZero(t);
            switch (n) {
                case 1:
                case "1":
                    return this.toFixZero(t);
                case 2:
                case "2":
                    return this.toIN(t);
                case 3:
                case "3":
                    return i ? this.toUSEu(t) : this.toUS(t);
                case 4:
                case "4":
                    return this.toEU(t);
                case 5:
                case "5":
                    return this.toML(t);
                case 6:
                case "6":
                    return i ? this.toFractionEu(t) : this.toFraction(t);
            }
        },
        toIN: function (n) {
            if (!n) return "";
            var t = parseFloat(n),
                i = this.countDecimal(t) > 2 ? 3 : 2;
            if (t === 0) {
                return t
            } else if (t < 1) {
                return (0 - 1 / t).toFixed(i)
            } else {
                return this.toFixZero(n)
            }
        },
        toML: function (n) {
            if (!n) return "";
            var t = parseFloat(n),
                i = this.countDecimal(t) > 2 ? 3 : 2;
            return t > 1 ? (0 - 1 / t).toFixed(i) : this.toFixZero(n);
        },
        toEU: function (n) {
            if (!n) return "";
            var t = parseFloat(n),
                i = this.countDecimal(t) > 2 ? 3 : 2;
            return (t + 1).toFixed(i);
        },
        toUS: function (n) {
            var i;
            if (!n) return "";
            var t = parseFloat(n),
                u = this.countDecimal(t) > 2 ? 3 : 2,
                r = oTool.USJson;
            return t in r
                ? r[t]
                : ((i = 0),
                    (i =
                        t <= 0
                            ? 0
                            : t < 1
                                ? Math.round(0 - 100 * (1 / t).toFixed(u))
                                : Math.round(100 * t)),
                    i > 0 ? "+" + i : i);
        },
        toUSEu: function (n) {
            var t, u, r, i;
            return n
                ? ((t = parseFloat(n)),
                    (u = this.countDecimal(t) > 2 ? 3 : 2),
                !t || isNaN(t))
                    ? ""
                    : ((t = FloatHelper.Operator(t, 1, "-")),
                        (r = oTool.USJson),
                    t in r)
                        ? r[t]
                        : t == 0
                            ? "0"
                            : ((i = 0),
                                (i =
                                    t < 1
                                        ? Math.round(0 - 100 * (1 / t).toFixed(u))
                                        : Math.round(100 * t)),
                                i > 0 ? "+" + i : i)
                : "";
        },
        toFraction: function (n) {
            var t = parseFloat(n),
                r,
                i,
                u,
                f,
                e;
            if (t.toString() == "NaN") return "";
            if (
                ((r = t < 0),
                r && (t = Math.abs(t)),
                    (i = {
                        n: 0,
                        m: 1,
                    }),
                    (u = 0),
                t > 1 && (t = FloatHelper.Operator(t, (u = t | 0), "-")),
                    (f = oTool.fractionJson),
                t in f)
            )
                (e = f[t].split("/")),
                    (i.n = parseInt(e[0])),
                    (i.m = parseInt(e[1]));
            else if (t > 0) {
                var s = function (n, t) {
                        return t == 0 ? n : s(t, n % t);
                    },
                    o = Math.pow(10, FloatHelper.DecimalLength(t)),
                    h = parseInt(t * o),
                    c = s(o, h);
                i.n = h / c;
                i.m = o / c;
            }
            return (r ? "-" : "") + (u * i.m + i.n) + "/" + i.m;
        },
        toFractionEu: function (n) {
            var t = parseFloat(n),
                r,
                i,
                u,
                f,
                e;
            if (t.toString() == "NaN") return "";
            if (
                ((t = FloatHelper.Operator(t, 1, "-")),
                    (r = t < 0),
                r && (t = Math.abs(t)),
                    (i = {
                        n: 0,
                        m: 1,
                    }),
                    (u = 0),
                t > 1 && (t = FloatHelper.Operator(t, (u = t | 0), "-")),
                    (f = oTool.fractionJson),
                t in f)
            )
                (e = f[t].split("/")),
                    (i.n = parseInt(e[0])),
                    (i.m = parseInt(e[1]));
            else if (t > 0) {
                var s = function (n, t) {
                        return t == 0 ? n : s(t, n % t);
                    },
                    o = Math.pow(10, FloatHelper.DecimalLength(t)),
                    h = parseInt(t * o),
                    c = s(o, h);
                i.n = h / c;
                i.m = o / c;
            }
            return (r ? "-" : "") + (u * i.m + i.n) + "/" + i.m;
        },
        toFixZero: function (n, t) {
            t || (t = this.countDecimal(n) > 2 ? 3 : 2);
            var i = parseFloat(n);
            return i.toString() == "NaN" ? n : i.toFixed(t);
        },
        countDecimal: function (n) {
            var t = ("" + n).match(/\.(\d+)$/);
            return t === null ? 0 : t[1].length;
        }
    },
    _handicapTypeArray = ["/-", "+/-", "/*", "让/受让"],
    _handicapType = 1,
    _handicapAccept = "-",
    _handicapGive = "",
    _ouTrimEndZero = !0,
    GoalCn = [
        "0",
        "0/{0}0.5",
        "{0}0.5",
        "{0}0.5/1",
        "{0}1",
        "{0}1/1.5",
        "{0}1.5",
        "{0}1.5/2",
        "{0}2",
        "{0}2/2.5",
        "{0}2.5",
        "{0}2.5/3",
        "{0}3",
        "{0}3/3.5",
        "{0}3.5",
        "{0}3.5/4",
        "{0}4",
        "{0}4/4.5",
        "{0}4.5",
        "{0}4.5/5",
        "{0}5",
        "{0}5/5.5",
        "{0}5.5",
        "{0}5.5/6",
        "{0}6",
        "{0}6/6.5",
        "{0}6.5",
        "{0}6.5/7",
        "{0}7",
        "{0}7/7.5",
        "{0}7.5",
        "{0}7.5/8",
        "{0}8",
        "{0}8/8.5",
        "{0}8.5",
        "{0}8.5/9",
        "{0}9",
        "{0}9/9.5",
        "{0}9.5",
        "{0}9.5/10",
        "{0}10",
        "{0}10/10.5",
        "{0}10.5",
        "{0}10.5/11",
        "{0}11",
        "{0}11/11.5",
        "{0}11.5",
        "{0}11.5/12",
        "{0}12",
        "{0}12/12.5",
        "{0}12.5",
        "{0}12.5/13",
        "{0}13",
        "{0}13/13.5",
        "{0}13.5",
        "{0}13.5/14",
        "{0}14",
    ],
    GoalCnOU = [
        "0",
        "0/0.5",
        "0.5",
        "0.5/1",
        "1",
        "1/1.5",
        "1.5",
        "1.5/2",
        "2",
        "2/2.5",
        "2.5",
        "2.5/3",
        "3",
        "3/3.5",
        "3.5",
        "3.5/4",
        "4",
        "4/4.5",
        "4.5",
        "4.5/5",
        "5",
        "5/5.5",
        "5.5",
        "5.5/6",
        "6",
        "6/6.5",
        "6.5",
        "6.5/7",
        "7",
        "7/7.5",
        "7.5",
        "7.5/8",
        "8",
        "8/8.5",
        "8.5",
        "8.5/9",
        "9",
        "9/9.5",
        "9.5",
        "9.5/10",
        "10",
        "10/10.5",
        "10.5",
        "10.5/11",
        "11",
        "11/11.5",
        "11.5",
        "11.5/12",
        "12",
        "12/12.5",
        "12.5",
        "12.5/13",
        "13",
        "13/13.5",
        "13.5",
        "13.5/14",
        "14",
    ];
initHandicap();
_cnzzLoaded = !1;
_cnzzUrls = [];
dark_mode =
    getQueryVariable("darkmode") != !1 ? getQueryVariable("darkmode") : 0;
BomHelper.prototype.checkBrowerType = function () {
    for (
        var u = navigator.userAgent.toLowerCase(),
            i,
            n,
            r = [
                this.kv("ie", /msie ([\d.]+)/),
                this.kv("qq", /qq\/([\d.]+)/i),
                this.kv("firefox", /firefox\/([\d.]+)/i),
                this.kv("uc", /ucbrowser\/([\d.]+)/i),
                this.kv("operaMini", /opera[\s]mini.([\d.]+)/i),
                this.kv("opera", /opera[\s]mini.([\d.]+)/i),
                this.kv("chrome", /chrome\/([\d.]+)/i),
                this.kv("crios", /crios\/([\d.]+)/i),
                this.kv("safari", /version\/([\d.]+).*safari/i),
            ],
            t = 0;
        t < r.length;
        t++
    )
        if (((n = r[t]), (i = u.match(n.value)))) {
            this[n.key] = i[1];
            break;
        }
};
BomHelper.prototype.checkPlatform = function (n) {
    var t = navigator.userAgent.toLowerCase(),
        r,
        u,
        i;
    if (/(iphone|ipad|ipod|ios)/i.test(t))
        this.ios = (n = t.match(/(?:iphone|ipad|itouch).* os (\d+)_[\d]/))
            ? n[1]
            : "1";
    else if (/android/i.test(t)) {
        for (
            this.android.version = (n = t.match(/(?:android) ([\d\.]+);/))
                ? n[1]
                : "1",
                u = [
                    this.kv("huawei", /(huawei|honorbln)/i),
                    this.kv("oppo", /oppo/i),
                    this.kv("vivo", /vivo/i),
                    this.kv("xiaomi", /(miui|xiaomi)/i),
                    this.kv("meizu", /;[\s]+mz-/i),
                    this.kv("original", /android/),
                ],
                i = 0;
            i < u.length;
            i++
        )
            if (((r = u[i]), (n = t.match(r.value)))) {
                this.android[r.key] = 1;
                break;
            }
    } else this.pc = "pc";
};
BomHelper.prototype.ajaxObj = function () {
    var n = null;
    if (this.ie != "") {
        if (typeof ActiveXObject != "undefined") return new XMLHttpRequest();
        try {
            n = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (t) {
            try {
                n = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (i) {
                try {
                    n = new XMLHttpRequest();
                } catch (t) {
                    alert(
                        "创建ajax对象失败,本网站只支持ie6以上版本浏览器,请刷新页面重试"
                    );
                }
            }
        }
    } else
        try {
            n = new XMLHttpRequest();
        } catch (i) {
            alert("创建ajax对象失败,请刷新页面重试");
        }
    return n;
};
BomHelper.prototype.ajaxGet = function (n, t, i) {

    i == undefined && (i = !0);
    var r = this.ajaxObj();
    r.onreadystatechange = function () {
        r.readyState == 4 && t(r.responseText);
    };
    n =
        n.indexOf("?") == -1
            ? n + "?flesh=" + Math.random()
            : n + "&flesh=" + Math.random();
    r.open("GET", n, i);
    r.send(null);
};
BomHelper.prototype.ajaxPost = function (n, t, i) {
    var r = this.ajaxObj();
    r.onreadystatechange = function () {
        r.readyState == 4 && i(r.responseText);
    };
    t = t == "" ? t + "flesh=" + Math.random() : t + "&flesh=" + Math.random();
    r.open("POST", n, !0);
    r.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    r.send(t);
};
BomHelper.prototype.ajaxXml = function (n, t, i) {
    var r = this.ajaxObj();
    r.onreadystatechange = function () {
        r.readyState == 4 && i(r.responseXML, r.responseText);
    };
    n =
        n.indexOf("?") == -1
            ? n + "?flesh=" + Math.random()
            : n + "&flesh=" + Math.random();
    r.open("GET", n, t);
    r.send(null);
};
BomHelper.prototype.useIE7 = function () {
    document.write(
        '<meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible">'
    );
};
bomHelper = new BomHelper();
bomHelper.checkBrowerType();
bomHelper.checkPlatform();
String.prototype.Trim = function () {
    return this.replace(/(^\s*)|(\s*$)/g, "");
};
ssoAvataUrl = "/sso/ssologinpcjs/";
_share = {
    facebook: function (n, t) {
        var i = n || location.href,
            r = t || "";
        window.open(
            "https://www.facebook.com/sharer.php?u=" +
            encodeURIComponent(i) +
            "&t=" +
            encodeURIComponent(r)
        );
    },
    twitter: function (n, t) {
        var i = n || location.href,
            r = t || "";
        window.open(
            "https://twitter.com/share/?text=" +
            encodeURIComponent(r) +
            "&url=" +
            _share.encodeUrlWithUnicode(i)
        );
    },
    telegram: function (n, t) {
        var i = n || location.href,
            r = t || "";
        window.open(
            "https://t.me/share/url?url=" +
            _share.encodeUrlWithUnicode(i) +
            "&text=" +
            encodeURIComponent(r)
        );
    },
    blogger: function (n, t) {
        var i = n || location.href,
            r = t || "";
        window.open(
            "https://share.naver.com/web/shareView.nhn?url=" +
            encodeURIComponent(i) +
            "&title=" +
            encodeURIComponent(_share.trim(t, location.host))
        );
    },
    encodeUrlWithUnicode: function (n) {
        for (
            var r = /([\u0100-\uFFFF]+)/g, i = n.split(r), u = "", t = 0;
            t < i.length;
            t++
        )
            u += r.test(i[t])
                ? encodeURIComponent(encodeURIComponent(i[t]))
                : encodeURIComponent(i[t]);
        return u;
    },
    trim: function (n) {
        var t = arguments[arguments.length - 1];
        return n ? n.replace(/^\s+|\s+$/gm, "") || t : t;
    },
};
function getTvLinkTxtUrl(n) {
    var t = "/gf/tvlive/tvlive_fn_fb.txt?";
    switch (n) {
    case "Vn":
        t = "/gf/tvlive/tvlive_vn_fb.txt?";
        break;
    case "Thai":
        t = "/gf/tvlive/tvlive_th_fb.txt?";
        break;
    case "Ng":
    case "Bola":
        t = "/gf/tvlive/tvlive_en_fb.txt?";
        break;
    case "Kor":
        t = "/gf/tvlive/tvlive_kr_fb.txt?"
    }
    return t
}
var soccerInPage = {
        prefix: `/${toThaiUri('football')}/`,
        isSummary: function (n, t, i, r) {
            return typeof checkInpageVersion == "function" &&
            checkInpageVersion(n, t, i, r) == 1
                ? !0
                : !1;
        },
        gethost: function () {
            return _mainWebDomain.substr(0, _mainWebDomain.length - 1);
        },
        customDetail: function (n, t, i, u = '', customHost = '', type = 'live') {
            window.open(
                `${customHost}/${toThaiUri('match')}/${toThaiUri(type)}-${toThaiSlug(t)}-${toThaiSlug(i)}-${n}`,
                u ? "_self" : ""
            );
        },
        detail: function (n, t, i, r, u) {

            if (window.match_detail_url){
                let slugDt = `${toThaiSlug(t)}-${toThaiSlug(o)}-${n}`;
                window.open(window.match_detail_url + "/" + slugDt);
            }
            this.isSummary(n, t, i, u) ||
            window.open(
                `${this.gethost()}/${toThaiUri('match')}/${toThaiUri('live')}-${toThaiSlug(t)}-${toThaiSlug(i)}-${n}`,
                u ? "_self" : ""
            );
        },
        detailUrl: function (n, t, i, r, u) {
            return `${this.gethost()}/${toThaiUri('match')}/${toThaiUri('live')}-${toThaiSlug(t)}-${toThaiSlug(i)}-${n}`
        },
        gameratelUrl: function (n, t, i, r, leagueIndex) {
            return `${this.gethost()}/${toThaiUri('gamerate')}/${n}?leagueindex=${leagueIndex || 0}`;
        },
        analysis: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                `${this.gethost()}/${toThaiUri('match')}/${toThaiUri('h2h')}-${toThaiSlug(t)}${toThaiSlug(i)}-${n}`,
                u ? "_self" : ""
            );
        },
        analysisUrl: function (n, t, i, r, u) {
            return `${this.gethost()}/${toThaiUri('match')}/${toThaiUri('h2h')}-${toThaiSlug(t)}${toThaiSlug(i)}-${n}`
        },
        gamerate: function (n, t, i, r, leagueIndex) {
            // this.isSummary(n, t, i) ||
            // window.open(
            //     `${this.gethost()}/${toThaiUri('gamerate')}/${n}?leagueindex=${leagueIndex}`,
            //     "_self"
            // );
            if (_iframe){
                window.open(
                    `${this.gethost()}/${toThaiUri('gamerate')}/${n}?leagueindex=${leagueIndex || 0}`,
                    "_blank"
                );
            }
            window.location.href=`${this.gethost()}/${toThaiUri('gamerate')}/${n}?leagueindex=${leagueIndex || 0}`
        },
        oddscomp: function (n, t, i, r, u, f, e) {
            if (!this.isSummary(n, r, u, e)) {
                var o = `${this.gethost()}/${toThaiUri('oddscomp')}/${toThaiSlug(r)}${toThaiSlug(u)}-${n}`;

                i && (o += "?half=1");
                window.open(o, e ? "_self" : "");
            }
        },
        euroodds: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                this.gethost() + "/"+toThaiUri('1x2-odds')+"/" + n,
                u ? "_self" : ""
            );
        },
        ouodds: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                this.gethost() + "/"+toThaiUri('over-under-odds')+"/" + n,
                u ? "_self" : ""
            );
        },
        ahodds: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                this.gethost() + "/"+toThaiUri('asian-handicap-odds')+"/" + n,
                u ? "_self" : ""
            );
        },
        threemix: function (n, t, i, r, u, f, e) {
            if (!this.isSummary(n, r, u, e)) {
                var o = this.gethost() + `/${toThaiUri('match')}/${toThaiUri('live')}-` + n;
                i && (o += "?half=1");
                window.open(o, e ? "_self" : "");
            }
        },
        textlive: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                this.gethost() + "/"+toThaiUri('textlive')+"/" + n,
                u ? "_self" : ""
            );
        },
        playertech: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                this.gethost() + "/"+toThaiUri('playertech')+"/" + n,
                u ? "_self" : ""
            );
        },
        tipsmatch: function (n, t, i, r, u) {
            this.isSummary(n, t, i, u) ||
            window.open(
                _cmsWebDomain + toThaiUri('football') + "/" + toThaiUri('match') + "/" + n,
                u ? "_self" : ""
            );
        },
    },
    basketInPage = {
        gethost: function () {
            return _mainWebDomain.substr(0, _mainWebDomain.length - 1);
        },
        analysis: function (n) {
            window.open(`/${translateUri("basketball")}/${translateUri("match")}/${translateUri("analysis")}/` + n);
        },
        oddscomp: function (n) {
            window.open(`/${translateUri("basketball")}/${translateUri("match")}/${translateUri("oddscompbasket")}/` + n);
        },
        euroodds: function (n) {
            window.open(this.gethost() + "/basketball/1x2-" + n);
        },
        playertech: function (n) {
            window.open(`/${translateUri("basketball")}/${translateUri("match")}/${translateUri("statistics")}/` + n);
        },
        textlive: function (n) {
            window.open(this.gethost() + "/statistics/" + n + "?showtxt=1");
        },
    },
    soccerDbPage = {

        domain:
            typeof _footballWebDomain == "undefined"
                ? ""
                : (_footballWebDomain += _footballWebDomain.endsWith("/")
                    ? ""
                    : "/"),
        player: function (n) {
            window.open('/' + toThaiUri('team') + "/" + toThaiUri('player') + "/" + n);
        },
        team: function (n) {
            window.open(`${toThaiUri('team')}/${toThaiUri('summary')}/` + n);
            // window.open(this.domain + "team/summary/" + id);
        },
        league: function (n) {
            window.open(this.domain + toThaiUri('leagueinfo-pop-up') + "/" + n);
        },
    },
    basketballDbPage = {
        domain:
            typeof _basketballWebDomain == "undefined"
                ? ""
                : (_basketballWebDomain += _basketballWebDomain.endsWith("/")
                    ? ""
                    : "/"),
        player: function (n) {
            window.open("/" + toThaiUri('basketball') + "/"  + toThaiUri('team') + "/" + toThaiUri('player') + "/" + n);
        },
        team: function (n) {
            window.open("/" + toThaiUri('basketball') + "/" + `${toThaiUri('team')}/${toThaiUri('summary')}/` + n);
        },
        league: function (n) {
            window.open("/" + toThaiUri('basketball') + "/" + toThaiUri('leagueinfo') + "/" + n);
        },
    };
_counFavMatchTimmer = null;
Storage = {
    enableStorage: function (n) {
        try {
            n.setItem("_test", "1");
            var t = n.getItem("_test") == "1";
            return n.removeItem("_test"), t;
        } catch (i) {
            return !1;
        }
    },
    enableLocal: function () {
        return (
            typeof localStorage != "undefined" &&
            this.enableStorage(localStorage)
        );
    },
    enableSession: function () {
        return (
            typeof sessionStorage != "undefined" &&
            this.enableStorage(sessionStorage)
        );
    },
    getLocal: function (n) {
        return this.enableLocal()
            ? localStorage.getItem(n)
            : unescape(findCookie(n));
    },
    setLocal: function (n, t) {
        this.enableLocal() ? localStorage.setItem(n, t) : writeCookie(n, t);
    },
    getSession: function (n) {
        return this.enableSession()
            ? sessionStorage.getItem(n)
            : this.getLocal(n);
    },
    setSession: function (n, t) {
        this.enableSession()
            ? sessionStorage.setItem(n, t)
            : this.setLocal(n, t);
    },
    setLocalWithExpire: function (n, t, i) {
        (typeof second == "undefined" || CheckEmpty(second)) && i == 60;
        var r = {
            value: t,
            expire: new Date().getTime() + i * 6e4,
        };
        localStorage.setItem(n, JSON.stringify(r));
    },
    getLocalWithExpire: function (n) {
        var i = localStorage.getItem(n),
            t;
        return i
            ? ((t = JSON.parse(i)), t.expire && new Date().getTime() > t.expire)
                ? (localStorage.removeItem(n), null)
                : t.value
            : null;
    },
};
MonitorError();
LoadDark();
_oddsType = GetOddType();
_timeZone = GetTimeZone();
$(function () {
    document.onclick = checkHide;
    initSetting();
});
!(function () {
    var u = getCookie("MyGames_LeagueID"),
        e,
        f,
        o,
        n,
        i,
        t,
        r;
    u &&
    u.indexOf("_") != -1 &&
    ((e = u.split("_")),
        (f = []),
        e.forEach((n) => {
            n && f.push(n);
        }),
        (document.cookie =
            "MyGames_LeagueID=;path=/;expires=" +
            new Date(new Date().getTime() + -36e6).toGMTString()),
        (o = getCookie("MyGames_LeagueID")
            ? "," + getCookie("MyGames_LeagueID")
            : ""),
        writeShareCookie(
            "MyGames_LeagueID",
            f.join(",") + o + new Date(new Date().getTime() + 6048e5)
        ));
    n = getCookie("MyGames_MatchID");
    n &&
    n.indexOf("_") != -1 &&
    ((i = n.split("_")),
        (t = []),
        i.forEach((n) => {
            n && t.push(n);
        }),
        (document.cookie =
            "MyGames_MatchID=;path=/;expires=" +
            new Date(new Date().getTime() + -36e6).toGMTString()),
        (r = getCookie("MyGames_MatchID")
            ? "," + getCookie("MyGames_MatchID")
            : ""),
        writeShareCookie(
            "MyGames_MatchID",
            t.join(",") + r,
            new Date(new Date().getTime() + 6048e5)
        ));
    n = getCookie("MyNBA_MatchID");
    n &&
    n.indexOf("_") != -1 &&
    ((i = n.split("_")),
        (t = []),
        i.forEach((n) => {
            n && t.push(n);
        }),
        (document.cookie =
            "MyNBA_MatchID=;path=/;expires=" +
            new Date(new Date().getTime() + -36e6).toGMTString()),
        (r = getCookie("MyGames_LQ_MatchID")
            ? "," + getCookie("MyGames_LQ_MatchID")
            : ""),
        writeShareCookie(
            "MyGames_LQ_MatchID",
            t.join(",") + r,
            new Date(new Date().getTime() + 6048e5)
        ));
})();
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
!(function (n, t) {
    "object" == typeof exports && "undefined" != typeof module
        ? t(exports)
        : "function" == typeof define && define.amd
            ? define(["exports"], t)
            : t(
                ((n =
                    "undefined" != typeof globalThis
                        ? globalThis
                        : n || self).pako = {})
            );
})(this, function (n) {
    "use strict";

    function di() {
        this.strm = null;
        this.mode = 0;
        this.last = !1;
        this.wrap = 0;
        this.havedict = !1;
        this.flags = 0;
        this.dmax = 0;
        this.check = 0;
        this.total = 0;
        this.head = null;
        this.wbits = 0;
        this.wsize = 0;
        this.whave = 0;
        this.wnext = 0;
        this.window = null;
        this.hold = 0;
        this.bits = 0;
        this.length = 0;
        this.offset = 0;
        this.extra = 0;
        this.lencode = null;
        this.distcode = null;
        this.lenbits = 0;
        this.distbits = 0;
        this.ncode = 0;
        this.nlen = 0;
        this.ndist = 0;
        this.have = 0;
        this.next = null;
        this.lens = new Uint16Array(320);
        this.work = new Uint16Array(288);
        this.lendyn = null;
        this.distdyn = null;
        this.sane = 0;
        this.back = 0;
        this.was = 0;
    }

    function l(n) {
        this.options = ni(
            {
                chunkSize: 65536,
                windowBits: 15,
                to: "",
            },
            n || {}
        );
        const t = this.options;
        t.raw &&
        t.windowBits >= 0 &&
        t.windowBits < 16 &&
        ((t.windowBits = -t.windowBits),
        0 === t.windowBits && (t.windowBits = -15));
        !(t.windowBits >= 0 && t.windowBits < 16) ||
        (n && n.windowBits) ||
        (t.windowBits += 32);
        t.windowBits > 15 &&
        t.windowBits < 48 &&
        0 == (15 & t.windowBits) &&
        (t.windowBits |= 15);
        this.err = 0;
        this.msg = "";
        this.ended = !1;
        this.chunks = [];
        this.strm = new ur();
        this.strm.avail_out = 0;
        let i = u.inflateInit2(this.strm, t.windowBits);
        if (i !== c) throw new Error(ft[i]);
        if (
            ((this.header = new fr()),
                u.inflateGetHeader(this.strm, this.header),
            t.dictionary &&
            ("string" == typeof t.dictionary
                ? (t.dictionary = tr(t.dictionary))
                : "[object ArrayBuffer]" === ri.call(t.dictionary) &&
                (t.dictionary = new Uint8Array(t.dictionary)),
            t.raw &&
            ((i = u.inflateSetDictionary(this.strm, t.dictionary)),
            i !== c)))
        )
            throw new Error(ft[i]);
    }

    function st(n, t) {
        const i = new l(t);
        if ((i.push(n), i.err)) throw i.msg || ft[i.err];
        return i.result;
    }

    var g = (n, t, i, r) => {
            let u = (65535 & n) | 0,
                f = ((n >>> 16) & 65535) | 0,
                e = 0;
            for (; 0 !== i;) {
                e = i > 2e3 ? 2e3 : i;
                i -= e;
                do (u = (u + t[r++]) | 0), (f = (f + u) | 0);
                while (--e);
                u %= 65521;
                f %= 65521;
            }
            return u | (f << 16) | 0;
        },
        r,
        ht,
        s,
        y,
        u,
        ni,
        ti;
    const ci = new Uint32Array(
        (() => {
            var t, i;
            let n,
                r = [];
            for (t = 0; t < 256; t++) {
                for (n = t, i = 0; i < 8; i++)
                    n = 1 & n ? 3988292384 ^ (n >>> 1) : n >>> 1;
                r[t] = n;
            }
            return r;
        })()
    );
    r = (n, t, i, r) => {
        const u = ci,
            f = r + i;
        n ^= -1;
        for (let i = r; i < f; i++) n = (n >>> 8) ^ u[255 & (n ^ t[i])];
        return -1 ^ n;
    };
    const a = 16209;
    ht = function (n, t) {
        let c,
            k,
            r,
            it,
            d,
            rt,
            g,
            ut,
            p,
            b,
            s,
            u,
            nt,
            tt,
            ft,
            et,
            l,
            i,
            o,
            v,
            e,
            y,
            w,
            f;
        const h = n.state;
        c = n.next_in;
        w = n.input;
        k = c + (n.avail_in - 5);
        r = n.next_out;
        f = n.output;
        it = r - (t - n.avail_out);
        d = r + (n.avail_out - 257);
        rt = h.dmax;
        g = h.wsize;
        ut = h.whave;
        p = h.wnext;
        b = h.window;
        s = h.hold;
        u = h.bits;
        nt = h.lencode;
        tt = h.distcode;
        ft = (1 << h.lenbits) - 1;
        et = (1 << h.distbits) - 1;
        n: do {
            u < 15 &&
            ((s += w[c++] << u), (u += 8), (s += w[c++] << u), (u += 8));
            l = nt[s & ft];
            t: for (; ;) {
                if (
                    ((i = l >>> 24),
                        (s >>>= i),
                        (u -= i),
                        (i = (l >>> 16) & 255),
                    0 === i)
                )
                    f[r++] = 65535 & l;
                else {
                    if (!(16 & i)) {
                        if (0 == (64 & i)) {
                            l = nt[(65535 & l) + (s & ((1 << i) - 1))];
                            continue t;
                        }
                        if (32 & i) {
                            h.mode = 16191;
                            break n;
                        }
                        n.msg = "invalid literal/length code";
                        h.mode = a;
                        break n;
                    }
                    o = 65535 & l;
                    i &= 15;
                    i &&
                    (u < i && ((s += w[c++] << u), (u += 8)),
                        (o += s & ((1 << i) - 1)),
                        (s >>>= i),
                        (u -= i));
                    u < 15 &&
                    ((s += w[c++] << u),
                        (u += 8),
                        (s += w[c++] << u),
                        (u += 8));
                    l = tt[s & et];
                    i: for (; ;) {
                        if (
                            ((i = l >>> 24),
                                (s >>>= i),
                                (u -= i),
                                (i = (l >>> 16) & 255),
                                !(16 & i))
                        ) {
                            if (0 == (64 & i)) {
                                l = tt[(65535 & l) + (s & ((1 << i) - 1))];
                                continue i;
                            }
                            n.msg = "invalid distance code";
                            h.mode = a;
                            break n;
                        }
                        if (
                            ((v = 65535 & l),
                                (i &= 15),
                            u < i &&
                            ((s += w[c++] << u),
                                (u += 8),
                            u < i && ((s += w[c++] << u), (u += 8))),
                                (v += s & ((1 << i) - 1)),
                            v > rt)
                        ) {
                            n.msg = "invalid distance too far back";
                            h.mode = a;
                            break n;
                        }
                        if (((s >>>= i), (u -= i), (i = r - it), v > i)) {
                            if (((i = v - i), i > ut && h.sane)) {
                                n.msg = "invalid distance too far back";
                                h.mode = a;
                                break n;
                            }
                            if (((e = 0), (y = b), 0 === p)) {
                                if (((e += g - i), i < o)) {
                                    o -= i;
                                    do f[r++] = b[e++];
                                    while (--i);
                                    e = r - v;
                                    y = f;
                                }
                            } else if (p < i) {
                                if (((e += g + p - i), (i -= p), i < o)) {
                                    o -= i;
                                    do f[r++] = b[e++];
                                    while (--i);
                                    if (((e = 0), p < o)) {
                                        i = p;
                                        o -= i;
                                        do f[r++] = b[e++];
                                        while (--i);
                                        e = r - v;
                                        y = f;
                                    }
                                }
                            } else if (((e += p - i), i < o)) {
                                o -= i;
                                do f[r++] = b[e++];
                                while (--i);
                                e = r - v;
                                y = f;
                            }
                            for (; o > 2;)
                                (f[r++] = y[e++]),
                                    (f[r++] = y[e++]),
                                    (f[r++] = y[e++]),
                                    (o -= 3);
                            o &&
                            ((f[r++] = y[e++]), o > 1 && (f[r++] = y[e++]));
                        } else {
                            e = r - v;
                            do
                                (f[r++] = f[e++]),
                                    (f[r++] = f[e++]),
                                    (f[r++] = f[e++]),
                                    (o -= 3);
                            while (o > 2);
                            o &&
                            ((f[r++] = f[e++]), o > 1 && (f[r++] = f[e++]));
                        }
                        break;
                    }
                }
                break;
            }
        } while (c < k && r < d);
        o = u >> 3;
        c -= o;
        u -= o << 3;
        s &= (1 << u) - 1;
        n.next_in = c;
        n.next_out = r;
        n.avail_in = c < k ? k - c + 5 : 5 - (c - k);
        n.avail_out = r < d ? d - r + 257 : 257 - (r - d);
        h.hold = s;
        h.bits = u;
    };
    const v = 15,
        li = new Uint16Array([
            3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51,
            59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0,
        ]),
        ai = new Uint8Array([
            16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19,
            19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78,
        ]),
        vi = new Uint16Array([
            1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385,
            513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385,
            24577, 0, 0,
        ]),
        yi = new Uint8Array([
            16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23,
            23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64,
        ]);
    s = (n, t, i, r, u, f, e, o) => {
        const lt = o.bits;
        let k,
            tt,
            rt,
            ht,
            it,
            g,
            s = 0,
            h = 0,
            p = 0,
            c = 0,
            l = 0,
            w = 0,
            a = 0,
            b = 0,
            nt = 0,
            y = 0,
            ut = null;
        const d = new Uint16Array(16),
            ft = new Uint16Array(16);
        let ct,
            et,
            ot,
            st = null;
        for (s = 0; s <= v; s++) d[s] = 0;
        for (h = 0; h < r; h++) d[t[i + h]]++;
        for (l = lt, c = v; c >= 1 && 0 === d[c]; c--) ;
        if ((l > c && (l = c), 0 === c))
            return (u[f++] = 20971520), (u[f++] = 20971520), (o.bits = 1), 0;
        for (p = 1; p < c && 0 === d[p]; p++) ;
        for (l < p && (l = p), b = 1, s = 1; s <= v; s++)
            if (((b <<= 1), (b -= d[s]), b < 0)) return -1;
        if (b > 0 && (0 === n || 1 !== c)) return -1;
        for (ft[1] = 0, s = 1; s < v; s++) ft[s + 1] = ft[s] + d[s];
        for (h = 0; h < r; h++) 0 !== t[i + h] && (e[ft[t[i + h]]++] = h);
        if (
            (0 === n
                ? ((ut = st = e), (g = 20))
                : 1 === n
                    ? ((ut = li), (st = ai), (g = 257))
                    : ((ut = vi), (st = yi), (g = 0)),
                (y = 0),
                (h = 0),
                (s = p),
                (it = f),
                (w = l),
                (a = 0),
                (rt = -1),
                (nt = 1 << l),
                (ht = nt - 1),
            (1 === n && nt > 852) || (2 === n && nt > 592))
        )
            return 1;
        for (; ;) {
            ct = s - a;
            e[h] + 1 < g
                ? ((et = 0), (ot = e[h]))
                : e[h] >= g
                    ? ((et = st[e[h] - g]), (ot = ut[e[h] - g]))
                    : ((et = 96), (ot = 0));
            k = 1 << (s - a);
            tt = 1 << w;
            p = tt;
            do
                (tt -= k),
                    (u[it + (y >> a) + tt] = (ct << 24) | (et << 16) | ot | 0);
            while (0 !== tt);
            for (k = 1 << (s - 1); y & k;) k >>= 1;
            if (
                (0 !== k ? ((y &= k - 1), (y += k)) : (y = 0), h++, 0 == --d[s])
            ) {
                if (s === c) break;
                s = t[i + e[h]];
            }
            if (s > l && (y & ht) !== rt) {
                for (
                    0 === a && (a = l), it += p, w = s - a, b = 1 << w;
                    w + a < c && ((b -= d[w + a]), !(b <= 0));
                )
                    w++, (b <<= 1);
                if (
                    ((nt += 1 << w),
                    (1 === n && nt > 852) || (2 === n && nt > 592))
                )
                    return 1;
                rt = y & ht;
                u[rt] = (l << 24) | (w << 16) | (it - f) | 0;
            }
        }
        return (
            0 !== y && (u[it + y] = ((s - a) << 24) | 4194304), (o.bits = l), 0
        );
    };
    y = {
        Z_NO_FLUSH: 0,
        Z_PARTIAL_FLUSH: 1,
        Z_SYNC_FLUSH: 2,
        Z_FULL_FLUSH: 3,
        Z_FINISH: 4,
        Z_BLOCK: 5,
        Z_TREES: 6,
        Z_OK: 0,
        Z_STREAM_END: 1,
        Z_NEED_DICT: 2,
        Z_ERRNO: -1,
        Z_STREAM_ERROR: -2,
        Z_DATA_ERROR: -3,
        Z_MEM_ERROR: -4,
        Z_BUF_ERROR: -5,
        Z_NO_COMPRESSION: 0,
        Z_BEST_SPEED: 1,
        Z_BEST_COMPRESSION: 9,
        Z_DEFAULT_COMPRESSION: -1,
        Z_FILTERED: 1,
        Z_HUFFMAN_ONLY: 2,
        Z_RLE: 3,
        Z_FIXED: 4,
        Z_DEFAULT_STRATEGY: 0,
        Z_BINARY: 0,
        Z_TEXT: 1,
        Z_UNKNOWN: 2,
        Z_DEFLATED: 8,
    };
    const {
            Z_FINISH: ct,
            Z_BLOCK: pi,
            Z_TREES: p,
            Z_OK: e,
            Z_STREAM_END: wi,
            Z_NEED_DICT: bi,
            Z_STREAM_ERROR: i,
            Z_DATA_ERROR: lt,
            Z_MEM_ERROR: at,
            Z_BUF_ERROR: ki,
            Z_DEFLATED: vt,
        } = y,
        w = 16180,
        b = 16190,
        f = 16191,
        nt = 16192,
        tt = 16194,
        k = 16199,
        d = 16200,
        it = 16206,
        t = 16209,
        yt = (n) =>
            ((n >>> 24) & 255) +
            ((n >>> 8) & 65280) +
            ((65280 & n) << 8) +
            ((255 & n) << 24);
    const o = (n) => {
            if (!n) return 1;
            const t = n.state;
            return !t || t.strm !== n || t.mode < w || t.mode > 16211 ? 1 : 0;
        },
        pt = (n) => {
            if (o(n)) return i;
            const t = n.state;
            return (
                (n.total_in = n.total_out = t.total = 0),
                    (n.msg = ""),
                t.wrap && (n.adler = 1 & t.wrap),
                    (t.mode = w),
                    (t.last = 0),
                    (t.havedict = 0),
                    (t.flags = -1),
                    (t.dmax = 32768),
                    (t.head = null),
                    (t.hold = 0),
                    (t.bits = 0),
                    (t.lencode = t.lendyn = new Int32Array(852)),
                    (t.distcode = t.distdyn = new Int32Array(592)),
                    (t.sane = 1),
                    (t.back = -1),
                    e
            );
        },
        wt = (n) => {
            if (o(n)) return i;
            const t = n.state;
            return (t.wsize = 0), (t.whave = 0), (t.wnext = 0), pt(n);
        },
        bt = (n, t) => {
            let u;
            if (o(n)) return i;
            const r = n.state;
            return (
                t < 0
                    ? ((u = 0), (t = -t))
                    : ((u = 5 + (t >> 4)), t < 48 && (t &= 15)),
                    t && (t < 8 || t > 15)
                        ? i
                        : (null !== r.window && r.wbits !== t && (r.window = null),
                            (r.wrap = u),
                            (r.wbits = t),
                            wt(n))
            );
        },
        kt = (n, t) => {
            if (!n) return i;
            const r = new di();
            n.state = r;
            r.strm = n;
            r.window = null;
            r.mode = w;
            const u = bt(n, t);
            return u !== e && (n.state = null), u;
        };
    let rt,
        ut,
        dt = !0;
    const gi = (n) => {
            if (dt) {
                rt = new Int32Array(512);
                ut = new Int32Array(32);
                let t = 0;
                for (; t < 144;) n.lens[t++] = 8;
                for (; t < 256;) n.lens[t++] = 9;
                for (; t < 280;) n.lens[t++] = 7;
                for (; t < 288;) n.lens[t++] = 8;
                for (
                    s(1, n.lens, 0, 288, rt, 0, n.work, {
                        bits: 9,
                    }),
                        t = 0;
                    t < 32;
                )
                    n.lens[t++] = 5;
                s(2, n.lens, 0, 32, ut, 0, n.work, {
                    bits: 5,
                });
                dt = !1;
            }
            n.lencode = rt;
            n.lenbits = 9;
            n.distcode = ut;
            n.distbits = 5;
        },
        gt = (n, t, i, r) => {
            let f;
            const u = n.state;
            return (
                null === u.window &&
                ((u.wsize = 1 << u.wbits),
                    (u.wnext = 0),
                    (u.whave = 0),
                    (u.window = new Uint8Array(u.wsize))),
                    r >= u.wsize
                        ? (u.window.set(t.subarray(i - u.wsize, i), 0),
                            (u.wnext = 0),
                            (u.whave = u.wsize))
                        : ((f = u.wsize - u.wnext),
                        f > r && (f = r),
                            u.window.set(t.subarray(i - r, i - r + f), u.wnext),
                            (r -= f)
                                ? (u.window.set(t.subarray(i - r, i), 0),
                                    (u.wnext = r),
                                    (u.whave = u.wsize))
                                : ((u.wnext += f),
                                u.wnext === u.wsize && (u.wnext = 0),
                                u.whave < u.wsize && (u.whave += f))),
                    0
            );
        };
    u = {
        inflateReset: wt,
        inflateReset2: bt,
        inflateResetKeep: pt,
        inflateInit: (n) => kt(n, 15),
        inflateInit2: kt,
        inflate: (n, u) => {
            let h,
                rt,
                ti,
                y,
                dt,
                a,
                st,
                l,
                c,
                ui,
                ft,
                v,
                fi,
                si,
                ut,
                wt,
                kt,
                bt,
                ei,
                oi,
                et,
                ni,
                ot = 0;
            const pt = new Uint8Array(4);
            let ri, ii;
            const hi = new Uint8Array([
                16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1,
                15,
            ]);
            if (o(n) || !n.output || (!n.input && 0 !== n.avail_in)) return i;
            h = n.state;
            h.mode === f && (h.mode = nt);
            dt = n.next_out;
            ti = n.output;
            st = n.avail_out;
            y = n.next_in;
            rt = n.input;
            a = n.avail_in;
            l = h.hold;
            c = h.bits;
            ui = a;
            ft = st;
            ni = e;
            n: for (; ;)
                switch (h.mode) {
                    case w:
                        if (0 === h.wrap) {
                            h.mode = nt;
                            break;
                        }
                        for (; c < 16;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        if (2 & h.wrap && 35615 === l) {
                            0 === h.wbits && (h.wbits = 15);
                            h.check = 0;
                            pt[0] = 255 & l;
                            pt[1] = (l >>> 8) & 255;
                            h.check = r(h.check, pt, 2, 0);
                            l = 0;
                            c = 0;
                            h.mode = 16181;
                            break;
                        }
                        if (
                            (h.head && (h.head.done = !1),
                            !(1 & h.wrap) || (((255 & l) << 8) + (l >> 8)) % 31)
                        ) {
                            n.msg = "incorrect header check";
                            h.mode = t;
                            break;
                        }
                        if ((15 & l) !== vt) {
                            n.msg = "unknown compression method";
                            h.mode = t;
                            break;
                        }
                        if (
                            ((l >>>= 4),
                                (c -= 4),
                                (et = 8 + (15 & l)),
                            0 === h.wbits && (h.wbits = et),
                            et > 15 || et > h.wbits)
                        ) {
                            n.msg = "invalid window size";
                            h.mode = t;
                            break;
                        }
                        h.dmax = 1 << h.wbits;
                        h.flags = 0;
                        n.adler = h.check = 1;
                        h.mode = 512 & l ? 16189 : f;
                        l = 0;
                        c = 0;
                        break;
                    case 16181:
                        for (; c < 16;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        if (((h.flags = l), (255 & h.flags) !== vt)) {
                            n.msg = "unknown compression method";
                            h.mode = t;
                            break;
                        }
                        if (57344 & h.flags) {
                            n.msg = "unknown header flags set";
                            h.mode = t;
                            break;
                        }
                        h.head && (h.head.text = (l >> 8) & 1);
                        512 & h.flags &&
                        4 & h.wrap &&
                        ((pt[0] = 255 & l),
                            (pt[1] = (l >>> 8) & 255),
                            (h.check = r(h.check, pt, 2, 0)));
                        l = 0;
                        c = 0;
                        h.mode = 16182;
                    case 16182:
                        for (; c < 32;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        h.head && (h.head.time = l);
                        512 & h.flags &&
                        4 & h.wrap &&
                        ((pt[0] = 255 & l),
                            (pt[1] = (l >>> 8) & 255),
                            (pt[2] = (l >>> 16) & 255),
                            (pt[3] = (l >>> 24) & 255),
                            (h.check = r(h.check, pt, 4, 0)));
                        l = 0;
                        c = 0;
                        h.mode = 16183;
                    case 16183:
                        for (; c < 16;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        h.head &&
                        ((h.head.xflags = 255 & l), (h.head.os = l >> 8));
                        512 & h.flags &&
                        4 & h.wrap &&
                        ((pt[0] = 255 & l),
                            (pt[1] = (l >>> 8) & 255),
                            (h.check = r(h.check, pt, 2, 0)));
                        l = 0;
                        c = 0;
                        h.mode = 16184;
                    case 16184:
                        if (1024 & h.flags) {
                            for (; c < 16;) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            h.length = l;
                            h.head && (h.head.extra_len = l);
                            512 & h.flags &&
                            4 & h.wrap &&
                            ((pt[0] = 255 & l),
                                (pt[1] = (l >>> 8) & 255),
                                (h.check = r(h.check, pt, 2, 0)));
                            l = 0;
                            c = 0;
                        } else h.head && (h.head.extra = null);
                        h.mode = 16185;
                    case 16185:
                        if (
                            1024 & h.flags &&
                            ((v = h.length),
                            v > a && (v = a),
                            v &&
                            (h.head &&
                            ((et = h.head.extra_len - h.length),
                            h.head.extra ||
                            (h.head.extra = new Uint8Array(
                                h.head.extra_len
                            )),
                                h.head.extra.set(
                                    rt.subarray(y, y + v),
                                    et
                                )),
                            512 & h.flags &&
                            4 & h.wrap &&
                            (h.check = r(h.check, rt, v, y)),
                                (a -= v),
                                (y += v),
                                (h.length -= v)),
                                h.length)
                        )
                            break n;
                        h.length = 0;
                        h.mode = 16186;
                    case 16186:
                        if (2048 & h.flags) {
                            if (0 === a) break n;
                            v = 0;
                            do
                                (et = rt[y + v++]),
                                h.head &&
                                et &&
                                h.length < 65536 &&
                                (h.head.name +=
                                    String.fromCharCode(et));
                            while (et && v < a);
                            if (
                                (512 & h.flags &&
                                4 & h.wrap &&
                                (h.check = r(h.check, rt, v, y)),
                                    (a -= v),
                                    (y += v),
                                    et)
                            )
                                break n;
                        } else h.head && (h.head.name = null);
                        h.length = 0;
                        h.mode = 16187;
                    case 16187:
                        if (4096 & h.flags) {
                            if (0 === a) break n;
                            v = 0;
                            do
                                (et = rt[y + v++]),
                                h.head &&
                                et &&
                                h.length < 65536 &&
                                (h.head.comment +=
                                    String.fromCharCode(et));
                            while (et && v < a);
                            if (
                                (512 & h.flags &&
                                4 & h.wrap &&
                                (h.check = r(h.check, rt, v, y)),
                                    (a -= v),
                                    (y += v),
                                    et)
                            )
                                break n;
                        } else h.head && (h.head.comment = null);
                        h.mode = 16188;
                    case 16188:
                        if (512 & h.flags) {
                            for (; c < 16;) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            if (4 & h.wrap && l !== (65535 & h.check)) {
                                n.msg = "header crc mismatch";
                                h.mode = t;
                                break;
                            }
                            l = 0;
                            c = 0;
                        }
                        h.head &&
                        ((h.head.hcrc = (h.flags >> 9) & 1),
                            (h.head.done = !0));
                        n.adler = h.check = 0;
                        h.mode = f;
                        break;
                    case 16189:
                        for (; c < 32;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        n.adler = h.check = yt(l);
                        l = 0;
                        c = 0;
                        h.mode = b;
                    case b:
                        if (0 === h.havedict)
                            return (
                                (n.next_out = dt),
                                    (n.avail_out = st),
                                    (n.next_in = y),
                                    (n.avail_in = a),
                                    (h.hold = l),
                                    (h.bits = c),
                                    bi
                            );
                        n.adler = h.check = 1;
                        h.mode = f;
                    case f:
                        if (u === pi || u === p) break n;
                    case nt:
                        if (h.last) {
                            l >>>= 7 & c;
                            c -= 7 & c;
                            h.mode = it;
                            break;
                        }
                        for (; c < 3;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        switch (
                            ((h.last = 1 & l), (l >>>= 1), (c -= 1), 3 & l)
                            ) {
                            case 0:
                                h.mode = 16193;
                                break;
                            case 1:
                                if ((gi(h), (h.mode = k), u === p)) {
                                    l >>>= 2;
                                    c -= 2;
                                    break n;
                                }
                                break;
                            case 2:
                                h.mode = 16196;
                                break;
                            case 3:
                                n.msg = "invalid block type";
                                h.mode = t;
                        }
                        l >>>= 2;
                        c -= 2;
                        break;
                    case 16193:
                        for (l >>>= 7 & c, c -= 7 & c; c < 32;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        if ((65535 & l) != ((l >>> 16) ^ 65535)) {
                            n.msg = "invalid stored block lengths";
                            h.mode = t;
                            break;
                        }
                        if (
                            ((h.length = 65535 & l),
                                (l = 0),
                                (c = 0),
                                (h.mode = tt),
                            u === p)
                        )
                            break n;
                    case tt:
                        h.mode = 16195;
                    case 16195:
                        if (((v = h.length), v)) {
                            if ((v > a && (v = a), v > st && (v = st), 0 === v))
                                break n;
                            ti.set(rt.subarray(y, y + v), dt);
                            a -= v;
                            y += v;
                            st -= v;
                            dt += v;
                            h.length -= v;
                            break;
                        }
                        h.mode = f;
                        break;
                    case 16196:
                        for (; c < 14;) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        if (
                            ((h.nlen = 257 + (31 & l)),
                                (l >>>= 5),
                                (c -= 5),
                                (h.ndist = 1 + (31 & l)),
                                (l >>>= 5),
                                (c -= 5),
                                (h.ncode = 4 + (15 & l)),
                                (l >>>= 4),
                                (c -= 4),
                            h.nlen > 286 || h.ndist > 30)
                        ) {
                            n.msg = "too many length or distance symbols";
                            h.mode = t;
                            break;
                        }
                        h.have = 0;
                        h.mode = 16197;
                    case 16197:
                        for (; h.have < h.ncode;) {
                            for (; c < 3;) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            h.lens[hi[h.have++]] = 7 & l;
                            l >>>= 3;
                            c -= 3;
                        }
                        for (; h.have < 19;) h.lens[hi[h.have++]] = 0;
                        if (
                            ((h.lencode = h.lendyn),
                                (h.lenbits = 7),
                                (ri = {
                                    bits: h.lenbits,
                                }),
                                (ni = s(
                                    0,
                                    h.lens,
                                    0,
                                    19,
                                    h.lencode,
                                    0,
                                    h.work,
                                    ri
                                )),
                                (h.lenbits = ri.bits),
                                ni)
                        ) {
                            n.msg = "invalid code lengths set";
                            h.mode = t;
                            break;
                        }
                        h.have = 0;
                        h.mode = 16198;
                    case 16198:
                        for (; h.have < h.nlen + h.ndist;) {
                            for (
                                ;
                                (ot = h.lencode[l & ((1 << h.lenbits) - 1)]),
                                    (ut = ot >>> 24),
                                    (wt = (ot >>> 16) & 255),
                                    (kt = 65535 & ot),
                                    !(ut <= c);
                            ) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            if (kt < 16)
                                (l >>>= ut), (c -= ut), (h.lens[h.have++] = kt);
                            else {
                                if (16 === kt) {
                                    for (ii = ut + 2; c < ii;) {
                                        if (0 === a) break n;
                                        a--;
                                        l += rt[y++] << c;
                                        c += 8;
                                    }
                                    if (
                                        ((l >>>= ut), (c -= ut), 0 === h.have)
                                    ) {
                                        n.msg = "invalid bit length repeat";
                                        h.mode = t;
                                        break;
                                    }
                                    et = h.lens[h.have - 1];
                                    v = 3 + (3 & l);
                                    l >>>= 2;
                                    c -= 2;
                                } else if (17 === kt) {
                                    for (ii = ut + 3; c < ii;) {
                                        if (0 === a) break n;
                                        a--;
                                        l += rt[y++] << c;
                                        c += 8;
                                    }
                                    l >>>= ut;
                                    c -= ut;
                                    et = 0;
                                    v = 3 + (7 & l);
                                    l >>>= 3;
                                    c -= 3;
                                } else {
                                    for (ii = ut + 7; c < ii;) {
                                        if (0 === a) break n;
                                        a--;
                                        l += rt[y++] << c;
                                        c += 8;
                                    }
                                    l >>>= ut;
                                    c -= ut;
                                    et = 0;
                                    v = 11 + (127 & l);
                                    l >>>= 7;
                                    c -= 7;
                                }
                                if (h.have + v > h.nlen + h.ndist) {
                                    n.msg = "invalid bit length repeat";
                                    h.mode = t;
                                    break;
                                }
                                for (; v--;) h.lens[h.have++] = et;
                            }
                        }
                        if (h.mode === t) break;
                        if (0 === h.lens[256]) {
                            n.msg = "invalid code -- missing end-of-block";
                            h.mode = t;
                            break;
                        }
                        if (
                            ((h.lenbits = 9),
                                (ri = {
                                    bits: h.lenbits,
                                }),
                                (ni = s(
                                    1,
                                    h.lens,
                                    0,
                                    h.nlen,
                                    h.lencode,
                                    0,
                                    h.work,
                                    ri
                                )),
                                (h.lenbits = ri.bits),
                                ni)
                        ) {
                            n.msg = "invalid literal/lengths set";
                            h.mode = t;
                            break;
                        }
                        if (
                            ((h.distbits = 6),
                                (h.distcode = h.distdyn),
                                (ri = {
                                    bits: h.distbits,
                                }),
                                (ni = s(
                                    2,
                                    h.lens,
                                    h.nlen,
                                    h.ndist,
                                    h.distcode,
                                    0,
                                    h.work,
                                    ri
                                )),
                                (h.distbits = ri.bits),
                                ni)
                        ) {
                            n.msg = "invalid distances set";
                            h.mode = t;
                            break;
                        }
                        if (((h.mode = k), u === p)) break n;
                    case k:
                        h.mode = d;
                    case d:
                        if (a >= 6 && st >= 258) {
                            n.next_out = dt;
                            n.avail_out = st;
                            n.next_in = y;
                            n.avail_in = a;
                            h.hold = l;
                            h.bits = c;
                            ht(n, ft);
                            dt = n.next_out;
                            ti = n.output;
                            st = n.avail_out;
                            y = n.next_in;
                            rt = n.input;
                            a = n.avail_in;
                            l = h.hold;
                            c = h.bits;
                            h.mode === f && (h.back = -1);
                            break;
                        }
                        for (
                            h.back = 0;
                            (ot = h.lencode[l & ((1 << h.lenbits) - 1)]),
                                (ut = ot >>> 24),
                                (wt = (ot >>> 16) & 255),
                                (kt = 65535 & ot),
                                !(ut <= c);
                        ) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        if (wt && 0 == (240 & wt)) {
                            for (
                                bt = ut, ei = wt, oi = kt;
                                (ot =
                                    h.lencode[
                                    oi +
                                    ((l & ((1 << (bt + ei)) - 1)) >> bt)
                                        ]),
                                    (ut = ot >>> 24),
                                    (wt = (ot >>> 16) & 255),
                                    (kt = 65535 & ot),
                                    !(bt + ut <= c);
                            ) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            l >>>= bt;
                            c -= bt;
                            h.back += bt;
                        }
                        if (
                            ((l >>>= ut),
                                (c -= ut),
                                (h.back += ut),
                                (h.length = kt),
                            0 === wt)
                        ) {
                            h.mode = 16205;
                            break;
                        }
                        if (32 & wt) {
                            h.back = -1;
                            h.mode = f;
                            break;
                        }
                        if (64 & wt) {
                            n.msg = "invalid literal/length code";
                            h.mode = t;
                            break;
                        }
                        h.extra = 15 & wt;
                        h.mode = 16201;
                    case 16201:
                        if (h.extra) {
                            for (ii = h.extra; c < ii;) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            h.length += l & ((1 << h.extra) - 1);
                            l >>>= h.extra;
                            c -= h.extra;
                            h.back += h.extra;
                        }
                        h.was = h.length;
                        h.mode = 16202;
                    case 16202:
                        for (
                            ;
                            (ot = h.distcode[l & ((1 << h.distbits) - 1)]),
                                (ut = ot >>> 24),
                                (wt = (ot >>> 16) & 255),
                                (kt = 65535 & ot),
                                !(ut <= c);
                        ) {
                            if (0 === a) break n;
                            a--;
                            l += rt[y++] << c;
                            c += 8;
                        }
                        if (0 == (240 & wt)) {
                            for (
                                bt = ut, ei = wt, oi = kt;
                                (ot =
                                    h.distcode[
                                    oi +
                                    ((l & ((1 << (bt + ei)) - 1)) >> bt)
                                        ]),
                                    (ut = ot >>> 24),
                                    (wt = (ot >>> 16) & 255),
                                    (kt = 65535 & ot),
                                    !(bt + ut <= c);
                            ) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            l >>>= bt;
                            c -= bt;
                            h.back += bt;
                        }
                        if (((l >>>= ut), (c -= ut), (h.back += ut), 64 & wt)) {
                            n.msg = "invalid distance code";
                            h.mode = t;
                            break;
                        }
                        h.offset = kt;
                        h.extra = 15 & wt;
                        h.mode = 16203;
                    case 16203:
                        if (h.extra) {
                            for (ii = h.extra; c < ii;) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            h.offset += l & ((1 << h.extra) - 1);
                            l >>>= h.extra;
                            c -= h.extra;
                            h.back += h.extra;
                        }
                        if (h.offset > h.dmax) {
                            n.msg = "invalid distance too far back";
                            h.mode = t;
                            break;
                        }
                        h.mode = 16204;
                    case 16204:
                        if (0 === st) break n;
                        if (((v = ft - st), h.offset > v)) {
                            if (((v = h.offset - v), v > h.whave && h.sane)) {
                                n.msg = "invalid distance too far back";
                                h.mode = t;
                                break;
                            }
                            v > h.wnext
                                ? ((v -= h.wnext), (fi = h.wsize - v))
                                : (fi = h.wnext - v);
                            v > h.length && (v = h.length);
                            si = h.window;
                        } else (si = ti), (fi = dt - h.offset), (v = h.length);
                        v > st && (v = st);
                        st -= v;
                        h.length -= v;
                        do ti[dt++] = si[fi++];
                        while (--v);
                        0 === h.length && (h.mode = d);
                        break;
                    case 16205:
                        if (0 === st) break n;
                        ti[dt++] = h.length;
                        st--;
                        h.mode = d;
                        break;
                    case it:
                        if (h.wrap) {
                            for (; c < 32;) {
                                if (0 === a) break n;
                                a--;
                                l |= rt[y++] << c;
                                c += 8;
                            }
                            if (
                                ((ft -= st),
                                    (n.total_out += ft),
                                    (h.total += ft),
                                4 & h.wrap &&
                                ft &&
                                (n.adler = h.check =
                                    h.flags
                                        ? r(h.check, ti, ft, dt - ft)
                                        : g(h.check, ti, ft, dt - ft)),
                                    (ft = st),
                                4 & h.wrap && (h.flags ? l : yt(l)) !== h.check)
                            ) {
                                n.msg = "incorrect data check";
                                h.mode = t;
                                break;
                            }
                            l = 0;
                            c = 0;
                        }
                        h.mode = 16207;
                    case 16207:
                        if (h.wrap && h.flags) {
                            for (; c < 32;) {
                                if (0 === a) break n;
                                a--;
                                l += rt[y++] << c;
                                c += 8;
                            }
                            if (4 & h.wrap && l !== (4294967295 & h.total)) {
                                n.msg = "incorrect length check";
                                h.mode = t;
                                break;
                            }
                            l = 0;
                            c = 0;
                        }
                        h.mode = 16208;
                    case 16208:
                        ni = wi;
                        break n;
                    case t:
                        ni = lt;
                        break n;
                    case 16210:
                        return at;
                    default:
                        return i;
                }
            return (
                (n.next_out = dt),
                    (n.avail_out = st),
                    (n.next_in = y),
                    (n.avail_in = a),
                    (h.hold = l),
                    (h.bits = c),
                (h.wsize ||
                    (ft !== n.avail_out &&
                        h.mode < t &&
                        (h.mode < it || u !== ct))) &&
                gt(n, n.output, n.next_out, ft - n.avail_out),
                    (ui -= n.avail_in),
                    (ft -= n.avail_out),
                    (n.total_in += ui),
                    (n.total_out += ft),
                    (h.total += ft),
                4 & h.wrap &&
                ft &&
                (n.adler = h.check =
                    h.flags
                        ? r(h.check, ti, ft, n.next_out - ft)
                        : g(h.check, ti, ft, n.next_out - ft)),
                    (n.data_type =
                        h.bits +
                        (h.last ? 64 : 0) +
                        (h.mode === f ? 128 : 0) +
                        (h.mode === k || h.mode === tt ? 256 : 0)),
                ((0 === ui && 0 === ft) || u === ct) && ni === e && (ni = ki),
                    ni
            );
        },
        inflateEnd: (n) => {
            if (o(n)) return i;
            let t = n.state;
            return t.window && (t.window = null), (n.state = null), e;
        },
        inflateGetHeader: (n, t) => {
            if (o(n)) return i;
            const r = n.state;
            return 0 == (2 & r.wrap) ? i : ((r.head = t), (t.done = !1), e);
        },
        inflateSetDictionary: (n, t) => {
            const f = t.length;
            let r, u, s;
            return o(n)
                ? i
                : ((r = n.state),
                    0 !== r.wrap && r.mode !== b
                        ? i
                        : r.mode === b &&
                        ((u = 1), (u = g(u, t, f, 0)), u !== r.check)
                            ? lt
                            : ((s = gt(n, t, f, f)),
                                s ? ((r.mode = 16210), at) : ((r.havedict = 1), e)));
        },
        inflateInfo: "pako inflate (from Nodeca project)",
    };
    const nr = (n, t) => Object.prototype.hasOwnProperty.call(n, t);
    ni = function (n) {
        const t = Array.prototype.slice.call(arguments, 1);
        for (; t.length;) {
            const i = t.shift();
            if (i) {
                if ("object" != typeof i)
                    throw new TypeError(i + "must be non-object");
                for (const t in i) nr(i, t) && (n[t] = i[t]);
            }
        }
        return n;
    };
    ti = (n) => {
        let t = 0;
        for (let i = 0, r = n.length; i < r; i++) t += n[i].length;
        const i = new Uint8Array(t);
        for (let t = 0, r = 0, u = n.length; t < u; t++) {
            let u = n[t];
            i.set(u, r);
            r += u.length;
        }
        return i;
    };
    let ii = !0;
    try {
        String.fromCharCode.apply(null, new Uint8Array(1));
    } catch (n) {
        ii = !1;
    }
    const h = new Uint8Array(256);
    for (let n = 0; n < 256; n++)
        h[n] =
            n >= 252
                ? 6
                : n >= 248
                    ? 5
                    : n >= 240
                        ? 4
                        : n >= 224
                            ? 3
                            : n >= 192
                                ? 2
                                : 1;
    h[254] = h[254] = 1;
    var tr = (n) => {
            if (
                "function" == typeof TextEncoder &&
                TextEncoder.prototype.encode
            )
                return new TextEncoder().encode(n);
            let r,
                t,
                f,
                i,
                u,
                e = n.length,
                o = 0;
            for (i = 0; i < e; i++)
                (t = n.charCodeAt(i)),
                55296 == (64512 & t) &&
                i + 1 < e &&
                ((f = n.charCodeAt(i + 1)),
                56320 == (64512 & f) &&
                ((t = 65536 + ((t - 55296) << 10) + (f - 56320)),
                    i++)),
                    (o += t < 128 ? 1 : t < 2048 ? 2 : t < 65536 ? 3 : 4);
            for (r = new Uint8Array(o), u = 0, i = 0; u < o; i++)
                (t = n.charCodeAt(i)),
                55296 == (64512 & t) &&
                i + 1 < e &&
                ((f = n.charCodeAt(i + 1)),
                56320 == (64512 & f) &&
                ((t = 65536 + ((t - 55296) << 10) + (f - 56320)),
                    i++)),
                    t < 128
                        ? (r[u++] = t)
                        : t < 2048
                            ? ((r[u++] = 192 | (t >>> 6)),
                                (r[u++] = 128 | (63 & t)))
                            : t < 65536
                                ? ((r[u++] = 224 | (t >>> 12)),
                                    (r[u++] = 128 | ((t >>> 6) & 63)),
                                    (r[u++] = 128 | (63 & t)))
                                : ((r[u++] = 240 | (t >>> 18)),
                                    (r[u++] = 128 | ((t >>> 12) & 63)),
                                    (r[u++] = 128 | ((t >>> 6) & 63)),
                                    (r[u++] = 128 | (63 & t)));
            return r;
        },
        ir = (n, t) => {
            const f = t || n.length;
            if (
                "function" == typeof TextDecoder &&
                TextDecoder.prototype.decode
            )
                return new TextDecoder().decode(n.subarray(0, t));
            let u, i;
            const r = new Array(2 * f);
            for (i = 0, u = 0; u < f;) {
                let t = n[u++];
                if (t < 128) {
                    r[i++] = t;
                    continue;
                }
                let e = h[t];
                if (e > 4) (r[i++] = 65533), (u += e - 1);
                else {
                    for (t &= 2 === e ? 31 : 3 === e ? 15 : 7; e > 1 && u < f;)
                        (t = (t << 6) | (63 & n[u++])), e--;
                    e > 1
                        ? (r[i++] = 65533)
                        : t < 65536
                            ? (r[i++] = t)
                            : ((t -= 65536),
                                (r[i++] = 55296 | ((t >> 10) & 1023)),
                                (r[i++] = 56320 | (1023 & t)));
                }
            }
            return ((n, t) => {
                if (t < 65534 && n.subarray && ii)
                    return String.fromCharCode.apply(
                        null,
                        n.length === t ? n : n.subarray(0, t)
                    );
                let i = "";
                for (let r = 0; r < t; r++) i += String.fromCharCode(n[r]);
                return i;
            })(r, i);
        },
        rr = (n, t) => {
            (t = t || n.length) > n.length && (t = n.length);
            let i = t - 1;
            for (; i >= 0 && 128 == (192 & n[i]);) i--;
            return i < 0 || 0 === i ? t : i + h[n[i]] > t ? i : t;
        },
        ft = {
            2: "need dictionary",
            1: "stream end",
            0: "",
            "-1": "file error",
            "-2": "stream error",
            "-3": "data error",
            "-4": "insufficient memory",
            "-5": "buffer error",
            "-6": "incompatible version",
        },
        ur = function () {
            this.input = null;
            this.next_in = 0;
            this.avail_in = 0;
            this.total_in = 0;
            this.output = null;
            this.next_out = 0;
            this.avail_out = 0;
            this.total_out = 0;
            this.msg = "";
            this.state = null;
            this.data_type = 2;
            this.adler = 0;
        },
        fr = function () {
            this.text = 0;
            this.time = 0;
            this.xflags = 0;
            this.os = 0;
            this.extra = null;
            this.extra_len = 0;
            this.name = "";
            this.comment = "";
            this.hcrc = 0;
            this.done = !1;
        };
    const ri = Object.prototype.toString,
        {
            Z_NO_FLUSH: er,
            Z_FINISH: or,
            Z_OK: c,
            Z_STREAM_END: et,
            Z_NEED_DICT: ot,
            Z_STREAM_ERROR: sr,
            Z_DATA_ERROR: ui,
            Z_MEM_ERROR: hr,
        } = y;
    l.prototype.push = function (n, t) {
        const i = this.strm,
            e = this.options.chunkSize,
            o = this.options.dictionary;
        let r, f, s;
        if (this.ended) return !1;
        for (
            f = t === ~~t ? t : !0 === t ? or : er,
                i.input =
                    "[object ArrayBuffer]" === ri.call(n)
                        ? new Uint8Array(n)
                        : n,
                i.next_in = 0,
                i.avail_in = i.input.length;
            ;
        ) {
            for (
                0 === i.avail_out &&
                ((i.output = new Uint8Array(e)),
                    (i.next_out = 0),
                    (i.avail_out = e)),
                    r = u.inflate(i, f),
                r === ot &&
                o &&
                ((r = u.inflateSetDictionary(i, o)),
                    r === c ? (r = u.inflate(i, f)) : r === ui && (r = ot));
                i.avail_in > 0 &&
                r === et &&
                i.state.wrap > 0 &&
                0 !== n[i.next_in];
            )
                u.inflateReset(i), (r = u.inflate(i, f));
            switch (r) {
                case sr:
                case ui:
                case ot:
                case hr:
                    return this.onEnd(r), (this.ended = !0), !1;
            }
            if (
                ((s = i.avail_out),
                i.next_out && (0 === i.avail_out || r === et))
            )
                if ("string" === this.options.to) {
                    let n = rr(i.output, i.next_out),
                        t = i.next_out - n,
                        r = ir(i.output, n);
                    i.next_out = t;
                    i.avail_out = e - t;
                    t && i.output.set(i.output.subarray(n, n + t), 0);
                    this.onData(r);
                } else
                    this.onData(
                        i.output.length === i.next_out
                            ? i.output
                            : i.output.subarray(0, i.next_out)
                    );
            if (r !== c || 0 !== s) {
                if (r === et)
                    return (
                        (r = u.inflateEnd(this.strm)),
                            this.onEnd(r),
                            (this.ended = !0),
                            !0
                    );
                if (0 === i.avail_in) break;
            }
        }
        return !0;
    };
    l.prototype.onData = function (n) {
        this.chunks.push(n);
    };
    l.prototype.onEnd = function (n) {
        n === c &&
        (this.result =
            "string" === this.options.to
                ? this.chunks.join("")
                : ti(this.chunks));
        this.chunks = [];
        this.err = n;
        this.msg = this.strm.msg;
    };
    var fi = l,
        ei = st,
        oi = function (n, t) {
            return ((t = t || {}).raw = !0), st(n, t);
        },
        si = st,
        hi = y,
        cr = {
            Inflate: fi,
            inflate: ei,
            inflateRaw: oi,
            ungzip: si,
            constants: hi,
        };
    n.Inflate = fi;
    n.constants = hi;
    n.default = cr;
    n.inflate = ei;
    n.inflateRaw = oi;
    n.ungzip = si;
    Object.defineProperty(n, "__esModule", {
        value: !0,
    });
});
wsUtil = {
    wsUrl: `wss://${_wsUrl}/stream?channels={0}&&token={1}`,
    token: "",
    socket: null,
    wsIntervalId: null,
    wstimeout: 5e3,
    wstimer: null,
    tokenCacheKey: "WebSocketToken",
    channels: null,
    wsHandler: function () {
    },
    startHandler: function () {
    },
    stopHandler: function () {
    },
    getToken: function () {
        return new Promise((n, t) => {
            var i = "";
        });
    },
    connectWs: function (n, t, i, r) {
        n && (this.channels = n);
        t && (this.wsHandler = t);
        i && (this.startHandler = i);
        r && (this.stopHandler = r);
        this.token == ""
            ? this.getToken().then((n) => {
                (this.token = n), this.createWs();
            })
            : this.createWs();
    },
    createWs: function () {
        var n = this,
            t;
        (this.socket == null ||
            this.socket.readyState != WebSocket.OPEN ||
            this.socket.readyState != WebSocket.CONNECTING) &&
        ((t = this.wsUrl
            .replace("{0}", encodeURIComponent(this.channels.join(",")))
            .replace("{1}", this.token)),
            (this.socket = new WebSocket(t)),
            (this.wstimer = setTimeout(() => {
                n.socket.close(), console.log("ws timeout");
            }, this.wstimeout)),
            (this.socket.onmessage = function (t) {
                var r = t.data;
                if (r != "ok") {
                    let i = new FileReader();
                    i.readAsArrayBuffer(r, "utf-8");
                    i.onload = function () {
                        var t = JSON.parse(
                            pako.inflate(i.result, {
                                to: "string",
                            })
                        );
                        t != undefined && n.wsHandler(t);
                    };
                }
            }),
            (this.socket.onopen = function () {
                n.wstimer && clearTimeout(n.wstimer);
                console.log("ws open");
                n.updateState();
            }),
            (this.socket.onclose = function () {
                n.wstimer && clearTimeout(n.wstimer);
                console.log("ws close");
                n.token = "";
                n.updateState();
            }),
            (this.socket.onerror = function () {
                n.wstimer && clearTimeout(n.wstimer);
                console.log("ws error");
            }));
    },
    updateState: function () {
        function t() {
            n.startHandler();
            n.wsIntervalId ||
            (n.wsIntervalId = setInterval(() => {
                n.connectWs();
            }, 3e4));
        }

        function i() {
            n.stopHandler();
            n.wsIntervalId &&
            (clearInterval(n.wsIntervalId), (n.wsIntervalId = null));
        }

        var n = this;
        if (this.socket)
            switch (this.socket.readyState) {
                case WebSocket.CLOSED:
                    t();
                    break;
                case WebSocket.CLOSING:
                    t();
                    break;
                case WebSocket.CONNECTING:
                    t();
                    break;
                case WebSocket.OPEN:
                    i();
                    break;
                default:
                    t();
            }
        else t();
    },
    changeChannel: function (n) {
        if (
            ((this.channels = n),
            !this.socket || this.socket.readyState !== WebSocket.OPEN)
        ) {
            return;
        }
        var t = {
            type: 0,
            channels: n,
        };
        this.socket.send(JSON.stringify(t));
    },
    closeWs: function () {
        this.socket.close();
    },
};


// if (sessionStorage.getItem('SelectMenu') == null) {
//     sessionStorage.setItem('SelectMenu', 0);
// }

// if (sessionStorage.getItem('SelectMenuR') == null) {
//     sessionStorage.setItem('SelectMenuR', 0);
// }

const getMobileDetect = (userAgent) => {
    const isAndroid = () => Boolean(userAgent.match(/Android/i))
    const isIos = () => Boolean(userAgent.match(/iPhone|iPad|iPod/i))
    const isOpera = () => Boolean(userAgent.match(/Opera Mini/i))
    const isWindows = () => Boolean(userAgent.match(/IEMobile/i))
    const isSSR = () => Boolean(userAgent.match(/SSR/i))
    const isMobile = () => Boolean(isAndroid() || isIos() || isOpera() || isWindows())
    const isDesktop = () => Boolean(!isMobile() && !isSSR())

    return {
      isMobile,
      isDesktop,
      isAndroid,
      isIos,
      isSSR,
    }
  }

const useMobileDetect = () => {
    const userAgent = typeof navigator === 'undefined' ? 'SSR' : navigator.userAgent
    return getMobileDetect(userAgent)
}

function addMaskForTable(el) {
    $(el).each(function(){
        $(this).on('scroll', function() {
            let $container = $(this);
            let scrollLeft = $container.scrollLeft();

            if (scrollLeft > 18) {
                $(this).addClass('d-after-none')
            } else {
                $(this).removeClass('d-after-none')
            }
        })
    })
}

function scrollToActiveMenu(container, item) {
    let menuContainer = $(container)
    let activeItem = $(item)
    if (activeItem.length) {
        let containerWidth = menuContainer.width();
        let activeItemOffset = activeItem.offset().left;
        let activeItemWidth = activeItem.outerWidth();
        let scrollToPosition = activeItemOffset - (containerWidth / 2) + (activeItemWidth / 2);

        menuContainer.animate({
            scrollLeft: scrollToPosition
        }, 500);
    }
}

function changeMenuText(container) {
    let menuContainer = $(container)
    menuContainer.find('a[name="4"]').text(menuContainer.find('a[name="4"]').text().replace('châu Á', 'Châu Á'))
    menuContainer.find('a[name="5"]').text(menuContainer.find('a[name="5"]').text().replace('châu Á', 'Châu Á'))
    menuContainer.find('a[name="6"]').text(menuContainer.find('a[name="6"]').text().replace('T/X', 'Tài Xỉu'))
}

// $(document).ready(function() {
//     try {
//         scrollToActiveMenu('#info .sub_menu', '#info .sub_menu a.on')
//         scrollToActiveMenu('#info .mintopnav', '#info .mintopnav li.on')
//         const BONG_DA_SO_SANH_PATHS = ['ty-le-chau-a', 'ty-le-tai-xiu', 'ty-le-1x2', 'ty-le-goc-tai-xiu', 'ty-le-ti-so-chinh-xac', 'ty-le-chau-au', 'ty-le-2-ty-so'];

//         const keywords = ['bong-da', 'tran-dau', 'so-sanh-ty-le','doi-bong', 'lien-he', 'phan-hoi', 'chinh-sach', 'lien-he', 'disclaimer', 'coming-soon', ...BONG_DA_SO_SANH_PATHS];
//         const subMenus = ['tran-dau/', 'so-sanh-ty-le', ...BONG_DA_SO_SANH_PATHS];

//         changeMenuText('#info .sub_menu')
//         let path = window.location.pathname;
//         const firstRoute = path.split('/')[1];


//         if (keywords.some(keyword => path.includes(keyword)) || path === '/') {
//             if(!['bong-ro'].includes(window.location.pathname.split('/')[1]))
//             $('#menu #ball2').addClass('active')
//         }
//         else {
//             $('#menu #ball2').removeClass('active')
//         }

//         if (subMenus.some(keyword => firstRoute.includes(keyword))) {
//             $('li.sub1_0').addClass('on');
//         }

//         // let homeTeamName = $('#info.ball-analysis .row-two-center #homeFlag .sclassName').text().trim()
//         // let guestTeamname = $('#info.ball-analysis .row-two-center #guestFlag .sclassName').text().trim()

//         if($('#info .fbheader .img-left')) $('#info .fbheader .img-left').removeAttr('title')

//         if($('#info .fbheader .img-right')) $('#info .fbheader .img-right').removeAttr('title')

//         // $(`#info .fbheader .row-two-center-center span:nth-of-type(2)`).text($(`#info .fbheader .row-two-center-center span:nth-of-type(2)`).text().replace('vs', ''))
//         if($(`#info .fbheader #mScore .row.vs`).length > 0) $(`#info .fbheader #mScore .row.vs`).html($(`#info .fbheader #mScore .row.vs`).html().replace('VS', ''))
//     } catch (error) {
//         console.error('commonOnLoad', error)
//     }
// });

var getUrlParameter = function getUrlParameter(sParam) {
    var sPageURL = window.location.search.substring(1),
        sURLVariables = sPageURL.split('&'),
        sParameterName,
        i;

    for (i = 0; i < sURLVariables.length; i++) {
        sParameterName = sURLVariables[i].split('=');

        if (sParameterName[0] === sParam) {
            return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
        }
    }
    return false;
};

function updateDropdownSelection(dropdownId, { handleClickOption } = { handleClickOption: () => {} }) {
    const dropdown = document.getElementById(dropdownId);

    if (!dropdown) return;

    const customSelect = dropdown.querySelector('.custom-select');
    const customOptions = dropdown.querySelectorAll('.custom-option');
    let customSelectValue = customSelect.textContent.trim().toLowerCase();

    customOptions.forEach(option => {
        option.classList.toggle('selected', option.textContent.trim().toLowerCase() === customSelectValue);
    });

    dropdown.addEventListener('click', (e) => {
        const option = e.target.closest('.custom-option');
        if (option) {
            customSelect.textContent = option.textContent;
            customSelectValue = option.textContent.trim().toLowerCase(); // Update selected value

            customOptions.forEach(opt => opt.classList.remove('selected'));
            option.classList.add('selected');

            handleClickOption({
                value: option.getAttribute("value"),
                text: option.textContent,
            });
        }
    });

    dropdown.addEventListener('mouseover', (e) => {
        const option = e.target.closest('.custom-option');
        if (option) {
            customOptions.forEach(opt => opt.classList.remove('selected'));
        }
    });

    dropdown.addEventListener('mouseout', (e) => {
        const option = e.target.closest('.custom-option');
        if (option) {
            customOptions.forEach(opt => {
                opt.classList.toggle('selected', opt.textContent.trim().toLowerCase() === customSelectValue);
            });
        }
    });
}

function parseSelection(selectElementId, activeValue, customClass = '') {
    // Get the select element by its ID
    var selectElement = document.getElementById(selectElementId);
    if (!selectElement || !selectElement.length) return;
    const parentTh = $('#' + selectElementId).parent();

    // Initialize an array to hold the options
    var optionsArray = [];

    // Get the 'onchange' attribute value as the action
    let newOptions = ``;
    let currentOption = `<div class="custom-select">${selectElement.options[activeValue] ? selectElement.options[activeValue].text.trim() : selectElement.options[0].text.trim()}</div>`;
    for (var i = 0; i < selectElement.options.length; i++) {
        var option = selectElement.options[i];

        // Create an object for each option with value and text
        var optionObject = {
            value: option.value,
            text: option.text.trim() // Trim to remove any leading/trailing spaces
        };
        // Add the object to the array
        optionsArray.push(optionObject);
        newOptions += `<div value="${option.value}" onclick="changeSelectValue(${selectElementId}, ${option.value})" class="custom-option ${activeValue == i ? 'selected' : ''}"> ${option.text.trim()} </div>`;
    }
    // Create the final JSON object


    let newSelect = `
    <div class="custom-select-02">
        ${currentOption}
        <div class="custom-options scroll-custom">
            ${newOptions}
        </div>
    </div>
    `;
    const a = parentTh.find('.box-flex-select');
    if (a.length !== 0) a.append(newSelect);
    else parentTh.append(`
    <div class="box-flex-select d-flex ${customClass} ">
        ${newSelect}
    </div>
    `);

    parentTh.find('select').hide();
}
function changeSelectValue(id, value) {
    $(id).val(value).trigger("change");
}

function addMatchToFavouriteList() {
    /***
     *
     * Sample HTML
     * <div id="{{id}}" mid="{{matchID}}"></div>
     *
     * Sample JS
     * $("{{id}}").off("click").on("click", addMatchToFavouriteList);
     *
     */
    try {
        let favMatchIDs = Config.getFavMatchIds();
        let n = $(this),
            t = parseInt(n.attr("mid"));

        let findIndex = favMatchIDs.indexOf(t.toString())

        if(findIndex <= -1) { // Not found
            favMatchIDs.push(t.toString())
        } else {
            favMatchIDs.splice(findIndex, 1)
        }
        Config.setFavMatchIds(favMatchIDs)
    } catch (error) {

    }
}
function addLeagueToFavouriteList() {
    /***
     *
     * Sample HTML
     * <div class="{{id}}" lid="{{matchID}}"></div>
     *
     * Sample JS
     * $("{{id}}").off("click").on("click", addLeagueToFavouriteList);
     *
     */
    try {
        let favLeagueIDs = Config.getFavLeagueIds();
        let n = $(this),
            t = parseInt(n.attr("lid"));

        let findIndex = favLeagueIDs.indexOf(t.toString())

        if(findIndex <= -1) { // Not found
            favLeagueIDs.push(t.toString())
        } else {
            favLeagueIDs.splice(findIndex, 1)
        }
        Config.setFavLeagueIds(favLeagueIDs)
    } catch (error) {

        console.log(error)
    }
}

$(document).ready(function () {
    function replaceImgSrc(selector) {
      const elements = document.querySelectorAll(selector);
      if (elements.length === 0) return;

      elements.forEach(element => {
        const homeElements = element.getElementsByClassName('home');
        const guestElements = element.getElementsByClassName('guest');

        function replaceImgs(elements, newSrc) {
          for (let i = 0; i < elements.length; i++) {
            const imgs = elements[i].getElementsByTagName('img');
            for (let j = 0; j < imgs.length; j++) {
              if (imgs[j].src.includes('football1.')) {
                imgs[j].src = newSrc;
              }
            }
          }
        }

        replaceImgs(homeElements, '/assets/images/home_1.svg');
        replaceImgs(guestElements, '/assets/images/away_1.svg');
      });
    }

    replaceImgSrc('.fbheader.desk');
    replaceImgSrc('.fbheader.mobile');
    replaceImgSrc('#porletP1');
    replaceImgSrc('#porletP2');
    replaceImgSrc('#porletP5');
    replaceImgSrc('#porletP6');
    replaceImgSrc('.table-charts');

    replaceImgSrc('#fbheader');
    replaceImgSrc('.event-football-detail-right-content');

    // hàm đổi về logo mặc định của giải đấu, khi kiểm tra không có hình ảnh
    // function replaceIconOfLuague(url, fallbackUrl, imgElement) {
    //     const img = new Image();
    //     img.onload = function() {
    //         console.log('Image exists:', url);
    //     };
    //     img.onerror = function() {
    //         console.log('Image does not exist:', url);
    //         imgElement.src = fallbackUrl;
    //     };
    //     img.src = url;
    //   }

    //   function checkAndReplaceImage(imgClass) {
    //     const imgElement = document.querySelector(`${imgClass}`);
    //     if (imgElement) {
    //         const imageUrl = imgElement.src;
    //         const currentDomain = window.location.origin;
    //         const fallbackUrl = currentDomain + '/assets/upload/fbcountry/52-flag-small.png';
    //         replaceIconOfLuague(imageUrl, fallbackUrl, imgElement);
    //     }
    //   }

    //   checkAndReplaceImage('.LName img');


    function checkIsHomePage() {
        var homePageElement = document.getElementById('homepage');
        return homePageElement && homePageElement.getAttribute('data-home') === 'true';
    }

    function setActiveForNavigation() {
        const navigation_home = document.getElementById('navigation-home');
        const navigation_hot = document.getElementById('navigation-hot');
        const navigation_new = document.getElementById('navigation-new');

        navigation_home.addEventListener('click', function() {
            navigation_hot.classList.remove('active-sp');
            navigation_new.classList.remove('active-sp');
            navigation_home.classList.add('active-sp');
            // FilterByOption(0);
            window.location.href = '/?ishot=0';
            if (checkIsHomePage()) {

            } else {
                localStorage.setItem('filterApplied', 'home');
                window.location.href = '?is_host';
            }
        });

        navigation_hot.addEventListener('click', function() {
            navigation_home.classList.remove('active-sp');
            navigation_new.classList.remove('active-sp');
            navigation_hot.classList.add('active-sp');
            window.location.href = '/?ishot=1';
            // FilterByOption(1);
            if (checkIsHomePage()) {
            } else {
                localStorage.setItem('filterApplied', 'hot');
                window.location.href = '/';
            }
        });
        navigation_new.addEventListener('click', function() {
            navigation_home.classList.remove('active-sp');
            navigation_hot.classList.remove('active-sp');
            navigation_new.classList.add('active-sp');

        });

        window.addEventListener('load', function() {
            const filterApplied = localStorage.getItem('filterApplied');
            if (filterApplied === 'home') {
                navigation_home.classList.add('active-sp');
                navigation_hot.classList.remove('active-sp');
                // FilterByOption(0);
                localStorage.removeItem('filterApplied');
            } else if (filterApplied === 'hot') {
                navigation_hot.classList.add('active-sp');
                navigation_home.classList.remove('active-sp');
                // FilterByOption(1);
                localStorage.removeItem('filterApplied');
            }
        });
    }

    // setActiveForNavigation();
  });

/// Update 20241003 ///
window.helper = () => {

    const listHtFt = () => {
        return [
            {value: '1', label: 'HT'}, {value: '0', label: 'FT'}
        ]
    }
    const listCompany = (company_id = '') => {
        const list = [ { id: 100, name: "K - Sport" },
            { value: 31, label: "Sbobet" },
            { value: 8, label: "Bet365" },
            { value: 23, label: "188bet" },
            { value: 24, label: "12bet" },
            // { value: 3, label: "Crown" },
            { value: 42, label: "18Bet" },
            { value: 1, label: "Macauslot" },
            { value: 4, label: "Ladbrokes" },
            { value: 12, label: "Easybet" },
        ];
        return company_id ? list.find(x => x.value == company_id) : list;
    };

    const getCompany = () => {
        return this.getCookie('thscore_SelCompany') || 8;
    };

    const setCompany = (company_id) => {
        setCookie('thscore_SelCompany', company_id);
    };

    const setCookie = (name, value, days = 30) => {
        const date = new Date();
        date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
        const expires = "expires=" + date.toUTCString();
        document.cookie = `${name}=${value}; domain=${getDoMain()}; ${expires}; path=/`;
    };

    const getCookie = (cname) => {
        const name = `${cname}=`;
        const decodedCookie = decodeURIComponent(document.cookie);
        const cookieArray = decodedCookie.split(";");

        const cookie = cookieArray.find(c => c.trim().startsWith(name));
        return cookie ? cookie.substring(name.length) : "";
    };

    return { listCompany, getCompany, setCompany, getCookie, setCookie,listHtFt };
};

function getCurrentTimeZone() {
    const timeZone = getCookie("Time_Zone") || getCookie("Default_TimeZone") || 7;
    return Number.parseFloat(timeZone);
}

/// End Update 20241003 ///
