import { BundleIcon as h } from "./accelbyte-widgets379.mjs";
import { GameIcon as f } from "./accelbyte-widgets380.mjs";
import { OptionboxIcon as I } from "./accelbyte-widgets381.mjs";
import { Tabs as y } from "./accelbyte-widgets174.mjs";
import S from "./accelbyte-widgets210.mjs";
import { Ctx as k } from "./accelbyte-widgets33.mjs";
import { ItemType as u, AppType as A } from "./accelbyte-widgets185.mjs";
import { EcomPath as n } from "./accelbyte-widgets59.mjs";
import e, { Component as b } from "react";
import { Trans as i } from "react-i18next";
import { NavLink as g, Switch as P, Route as E, Redirect as L } from "react-router-dom";
import d from "./accelbyte-widgets212.mjs";
import { AppDetailPageLoadingScreen as D, AppDetailPageError as M } from "./accelbyte-widgets66.mjs";
import { AppDetailPageLogic as N } from "./accelbyte-widgets224.mjs";
import { mockSingleGameInfo as x } from "./accelbyte-widgets209.mjs";
class T extends b {
  constructor(t) {
    super(t), this.logic = new N(t), this.logic.subscribe(() => this.setState({}));
  }
  componentDidMount() {
    this.props.isPreviewMode || this.logic.init();
  }
  render() {
    const { language: t, path: s } = this.props, { appItem: p, isFetching: o, error: m } = this.logic.state, l = this.props.isPreviewMode, c = l ? s : "", a = l ? x : p;
    return o ? /* @__PURE__ */ e.createElement(D, null) : m ? /* @__PURE__ */ e.createElement(M, { error: m }) : /* @__PURE__ */ e.createElement("div", { className: "pb-6" }, /* @__PURE__ */ e.createElement(y, null, /* @__PURE__ */ e.createElement(g, { className: `tab ${l ? "active" : ""}`, to: n.DlcList.makePath() }, /* @__PURE__ */ e.createElement(f, { className: "icon" }), /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.dlcStore.heading" }, "Expansions")), /* @__PURE__ */ e.createElement(g, { className: "tab", to: n.BundleList.makePath() }, /* @__PURE__ */ e.createElement(h, { className: "icon" }), /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.heading" }, "Game Store")), /* @__PURE__ */ e.createElement(g, { className: "tab", to: n.OptionboxList.makePath() }, /* @__PURE__ */ e.createElement(I, { className: "m-2" }), /* @__PURE__ */ e.createElement(i, { i18nKey: "StorePage.tabs.optionbox" }, "Optionbox"))), /* @__PURE__ */ e.createElement("div", { className: "gridContainer" }, /* @__PURE__ */ e.createElement(P, null, /* @__PURE__ */ e.createElement(
      E,
      {
        key: "AppStoreContainer",
        exact: !0,
        path: `${c}${n.DlcList.link}`,
        render: () => a ? /* @__PURE__ */ e.createElement(
          d,
          {
            baseItem: a,
            itemType: u.enum.APP,
            appType: A.enum.DLC,
            language: t,
            noItemMessage: /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.noItem" }, "Looks like there aren`t any items for this game yet."),
            isPreviewMode: l
          }
        ) : /* @__PURE__ */ e.createElement(e.Fragment, null)
      }
    ), /* @__PURE__ */ e.createElement(
      E,
      {
        key: "BundleStoreContainer",
        exact: !0,
        path: `${c}${n.BundleList.link}`,
        render: () => a ? /* @__PURE__ */ e.createElement(
          d,
          {
            baseItem: a,
            itemType: u.enum.INGAMEITEM,
            language: t,
            noItemMessage: /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.noItem" }, "Looks like there aren`t any items for this game yet.")
          }
        ) : /* @__PURE__ */ e.createElement(e.Fragment, null)
      }
    ), /* @__PURE__ */ e.createElement(
      E,
      {
        key: "OptionboxStoreContainer",
        exact: !0,
        path: `${c}${n.OptionboxList.link}`,
        render: () => a ? /* @__PURE__ */ e.createElement(
          d,
          {
            baseItem: a,
            itemType: u.enum.OPTIONBOX,
            language: t,
            noItemMessage: /* @__PURE__ */ e.createElement(i, { i18nKey: "AppDetailPage.inAppStore.noItem" }, "Looks like there aren`t any items for this game yet.")
          }
        ) : /* @__PURE__ */ e.createElement(e.Fragment, null)
      }
    ), /* @__PURE__ */ e.createElement(L, { to: `${c}${n.DlcList.link}` }))));
  }
}
const z = S(
  ({ itemId: r, language: t, path: s, isPreviewMode: p }) => {
    const o = k.getAppState().getUser() || void 0, m = o && o.country || void 0;
    return /* @__PURE__ */ e.createElement(T, { itemId: r, country: m, user: o, language: t, path: s, isPreviewMode: p });
  },
  (r, t) => r.itemId !== t.itemId || r.language !== t.language || r.path !== t.path || r.isPreviewMode !== t.isPreviewMode
);
export {
  z as SingleGameStore
};
