import "react";
import { STATUS } from "../interface.js";
import { isFunction, isObject } from "../../_util/is.js";
import UploadProgress from "./uploadProgress.js";
import IconImageClose from "../../../icon/react-icon/IconImageClose/index.js";
import IconEye from "../../../icon/react-icon/IconEye/index.js";
import IconDelete from "../../../icon/react-icon/IconDelete/index.js";
import IconUpload from "../../../icon/react-icon/IconUpload/index.js";
import { jsx, jsxs, Fragment } from "../../../../../../../@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 && isFunction(URL.createObjectURL) && URL.createObjectURL(originFile);
  var actionIcons = isObject(showUploadList) ? showUploadList : {};
  return /* @__PURE__ */ jsx("div", {
    className: cls,
    children: status === STATUS.uploading ? /* @__PURE__ */ jsx(UploadProgress, {
      ...__assign({
        onReupload: props.onReupload,
        onUpload: props.onUpload,
        onAbort: props.onAbort,
        listType: "picture-card",
        file,
        prefixCls,
        progressProps: props.progressProps
      }, actionIcons)
    }) : /* @__PURE__ */ jsxs(Fragment, {
      children: [isFunction(actionIcons.imageRender) ? actionIcons.imageRender(file) : /* @__PURE__ */ jsx("img", {
        src: url
      }), /* @__PURE__ */ jsxs("div", {
        className: cls + "-mask",
        children: [file.status === STATUS.fail && /* @__PURE__ */ jsx("div", {
          className: cls + "-error-tip",
          children: actionIcons.errorIcon !== null && /* @__PURE__ */ jsx("span", {
            className: prefixCls + "-list-error-icon",
            children: actionIcons.errorIcon || /* @__PURE__ */ jsx(IconImageClose, {})
          })
        }), /* @__PURE__ */ jsxs("div", {
          className: cls + "-operation",
          children: [file.status !== STATUS.fail && actionIcons.previewIcon !== null && /* @__PURE__ */ jsx("span", {
            className: prefixCls + "-list-preview-icon",
            onClick: function() {
              props.onPreview && props.onPreview(file);
            },
            children: actionIcons.previewIcon || /* @__PURE__ */ jsx(IconEye, {})
          }), file.status === STATUS.fail && actionIcons.reuploadIcon !== null && /* @__PURE__ */ jsx("span", {
            className: props.prefixCls + "-list-reupload-icon",
            onClick: function() {
              props.onReupload && props.onReupload(file);
            },
            children: actionIcons.reuploadIcon || /* @__PURE__ */ jsx(IconUpload, {})
          }), !disabled && actionIcons.removeIcon !== null && /* @__PURE__ */ jsx("span", {
            className: prefixCls + "-list-remove-icon",
            onClick: function() {
              props.onRemove && props.onRemove(file);
            },
            children: actionIcons.removeIcon || /* @__PURE__ */ jsx(IconDelete, {})
          })]
        })]
      })]
    })
  });
};
const PictureItem$1 = PictureItem;
export {
  PictureItem$1 as default
};
//# sourceMappingURL=pictureItem.js.map
