import { _ as _defineProperty } from '../_verture/defineProperty-62acccfc.js';
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-81040c9e.js';
import { _ as _slicedToArray } from '../_verture/slicedToArray-76060636.js';
import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
import { useState, useEffect, useRef, memo, forwardRef, useCallback, useImperativeHandle, useMemo } from 'react';
import RcUpload from 'rc-upload';
import UploadIcon from '@iam-com/icons/UploadFile';
import LoadingIcon from '@iam-com/icons/Loading';
import { _ as _typeof } from '../_verture/typeof-498dd2b1.js';
import { r as regenerator } from '../_verture/index-beef914f.js';
import Delete from '@iam-com/icons/Delete';
import TextIcon from '@iam-com/icons/Text';
import PhotoIcon from '@iam-com/icons/Photo';
import clsx from 'clsx';
import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-66aa48a1.js';
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
import Forbid from '@iam-com/icons/Forbid';
import { Button } from '../Button/index.js';
import { u as useFormatMessage } from '../_verture/useFormatMessage-703f8b20.js';
import EditOutline from '@iam-com/icons/EditOutline';
import CloseIcon from '@iam-com/icons/Close';
import { Tooltip } from '../Tooltip/index.js';
import { Slider } from '../Slider/index.js';
import Cropper from 'react-easy-crop';
import { Modal } from '../Modal/index.js';
import '../_verture/unsupportedIterableToArray-cb478f24.js';
import '@iam-com/icons/LoadingF';
import '@iam-com/icons/Down';
import '../_verture/index-fac03ce3.js';
import 'rc-dropdown';
import '../_verture/usePopupContainer-87febeb9.js';
import 'dayjs';
import '@iam-com/lib';
import 'rc-tooltip';
import 'rc-tooltip/lib/placements';
import '@para-ui/core/GlobalContext';
import 'rc-slider';
import 'rc-dialog';
import '../_verture/index-65bbd1e4.js';
import 'react-dom';
import '../AutoTips/index.js';
import '@iam-com/icons/CheckCircleF';
import '@iam-com/icons/CloseCircleF';
import '@iam-com/icons/WarningCircle';
import '@iam-com/icons/WarningCircleF';

var css_248z$4 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午3:08\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload-list-text .upload-list-item {\n  margin-top: 8px;\n}\n.paraui-v3-upload-list-text .upload-list-item-info {\n  display: flex;\n  align-items: center;\n  padding: 0 8px;\n  line-height: 28px;\n  font-size: 14px;\n  color: rgb(46, 55, 67);\n  border-radius: 4px;\n  transition: background-color 0.3s;\n}\n.paraui-v3-upload-list-text .upload-list-item-info .upload-list-text {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n}\n.paraui-v3-upload-list-text .upload-list-item-info .upload-list-text .upload-list-fileicon {\n  line-height: 0;\n  opacity: 1;\n  transition: opacity 0.3s;\n}\n.paraui-v3-upload-list-text .upload-list-item-info .upload-list-text .upload-list-fileicon svg {\n  color: inherit;\n  font-size: inherit;\n}\n.paraui-v3-upload-list-text .upload-list-item-info .upload-list-text-name {\n  margin-left: 10px;\n}\n.paraui-v3-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions {\n  position: absolute;\n  opacity: 0;\n  visibility: hidden;\n  line-height: 0;\n  transition: opacity 0.3s;\n  cursor: pointer;\n}\n.paraui-v3-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions svg {\n  color: rgb(235, 96, 84);\n  font-size: inherit;\n}\n.paraui-v3-upload-list-text .upload-list-item-info:hover {\n  background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-v3-upload-list-text .upload-list-item-info:hover .upload-list-text .upload-list-actions {\n  visibility: visible;\n  opacity: 1;\n}\n.paraui-v3-upload-list-text .upload-list-item-info:hover .upload-list-text .upload-list-fileicon-active {\n  opacity: 0;\n}\n.paraui-v3-upload-list-picture {\n  display: inline-flex;\n  align-items: center;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item {\n  position: relative;\n  display: inline-block;\n  width: 100px;\n  height: 100px;\n  margin-right: 16px;\n  border-radius: 4px;\n  cursor: default;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item::before {\n  content: \" \";\n  position: absolute;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  top: 0;\n  background-color: rgba(46, 55, 67, 0.7);\n  border-radius: 4px;\n  opacity: 0;\n  transition: 0.3s;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item img {\n  width: 100%;\n  height: 100%;\n  border-radius: 4px;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item .upload-list-picture-name {\n  position: absolute;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  padding: 0 10px;\n  font-size: 12px;\n  line-height: 24px;\n  text-align: center;\n  text-overflow: ellipsis;\n  overflow: hidden;\n  white-space: nowrap;\n  background-color: rgba(46, 55, 67, 0.7);\n  border-radius: 0 0 4px 4px;\n  color: rgb(255, 255, 255);\n  transition: 0.3s;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item .upload-list-actions {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  opacity: 0;\n  line-height: 0;\n  cursor: pointer;\n  transition: 0.3s;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item .upload-list-actions svg {\n  color: rgb(255, 255, 255);\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly)::before {\n  opacity: 1;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly) .upload-list-actions {\n  opacity: 1;\n}\n.paraui-v3-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly) .upload-list-picture-name {\n  opacity: 0;\n}";
styleInject(css_248z$4);

function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
//UploadList
var UploadList = function UploadList(props) {
  var _props$listType = props.listType,
    listType = _props$listType === void 0 ? 'text' : _props$listType,
    _props$items = props.items,
    items = _props$items === void 0 ? [] : _props$items,
    onRemove = props.onRemove,
    _props$showRemoveIcon = props.showRemoveIcon,
    showRemoveIcon = _props$showRemoveIcon === void 0 ? true : _props$showRemoveIcon,
    removeIcon = props.removeIcon,
    itemRender = props.itemRender,
    readonly = props.readonly;
  var _useState = useState([]),
    _useState2 = _slicedToArray(_useState, 2),
    uploadList = _useState2[0],
    setUploadList = _useState2[1];
  //处理删除
  var handleRemove = function handleRemove(file, evt) {
    evt.stopPropagation();
    onRemove === null || onRemove === void 0 ? void 0 : onRemove(file);
  };
  //渲染列表actions
  var renderActions = function renderActions(file) {
    return showRemoveIcon && !readonly && jsx("span", Object.assign({
      className: 'upload-list-actions',
      onClick: function onClick(evt) {
        return handleRemove(file, evt);
      }
    }, {
      children: removeIcon || jsx(Delete, {})
    }));
  };
  //文件列表 text
  var renderFileListText = function renderFileListText() {
    if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
    return uploadList.map(function (file, idx) {
      var _a;
      if (itemRender)
        //自定义渲染
        return itemRender(file, uploadList);
      var isImage = !!((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image/'));
      return jsx("div", Object.assign({
        className: 'upload-list-item'
      }, {
        children: jsx("div", Object.assign({
          className: 'upload-list-item-info'
        }, {
          children: jsxs("span", Object.assign({
            className: 'upload-list-text'
          }, {
            children: [jsx("span", Object.assign({
              className: clsx('upload-list-fileicon', showRemoveIcon && 'upload-list-fileicon-active')
            }, {
              children: isImage ? jsx(PhotoIcon, {}) : jsx(TextIcon, {})
            })), renderActions(file), jsx("span", Object.assign({
              className: "upload-list-text-name"
            }, {
              children: file.name
            }))]
          }))
        }))
      }), idx);
    });
  };
  //文件列表 picture-card
  var renderFileListPicture = function renderFileListPicture() {
    if (!(uploadList === null || uploadList === void 0 ? void 0 : uploadList.length)) return null;
    return uploadList.map(function (file, idx) {
      if (itemRender)
        //自定义渲染
        return itemRender(file, uploadList);
      return jsxs("div", Object.assign({
        className: "upload-list-picture-item ".concat(readonly ? 'upload-list-picture-item-readonly' : '')
      }, {
        children: [jsx("img", {
          src: file.dataUrl || file.url,
          alt: file.name
        }), jsx("span", Object.assign({
          className: 'upload-list-picture-name',
          title: file.name
        }, {
          children: file.name
        })), renderActions(file)]
      }), idx);
    });
  };
  //处理文件
  var handleFileFormat = function handleFileFormat() {
    return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
      var readerFileAsDataUrl, _iterator, _step, file, dataUrl;
      return regenerator.wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            if (items === null || items === void 0 ? void 0 : items.length) {
              _context2.next = 2;
              break;
            }
            return _context2.abrupt("return", setUploadList([]));
          case 2:
            //读取file as DataUrl
            readerFileAsDataUrl = function readerFileAsDataUrl(file) {
              return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
                return regenerator.wrap(function _callee$(_context) {
                  while (1) switch (_context.prev = _context.next) {
                    case 0:
                      return _context.abrupt("return", new Promise(function (resolve) {
                        var fileReader = new FileReader();
                        if (file.originFileObj) {
                          fileReader.onload = function () {
                            resolve(fileReader.result);
                          };
                          fileReader.readAsDataURL(file.originFileObj);
                        } else resolve('');
                      }));
                    case 1:
                    case "end":
                      return _context.stop();
                  }
                }, _callee);
              }));
            };
            _iterator = _createForOfIteratorHelper(items);
            _context2.prev = 4;
            _iterator.s();
          case 6:
            if ((_step = _iterator.n()).done) {
              _context2.next = 15;
              break;
            }
            file = _step.value;
            if (!file.originFileObj) {
              _context2.next = 13;
              break;
            }
            _context2.next = 11;
            return readerFileAsDataUrl(file);
          case 11:
            dataUrl = _context2.sent;
            file.dataUrl = dataUrl;
          case 13:
            _context2.next = 6;
            break;
          case 15:
            _context2.next = 20;
            break;
          case 17:
            _context2.prev = 17;
            _context2.t0 = _context2["catch"](4);
            _iterator.e(_context2.t0);
          case 20:
            _context2.prev = 20;
            _iterator.f();
            return _context2.finish(20);
          case 23:
            setUploadList(_toConsumableArray(items));
          case 24:
          case "end":
            return _context2.stop();
        }
      }, _callee2, null, [[4, 17, 20, 23]]);
    }));
  };
  useEffect(function () {
    if (listType === 'picture-card') handleFileFormat();else setUploadList(function (pre) {
      if (items) return _toConsumableArray(items);
      return pre;
    });
  }, [items]);
  return jsx(Fragment, {
    children: listType === 'text' ? jsx("section", Object.assign({
      className: "".concat($prefixCls, "-upload-list-text")
    }, {
      children: renderFileListText()
    })) : jsx("section", Object.assign({
      className: "".concat($prefixCls, "-upload-list-picture")
    }, {
      children: renderFileListPicture()
    }))
  });
};

