Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.121/admin/js/components/form-settings/FormSettingsModal",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","data-engine-js-components-web","liferay!frontend-js-react-web$react"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(r("@frontend-taglib-clay$clayui/button")),n=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/modal")),l=r("data-engine-js-components-web"),i=_interopRequireWildcard(r("liferay!frontend-js-react-web$react"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}var _default=({children:e,onCloseFormSettings:t,prevPagesRef:r,serializedSettingsContext:o,undoPagesRef:u,visibleFormSettings:d})=>{const{spritemap:s}=(0,l.useConfig)(),{pages:c}=(0,l.useFormState)(),f=(0,l.useForm)();(0,i.useEffect)((()=>{if(o.value){const e=JSON.parse(o.value).pages;f({payload:e,type:l.EVENT_TYPES.PAGE.UPDATE}),r.current=e}o.value=JSON.stringify({pages:r.current})}),[f,r,o]);const{observer:p,onClose:g}=(0,n.useModal)({onClose:()=>{var e;u.current?(f({payload:r.current,type:l.EVENT_TYPES.PAGE.UPDATE}),o.value=JSON.stringify({pages:r.current})):o.value=JSON.stringify({pages:c});const a=null===(e=new l.PagesVisitor(c).findField((({fieldName:e})=>"showPartialResultsToRespondents"===e)))||void 0===e?void 0:e.value,n=document.querySelector(".lfr-ddm__show-partial-results-alert");a?n.classList.remove("lfr-ddm__show-partial-results-alert--hidden"):n.classList.add("lfr-ddm__show-partial-results-alert--hidden"),u.current=!0,t()}});return i.default.createElement(i.default.Fragment,null,d&&i.default.createElement(n.default,{className:"ddm-form-settings-modal",observer:p,spritemap:s},i.default.createElement(n.default.Header,null,Liferay.Language.get("settings")),i.default.createElement(n.default.Body,null,e),i.default.createElement(n.default.Footer,{last:i.default.createElement(a.default.Group,{key:1,spaced:!0},i.default.createElement(a.default,{displayType:"secondary",onClick:()=>{u.current=!0,g()}},Liferay.Language.get("cancel")),i.default.createElement(a.default,{displayType:"primary",onClick:()=>{r.current=c,u.current=!1,g()}},Liferay.Language.get("done")))})))};t.default=_default}}));
//# sourceMappingURL=FormSettingsModal.js.map