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