"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _vtxFullScreenBaseModal = _interopRequireDefault(require("../vtx-full-screen-base-modal"));

var _antd = require("antd");

var _useSettings2 = _interopRequireDefault(require("../vm-hooks/useSettings"));

var _vtxBaseModal = _interopRequireDefault(require("../vtx-base-modal"));

var _excluded = ["tabs", "onCancel", "title", "children", "subtitle"];

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

function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var VmGasModal = function VmGasModal(_ref) {
  var _ref$tabs = _ref.tabs,
      tabs = _ref$tabs === void 0 ? [] : _ref$tabs,
      onCancel = _ref.onCancel,
      title = _ref.title,
      children = _ref.children,
      _ref$subtitle = _ref.subtitle,
      subtitle = _ref$subtitle === void 0 ? '查看' : _ref$subtitle,
      resetProps = _objectWithoutProperties(_ref, _excluded);

  var _useSettings = (0, _useSettings2["default"])(),
      theme = _useSettings.theme;

  var newTabs = [];
  var contents = [];
  tabs.forEach(function (_ref2) {
    var key = _ref2.key,
        value = _ref2.value,
        content = _ref2.content;
    newTabs.push({
      key: key,
      value: value
    });
    contents.push({
      key: key,
      content: content
    });
  });

  if (theme === 'dark') {
    return /*#__PURE__*/_react["default"].createElement(_vtxBaseModal["default"], _extends({
      title: title,
      subTitle: subtitle,
      tabs: newTabs,
      contents: contents,
      onCancel: onCancel
    }, resetProps));
  }

  return /*#__PURE__*/_react["default"].createElement(_vtxFullScreenBaseModal["default"], _extends({
    title: /*#__PURE__*/_react["default"].createElement(_vtxFullScreenBaseModal["default"].Title, {
      text: title,
      subtitle: subtitle
    })
  }, resetProps, {
    onCancel: onCancel,
    width: _vtxFullScreenBaseModal["default"].size.large,
    tabs: tabs,
    footer: [/*#__PURE__*/_react["default"].createElement(_antd.Button, {
      key: "cancel",
      onClick: onCancel
    }, "\u5173\u95ED")]
  }), children);
};

VmGasModal.propTypes = {
  tabs: _propTypes["default"].array,
  title: _propTypes["default"].string,
  children: _propTypes["default"].node,
  subtitle: _propTypes["default"].element,
  onCancel: _propTypes["default"].func.isRequired
};
var _default = VmGasModal;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
