"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.SecurityFlow=SecurityFlow;const jsx_runtime_1=require("react/jsx-runtime"),styled_components_1=__importDefault(require("styled-components")),SecuritySchemeItem_1=require("./SecuritySchemeItem"),utils_1=require("../../utils"),OAuthFlow_1=require("./OAuthFlow"),styled_1=require("./styled"),Markdown_1=require("../Markdown"),hooks_1=require("../../hooks"),OAuthScopes_1=require("./OAuthScopes");function SecurityFlow({type:e,bearerFormat:t,name:r,flows:i,openIdConnectUrl:s,description:n,id:o,securities:u,in:a}){const c=(0,hooks_1.useTranslate)();if(!e||!o)return null;const l={http:(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:c("openapi.httpAuthorizationScheme","HTTP Authorization Scheme"),value:e}),(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:c("openapi.bearerFormat","Bearer Format"),value:t})]}),apiKey:(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:`${(0,utils_1.titleize)(a||"")} ${c("openapi.parameterName","parameter name")}:`,value:r}),oauth2:(0,jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment,{children:[(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:c("openapi.flowType","Flow type"),value:e}),i&&Object.keys(i).map((e=>(0,jsx_runtime_1.jsx)(OAuthFlow_1.OAuthFlow,{flow:i[e]},e)))]}),openIdConnect:(0,jsx_runtime_1.jsx)(SecuritySchemeItem_1.SecuritySchemeItem,{label:c("openapi.connectUrl","Connect URL"),value:s&&(0,jsx_runtime_1.jsx)(styled_1.StyledLink,{target:"_blank",rel:"noopener noreferrer",href:s,children:s})})},m=i&&Object.keys(i).map((e=>(0,jsx_runtime_1.jsx)(OAuthScopes_1.OAuthRequiredScopes,{id:o,securities:u,flow:i[e]},e))),_=i&&Object.keys(i).map((e=>(0,jsx_runtime_1.jsx)(OAuthScopes_1.OAuthOptionalScopes,{flow:i[e]},e)));return(0,jsx_runtime_1.jsxs)(Wrapper,{children:[(0,jsx_runtime_1.jsx)(TitleSchema,{children:o}),(0,jsx_runtime_1.jsx)(Markdown_1.Markdown,{source:n}),(0,jsx_runtime_1.jsxs)(List,{children:[l[e]||null,m,_]})]})}const Wrapper=styled_components_1.default.div`
  background: var(--layer-color);
  padding: var(--spacing-base);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color-secondary);
  width: 100%;
  margin-top: var(--spacing-base);
`,List=styled_components_1.default.div`
  width: 100%;
  margin-top: var(--spacing-md);
`,TitleSchema=styled_components_1.default.p`
  font-size: var(--font-size-base);
  margin: 0 0 var(--spacing-xs);
  text-transform: capitalize;
  font-weight: var(--font-weight-semibold);
`;
//# sourceMappingURL=SecurityFlow.js.map