var g = Object.defineProperty, u = Object.defineProperties;
var k = Object.getOwnPropertyDescriptors;
var a = Object.getOwnPropertySymbols;
var w = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
var c = (e, i, t) => i in e ? g(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t, n = (e, i) => {
  for (var t in i || (i = {}))
    w.call(i, t) && c(e, t, i[t]);
  if (a)
    for (var t of a(i))
      I.call(i, t) && c(e, t, i[t]);
  return e;
}, o = (e, i) => u(e, k(i));
import { jsx as m, jsxs as M, Fragment as V } from "react/jsx-runtime";
import { Image as b } from "antd";
import "../../../node_modules/antd-mobile/es/global/index.mjs";
import x from "../../../node_modules/antd-mobile/es/components/image-viewer/index.mjs";
import { useState as l, useEffect as y } from "react";
import { isMobile as h } from "../../../node_modules/react-device-detect/dist/lib.mjs";
import C from "../Video/index.mjs";
import { checkMediaType as T } from "../../../utils/markdown/index.mjs";
const j = (e) => {
  const [i, t] = l(!1), [s, f] = l();
  return y(() => {
    e.src && f(T(e.src));
  }, [e.src]), s == "video" ? /* @__PURE__ */ m(C, {
    src: e.src,
    controls: !0
  }) : h ? /* @__PURE__ */ M(V, {
    children: [/* @__PURE__ */ m("img", {
      style: {
        maxWidth: "100%"
      },
      src: e == null ? void 0 : e.src,
      onClick: () => {
        t(!0);
      }
    }), /* @__PURE__ */ m(x, {
      image: (e == null ? void 0 : e.src) || "",
      visible: i,
      onClose: () => {
        t(!1);
      }
    })]
  }) : /* @__PURE__ */ m(b, o(n({
    style: {
      maxWidth: "100%"
    }
  }, e), {
    onClick: (d) => {
      var r;
      return (r = e.onClick) == null ? void 0 : r.call(e, d);
    },
    onError: () => {
      console.log(e), console.warn("图片加载失败");
    }
  }));
}, A = j;
export {
  A as default
};
