'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var formik = require('formik');
var ramda = require('ramda');
var MultiEmailInput = require('../MultiEmailInput.js');
var jsxRuntime = require('react/jsx-runtime');
require('@babel/runtime/helpers/toConsumableArray');
require('classnames');
require('../react-select-creatable.esm-CYabSQvs.js');
require('@babel/runtime/helpers/esm/extends');
require('@babel/runtime/helpers/esm/objectSpread2');
require('@babel/runtime/helpers/esm/classCallCheck');
require('@babel/runtime/helpers/esm/createClass');
require('@babel/runtime/helpers/esm/inherits');
require('@babel/runtime/helpers/esm/createSuper');
require('@babel/runtime/helpers/esm/toConsumableArray');
require('@babel/runtime/helpers/extends');
require('@babel/runtime/helpers/esm/taggedTemplateLiteral');
require('@babel/runtime/helpers/esm/objectWithoutProperties');
require('@babel/runtime/helpers/esm/slicedToArray');
require('@babel/runtime/helpers/esm/typeof');
require('@babel/runtime/helpers/esm/defineProperty');
require('react-dom');
require('@babel/runtime/helpers/objectSpread2');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('@babel/runtime/helpers/inherits');
require('@babel/runtime/helpers/createSuper');
require('@babel/runtime/helpers/taggedTemplateLiteral');
require('@babel/runtime/helpers/typeof');
require('../index-CNZKW5X0.js');
require('@bigbinary/neeto-cist');
require('qs');
require('../en-B1i-pQJm.js');
require('../index-BgzkP01c.js');
require('dayjs');
require('dayjs/plugin/localeData');
require('dayjs/plugin/utc');
require('dayjs/plugin/weekday');
require('dayjs/plugin/weekOfYear');
require('i18next');
require('@babel/runtime/helpers/toArray');
require('@bigbinary/neeto-icons/Close');
require('../Tag.js');
require('../Label.js');
require('@bigbinary/neeto-icons/Help');
require('../Button.js');
require('react-router-dom');
require('../Spinner.js');
require('../Tooltip.js');
require('@tippyjs/react');
require('tippy.js');
require('@bigbinary/neeto-hotkeys');
require('../overlayManager.js');
require('../usePrefersReducedMotion-D2Ck84HM.js');
require('../Popover.js');
require('../Typography.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);

var _excluded = ["name"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var FormikMultiEmailInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var name = _ref.name,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  var _useField = formik.useField(name),
    _useField2 = _slicedToArray__default.default(_useField, 3),
    field = _useField2[0],
    meta = _useField2[1],
    _useField2$ = _useField2[2],
    setValue = _useField2$.setValue,
    setTouched = _useField2$.setTouched;
  var _useFormikContext = formik.useFormikContext(),
    _useFormikContext$sta = _useFormikContext.status,
    status = _useFormikContext$sta === void 0 ? {} : _useFormikContext$sta,
    setStatus = _useFormikContext.setStatus;
  var fieldStatus = formik.getIn(status, name);
  return /*#__PURE__*/jsxRuntime.jsx(MultiEmailInput, _objectSpread({
    ref: ref,
    error: meta.touched ? meta.error || fieldStatus : "",
    name: field.name,
    value: field.value,
    onBlur: function onBlur() {
      return setTouched(true);
    },
    onChange: function onChange(value) {
      setStatus(ramda.dissoc(name, status));
      setValue(value);
    }
  }, otherProps));
});
FormikMultiEmailInput.displayName = "FormikMultiEmailInput";

module.exports = FormikMultiEmailInput;
//# sourceMappingURL=MultiEmailInput.js.map
