import { jsxs as i, jsx as s, Fragment as C } from "react/jsx-runtime";
import { t as z, e as w, f as T, a as H, b as j, A as Y, s as a, i as W, I as $, c as U, B as h, D as K, d as f, u, r as L, S as D, O as q, g as O, R as P, h as _, w as ss, p as es, j as as, l as ns, k as ls, m as ts, n as is, o as os, q as rs, C as cs } from "./index2.js";
import "@nanostores/react";
import { useRef as G, useState as Z, useCallback as x, useEffect as R } from "react";
import "nanostores";
import "@noriginmedia/norigin-spatial-navigation";
import "react-countdown-circle-timer";
import "react-countup";
import "lodash.throttle";
import ds from "react-infinite-scroller";
const ps = /* @__PURE__ */ T(" ", [H, j]), ms = /* @__PURE__ */ w(ps, 1), B = /* @__PURE__ */ z(ms), bs = (e, n, l) => {
  const o = n >= Y.lg && n < Y.xl ? 75 : 52;
  e.current && window.scrollTo({
    top: e.current.offsetTop - o,
    ...l
  });
}, us = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "c1zy8a",
  propsAsIs: !1
}), hs = /* @__PURE__ */ a("div")({
  name: "Title",
  class: "t1vih9p5",
  propsAsIs: !1
}), As = /* @__PURE__ */ a("div")({
  name: "Indicator",
  class: "i1fbnvpb",
  propsAsIs: !1
}), y = ({ indicator: e, title: n }) => /* @__PURE__ */ i(us, { children: [
  /* @__PURE__ */ s(hs, { children: n }),
  /* @__PURE__ */ s(As, { children: e })
] }), vs = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "ctmhwyc",
  propsAsIs: !1
}), Ws = /* @__PURE__ */ a("div")({
  name: "Indicator",
  class: "i1jri200",
  propsAsIs: !1
}), Is = /* @__PURE__ */ a("div")({
  name: "Title",
  class: "t8s05oq",
  propsAsIs: !1
}), I = ({ indicator: e, title: n }) => /* @__PURE__ */ i(vs, { children: [
  /* @__PURE__ */ s(Ws, { children: e }),
  /* @__PURE__ */ s(Is, { children: n })
] }), Rs = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "c1yrpn9o",
  propsAsIs: !1
}), gs = /* @__PURE__ */ a("div")({
  name: "TopInfo",
  class: "t17fwahh",
  propsAsIs: !1
}), Vs = /* @__PURE__ */ a("div")({
  name: "BottomInfo",
  class: "by6w7e9",
  propsAsIs: !1
}), Cs = /* @__PURE__ */ a("div")({
  name: "User",
  class: "u1g7arbm",
  propsAsIs: !1
}), Gs = /* @__PURE__ */ a("img")({
  name: "Avatar",
  class: "a1ldeata",
  propsAsIs: !1
}), Zs = /* @__PURE__ */ a("div")({
  name: "UserInfo",
  class: "u10d4koz",
  propsAsIs: !1
}), Xs = /* @__PURE__ */ a("div")({
  name: "UserName",
  class: "u1q6roj0",
  propsAsIs: !1
}), Ss = /* @__PURE__ */ a("div")({
  name: "UserRating",
  class: "ui0m425",
  propsAsIs: !1
}), Ys = /* @__PURE__ */ a("img")({
  name: "TrophyIcon",
  class: "t1el3mrn",
  propsAsIs: !1
}), ys = /* @__PURE__ */ a("div")({
  name: "RtsContainer",
  class: "r2vgnxv",
  propsAsIs: !1
}), Es = /* @__PURE__ */ a("div")({
  name: "RtsDivider",
  class: "roqn06j",
  propsAsIs: !1
}), Ns = /* @__PURE__ */ a("div")({
  name: "Rts",
  class: "r15adx7c",
  propsAsIs: !1
}), E = /* @__PURE__ */ a("div")({
  name: "RtsIndicator",
  class: "rv59lta",
  propsAsIs: !1
}), N = /* @__PURE__ */ a("div")({
  name: "RtsLabel",
  class: "r55lotb",
  propsAsIs: !1
}), Fs = /* @__PURE__ */ a("div")({
  name: "Divider",
  class: "d1knfgqt",
  propsAsIs: !1
}), ks = /* @__PURE__ */ a("div")({
  name: "Ranks",
  class: "r1mqo824",
  propsAsIs: !1
}), $s = /* @__PURE__ */ a("div")({
  name: "Statistics",
  class: "sxareh6",
  propsAsIs: !1
}), Us = /* @__PURE__ */ a("div")({
  name: "AvatarPlaceholder",
  class: "amcu48h",
  propsAsIs: !1
}), fs = /* @__PURE__ */ a("button")({
  name: "UserAccountBtn",
  class: "u32nfkp",
  propsAsIs: !1
}), Ls = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Trophy'%3e%3cpath%20id='Combined%20Shape'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3.69197%204.66662C3.69197%205.99705%203.92914%207.17787%204.4035%208.20912C3.49966%208.02451%202.74487%207.66486%202.1391%207.13014C1.53333%206.59542%201.23046%206.0798%201.23046%205.58328V4.66662H3.69197ZM14.7686%204.66662V5.58328C14.7686%206.0798%2014.4658%206.59542%2013.86%207.13014C13.2542%207.66486%2012.4994%208.02451%2011.5956%208.20912C12.0699%207.17787%2012.3071%205.99705%2012.3071%204.66662H14.7686ZM15.9998%205.58329V4.36108C15.9998%204.10645%2015.9101%203.89002%2015.7306%203.71178C15.5511%203.53354%2015.3332%203.44442%2015.0768%203.44442H12.3076V2.52776C12.3076%202.10763%2012.1569%201.74797%2011.8556%201.44878C11.5544%201.14959%2011.1922%201%2010.7691%201H5.23072C4.80764%201%204.44547%201.14959%204.14419%201.44878C3.84291%201.74797%203.69227%202.10763%203.69227%202.52776V3.44442H0.923068C0.666659%203.44442%200.448714%203.53354%200.269228%203.71178C0.0897418%203.89002%200%204.10645%200%204.36108V5.58329C0%206.03525%200.13301%206.49039%200.399034%206.94872C0.665059%207.40705%201.02403%207.82082%201.47595%208.19003C1.92787%208.55924%202.48234%208.86957%203.13939%209.12101C3.79644%209.37246%204.48713%209.51409%205.21149%209.54592C5.48071%209.88967%205.7852%2010.192%206.12494%2010.453C6.36853%2010.6695%206.53679%2010.9002%206.62974%2011.1453C6.72269%2011.3904%206.76916%2011.6752%206.76916%2011.9999C6.76916%2012.3436%206.67141%2012.6333%206.4759%2012.8688C6.28038%2013.1043%205.96789%2013.2221%205.53841%2013.2221C5.05764%2013.2221%204.62976%2013.3669%204.25476%2013.6566C3.87977%2013.9462%203.69227%2014.3106%203.69227%2014.7499V15.361C3.69227%2015.4501%203.72112%2015.5233%203.77881%2015.5806C3.8365%2015.6379%203.91022%2015.6665%203.99996%2015.6665H11.9999C12.0896%2015.6665%2012.1633%2015.6379%2012.221%2015.5806C12.2787%2015.5233%2012.3076%2015.4501%2012.3076%2015.361V14.7499C12.3076%2014.3106%2012.1201%2013.9462%2011.7451%2013.6566C11.3701%2013.3669%2010.9422%2013.2221%2010.4614%2013.2221C10.0319%2013.2221%209.71945%2013.1043%209.52394%2012.8688C9.32843%2012.6333%209.23068%2012.3436%209.23068%2011.9999C9.23068%2011.6752%209.27715%2011.3904%209.3701%2011.1453C9.46305%2010.9002%209.63131%2010.6695%209.8749%2010.453C10.2146%2010.192%2010.5191%209.88967%2010.7884%209.54592C11.5127%209.51409%2012.2034%209.37246%2012.8604%209.12101C13.5175%208.86957%2014.072%208.55924%2014.5239%208.19003C14.9758%207.82082%2015.3348%207.40705%2015.6008%206.94872C15.8668%206.49039%2015.9998%206.03525%2015.9998%205.58329ZM6.76047%207.1798L8.05109%206.49997L9.3417%207.1798L9.09521%205.73989L10.1393%204.72015L8.69639%204.51007L8.05109%203.2L7.40578%204.51007L5.96283%204.72015L7.00696%205.73989L6.76047%207.1798Z'%20fill='%23F2C94C'/%3e%3c/g%3e%3c/svg%3e", xs = ({
  loading: e,
  hideFriendsRank: n,
  avatar: l,
  name: o,
  points: t,
  friendsRank: r,
  rank: d,
  streak: p,
  correct: c,
  incorrect: m,
  inTop: b,
  successRate: g
}) => /* @__PURE__ */ i(Rs, { "data-loading": e, children: [
  /* @__PURE__ */ s(gs, { children: /* @__PURE__ */ s(W, { loading: e, children: /* @__PURE__ */ i(Cs, { children: [
    /* @__PURE__ */ i(fs, { children: [
      l && /* @__PURE__ */ s(Gs, { alt: "avatar", src: l }),
      !l && /* @__PURE__ */ s(Us, { children: $(o || "") })
    ] }),
    /* @__PURE__ */ i(Zs, { children: [
      /* @__PURE__ */ s(Xs, { children: o }),
      /* @__PURE__ */ i(Ss, { children: [
        /* @__PURE__ */ i(ys, { children: [
          /* @__PURE__ */ i(Ns, { children: [
            /* @__PURE__ */ s(Ys, { alt: "rank-icon", src: Ls }),
            /* @__PURE__ */ i(E, { children: [
              U(t),
              /* @__PURE__ */ s(N, { children: "PTS" })
            ] })
          ] }),
          n && /* @__PURE__ */ i(E, { children: [
            /* @__PURE__ */ s(Es, {}),
            d || 0,
            /* @__PURE__ */ s(N, { children: "global rank" })
          ] })
        ] }),
        !n && /* @__PURE__ */ i(C, { children: [
          /* @__PURE__ */ s(Fs, {}),
          /* @__PURE__ */ i("div", { children: [
            "TOP ",
            b || 0,
            "%"
          ] })
        ] })
      ] })
    ] })
  ] }) }) }),
  /* @__PURE__ */ i(Vs, { children: [
    !n && /* @__PURE__ */ i(ks, { children: [
      /* @__PURE__ */ s(W, { loading: e, style: { width: "100%" }, children: /* @__PURE__ */ s(y, { indicator: r || 0, title: "Friends rank" }) }),
      /* @__PURE__ */ s(W, { loading: e, style: { width: "100%" }, children: /* @__PURE__ */ s(y, { indicator: d || 0, title: "Global rank" }) })
    ] }),
    /* @__PURE__ */ s(W, { loading: e, children: /* @__PURE__ */ i($s, { children: [
      /* @__PURE__ */ s(I, { indicator: p || 0, title: "Win streak" }),
      /* @__PURE__ */ s(I, { indicator: c || 0, title: "Correct" }),
      /* @__PURE__ */ s(I, { indicator: m || 0, title: "Incorrect" }),
      /* @__PURE__ */ s(I, { indicator: `${g || 0}%`, title: "Succ. rate" })
    ] }) })
  ] })
] }), Bs = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "c115qtkr",
  propsAsIs: !1
}), Js = /* @__PURE__ */ a("div")({
  name: "STabs",
  class: "sxnslc8",
  propsAsIs: !1
}), Qs = /* @__PURE__ */ a("button")({
  name: "Button",
  class: "b1umzux0",
  propsAsIs: !1
}), Ms = /* @__PURE__ */ a("span")({
  name: "Title",
  class: "tspsaas",
  propsAsIs: !1
});
var v = /* @__PURE__ */ ((e) => (e.HOME = "home", e.LEADERBOARD = "leaderboard", e))(v || {});
const F = ({ title: e, active: n, onClick: l }) => /* @__PURE__ */ s(Qs, { "data-a": "intr", onClick: l, "data-selected": n, children: /* @__PURE__ */ s(Ms, { "data-a": "intr", children: e }) }), zs = ({ activePage: e = "home", toggleActivePage: n }) => /* @__PURE__ */ s(Bs, { children: /* @__PURE__ */ i(Js, { "data-position": e === "home" ? "left" : "right", children: [
  /* @__PURE__ */ s(F, { title: "Home", active: e === "home", onClick: () => n(
    "home"
    /* HOME */
  ) }),
  /* @__PURE__ */ s(
    F,
    {
      title: "Friends",
      active: e === "leaderboard",
      onClick: () => n(
        "leaderboard"
        /* LEADERBOARD */
      )
    }
  )
] }) }), ws = /* @__PURE__ */ a("button")({
  name: "Container",
  class: "cpjnajb",
  propsAsIs: !1
}), Ts = /* @__PURE__ */ a("div")({
  name: "Content",
  class: "c4m6kaz",
  propsAsIs: !1
}), Hs = /* @__PURE__ */ a("span")({
  name: "Title",
  class: "t1h8t9cc",
  propsAsIs: !1
}), js = () => /* @__PURE__ */ s(ws, { children: /* @__PURE__ */ i(Ts, { children: [
  /* @__PURE__ */ s(h, { name: "iconCopySuccess" }),
  /* @__PURE__ */ s(Hs, { children: "Link Copied to Clipboard" })
] }) }), J = (e) => {
  const n = G(), [l, o] = Z(null), t = x(
    async (r) => {
      var d;
      if (r && (d = navigator == null ? void 0 : navigator.clipboard) != null && d.writeText) {
        n.current && (clearTimeout(n.current), o(null));
        try {
          await navigator.clipboard.writeText(r), e.current && (o(K.createPortal(/* @__PURE__ */ s(js, {}), e.current)), n.current = setTimeout(() => {
            o(null);
          }, 1e3));
        } catch (p) {
          console.error("Unable to copy to clipboard", p);
        }
      }
    },
    [e]
  );
  return R(() => () => {
    clearTimeout(n.current);
  }, []), [t, l];
}, Ks = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "c1ux29ft",
  propsAsIs: !1
}), Ds = () => h, qs = /* @__PURE__ */ a(Ds())({
  name: "FriendsIcon",
  class: "f10ncfg2",
  propsAsIs: !0
}), Os = /* @__PURE__ */ a("div")({
  name: "Content",
  class: "c1yc07bd",
  propsAsIs: !1
}), Ps = /* @__PURE__ */ a("div")({
  name: "Title",
  class: "tj6cq7w",
  propsAsIs: !1
}), _s = /* @__PURE__ */ a("div")({
  name: "Description",
  class: "d1ag78xo",
  propsAsIs: !1
}), se = () => h, ee = /* @__PURE__ */ a(se())({
  name: "ArrowInviteIcon",
  class: "awohrz6",
  propsAsIs: !0
}), ae = ({ title: e, description: n, onClick: l, className: o }) => {
  const [t] = f({
    type: "invitation",
    action: "sent",
    payload: {
      from: B.TITLE_CARD
    }
  });
  return /* @__PURE__ */ i(Ks, { "data-a": "intr", onClick: t(l), className: o, children: [
    /* @__PURE__ */ s(qs, { name: "icon-friends" }),
    /* @__PURE__ */ i(Os, { children: [
      /* @__PURE__ */ s(Ps, { children: e }),
      /* @__PURE__ */ s(_s, { children: n })
    ] }),
    /* @__PURE__ */ s(ee, { name: "icon-copy" })
  ] });
}, ne = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "culdu4a",
  propsAsIs: !1
}), le = /* @__PURE__ */ a("div")({
  name: "Position",
  class: "pwf8e69",
  propsAsIs: !1
}), te = /* @__PURE__ */ a("img")({
  name: "Avatar",
  class: "atf4yh4",
  propsAsIs: !1
}), ie = /* @__PURE__ */ a("div")({
  name: "AvatarPlaceholder",
  class: "a1dg29ja",
  propsAsIs: !1
}), oe = /* @__PURE__ */ a("div")({
  name: "Content",
  class: "c10a68rc",
  propsAsIs: !1
}), re = /* @__PURE__ */ a("div")({
  name: "NameContainer",
  class: "nc4kck5",
  propsAsIs: !1
}), ce = /* @__PURE__ */ a("span")({
  name: "Name",
  class: "njsrqgr",
  propsAsIs: !1
}), de = () => h, pe = /* @__PURE__ */ a(de())({
  name: "CurrentUserBadge",
  class: "c17uc4zr",
  propsAsIs: !0
}), me = ({
  friendsRank: e,
  avatar: n,
  name: l,
  userId: o,
  points: t,
  isCurrentUser: r,
  style: d
}) => /* @__PURE__ */ i(ne, { "data-name": o, style: d, children: [
  /* @__PURE__ */ s(le, { children: e || 0 }),
  /* @__PURE__ */ i(oe, { children: [
    n ? /* @__PURE__ */ s(te, { alt: "leaderboard-item-avatar", src: n }) : /* @__PURE__ */ s(ie, { children: $(l || "") }),
    /* @__PURE__ */ i(re, { children: [
      /* @__PURE__ */ s(ce, { children: l || "" }),
      r && /* @__PURE__ */ s(pe, { name: "icon-star" })
    ] })
  ] }),
  /* @__PURE__ */ s("div", { children: U(t) })
] }), be = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "c16btbfp",
  propsAsIs: !1
}), ue = ({
  items: e,
  currentUserId: n,
  openItemDetail: l,
  fetchMore: o,
  scrollNode: t,
  hasMore: r
}) => {
  const d = x((p) => {
    const c = p.target.getAttribute("data-name");
    c && l(c);
  }, [l]);
  return /* @__PURE__ */ s(ds, {
    loadMore: o,
    initialLoad: !1,
    hasMore: r,
    useWindow: !1,
    getScrollParent: () => t.current,
    children: /* @__PURE__ */ s(be, {
      "data-a": "intr",
      onClick: d,
      children: e.map((p) => /* @__PURE__ */ s(me, {
        ...p,
        isCurrentUser: !!n && n === p.userId
      }, p.userId))
    })
  });
}, he = /* @__PURE__ */ a("div")({
  name: "Container",
  class: "c1itm4k7",
  propsAsIs: !1
}), Ae = /* @__PURE__ */ a("div")({
  name: "IconContainer",
  class: "i1w4fsni",
  propsAsIs: !1
}), ve = () => h, We = /* @__PURE__ */ a(ve())({
  name: "InviteGameIcon",
  class: "i19m85r1",
  propsAsIs: !0
}), Ie = /* @__PURE__ */ a("div")({
  name: "Content",
  class: "c1mbu204",
  propsAsIs: !1
}), Re = /* @__PURE__ */ a("div")({
  name: "Heading",
  class: "h1amdqtv",
  propsAsIs: !1
}), ge = /* @__PURE__ */ a("div")({
  name: "Subtext",
  class: "s1lhlj9j",
  propsAsIs: !1
}), Ve = /* @__PURE__ */ a("div")({
  name: "LinkContainer",
  class: "l1wot35e",
  propsAsIs: !1
}), Ce = /* @__PURE__ */ a("div")({
  name: "LinkInfo",
  class: "l1jdw39q",
  propsAsIs: !1
}), Ge = /* @__PURE__ */ a("span")({
  name: "LinkTitle",
  class: "l1cr5mk",
  propsAsIs: !1
}), Ze = /* @__PURE__ */ a("span")({
  name: "LinkAddress",
  class: "lvi87q4",
  propsAsIs: !1
}), Xe = () => h, Se = /* @__PURE__ */ a(Xe())({
  name: "LinkIcon",
  class: "l1pqlvw3",
  propsAsIs: !0
}), Ye = ({
  inviteLink: e,
  inviteCardTitle: n,
  inviteCardSubtext: l,
  primaryColor: o,
  className: t
}) => {
  const r = G(null), [d, p] = J(r), [c] = f({
    type: "invitation",
    action: "sent",
    payload: {
      from: B.MENU
    }
  });
  return /* @__PURE__ */ i(he, { className: t, children: [
    /* @__PURE__ */ s(Ae, { style: { backgroundColor: o }, children: /* @__PURE__ */ s(We, { name: "invite-game-icon" }) }),
    /* @__PURE__ */ i(Ie, { children: [
      /* @__PURE__ */ s(Re, { children: n || "" }),
      /* @__PURE__ */ s(ge, { children: l || "" })
    ] }),
    e && /* @__PURE__ */ i(Ve, { ref: r, "data-a": "intr", onClick: c(() => d(e)), children: [
      /* @__PURE__ */ i(Ce, { children: [
        /* @__PURE__ */ s(Ge, { children: "Invite link" }),
        /* @__PURE__ */ s(Ze, { children: e })
      ] }),
      /* @__PURE__ */ s(Se, { name: "icon-copy" })
    ] }),
    p
  ] });
}, ye = /* @__PURE__ */ a("div")({
  name: "InviteFriendsContainer",
  class: "i1c9dygq",
  propsAsIs: !1
}), Ee = ({
  deepLink: e
}) => /* @__PURE__ */ s(ye, {
  children: /* @__PURE__ */ s(Ye, {
    inviteLink: e,
    inviteCardTitle: "It’s More Fun With Friends",
    inviteCardSubtext: "Invite and compete against your friends for the top spot on the leaderboard."
  })
}), Ne = /* @__PURE__ */ a("div")({
  name: "InviteLinkContainer",
  class: "i1odbhm4",
  propsAsIs: !1
}), Fe = ({
  gamification: e,
  scrollNode: n,
  scrollStore: l
}) => {
  const o = G(null), {
    data: t,
    hasMore: r,
    loading: d,
    key: p
  } = u(e.leaderboardList.$store), {
    data: c
  } = u(e.deepLink.$store), [m, b] = J(o);
  return !t.length && !d ? /* @__PURE__ */ s(Ee, {
    deepLink: c
  }) : /* @__PURE__ */ i(C, {
    children: [/* @__PURE__ */ s(ue, {
      items: t,
      scrollNode: n,
      scrollStore: l,
      fetchMore: e.leaderboardList.fetchMore,
      hasMore: r,
      openItemDetail: e.openUser,
      currentUserId: e.currentUserId.get()
    }, p), c && /* @__PURE__ */ s(Ne, {
      ref: o,
      children: /* @__PURE__ */ s(ae, {
        "data-a": "intr",
        onClick: () => m(c),
        title: "Invite Friends",
        description: "Challenge them now!"
      })
    }), b]
  });
}, ke = () => L, $e = /* @__PURE__ */ a(ke())({
  name: "Container",
  class: "cll3md7",
  propsAsIs: !0
}), Ue = () => D, fe = /* @__PURE__ */ a(Ue())({
  name: "ActionBtn",
  class: "a10g1iik",
  propsAsIs: !0
}), Le = ({ questionId: e, ...n }) => /* @__PURE__ */ i($e, { "data-a": "intr", "data-name": e, children: [
  /* @__PURE__ */ s(q, { questionId: e, ...n }),
  /* @__PURE__ */ s(fe, { "data-a": "intr", "data-name": e, children: "View Insight" })
] }), xe = () => L, Be = /* @__PURE__ */ a(xe())({
  name: "Container",
  class: "cl56x6b",
  propsAsIs: !0
}), Je = /* @__PURE__ */ a("button")({
  name: "ActionButton",
  class: "a11pzf92",
  propsAsIs: !1
}), Qe = /* @__PURE__ */ a("blockquote")({
  name: "Quote",
  class: "q1hbaleq",
  propsAsIs: !1
}), Me = ({ ...e }) => /* @__PURE__ */ i(Be, { "data-a": "intr", "data-name": e.tweetId, children: [
  e.title && /* @__PURE__ */ s(Qe, { children: e.title }),
  /* @__PURE__ */ s(O, { ...e }),
  /* @__PURE__ */ s(Je, { "data-a": "intr", "data-name": e.tweetId, children: "View Insight" })
] }), k = /* @__PURE__ */ a("div")({
  name: "QuestionsContainer",
  class: "qvghv3l",
  propsAsIs: !1
}), ze = ({ questions: e, openQuestion: n, controlVideo: l }) => e ? /* @__PURE__ */ s(k, { "data-a": "intr", onClick: (t) => {
  const r = t.target.getAttribute("data-name");
  r && (ss(), n(r, { openedFrom: "list" }));
}, children: e == null ? void 0 : e.map((t) => {
  var r, d, p;
  if (t.type === "question" && ((r = t.attributes) == null ? void 0 : r.attributes.case) === "question") {
    const c = t.attributes.attributes.value;
    return /* @__PURE__ */ s(P, { ...c }, c.questionId);
  }
  if (t.type === "insight" && ((d = t.attributes) == null ? void 0 : d.attributes.case) === "insight") {
    const c = t.attributes.attributes.value;
    return /* @__PURE__ */ s(Le, { controlVideo: l, ...c }, c.questionId);
  }
  if (t.type === "tweet" && ((p = t.attributes) == null ? void 0 : p.attributes.case) === "tweet") {
    const c = t.attributes.attributes.value, m = t.attributes.id;
    return /* @__PURE__ */ s(Me, { controlVideo: l, ...c, tweetId: m }, m);
  }
  return null;
}) }) : /* @__PURE__ */ s(k, { children: Array.from({ length: 5 }).map((t, r) => /* @__PURE__ */ s(_, {}, r)) }), we = ({ store: e, openQuestion: n }) => {
  const { sdk: l } = es(), o = u(e);
  return /* @__PURE__ */ s(ze, { openQuestion: n, questions: o.data, controlVideo: l == null ? void 0 : l.controlVideoPlayer });
}, Te = ({ userSummary: e }) => {
  var n;
  const [l, o] = Z(void 0);
  return R(() => {
    const t = e.$store.subscribe((r) => {
      r && o(r);
    });
    return () => {
      t();
    };
  }, [e]), /* @__PURE__ */ s(xs, { loading: !(l != null && l.summary), ...l == null ? void 0 : l.summary, successRate: (n = l == null ? void 0 : l.percentage) == null ? void 0 : n.correct });
}, He = ({ gamification: e, className: n, scrollStore: l, scrollNode: o, appNode: t, style: r, responsiveStore: d }) => {
  const { tabsShown: p } = u(l, { keys: ["tabsShown"] }), c = u(e.friendsTabEnabled), [m, b] = Z(v.HOME), [, g] = as(), { sdkInDesktopView: X, screen: Q } = u(d, { keys: ["sdkInDesktopView"] }), M = (A) => {
    g(() => {
      var S;
      b(A), X === !1 && (((S = t.current) == null ? void 0 : S.getBoundingClientRect().y) || 0) < 0 && bs(t, Q.size, { behavior: "instant" });
    });
  };
  R(() => l.subscribe((A) => {
    if (A.scrollPosition === 0) {
      l.setKey("tabsShown", !0);
      return;
    }
    d.get().sdkInDesktopView ? l.setKey("tabsShown", A.scrollDirection === "backward") : l.setKey("tabsShown", A.scrollDirection === "forward");
  }), [l, d]), R(() => {
    c || b(v.HOME);
  }, [c]);
  let V = "0px";
  return X ? V = p ? "0px" : "calc(0px - var(--header-height))" : V = p ? "var(--header-height)" : "0px", /* @__PURE__ */ i(ns, { className: ls(n, "SL-Tabs", "sl-hide-on-modal"), style: r, children: [
    c && /* @__PURE__ */ s(
      ts,
      {
        style: {
          top: V
        },
        children: /* @__PURE__ */ s(zs, { activePage: m, toggleActivePage: M })
      }
    ),
    m === v.HOME && /* @__PURE__ */ i(C, { children: [
      /* @__PURE__ */ s(is, { children: /* @__PURE__ */ s(os, { children: /* @__PURE__ */ s(Te, { userSummary: e.userSummary }) }) }),
      /* @__PURE__ */ s(rs, { style: { flex: 1 }, children: /* @__PURE__ */ s(we, { openQuestion: e.openQuestion, store: e.feedList.getStore() }) })
    ] }),
    m === v.LEADERBOARD && /* @__PURE__ */ s(cs, { children: /* @__PURE__ */ s(Fe, { scrollStore: l, scrollNode: o, gamification: e }) })
  ] });
}, na = ({
  gamification: e,
  scrollStore: n,
  className: l,
  appNode: o,
  scrollNode: t,
  responsiveStore: r
}) => /* @__PURE__ */ s(He, {
  appNode: o,
  scrollStore: n,
  scrollNode: t,
  className: l,
  gamification: e,
  responsiveStore: r
});
export {
  na as default
};
