var Ce = Object.defineProperty;
var Ee = (e, t, n) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
var k = (e, t, n) => Ee(e, typeof t != "symbol" ? t + "" : t, n);
import { useState as S, useEffect as y, useRef as x, PureComponent as Re, useCallback as j, lazy as xe, useMemo as w, Suspense as Le, forwardRef as be, useLayoutEffect as De, useContext as Y } from "react";
import { i as Z, F as Te, z as Oe, Y as X } from "./hooks-WfHlJH12.js";
import { jsx as i, jsxs as f, Fragment as L } from "react/jsx-runtime";
import { I as _e, S as N, f as R, h as ee, Q as V } from "./useStreamLayerApp2.js";
import { h as Me } from "./index8.js";
import { A as T, u as v, s as u, b as Ue, c as C, a as z } from "./sl-types.js";
import { l as Be, a as Fe, m as ze, d as Pe, n as Ve, C as qe, S as je, b as Ke, f as G, p as Qe, c as Ge } from "./index11.js";
import { M as We, a as He, k as Je, z as ke, c as ye, T as Ne, I as Ye, t as Ze, f as Xe, w as te, D as et, p as tt } from "./index16.js";
import K from "lodash.throttle";
import { f as Se, a as nt, b as st, A as ot } from "./analytics.js";
import { m as B } from "./theme.js";
import { F as it, c as M } from "./feature.js";
import "nanostores";
import { p as W, h as at, e as rt } from "./Question.js";
import { y as lt } from "./index10.js";
import { B as D } from "./index6.js";
import dt from "react-infinite-scroller";
import { I as ct, s as pt, e as ut } from "./index12.js";
import "uuid";
import "@nanostores/query";
import "./storage.js";
import "./index7.js";
import { createPortal as mt } from "react-dom";
import { e as ht } from "./index3.js";
import "./notification.js";
const ne = Object.keys(T), se = () => {
  const e = window.innerWidth;
  let t = "sm";
  for (let n = ne.length - 1; n > 0; n--) {
    const o = ne[n];
    if (!(e < T[o]) && e >= T[o]) {
      t = o;
      break;
    }
  }
  return {
    name: t,
    size: T[t]
  };
}, oe = (e) => {
  var t;
  return (((t = e.current) == null ? void 0 : t.getBoundingClientRect().y) || 0) < -68;
}, P = () => window.matchMedia("(orientation: landscape)").matches, vt = (e) => {
  const [t] = S(() => Se({
    screen: se(),
    sdkInView: oe(e),
    sdkInDesktopView: P()
  }));
  return y(() => {
    const n = K(() => {
      t.setKey("sdkInView", oe(e));
    }, 200), o = K(() => {
      const s = se();
      t.setKey("screen", s), t.setKey("sdkInDesktopView", P());
    }, 200);
    return window.addEventListener("scroll", n), window.addEventListener("resize", o), () => {
      window.removeEventListener("scroll", n), window.removeEventListener("resize", o);
    };
  }, [t, e]), [t];
}, H = (e, t, n) => {
  const o = t >= T.lg && t < T.xl ? 75 : 52;
  e.current && window.scrollTo({
    top: e.current.offsetTop - o,
    ...n
  });
}, ft = 15, gt = (e, t) => {
  const n = x(null), o = x(0), [s] = S(
    Se({
      scrollPosition: 0,
      tabsShown: !0,
      scrollDirection: "forward"
    })
  ), r = v(t);
  return y(() => {
    const l = P() ? n.current : window;
    if (!l)
      return () => {
      };
    const d = K((a) => {
      var c;
      const m = a.target;
      if (!m)
        return;
      let p = 0;
      P() ? p = m.scrollTop : p = ((c = e.current) == null ? void 0 : c.getBoundingClientRect().y) || 0;
      const h = o.current - p;
      if (ft > Math.abs(h))
        return;
      const g = o.current < p ? "forward" : "backward";
      o.current = p, s.set({
        scrollPosition: Math.round(p),
        scrollDirection: g,
        tabsShown: s.get().tabsShown
      });
    }, 200);
    return l.addEventListener("scroll", d), () => {
      l.removeEventListener("scroll", d);
    };
  }, [s, e, r.screen]), [n, s];
}, q = /* @__PURE__ */ u("div")({
  name: "LoadingContainer",
  class: "lclc0ej",
  propsAsIs: !1
}), It = ({
  feature: e,
  sdk: t,
  children: n,
  className: o,
  noWait: s
}) => {
  const r = v(e.status), l = v(t.sdkStore.slStreamId);
  if (!s) {
    if (l != null && l.loading && !l.data)
      return /* @__PURE__ */ i(q, {
        className: o,
        children: "Event is loading..."
      });
    if (!(l != null && l.data))
      return /* @__PURE__ */ i(q, {
        className: o,
        children: "Event is forbidden..."
      });
    if (r !== it.Ready)
      return /* @__PURE__ */ i(q, {
        className: o,
        children: "Wait feature..."
      });
  }
  return n;
}, bt = /* @__PURE__ */ u("div")({
  name: "Container",
  class: "c115qtkr",
  propsAsIs: !1
}), kt = /* @__PURE__ */ u("div")({
  name: "STabs",
  class: "sxnslc8",
  propsAsIs: !1
}), yt = /* @__PURE__ */ u("button")({
  name: "Button",
  class: "b1umzux0",
  propsAsIs: !1
}), Nt = /* @__PURE__ */ u("span")({
  name: "Title",
  class: "tspsaas",
  propsAsIs: !1
});
var _ = /* @__PURE__ */ ((e) => (e.HOME = "home", e.LEADERBOARD = "leaderboard", e))(_ || {});
const ie = ({ title: e, active: t, onClick: n }) => /* @__PURE__ */ i(yt, { "data-a": "intr", onClick: n, "data-selected": t, children: /* @__PURE__ */ i(Nt, { "data-a": "intr", children: e }) }), St = ({ activePage: e = "home", toggleActivePage: t }) => /* @__PURE__ */ i(bt, { children: /* @__PURE__ */ f(kt, { "data-position": e === "home" ? "left" : "right", children: [
  /* @__PURE__ */ i(ie, { title: "Home", active: e === "home", onClick: () => t(
    "home"
    /* HOME */
  ) }),
  /* @__PURE__ */ i(
    ie,
    {
      title: "Friends",
      active: e === "leaderboard",
      onClick: () => t(
        "leaderboard"
        /* LEADERBOARD */
      )
    }
  )
] }) }), $t = /* @__PURE__ */ u("div")({
  name: "Container",
  class: "c1ux29ft",
  propsAsIs: !1
}), At = () => D, wt = /* @__PURE__ */ u(At())({
  name: "FriendsIcon",
  class: "f10ncfg2",
  propsAsIs: !0
}), Ct = /* @__PURE__ */ u("div")({
  name: "Content",
  class: "c1yc07bd",
  propsAsIs: !1
}), Et = /* @__PURE__ */ u("div")({
  name: "Title",
  class: "tj6cq7w",
  propsAsIs: !1
}), Rt = /* @__PURE__ */ u("div")({
  name: "Description",
  class: "d1ag78xo",
  propsAsIs: !1
}), xt = () => D, Lt = /* @__PURE__ */ u(xt())({
  name: "ArrowInviteIcon",
  class: "awohrz6",
  propsAsIs: !0
}), Dt = ({ title: e, description: t, onClick: n, className: o }) => {
  const [s] = nt({
    type: "invitation",
    action: "sent",
    payload: {
      from: _e.TITLE_CARD
    }
  });
  return /* @__PURE__ */ f($t, { "data-a": "intr", onClick: s(n), className: o, children: [
    /* @__PURE__ */ i(wt, { name: "icon-friends" }),
    /* @__PURE__ */ f(Ct, { children: [
      /* @__PURE__ */ i(Et, { children: e }),
      /* @__PURE__ */ i(Rt, { children: t })
    ] }),
    /* @__PURE__ */ i(Lt, { name: "icon-copy" })
  ] });
};
function Tt(e) {
  var t = e.lastRenderedStartIndex, n = e.lastRenderedStopIndex, o = e.startIndex, s = e.stopIndex;
  return !(o > n || s < t);
}
function Ot(e) {
  for (var t = e.isItemLoaded, n = e.itemCount, o = e.minimumBatchSize, s = e.startIndex, r = e.stopIndex, l = [], d = null, a = null, c = s; c <= r; c++) {
    var m = t(c);
    m ? a !== null && (l.push(d, a), d = a = null) : (a = c, d === null && (d = c));
  }
  if (a !== null) {
    for (var p = Math.min(Math.max(a, d + o - 1), n - 1), h = a + 1; h <= p && !t(h); h++)
      a = h;
    l.push(d, a);
  }
  if (l.length)
    for (; l[1] - l[0] + 1 < o && l[0] > 0; ) {
      var g = l[0] - 1;
      if (!t(g))
        l[0] = g;
      else
        break;
    }
  return l;
}
var _t = function(e, t) {
  if (!(e instanceof t))
    throw new TypeError("Cannot call a class as a function");
}, Mt = /* @__PURE__ */ function() {
  function e(t, n) {
    for (var o = 0; o < n.length; o++) {
      var s = n[o];
      s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(t, s.key, s);
    }
  }
  return function(t, n, o) {
    return n && e(t.prototype, n), o && e(t, o), t;
  };
}(), Ut = function(e, t) {
  if (typeof t != "function" && t !== null)
    throw new TypeError("Super expression must either be null or a function, not " + typeof t);
  e.prototype = Object.create(t && t.prototype, {
    constructor: {
      value: e,
      enumerable: !1,
      writable: !0,
      configurable: !0
    }
  }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
}, ae = function(e, t) {
  if (!e)
    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return t && (typeof t == "object" || typeof t == "function") ? t : e;
};
(function(e) {
  Ut(t, e);
  function t() {
    var n, o, s, r;
    _t(this, t);
    for (var l = arguments.length, d = Array(l), a = 0; a < l; a++)
      d[a] = arguments[a];
    return r = (o = (s = ae(this, (n = t.__proto__ || Object.getPrototypeOf(t)).call.apply(n, [this].concat(d))), s), s._lastRenderedStartIndex = -1, s._lastRenderedStopIndex = -1, s._memoizedUnloadedRanges = [], s._onItemsRendered = function(c) {
      var m = c.visibleStartIndex, p = c.visibleStopIndex;
      s._lastRenderedStartIndex = m, s._lastRenderedStopIndex = p, s._ensureRowsLoaded(m, p);
    }, s._setRef = function(c) {
      s._listRef = c;
    }, o), ae(s, r);
  }
  return Mt(t, [{
    key: "resetloadMoreItemsCache",
    value: function() {
      var o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
      this._memoizedUnloadedRanges = [], o && this._ensureRowsLoaded(this._lastRenderedStartIndex, this._lastRenderedStopIndex);
    }
  }, {
    key: "componentDidMount",
    value: function() {
    }
  }, {
    key: "render",
    value: function() {
      var o = this.props.children;
      return o({
        onItemsRendered: this._onItemsRendered,
        ref: this._setRef
      });
    }
  }, {
    key: "_ensureRowsLoaded",
    value: function(o, s) {
      var r = this.props, l = r.isItemLoaded, d = r.itemCount, a = r.minimumBatchSize, c = a === void 0 ? 10 : a, m = r.threshold, p = m === void 0 ? 15 : m, h = Ot({
        isItemLoaded: l,
        itemCount: d,
        minimumBatchSize: c,
        startIndex: Math.max(0, o - p),
        stopIndex: Math.min(d - 1, s + p)
      });
      (this._memoizedUnloadedRanges.length !== h.length || this._memoizedUnloadedRanges.some(function(g, b) {
        return h[b] !== g;
      })) && (this._memoizedUnloadedRanges = h, this._loadUnloadedRanges(h));
    }
  }, {
    key: "_loadUnloadedRanges",
    value: function(o) {
      for (var s = this, r = this.props.loadMoreItems || this.props.loadMoreRows, l = function(c) {
        var m = o[c], p = o[c + 1], h = r(m, p);
        h != null && h.then(function() {
          if (Tt({
            lastRenderedStartIndex: s._lastRenderedStartIndex,
            lastRenderedStopIndex: s._lastRenderedStopIndex,
            startIndex: m,
            stopIndex: p
          })) {
            if (s._listRef == null)
              return;
            typeof s._listRef.resetAfterIndex == "function" ? s._listRef.resetAfterIndex(m, !0) : (typeof s._listRef._getItemStyleCache == "function" && s._listRef._getItemStyleCache(-1), s._listRef.forceUpdate());
          }
        });
      }, d = 0; d < o.length; d += 2)
        l(d);
    }
  }]), t;
})(Re);
const Bt = /* @__PURE__ */ u("div")({
  name: "Container",
  class: "culdu4a",
  propsAsIs: !1
}), Ft = /* @__PURE__ */ u("div")({
  name: "Position",
  class: "pwf8e69",
  propsAsIs: !1
}), zt = /* @__PURE__ */ u("img")({
  name: "Avatar",
  class: "atf4yh4",
  propsAsIs: !1
}), Pt = /* @__PURE__ */ u("div")({
  name: "AvatarPlaceholder",
  class: "a1dg29ja",
  propsAsIs: !1
}), Vt = /* @__PURE__ */ u("div")({
  name: "Content",
  class: "c10a68rc",
  propsAsIs: !1
}), qt = /* @__PURE__ */ u("div")({
  name: "NameContainer",
  class: "nc4kck5",
  propsAsIs: !1
}), jt = /* @__PURE__ */ u("span")({
  name: "Name",
  class: "njsrqgr",
  propsAsIs: !1
}), Kt = () => D, Qt = /* @__PURE__ */ u(Kt())({
  name: "CurrentUserBadge",
  class: "c17uc4zr",
  propsAsIs: !0
}), Gt = ({
  friendsRank: e,
  avatar: t,
  name: n,
  userId: o,
  points: s,
  isCurrentUser: r,
  style: l
}) => /* @__PURE__ */ f(Bt, { "data-name": o, style: l, children: [
  /* @__PURE__ */ i(Ft, { children: e || 0 }),
  /* @__PURE__ */ f(Vt, { children: [
    t ? /* @__PURE__ */ i(zt, { alt: "leaderboard-item-avatar", src: t }) : /* @__PURE__ */ i(Pt, { children: ct(n || "") }),
    /* @__PURE__ */ f(qt, { children: [
      /* @__PURE__ */ i(jt, { children: n || "" }),
      r && /* @__PURE__ */ i(Qt, { name: "icon-star" })
    ] })
  ] }),
  /* @__PURE__ */ i("div", { children: pt(s) })
] }), Wt = /* @__PURE__ */ u("div")({
  name: "Container",
  class: "c16btbfp",
  propsAsIs: !1
}), Ht = ({
  items: e,
  currentUserId: t,
  openItemDetail: n,
  fetchMore: o,
  scrollNode: s,
  hasMore: r
}) => {
  const l = j((d) => {
    const a = d.target.getAttribute("data-name");
    a && n(a);
  }, [n]);
  return /* @__PURE__ */ i(dt, {
    loadMore: o,
    initialLoad: !1,
    hasMore: r,
    useWindow: !1,
    getScrollParent: () => s.current,
    children: /* @__PURE__ */ i(Wt, {
      "data-a": "intr",
      onClick: l,
      children: e.map((d) => /* @__PURE__ */ i(Gt, {
        ...d,
        isCurrentUser: !!t && t === d.userId
      }, d.userId))
    })
  });
}, Jt = /* @__PURE__ */ u("div")({
  name: "InviteFriendsContainer",
  class: "i1c9dygq",
  propsAsIs: !1
}), Yt = ({
  deepLink: e
}) => /* @__PURE__ */ i(Jt, {
  children: /* @__PURE__ */ i(We, {
    inviteLink: e,
    inviteCardTitle: "It’s More Fun With Friends",
    inviteCardSubtext: "Invite and compete against your friends for the top spot on the leaderboard."
  })
}), Zt = /* @__PURE__ */ u("div")({
  name: "InviteLinkContainer",
  class: "i1odbhm4",
  propsAsIs: !1
}), Xt = ({
  gamification: e,
  scrollNode: t,
  scrollStore: n,
  leaderboardList: o
}) => {
  const s = x(null), {
    data: r,
    hasMore: l,
    loading: d,
    key: a
  } = v(o.$store), {
    data: c
  } = v(e.deepLink.$store), [m, p] = He(s);
  return !r.length && !d ? /* @__PURE__ */ i(Yt, {
    deepLink: c
  }) : /* @__PURE__ */ f(L, {
    children: [/* @__PURE__ */ i(Ht, {
      items: r,
      scrollNode: t,
      scrollStore: n,
      fetchMore: o.fetchMore,
      hasMore: l,
      openItemDetail: e.openUser,
      currentUserId: e.currentUserId.get()
    }, a), c && /* @__PURE__ */ i(Zt, {
      ref: s,
      children: /* @__PURE__ */ i(Dt, {
        "data-a": "intr",
        onClick: () => m(c),
        title: "Invite Friends",
        description: "Challenge them now!"
      })
    }), p]
  });
}, en = ({
  gamification: e,
  scrollNode: t,
  scrollStore: n
}) => e.leaderboardList ? /* @__PURE__ */ i(Xt, {
  leaderboardList: e.leaderboardList,
  gamification: e,
  scrollNode: t,
  scrollStore: n
}) : null, tn = ({ store: e, openQuestion: t }) => {
  const { sdk: n } = W(), o = v(e);
  return /* @__PURE__ */ i(Je, { openQuestion: t, questions: o.data, controlVideo: n == null ? void 0 : n.controlVideoPlayer });
}, nn = ({ userSummary: e }) => {
  var t;
  const [n, o] = S(void 0);
  return y(() => {
    const s = e.$store.subscribe((r) => {
      r && o(r);
    });
    return () => {
      s();
    };
  }, [e]), /* @__PURE__ */ i(ke, { loading: !(n != null && n.summary), ...n == null ? void 0 : n.summary, successRate: (t = n == null ? void 0 : n.percentage) == null ? void 0 : t.correct });
}, sn = ({ gamification: e, className: t, scrollStore: n, scrollNode: o, appNode: s, style: r, responsiveStore: l }) => {
  const { tabsShown: d } = v(n, { keys: ["tabsShown"] }), a = v(e.friendsTabEnabled), [c, m] = S(_.HOME), [, p] = Ue(), { sdkInDesktopView: h, screen: g } = v(l, { keys: ["sdkInDesktopView"] }), b = (I) => {
    p(() => {
      var U;
      m(I), h === !1 && (((U = s.current) == null ? void 0 : U.getBoundingClientRect().y) || 0) < 0 && H(s, g.size, { behavior: "instant" });
    });
  };
  y(() => n.subscribe((I) => {
    if (I.scrollPosition === 0) {
      n.setKey("tabsShown", !0);
      return;
    }
    l.get().sdkInDesktopView ? n.setKey("tabsShown", I.scrollDirection === "backward") : n.setKey("tabsShown", I.scrollDirection === "forward");
  }), [n, l]), y(() => {
    a || m(_.HOME);
  }, [a]);
  let $ = "0px";
  return h ? $ = d ? "0px" : "calc(0px - var(--header-height))" : $ = d ? "var(--header-height)" : "0px", /* @__PURE__ */ f(Be, { className: C(t, "SL-Tabs", "sl-hide-on-modal"), style: r, children: [
    a && /* @__PURE__ */ i(
      Fe,
      {
        style: {
          top: $
        },
        children: /* @__PURE__ */ i(St, { activePage: c, toggleActivePage: b })
      }
    ),
    c === _.HOME && /* @__PURE__ */ f(L, { children: [
      /* @__PURE__ */ i(ze, { children: /* @__PURE__ */ i(Pe, { children: /* @__PURE__ */ i(nn, { userSummary: e.userSummary }) }) }),
      /* @__PURE__ */ i(Ve, { style: { flex: 1 }, children: /* @__PURE__ */ i(tn, { openQuestion: e.openQuestion, store: e.feedList.getStore() }) })
    ] }),
    c === _.LEADERBOARD && /* @__PURE__ */ i(qe, { children: /* @__PURE__ */ i(en, { scrollStore: n, scrollNode: o, gamification: e }) })
  ] });
}, on = () => G, re = /* @__PURE__ */ u(on())({
  name: "OpenedContainer",
  class: "ouvguos",
  propsAsIs: !0
}), le = "t1eu4lbg", an = /* @__PURE__ */ u("div")({
  name: "UserContainer",
  class: "uuv2xqo",
  propsAsIs: !1
}), rn = ({
  correct: e,
  incorrect: t
}) => {
  const n = e + t;
  return n === 0 ? 0 : Math.round(e / n * 100);
}, Ps = ({
  gamification: e,
  scrollStore: t,
  className: n,
  appNode: o,
  scrollNode: s,
  responsiveStore: r
}) => /* @__PURE__ */ i(sn, {
  appNode: o,
  scrollStore: t,
  scrollNode: s,
  className: n,
  gamification: e,
  responsiveStore: r
}), ln = ({
  gamification: e,
  muted: t,
  sdk: n,
  className: o,
  appNode: s,
  responsiveStore: r
}) => {
  const {
    topNavigation: l
  } = W(), d = v(e.openedQuestionId), a = v(e.openedQuestion.$store), c = v(e.openedUser || ye(void 0)), {
    sdkInDesktopView: m
  } = v(r, {
    keys: ["sdkInDesktopView"]
  }), {
    hiding: p,
    onAnimationEnd: h
  } = je();
  if (!d && !c)
    return null;
  const g = a ? /* @__PURE__ */ i(re, {
    className: C(o, !l && le),
    hiding: p,
    onAnimationEnd: h,
    children: /* @__PURE__ */ i(at, {
      muted: t,
      sdk: n,
      gamification: e
    })
  }) : c ? /* @__PURE__ */ i(re, {
    className: C(o, !l && le),
    hiding: p,
    onAnimationEnd: h,
    children: /* @__PURE__ */ f(an, {
      children: [/* @__PURE__ */ i(lt, {
        label: "Friend's Rank",
        close: e.closeUser
      }), /* @__PURE__ */ i(Ke, {
        children: /* @__PURE__ */ i(ke, {
          ...c,
          successRate: rn(c)
        })
      })]
    })
  }) : null;
  return /* @__PURE__ */ i(Ne, {
    container: s,
    useContainer: !m,
    children: g
  });
}, dn = xe(() => import("./gamification-feature.js")), cn = ({ sdk: e, feature: t, className: n, scrollStore: o, appNode: s, scrollNode: r, responsiveStore: l }) => {
  const d = w(() => t && t.featureConfig.get().type === N.GAMES ? /* @__PURE__ */ i(It, { className: n, sdk: e, feature: t, children: /* @__PURE__ */ i(
    dn,
    {
      appNode: s,
      scrollStore: o,
      scrollNode: r,
      className: n,
      responsiveStore: l,
      gamification: t
    }
  ) }) : null, [e, t, n, l, o, r, s]);
  return /* @__PURE__ */ i(
    Le,
    {
      fallback: /* @__PURE__ */ i("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: "page loading..." }),
      children: d
    }
  );
}, pn = ({ feature: e, sdk: t, muted: n, className: o, appNode: s, responsiveStore: r }) => e && e.featureConfig.get().type === N.GAMES ? /* @__PURE__ */ i(
  ln,
  {
    className: o,
    appNode: s,
    muted: n,
    sdk: t,
    responsiveStore: r,
    gamification: e
  }
) : null;
window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));
function un(e) {
  return e instanceof DOMException && // everything except Firefox
  (e.code === 22 || // Firefox
  e.code === 1014 || // test name field too, because code might not be present
  // everything except Firefox
  e.name === "QuotaExceededError" || // Firefox
  e.name === "NS_ERROR_DOM_QUOTA_REACHED");
}
class mn {
  constructor(t = "main", n = window.localStorage) {
    k(this, "delimiter", ":");
    k(this, "prefix");
    k(this, "storage");
    k(this, "clear", () => {
      for (const t in window.localStorage)
        t.startsWith(this.prefix) && this.storage.removeItem(t);
    });
    k(this, "generateKey", (t) => `${this.prefix}${this.delimiter}${t.join(this.delimiter)}`);
    k(this, "write", (...t) => {
      const n = t.pop() || "", o = this.generateKey(t);
      try {
        this.storage.setItem(o, n);
      } catch (s) {
        un(s) && this.storage === window.sessionStorage && (window.sessionStorage.removeItem("slstreamlogs"), this.storage.setItem(o, n));
      }
    });
    k(this, "read", (...t) => {
      const n = this.storage.getItem(this.generateKey(t));
      return n === null ? void 0 : n;
    });
    k(this, "remove", (...t) => {
      this.storage.removeItem(this.generateKey(t));
    });
    this.prefix = `sl-sdk${this.delimiter}${t}`, this.storage = n;
  }
}
var de;
(function(e) {
  e.Init = "init", e.Ready = "ready", e.Connecting = "connecting", e.Connected = "connected", e.Disconnected = "disconnected", e.Failed = "failed", e.Reconnect = "reconnect", e.Reconnecting = "reconnecting";
})(de || (de = {}));
M("grpc:stream");
R.Unknown, R.Internal, R.DeadlineExceeded, R.ResourceExhausted, R.FailedPrecondition, R.Unavailable, R.DataLoss;
M("grpc:retry");
ee(10, { description: "Number of attempts to retry" }), ee(3e4, { description: "Max delay between retries in milliseconds" });
var A;
(function(e) {
  e.SCHEMA = "schema", e.EXTERNAL_TOKEN = "eToken", e.TOKEN = "token";
})(A || (A = {}));
class hn extends mn {
  constructor() {
    super("user");
    // Schema
    k(this, "setSchema", (n) => {
      this.write(A.SCHEMA, n);
    });
    k(this, "getSchema", () => this.read(A.SCHEMA));
    // Token
    k(this, "setToken", (n) => {
      this.write(A.TOKEN, n);
    });
    k(this, "getToken", () => this.read(A.TOKEN));
    // External Token
    k(this, "setExternalToken", (n) => {
      this.write(A.EXTERNAL_TOKEN, n);
    });
    k(this, "getExternalToken", () => this.read(A.EXTERNAL_TOKEN));
    k(this, "removeToken", () => {
      this.remove(A.TOKEN);
    });
  }
}
var ce;
(function(e) {
  e.DISABLED = "disabled", e.INITIALIZATION = "initialization", e.READY = "ready", e.FAILED = "failed", e.SUSPENDED = "suspended";
})(ce || (ce = {}));
var pe;
(function(e) {
  e.SHOWED = "showed", e.EVENT = "ev";
})(pe || (pe = {}));
var ue;
(function(e) {
  e.ONBOARDING = "onboarding", e.ONBOARDING_IO = "onboarding_io", e.QUESTION_RECEIVED = "q-received", e.QUESTION_OPENED = "q-opened";
})(ue || (ue = {}));
var me;
(function(e) {
  e.ALLOWED = "allowed", e.DISALLOWED = "disallowed";
})(me || (me = {}));
var he;
(function(e) {
  e.UNKNOWN = "unknown", e.ALREADY_VOTED = "already_voted";
})(he || (he = {}));
M("deep_link");
M("bypass");
new hn();
M("video_player");
var ve;
(function(e) {
  e.Unset = "unset", e.Required = "required", e.Optional = "optional", e.Completed = "completed", e.Disabled = "disabled", e.Unavailable = "unavailable";
})(ve || (ve = {}));
V.POLL, V.PREDICTION, V.TRIVIA;
const vn = {
  [N.GAMES]: !0
}, fn = /* @__PURE__ */ u("div")({
  name: "Buttons",
  class: "b5o8qbl",
  propsAsIs: !1
}), gn = ({
  children: e,
  className: t
}) => /* @__PURE__ */ i(fn, {
  className: t,
  children: e
}), $e = /* @__PURE__ */ u("div")({
  name: "Navigation",
  class: "n6tbwuy",
  propsAsIs: !1
}), In = () => gn, fe = /* @__PURE__ */ u(In())({
  name: "NavigationItems",
  class: "n1up4z7v",
  propsAsIs: !0
}), bn = /* @__PURE__ */ u("button")({
  name: "SButton",
  class: "sxxa0c",
  propsAsIs: !1
}), kn = /* @__PURE__ */ u("span")({
  name: "ButtonIcon",
  class: "b193dcyu",
  propsAsIs: !1
}), yn = /* @__PURE__ */ u("span")({
  name: "ButtonLabel",
  class: "b40tuix",
  propsAsIs: !1
}), Nn = "s14xk0af", Sn = "ha3mg7c", $n = "h103yr45", F = ({ disabled: e, active: t, onClick: n, label: o, icon: s, id: r }) => /* @__PURE__ */ i(
  bn,
  {
    onClick: n,
    "data-a": "intr",
    disabled: e,
    className: C(
      t && Nn,
      !t && (r === "channels" || r === "featuredGroups") && Sn,
      !t && r === "leaderboard" && $n
    ),
    children: /* @__PURE__ */ f(L, { children: [
      s && /* @__PURE__ */ i(kn, { children: s }),
      /* @__PURE__ */ i(yn, { children: o })
    ] })
  }
), An = () => D, wn = /* @__PURE__ */ u(An())({
  name: "ButtonIcon",
  class: "b11wpe79",
  propsAsIs: !0
}), Cn = /* @__PURE__ */ u("div")({
  name: "Container",
  class: "calnblm",
  propsAsIs: !1
}), En = /* @__PURE__ */ u("div")({
  name: "Title",
  class: "t1438p52",
  propsAsIs: !1
}), Rn = /* @__PURE__ */ u("div")({
  name: "CloseIconWrap",
  class: "c17srj38",
  propsAsIs: !1
}), xn = () => D, Ln = /* @__PURE__ */ u(xn())({
  name: "CloseIcon",
  class: "clqia8k",
  propsAsIs: !0
}), Dn = () => D, Tn = /* @__PURE__ */ u(Dn())({
  name: "DashboardIcon",
  class: "df5w958",
  propsAsIs: !0
}), On = "h12x6aiv", _n = be(({
  sdk: e,
  className: t
}, n) => {
  const o = () => {
    e.closeFeature();
  };
  return /* @__PURE__ */ f($e, {
    className: C(t, On),
    children: [/* @__PURE__ */ f(Cn, {
      children: [/* @__PURE__ */ f(En, {
        children: [/* @__PURE__ */ i(Tn, {
          name: "dashboard"
        }), "Dashboard"]
      }), /* @__PURE__ */ i(Rn, {
        "data-a": "intr",
        onClick: o,
        children: /* @__PURE__ */ i(Ln, {
          name: "icon-cross"
        })
      })]
    }), /* @__PURE__ */ i("div", {
      ref: n
    })]
  });
}), Mn = be(({
  sdk: e,
  className: t
}, n) => {
  const o = v(e.sdkStore.organizationSettings), s = v(e.sdkStore.streamSettings), r = v(e.getActiveFeature()), l = w(() => {
    const a = (s == null ? void 0 : s.data) || (o == null ? void 0 : o.data);
    return a != null && a.overlays ? a.overlays : [];
  }, [o, s]), d = w(() => [...l.filter(({
    enableSdkButton: a,
    type: c
  }) => c === N.GAMES || a).map((a) => ({
    id: a.type,
    onClick: () => e.openFeature(a.type),
    disabled: !(a.type in vn),
    label: a.name,
    icon: /* @__PURE__ */ i("img", {
      src: a.icon,
      alt: ""
    }),
    /** multiplied by 10 to add the ability to insert custom buttons between our buttons */
    position: a.position * 10
  }))].sort((a, c) => a.position - c.position), [l, e]);
  return /* @__PURE__ */ f($e, {
    className: t,
    children: [d.length !== 0 && /* @__PURE__ */ i(fe, {
      children: [/* @__PURE__ */ i(F, {
        id: "Channels",
        onClick: () => e.closeFeature(),
        label: "Channels",
        active: r === 0
      }, "Channels"), ...d.map((a) => a.id === N.GAMES ? /* @__PURE__ */ i(F, {
        ...a,
        active: a.id === r,
        label: "StreamLayer +",
        id: "featuredGroups",
        icon: /* @__PURE__ */ i(wn, {
          name: "icon-btn-feature-groups",
          "data-selected": a.id === r
        })
      }, a.id) : /* @__PURE__ */ i(F, {
        ...a,
        icon: void 0,
        active: a.id === r
      }, a.id))]
    }), !d.length && /* @__PURE__ */ i(fe, {
      children: [/* @__PURE__ */ i(F, {
        id: "empty",
        label: "No Features...",
        active: !1,
        disabled: !0
      }, "empty")]
    }), /* @__PURE__ */ i("div", {
      ref: n
    })]
  });
}), Un = /* @__PURE__ */ u("div")({
  name: "Container",
  class: "c1qjj4d4",
  propsAsIs: !1
}), Bn = /* @__PURE__ */ u("div")({
  name: "CloseIconWrap",
  class: "c1lg6b8a",
  propsAsIs: !1
}), Fn = () => D, zn = /* @__PURE__ */ u(Fn())({
  name: "CloseIcon",
  class: "c159el66",
  propsAsIs: !0
}), Pn = /* @__PURE__ */ u("div")({
  name: "Title",
  class: "t16xmufv",
  propsAsIs: !1
}), Vn = /* @__PURE__ */ u("img")({
  name: "SponsorLogo",
  class: "s83lc21",
  propsAsIs: !1
}), qn = /* @__PURE__ */ u("div")({
  name: "PresentsTitle",
  class: "p1p7igia",
  propsAsIs: !1
}), jn = /* @__PURE__ */ u("div")({
  name: "Subtitle",
  class: "s1eftsbu",
  propsAsIs: !1
}), Kn = /* @__PURE__ */ u("div")({
  name: "Description",
  class: "d8uezec",
  propsAsIs: !1
}), Qn = /* @__PURE__ */ u("button")({
  name: "ActionButton",
  class: "a1h1bk90",
  propsAsIs: !1
}), ge = ({ close: e, action: t, onboarding: n }) => {
  var o, s, r, l, d, a, c, m;
  return /* @__PURE__ */ f(Un, { children: [
    /* @__PURE__ */ i(Bn, { "data-a": "intr", onClick: e, children: /* @__PURE__ */ i(zn, { name: "icon-cross" }) }),
    ((s = (o = n == null ? void 0 : n.titleCard) == null ? void 0 : o.media) == null ? void 0 : s.sponsorLogo) && /* @__PURE__ */ f(Pn, { children: [
      /* @__PURE__ */ i(Vn, { alt: "sponsor-logo", src: (l = (r = n == null ? void 0 : n.titleCard) == null ? void 0 : r.media) == null ? void 0 : l.sponsorLogo }),
      /* @__PURE__ */ i(qn, { children: "PRESENTS" })
    ] }),
    ((d = n == null ? void 0 : n.titleCard) == null ? void 0 : d.title) && /* @__PURE__ */ i(jn, { children: (a = n == null ? void 0 : n.titleCard) == null ? void 0 : a.title }),
    ((c = n == null ? void 0 : n.titleCard) == null ? void 0 : c.subtitle) && /* @__PURE__ */ i(Kn, { children: (m = n == null ? void 0 : n.titleCard) == null ? void 0 : m.subtitle }),
    /* @__PURE__ */ i(Qn, { "data-a": "intr", onClick: t, children: "Play Now" })
  ] });
}, Q = [{
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/dark/step_1.png",
  tagline: "",
  headline: /* @__PURE__ */ f(L, {
    children: ["Welcome to ", /* @__PURE__ */ i("br", {}), " Live Challenge"]
  })
}, {
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/dark/step_2.png",
  headline: "Live insights, polls, trivia and predictions."
}, {
  graphicSrc: "https://cdn.streamlayer.io/assets/sdk-web/onboarding-steps/dark/step_3.png",
  headline: "Win points and play against friends."
}], Gn = /* @__PURE__ */ u("div")({
  name: "OnboardingContainer",
  class: "o1xni1kr",
  propsAsIs: !1
}), Wn = () => G, Hn = /* @__PURE__ */ u(Wn())({
  name: "OnboardingNotificationContainer",
  class: "o1vnouv7",
  propsAsIs: !0
}), Ie = /* @__PURE__ */ u("div")({
  name: "InnerContainer",
  class: "i59uefw",
  propsAsIs: !1
}), Jn = /* @__PURE__ */ u("div")({
  name: "OnboardingOverlap",
  class: "ovnr8ov",
  propsAsIs: !1
}), Yn = ({
  deepLink: e,
  onboardingOpts: t,
  notification: n,
  gamification: o,
  loading: s,
  sdk: r,
  throttled: l
}) => {
  var d, a, c, m, p, h, g;
  const b = v(o.friends ? o.friends.getStore() : ye({
    data: []
  })), [$, I] = S(void 0), U = w(() => {
    var E, O;
    const J = r.getInviter();
    return J ? (O = (E = b.data) == null ? void 0 : E.find(({
      slId: we
    }) => we === J)) == null ? void 0 : O.name : "";
  }, [b.data, r]);
  return y(() => {
    const E = e.$store.subscribe((O) => {
      O && I(O.data);
    });
    return () => {
      E();
    };
  }, [e.$store]), /* @__PURE__ */ f(Gn, {
    children: [/* @__PURE__ */ i(Ze, {
      loading: s,
      rules: [{
        label: "Answer as many questions as you like.",
        icon: "icon-btn-feature-groups"
      }, {
        label: "Win points for each correct trivia or prediction answer.",
        icon: "icon-thumb-up"
      }, {
        label: "Top the leader board and best your friends.",
        icon: "icon-trophy"
      }],
      rulesBtnLabel: (d = t.rules) == null ? void 0 : d.buttonLabel,
      rulesTitle: (a = t.rules) == null ? void 0 : a.heading,
      termsTitle: "Terms and Conditions",
      termsText: (c = t.rules) == null ? void 0 : c.terms,
      steps: Q,
      primaryColor: (m = t.inviteCard) == null ? void 0 : m.iconColor,
      inviteLink: $,
      inviteCardTitle: (p = t.inviteCard) == null ? void 0 : p.heading,
      inviteCardSubtext: (h = t.inviteCard) == null ? void 0 : h.subtext,
      inviteCardBtnLabel: (g = t.inviteCard) == null ? void 0 : g.buttonLabel,
      onClose: () => {
        var E;
        (E = n.close) == null || E.call(n);
      },
      gamification: o,
      sdk: r,
      inviterName: U
    }), l && /* @__PURE__ */ i(Jn, {})]
  });
}, Zn = ({
  sdk: e,
  notification: t,
  saveHeight: n,
  style: o,
  appNode: s,
  sdkInDesktopView: r,
  responsiveStore: l
}) => {
  const d = x(null), a = t.data.onboarding, [c, m] = S(a == null ? void 0 : a.instantOpen), p = e.getFeature(N.GAMES), h = w(() => Q == null ? void 0 : Q.map(({
    graphicSrc: I
  }) => I), []), {
    screen: g
  } = v(l, {
    keys: ["screen"]
  });
  De(() => {
    var I;
    n(((I = d.current) == null ? void 0 : I.getBoundingClientRect().height) || 0);
  }, [n]);
  const {
    loading: b,
    throttled: $
  } = Ye(h);
  return c && p && a && s.current ? /* @__PURE__ */ i(Ne, {
    container: s,
    useContainer: !r,
    children: /* @__PURE__ */ i(Yn, {
      throttled: $,
      notification: t,
      setOpened: m,
      gamification: p,
      onboardingOpts: a,
      deepLink: p.deepLink,
      loading: b,
      renderToNode: s,
      sdk: e
    })
  }) : /* @__PURE__ */ f(L, {
    children: [/* @__PURE__ */ i(Ie, {
      ref: d,
      style: {
        position: "absolute",
        visibility: "hidden"
      },
      children: /* @__PURE__ */ i(ge, {
        close: () => {
        },
        action: () => {
        },
        onboarding: a
      })
    }), /* @__PURE__ */ i(Hn, {
      style: o,
      hiding: t.hiding,
      children: /* @__PURE__ */ i(Ie, {
        children: /* @__PURE__ */ i(ge, {
          close: t.close,
          action: () => {
            var I;
            m(!0), (((I = s.current) == null ? void 0 : I.getBoundingClientRect().y) || 0) < 0 && H(s, g.size, {
              behavior: "smooth"
            });
          },
          onboarding: a
        })
      })
    })]
  });
}, Xn = () => G, es = /* @__PURE__ */ u(Xn())({
  name: "Container",
  class: "c8ol1ve",
  propsAsIs: !0
}), Ae = /* @__PURE__ */ u("div")({
  name: "InnerContainer",
  class: "iqfywam",
  propsAsIs: !1
}), ts = () => Ae, ns = /* @__PURE__ */ u(ts())({
  name: "HiddenContainer",
  class: "hokmtod",
  propsAsIs: !0
}), ss = /* @__PURE__ */ u("div")({
  name: "NotificationRefreshing",
  class: "n192d1q8",
  propsAsIs: !1
}), os = () => Xe, is = /* @__PURE__ */ u(os())({
  name: "Pill",
  class: "p1lha68t",
  propsAsIs: !0
}), as = (e) => {
  const [t, n] = S(0), o = x(null), s = w(() => new ResizeObserver((d) => {
    window.requestAnimationFrame(() => {
      var a;
      if (Array.isArray(d)) {
        for (const c of d)
          if (c.contentBoxSize) {
            const m = (a = o.current) == null ? void 0 : a.getBoundingClientRect();
            m && n(m.height);
          }
      }
    });
  }), []), r = j((d) => {
    o.current = d;
  }, []), l = j((d) => {
    n(d);
  }, []);
  return y(() => {
    const d = o.current;
    return d ? (s.observe(d), () => {
      s.unobserve(d);
    }) : () => {
    };
  }, [e]), y(() => () => {
    s.disconnect();
  }), [r, t, l];
}, rs = ({
  sdk: e,
  notification: t,
  appNode: n,
  responsiveStore: o,
  hasActiveFeature: s
}) => {
  var r, l;
  const {
    sdkInDesktopView: d
  } = v(o, {
    keys: ["sdkInDesktopView"]
  }), {
    sdk: a
  } = W(), [c, m, p] = as(t.id);
  let h = m;
  return s || (h = "auto"), t.type === z.QUESTION ? /* @__PURE__ */ f(L, {
    children: [/* @__PURE__ */ i(ns, {
      ref: c,
      children: /* @__PURE__ */ i(te, {
        ...t
      })
    }), /* @__PURE__ */ f(es, {
      style: {
        height: t.hiding ? 0 : h
      },
      hiding: t.hiding,
      children: [/* @__PURE__ */ i(Ae, {
        style: {
          height: "100%"
        },
        children: /* @__PURE__ */ i(te, {
          ...t,
          controlVideo: a == null ? void 0 : a.controlVideoPlayer
        })
      }), /* @__PURE__ */ i(ss, {}, t.id)]
    })]
  }) : t.type === z.QUESTION_RESOLVED && (l = (r = t.data) == null ? void 0 : r.question) != null && l.predictionResult ? /* @__PURE__ */ i(et, {
    style: {
      height: t.hiding ? 0 : m
    },
    saveHeight: p,
    close: t.close,
    hiding: t.hiding,
    ...t.data.question
  }) : t.type === z.ONBOARDING ? /* @__PURE__ */ i(Zn, {
    style: {
      height: t.hiding ? 0 : h
    },
    saveHeight: p,
    sdk: e,
    notification: t,
    sdkInDesktopView: d,
    appNode: n,
    responsiveStore: o
  }) : null;
}, ls = "p7vfi6t", ds = ({
  pill: e,
  setPill: t,
  appNode: n,
  headerNode: o,
  scrollNode: s,
  responsiveStore: r,
  scrollStore: l
}) => {
  var d, a;
  const {
    screen: c
  } = v(r, {
    keys: ["screen"]
  }), {
    tabsShown: m,
    scrollPosition: p
  } = v(l, {
    keys: ["tabsShown", "scrollPosition"]
  });
  y(() => {
    r.get().sdkInDesktopView ? p < 50 && t(null) : p > -50 && t(null);
  }, [p, r, t]);
  const h = r.get().sdkInDesktopView ? n : o;
  return !e || !h.current ? null : mt(/* @__PURE__ */ i(is, {
    title: e.type === z.QUESTION_RESOLVED ? "Prediction result" : `New ${((a = ut[(d = e.data) == null ? void 0 : d.questionType]) == null ? void 0 : a.label) || "notification"}`,
    "data-a": "intr",
    onClick: () => {
      var g;
      r.get().sdkInDesktopView ? (g = s.current) == null || g.scrollTo({
        top: 0,
        behavior: "smooth"
      }) : H(n, c.size, {
        behavior: "smooth"
      }), t(null);
    },
    className: C(m && ls, "sl-pill-button")
  }), h.current);
}, cs = ({
  sdk: e,
  headerNode: t,
  scrollNode: n,
  responsiveStore: o,
  appNode: s,
  scrollStore: r,
  hasActiveFeature: l
}) => {
  const [d] = S(e.getNotificationsStore()), a = v(d), [c, m] = S(null), p = w(() => e.getActiveNotification(), [e, a]);
  return y(() => {
    p && ht.emit("notification", {
      action: "rendered",
      payload: {
        questionId: p.data.questionId,
        questionType: p.data.questionType
      }
    });
  }, [p]), y(() => {
    const {
      sdkInDesktopView: h,
      sdkInView: g
    } = o.get();
    p && (h || g) && (!h && g && m(p), h && window.requestAnimationFrame(() => {
      r.get().scrollPosition !== 0 && m(p);
    }));
  }, [p]), y(() => {
    p || m(null);
  }, [p]), /* @__PURE__ */ f(L, {
    children: [!c && p && /* @__PURE__ */ i(rs, {
      appNode: s,
      sdk: e,
      hasActiveFeature: l,
      notification: p,
      responsiveStore: o
    }), c && /* @__PURE__ */ i(ds, {
      pill: c,
      setPill: m,
      appNode: s,
      notification: p,
      headerNode: t,
      scrollNode: n,
      scrollStore: r,
      responsiveStore: o
    })]
  });
}, ps = (e) => {
  const t = v(e.status), n = v(e.sdkStore.slStreamId), o = v(e.userId()), s = v(e.getActiveFeature()), r = t === "ready" && !!n.data;
  return y(() => {
    const l = e.getFeature(N.GAMES);
    l && s !== N.GAMES && (l.closeQuestion(), l.closeUser()), l == null || l.openedQuestionId.subscribe((d) => {
      d && s !== N.GAMES && e.openFeature(N.GAMES);
    });
  }, [s, e]), {
    sdkReady: r,
    activeFeature: s,
    isLogged: !!o
  };
}, us = ({
  sdk: e,
  className: t,
  scrollStore: n,
  appNode: o,
  scrollNode: s,
  responsiveStore: r
}) => {
  const [, l] = tt(e);
  return /* @__PURE__ */ i(cn, {
    className: t,
    scrollNode: s,
    appNode: o,
    scrollStore: n,
    feature: l,
    responsiveStore: r,
    sdk: e
  });
}, ms = ({
  sdk: e,
  muted: t,
  className: n,
  appNode: o,
  responsiveStore: s
}) => {
  const r = v(e.featuresList.getStore());
  return r ? Array.from(r, (l) => {
    const d = e.getFeature(l);
    return d ? /* @__PURE__ */ i(pn, {
      className: n,
      muted: t,
      appNode: o,
      feature: d,
      responsiveStore: s,
      sdk: e
    }, l) : null;
  }) : null;
}, hs = ({
  sdk: e,
  muted: t,
  topNavigation: n
}) => {
  const [o, s] = S(!0), r = x(null), l = v(e.uiState), d = x(null), [a] = vt(r), [c, m] = gt(r, a), {
    sdkReady: p,
    activeFeature: h,
    isLogged: g
  } = ps(e), b = !!p;
  st(r, {
    enabled: b,
    event: "click",
    listener: ot
  });
  const $ = w(() => ({
    sdk: e,
    topNavigation: n
  }), [e, n]);
  return y(() => {
    import("./gamification-feature.js");
  }, []), /* @__PURE__ */ i(rt.Provider, {
    value: $,
    children: /* @__PURE__ */ f(Qe, {
      ref: (I) => {
        r.current = I, s(!!I);
      },
      className: n ? "" : "c10llmat",
      children: [b && n && l.app && /* @__PURE__ */ i(Mn, {
        className: C(B, "sl-hide-on-modal"),
        sdk: e,
        ref: d
      }), b && !n && !!h && l.app && /* @__PURE__ */ i(_n, {
        className: C(B, "sl-hide-on-modal"),
        sdk: e,
        ref: d
      }), /* @__PURE__ */ f(Ge, {
        className: "sl-hide-on-modal",
        ref: c,
        "data-nav": (!!h && b).toString(),
        children: [b && l.app && /* @__PURE__ */ i(cs, {
          sdk: e,
          scrollNode: c,
          headerNode: d,
          appNode: r,
          scrollStore: m,
          responsiveStore: a,
          hasActiveFeature: !!h
        }), b && l.app && /* @__PURE__ */ i(us, {
          scrollStore: m,
          responsiveStore: a,
          scrollNode: c,
          appNode: r,
          className: B,
          sdk: e
        }), b && o && /* @__PURE__ */ i(ms, {
          muted: t,
          responsiveStore: a,
          appNode: r,
          className: B,
          sdk: e
        })]
      }), b && !g && o && l.app && /* @__PURE__ */ i("div", {
        style: {
          display: "flex",
          alignItems: "center",
          justifyContent: "center",
          width: "100%",
          height: "100%"
        },
        children: "You are not logged in."
      })]
    })
  });
}, Vs = ({ event: e, topNavigation: t, theme: n, muted: o, withSidebarNotification: s = !0 }) => {
  const { sdk: r, status: l } = Y(Z), d = Te(), a = Oe(), { event: c } = Y(Z);
  if (l === X.UNSET)
    throw new Error("Wrap app in `StreamLayerProvider`");
  return l === X.CONNECTED ? /* @__PURE__ */ i("div", { className: "StreamLayerSDK", children: "wait" }) : r === null ? /* @__PURE__ */ i("div", { className: "StreamLayerSDK", children: "sdk not initialized" }) : !d.app && !d.appNotification && !d.appSidebar || !d.app && !d.appSidebar && d.appNotification && !s ? null : /* @__PURE__ */ i("div", { className: "StreamLayerSDK", children: /* @__PURE__ */ i(Me, { customTheme: n ?? a.theme, themeMode: a.themeMode, children: /* @__PURE__ */ i(hs, { sdk: r, muted: o, event: (c == null ? void 0 : c.current) || e, topNavigation: t }) }) });
};
export {
  Ps as B,
  Vs as b
};
