@sylphx/flow 0.0.3

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.
Files changed (47) hide show
  1. package/README.md +569 -0
  2. package/assets/agents/coder.md +32 -0
  3. package/assets/agents/orchestrator.md +36 -0
  4. package/assets/agents/reviewer.md +30 -0
  5. package/assets/agents/writer.md +30 -0
  6. package/assets/knowledge/data/sql.md +216 -0
  7. package/assets/knowledge/guides/saas-template.md +85 -0
  8. package/assets/knowledge/guides/system-prompt.md +344 -0
  9. package/assets/knowledge/guides/tech-stack.md +92 -0
  10. package/assets/knowledge/guides/ui-ux.md +44 -0
  11. package/assets/knowledge/stacks/nextjs-app.md +165 -0
  12. package/assets/knowledge/stacks/node-api.md +220 -0
  13. package/assets/knowledge/stacks/react-app.md +232 -0
  14. package/assets/knowledge/universal/deployment.md +109 -0
  15. package/assets/knowledge/universal/performance.md +121 -0
  16. package/assets/knowledge/universal/security.md +79 -0
  17. package/assets/knowledge/universal/testing.md +111 -0
  18. package/assets/output-styles/silent.md +23 -0
  19. package/assets/rules/core.md +144 -0
  20. package/assets/slash-commands/commit.md +23 -0
  21. package/assets/slash-commands/explain.md +35 -0
  22. package/assets/slash-commands/mep.md +63 -0
  23. package/assets/slash-commands/review.md +39 -0
  24. package/assets/slash-commands/test.md +30 -0
  25. package/dist/chunk-5grx6px4.js +10 -0
  26. package/dist/chunk-5grx6px4.js.map +23 -0
  27. package/dist/chunk-8bvc13yx.js +4 -0
  28. package/dist/chunk-8bvc13yx.js.map +9 -0
  29. package/dist/chunk-e0cdpket.js +4 -0
  30. package/dist/chunk-e0cdpket.js.map +10 -0
  31. package/dist/chunk-j7rqqb2w.js +4 -0
  32. package/dist/chunk-j7rqqb2w.js.map +10 -0
  33. package/dist/chunk-npw0sq1m.js +3 -0
  34. package/dist/chunk-npw0sq1m.js.map +10 -0
  35. package/dist/chunk-p56r2pqw.js +4 -0
  36. package/dist/chunk-p56r2pqw.js.map +11 -0
  37. package/dist/chunk-rtrp1qa5.js +15 -0
  38. package/dist/chunk-rtrp1qa5.js.map +10 -0
  39. package/dist/chunk-w8epyz4j.js +3 -0
  40. package/dist/chunk-w8epyz4j.js.map +10 -0
  41. package/dist/chunk-wv5zpnbp.js +75 -0
  42. package/dist/chunk-wv5zpnbp.js.map +12 -0
  43. package/dist/chunk-z9h5spfk.js +183 -0
  44. package/dist/chunk-z9h5spfk.js.map +151 -0
  45. package/dist/index.js +723 -0
  46. package/dist/index.js.map +711 -0
  47. package/package.json +96 -0
