import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";import{useAtomValue}from"jotai";import{AfterOpenApiTitle,LayoutVariant}from"@redocly/theme";import{SamplesMiddlePanel,Row}from"../common";import{ExternalDocumentation}from"../ExternalDocumentation";import{Markdown}from"../Markdown";import{ApiHeader}from"./styled";import{globalStoreAtom}from"../../jotai/store";import{saveTextBeforeHeading}from"../../utils/saveTextBeforeHeading";import{getValueFromMdParsedExtension}from"../../utils/helpers";import{RenderHook}from"../RenderHook";import{Metadata}from"./Metadata";import{useTranslate}from"../../hooks";export function ApiInfo({item:e,layout:o}){const t=useTranslate(),{options:{unstable_hooks:r,hideInfoMetadata:a},parser:{definition:i}}=useAtomValue(globalStoreAtom),n=e.infoDefinition;if(!n)return null;const s=saveTextBeforeHeading(getValueFromMdParsedExtension(n,"description")||""),l=getValueFromMdParsedExtension(n,"summary")||void 0,m=(null==i?void 0:i.externalDocs)||(null==n?void 0:n.externalDocs),d=n.version&&_jsxs("span",{children:["(",n.version,")"]})||null,p=o===LayoutVariant.STACKED;return _jsx(Row,{layout:o,children:_jsxs(SamplesMiddlePanel,{fullWidth:!0,className:"api-info",isStacked:p,children:[_jsxs(ApiHeader,{children:[n.title," ",d]}),_jsx(RenderHook,{Hook:AfterOpenApiTitle||(null==r?void 0:r.AfterApiTitle),props:{info:n}}),l&&_jsx(Markdown,{source:l,"data-role":"redoc-summary"}),s&&_jsx(Markdown,{source:s,"data-role":"redoc-description"}),m&&_jsx(ExternalDocumentation,{externalDocs:m}),!a&&_jsx(Metadata,{metadata:n["x-metadata"],translate:t})]})})}
//# sourceMappingURL=ApiInfo.js.map