import t, { useState as r } from "react";
import { Trans as m } from "react-i18next";
import { t as c } from "./accelbyte-widgets58.mjs";
import { Typography as s } from "./accelbyte-widgets173.mjs";
import { Modal as w, ModalBody as D } from "./accelbyte-widgets635.mjs";
import { Button as u, ButtonType as d, ButtonFontSize as p, ButtonStyle as y } from "./accelbyte-widgets107.mjs";
import { Drops as B } from "./accelbyte-widgets636.mjs";
import "./accelbyte-widgets637.mjs";
function R({ onCancel: h, onClaim: C, options: a, visible: E, isPreview: l, isMultipleGame: T, gameData: b }) {
  const [o, f] = r(a[0]), [g, i] = r(!1), M = (e) => {
    f(e);
  }, S = async () => {
    i(!0);
    const e = b.find((v) => v.value === o.value);
    e && await C(e == null ? void 0 : e.namespace, o.value, e == null ? void 0 : e.clientId, e == null ? void 0 : e.label), i(!1);
  }, n = T ? "multipleGame" : "";
  return /* @__PURE__ */ t.createElement(
    w,
    {
      visible: E,
      className: `twitchDropPage__claimModal ${n}`,
      overlayClassName: n,
      isPreviewMode: l,
      overlayBackground: l ? { position: "absolute" } : void 0
    },
    /* @__PURE__ */ t.createElement(D, null, /* @__PURE__ */ t.createElement(s, { tag: "h2", fontSize: "lg", isCentered: !0 }, /* @__PURE__ */ t.createElement(m, { i18nKey: "TwitchDropPage.claim.modal.title" }, "Claim Drops")), /* @__PURE__ */ t.createElement(s, { tag: "p", isCentered: !0 }, /* @__PURE__ */ t.createElement(m, { i18nKey: "TwitchDropPage.claim.modal.subtitle" }, "Do you want to claim game drops with this Twitch account?", /* @__PURE__ */ t.createElement("br", null), "This action may require you to re-login to Twitch.")), /* @__PURE__ */ t.createElement(B, { options: a, onChange: M, isFullWidth: !0, placeholder: "Choose a game", value: o }), /* @__PURE__ */ t.createElement("div", { className: "buttonContainer" }, /* @__PURE__ */ t.createElement(
      u,
      {
        onClick: h,
        buttonType: d.PLAIN,
        buttonFontSize: p.MEDIUM,
        buttonStyle: y.TEXT,
        hasOutline: !1
      },
      c("common.cancel")
    ), /* @__PURE__ */ t.createElement(
      u,
      {
        isLoading: g,
        onClick: S,
        buttonType: d.FLAT,
        buttonFontSize: p.MEDIUM,
        buttonStyle: y.PRIMARY,
        disabled: !o
      },
      c("common.claim")
    )))
  );
}
export {
  R as ClaimModal
};
