import d from "./accelbyte-widgets210.mjs";
import { Ctx as h } from "./accelbyte-widgets33.mjs";
import { AccPath as g } from "./accelbyte-widgets34.mjs";
import { FeUtils as u } from "./accelbyte-widgets45.mjs";
import t from "react";
import { Trans as y } from "react-i18next";
import { AccountHistoryLogic as H, EditableInputWithHistory as f } from "./accelbyte-widgets324.mjs";
import { AccountHistoryPageDetail as D } from "./accelbyte-widgets325.mjs";
class E extends t.Component {
  constructor(e) {
    var a;
    super(e), this.renderTableHistories = (s) => /* @__PURE__ */ t.createElement("table", { className: "historyTable" }, /* @__PURE__ */ t.createElement("thead", null, /* @__PURE__ */ t.createElement("tr", null, /* @__PURE__ */ t.createElement("th", null, /* @__PURE__ */ t.createElement(y, { i18nKey: "PasswordAccountHistoryPage.date" }, "Date")))), /* @__PURE__ */ t.createElement("tbody", null, s.map((r) => /* @__PURE__ */ t.createElement("tr", { key: r.timestamp }, /* @__PURE__ */ t.createElement("td", null, u.formatDate(r.timestamp, { type: "dynamic", format: "LL" })))))), this.appState = h.getAppState(), this.logic = new H({
      userId: ((a = this.appState.getUser()) == null ? void 0 : a.userId) || "",
      page: e.page,
      startDate: e.startDate,
      endDate: e.endDate,
      type: f.enum.password,
      appState: this.appState
    }), this.logic.subscribe(() => this.setState({}));
  }
  componentDidMount() {
    this.logic.fetchAccountHistoryData();
  }
  render() {
    var i;
    const { startDate: e, endDate: a } = this.logic.state, { accountHistory: s, errorFetchingHistory: r, isFetchingHistory: n } = this.appState.getUserManager().state, { changeEndDate: c, changeStartDate: m } = this.logic, { page: p } = this.props, l = ((i = this.appState.getUser()) == null ? void 0 : i.userId) || "";
    return /* @__PURE__ */ t.createElement(
      D,
      {
        changeEndDate: c,
        changeStartDate: m,
        editHistory: s,
        endDate: a,
        startDate: e,
        fetchError: r,
        isFetching: n,
        page: p,
        paginationPath: g.PasswordHistory.makePath(),
        userId: l,
        renderTableHistories: this.renderTableHistories
      }
    );
  }
}
const U = d(E, (o, e) => o.page !== e.page);
export {
  U as PasswordAccountHistoryPage
};
