"use client";
import { jsxs as i, jsx as a, Fragment as g } from "react/jsx-runtime";
import { formatDate as f } from "../../utils/formatDate.es.js";
import { cn as m } from "../../utils/cn/cn.es.js";
import { EAnalyticsEventType as v } from "../../types/analytics/analytics.es.js";
import e from "../../components/StudyGridCard/studyGridCard.module.css";
import { Typography as n } from "../Typography/Typography.es.js";
import { TextButton as d } from "../TextButton/TextButton.es.js";
import { EIconName as o } from "../Icon/constants.es.js";
import { Label as y } from "../Label/Label.es.js";
function S(t) {
  const s = () => {
    var r;
    if (t.trackingEvent) {
      const l = {
        event: t.trackingEvent,
        location: t.trackingLocation || "",
        type: v.interaction,
        payload: {
          scienceCardTitle: t.title
        }
      };
      (r = window.eventBus) == null || r.emit("analytics", l);
    }
  };
  if (t.compressed === !0) {
    const { title: r, link: l, image: c } = t;
    return /* @__PURE__ */ i("div", { className: m(e.study, e.studyCompressed), children: [
      /* @__PURE__ */ a(
        "div",
        {
          className: m(e.imagePart, e.imagePartCompressed),
          style: { backgroundImage: `url(${c})` }
        }
      ),
      /* @__PURE__ */ i("div", { className: m(e.dataPart, e.dataPartCompressed), children: [
        /* @__PURE__ */ a(
          n,
          {
            className: m(e.title, e.titleCompressed),
            defaultVariant: "headingSm",
            mobileVariant: "bodySm",
            as: "h6",
            children: r
          }
        ),
        /* @__PURE__ */ i("div", { className: e.button, children: [
          /* @__PURE__ */ a(
            d,
            {
              hideOn: "desktop",
              size: "sm",
              as: "a",
              href: l,
              suffixIcon: o.ARROW_FORWARD,
              onClick: s,
              children: "READ MORE"
            }
          ),
          /* @__PURE__ */ a(
            d,
            {
              hideOn: "mobile",
              size: "lg",
              as: "a",
              href: l,
              suffixIcon: o.ARROW_FORWARD,
              onClick: s,
              children: "READ MORE"
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ a("div", { className: e.borderLeft }),
      /* @__PURE__ */ a("div", { className: e.borderRight })
    ] });
  } else {
    const { title: r, link: l, image: c, inverted: b, date: h, label: u, readTime: R } = t;
    return /* @__PURE__ */ i("div", { className: e.study, "data-inverted": b, children: [
      /* @__PURE__ */ a("div", { className: e.imagePart, style: { backgroundImage: `url(${c})` }, children: u && /* @__PURE__ */ a(y, { ...u }) }),
      /* @__PURE__ */ i("div", { className: e.dataPart, children: [
        /* @__PURE__ */ i("div", { className: e.info, children: [
          /* @__PURE__ */ a(
            n,
            {
              className: e.date,
              defaultVariant: "labelSm",
              mobileVariant: "labelXs",
              emphasis: !0,
              weight: "medium",
              color: "color-neutral-500",
              children: f(h)
            }
          ),
          /* @__PURE__ */ a(
            n,
            {
              className: e.mobileDate,
              defaultVariant: "labelSm",
              mobileVariant: "labelXs",
              emphasis: !0,
              weight: "medium",
              color: "color-neutral-500",
              children: f(h, { year: "2-digit" }).replaceAll(" / ", "/")
            }
          ),
          /* @__PURE__ */ i(g, { children: [
            /* @__PURE__ */ a(
              n,
              {
                defaultVariant: "labelSm",
                mobileVariant: "labelXs",
                emphasis: !0,
                weight: "medium",
                color: "color-neutral-500",
                align: "center",
                children: "•"
              }
            ),
            /* @__PURE__ */ i(
              n,
              {
                defaultVariant: "labelSm",
                mobileVariant: "labelXs",
                emphasis: !0,
                weight: "medium",
                color: "color-neutral-500",
                children: [
                  R,
                  " MIN READ"
                ]
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ a(n, { className: e.title, defaultVariant: "headingSm", mobileVariant: "bodySm", as: "h6", children: r }),
        /* @__PURE__ */ i("div", { className: e.button, children: [
          /* @__PURE__ */ a(
            d,
            {
              hideOn: "desktop",
              size: "sm",
              as: "a",
              href: l,
              suffixIcon: o.ARROW_FORWARD,
              onClick: s,
              children: "READ MORE"
            }
          ),
          /* @__PURE__ */ a(
            d,
            {
              hideOn: "mobile",
              size: "lg",
              as: "a",
              href: l,
              suffixIcon: o.ARROW_FORWARD,
              onClick: s,
              children: "READ MORE"
            }
          )
        ] })
      ] })
    ] });
  }
}
export {
  S as StudyGridCard
};
