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