import { jsx as c, Fragment as x } from "@emotion/react/jsx-runtime";
import { useContext as u } from "react";
import { getPropertyByString as a } from "@m4l/core";
import { IMAGE_SIZES as f } from "./constants.js";
import { DataGridContext as w } from "../../contexts/DataGridContext/DataGridContext.js";
import { ImageFormatter as I } from "../../../formatters/ImageFormatter/ImageFormatter.js";
function G(h) {
  const { formatterProps: o, fieldValue: l, fieldText: r, width: e, height: i, cover: v } = h, n = u(w)?.viewMode ?? "cards", d = e !== void 0 && i !== void 0, s = n === "cards" || n === "list", g = s ? d ? e : f.cards : void 0, p = s ? d ? i : f.cards : void 0, t = a(o.row, l) ?? void 0, m = r ? a(o.row, r) ?? void 0 : void 0;
  return t ? /* @__PURE__ */ c(
    I,
    {
      src: t,
      alt: m || t,
      width: g,
      height: p,
      text: m,
      cover: v
    }
  ) : /* @__PURE__ */ c(x, { children: "-" });
}
export {
  G as ImageFormatterCell
};
