import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
import produce from 'immer';
import { flow } from 'lodash';
import * as autocomplete from './autocomplete';
import * as formGroupList from './formGroupList';
import * as showCharacterCounter from './showCharacterCounter';
import * as selectAutocomplete from './selectAutocomplete'; // Order of plugins

var typePlugins = [autocomplete, selectAutocomplete, showCharacterCounter, formGroupList];
export default (function (props) {
  var _props$extraTypePlugi = props.extraTypePlugins,
      extraTypePlugins = _props$extraTypePlugi === void 0 ? [] : _props$extraTypePlugi,
      config = props.config; // Run plugins in the given order

  return flow([].concat(typePlugins, _toConsumableArray(extraTypePlugins)) // Plugin type must match with the config type
  .filter(function (_ref) {
    var types = _ref.types;
    return types.includes(config.type);
  }).map(function (_ref2) {
    var _ref3, _props;

    var converter = _ref2.converter;
    return _ref3 = (_props = props, converter(_props)), produce(_ref3);
  }));
});
//# sourceMappingURL=index.js.map