import{useEffect as c,useState as s}from"react";import{useNavigate as l}from"react-router-dom";import{loadAndNavigate as a}from"../app/utils/loadAndNavigate.js";import{isHostnameOnDomain as u}from"../app/utils/isHostnameOnDomain.js";import{isAssetsLink as m,isLocalLink as d}from"../../shared/utils.js";import{isForcedNavigationLinkClick as f}from"../utils.js";export*from"./page-data/hooks.js";function L(){const o=l();c(()=>{const t=n=>{const r=n.target;if(r.tagName!=="A"||f(n,r.getAttribute("target")||""))return;const i=r.getAttribute("href");!d(i)||m(i)||(n.preventDefault(),a({navigate:o,to:i||""}))};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t)}},[o])}function w(){const[o,t]=s(null);return c(()=>{if(process.env.NODE_ENV==="development"&&typeof window<"u"&&!e("localhost")&&!e("127.0.0.1")&&!e("")&&!e("redocly-local.com")&&!e("editor.redocly.xyz")&&!e("apps.codespaces.githubusercontent.com")&&!e("blueharvest.cloud")&&!e("bhstage.cloud")&&!e("cloud.redocly.com")&&!e("cloud.eu.redocly.com")&&!e("cba.au.redocly.com"))return t("Development mode is only allowed in localhost")},[typeof window]),o}function e(o){return u(window.location.hostname,o)}export{L as useRouterForLocalLinks,w as useRunningEnvironmentCheck};
