import*as i18n from"../i18n/i18n.js";import{Dialog}from"./Dialog.js";import{SizeBehavior}from"./GlassPane.js";import{createTextButton,formatLocalized}from"./UIUtils.js";import{VBox}from"./Widget.js";const UIStrings={reconnectWhenReadyByReopening:"Reconnect when ready by reopening DevTools.",reconnectDevtools:"Reconnect DevTools"},str_=i18n.i18n.registerUIStrings("ui/RemoteDebuggingTerminatedScreen.js",UIStrings),i18nString=i18n.i18n.getLocalizedString.bind(void 0,str_);export class RemoteDebuggingTerminatedScreen extends VBox{constructor(e){super(!0),this.registerRequiredCSS("ui/remoteDebuggingTerminatedScreen.css",{enableLegacyPatching:!0});const n=this.contentElement.createChild("div","message"),t=n.createChild("span","reason");t.textContent=e,n.appendChild(formatLocalized("Debugging connection was closed. Reason: %s",[t])),this.contentElement.createChild("div","message").textContent=i18nString(UIStrings.reconnectWhenReadyByReopening);const i=createTextButton(i18nString(UIStrings.reconnectDevtools),(()=>window.location.reload()));this.contentElement.createChild("div","button").appendChild(i)}static show(e){const n=new Dialog;n.setSizeBehavior(SizeBehavior.MeasureContent),n.addCloseButton(),n.setDimmed(!0),new RemoteDebuggingTerminatedScreen(e).show(n.contentElement),n.show()}}