import { j as jsxRuntimeExports } from "./jsx-runtime.CXYVdt5g.js";
import { b as useBrickStyle } from "./use-section-style.D8_SY6rK.js";
import { ba as manifest } from "./use-editor.CurXdZnZ.js";
import "@sinclair/typebox";
import "lodash-es";
import { a as tx } from "./twind.B1qQmF_s.js";
import { B as BrickRoot } from "./BrickRoot.C4Jpjw20.js";
function Image({ brick, editable }) {
  const { props } = brick;
  const styles = useBrickStyle(brick);
  const { image: imageStyles, ...containerStyles } = styles;
  const { src, alt } = props.image ?? {};
  const isDynamicSrc = src?.includes("{{");
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
    BrickRoot,
    {
      brick,
      editable,
      manifest,
      as: "picture",
      className: tx("group/image flex items-center justify-center", Object.values(containerStyles)),
      children: [
        !isDynamicSrc && typeof src === "string" && src !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "img",
          {
            src,
            alt,
            className: tx(
              "max-h-full w-full h-full rounded-[inherit] select-none pointer-events-none",
              imageStyles
            )
          }
        ),
        editable && !src && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: tx(
              "rounded-[inherit] transition-opacity duration-300 group-hover/image:opacity-100 flex w-full h-full p-10 items-center justify-center font-semibold"
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-ellipsis text-nowrap flex-nowrap text-center", children: "No image set" })
          }
        ),
        editable && isDynamicSrc && /* @__PURE__ */ jsxRuntimeExports.jsx(
          "div",
          {
            className: tx(
              "rounded-[inherit] transition-opacity duration-300 flex items-center  w-full h-full justify-center font-medium p-10"
            ),
            children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-ellipsis text-nowrap flex-nowrap text-center", children: "Dynamic Image" })
          }
        )
      ]
    }
  );
}
export {
  Image as default
};
//# sourceMappingURL=image.5omojKtx.js.map
