"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

require("antd-mobile/es/toast/style");

var _toast = _interopRequireDefault(require("antd-mobile/es/toast"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var _default = function _default(_ref) {
  var _ref$icon = _ref.icon,
      icon = _ref$icon === void 0 ? 'success' : _ref$icon,
      title = _ref.title,
      duration = _ref.duration,
      _ref$mask = _ref.mask,
      mask = _ref$mask === void 0 ? false : _ref$mask;
  return new Promise(function (resolve) {
    if (icon === 'none') {
      _toast.default.show(title, duration, mask);

      setTimeout(resolve, duration);
    } else {
      _toast.default.success(title, duration, function () {
        return resolve('');
      }, mask);
    }
  });
};

exports.default = _default;