import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
import { forwardRef } from 'react';
import { useField, useFormikContext, getIn } from 'formik';
import { dissoc } from 'ramda';
import TreeSelect from '../TreeSelect.js';
import { jsx } from 'react/jsx-runtime';
import 'antd/lib/config-provider';
import 'antd/lib/tree-select';
import 'classnames';
import '@bigbinary/neeto-icons/Down';
import 'react-i18next';
import '../index-QWVp_Xt6.js';
import '@babel/runtime/helpers/classCallCheck';
import '@babel/runtime/helpers/createClass';
import '@bigbinary/neeto-cist';
import 'qs';
import '../en-Dmu3B4Vs.js';
import '../index-DyUNP5G9.js';
import '@babel/runtime/helpers/toConsumableArray';
import 'dayjs';
import 'dayjs/plugin/localeData';
import 'dayjs/plugin/utc';
import 'dayjs/plugin/weekday';
import 'dayjs/plugin/weekOfYear';
import 'i18next';
import '../constants.js';
import 'antd/locale/de_DE';
import 'antd/locale/en_US';
import 'antd/locale/es_ES';
import 'antd/locale/fr_FR';
import 'antd/locale/nl_NL';
import 'antd/locale/pl_PL';
import 'antd/locale/pt_PT';
import '../Label.js';
import '@bigbinary/neeto-icons/Help';
import '../Button.js';
import 'react-router-dom';
import '../Spinner.js';
import '../Tooltip.js';
import '@tippyjs/react';
import 'tippy.js';
import '@bigbinary/neeto-hotkeys';
import '../overlayManager.js';
import '../usePrefersReducedMotion-n4ZJtExQ.js';
import '../Popover.js';
import '../Typography.js';

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(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 FormikTreeSelect = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var name = _ref.name,
    otherProps = _objectWithoutProperties(_ref, _excluded);
  var _useField = useField(name),
    _useField2 = _slicedToArray(_useField, 3),
    field = _useField2[0],
    meta = _useField2[1],
    _useField2$ = _useField2[2],
    setValue = _useField2$.setValue,
    setTouched = _useField2$.setTouched;
  var _useFormikContext = useFormikContext(),
    _useFormikContext$sta = _useFormikContext.status,
    status = _useFormikContext$sta === void 0 ? {} : _useFormikContext$sta,
    setStatus = _useFormikContext.setStatus;
  var fieldStatus = getIn(status, name);
  return /*#__PURE__*/jsx(TreeSelect, _objectSpread({
    ref: ref,
    error: meta.error || fieldStatus || "",
    name: field.name,
    value: field.value,
    onBlur: function onBlur() {
      return setTouched(true);
    },
    onChange: function onChange(value) {
      setStatus(dissoc(name, status));
      setValue(value);
    }
  }, otherProps));
});
FormikTreeSelect.displayName = "TreeSelect";

export { FormikTreeSelect as default };
//# sourceMappingURL=TreeSelect.js.map
