export class AddSourceMapURLDialog extends UI.HBox{constructor(callback){super(true);this.registerRequiredCSS('sources/dialog.css');this.contentElement.createChild('label').textContent=Common.UIString('Source map URL: ');this._input=UI.createInput('add-source-map','text');this._input.addEventListener('keydown',this._onKeyDown.bind(this),false);this.contentElement.appendChild(this._input);const addButton=UI.createTextButton(ls`Add`,this._apply.bind(this));this.contentElement.appendChild(addButton);this._dialog=new UI.Dialog();this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.MeasureContent);this._dialog.setDefaultFocusedElement(this._input);this._done=function(value){this._dialog.hide();callback(value);};}
show(){super.show(this._dialog.contentElement);this._dialog.show();}
_apply(){this._done(this._input.value);}
_onKeyDown(event){if(isEnterKey(event)){event.consume(true);this._apply();}}}