import{jsx as t,Fragment as i,jsxs as f}from"react/jsx-runtime";import{memo as u}from"react";import{useAtomValue as x}from"jotai";import{joinWithSeparator as I}from"../../services/index.js";import{TagItem as e}from"../TagItem/index.js";import{OperationItem as g}from"../OperationItem/index.js";import{Section as y}from"../common/index.js";import{useIsExpanded as C}from"./useIsExpanded.js";import{SectionItem as E}from"../SectionItem/index.js";import h from"../ContentItems/useScrollOnRender.js";import{isRootItem as j}from"../ContentItems/helpers.js";import{ApiInfo as R}from"../ApiInfo/index.js";import{layoutAtom as S}from"../../jotai/app.js";import{isRenderableMenuItem as A}from"../../utils/menu.js";const _={group:null,tag:e,section:E,schema:o=>t(e,{...o,item:o.item,isExpanded:!0}),operation:g,tool:o=>t(e,{...o,item:o.item,isExpanded:!0}),rsrc:o=>t(e,{...o,item:o.item,isExpanded:!0}),prompt:o=>t(e,{...o,item:o.item,isExpanded:!0}),root:R};function b({item:o,routingBasePath:n,children:p,layout:s}){const a=j(o),m=_[a?"root":o.type],d=o.type==="tag"&&o.items.length>0,r=C({item:o,routingBasePath:n});let l=h(o,n);const c=x(S);return f(i,{children:[m&&t(y,{id:o.id,ref:l,sectionId:I(n,o.id),underlined:A(o),expanded:d&&!r,children:t(m,{item:o,routingBasePath:n,isExpanded:r,layout:s||c})}),(r||o.type!=="tag")&&!!o.items?.length&&t(i,{children:p})]})}const J=u(b);export{J as ContentItem};
