import{REDOCLY_ROUTE_RBAC as m,REDOCLY_TEAMS_RBAC as l}from"@redocly/config";import{removeMarkdownLinks as h}from"../../openapi-docs/utils.js";import{extractDocumentSearchFacets as b,setDocumentSearchFacets as R}from"./search-facets.js";function k(c,e){return async(t,r)=>{const s=t.getSidebar?.(t)||[];return f(c,r,t,s,e)}}function f(c,e,t,r,s,p){const a=[];for(const n of r)if(n.type==="group")a.push(...f(c,e,t,n.items,s,n.label));else{const i=S(n,s,p||"");if(i){const o=n.link||n.slug,d={slug:t.slug,fsPath:t.fsPath},g=t.metadata||{},u=b(c,g);R(c,u),a.push({id:o,url:o,text:h(i.description||""),title:i.name,facets:u,[l]:e[l],[m]:e[m]||d})}}return a}function S(c,e,t){const r=t.toLowerCase(),{label:s}=c;switch(r){case"queries":return e.getQueryField(s);case"mutations":return e.getMutationField(s);case"subscriptions":return e.getSubscriptionField(s);case"directives":return e.getDirective(s);case"objects":case"interfaces":case"unions":case"enums":case"inputs":case"scalars":return e.getType(s)}}export{k as searchResolver};
