"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ChangeWalletEnvComponent = void 0;
var _select = _interopRequireDefault(require("@alifd/next/lib/select"));
var _react = _interopRequireWildcard(require("react"));
var _boxSlotComponent = _interopRequireDefault(require("../../_components/boxSlotComponent"));
var _locale = require("../../../../src/locale");
var _type = require("../type");
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
var ChangeWalletEnvComponent = exports.ChangeWalletEnvComponent = function ChangeWalletEnvComponent(props) {
  var value = props.value,
    onChange = props.onChange;
  var _useState = (0, _react.useState)(value === null || value === void 0 ? void 0 : value.type),
    env = _useState[0],
    setEnv = _useState[1];
  (0, _react.useEffect)(function () {
    if (env) {
      onChange({
        type: env
      });
    }
  }, [env]);
  var repeatTimesList = (0, _react.useMemo)(function () {
    return [{
      label: (0, _locale.t)('setter.walletEmailEnvType'),
      value: _type.WalletEnvType.noWallet
    }, {
      label: (0, _locale.t)('setter.walletWEnvType'),
      value: _type.WalletEnvType.wallet
    }];
  }, []);
  return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_boxSlotComponent["default"], {
    title: (0, _locale.t)('setter.walletEnvSelect')
  }, /*#__PURE__*/_react["default"].createElement(_select["default"], {
    placeholder: (0, _locale.t)('setter.selectPlaceHolder'),
    notFoundContent: (0, _locale.t)('setter.notFoundContent'),
    showSearch: true,
    value: env,
    dataSource: repeatTimesList,
    onChange: function onChange(v) {
      setEnv(v);
    }
  })));
};