import { css } from "@emotion/react";
import { memo, useState, useEffect, useRef, useLayoutEffect } from "react";
import { jsx, jsxs, Fragment } from "@emotion/react/jsx-runtime";
import "../../node_modules/.pnpm/@google_model-viewer@3.2.1_three@0.154.0/node_modules/@google/model-viewer/lib/model-viewer.js";
import iconDownload from "../../assets/icon/download.png.js";
import musicCard from "../../assets/icon/music_card.png.js";
import mysteryBox from "../../assets/icon/mysteryBox.jpg.js";
import iconSpinner from "../../assets/icon/spinner_black.svg.js";
import { colors, ellipsisCSS } from "../../styles.js";
import "../CheckBox/style.js";
import "../RadioButton/RadioButtonWrap.js";
import "../Select/Select/SelectWrap.js";
import "../Input/style.js";
import "../UploadCell/UploadCellWrap.js";
import "../Loading/Loading/LoadingWrap.js";
import "../Loading/FolderLoading/style.js";
import "../Button/Button/style.js";
import "../Button/NormalButton/style.js";
import { SmallButton } from "../Button/SmallButton/index.js";
import "../Avatar/style.js";
import "react-dom";
import "../Modal/NormalModal/ModalWrap.js";
import "../Modal/FullScreenModal/style.js";
import "../Modal/CardModal/ModalWrap.js";
import "../BottomTabBar/style.js";
import "../Message/index.js";
import "../Divider/styles.js";
import "../Header/styles.js";
import "../Textarea/styled.js";
import "../Switch/styled.js";
import { dataURLToBlob } from "../../utils/index.js";
import compress from "../../utils/compress.js";
import { jsonProxy2, revokeJsonProxy, jsonProxy, revokeJsonProxy2 } from "../../utils/constants.js";
import { getPlatformType } from "../../utils/getPlatform.js";
const iconStyle = "position: absolute;top: 0;right: 0;bottom: 0;left: 0;max-height: 100%;margin: auto;";
const baseStyle = "border-radius: 12px;";
const backgroundStyle = `background:${colors.nftbg};`;
let contentStyle = `${baseStyle}${backgroundStyle}`;
const Text = function({
  media,
  mediaVisible,
  isDetail
}) {
  const [content, setContent] = useState("");
  useEffect(() => {
    fetch(media).then((r) => r.text()).then((r) => setContent(r));
  }, [media]);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      Loading,
      {
        cssStyle: css`
          display: ${isDetail && content && "none"};
        `,
        isDetail
      }
    ),
    /* @__PURE__ */ jsx(
      "div",
      {
        css: css`
          ${contentStyle}
          ${isDetail || iconStyle}
          padding: ${mediaVisible ? "10px" : "10px 15px"};
          overflow: ${mediaVisible ? "auto" : "hidden"};
          font-size: ${mediaVisible ? "20px" : "16px"};
          color: ${!isDetail && "white"};
          text-align: left;
          word-break: break-word;
          white-space: pre-wrap;
        `,
        className: "hideScrollbar",
        children: content
      }
    )
  ] });
};
const Html = function({
  media,
  mediaVisible,
  isDetail
}) {
  const contentElement = useRef(null);
  const [url, setUrl] = useState(media);
  const [iframeVisible, setIframeVisible] = useState();
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const a = media.lastIndexOf("http");
    if (a === -1)
      return;
    const b = media.slice(a);
    try {
      const c = decodeURIComponent(decodeURIComponent(b));
      if (c.includes("</svg>")) {
        setIframeVisible(false);
        setUrl(
          `data:image/svg+xml;base64,${window.btoa(
            unescape(encodeURIComponent(media))
          )}`
        );
        return;
      }
      setIframeVisible(true);
      setUrl(c);
    } catch {
      try {
        if (media.includes("</svg>")) {
          setIframeVisible(false);
          setUrl(
            `data:image/svg+xml;base64,${window.btoa(
              unescape(encodeURIComponent(media))
            )}`
          );
        } else {
        }
      } catch {
      }
    }
  }, [media]);
  return /* @__PURE__ */ jsxs(
    "div",
    {
      ref: contentElement,
      css: css`
        ${contentStyle}
        ${isDetail || iconStyle}
        overflow: ${mediaVisible ? "auto" : "hidden"};
        font-size: 20px;
        color: white;
        text-align: left;
        word-break: break-all;
        white-space: pre-line;
      `,
      className: "hideScrollbar",
      children: [
        /* @__PURE__ */ jsx(
          Loading,
          {
            cssStyle: css`
          display: ${isDetail && isLoaded && "none"};
          z-index: ${!isDetail && isLoaded ? "-1" : "1"};
          background: ${isDetail && "white"};
        `,
            isDetail
          }
        ),
        iframeVisible ? /* @__PURE__ */ jsx(
          "iframe",
          {
            title: "iframe",
            src: url,
            allowFullScreen: true,
            name: "mapFrame",
            scrolling: "no",
            frameBorder: "0",
            width: "100%",
            height: "100%",
            onLoad: () => setIsLoaded(true),
            css: css`
            display: block;
            /* position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0; */
          `
          }
        ) : /* @__PURE__ */ jsx(
          "img",
          {
            css: css`
            ${contentStyle}
            ${isDetail || iconStyle}
            width: 100%;
            object-fit: contain;
            /* position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0; */
          `,
            src: url,
            onLoad: () => setIsLoaded(true)
          }
        )
      ]
    }
  );
};
const Model = function({
  media,
  mediaVisible,
  isDetail
}) {
  const contentElement = useRef();
  useLayoutEffect(() => {
    var _a, _b, _c;
    if (isDetail)
      return;
    const mv = contentElement.current;
    if (!mv)
      return;
    const shadowRoot = mv.shadowRoot;
    if (!shadowRoot)
      return;
    const button = shadowRoot.querySelectorAll(
      "#default-poster"
    )[0];
    button.style.background = "none";
    const el = (_c = (_b = (_a = mv.parentNode) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.parentNode) == null ? void 0 : _c.parentNode;
    mv.style.opacity = "0";
    mv.style.width = `${el == null ? void 0 : el.offsetWidth}px`;
    mv.style.height = `${el == null ? void 0 : el.offsetHeight}px`;
    setTimeout(
      () => {
        mv.style.opacity = "1";
      },
      mediaVisible ? 800 : 1300
    );
  }, [isDetail, mediaVisible]);
  return /* @__PURE__ */ jsxs(
    "div",
    {
      css: css`
        ${contentStyle}
        ${isDetail || iconStyle}
        background:${isDetail && "white"};
      `,
      onLoad: (el) => {
        var _a, _b;
        if (!isDetail)
          return;
        const mv = contentElement.current;
        if (!mv)
          return;
        const shadowRoot = mv.shadowRoot;
        if (!shadowRoot)
          return;
        const el2 = (_b = (_a = el == null ? void 0 : el.target.parentNode) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.parentNode;
        mv.style.width = `${el2 == null ? void 0 : el2.offsetWidth}px`;
        mv.style.height = `${el2 == null ? void 0 : el2.offsetWidth}px`;
      },
      children: [
        /* @__PURE__ */ jsx(
          Loading,
          {
            cssStyle: css`
          display: none;
        `,
            isDetail
          }
        ),
        /* @__PURE__ */ jsx(
          "model-viewer",
          {
            ref: contentElement,
            src: jsonProxy2(revokeJsonProxy(media)),
            ar: true,
            "ar-modes": "webxr scene-viewer quick-look",
            "environment-image": "neutral",
            "auto-rotate": true,
            "camera-controls": true,
            onClick: (e) => {
              e.stopPropagation();
            },
            onError: (e) => {
            },
            onClose: (e) => {
            },
            "model-visibility": (e) => {
            }
          }
        )
      ]
    }
  );
};
const Binary = function({
  media,
  mediaVisible,
  mediaMimeType,
  autoPlay,
  getMedia,
  isDetail,
  imgCssStyle
}) {
  let format;
  media = revokeJsonProxy(media);
  if (media.includes("?")) {
    const base = media.split("?")[0];
    format = base.slice(base.lastIndexOf(".") + 1);
  } else {
    format = media.slice(media.lastIndexOf(".") + 1);
  }
  if (getPlatformType(media) === "IPFS") {
    media = jsonProxy(media);
  }
  switch (format) {
    case "jpg":
    case "png":
    case "jpeg":
    case "bmp":
    case "ico":
    case "webp":
    case "svg":
    case "avif":
      return /* @__PURE__ */ jsx(
        Image,
        {
          image: media,
          mediaVisible,
          isDetail,
          imgCssStyle
        }
      );
    case "gif":
      return /* @__PURE__ */ jsx(
        Image,
        {
          image: media,
          mediaVisible,
          mediaMimeType: "image/gif",
          isDetail,
          imgCssStyle
        }
      );
    case "mp4":
    case "mov":
    case "ogv":
    case "Ogg":
    case "ogg":
    case "mkv":
    case "webm":
    case "f4v":
      return /* @__PURE__ */ jsx(
        Video,
        {
          media,
          autoPlay,
          getMedia,
          mediaVisible
        }
      );
    case "mp3":
    case "flac":
    case "wav":
    case "aac":
    case "m4r":
    case "m4a":
      return mediaVisible ? /* @__PURE__ */ jsx(Audio, { media, autoPlay, getMedia }) : /* @__PURE__ */ jsx(MusicCard, {});
    case "glb":
    case "gltf":
      return /* @__PURE__ */ jsx(Model, { media, mediaVisible, isDetail });
    default:
      return /* @__PURE__ */ jsx(
        Download,
        {
          media,
          mediaVisible,
          mediaMimeType
        }
      );
  }
};
const Audio = function({
  media,
  autoPlay,
  getMedia
}) {
  const [hasChangedProxy, setHasChangedProxy] = useState(false);
  const [hasRemovedProxy, setHasRemovedProxy] = useState(false);
  const audio = useRef();
  useEffect(() => {
    getMedia(audio.current);
  }, [getMedia]);
  return /* @__PURE__ */ jsx(
    "div",
    {
      css: css`
        ${contentStyle}
        display: flex;
        align-items: center;
        justify-content: center;
      `,
      children: /* @__PURE__ */ jsx(
        "audio",
        {
          css: css`
          width: 50%;
        `,
          ref: audio,
          controls: true,
          loop: true,
          src: media,
          autoPlay,
          onError: (el) => {
            if (!hasRemovedProxy) {
              el.currentTarget.src = revokeJsonProxy(el.currentTarget.src);
              const el2 = el.currentTarget;
              const pNode = el.currentTarget.parentNode;
              el.currentTarget.remove();
              pNode == null ? void 0 : pNode.append(el2);
              setHasRemovedProxy(true);
            } else if (!hasChangedProxy) {
              el.currentTarget.src = jsonProxy2(el.currentTarget.src);
              const el2 = el.currentTarget;
              const pNode = el.currentTarget.parentNode;
              el.currentTarget.remove();
              pNode == null ? void 0 : pNode.append(el2);
              setHasChangedProxy(true);
            }
          }
        }
      )
    }
  );
};
const MusicCard = function() {
  return /* @__PURE__ */ jsx(
    "div",
    {
      css: css`
        ${contentStyle}
        background: rgb(0,1,0);
      `,
      children: /* @__PURE__ */ jsx(
        Image,
        {
          image: musicCard,
          cssStyle: css`
          object-fit: contain !important;
          width: 70% !important;
          background: rgb(0, 1, 0) !important;
        `,
          mediaVisible: true
        }
      )
    }
  );
};
const Video = function({
  media,
  autoPlay,
  mediaVisible,
  getMedia,
  cssStyle
}) {
  const [hasChangedProxy, setHasChangedProxy] = useState(false);
  const [hasRemovedProxy, setHasRemovedProxy] = useState(false);
  const video = useRef();
  useEffect(() => {
    getMedia(video.current);
  }, [autoPlay, getMedia]);
  return /* @__PURE__ */ jsx(
    "video",
    {
      src: media,
      css: css`
        ${contentStyle}
        width: 100%;
        height: 100%;
        ${cssStyle}
      `,
      ref: video,
      autoPlay,
      controls: !!mediaVisible,
      loop: true,
      playsInline: true,
      onError: (el) => {
        if (!hasRemovedProxy) {
          el.currentTarget.src = revokeJsonProxy(el.currentTarget.src);
          const el2 = el.currentTarget;
          const pNode = el.currentTarget.parentNode;
          el.currentTarget.remove();
          pNode == null ? void 0 : pNode.append(el2);
          setHasRemovedProxy(true);
        } else if (!hasChangedProxy) {
          el.currentTarget.src = jsonProxy2(el.currentTarget.src);
          const el2 = el.currentTarget;
          const pNode = el.currentTarget.parentNode;
          el.currentTarget.remove();
          pNode == null ? void 0 : pNode.append(el2);
          setHasChangedProxy(true);
        }
      },
      children: /* @__PURE__ */ jsx(
        "source",
        {
          src: media,
          onError: (el) => {
            if (!hasRemovedProxy) {
              el.currentTarget.src = revokeJsonProxy(el.currentTarget.src);
              const el2 = el.currentTarget;
              const pNode = el.currentTarget.parentNode;
              el.currentTarget.remove();
              pNode == null ? void 0 : pNode.append(el2);
              setHasRemovedProxy(true);
            } else if (!hasChangedProxy) {
              el.currentTarget.src = jsonProxy2(el.currentTarget.src);
              const el2 = el.currentTarget;
              const pNode = el.currentTarget.parentNode;
              el.currentTarget.remove();
              pNode == null ? void 0 : pNode.append(el2);
              setHasChangedProxy(true);
            }
          }
        }
      )
    }
  );
};
const Image = function({
  image,
  cssStyle,
  imgCssStyle,
  mediaVisible,
  mediaMimeType,
  needCompress = true,
  onLoad,
  isDetail
}) {
  const [hasChangedProxy, setHasChangedProxy] = useState(false);
  const [hasRemovedProxy, setHasRemovedProxy] = useState(false);
  const [isLoaded, setIsLoaded] = useState(false);
  const isGif = mediaMimeType == null ? void 0 : mediaMimeType.includes("image/gif");
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      Loading,
      {
        cssStyle: css`
          display: ${isDetail && isLoaded && "none !important"};
          ${cssStyle}
        `,
        isDetail
      }
    ),
    /* @__PURE__ */ jsx(
      "img",
      {
        id: "mediaImg",
        css: css`
          ${contentStyle}
          ${isDetail || iconStyle}
          width: 100%;
          /* visibility: ${!isGif && "hidden"}; */
          visibility: hidden;
          ${cssStyle};
          ${imgCssStyle};
        `,
        src: image,
        onLoad: (el) => {
          if (isGif || !needCompress || image.includes("https://images.mirror-media.xyz/")) {
            el.target.style.visibility = "visible";
            onLoad && onLoad();
            setIsLoaded && setIsLoaded(true);
            return;
          }
          compress(
            el.currentTarget.src,
            el.currentTarget,
            void 0,
            onLoad,
            setIsLoaded
          );
        },
        onError: (el) => {
          if (!hasChangedProxy) {
            const newImage = jsonProxy2(revokeJsonProxy(image));
            setHasChangedProxy(true);
            if (isGif || !needCompress) {
              el.currentTarget.src = newImage;
              return;
            }
            compress(newImage, el.currentTarget, true);
          } else if (!hasRemovedProxy) {
            const newImage = revokeJsonProxy2(image);
            setHasRemovedProxy(true);
            if (isGif || !needCompress) {
              el.currentTarget.src = newImage;
              return;
            }
            compress(newImage, el.currentTarget, true);
          }
        }
      }
    )
  ] });
};
const Download = function({
  media,
  mediaVisible,
  mediaMimeType,
  cardWidth,
  isDetail
}) {
  if (getPlatformType(media) === "IPFS") {
    media = revokeJsonProxy(media);
  }
  return /* @__PURE__ */ jsxs(
    "div",
    {
      css: css`
        ${contentStyle}
        ${isDetail || iconStyle}
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: ${mediaVisible ? "10px" : "10px 15px"};
        overflow: ${mediaVisible ? "auto" : "hidden"};
        font-size: 16px;
        color: white;
        text-align: center;
        background-color: white;
      `,
      className: "hideScrollbar",
      children: [
        /* @__PURE__ */ jsx(
          "div",
          {
            css: css`
          display: flex;
          align-items: center;
          justify-content: center;
          width: ${cardWidth && cardWidth < 150 ? "100%" : "150px"};
          /* width: 10px; */
          height: 33px;
          padding: 16px 10px;
          background: linear-gradient(
              95.04deg,
              rgba(0, 0, 0, 0) 3.11%,
              rgba(0, 0, 0, 0.12) 94.96%
            ),
            #212426;
          border: 2px solid rgba(0, 0, 0, 0.08);
          border-radius: 100px;
          box-shadow:
            -6px -6px 12px rgba(255, 255, 255, 0.04),
            6px 6px 12px rgba(0, 0, 0, 0.16);
        `,
            children: /* @__PURE__ */ jsx(
              "span",
              {
                css: css`
            ${ellipsisCSS}
          `,
                children: mediaMimeType && mediaMimeType.split("/")[1] !== void 0 && mediaMimeType.split("/")[1].split(";")[0]
              }
            )
          }
        ),
        /* @__PURE__ */ jsx(
          "a",
          {
            target: "_blank",
            rel: "noreferrer noopener",
            download: true,
            href: media,
            css: css`
          display: block;
          margin-top: 22px;
        `,
            children: /* @__PURE__ */ jsx(
              SmallButton,
              {
                content: iconDownload,
                tip: "Download File",
                cssStyle: css`
            > div {
              margin-top: 16px;
            }
          `,
                borderless: true
              }
            )
          }
        )
      ]
    }
  );
};
const Iframe = memo(function Iframe2({
  id,
  media,
  onLoad,
  onError,
  cssStyles
}) {
  const [iframeSrc, setIframeSrc] = useState();
  useEffect(() => {
    if (media) {
      setIframeSrc(URL.createObjectURL(dataURLToBlob(media)));
    }
  }, [media]);
  return /* @__PURE__ */ jsx(
    "iframe",
    {
      id,
      title: "iframe",
      src: iframeSrc,
      allowFullScreen: true,
      name: "mapFrame",
      frameBorder: "0",
      width: "100%",
      height: "100%",
      scrolling: "yes",
      className: "mediaIframe",
      sandbox: "allow-scripts allow-same-origin allow-popups allow-forms allow-top-navigation-by-user-activation",
      onLoad: (e) => onLoad == null ? void 0 : onLoad(e),
      onError: (e) => onError == null ? void 0 : onError(e)
    }
  );
});
const IframeWithoutSandBox = memo(function IframeWithoutSandBox2({
  media,
  onLoad
}) {
  const [iframeSrc, setIframeSrc] = useState();
  useEffect(() => {
    if (media) {
      setIframeSrc(URL.createObjectURL(dataURLToBlob(media)));
    }
  }, [media]);
  return /* @__PURE__ */ jsx(
    "iframe",
    {
      title: "iframe",
      src: iframeSrc,
      allowFullScreen: true,
      name: "mapFrame",
      frameBorder: "0",
      width: "100%",
      height: "100%",
      scrolling: "yes",
      onLoad: (e) => {
        onLoad && onLoad(e);
      }
    }
  );
});
const Empty = function({
  cssStyle,
  children
}) {
  return /* @__PURE__ */ jsx(
    "div",
    {
      css: css`
        ${contentStyle}
        display: grid;
        place-items: center;
        color: black;
        background: ${colors.nftbg};
        ${cssStyle}
      `,
      children
    }
  );
};
const Loading = function({
  cssStyle,
  isDetail
}) {
  return /* @__PURE__ */ jsx(
    Empty,
    {
      cssStyle: css`
        background: ${isDetail && "white"};
        ${cssStyle}
      `,
      children: isDetail && /* @__PURE__ */ jsx(
        "img",
        {
          src: iconSpinner,
          css: css`
            @keyframes _18hu3ey0 {
              to {
                transform: rotate(1turn);
              }
            }
            animation: _18hu3ey0 1.4s linear infinite;
            width: 30px;
            height: 30px;
          `
        }
      )
    }
  );
};
const Media = function({
  mediaUrl,
  mediaMimeType,
  autoPlay = false,
  mediaVisible = false,
  needCompress = true,
  isMysteryBox,
  getMedia = () => {
  },
  cardWidth,
  cssStyle,
  imgCssStyle,
  onLoad,
  isDetail
}) {
  contentStyle = mediaVisible ? `${baseStyle}background:none;` : `${baseStyle}${backgroundStyle}`;
  if ((mediaMimeType == null ? void 0 : mediaMimeType.includes("text/xml")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("text/plain")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("text/markdown")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("application/json")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("application/javascript")))
    return /* @__PURE__ */ jsx(Text, { media: mediaUrl, mediaVisible, isDetail });
  if (mediaMimeType == null ? void 0 : mediaMimeType.includes("text/html"))
    return /* @__PURE__ */ jsx(Html, { media: mediaUrl, mediaVisible, isDetail });
  if (mediaMimeType == null ? void 0 : mediaMimeType.includes("model/gltf")) {
    return /* @__PURE__ */ jsx(Model, { media: mediaUrl, mediaVisible, isDetail });
  }
  if ((mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/mp3")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/ogg")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/flac")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/wav")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/vnd.dlna.adts")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/x-m4r")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/m4a")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("audio/mpeg")))
    return mediaVisible ? /* @__PURE__ */ jsx(
      Audio,
      {
        media: mediaVisible ? mediaUrl : "",
        autoPlay,
        getMedia
      }
    ) : /* @__PURE__ */ jsx(MusicCard, {});
  if ((mediaMimeType == null ? void 0 : mediaMimeType.includes("video/mp4")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("video/quicktime")))
    return /* @__PURE__ */ jsx(
      Video,
      {
        media: mediaUrl,
        autoPlay,
        mediaVisible,
        getMedia,
        cssStyle
      }
    );
  if ((mediaMimeType == null ? void 0 : mediaMimeType.includes("image/jpg")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/jpeg")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/png")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/bmp")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/gif")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/x-icon")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/webp")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("image/svg+xml")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("imageViewer")))
    return /* @__PURE__ */ jsx(
      Image,
      {
        image: mediaUrl,
        mediaVisible,
        mediaMimeType,
        needCompress,
        cssStyle,
        imgCssStyle,
        onLoad,
        isDetail
      }
    );
  if ((mediaMimeType == null ? void 0 : mediaMimeType.includes("application/octet-stream")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("binary/octet-stream")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("application/wasm")) || (mediaMimeType == null ? void 0 : mediaMimeType.includes("application/json")))
    return /* @__PURE__ */ jsx(
      Binary,
      {
        media: mediaUrl,
        mediaMimeType,
        mediaVisible,
        autoPlay,
        getMedia,
        imgCssStyle
      }
    );
  if (mediaMimeType == null ? void 0 : mediaMimeType.includes("application/pdf")) {
    return /* @__PURE__ */ jsx(IframeWithoutSandBox, { media: mediaUrl, onLoad });
  }
  if (mediaMimeType === "iframe") {
    return /* @__PURE__ */ jsx(Iframe, { media: mediaUrl, onLoad });
  }
  if (mediaUrl)
    return /* @__PURE__ */ jsx(
      Download,
      {
        media: mediaUrl,
        mediaVisible,
        mediaMimeType,
        cardWidth,
        isDetail
      }
    );
  if (isMysteryBox)
    return /* @__PURE__ */ jsx(Image, { image: mysteryBox });
  return /* @__PURE__ */ jsx(Empty, {});
};
export {
  Iframe,
  IframeWithoutSandBox,
  Media
};
//# sourceMappingURL=index.js.map
