openpond 0.2.50 → 0.2.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{lc as r}from"./chunks/chunk-V67DJQQ3.js";import"./chunks/chunk-TBNBCOW7.js";import"./chunks/chunk-EMKZVP7Z.js";import{e as p}from"./chunks/chunk-JCCU3VFK.js";import"./chunks/chunk-O7VGFMDO.js";import"./chunks/chunk-DLZP22WV.js";import"./chunks/chunk-ZCWHVLJ4.js";import"./chunks/chunk-OE2VF6KU.js";import"./chunks/chunk-T5LE6R5S.js";import"./chunks/chunk-QJRXTIOC.js";import"./chunks/chunk-SDO4FC4Q.js";import"./chunks/chunk-IR3YJWPW.js";import{i as e}from"./chunks/chunk-7K72KS5C.js";import"./chunks/chunk-XM26DGML.js";import"./chunks/chunk-EPY7M5XS.js";import"./chunks/chunk-7MXZJQS7.js";import"./chunks/chunk-7YR6CBNU.js";import"./chunks/chunk-2ZJJFBIA.js";import"./chunks/chunk-5CMKGD43.js";import"./chunks/chunk-XEOEKFG6.js";import"./chunks/chunk-HA7EFTPF.js";import"./chunks/chunk-L3KS6MOV.js";import"./chunks/chunk-7QEE4PBI.js";import"./chunks/chunk-XDMUD4FW.js";import"./chunks/chunk-IKWDL3RB.js";import"./chunks/chunk-6MI4KKWF.js";import"./chunks/chunk-QRWPEW3Z.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-YL6VFJ4P.js";import"./chunks/chunk-Z3D4C7BG.js";import"./chunks/chunk-WV2APYWG.js";import"./chunks/chunk-PJM2G7SG.js";import"./chunks/chunk-SDEDAHV6.js";import"./chunks/chunk-DALJMSJG.js";import"./chunks/chunk-TGIB24K4.js";import"./chunks/chunk-NNF6KCHD.js";import"./chunks/chunk-ES2ISFJC.js";import"./chunks/chunk-H7IWJN7L.js";import"./chunks/chunk-FTQLQJQV.js";export{e as AGENT_PROTOCOL_VERSION,r as createOpenPondAppServer,p as runAppServerJsonl};
2
+ import{lc as r}from"./chunks/chunk-KXEG7HCG.js";import"./chunks/chunk-TBNBCOW7.js";import"./chunks/chunk-EMKZVP7Z.js";import{e as p}from"./chunks/chunk-JCCU3VFK.js";import"./chunks/chunk-O7VGFMDO.js";import"./chunks/chunk-DLZP22WV.js";import"./chunks/chunk-ZCWHVLJ4.js";import"./chunks/chunk-OE2VF6KU.js";import"./chunks/chunk-T5LE6R5S.js";import"./chunks/chunk-QJRXTIOC.js";import"./chunks/chunk-SDO4FC4Q.js";import"./chunks/chunk-IR3YJWPW.js";import{i as e}from"./chunks/chunk-7K72KS5C.js";import"./chunks/chunk-XM26DGML.js";import"./chunks/chunk-EPY7M5XS.js";import"./chunks/chunk-7MXZJQS7.js";import"./chunks/chunk-7YR6CBNU.js";import"./chunks/chunk-2ZJJFBIA.js";import"./chunks/chunk-5CMKGD43.js";import"./chunks/chunk-XEOEKFG6.js";import"./chunks/chunk-HA7EFTPF.js";import"./chunks/chunk-L3KS6MOV.js";import"./chunks/chunk-7QEE4PBI.js";import"./chunks/chunk-XDMUD4FW.js";import"./chunks/chunk-IKWDL3RB.js";import"./chunks/chunk-6MI4KKWF.js";import"./chunks/chunk-QRWPEW3Z.js";import"./chunks/chunk-6FA3GG5B.js";import"./chunks/chunk-YL6VFJ4P.js";import"./chunks/chunk-Z3D4C7BG.js";import"./chunks/chunk-WV2APYWG.js";import"./chunks/chunk-PJM2G7SG.js";import"./chunks/chunk-SDEDAHV6.js";import"./chunks/chunk-DALJMSJG.js";import"./chunks/chunk-TGIB24K4.js";import"./chunks/chunk-NNF6KCHD.js";import"./chunks/chunk-ES2ISFJC.js";import"./chunks/chunk-H7IWJN7L.js";import"./chunks/chunk-FTQLQJQV.js";export{e as AGENT_PROTOCOL_VERSION,r as createOpenPondAppServer,p as runAppServerJsonl};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{kc as c,lc as d}from"./chunk-V67DJQQ3.js";import"./chunk-TBNBCOW7.js";import"./chunk-EMKZVP7Z.js";import{e as b}from"./chunk-JCCU3VFK.js";import"./chunk-O7VGFMDO.js";import"./chunk-DLZP22WV.js";import"./chunk-ZCWHVLJ4.js";import"./chunk-OE2VF6KU.js";import"./chunk-T5LE6R5S.js";import"./chunk-QJRXTIOC.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{i as a}from"./chunk-7K72KS5C.js";import"./chunk-XM26DGML.js";import"./chunk-EPY7M5XS.js";import"./chunk-7MXZJQS7.js";import"./chunk-7YR6CBNU.js";import"./chunk-2ZJJFBIA.js";import"./chunk-5CMKGD43.js";import"./chunk-XEOEKFG6.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-XDMUD4FW.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as AGENT_PROTOCOL_VERSION,c as APP_SERVER_COMPOSITION,d as createOpenPondAppServer,b as runAppServerJsonl};
2
+ import{kc as c,lc as d}from"./chunk-KXEG7HCG.js";import"./chunk-TBNBCOW7.js";import"./chunk-EMKZVP7Z.js";import{e as b}from"./chunk-JCCU3VFK.js";import"./chunk-O7VGFMDO.js";import"./chunk-DLZP22WV.js";import"./chunk-ZCWHVLJ4.js";import"./chunk-OE2VF6KU.js";import"./chunk-T5LE6R5S.js";import"./chunk-QJRXTIOC.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{i as a}from"./chunk-7K72KS5C.js";import"./chunk-XM26DGML.js";import"./chunk-EPY7M5XS.js";import"./chunk-7MXZJQS7.js";import"./chunk-7YR6CBNU.js";import"./chunk-2ZJJFBIA.js";import"./chunk-5CMKGD43.js";import"./chunk-XEOEKFG6.js";import"./chunk-HA7EFTPF.js";import"./chunk-L3KS6MOV.js";import"./chunk-7QEE4PBI.js";import"./chunk-XDMUD4FW.js";import"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import"./chunk-QRWPEW3Z.js";import"./chunk-6FA3GG5B.js";import"./chunk-YL6VFJ4P.js";import"./chunk-Z3D4C7BG.js";import"./chunk-WV2APYWG.js";import"./chunk-PJM2G7SG.js";import"./chunk-SDEDAHV6.js";import"./chunk-DALJMSJG.js";import"./chunk-TGIB24K4.js";import"./chunk-NNF6KCHD.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as AGENT_PROTOCOL_VERSION,c as APP_SERVER_COMPOSITION,d as createOpenPondAppServer,b as runAppServerJsonl};
@@ -77,7 +77,7 @@ ${n.stdout}`;if(nN(r))return;throw new Error(`Fetch Cloud source parent failed:
77
77
  event: runtime
78
78
  data: ${JSON.stringify(P)}
79
79
 
80
- `;try{if(!y.response.write(C)){y.backpressured=!0;let k=s(()=>{y.drainListener=null,y.backpressured=!1,S(y)},"onDrain");y.drainListener=k,y.response.once("drain",k)}return!0}catch{return R(y),!1}}s(g,"writeSubscriberEvent");function R(y,P=!0){r.delete(y),y.drainListener&&(y.response.off("drain",y.drainListener),y.drainListener=null),y.backpressured=!1,y.pending=[],P&&!y.response.destroyed&&y.response.destroy()}s(R,"disconnectSubscriber");function I(y,P){return y.pending.push(P),y.pending.length<=CC?!0:(R(y),!1)}s(I,"queueSubscriberEvent");function S(y){for(;r.has(y)&&!y.backpressured&&y.pending.length>0;){let P=y.pending.shift();if(!P||!g(y,P))return}}s(S,"flushSubscriberQueue")}s(Ld,"createRuntimeEventBus");function $F(e){return e.name==="assistant.delta"&&!!e.output&&!e.action&&!e.args&&!e.status&&!e.error&&!e.relatedDeploymentId&&e.data===void 0}s($F,"isCoalescibleAssistantDelta");function DF(e){return[e.sessionId??"",e.turnId??"",e.source??"",e.appId??""].join("\0")}s(DF,"assistantDeltaKey");import{promises as Fd}from"node:fs";import Rn from"node:path";var NF=12e4,LF=15*1024*1024,EC=2*1024*1024,AC=new Map([[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".png","image/png"],[".webp","image/webp"]]),FF=new Set(AC.values()),UF=new Set(["application/javascript","application/json","application/ld+json","application/sql","application/toml","application/typescript","application/x-httpd-php","application/x-javascript","application/x-sh","application/x-yaml","application/xml","application/yaml"]),BF=new Set([".c",".cc",".cpp",".css",".csv",".go",".h",".html",".java",".js",".json",".jsx",".log",".md",".mdx",".php",".py",".rb",".rs",".sh",".sql",".toml",".ts",".tsx",".txt",".xml",".yaml",".yml"]);async function _C(e){let t=e.attachments??[];if(t.length===0)return[];let n=Rn.join(e.attachmentRootDir,Js(e.sessionId),Js(e.turnId)),r=new Set,o=[];for(let[a,i]of t.entries()){let l={...MC(i),...i.text?{text:i.text}:{}};if(i.contentsBase64){await Fd.mkdir(n,{recursive:!0});let d=KF(i.relativePath||i.name,r,a+1),u=Rn.join(n,d);await Fd.mkdir(Rn.dirname(u),{recursive:!0});let p=Buffer.from(i.contentsBase64,"base64"),m=await oy(e.storageHome,{owner:{domain:"chat_attachment",id:JSON.stringify([e.sessionId,e.turnId,d])},displayName:i.name,mediaType:i.mediaType,bytes:p});await lc(u,p),l.localPath=m.path,l.storageName=d}o.push(l)}return o}s(_C,"materializeChatAttachments");function OC(e,t){let n=new Map(t?.materialized.map(r=>[r.id,r])??[]);return(e??[]).map(r=>{let o=MC(r),a=n.get(r.id),i=jC(r.mediaType,a?.storageName??r.name);return t&&o.kind==="image"&&a?.localPath&&a.storageName&&i?{...o,imagePreview:{sessionId:t.sessionId,turnId:t.turnId,attachmentId:r.id,storageName:a.storageName,contentType:i}}:t&&a?.localPath&&a.storageName&&r.sizeBytes<=EC&&$C(r.mediaType,a.storageName)?{...o,filePreview:{sessionId:t.sessionId,turnId:t.turnId,attachmentId:r.id,storageName:a.storageName,contentType:r.mediaType}}:o})}s(OC,"chatAttachmentSummaries");function HC(e){if(!e||e.length===0)return"";let t=["<attachments>",`The user attached ${e.length} file${e.length===1?"":"s"} with this message.`],n=NF;for(let[r,o]of e.entries()){let a=o.localPath?` Saved locally at: ${o.localPath}`:"";t.push(`${r+1}. ${o.name} (${o.mediaType}, ${GF(o.sizeBytes)}, ${o.kind}).${a}`);let i=o.text?.trim();if(i&&n>0){let c=i.length>n?`${i.slice(0,Math.max(0,n-34))}
80
+ `;try{if(!y.response.write(C)){y.backpressured=!0;let k=s(()=>{y.drainListener=null,y.backpressured=!1,S(y)},"onDrain");y.drainListener=k,y.response.once("drain",k)}return!0}catch{return R(y),!1}}s(g,"writeSubscriberEvent");function R(y,P=!0){r.delete(y),y.drainListener&&(y.response.off("drain",y.drainListener),y.drainListener=null),y.backpressured=!1,y.pending=[],P&&!y.response.destroyed&&y.response.destroy()}s(R,"disconnectSubscriber");function I(y,P){return y.pending.push(P),y.pending.length<=CC?!0:(R(y),!1)}s(I,"queueSubscriberEvent");function S(y){for(;r.has(y)&&!y.backpressured&&y.pending.length>0;){let P=y.pending.shift();if(!P||!g(y,P))return}}s(S,"flushSubscriberQueue")}s(Ld,"createRuntimeEventBus");function $F(e){return(e.name==="assistant.delta"||e.name==="assistant.reasoning.delta")&&!!e.output&&!e.action&&!e.args&&!e.status&&!e.error&&!e.relatedDeploymentId&&e.data===void 0}s($F,"isCoalescibleAssistantDelta");function DF(e){return[e.name,e.sessionId??"",e.turnId??"",e.source??"",e.appId??""].join("\0")}s(DF,"assistantDeltaKey");import{promises as Fd}from"node:fs";import Rn from"node:path";var NF=12e4,LF=15*1024*1024,EC=2*1024*1024,AC=new Map([[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".png","image/png"],[".webp","image/webp"]]),FF=new Set(AC.values()),UF=new Set(["application/javascript","application/json","application/ld+json","application/sql","application/toml","application/typescript","application/x-httpd-php","application/x-javascript","application/x-sh","application/x-yaml","application/xml","application/yaml"]),BF=new Set([".c",".cc",".cpp",".css",".csv",".go",".h",".html",".java",".js",".json",".jsx",".log",".md",".mdx",".php",".py",".rb",".rs",".sh",".sql",".toml",".ts",".tsx",".txt",".xml",".yaml",".yml"]);async function _C(e){let t=e.attachments??[];if(t.length===0)return[];let n=Rn.join(e.attachmentRootDir,Js(e.sessionId),Js(e.turnId)),r=new Set,o=[];for(let[a,i]of t.entries()){let l={...MC(i),...i.text?{text:i.text}:{}};if(i.contentsBase64){await Fd.mkdir(n,{recursive:!0});let d=KF(i.relativePath||i.name,r,a+1),u=Rn.join(n,d);await Fd.mkdir(Rn.dirname(u),{recursive:!0});let p=Buffer.from(i.contentsBase64,"base64"),m=await oy(e.storageHome,{owner:{domain:"chat_attachment",id:JSON.stringify([e.sessionId,e.turnId,d])},displayName:i.name,mediaType:i.mediaType,bytes:p});await lc(u,p),l.localPath=m.path,l.storageName=d}o.push(l)}return o}s(_C,"materializeChatAttachments");function OC(e,t){let n=new Map(t?.materialized.map(r=>[r.id,r])??[]);return(e??[]).map(r=>{let o=MC(r),a=n.get(r.id),i=jC(r.mediaType,a?.storageName??r.name);return t&&o.kind==="image"&&a?.localPath&&a.storageName&&i?{...o,imagePreview:{sessionId:t.sessionId,turnId:t.turnId,attachmentId:r.id,storageName:a.storageName,contentType:i}}:t&&a?.localPath&&a.storageName&&r.sizeBytes<=EC&&$C(r.mediaType,a.storageName)?{...o,filePreview:{sessionId:t.sessionId,turnId:t.turnId,attachmentId:r.id,storageName:a.storageName,contentType:r.mediaType}}:o})}s(OC,"chatAttachmentSummaries");function HC(e){if(!e||e.length===0)return"";let t=["<attachments>",`The user attached ${e.length} file${e.length===1?"":"s"} with this message.`],n=NF;for(let[r,o]of e.entries()){let a=o.localPath?` Saved locally at: ${o.localPath}`:"";t.push(`${r+1}. ${o.name} (${o.mediaType}, ${GF(o.sizeBytes)}, ${o.kind}).${a}`);let i=o.text?.trim();if(i&&n>0){let c=i.length>n?`${i.slice(0,Math.max(0,n-34))}
81
81
  [attachment text truncated]`:i;t.push("Text content:"),t.push("~~~text"),t.push(c),t.push("~~~"),n-=c.length}}return t.push("</attachments>"),t.join(`
