import{ObjectWrapper as e}from"../common/common.js";import{TargetDetachedDialog as r}from"../components/components.js";import{NetworkPanelIndicator as o}from"../mobile_throttling/mobile_throttling.js";import{ls as t}from"../platform/platform.js";import{Connections as n,SDKModel as a,ChildTargetManager as i,DebuggerModel as s}from"../sdk/sdk.js";class m extends e.ObjectWrapper{async run(){n.initMainConnection((async()=>{a.TargetManager.instance().createTarget("main",t`Main`,a.Type.ServiceWorker,null)}),r.TargetDetachedDialog.webSocketConnectionLost),new o.NetworkPanelIndicator}}i.ChildTargetManager.install((async({target:e,waitingForDebugger:r})=>{if(e.parentTarget()||e.type()!==a.Type.ServiceWorker||!r)return;const o=e.model(s.DebuggerModel);o&&(o.isReadyToPause()||await o.once(s.Events.DebuggerIsReadyToPause),o.pause())}));var c=Object.freeze({__proto__:null,WorkerMainImpl:m});export{c as WorkerMain};
