Liferay.Loader.define("data-engine-js-components-web@1.0.87/js/core/hooks/useForm.es",["module","exports","require","@liferay/frontend-js-react-web","liferay!frontend-js-react-web$react","../reducers/createReducer.es","./useConfig.es","./useDataView.es"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.FormNoopProvider=function FormNoopProvider({children:r,initialState:t,onAction:a,value:i}){const[,c]=(0,n.useThunk)([{},a]);return o.default.createElement(e.Provider,{value:c},o.default.createElement(u.Provider,{value:_objectSpread(_objectSpread({},t),i)},r))},r.FormProvider=FormProvider,r.useForm=function useForm(){return(0,o.useContext)(e)},r.useFormState=function useFormState({schema:e}={}){return(0,c.useDataView)((0,o.useContext)(u),e)};var n=t("@liferay/frontend-js-react-web"),o=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=_getRequireWildcardCache();if(r&&r.has(e))return r.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var a=n?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(t,o,a):t[o]=e[o]}t.default=e,r&&r.set(e,t);return t}(t("liferay!frontend-js-react-web$react")),a=t("../reducers/createReducer.es"),i=t("./useConfig.es"),c=t("./useDataView.es");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}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}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const e=o.default.createContext((()=>{}));e.displayName="FormDispatchContext";const u=o.default.createContext({editingLanguageId:"en_US"});u.displayName="FormStateContext";const usePropagateAction=([e,r],t)=>[e,(0,o.useCallback)((e=>{r(e),null==t||t(e)}),[r,t])];function FormProvider({children:r,init:t=(e=>e),initialState:c={},onAction:s,reducers:d,value:f}){const l=(0,i.useConfig)(),[p,b]=(0,n.useThunk)(usePropagateAction((0,o.useReducer)((0,a.createReducer)(d,l),_objectSpread(_objectSpread({},c),f),(e=>t(e,l))),s));return o.default.createElement(e.Provider,{value:b},o.default.createElement(u.Provider,{value:p},"function"==typeof r?r(p):r))}FormProvider.displayName="FormProvider"}}));
//# sourceMappingURL=useForm.es.js.map