"use client";
import { j as a } from "./index.esm38.js";
import N from "./index.esm40.js";
import { AnimatedEyeIcon as g } from "./index.esm394.js";
import { AnimatedClockIcon as u } from "./index.esm395.js";
import e from "./index.esm396.js";
import { FileTextIcon as y } from "./index.esm397.js";
import { Typography as i } from "./index.esm9.js";
import { EyeIcon as I } from "./index.esm398.js";
function v(s) {
  return s >= 1e6 ? `${(s / 1e6).toFixed(1)}M` : s >= 1e3 ? `${(s / 1e3).toFixed(1)}K` : String(s);
}
function k(s) {
  if (s < 60) return `${s} мин`;
  const n = Math.floor(s / 60), r = s % 60;
  return r > 0 ? `${n} ч ${r} мин` : `${n} ч`;
}
function A({
  title: s,
  description: n,
  viewsCount: r,
  readingTimeMinutes: m,
  author: c,
  imageUrl: h,
  imageAlt: f,
  formattedDate: o,
  view: x,
  tags: l,
  href: j,
  showPlaceholder: w = !0,
  className: p
}) {
  if (x === "row")
    return /* @__PURE__ */ a.jsxs("div", { className: N(e.content, e["content--row"], p), children: [
      /* @__PURE__ */ a.jsx("div", { className: e.rowIcon, "aria-hidden": !0, children: /* @__PURE__ */ a.jsx(y, { size: 24, strokeWidth: 2 }) }),
      /* @__PURE__ */ a.jsxs("div", { className: e.rowBody, children: [
        l && /* @__PURE__ */ a.jsx("div", { className: e.tagsSlotRow, onClick: (t) => t.stopPropagation(), children: l }),
        /* @__PURE__ */ a.jsx(i, { variant: "h5", as: "h2", className: e.title, title: s, children: s }),
        /* @__PURE__ */ a.jsxs("div", { className: e.rowMeta, children: [
          /* @__PURE__ */ a.jsx(i, { variant: "caption", className: e.date, children: o }),
          r != null && /* @__PURE__ */ a.jsxs("span", { className: e.views, title: "Просмотры", children: [
            /* @__PURE__ */ a.jsx(I, { size: 14, strokeWidth: 2 }),
            /* @__PURE__ */ a.jsx("span", { children: v(r) })
          ] })
        ] })
      ] })
    ] });
  if (x === "card") {
    const t = /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
      m != null && /* @__PURE__ */ a.jsxs("span", { className: e.readingTime, title: "Время чтения", children: [
        /* @__PURE__ */ a.jsx(u, { size: 14, className: e.clockIcon }),
        /* @__PURE__ */ a.jsx("span", { children: k(m) })
      ] }),
      r != null && /* @__PURE__ */ a.jsxs("span", { className: e.views, title: "Просмотры", children: [
        /* @__PURE__ */ a.jsx(g, { size: 14, className: e.eyeIcon }),
        /* @__PURE__ */ a.jsx("span", { children: v(r) })
      ] })
    ] });
    return /* @__PURE__ */ a.jsxs(
      "div",
      {
        className: N(
          e.content,
          e["content--card"],
          p
        ),
        children: [
          /* @__PURE__ */ a.jsxs("div", { className: e.cardBody, children: [
            c ? /* @__PURE__ */ a.jsxs("div", { className: e.author, onClick: (d) => d.stopPropagation(), children: [
              c.avatarUrl ? /* @__PURE__ */ a.jsx(
                "img",
                {
                  src: c.avatarUrl,
                  alt: "",
                  className: e.authorAvatar,
                  width: 32,
                  height: 32
                }
              ) : /* @__PURE__ */ a.jsx("div", { className: e.authorAvatarPlaceholder, "aria-hidden": !0, children: c.name.charAt(0).toUpperCase() }),
              /* @__PURE__ */ a.jsx(i, { variant: "caption", className: e.authorName, children: c.name }),
              /* @__PURE__ */ a.jsx(i, { variant: "caption", className: e.date, children: o })
            ] }) : /* @__PURE__ */ a.jsx(i, { variant: "caption", className: e.date, children: o }),
            /* @__PURE__ */ a.jsx(i, { variant: "h5", as: "h2", className: e.title, title: s, children: s }),
            n && /* @__PURE__ */ a.jsx(i, { variant: "caption", className: e.description, children: n }),
            /* @__PURE__ */ a.jsxs("div", { className: e.cardFooter, children: [
              l && /* @__PURE__ */ a.jsx("div", { className: e.tagsSlotCard, onClick: (d) => d.stopPropagation(), children: l }),
              j ? /* @__PURE__ */ a.jsx("a", { href: j, className: e.meta, children: t }) : /* @__PURE__ */ a.jsx("div", { className: e.meta, children: t })
            ] })
          ] }),
          h ? /* @__PURE__ */ a.jsx("div", { className: e.previewWrap, children: /* @__PURE__ */ a.jsx(
            "img",
            {
              src: h,
              alt: f || s,
              className: e.previewImage,
              decoding: "async",
              loading: "lazy"
            }
          ) }) : w ? /* @__PURE__ */ a.jsx("div", { className: e.previewWrap, children: /* @__PURE__ */ a.jsx("div", { className: e.previewPlaceholder, "aria-hidden": !0 }) }) : null
        ]
      }
    );
  }
  return null;
}
A.displayName = "ArticlePreviewContent";
export {
  A as ArticlePreviewContent
};
//# sourceMappingURL=index.esm52.js.map
