import e,{useState as t,useEffect as r}from"react";import n from"../../../node_modules/next/router.js";import"../../../node_modules/react-redux/es/index.js";import{useSelector as o}from"../../../node_modules/react-redux/es/hooks/useSelector.js";var a=function(a){var u=o(a.selectPageState),s=t(!1),i=s[0],d=s[1];return r((function(){d(u.changesMade)}),[u]),r((function(){var e="Changes you made may not be saved.",t=function(t){return t.returnValue=e,e},r=function(t){if(n.pathname!==t&&!confirm(e))throw n.events.emit("routeChangeError"),'Route change to "'+t+'" was aborted (this error can be safely ignored). See https://github.com/zeit/next.js/issues/2476.'};return i?(window.addEventListener("beforeunload",t),n.events.on("routeChangeStart",r)):(window.removeEventListener("beforeunload",t),n.events.off("routeChangeStart",r)),function(){window.removeEventListener("beforeunload",t),n.events.off("routeChangeStart",r)}}),[i]),e.createElement(e.Fragment,null)};a.propTypes={};export default a;
//# sourceMappingURL=RouteLeaveGuard.js.map