var css_248z$3 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/15 下午7:12\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload-error {\n  position: absolute;\n  left: 0;\n  top: 100%;\n  margin-top: 12px;\n  display: inline-flex;\n  align-items: center;\n  padding: 0 12px;\n  line-height: 28px;\n  background-color: #FDF6F5;\n  color: rgb(235, 96, 84);\n  font-size: 14px;\n  white-space: nowrap;\n  border-radius: 4px;\n  z-index: 1;\n}\n.paraui-v3-upload-error svg {\n  margin-right: 4px;\n  font-size: inherit;\n  color: inherit;\n}\n.paraui-v3-upload-error-image {\n  margin-top: 8px;\n}\n.paraui-v3-upload-error-drag {\n  top: 20px;\n  left: 50%;\n  margin-top: 0;\n  transform: translateX(-50%);\n}";
styleInject(css_248z$3);

//error tip
var ErrorTip = function ErrorTip(props) {
  return jsxs("div", Object.assign({
    className: clsx("".concat($prefixCls, "-upload-error"), props.className)
  }, {
    children: [jsx(Forbid, {}), props.message]
  }));
};

var en = {
  uploadError: 'Upload error',
  uploading: 'Uploading',
  clickUploadFile: 'Click to upload file',
  dragFileUpload: 'After downloading the template and completing the information, you can directly drag and drop the file here to upload it. Supported formats: XLS, XLSX...',
  add: 'Add',
  edit: 'Edit',
  disabled: 'Disabled',
  delete: 'Delete',
  editImage: 'Edit image'
};

var zh = {
  uploadError: '上传失败',
  uploading: '正在上传',
  clickUploadFile: '点击上传文件',
  dragFileUpload: '下载模板并完善信息后，可直接将文件拖拽到此处进行上传，支持格式：XLS、XLSX...',
  add: '新增',
  edit: '编辑',
  disabled: '禁用',
  delete: '删除',
  editImage: '编辑图片'
};

var localeJson = {
  zh: zh,
  en: en
};

var css_248z$2 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午7:31\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload-image {\n  display: inline-flex;\n  align-items: center;\n}\n.paraui-v3-upload-image .upload-img-wrapper-container {\n  position: relative;\n}\n.paraui-v3-upload-image .upload-img-wrapper-container__del-btn {\n  display: none;\n  position: absolute;\n  top: 10px;\n  right: 10px;\n  padding: 0;\n  width: 14px;\n  height: 14px;\n  text-align: center;\n  border-radius: 50%;\n  background: #fff;\n  box-shadow: 0px 0px 4px 0px rgba(46, 55, 67, 0.4);\n  z-index: 1;\n}\n.paraui-v3-upload-image .upload-img-wrapper-container__del-btn .paraui-icon-small {\n  vertical-align: top;\n  font-size: 14px;\n  color: rgba(46, 55, 67, 0.7);\n}\n.paraui-v3-upload-image .upload-img-wrapper-container__del-btn:hover .paraui-icon-small {\n  color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-upload-image .upload-img-wrapper-container:hover .upload-img-wrapper-container__del-btn {\n  display: block;\n}\n.paraui-v3-upload-image .upload-image-select {\n  position: relative;\n  width: 100px;\n  height: 100px;\n  background-color: rgba(171, 176, 185, 0.12);\n  border-radius: 4px;\n  cursor: pointer;\n  transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-select-loading {\n  pointer-events: none;\n}\n.paraui-v3-upload-image .upload-image-select .component-upload {\n  display: inline-block;\n  width: 100%;\n  height: 100%;\n}\n.paraui-v3-upload-image .upload-image-select:hover {\n  background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-upload-image .upload-image-select:hover .upload-image-picture-card {\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-upload-image .upload-image-select.upload-image-select-disabled {\n  background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-v3-upload-image .upload-image-select.upload-image-select-disabled .upload-image-picture-card {\n  color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-upload-image .upload-image-select.upload-image-select-disabled .upload-image-picture-card svg {\n  color: rgba(46, 55, 67, 0.4);\n}\n.paraui-v3-upload-image .upload-image-picture-card {\n  display: inline-flex;\n  flex-direction: column;\n  width: 100%;\n  height: 100%;\n  align-items: center;\n  justify-content: center;\n  color: rgb(46, 55, 67);\n  font-size: 14px;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-select-tooltip-wrapper {\n  display: inline-flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  width: 100%;\n  height: 100%;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper {\n  position: relative;\n  width: 100%;\n  height: 100%;\n  overflow: hidden;\n  cursor: default;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper img {\n  width: 100%;\n  height: 100%;\n  border-radius: 4px;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper::before {\n  content: \" \";\n  position: absolute;\n  left: 0;\n  right: 0;\n  bottom: 0;\n  top: 0;\n  background-color: rgba(46, 55, 67, 0.7);\n  border-radius: 4px;\n  opacity: 0;\n  transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper-name {\n  position: absolute;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  padding: 0 10px;\n  font-size: 12px;\n  line-height: 24px;\n  text-align: center;\n  text-overflow: ellipsis;\n  overflow: hidden;\n  white-space: nowrap;\n  background-color: rgba(46, 55, 67, 0.7);\n  border-radius: 0 0 4px 4px;\n  color: rgb(255, 255, 255);\n  transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper-action {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  opacity: 0;\n  line-height: 0;\n  cursor: pointer;\n  transition: 0.3s;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper-action svg {\n  color: rgb(255, 255, 255);\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper:hover::before {\n  opacity: 1;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper:hover .upload-img-wrapper-name {\n  opacity: 0;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-img-wrapper:hover .upload-img-wrapper-action {\n  opacity: 1;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-icon {\n  color: rgb(54, 102, 214);\n  font-size: 30px;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-loading {\n  color: rgb(54, 102, 214);\n  font-size: 30px;\n  animation: imageLoadingCircle 1s infinite linear;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-text {\n  margin-top: 6px;\n  color: inherit;\n  transition: 0.3s;\n  text-align: center;\n}\n.paraui-v3-upload-image .upload-image-picture-card .upload-image-text-loading {\n  color: rgb(54, 102, 214);\n}\n@keyframes imageLoadingCircle {\n  100% {\n    transform: rotate(360deg);\n  }\n}";
styleInject(css_248z$2);

//ImageUpload
var ImageUpload = function ImageUpload(props) {
  var className = props.className,
    style = props.style,
    _onStart = props.onStart,
    _onSuccess = props.onSuccess,
    _onError = props.onError,
    _onProgress = props.onProgress,
    onRemove = props.onRemove,
    _beforeUpload = props.beforeUpload,
    onChange = props.onChange,
    _props$defaultFileLis = props.defaultFileList,
    defaultFileList = _props$defaultFileLis === void 0 ? [] : _props$defaultFileLis,
    fileList = props.fileList,
    _props$showUploadList = props.showUploadList,
    showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
    maxCount = props.maxCount,
    _props$children = props.children,
    children = _props$children === void 0 ? null : _props$children,
    itemRender = props.itemRender,
    _props$showUploadErro = props.showUploadError,
    showUploadError = _props$showUploadErro === void 0 ? true : _props$showUploadErro,
    _props$stash = props.stash,
    stash = _props$stash === void 0 ? false : _props$stash,
    _props$uploading = props.uploading,
    uploading = _props$uploading === void 0 ? true : _props$uploading,
    _props$loading = props.loading,
    loading = _props$loading === void 0 ? false : _props$loading,
    _props$showLoading = props.showLoading,
    showLoadingProp = _props$showLoading === void 0 ? false : _props$showLoading,
    defaultImage = props.defaultImage,
    readonly = props.readonly,
    avatarProps = props.avatarProps,
    disabledTooltip = props.disabledTooltip,
    restProps = __rest(props, ["className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "stash", "uploading", "loading", "showLoading", "defaultImage", "readonly", "avatarProps", "disabledTooltip"]);
  var intl = useFormatMessage('Upload', localeJson);
  var _useState = useState(defaultFileList),
    _useState2 = _slicedToArray(_useState, 2),
    uploadFileList = _useState2[0],
    setUploadFileList = _useState2[1]; //文件列表
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    showResetBtn = _useState4[0],
    setShowResetBtn = _useState4[1]; // 是否展示重置按钮-默认不展示
  var _useState5 = useState(),
    _useState6 = _slicedToArray(_useState5, 2),
    borderRadius = _useState6[0],
    setBorderRadius = _useState6[1]; // border-radius样式
  var _useState7 = useState(false),
    _useState8 = _slicedToArray(_useState7, 2),
    isAvatar = _useState8[0],
    setIsAvatar = _useState8[1]; // 是否为头像组件
  var _useState9 = useState(true),
    _useState10 = _slicedToArray(_useState9, 2),
    showPicName = _useState10[0],
    setShowPicName = _useState10[1]; // 是否展示图片名称
  var _useState11 = useState(false),
    _useState12 = _slicedToArray(_useState11, 2),
    showLoading = _useState12[0],
    setShowLoading = _useState12[1]; //upload loading
  var _useState13 = useState(false),
    _useState14 = _slicedToArray(_useState13, 2),
    errTip = _useState14[0],
    setErrTip = _useState14[1]; //upload error tip
  var _useState15 = useState({
      imageUrl: ''
    }),
    _useState16 = _slicedToArray(_useState15, 2),
    avatar = _useState16[0],
    setAvatar = _useState16[1]; //不显示列表时上传头像
  var _ref = typeof showUploadList === 'boolean' ? {} : showUploadList,
    showRemoveIcon = _ref.showRemoveIcon,
    removeIcon = _ref.removeIcon; //显示上传列表
  var _ref2 = typeof showUploadError === 'boolean' ? {} : showUploadError,
    _ref2$uploadErrorMsg = _ref2.uploadErrorMsg,
    uploadErrorMsg = _ref2$uploadErrorMsg === void 0 ? intl({
      id: 'uploadError'
    }) : _ref2$uploadErrorMsg,
    _ref2$leaveDelay = _ref2.leaveDelay,
    leaveDelay = _ref2$leaveDelay === void 0 ? 2000 : _ref2$leaveDelay; //错误信息提示
  var cropFileRef = useRef(); //裁剪文件
  useEffect(function () {
    if (avatarProps && Object.prototype.toString.call(avatarProps) === "[object Object]" && Object.keys(avatarProps).length > 0) {
      var _ref3 = avatarProps || {},
        _ref3$showReset = _ref3.showReset,
        showReset = _ref3$showReset === void 0 ? false : _ref3$showReset,
        _ref3$borderRadius = _ref3.borderRadius,
        borderRadiusVal = _ref3$borderRadius === void 0 ? "50%" : _ref3$borderRadius,
        avatarDefaultImage = _ref3.defaultImage,
        _ref3$showName = _ref3.showName,
        showName = _ref3$showName === void 0 ? false : _ref3$showName;
      setShowResetBtn(showReset);
      setBorderRadius(String(borderRadiusVal).includes("px") || String(borderRadiusVal).includes("%") ? String(borderRadiusVal) : "".concat(borderRadiusVal, "px"));
      setIsAvatar(true);
      setShowPicName(showName);
      var nextAvatarDefaultImage = avatarDefaultImage || defaultImage || {
        imageUrl: ''
      };
      setAvatar(Object.assign({}, nextAvatarDefaultImage));
    } else if (typeof avatarProps === "boolean" && avatarProps) {
      setBorderRadius("50%");
      setIsAvatar(true);
      setShowPicName(false);
      if (defaultImage) {
        setAvatar(Object.assign({}, defaultImage));
      }
    } else {
      setIsAvatar(false);
      setShowPicName(true);
      if (defaultImage) {
        setAvatar(Object.assign({}, defaultImage));
      }
    }
  }, [avatarProps, defaultImage]);
  useEffect(function () {
    setShowLoading(loading);
  }, [loading]);
  //复写属性
  var overrideProps = Object.assign(Object.assign({
    accept: 'image/*'
  }, restProps), {
    beforeUpload: function beforeUpload(file, fileList) {
      return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
        var result;
        return regenerator.wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              if (restProps.action && showLoadingProp && uploading) setShowLoading(true);
              _context.next = 3;
              return _beforeUpload === null || _beforeUpload === void 0 ? void 0 : _beforeUpload(file, fileList);
            case 3:
              result = _context.sent;
              if (!(result === false)) {
                _context.next = 9;
                break;
              }
              setShowLoading(false);
              return _context.abrupt("return", false);
            case 9:
              if (!(_typeof(result) === 'object' && result)) {
                _context.next = 16;
                break;
              }
              if (!(result instanceof File || result instanceof Blob)) {
                _context.next = 12;
                break;
              }
              return _context.abrupt("return", result);
            case 12:
              cropFileRef.current = result.cropFile;
              return _context.abrupt("return", result.isUpload);
            case 16:
              return _context.abrupt("return", true);
            case 17:
            case "end":
              return _context.stop();
          }
        }, _callee);
      }));
    },
    onStart: function onStart(file) {
      _onStart === null || _onStart === void 0 ? void 0 : _onStart(file);
    },
    onSuccess: function onSuccess(response, file, xhr) {
      setShowLoading(false);
      errTip && showErrTip(false);
      var nextFileList = updateFileList(file);
      onInternalChange(nextFileList);
      _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess(response, file, xhr);
    },
    onError: function onError(error, response, file) {
      setShowLoading(false);
      showErrTip(!!showUploadError);
      _onError === null || _onError === void 0 ? void 0 : _onError(error, response, file);
    },
    onProgress: function onProgress(e, file) {
      _onProgress === null || _onProgress === void 0 ? void 0 : _onProgress(e, file);
    },
    onBatchStart: function onBatchStart(fileList) {
      if (stash) {
        if (cropFileRef.current) {
          var idx = fileList.findIndex(function (_) {
            var _a;
            return _.file.uid === ((_a = cropFileRef.current) === null || _a === void 0 ? void 0 : _a.uid);
          });
          if (idx > -1) {
            fileList.splice(idx, 1, {
              file: cropFileRef.current,
              parsedFile: cropFileRef.current
            });
          }
        }
        var arr = fileList.map(function (_) {
          return _.parsedFile || _.file;
        });
        var mList = mergedFileList(arr);
        onInternalChange(mList);
      }
    }
  });
  //内部变化
  var onInternalChange = function onInternalChange(changedFileList) {
    return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
      var cloneList, file, imageUrl;
      return regenerator.wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            cloneList = _toConsumableArray(changedFileList);
            if (showUploadList) {
              _context2.next = 17;
              break;
            }
            //不显示上传列表
            file = cloneList.slice(-1)[0];
            if (!file) {
              _context2.next = 14;
              break;
            }
            _context2.next = 6;
            return readerFileAsDataUrl(file);
          case 6:
            imageUrl = _context2.sent;
            file.dataUrl = imageUrl;
            avatar.imageUrl = imageUrl;
            avatar.imageName = file.name;
            setAvatar(Object.assign({}, avatar));
            onChange === null || onChange === void 0 ? void 0 : onChange([file]);
            _context2.next = 16;
            break;
          case 14:
            setAvatar({
              imageUrl: ''
            });
            onChange === null || onChange === void 0 ? void 0 : onChange([]);
          case 16:
            return _context2.abrupt("return");
          case 17:
            if (maxCount === 1) {
              cloneList = cloneList.slice(-1);
            } else if (maxCount) {
              cloneList = cloneList.slice(0, maxCount);
            }
            onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
            setUploadFileList(cloneList);
          case 20:
          case "end":
            return _context2.stop();
        }
      }, _callee2);
    }));
  };
  //更新文件列表
  var updateFileList = function updateFileList(file) {
    var cloneList = _toConsumableArray(uploadFileList);
    var fileObj = Object.assign(Object.assign({}, file), {
      lastModified: file.lastModified,
      lastModifiedDate: file.lastModifiedDate,
      name: file.name,
      size: file.size,
      type: file.type,
      uid: file.uid,
      originFileObj: file
    });
    return cloneList.concat(fileObj);
  };
  //合并文件列表
  var mergedFileList = function mergedFileList(fileList) {
    var cloneList = _toConsumableArray(uploadFileList);
    var newFileList = fileList.map(function (file) {
      return Object.assign(Object.assign({}, file), {
        lastModified: file.lastModified,
        lastModifiedDate: file.lastModifiedDate,
        name: file.name,
        size: file.size,
        type: file.type,
        uid: file.uid,
        originFileObj: file
      });
    });
    return cloneList.concat(newFileList);
  };
  //删除文件
  var handleRemove = function handleRemove(file) {
    Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
      // Prevent removing file
      if (ret === false) return;
      var idx = uploadFileList.findIndex(function (_) {
        return _.uid === file.uid;
      });
      if (idx > -1) uploadFileList.splice(idx, 1);
      onInternalChange(uploadFileList);
    });
  };
  //读取dataUrl
  var readerFileAsDataUrl = function readerFileAsDataUrl(file) {
    return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
      return regenerator.wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            return _context3.abrupt("return", new Promise(function (resolve) {
              var fileReader = new FileReader();
              if (file.originFileObj) {
                fileReader.onload = function () {
                  resolve(fileReader.result);
                };
                fileReader.readAsDataURL(file.originFileObj);
              } else resolve('');
            }));
          case 1:
          case "end":
            return _context3.stop();
        }
      }, _callee3);
    }));
  };
  //显示错误提示
  var showErrTip = function showErrTip(flag) {
    setErrTip(flag);
    if (leaveDelay < 0) return;
    setTimeout(function () {
      setErrTip(false);
    }, leaveDelay);
  };
  useEffect(function () {
    if (fileList) {
      setUploadFileList(_toConsumableArray(fileList));
    }
  }, [fileList]);
  //渲染上传列表
  var renderUploadList = function renderUploadList() {
    return showUploadList && jsx(UploadList, {
      listType: 'picture-card',
      readonly: readonly,
      items: uploadFileList,
      showRemoveIcon: showRemoveIcon,
      removeIcon: removeIcon,
      onRemove: handleRemove,
      itemRender: itemRender
    });
  };
  //渲染内容
  var renderUploadContent = function renderUploadContent() {
    var _a;
    var borderRadiusStyle = borderRadius ? {
      borderRadius: borderRadius
    } : {};
    var avatarUploadNode = jsxs("div", Object.assign({
      className: 'upload-img-wrapper',
      style: borderRadiusStyle
    }, {
      children: [jsx("img", {
        src: avatar.imageUrl,
        alt: (_a = avatar.imageName) !== null && _a !== void 0 ? _a : '',
        style: borderRadiusStyle
      }), avatar.imageName && showPicName && jsx("span", Object.assign({
        className: 'upload-img-wrapper-name'
      }, {
        children: avatar.imageName
      })), jsx("span", Object.assign({
        className: 'upload-img-wrapper-action'
      }, {
        children: jsx(EditOutline, {})
      }))]
    }));
    var uploadNode = jsxs(Fragment, {
      children: [showLoading ? jsx(LoadingIcon, {
        className: 'upload-image-loading'
      }) : jsx(UploadIcon, {
        className: 'upload-image-icon'
      }), jsx("span", Object.assign({
        className: clsx('upload-image-text', showLoading && 'upload-image-text-loading')
      }, {
        children: showLoading ? intl({
          id: 'uploading'
        }) : children
      }))]
    });
    if (restProps.disabled && disabledTooltip && (disabledTooltip === null || disabledTooltip === void 0 ? void 0 : disabledTooltip.title)) return jsx(Tooltip, Object.assign({
      followCursor: true
    }, disabledTooltip || {}, {
      disabled: true
    }, {
      children: jsx("div", Object.assign({
        className: "upload-image-select-tooltip-wrapper"
      }, {
        children: uploadNode
      }))
    }));
    if (!showUploadList && avatar.imageUrl && !showLoading) {
      return avatarUploadNode;
    }
    return jsx(Fragment, {
      children: uploadNode
    });
  };
  //渲染上传控件
  var renderUploadSelector = function renderUploadSelector() {
    return jsxs("div", Object.assign({
      className: clsx(['upload-image-select', restProps.disabled && 'upload-image-select-disabled', showLoading && 'upload-image-select-loading', isAvatar && 'is-avatar']),
      style: borderRadius ? {
        borderRadius: borderRadius
      } : {}
    }, {
      children: [jsx(RcUpload, Object.assign({}, overrideProps, {
        prefixCls: "".concat($rcPrefixCls, "-upload")
      }, {
        children: jsx("div", Object.assign({
          className: 'upload-image-picture-card'
        }, {
          children: renderUploadContent()
        }))
      })), errTip && jsx(ErrorTip, {
        message: uploadErrorMsg,
        className: "".concat($prefixCls, "-upload-error-image")
      })]
    }));
  };
  var handleReset = function handleReset() {
    handleRemove(uploadFileList[0]);
  };
  return jsxs("div", Object.assign({
    className: clsx("".concat($prefixCls, "-upload-image"), className),
    style: style
  }, {
    children: [renderUploadList(), !readonly ? showResetBtn && avatar.imageUrl ? jsxs("div", Object.assign({
      className: "upload-img-wrapper-container"
    }, {
      children: [jsx(Button, Object.assign({
        className: "upload-img-wrapper-container__del-btn",
        variant: "text",
        onClick: handleReset
      }, {
        children: jsx(CloseIcon, {})
      })), renderUploadSelector()]
    })) : renderUploadSelector() : jsx(Fragment, {})]
  }));
};

