import {
    G as j,
    aT as A,
    r as m,
    B as F,
    C as G,
    W as J,
    $,
    H as b,
    N as a,
    I as o,
    J as e,
    P as n,
    ao as u,
    K as p,
    M as g,
    Q as _,
    av as z,
    ap as I,
    V as K
} from "./common.modules-5cfe2cf4.js";
import {
    R as Q,
    v as q
} from "./page-saasLottery-D5-2f97b5a2.js";
import {
    _ as O
} from "./page-activity-ActivityDetail-a58ec568.js";
import "./page-activity-Bonus-3c16c86d.js";
import "./page-turntable-assets-d6267459.js";
import "./native/index-2ac88fb8.js";
import "./en-cfd26acf.js";
const U = {
        class: "t"
    },
    X = {
        class: "t-b1"
    },
    Y = {
        class: "t-b1-l w"
    },
    Z = {
        class: "w"
    },
    ee = {
        class: "t-b1-l"
    },
    te = {
        class: "t-b1-l-n"
    },
    se = {
        class: "t-b1-l"
    },
    ae = {
        class: "t-b1-l-n"
    },
    oe = {
        class: "t-b1-l"
    },
    ne = {
        class: "t-b1-l-n"
    },
    le = {
        class: "t-b1-l"
    },
    ie = {
        class: "t-b1-l-n"
    },
    re = {
        class: "t-b2"
    },
    ce = ["IssueNumber", "Number", "Colour", "rowId"],
    ue = {
        class: "t-b2-i"
    },
    de = {
        class: "t-b2-Num"
    },
    ve = ["id"],
    _e = {
        key: 0,
        class: "flex-center t-b2-loading",
        style: {
            height: "100%"
        }
    },
    me = {
        key: 1,
        class: "t-b2-empty flex-center"
    },
    pe = {
        key: 0,
        class: "t-foot"
    },
    ge = {
        class: "t-foot-page"
    },
    fe = j({
        __name: "trend",
        setup(he) {
            const L = A("trxWinHook"),
                {
                    historyIssuesTotalPage: D,
                    historyIssues: H,
                    gameCode: E,
                    update: R
                } = L,
                P = m([]),
                c = F(() => P.value.length ? P.value : H.value),
                f = m([]),
                l = m(1),
                V = m(10),
                y = m(!1),
                h = m(D.value);

            function B() {
                K(() => {
                    for (let t = 0; t < c.value.length; t++) c.value[t + 1] && W(t, c.value[t], c.value[t + 1])
                })
            }

            function W(t, d, N) {
                let C = parseInt(d.number),
                    k = parseInt(N.number);
                const v = document.getElementById("myCanvas" + t);
                if (v && v.getContext) {
                    var r = v.getContext("2d");
                    r.clearRect(0, 0, v.width, v.height), r.beginPath(), r.moveTo(C == 0 ? 20 : C * 29 + 20, 0), r.lineTo(k == 0 ? 20 : k * 29 + 20, v.height), r.strokeStyle = "red", r.stroke(), r.closePath()
                }
            }
            const x = () => {
                    l.value < 2 || (l.value--, T())
                },
                M = () => {
                    l.value++, !(l.value > h.value) && T()
                },
                S = async () => {
                    const {
                        result: t,
                        data: d
                    } = await Q({
                        gameCode: E.value,
                        pageNo: l.value,
                        pageSize: 10
                    });
                    t && (f.value = d)
                },
                T = async () => {
                    try {
                        y.value = !0;
                        const {
                            result: t,
                            data: d
                        } = await q({
                            gameCode: E.value,
                            pageNo: l.value,
                            pageSize: V.value
                        });
                        t && (P.value = d.list || [], l.value = d.pageNo || 1, h.value = d.totalPage || 0)
                    } catch {} finally {
                        y.value = !1
                    }
                };
            return G(async () => {
                c.value.length && B(), await S()
            }), J(() => {
                B()
            }), $(c, () => {
                B(), S()
            }), $(D, () => {
                h.value = D.value
            }), $(R, () => {
                l.value = 1, T(), S()
            }), (t, d) => {
                const N = b("van-col"),
                    C = b("van-row"),
                    k = b("van-loading"),
                    v = b("Empty"),
                    r = b("van-icon");
                return a(), o("div", U, [e("div", X, [e("div", Y, [e("span", Z, n(t.$t("trendDesc1")), 1)]), u('      <div class="t-b1-l lottery">'), u("        <div>{{ $t('trendDesc2') }}</div>"), u('        <div class="t-b1-l-n">'), u('          <div v-for="item in 10" :key="item">{{ item - 1 }}</div>'), u("        </div>"), u("      </div>"), e("div", ee, [e("div", null, n(t.$t("trendDesc3")), 1), e("div", te, [(a(!0), o(p, null, g(f.value, (s, i) => (a(), o("div", {
                    key: "4" + i
                }, n(s.missingCount), 1))), 128))])]), e("div", se, [e("div", null, n(t.$t("trendDesc4")), 1), e("div", ae, [(a(!0), o(p, null, g(f.value, (s, i) => (a(), o("div", {
                    key: "2" + i
                }, n(s.avgMissing), 1))), 128))])]), e("div", oe, [e("div", null, n(t.$t("trendDesc5")), 1), e("div", ne, [(a(!0), o(p, null, g(f.value, (s, i) => (a(), o("div", {
                    key: "5" + i
                }, n(s.openCount), 1))), 128))])]), e("div", le, [e("div", null, n(t.$t("trendDesc6")), 1), e("div", ie, [(a(!0), o(p, null, g(f.value, (s, i) => (a(), o("div", {
                    key: "3" + i
                }, n(s.maxContinuous), 1))), 128))])])]), e("div", re, [(a(!0), o(p, null, g(c.value, (s, i) => (a(), o("div", {
                    key: i,
                    IssueNumber: s.issueNumber,
                    Number: s.number,
                    Colour: s.colour,
                    rowId: i,
                    class: "t-b2-item"
                }, [_(C, null, {
                    default: z(() => [_(N, {
                        span: "9"
                    }, {
                        default: z(() => [e("div", ue, n(s.issueNumber), 1)]),
                        _: 2
                    }, 1024), _(N, {
                        span: "15"
                    }, {
                        default: z(() => [e("div", de, [e("canvas", {
                            id: "myCanvas" + i,
                            ref_for: !0,
                            ref: "canvas",
                            class: "line-canvas"
                        }, null, 8, ve), (a(), o(p, null, g(10, w => e("div", {
                            class: I(["t-b2-Num-item", Number(s.number) == w - 1 ? "action" + (w - 1) : ""]),
                            key: w
                        }, n(w - 1), 3)), 64)), e("div", {
                            class: I(["t-b2-Num-BS", {
                                isB: Number(s.number) > 4
                            }])
                        }, n(Number(s.number) > 4 ? "B" : "S"), 3)])]),
                        _: 2
                    }, 1024)]),
                    _: 2
                }, 1024)], 8, ce))), 128)), y.value ? (a(), o("div", _e, [_(k, {
                    type: "spinner",
                    color: "#FD565C"
                })])) : u("v-if", !0), c.value.length === 0 && !y.value ? (a(), o("div", me, [_(v)])) : u("v-if", !0)]), c.value.length ? (a(), o("div", pe, [e("div", {
                    class: I(["t-foot-previous", {
                        disabled: l.value <= 1
                    }]),
                    onClick: x
                }, [_(r, {
                    name: "arrow-left",
                    class: "t-icon",
                    size: "20"
                })], 2), e("div", ge, n(l.value) + "/" + n(h.value), 1), e("div", {
                    class: I(["t-foot-next", {
                        disabled: l.value >= h.value
                    }]),
                    onClick: M
                }, [_(r, {
                    name: "arrow",
                    class: "t-icon",
                    size: "20"
                })], 2)])) : u("v-if", !0)])
            }
        }
    });
const De = O(fe, [
    ["__scopeId", "data-v-e3d7427f"],
    ["__file", "/usr/local/jenkins-prod/workspace/AR048-Pages-india-91club/src/saasLottery/game/TrxWinGo/components/trx2/trend.vue"]
]);
export {
    De as
    default
};