"use strict";
require("react");
const _interface = require("../interface.js");
const is = require("../../_util/is.js");
const uploadProgress = require("./uploadProgress.js");
const index = require("../../../icon/react-icon/IconImageClose/index.js");
const index$1 = require("../../../icon/react-icon/IconEye/index.js");
const index$3 = require("../../../icon/react-icon/IconDelete/index.js");
const index$2 = require("../../../icon/react-icon/IconUpload/index.js");
const emotionReactJsxRuntime_browser_esm = require("../../../../../../../@emotion_react@11.10.4_3toe27fv7etiytxb5kxc7fxaw4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js");
var __assign = globalThis && globalThis.__assign || function() {
  __assign = Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];
      for (var p in s)
        if (Object.prototype.hasOwnProperty.call(s, p))
          t[p] = s[p];
    }
    return t;
  };
  return __assign.apply(this, arguments);
};
var PictureItem = function(props) {
  var disabled = props.disabled, prefixCls = props.prefixCls, file = props.file, showUploadList = props.showUploadList;
  var cls = prefixCls + "-list-item-picture";
  var status = file.status, originFile = file.originFile;
  var url = file.url !== void 0 ? file.url : originFile && is.isFunction(URL.createObjectURL) && URL.createObjectURL(originFile);
  var actionIcons = is.isObject(showUploadList) ? showUploadList : {};
  return /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
    className: cls,
    children: status === _interface.STATUS.uploading ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(uploadProgress, {
      ...__assign({
        onReupload: props.onReupload,
        onUpload: props.onUpload,
        onAbort: props.onAbort,
        listType: "picture-card",
        file,
        prefixCls,
        progressProps: props.progressProps
      }, actionIcons)
    }) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs(emotionReactJsxRuntime_browser_esm.Fragment, {
      children: [is.isFunction(actionIcons.imageRender) ? actionIcons.imageRender(file) : /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("img", {
        src: url
      }), /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
        className: cls + "-mask",
        children: [file.status === _interface.STATUS.fail && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("div", {
          className: cls + "-error-tip",
          children: actionIcons.errorIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
            className: prefixCls + "-list-error-icon",
            children: actionIcons.errorIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index, {})
          })
        }), /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
          className: cls + "-operation",
          children: [file.status !== _interface.STATUS.fail && actionIcons.previewIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
            className: prefixCls + "-list-preview-icon",
            onClick: function() {
              props.onPreview && props.onPreview(file);
            },
            children: actionIcons.previewIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$1, {})
          }), file.status === _interface.STATUS.fail && actionIcons.reuploadIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
            className: props.prefixCls + "-list-reupload-icon",
            onClick: function() {
              props.onReupload && props.onReupload(file);
            },
            children: actionIcons.reuploadIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$2, {})
          }), !disabled && actionIcons.removeIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
            className: prefixCls + "-list-remove-icon",
            onClick: function() {
              props.onRemove && props.onRemove(file);
            },
            children: actionIcons.removeIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$3, {})
          })]
        })]
      })]
    })
  });
};
const PictureItem$1 = PictureItem;
module.exports = PictureItem$1;
//# sourceMappingURL=pictureItem.js.map
