import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as h}from"../../../../markdoc/helpers/get-inner-text.js";import{getSearchDocuments as T}from"./get-search-documents.js";import{AstToSearchNodeTransformer as R}from"./walk-sections.js";import{setDocumentSearchFacets as S,extractDocumentSearchFacets as C}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../constants/common.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),f=new R({ast:i,getInnerContent:h,partials:a.getGlobalConfig(D)||{}}),u=t.metadata||{},n=C(u,o);S(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return T(f,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};
