Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.105/admin/js/hooks/useStateSync.es",["module","exports","require","data-engine-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useStateSync=function(){const{portletNamespace:e,sidebarPanels:t}=(0,n.useConfig)(),{availableLanguageIds:a,defaultLanguageId:i,localizedDescription:s,localizedName:o,pages:l,paginationMode:u,rules:d,successPageSettings:g}=(0,n.useFormState)();return(0,r.useCallback)((()=>{const n={availableLanguageIds:a,defaultLanguageId:i,description:s,name:o,pages:l,paginationMode:u,rules:d,sidebarPanels:t,successPageSettings:g};Object.keys(n.name).forEach((e=>{n.name[e]=Liferay.Util.unescape(n.name[e])})),Object.keys(n.description).forEach((e=>{n.description[e]=Liferay.Util.unescape(n.description[e])})),document.querySelector("#".concat(e,"name")).value=JSON.stringify(o),document.querySelector("#".concat(e,"description")).value=JSON.stringify(s),document.querySelector("#".concat(e,"serializedFormBuilderContext")).value=c(n,i)}),[a,i,s,o,l,u,e,d,t,g])};var n=a("data-engine-js-components-web"),r=a("liferay!frontend-js-react-web$react");function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?i(Object(a),!0).forEach((function(t){o(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):i(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const e=(e,t)=>new n.PagesVisitor(e).mapFields((e=>{if("options"===e.type){const{value:a}=e,n={};Object.keys(a).forEach((e=>{n[e]=a[e].filter((({value:e})=>""!==e))})),n[t]||(n[t]=[]),e=s(s({},e),{},{value:n})}return e})),c=(t,a)=>{const r=t.pages.map((e=>s(s({},e),{},{description:e.localizedDescription,title:e.localizedTitle}))).filter((({contentRenderer:e})=>"success"!==e)),i=new n.PagesVisitor(r);return JSON.stringify(s(s({},t),{},{pages:i.mapFields((n=>s(s({},n),{},{settingsContext:s(s({},n.settingsContext),{},{availableLanguageIds:t.availableLanguageIds,defaultLanguageId:t.defaultLanguageId,pages:e(n.settingsContext.pages,a)})})),!0,!0)}))}}}));
//# sourceMappingURL=useStateSync.es.js.map