"use strict";
const React = require("react");
const _interface = require("../interface.js");
const index$3 = require("../../Progress/index.js");
const index = require("../../ConfigProvider/index.js");
const index$2 = require("../../../icon/react-icon/IconCheck/index.js");
const index$1 = require("../../../icon/react-icon/IconUpload/index.js");
const index$5 = require("../../../icon/react-icon/IconPlayArrowFill/index.js");
const index$6 = require("../../../icon/react-icon/IconPause/index.js");
const index$4 = require("../../Tooltip/index.js");
const is = require("../../_util/is.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 UploadProgress = function(props) {
  var file = props.file, prefixCls = props.prefixCls, progressProps = props.progressProps, progressRender = props.progressRender;
  var locale = React.useContext(index.ConfigContext).locale;
  var status = file.status, _a = file.percent, percent = _a === void 0 ? 0 : _a;
  var cls = prefixCls + "-list";
  var widthStyle = progressProps && progressProps.width ? {
    width: progressProps.width
  } : {};
  var dom = /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs(emotionReactJsxRuntime_browser_esm.Fragment, {
    children: [status === _interface.STATUS.fail && props.reuploadIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
      className: prefixCls + "-list-reupload-icon",
      onClick: function() {
        props.onReupload && props.onReupload(file);
      },
      children: props.reuploadIcon || (props.listType === "picture-card" ? /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$1, {}) : locale.Upload.reupload)
    }), status === _interface.STATUS.success && props.successIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
      className: prefixCls + "-list-success-icon",
      children: props.successIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$2, {})
    }), status !== _interface.STATUS.success && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsxs("div", {
      className: cls + "-status",
      style: widthStyle,
      children: [/* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$3, {
        ...__assign({
          showText: false,
          className: cls + "-progress",
          type: "circle",
          status: status === _interface.STATUS.fail ? "error" : status === _interface.STATUS.success ? "success" : "normal",
          percent,
          size: "mini"
        }, progressProps)
      }), status === _interface.STATUS.init && props.startIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
        className: prefixCls + "-list-start-icon",
        onClick: function() {
          props.onUpload && props.onUpload(file);
        },
        children: props.startIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$4, {
          content: locale.Upload.start,
          children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$5, {})
        })
      }), status === _interface.STATUS.uploading && props.cancelIcon !== null && /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx("span", {
        className: props.prefixCls + "-list-cancel-icon",
        onClick: function() {
          props.onAbort && props.onAbort(file);
        },
        children: props.cancelIcon || /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$4, {
          content: locale.Upload.cancel,
          children: /* @__PURE__ */ emotionReactJsxRuntime_browser_esm.jsx(index$6, {})
        })
      })]
    })]
  });
  return is.isFunction(progressRender) ? progressRender(file, dom) : dom;
};
const UploadProgress$1 = UploadProgress;
module.exports = UploadProgress$1;
//# sourceMappingURL=uploadProgress.js.map
