import { defineComponent, computed, createVNode, mergeProps } from 'vue';
import { EyeOutlined } from '@ant-design/icons-vue';
import localeValues from '../locale/lang/en_US.mjs';
import '../vc-image/index.mjs';
import ImageInternal, { imageProps } from '../vc-image/src/Image.mjs';
import '../hooks/index.mjs';
import { getTransitionName } from '../_util/components/transition.mjs';
import classNames from '../_util/classNames.mjs';
import useStyle from './style/index.mjs';
import InternalPreviewGroup, { icons } from './PreviewGroup.mjs';
import useConfigInject from '../config-provider/hooks/useConfigInject.mjs';

const Image = /* @__PURE__ */ defineComponent({
  name: "AImage",
  inheritAttrs: false,
  props: imageProps(),
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls,
      rootPrefixCls,
      configProvider
    } = useConfigInject("image", props);
    const [wrapSSR, hashId] = useStyle(prefixCls);
    const mergedPreview = computed(() => {
      const {
        preview
      } = props;
      if (preview === false)
        return preview;
      const _preview = typeof preview === "object" ? preview : {};
      return {
        icons,
        ..._preview,
        transitionName: getTransitionName(rootPrefixCls.value, "zoom", _preview.transitionName),
        maskTransitionName: getTransitionName(rootPrefixCls.value, "fade", _preview.maskTransitionName)
      };
    });
    return () => {
      var _a, _b;
      const imageLocale = ((_b = (_a = configProvider.locale) == null ? void 0 : _a.value) == null ? void 0 : _b.Image) || localeValues.Image;
      const defaultPreviewMask = () => createVNode("div", {
        "class": `${prefixCls.value}-mask-info`
      }, [createVNode(EyeOutlined, null, null), imageLocale == null ? void 0 : imageLocale.preview]);
      const {
        previewMask = slots.previewMask || defaultPreviewMask
      } = props;
      return wrapSSR(createVNode(ImageInternal, mergeProps({
        ...attrs,
        ...props,
        prefixCls: prefixCls.value
      }, {
        "preview": mergedPreview.value,
        "rootClassName": classNames(props.rootClassName, hashId.value)
      }), {
        ...slots,
        previewMask: typeof previewMask === "function" ? previewMask : null
      }));
    };
  }
});
Image.PreviewGroup = InternalPreviewGroup;
Image.install = function(app) {
  app.component(Image.name, Image);
  app.component(Image.PreviewGroup.name, Image.PreviewGroup);
  return app;
};

export { InternalPreviewGroup as ImagePreviewGroup, Image as default, imageProps };
//# sourceMappingURL=index.mjs.map
