"use strict";

exports.__esModule = true;
exports.useCreateViews = useCreateViews;
exports.useViews = void 0;
var _react = require("react");
var _state = require("../state");
var _react2 = require("@wix/bex-core/react");
var _presetsToCategories = require("../state/presetsToCategories");
function useCreateViews() {
  const container = (0, _react2.useWixPatternsContainer)();
  return (0, _react.useCallback)(config => {
    const {
      namespace,
      presets,
      initialSelect,
      fqdn,
      allItemsViewProps
    } = config;
    return new _state.ViewsState({
      oldNamespace: namespace,
      presets: (0, _presetsToCategories.presetsToCategories)(presets),
      container,
      initialSelect,
      fqdn,
      allItemsViewProps,
      reportBI: () => {}
    });
  }, []);
}
const useViews = config => {
  const createViews = useCreateViews();
  const [state] = (0, _react.useState)(() => createViews(config));
  return state;
};
exports.useViews = useViews;
//# sourceMappingURL=useViews.js.map