//Dragger upload
var Dragger = function Dragger(props) {
  return jsx(Upload, Object.assign({}, props, {
    type: 'drag'
  }));
};

var PREFIX = "".concat($prefixCls, "-img-crop");
var INIT_ZOOM = 1;
var ZOOM_STEP = 0.1;
var INIT_ROTATE = 0;
var ROTATE_STEP = 1;
var MIN_ROTATE = -180;
var MAX_ROTATE = 180;

var EasyCrop = /*#__PURE__*/forwardRef(function (props, ref) {
  var cropperRef = props.cropperRef,
    image = props.image,
    aspect = props.aspect,
    shape = props.shape,
    grid = props.grid,
    zoom = props.zoom,
    rotate = props.rotate,
    minZoom = props.minZoom,
    maxZoom = props.maxZoom,
    fixedCropSize = props.fixedCropSize,
    cropperProps = props.cropperProps;
  var _useState = useState({
      x: 0,
      y: 0
    }),
    _useState2 = _slicedToArray(_useState, 2),
    crop = _useState2[0],
    onCropChange = _useState2[1]; //裁剪变化
  var _useState3 = useState({
      width: 0,
      height: 0
    }),
    _useState4 = _slicedToArray(_useState3, 2),
    cropSize = _useState4[0],
    setCropSize = _useState4[1]; //裁剪大小
  var _useState5 = useState(INIT_ZOOM),
    _useState6 = _slicedToArray(_useState5, 2),
    zoomVal = _useState6[0],
    setZoomVal = _useState6[1]; //缩放值
  var _useState7 = useState(INIT_ROTATE),
    _useState8 = _slicedToArray(_useState7, 2),
    rotateVal = _useState8[0],
    setRotateVal = _useState8[1]; //旋转值
  var cropPixelsRef = useRef({
    width: 0,
    height: 0,
    x: 0,
    y: 0
  }); //裁剪区域
  //media 加载完成回调
  var onMediaLoaded = useCallback(function (mediaSize) {
    if (fixedCropSize) return;
    var width = mediaSize.width,
      height = mediaSize.height;
    var ratioWidth = height * aspect;
    if (width > ratioWidth) {
      setCropSize({
        width: ratioWidth,
        height: height
      });
    } else {
      setCropSize({
        width: width,
        height: width / aspect
      });
    }
  }, [aspect]);
  //裁剪完成回调
  var onCropComplete = useCallback(function (croppedArea, croppedAreaPixels) {
    cropPixelsRef.current = croppedAreaPixels;
  }, []);
  //ref 暴露方法
  useImperativeHandle(ref, function () {
    return {
      rotateVal: rotateVal,
      setZoomVal: setZoomVal,
      setRotateVal: setRotateVal,
      cropPixelsRef: cropPixelsRef
    };
  }, [rotateVal]);
  return jsxs(Fragment, {
    children: [jsx(Cropper, Object.assign({}, cropperProps, {
      ref: cropperRef,
      image: image,
      crop: crop,
      cropSize: !fixedCropSize ? cropSize : fixedCropSize,
      onCropChange: onCropChange,
      aspect: aspect,
      cropShape: shape,
      showGrid: grid,
      zoomWithScroll: zoom,
      zoom: zoomVal,
      rotation: rotateVal,
      onZoomChange: setZoomVal,
      onRotationChange: setRotateVal,
      minZoom: minZoom,
      maxZoom: maxZoom,
      onMediaLoaded: onMediaLoaded,
      onCropComplete: onCropComplete,
      classes: {
        containerClassName: "".concat(PREFIX, "-container"),
        mediaClassName: "".concat(PREFIX, "-media")
      }
    })), zoom && jsxs("section", Object.assign({
      className: "".concat(PREFIX, "-control ").concat(PREFIX, "-control-zoom")
    }, {
      children: [jsx("button", Object.assign({
        onClick: function onClick() {
          return setZoomVal(zoomVal - ZOOM_STEP);
        },
        disabled: zoomVal - ZOOM_STEP < minZoom
      }, {
        children: "\uFF0D"
      })), jsx(Slider, {
        min: minZoom,
        max: maxZoom,
        step: ZOOM_STEP,
        value: zoomVal,
        onChange: setZoomVal
      }), jsx("button", Object.assign({
        onClick: function onClick() {
          return setZoomVal(zoomVal + ZOOM_STEP);
        },
        disabled: zoomVal + ZOOM_STEP > maxZoom
      }, {
        children: "\uFF0B"
      }))]
    })), rotate && jsxs("section", Object.assign({
      className: "".concat(PREFIX, "-control ").concat(PREFIX, "-control-rotate")
    }, {
      children: [jsx("button", Object.assign({
        onClick: function onClick() {
          return setRotateVal(rotateVal - ROTATE_STEP);
        },
        disabled: rotateVal === MIN_ROTATE
      }, {
        children: "\u21BA"
      })), jsx(Slider, {
        min: MIN_ROTATE,
        max: MAX_ROTATE,
        step: ROTATE_STEP,
        value: rotateVal,
        onChange: setRotateVal
      }), jsx("button", Object.assign({
        onClick: function onClick() {
          return setRotateVal(rotateVal + ROTATE_STEP);
        },
        disabled: rotateVal === MAX_ROTATE
      }, {
        children: "\u21BB"
      }))]
    }))]
  });
});
var EasyCrop$1 = /*#__PURE__*/memo(EasyCrop);

