import*as i18n from"../i18n/i18n.js";import{FilteredListWidget,Provider}from"./FilteredListWidget.js";const UIStrings={pressEnterToConfirmOrEscapeTo:"{PH1} (Press 'Enter' to confirm or 'Escape' to cancel.)"},str_=i18n.i18n.registerUIStrings("quick_open/QuickInput.ts",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class QuickInput{constructor(){throw new ReferenceError("Instance type not implemented.")}static show(e){let t=new Promise((e=>{}));const r=new Promise((r=>{const i=new QuickInputProvider(e,r),n=new FilteredListWidget(i);e.placeHolder&&n.setPlaceholder(e.placeHolder),n.setPromptTitle(e.placeHolder||e.prompt),n.showAsDialog(e.prompt),t=n.once("hidden"),n.setQuery(e.value||""),e.valueSelection&&n.setQuerySelectedRange(e.valueSelection[0],e.valueSelection[1])}));return Promise.race([r,t]).then((e=>e))}}class QuickInputProvider extends Provider{constructor(e,t){super(),this._options=e,this._resolve=t}notFoundText(){return i18nString(UIStrings.pressEnterToConfirmOrEscapeTo,{PH1:this._options.prompt})}selectItem(e,t){this._resolve(t)}}