import _defineProperty from "@babel/runtime/helpers/defineProperty";
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), !0).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; }
import React from "react";
import * as Widgets from "../components/widgets";
import * as CustomOperators from "../components/operators";
import { CoreConfig, Utils } from "@react-awesome-query-builder/core";

//----------------------------  conjunctions

var conjunctions = _objectSpread({}, CoreConfig.conjunctions);

//----------------------------  operators

var operators = _objectSpread(_objectSpread({}, CoreConfig.operators), {}, {
  proximity: _objectSpread(_objectSpread({}, CoreConfig.operators.proximity), {}, {
    options: _objectSpread(_objectSpread({}, CoreConfig.operators.proximity.options), {}, {
      factory: function factory(props, _ref) {
        var RCE = _ref.RCE,
          ProximityOperator = _ref.O.ProximityOperator;
        return RCE(ProximityOperator, props);
      }
    })
  })
});

//----------------------------  widgets

var widgets = {
  text: _objectSpread(_objectSpread({}, CoreConfig.widgets.text), {}, {
    factory: function factory(props, _ref2) {
      var RCE = _ref2.RCE,
        VanillaTextWidget = _ref2.W.VanillaTextWidget;
      return RCE(VanillaTextWidget, props);
    }
  }),
  textarea: _objectSpread(_objectSpread({}, CoreConfig.widgets.textarea), {}, {
    factory: function factory(props, _ref3) {
      var RCE = _ref3.RCE,
        VanillaTextAreaWidget = _ref3.W.VanillaTextAreaWidget;
      return RCE(VanillaTextAreaWidget, props);
    }
  }),
  number: _objectSpread(_objectSpread({}, CoreConfig.widgets.number), {}, {
    factory: function factory(props, _ref4) {
      var RCE = _ref4.RCE,
        VanillaNumberWidget = _ref4.W.VanillaNumberWidget;
      return RCE(VanillaNumberWidget, props);
    }
  }),
  slider: _objectSpread(_objectSpread({}, CoreConfig.widgets.slider), {}, {
    factory: function factory(props, _ref5) {
      var RCE = _ref5.RCE,
        VanillaSliderWidget = _ref5.W.VanillaSliderWidget;
      return RCE(VanillaSliderWidget, props);
    }
  }),
  select: _objectSpread(_objectSpread({}, CoreConfig.widgets.select), {}, {
    factory: function factory(props, _ref6) {
      var RCE = _ref6.RCE,
        VanillaSelectWidget = _ref6.W.VanillaSelectWidget;
      return RCE(VanillaSelectWidget, props);
    }
  }),
  multiselect: _objectSpread(_objectSpread({}, CoreConfig.widgets.multiselect), {}, {
    factory: function factory(props, _ref7) {
      var RCE = _ref7.RCE,
        VanillaMultiSelectWidget = _ref7.W.VanillaMultiSelectWidget;
      return RCE(VanillaMultiSelectWidget, props);
    }
  }),
  date: _objectSpread(_objectSpread({}, CoreConfig.widgets.date), {}, {
    factory: function factory(props, _ref8) {
      var RCE = _ref8.RCE,
        VanillaDateWidget = _ref8.W.VanillaDateWidget;
      return RCE(VanillaDateWidget, props);
    }
  }),
  time: _objectSpread(_objectSpread({}, CoreConfig.widgets.time), {}, {
    factory: function factory(props, _ref9) {
      var RCE = _ref9.RCE,
        VanillaTimeWidget = _ref9.W.VanillaTimeWidget;
      return RCE(VanillaTimeWidget, props);
    }
  }),
  datetime: _objectSpread(_objectSpread({}, CoreConfig.widgets.datetime), {}, {
    factory: function factory(props, _ref10) {
      var RCE = _ref10.RCE,
        VanillaDateTimeWidget = _ref10.W.VanillaDateTimeWidget;
      return RCE(VanillaDateTimeWidget, props);
    }
  }),
  "boolean": _objectSpread(_objectSpread({}, CoreConfig.widgets["boolean"]), {}, {
    factory: function factory(props, _ref11) {
      var RCE = _ref11.RCE,
        VanillaBooleanWidget = _ref11.W.VanillaBooleanWidget;
      return RCE(VanillaBooleanWidget, props);
    }
  }),
  field: _objectSpread(_objectSpread({}, CoreConfig.widgets.field), {}, {
    factory: function factory(props, _ref12) {
      var RCE = _ref12.RCE,
        ValueFieldWidget = _ref12.W.ValueFieldWidget;
      return RCE(ValueFieldWidget, props);
    },
    customProps: {
      showSearch: true
    }
  }),
  func: _objectSpread(_objectSpread({}, CoreConfig.widgets.func), {}, {
    factory: function factory(props, _ref13) {
      var RCE = _ref13.RCE,
        FuncWidget = _ref13.W.FuncWidget;
      return RCE(FuncWidget, props);
    },
    customProps: {
      //showSearch: true
    }
  }),
  /**
   * @deprecated
   */
  case_value: _objectSpread(_objectSpread({}, CoreConfig.widgets.case_value), {}, {
    // simple text value
    factory: function factory(props, _ref14) {
      var RCE = _ref14.RCE,
        VanillaTextWidget = _ref14.W.VanillaTextWidget;
      return RCE(VanillaTextWidget, props);
    }
  })
};

