import*as UI from"../ui/ui.js";import{getRegisteredProviders,Provider,registerProvider}from"./FilteredListWidget.js";import{QuickOpenImpl}from"./QuickOpen.js";let helpQuickOpenInstance;export class HelpQuickOpen extends Provider{constructor(){super(),this._providers=[],getRegisteredProviders().forEach(this._addProvider.bind(this))}static instance(e={forceNew:null}){const{forceNew:r}=e;return helpQuickOpenInstance&&!r||(helpQuickOpenInstance=new HelpQuickOpen),helpQuickOpenInstance}_addProvider(e){e.title&&this._providers.push({prefix:e.prefix||"",title:e.title()})}itemCount(){return this._providers.length}itemKeyAt(e){return this._providers[e].prefix}itemScoreAt(e,r){return-this._providers[e].prefix.length}renderItem(e,r,i,t){const s=this._providers[e];i.createChild("span","monospace").textContent=(s.prefix||"\u2026")+" ",UI.UIUtils.createTextChild(i,s.title)}selectItem(e,r){null!==e&&QuickOpenImpl.show(this._providers[e].prefix)}renderAsTwoRows(){return!1}}registerProvider({prefix:"?",title:void 0,provider:HelpQuickOpen.instance});