Liferay.Loader.define("dynamic-data-mapping-form-web@4.0.150/admin/js/hooks/useBack.es",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/modal","@liferay/frontend-js-react-web","data-engine-js-components-web","liferay!frontend-js-react-web$react","./useAutoSave.es"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.useBack=function useBack(){const{portletNamespace:e}=(0,u.useConfig)(),[{onClose:t},a]=(0,l.useContext)(n.Context),{isSaved:c}=(0,i.useAutoSave)(),f=(0,l.useCallback)((e=>{if(c())return;e.preventDefault();const n=e.currentTarget.href;a({payload:{body:Liferay.Language.get("any-unsaved-changes-will-be-lost-are-you-sure-you-want-to-leave"),footer:[null,null,l.default.createElement(r.default.Group,{key:3,spaced:!0},l.default.createElement(r.default,{displayType:"secondary",onClick:()=>{window.location.href=n}},Liferay.Language.get("leave")),l.default.createElement(r.default,{displayType:"primary",onClick:t},Liferay.Language.get("stay")))],header:Liferay.Language.get("leave-form"),size:"sm"},type:1})}),[a,c,t]);(0,o.useEventListener)("click",f,!0,document.querySelector("#".concat(e,"controlMenu .sites-control-group span .lfr-icon-item")))};var r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(a("@frontend-taglib-clay$clayui/button")),n=a("@frontend-taglib-clay$clayui/modal"),o=a("@liferay/frontend-js-react-web"),u=a("data-engine-js-components-web"),l=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 a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=r?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(a,n,o):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),i=a("./useAutoSave.es");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}}}));
//# sourceMappingURL=useBack.es.js.map