var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/4/20 下午4:44\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-container {\n  position: relative;\n  width: 100%;\n  height: 40vh;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control {\n  display: flex;\n  align-items: center;\n  width: 60%;\n  margin-left: auto;\n  margin-right: auto;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control:first-of-type {\n  margin-top: 16px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control:last-of-type {\n  margin-bottom: -8px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control button {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  width: 34px;\n  height: 34px;\n  padding: 0;\n  font-style: normal;\n  background: transparent;\n  border: 0;\n  outline: 0;\n  cursor: pointer;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control button[disabled] {\n  cursor: default;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control button + div:only-of-type {\n  flex: 1;\n  margin: 0 8px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-zoom button {\n  font-size: 18px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-rotate button {\n  font-size: 16px;\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-rotate button:first-of-type {\n  transform: rotate(-20deg);\n}\n.paraui-v3-img-crop-modal .paraui-v3-img-crop-control-rotate button:last-of-type {\n  transform: rotate(20deg);\n}";
styleInject(css_248z$1);

//图片裁剪组件
var ImgCrop = /*#__PURE__*/forwardRef(function (props, ref) {
  var _props$aspect = props.aspect,
    aspect = _props$aspect === void 0 ? 1 : _props$aspect,
    _props$shape = props.shape,
    shape = _props$shape === void 0 ? 'rect' : _props$shape,
    _props$grid = props.grid,
    grid = _props$grid === void 0 ? false : _props$grid,
    _props$quality = props.quality,
    quality = _props$quality === void 0 ? 0.4 : _props$quality,
    _props$fillColor = props.fillColor,
    fillColor = _props$fillColor === void 0 ? 'transparent' : _props$fillColor,
    _props$zoom = props.zoom,
    zoom = _props$zoom === void 0 ? true : _props$zoom,
    _props$rotate = props.rotate,
    rotate = _props$rotate === void 0 ? false : _props$rotate,
    _props$minZoom = props.minZoom,
    minZoom = _props$minZoom === void 0 ? 1 : _props$minZoom,
    _props$maxZoom = props.maxZoom,
    maxZoom = _props$maxZoom === void 0 ? 3 : _props$maxZoom,
    modalTitle = props.modalTitle,
    modalWidth = props.modalWidth,
    modalOk = props.modalOk,
    modalCancel = props.modalCancel,
    onModalOk = props.onModalOk,
    onModalCancel = props.onModalCancel,
    beforeCrop = props.beforeCrop,
    onUploadFail = props.onUploadFail,
    cropperProps = props.cropperProps,
    children = props.children,
    _props$fixedCropSize = props.fixedCropSize,
    fixedCropSize = _props$fixedCropSize === void 0 ? {
      width: 120,
      height: 120
    } : _props$fixedCropSize;
  var intl = useFormatMessage('Upload', localeJson);
  var _useState = useState(''),
    _useState2 = _slicedToArray(_useState, 2),
    image = _useState2[0],
    setImage = _useState2[1];
  var fileRef = useRef();
  var beforeUploadRef = useRef();
  var resolveRef = useRef();
  var rejectRef = useRef();
  //存储回调
  var cbRef = useRef({});
  cbRef.current.onModalOk = onModalOk;
  cbRef.current.onModalCancel = onModalCancel;
  cbRef.current.beforeCrop = beforeCrop;
  cbRef.current.onUploadFail = onUploadFail;
  var easyCropRef = useRef({});
  //上传组件
  var uploadComponent = useMemo(function () {
    var upload = Array.isArray(children) ? children[0] : children;
    var _a = upload.props,
      beforeUpload = _a.beforeUpload,
      accept = _a.accept,
      restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
    beforeUploadRef.current = beforeUpload;
    return Object.assign(Object.assign({}, upload), {
      props: Object.assign(Object.assign({}, restUploadProps), {
        accept: accept || 'image/*',
        beforeUpload: function beforeUpload(file, fileList) {
          return new Promise(function (resolve, reject) {
            return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
              var reader;
              return regenerator.wrap(function _callee$(_context) {
                while (1) switch (_context.prev = _context.next) {
                  case 0:
                    _context.t0 = cbRef.current.beforeCrop;
                    if (!_context.t0) {
                      _context.next = 5;
                      break;
                    }
                    _context.next = 4;
                    return cbRef.current.beforeCrop(file, fileList);
                  case 4:
                    _context.t0 = !_context.sent;
                  case 5:
                    if (!_context.t0) {
                      _context.next = 8;
                      break;
                    }
                    reject();
                    return _context.abrupt("return");
                  case 8:
                    fileRef.current = file;
                    resolveRef.current = function (newFile) {
                      var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
                      var _a, _b;
                      (_b = (_a = cbRef.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, newFile);
                      if (!flag) return resolve({
                        cropFile: newFile,
                        isUpload: flag
                      });
                      resolve(newFile);
                    };
                    rejectRef.current = function (uploadErr) {
                      var _a, _b;
                      (_b = (_a = cbRef.current).onUploadFail) === null || _b === void 0 ? void 0 : _b.call(_a, uploadErr);
                      reject(uploadErr);
                    };
                    reader = new FileReader();
                    reader.addEventListener('load', function () {
                      return typeof reader.result === 'string' && setImage(reader.result);
                    });
                    reader.readAsDataURL(file);
                  case 14:
                  case "end":
                    return _context.stop();
                }
              }, _callee);
            }));
          });
        }
      })
    });
  }, [children]);
  //modal 关闭后操作
  var onClose = function onClose() {
    setImage('');
    easyCropRef.current.setZoomVal(INIT_ZOOM);
    easyCropRef.current.setRotateVal(INIT_ROTATE);
  };
  //modal cancel
  var onCancel = useCallback(function () {
    var _a, _b;
    (_b = (_a = cbRef.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a);
    onClose();
  }, []);
  //modal ok
  var onOk = useCallback(function () {
    return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee3() {
      var canvas, ctx, imgSource, _easyCropRef$current$, cropWidth, cropHeight, cropX, cropY, imgWidth, imgHeight, angle, sine, cosine, squareWidth, squareHeight, squareHalfWidth, squareHalfHeight, imgX, imgY, imgData, changeImageSizeAfterCrop, _fileRef$current, type, name, uid, idx, onBlob;
      return regenerator.wrap(function _callee3$(_context3) {
        while (1) switch (_context3.prev = _context3.next) {
          case 0:
            onClose();
            canvas = document.createElement('canvas');
            ctx = canvas.getContext('2d');
            imgSource = document.querySelector(".".concat(PREFIX, "-media"));
            _easyCropRef$current$ = easyCropRef.current.cropPixelsRef.current, cropWidth = _easyCropRef$current$.width, cropHeight = _easyCropRef$current$.height, cropX = _easyCropRef$current$.x, cropY = _easyCropRef$current$.y;
            if (rotate && easyCropRef.current.rotateVal !== INIT_ROTATE) {
              imgWidth = imgSource.naturalWidth, imgHeight = imgSource.naturalHeight;
              angle = easyCropRef.current.rotateVal * (Math.PI / 180); // get container for rotated image
              sine = Math.abs(Math.sin(angle));
              cosine = Math.abs(Math.cos(angle));
              squareWidth = imgWidth * cosine + imgHeight * sine;
              squareHeight = imgHeight * cosine + imgWidth * sine;
              canvas.width = squareWidth;
              canvas.height = squareHeight;
              ctx.fillStyle = fillColor;
              ctx.fillRect(0, 0, squareWidth, squareHeight);
              // rotate container
              squareHalfWidth = squareWidth / 2;
              squareHalfHeight = squareHeight / 2;
              ctx.translate(squareHalfWidth, squareHalfHeight);
              ctx.rotate(angle);
              ctx.translate(-squareHalfWidth, -squareHalfHeight);
              // draw rotated image
              imgX = (squareWidth - imgWidth) / 2;
              imgY = (squareHeight - imgHeight) / 2;
              ctx.drawImage(imgSource, 0, 0, imgWidth, imgHeight, imgX, imgY, imgWidth, imgHeight);
              // crop rotated image
              imgData = ctx.getImageData(0, 0, squareWidth, squareHeight);
              canvas.width = cropWidth;
              canvas.height = cropHeight;
              ctx.putImageData(imgData, -cropX, -cropY);
            } else {
              canvas.width = cropWidth;
              canvas.height = cropHeight;
              ctx.fillStyle = fillColor;
              ctx.fillRect(0, 0, cropWidth, cropHeight);
              ctx.drawImage(imgSource, cropX, cropY, cropWidth, cropHeight, 0, 0, cropWidth, cropHeight);
            }
            //裁剪之后改变图片大小
            changeImageSizeAfterCrop = function changeImageSizeAfterCrop(newFile) {
              return new Promise(function (resolve) {
                var name = newFile.name,
                  type = newFile.type,
                  uid = newFile.uid;
                var width = fixedCropSize.width,
                  height = fixedCropSize.height; //固定裁剪大小
                var changeCanvas = document.createElement('canvas');
                var changeCtx = changeCanvas.getContext('2d');
                var img = new Image();
                img.onload = function () {
                  changeCanvas.width = width;
                  changeCanvas.height = height;
                  changeCtx.drawImage(img, 0, 0, width, height);
                  changeCanvas.toBlob(function (cBlob) {
                    var changeFile = Object.assign(new File([cBlob], name, {
                      type: type
                    }), {
                      uid: uid
                    });
                    resolve(changeFile);
                  }, type, quality);
                };
                img.onerror = function () {
                  resolve(newFile);
                };
                var fileReader = new FileReader();
                fileReader.onload = function () {
                  img.src = fileReader.result;
                };
                fileReader.onerror = function () {
                  resolve(newFile);
                };
                fileReader.readAsDataURL(newFile);
              });
            }; // get the new image
            _fileRef$current = fileRef.current, type = _fileRef$current.type, name = _fileRef$current.name, uid = _fileRef$current.uid;
            if (/svg/ig.test(type)) {
              //svg 转为 png
              type = 'image/png';
              idx = name.lastIndexOf('.');
              if (idx > -1) name = name.substring(0, idx) + '.png';
            }
            //转为blob
            onBlob = function onBlob(blob) {
              return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee2() {
                var _a, _b, _c, _d, _e, _f, newFile, changeFile, res, passedFile;
                return regenerator.wrap(function _callee2$(_context2) {
                  while (1) switch (_context2.prev = _context2.next) {
                    case 0:
                      newFile = Object.assign(new File([blob], name, {
                        type: type
                      }), {
                        uid: uid
                      });
                      _context2.next = 3;
                      return changeImageSizeAfterCrop(newFile);
                    case 3:
                      changeFile = _context2.sent;
                      if (!(typeof beforeUploadRef.current !== 'function')) {
                        _context2.next = 6;
                        break;
                      }
                      return _context2.abrupt("return", (_a = resolveRef.current) === null || _a === void 0 ? void 0 : _a.call(resolveRef, changeFile));
                    case 6:
                      res = beforeUploadRef.current(changeFile, [changeFile]);
                      if (!(typeof res !== 'boolean' && !res)) {
                        _context2.next = 10;
                        break;
                      }
                      console.error('beforeUpload must return a boolean or Promise');
                      return _context2.abrupt("return");
                    case 10:
                      if (!(res === true)) {
                        _context2.next = 12;
                        break;
                      }
                      return _context2.abrupt("return", (_b = resolveRef.current) === null || _b === void 0 ? void 0 : _b.call(resolveRef, changeFile));
                    case 12:
                      if (!(res === false)) {
                        _context2.next = 14;
                        break;
                      }
                      return _context2.abrupt("return", (_c = resolveRef.current) === null || _c === void 0 ? void 0 : _c.call(resolveRef, changeFile, false));
                    case 14:
                      if (!(res && res instanceof Promise)) {
                        _context2.next = 27;
                        break;
                      }
                      _context2.prev = 15;
                      _context2.next = 18;
                      return res;
                    case 18:
                      passedFile = _context2.sent;
                      if (!(passedFile instanceof File || passedFile instanceof Blob)) {
                        _context2.next = 21;
                        break;
                      }
                      return _context2.abrupt("return", (_d = resolveRef.current) === null || _d === void 0 ? void 0 : _d.call(resolveRef, passedFile));
                    case 21:
                      (_e = resolveRef.current) === null || _e === void 0 ? void 0 : _e.call(resolveRef, changeFile, passedFile);
                      _context2.next = 27;
                      break;
                    case 24:
                      _context2.prev = 24;
                      _context2.t0 = _context2["catch"](15);
                      (_f = rejectRef.current) === null || _f === void 0 ? void 0 : _f.call(rejectRef, _context2.t0);
                    case 27:
                    case "end":
                      return _context2.stop();
                  }
                }, _callee2, null, [[15, 24]]);
              }));
            };
            canvas.toBlob(onBlob, type, quality);
          case 11:
          case "end":
            return _context3.stop();
        }
      }, _callee3);
    }));
  }, [fillColor, quality, rotate]);
  //img crop 组件
  var getComponent = function getComponent(titleOfModal) {
    return jsxs(Fragment, {
      children: [uploadComponent, image && jsx(Modal, Object.assign({
        open: true,
        className: "".concat(PREFIX, "-modal"),
        size: 'md',
        title: titleOfModal !== null && titleOfModal !== void 0 ? titleOfModal : intl({
          id: 'editImage'
        }),
        onOk: onOk,
        onCancel: onCancel,
        okText: modalOk,
        cancelText: modalCancel,
        contentWidth: modalWidth
      }, {
        children: jsx(EasyCrop$1, {
          ref: easyCropRef,
          cropperRef: ref,
          image: image,
          aspect: aspect,
          shape: shape,
          grid: grid,
          zoom: zoom,
          rotate: rotate,
          minZoom: minZoom,
          maxZoom: maxZoom,
          fixedCropSize: fixedCropSize,
          cropperProps: cropperProps
        })
      }))]
    });
  };
  return jsx(Fragment, {
    children: getComponent(modalTitle)
  });
});

var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午1:40\n* @description\n*/\n/**\n* @author Hanz\n* @date 2021/10/20 下午2:08\n* @description color\n*/\n.paraui-v3-upload .component-upload {\n  position: relative;\n  display: inline-block;\n}\n.paraui-v3-upload-loading {\n  pointer-events: none;\n}\n.paraui-v3-upload .paraui-v3-button {\n  color: rgb(54, 102, 214);\n  border-color: rgb(54, 102, 214);\n}\n.paraui-v3-upload .paraui-v3-button:hover {\n  border-color: rgba(54, 102, 214, 0.8);\n  color: rgba(54, 102, 214, 0.8);\n}\n.paraui-v3-upload .paraui-v3-button[disabled] {\n  color: rgba(46, 55, 67, 0.4);\n  border-color: rgba(171, 176, 185, 0.4);\n  background-color: rgba(171, 176, 185, 0.12);\n}\n.paraui-v3-upload .paraui-v3-button-loading .button-icon {\n  animation: uploadLoadingCircle 1s infinite linear;\n}\n.paraui-v3-upload-drag {\n  position: relative;\n}\n.paraui-v3-upload-drag .component-upload {\n  display: block;\n}\n.paraui-v3-upload-drag-loading {\n  pointer-events: none;\n}\n.paraui-v3-upload-drag-hover .upload-drag-container {\n  border-color: rgba(54, 102, 214, 0.4);\n  background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-upload-drag .upload-drag-container {\n  display: inline-flex;\n  width: 100%;\n  max-width: 960px;\n  height: 220px;\n  flex-direction: column;\n  justify-content: center;\n  align-items: center;\n  font-size: 14px;\n  line-height: 1;\n  border: 2px dashed rgba(171, 176, 185, 0.4);\n  background-color: rgba(171, 176, 185, 0.12);\n  border-radius: 4px;\n  cursor: pointer;\n  transition: 0.3s;\n}\n.paraui-v3-upload-drag .upload-drag-container:hover {\n  border-color: rgba(54, 102, 214, 0.4);\n  background-color: rgba(54, 102, 214, 0.05);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-icon {\n  line-height: 0;\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-icon svg {\n  font-size: 48px;\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-icon .upload-drag-loading {\n  animation: uploadLoadingCircle 1s infinite linear;\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-text {\n  margin: 20px 0 12px 0;\n  color: rgb(46, 55, 67);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-text-loading {\n  color: rgb(54, 102, 214);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-text-filename {\n  margin-right: 5px;\n  color: rgb(46, 55, 67);\n}\n.paraui-v3-upload-drag .upload-drag-container .upload-drag-hint {\n  color: rgba(46, 55, 67, 0.7);\n  padding: 0 20px;\n  text-align: center;\n}\n@keyframes uploadLoadingCircle {\n  100% {\n    transform: rotate(360deg);\n  }\n}";
styleInject(css_248z);

//upload
var InternalUpload = function InternalUpload(props) {
  var _props$type = props.type,
    type = _props$type === void 0 ? 'select' : _props$type,
    className = props.className,
    style = props.style,
    _onStart = props.onStart,
    _onSuccess = props.onSuccess,
    _onError = props.onError,
    _onProgress = props.onProgress,
    onRemove = props.onRemove,
    _beforeUpload = props.beforeUpload,
    onChange = props.onChange,
    onDrop = props.onDrop,
    _props$defaultFileLis = props.defaultFileList,
    defaultFileList = _props$defaultFileLis === void 0 ? [] : _props$defaultFileLis,
    fileList = props.fileList,
    _props$showUploadList = props.showUploadList,
    showUploadList = _props$showUploadList === void 0 ? true : _props$showUploadList,
    maxCount = props.maxCount,
    _props$children = props.children,
    children = _props$children === void 0 ? null : _props$children,
    itemRender = props.itemRender,
    _props$showUploadErro = props.showUploadError,
    showUploadError = _props$showUploadErro === void 0 ? true : _props$showUploadErro,
    _props$size = props.size,
    size = _props$size === void 0 ? 'large' : _props$size,
    _props$stash = props.stash,
    stash = _props$stash === void 0 ? false : _props$stash,
    _props$uploading = props.uploading,
    uploading = _props$uploading === void 0 ? true : _props$uploading,
    _props$showLoading = props.showLoading,
    showLoadingProp = _props$showLoading === void 0 ? true : _props$showLoading,
    _props$loading = props.loading,
    loading = _props$loading === void 0 ? false : _props$loading,
    dragArea = props.dragArea,
    disabledTooltip = props.disabledTooltip,
    restProps = __rest(props, ["type", "className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "onDrop", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "size", "stash", "uploading", "showLoading", "loading", "dragArea", "disabledTooltip"]);
  var intl = useFormatMessage('Upload', localeJson);
  var _useState = useState(defaultFileList),
    _useState2 = _slicedToArray(_useState, 2),
    uploadFileList = _useState2[0],
    setUploadFileList = _useState2[1]; //文件列表
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    showLoading = _useState4[0],
    setShowLoading = _useState4[1]; //upload loading
  var _useState5 = useState(false),
    _useState6 = _slicedToArray(_useState5, 2),
    errTip = _useState6[0],
    setErrTip = _useState6[1]; //upload error tip
  var _ref = typeof showUploadList === 'boolean' ? {} : showUploadList,
    showRemoveIcon = _ref.showRemoveIcon,
    removeIcon = _ref.removeIcon; //显示上传列表
  var _ref2 = typeof showUploadError === 'boolean' ? {} : showUploadError,
    _ref2$uploadErrorMsg = _ref2.uploadErrorMsg,
    uploadErrorMsg = _ref2$uploadErrorMsg === void 0 ? intl({
      id: 'uploadError'
    }) : _ref2$uploadErrorMsg,
    _ref2$leaveDelay = _ref2.leaveDelay,
    leaveDelay = _ref2$leaveDelay === void 0 ? 3000 : _ref2$leaveDelay; //错误信息提示
  var _useState7 = useState('drop'),
    _useState8 = _slicedToArray(_useState7, 2),
    dragState = _useState8[0],
    setDragState = _useState8[1]; //拖拽状态
  var curFileRef = useRef(); //正上传文件
  var recordNonAcceptFileRef = useRef(); //记录非accept推荐文件
  //复写属性
  var overrideProps = Object.assign(Object.assign({}, restProps), {
    beforeUpload: function beforeUpload(file, fileList) {
      if (restProps.action && showLoadingProp && uploading) {
        setShowLoading(true);
        curFileRef.current = file;
      }
      var val = _beforeUpload === null || _beforeUpload === void 0 ? void 0 : _beforeUpload(file, fileList);
      if (val === false) {
        setShowLoading(false);
        curFileRef.current = null;
        return false;
      } else if (val instanceof Promise) return val;else return true;
    },
    onStart: function onStart(file) {
      _onStart === null || _onStart === void 0 ? void 0 : _onStart(file);
    },
    onSuccess: function onSuccess(response, file, xhr) {
      setShowLoading(false);
      curFileRef.current = null;
      errTip && showErrTip(false);
      var nextFileList = updateFileList(file);
      onInternalChange(nextFileList);
      _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess(response, file, xhr);
    },
    onError: function onError(error, response, file) {
      setShowLoading(false);
      curFileRef.current = null;
      showErrTip(!!showUploadError);
      _onError === null || _onError === void 0 ? void 0 : _onError(error, response, file);
    },
    onProgress: function onProgress(e, file) {
      _onProgress === null || _onProgress === void 0 ? void 0 : _onProgress(e, file);
    },
    onBatchStart: function onBatchStart(fileList) {
      if (stash) {
        var arr = fileList.map(function (_) {
          return _.file;
        });
        if (type === 'drag' && restProps.accept && recordNonAcceptFileRef.current) {
          arr.push(recordNonAcceptFileRef.current);
          recordNonAcceptFileRef.current = null;
        }
        var mList = mergedFileList(arr);
        onInternalChange(mList);
      }
    }
  });
  //内部变化
  var onInternalChange = function onInternalChange(changedFileList) {
    var cloneList = _toConsumableArray(changedFileList);
    // Cut to match count
    if (maxCount === 1) {
      cloneList = cloneList.slice(-1);
    } else if (maxCount) {
      cloneList = cloneList.slice(0, maxCount);
    }
    onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
    setUploadFileList(cloneList);
  };
  //更新文件列表
  var updateFileList = function updateFileList(file) {
    var cloneList = _toConsumableArray(uploadFileList);
    var fileObj = Object.assign(Object.assign({}, file), {
      lastModified: file.lastModified,
      lastModifiedDate: file.lastModifiedDate,
      name: file.name,
      size: file.size,
      type: file.type,
      uid: file.uid,
      originFileObj: file
    });
    return cloneList.concat(fileObj);
  };
  //合并文件列表
  var mergedFileList = function mergedFileList(fileList) {
    var cloneList = _toConsumableArray(uploadFileList);
    var newFileList = fileList.map(function (file) {
      return Object.assign(Object.assign({}, file), {
        lastModified: file.lastModified,
        lastModifiedDate: file.lastModifiedDate,
        name: file.name,
        size: file.size,
        type: file.type,
        uid: file.uid || "rc-upload-".concat(Date.now()),
        originFileObj: file
      });
    });
    return cloneList.concat(newFileList);
  };
  //删除文件
  var handleRemove = function handleRemove(file) {
    Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(function (ret) {
      // Prevent removing file
      if (ret === false) return;
      var idx = uploadFileList.findIndex(function (_) {
        return _.uid === file.uid;
      });
      if (idx > -1) uploadFileList.splice(idx, 1);
      onInternalChange(uploadFileList);
    });
  };
  //拖拽区域
  var onFileDrop = function onFileDrop(e) {
    var _a, _b;
    e.preventDefault();
    e.stopPropagation();
    setDragState(e.type);
    if (e.type === 'drop') {
      onDrop === null || onDrop === void 0 ? void 0 : onDrop(e);
      //拖拽且设置accept
      if (type === 'drag' && restProps.accept) {
        var dropFile = (_b = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
        if (dropFile) {
          var reg = new RegExp(restProps.accept, 'ig');
          if (!reg.test(dropFile.type)) {
            recordNonAcceptFileRef.current = dropFile;
          }
        }
      }
    }
  };
  //显示错误提示
  var showErrTip = function showErrTip(flag) {
    setErrTip(flag);
    if (leaveDelay < 0) return;
    setTimeout(function () {
      setErrTip(false);
    }, leaveDelay);
  };
  useEffect(function () {
    if (fileList) {
      setUploadFileList(_toConsumableArray(fileList));
    }
  }, [fileList]);
  useEffect(function () {
    setShowLoading(loading);
  }, [loading]);
  //渲染上传列表
  var renderUploadList = function renderUploadList() {
    return showUploadList && jsx(UploadList, {
      listType: 'text',
      items: uploadFileList,
      showRemoveIcon: showRemoveIcon,
      removeIcon: removeIcon,
      onRemove: handleRemove,
      itemRender: itemRender
    });
  };
  //渲染上传按钮
  var renderButton = function renderButton() {
    var icon = jsx(UploadIcon, {});
    var text = children;
    if (showLoading) {
      icon = jsx(LoadingIcon, {});
      text = intl({
        id: 'uploading'
      });
    }
    return jsx(Button, Object.assign({
      variant: 'outlined',
      size: size,
      startIcon: icon,
      toolTipTitle: (disabledTooltip === null || disabledTooltip === void 0 ? void 0 : disabledTooltip.title) || '',
      TooltipProps: disabledTooltip,
      disabled: restProps.disabled,
      className: clsx(showLoading && "".concat($prefixCls, "-button-loading"))
    }, {
      children: text
    }));
  };
  //渲染拖拽区域
  var renderDragArea = function renderDragArea() {
    var _a;
    var icon = jsx(UploadIcon, {});
    var text = intl({
      id: 'clickUploadFile'
    });
    var hint = intl({
      id: 'dragFileUpload'
    });
    var _ref3 = dragArea !== null && dragArea !== void 0 ? dragArea : {},
      _ref3$areaIcon = _ref3.areaIcon,
      areaIcon = _ref3$areaIcon === void 0 ? icon : _ref3$areaIcon,
      _ref3$areaText = _ref3.areaText,
      areaText = _ref3$areaText === void 0 ? text : _ref3$areaText,
      _ref3$areaDesc = _ref3.areaDesc,
      areaDesc = _ref3$areaDesc === void 0 ? hint : _ref3$areaDesc;
    if (showLoading) {
      areaIcon = jsx(LoadingIcon, {
        className: 'upload-drag-loading'
      });
      areaText = jsxs("span", Object.assign({
        className: 'upload-drag-text-loading'
      }, {
        children: [jsx("span", Object.assign({
          className: 'upload-drag-text-filename'
        }, {
          children: (_a = curFileRef.current) === null || _a === void 0 ? void 0 : _a.name
        })), intl({
          id: 'uploading'
        }), "..."]
      }));
    }
    return jsx("div", Object.assign({
      className: 'upload-drag-container'
    }, {
      children: children ? children : jsxs(Fragment, {
        children: [jsx("p", Object.assign({
          className: 'upload-drag-icon'
        }, {
          children: areaIcon
        })), jsx("p", Object.assign({
          className: 'upload-drag-text'
        }, {
          children: areaText
        })), !showLoading && jsx("p", Object.assign({
          className: 'upload-drag-hint'
        }, {
          children: areaDesc
        }))]
      })
    }));
  };
  //拖拽上传
  if (type === 'drag') {
    var _clsx;
    var dragCls = clsx("".concat($prefixCls, "-upload-drag"), className, (_clsx = {}, _defineProperty(_clsx, "".concat($prefixCls, "-upload-drag-loading"), showLoading), _defineProperty(_clsx, "".concat($prefixCls, "-upload-drag-hover"), dragState === 'dragover'), _clsx));
    return jsxs("div", Object.assign({
      className: dragCls,
      onDrop: onFileDrop,
      onDragOver: onFileDrop,
      onDragLeave: onFileDrop
    }, {
      children: [jsx(RcUpload, Object.assign({}, overrideProps, {
        prefixCls: "".concat($rcPrefixCls, "-upload")
      }, {
        children: renderDragArea()
      })), renderUploadList(), errTip && jsx(ErrorTip, {
        message: uploadErrorMsg,
        className: "".concat($prefixCls, "-upload-error-drag")
      })]
    }));
  }
  var makeCls = clsx("".concat($prefixCls, "-upload"), className, showLoading && "".concat($prefixCls, "-upload-loading"));
  return jsxs("div", Object.assign({
    className: makeCls,
    style: style
  }, {
    children: [jsxs(RcUpload, Object.assign({}, overrideProps, {
      prefixCls: "".concat($rcPrefixCls, "-upload")
    }, {
      children: [renderButton(), errTip && jsx(ErrorTip, {
        message: uploadErrorMsg
      })]
    })), renderUploadList()]
  }));
};
var Upload = InternalUpload;
Upload.ImageUpload = ImageUpload;
Upload.Dragger = Dragger;
Upload.ImgCrop = ImgCrop;

export { Upload as default };
