import { T as Tabs, a as TabStyles } from "./Tabs.js";
import { w as withPropsGuard } from "./WithPropsGuard.js";
import { c as classNames } from "./reactSlick.js";
import React__default from "react";
import { T as Trans } from "./index.js";
var PlatformRequirements$1 = "";
const RequirementItemList = (props) => {
  const { requirements } = props;
  return /* @__PURE__ */ React__default.createElement("div", {
    className: "requirementItemList"
  }, requirements.map((requirement, index) => /* @__PURE__ */ React__default.createElement("div", {
    key: `${index} ${requirement.label}`
  }, /* @__PURE__ */ React__default.createElement("div", {
    className: "itemLabel"
  }, requirement.label), /* @__PURE__ */ React__default.createElement("ul", null, /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.osVersion"
    }, "OS Version"),
    value: requirement.osVersion
  }), /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.processor"
    }, "Processor"),
    value: requirement.processor
  }), /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.ram"
    }, "RAM"),
    value: requirement.ram
  }), /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.graphics"
    }, "Graphics Card"),
    value: requirement.graphics
  }), /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.directXVersion"
    }, "Direct X Version"),
    value: requirement.directXVersion
  }), /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.diskSpace"
    }, "Disk Space"),
    value: requirement.diskSpace
  }), /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.soundCard"
    }, "Sound Card"),
    value: requirement.soundCard
  }), requirement.additionals && /* @__PURE__ */ React__default.createElement(RequirementItem, {
    title: /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.requirements.additionals"
    }, "Additional Requirements"),
    value: requirement.additionals
  })))));
};
const RequirementItem = (props) => {
  const { title, value } = props;
  return /* @__PURE__ */ React__default.createElement("li", {
    className: "requirementItem"
  }, /* @__PURE__ */ React__default.createElement("span", {
    className: "itemTitle"
  }, title), /* @__PURE__ */ React__default.createElement("span", {
    className: "itemContent"
  }, value || "-"));
};
const PlatformRequirements = withPropsGuard(class PlatformRequirementsClass extends React__default.Component {
  constructor() {
    super(...arguments);
    this.state = {
      selectedRequirementKey: null
    };
  }
  componentDidMount() {
    const {
      additionalAppInfo: { platformRequirements }
    } = this.props;
    this.setState({
      selectedRequirementKey: Object.keys(platformRequirements || {})[0] || null
    });
  }
  render() {
    const {
      additionalAppInfo: { platformRequirements }
    } = this.props;
    if (!platformRequirements)
      return null;
    const platformsKeys = Object.keys(platformRequirements);
    if (!this.state.selectedRequirementKey)
      return null;
    const requirements = platformRequirements[this.state.selectedRequirementKey];
    if (!requirements)
      return;
    return /* @__PURE__ */ React__default.createElement("div", {
      className: classNames("gamePlatformRequirements", this.props.className)
    }, /* @__PURE__ */ React__default.createElement("h3", {
      className: "requirementTitle"
    }, /* @__PURE__ */ React__default.createElement(Trans, {
      i18nKey: "PlatformRequirements.systemRequirement"
    }, "System Requirements")), /* @__PURE__ */ React__default.createElement(Tabs, null, platformsKeys.map((key) => /* @__PURE__ */ React__default.createElement("span", {
      className: classNames(TabStyles.tab, key === this.state.selectedRequirementKey && TabStyles.active),
      onClick: () => this.setState({
        selectedPlatformKey: key
      }),
      key
    }, key))), /* @__PURE__ */ React__default.createElement(RequirementItemList, {
      requirements
    }));
  }
}, (prev, next) => prev.additionalAppInfo !== next.additionalAppInfo);
export { PlatformRequirements as P };
