Liferay.Loader.define("dynamic-data-mapping-form-renderer@5.0.66/js/hooks/useEvaluate.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', './usePage.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.useEvaluate = void 0;

    var _react = require("frontend-js-react-web$react");

    var _usePage2 = require("./usePage.es");

    function ownKeys(object, enumerableOnly) {
      var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {
        var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) symbols = symbols.filter(function (sym) {
          return Object.getOwnPropertyDescriptor(object, sym).enumerable;
        });keys.push.apply(keys, symbols);
      }return keys;
    }

    function _objectSpread(target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {
          ownKeys(Object(source), true).forEach(function (key) {
            _defineProperty(target, key, source[key]);
          });
        } else if (Object.getOwnPropertyDescriptors) {
          Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
        } else {
          ownKeys(Object(source)).forEach(function (key) {
            Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
          });
        }
      }return target;
    }

    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });
      } else {
        obj[key] = value;
      }return obj;
    }

    /**
     * This hook is a partial function that removes the need to pass the same
     * properties every time they are called, this is only for thunks that use
     * the `evaluate` function.
     */
    var useEvaluate = function useEvaluate(thunk) {
      var _usePage = (0, _usePage2.usePage)(),
          defaultLanguageId = _usePage.defaultLanguageId,
          editingLanguageId = _usePage.editingLanguageId,
          groupId = _usePage.groupId,
          pages = _usePage.pages,
          portletNamespace = _usePage.portletNamespace,
          rules = _usePage.rules;

      return (0, _react.useCallback)(function (args) {
        return thunk(_objectSpread({
          defaultLanguageId: defaultLanguageId,
          editingLanguageId: editingLanguageId,
          groupId: groupId,
          pages: pages,
          portletNamespace: portletNamespace,
          rules: rules
        }, args));
      }, [defaultLanguageId, editingLanguageId, groupId, pages, portletNamespace, rules, thunk]);
    };

    exports.useEvaluate = useEvaluate;
    //# sourceMappingURL=useEvaluate.es.js.map
  }
});
//# sourceMappingURL=useEvaluate.es.js.map