import { jsxs as n, jsx as r } from "react/jsx-runtime";
import { aH as p } from "./use-page-data.BYLN5MSa.js";
import { T as i } from "./TextContent.i83ueo1A.js";
import { a as e } from "./twind.Cg2g8xBZ.js";
import { b as f } from "./use-section-style.CqWLdjop.js";
import { B as x } from "./BrickRoot.CQgjTuOI.js";
import { u as g } from "./use-brick-props.C-zGB4NN.js";
import { useState as u } from "react";
function C(s) {
  const { brick: o, editable: a } = s, t = g(s), c = f(o), m = Object.values(c), [l, d] = u(!0);
  return /* @__PURE__ */ n(
    x,
    {
      brick: o,
      editable: a,
      manifest: p,
      className: e("flex relative overflow-hidden !flex-nowrap flex-col", m),
      children: [
        /* @__PURE__ */ n("div", { className: e("card-inner-wrapper", t.imagePosition === "top" ? "order-2" : "order-1"), children: [
          !t.noTitle && /* @__PURE__ */ r("div", { className: e("text-[120%] font-semibold z-auto my-4 mx-4"), children: /* @__PURE__ */ r(
            i,
            {
              propPath: "title.content",
              className: e("flex-1"),
              brickId: o.id,
              content: t.title,
              rawContent: o.props.title,
              editable: a,
              inline: !0
            }
          ) }),
          t.imagePosition !== "middle" && /* @__PURE__ */ r("div", { className: e("z-auto p-4", !t.noTitle && "pt-0"), children: /* @__PURE__ */ r(
            i,
            {
              propPath: "text.content",
              className: e("flex-grow"),
              brickId: o.id,
              content: t.text,
              rawContent: o.props.text,
              editable: a
            }
          ) })
        ] }),
        t.cardImage?.src && l && /* @__PURE__ */ r(
          "img",
          {
            onError: () => d(!1),
            className: e(
              " select-none pointer-events-none bg-transparent w-inherit h-[clamp(100px,50%,250px)]",
              t.cardImage.position ?? "object-center",
              t.cardImage.fit ?? "object-cover",
              t.imagePosition === "middle" && "order-2",
              t.imagePosition === "top" && "order-first",
              t.imagePosition === "bottom" && "order-last mt-auto"
            ),
            src: t.cardImage.src,
            alt: t.cardImage.alt || "Card Image"
          }
        ),
        t.text && t.imagePosition === "middle" && /* @__PURE__ */ r("div", { className: e("z-auto p-4 order-last"), children: /* @__PURE__ */ r(
          i,
          {
            propPath: "text.content",
            className: e("flex-1 prose lg:prose-lg"),
            brickId: o.id,
            content: t.text,
            rawContent: o.props.text,
            editable: a
          }
        ) })
      ]
    }
  );
}
export {
  C as default
};
