import _Select from "@alifd/next/es/select";
import React, { useEffect, useMemo, useState } from 'react';
import BoxSlotComponent from "../../_components/boxSlotComponent";
import { t } from "../../../../src/locale";
import { WalletEnvType } from "../type";
export var ChangeWalletEnvComponent = function ChangeWalletEnvComponent(props) {
  var value = props.value,
    onChange = props.onChange;
  var _useState = useState(value === null || value === void 0 ? void 0 : value.type),
    env = _useState[0],
    setEnv = _useState[1];
  useEffect(function () {
    if (env) {
      onChange({
        type: env
      });
    }
  }, [env]);
  var repeatTimesList = useMemo(function () {
    return [{
      label: t('setter.walletEmailEnvType'),
      value: WalletEnvType.noWallet
    }, {
      label: t('setter.walletWEnvType'),
      value: WalletEnvType.wallet
    }];
  }, []);
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BoxSlotComponent, {
    title: t('setter.walletEnvSelect')
  }, /*#__PURE__*/React.createElement(_Select, {
    placeholder: t('setter.selectPlaceHolder'),
    notFoundContent: t('setter.notFoundContent'),
    showSearch: true,
    value: env,
    dataSource: repeatTimesList,
    onChange: function onChange(v) {
      setEnv(v);
    }
  })));
};