"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiInfo=ApiInfo;const jsx_runtime_1=require("react/jsx-runtime"),jotai_1=require("jotai"),theme_1=require("@redocly/theme"),common_1=require("../common"),ExternalDocumentation_1=require("../ExternalDocumentation"),Markdown_1=require("../Markdown"),styled_1=require("./styled"),store_1=require("../../jotai/store"),saveTextBeforeHeading_1=require("../../utils/saveTextBeforeHeading"),helpers_1=require("../../utils/helpers"),RenderHook_1=require("../RenderHook"),Metadata_1=require("./Metadata"),hooks_1=require("../../hooks");function ApiInfo({item:e,layout:r}){const t=(0,hooks_1.useTranslate)(),{options:{unstable_hooks:o,hideInfoMetadata:n},parser:{definition:i}}=(0,jotai_1.useAtomValue)(store_1.globalStoreAtom),a=e.infoDefinition;if(!a)return null;const s=(0,saveTextBeforeHeading_1.saveTextBeforeHeading)((0,helpers_1.getValueFromMdParsedExtension)(a,"description")||""),u=(0,helpers_1.getValueFromMdParsedExtension)(a,"summary")||void 0,l=(null==i?void 0:i.externalDocs)||(null==a?void 0:a.externalDocs),d=a.version&&(0,jsx_runtime_1.jsxs)("span",{children:["(",a.version,")"]})||null,_=r===theme_1.LayoutVariant.STACKED;return(0,jsx_runtime_1.jsx)(common_1.Row,{layout:r,children:(0,jsx_runtime_1.jsxs)(common_1.SamplesMiddlePanel,{fullWidth:!0,className:"api-info",isStacked:_,children:[(0,jsx_runtime_1.jsxs)(styled_1.ApiHeader,{children:[a.title," ",d]}),(0,jsx_runtime_1.jsx)(RenderHook_1.RenderHook,{Hook:theme_1.AfterOpenApiTitle||(null==o?void 0:o.AfterApiTitle),props:{info:a}}),u&&(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:u,"data-role":"redoc-summary"}),s&&(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:s,"data-role":"redoc-description"}),l&&(0,jsx_runtime_1.jsx)(ExternalDocumentation_1.ExternalDocumentation,{externalDocs:l}),!n&&(0,jsx_runtime_1.jsx)(Metadata_1.Metadata,{metadata:a["x-metadata"],translate:t})]})})}
//# sourceMappingURL=ApiInfo.js.map