"use client";
import { j as e } from "../../../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.mjs";
import i from "../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.mjs";
import "react";
import { ReactComponent as z } from "../../assets/images/PlusCircleOutline.svg.mjs";
import { ReactComponent as D } from "../../assets/images/Update.svg.mjs";
import H from "../../utils/useAllImagesLoaded.mjs";
import O from "../AchievementNav/index.mjs";
import h from "../Button/index.mjs";
import E from "../Dropdowns/Dropdown/index.mjs";
import "../Dropdowns/GenericDropdown/index.mjs";
import "@mantine/core";
import "../Checkbox/index.mjs";
import "../Dropdowns/OptionsDropdown/OptionsDropdown.module.scss.mjs";
import u from "../Loading/index.mjs";
import { Tabs as l, getTabsClassNames as G } from "../Tabs/index.mjs";
import t from "./AchievementSummaryTable.module.scss.mjs";
import W from "./components/MessageModal/index.mjs";
function re({
  games: a,
  imagesToPreload: x,
  sortProps: g,
  paginationProps: v,
  filterProps: n,
  mintButtonProps: j,
  updateButtonProps: f,
  i18n: r = {
    mintButtonLabel: "Mint",
    updateButtonLabel: "Update"
  },
  achievementNavProps: N,
  isFetching: m,
  hasFetchedAll: B,
  fetchNextPage: c,
  className: b,
  isPageLoading: C,
  tabs: T,
  messageModalProps: d,
  ...w
}) {
  const { handleNextPage: L, handlePrevPage: I } = v, { totalToMint: P, ...y } = j ?? {}, { totalToUpdate: A, ...M } = f ?? {}, R = (s) => {
    const { scrollHeight: S, scrollTop: U, clientHeight: k } = s.target;
    S - U - k < 5e3 && !m && !B && c !== void 0 && c();
  }, F = H(x), p = /* @__PURE__ */ e.jsx("div", { className: t.gamesTable, children: a });
  let o = null;
  return C || !F ? o = /* @__PURE__ */ e.jsx(u, {}) : m ? o = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
    p,
    /* @__PURE__ */ e.jsx(u, {})
  ] }) : a == null || a.length === 0 ? o = /* @__PURE__ */ e.jsx(
    W,
    {
      title: d.title,
      message: d.message,
      className: t.messageModal
    }
  ) : o = p, /* @__PURE__ */ e.jsxs("div", { className: i(t.container, b), ...w, children: [
    /* @__PURE__ */ e.jsxs("div", { className: t.topBar, children: [
      /* @__PURE__ */ e.jsx(
        O,
        {
          ...N,
          nextButtonProps: {
            onClick: L
          },
          previousButtonProps: {
            onClick: I
          },
          showGameAddButton: !1
        }
      ),
      /* @__PURE__ */ e.jsx(
        l,
        {
          value: n.activeFilter,
          onChange: (s) => n.setActiveFilter(s),
          mah: "100%",
          className: t.secondTopRowContainer,
          classNames: G({}, { list: "outline" }),
          children: /* @__PURE__ */ e.jsxs("div", { className: t.row, children: [
            /* @__PURE__ */ e.jsxs("div", { className: t.filters, children: [
              /* @__PURE__ */ e.jsx(
                E,
                {
                  targetWidth: 300,
                  dropdownButtonDivProps: {
                    className: "text--lg weight--regular"
                  },
                  ...g
                }
              ),
              /* @__PURE__ */ e.jsx(l.List, { children: T.map((s) => /* @__PURE__ */ e.jsx(
                l.Tab,
                {
                  value: s.value,
                  className: t.tab,
                  children: /* @__PURE__ */ e.jsx("div", { className: "menu", children: s.label })
                },
                s.value
              )) })
            ] }),
            /* @__PURE__ */ e.jsxs("div", { className: t.ctas, children: [
              /* @__PURE__ */ e.jsx(
                h,
                {
                  type: "secondary",
                  size: "medium",
                  leftIcon: /* @__PURE__ */ e.jsx(z, { width: 16, height: 16 }),
                  spacing: "xs",
                  rightIcon: /* @__PURE__ */ e.jsx("div", { className: i(t.rightIcon, t.mint), children: P ?? 0 }),
                  ...y,
                  children: r.mintButtonLabel
                }
              ),
              /* @__PURE__ */ e.jsx(
                h,
                {
                  type: "alert",
                  size: "medium",
                  leftIcon: /* @__PURE__ */ e.jsx(D, { width: 16, height: 16 }),
                  spacing: "xs",
                  rightIcon: /* @__PURE__ */ e.jsx("div", { className: i(t.rightIcon, t.update), children: A ?? 0 }),
                  ...M,
                  children: r.updateButtonLabel
                }
              )
            ] })
          ] })
        }
      )
    ] }),
    /* @__PURE__ */ e.jsx("div", { className: t.games, onScroll: R, children: o })
  ] });
}
export {
  re as default
};
//# sourceMappingURL=index.mjs.map
