openpond 0.2.19 → 0.2.20

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,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{d as F}from"./chunk-HKYGCUA6.js";import{a as o}from"./chunk-FTQLQJQV.js";import{spawn as nt,spawnSync as At}from"node:child_process";import{accessSync as vt,constants as Rt,existsSync as _t,promises as Bt}from"node:fs";import et from"node:path";var rt="Git is required for OpenPond app workspaces, but macOS reports Apple Command Line Tools are not installed. OpenPond skipped /usr/bin/git to avoid opening the Xcode installer prompt. Install Command Line Tools with `xcode-select --install`, install Git from Homebrew, or put a non-Apple git binary earlier on PATH.",T;function Lt(e){try{return _t(e)?(vt(e,Rt.X_OK),!0):!1}catch{return!1}}o(Lt,"isExecutable");function Ot(){let e=(process.env.PATH??"").split(et.delimiter).map(t=>t.trim()).filter(Boolean);for(let t of e){let n=et.join(t,"git");if(!(n==="/usr/bin/git"||n==="/bin/git")&&Lt(n))return n}return null}o(Ot,"firstNonAppleGitOnPath");function it(){let e=At("/usr/bin/xcode-select",["-p"],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});return e.status===0&&!!e.stdout.trim()}o(it,"appleDeveloperToolsAvailable");function Dt(e){if(e!=="git"||process.platform!=="darwin")return{command:e};if(T!==void 0)return{command:T};let t=Ot();return t?(T=t,{command:t}):it()?(T="git",{command:"git"}):{error:rt}}o(Dt,"resolveWorkspaceCommand");function u(e,t,n,r={},i){return new Promise(s=>{let a=Dt(e);if("error"in a){s({code:1,stdout:"",stderr:a.error});return}let c=nt(a.command,t,{cwd:n,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:[i===void 0?"ignore":"pipe","pipe","pipe"]}),d=[],p=[];i!==void 0&&c.stdin?.end(i),c.stdout?.on("data",h=>d.push(h)),c.stderr?.on("data",h=>p.push(h)),c.on("error",h=>{s({code:1,stdout:"",stderr:h.message})}),c.on("close",h=>{s({code:h??1,stdout:Buffer.concat(d).toString("utf8"),stderr:Buffer.concat(p).toString("utf8")})})})}o(u,"runCommand");function Gt(e){return!!(e&&e.includes(rt.slice(0,80)))}o(Gt,"isMacOSGitDeveloperToolsMissing");async function Se(e){await Bt.mkdir(e,{recursive:!0});let t=await u("git",["--version"],e);if(t.code===0)return{ok:!0,command:T??"git",version:(t.stdout||t.stderr).trim()};let n=t.stderr.trim()||t.stdout.trim()||"Git is required for OpenPond app workspaces.";return{ok:!1,error:n,installAction:process.platform==="darwin"&&Gt(n)?"macos_command_line_tools":"manual_git_install"}}o(Se,"checkWorkspaceGitAvailability");function ye(){if(process.platform!=="darwin")return{ok:!1,error:"Apple Command Line Tools installation is only available on macOS."};if(it())return{ok:!0,message:"Apple Command Line Tools already appear to be installed."};try{return nt("/usr/bin/xcode-select",["--install"],{detached:!0,stdio:"ignore"}).unref(),{ok:!0,message:"Opened the Apple Command Line Tools installer."}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}o(ye,"startMacOSCommandLineToolsInstall");import{promises as k}from"node:fs";import m from"node:path";var st=24e3,ot=8e4,It=512*1024,ct=15*1024*1024,Tt=20*1024*1024,Mt=new Set([".cache",".eggs",".git",".ipynb_checkpoints",".mypy_cache",".next",".nox",".nuxt",".openpond",".output",".parcel-cache",".pytest_cache",".pyre",".ruff_cache",".svelte-kit",".tox",".turbo",".venv","__pycache__","artifacts","build","coverage","dist","env","node_modules","out","site-packages","target","venv","volumes"]),zt=new Set([".7z",".avif",".db",".doc",".docx",".gif",".gz",".ico",".jpeg",".jpg",".mov",".mp4",".pdf",".png",".sqlite",".tar",".webp",".xls",".xlsm",".xlsx",".zip"]),$t=new Map([[".avif","image/avif"],[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".png","image/png"],[".webp","image/webp"]]),Nt=new Map([[".m4v","video/x-m4v"],[".mov","video/quicktime"],[".mp4","video/mp4"],[".webm","video/webm"]]),Ht=new Set([".doc",".docx",".pdf"]);function Ut(e){return e.replace(/[^a-zA-Z0-9._-]/g,"-").slice(0,120)||"app"}o(Ut,"safeAppSegment");function N(e){if(!e)return"unknown";try{let t=new URL(e).hostname.toLowerCase();if(t==="github.com"||t.endsWith(".github.com"))return"github";if(t==="openpond.ai"||t.endsWith(".openpond.ai"))return"openpond"}catch{return"unknown"}return"local_git"}o(N,"sourceFromRemote");function $(e){return e.replace(/x-access-token:[^@]+@/g,"x-access-token:***@").replace(/Authorization:\s*Basic\s+[A-Za-z0-9+/=]+/gi,"Authorization: Basic ***")}o($,"redactRemoteUrl");async function G(e){try{return await k.access(e),!0}catch{return!1}}o(G,"pathExists");async function O(e){return await G(e)?(await u("git",["rev-parse","--git-dir"],e)).code===0:!1}o(O,"isGitRepo");function X(e){return e.length<=st?e:`${e.slice(0,st)}
2
+ import{d as F}from"./chunk-7VRXJGFG.js";import{a as o}from"./chunk-FTQLQJQV.js";import{spawn as nt,spawnSync as At}from"node:child_process";import{accessSync as vt,constants as Rt,existsSync as _t,promises as Bt}from"node:fs";import et from"node:path";var rt="Git is required for OpenPond app workspaces, but macOS reports Apple Command Line Tools are not installed. OpenPond skipped /usr/bin/git to avoid opening the Xcode installer prompt. Install Command Line Tools with `xcode-select --install`, install Git from Homebrew, or put a non-Apple git binary earlier on PATH.",T;function Lt(e){try{return _t(e)?(vt(e,Rt.X_OK),!0):!1}catch{return!1}}o(Lt,"isExecutable");function Ot(){let e=(process.env.PATH??"").split(et.delimiter).map(t=>t.trim()).filter(Boolean);for(let t of e){let n=et.join(t,"git");if(!(n==="/usr/bin/git"||n==="/bin/git")&&Lt(n))return n}return null}o(Ot,"firstNonAppleGitOnPath");function it(){let e=At("/usr/bin/xcode-select",["-p"],{encoding:"utf8",stdio:["ignore","pipe","pipe"]});return e.status===0&&!!e.stdout.trim()}o(it,"appleDeveloperToolsAvailable");function Dt(e){if(e!=="git"||process.platform!=="darwin")return{command:e};if(T!==void 0)return{command:T};let t=Ot();return t?(T=t,{command:t}):it()?(T="git",{command:"git"}):{error:rt}}o(Dt,"resolveWorkspaceCommand");function u(e,t,n,r={},i){return new Promise(s=>{let a=Dt(e);if("error"in a){s({code:1,stdout:"",stderr:a.error});return}let c=nt(a.command,t,{cwd:n,env:{...process.env,...r,GIT_TERMINAL_PROMPT:"0"},stdio:[i===void 0?"ignore":"pipe","pipe","pipe"]}),d=[],p=[];i!==void 0&&c.stdin?.end(i),c.stdout?.on("data",h=>d.push(h)),c.stderr?.on("data",h=>p.push(h)),c.on("error",h=>{s({code:1,stdout:"",stderr:h.message})}),c.on("close",h=>{s({code:h??1,stdout:Buffer.concat(d).toString("utf8"),stderr:Buffer.concat(p).toString("utf8")})})})}o(u,"runCommand");function Gt(e){return!!(e&&e.includes(rt.slice(0,80)))}o(Gt,"isMacOSGitDeveloperToolsMissing");async function Se(e){await Bt.mkdir(e,{recursive:!0});let t=await u("git",["--version"],e);if(t.code===0)return{ok:!0,command:T??"git",version:(t.stdout||t.stderr).trim()};let n=t.stderr.trim()||t.stdout.trim()||"Git is required for OpenPond app workspaces.";return{ok:!1,error:n,installAction:process.platform==="darwin"&&Gt(n)?"macos_command_line_tools":"manual_git_install"}}o(Se,"checkWorkspaceGitAvailability");function ye(){if(process.platform!=="darwin")return{ok:!1,error:"Apple Command Line Tools installation is only available on macOS."};if(it())return{ok:!0,message:"Apple Command Line Tools already appear to be installed."};try{return nt("/usr/bin/xcode-select",["--install"],{detached:!0,stdio:"ignore"}).unref(),{ok:!0,message:"Opened the Apple Command Line Tools installer."}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}o(ye,"startMacOSCommandLineToolsInstall");import{promises as k}from"node:fs";import m from"node:path";var st=24e3,ot=8e4,It=512*1024,ct=15*1024*1024,Tt=20*1024*1024,Mt=new Set([".cache",".eggs",".git",".ipynb_checkpoints",".mypy_cache",".next",".nox",".nuxt",".openpond",".output",".parcel-cache",".pytest_cache",".pyre",".ruff_cache",".svelte-kit",".tox",".turbo",".venv","__pycache__","artifacts","build","coverage","dist","env","node_modules","out","site-packages","target","venv","volumes"]),zt=new Set([".7z",".avif",".db",".doc",".docx",".gif",".gz",".ico",".jpeg",".jpg",".mov",".mp4",".pdf",".png",".sqlite",".tar",".webp",".xls",".xlsm",".xlsx",".zip"]),$t=new Map([[".avif","image/avif"],[".gif","image/gif"],[".jpeg","image/jpeg"],[".jpg","image/jpeg"],[".png","image/png"],[".webp","image/webp"]]),Nt=new Map([[".m4v","video/x-m4v"],[".mov","video/quicktime"],[".mp4","video/mp4"],[".webm","video/webm"]]),Ht=new Set([".doc",".docx",".pdf"]);function Ut(e){return e.replace(/[^a-zA-Z0-9._-]/g,"-").slice(0,120)||"app"}o(Ut,"safeAppSegment");function N(e){if(!e)return"unknown";try{let t=new URL(e).hostname.toLowerCase();if(t==="github.com"||t.endsWith(".github.com"))return"github";if(t==="openpond.ai"||t.endsWith(".openpond.ai"))return"openpond"}catch{return"unknown"}return"local_git"}o(N,"sourceFromRemote");function $(e){return e.replace(/x-access-token:[^@]+@/g,"x-access-token:***@").replace(/Authorization:\s*Basic\s+[A-Za-z0-9+/=]+/gi,"Authorization: Basic ***")}o($,"redactRemoteUrl");async function G(e){try{return await k.access(e),!0}catch{return!1}}o(G,"pathExists");async function O(e){return await G(e)?(await u("git",["rev-parse","--git-dir"],e)).code===0:!1}o(O,"isGitRepo");function X(e){return e.length<=st?e:`${e.slice(0,st)}
3
3
 
4
4
  [diff truncated]`}o(X,"truncatePatch");function jt(e){return e.length<=ot?e:`${e.slice(0,ot)}
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b as Q,c as Z,t as ee,y as oe}from"./chunk-FRWPAVCD.js";import{a as T,b as X,h as K}from"./chunk-HKYGCUA6.js";import{n as te,p as re}from"./chunk-P7EHGAOW.js";import{$a as E,Ra as V,Sa as J,Ua as I,Xa as F,_a as W,b as L,c as B,db as z,fb as q,gb as Y,ja as D,la as H,ma as M,na as $,oa as j,qa as G}from"./chunk-NNLI4OWY.js";import{b as i}from"./chunk-ES2ISFJC.js";import{c as N,d as C,f as k,h as R}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{promises as U}from"node:fs";import Ee from"node:os";import Ae from"node:path";import{createServer as Ie}from"node:http";import{randomBytes as Te}from"node:crypto";var be=i.discriminatedUnion("op",[i.strictObject({op:i.literal("set"),path:i.array(i.string().min(1)).min(1),value:i.unknown()}),i.strictObject({op:i.literal("unset"),path:i.array(i.string().min(1)).min(1)})]),Oe=i.discriminatedUnion("action",[i.strictObject({action:i.literal("patch"),expectedRevision:i.string(),operations:i.array(be).max(100)}),i.strictObject({action:i.literal("replace"),expectedRevision:i.string(),text:i.string().max(1048576)}),i.strictObject({action:i.literal("validate"),text:i.string().max(1048576)}),i.strictObject({action:i.literal("restore"),expectedRevision:i.string(),revision:i.string()}),i.strictObject({action:i.literal("trust"),root:i.string(),accountId:i.string(),trusted:i.boolean()}),i.strictObject({action:i.literal("client-state"),owner:i.string(),patch:z,importOnly:i.boolean().optional()})]);function ne(e){let t=null;async function r(l,n){let g=R(e).config,w=null,p=null,d=null;try{w=await B(g),d=await E(e,{projectRoot:l,accountId:n}),l||(t=d)}catch(v){p=C(v,g)}let y=d??(l?null:t);return{path:g,text:w,rawRevision:L(w),issue:p,effective:y,usingLastValid:!d&&!!y,applies:"next_turn",recoverableRevisions:await H(e),clientState:p?null:await q(e)}}s(r,"status");async function o(l){let n=Oe.parse(l);return n.action==="validate"?{valid:!0,document:D(n.text,R(e).config)}:(n.action==="patch"&&await G(e,n.expectedRevision,n.operations),n.action==="replace"&&await M(e,n.expectedRevision,n.text),n.action==="restore"&&await $(e,n.revision,n.expectedRevision),n.action==="trust"&&await W(e,n.root,n.accountId,n.trusted),n.action==="client-state"?Y(e,n.owner,n.patch,n.importOnly):r())}return s(o,"mutate"),{status:r,mutate:o,schema:j}}s(ne,"createConfigurationPayloads");import{Buffer as ie}from"node:buffer";var A={"Access-Control-Allow-Headers":"authorization, content-type, x-openpond-team-id","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS"},Se=25*1024*1024,x=class extends Error{constructor(r,o,l){super(l);this.status=r;this.code=o;this.name="HttpBodyError"}status;code;static{s(this,"HttpBodyError")}};function ae(e,t,r={}){for(let[l,n]of Object.entries(A))t.setHeader(l,n);let o=ce(e.headers.origin);return o?(t.setHeader("Vary",xe(t.getHeader("Vary"))),Re(o,r)?(t.setHeader("Access-Control-Allow-Origin",o),{allowed:!0,origin:o}):{allowed:!1,origin:o}):{allowed:!0,origin:null}}s(ae,"applyCorsHeaders");function Re(e,t={}){if(e==="null")return!0;let r=se(e);return r?Ce(r)?!0:new Set((t.allowedOrigins??[]).map(l=>l?se(l):null).filter(l=>!!l)).has(r):!1}s(Re,"isAllowedCorsOrigin");function h(e,t,r){e.writeHead(t,{"Content-Type":"application/json",...A}),e.end(JSON.stringify(r))}s(h,"sendJson");function Je(e,t,r){e.writeHead(t,{"Content-Type":"text/plain; charset=utf-8",...A}),e.end(r)}s(Je,"sendText");function Fe(e,t,r,o){e.writeHead(t,{"Content-Type":o,"Content-Length":String(r.byteLength),"Cache-Control":"no-store","X-Content-Type-Options":"nosniff",...A}),e.end(r)}s(Fe,"sendBinary");async function _(e,t={}){let r=t.maxBytes??Se,o=ce(e.headers["content-type"]),l=[],n=0;for await(let w of e){let p=ie.from(w);if(n+=p.byteLength,n>r)throw new x(413,"request_body_too_large",`JSON request body exceeds ${r} bytes.`);l.push(p)}let g=ie.concat(l).toString("utf8").trim();if(!g)return{};if(!Pe(o))throw new x(415,"unsupported_media_type","JSON request body requires Content-Type: application/json.");try{return JSON.parse(g)}catch{throw new x(400,"invalid_json","Request body is not valid JSON.")}}s(_,"readJson");function le(e,t,r){let o=e.headers.authorization;return(typeof o=="string"&&o.startsWith("Bearer ")?o.slice(7):null)===r}s(le,"hasAuth");function ce(e){return Array.isArray(e)?e[0]??null:e??null}s(ce,"headerValue");function Pe(e){if(!e)return!1;let t=e.split(";")[0]?.trim().toLowerCase();return t==="application/json"||!!t?.endsWith("+json")}s(Pe,"isJsonContentType");function se(e){try{let t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.origin}catch{return null}}s(se,"normalizeOrigin");function Ce(e){let t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"}s(Ce,"isLoopbackOrigin");function xe(e){let r=(Array.isArray(e)?e.join(", "):e?String(e):"").split(",").map(o=>o.trim()).filter(Boolean);return r.some(o=>o.toLowerCase()==="origin")||r.push("Origin"),r.join(", ")}s(xe,"appendVaryOrigin");function pe(e){return`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>OpenPond recovery</title>
2
+ import{b as Q,c as Z,t as ee,y as oe}from"./chunk-FRWPAVCD.js";import{a as T,b as X,h as K}from"./chunk-7VRXJGFG.js";import{n as te,p as re}from"./chunk-P7EHGAOW.js";import{$a as E,Ra as V,Sa as J,Ua as I,Xa as F,_a as W,b as L,c as B,db as z,fb as q,gb as Y,ja as D,la as H,ma as M,na as $,oa as j,qa as G}from"./chunk-NNLI4OWY.js";import{b as i}from"./chunk-ES2ISFJC.js";import{c as N,d as C,f as k,h as R}from"./chunk-H7IWJN7L.js";import{a as s}from"./chunk-FTQLQJQV.js";import{promises as U}from"node:fs";import Ee from"node:os";import Ae from"node:path";import{createServer as Ie}from"node:http";import{randomBytes as Te}from"node:crypto";var be=i.discriminatedUnion("op",[i.strictObject({op:i.literal("set"),path:i.array(i.string().min(1)).min(1),value:i.unknown()}),i.strictObject({op:i.literal("unset"),path:i.array(i.string().min(1)).min(1)})]),Oe=i.discriminatedUnion("action",[i.strictObject({action:i.literal("patch"),expectedRevision:i.string(),operations:i.array(be).max(100)}),i.strictObject({action:i.literal("replace"),expectedRevision:i.string(),text:i.string().max(1048576)}),i.strictObject({action:i.literal("validate"),text:i.string().max(1048576)}),i.strictObject({action:i.literal("restore"),expectedRevision:i.string(),revision:i.string()}),i.strictObject({action:i.literal("trust"),root:i.string(),accountId:i.string(),trusted:i.boolean()}),i.strictObject({action:i.literal("client-state"),owner:i.string(),patch:z,importOnly:i.boolean().optional()})]);function ne(e){let t=null;async function r(l,n){let g=R(e).config,w=null,p=null,d=null;try{w=await B(g),d=await E(e,{projectRoot:l,accountId:n}),l||(t=d)}catch(v){p=C(v,g)}let y=d??(l?null:t);return{path:g,text:w,rawRevision:L(w),issue:p,effective:y,usingLastValid:!d&&!!y,applies:"next_turn",recoverableRevisions:await H(e),clientState:p?null:await q(e)}}s(r,"status");async function o(l){let n=Oe.parse(l);return n.action==="validate"?{valid:!0,document:D(n.text,R(e).config)}:(n.action==="patch"&&await G(e,n.expectedRevision,n.operations),n.action==="replace"&&await M(e,n.expectedRevision,n.text),n.action==="restore"&&await $(e,n.revision,n.expectedRevision),n.action==="trust"&&await W(e,n.root,n.accountId,n.trusted),n.action==="client-state"?Y(e,n.owner,n.patch,n.importOnly):r())}return s(o,"mutate"),{status:r,mutate:o,schema:j}}s(ne,"createConfigurationPayloads");import{Buffer as ie}from"node:buffer";var A={"Access-Control-Allow-Headers":"authorization, content-type, x-openpond-team-id","Access-Control-Allow-Methods":"GET, POST, PUT, PATCH, DELETE, OPTIONS"},Se=25*1024*1024,x=class extends Error{constructor(r,o,l){super(l);this.status=r;this.code=o;this.name="HttpBodyError"}status;code;static{s(this,"HttpBodyError")}};function ae(e,t,r={}){for(let[l,n]of Object.entries(A))t.setHeader(l,n);let o=ce(e.headers.origin);return o?(t.setHeader("Vary",xe(t.getHeader("Vary"))),Re(o,r)?(t.setHeader("Access-Control-Allow-Origin",o),{allowed:!0,origin:o}):{allowed:!1,origin:o}):{allowed:!0,origin:null}}s(ae,"applyCorsHeaders");function Re(e,t={}){if(e==="null")return!0;let r=se(e);return r?Ce(r)?!0:new Set((t.allowedOrigins??[]).map(l=>l?se(l):null).filter(l=>!!l)).has(r):!1}s(Re,"isAllowedCorsOrigin");function h(e,t,r){e.writeHead(t,{"Content-Type":"application/json",...A}),e.end(JSON.stringify(r))}s(h,"sendJson");function Je(e,t,r){e.writeHead(t,{"Content-Type":"text/plain; charset=utf-8",...A}),e.end(r)}s(Je,"sendText");function Fe(e,t,r,o){e.writeHead(t,{"Content-Type":o,"Content-Length":String(r.byteLength),"Cache-Control":"no-store","X-Content-Type-Options":"nosniff",...A}),e.end(r)}s(Fe,"sendBinary");async function _(e,t={}){let r=t.maxBytes??Se,o=ce(e.headers["content-type"]),l=[],n=0;for await(let w of e){let p=ie.from(w);if(n+=p.byteLength,n>r)throw new x(413,"request_body_too_large",`JSON request body exceeds ${r} bytes.`);l.push(p)}let g=ie.concat(l).toString("utf8").trim();if(!g)return{};if(!Pe(o))throw new x(415,"unsupported_media_type","JSON request body requires Content-Type: application/json.");try{return JSON.parse(g)}catch{throw new x(400,"invalid_json","Request body is not valid JSON.")}}s(_,"readJson");function le(e,t,r){let o=e.headers.authorization;return(typeof o=="string"&&o.startsWith("Bearer ")?o.slice(7):null)===r}s(le,"hasAuth");function ce(e){return Array.isArray(e)?e[0]??null:e??null}s(ce,"headerValue");function Pe(e){if(!e)return!1;let t=e.split(";")[0]?.trim().toLowerCase();return t==="application/json"||!!t?.endsWith("+json")}s(Pe,"isJsonContentType");function se(e){try{let t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:t.origin}catch{return null}}s(se,"normalizeOrigin");function Ce(e){let t=new URL(e);return t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="::1"||t.hostname==="[::1]"}s(Ce,"isLoopbackOrigin");function xe(e){let r=(Array.isArray(e)?e.join(", "):e?String(e):"").split(",").map(o=>o.trim()).filter(Boolean);return r.some(o=>o.toLowerCase()==="origin")||r.push("Origin"),r.join(", ")}s(xe,"appendVaryOrigin");function pe(e){return`<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>OpenPond recovery</title>
3
3
  <style nonce="${e}">body{font:16px system-ui;background:#171819;color:#eee;max-width:850px;margin:6vh auto;padding:24px}textarea{box-sizing:border-box;width:100%;min-height:280px;background:#222;color:#eee;padding:14px;border:1px solid #777;border-radius:8px;font:14px monospace}button,input,select{font:inherit;margin:6px;padding:8px}pre{white-space:pre-wrap}code{overflow-wrap:anywhere}button{cursor:pointer}p{line-height:1.5}</style>
4
4
  <h1>OpenPond needs a storage repair</h1><p id="issue" role="alert">Loading recovery details\u2026</p><p><code id="file"></code></p>
5
5
  <p id="action"></p><p>Migration backups and the source installation remain available. Execution services are stopped while recovery is open.</p>
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{i as a,j as b,k as c}from"./chunk-GWDPEBFV.js";import"./chunk-FRWPAVCD.js";import"./chunk-HKYGCUA6.js";import"./chunk-P7EHGAOW.js";import"./chunk-M3FDHTJ2.js";import"./chunk-Q7QAKAGF.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-J2S7BOZU.js";import"./chunk-A2PIGBPD.js";import"./chunk-6FA3GG5B.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as resolveWebLaunchMessages,c as runOpenPondAppServerCli,b as runOpenPondServerCli};
2
+ import{i as a,j as b,k as c}from"./chunk-QGHFQHLH.js";import"./chunk-FRWPAVCD.js";import"./chunk-7VRXJGFG.js";import"./chunk-P7EHGAOW.js";import"./chunk-M3FDHTJ2.js";import"./chunk-Q7QAKAGF.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import"./chunk-J2S7BOZU.js";import"./chunk-A2PIGBPD.js";import"./chunk-6FA3GG5B.js";import"./chunk-NNLI4OWY.js";import"./chunk-HZP5U2AA.js";import"./chunk-ES2ISFJC.js";import"./chunk-H7IWJN7L.js";import"./chunk-FTQLQJQV.js";export{a as resolveWebLaunchMessages,c as runOpenPondAppServerCli,b as runOpenPondServerCli};
@@ -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 GA,b as KA,c as YA,d as H,e as XA,f as go,g as z,h as Cu,j as QA}from"./chunk-GWDPEBFV.js";import{$ as hx,$a as fT,$b as Pu,$c as zA,A as D_,Aa as Kx,Ab as HT,Ac as PA,B as B_,Ba as Yx,Bb as OT,Bc as wh,C as $_,Ca as Ts,Cb as $T,Cc as _A,D as q_,Da as As,Db as LT,Dc as yh,E as ex,Ea as Xx,Eb as Ru,Ec as xA,F as tx,Fa as Qx,Fb as NT,Fc as TA,G as nx,Ga as Zx,Gb as FT,Gc as AA,H as rx,Ha as eT,Hb as UT,Hc as CA,I as ox,Ia as tT,Ib as qT,Ic as EA,J as ax,Ja as nT,Jb as zT,Jc as fo,K as sx,Ka as rT,Kb as ph,Kc as Mr,L as ix,La as uo,Lb as WT,Lc as vh,M as cx,Ma as oT,Mb as VT,Mc as MA,N as uu,Na as aT,Nb as JT,Nc as jA,O as dx,Oa as lh,Ob as GT,Oc as Tu,P as pu,Pa as sT,Pb as KT,Pc as Ms,Q as lx,Qa as Rc,Qb as YT,Qc as HA,R as ux,Ra as iT,Rb as XT,Rc as Au,S as px,Sa as Cs,Sb as QT,Sc as OA,T as Rs,Ta as cT,Tb as ZT,Tc as DA,U as mu,Ua as dT,Ub as eA,Uc as BA,V as kc,Va as lT,Vb as tA,Vc as $A,W as ah,Wa as uT,Wb as nA,Wc as LA,X as na,Xa as oe,Xb as rA,Xc as NA,Y as mx,Ya as pT,Yb as oA,Yc as FA,Z as fx,Za as mT,Zb as aA,Zc as UA,_ as gx,_a as ku,_b as sA,_c as qA,a as xS,aa as wx,ab as gT,ac as iA,ad as WA,b as TS,ba as yx,bb as hT,bc as ra,bd as VA,c as AS,ca as vx,cb as wT,cc as _u,d as CS,da as fu,db as yT,dc as cA,dd as JA,e as ES,ea as gu,eb as bu,ec as mo,f as Tl,fa as Ps,fb as vT,fc as xu,g as iI,ga as hu,gb as po,gc as dA,h as cI,ha as kx,hb as Ae,hc as lA,i as dI,ia as bx,ib as kT,ic as mh,j as lI,ja as Sx,jb as pe,jc as fh,k as uI,ka as Ix,kb as bT,kc as uA,l as jg,la as Rx,lb as ST,lc as pA,m as fI,ma as Px,mb as IT,mc as mA,n as gI,na as wu,nb as RT,nc as fA,o as hI,oa as _x,ob as PT,oc as gh,p as wI,pa as xx,pb as _T,pc as gA,q as yI,qa as Tx,qb as xT,qc as hh,r as vI,ra as Ax,rb as TT,rc as hA,s as Yo,sa as Cx,sb as AT,sc as wA,t as kI,ta as Sc,tb as CT,tc as yA,u as bI,ua as zx,ub as ET,uc as vA,v as El,va as Wx,vb as Es,vc as kA,w as SI,wa as Vx,wb as Bn,wc as bA,x as II,xa as Jx,xb as He,xc as SA,y as sq,ya as Gx,yb as MT,yc as IA,z as O_,za as Ic,zb as jT,zc as RA}from"./chunk-L32JRSK7.js";import{A as Bx,C as yu,F as vu,G as ur,H as $x,I as sh,J as Lx,K as ih,N as Nx,O as ch,P as Fx,Q as Ux,R as qx,S as dh,T as xs,b as lr,d as Ex,e as Mx,h as jx,m as _s,n as Hx,p as Ox,q as Dx,s as bc}from"./chunk-U2AWYZZC.js";import{a as dt,b as L_,c as N_,f as F_,s as U_,u as uh,v as DT,w as Su,x as Iu,y as BT}from"./chunk-FRWPAVCD.js";import{a as j_,b as cu,d as ie,e as ct,f as Is,g as te,i as H_}from"./chunk-HKYGCUA6.js";import{a as cn,b as z_,c as W_,d as du,e as lu,g as V_,h as J_,i as G_,j as K_,k as Y_,l as X_,m as Q_,n as Z_}from"./chunk-P7EHGAOW.js";import{$ as Ul,$a as ZR,$b as MP,$c as i_,A as gR,Aa as zg,B as hR,Ba as ze,Bb as fc,Bc as Ql,Bd as ea,C as wR,Ca as Wl,Cb as hP,Cd as g_,D as Ll,Da as BR,Dc as eh,Dd as Er,E as yR,Ea as Wg,Eb as wP,Ec as YP,Ed as h_,F as Ng,Fb as yP,Fc as XP,Fd as w_,G as vR,Ga as $R,Gb as vP,Gd as y_,H as kR,Hd as co,I as nt,Ia as LR,Ib as ws,Ic as Zl,Id as bs,J as vt,Jb as kP,Jc as QP,Jd as ru,K as Nl,Ka as Vl,Kc as th,Kd as v_,L as bR,La as NR,Lb as gc,Lc as cr,Ld as k_,M as SR,Mb as Yl,Mc as ZP,Md as b_,Na as FR,Nb as bP,Nc as e_,Nd as yc,O as IR,Oa as UR,Ob as Gg,Oc as nh,Od as Ss,Pa as qR,Pb as SP,Pc as wc,Pd as ou,Q as RR,Qa as zR,Qb as IP,Qc as t_,Qd as S_,R as PR,Ra as WR,Rb as Kg,Rc as eu,Rd as au,S as Dn,Sa as VR,Sb as RP,Sc as n_,Sd as lo,Ta as JR,Tb as PP,Tc as r_,Td as I_,Ua as GR,Ub as _P,Uc as ys,Ud as R_,Va as KR,Vb as xP,Vc as o_,Vd as P_,Wa as io,Wb as TP,Wc as vs,Wd as su,X as _R,Xb as AP,Xc as a_,Xd as __,Ya as YR,Yb as CP,Yc as s_,Yd as vc,Z as Fl,Za as XR,Zb as Yg,Zc as rh,Zd as x_,_ as Fg,_a as QR,_b as EP,_c as tu,_d as T_,aa as xR,ac as jP,ad as Be,bb as eP,bc as HP,bd as nu,c as nR,ca as Ug,cb as Jl,cc as Xg,cd as c_,da as TR,db as tP,dc as OP,dd as d_,ea as Nt,eb as nP,ec as DP,ed as l_,fa as Xo,fb as rP,fc as BP,fd as oh,ga as Qo,gb as oP,gc as $P,gd as u_,ha as qg,hb as aP,hc as LP,hd as p_,he as iu,ia as AR,ib as sP,ic as NP,id as m_,ie as A_,ja as CR,jb as iP,jc as FP,je as C_,ka as ER,kb as cP,kc as UP,kd as ks,ke as dr,l as rR,la as MR,lb as dP,lc as qP,ld as f_,le as E_,m as oR,ma as jR,mb as lP,mc as zP,me as ta,n as aR,na as HR,nb as uP,nc as Qg,ne as M_,o as sR,oa as ql,ob as pP,oc as Zo,p as iR,pb as mP,pc as WP,qa as zl,qb as Vg,qc as VP,rb as Gl,rc as JP,s as cR,sb as fP,t as dR,tb as ir,tc as Xl,u as lR,ub as Cr,uc as GP,v as uR,vb as Jg,w as pR,wb as Kl,wc as KP,x as Lg,xa as OR,xb as gP,xc as hc,y as mR,yb as Ft,yc as Zg,z as fR,za as DR,zb as mc}from"./chunk-M3FDHTJ2.js";import"./chunk-XEOEKFG6.js";import{$a as sI,Ab as CI,Bb as EI,Ca as On,Da as tI,Dc as fs,E as DS,Ea as _l,Ec as UI,F as BS,Fa as sn,Fc as qI,G as $S,Gc as Dl,H as kn,Hc as Bl,Ia as nI,Ic as $l,Jc as zI,K as LS,Kc as Dg,L as Rl,La as rI,Lc as WI,M as NS,Mc as VI,Na as Eg,Nc as JI,Oa as je,Oc as GI,Pa as Ko,Pc as so,Qa as Ze,Qc as KI,Rb as MI,Rc as sr,S as FS,Sc as YI,T as US,Tb as jI,Ua as oI,Ub as HI,Wc as XI,X as qS,Xa as uc,Xc as QI,Ya as aI,Yc as gs,Za as xl,aa as zS,ab as Mg,ac as OI,ba as WS,bb as ms,ca as VS,da as JS,dc as DI,e as MS,ea as GS,fa as Pl,fb as Al,ga as Cg,gd as hs,ha as KS,hb as pI,hd as pc,ia as YS,ic as BI,id as ZI,ja as XS,jd as eR,kd as tR,mc as Og,md as Bg,na as QS,nb as Cl,nc as $I,ob as mI,od as $g,p as jS,pa as ps,pb as RI,q as HS,qb as Ml,qc as LI,r as Kt,rc as Hl,s as Sl,sa as ZS,sc as Ol,tb as Hg,tc as NI,ua as eI,ub as PI,v as Ar,vb as _I,vc as FI,w as lc,wb as xI,x as Ag,xb as jl,y as Il,yb as TI,z as OS,zb as AI}from"./chunk-Q7QAKAGF.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{D as us,E as cc,F as bl,d as kl,m as PS,n as ao,o as Je,p as _S}from"./chunk-UN3A7GEU.js";import"./chunk-J2S7BOZU.js";import{Ba as wS,Eb as Ge,Fb as Gt,Ia as yS,Lb as SS,Ma as vS,Na as kS,S as wl,Ua as vl,Ub as IS,Wb as RS,a as an,ab as bS,qa as gS,ra as yl,sa as hS}from"./chunk-A2PIGBPD.js";import{a as dc}from"./chunk-6FA3GG5B.js";import{$a as Go,Ca as dS,Ea as xg,F as _g,Fa as Tg,Ga as lS,N as eS,R as ro,T as tS,Ta as gl,Ua as uS,V as nS,W as rS,X as oS,Ya as pS,Za as mS,ab as fS,bb as hl,f as cl,k as Vo,l as Vb,m as ic,n as xr,o as pl,p as Jb,pa as oo,q as ml,r as Gb,ra as Jo,s as cs,u as Kb,v as Yb,w as Xb,wa as aS,x as Qb,xa as sS,y as Zb,ya as iS,za as cS}from"./chunk-NNLI4OWY.js";import{a as ss,b as is,c as Rg,d as dl,e as it,f as Pg,g as ll,j as Ve,k as ke,l as O,m as zb,o as Wb,p as ul,q as Ct}from"./chunk-HZP5U2AA.js";import{a as Wo,b as _}from"./chunk-ES2ISFJC.js";import{a as Fb,c as zo,f as Ub,h as il,i as qb,p as ds,q as fl,r as Tr,s as ls}from"./chunk-H7IWJN7L.js";import{a,b as Pe,c as Te,e as ar}from"./chunk-FTQLQJQV.js";var qr=Te((qme,fj)=>{"use strict";var pj=["nodebuffer","arraybuffer","fragments"],mj=typeof Blob<"u";mj&&pj.push("blob");fj.exports={BINARY_TYPES:pj,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:mj,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:a(()=>{},"NOOP")}});var Kc=Te((Wme,Ip)=>{"use strict";var{EMPTY_BUFFER:f6}=qr(),Jw=Buffer[Symbol.species];function g6(e,t){if(e.length===0)return f6;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let o=0;o<e.length;o++){let s=e[o];n.set(s,r),r+=s.length}return r<t?new Jw(n.buffer,n.byteOffset,r):n}a(g6,"concat");function gj(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}a(gj,"_mask");function hj(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}a(hj,"_unmask");function h6(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}a(h6,"toArrayBuffer");function Gw(e){if(Gw.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Jw(e):ArrayBuffer.isView(e)?t=new Jw(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Gw.readOnly=!1),t}a(Gw,"toBuffer");Ip.exports={concat:g6,mask:gj,toArrayBuffer:h6,toBuffer:Gw,unmask:hj};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Pe("bufferutil");Ip.exports.mask=function(t,n,r,o,s){s<48?gj(t,n,r,o,s):e.mask(t,n,r,o,s)},Ip.exports.unmask=function(t,n){t.length<32?hj(t,n):e.unmask(t,n)}}catch{}});var vj=Te((Jme,yj)=>{"use strict";var wj=Symbol("kDone"),Kw=Symbol("kRun"),Yw=class{static{a(this,"Limiter")}constructor(t){this[wj]=()=>{this.pending--,this[Kw]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Kw]()}[Kw](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[wj])}}};yj.exports=Yw});var di=Te((Kme,Ij)=>{"use strict";var Yc=Pe("zlib"),kj=Kc(),w6=vj(),{kStatusCode:bj}=qr(),y6=Buffer[Symbol.species],v6=Buffer.from([0,0,255,255]),Pp=Symbol("permessage-deflate"),zr=Symbol("total-length"),ii=Symbol("callback"),Ao=Symbol("buffers"),ci=Symbol("error"),Rp,Xw=class{static{a(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,!Rp){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Rp=new w6(n)}}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[ii];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,r=t.find(o=>!(n.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>o.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(r.server_no_context_takeover=!0),n.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(r.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?r.client_max_window_bits=n.clientMaxWindowBits:(r.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(r=>{let o=n[r];if(o.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(o=o[0],r==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else if(r==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else throw new Error(`Unknown parameter "${r}"`);n[r]=o})}),t}decompress(t,n,r){Rp.add(o=>{this._decompress(t,n,(s,i)=>{o(),r(s,i)})})}compress(t,n,r){Rp.add(o=>{this._compress(t,n,(s,i)=>{o(),r(s,i)})})}_decompress(t,n,r){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Yc.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Pp]=this,this._inflate[zr]=0,this._inflate[Ao]=[],this._inflate.on("error",b6),this._inflate.on("data",Sj)}this._inflate[ii]=r,this._inflate.write(t),n&&this._inflate.write(v6),this._inflate.flush(()=>{let s=this._inflate[ci];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=kj.concat(this._inflate[Ao],this._inflate[zr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[zr]=0,this._inflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,i)})}_compress(t,n,r){let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Yc.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[zr]=0,this._deflate[Ao]=[],this._deflate.on("data",k6)}this._deflate[ii]=r,this._deflate.write(t),this._deflate.flush(Yc.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=kj.concat(this._deflate[Ao],this._deflate[zr]);n&&(s=new y6(s.buffer,s.byteOffset,s.length-4)),this._deflate[ii]=null,this._deflate[zr]=0,this._deflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};Ij.exports=Xw;function k6(e){this[Ao].push(e),this[zr]+=e.length}a(k6,"deflateOnData");function Sj(e){if(this[zr]+=e.length,this[Pp]._maxPayload<1||this[zr]<=this[Pp]._maxPayload){this[Ao].push(e);return}this[ci]=new RangeError("Max payload size exceeded"),this[ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ci][bj]=1009,this.removeListener("data",Sj),this.reset()}a(Sj,"inflateOnData");function b6(e){if(this[Pp]._inflate=null,this[ci]){this[ii](this[ci]);return}e[bj]=1007,this[ii](e)}a(b6,"inflateOnError")});var li=Te((Xme,_p)=>{"use strict";var{isUtf8:Rj}=Pe("buffer"),{hasBlob:S6}=qr(),I6=[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 R6(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}a(R6,"isValidStatusCode");function Qw(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}a(Qw,"_isValidUTF8");function P6(e){return S6&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}a(P6,"isBlob");_p.exports={isBlob:P6,isValidStatusCode:R6,isValidUTF8:Qw,tokenChars:I6};if(Rj)_p.exports.isValidUTF8=function(e){return e.length<24?Qw(e):Rj(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Pe("utf-8-validate");_p.exports.isValidUTF8=function(t){return t.length<32?Qw(t):e(t)}}catch{}});var ry=Te((Zme,Ej)=>{"use strict";var{Writable:_6}=Pe("stream"),Pj=di(),{BINARY_TYPES:x6,EMPTY_BUFFER:_j,kStatusCode:T6,kWebSocket:A6}=qr(),{concat:Zw,toArrayBuffer:C6,unmask:E6}=Kc(),{isValidStatusCode:M6,isValidUTF8:xj}=li(),xp=Buffer[Symbol.species],xn=0,Tj=1,Aj=2,Cj=3,ey=4,ty=5,Tp=6,ny=class extends _6{static{a(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||x6[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[A6]=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=xn}_write(t,n,r){if(this._opcode===8&&this._state==xn)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){r(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(r)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new xp(r.buffer,r.byteOffset+t,r.length-t),new xp(r.buffer,r.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let r=this._buffers[0],o=n.length-t;t>=r.length?n.set(this._buffers.shift(),o):(n.set(new Uint8Array(r.buffer,r.byteOffset,t),o),this._buffers[0]=new xp(r.buffer,r.byteOffset+t,r.length-t)),t-=r.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case xn:this.getInfo(t);break;case Tj:this.getPayloadLength16(t);break;case Aj:this.getPayloadLength64(t);break;case Cj:this.getMask();break;case ey:this.getData(t);break;case ty:case Tp:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[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 r=(n[0]&64)===64;if(r&&!this._extensions[Pj.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(r){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=r}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(r){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=(n[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=Tj:this._payloadLength===127?this._state=Aj: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 n=this.consume(8),r=n.readUInt32BE(0);if(r>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=r*Math.pow(2,32)+n.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 n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=Cj:this._state=ey}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=ey}getData(t){let n=_j;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&E6(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let r=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(r);return}if(this._compressed){this._state=ty,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[Pj.extensionName].decompress(t,this._fin,(o,s)=>{if(o)return n(o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(i);return}this._fragments.push(s)}this.dataMessage(n),this._state===xn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=xn;return}let n=this._messageLength,r=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=Zw(r,n):this._binaryType==="arraybuffer"?o=C6(Zw(r,n)):this._binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=xn):(this._state=Tp,setImmediate(()=>{this.emit("message",o,!0),this._state=xn,this.startLoop(t)}))}else{let o=Zw(r,n);if(!this._skipUTF8Validation&&!xj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(s);return}this._state===ty||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=xn):(this._state=Tp,setImmediate(()=>{this.emit("message",o,!1),this._state=xn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,_j),this.end();else{let r=t.readUInt16BE(0);if(!M6(r)){let s=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(s);return}let o=new xp(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!xj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(s);return}this._loop=!1,this.emit("conclude",r,o),this.end()}this._state=xn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=xn):(this._state=Tp,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=xn,this.startLoop(n)}))}createError(t,n,r,o,s){this._loop=!1,this._errored=!0;let i=new t(r?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(i,this.createError),i.code=s,i[T6]=o,i}};Ej.exports=ny});var sy=Te((nfe,Hj)=>{"use strict";var{Duplex:tfe}=Pe("stream"),{randomFillSync:j6}=Pe("crypto"),{types:{isUint8Array:H6}}=Pe("util"),Mj=di(),{EMPTY_BUFFER:O6,kWebSocket:D6,NOOP:B6}=qr(),{isBlob:ui,isValidStatusCode:$6}=li(),{mask:jj,toBuffer:fa}=Kc(),Tn=Symbol("kByteLength"),L6=Buffer.alloc(4),Ap=8*1024,ga,pi=Ap,Fn=0,N6=1,F6=2,oy=class e{static{a(this,"Sender")}constructor(t,n,r){this._extensions=n||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Fn,this.onerror=B6,this[D6]=void 0}static frame(t,n){let r,o=!1,s=2,i=!1;n.mask&&(r=n.maskBuffer||L6,n.generateMask?n.generateMask(r):(pi===Ap&&(ga===void 0&&(ga=Buffer.alloc(Ap)),j6(ga,0,Ap),pi=0),r[0]=ga[pi++],r[1]=ga[pi++],r[2]=ga[pi++],r[3]=ga[pi++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let c;typeof t=="string"?(!n.mask||i)&&n[Tn]!==void 0?c=n[Tn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=n.mask&&n.readOnly&&!i);let d=c;c>=65536?(s+=8,d=127):c>125&&(s+=2,d=126);let l=Buffer.allocUnsafe(o?c+s:s);return l[0]=n.fin?n.opcode|128:n.opcode,n.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)),n.mask?(l[1]|=128,l[s-4]=r[0],l[s-3]=r[1],l[s-2]=r[2],l[s-1]=r[3],i?[l,t]:o?(jj(t,r,l,s,c),[l]):(jj(t,r,t,0,c),[l,t])):[l,t]}close(t,n,r,o){let s;if(t===void 0)s=O6;else{if(typeof t!="number"||!$6(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(t,0);else{let c=Buffer.byteLength(n);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+c),s.writeUInt16BE(t,0),typeof n=="string")s.write(n,2);else if(H6(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[Tn]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Fn?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(e.frame(s,i),o)}ping(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):ui(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};ui(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}pong(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):ui(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};ui(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}send(t,n,r){let o=this._extensions[Mj.extensionName],s=n.binary?2:1,i=n.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):ui(t)?(c=t.size,d=!1):(t=fa(t),c=t.length,d=fa.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=c>=o._threshold),this._compress=i):(i=!1,s=0),n.fin&&(this._firstFragment=!0);let l={[Tn]:c,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:d,rsv1:i};ui(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,this._compress,l,r]):this.getBlobData(t,this._compress,l,r):this._state!==Fn?this.enqueue([this.dispatch,t,this._compress,l,r]):this.dispatch(t,this._compress,l,r)}getBlobData(t,n,r,o){this._bufferedBytes+=r[Tn],this._state=F6,t.arrayBuffer().then(s=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(ay,this,c,o);return}this._bufferedBytes-=r[Tn];let i=fa(s);n?this.dispatch(i,n,r,o):(this._state=Fn,this.sendFrame(e.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(U6,this,s,o)})}dispatch(t,n,r,o){if(!n){this.sendFrame(e.frame(t,r),o);return}let s=this._extensions[Mj.extensionName];this._bufferedBytes+=r[Tn],this._state=N6,s.compress(t,r.fin,(i,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");ay(this,d,o);return}this._bufferedBytes-=r[Tn],this._state=Fn,r.readOnly=!1,this.sendFrame(e.frame(c,r),o),this.dequeue()})}dequeue(){for(;this._state===Fn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Tn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Tn],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};Hj.exports=oy;function ay(e,t,n){typeof n=="function"&&n(t);for(let r=0;r<e._queue.length;r++){let o=e._queue[r],s=o[o.length-1];typeof s=="function"&&s(t)}}a(ay,"callCallbacks");function U6(e,t,n){ay(e,t,n),e.onerror(t)}a(U6,"onError")});var qj=Te((ofe,Uj)=>{"use strict";var{kForOnEventAttribute:Xc,kListener:iy}=qr(),Oj=Symbol("kCode"),Dj=Symbol("kData"),Bj=Symbol("kError"),$j=Symbol("kMessage"),Lj=Symbol("kReason"),mi=Symbol("kTarget"),Nj=Symbol("kType"),Fj=Symbol("kWasClean"),Wr=class{static{a(this,"Event")}constructor(t){this[mi]=null,this[Nj]=t}get target(){return this[mi]}get type(){return this[Nj]}};Object.defineProperty(Wr.prototype,"target",{enumerable:!0});Object.defineProperty(Wr.prototype,"type",{enumerable:!0});var ha=class extends Wr{static{a(this,"CloseEvent")}constructor(t,n={}){super(t),this[Oj]=n.code===void 0?0:n.code,this[Lj]=n.reason===void 0?"":n.reason,this[Fj]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[Oj]}get reason(){return this[Lj]}get wasClean(){return this[Fj]}};Object.defineProperty(ha.prototype,"code",{enumerable:!0});Object.defineProperty(ha.prototype,"reason",{enumerable:!0});Object.defineProperty(ha.prototype,"wasClean",{enumerable:!0});var fi=class extends Wr{static{a(this,"ErrorEvent")}constructor(t,n={}){super(t),this[Bj]=n.error===void 0?null:n.error,this[$j]=n.message===void 0?"":n.message}get error(){return this[Bj]}get message(){return this[$j]}};Object.defineProperty(fi.prototype,"error",{enumerable:!0});Object.defineProperty(fi.prototype,"message",{enumerable:!0});var Qc=class extends Wr{static{a(this,"MessageEvent")}constructor(t,n={}){super(t),this[Dj]=n.data===void 0?null:n.data}get data(){return this[Dj]}};Object.defineProperty(Qc.prototype,"data",{enumerable:!0});var q6={addEventListener(e,t,n={}){for(let o of this.listeners(e))if(!n[Xc]&&o[iy]===t&&!o[Xc])return;let r;if(e==="message")r=a(function(s,i){let c=new Qc("message",{data:i?s:s.toString()});c[mi]=this,Cp(t,this,c)},"onMessage");else if(e==="close")r=a(function(s,i){let c=new ha("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[mi]=this,Cp(t,this,c)},"onClose");else if(e==="error")r=a(function(s){let i=new fi("error",{error:s,message:s.message});i[mi]=this,Cp(t,this,i)},"onError");else if(e==="open")r=a(function(){let s=new Wr("open");s[mi]=this,Cp(t,this,s)},"onOpen");else return;r[Xc]=!!n[Xc],r[iy]=t,n.once?this.once(e,r):this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[iy]===t&&!n[Xc]){this.removeListener(e,n);break}}};Uj.exports={CloseEvent:ha,ErrorEvent:fi,Event:Wr,EventTarget:q6,MessageEvent:Qc};function Cp(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}a(Cp,"callListener")});var Ep=Te((sfe,zj)=>{"use strict";var{tokenChars:Zc}=li();function hr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}a(hr,"push");function z6(e){let t=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),i===void 0)if(u===-1&&Zc[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 f=e.slice(d,u);l===44?(hr(t,f,n),n=Object.create(null)):i=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Zc[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),hr(n,e.slice(d,u),!0),l===44&&(hr(t,i,n),n=Object.create(null),i=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(Zc[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:r||(r=!0),o=!1}else if(s)if(Zc[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)s=!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)s=!0;else if(u===-1&&Zc[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 f=e.slice(d,u);r&&(f=f.replace(/\\/g,""),r=!1),hr(n,c,f),l===44&&(hr(t,i,n),n=Object.create(null),i=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||s||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return i===void 0?hr(t,m,n):(c===void 0?hr(n,m,!0):r?hr(n,c,m.replace(/\\/g,"")):hr(n,c,m),hr(t,i,n)),t}a(z6,"parse");function W6(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(r=>[t].concat(Object.keys(r).map(o=>{let s=r[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}a(W6,"format");zj.exports={format:W6,parse:z6}});var Op=Te((lfe,nH)=>{"use strict";var V6=Pe("events"),J6=Pe("https"),G6=Pe("http"),Jj=Pe("net"),K6=Pe("tls"),{randomBytes:Y6,createHash:X6}=Pe("crypto"),{Duplex:cfe,Readable:dfe}=Pe("stream"),{URL:cy}=Pe("url"),Co=di(),Q6=ry(),Z6=sy(),{isBlob:e5}=li(),{BINARY_TYPES:Wj,CLOSE_TIMEOUT:t5,EMPTY_BUFFER:Mp,GUID:n5,kForOnEventAttribute:dy,kListener:r5,kStatusCode:o5,kWebSocket:mt,NOOP:Gj}=qr(),{EventTarget:{addEventListener:a5,removeEventListener:s5}}=qj(),{format:i5,parse:c5}=Ep(),{toBuffer:d5}=Kc(),Kj=Symbol("kAborted"),ly=[8,13],Vr=["CONNECTING","OPEN","CLOSING","CLOSED"],l5=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,We=class e extends V6{static{a(this,"WebSocket")}constructor(t,n,r){super(),this._binaryType=Wj[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Mp,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,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(r=n,n=[]):n=[n]),Yj(this,t,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Wj.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,n,r){let o=new Q6({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),s=new Z6(t,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=t,o[mt]=this,s[mt]=this,t[mt]=this,o.on("conclude",m5),o.on("drain",f5),o.on("error",g5),o.on("message",h5),o.on("ping",w5),o.on("pong",y5),s.onerror=v5,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Zj),t.on("data",Hp),t.on("end",eH),t.on("error",tH),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[Co.extensionName]&&this._extensions[Co.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(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,n,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Qj(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){uy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||Mp,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){uy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||Mp,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(r=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){uy(this,t,r);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Co.extensionName]||(o.compress=!1),this._sender.send(t||Mp,o,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(We,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(We.prototype,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(We,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(We.prototype,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(We,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(We.prototype,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(We,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});Object.defineProperty(We.prototype,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(We.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(We.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[dy])return t[r5];return null},set(t){for(let n of this.listeners(e))if(n[dy]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[dy]:!0})}})});We.prototype.addEventListener=a5;We.prototype.removeEventListener=s5;nH.exports=We;function Yj(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:t5,protocolVersion:ly[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,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,!ly.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ly.join(", ")})`);let s;if(t instanceof cy)s=t;else try{s=new cy(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),e._url=s.href;let i=s.protocol==="wss:",c=s.protocol==="ws+unix:",d;if(s.protocol!=="ws:"&&!i&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!s.pathname?d="The URL's pathname is empty":s.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;jp(e,h);return}let l=i?443:80,u=Y6(16).toString("base64"),p=i?J6.request:G6.request,m=new Set,f;if(o.createConnection=o.createConnection||(i?p5:u5),o.defaultPort=o.defaultPort||l,o.port=s.port||l,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new Co({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=i5({[Co.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!l5.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let w;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=i,e._originalHostOrSocketPath=c?o.socketPath:s.host;let h=r&&r.headers;if(r={...r,headers:{}},h)for(let[v,g]of Object.entries(h))r.headers[v.toLowerCase()]=g}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),w=e._req=p(o),e._redirects&&e.emit("redirect",e.url,w)}else w=e._req=p(o);o.timeout&&w.on("timeout",()=>{pn(e,w,"Opening handshake has timed out")}),w.on("error",h=>{w===null||w[Kj]||(w=e._req=null,jp(e,h))}),w.on("response",h=>{let v=h.headers.location,g=h.statusCode;if(v&&o.followRedirects&&g>=300&&g<400){if(++e._redirects>o.maxRedirects){pn(e,w,"Maximum redirects exceeded");return}w.abort();let S;try{S=new cy(v,t)}catch{let k=new SyntaxError(`Invalid URL: ${v}`);jp(e,k);return}Yj(e,S,n,r)}else e.emit("unexpected-response",w,h)||pn(e,w,`Unexpected server response: ${h.statusCode}`)}),w.on("upgrade",(h,v,g)=>{if(e.emit("upgrade",h),e.readyState!==We.CONNECTING)return;w=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){pn(e,v,"Invalid Upgrade header");return}let R=X6("sha1").update(u+n5).digest("base64");if(h.headers["sec-websocket-accept"]!==R){pn(e,v,"Invalid Sec-WebSocket-Accept header");return}let k=h.headers["sec-websocket-protocol"],y;if(k!==void 0?m.size?m.has(k)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":m.size&&(y="Server sent no subprotocol"),y){pn(e,v,y);return}k&&(e._protocol=k);let T=h.headers["sec-websocket-extensions"];if(T!==void 0){if(!f){pn(e,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=c5(T)}catch{pn(e,v,"Invalid Sec-WebSocket-Extensions header");return}let b=Object.keys(C);if(b.length!==1||b[0]!==Co.extensionName){pn(e,v,"Server indicated an extension that was not requested");return}try{f.accept(C[Co.extensionName])}catch{pn(e,v,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Co.extensionName]=f}e.setSocket(v,g,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(w,e):w.end()}a(Yj,"initAsClient");function jp(e,t){e._readyState=We.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}a(jp,"emitErrorAndClose");function u5(e){return e.path=e.socketPath,Jj.connect(e)}a(u5,"netConnect");function p5(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Jj.isIP(e.host)?"":e.host),K6.connect(e)}a(p5,"tlsConnect");function pn(e,t,n){e._readyState=We.CLOSING;let r=new Error(n);Error.captureStackTrace(r,pn),t.setHeader?(t[Kj]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(jp,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}a(pn,"abortHandshake");function uy(e,t,n){if(t){let r=e5(t)?t.size:d5(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Vr[e.readyState]})`);process.nextTick(n,r)}}a(uy,"sendAfterClose");function m5(e,t){let n=this[mt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[mt]!==void 0&&(n._socket.removeListener("data",Hp),process.nextTick(Xj,n._socket),e===1005?n.close():n.close(e,t))}a(m5,"receiverOnConclude");function f5(){let e=this[mt];e.isPaused||e._socket.resume()}a(f5,"receiverOnDrain");function g5(e){let t=this[mt];t._socket[mt]!==void 0&&(t._socket.removeListener("data",Hp),process.nextTick(Xj,t._socket),t.close(e[o5])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}a(g5,"receiverOnError");function Vj(){this[mt].emitClose()}a(Vj,"receiverOnFinish");function h5(e,t){this[mt].emit("message",e,t)}a(h5,"receiverOnMessage");function w5(e){let t=this[mt];t._autoPong&&t.pong(e,!this._isServer,Gj),t.emit("ping",e)}a(w5,"receiverOnPing");function y5(e){this[mt].emit("pong",e)}a(y5,"receiverOnPong");function Xj(e){e.resume()}a(Xj,"resume");function v5(e){let t=this[mt];t.readyState!==We.CLOSED&&(t.readyState===We.OPEN&&(t._readyState=We.CLOSING,Qj(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}a(v5,"senderOnError");function Qj(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}a(Qj,"setCloseTimer");function Zj(){let e=this[mt];if(this.removeListener("close",Zj),this.removeListener("data",Hp),this.removeListener("end",eH),e._readyState=We.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[mt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Vj),e._receiver.on("finish",Vj))}a(Zj,"socketOnClose");function Hp(e){this[mt]._receiver.write(e)||this.pause()}a(Hp,"socketOnData");function eH(){let e=this[mt];e._readyState=We.CLOSING,e._receiver.end(),this.end()}a(eH,"socketOnEnd");function tH(){let e=this[mt];this.removeListener("error",tH),this.on("error",Gj),e&&(e._readyState=We.CLOSING,this.destroy())}a(tH,"socketOnError")});var sH=Te((mfe,aH)=>{"use strict";var pfe=Op(),{Duplex:k5}=Pe("stream");function rH(e){e.emit("close")}a(rH,"emitClose");function b5(){!this.destroyed&&this._writableState.finished&&this.destroy()}a(b5,"duplexOnEnd");function oH(e){this.removeListener("error",oH),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}a(oH,"duplexOnError");function S5(e,t){let n=!0,r=new k5({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",a(function(s,i){let c=!i&&r._readableState.objectMode?s.toString():s;r.push(c)||e.pause()},"message")),e.once("error",a(function(s){r.destroyed||(n=!1,r.destroy(s))},"error")),e.once("close",a(function(){r.destroyed||r.push(null)},"close")),r._destroy=function(o,s){if(e.readyState===e.CLOSED){s(o),process.nextTick(rH,r);return}let i=!1;e.once("error",a(function(d){i=!0,s(d)},"error")),e.once("close",a(function(){i||s(o),process.nextTick(rH,r)},"close")),n&&e.terminate()},r._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),r._readableState.endEmitted&&r.destroy()):(e._socket.once("finish",a(function(){o()},"finish")),e.close()))},r._read=function(){e.isPaused&&e.resume()},r._write=function(o,s,i){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._write(o,s,i)},"open"));return}e.send(o,i)},r.on("end",b5),r.on("error",oH),r}a(S5,"createWebSocketStream");aH.exports=S5});var py=Te((gfe,iH)=>{"use strict";var{tokenChars:I5}=li();function R5(e){let t=new Set,n=-1,r=-1,o=0;for(o;o<e.length;o++){let i=e.charCodeAt(o);if(r===-1&&I5[i]===1)n===-1&&(n=o);else if(o!==0&&(i===32||i===9))r===-1&&n!==-1&&(r=o);else if(i===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${o}`);r===-1&&(r=o);let c=e.slice(n,r);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),n=r=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(n===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=e.slice(n,o);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}a(R5,"parse");iH.exports={parse:R5}});var fH=Te((yfe,mH)=>{"use strict";var P5=Pe("events"),Dp=Pe("http"),{Duplex:wfe}=Pe("stream"),{createHash:_5}=Pe("crypto"),cH=Ep(),wa=di(),x5=py(),T5=Op(),{CLOSE_TIMEOUT:A5,GUID:C5,kWebSocket:E5}=qr(),M5=/^[+/0-9A-Za-z]{22}==$/,dH=0,lH=1,pH=2,my=class extends P5{static{a(this,"WebSocketServer")}constructor(t,n){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:A5,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:T5,...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=Dp.createServer((r,o)=>{let s=Dp.STATUS_CODES[426];o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=j5(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:a((o,s,i)=>{this.handleUpgrade(o,s,i,r)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=dH}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===pH){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(ed,this);return}if(t&&this.once("close",t),this._state!==lH)if(this._state=lH,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(ed,this):process.nextTick(ed,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{ed(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,r,o){n.on("error",uH);let s=t.headers["sec-websocket-key"],i=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ya(this,t,n,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){ya(this,t,n,400,"Invalid Upgrade header");return}if(s===void 0||!M5.test(s)){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){td(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=x5.parse(d)}catch{ya(this,t,n,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 wa({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=cH.parse(u);f[wa.extensionName]&&(m.accept(f[wa.extensionName]),p[wa.extensionName]=m)}catch{ya(this,t,n,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,(f,w,h,v)=>{if(!f)return td(n,w||401,h,v);this.completeUpgrade(p,s,l,t,n,r,o)});return}if(!this.options.verifyClient(m))return td(n,401)}this.completeUpgrade(p,s,l,t,n,r,o)}completeUpgrade(t,n,r,o,s,i,c){if(!s.readable||!s.writable)return s.destroy();if(s[E5])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>dH)return td(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${_5("sha1").update(n+C5).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(r.size){let p=this.options.handleProtocols?this.options.handleProtocols(r,o):r.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[wa.extensionName]){let p=t[wa.extensionName].params,m=cH.format({[wa.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),s.write(l.concat(`\r
3
+ import{a as GA,b as KA,c as YA,d as H,e as XA,f as go,g as z,h as Cu,j as QA}from"./chunk-QGHFQHLH.js";import{$ as hx,$a as fT,$b as Pu,$c as zA,A as D_,Aa as Kx,Ab as HT,Ac as PA,B as B_,Ba as Yx,Bb as OT,Bc as wh,C as $_,Ca as Ts,Cb as $T,Cc as _A,D as q_,Da as As,Db as LT,Dc as yh,E as ex,Ea as Xx,Eb as Ru,Ec as xA,F as tx,Fa as Qx,Fb as NT,Fc as TA,G as nx,Ga as Zx,Gb as FT,Gc as AA,H as rx,Ha as eT,Hb as UT,Hc as CA,I as ox,Ia as tT,Ib as qT,Ic as EA,J as ax,Ja as nT,Jb as zT,Jc as fo,K as sx,Ka as rT,Kb as ph,Kc as Mr,L as ix,La as uo,Lb as WT,Lc as vh,M as cx,Ma as oT,Mb as VT,Mc as MA,N as uu,Na as aT,Nb as JT,Nc as jA,O as dx,Oa as lh,Ob as GT,Oc as Tu,P as pu,Pa as sT,Pb as KT,Pc as Ms,Q as lx,Qa as Rc,Qb as YT,Qc as HA,R as ux,Ra as iT,Rb as XT,Rc as Au,S as px,Sa as Cs,Sb as QT,Sc as OA,T as Rs,Ta as cT,Tb as ZT,Tc as DA,U as mu,Ua as dT,Ub as eA,Uc as BA,V as kc,Va as lT,Vb as tA,Vc as $A,W as ah,Wa as uT,Wb as nA,Wc as LA,X as na,Xa as oe,Xb as rA,Xc as NA,Y as mx,Ya as pT,Yb as oA,Yc as FA,Z as fx,Za as mT,Zb as aA,Zc as UA,_ as gx,_a as ku,_b as sA,_c as qA,a as xS,aa as wx,ab as gT,ac as iA,ad as WA,b as TS,ba as yx,bb as hT,bc as ra,bd as VA,c as AS,ca as vx,cb as wT,cc as _u,d as CS,da as fu,db as yT,dc as cA,dd as JA,e as ES,ea as gu,eb as bu,ec as mo,f as Tl,fa as Ps,fb as vT,fc as xu,g as iI,ga as hu,gb as po,gc as dA,h as cI,ha as kx,hb as Ae,hc as lA,i as dI,ia as bx,ib as kT,ic as mh,j as lI,ja as Sx,jb as pe,jc as fh,k as uI,ka as Ix,kb as bT,kc as uA,l as jg,la as Rx,lb as ST,lc as pA,m as fI,ma as Px,mb as IT,mc as mA,n as gI,na as wu,nb as RT,nc as fA,o as hI,oa as _x,ob as PT,oc as gh,p as wI,pa as xx,pb as _T,pc as gA,q as yI,qa as Tx,qb as xT,qc as hh,r as vI,ra as Ax,rb as TT,rc as hA,s as Yo,sa as Cx,sb as AT,sc as wA,t as kI,ta as Sc,tb as CT,tc as yA,u as bI,ua as zx,ub as ET,uc as vA,v as El,va as Wx,vb as Es,vc as kA,w as SI,wa as Vx,wb as Bn,wc as bA,x as II,xa as Jx,xb as He,xc as SA,y as sq,ya as Gx,yb as MT,yc as IA,z as O_,za as Ic,zb as jT,zc as RA}from"./chunk-FC4HHYDK.js";import{A as Bx,C as yu,F as vu,G as ur,H as $x,I as sh,J as Lx,K as ih,N as Nx,O as ch,P as Fx,Q as Ux,R as qx,S as dh,T as xs,b as lr,d as Ex,e as Mx,h as jx,m as _s,n as Hx,p as Ox,q as Dx,s as bc}from"./chunk-GZX5FDUN.js";import{a as dt,b as L_,c as N_,f as F_,s as U_,u as uh,v as DT,w as Su,x as Iu,y as BT}from"./chunk-FRWPAVCD.js";import{a as j_,b as cu,d as ie,e as ct,f as Is,g as te,i as H_}from"./chunk-7VRXJGFG.js";import{a as cn,b as z_,c as W_,d as du,e as lu,g as V_,h as J_,i as G_,j as K_,k as Y_,l as X_,m as Q_,n as Z_}from"./chunk-P7EHGAOW.js";import{$ as Ul,$a as ZR,$b as MP,$c as i_,A as gR,Aa as zg,B as hR,Ba as ze,Bb as fc,Bc as Ql,Bd as ea,C as wR,Ca as Wl,Cb as hP,Cd as g_,D as Ll,Da as BR,Dc as eh,Dd as Er,E as yR,Ea as Wg,Eb as wP,Ec as YP,Ed as h_,F as Ng,Fb as yP,Fc as XP,Fd as w_,G as vR,Ga as $R,Gb as vP,Gd as y_,H as kR,Hd as co,I as nt,Ia as LR,Ib as ws,Ic as Zl,Id as bs,J as vt,Jb as kP,Jc as QP,Jd as ru,K as Nl,Ka as Vl,Kc as th,Kd as v_,L as bR,La as NR,Lb as gc,Lc as cr,Ld as k_,M as SR,Mb as Yl,Mc as ZP,Md as b_,Na as FR,Nb as bP,Nc as e_,Nd as yc,O as IR,Oa as UR,Ob as Gg,Oc as nh,Od as Ss,Pa as qR,Pb as SP,Pc as wc,Pd as ou,Q as RR,Qa as zR,Qb as IP,Qc as t_,Qd as S_,R as PR,Ra as WR,Rb as Kg,Rc as eu,Rd as au,S as Dn,Sa as VR,Sb as RP,Sc as n_,Sd as lo,Ta as JR,Tb as PP,Tc as r_,Td as I_,Ua as GR,Ub as _P,Uc as ys,Ud as R_,Va as KR,Vb as xP,Vc as o_,Vd as P_,Wa as io,Wb as TP,Wc as vs,Wd as su,X as _R,Xb as AP,Xc as a_,Xd as __,Ya as YR,Yb as CP,Yc as s_,Yd as vc,Z as Fl,Za as XR,Zb as Yg,Zc as rh,Zd as x_,_ as Fg,_a as QR,_b as EP,_c as tu,_d as T_,aa as xR,ac as jP,ad as Be,bb as eP,bc as HP,bd as nu,c as nR,ca as Ug,cb as Jl,cc as Xg,cd as c_,da as TR,db as tP,dc as OP,dd as d_,ea as Nt,eb as nP,ec as DP,ed as l_,fa as Xo,fb as rP,fc as BP,fd as oh,ga as Qo,gb as oP,gc as $P,gd as u_,ha as qg,hb as aP,hc as LP,hd as p_,he as iu,ia as AR,ib as sP,ic as NP,id as m_,ie as A_,ja as CR,jb as iP,jc as FP,je as C_,ka as ER,kb as cP,kc as UP,kd as ks,ke as dr,l as rR,la as MR,lb as dP,lc as qP,ld as f_,le as E_,m as oR,ma as jR,mb as lP,mc as zP,me as ta,n as aR,na as HR,nb as uP,nc as Qg,ne as M_,o as sR,oa as ql,ob as pP,oc as Zo,p as iR,pb as mP,pc as WP,qa as zl,qb as Vg,qc as VP,rb as Gl,rc as JP,s as cR,sb as fP,t as dR,tb as ir,tc as Xl,u as lR,ub as Cr,uc as GP,v as uR,vb as Jg,w as pR,wb as Kl,wc as KP,x as Lg,xa as OR,xb as gP,xc as hc,y as mR,yb as Ft,yc as Zg,z as fR,za as DR,zb as mc}from"./chunk-M3FDHTJ2.js";import"./chunk-XEOEKFG6.js";import{$a as sI,Ab as CI,Bb as EI,Ca as On,Da as tI,Dc as fs,E as DS,Ea as _l,Ec as UI,F as BS,Fa as sn,Fc as qI,G as $S,Gc as Dl,H as kn,Hc as Bl,Ia as nI,Ic as $l,Jc as zI,K as LS,Kc as Dg,L as Rl,La as rI,Lc as WI,M as NS,Mc as VI,Na as Eg,Nc as JI,Oa as je,Oc as GI,Pa as Ko,Pc as so,Qa as Ze,Qc as KI,Rb as MI,Rc as sr,S as FS,Sc as YI,T as US,Tb as jI,Ua as oI,Ub as HI,Wc as XI,X as qS,Xa as uc,Xc as QI,Ya as aI,Yc as gs,Za as xl,aa as zS,ab as Mg,ac as OI,ba as WS,bb as ms,ca as VS,da as JS,dc as DI,e as MS,ea as GS,fa as Pl,fb as Al,ga as Cg,gd as hs,ha as KS,hb as pI,hd as pc,ia as YS,ic as BI,id as ZI,ja as XS,jd as eR,kd as tR,mc as Og,md as Bg,na as QS,nb as Cl,nc as $I,ob as mI,od as $g,p as jS,pa as ps,pb as RI,q as HS,qb as Ml,qc as LI,r as Kt,rc as Hl,s as Sl,sa as ZS,sc as Ol,tb as Hg,tc as NI,ua as eI,ub as PI,v as Ar,vb as _I,vc as FI,w as lc,wb as xI,x as Ag,xb as jl,y as Il,yb as TI,z as OS,zb as AI}from"./chunk-Q7QAKAGF.js";import"./chunk-6MI4KKWF.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{D as us,E as cc,F as bl,d as kl,m as PS,n as ao,o as Je,p as _S}from"./chunk-UN3A7GEU.js";import"./chunk-J2S7BOZU.js";import{Ba as wS,Eb as Ge,Fb as Gt,Ia as yS,Lb as SS,Ma as vS,Na as kS,S as wl,Ua as vl,Ub as IS,Wb as RS,a as an,ab as bS,qa as gS,ra as yl,sa as hS}from"./chunk-A2PIGBPD.js";import{a as dc}from"./chunk-6FA3GG5B.js";import{$a as Go,Ca as dS,Ea as xg,F as _g,Fa as Tg,Ga as lS,N as eS,R as ro,T as tS,Ta as gl,Ua as uS,V as nS,W as rS,X as oS,Ya as pS,Za as mS,ab as fS,bb as hl,f as cl,k as Vo,l as Vb,m as ic,n as xr,o as pl,p as Jb,pa as oo,q as ml,r as Gb,ra as Jo,s as cs,u as Kb,v as Yb,w as Xb,wa as aS,x as Qb,xa as sS,y as Zb,ya as iS,za as cS}from"./chunk-NNLI4OWY.js";import{a as ss,b as is,c as Rg,d as dl,e as it,f as Pg,g as ll,j as Ve,k as ke,l as O,m as zb,o as Wb,p as ul,q as Ct}from"./chunk-HZP5U2AA.js";import{a as Wo,b as _}from"./chunk-ES2ISFJC.js";import{a as Fb,c as zo,f as Ub,h as il,i as qb,p as ds,q as fl,r as Tr,s as ls}from"./chunk-H7IWJN7L.js";import{a,b as Pe,c as Te,e as ar}from"./chunk-FTQLQJQV.js";var qr=Te((qme,fj)=>{"use strict";var pj=["nodebuffer","arraybuffer","fragments"],mj=typeof Blob<"u";mj&&pj.push("blob");fj.exports={BINARY_TYPES:pj,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:mj,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:a(()=>{},"NOOP")}});var Kc=Te((Wme,Ip)=>{"use strict";var{EMPTY_BUFFER:f6}=qr(),Jw=Buffer[Symbol.species];function g6(e,t){if(e.length===0)return f6;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),r=0;for(let o=0;o<e.length;o++){let s=e[o];n.set(s,r),r+=s.length}return r<t?new Jw(n.buffer,n.byteOffset,r):n}a(g6,"concat");function gj(e,t,n,r,o){for(let s=0;s<o;s++)n[r+s]=e[s]^t[s&3]}a(gj,"_mask");function hj(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}a(hj,"_unmask");function h6(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}a(h6,"toArrayBuffer");function Gw(e){if(Gw.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new Jw(e):ArrayBuffer.isView(e)?t=new Jw(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Gw.readOnly=!1),t}a(Gw,"toBuffer");Ip.exports={concat:g6,mask:gj,toArrayBuffer:h6,toBuffer:Gw,unmask:hj};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=Pe("bufferutil");Ip.exports.mask=function(t,n,r,o,s){s<48?gj(t,n,r,o,s):e.mask(t,n,r,o,s)},Ip.exports.unmask=function(t,n){t.length<32?hj(t,n):e.unmask(t,n)}}catch{}});var vj=Te((Jme,yj)=>{"use strict";var wj=Symbol("kDone"),Kw=Symbol("kRun"),Yw=class{static{a(this,"Limiter")}constructor(t){this[wj]=()=>{this.pending--,this[Kw]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Kw]()}[Kw](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[wj])}}};yj.exports=Yw});var di=Te((Kme,Ij)=>{"use strict";var Yc=Pe("zlib"),kj=Kc(),w6=vj(),{kStatusCode:bj}=qr(),y6=Buffer[Symbol.species],v6=Buffer.from([0,0,255,255]),Pp=Symbol("permessage-deflate"),zr=Symbol("total-length"),ii=Symbol("callback"),Ao=Symbol("buffers"),ci=Symbol("error"),Rp,Xw=class{static{a(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,!Rp){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Rp=new w6(n)}}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[ii];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let n=this._options,r=t.find(o=>!(n.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(n.serverMaxWindowBits===!1||typeof n.serverMaxWindowBits=="number"&&n.serverMaxWindowBits>o.server_max_window_bits)||typeof n.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return n.serverNoContextTakeover&&(r.server_no_context_takeover=!0),n.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof n.serverMaxWindowBits=="number"&&(r.server_max_window_bits=n.serverMaxWindowBits),typeof n.clientMaxWindowBits=="number"?r.client_max_window_bits=n.clientMaxWindowBits:(r.client_max_window_bits===!0||n.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(t){let n=t[0];if(this._options.clientNoContextTakeover===!1&&n.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!n.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(n.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&n.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return n}normalizeParams(t){return t.forEach(n=>{Object.keys(n).forEach(r=>{let o=n[r];if(o.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(o=o[0],r==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else if(r==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${o}`);o=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${o}`)}else throw new Error(`Unknown parameter "${r}"`);n[r]=o})}),t}decompress(t,n,r){Rp.add(o=>{this._decompress(t,n,(s,i)=>{o(),r(s,i)})})}compress(t,n,r){Rp.add(o=>{this._compress(t,n,(s,i)=>{o(),r(s,i)})})}_decompress(t,n,r){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Yc.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Pp]=this,this._inflate[zr]=0,this._inflate[Ao]=[],this._inflate.on("error",b6),this._inflate.on("data",Sj)}this._inflate[ii]=r,this._inflate.write(t),n&&this._inflate.write(v6),this._inflate.flush(()=>{let s=this._inflate[ci];if(s){this._inflate.close(),this._inflate=null,r(s);return}let i=kj.concat(this._inflate[Ao],this._inflate[zr]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[zr]=0,this._inflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),r(null,i)})}_compress(t,n,r){let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Yc.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Yc.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[zr]=0,this._deflate[Ao]=[],this._deflate.on("data",k6)}this._deflate[ii]=r,this._deflate.write(t),this._deflate.flush(Yc.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=kj.concat(this._deflate[Ao],this._deflate[zr]);n&&(s=new y6(s.buffer,s.byteOffset,s.length-4)),this._deflate[ii]=null,this._deflate[zr]=0,this._deflate[Ao]=[],n&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};Ij.exports=Xw;function k6(e){this[Ao].push(e),this[zr]+=e.length}a(k6,"deflateOnData");function Sj(e){if(this[zr]+=e.length,this[Pp]._maxPayload<1||this[zr]<=this[Pp]._maxPayload){this[Ao].push(e);return}this[ci]=new RangeError("Max payload size exceeded"),this[ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ci][bj]=1009,this.removeListener("data",Sj),this.reset()}a(Sj,"inflateOnData");function b6(e){if(this[Pp]._inflate=null,this[ci]){this[ii](this[ci]);return}e[bj]=1007,this[ii](e)}a(b6,"inflateOnError")});var li=Te((Xme,_p)=>{"use strict";var{isUtf8:Rj}=Pe("buffer"),{hasBlob:S6}=qr(),I6=[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 R6(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}a(R6,"isValidStatusCode");function Qw(e){let t=e.length,n=0;for(;n<t;)if((e[n]&128)===0)n++;else if((e[n]&224)===192){if(n+1===t||(e[n+1]&192)!==128||(e[n]&254)===192)return!1;n+=2}else if((e[n]&240)===224){if(n+2>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||e[n]===224&&(e[n+1]&224)===128||e[n]===237&&(e[n+1]&224)===160)return!1;n+=3}else if((e[n]&248)===240){if(n+3>=t||(e[n+1]&192)!==128||(e[n+2]&192)!==128||(e[n+3]&192)!==128||e[n]===240&&(e[n+1]&240)===128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}a(Qw,"_isValidUTF8");function P6(e){return S6&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}a(P6,"isBlob");_p.exports={isBlob:P6,isValidStatusCode:R6,isValidUTF8:Qw,tokenChars:I6};if(Rj)_p.exports.isValidUTF8=function(e){return e.length<24?Qw(e):Rj(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=Pe("utf-8-validate");_p.exports.isValidUTF8=function(t){return t.length<32?Qw(t):e(t)}}catch{}});var ry=Te((Zme,Ej)=>{"use strict";var{Writable:_6}=Pe("stream"),Pj=di(),{BINARY_TYPES:x6,EMPTY_BUFFER:_j,kStatusCode:T6,kWebSocket:A6}=qr(),{concat:Zw,toArrayBuffer:C6,unmask:E6}=Kc(),{isValidStatusCode:M6,isValidUTF8:xj}=li(),xp=Buffer[Symbol.species],xn=0,Tj=1,Aj=2,Cj=3,ey=4,ty=5,Tp=6,ny=class extends _6{static{a(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||x6[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[A6]=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=xn}_write(t,n,r){if(this._opcode===8&&this._state==xn)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){r(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(r)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new xp(r.buffer,r.byteOffset+t,r.length-t),new xp(r.buffer,r.byteOffset,t)}let n=Buffer.allocUnsafe(t);do{let r=this._buffers[0],o=n.length-t;t>=r.length?n.set(this._buffers.shift(),o):(n.set(new Uint8Array(r.buffer,r.byteOffset,t),o),this._buffers[0]=new xp(r.buffer,r.byteOffset+t,r.length-t)),t-=r.length}while(t>0);return n}startLoop(t){this._loop=!0;do switch(this._state){case xn:this.getInfo(t);break;case Tj:this.getPayloadLength16(t);break;case Aj:this.getPayloadLength64(t);break;case Cj:this.getMask();break;case ey:this.getData(t);break;case ty:case Tp:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let n=this.consume(2);if((n[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 r=(n[0]&64)===64;if(r&&!this._extensions[Pj.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(n[0]&128)===128,this._opcode=n[0]&15,this._payloadLength=n[1]&127,this._opcode===0){if(r){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=r}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(r){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=(n[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=Tj:this._payloadLength===127?this._state=Aj: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 n=this.consume(8),r=n.readUInt32BE(0);if(r>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=r*Math.pow(2,32)+n.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 n=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(n);return}this._masked?this._state=Cj:this._state=ey}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=ey}getData(t){let n=_j;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}n=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&E6(n,this._mask)}if(this._opcode>7){this.controlMessage(n,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let r=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(r);return}if(this._compressed){this._state=ty,this.decompress(n,t);return}n.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(n)),this.dataMessage(t)}decompress(t,n){this._extensions[Pj.extensionName].decompress(t,this._fin,(o,s)=>{if(o)return n(o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");n(i);return}this._fragments.push(s)}this.dataMessage(n),this._state===xn&&this.startLoop(n)})}dataMessage(t){if(!this._fin){this._state=xn;return}let n=this._messageLength,r=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=Zw(r,n):this._binaryType==="arraybuffer"?o=C6(Zw(r,n)):this._binaryType==="blob"?o=new Blob(r):o=r,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=xn):(this._state=Tp,setImmediate(()=>{this.emit("message",o,!0),this._state=xn,this.startLoop(t)}))}else{let o=Zw(r,n);if(!this._skipUTF8Validation&&!xj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(s);return}this._state===ty||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=xn):(this._state=Tp,setImmediate(()=>{this.emit("message",o,!1),this._state=xn,this.startLoop(t)}))}}controlMessage(t,n){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,_j),this.end();else{let r=t.readUInt16BE(0);if(!M6(r)){let s=this.createError(RangeError,`invalid status code ${r}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");n(s);return}let o=new xp(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!xj(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");n(s);return}this._loop=!1,this.emit("conclude",r,o),this.end()}this._state=xn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=xn):(this._state=Tp,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=xn,this.startLoop(n)}))}createError(t,n,r,o,s){this._loop=!1,this._errored=!0;let i=new t(r?`Invalid WebSocket frame: ${n}`:n);return Error.captureStackTrace(i,this.createError),i.code=s,i[T6]=o,i}};Ej.exports=ny});var sy=Te((nfe,Hj)=>{"use strict";var{Duplex:tfe}=Pe("stream"),{randomFillSync:j6}=Pe("crypto"),{types:{isUint8Array:H6}}=Pe("util"),Mj=di(),{EMPTY_BUFFER:O6,kWebSocket:D6,NOOP:B6}=qr(),{isBlob:ui,isValidStatusCode:$6}=li(),{mask:jj,toBuffer:fa}=Kc(),Tn=Symbol("kByteLength"),L6=Buffer.alloc(4),Ap=8*1024,ga,pi=Ap,Fn=0,N6=1,F6=2,oy=class e{static{a(this,"Sender")}constructor(t,n,r){this._extensions=n||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Fn,this.onerror=B6,this[D6]=void 0}static frame(t,n){let r,o=!1,s=2,i=!1;n.mask&&(r=n.maskBuffer||L6,n.generateMask?n.generateMask(r):(pi===Ap&&(ga===void 0&&(ga=Buffer.alloc(Ap)),j6(ga,0,Ap),pi=0),r[0]=ga[pi++],r[1]=ga[pi++],r[2]=ga[pi++],r[3]=ga[pi++]),i=(r[0]|r[1]|r[2]|r[3])===0,s=6);let c;typeof t=="string"?(!n.mask||i)&&n[Tn]!==void 0?c=n[Tn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=n.mask&&n.readOnly&&!i);let d=c;c>=65536?(s+=8,d=127):c>125&&(s+=2,d=126);let l=Buffer.allocUnsafe(o?c+s:s);return l[0]=n.fin?n.opcode|128:n.opcode,n.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)),n.mask?(l[1]|=128,l[s-4]=r[0],l[s-3]=r[1],l[s-2]=r[2],l[s-1]=r[3],i?[l,t]:o?(jj(t,r,l,s,c),[l]):(jj(t,r,t,0,c),[l,t])):[l,t]}close(t,n,r,o){let s;if(t===void 0)s=O6;else{if(typeof t!="number"||!$6(t))throw new TypeError("First argument must be a valid error code number");if(n===void 0||!n.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(t,0);else{let c=Buffer.byteLength(n);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(s=Buffer.allocUnsafe(2+c),s.writeUInt16BE(t,0),typeof n=="string")s.write(n,2);else if(H6(n))s.set(n,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let i={[Tn]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Fn?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(e.frame(s,i),o)}ping(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):ui(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};ui(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}pong(t,n,r){let o,s;if(typeof t=="string"?(o=Buffer.byteLength(t),s=!1):ui(t)?(o=t.size,s=!1):(t=fa(t),o=t.length,s=fa.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[Tn]:o,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};ui(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,!1,i,r]):this.getBlobData(t,!1,i,r):this._state!==Fn?this.enqueue([this.dispatch,t,!1,i,r]):this.sendFrame(e.frame(t,i),r)}send(t,n,r){let o=this._extensions[Mj.extensionName],s=n.binary?2:1,i=n.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):ui(t)?(c=t.size,d=!1):(t=fa(t),c=t.length,d=fa.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=c>=o._threshold),this._compress=i):(i=!1,s=0),n.fin&&(this._firstFragment=!0);let l={[Tn]:c,fin:n.fin,generateMask:this._generateMask,mask:n.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:d,rsv1:i};ui(t)?this._state!==Fn?this.enqueue([this.getBlobData,t,this._compress,l,r]):this.getBlobData(t,this._compress,l,r):this._state!==Fn?this.enqueue([this.dispatch,t,this._compress,l,r]):this.dispatch(t,this._compress,l,r)}getBlobData(t,n,r,o){this._bufferedBytes+=r[Tn],this._state=F6,t.arrayBuffer().then(s=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(ay,this,c,o);return}this._bufferedBytes-=r[Tn];let i=fa(s);n?this.dispatch(i,n,r,o):(this._state=Fn,this.sendFrame(e.frame(i,r),o),this.dequeue())}).catch(s=>{process.nextTick(U6,this,s,o)})}dispatch(t,n,r,o){if(!n){this.sendFrame(e.frame(t,r),o);return}let s=this._extensions[Mj.extensionName];this._bufferedBytes+=r[Tn],this._state=N6,s.compress(t,r.fin,(i,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");ay(this,d,o);return}this._bufferedBytes-=r[Tn],this._state=Fn,r.readOnly=!1,this.sendFrame(e.frame(c,r),o),this.dequeue()})}dequeue(){for(;this._state===Fn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][Tn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][Tn],this._queue.push(t)}sendFrame(t,n){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],n),this._socket.uncork()):this._socket.write(t[0],n)}};Hj.exports=oy;function ay(e,t,n){typeof n=="function"&&n(t);for(let r=0;r<e._queue.length;r++){let o=e._queue[r],s=o[o.length-1];typeof s=="function"&&s(t)}}a(ay,"callCallbacks");function U6(e,t,n){ay(e,t,n),e.onerror(t)}a(U6,"onError")});var qj=Te((ofe,Uj)=>{"use strict";var{kForOnEventAttribute:Xc,kListener:iy}=qr(),Oj=Symbol("kCode"),Dj=Symbol("kData"),Bj=Symbol("kError"),$j=Symbol("kMessage"),Lj=Symbol("kReason"),mi=Symbol("kTarget"),Nj=Symbol("kType"),Fj=Symbol("kWasClean"),Wr=class{static{a(this,"Event")}constructor(t){this[mi]=null,this[Nj]=t}get target(){return this[mi]}get type(){return this[Nj]}};Object.defineProperty(Wr.prototype,"target",{enumerable:!0});Object.defineProperty(Wr.prototype,"type",{enumerable:!0});var ha=class extends Wr{static{a(this,"CloseEvent")}constructor(t,n={}){super(t),this[Oj]=n.code===void 0?0:n.code,this[Lj]=n.reason===void 0?"":n.reason,this[Fj]=n.wasClean===void 0?!1:n.wasClean}get code(){return this[Oj]}get reason(){return this[Lj]}get wasClean(){return this[Fj]}};Object.defineProperty(ha.prototype,"code",{enumerable:!0});Object.defineProperty(ha.prototype,"reason",{enumerable:!0});Object.defineProperty(ha.prototype,"wasClean",{enumerable:!0});var fi=class extends Wr{static{a(this,"ErrorEvent")}constructor(t,n={}){super(t),this[Bj]=n.error===void 0?null:n.error,this[$j]=n.message===void 0?"":n.message}get error(){return this[Bj]}get message(){return this[$j]}};Object.defineProperty(fi.prototype,"error",{enumerable:!0});Object.defineProperty(fi.prototype,"message",{enumerable:!0});var Qc=class extends Wr{static{a(this,"MessageEvent")}constructor(t,n={}){super(t),this[Dj]=n.data===void 0?null:n.data}get data(){return this[Dj]}};Object.defineProperty(Qc.prototype,"data",{enumerable:!0});var q6={addEventListener(e,t,n={}){for(let o of this.listeners(e))if(!n[Xc]&&o[iy]===t&&!o[Xc])return;let r;if(e==="message")r=a(function(s,i){let c=new Qc("message",{data:i?s:s.toString()});c[mi]=this,Cp(t,this,c)},"onMessage");else if(e==="close")r=a(function(s,i){let c=new ha("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[mi]=this,Cp(t,this,c)},"onClose");else if(e==="error")r=a(function(s){let i=new fi("error",{error:s,message:s.message});i[mi]=this,Cp(t,this,i)},"onError");else if(e==="open")r=a(function(){let s=new Wr("open");s[mi]=this,Cp(t,this,s)},"onOpen");else return;r[Xc]=!!n[Xc],r[iy]=t,n.once?this.once(e,r):this.on(e,r)},removeEventListener(e,t){for(let n of this.listeners(e))if(n[iy]===t&&!n[Xc]){this.removeListener(e,n);break}}};Uj.exports={CloseEvent:ha,ErrorEvent:fi,Event:Wr,EventTarget:q6,MessageEvent:Qc};function Cp(e,t,n){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}a(Cp,"callListener")});var Ep=Te((sfe,zj)=>{"use strict";var{tokenChars:Zc}=li();function hr(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}a(hr,"push");function z6(e){let t=Object.create(null),n=Object.create(null),r=!1,o=!1,s=!1,i,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),i===void 0)if(u===-1&&Zc[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 f=e.slice(d,u);l===44?(hr(t,f,n),n=Object.create(null)):i=f,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Zc[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),hr(n,e.slice(d,u),!0),l===44&&(hr(t,i,n),n=Object.create(null),i=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(Zc[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:r||(r=!0),o=!1}else if(s)if(Zc[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)s=!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)s=!0;else if(u===-1&&Zc[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 f=e.slice(d,u);r&&(f=f.replace(/\\/g,""),r=!1),hr(n,c,f),l===44&&(hr(t,i,n),n=Object.create(null),i=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||s||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return i===void 0?hr(t,m,n):(c===void 0?hr(n,m,!0):r?hr(n,c,m.replace(/\\/g,"")):hr(n,c,m),hr(t,i,n)),t}a(z6,"parse");function W6(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(r=>[t].concat(Object.keys(r).map(o=>{let s=r[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}a(W6,"format");zj.exports={format:W6,parse:z6}});var Op=Te((lfe,nH)=>{"use strict";var V6=Pe("events"),J6=Pe("https"),G6=Pe("http"),Jj=Pe("net"),K6=Pe("tls"),{randomBytes:Y6,createHash:X6}=Pe("crypto"),{Duplex:cfe,Readable:dfe}=Pe("stream"),{URL:cy}=Pe("url"),Co=di(),Q6=ry(),Z6=sy(),{isBlob:e5}=li(),{BINARY_TYPES:Wj,CLOSE_TIMEOUT:t5,EMPTY_BUFFER:Mp,GUID:n5,kForOnEventAttribute:dy,kListener:r5,kStatusCode:o5,kWebSocket:mt,NOOP:Gj}=qr(),{EventTarget:{addEventListener:a5,removeEventListener:s5}}=qj(),{format:i5,parse:c5}=Ep(),{toBuffer:d5}=Kc(),Kj=Symbol("kAborted"),ly=[8,13],Vr=["CONNECTING","OPEN","CLOSING","CLOSED"],l5=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,We=class e extends V6{static{a(this,"WebSocket")}constructor(t,n,r){super(),this._binaryType=Wj[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Mp,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,n===void 0?n=[]:Array.isArray(n)||(typeof n=="object"&&n!==null?(r=n,n=[]):n=[n]),Yj(this,t,n,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Wj.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,n,r){let o=new Q6({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),s=new Z6(t,this._extensions,r.generateMask);this._receiver=o,this._sender=s,this._socket=t,o[mt]=this,s[mt]=this,t[mt]=this,o.on("conclude",m5),o.on("drain",f5),o.on("error",g5),o.on("message",h5),o.on("ping",w5),o.on("pong",y5),s.onerror=v5,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on("close",Zj),t.on("data",Hp),t.on("end",eH),t.on("error",tH),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[Co.extensionName]&&this._extensions[Co.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(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,n,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Qj(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){uy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||Mp,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(r=t,t=n=void 0):typeof n=="function"&&(r=n,n=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){uy(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||Mp,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof n=="function"&&(r=n,n={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){uy(this,t,r);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[Co.extensionName]||(o.compress=!1),this._sender.send(t||Mp,o,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(We,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(We.prototype,"CONNECTING",{enumerable:!0,value:Vr.indexOf("CONNECTING")});Object.defineProperty(We,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(We.prototype,"OPEN",{enumerable:!0,value:Vr.indexOf("OPEN")});Object.defineProperty(We,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(We.prototype,"CLOSING",{enumerable:!0,value:Vr.indexOf("CLOSING")});Object.defineProperty(We,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});Object.defineProperty(We.prototype,"CLOSED",{enumerable:!0,value:Vr.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(We.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(We.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[dy])return t[r5];return null},set(t){for(let n of this.listeners(e))if(n[dy]){this.removeListener(e,n);break}typeof t=="function"&&this.addEventListener(e,t,{[dy]:!0})}})});We.prototype.addEventListener=a5;We.prototype.removeEventListener=s5;nH.exports=We;function Yj(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:t5,protocolVersion:ly[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,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,!ly.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ly.join(", ")})`);let s;if(t instanceof cy)s=t;else try{s=new cy(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),e._url=s.href;let i=s.protocol==="wss:",c=s.protocol==="ws+unix:",d;if(s.protocol!=="ws:"&&!i&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!s.pathname?d="The URL's pathname is empty":s.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;jp(e,h);return}let l=i?443:80,u=Y6(16).toString("base64"),p=i?J6.request:G6.request,m=new Set,f;if(o.createConnection=o.createConnection||(i?p5:u5),o.defaultPort=o.defaultPort||l,o.port=s.port||l,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(f=new Co({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=i5({[Co.extensionName]:f.offer()})),n.length){for(let h of n){if(typeof h!="string"||!l5.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=n.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let w;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=i,e._originalHostOrSocketPath=c?o.socketPath:s.host;let h=r&&r.headers;if(r={...r,headers:{}},h)for(let[v,g]of Object.entries(h))r.headers[v.toLowerCase()]=g}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),w=e._req=p(o),e._redirects&&e.emit("redirect",e.url,w)}else w=e._req=p(o);o.timeout&&w.on("timeout",()=>{pn(e,w,"Opening handshake has timed out")}),w.on("error",h=>{w===null||w[Kj]||(w=e._req=null,jp(e,h))}),w.on("response",h=>{let v=h.headers.location,g=h.statusCode;if(v&&o.followRedirects&&g>=300&&g<400){if(++e._redirects>o.maxRedirects){pn(e,w,"Maximum redirects exceeded");return}w.abort();let S;try{S=new cy(v,t)}catch{let k=new SyntaxError(`Invalid URL: ${v}`);jp(e,k);return}Yj(e,S,n,r)}else e.emit("unexpected-response",w,h)||pn(e,w,`Unexpected server response: ${h.statusCode}`)}),w.on("upgrade",(h,v,g)=>{if(e.emit("upgrade",h),e.readyState!==We.CONNECTING)return;w=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){pn(e,v,"Invalid Upgrade header");return}let R=X6("sha1").update(u+n5).digest("base64");if(h.headers["sec-websocket-accept"]!==R){pn(e,v,"Invalid Sec-WebSocket-Accept header");return}let k=h.headers["sec-websocket-protocol"],y;if(k!==void 0?m.size?m.has(k)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":m.size&&(y="Server sent no subprotocol"),y){pn(e,v,y);return}k&&(e._protocol=k);let T=h.headers["sec-websocket-extensions"];if(T!==void 0){if(!f){pn(e,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let C;try{C=c5(T)}catch{pn(e,v,"Invalid Sec-WebSocket-Extensions header");return}let b=Object.keys(C);if(b.length!==1||b[0]!==Co.extensionName){pn(e,v,"Server indicated an extension that was not requested");return}try{f.accept(C[Co.extensionName])}catch{pn(e,v,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Co.extensionName]=f}e.setSocket(v,g,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(w,e):w.end()}a(Yj,"initAsClient");function jp(e,t){e._readyState=We.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}a(jp,"emitErrorAndClose");function u5(e){return e.path=e.socketPath,Jj.connect(e)}a(u5,"netConnect");function p5(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Jj.isIP(e.host)?"":e.host),K6.connect(e)}a(p5,"tlsConnect");function pn(e,t,n){e._readyState=We.CLOSING;let r=new Error(n);Error.captureStackTrace(r,pn),t.setHeader?(t[Kj]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(jp,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}a(pn,"abortHandshake");function uy(e,t,n){if(t){let r=e5(t)?t.size:d5(t).length;e._socket?e._sender._bufferedBytes+=r:e._bufferedAmount+=r}if(n){let r=new Error(`WebSocket is not open: readyState ${e.readyState} (${Vr[e.readyState]})`);process.nextTick(n,r)}}a(uy,"sendAfterClose");function m5(e,t){let n=this[mt];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[mt]!==void 0&&(n._socket.removeListener("data",Hp),process.nextTick(Xj,n._socket),e===1005?n.close():n.close(e,t))}a(m5,"receiverOnConclude");function f5(){let e=this[mt];e.isPaused||e._socket.resume()}a(f5,"receiverOnDrain");function g5(e){let t=this[mt];t._socket[mt]!==void 0&&(t._socket.removeListener("data",Hp),process.nextTick(Xj,t._socket),t.close(e[o5])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}a(g5,"receiverOnError");function Vj(){this[mt].emitClose()}a(Vj,"receiverOnFinish");function h5(e,t){this[mt].emit("message",e,t)}a(h5,"receiverOnMessage");function w5(e){let t=this[mt];t._autoPong&&t.pong(e,!this._isServer,Gj),t.emit("ping",e)}a(w5,"receiverOnPing");function y5(e){this[mt].emit("pong",e)}a(y5,"receiverOnPong");function Xj(e){e.resume()}a(Xj,"resume");function v5(e){let t=this[mt];t.readyState!==We.CLOSED&&(t.readyState===We.OPEN&&(t._readyState=We.CLOSING,Qj(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}a(v5,"senderOnError");function Qj(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}a(Qj,"setCloseTimer");function Zj(){let e=this[mt];if(this.removeListener("close",Zj),this.removeListener("data",Hp),this.removeListener("end",eH),e._readyState=We.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[mt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Vj),e._receiver.on("finish",Vj))}a(Zj,"socketOnClose");function Hp(e){this[mt]._receiver.write(e)||this.pause()}a(Hp,"socketOnData");function eH(){let e=this[mt];e._readyState=We.CLOSING,e._receiver.end(),this.end()}a(eH,"socketOnEnd");function tH(){let e=this[mt];this.removeListener("error",tH),this.on("error",Gj),e&&(e._readyState=We.CLOSING,this.destroy())}a(tH,"socketOnError")});var sH=Te((mfe,aH)=>{"use strict";var pfe=Op(),{Duplex:k5}=Pe("stream");function rH(e){e.emit("close")}a(rH,"emitClose");function b5(){!this.destroyed&&this._writableState.finished&&this.destroy()}a(b5,"duplexOnEnd");function oH(e){this.removeListener("error",oH),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}a(oH,"duplexOnError");function S5(e,t){let n=!0,r=new k5({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",a(function(s,i){let c=!i&&r._readableState.objectMode?s.toString():s;r.push(c)||e.pause()},"message")),e.once("error",a(function(s){r.destroyed||(n=!1,r.destroy(s))},"error")),e.once("close",a(function(){r.destroyed||r.push(null)},"close")),r._destroy=function(o,s){if(e.readyState===e.CLOSED){s(o),process.nextTick(rH,r);return}let i=!1;e.once("error",a(function(d){i=!0,s(d)},"error")),e.once("close",a(function(){i||s(o),process.nextTick(rH,r)},"close")),n&&e.terminate()},r._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),r._readableState.endEmitted&&r.destroy()):(e._socket.once("finish",a(function(){o()},"finish")),e.close()))},r._read=function(){e.isPaused&&e.resume()},r._write=function(o,s,i){if(e.readyState===e.CONNECTING){e.once("open",a(function(){r._write(o,s,i)},"open"));return}e.send(o,i)},r.on("end",b5),r.on("error",oH),r}a(S5,"createWebSocketStream");aH.exports=S5});var py=Te((gfe,iH)=>{"use strict";var{tokenChars:I5}=li();function R5(e){let t=new Set,n=-1,r=-1,o=0;for(o;o<e.length;o++){let i=e.charCodeAt(o);if(r===-1&&I5[i]===1)n===-1&&(n=o);else if(o!==0&&(i===32||i===9))r===-1&&n!==-1&&(r=o);else if(i===44){if(n===-1)throw new SyntaxError(`Unexpected character at index ${o}`);r===-1&&(r=o);let c=e.slice(n,r);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),n=r=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(n===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=e.slice(n,o);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}a(R5,"parse");iH.exports={parse:R5}});var fH=Te((yfe,mH)=>{"use strict";var P5=Pe("events"),Dp=Pe("http"),{Duplex:wfe}=Pe("stream"),{createHash:_5}=Pe("crypto"),cH=Ep(),wa=di(),x5=py(),T5=Op(),{CLOSE_TIMEOUT:A5,GUID:C5,kWebSocket:E5}=qr(),M5=/^[+/0-9A-Za-z]{22}==$/,dH=0,lH=1,pH=2,my=class extends P5{static{a(this,"WebSocketServer")}constructor(t,n){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:A5,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:T5,...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=Dp.createServer((r,o)=>{let s=Dp.STATUS_CODES[426];o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(t.port,t.host,t.backlog,n)):t.server&&(this._server=t.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=j5(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:a((o,s,i)=>{this.handleUpgrade(o,s,i,r)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=dH}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===pH){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(ed,this);return}if(t&&this.once("close",t),this._state!==lH)if(this._state=lH,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(ed,this):process.nextTick(ed,this);else{let n=this._server;this._removeListeners(),this._removeListeners=this._server=null,n.close(()=>{ed(this)})}}shouldHandle(t){if(this.options.path){let n=t.url.indexOf("?");if((n!==-1?t.url.slice(0,n):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,n,r,o){n.on("error",uH);let s=t.headers["sec-websocket-key"],i=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){ya(this,t,n,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){ya(this,t,n,400,"Invalid Upgrade header");return}if(s===void 0||!M5.test(s)){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){ya(this,t,n,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){td(n,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=x5.parse(d)}catch{ya(this,t,n,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 wa({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let f=cH.parse(u);f[wa.extensionName]&&(m.accept(f[wa.extensionName]),p[wa.extensionName]=m)}catch{ya(this,t,n,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,(f,w,h,v)=>{if(!f)return td(n,w||401,h,v);this.completeUpgrade(p,s,l,t,n,r,o)});return}if(!this.options.verifyClient(m))return td(n,401)}this.completeUpgrade(p,s,l,t,n,r,o)}completeUpgrade(t,n,r,o,s,i,c){if(!s.readable||!s.writable)return s.destroy();if(s[E5])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>dH)return td(s,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${_5("sha1").update(n+C5).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(r.size){let p=this.options.handleProtocols?this.options.handleProtocols(r,o):r.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[wa.extensionName]){let p=t[wa.extensionName].params,m=cH.format({[wa.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),s.write(l.concat(`\r
4
4
  `).join(`\r
5
5
  `)),s.removeListener("error",uH),u.setSocket(s,i,{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(ed,this)})),c(u,o)}};mH.exports=my;function j5(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return a(function(){for(let r of Object.keys(t))e.removeListener(r,t[r])},"removeListeners")}a(j5,"addListeners");function ed(e){e._state=pH,e.emit("close")}a(ed,"emitClose");function uH(){this.destroy()}a(uH,"socketOnError");function td(e,t,n,r){n=n||Dp.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(n),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Dp.STATUS_CODES[t]}\r
6
6
  `+Object.keys(r).map(o=>`${o}: ${r[o]}`).join(`\r
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-U2AWYZZC.js";import"./chunk-HKYGCUA6.js";import"./chunk-FTQLQJQV.js";export{a as MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,C as appWorkspacePaths,B as assertSafeBranchName,d as checkWorkspaceGitAvailability,J as checkoutBranch,K as checkoutBranchAtPath,M as clearWorkspaceDiffCacheForTests,D as cloneWorkspace,H as createAndCheckoutBranch,I as createAndCheckoutBranchAtPath,A as expectedRemoteUrl,t as isGeneratedWorkspacePath,i as isGitRepo,c as isMacOSGitDeveloperToolsMissing,u as isVisibleGitWorkspaceFile,r as isWorkspaceDirectory,E as lastFetchAt,z as listPlainWorkspaceFiles,P as loadGitCommitDiffAtPath,N as loadWorkspaceDiff,O as loadWorkspaceDiffAtPath,Q as loadWorkspaceFile,T as loadWorkspaceFileAtPath,R as loadWorkspaceImageFile,S as loadWorkspaceImageFileAtPath,F as loadWorkspaceState,G as loadWorkspaceStateAtPath,n as localVideoContentType,L as mapWorkspaceDiffEntriesWithConcurrency,s as normalizeWorkspaceFilePath,w as parseBranchStatusLine,x as parseNumstat,v as parseStatusLine,h as pathExists,p as readLocalImageFile,q as readLocalVideoFile,l as readWorkspaceDocumentPreview,k as readWorkspaceFile,o as readWorkspaceImageFile,g as redactRemoteUrl,b as runWorkspaceCommand,f as sourceFromRemote,e as startMacOSCommandLineToolsInstall,j as truncatePatch,y as uniqueSortedPaths,m as workspaceImageContentType};
2
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-GZX5FDUN.js";import"./chunk-7VRXJGFG.js";import"./chunk-FTQLQJQV.js";export{a as MACOS_GIT_MISSING_DEVELOPER_TOOLS_ERROR,C as appWorkspacePaths,B as assertSafeBranchName,d as checkWorkspaceGitAvailability,J as checkoutBranch,K as checkoutBranchAtPath,M as clearWorkspaceDiffCacheForTests,D as cloneWorkspace,H as createAndCheckoutBranch,I as createAndCheckoutBranchAtPath,A as expectedRemoteUrl,t as isGeneratedWorkspacePath,i as isGitRepo,c as isMacOSGitDeveloperToolsMissing,u as isVisibleGitWorkspaceFile,r as isWorkspaceDirectory,E as lastFetchAt,z as listPlainWorkspaceFiles,P as loadGitCommitDiffAtPath,N as loadWorkspaceDiff,O as loadWorkspaceDiffAtPath,Q as loadWorkspaceFile,T as loadWorkspaceFileAtPath,R as loadWorkspaceImageFile,S as loadWorkspaceImageFileAtPath,F as loadWorkspaceState,G as loadWorkspaceStateAtPath,n as localVideoContentType,L as mapWorkspaceDiffEntriesWithConcurrency,s as normalizeWorkspaceFilePath,w as parseBranchStatusLine,x as parseNumstat,v as parseStatusLine,h as pathExists,p as readLocalImageFile,q as readLocalVideoFile,l as readWorkspaceDocumentPreview,k as readWorkspaceFile,o as readWorkspaceImageFile,g as redactRemoteUrl,b as runWorkspaceCommand,f as sourceFromRemote,e as startMacOSCommandLineToolsInstall,j as truncatePatch,y as uniqueSortedPaths,m as workspaceImageContentType};
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-ZVOO7FKM.js";import"./chunks/chunk-GLUWATL5.js";import{b as u}from"./chunks/chunk-IGRYR3PT.js";import{a as c,j as d}from"./chunks/chunk-CUB5BQIQ.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import{a as i}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"}i(f,"resolveCliTopLevelAction");async function v(e=process.argv.slice(2)){if(await C(e))return;let{command:r,options:o,rest:t}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-UA2RQUA4.js")).resolveOpenPondHome({home:o.home}));let n=f({command:r,options:o});if(n==="version"){console.log(c());return}if(n==="check-update"){await(await import("./chunks/core-commands-IDPOMDVM.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-46NAZU6H.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),n==="tui"){await(await import("./chunks/app-layer-LMB3B4TY.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-LMB3B4TY.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-46NAZU6H.js")).printHelp(),process.exit(1))}i(v,"runOpenPondCli");async function C(e){if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:r},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-IILK75PB.js"),import("./chunks/cli-EQJBPK7F.js")]);return await o(r),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:r},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-OQTW7BBY.js"),import("./chunks/cli-EQJBPK7F.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-IILK75PB.js");return await o({createOpenPondServer:r,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-4R2FGHSH.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}i(C,"runEmbeddedCompanion");v().catch(e=>{let r=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:r}}));else if(o&&typeof o=="object"){let n=o;console.error(`${n.code}: ${n.message}
3
+ import{a as m,b as l}from"./chunks/chunk-ZVOO7FKM.js";import"./chunks/chunk-GLUWATL5.js";import{b as u}from"./chunks/chunk-IGRYR3PT.js";import{a as c,j as d}from"./chunks/chunk-CUB5BQIQ.js";import{f as s}from"./chunks/chunk-3M53YXEI.js";import{a as i}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"}i(f,"resolveCliTopLevelAction");async function v(e=process.argv.slice(2)){if(await C(e))return;let{command:r,options:o,rest:t}=u(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-UA2RQUA4.js")).resolveOpenPondHome({home:o.home}));let n=f({command:r,options:o});if(n==="version"){console.log(c());return}if(n==="check-update"){await(await import("./chunks/core-commands-IDPOMDVM.js")).runCheckUpdate();return}if(n==="help"){(await import("./chunks/help-46NAZU6H.js")).printHelp();return}let a=m(o),p=l(o);if(a&&(process.env.OPENPOND_ACCOUNT=a),p&&(process.env.OPENPOND_BASE_URL=p),n==="tui"){await(await import("./chunks/app-layer-LMB3B4TY.js")).runOpenPondTerminalCommand(o,t);return}if(n==="ui"){await(await import("./chunks/app-layer-LMB3B4TY.js")).runOpenPondServerCommand("web",o,t);return}await d({command:r,options:o,rest:t})||((await import("./chunks/help-46NAZU6H.js")).printHelp(),process.exit(1))}i(v,"runOpenPondCli");async function C(e){if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:r},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-WJVVQC3J.js"),import("./chunks/cli-HSTHZVVW.js")]);return await o(r),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:r},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-K54UA6AW.js"),import("./chunks/cli-HSTHZVVW.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-WJVVQC3J.js");return await o({createOpenPondServer:r,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-4R2FGHSH.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}i(C,"runEmbeddedCompanion");v().catch(e=>{let r=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:r}}));else if(o&&typeof o=="object"){let n=o;console.error(`${n.code}: ${n.message}
4
4
  ${n.path}
5
5
  ${n.action}`)}else console.error(r);let t=typeof e.exitCode=="number"?e.exitCode:1;process.exit(t)});export{v as runOpenPondCli};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openpond",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "openpondReleaseVersioned": true,
5
5
  "license": "MIT",
6
6
  "description": "OpenPond CLI and local harness",