import*as i18n from"../i18n/i18n.js";import*as UI from"../ui/ui.js";const UIStrings={sourceMapUrl:"Source map URL: ",add:"Add"},str_=i18n.i18n.registerUIStrings("sources/AddSourceMapURLDialog.js",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class AddSourceMapURLDialog extends UI.Widget.HBox{constructor(t){super(!0),this.registerRequiredCSS("sources/dialog.css",{enableLegacyPatching:!1}),this.contentElement.createChild("label").textContent=i18nString(UIStrings.sourceMapUrl),this._input=UI.UIUtils.createInput("add-source-map","text"),this._input.addEventListener("keydown",this._onKeyDown.bind(this),!1),this.contentElement.appendChild(this._input);const i=UI.UIUtils.createTextButton(i18nString(UIStrings.add),this._apply.bind(this));this.contentElement.appendChild(i),this._dialog=new UI.Dialog.Dialog,this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent),this._dialog.setDefaultFocusedElement(this._input),this._callback=t}show(){super.show(this._dialog.contentElement),this._dialog.show()}_done(t){this._dialog.hide(),this._callback(t)}_apply(){this._done(this._input.value)}_onKeyDown(t){"Enter"===t.key&&(t.consume(!0),this._apply())}}