//----------------------------  types

var types = _objectSpread(_objectSpread({}, CoreConfig.types), {}, {
  select: _objectSpread(_objectSpread({}, CoreConfig.types.select), {}, {
    widgets: _objectSpread(_objectSpread({}, CoreConfig.types.select.widgets), {}, {
      select: _objectSpread(_objectSpread({}, CoreConfig.types.select.widgets.select), {}, {
        widgetProps: {
          customProps: {
            showSearch: true
          }
        }
      })
    })
  })
});

//----------------------------  settings

var settings = _objectSpread(_objectSpread({}, CoreConfig.settings), {}, {
  renderField: function renderField(props, _ref15) {
    var RCE = _ref15.RCE,
      VanillaFieldSelect = _ref15.W.VanillaFieldSelect;
    return RCE(VanillaFieldSelect, props);
  },
  renderOperator: function renderOperator(props, _ref16) {
    var RCE = _ref16.RCE,
      VanillaFieldSelect = _ref16.W.VanillaFieldSelect;
    return RCE(VanillaFieldSelect, props);
  },
  renderFunc: function renderFunc(props, _ref17) {
    var RCE = _ref17.RCE,
      VanillaFieldSelect = _ref17.W.VanillaFieldSelect;
    return RCE(VanillaFieldSelect, props);
  },
  renderConjs: function renderConjs(props, _ref18) {
    var RCE = _ref18.RCE,
      VanillaConjs = _ref18.W.VanillaConjs;
    return RCE(VanillaConjs, props);
  },
  renderSwitch: function renderSwitch(props, _ref19) {
    var RCE = _ref19.RCE,
      VanillaSwitch = _ref19.W.VanillaSwitch;
    return RCE(VanillaSwitch, props);
  },
  renderButton: function renderButton(props, _ref20) {
    var RCE = _ref20.RCE,
      VanillaButton = _ref20.W.VanillaButton;
    return RCE(VanillaButton, props);
  },
  renderIcon: function renderIcon(props, _ref21) {
    var RCE = _ref21.RCE,
      VanillaIcon = _ref21.W.VanillaIcon;
    return RCE(VanillaIcon, props);
  },
  renderButtonGroup: function renderButtonGroup(props, _ref22) {
    var RCE = _ref22.RCE,
      VanillaButtonGroup = _ref22.W.VanillaButtonGroup;
    return RCE(VanillaButtonGroup, props);
  },
  renderProvider: function renderProvider(props, _ref23) {
    var RCE = _ref23.RCE,
      VanillaProvider = _ref23.W.VanillaProvider;
    return RCE(VanillaProvider, props);
  },
  renderValueSources: function renderValueSources(props, _ref24) {
    var RCE = _ref24.RCE,
      VanillaValueSources = _ref24.W.VanillaValueSources;
    return RCE(VanillaValueSources, props);
  },
  renderFieldSources: function renderFieldSources(props, _ref25) {
    var RCE = _ref25.RCE,
      VanillaValueSources = _ref25.W.VanillaValueSources;
    return RCE(VanillaValueSources, props);
  },
  renderConfirm: function renderConfirm(props, _ref26) {
    var vanillaConfirm = _ref26.W.vanillaConfirm;
    return vanillaConfirm(props);
  },
  renderSwitchPrefix: "IF",
  renderBeforeCaseValue: function renderBeforeCaseValue(props, _ref27) {
    var RCE = _ref27.RCE;
    return RCE("span", {
      children: [" then "]
    });
  },
  customFieldSelectProps: {
    showSearch: true
  },
  customOperatorSelectProps: {
    // showSearch: false
  },
  defaultSliderWidth: "200px",
  defaultSelectWidth: "200px",
  defaultSearchWidth: "100px",
  defaultMaxRows: 5,
  renderSize: "small",
  maxLabelsLength: 100,
  showLock: false,
  showNot: true,
  forceShowConj: false,
  groupActionsPosition: "topRight" // oneOf [topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight]
});

//----------------------------

var ctx = _objectSpread(_objectSpread({}, CoreConfig.ctx), {}, {
  W: _objectSpread({}, Widgets),
  O: _objectSpread({}, CustomOperators),
  RCE: function RCE(C, P) {
    return /*#__PURE__*/React.createElement(C, P);
  }
});

//----------------------------

var config = {
  conjunctions: conjunctions,
  operators: operators,
  widgets: widgets,
  types: types,
  settings: settings,
  ctx: ctx
};
config = Utils.ConfigMixins.removeMixins(config, ["rangeslider", "treeselect", "treemultiselect"]);
export default config;