export const ClickableTableOfContents = ({ title, code }) => { const lines = String(code ?? "").replace(/\r\n/g, "\n").split("\n"); return (
{title ? (
{title}
) : null}
        
          {lines.map((line, index) => {
            if (line.trim().startsWith("// NEXT_LINE_PLATFORM")) {
              return null;
            }

            const match = line.match(/^(.*?)(?:\s*\/\/\s*\$stack-link-to:(#[a-zA-Z0-9_-]+))\s*$/);
            const href = match?.[2] ?? null;
            const text = match?.[1] ?? line;

            if (text.trim() === "") {
              return ;
            }

            const content = (
              
                {text.replace(/\s+$/, "")}
              
            );

            if (!href) {
              return (
                
                  {content}
                
              );
            }

            return (
              
                {content}
              
            );
          })}
        
      
); }; export const CollapsibleTypesSection = ({ type, property, signature, defaultOpen = false, deprecated = false, badge, children, }) => { const id = `${String(type ?? "") .toLowerCase() .replace(/[^a-z0-9]/g, "")}${String(property ?? "") .toLowerCase() .replace(/[^a-z0-9]/g, "")}`; const [isOpen, setIsOpen] = useState(defaultOpen); useEffect(() => { if (typeof window === "undefined") { return undefined; } const syncWithHash = () => { if (window.location.hash === `#${id}`) { setIsOpen(true); } }; syncWithHash(); window.addEventListener("hashchange", syncWithHash); return () => window.removeEventListener("hashchange", syncWithHash); }, [id]); const label = signature ? `${property}(${signature})` : property; const fullLabel = type ? `${type}.${label}` : label; return (
setIsOpen(event.currentTarget.open)} className={`not-prose my-4 scroll-mt-24 overflow-hidden rounded-2xl border bg-white dark:bg-zinc-950 ${deprecated ? "border-orange-400/40 dark:border-orange-500/30" : "border-zinc-950/10 dark:border-white/10"}`} >
{fullLabel} {deprecated ? ( deprecated ) : null} {badge ?? null}
{children}
); }; export const MethodLayout = ({ children }) => (
{children}
); export const MethodContent = ({ children }) => (
{children}
); export const MethodAside = ({ title, children }) => (
{title ? (

{title}

) : null}
{children}
); export const AsideSection = ({ title, children }) => (
{title ? (

{title}

) : null}
{children}
); export const ContentSection = ({ title, children }) => (
{title ? (

{title}

) : null}
{children}
); export const MethodReturns = ({ type, children }) => ( {type} {children ? (
{children}
) : null}
);