import { Alert as n } from "./accelbyte-widgets123.mjs";
import { AlertType as r } from "./accelbyte-widgets128.mjs";
import { PurchaseHelper as P } from "./accelbyte-widgets211.mjs";
import t from "react";
import { Trans as a } from "react-i18next";
import { withRouter as w } from "react-router-dom";
function p({ purchaseLogic: e, user: f, location: A, isPreviewMode: E }) {
  var o, s, u, y;
  if (E)
    return null;
  const l = !!(f && ((s = (o = e == null ? void 0 : e.state) == null ? void 0 : o.itemOwnership) != null && s.owned)), m = e && e.state.purchaseConstraint && P.purchaseUnavailable(e.state.purchaseConstraint), i = !!((y = (u = e == null ? void 0 : e.state) == null ? void 0 : u.pendingOrders) != null && y[0]), d = A.pathname.includes("store");
  return i && d ? /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement(n, { type: r.warning, className: "headerAlert rounded-none" }, /* @__PURE__ */ t.createElement(a, { i18nKey: "BundleItemDetailPage.itemAlreadyOrdered" }, "You already ordered this item. Please complete your order."))) : l && m && d ? /* @__PURE__ */ t.createElement("div", null, /* @__PURE__ */ t.createElement(n, { type: r.warning, className: "headerAlert rounded-none" }, /* @__PURE__ */ t.createElement(a, { i18nKey: "BundleItemDetailPage.itemAlreadyOwned" }, "You already own this item."))) : /* @__PURE__ */ t.createElement("div", null, m && !l && !i && /* @__PURE__ */ t.createElement(n, { type: r.danger, className: "headerAlert rounded-none" }, /* @__PURE__ */ t.createElement(a, { i18nKey: "BundleItemDetailPage.itemNotAvailable" }, "This item is unavailable.")));
}
const N = w(p);
export {
  N as ItemDetailPurchaseAlert
};
