import{useMemo}from"react";import{useLocation}from"react-router-dom";import{removeLeadingSlash}from"@redocly/theme";import{tryDecodeURIComponent,normalizePath}from"../../utils";import{getLegacyHash}from"../Content/useAutoScroll";export function useIsExpanded({item:e,routingBasePath:o}){const t=useLocation(),r=useMemo((()=>tryDecodeURIComponent(normalizePath(t.pathname.replace(o,"")))),[t.pathname,o]),n=useMemo((()=>{const o=[],t=e=>{e.forEach((e=>{var r;o.push(e),(null===(r=e.items)||void 0===r?void 0:r.length)&&t(e.items)}))};return t([e]),o}),[e]);if("tag"!==e.type)return!1;const a=n.map((e=>e.href));return a.some((e=>{const o=getLegacyHash(t.hash);return[e,tryDecodeURIComponent(e)].includes(r)||o&&(e.endsWith(o)||e===removeLeadingSlash(o))}))}
//# sourceMappingURL=useIsExpanded.js.map