import { mergeProps, unref, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderClass, ssrRenderAttr, ssrRenderStyle } from 'vue/server-renderer';

const _sfc_main = {
  __name: "CoreImg",
  __ssrInlineRender: true,
  props: {
    event: { type: Object, default: () => ({}) },
    thumb: { type: Boolean, default: false },
    lazy: { type: Boolean, default: false },
    showPreview: { type: Boolean, default: true }
  },
  setup(__props) {
    const props = __props;
    const media = props.event.media?.[0];
    const thumbnailPosition = media?.focalpoint ? `${(media?.focalpoint[0] + 1) * 50}% ${(media?.focalpoint[1] + 1) * 50}%` : "center center";
    const srcset = props.thumb ? "" : `/media/thumb/${media?.url} 500w, /media/${media?.url} 1200w`;
    const height = media?.height ?? "auto";
    const width = media?.width ?? "auto";
    const src = media?.url ? "/media/thumb/" + media?.url : props.thumb && "/fallbackimage.png";
    return (_ctx, _push, _parent, _attrs) => {
      _push(`<div${ssrRenderAttrs(mergeProps({
        class: { img: true, thumb: __props.thumb }
      }, _attrs))}>`);
      if (unref(media)) {
        _push(`<img class="${ssrRenderClass({ "u-featured": true })}"${ssrRenderAttr("alt", unref(media).name)}${ssrRenderAttr("loading", __props.lazy ? "lazy" : "eager")}${ssrRenderAttr("src", unref(src))}${ssrRenderAttr("srcset", unref(srcset))} itemprop="image"${ssrRenderAttr("height", unref(height))}${ssrRenderAttr("width", unref(width))} style="${ssrRenderStyle({ "object-position": unref(thumbnailPosition) })}">`);
      } else if (!unref(media)) {
        _push(`<img class="thumb"${ssrRenderAttr("src", `/fallbackimage.png`)} alt="">`);
      } else {
        _push(`<!---->`);
      }
      _push(`</div>`);
    };
  }
};
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Core/Img.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};

export { _sfc_main as _ };
