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