var g=Object.defineProperty;var d=s=>{throw TypeError(s)};var p=(s,e,r)=>e in s?g(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var i=(s,e,r)=>p(s,typeof e!="symbol"?e+"":e,r),u=(s,e,r)=>e.has(s)||d("Cannot "+r);var o=(s,e,r)=>(u(s,e,"read from private field"),r?r.call(s):e.get(s)),w=(s,e,r)=>e.has(s)?d("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,r),h=(s,e,r,n)=>(u(s,e,"write to private field"),n?n.call(s,r):e.set(s,r),r);import{g as E,p as b}from"./sidepanel-DhgOnq_z.js";var l,f;function L(){return f||(f=1,l=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),l}var x=L();const k=E(x);/**
 * @license
 * Copyright 2018 Google Inc.
 * SPDX-License-Identifier: Apache-2.0
 */var t;const c=class c{constructor(e){w(this,t);i(this,"onmessage");i(this,"onclose");h(this,t,e),o(this,t).addEventListener("message",r=>{this.onmessage&&this.onmessage.call(null,r.data)}),o(this,t).addEventListener("close",()=>{this.onclose&&this.onclose.call(null)}),o(this,t).addEventListener("error",()=>{})}static create(e,r){return new Promise((n,v)=>{const a=new k(e,[],{followRedirects:!0,perMessageDeflate:!1,allowSynchronousEvents:!1,maxPayload:268435456,headers:{"User-Agent":`Puppeteer ${b}`,...r}});a.addEventListener("open",()=>n(new c(a))),a.addEventListener("error",v)})}send(e){o(this,t).send(e)}close(){o(this,t).close()}};t=new WeakMap;let m=c;export{m as NodeWebSocketTransport};