@@ -0,0 +1,144 @@
1
+ ---
2
+ name: Shared Agent Guidelines
3
+ description: Universal principles and standards for all agents
4
+ ---
5
+
6
+ # SHARED GUIDELINES
7
+
8
+ ## Performance
9
+
10
+ **Parallel Execution**: Multiple tool calls in ONE message = parallel. Multiple messages = sequential.
11
+
12
+ Use parallel whenever tools are independent. Watch for dependencies and ordering requirements.
13
+
14
+ ---
15
+
16
+ ## Cognitive Framework
17
+
18
+ ### Understanding Depth
19
+ - **Shallow OK**: Well-defined, low-risk, established patterns → Implement
20
+ - **Deep required**: Ambiguous, high-risk, novel, irreversible → Investigate first
21
+
22
+ ### Complexity Navigation
23
+ - **Mechanical**: Known patterns → Execute fast
24
+ - **Analytical**: Multiple components → Design then build
25
+ - **Emergent**: Unknown domain → Research, prototype, design, build
26
+
27
+ ### State Awareness
28
+ - **Flow**: Clear path, tests pass → Push forward
29
+ - **Friction**: Hard to implement, messy → Reassess, simplify
30
+ - **Uncertain**: Missing info → Assume reasonably, document, continue
31
+
32
+ **Signals to pause**: Can't explain simply, too many caveats, hesitant without reason, over-confident without alternatives.
33
+
34
+ ---
35
+
36
+ ## Principles
37
+
38
+ ### Programming
39
+ - **Functional composition**: Pure functions, immutable data, explicit side effects
40
+ - **Composition over inheritance**: Prefer function composition, mixins, dependency injection
41
+ - **Declarative over imperative**: Express what you want, not how
42
+ - **Event-driven when appropriate**: Decouple components through events/messages
43
+
44
+ ### Quality
45
+ - **YAGNI**: Build what's needed now, not hypothetical futures
46
+ - **KISS**: Choose simple solutions over complex ones
47
+ - **DRY**: Extract duplication on 3rd occurrence. Balance with readability
48
+ - **Separation of concerns**: Each module handles one responsibility
49
+ - **Dependency inversion**: Depend on abstractions, not implementations
50
+
51
+ ---
52
+
53
+ ## Technical Standards
54
+
55
+ **Code Quality**: Self-documenting names, test critical paths (100%) and business logic (80%+), comments explain WHY not WHAT, make illegal states unrepresentable.
56
+
57
+ **Security**: Validate inputs at boundaries, never log sensitive data, secure defaults (auth required, deny by default), include rollback plan for risky changes.
58
+
59
+ **Error Handling**: Handle explicitly at boundaries, use Result/Either for expected failures, never mask failures, log with context, actionable messages.
60
+
61
+ **Refactoring**: Extract on 3rd duplication, when function >20 lines or cognitive load high. When thinking "I'll clean later" → Clean NOW. When adding TODO → Implement NOW.
62
+
63
+ ---
64
+
65
+ ## Documentation
66
+
67
+ Communicate through code using inline comments and docstrings.
68
+
69
+ Separate documentation files only when explicitly requested.
70
+
71
+ ---
72
+
73
+ ## Anti-Patterns
74
+
75
+ **Technical Debt Rationalization**: "I'll clean this later" → You won't. "Just one more TODO" → Compounds. "Tests slow me down" → Bugs slow more. Refactor AS you make it work, not after.
76
+
77
+ **Reinventing the Wheel**: Before ANY feature: research best practices + search codebase + check package registry + check framework built-ins.
78
+
79
+ Example:
80
+ ```typescript
81
+ Don't: Custom Result type → Do: import { Result } from 'neverthrow'
82
+ Don't: Custom validation → Do: import { z } from 'zod'
83
+ ```
84
+
85
+ **Others**: Premature optimization, analysis paralysis, skipping tests, ignoring existing patterns, blocking on missing info, asking permission for obvious choices.
86
+
87
+ ---
88
+
89
+ ## Version Control
90
+
91
+ Feature branches `{type}/{description}`, semantic commits `<type>(<scope>): <description>`, atomic commits.
92
+
93
+ ---
94
+
95
+ ## File Handling
96
+
97
+ **Scratch work**: System temp directory (/tmp on Unix, %TEMP% on Windows)
98
+ **Final deliverables**: Working directory or user-specified location
99
+
100
+ ---
101
+
102
+ ## Autonomous Decisions
103
+
104
+ **Never block. Always proceed with assumptions.**
105
+
106
+ Safe assumptions: Standard patterns (REST, JWT), framework conventions, existing codebase patterns.
107
+
108
+ **Document in code**:
109
+ ```javascript
110
+ // ASSUMPTION: JWT auth (REST standard, matches existing APIs)
111
+ // ALTERNATIVE: Session-based
112
+ ```
113
+
114
+ **Decision hierarchy**: existing patterns > simplicity > maintainability
115
+
116
+ Important decisions: Document in commit message or PR description.
117
+
118
+ ---
119
+
120
+ ## High-Stakes Decisions
121
+
122
+ Use structured reasoning only for high-stakes decisions. Most decisions: decide autonomously without explanation.
123
+
124
+ **When to use**:
125
+ - Decision difficult to reverse (schema changes, architecture choices)
126
+ - Affects >3 major components
127
+ - Security-critical
128
+ - Long-term maintenance impact
129
+
130
+ **Quick check**: Easy to reverse? → Decide autonomously. Clear best practice? → Follow it.
131
+
132
+ ### Decision Frameworks
133
+
134
+ **🎯 First Principles** - Break down to fundamentals, challenge assumptions. *Novel problems without precedent.*
135
+
136
+ **⚖️ Decision Matrix** - Score options against weighted criteria. *3+ options with multiple criteria.*
137
+
138
+ **🔄 Trade-off Analysis** - Compare competing aspects. *Performance vs cost, speed vs quality.*
139
+
140
+ ### Process
141
+ 1. Recognize trigger
142
+ 2. Choose framework
143
+ 3. Analyze decision
144
+ 4. Document in commit message or PR description
@@ -0,0 +1,23 @@
1
+ ---
2
+ description: Create a git commit with meaningful message
3
+ ---
4
+
5
+ # Create Git Commit
6
+
7
+ ## Context
8
+
9
+ - Current git status: !`git status`
10
+ - Current git diff (staged and unstaged changes): !`git diff HEAD`
11
+ - Current branch: !`git branch --show-current`
12
+ - Recent commits: !`git log --oneline -10`
13
+
14
+ ## Your Task
15
+
16
+ Based on the above changes, create a single git commit with a meaningful commit message that:
17
+
18
+ 1. Follows conventional commits format: `type(scope): description`
19
+ 2. Accurately describes what changed and why
20
+ 3. Includes any breaking changes or important notes
21
+ 4. Uses present tense ("add" not "added")
22
+
23
+ After creating the commit, show the commit message for review.
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: Explain code in detail
3
+ ---
4
+
5
+ # Explain Code
6
+
7
+ ## Context
8
+
9
+ $ARGUMENTS
10
+
11
+ ## Your Task
12
+
13
+ Provide a comprehensive explanation of the code above (or at the specified location) that includes:
14
+
15
+ 1. **Overview**
16
+ - What does this code do?
17
+ - What problem does it solve?
18
+
19
+ 2. **How It Works**
20
+ - Step-by-step breakdown of the logic
21
+ - Key algorithms or patterns used
22
+ - Important design decisions
23
+
24
+ 3. **Components**
25
+ - Main functions/classes/modules
26
+ - Their roles and responsibilities
27
+ - How they interact
28
+
29
+ 4. **Important Details**
30
+ - Edge cases handled
31
+ - Performance considerations
32
+ - Security implications
33
+ - Dependencies and requirements
34
+
35
+ Use clear language and provide examples where helpful.
@@ -0,0 +1,63 @@
1
+ ---
2
+ description: Convert verbose prompt to MEP (Minimal Effective Prompt)
3
+ ---
4
+
5
+ # MEP - Minimal Effective Prompt
6
+
7
+ ## Context
8
+
9
+ User's original prompt:
10
+ ```
11
+ $ARGUMENTS
12
+ ```
13
+
14
+ ## Your Task
15
+
16
+ Analyze the user's prompt above and refactor it into a **Minimal Effective Prompt (MEP)** that:
17
+
18
+ ### Remove Unnecessary Context
19
+ ❌ Remove information that AI already knows:
20
+ - Current date/time (AI has access via hooks)
21
+ - System information (platform, CPU, memory - provided automatically)
22
+ - Project structure (AI can search codebase)
23
+ - Tech stack (AI can detect from package.json and code)
24
+ - File locations (AI can search)
25
+ - Existing code patterns (AI can search codebase)
26
+
27
+ ### Keep Essential Information
28
+ ✅ Keep only what AI cannot infer:
29
+ - Specific business requirements
30
+ - User preferences or constraints
31
+ - Domain-specific knowledge
32
+ - Desired outcome or behavior
33
+ - Acceptance criteria
34
+
35
+ ### Apply MEP Principles
36
+
37
+ 1. **Be Specific About What, Not How**
38
+ - ❌ "Create a React component with useState hook, useEffect for data fetching, proper error handling..."
39
+ - ✅ "Add user profile page with real-time data"
40
+
41
+ 2. **Trust AI's Knowledge**
42
+ - ❌ "Using TypeScript with proper types, following our code style..."
43
+ - ✅ "Add user authentication" (AI will use TypeScript, follow existing patterns)
44
+
45
+ 3. **Focus on Intent**
46
+ - ❌ "I need a function that takes an array and returns unique values using Set..."
47
+ - ✅ "Remove duplicate items from the list"
48
+
49
+ 4. **Remove Redundancy**
50
+ - ❌ "Add comprehensive error handling with try-catch blocks and proper error messages..."
51
+ - ✅ "Add error handling" (comprehensive is default)
52
+
53
+ ### Output Format
54
+
55
+ Provide the refactored MEP prompt as a single, concise statement (1-3 sentences max) that captures the essence of the user's intent.
56
+
57
+ **Original:** [quote the original]
58
+
59
+ **MEP Version:** [your refactored minimal prompt]
60
+
61
+ **Removed Context:** [list what was removed and why - explain that AI already has this info]
62
+
63
+ **Preserved Intent:** [confirm the core requirement is maintained]
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Review code for quality, security, and best practices
3
+ ---
4
+
5
+ # Code Review
6
+
7
+ ## Context
8
+
9
+ $ARGUMENTS
10
+
11
+ ## Your Task
12
+
13
+ Review the code above (or at the specified location) and provide feedback on:
14
+
15
+ 1. **Code Quality**
16
+ - Readability and maintainability
17
+ - Code organization and structure
18
+ - Naming conventions
19
+ - Comments and documentation
20
+
21
+ 2. **Security**
22
+ - Potential vulnerabilities
23
+ - Input validation
24
+ - Authentication/authorization issues
25
+ - Data exposure risks
26
+
27
+ 3. **Performance**
28
+ - Algorithmic efficiency
29
+ - Resource usage
30
+ - Potential bottlenecks
31
+ - Scalability concerns
32
+
33
+ 4. **Best Practices**
34
+ - Language-specific idioms
35
+ - Design patterns
36
+ - Error handling
37
+ - Testing coverage
38
+
39
+ Provide specific, actionable suggestions for improvement.
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Write comprehensive tests for code
3
+ ---
4
+
5
+ # Write Tests
6
+
7
+ ## Context
8
+
9
+ $ARGUMENTS
10
+
11
+ ## Your Task
12
+
13
+ Write comprehensive tests for the code above (or at the specified location) that include:
14
+
15
+ 1. **Unit Tests**
16
+ - Test individual functions/methods
17
+ - Cover edge cases and boundary conditions
18
+ - Test error handling
19
+
20
+ 2. **Integration Tests** (if applicable)
21
+ - Test component interactions
22
+ - Test with realistic data
23
+
24
+ 3. **Test Coverage**
25
+ - Aim for high coverage of critical paths
26
+ - Include positive and negative test cases
27
+ - Test validation and error conditions
28
+
29
+ Use the project's existing testing framework and follow its conventions.
30
+ Ensure tests are readable, maintainable, and properly documented.
@@ -0,0 +1,10 @@
1
+ import{A as K5,B as M,D as R}from"./chunk-8bvc13yx.js";var C=M(($4,w5)=>{var v5=["nodebuffer","arraybuffer","fragments"],g5=typeof Blob<"u";if(g5)v5.push("blob");w5.exports={BINARY_TYPES:v5,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:g5,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var n=M((G4,X5)=>{var{EMPTY_BUFFER:m1}=C(),A5=Buffer[Symbol.species];function f1(J,K){if(J.length===0)return m1;if(J.length===1)return J[0];let X=Buffer.allocUnsafe(K),Z=0;for(let $=0;$<J.length;$++){let G=J[$];X.set(G,Z),Z+=G.length}if(Z<K)return new A5(X.buffer,X.byteOffset,Z);return X}function h5(J,K,X,Z,$){for(let G=0;G<$;G++)X[Z+G]=J[G]^K[G&3]}function m5(J,K){for(let X=0;X<J.length;X++)J[X]^=K[X&3]}function u1(J){if(J.length===J.buffer.byteLength)return J.buffer;return J.buffer.slice(J.byteOffset,J.byteOffset+J.length)}function F5(J){if(F5.readOnly=!0,Buffer.isBuffer(J))return J;let K;if(J instanceof ArrayBuffer)K=new A5(J);else if(ArrayBuffer.isView(J))K=new A5(J.buffer,J.byteOffset,J.byteLength);else K=Buffer.from(J),F5.readOnly=!1;return K}X5.exports={concat:f1,mask:h5,toArrayBuffer:u1,toBuffer:F5,unmask:m5};if(!process.env.WS_NO_BUFFER_UTIL)try{let J=(()=>{throw new Error("Cannot require module "+"bufferutil");})();X5.exports.mask=function(K,X,Z,$,G){if(G<48)h5(K,X,Z,$,G);else J.mask(K,X,Z,$,G)},X5.exports.unmask=function(K,X){if(K.length<32)m5(K,X);else J.unmask(K,X)}}catch(J){}});var p5=M((Q4,l5)=>{var f5=Symbol("kDone"),D5=Symbol("kRun");class u5{constructor(J){this[f5]=()=>{this.pending--,this[D5]()},this.concurrency=J||1/0,this.jobs=[],this.pending=0}add(J){this.jobs.push(J),this[D5]()}[D5](){if(this.pending===this.concurrency)return;if(this.jobs.length){let J=this.jobs.shift();this.pending++,J(this[f5])}}}l5.exports=u5});var a=M((j4,c5)=>{var r=R("zlib"),b5=n(),l1=p5(),{kStatusCode:i5}=C(),p1=Buffer[Symbol.species],b1=Buffer.from([0,0,255,255]),$5=Symbol("permessage-deflate"),U=Symbol("total-length"),f=Symbol("callback"),L=Symbol("buffers"),u=Symbol("error"),Z5;class k5{constructor(J,K,X){if(this._maxPayload=X|0,this._options=J||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!K,this._deflate=null,this._inflate=null,this.params=null,!Z5){let Z=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Z5=new l1(Z)}}static get extensionName(){return"permessage-deflate"}offer(){let J={};if(this._options.serverNoContextTakeover)J.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)J.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)J.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)J.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)J.client_max_window_bits=!0;return J}accept(J){return J=this.normalizeParams(J),this.params=this._isServer?this.acceptAsServer(J):this.acceptAsClient(J),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let J=this._deflate[f];if(this._deflate.close(),this._deflate=null,J)J(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(J){let K=this._options,X=J.find((Z)=>{if(K.serverNoContextTakeover===!1&&Z.server_no_context_takeover||Z.server_max_window_bits&&(K.serverMaxWindowBits===!1||typeof K.serverMaxWindowBits==="number"&&K.serverMaxWindowBits>Z.server_max_window_bits)||typeof K.clientMaxWindowBits==="number"&&!Z.client_max_window_bits)return!1;return!0});if(!X)throw Error("None of the extension offers can be accepted");if(K.serverNoContextTakeover)X.server_no_context_takeover=!0;if(K.clientNoContextTakeover)X.client_no_context_takeover=!0;if(typeof K.serverMaxWindowBits==="number")X.server_max_window_bits=K.serverMaxWindowBits;if(typeof K.clientMaxWindowBits==="number")X.client_max_window_bits=K.clientMaxWindowBits;else if(X.client_max_window_bits===!0||K.clientMaxWindowBits===!1)delete X.client_max_window_bits;return X}acceptAsClient(J){let K=J[0];if(this._options.clientNoContextTakeover===!1&&K.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!K.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")K.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&K.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return K}normalizeParams(J){return J.forEach((K)=>{Object.keys(K).forEach((X)=>{let Z=K[X];if(Z.length>1)throw Error(`Parameter "${X}" must have only a single value`);if(Z=Z[0],X==="client_max_window_bits"){if(Z!==!0){let $=+Z;if(!Number.isInteger($)||$<8||$>15)throw TypeError(`Invalid value for parameter "${X}": ${Z}`);Z=$}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${X}": ${Z}`)}else if(X==="server_max_window_bits"){let $=+Z;if(!Number.isInteger($)||$<8||$>15)throw TypeError(`Invalid value for parameter "${X}": ${Z}`);Z=$}else if(X==="client_no_context_takeover"||X==="server_no_context_takeover"){if(Z!==!0)throw TypeError(`Invalid value for parameter "${X}": ${Z}`)}else throw Error(`Unknown parameter "${X}"`);K[X]=Z})}),J}decompress(J,K,X){Z5.add((Z)=>{this._decompress(J,K,($,G)=>{Z(),X($,G)})})}compress(J,K,X){Z5.add((Z)=>{this._compress(J,K,($,G)=>{Z(),X($,G)})})}_decompress(J,K,X){let Z=this._isServer?"client":"server";if(!this._inflate){let $=`${Z}_max_window_bits`,G=typeof this.params[$]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[$];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:G}),this._inflate[$5]=this,this._inflate[U]=0,this._inflate[L]=[],this._inflate.on("error",k1),this._inflate.on("data",d5)}if(this._inflate[f]=X,this._inflate.write(J),K)this._inflate.write(b1);this._inflate.flush(()=>{let $=this._inflate[u];if($){this._inflate.close(),this._inflate=null,X($);return}let G=b5.concat(this._inflate[L],this._inflate[U]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[U]=0,this._inflate[L]=[],K&&this.params[`${Z}_no_context_takeover`])this._inflate.reset();X(null,G)})}_compress(J,K,X){let Z=this._isServer?"server":"client";if(!this._deflate){let $=`${Z}_max_window_bits`,G=typeof this.params[$]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[$];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:G}),this._deflate[U]=0,this._deflate[L]=[],this._deflate.on("data",i1)}this._deflate[f]=X,this._deflate.write(J),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let $=b5.concat(this._deflate[L],this._deflate[U]);if(K)$=new p1($.buffer,$.byteOffset,$.length-4);if(this._deflate[f]=null,this._deflate[U]=0,this._deflate[L]=[],K&&this.params[`${Z}_no_context_takeover`])this._deflate.reset();X(null,$)})}}c5.exports=k5;function i1(J){this[L].push(J),this[U]+=J.length}function d5(J){if(this[U]+=J.length,this[$5]._maxPayload<1||this[U]<=this[$5]._maxPayload){this[L].push(J);return}this[u]=RangeError("Max payload size exceeded"),this[u].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[u][i5]=1009,this.removeListener("data",d5),this.reset()}function k1(J){if(this[$5]._inflate=null,this[u]){this[f](this[u]);return}J[i5]=1007,this[f](J)}});var l=M((I4,G5)=>{var{isUtf8:n5}=R("buffer"),{hasBlob:d1}=C(),c1=[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 n1(J){return J>=1000&&J<=1014&&J!==1004&&J!==1005&&J!==1006||J>=3000&&J<=4999}function O5(J){let K=J.length,X=0;while(X<K)if((J[X]&128)===0)X++;else if((J[X]&224)===192){if(X+1===K||(J[X+1]&192)!==128||(J[X]&254)===192)return!1;X+=2}else if((J[X]&240)===224){if(X+2>=K||(J[X+1]&192)!==128||(J[X+2]&192)!==128||J[X]===224&&(J[X+1]&224)===128||J[X]===237&&(J[X+1]&224)===160)return!1;X+=3}else if((J[X]&248)===240){if(X+3>=K||(J[X+1]&192)!==128||(J[X+2]&192)!==128||(J[X+3]&192)!==128||J[X]===240&&(J[X+1]&240)===128||J[X]===244&&J[X+1]>143||J[X]>244)return!1;X+=4}else return!1;return!0}function r1(J){return d1&&typeof J==="object"&&typeof J.arrayBuffer==="function"&&typeof J.type==="string"&&typeof J.stream==="function"&&(J[Symbol.toStringTag]==="Blob"||J[Symbol.toStringTag]==="File")}G5.exports={isBlob:r1,isValidStatusCode:n1,isValidUTF8:O5,tokenChars:c1};if(n5)G5.exports.isValidUTF8=function(J){return J.length<24?O5(J):n5(J)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let J=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();G5.exports.isValidUTF8=function(K){return K.length<32?O5(K):J(K)}}catch(J){}});var P5=M((z4,t5)=>{var{Writable:a1}=R("stream"),r5=a(),{BINARY_TYPES:s1,EMPTY_BUFFER:a5,kStatusCode:o1,kWebSocket:t1}=C(),{concat:M5,toArrayBuffer:e1,unmask:J0}=n(),{isValidStatusCode:K0,isValidUTF8:s5}=l(),Q5=Buffer[Symbol.species];class o5 extends a1{constructor(J={}){super();this._allowSynchronousEvents=J.allowSynchronousEvents!==void 0?J.allowSynchronousEvents:!0,this._binaryType=J.binaryType||s1[0],this._extensions=J.extensions||{},this._isServer=!!J.isServer,this._maxPayload=J.maxPayload|0,this._skipUTF8Validation=!!J.skipUTF8Validation,this[t1]=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._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(J,K,X){if(this._opcode===8&&this._state==0)return X();this._bufferedBytes+=J.length,this._buffers.push(J),this.startLoop(X)}consume(J){if(this._bufferedBytes-=J,J===this._buffers[0].length)return this._buffers.shift();if(J<this._buffers[0].length){let X=this._buffers[0];return this._buffers[0]=new Q5(X.buffer,X.byteOffset+J,X.length-J),new Q5(X.buffer,X.byteOffset,J)}let K=Buffer.allocUnsafe(J);do{let X=this._buffers[0],Z=K.length-J;if(J>=X.length)K.set(this._buffers.shift(),Z);else K.set(new Uint8Array(X.buffer,X.byteOffset,J),Z),this._buffers[0]=new Q5(X.buffer,X.byteOffset+J,X.length-J);J-=X.length}while(J>0);return K}startLoop(J){this._loop=!0;do switch(this._state){case 0:this.getInfo(J);break;case 1:this.getPayloadLength16(J);break;case 2:this.getPayloadLength64(J);break;case 3:this.getMask();break;case 4:this.getData(J);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)J()}getInfo(J){if(this._bufferedBytes<2){this._loop=!1;return}let K=this.consume(2);if((K[0]&48)!==0){let Z=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");J(Z);return}let X=(K[0]&64)===64;if(X&&!this._extensions[r5.extensionName]){let Z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");J(Z);return}if(this._fin=(K[0]&128)===128,this._opcode=K[0]&15,this._payloadLength=K[1]&127,this._opcode===0){if(X){let Z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");J(Z);return}if(!this._fragmented){let Z=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");J(Z);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let Z=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");J(Z);return}this._compressed=X}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let Z=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");J(Z);return}if(X){let Z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");J(Z);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let Z=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");J(Z);return}}else{let Z=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");J(Z);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(K[1]&128)===128,this._isServer){if(!this._masked){let Z=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");J(Z);return}}else if(this._masked){let Z=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");J(Z);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(J)}getPayloadLength16(J){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(J)}getPayloadLength64(J){if(this._bufferedBytes<8){this._loop=!1;return}let K=this.consume(8),X=K.readUInt32BE(0);if(X>Math.pow(2,21)-1){let Z=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");J(Z);return}this._payloadLength=X*Math.pow(2,32)+K.readUInt32BE(4),this.haveLength(J)}haveLength(J){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let K=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");J(K);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(J){let K=a5;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(K=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)J0(K,this._mask)}if(this._opcode>7){this.controlMessage(K,J);return}if(this._compressed){this._state=5,this.decompress(K,J);return}if(K.length)this._messageLength=this._totalPayloadLength,this._fragments.push(K);this.dataMessage(J)}decompress(J,K){this._extensions[r5.extensionName].decompress(J,this._fin,(Z,$)=>{if(Z)return K(Z);if($.length){if(this._messageLength+=$.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let G=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");K(G);return}this._fragments.push($)}if(this.dataMessage(K),this._state===0)this.startLoop(K)})}dataMessage(J){if(!this._fin){this._state=0;return}let K=this._messageLength,X=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let Z;if(this._binaryType==="nodebuffer")Z=M5(X,K);else if(this._binaryType==="arraybuffer")Z=e1(M5(X,K));else if(this._binaryType==="blob")Z=new Blob(X);else Z=X;if(this._allowSynchronousEvents)this.emit("message",Z,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Z,!0),this._state=0,this.startLoop(J)})}else{let Z=M5(X,K);if(!this._skipUTF8Validation&&!s5(Z)){let $=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");J($);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",Z,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Z,!1),this._state=0,this.startLoop(J)})}}controlMessage(J,K){if(this._opcode===8){if(J.length===0)this._loop=!1,this.emit("conclude",1005,a5),this.end();else{let X=J.readUInt16BE(0);if(!K0(X)){let $=this.createError(RangeError,`invalid status code ${X}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");K($);return}let Z=new Q5(J.buffer,J.byteOffset+2,J.length-2);if(!this._skipUTF8Validation&&!s5(Z)){let $=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");K($);return}this._loop=!1,this.emit("conclude",X,Z),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",J),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",J),this._state=0,this.startLoop(K)})}createError(J,K,X,Z,$){this._loop=!1,this._errored=!0;let G=new J(X?`Invalid WebSocket frame: ${K}`:K);return Error.captureStackTrace(G,this.createError),G.code=$,G[o1]=Z,G}}t5.exports=o5});var x5=M((V4,K1)=>{var{Duplex:Y4}=R("stream"),{randomFillSync:X0}=R("crypto"),e5=a(),{EMPTY_BUFFER:Z0,kWebSocket:$0,NOOP:G0}=C(),{isBlob:p,isValidStatusCode:Q0}=l(),{mask:J1,toBuffer:S}=n(),T=Symbol("kByteLength"),j0=Buffer.alloc(4),v,b=8192,x=0,I0=1,z0=2;class W{constructor(J,K,X){if(this._extensions=K||{},X)this._generateMask=X,this._maskBuffer=Buffer.alloc(4);this._socket=J,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=x,this.onerror=G0,this[$0]=void 0}static frame(J,K){let X,Z=!1,$=2,G=!1;if(K.mask){if(X=K.maskBuffer||j0,K.generateMask)K.generateMask(X);else{if(b===8192){if(v===void 0)v=Buffer.alloc(8192);X0(v,0,8192),b=0}X[0]=v[b++],X[1]=v[b++],X[2]=v[b++],X[3]=v[b++]}G=(X[0]|X[1]|X[2]|X[3])===0,$=6}let Q;if(typeof J==="string")if((!K.mask||G)&&K[T]!==void 0)Q=K[T];else J=Buffer.from(J),Q=J.length;else Q=J.length,Z=K.mask&&K.readOnly&&!G;let I=Q;if(Q>=65536)$+=8,I=127;else if(Q>125)$+=2,I=126;let j=Buffer.allocUnsafe(Z?Q+$:$);if(j[0]=K.fin?K.opcode|128:K.opcode,K.rsv1)j[0]|=64;if(j[1]=I,I===126)j.writeUInt16BE(Q,2);else if(I===127)j[2]=j[3]=0,j.writeUIntBE(Q,4,6);if(!K.mask)return[j,J];if(j[1]|=128,j[$-4]=X[0],j[$-3]=X[1],j[$-2]=X[2],j[$-1]=X[3],G)return[j,J];if(Z)return J1(J,X,j,$,Q),[j];return J1(J,X,J,0,Q),[j,J]}close(J,K,X,Z){let $;if(J===void 0)$=Z0;else if(typeof J!=="number"||!Q0(J))throw TypeError("First argument must be a valid error code number");else if(K===void 0||!K.length)$=Buffer.allocUnsafe(2),$.writeUInt16BE(J,0);else{let Q=Buffer.byteLength(K);if(Q>123)throw RangeError("The message must not be greater than 123 bytes");if($=Buffer.allocUnsafe(2+Q),$.writeUInt16BE(J,0),typeof K==="string")$.write(K,2);else $.set(K,2)}let G={[T]:$.length,fin:!0,generateMask:this._generateMask,mask:X,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==x)this.enqueue([this.dispatch,$,!1,G,Z]);else this.sendFrame(W.frame($,G),Z)}ping(J,K,X){let Z,$;if(typeof J==="string")Z=Buffer.byteLength(J),$=!1;else if(p(J))Z=J.size,$=!1;else J=S(J),Z=J.length,$=S.readOnly;if(Z>125)throw RangeError("The data size must not be greater than 125 bytes");let G={[T]:Z,fin:!0,generateMask:this._generateMask,mask:K,maskBuffer:this._maskBuffer,opcode:9,readOnly:$,rsv1:!1};if(p(J))if(this._state!==x)this.enqueue([this.getBlobData,J,!1,G,X]);else this.getBlobData(J,!1,G,X);else if(this._state!==x)this.enqueue([this.dispatch,J,!1,G,X]);else this.sendFrame(W.frame(J,G),X)}pong(J,K,X){let Z,$;if(typeof J==="string")Z=Buffer.byteLength(J),$=!1;else if(p(J))Z=J.size,$=!1;else J=S(J),Z=J.length,$=S.readOnly;if(Z>125)throw RangeError("The data size must not be greater than 125 bytes");let G={[T]:Z,fin:!0,generateMask:this._generateMask,mask:K,maskBuffer:this._maskBuffer,opcode:10,readOnly:$,rsv1:!1};if(p(J))if(this._state!==x)this.enqueue([this.getBlobData,J,!1,G,X]);else this.getBlobData(J,!1,G,X);else if(this._state!==x)this.enqueue([this.dispatch,J,!1,G,X]);else this.sendFrame(W.frame(J,G),X)}send(J,K,X){let Z=this._extensions[e5.extensionName],$=K.binary?2:1,G=K.compress,Q,I;if(typeof J==="string")Q=Buffer.byteLength(J),I=!1;else if(p(J))Q=J.size,I=!1;else J=S(J),Q=J.length,I=S.readOnly;if(this._firstFragment){if(this._firstFragment=!1,G&&Z&&Z.params[Z._isServer?"server_no_context_takeover":"client_no_context_takeover"])G=Q>=Z._threshold;this._compress=G}else G=!1,$=0;if(K.fin)this._firstFragment=!0;let j={[T]:Q,fin:K.fin,generateMask:this._generateMask,mask:K.mask,maskBuffer:this._maskBuffer,opcode:$,readOnly:I,rsv1:G};if(p(J))if(this._state!==x)this.enqueue([this.getBlobData,J,this._compress,j,X]);else this.getBlobData(J,this._compress,j,X);else if(this._state!==x)this.enqueue([this.dispatch,J,this._compress,j,X]);else this.dispatch(J,this._compress,j,X)}getBlobData(J,K,X,Z){this._bufferedBytes+=X[T],this._state=z0,J.arrayBuffer().then(($)=>{if(this._socket.destroyed){let Q=Error("The socket was closed while the blob was being read");process.nextTick(T5,this,Q,Z);return}this._bufferedBytes-=X[T];let G=S($);if(!K)this._state=x,this.sendFrame(W.frame(G,X),Z),this.dequeue();else this.dispatch(G,K,X,Z)}).catch(($)=>{process.nextTick(Y0,this,$,Z)})}dispatch(J,K,X,Z){if(!K){this.sendFrame(W.frame(J,X),Z);return}let $=this._extensions[e5.extensionName];this._bufferedBytes+=X[T],this._state=I0,$.compress(J,X.fin,(G,Q)=>{if(this._socket.destroyed){let I=Error("The socket was closed while data was being compressed");T5(this,I,Z);return}this._bufferedBytes-=X[T],this._state=x,X.readOnly=!1,this.sendFrame(W.frame(Q,X),Z),this.dequeue()})}dequeue(){while(this._state===x&&this._queue.length){let J=this._queue.shift();this._bufferedBytes-=J[3][T],Reflect.apply(J[0],this,J.slice(1))}}enqueue(J){this._bufferedBytes+=J[3][T],this._queue.push(J)}sendFrame(J,K){if(J.length===2)this._socket.cork(),this._socket.write(J[0]),this._socket.write(J[1],K),this._socket.uncork();else this._socket.write(J[0],K)}}K1.exports=W;function T5(J,K,X){if(typeof X==="function")X(K);for(let Z=0;Z<J._queue.length;Z++){let $=J._queue[Z],G=$[$.length-1];if(typeof G==="function")G(K)}}function Y0(J,K,X){T5(J,K,X),J.onerror(K)}});var Y1=M((_4,z1)=>{var{kForOnEventAttribute:s,kListener:B5}=C(),X1=Symbol("kCode"),Z1=Symbol("kData"),$1=Symbol("kError"),G1=Symbol("kMessage"),Q1=Symbol("kReason"),i=Symbol("kTarget"),j1=Symbol("kType"),I1=Symbol("kWasClean");class E{constructor(J){this[i]=null,this[j1]=J}get target(){return this[i]}get type(){return this[j1]}}Object.defineProperty(E.prototype,"target",{enumerable:!0});Object.defineProperty(E.prototype,"type",{enumerable:!0});class k extends E{constructor(J,K={}){super(J);this[X1]=K.code===void 0?0:K.code,this[Q1]=K.reason===void 0?"":K.reason,this[I1]=K.wasClean===void 0?!1:K.wasClean}get code(){return this[X1]}get reason(){return this[Q1]}get wasClean(){return this[I1]}}Object.defineProperty(k.prototype,"code",{enumerable:!0});Object.defineProperty(k.prototype,"reason",{enumerable:!0});Object.defineProperty(k.prototype,"wasClean",{enumerable:!0});class o extends E{constructor(J,K={}){super(J);this[$1]=K.error===void 0?null:K.error,this[G1]=K.message===void 0?"":K.message}get error(){return this[$1]}get message(){return this[G1]}}Object.defineProperty(o.prototype,"error",{enumerable:!0});Object.defineProperty(o.prototype,"message",{enumerable:!0});class I5 extends E{constructor(J,K={}){super(J);this[Z1]=K.data===void 0?null:K.data}get data(){return this[Z1]}}Object.defineProperty(I5.prototype,"data",{enumerable:!0});var V0={addEventListener(J,K,X={}){for(let $ of this.listeners(J))if(!X[s]&&$[B5]===K&&!$[s])return;let Z;if(J==="message")Z=function(G,Q){let I=new I5("message",{data:Q?G:G.toString()});I[i]=this,j5(K,this,I)};else if(J==="close")Z=function(G,Q){let I=new k("close",{code:G,reason:Q.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});I[i]=this,j5(K,this,I)};else if(J==="error")Z=function(G){let Q=new o("error",{error:G,message:G.message});Q[i]=this,j5(K,this,Q)};else if(J==="open")Z=function(){let G=new E("open");G[i]=this,j5(K,this,G)};else return;if(Z[s]=!!X[s],Z[B5]=K,X.once)this.once(J,Z);else this.on(J,Z)},removeEventListener(J,K){for(let X of this.listeners(J))if(X[B5]===K&&!X[s]){this.removeListener(J,X);break}}};z1.exports={CloseEvent:k,ErrorEvent:o,Event:E,EventTarget:V0,MessageEvent:I5};function j5(J,K,X){if(typeof J==="object"&&J.handleEvent)J.handleEvent.call(J,X);else J.call(K,X)}});var C5=M((N4,V1)=>{var{tokenChars:t}=l();function B(J,K,X){if(J[K]===void 0)J[K]=[X];else J[K].push(X)}function _0(J){let K=Object.create(null),X=Object.create(null),Z=!1,$=!1,G=!1,Q,I,j=-1,V=-1,_=-1,Y=0;for(;Y<J.length;Y++)if(V=J.charCodeAt(Y),Q===void 0)if(_===-1&&t[V]===1){if(j===-1)j=Y}else if(Y!==0&&(V===32||V===9)){if(_===-1&&j!==-1)_=Y}else if(V===59||V===44){if(j===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(_===-1)_=Y;let D=J.slice(j,_);if(V===44)B(K,D,X),X=Object.create(null);else Q=D;j=_=-1}else throw SyntaxError(`Unexpected character at index ${Y}`);else if(I===void 0)if(_===-1&&t[V]===1){if(j===-1)j=Y}else if(V===32||V===9){if(_===-1&&j!==-1)_=Y}else if(V===59||V===44){if(j===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(_===-1)_=Y;if(B(X,J.slice(j,_),!0),V===44)B(K,Q,X),X=Object.create(null),Q=void 0;j=_=-1}else if(V===61&&j!==-1&&_===-1)I=J.slice(j,Y),j=_=-1;else throw SyntaxError(`Unexpected character at index ${Y}`);else if($){if(t[V]!==1)throw SyntaxError(`Unexpected character at index ${Y}`);if(j===-1)j=Y;else if(!Z)Z=!0;$=!1}else if(G)if(t[V]===1){if(j===-1)j=Y}else if(V===34&&j!==-1)G=!1,_=Y;else if(V===92)$=!0;else throw SyntaxError(`Unexpected character at index ${Y}`);else if(V===34&&J.charCodeAt(Y-1)===61)G=!0;else if(_===-1&&t[V]===1){if(j===-1)j=Y}else if(j!==-1&&(V===32||V===9)){if(_===-1)_=Y}else if(V===59||V===44){if(j===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(_===-1)_=Y;let D=J.slice(j,_);if(Z)D=D.replace(/\\/g,""),Z=!1;if(B(X,I,D),V===44)B(K,Q,X),X=Object.create(null),Q=void 0;I=void 0,j=_=-1}else throw SyntaxError(`Unexpected character at index ${Y}`);if(j===-1||G||V===32||V===9)throw SyntaxError("Unexpected end of input");if(_===-1)_=Y;let F=J.slice(j,_);if(Q===void 0)B(K,F,X);else{if(I===void 0)B(X,F,!0);else if(Z)B(X,I,F.replace(/\\/g,""));else B(X,I,F);B(K,Q,X)}return K}function N0(J){return Object.keys(J).map((K)=>{let X=J[K];if(!Array.isArray(X))X=[X];return X.map((Z)=>{return[K].concat(Object.keys(Z).map(($)=>{let G=Z[$];if(!Array.isArray(G))G=[G];return G.map((Q)=>Q===!0?$:`${$}=${Q}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}V1.exports={format:N0,parse:_0}});var _5=M((A4,x1)=>{var H0=R("events"),R0=R("https"),A0=R("http"),H1=R("net"),F0=R("tls"),{randomBytes:D0,createHash:O0}=R("crypto"),{Duplex:H4,Readable:R4}=R("stream"),{URL:U5}=R("url"),y=a(),M0=P5(),P0=x5(),{isBlob:T0}=l(),{BINARY_TYPES:_1,EMPTY_BUFFER:z5,GUID:x0,kForOnEventAttribute:q5,kListener:B0,kStatusCode:C0,kWebSocket:A,NOOP:R1}=C(),{EventTarget:{addEventListener:U0,removeEventListener:q0}}=Y1(),{format:L0,parse:W0}=C5(),{toBuffer:E0}=n(),A1=Symbol("kAborted"),L5=[8,13],q=["CONNECTING","OPEN","CLOSING","CLOSED"],y0=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class z extends H0{constructor(J,K,X){super();if(this._binaryType=_1[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=z5,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=z.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,J!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,K===void 0)K=[];else if(!Array.isArray(K))if(typeof K==="object"&&K!==null)X=K,K=[];else K=[K];F1(this,J,K,X)}else this._autoPong=X.autoPong,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(J){if(!_1.includes(J))return;if(this._binaryType=J,this._receiver)this._receiver._binaryType=J}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}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(J,K,X){let Z=new M0({allowSynchronousEvents:X.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:X.maxPayload,skipUTF8Validation:X.skipUTF8Validation}),$=new P0(J,this._extensions,X.generateMask);if(this._receiver=Z,this._sender=$,this._socket=J,Z[A]=this,$[A]=this,J[A]=this,Z.on("conclude",g0),Z.on("drain",w0),Z.on("error",h0),Z.on("message",m0),Z.on("ping",f0),Z.on("pong",u0),$.onerror=l0,J.setTimeout)J.setTimeout(0);if(J.setNoDelay)J.setNoDelay();if(K.length>0)J.unshift(K);J.on("close",M1),J.on("data",V5),J.on("end",P1),J.on("error",T1),this._readyState=z.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=z.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[y.extensionName])this._extensions[y.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=z.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(J,K){if(this.readyState===z.CLOSED)return;if(this.readyState===z.CONNECTING){P(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===z.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=z.CLOSING,this._sender.close(J,K,!this._isServer,(X)=>{if(X)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),O1(this)}pause(){if(this.readyState===z.CONNECTING||this.readyState===z.CLOSED)return;this._paused=!0,this._socket.pause()}ping(J,K,X){if(this.readyState===z.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")X=J,J=K=void 0;else if(typeof K==="function")X=K,K=void 0;if(typeof J==="number")J=J.toString();if(this.readyState!==z.OPEN){W5(this,J,X);return}if(K===void 0)K=!this._isServer;this._sender.ping(J||z5,K,X)}pong(J,K,X){if(this.readyState===z.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")X=J,J=K=void 0;else if(typeof K==="function")X=K,K=void 0;if(typeof J==="number")J=J.toString();if(this.readyState!==z.OPEN){W5(this,J,X);return}if(K===void 0)K=!this._isServer;this._sender.pong(J||z5,K,X)}resume(){if(this.readyState===z.CONNECTING||this.readyState===z.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(J,K,X){if(this.readyState===z.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof K==="function")X=K,K={};if(typeof J==="number")J=J.toString();if(this.readyState!==z.OPEN){W5(this,J,X);return}let Z={binary:typeof J!=="string",mask:!this._isServer,compress:!0,fin:!0,...K};if(!this._extensions[y.extensionName])Z.compress=!1;this._sender.send(J||z5,Z,X)}terminate(){if(this.readyState===z.CLOSED)return;if(this.readyState===z.CONNECTING){P(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=z.CLOSING,this._socket.destroy()}}Object.defineProperty(z,"CONNECTING",{enumerable:!0,value:q.indexOf("CONNECTING")});Object.defineProperty(z.prototype,"CONNECTING",{enumerable:!0,value:q.indexOf("CONNECTING")});Object.defineProperty(z,"OPEN",{enumerable:!0,value:q.indexOf("OPEN")});Object.defineProperty(z.prototype,"OPEN",{enumerable:!0,value:q.indexOf("OPEN")});Object.defineProperty(z,"CLOSING",{enumerable:!0,value:q.indexOf("CLOSING")});Object.defineProperty(z.prototype,"CLOSING",{enumerable:!0,value:q.indexOf("CLOSING")});Object.defineProperty(z,"CLOSED",{enumerable:!0,value:q.indexOf("CLOSED")});Object.defineProperty(z.prototype,"CLOSED",{enumerable:!0,value:q.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((J)=>{Object.defineProperty(z.prototype,J,{enumerable:!0})});["open","error","close","message"].forEach((J)=>{Object.defineProperty(z.prototype,`on${J}`,{enumerable:!0,get(){for(let K of this.listeners(J))if(K[q5])return K[B0];return null},set(K){for(let X of this.listeners(J))if(X[q5]){this.removeListener(J,X);break}if(typeof K!=="function")return;this.addEventListener(J,K,{[q5]:!0})}})});z.prototype.addEventListener=U0;z.prototype.removeEventListener=q0;x1.exports=z;function F1(J,K,X,Z){let $={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:L5[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...Z,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(J._autoPong=$.autoPong,!L5.includes($.protocolVersion))throw RangeError(`Unsupported protocol version: ${$.protocolVersion} (supported versions: ${L5.join(", ")})`);let G;if(K instanceof U5)G=K;else try{G=new U5(K)}catch(N){throw SyntaxError(`Invalid URL: ${K}`)}if(G.protocol==="http:")G.protocol="ws:";else if(G.protocol==="https:")G.protocol="wss:";J._url=G.href;let Q=G.protocol==="wss:",I=G.protocol==="ws+unix:",j;if(G.protocol!=="ws:"&&!Q&&!I)j=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(I&&!G.pathname)j="The URL's pathname is empty";else if(G.hash)j="The URL contains a fragment identifier";if(j){let N=SyntaxError(j);if(J._redirects===0)throw N;else{Y5(J,N);return}}let V=Q?443:80,_=D0(16).toString("base64"),Y=Q?R0.request:A0.request,F=new Set,D;if($.createConnection=$.createConnection||(Q?v0:S0),$.defaultPort=$.defaultPort||V,$.port=G.port||V,$.host=G.hostname.startsWith("[")?G.hostname.slice(1,-1):G.hostname,$.headers={...$.headers,"Sec-WebSocket-Version":$.protocolVersion,"Sec-WebSocket-Key":_,Connection:"Upgrade",Upgrade:"websocket"},$.path=G.pathname+G.search,$.timeout=$.handshakeTimeout,$.perMessageDeflate)D=new y($.perMessageDeflate!==!0?$.perMessageDeflate:{},!1,$.maxPayload),$.headers["Sec-WebSocket-Extensions"]=L0({[y.extensionName]:D.offer()});if(X.length){for(let N of X){if(typeof N!=="string"||!y0.test(N)||F.has(N))throw SyntaxError("An invalid or duplicated subprotocol was specified");F.add(N)}$.headers["Sec-WebSocket-Protocol"]=X.join(",")}if($.origin)if($.protocolVersion<13)$.headers["Sec-WebSocket-Origin"]=$.origin;else $.headers.Origin=$.origin;if(G.username||G.password)$.auth=`${G.username}:${G.password}`;if(I){let N=$.path.split(":");$.socketPath=N[0],$.path=N[1]}let H;if($.followRedirects){if(J._redirects===0){J._originalIpc=I,J._originalSecure=Q,J._originalHostOrSocketPath=I?$.socketPath:G.host;let N=Z&&Z.headers;if(Z={...Z,headers:{}},N)for(let[O,h]of Object.entries(N))Z.headers[O.toLowerCase()]=h}else if(J.listenerCount("redirect")===0){let N=I?J._originalIpc?$.socketPath===J._originalHostOrSocketPath:!1:J._originalIpc?!1:G.host===J._originalHostOrSocketPath;if(!N||J._originalSecure&&!Q){if(delete $.headers.authorization,delete $.headers.cookie,!N)delete $.headers.host;$.auth=void 0}}if($.auth&&!Z.headers.authorization)Z.headers.authorization="Basic "+Buffer.from($.auth).toString("base64");if(H=J._req=Y($),J._redirects)J.emit("redirect",J.url,H)}else H=J._req=Y($);if($.timeout)H.on("timeout",()=>{P(J,H,"Opening handshake has timed out")});if(H.on("error",(N)=>{if(H===null||H[A1])return;H=J._req=null,Y5(J,N)}),H.on("response",(N)=>{let O=N.headers.location,h=N.statusCode;if(O&&$.followRedirects&&h>=300&&h<400){if(++J._redirects>$.maxRedirects){P(J,H,"Maximum redirects exceeded");return}H.abort();let d;try{d=new U5(O,K)}catch(E5){let m=SyntaxError(`Invalid URL: ${O}`);Y5(J,m);return}F1(J,d,X,Z)}else if(!J.emit("unexpected-response",H,N))P(J,H,`Unexpected server response: ${N.statusCode}`)}),H.on("upgrade",(N,O,h)=>{if(J.emit("upgrade",N),J.readyState!==z.CONNECTING)return;H=J._req=null;let d=N.headers.upgrade;if(d===void 0||d.toLowerCase()!=="websocket"){P(J,O,"Invalid Upgrade header");return}let E5=O0("sha1").update(_+x0).digest("base64");if(N.headers["sec-websocket-accept"]!==E5){P(J,O,"Invalid Sec-WebSocket-Accept header");return}let m=N.headers["sec-websocket-protocol"],c;if(m!==void 0){if(!F.size)c="Server sent a subprotocol but none was requested";else if(!F.has(m))c="Server sent an invalid subprotocol"}else if(F.size)c="Server sent no subprotocol";if(c){P(J,O,c);return}if(m)J._protocol=m;let y5=N.headers["sec-websocket-extensions"];if(y5!==void 0){if(!D){P(J,O,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let H5;try{H5=W0(y5)}catch(R5){P(J,O,"Invalid Sec-WebSocket-Extensions header");return}let S5=Object.keys(H5);if(S5.length!==1||S5[0]!==y.extensionName){P(J,O,"Server indicated an extension that was not requested");return}try{D.accept(H5[y.extensionName])}catch(R5){P(J,O,"Invalid Sec-WebSocket-Extensions header");return}J._extensions[y.extensionName]=D}J.setSocket(O,h,{allowSynchronousEvents:$.allowSynchronousEvents,generateMask:$.generateMask,maxPayload:$.maxPayload,skipUTF8Validation:$.skipUTF8Validation})}),$.finishRequest)$.finishRequest(H,J);else H.end()}function Y5(J,K){J._readyState=z.CLOSING,J._errorEmitted=!0,J.emit("error",K),J.emitClose()}function S0(J){return J.path=J.socketPath,H1.connect(J)}function v0(J){if(J.path=void 0,!J.servername&&J.servername!=="")J.servername=H1.isIP(J.host)?"":J.host;return F0.connect(J)}function P(J,K,X){J._readyState=z.CLOSING;let Z=Error(X);if(Error.captureStackTrace(Z,P),K.setHeader){if(K[A1]=!0,K.abort(),K.socket&&!K.socket.destroyed)K.socket.destroy();process.nextTick(Y5,J,Z)}else K.destroy(Z),K.once("error",J.emit.bind(J,"error")),K.once("close",J.emitClose.bind(J))}function W5(J,K,X){if(K){let Z=T0(K)?K.size:E0(K).length;if(J._socket)J._sender._bufferedBytes+=Z;else J._bufferedAmount+=Z}if(X){let Z=Error(`WebSocket is not open: readyState ${J.readyState} (${q[J.readyState]})`);process.nextTick(X,Z)}}function g0(J,K){let X=this[A];if(X._closeFrameReceived=!0,X._closeMessage=K,X._closeCode=J,X._socket[A]===void 0)return;if(X._socket.removeListener("data",V5),process.nextTick(D1,X._socket),J===1005)X.close();else X.close(J,K)}function w0(){let J=this[A];if(!J.isPaused)J._socket.resume()}function h0(J){let K=this[A];if(K._socket[A]!==void 0)K._socket.removeListener("data",V5),process.nextTick(D1,K._socket),K.close(J[C0]);if(!K._errorEmitted)K._errorEmitted=!0,K.emit("error",J)}function N1(){this[A].emitClose()}function m0(J,K){this[A].emit("message",J,K)}function f0(J){let K=this[A];if(K._autoPong)K.pong(J,!this._isServer,R1);K.emit("ping",J)}function u0(J){this[A].emit("pong",J)}function D1(J){J.resume()}function l0(J){let K=this[A];if(K.readyState===z.CLOSED)return;if(K.readyState===z.OPEN)K._readyState=z.CLOSING,O1(K);if(this._socket.end(),!K._errorEmitted)K._errorEmitted=!0,K.emit("error",J)}function O1(J){J._closeTimer=setTimeout(J._socket.destroy.bind(J._socket),30000)}function M1(){let J=this[A];this.removeListener("close",M1),this.removeListener("data",V5),this.removeListener("end",P1),J._readyState=z.CLOSING;let K;if(!this._readableState.endEmitted&&!J._closeFrameReceived&&!J._receiver._writableState.errorEmitted&&(K=J._socket.read())!==null)J._receiver.write(K);if(J._receiver.end(),this[A]=void 0,clearTimeout(J._closeTimer),J._receiver._writableState.finished||J._receiver._writableState.errorEmitted)J.emitClose();else J._receiver.on("error",N1),J._receiver.on("finish",N1)}function V5(J){if(!this[A]._receiver.write(J))this.pause()}function P1(){let J=this[A];J._readyState=z.CLOSING,J._receiver.end(),this.end()}function T1(){let J=this[A];if(this.removeListener("error",T1),this.on("error",R1),J)J._readyState=z.CLOSING,this.destroy()}});var q1=M((D4,U1)=>{var F4=_5(),{Duplex:p0}=R("stream");function B1(J){J.emit("close")}function b0(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function C1(J){if(this.removeListener("error",C1),this.destroy(),this.listenerCount("error")===0)this.emit("error",J)}function i0(J,K){let X=!0,Z=new p0({...K,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return J.on("message",function(G,Q){let I=!Q&&Z._readableState.objectMode?G.toString():G;if(!Z.push(I))J.pause()}),J.once("error",function(G){if(Z.destroyed)return;X=!1,Z.destroy(G)}),J.once("close",function(){if(Z.destroyed)return;Z.push(null)}),Z._destroy=function($,G){if(J.readyState===J.CLOSED){G($),process.nextTick(B1,Z);return}let Q=!1;if(J.once("error",function(j){Q=!0,G(j)}),J.once("close",function(){if(!Q)G($);process.nextTick(B1,Z)}),X)J.terminate()},Z._final=function($){if(J.readyState===J.CONNECTING){J.once("open",function(){Z._final($)});return}if(J._socket===null)return;if(J._socket._writableState.finished){if($(),Z._readableState.endEmitted)Z.destroy()}else J._socket.once("finish",function(){$()}),J.close()},Z._read=function(){if(J.isPaused)J.resume()},Z._write=function($,G,Q){if(J.readyState===J.CONNECTING){J.once("open",function(){Z._write($,G,Q)});return}J.send($,Q)},Z.on("end",b0),Z.on("error",C1),Z}U1.exports=i0});var W1=M((O4,L1)=>{var{tokenChars:k0}=l();function d0(J){let K=new Set,X=-1,Z=-1,$=0;for($;$<J.length;$++){let Q=J.charCodeAt($);if(Z===-1&&k0[Q]===1){if(X===-1)X=$}else if($!==0&&(Q===32||Q===9)){if(Z===-1&&X!==-1)Z=$}else if(Q===44){if(X===-1)throw SyntaxError(`Unexpected character at index ${$}`);if(Z===-1)Z=$;let I=J.slice(X,Z);if(K.has(I))throw SyntaxError(`The "${I}" subprotocol is duplicated`);K.add(I),X=Z=-1}else throw SyntaxError(`Unexpected character at index ${$}`)}if(X===-1||Z!==-1)throw SyntaxError("Unexpected end of input");let G=J.slice(X,$);if(K.has(G))throw SyntaxError(`The "${G}" subprotocol is duplicated`);return K.add(G),K}L1.exports={parse:d0}});var g1=M((P4,v1)=>{var c0=R("events"),N5=R("http"),{Duplex:M4}=R("stream"),{createHash:n0}=R("crypto"),E1=C5(),g=a(),r0=W1(),a0=_5(),{GUID:s0,kWebSocket:o0}=C(),t0=/^[+/0-9A-Za-z]{22}==$/;class S1 extends c0{constructor(J,K){super();if(J={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:a0,...J},J.port==null&&!J.server&&!J.noServer||J.port!=null&&(J.server||J.noServer)||J.server&&J.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(J.port!=null)this._server=N5.createServer((X,Z)=>{let $=N5.STATUS_CODES[426];Z.writeHead(426,{"Content-Length":$.length,"Content-Type":"text/plain"}),Z.end($)}),this._server.listen(J.port,J.host,J.backlog,K);else if(J.server)this._server=J.server;if(this._server){let X=this.emit.bind(this,"connection");this._removeListeners=e0(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(Z,$,G)=>{this.handleUpgrade(Z,$,G,X)}})}if(J.perMessageDeflate===!0)J.perMessageDeflate={};if(J.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=J,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(J){if(this._state===2){if(J)this.once("close",()=>{J(Error("The server is not running"))});process.nextTick(e,this);return}if(J)this.once("close",J);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(e,this);else this._shouldEmitClose=!0;else process.nextTick(e,this)}else{let K=this._server;this._removeListeners(),this._removeListeners=this._server=null,K.close(()=>{e(this)})}}shouldHandle(J){if(this.options.path){let K=J.url.indexOf("?");if((K!==-1?J.url.slice(0,K):J.url)!==this.options.path)return!1}return!0}handleUpgrade(J,K,X,Z){K.on("error",y1);let $=J.headers["sec-websocket-key"],G=J.headers.upgrade,Q=+J.headers["sec-websocket-version"];if(J.method!=="GET"){w(this,J,K,405,"Invalid HTTP method");return}if(G===void 0||G.toLowerCase()!=="websocket"){w(this,J,K,400,"Invalid Upgrade header");return}if($===void 0||!t0.test($)){w(this,J,K,400,"Missing or invalid Sec-WebSocket-Key header");return}if(Q!==13&&Q!==8){w(this,J,K,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(J)){J5(K,400);return}let I=J.headers["sec-websocket-protocol"],j=new Set;if(I!==void 0)try{j=r0.parse(I)}catch(Y){w(this,J,K,400,"Invalid Sec-WebSocket-Protocol header");return}let V=J.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&V!==void 0){let Y=new g(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let F=E1.parse(V);if(F[g.extensionName])Y.accept(F[g.extensionName]),_[g.extensionName]=Y}catch(F){w(this,J,K,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let Y={origin:J.headers[`${Q===8?"sec-websocket-origin":"origin"}`],secure:!!(J.socket.authorized||J.socket.encrypted),req:J};if(this.options.verifyClient.length===2){this.options.verifyClient(Y,(F,D,H,N)=>{if(!F)return J5(K,D||401,H,N);this.completeUpgrade(_,$,j,J,K,X,Z)});return}if(!this.options.verifyClient(Y))return J5(K,401)}this.completeUpgrade(_,$,j,J,K,X,Z)}completeUpgrade(J,K,X,Z,$,G,Q){if(!$.readable||!$.writable)return $.destroy();if($[o0])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return J5($,503);let j=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${n0("sha1").update(K+s0).digest("base64")}`],V=new this.options.WebSocket(null,void 0,this.options);if(X.size){let _=this.options.handleProtocols?this.options.handleProtocols(X,Z):X.values().next().value;if(_)j.push(`Sec-WebSocket-Protocol: ${_}`),V._protocol=_}if(J[g.extensionName]){let _=J[g.extensionName].params,Y=E1.format({[g.extensionName]:[_]});j.push(`Sec-WebSocket-Extensions: ${Y}`),V._extensions=J}if(this.emit("headers",j,Z),$.write(j.concat(`\r
2
+ `).join(`\r
3
+ `)),$.removeListener("error",y1),V.setSocket($,G,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(V),V.on("close",()=>{if(this.clients.delete(V),this._shouldEmitClose&&!this.clients.size)process.nextTick(e,this)});Q(V,Z)}}v1.exports=S1;function e0(J,K){for(let X of Object.keys(K))J.on(X,K[X]);return function(){for(let Z of Object.keys(K))J.removeListener(Z,K[Z])}}function e(J){J._state=2,J.emit("close")}function y1(){this.destroy()}function J5(J,K,X,Z){X=X||N5.STATUS_CODES[K],Z={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(X),...Z},J.once("finish",J.destroy),J.end(`HTTP/1.1 ${K} ${N5.STATUS_CODES[K]}\r
4
+ `+Object.keys(Z).map(($)=>`${$}: ${Z[$]}`).join(`\r
5
+ `)+`\r
6
+ \r
7
+ `+X)}function w(J,K,X,Z,$,G){if(J.listenerCount("wsClientError")){let Q=Error($);Error.captureStackTrace(Q,w),J.emit("wsClientError",Q,X,K)}else J5(X,Z,$,G)}});var J4=K5(q1(),1),K4=K5(P5(),1),X4=K5(x5(),1),w1=K5(_5(),1),Z4=K5(g1(),1);var x4=w1.default;
8
+ export{w1 as a,x4 as b};
9
+
10
+ //# debugId=5C63658F3376771F64756E2164756E21