import{getValueFromMdParsedExtension}from"../utils";export function getSecurityRequirement({requirement:e,parser:t}){const n=t.definition.components&&t.definition.components.securitySchemes||{};return{schemes:Object.keys(e||{}).map((r=>{const o=t.deref(n[r]).resolved,i=e[r]||[];if(o)return Object.assign(Object.assign({},o),{id:r,sectionId:r,scopes:i})})).filter(Boolean)}}export function getSecurityScheme(e,t,n){if(!(null==e?void 0:e.deref))return{};const{resolved:r}=e.deref(n),o=t,i=r.type,s=getValueFromMdParsedExtension(r,"description")||"";let c,a,d,p={};switch(r.type){case"apiKey":c={name:r.name,in:r.in};break;case"http":a={scheme:r.scheme,bearerFormat:r.bearerFormat};break;case"openIdConnect":d={connectUrl:r.openIdConnectUrl};break;case"oauth2":p=r.flows}return{id:t,sectionId:o,type:i,description:s,apiKey:c,http:a,flows:p,openId:d}}export function getSecuritySchemes({parser:e}){var t,n;if(!e)return[];const r=(null===(n=null===(t=e.definition)||void 0===t?void 0:t.components)||void 0===n?void 0:n.securitySchemes)||{};return Object.keys(r).map((t=>getSecurityScheme(e,t,r[t])))}
//# sourceMappingURL=security.js.map