import{getTagGroupsItems as c,getTagsItems as g,getTagsWithOperations as p,buildNestedTagsItems as h}from"./tags.js";import{addMarkdownItems as l}from"./markdown.js";import{flattenByProp as T,getValueFromMdParsedExtension as x}from"../../utils/index.js";import{DEFAULT_WEBHOOKS_TAG_NAME as d}from"../../constants.js";function A(n,o){const{definition:e}=n,{schemaDefinitionsTagName:i}=o,a=[{id:"",name:e?.info?.["x-seo"]?.title||e?.info?.title||"Overview",href:"/",depth:1,level:1,type:"section",infoDefinition:e.info,items:[],keywords:e["x-keywords"]}],s=[...e.tags||[]];if(s.some(t=>t.name===d)||s.push({name:d}),!s.find(t=>t?.name===i)&&i&&s.push({name:i}),e["x-mcp"])for(const t of["Tools","Resources","Prompts"])e["x-mcp"][t]&&(s.find(r=>r?.name===t)||s.push({name:t}));const f=p(n,s),m=e["x-tagGroups"],u=Object.values(f).some(t=>t.parent);return a.push(...l(x(e.info,"description")||"",void 0,1)),u?a.push(...h(n,f,void 0,o)):m&&m.length>0?a.push(...c(n,void 0,m,f,o)):a.push(...g(n,f,void 0,void 0,o)),a}function w(n,o){const e=A(n,o),i=T(e||[],"items");return{contentItems:e,flatItems:i}}export{w as buildContentItems,A as buildMenuStructure};