82
82
  `)}s(HC,"chatAttachmentContext");function Ys(e,t){let n=e.trim()||"Please review the attached files.",r=t.trim();return r?`${n}
83
83
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
3
- import{a as LA,b as AC,c as CC,d as MC,e as DC,f as LC,g as BC,h as $C,i as NC,j as UC}from"./chunk-UBFRWC6I.js";import{a as _t,b as fd,c as Xn,d as Zp,e as em,f as Uo}from"./chunk-IOQUF34U.js";import{a as oj,b as aj,c as ij,d as O,e as sj,f as Wo,g as V,h as hm,j as cj}from"./chunk-42GOV5ZU.js";import{$ as qo,$a as hM,$b as Ba,A as e0,Aa as W0,Ab as LM,B as t0,Ba as V0,Bb as BM,C as r0,Ca as G0,Cb as Cy,D as n0,Da as J0,Db as $M,E as o0,Ea as K0,Eb as NM,F as a0,Fa as Y0,Fb as UM,G as d0,Ga as X0,Gb as qM,H as l0,Ha as Q0,Hb as FM,I as us,Ia as Z0,Ib as zo,J as ps,Ja as eM,Jb as Zn,K as u0,Ka as Mr,Kb as My,L as am,La as jr,Lb as zM,M as p0,Ma as Se,Mb as WM,N as m0,Na as tM,Nb as jy,O as im,Oa as rM,Ob as VM,P as f0,Pa as nM,Pb as GM,Q as g0,Qa as oM,Qb as JM,R as h0,Ra as sM,Rb as La,S as w0,Sa as cM,Sb as KM,T as y0,Ta as dM,Tb as En,U as v0,Ua as lM,Ub as pm,V as k0,Va as uM,Vb as fs,W as b0,Wa as pM,Wb as YM,X as vd,Xa as Ey,Xb as mm,Y as I0,Ya as mM,Yb as fm,Z as S0,Za as fM,Zb as gm,_ as P0,_a as gM,_b as An,a as FC,aa as R0,ab as wM,ac as Hy,b as tm,ba as x0,bb as yM,bc as Oy,c as rm,ca as _0,cb as vM,cc as kd,d as nm,da as T0,db as rn,dc as Dy,e as zC,ea as E0,eb as kM,ec as XM,f as WC,fa as A0,fb as um,fc as QM,g as VC,ga as C0,gb as bM,gc as ZM,h as GC,ha as M0,hb as IM,hc as ej,i as Ry,ia as ms,ib as Qt,ic as tj,j as Oa,ja as j0,jb as Da,jc as rj,k as xy,ka as H0,kb as SM,l as gd,la as O0,lb as Qn,lc as nj,m as hd,ma as D0,mb as PM,n as ls,na as sm,nb as RM,o as om,oa as L0,ob as xM,p as _y,pa as B0,pb as _M,q as wd,qa as $0,qb as TM,r as JC,ra as N0,rb as EM,s as se,sa as U0,sb as AM,t as KC,ta as cm,tb as Ay,u as yd,ua as q0,ub as CM,v as YC,va as Fo,vb as MM,w as XC,wa as je,wb as jM,x as OG,xa as F0,xb as HM,y as QC,ya as we,yb as OM,z as ZC,za as z0,zb as DM}from"./chunk-V67DJQQ3.js";import{A as GA,B as Kn,C as qp,D as JA,E as Bo,F as Fp,G as KA,Ga as ky,Ha as by,K as YA,La as kC,M as XA,N as QA,Na as bC,O as zp,Oa as IC,P as Wp,Q as ZA,Qa as Iy,Ra as SC,S as Q,Sa as PC,T as Vp,U as Gp,Ua as RC,V as $o,Va as Sy,W as eC,X as tC,Xa as xC,Ya as _C,Za as TC,_a as EC,a as Sw,ab as Qp,b as tR,ba as rC,c as rR,ca as No,d as nR,e as oR,ea as nC,f as aR,fa as oC,fb as HC,g as iR,ga as gy,gb as Yn,h as ba,hb as OC,i as sR,j as cR,k as _u,l as dR,m as lR,ob as qC,p as OA,pa as yC,pb as Py,q as Bp,u as DA,ua as vC,v as ss,y as Up,ya as Xp,z as _n}from"./chunk-TBNBCOW7.js";import{b as jC}from"./chunk-EMKZVP7Z.js";import{a as Xe,b as i0,c as s0,d as c0,h as Ty,i as aM,j as dm,k as lm,l as iM}from"./chunk-JCCU3VFK.js";import"./chunk-O7VGFMDO.js";import{a as Xt,b as BA,c as $A,d as $p,e as Np,g as NA,h as Lo,j as UA,k as qA,l as FA,m as zA,n as WA,o as VA}from"./chunk-DLZP22WV.js";import{a as PA,d as RA,e as Ha,h as CA}from"./chunk-ZCWHVLJ4.js";import{f as Hp,i as SA,j as tn}from"./chunk-OE2VF6KU.js";import{a as en,b as Op,c as my,d as xA}from"./chunk-T5LE6R5S.js";import{d as _A,e as TA,f as EA,g as Dp,h as AA}from"./chunk-QJRXTIOC.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{d as IA}from"./chunk-7K72KS5C.js";import{a as Lp,b as HA,c as fy}from"./chunk-XM26DGML.js";import{c as MA,d as jA}from"./chunk-EPY7M5XS.js";import{$ as ud,A as pA,B as mA,C as fA,R as Ap,U as Cp,X as gA,Y as hA,Z as as,_ as Mp,ba as pd,ca as ja,da as wA,ea as yA,fa as vA,ga as jp,h as eA,ma as kA,na as bA,o as Jn,p as nA,q as oA,qa as is,r as aA,ra as py,s as iA,t as sA,u as cA,v as dA,w as lA,x as uA,y as ld,z as Do}from"./chunk-7MXZJQS7.js";import"./chunk-7YR6CBNU.js";import{A as uC,C as Kp,F as Yp,G as Tn,H as pC,I as hy,J as mC,K as wy,N as fC,O as yy,P as gC,Q as hC,R as wC,S as vy,T as ds,b as Jp,d as aC,e as iC,h as sC,m as cs,n as cC,p as dC,q as lC,s as md}from"./chunk-2ZJJFBIA.js";import{a as tA,b as Ep,d as de,e as gt,f as os,g as ie,i as rA}from"./chunk-5CMKGD43.js";import"./chunk-XEOEKFG6.js";import{A as zE,B as _p,C as WE,D as uy,E as VE,F as GE,G as xt,H as JE,I as Ke,J as rt,K as KE,L as YE,M as dd,N as Tp,O as XE,Q as QE,R as ZE,S as Zr,c as ME,l as jE,m as HE,n as OE,r as DE,s as LE,t as BE,u as $E,v as ly,w as NE,x as UE,y as qE,z as FE}from"./chunk-HA7EFTPF.js";import{b as AE,c as CE}from"./chunk-L3KS6MOV.js";import{a as _E,d as TE,f as EE}from"./chunk-7QEE4PBI.js";import{$ as g_,$a as V_,$b as CT,$c as QT,Aa as L_,Ab as fT,Ba as Jw,Bb as gT,Ca as sp,Cb as hT,Da as B_,Ea as Qr,Eb as pp,F as i_,Fa as cp,Fb as bT,Ga as Kw,H as s_,Ha as dp,Hb as IT,I as Gw,Ib as td,Ja as lp,Jb as ny,Jd as dE,K as Ye,Ka as Qc,L as Vn,Ld as wE,M as Yi,Ma as $_,Mb as mp,Mc as Ca,Md as id,N as c_,Nc as WT,Nd as yE,Ob as oy,Oc as Gn,Od as sd,P as d_,Pa as N_,Pb as ST,Pc as VT,Pd as vE,Qa as U_,Qb as PT,Qc as GT,Qd as dy,Ra as q_,Rc as JT,Rd as kE,Sc as Ho,Sd as cd,T as l_,Ta as Xi,Tb as fp,Tc as rs,Td as bE,Ua as F_,Ub as RT,Uc as vp,Ud as Rp,V as op,Vb as ay,Vc as KT,Vd as IE,W as u_,Wa as Zc,Wb as Rn,Wc as YT,Wd as SE,Xa as up,Xb as xT,Xc as XT,Xd as PE,Y as p_,Ya as z_,Yb as _T,Yc as od,Yd as RE,Z as m_,Za as Yw,Zb as iy,Zc as ns,Zd as xp,_ as f_,_a as W_,_b as nd,_c as kp,_d as xE,aa as h_,ab as Xw,ac as wp,ad as bp,ba as w_,bb as G_,bc as MT,bd as Oo,ca as y_,cb as J_,cc as jT,cd as ZT,d as Gx,da as ap,db as K_,dc as es,dd as eE,ea as v_,eb as Y_,ec as HT,ed as tE,f as tp,fa as Pn,fb as X_,fc as yp,fd as Ip,gb as Q_,gc as OT,gd as rE,h as Xx,ha as k_,hb as Z_,hc as DT,hd as ad,ia as b_,ib as Qw,ic as sy,id as nE,ja as I_,jb as eT,jd as oE,k as Ww,ka as S_,kb as tT,kc as LT,l as Zx,lb as rT,lc as Ft,m as Yt,ma as P_,mb as nT,n as Ta,na as ip,nb as Zw,nc as BT,o as Ea,oa as R_,ob as oT,oc as $T,p as Vw,pa as x_,pb as aT,pc as NT,q as e_,qa as __,qb as iT,qc as cy,r as t_,ra as T_,rb as sT,rc as UT,s as r_,sa as E_,sb as cT,sc as qT,sd as Sp,t as n_,ta as A_,tb as dT,tc as FT,td as aE,u as o_,ua as C_,ub as lT,ud as iE,v as a_,va as M_,vb as uT,vc as ts,vd as xn,w as rp,wa as j_,wb as pT,wc as zT,wd as sE,xa as H_,xb as mT,xd as Ma,y as np,ya as O_,yb as ey,yd as cE,za as D_,zb as Aa}from"./chunk-XDMUD4FW.js";import{M as Qi,N as ed,O as yT,P as vT,Q as kT,S as ty,U as ry,V as rd,aa as TT,da as ET,e as zx,ga as Zi,ha as AT,i as Wx,j as Vx,ja as gp,k as Jx,l as Kx,m as Ar,n as Zu,na as hp,pa as lE,q as _a,qa as Cr,r as Xc,ra as uE,s as zw,sa as pE,t as ep,ta as Pp,u as Yx,ua as mE,y as Qx}from"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import{$b as Ox,Aa as Lu,Ab as Ex,Ac as gE,Ba as hx,Ca as qe,Cb as Ax,D as Aw,Dc as hE,Ea as wx,Fb as Vu,G as Sn,Ha as yx,Hb as Gu,Ia as Kt,Ib as Ju,Jb as Ji,Kb as Ow,Lb as Dw,Mb as Ku,Nb as Lw,Ob as Bw,Pb as $w,Q as tx,Qa as Co,Qb as Nw,R as rx,Ra as vx,Rb as Uw,S as nx,Sa as Bu,Sb as qw,T as ox,Ta as Xr,Tb as Cx,U as ax,Ub as Mx,V as Du,Va as $u,Vb as Ki,W as Cw,Wb as jx,X as ix,Xb as Hx,Y as sx,Yb as Yu,Z as cx,Zb as Xu,_b as Qu,a as Hu,ac as Fw,b as xa,bc as Dx,ca as dx,d as YR,db as Nu,dc as Lx,ea as Vi,eb as Mw,ec as Bx,fb as kx,fc as $x,ga as lx,gb as bx,gc as Nx,h as XR,hb as Uu,hc as Ux,ia as ux,ib as Ix,ic as Mo,j as Tw,jb as qu,jc as qx,k as qt,ka as px,kc as Fx,l as Gc,lb as Gi,lc as ir,m as Er,ma as mx,mb as Sx,mc as wT,na as fx,nb as Px,ob as Fu,pb as zu,pc as jo,q as QR,qb as jw,rb as Hw,sb as Rx,t as Jc,tc as fE,u as ZR,ua as gx,ub as xx,v as Ou,vb as _x,x as ex,xa as Ao,xb as Wu,y as Ew,ya as Kc,yb as Tx,z as Eo}from"./chunk-QRWPEW3Z.js";import{a as Yc}from"./chunk-6FA3GG5B.js";import{b as pu,e as aP,f as iP,g as sP,l as $i,m as cP,n as dP,p as lP,q as mu,r as fu}from"./chunk-PYABBF53.js";import{b as KP,c as XP}from"./chunk-YL6VFJ4P.js";import{j as KR}from"./chunk-Z3D4C7BG.js";import{A as YP,D as QP,K as ZP,V as eR,Y as uR,Z as Tu,aa as Pw,ba as pR,ca as mR,da as fR,ea as Eu,fa as gR,ga as hR,ha as wR,i as MP,ia as yR,k as Ni,n as jP,o as Pu,t as HP}from"./chunk-WV2APYWG.js";import{$ as bP,Aa as _P,B as gP,Bd as JP,C as hP,Da as Su,G as fw,H as gw,I as hw,J as ww,Jb as UP,K as yw,Ka as TP,L as vw,La as EP,Lb as Ru,M as kw,Ma as AP,N as bw,Na as CP,Q as wP,Qa as OP,Ta as DP,U as yP,Uc as qP,Va as LP,Vc as To,W as vP,Wa as BP,Wc as Ze,Xc as FP,Y as kP,_ as ku,_c as zP,a as xe,aa as IP,b as _o,ba as SP,ea as bu,g as uP,ga as zc,gd as Ui,hd as zn,i as pP,id as qi,ja as PP,la as Tr,n as mP,nd as WP,o as gu,p as hu,pa as Iu,pb as $P,pd as VP,q as wu,qa as RP,r as yu,u as vu,ua as Iw,ud as GP,v as mw,vb as Oe,w as va,wb as ft,x as ka,ya as xP,yb as NP,z as fP,zc as xu}from"./chunk-PJM2G7SG.js";import{Ba as rP,Ia as HG,Ja as nP,Ka as uw,La as pw,Na as oP,S as lw,ra as tP,sa as xo,xa as uu}from"./chunk-SDEDAHV6.js";import{C as $R,D as NR,I as qR,K as xw,L as _w,M as FR,Z as zR,_ as WR,ca as VR,da as GR,f as SR,fa as Ra,ga as JR,ha as ju,v as zi,x as Vc}from"./chunk-DALJMSJG.js";import{H as HR,L as Fi,N as OR,P as DR,Q as LR,R as BR,a as Sa,b as PR,c as Wc,d as Wn,e as RR,f as xR,g as _R,h as TR,i as Au,k as ER,l as AR,m as CR,n as MR,o as jR,y as Rw}from"./chunk-TGIB24K4.js";import{b as Li,c as Bi,d as cw,e as cu,f as mt,g as dw,h as ZS,k as Je,l as be,m as E,n as du,p as eP,q as lu,r as Ut}from"./chunk-NNF6KCHD.js";import{a as Rt,b as k}from"./chunk-ES2ISFJC.js";import{a as vR,c as Ia,f as kR,h as bR,i as IR,n as Cu,p as Wi,q as UR,r as Pa,s as Mu}from"./chunk-H7IWJN7L.js";import{a as i,b as Ee,c as Me,e as Yr}from"./chunk-FTQLQJQV.js";var go=Me((Qqe,JN)=>{"use strict";var VN=["nodebuffer","arraybuffer","fragments"],GN=typeof Blob<"u";GN&&VN.push("blob");JN.exports={BINARY_TYPES:VN,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:GN,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var fl=Me((eFe,wg)=>{"use strict";var{EMPTY_BUFFER:fZ}=go(),rb=Buffer[Symbol.species];function gZ(e,t){if(e.length===0)return fZ;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let a=e[o];r.set(a,n),n+=a.length}return n<t?new rb(r.buffer,r.byteOffset,n):r}i(gZ,"concat");function KN(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(KN,"_mask");function YN(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(YN,"_unmask");function hZ(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(hZ,"toArrayBuffer");function nb(e){if(nb.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new rb(e):ArrayBuffer.isView(e)?t=new rb(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),nb.readOnly=!1),t}i(nb,"toBuffer");wg.exports={concat:gZ,mask:KN,toArrayBuffer:hZ,toBuffer:nb,unmask:YN};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Ee("bufferutil");wg.exports.mask=function(t,r,n,o,a){a<48?KN(t,r,n,o,a):e.mask(t,r,n,o,a)},wg.exports.unmask=function(t,r){t.length<32?YN(t,r):e.unmask(t,r)}}catch{}});var ZN=Me((rFe,QN)=>{"use strict";var XN=Symbol("kDone"),ob=Symbol("kRun"),ab=class{static{i(this,"Limiter")}constructor(t){this[XN]=()=>{this.pending--,this[ob]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[ob]()}[ob](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[XN])}}};QN.exports=ab});var oc=Me((oFe,nU)=>{"use strict";var gl=Ee("zlib"),eU=fl(),wZ=ZN(),{kStatusCode:tU}=go(),yZ=Buffer[Symbol.species],vZ=Buffer.from([0,0,255,255]),vg=Symbol("permessage-deflate"),ho=Symbol("total-length"),rc=Symbol("callback"),ca=Symbol("buffers"),nc=Symbol("error"),yg,ib=class{static{i(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yg){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yg=new wZ(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[rc];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){yg.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){yg.add(o=>{this._compress(t,r,(a,s)=>{o(),n(a,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?gl.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=gl.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[vg]=this,this._inflate[ho]=0,this._inflate[ca]=[],this._inflate.on("error",bZ),this._inflate.on("data",rU)}this._inflate[rc]=n,this._inflate.write(t),r&&this._inflate.write(vZ),this._inflate.flush(()=>{let a=this._inflate[nc];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=eU.concat(this._inflate[ca],this._inflate[ho]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ho]=0,this._inflate[ca]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?gl.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=gl.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[ho]=0,this._deflate[ca]=[],this._deflate.on("data",kZ)}this._deflate[rc]=n,this._deflate.write(t),this._deflate.flush(gl.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=eU.concat(this._deflate[ca],this._deflate[ho]);r&&(a=new yZ(a.buffer,a.byteOffset,a.length-4)),this._deflate[rc]=null,this._deflate[ho]=0,this._deflate[ca]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};nU.exports=ib;function kZ(e){this[ca].push(e),this[ho]+=e.length}i(kZ,"deflateOnData");function rU(e){if(this[ho]+=e.length,this[vg]._maxPayload<1||this[ho]<=this[vg]._maxPayload){this[ca].push(e);return}this[nc]=new RangeError("Max payload size exceeded"),this[nc].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[nc][tU]=1009,this.removeListener("data",rU),this.reset()}i(rU,"inflateOnData");function bZ(e){if(this[vg]._inflate=null,this[nc]){this[rc](this[nc]);return}e[tU]=1007,this[rc](e)}i(bZ,"inflateOnError")});var ac=Me((iFe,kg)=>{"use strict";var{isUtf8:oU}=Ee("buffer"),{hasBlob:IZ}=go(),SZ=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function PZ(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(PZ,"isValidStatusCode");function sb(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}i(sb,"_isValidUTF8");function RZ(e){return IZ&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(RZ,"isBlob");kg.exports={isBlob:RZ,isValidStatusCode:PZ,isValidUTF8:sb,tokenChars:SZ};if(oU)kg.exports.isValidUTF8=function(e){return e.length<24?sb(e):oU(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Ee("utf-8-validate");kg.exports.isValidUTF8=function(t){return t.length<32?sb(t):e(t)}}catch{}});var pb=Me((cFe,uU)=>{"use strict";var{Writable:xZ}=Ee("stream"),aU=oc(),{BINARY_TYPES:_Z,EMPTY_BUFFER:iU,kStatusCode:TZ,kWebSocket:EZ}=go(),{concat:cb,toArrayBuffer:AZ,unmask:CZ}=fl(),{isValidStatusCode:MZ,isValidUTF8:sU}=ac(),bg=Buffer[Symbol.species],Nr=0,cU=1,dU=2,lU=3,db=4,lb=5,Ig=6,ub=class extends xZ{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||_Z[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[EZ]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Nr}_write(t,r,n){if(this._opcode===8&&this._state==Nr)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new bg(n.buffer,n.byteOffset+t,n.length-t),new bg(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new bg(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Nr:this.getInfo(t);break;case cU:this.getPayloadLength16(t);break;case dU:this.getPayloadLength64(t);break;case lU:this.getMask();break;case db:this.getData(t);break;case lb:case Ig:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[aU.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=cU:this._payloadLength===127?this._state=dU:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=lU:this._state=db}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=db}getData(t){let r=iU;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&CZ(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=lb,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[aU.extensionName].decompress(t,this._fin,(o,a)=>{if(o)return r(o);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}this._fragments.push(a)}this.dataMessage(r),this._state===Nr&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Nr;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=cb(n,r):this._binaryType==="arraybuffer"?o=AZ(cb(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Nr):(this._state=Ig,setImmediate(()=>{this.emit("message",o,!0),this._state=Nr,this.startLoop(t)}))}else{let o=cb(n,r);if(!this._skipUTF8Validation&&!sU(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===lb||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Nr):(this._state=Ig,setImmediate(()=>{this.emit("message",o,!1),this._state=Nr,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,iU),this.end();else{let n=t.readUInt16BE(0);if(!MZ(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new bg(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!sU(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Nr;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Nr):(this._state=Ig,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Nr,this.startLoop(r)}))}createError(t,r,n,o,a){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=a,s[TZ]=o,s}};uU.exports=ub});var gb=Me((uFe,fU)=>{"use strict";var{Duplex:lFe}=Ee("stream"),{randomFillSync:jZ}=Ee("crypto"),{types:{isUint8Array:HZ}}=Ee("util"),pU=oc(),{EMPTY_BUFFER:OZ,kWebSocket:DZ,NOOP:LZ}=go(),{isBlob:ic,isValidStatusCode:BZ}=ac(),{mask:mU,toBuffer:ci}=fl(),Ur=Symbol("kByteLength"),$Z=Buffer.alloc(4),Sg=8*1024,di,sc=Sg,un=0,NZ=1,UZ=2,mb=class e{static{i(this,"Sender")}constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=un,this.onerror=LZ,this[DZ]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||$Z,r.generateMask?r.generateMask(n):(sc===Sg&&(di===void 0&&(di=Buffer.alloc(Sg)),jZ(di,0,Sg),sc=0),n[0]=di[sc++],n[1]=di[sc++],n[2]=di[sc++],n[3]=di[sc++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[Ur]!==void 0?c=r[Ur]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!s);let d=c;c>=65536?(a+=8,d=127):c>125&&(a+=2,d=126);let l=Buffer.allocUnsafe(o?c+a:a);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),r.mask?(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],s?[l,t]:o?(mU(t,n,l,a,c),[l]):(mU(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=OZ;else{if(typeof t!="number"||!BZ(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+c),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(HZ(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[Ur]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==un?this.enqueue([this.dispatch,a,!1,s,o]):this.sendFrame(e.frame(a,s),o)}ping(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):ic(t)?(o=t.size,a=!1):(t=ci(t),o=t.length,a=ci.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[Ur]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};ic(t)?this._state!==un?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==un?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):ic(t)?(o=t.size,a=!1):(t=ci(t),o=t.length,a=ci.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[Ur]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};ic(t)?this._state!==un?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==un?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[pU.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):ic(t)?(c=t.size,d=!1):(t=ci(t),c=t.length,d=ci.readOnly),this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=c>=o._threshold),this._compress=s):(s=!1,a=0),r.fin&&(this._firstFragment=!0);let l={[Ur]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};ic(t)?this._state!==un?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==un?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[Ur],this._state=UZ,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(fb,this,c,o);return}this._bufferedBytes-=n[Ur];let s=ci(a);r?this.dispatch(s,r,n,o):(this._state=un,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(qZ,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[pU.extensionName];this._bufferedBytes+=n[Ur],this._state=NZ,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");fb(this,d,o);return}this._bufferedBytes-=n[Ur],this._state=un,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===un&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Ur],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Ur],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};fU.exports=mb;function fb(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],a=o[o.length-1];typeof a=="function"&&a(t)}}i(fb,"callCallbacks");function qZ(e,t,r){fb(e,t,r),e.onerror(t)}i(qZ,"onError")});var SU=Me((mFe,IU)=>{"use strict";var{kForOnEventAttribute:hl,kListener:hb}=go(),gU=Symbol("kCode"),hU=Symbol("kData"),wU=Symbol("kError"),yU=Symbol("kMessage"),vU=Symbol("kReason"),cc=Symbol("kTarget"),kU=Symbol("kType"),bU=Symbol("kWasClean"),wo=class{static{i(this,"Event")}constructor(t){this[cc]=null,this[kU]=t}get target(){return this[cc]}get type(){return this[kU]}};Object.defineProperty(wo.prototype,"target",{enumerable:!0});Object.defineProperty(wo.prototype,"type",{enumerable:!0});var li=class extends wo{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[gU]=r.code===void 0?0:r.code,this[vU]=r.reason===void 0?"":r.reason,this[bU]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[gU]}get reason(){return this[vU]}get wasClean(){return this[bU]}};Object.defineProperty(li.prototype,"code",{enumerable:!0});Object.defineProperty(li.prototype,"reason",{enumerable:!0});Object.defineProperty(li.prototype,"wasClean",{enumerable:!0});var dc=class extends wo{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[wU]=r.error===void 0?null:r.error,this[yU]=r.message===void 0?"":r.message}get error(){return this[wU]}get message(){return this[yU]}};Object.defineProperty(dc.prototype,"error",{enumerable:!0});Object.defineProperty(dc.prototype,"message",{enumerable:!0});var wl=class extends wo{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[hU]=r.data===void 0?null:r.data}get data(){return this[hU]}};Object.defineProperty(wl.prototype,"data",{enumerable:!0});var FZ={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[hl]&&o[hb]===t&&!o[hl])return;let n;if(e==="message")n=i(function(a,s){let c=new wl("message",{data:s?a:a.toString()});c[cc]=this,Pg(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new li("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[cc]=this,Pg(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new dc("error",{error:a,message:a.message});s[cc]=this,Pg(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new wo("open");a[cc]=this,Pg(t,this,a)},"onOpen");else return;n[hl]=!!r[hl],n[hb]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[hb]===t&&!r[hl]){this.removeListener(e,r);break}}};IU.exports={CloseEvent:li,ErrorEvent:dc,Event:wo,EventTarget:FZ,MessageEvent:wl};function Pg(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(Pg,"callListener")});var Rg=Me((gFe,PU)=>{"use strict";var{tokenChars:yl}=ac();function Ln(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(Ln,"push");function zZ(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,a=!1,s,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),s===void 0)if(u===-1&&yl[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let w=e.slice(d,u);l===44?(Ln(t,w,r),r=Object.create(null)):s=w,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&yl[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),Ln(r,e.slice(d,u),!0),l===44&&(Ln(t,s,r),r=Object.create(null),s=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(yl[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(yl[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)a=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)a=!0;else if(u===-1&&yl[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let w=e.slice(d,u);n&&(w=w.replace(/\\/g,""),n=!1),Ln(r,c,w),l===44&&(Ln(t,s,r),r=Object.create(null),s=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return s===void 0?Ln(t,m,r):(c===void 0?Ln(r,m,!0):n?Ln(r,c,m.replace(/\\/g,"")):Ln(r,c,m),Ln(t,s,r)),t}i(zZ,"parse");function WZ(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let a=n[o];return Array.isArray(a)||(a=[a]),a.map(s=>s===!0?o:`${o}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}i(WZ,"format");PU.exports={format:WZ,parse:zZ}});var Eg=Me((vFe,DU)=>{"use strict";var VZ=Ee("events"),GZ=Ee("https"),JZ=Ee("http"),_U=Ee("net"),KZ=Ee("tls"),{randomBytes:YZ,createHash:XZ}=Ee("crypto"),{Duplex:wFe,Readable:yFe}=Ee("stream"),{URL:wb}=Ee("url"),da=oc(),QZ=pb(),ZZ=gb(),{isBlob:eee}=ac(),{BINARY_TYPES:RU,CLOSE_TIMEOUT:tee,EMPTY_BUFFER:xg,GUID:ree,kForOnEventAttribute:yb,kListener:nee,kStatusCode:oee,kWebSocket:kt,NOOP:TU}=go(),{EventTarget:{addEventListener:aee,removeEventListener:iee}}=SU(),{format:see,parse:cee}=Rg(),{toBuffer:dee}=fl(),EU=Symbol("kAborted"),vb=[8,13],yo=["CONNECTING","OPEN","CLOSING","CLOSED"],lee=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Qe=class e extends VZ{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=RU[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xg,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),AU(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){RU.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let o=new QZ({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),a=new ZZ(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[kt]=this,a[kt]=this,t[kt]=this,o.on("conclude",mee),o.on("drain",fee),o.on("error",gee),o.on("message",hee),o.on("ping",wee),o.on("pong",yee),a.onerror=vee,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",jU),t.on("data",Tg),t.on("end",HU),t.on("error",OU),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[da.extensionName]&&this._extensions[da.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){kr(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),MU(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kb(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||xg,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kb(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||xg,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kb(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[da.extensionName]||(o.compress=!1),this._sender.send(t||xg,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){kr(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(Qe,"CONNECTING",{enumerable:!0,value:yo.indexOf("CONNECTING")});Object.defineProperty(Qe.prototype,"CONNECTING",{enumerable:!0,value:yo.indexOf("CONNECTING")});Object.defineProperty(Qe,"OPEN",{enumerable:!0,value:yo.indexOf("OPEN")});Object.defineProperty(Qe.prototype,"OPEN",{enumerable:!0,value:yo.indexOf("OPEN")});Object.defineProperty(Qe,"CLOSING",{enumerable:!0,value:yo.indexOf("CLOSING")});Object.defineProperty(Qe.prototype,"CLOSING",{enumerable:!0,value:yo.indexOf("CLOSING")});Object.defineProperty(Qe,"CLOSED",{enumerable:!0,value:yo.indexOf("CLOSED")});Object.defineProperty(Qe.prototype,"CLOSED",{enumerable:!0,value:yo.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(Qe.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(Qe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[yb])return t[nee];return null},set(t){for(let r of this.listeners(e))if(r[yb]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[yb]:!0})}})});Qe.prototype.addEventListener=aee;Qe.prototype.removeEventListener=iee;DU.exports=Qe;function AU(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:tee,protocolVersion:vb[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!vb.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${vb.join(", ")})`);let a;if(t instanceof wb)a=t;else try{a=new wb(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let s=a.protocol==="wss:",c=a.protocol==="ws+unix:",d;if(a.protocol!=="ws:"&&!s&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;_g(e,h);return}let l=s?443:80,u=YZ(16).toString("base64"),p=s?GZ.request:JZ.request,m=new Set,w;if(o.createConnection=o.createConnection||(s?pee:uee),o.defaultPort=o.defaultPort||l,o.port=a.port||l,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(w=new da({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=see({[da.extensionName]:w.offer()})),r.length){for(let h of r){if(typeof h!="string"||!lee.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let g;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?o.socketPath:a.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,f]of Object.entries(h))n.headers[y.toLowerCase()]=f}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),g=e._req=p(o),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(o);o.timeout&&g.on("timeout",()=>{kr(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[EU]||(g=e._req=null,_g(e,h))}),g.on("response",h=>{let y=h.headers.location,f=h.statusCode;if(y&&o.followRedirects&&f>=300&&f<400){if(++e._redirects>o.maxRedirects){kr(e,g,"Maximum redirects exceeded");return}g.abort();let P;try{P=new wb(y,t)}catch{let b=new SyntaxError(`Invalid URL: ${y}`);_g(e,b);return}AU(e,P,r,n)}else e.emit("unexpected-response",g,h)||kr(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,f)=>{if(e.emit("upgrade",h),e.readyState!==Qe.CONNECTING)return;g=e._req=null;let P=h.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){kr(e,y,"Invalid Upgrade header");return}let S=XZ("sha1").update(u+ree).digest("base64");if(h.headers["sec-websocket-accept"]!==S){kr(e,y,"Invalid Sec-WebSocket-Accept header");return}let b=h.headers["sec-websocket-protocol"],v;if(b!==void 0?m.size?m.has(b)||(v="Server sent an invalid subprotocol"):v="Server sent a subprotocol but none was requested":m.size&&(v="Server sent no subprotocol"),v){kr(e,y,v);return}b&&(e._protocol=b);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!w){kr(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let A;try{A=cee(R)}catch{kr(e,y,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(A);if(I.length!==1||I[0]!==da.extensionName){kr(e,y,"Server indicated an extension that was not requested");return}try{w.accept(A[da.extensionName])}catch{kr(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[da.extensionName]=w}e.setSocket(y,f,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(g,e):g.end()}i(AU,"initAsClient");function _g(e,t){e._readyState=Qe.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(_g,"emitErrorAndClose");function uee(e){return e.path=e.socketPath,_U.connect(e)}i(uee,"netConnect");function pee(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=_U.isIP(e.host)?"":e.host),KZ.connect(e)}i(pee,"tlsConnect");function kr(e,t,r){e._readyState=Qe.CLOSING;let n=new Error(r);Error.captureStackTrace(n,kr),t.setHeader?(t[EU]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(_g,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(kr,"abortHandshake");function kb(e,t,r){if(t){let n=eee(t)?t.size:dee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${yo[e.readyState]})`);process.nextTick(r,n)}}i(kb,"sendAfterClose");function mee(e,t){let r=this[kt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[kt]!==void 0&&(r._socket.removeListener("data",Tg),process.nextTick(CU,r._socket),e===1005?r.close():r.close(e,t))}i(mee,"receiverOnConclude");function fee(){let e=this[kt];e.isPaused||e._socket.resume()}i(fee,"receiverOnDrain");function gee(e){let t=this[kt];t._socket[kt]!==void 0&&(t._socket.removeListener("data",Tg),process.nextTick(CU,t._socket),t.close(e[oee])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(gee,"receiverOnError");function xU(){this[kt].emitClose()}i(xU,"receiverOnFinish");function hee(e,t){this[kt].emit("message",e,t)}i(hee,"receiverOnMessage");function wee(e){let t=this[kt];t._autoPong&&t.pong(e,!this._isServer,TU),t.emit("ping",e)}i(wee,"receiverOnPing");function yee(e){this[kt].emit("pong",e)}i(yee,"receiverOnPong");function CU(e){e.resume()}i(CU,"resume");function vee(e){let t=this[kt];t.readyState!==Qe.CLOSED&&(t.readyState===Qe.OPEN&&(t._readyState=Qe.CLOSING,MU(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(vee,"senderOnError");function MU(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(MU,"setCloseTimer");function jU(){let e=this[kt];if(this.removeListener("close",jU),this.removeListener("data",Tg),this.removeListener("end",HU),e._readyState=Qe.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[kt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",xU),e._receiver.on("finish",xU))}i(jU,"socketOnClose");function Tg(e){this[kt]._receiver.write(e)||this.pause()}i(Tg,"socketOnData");function HU(){let e=this[kt];e._readyState=Qe.CLOSING,e._receiver.end(),this.end()}i(HU,"socketOnEnd");function OU(){let e=this[kt];this.removeListener("error",OU),this.on("error",TU),e&&(e._readyState=Qe.CLOSING,this.destroy())}i(OU,"socketOnError")});var NU=Me((IFe,$U)=>{"use strict";var bFe=Eg(),{Duplex:kee}=Ee("stream");function LU(e){e.emit("close")}i(LU,"emitClose");function bee(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(bee,"duplexOnEnd");function BU(e){this.removeListener("error",BU),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(BU,"duplexOnError");function Iee(e,t){let r=!0,n=new kee({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",i(function(a,s){let c=!s&&n._readableState.objectMode?a.toString():a;n.push(c)||e.pause()},"message")),e.once("error",i(function(a){n.destroyed||(r=!1,n.destroy(a))},"error")),e.once("close",i(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(o,a){if(e.readyState===e.CLOSED){a(o),process.nextTick(LU,n);return}let s=!1;e.once("error",i(function(d){s=!0,a(d)},"error")),e.once("close",i(function(){s||a(o),process.nextTick(LU,n)},"close")),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",i(function(){o()},"finish")),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,a,s){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._write(o,a,s)},"open"));return}e.send(o,s)},n.on("end",bee),n.on("error",BU),n}i(Iee,"createWebSocketStream");$U.exports=Iee});var bb=Me((PFe,UU)=>{"use strict";var{tokenChars:See}=ac();function Pee(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let s=e.charCodeAt(o);if(n===-1&&See[s]===1)r===-1&&(r=o);else if(o!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=o);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}i(Pee,"parse");UU.exports={parse:Pee}});var JU=Me((_Fe,GU)=>{"use strict";var Ree=Ee("events"),Ag=Ee("http"),{Duplex:xFe}=Ee("stream"),{createHash:xee}=Ee("crypto"),qU=Rg(),ui=oc(),_ee=bb(),Tee=Eg(),{CLOSE_TIMEOUT:Eee,GUID:Aee,kWebSocket:Cee}=go(),Mee=/^[+/0-9A-Za-z]{22}==$/,FU=0,zU=1,VU=2,Ib=class extends Ree{static{i(this,"WebSocketServer")}constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Eee,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Tee,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Ag.createServer((n,o)=>{let a=Ag.STATUS_CODES[426];o.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),o.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=jee(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:i((o,a,s)=>{this.handleUpgrade(o,a,s,n)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=FU}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===VU){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(vl,this);return}if(t&&this.once("close",t),this._state!==zU)if(this._state=zU,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(vl,this):process.nextTick(vl,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{vl(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",WU);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){pi(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){pi(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!Mee.test(a)){pi(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){pi(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){kl(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=_ee.parse(d)}catch{pi(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new ui({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let w=qU.parse(u);w[ui.extensionName]&&(m.accept(w[ui.extensionName]),p[ui.extensionName]=m)}catch{pi(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(w,g,h,y)=>{if(!w)return kl(r,g||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(m))return kl(r,401)}this.completeUpgrade(p,a,l,t,r,n,o)}completeUpgrade(t,r,n,o,a,s,c){if(!a.readable||!a.writable)return a.destroy();if(a[Cee])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>FU)return kl(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${xee("sha1").update(r+Aee).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[ui.extensionName]){let p=t[ui.extensionName].params,m=qU.format({[ui.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
3
+ import{a as LA,b as AC,c as CC,d as MC,e as DC,f as LC,g as BC,h as $C,i as NC,j as UC}from"./chunk-UBFRWC6I.js";import{a as _t,b as fd,c as Xn,d as Zp,e as em,f as Uo}from"./chunk-IOQUF34U.js";import{a as oj,b as aj,c as ij,d as O,e as sj,f as Wo,g as V,h as hm,j as cj}from"./chunk-42GOV5ZU.js";import{$ as qo,$a as hM,$b as Ba,A as e0,Aa as W0,Ab as LM,B as t0,Ba as V0,Bb as BM,C as r0,Ca as G0,Cb as Cy,D as n0,Da as J0,Db as $M,E as o0,Ea as K0,Eb as NM,F as a0,Fa as Y0,Fb as UM,G as d0,Ga as X0,Gb as qM,H as l0,Ha as Q0,Hb as FM,I as us,Ia as Z0,Ib as zo,J as ps,Ja as eM,Jb as Zn,K as u0,Ka as Mr,Kb as My,L as am,La as jr,Lb as zM,M as p0,Ma as Se,Mb as WM,N as m0,Na as tM,Nb as jy,O as im,Oa as rM,Ob as VM,P as f0,Pa as nM,Pb as GM,Q as g0,Qa as oM,Qb as JM,R as h0,Ra as sM,Rb as La,S as w0,Sa as cM,Sb as KM,T as y0,Ta as dM,Tb as En,U as v0,Ua as lM,Ub as pm,V as k0,Va as uM,Vb as fs,W as b0,Wa as pM,Wb as YM,X as vd,Xa as Ey,Xb as mm,Y as I0,Ya as mM,Yb as fm,Z as S0,Za as fM,Zb as gm,_ as P0,_a as gM,_b as An,a as FC,aa as R0,ab as wM,ac as Hy,b as tm,ba as x0,bb as yM,bc as Oy,c as rm,ca as _0,cb as vM,cc as kd,d as nm,da as T0,db as rn,dc as Dy,e as zC,ea as E0,eb as kM,ec as XM,f as WC,fa as A0,fb as um,fc as QM,g as VC,ga as C0,gb as bM,gc as ZM,h as GC,ha as M0,hb as IM,hc as ej,i as Ry,ia as ms,ib as Qt,ic as tj,j as Oa,ja as j0,jb as Da,jc as rj,k as xy,ka as H0,kb as SM,l as gd,la as O0,lb as Qn,lc as nj,m as hd,ma as D0,mb as PM,n as ls,na as sm,nb as RM,o as om,oa as L0,ob as xM,p as _y,pa as B0,pb as _M,q as wd,qa as $0,qb as TM,r as JC,ra as N0,rb as EM,s as se,sa as U0,sb as AM,t as KC,ta as cm,tb as Ay,u as yd,ua as q0,ub as CM,v as YC,va as Fo,vb as MM,w as XC,wa as je,wb as jM,x as OG,xa as F0,xb as HM,y as QC,ya as we,yb as OM,z as ZC,za as z0,zb as DM}from"./chunk-KXEG7HCG.js";import{A as GA,B as Kn,C as qp,D as JA,E as Bo,F as Fp,G as KA,Ga as ky,Ha as by,K as YA,La as kC,M as XA,N as QA,Na as bC,O as zp,Oa as IC,P as Wp,Q as ZA,Qa as Iy,Ra as SC,S as Q,Sa as PC,T as Vp,U as Gp,Ua as RC,V as $o,Va as Sy,W as eC,X as tC,Xa as xC,Ya as _C,Za as TC,_a as EC,a as Sw,ab as Qp,b as tR,ba as rC,c as rR,ca as No,d as nR,e as oR,ea as nC,f as aR,fa as oC,fb as HC,g as iR,ga as gy,gb as Yn,h as ba,hb as OC,i as sR,j as cR,k as _u,l as dR,m as lR,ob as qC,p as OA,pa as yC,pb as Py,q as Bp,u as DA,ua as vC,v as ss,y as Up,ya as Xp,z as _n}from"./chunk-TBNBCOW7.js";import{b as jC}from"./chunk-EMKZVP7Z.js";import{a as Xe,b as i0,c as s0,d as c0,h as Ty,i as aM,j as dm,k as lm,l as iM}from"./chunk-JCCU3VFK.js";import"./chunk-O7VGFMDO.js";import{a as Xt,b as BA,c as $A,d as $p,e as Np,g as NA,h as Lo,j as UA,k as qA,l as FA,m as zA,n as WA,o as VA}from"./chunk-DLZP22WV.js";import{a as PA,d as RA,e as Ha,h as CA}from"./chunk-ZCWHVLJ4.js";import{f as Hp,i as SA,j as tn}from"./chunk-OE2VF6KU.js";import{a as en,b as Op,c as my,d as xA}from"./chunk-T5LE6R5S.js";import{d as _A,e as TA,f as EA,g as Dp,h as AA}from"./chunk-QJRXTIOC.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{d as IA}from"./chunk-7K72KS5C.js";import{a as Lp,b as HA,c as fy}from"./chunk-XM26DGML.js";import{c as MA,d as jA}from"./chunk-EPY7M5XS.js";import{$ as ud,A as pA,B as mA,C as fA,R as Ap,U as Cp,X as gA,Y as hA,Z as as,_ as Mp,ba as pd,ca as ja,da as wA,ea as yA,fa as vA,ga as jp,h as eA,ma as kA,na as bA,o as Jn,p as nA,q as oA,qa as is,r as aA,ra as py,s as iA,t as sA,u as cA,v as dA,w as lA,x as uA,y as ld,z as Do}from"./chunk-7MXZJQS7.js";import"./chunk-7YR6CBNU.js";import{A as uC,C as Kp,F as Yp,G as Tn,H as pC,I as hy,J as mC,K as wy,N as fC,O as yy,P as gC,Q as hC,R as wC,S as vy,T as ds,b as Jp,d as aC,e as iC,h as sC,m as cs,n as cC,p as dC,q as lC,s as md}from"./chunk-2ZJJFBIA.js";import{a as tA,b as Ep,d as de,e as gt,f as os,g as ie,i as rA}from"./chunk-5CMKGD43.js";import"./chunk-XEOEKFG6.js";import{A as zE,B as _p,C as WE,D as uy,E as VE,F as GE,G as xt,H as JE,I as Ke,J as rt,K as KE,L as YE,M as dd,N as Tp,O as XE,Q as QE,R as ZE,S as Zr,c as ME,l as jE,m as HE,n as OE,r as DE,s as LE,t as BE,u as $E,v as ly,w as NE,x as UE,y as qE,z as FE}from"./chunk-HA7EFTPF.js";import{b as AE,c as CE}from"./chunk-L3KS6MOV.js";import{a as _E,d as TE,f as EE}from"./chunk-7QEE4PBI.js";import{$ as g_,$a as V_,$b as CT,$c as QT,Aa as L_,Ab as fT,Ba as Jw,Bb as gT,Ca as sp,Cb as hT,Da as B_,Ea as Qr,Eb as pp,F as i_,Fa as cp,Fb as bT,Ga as Kw,H as s_,Ha as dp,Hb as IT,I as Gw,Ib as td,Ja as lp,Jb as ny,Jd as dE,K as Ye,Ka as Qc,L as Vn,Ld as wE,M as Yi,Ma as $_,Mb as mp,Mc as Ca,Md as id,N as c_,Nc as WT,Nd as yE,Ob as oy,Oc as Gn,Od as sd,P as d_,Pa as N_,Pb as ST,Pc as VT,Pd as vE,Qa as U_,Qb as PT,Qc as GT,Qd as dy,Ra as q_,Rc as JT,Rd as kE,Sc as Ho,Sd as cd,T as l_,Ta as Xi,Tb as fp,Tc as rs,Td as bE,Ua as F_,Ub as RT,Uc as vp,Ud as Rp,V as op,Vb as ay,Vc as KT,Vd as IE,W as u_,Wa as Zc,Wb as Rn,Wc as YT,Wd as SE,Xa as up,Xb as xT,Xc as XT,Xd as PE,Y as p_,Ya as z_,Yb as _T,Yc as od,Yd as RE,Z as m_,Za as Yw,Zb as iy,Zc as ns,Zd as xp,_ as f_,_a as W_,_b as nd,_c as kp,_d as xE,aa as h_,ab as Xw,ac as wp,ad as bp,ba as w_,bb as G_,bc as MT,bd as Oo,ca as y_,cb as J_,cc as jT,cd as ZT,d as Gx,da as ap,db as K_,dc as es,dd as eE,ea as v_,eb as Y_,ec as HT,ed as tE,f as tp,fa as Pn,fb as X_,fc as yp,fd as Ip,gb as Q_,gc as OT,gd as rE,h as Xx,ha as k_,hb as Z_,hc as DT,hd as ad,ia as b_,ib as Qw,ic as sy,id as nE,ja as I_,jb as eT,jd as oE,k as Ww,ka as S_,kb as tT,kc as LT,l as Zx,lb as rT,lc as Ft,m as Yt,ma as P_,mb as nT,n as Ta,na as ip,nb as Zw,nc as BT,o as Ea,oa as R_,ob as oT,oc as $T,p as Vw,pa as x_,pb as aT,pc as NT,q as e_,qa as __,qb as iT,qc as cy,r as t_,ra as T_,rb as sT,rc as UT,s as r_,sa as E_,sb as cT,sc as qT,sd as Sp,t as n_,ta as A_,tb as dT,tc as FT,td as aE,u as o_,ua as C_,ub as lT,ud as iE,v as a_,va as M_,vb as uT,vc as ts,vd as xn,w as rp,wa as j_,wb as pT,wc as zT,wd as sE,xa as H_,xb as mT,xd as Ma,y as np,ya as O_,yb as ey,yd as cE,za as D_,zb as Aa}from"./chunk-XDMUD4FW.js";import{M as Qi,N as ed,O as yT,P as vT,Q as kT,S as ty,U as ry,V as rd,aa as TT,da as ET,e as zx,ga as Zi,ha as AT,i as Wx,j as Vx,ja as gp,k as Jx,l as Kx,m as Ar,n as Zu,na as hp,pa as lE,q as _a,qa as Cr,r as Xc,ra as uE,s as zw,sa as pE,t as ep,ta as Pp,u as Yx,ua as mE,y as Qx}from"./chunk-IKWDL3RB.js";import"./chunk-6MI4KKWF.js";import{$b as Ox,Aa as Lu,Ab as Ex,Ac as gE,Ba as hx,Ca as qe,Cb as Ax,D as Aw,Dc as hE,Ea as wx,Fb as Vu,G as Sn,Ha as yx,Hb as Gu,Ia as Kt,Ib as Ju,Jb as Ji,Kb as Ow,Lb as Dw,Mb as Ku,Nb as Lw,Ob as Bw,Pb as $w,Q as tx,Qa as Co,Qb as Nw,R as rx,Ra as vx,Rb as Uw,S as nx,Sa as Bu,Sb as qw,T as ox,Ta as Xr,Tb as Cx,U as ax,Ub as Mx,V as Du,Va as $u,Vb as Ki,W as Cw,Wb as jx,X as ix,Xb as Hx,Y as sx,Yb as Yu,Z as cx,Zb as Xu,_b as Qu,a as Hu,ac as Fw,b as xa,bc as Dx,ca as dx,d as YR,db as Nu,dc as Lx,ea as Vi,eb as Mw,ec as Bx,fb as kx,fc as $x,ga as lx,gb as bx,gc as Nx,h as XR,hb as Uu,hc as Ux,ia as ux,ib as Ix,ic as Mo,j as Tw,jb as qu,jc as qx,k as qt,ka as px,kc as Fx,l as Gc,lb as Gi,lc as ir,m as Er,ma as mx,mb as Sx,mc as wT,na as fx,nb as Px,ob as Fu,pb as zu,pc as jo,q as QR,qb as jw,rb as Hw,sb as Rx,t as Jc,tc as fE,u as ZR,ua as gx,ub as xx,v as Ou,vb as _x,x as ex,xa as Ao,xb as Wu,y as Ew,ya as Kc,yb as Tx,z as Eo}from"./chunk-QRWPEW3Z.js";import{a as Yc}from"./chunk-6FA3GG5B.js";import{b as pu,e as aP,f as iP,g as sP,l as $i,m as cP,n as dP,p as lP,q as mu,r as fu}from"./chunk-PYABBF53.js";import{b as KP,c as XP}from"./chunk-YL6VFJ4P.js";import{j as KR}from"./chunk-Z3D4C7BG.js";import{A as YP,D as QP,K as ZP,V as eR,Y as uR,Z as Tu,aa as Pw,ba as pR,ca as mR,da as fR,ea as Eu,fa as gR,ga as hR,ha as wR,i as MP,ia as yR,k as Ni,n as jP,o as Pu,t as HP}from"./chunk-WV2APYWG.js";import{$ as bP,Aa as _P,B as gP,Bd as JP,C as hP,Da as Su,G as fw,H as gw,I as hw,J as ww,Jb as UP,K as yw,Ka as TP,L as vw,La as EP,Lb as Ru,M as kw,Ma as AP,N as bw,Na as CP,Q as wP,Qa as OP,Ta as DP,U as yP,Uc as qP,Va as LP,Vc as To,W as vP,Wa as BP,Wc as Ze,Xc as FP,Y as kP,_ as ku,_c as zP,a as xe,aa as IP,b as _o,ba as SP,ea as bu,g as uP,ga as zc,gd as Ui,hd as zn,i as pP,id as qi,ja as PP,la as Tr,n as mP,nd as WP,o as gu,p as hu,pa as Iu,pb as $P,pd as VP,q as wu,qa as RP,r as yu,u as vu,ua as Iw,ud as GP,v as mw,vb as Oe,w as va,wb as ft,x as ka,ya as xP,yb as NP,z as fP,zc as xu}from"./chunk-PJM2G7SG.js";import{Ba as rP,Ia as HG,Ja as nP,Ka as uw,La as pw,Na as oP,S as lw,ra as tP,sa as xo,xa as uu}from"./chunk-SDEDAHV6.js";import{C as $R,D as NR,I as qR,K as xw,L as _w,M as FR,Z as zR,_ as WR,ca as VR,da as GR,f as SR,fa as Ra,ga as JR,ha as ju,v as zi,x as Vc}from"./chunk-DALJMSJG.js";import{H as HR,L as Fi,N as OR,P as DR,Q as LR,R as BR,a as Sa,b as PR,c as Wc,d as Wn,e as RR,f as xR,g as _R,h as TR,i as Au,k as ER,l as AR,m as CR,n as MR,o as jR,y as Rw}from"./chunk-TGIB24K4.js";import{b as Li,c as Bi,d as cw,e as cu,f as mt,g as dw,h as ZS,k as Je,l as be,m as E,n as du,p as eP,q as lu,r as Ut}from"./chunk-NNF6KCHD.js";import{a as Rt,b as k}from"./chunk-ES2ISFJC.js";import{a as vR,c as Ia,f as kR,h as bR,i as IR,n as Cu,p as Wi,q as UR,r as Pa,s as Mu}from"./chunk-H7IWJN7L.js";import{a as i,b as Ee,c as Me,e as Yr}from"./chunk-FTQLQJQV.js";var go=Me((Qqe,JN)=>{"use strict";var VN=["nodebuffer","arraybuffer","fragments"],GN=typeof Blob<"u";GN&&VN.push("blob");JN.exports={BINARY_TYPES:VN,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:GN,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var fl=Me((eFe,wg)=>{"use strict";var{EMPTY_BUFFER:fZ}=go(),rb=Buffer[Symbol.species];function gZ(e,t){if(e.length===0)return fZ;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let a=e[o];r.set(a,n),n+=a.length}return n<t?new rb(r.buffer,r.byteOffset,n):r}i(gZ,"concat");function KN(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(KN,"_mask");function YN(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(YN,"_unmask");function hZ(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(hZ,"toArrayBuffer");function nb(e){if(nb.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new rb(e):ArrayBuffer.isView(e)?t=new rb(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),nb.readOnly=!1),t}i(nb,"toBuffer");wg.exports={concat:gZ,mask:KN,toArrayBuffer:hZ,toBuffer:nb,unmask:YN};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Ee("bufferutil");wg.exports.mask=function(t,r,n,o,a){a<48?KN(t,r,n,o,a):e.mask(t,r,n,o,a)},wg.exports.unmask=function(t,r){t.length<32?YN(t,r):e.unmask(t,r)}}catch{}});var ZN=Me((rFe,QN)=>{"use strict";var XN=Symbol("kDone"),ob=Symbol("kRun"),ab=class{static{i(this,"Limiter")}constructor(t){this[XN]=()=>{this.pending--,this[ob]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[ob]()}[ob](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[XN])}}};QN.exports=ab});var oc=Me((oFe,nU)=>{"use strict";var gl=Ee("zlib"),eU=fl(),wZ=ZN(),{kStatusCode:tU}=go(),yZ=Buffer[Symbol.species],vZ=Buffer.from([0,0,255,255]),vg=Symbol("permessage-deflate"),ho=Symbol("total-length"),rc=Symbol("callback"),ca=Symbol("buffers"),nc=Symbol("error"),yg,ib=class{static{i(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yg){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yg=new wZ(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[rc];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){yg.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){yg.add(o=>{this._compress(t,r,(a,s)=>{o(),n(a,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?gl.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=gl.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[vg]=this,this._inflate[ho]=0,this._inflate[ca]=[],this._inflate.on("error",bZ),this._inflate.on("data",rU)}this._inflate[rc]=n,this._inflate.write(t),r&&this._inflate.write(vZ),this._inflate.flush(()=>{let a=this._inflate[nc];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=eU.concat(this._inflate[ca],this._inflate[ho]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ho]=0,this._inflate[ca]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?gl.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=gl.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[ho]=0,this._deflate[ca]=[],this._deflate.on("data",kZ)}this._deflate[rc]=n,this._deflate.write(t),this._deflate.flush(gl.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=eU.concat(this._deflate[ca],this._deflate[ho]);r&&(a=new yZ(a.buffer,a.byteOffset,a.length-4)),this._deflate[rc]=null,this._deflate[ho]=0,this._deflate[ca]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};nU.exports=ib;function kZ(e){this[ca].push(e),this[ho]+=e.length}i(kZ,"deflateOnData");function rU(e){if(this[ho]+=e.length,this[vg]._maxPayload<1||this[ho]<=this[vg]._maxPayload){this[ca].push(e);return}this[nc]=new RangeError("Max payload size exceeded"),this[nc].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[nc][tU]=1009,this.removeListener("data",rU),this.reset()}i(rU,"inflateOnData");function bZ(e){if(this[vg]._inflate=null,this[nc]){this[rc](this[nc]);return}e[tU]=1007,this[rc](e)}i(bZ,"inflateOnError")});var ac=Me((iFe,kg)=>{"use strict";var{isUtf8:oU}=Ee("buffer"),{hasBlob:IZ}=go(),SZ=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function PZ(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(PZ,"isValidStatusCode");function sb(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}i(sb,"_isValidUTF8");function RZ(e){return IZ&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(RZ,"isBlob");kg.exports={isBlob:RZ,isValidStatusCode:PZ,isValidUTF8:sb,tokenChars:SZ};if(oU)kg.exports.isValidUTF8=function(e){return e.length<24?sb(e):oU(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Ee("utf-8-validate");kg.exports.isValidUTF8=function(t){return t.length<32?sb(t):e(t)}}catch{}});var pb=Me((cFe,uU)=>{"use strict";var{Writable:xZ}=Ee("stream"),aU=oc(),{BINARY_TYPES:_Z,EMPTY_BUFFER:iU,kStatusCode:TZ,kWebSocket:EZ}=go(),{concat:cb,toArrayBuffer:AZ,unmask:CZ}=fl(),{isValidStatusCode:MZ,isValidUTF8:sU}=ac(),bg=Buffer[Symbol.species],Nr=0,cU=1,dU=2,lU=3,db=4,lb=5,Ig=6,ub=class extends xZ{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||_Z[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[EZ]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Nr}_write(t,r,n){if(this._opcode===8&&this._state==Nr)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new bg(n.buffer,n.byteOffset+t,n.length-t),new bg(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new bg(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Nr:this.getInfo(t);break;case cU:this.getPayloadLength16(t);break;case dU:this.getPayloadLength64(t);break;case lU:this.getMask();break;case db:this.getData(t);break;case lb:case Ig:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[aU.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=cU:this._payloadLength===127?this._state=dU:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=lU:this._state=db}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=db}getData(t){let r=iU;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&CZ(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=lb,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[aU.extensionName].decompress(t,this._fin,(o,a)=>{if(o)return r(o);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}this._fragments.push(a)}this.dataMessage(r),this._state===Nr&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Nr;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=cb(n,r):this._binaryType==="arraybuffer"?o=AZ(cb(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Nr):(this._state=Ig,setImmediate(()=>{this.emit("message",o,!0),this._state=Nr,this.startLoop(t)}))}else{let o=cb(n,r);if(!this._skipUTF8Validation&&!sU(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===lb||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Nr):(this._state=Ig,setImmediate(()=>{this.emit("message",o,!1),this._state=Nr,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,iU),this.end();else{let n=t.readUInt16BE(0);if(!MZ(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new bg(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!sU(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Nr;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Nr):(this._state=Ig,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Nr,this.startLoop(r)}))}createError(t,r,n,o,a){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=a,s[TZ]=o,s}};uU.exports=ub});var gb=Me((uFe,fU)=>{"use strict";var{Duplex:lFe}=Ee("stream"),{randomFillSync:jZ}=Ee("crypto"),{types:{isUint8Array:HZ}}=Ee("util"),pU=oc(),{EMPTY_BUFFER:OZ,kWebSocket:DZ,NOOP:LZ}=go(),{isBlob:ic,isValidStatusCode:BZ}=ac(),{mask:mU,toBuffer:ci}=fl(),Ur=Symbol("kByteLength"),$Z=Buffer.alloc(4),Sg=8*1024,di,sc=Sg,un=0,NZ=1,UZ=2,mb=class e{static{i(this,"Sender")}constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=un,this.onerror=LZ,this[DZ]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||$Z,r.generateMask?r.generateMask(n):(sc===Sg&&(di===void 0&&(di=Buffer.alloc(Sg)),jZ(di,0,Sg),sc=0),n[0]=di[sc++],n[1]=di[sc++],n[2]=di[sc++],n[3]=di[sc++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[Ur]!==void 0?c=r[Ur]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!s);let d=c;c>=65536?(a+=8,d=127):c>125&&(a+=2,d=126);let l=Buffer.allocUnsafe(o?c+a:a);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),r.mask?(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],s?[l,t]:o?(mU(t,n,l,a,c),[l]):(mU(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=OZ;else{if(typeof t!="number"||!BZ(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+c),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(HZ(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[Ur]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==un?this.enqueue([this.dispatch,a,!1,s,o]):this.sendFrame(e.frame(a,s),o)}ping(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):ic(t)?(o=t.size,a=!1):(t=ci(t),o=t.length,a=ci.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[Ur]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};ic(t)?this._state!==un?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==un?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):ic(t)?(o=t.size,a=!1):(t=ci(t),o=t.length,a=ci.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[Ur]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};ic(t)?this._state!==un?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==un?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[pU.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):ic(t)?(c=t.size,d=!1):(t=ci(t),c=t.length,d=ci.readOnly),this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=c>=o._threshold),this._compress=s):(s=!1,a=0),r.fin&&(this._firstFragment=!0);let l={[Ur]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};ic(t)?this._state!==un?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==un?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[Ur],this._state=UZ,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(fb,this,c,o);return}this._bufferedBytes-=n[Ur];let s=ci(a);r?this.dispatch(s,r,n,o):(this._state=un,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(qZ,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[pU.extensionName];this._bufferedBytes+=n[Ur],this._state=NZ,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");fb(this,d,o);return}this._bufferedBytes-=n[Ur],this._state=un,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===un&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Ur],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Ur],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};fU.exports=mb;function fb(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],a=o[o.length-1];typeof a=="function"&&a(t)}}i(fb,"callCallbacks");function qZ(e,t,r){fb(e,t,r),e.onerror(t)}i(qZ,"onError")});var SU=Me((mFe,IU)=>{"use strict";var{kForOnEventAttribute:hl,kListener:hb}=go(),gU=Symbol("kCode"),hU=Symbol("kData"),wU=Symbol("kError"),yU=Symbol("kMessage"),vU=Symbol("kReason"),cc=Symbol("kTarget"),kU=Symbol("kType"),bU=Symbol("kWasClean"),wo=class{static{i(this,"Event")}constructor(t){this[cc]=null,this[kU]=t}get target(){return this[cc]}get type(){return this[kU]}};Object.defineProperty(wo.prototype,"target",{enumerable:!0});Object.defineProperty(wo.prototype,"type",{enumerable:!0});var li=class extends wo{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[gU]=r.code===void 0?0:r.code,this[vU]=r.reason===void 0?"":r.reason,this[bU]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[gU]}get reason(){return this[vU]}get wasClean(){return this[bU]}};Object.defineProperty(li.prototype,"code",{enumerable:!0});Object.defineProperty(li.prototype,"reason",{enumerable:!0});Object.defineProperty(li.prototype,"wasClean",{enumerable:!0});var dc=class extends wo{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[wU]=r.error===void 0?null:r.error,this[yU]=r.message===void 0?"":r.message}get error(){return this[wU]}get message(){return this[yU]}};Object.defineProperty(dc.prototype,"error",{enumerable:!0});Object.defineProperty(dc.prototype,"message",{enumerable:!0});var wl=class extends wo{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[hU]=r.data===void 0?null:r.data}get data(){return this[hU]}};Object.defineProperty(wl.prototype,"data",{enumerable:!0});var FZ={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[hl]&&o[hb]===t&&!o[hl])return;let n;if(e==="message")n=i(function(a,s){let c=new wl("message",{data:s?a:a.toString()});c[cc]=this,Pg(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new li("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[cc]=this,Pg(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new dc("error",{error:a,message:a.message});s[cc]=this,Pg(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new wo("open");a[cc]=this,Pg(t,this,a)},"onOpen");else return;n[hl]=!!r[hl],n[hb]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[hb]===t&&!r[hl]){this.removeListener(e,r);break}}};IU.exports={CloseEvent:li,ErrorEvent:dc,Event:wo,EventTarget:FZ,MessageEvent:wl};function Pg(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(Pg,"callListener")});var Rg=Me((gFe,PU)=>{"use strict";var{tokenChars:yl}=ac();function Ln(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(Ln,"push");function zZ(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,a=!1,s,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),s===void 0)if(u===-1&&yl[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let w=e.slice(d,u);l===44?(Ln(t,w,r),r=Object.create(null)):s=w,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&yl[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),Ln(r,e.slice(d,u),!0),l===44&&(Ln(t,s,r),r=Object.create(null),s=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(yl[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(yl[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)a=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)a=!0;else if(u===-1&&yl[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let w=e.slice(d,u);n&&(w=w.replace(/\\/g,""),n=!1),Ln(r,c,w),l===44&&(Ln(t,s,r),r=Object.create(null),s=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return s===void 0?Ln(t,m,r):(c===void 0?Ln(r,m,!0):n?Ln(r,c,m.replace(/\\/g,"")):Ln(r,c,m),Ln(t,s,r)),t}i(zZ,"parse");function WZ(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let a=n[o];return Array.isArray(a)||(a=[a]),a.map(s=>s===!0?o:`${o}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}i(WZ,"format");PU.exports={format:WZ,parse:zZ}});var Eg=Me((vFe,DU)=>{"use strict";var VZ=Ee("events"),GZ=Ee("https"),JZ=Ee("http"),_U=Ee("net"),KZ=Ee("tls"),{randomBytes:YZ,createHash:XZ}=Ee("crypto"),{Duplex:wFe,Readable:yFe}=Ee("stream"),{URL:wb}=Ee("url"),da=oc(),QZ=pb(),ZZ=gb(),{isBlob:eee}=ac(),{BINARY_TYPES:RU,CLOSE_TIMEOUT:tee,EMPTY_BUFFER:xg,GUID:ree,kForOnEventAttribute:yb,kListener:nee,kStatusCode:oee,kWebSocket:kt,NOOP:TU}=go(),{EventTarget:{addEventListener:aee,removeEventListener:iee}}=SU(),{format:see,parse:cee}=Rg(),{toBuffer:dee}=fl(),EU=Symbol("kAborted"),vb=[8,13],yo=["CONNECTING","OPEN","CLOSING","CLOSED"],lee=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,Qe=class e extends VZ{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=RU[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xg,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),AU(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){RU.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let o=new QZ({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),a=new ZZ(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[kt]=this,a[kt]=this,t[kt]=this,o.on("conclude",mee),o.on("drain",fee),o.on("error",gee),o.on("message",hee),o.on("ping",wee),o.on("pong",yee),a.onerror=vee,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",jU),t.on("data",Tg),t.on("end",HU),t.on("error",OU),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[da.extensionName]&&this._extensions[da.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){kr(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),MU(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kb(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||xg,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kb(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||xg,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){kb(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[da.extensionName]||(o.compress=!1),this._sender.send(t||xg,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){kr(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(Qe,"CONNECTING",{enumerable:!0,value:yo.indexOf("CONNECTING")});Object.defineProperty(Qe.prototype,"CONNECTING",{enumerable:!0,value:yo.indexOf("CONNECTING")});Object.defineProperty(Qe,"OPEN",{enumerable:!0,value:yo.indexOf("OPEN")});Object.defineProperty(Qe.prototype,"OPEN",{enumerable:!0,value:yo.indexOf("OPEN")});Object.defineProperty(Qe,"CLOSING",{enumerable:!0,value:yo.indexOf("CLOSING")});Object.defineProperty(Qe.prototype,"CLOSING",{enumerable:!0,value:yo.indexOf("CLOSING")});Object.defineProperty(Qe,"CLOSED",{enumerable:!0,value:yo.indexOf("CLOSED")});Object.defineProperty(Qe.prototype,"CLOSED",{enumerable:!0,value:yo.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(Qe.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(Qe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[yb])return t[nee];return null},set(t){for(let r of this.listeners(e))if(r[yb]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[yb]:!0})}})});Qe.prototype.addEventListener=aee;Qe.prototype.removeEventListener=iee;DU.exports=Qe;function AU(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:tee,protocolVersion:vb[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!vb.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${vb.join(", ")})`);let a;if(t instanceof wb)a=t;else try{a=new wb(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let s=a.protocol==="wss:",c=a.protocol==="ws+unix:",d;if(a.protocol!=="ws:"&&!s&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;_g(e,h);return}let l=s?443:80,u=YZ(16).toString("base64"),p=s?GZ.request:JZ.request,m=new Set,w;if(o.createConnection=o.createConnection||(s?pee:uee),o.defaultPort=o.defaultPort||l,o.port=a.port||l,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(w=new da({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=see({[da.extensionName]:w.offer()})),r.length){for(let h of r){if(typeof h!="string"||!lee.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let g;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?o.socketPath:a.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,f]of Object.entries(h))n.headers[y.toLowerCase()]=f}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),g=e._req=p(o),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(o);o.timeout&&g.on("timeout",()=>{kr(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[EU]||(g=e._req=null,_g(e,h))}),g.on("response",h=>{let y=h.headers.location,f=h.statusCode;if(y&&o.followRedirects&&f>=300&&f<400){if(++e._redirects>o.maxRedirects){kr(e,g,"Maximum redirects exceeded");return}g.abort();let P;try{P=new wb(y,t)}catch{let b=new SyntaxError(`Invalid URL: ${y}`);_g(e,b);return}AU(e,P,r,n)}else e.emit("unexpected-response",g,h)||kr(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,f)=>{if(e.emit("upgrade",h),e.readyState!==Qe.CONNECTING)return;g=e._req=null;let P=h.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){kr(e,y,"Invalid Upgrade header");return}let S=XZ("sha1").update(u+ree).digest("base64");if(h.headers["sec-websocket-accept"]!==S){kr(e,y,"Invalid Sec-WebSocket-Accept header");return}let b=h.headers["sec-websocket-protocol"],v;if(b!==void 0?m.size?m.has(b)||(v="Server sent an invalid subprotocol"):v="Server sent a subprotocol but none was requested":m.size&&(v="Server sent no subprotocol"),v){kr(e,y,v);return}b&&(e._protocol=b);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!w){kr(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let A;try{A=cee(R)}catch{kr(e,y,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(A);if(I.length!==1||I[0]!==da.extensionName){kr(e,y,"Server indicated an extension that was not requested");return}try{w.accept(A[da.extensionName])}catch{kr(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[da.extensionName]=w}e.setSocket(y,f,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(g,e):g.end()}i(AU,"initAsClient");function _g(e,t){e._readyState=Qe.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(_g,"emitErrorAndClose");function uee(e){return e.path=e.socketPath,_U.connect(e)}i(uee,"netConnect");function pee(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=_U.isIP(e.host)?"":e.host),KZ.connect(e)}i(pee,"tlsConnect");function kr(e,t,r){e._readyState=Qe.CLOSING;let n=new Error(r);Error.captureStackTrace(n,kr),t.setHeader?(t[EU]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(_g,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(kr,"abortHandshake");function kb(e,t,r){if(t){let n=eee(t)?t.size:dee(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${yo[e.readyState]})`);process.nextTick(r,n)}}i(kb,"sendAfterClose");function mee(e,t){let r=this[kt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[kt]!==void 0&&(r._socket.removeListener("data",Tg),process.nextTick(CU,r._socket),e===1005?r.close():r.close(e,t))}i(mee,"receiverOnConclude");function fee(){let e=this[kt];e.isPaused||e._socket.resume()}i(fee,"receiverOnDrain");function gee(e){let t=this[kt];t._socket[kt]!==void 0&&(t._socket.removeListener("data",Tg),process.nextTick(CU,t._socket),t.close(e[oee])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(gee,"receiverOnError");function xU(){this[kt].emitClose()}i(xU,"receiverOnFinish");function hee(e,t){this[kt].emit("message",e,t)}i(hee,"receiverOnMessage");function wee(e){let t=this[kt];t._autoPong&&t.pong(e,!this._isServer,TU),t.emit("ping",e)}i(wee,"receiverOnPing");function yee(e){this[kt].emit("pong",e)}i(yee,"receiverOnPong");function CU(e){e.resume()}i(CU,"resume");function vee(e){let t=this[kt];t.readyState!==Qe.CLOSED&&(t.readyState===Qe.OPEN&&(t._readyState=Qe.CLOSING,MU(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(vee,"senderOnError");function MU(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(MU,"setCloseTimer");function jU(){let e=this[kt];if(this.removeListener("close",jU),this.removeListener("data",Tg),this.removeListener("end",HU),e._readyState=Qe.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[kt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",xU),e._receiver.on("finish",xU))}i(jU,"socketOnClose");function Tg(e){this[kt]._receiver.write(e)||this.pause()}i(Tg,"socketOnData");function HU(){let e=this[kt];e._readyState=Qe.CLOSING,e._receiver.end(),this.end()}i(HU,"socketOnEnd");function OU(){let e=this[kt];this.removeListener("error",OU),this.on("error",TU),e&&(e._readyState=Qe.CLOSING,this.destroy())}i(OU,"socketOnError")});var NU=Me((IFe,$U)=>{"use strict";var bFe=Eg(),{Duplex:kee}=Ee("stream");function LU(e){e.emit("close")}i(LU,"emitClose");function bee(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(bee,"duplexOnEnd");function BU(e){this.removeListener("error",BU),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(BU,"duplexOnError");function Iee(e,t){let r=!0,n=new kee({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",i(function(a,s){let c=!s&&n._readableState.objectMode?a.toString():a;n.push(c)||e.pause()},"message")),e.once("error",i(function(a){n.destroyed||(r=!1,n.destroy(a))},"error")),e.once("close",i(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(o,a){if(e.readyState===e.CLOSED){a(o),process.nextTick(LU,n);return}let s=!1;e.once("error",i(function(d){s=!0,a(d)},"error")),e.once("close",i(function(){s||a(o),process.nextTick(LU,n)},"close")),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",i(function(){o()},"finish")),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,a,s){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._write(o,a,s)},"open"));return}e.send(o,s)},n.on("end",bee),n.on("error",BU),n}i(Iee,"createWebSocketStream");$U.exports=Iee});var bb=Me((PFe,UU)=>{"use strict";var{tokenChars:See}=ac();function Pee(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let s=e.charCodeAt(o);if(n===-1&&See[s]===1)r===-1&&(r=o);else if(o!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=o);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}i(Pee,"parse");UU.exports={parse:Pee}});var JU=Me((_Fe,GU)=>{"use strict";var Ree=Ee("events"),Ag=Ee("http"),{Duplex:xFe}=Ee("stream"),{createHash:xee}=Ee("crypto"),qU=Rg(),ui=oc(),_ee=bb(),Tee=Eg(),{CLOSE_TIMEOUT:Eee,GUID:Aee,kWebSocket:Cee}=go(),Mee=/^[+/0-9A-Za-z]{22}==$/,FU=0,zU=1,VU=2,Ib=class extends Ree{static{i(this,"WebSocketServer")}constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Eee,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Tee,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Ag.createServer((n,o)=>{let a=Ag.STATUS_CODES[426];o.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),o.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=jee(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:i((o,a,s)=>{this.handleUpgrade(o,a,s,n)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=FU}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===VU){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(vl,this);return}if(t&&this.once("close",t),this._state!==zU)if(this._state=zU,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(vl,this):process.nextTick(vl,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{vl(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",WU);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){pi(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){pi(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!Mee.test(a)){pi(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){pi(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){kl(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=_ee.parse(d)}catch{pi(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new ui({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let w=qU.parse(u);w[ui.extensionName]&&(m.accept(w[ui.extensionName]),p[ui.extensionName]=m)}catch{pi(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(w,g,h,y)=>{if(!w)return kl(r,g||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(m))return kl(r,401)}this.completeUpgrade(p,a,l,t,r,n,o)}completeUpgrade(t,r,n,o,a,s,c){if(!a.readable||!a.writable)return a.destroy();if(a[Cee])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>FU)return kl(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${xee("sha1").update(r+Aee).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[ui.extensionName]){let p=t[ui.extensionName].params,m=qU.format({[ui.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
4
4
  `).join(`\r
5
5
  `)),a.removeListener("error",WU),u.setSocket(a,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(vl,this)})),c(u,o)}};GU.exports=Ib;function jee(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return i(function(){for(let n of Object.keys(t))e.removeListener(n,t[n])},"removeListeners")}i(jee,"addListeners");function vl(e){e._state=VU,e.emit("close")}i(vl,"emitClose");function WU(){this.destroy()}i(WU,"socketOnError");function kl(e,t,r,n){r=r||Ag.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Ag.STATUS_CODES[t]}\r
6
6
  `+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
3
- import{a as m,b as l}from"./chunks/chunk-BSHAIAXY.js";import"./chunks/chunk-XWPC3AN4.js";import{b as u}from"./chunks/chunk-RLZPX4YP.js";import{a as c,j as d}from"./chunks/chunk-Q4H3NUVW.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import"./chunks/chunk-GLUWATL5.js";import{a as n}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}n(f,"resolveCliTopLevelAction");async function C(e=process.argv.slice(2)){if(await w(e))return;let{command:t,options:o,rest:r}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-4HV2W6V4.js")).resolveOpenPondHome({home:o.home}));let i=f({command:t,options:o});if(i==="version"){console.log(c());return}if(i==="check-update"){await(await import("./chunks/core-commands-W5IGIITV.js")).runCheckUpdate();return}if(i==="help"){(await import("./chunks/help-PEFQDDTA.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),i==="tui"){await(await import("./chunks/app-layer-RRFI27N4.js")).runOpenPondTerminalCommand(o,r);return}if(i==="ui"){await(await import("./chunks/app-layer-RRFI27N4.js")).runOpenPondServerCommand("web",o,r);return}await d({command:t,options:o,rest:r})||((await import("./chunks/help-PEFQDDTA.js")).printHelp(),process.exit(1))}n(C,"runOpenPondCli");async function w(e){if(e[0]==="__inspect-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-JODGZCA7.js")).runHostedProfileInspectionCli(e.slice(1)),!0;if(e[0]==="__prepare-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-JODGZCA7.js")).runHostedProfileEvaluationCli(e.slice(1)),!0;if(e[0]==="__hosted-experiment-improvement")return await(await import("./chunks/hosted-experiment-improvement-NTYYSPQX.js")).runHostedExperimentImprovementCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile-candidate")return await(await import("./chunks/hosted-profile-candidate-LVNKOTKJ.js")).runHostedProfileCandidateCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile")return await(await import("./chunks/hosted-profile-compiler-JODGZCA7.js")).runHostedProfileCompilerCli(e.slice(1)),!0;if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:t},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-OG7GYIIA.js"),import("./chunks/cli-ZLDLOKPL.js")]);return await o(t),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:t},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-4RLFNNVK.js"),import("./chunks/cli-ZLDLOKPL.js")]),{createOpenPondAppServer:r}=await import("./chunks/app-server-runtime-OG7GYIIA.js");return await o({createOpenPondServer:t,createOpenPondAppServer:r}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-DH5AQ4Z7.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}n(w,"runEmbeddedCompanion");C().catch(e=>{let t=e instanceof Error?e.message:String(e),o=e.issue;if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??{code:"CLI_ERROR",message:t}}));else if(o&&typeof o=="object"){let i=o;console.error(`${i.code}: ${i.message}
3
+ import{a as m,b as l}from"./chunks/chunk-BSHAIAXY.js";import"./chunks/chunk-XWPC3AN4.js";import{b as u}from"./chunks/chunk-RLZPX4YP.js";import{a as c,j as d}from"./chunks/chunk-Q4H3NUVW.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import"./chunks/chunk-GLUWATL5.js";import{a as n}from"./chunks/chunk-FTQLQJQV.js";function f(e){return!e.command&&s(e.options.version)?"version":s(e.options.checkUpdate)?"check-update":!e.command&&s(e.options.help)?"help":!e.command&&s(e.options.tui)?"tui":e.command?"command":"ui"}n(f,"resolveCliTopLevelAction");async function C(e=process.argv.slice(2)){if(await w(e))return;let{command:t,options:o,rest:r}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-4HV2W6V4.js")).resolveOpenPondHome({home:o.home}));let i=f({command:t,options:o});if(i==="version"){console.log(c());return}if(i==="check-update"){await(await import("./chunks/core-commands-W5IGIITV.js")).runCheckUpdate();return}if(i==="help"){(await import("./chunks/help-PEFQDDTA.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),i==="tui"){await(await import("./chunks/app-layer-RRFI27N4.js")).runOpenPondTerminalCommand(o,r);return}if(i==="ui"){await(await import("./chunks/app-layer-RRFI27N4.js")).runOpenPondServerCommand("web",o,r);return}await d({command:t,options:o,rest:r})||((await import("./chunks/help-PEFQDDTA.js")).printHelp(),process.exit(1))}n(C,"runOpenPondCli");async function w(e){if(e[0]==="__inspect-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-JODGZCA7.js")).runHostedProfileInspectionCli(e.slice(1)),!0;if(e[0]==="__prepare-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-JODGZCA7.js")).runHostedProfileEvaluationCli(e.slice(1)),!0;if(e[0]==="__hosted-experiment-improvement")return await(await import("./chunks/hosted-experiment-improvement-NTYYSPQX.js")).runHostedExperimentImprovementCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile-candidate")return await(await import("./chunks/hosted-profile-candidate-LVNKOTKJ.js")).runHostedProfileCandidateCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile")return await(await import("./chunks/hosted-profile-compiler-JODGZCA7.js")).runHostedProfileCompilerCli(e.slice(1)),!0;if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:t},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-4YKIZB22.js"),import("./chunks/cli-ZLDLOKPL.js")]);return await o(t),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:t},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-STK4YHBI.js"),import("./chunks/cli-ZLDLOKPL.js")]),{createOpenPondAppServer:r}=await import("./chunks/app-server-runtime-4YKIZB22.js");return await o({createOpenPondServer:t,createOpenPondAppServer:r}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-DH5AQ4Z7.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}n(w,"runEmbeddedCompanion");C().catch(e=>{let t=e instanceof Error?e.message:String(e),o=e.issue;if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??{code:"CLI_ERROR",message:t}}));else if(o&&typeof o=="object"){let i=o;console.error(`${i.code}: ${i.message}
4
4
  ${i.path}
5
5
  ${i.action}`)}else console.error(t);let r=typeof e.exitCode=="number"?e.exitCode:1;process.exit(r)});export{C as runOpenPondCli};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.2.50",
3
+ "version": "0.2.51",
4
4
  "license": "MIT",
5
5
  "description": "OpenPond CLI and local harness",
6
6
  "main": "dist/index.js",