import React from 'react';
import { DownloadWrap } from "./DownloadWrap";
import { revokeJsonProxy } from "../..\\utils\\constants";
import { getPlatformType } from "../..\\utils\\getPlatform";
import Button from "../Button";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
const Download = ({
  media,
  mediaVisible,
  mediaMimeType,
  cardWidth
}) => {
  var _mediaMimeType$split$;
  const url = getPlatformType(media) === 'IPFS' ? revokeJsonProxy(media) : media;
  return /*#__PURE__*/_jsx(DownloadWrap, {
    mediaVisible: mediaVisible,
    cardWidth: cardWidth,
    children: /*#__PURE__*/_jsxs("div", {
      className: "hideScrollbar",
      children: [/*#__PURE__*/_jsx("div", {
        className: "spanContainer",
        children: /*#__PURE__*/_jsx("span", {
          children: mediaMimeType === null || mediaMimeType === void 0 ? void 0 : (_mediaMimeType$split$ = mediaMimeType.split('/')[1]) === null || _mediaMimeType$split$ === void 0 ? void 0 : _mediaMimeType$split$.split(';')[0]
        })
      }), /*#__PURE__*/_jsx("a", {
        target: "_blank",
        rel: "noreferrer noopener",
        download: true,
        href: url,
        className: "downloadA",
        children: /*#__PURE__*/_jsx(Button, {
          label: "Download File"
        })
      })]
    })
  });
};
export default Download;