neural-loom 0.2.41 → 0.2.43

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 (139) hide show
  1. package/.next/BUILD_ID +1 -0
  2. package/.next/app-path-routes-manifest.json +20 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/cache/.previewinfo +1 -1
  5. package/.next/cache/.rscinfo +1 -1
  6. package/.next/cache/.tsbuildinfo +1 -1
  7. package/.next/diagnostics/build-diagnostics.json +1 -1
  8. package/.next/diagnostics/route-bundle-stats.json +25 -0
  9. package/.next/export-marker.json +6 -0
  10. package/.next/fallback-build-manifest.json +3 -3
  11. package/.next/images-manifest.json +68 -0
  12. package/.next/prerender-manifest.json +85 -0
  13. package/.next/required-server-files.js +335 -0
  14. package/.next/required-server-files.json +335 -0
  15. package/.next/routes-manifest.json +153 -0
  16. package/.next/server/app/_global-error.html +1 -0
  17. package/.next/server/app/_global-error.meta +15 -0
  18. package/.next/server/app/_global-error.rsc +14 -0
  19. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +5 -0
  20. package/.next/server/app/_global-error.segments/_full.segment.rsc +14 -0
  21. package/.next/server/app/_global-error.segments/_head.segment.rsc +5 -0
  22. package/.next/server/app/_global-error.segments/_index.segment.rsc +5 -0
  23. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -0
  24. package/.next/server/app/_not-found.html +1 -0
  25. package/.next/server/app/_not-found.meta +16 -0
  26. package/.next/server/app/_not-found.rsc +16 -0
  27. package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -0
  28. package/.next/server/app/_not-found.segments/_head.segment.rsc +6 -0
  29. package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -0
  30. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -0
  31. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +5 -0
  32. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -0
  33. package/.next/server/app/api/context/aider/route.js +1 -1
  34. package/.next/server/app/api/context/aider/route.js.nft.json +1 -1
  35. package/.next/server/app/api/context/claude/route.js +1 -1
  36. package/.next/server/app/api/context/claude/route.js.nft.json +1 -1
  37. package/.next/server/app/api/context/ssh/route.js +1 -1
  38. package/.next/server/app/api/context/ssh/route.js.nft.json +1 -1
  39. package/.next/server/app/api/recents/route.js +1 -1
  40. package/.next/server/app/api/recents/route.js.nft.json +1 -1
  41. package/.next/server/app/api/sessions/inject/route.js +1 -1
  42. package/.next/server/app/api/sessions/inject/route.js.nft.json +1 -1
  43. package/.next/server/app/api/sessions/input/route.js +1 -1
  44. package/.next/server/app/api/sessions/input/route.js.nft.json +1 -1
  45. package/.next/server/app/api/sessions/launch/route.js +1 -1
  46. package/.next/server/app/api/sessions/launch/route.js.nft.json +1 -1
  47. package/.next/server/app/api/sessions/route.js +1 -1
  48. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  49. package/.next/server/app/api/sessions/scope/route.js +1 -1
  50. package/.next/server/app/api/sessions/scope/route.js.nft.json +1 -1
  51. package/.next/server/app/api/sessions/start/route.js +1 -1
  52. package/.next/server/app/api/sessions/start/route.js.nft.json +1 -1
  53. package/.next/server/app/api/sessions/stats/route.js +1 -1
  54. package/.next/server/app/api/sessions/stats/route.js.nft.json +1 -1
  55. package/.next/server/app/api/sessions/stop/route.js +1 -1
  56. package/.next/server/app/api/sessions/stop/route.js.nft.json +1 -1
  57. package/.next/server/app/index.html +1 -0
  58. package/.next/server/app/index.meta +14 -0
  59. package/.next/server/app/index.rsc +21 -0
  60. package/.next/server/app/index.segments/__PAGE__.segment.rsc +10 -0
  61. package/.next/server/app/index.segments/_full.segment.rsc +21 -0
  62. package/.next/server/app/index.segments/_head.segment.rsc +6 -0
  63. package/.next/server/app/index.segments/_index.segment.rsc +5 -0
  64. package/.next/server/app/index.segments/_tree.segment.rsc +5 -0
  65. package/.next/server/chunks/[root-of-the-server]__01.zh3b._.js +15 -0
  66. package/.next/server/chunks/[root-of-the-server]__01.zh3b._.js.map +1 -0
  67. package/.next/server/chunks/[root-of-the-server]__07zx04e._.js +15 -0
  68. package/.next/server/chunks/[root-of-the-server]__07zx04e._.js.map +1 -0
  69. package/.next/server/chunks/[root-of-the-server]__0_o7_jj._.js +15 -0
  70. package/.next/server/chunks/[root-of-the-server]__0_o7_jj._.js.map +1 -0
  71. package/.next/server/chunks/[root-of-the-server]__0d0pykb._.js +7 -7
  72. package/.next/server/chunks/[root-of-the-server]__0d0pykb._.js.map +1 -1
  73. package/.next/server/chunks/[root-of-the-server]__0em6a~~._.js +15 -0
  74. package/.next/server/chunks/[root-of-the-server]__0em6a~~._.js.map +1 -0
  75. package/.next/server/chunks/[root-of-the-server]__0gchnwb._.js +3 -0
  76. package/.next/server/chunks/[root-of-the-server]__0gchnwb._.js.map +1 -0
  77. package/.next/server/chunks/[root-of-the-server]__0i~01cv._.js +15 -0
  78. package/.next/server/chunks/[root-of-the-server]__0i~01cv._.js.map +1 -0
  79. package/.next/server/chunks/[root-of-the-server]__0s0is_9._.js +15 -0
  80. package/.next/server/chunks/[root-of-the-server]__0s0is_9._.js.map +1 -0
  81. package/.next/server/chunks/[root-of-the-server]__0t713sv._.js +3 -0
  82. package/.next/server/chunks/[root-of-the-server]__0t713sv._.js.map +1 -0
  83. package/.next/server/chunks/[root-of-the-server]__0thsozo._.js +15 -0
  84. package/.next/server/chunks/[root-of-the-server]__0thsozo._.js.map +1 -0
  85. package/.next/server/chunks/[root-of-the-server]__10wwca8._.js +15 -0
  86. package/.next/server/chunks/[root-of-the-server]__10wwca8._.js.map +1 -0
  87. package/.next/server/chunks/[root-of-the-server]__11h_nxt._.js +3 -0
  88. package/.next/server/chunks/[root-of-the-server]__11h_nxt._.js.map +1 -0
  89. package/.next/server/chunks/[root-of-the-server]__11z12oe._.js +3 -0
  90. package/.next/server/chunks/[root-of-the-server]__11z12oe._.js.map +1 -0
  91. package/.next/server/functions-config-manifest.json +4 -0
  92. package/.next/server/middleware-build-manifest.js +3 -3
  93. package/.next/server/pages/404.html +1 -0
  94. package/.next/server/pages/500.html +1 -0
  95. package/.next/server/pages-manifest.json +4 -1
  96. package/.next/server/prefetch-hints.json +1 -0
  97. package/.next/server/server-reference-manifest.js +1 -1
  98. package/.next/server/server-reference-manifest.json +1 -1
  99. package/.next/static/xqFiJPAmHsNHappCgW2Ov/_ssgManifest.js +1 -0
  100. package/.next/trace +1 -0
  101. package/.next/trace-build +1 -0
  102. package/package.json +1 -1
  103. package/src/app/api/context/aider/route.ts +3 -1
  104. package/src/app/api/context/claude/route.ts +3 -1
  105. package/src/app/api/context/ssh/route.ts +3 -1
  106. package/src/app/api/sessions/scope/route.ts +3 -2
  107. package/src/lib/agents/AiderRunner.ts +2 -1
  108. package/src/lib/agents/ClaudeRunner.ts +3 -2
  109. package/src/lib/agents/DockerRunner.ts +2 -1
  110. package/src/lib/agents/SSHRunner.ts +3 -2
  111. package/src/lib/config.ts +32 -0
  112. package/src/lib/recents.ts +2 -1
  113. package/.next/server/chunks/[root-of-the-server]__005xmeg._.js +0 -15
  114. package/.next/server/chunks/[root-of-the-server]__005xmeg._.js.map +0 -1
  115. package/.next/server/chunks/[root-of-the-server]__0969ozy._.js +0 -3
  116. package/.next/server/chunks/[root-of-the-server]__0969ozy._.js.map +0 -1
  117. package/.next/server/chunks/[root-of-the-server]__0_~zjnf._.js +0 -15
  118. package/.next/server/chunks/[root-of-the-server]__0_~zjnf._.js.map +0 -1
  119. package/.next/server/chunks/[root-of-the-server]__0hl8jxx._.js +0 -15
  120. package/.next/server/chunks/[root-of-the-server]__0hl8jxx._.js.map +0 -1
  121. package/.next/server/chunks/[root-of-the-server]__0ho7s6e._.js +0 -15
  122. package/.next/server/chunks/[root-of-the-server]__0ho7s6e._.js.map +0 -1
  123. package/.next/server/chunks/[root-of-the-server]__0lh_jn-._.js +0 -15
  124. package/.next/server/chunks/[root-of-the-server]__0lh_jn-._.js.map +0 -1
  125. package/.next/server/chunks/[root-of-the-server]__0mq3k0u._.js +0 -15
  126. package/.next/server/chunks/[root-of-the-server]__0mq3k0u._.js.map +0 -1
  127. package/.next/server/chunks/[root-of-the-server]__0n-zban._.js +0 -3
  128. package/.next/server/chunks/[root-of-the-server]__0n-zban._.js.map +0 -1
  129. package/.next/server/chunks/[root-of-the-server]__0rr36fm._.js +0 -15
  130. package/.next/server/chunks/[root-of-the-server]__0rr36fm._.js.map +0 -1
  131. package/.next/server/chunks/[root-of-the-server]__0sa_gpm._.js +0 -3
  132. package/.next/server/chunks/[root-of-the-server]__0sa_gpm._.js.map +0 -1
  133. package/.next/server/chunks/[root-of-the-server]__0vp8-ka._.js +0 -3
  134. package/.next/server/chunks/[root-of-the-server]__0vp8-ka._.js.map +0 -1
  135. package/.next/server/chunks/[root-of-the-server]__0xcrc-1._.js +0 -15
  136. package/.next/server/chunks/[root-of-the-server]__0xcrc-1._.js.map +0 -1
  137. package/.next/static/ZtSBLhTiGqKpNetcymWiC/_ssgManifest.js +0 -1
  138. /package/.next/static/{ZtSBLhTiGqKpNetcymWiC → xqFiJPAmHsNHappCgW2Ov}/_buildManifest.js +0 -0
  139. /package/.next/static/{ZtSBLhTiGqKpNetcymWiC → xqFiJPAmHsNHappCgW2Ov}/_clientMiddlewareManifest.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/config.ts","../../../src/lib/workspaceParser.ts","../../../src/lib/agents/ContextManager.ts","turbopack:///package.json","../../../src/app/api/sessions/route.ts","../../../node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport os from \"os\";\n\nexport function getConfigDir(): string {\n const primaryDir = path.join(process.env.ORIGINAL_CWD || process.cwd(), \".ai\", \"neural-loom\");\n \n try {\n // Check if primary directory exists. If not, try to create it.\n if (!fs.existsSync(primaryDir)) {\n fs.mkdirSync(primaryDir, { recursive: true });\n }\n // Perform a test write to verify write permissions (crucial for read-only directories like C:\\Program Files)\n const testFile = path.join(primaryDir, \".write-test-\" + Math.random().toString(36).substring(7));\n fs.writeFileSync(testFile, \"test\");\n fs.unlinkSync(testFile);\n return primaryDir;\n } catch (err) {\n // If EPERM or any other write error occurs, fall back to the user's home directory\n console.warn(`[Config] Primary config dir is not writable (${primaryDir}). Falling back to home directory.`, err);\n const fallbackDir = path.join(os.homedir(), \".ai\", \"neural-loom\");\n try {\n if (!fs.existsSync(fallbackDir)) {\n fs.mkdirSync(fallbackDir, { recursive: true });\n }\n return fallbackDir;\n } catch (fallbackErr) {\n console.error(\"[Config] Fallback config dir is also not writable!\", fallbackErr);\n return primaryDir;\n }\n }\n}\n","import fs from \"fs\";\nimport path from \"path\";\n\nexport function getWorkspaceFileFolders(workspaceRoot: string): string[] {\n try {\n if (!workspaceRoot || !fs.existsSync(workspaceRoot)) return [];\n \n // Normalize workspaceRoot path\n const normRoot = path.resolve(workspaceRoot).replace(/\\\\/g, \"/\");\n \n const files = fs.readdirSync(normRoot);\n const workspaceFile = files.find(f => f.endsWith(\".code-workspace\"));\n if (!workspaceFile) return [];\n\n const filePath = path.join(normRoot, workspaceFile);\n const content = fs.readFileSync(filePath, \"utf8\");\n const json = JSON.parse(content);\n \n if (!json.folders || !Array.isArray(json.folders)) return [];\n \n const folders: string[] = [];\n for (const folder of json.folders) {\n if (folder.path) {\n // Resolve relative to workspace root (where the workspace file resides)\n const resolved = path.resolve(normRoot, folder.path).replace(/\\\\/g, \"/\");\n \n // Exclude the workspace root folder itself\n if (resolved !== normRoot) {\n if (fs.existsSync(resolved)) {\n folders.push(resolved);\n }\n }\n }\n }\n return folders;\n } catch (err) {\n console.error(\"[WorkspaceParser] Failed to parse code-workspace file:\", err);\n return [];\n }\n}\n","import fs from \"fs\";\nimport path from \"path\";\n\nexport class ContextManager {\n private static get workspaceRoot(): string {\n return process.env.ORIGINAL_CWD || process.cwd();\n }\n\n private static ensureDirs(root: string) {\n const aiDir = path.join(root, \".ai\", \"neural-loom\");\n if (!fs.existsSync(aiDir)) {\n fs.mkdirSync(aiDir, { recursive: true });\n }\n\n const commandDir = path.join(root, \".claude\", \"commands\");\n if (!fs.existsSync(commandDir)) {\n fs.mkdirSync(commandDir, { recursive: true });\n }\n }\n\n public static initializeStaging(root: string = process.env.ORIGINAL_CWD || process.cwd()) {\n this.ensureDirs(root);\n\n // Create /ccp.md custom slash command file\n const ccpPath = path.join(root, \".claude\", \"commands\", \"ccp.md\");\n if (!fs.existsSync(ccpPath)) {\n fs.writeFileSync(\n ccpPath,\n \"Read the prompt from .ai/neural-loom/cprompt.md and execute it. This is a staged prompt from the NeuralLoom UI. Treat the contents as user instructions.\\n\"\n );\n }\n\n // Create /ccc.md custom slash command file\n const cccPath = path.join(root, \".claude\", \"commands\", \"ccc.md\");\n if (!fs.existsSync(cccPath)) {\n fs.writeFileSync(\n cccPath,\n \"Read the context from .ai/neural-loom/ccontext.md. This is persistent context from the NeuralLoom UI. Absorb it as background information for this session. Acknowledge briefly what you received.\\n\"\n );\n }\n }\n\n public static updatePrompt(promptText: string, root: string = process.env.ORIGINAL_CWD || process.cwd()) {\n this.ensureDirs(root);\n const promptFile = path.join(root, \".ai\", \"neural-loom\", \"cprompt.md\");\n fs.writeFileSync(promptFile, promptText);\n }\n\n public static updateContext(contextText: string, root: string = process.env.ORIGINAL_CWD || process.cwd()) {\n this.ensureDirs(root);\n const contextFile = path.join(root, \".ai\", \"neural-loom\", \"ccontext.md\");\n fs.writeFileSync(contextFile, contextText);\n }\n\n public static updateRules(rulesText: string, root: string = process.env.ORIGINAL_CWD || process.cwd()) {\n this.ensureDirs(root);\n const agentsMdPath = path.join(root, \"AGENTS.md\");\n fs.writeFileSync(agentsMdPath, rulesText, \"utf8\");\n }\n\n public static loadPrompt(root: string = process.env.ORIGINAL_CWD || process.cwd()): string {\n const promptFile = path.join(root, \".ai\", \"neural-loom\", \"cprompt.md\");\n return fs.existsSync(promptFile) ? fs.readFileSync(promptFile, \"utf8\") : \"\";\n }\n\n public static loadRules(root: string = process.env.ORIGINAL_CWD || process.cwd()): string {\n const agentsMdPath = path.join(root, \"AGENTS.md\");\n return fs.existsSync(agentsMdPath) ? fs.readFileSync(agentsMdPath, \"utf8\") : \"\";\n }\n\n public static compileGlobalRules() {\n this.compileSessionContext();\n }\n\n public static compileSessionContext(root: string = process.env.ORIGINAL_CWD || process.cwd(), scopedDirs?: string[]) {\n this.ensureDirs(root);\n this.initializeStaging(root);\n \n // Check if AGENTS.md rules template exists\n const agentsMdPath = path.join(root, \"AGENTS.md\");\n let agentsRules = \"\";\n if (fs.existsSync(agentsMdPath)) {\n agentsRules = fs.readFileSync(agentsMdPath, \"utf8\");\n } else {\n // Try fallback from global\n const fallbackPath = path.join(this.workspaceRoot, \"AGENTS.md\");\n if (fs.existsSync(fallbackPath)) {\n agentsRules = fs.readFileSync(fallbackPath, \"utf8\");\n }\n }\n\n // Generate maps\n let maps = `## Workspace Root Map (${root}):\\n${this.generateProjectMapFor(root)}`;\n\n if (scopedDirs && Array.isArray(scopedDirs)) {\n scopedDirs.forEach((dir) => {\n if (fs.existsSync(dir)) {\n maps += `\\n\\n## Scoped Directory Map (${dir}):\\n${this.generateProjectMapFor(dir)}`;\n }\n });\n }\n\n // Combine rules and folder map\n const compiledContext = `# System Rules & Guidelines\\n\\n${agentsRules}\\n\\n# Project File Hierarchy Map\\n\\n${maps}`;\n this.updateContext(compiledContext, root);\n\n // Write a default empty prompt staging file if missing\n const promptFile = path.join(root, \".ai\", \"neural-loom\", \"cprompt.md\");\n if (!fs.existsSync(promptFile)) {\n fs.writeFileSync(promptFile, \"Hello! Please review the project context (/ccc) and check for any tasks to execute.\");\n }\n }\n\n private static generateProjectMapFor(targetDir: string): string {\n try {\n const walk = (dir: string, depth = 0): string => {\n if (depth > 2) return \"\"; // Keep map depth concise to fit tokens\n let result = \"\";\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (\n file.name.startsWith(\".\") ||\n file.name === \"node_modules\" ||\n file.name === \"out\" ||\n file.name === \".next\"\n ) {\n continue;\n }\n const indent = \" \".repeat(depth);\n if (file.isDirectory()) {\n result += `${indent}- [Dir] ${file.name}/\\n`;\n result += walk(path.join(dir, file.name), depth + 1);\n } else {\n result += `${indent}- [File] ${file.name}\\n`;\n }\n }\n return result;\n };\n return walk(targetDir);\n } catch (err) {\n return \"Error generating project map: \" + (err instanceof Error ? err.message : String(err));\n }\n }\n}\n","{\"name\":\"neural-loom\",\"version\":\"0.2.43\",\"bin\":{\"neural-loom\":\"./bin/cli.js\"},\"files\":[\"bin\",\"public\",\".next\",\"src\",\"next.config.ts\",\"tsconfig.json\",\"README.md\"],\"scripts\":{\"dev\":\"next dev\",\"build\":\"next build\",\"start\":\"next start\",\"lint\":\"eslint\"},\"dependencies\":{\"next\":\"16.2.6\",\"node-pty\":\"^1.1.0\",\"react\":\"19.2.4\",\"react-dom\":\"19.2.4\",\"ws\":\"^8.21.0\",\"xterm\":\"^5.3.0\",\"xterm-addon-fit\":\"^0.8.0\"},\"devDependencies\":{\"@types/node\":\"^20\",\"@types/react\":\"^19\",\"@types/react-dom\":\"^19\",\"@types/ws\":\"^8.18.1\",\"eslint\":\"^9\",\"eslint-config-next\":\"16.2.6\",\"typescript\":\"^5\"}}","import { NextResponse } from \"next/server\";\nimport { SessionManager } from \"@/lib/agents/SessionManager\";\nimport pkg from \"../../../../package.json\";\n\ndeclare global {\n var wsPort: number | undefined;\n}\n\nexport async function GET(request: Request) {\n try {\n const { searchParams } = new URL(request.url);\n const id = searchParams.get(\"id\");\n const manager = SessionManager.getInstance();\n\n if (id) {\n const session = manager.getSession(id);\n if (!session) {\n return NextResponse.json({ error: \"Session not found\" }, { status: 404 });\n }\n return NextResponse.json({\n ...session.getStatus(),\n logs: session.logs,\n wsPort: global.wsPort || 3001,\n version: pkg.version,\n });\n }\n\n const sessions = manager.listSessions();\n const originalCwd = process.env.ORIGINAL_CWD || process.cwd();\n const wsPort = global.wsPort || 3001;\n return NextResponse.json({ sessions, originalCwd, wsPort, version: pkg.version });\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error\";\n return NextResponse.json({ error: errorMessage }, { status: 500 });\n }\n}\n\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { addRequestMeta, getRequestMeta, setRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { setManifestsSingleton } from \"next/dist/esm/server/app-render/manifests-singleton\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/sessions/route\",\n pathname: \"/api/sessions\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/src/app/api/sessions/route.ts\",\n nextConfigOutput,\n // The static import is used for initialization (methods, dynamic, etc.).\n userland: userland,\n // In Turbopack dev mode, also provide a getter that calls require() on every\n // request. This re-reads from devModuleCache so HMR updates are picked up,\n // and the async wrapper unwraps async-module Promises (ESM-only\n // serverExternalPackages) automatically.\n ...process.env.TURBOPACK && process.env.__NEXT_DEV_SERVER ? {\n getUserland: ()=>import(\"INNER_APP_ROUTE\")\n } : {}\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n if (ctx.requestMeta) {\n setRequestMeta(req, ctx.requestMeta);\n }\n if (routeModule.isDev) {\n addRequestMeta(req, 'devRequestTimingInternalsEnd', process.hrtime.bigint());\n }\n let srcPage = \"/api/sessions/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, deploymentId, params, nextConfig, parsedUrl, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname, clientReferenceManifest, serverActionsManifest } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n const render404 = async ()=>{\n // TODO: should route-module itself handle rendering the 404\n if (routerServerContext == null ? void 0 : routerServerContext.render404) {\n await routerServerContext.render404(req, res, parsedUrl, false);\n } else {\n res.end('This page could not be found');\n }\n return null;\n };\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n if (nextConfig.adapterPath) {\n return await render404();\n }\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isStaticGeneration = isIsr && !supportsDynamicResponse;\n // Before rendering (which initializes component tree modules), we have to\n // set the reference manifests to our global store so Server Action's\n // encryption util can access to them at the top level of the page module.\n if (serverActionsManifest && clientReferenceManifest) {\n setManifestsSingleton({\n page: srcPage,\n clientReferenceManifest,\n serverActionsManifest\n });\n }\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const isWrappedByNextServer = Boolean(routerServerContext == null ? void 0 : routerServerContext.isWrappedByNextServer);\n const isMinimalMode = Boolean(getRequestMeta(req, 'minimalMode'));\n const incrementalCache = getRequestMeta(req, 'incrementalCache') || await routeModule.getIncrementalCache(req, nextConfig, prerenderManifest, isMinimalMode);\n incrementalCache == null ? void 0 : incrementalCache.resetRequestCache();\n globalThis.__incrementalCache = incrementalCache;\n const context = {\n params,\n previewProps: prerenderManifest.preview,\n renderOpts: {\n experimental: {\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n cacheComponents: Boolean(nextConfig.cacheComponents),\n supportsDynamicResponse,\n incrementalCache,\n cacheLifeProfiles: nextConfig.cacheLife,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext, silenceLog)=>routeModule.onRequestError(req, error, errorContext, silenceLog, routerServerContext)\n },\n sharedContext: {\n buildId,\n deploymentId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n let parentSpan;\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n // Propagate http.route to the parent span if one exists (e.g.\n // a platform-created HTTP span in adapter deployments).\n if (parentSpan && parentSpan !== span) {\n parentSpan.setAttribute('http.route', route);\n parentSpan.updateName(name);\n }\n } else {\n span.updateName(`${method} ${srcPage}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!isMinimalMode && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil,\n isMinimalMode\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!isMinimalMode) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(isMinimalMode && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, // @ts-expect-error - Argument of type 'Buffer<ArrayBufferLike>' is not assignable to parameter of type 'BodyInit | null | undefined'.\n new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (isWrappedByNextServer && activeSpan) {\n await handleResponse(activeSpan);\n } else {\n parentSpan = tracer.getActiveScopeSpan();\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${srcPage}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse), undefined, !isWrappedByNextServer);\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n const silenceLog = false;\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isStaticGeneration,\n isOnDemandRevalidate\n })\n }, silenceLog, routerServerContext);\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":["getConfigDir","primaryDir","join","process","env","ORIGINAL_CWD","cwd","existsSync","mkdirSync","recursive","testFile","Math","random","toString","substring","writeFileSync","unlinkSync","err","console","warn","fallbackDir","homedir","fallbackErr","error","getWorkspaceFileFolders","workspaceRoot","normRoot","resolve","replace","files","readdirSync","workspaceFile","find","f","endsWith","filePath","content","readFileSync","json","JSON","parse","folders","Array","isArray","folder","path","resolved","push","ContextManager","ensureDirs","root","aiDir","commandDir","initializeStaging","ccpPath","cccPath","updatePrompt","promptText","promptFile","updateContext","contextText","contextFile","updateRules","rulesText","agentsMdPath","loadPrompt","loadRules","compileGlobalRules","compileSessionContext","scopedDirs","agentsRules","fallbackPath","maps","generateProjectMapFor","forEach","dir","compiledContext","targetDir","walk","depth","result","withFileTypes","file","name","startsWith","indent","repeat","isDirectory","Error","message","String","GET","request","searchParams","URL","url","id","get","manager","getInstance","session","getSession","status","getStatus","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,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,GAAyB,EACzB,MAAM,EAAe,EADgB,EAGrC,EAAa,EAAO,kBAAkB,GACtC,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAA,CAAS,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,QAAiB,EAAW,CAAC,GAE5C,CAAE,MAAO,EAAK,CAeV,GAdM,aAAe,EAAA,eAAe,EAEhC,CAFmC,KAE7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,oBAClC,uBACA,CACJ,EACJ,GAAG,AATgB,EASJ,GAIf,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,mCA5TA,SAAS,EACL,MAAO,CAAA,EAAA,EAAA,UAAA,AAAW,EAAC,kBACf,uBACA,CACJ,EACJ","ignoreList":[5]}
@@ -1,24 +1,24 @@
1
- module.exports=[54799,(e,t,s)=>{t.exports=e.x("crypto",()=>require("crypto"))},27699,(e,t,s)=>{t.exports=e.x("events",()=>require("events"))},24836,(e,t,s)=>{t.exports=e.x("https",()=>require("https"))},21517,(e,t,s)=>{t.exports=e.x("http",()=>require("http"))},4446,(e,t,s)=>{t.exports=e.x("net",()=>require("net"))},55004,(e,t,s)=>{t.exports=e.x("tls",()=>require("tls"))},88947,(e,t,s)=>{t.exports=e.x("stream",()=>require("stream"))},92509,(e,t,s)=>{t.exports=e.x("url",()=>require("url"))},6461,(e,t,s)=>{t.exports=e.x("zlib",()=>require("zlib"))},74836,(e,t,s)=>{"use strict";let r=["nodebuffer","arraybuffer","fragments"],i="u">typeof Blob;i&&r.push("blob"),t.exports={BINARY_TYPES:r,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:i,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},97970,(e,t,s)=>{"use strict";let{EMPTY_BUFFER:r}=e.r(74836),i=Buffer[Symbol.species];function o(e,t,s,r,i){for(let o=0;o<i;o++)s[r+o]=e[o]^t[3&o]}function n(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}function a(e){let t;return(a.readOnly=!0,Buffer.isBuffer(e))?e:(e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),a.readOnly=!1),t)}if(t.exports={concat:function(e,t){if(0===e.length)return r;if(1===e.length)return e[0];let s=Buffer.allocUnsafe(t),o=0;for(let t=0;t<e.length;t++){let r=e[t];s.set(r,o),o+=r.length}return o<t?new i(s.buffer,s.byteOffset,o):s},mask:o,toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:a,unmask:n},!process.env.WS_NO_BUFFER_UTIL)try{let e=(()=>{let e=Error("Cannot find module 'bufferutil'");throw e.code="MODULE_NOT_FOUND",e})();t.exports.mask=function(t,s,r,i,n){n<48?o(t,s,r,i,n):e.mask(t,s,r,i,n)},t.exports.unmask=function(t,s){t.length<32?n(t,s):e.unmask(t,s)}}catch(e){}},62048,(e,t,s)=>{"use strict";let r=Symbol("kDone"),i=Symbol("kRun");class o{constructor(e){this[r]=()=>{this.pending--,this[i]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[i]()}[i](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[r])}}}t.exports=o},80295,(e,t,s)=>{"use strict";let r,i=e.r(6461),o=e.r(97970),n=e.r(62048),{kStatusCode:a}=e.r(74836),l=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),h=Symbol("permessage-deflate"),d=Symbol("total-length"),p=Symbol("callback"),u=Symbol("buffers"),f=Symbol("error");class m{constructor(e){this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,r||(r=new n(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[p];this._deflate.close(),this._deflate=null,e&&e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,s=e.find(e=>(!1!==t.serverNoContextTakeover||!e.server_no_context_takeover)&&(!e.server_max_window_bits||!1!==t.serverMaxWindowBits&&("number"!=typeof t.serverMaxWindowBits||!(t.serverMaxWindowBits>e.server_max_window_bits)))&&("number"!=typeof t.clientMaxWindowBits||!!e.client_max_window_bits));if(!s)throw Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:(!0===s.client_max_window_bits||!1===t.clientMaxWindowBits)&&delete s.client_max_window_bits,s}acceptAsClient(e){let t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let s=e[t];if(s.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if("client_no_context_takeover"===t||"server_no_context_takeover"===t){if(!0!==s)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=s})}),e}decompress(e,t,s){r.add(r=>{this._decompress(e,t,(e,t)=>{r(),s(e,t)})})}compress(e,t,s){r.add(r=>{this._compress(e,t,(e,t)=>{r(),s(e,t)})})}_decompress(e,t,s){let r=this._isServer?"client":"server";if(!this._inflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=i.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[h]=this,this._inflate[d]=0,this._inflate[u]=[],this._inflate.on("error",y),this._inflate.on("data",_)}this._inflate[p]=s,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,s(e);return}let i=o.concat(this._inflate[u],this._inflate[d]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[d]=0,this._inflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),s(null,i)})}_compress(e,t,s){let r=this._isServer?"server":"client";if(!this._deflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=i.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[d]=0,this._deflate[u]=[],this._deflate.on("data",g)}this._deflate[p]=s,this._deflate.write(e),this._deflate.flush(i.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=o.concat(this._deflate[u],this._deflate[d]);t&&(e=new l(e.buffer,e.byteOffset,e.length-4)),this._deflate[p]=null,this._deflate[d]=0,this._deflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),s(null,e)})}}function g(e){this[u].push(e),this[d]+=e.length}function _(e){(this[d]+=e.length,this[h]._maxPayload<1||this[d]<=this[h]._maxPayload)?this[u].push(e):(this[f]=RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][a]=1009,this.removeListener("data",_),this.reset())}function y(e){(this[h]._inflate=null,this[f])?this[p](this[f]):(e[a]=1007,this[p](e))}t.exports=m},874,(e,t,s)=>{t.exports=e.x("buffer",()=>require("buffer"))},58739,(e,t,s)=>{"use strict";let{isUtf8:r}=e.r(874),{hasBlob:i}=e.r(74836);function o(e){let t=e.length,s=0;for(;s<t;)if((128&e[s])==0)s++;else if((224&e[s])==192){if(s+1===t||(192&e[s+1])!=128||(254&e[s])==192)return!1;s+=2}else if((240&e[s])==224){if(s+2>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||224===e[s]&&(224&e[s+1])==128||237===e[s]&&(224&e[s+1])==160)return!1;s+=3}else{if((248&e[s])!=240||s+3>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||(192&e[s+3])!=128||240===e[s]&&(240&e[s+1])==128||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}if(t.exports={isBlob:function(e){return i&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:o,tokenChars:[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]},r)t.exports.isValidUTF8=function(e){return e.length<24?o(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=(()=>{let e=Error("Cannot find module 'utf-8-validate'");throw e.code="MODULE_NOT_FOUND",e})();t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch(e){}},29485,(e,t,s)=>{"use strict";let{Writable:r}=e.r(88947),i=e.r(80295),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:l}=e.r(74836),{concat:c,toArrayBuffer:h,unmask:d}=e.r(97970),{isValidStatusCode:p,isValidUTF8:u}=e.r(58739),f=Buffer[Symbol.species],m=0,g=1,_=2,y=3,S=4,b=5,x=6;class v extends r{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=0|e.maxBufferedChunks,this._maxFragments=0|e.maxFragments,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[l]=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=m}_write(e,t,s){return 8===this._opcode&&this._state==m?s():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void s(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new f(t.buffer,t.byteOffset+e,t.length-e),new f(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let s=this._buffers[0],r=t.length-e;e>=s.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),r),this._buffers[0]=new f(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0)return t}startLoop(e){this._loop=!0;do switch(this._state){case m:this.getInfo(e);break;case g:this.getPayloadLength16(e);break;case _:this.getPayloadLength64(e);break;case y:this.getMask();break;case S:this.getData(e);break;case b:case x:this._loop=!1;return}while(this._loop)this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((48&t[0])!=0)return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let s=(64&t[0])==64;if(s&&!this._extensions[i.extensionName])return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&t[0])==128,this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=s}else{if(!(this._opcode>7)||!(this._opcode<11))return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&t[1])==128,this._isServer){if(!this._masked)return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=g:127===this._payloadLength?this._state=_:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),s=t.readUInt32BE(0);s>2097151?e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*s+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=y:this._state=S}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=S}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&d(t,this._mask)}if(this._opcode>7)return void this.controlMessage(t,e);if(this._compressed){this._state=b,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void e(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void t(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void t(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._fragments.push(s)}this.dataMessage(t),this._state===m&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=m;return}let t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?c(s,t):"arraybuffer"===this._binaryType?h(c(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=m):(this._state=x,setImmediate(()=>{this.emit("message",r,!0),this._state=m,this.startLoop(e)}))}else{let r=c(s,t);if(!this._skipUTF8Validation&&!u(r))return void e(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._state===b||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=m):(this._state=x,setImmediate(()=>{this.emit("message",r,!1),this._state=m,this.startLoop(e)}))}}controlMessage(e,t){if(8===this._opcode){if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{let s=e.readUInt16BE(0);if(!p(s))return void t(this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let r=new f(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!u(r))return void t(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=m;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=m):(this._state=x,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=m,this.startLoop(t)}))}createError(e,t,s,r,i){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[a]=r,o}}t.exports=v},16735,(e,t,s)=>{"use strict";let r,{Duplex:i}=e.r(88947),{randomFillSync:o}=e.r(54799),{types:{isUint8Array:n}}=e.r(24361),a=e.r(80295),{EMPTY_BUFFER:l,kWebSocket:c,NOOP:h}=e.r(74836),{isBlob:d,isValidStatusCode:p}=e.r(58739),{mask:u,toBuffer:f}=e.r(97970),m=Symbol("kByteLength"),g=Buffer.alloc(4),_=8192,y=8192,S=0,b=1,x=2;class v{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=S,this.onerror=h,this[c]=void 0}static frame(e,t){let s,i,n=!1,a=2,l=!1;t.mask&&(s=t.maskBuffer||g,t.generateMask?t.generateMask(s):(y===_&&(void 0===r&&(r=Buffer.alloc(_)),o(r,0,_),y=0),s[0]=r[y++],s[1]=r[y++],s[2]=r[y++],s[3]=r[y++]),l=(s[0]|s[1]|s[2]|s[3])==0,a=6),"string"==typeof e?i=(!t.mask||l)&&void 0!==t[m]?t[m]:(e=Buffer.from(e)).length:(i=e.length,n=t.mask&&t.readOnly&&!l);let c=i;i>=65536?(a+=8,c=127):i>125&&(a+=2,c=126);let h=Buffer.allocUnsafe(n?i+a:a);return(h[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(h[0]|=64),h[1]=c,126===c?h.writeUInt16BE(i,2):127===c&&(h[2]=h[3]=0,h.writeUIntBE(i,4,6)),t.mask)?(h[1]|=128,h[a-4]=s[0],h[a-3]=s[1],h[a-2]=s[2],h[a-1]=s[3],l)?[h,e]:n?(u(e,s,h,a,i),[h]):(u(e,s,e,0,i),[h,e]):[h,e]}close(e,t,s,r){let i;if(void 0===e)i=l;else if("number"==typeof e&&p(e))if(void 0!==t&&t.length){let s=Buffer.byteLength(t);if(s>123)throw RangeError("The message must not be greater than 123 bytes");if((i=Buffer.allocUnsafe(2+s)).writeUInt16BE(e,0),"string"==typeof t)i.write(t,2);else if(n(t))i.set(t,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(i=Buffer.allocUnsafe(2)).writeUInt16BE(e,0);else throw TypeError("First argument must be a valid error code number");let o={[m]:i.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==S?this.enqueue([this.dispatch,i,!1,o,r]):this.sendFrame(v.frame(i,o),r)}ping(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):d(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let o={[m]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};d(e)?this._state!==S?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):this._state!==S?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(v.frame(e,o),s)}pong(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):d(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let o={[m]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};d(e)?this._state!==S?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):this._state!==S?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(v.frame(e,o),s)}send(e,t,s){let r,i,o=this._extensions[a.extensionName],n=t.binary?2:1,l=t.compress;"string"==typeof e?(r=Buffer.byteLength(e),i=!1):d(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),this._firstFragment?(this._firstFragment=!1,l&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=r>=o._threshold),this._compress=l):(l=!1,n=0),t.fin&&(this._firstFragment=!0);let c={[m]:r,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:i,rsv1:l};d(e)?this._state!==S?this.enqueue([this.getBlobData,e,this._compress,c,s]):this.getBlobData(e,this._compress,c,s):this._state!==S?this.enqueue([this.dispatch,e,this._compress,c,s]):this.dispatch(e,this._compress,c,s)}getBlobData(e,t,s,r){this._bufferedBytes+=s[m],this._state=x,e.arrayBuffer().then(e=>{if(this._socket.destroyed){let e=Error("The socket was closed while the blob was being read");process.nextTick(k,this,e,r);return}this._bufferedBytes-=s[m];let i=f(e);t?this.dispatch(i,t,s,r):(this._state=S,this.sendFrame(v.frame(i,s),r),this.dequeue())}).catch(e=>{process.nextTick(w,this,e,r)})}dispatch(e,t,s,r){if(!t)return void this.sendFrame(v.frame(e,s),r);let i=this._extensions[a.extensionName];this._bufferedBytes+=s[m],this._state=b,i.compress(e,s.fin,(e,t)=>{this._socket.destroyed?k(this,Error("The socket was closed while data was being compressed"),r):(this._bufferedBytes-=s[m],this._state=S,s.readOnly=!1,this.sendFrame(v.frame(t,s),r),this.dequeue())})}dequeue(){for(;this._state===S&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}function k(e,t,s){"function"==typeof s&&s(t);for(let s=0;s<e._queue.length;s++){let r=e._queue[s],i=r[r.length-1];"function"==typeof i&&i(t)}}function w(e,t,s){k(e,t,s),e.onerror(t)}t.exports=v},70494,(e,t,s)=>{"use strict";let{kForOnEventAttribute:r,kListener:i}=e.r(74836),o=Symbol("kCode"),n=Symbol("kData"),a=Symbol("kError"),l=Symbol("kMessage"),c=Symbol("kReason"),h=Symbol("kTarget"),d=Symbol("kType"),p=Symbol("kWasClean");class u{constructor(e){this[h]=null,this[d]=e}get target(){return this[h]}get type(){return this[d]}}Object.defineProperty(u.prototype,"target",{enumerable:!0}),Object.defineProperty(u.prototype,"type",{enumerable:!0});class f extends u{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[c]=void 0===t.reason?"":t.reason,this[p]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[c]}get wasClean(){return this[p]}}Object.defineProperty(f.prototype,"code",{enumerable:!0}),Object.defineProperty(f.prototype,"reason",{enumerable:!0}),Object.defineProperty(f.prototype,"wasClean",{enumerable:!0});class m extends u{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[l]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[l]}}Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});class g extends u{constructor(e,t={}){super(e),this[n]=void 0===t.data?null:t.data}get data(){return this[n]}}Object.defineProperty(g.prototype,"data",{enumerable:!0});let _={addEventListener(e,t,s={}){let o;for(let o of this.listeners(e))if(!s[r]&&o[i]===t&&!o[r])return;if("message"===e)o=function(e,s){let r=new g("message",{data:s?e:e.toString()});r[h]=this,y(t,this,r)};else if("close"===e)o=function(e,s){let r=new f("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[h]=this,y(t,this,r)};else if("error"===e)o=function(e){let s=new m("error",{error:e,message:e.message});s[h]=this,y(t,this,s)};else{if("open"!==e)return;o=function(){let e=new u("open");e[h]=this,y(t,this,e)}}o[r]=!!s[r],o[i]=t,s.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let s of this.listeners(e))if(s[i]===t&&!s[r]){this.removeListener(e,s);break}}};function y(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}t.exports={CloseEvent:f,ErrorEvent:m,Event:u,EventTarget:_,MessageEvent:g}},96903,(e,t,s)=>{"use strict";let{tokenChars:r}=e.r(58739);function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}t.exports={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){let t,s,o=Object.create(null),n=Object.create(null),a=!1,l=!1,c=!1,h=-1,d=-1,p=-1,u=0;for(;u<e.length;u++)if(d=e.charCodeAt(u),void 0===t)if(-1===p&&1===r[d])-1===h&&(h=u);else if(0!==u&&(32===d||9===d))-1===p&&-1!==h&&(p=u);else if(59===d||44===d){if(-1===h)throw SyntaxError(`Unexpected character at index ${u}`);-1===p&&(p=u);let s=e.slice(h,p);44===d?(i(o,s,n),n=Object.create(null)):t=s,h=p=-1}else throw SyntaxError(`Unexpected character at index ${u}`);else if(void 0===s)if(-1===p&&1===r[d])-1===h&&(h=u);else if(32===d||9===d)-1===p&&-1!==h&&(p=u);else if(59===d||44===d){if(-1===h)throw SyntaxError(`Unexpected character at index ${u}`);-1===p&&(p=u),i(n,e.slice(h,p),!0),44===d&&(i(o,t,n),n=Object.create(null),t=void 0),h=p=-1}else if(61===d&&-1!==h&&-1===p)s=e.slice(h,u),h=p=-1;else throw SyntaxError(`Unexpected character at index ${u}`);else if(l){if(1!==r[d])throw SyntaxError(`Unexpected character at index ${u}`);-1===h?h=u:a||(a=!0),l=!1}else if(c)if(1===r[d])-1===h&&(h=u);else if(34===d&&-1!==h)c=!1,p=u;else if(92===d)l=!0;else throw SyntaxError(`Unexpected character at index ${u}`);else if(34===d&&61===e.charCodeAt(u-1))c=!0;else if(-1===p&&1===r[d])-1===h&&(h=u);else if(-1!==h&&(32===d||9===d))-1===p&&(p=u);else if(59===d||44===d){if(-1===h)throw SyntaxError(`Unexpected character at index ${u}`);-1===p&&(p=u);let r=e.slice(h,p);a&&(r=r.replace(/\\/g,""),a=!1),i(n,s,r),44===d&&(i(o,t,n),n=Object.create(null),t=void 0),s=void 0,h=p=-1}else throw SyntaxError(`Unexpected character at index ${u}`);if(-1===h||c||32===d||9===d)throw SyntaxError("Unexpected end of input");-1===p&&(p=u);let f=e.slice(h,p);return void 0===t?i(o,f,n):(void 0===s?i(n,f,!0):a?i(n,s,f.replace(/\\/g,"")):i(n,s,f),i(o,t,n)),o}}},35065,(e,t,s)=>{"use strict";let r=e.r(27699),i=e.r(24836),o=e.r(21517),n=e.r(4446),a=e.r(55004),{randomBytes:l,createHash:c}=e.r(54799),{Duplex:h,Readable:d}=e.r(88947),{URL:p}=e.r(92509),u=e.r(80295),f=e.r(29485),m=e.r(16735),{isBlob:g}=e.r(58739),{BINARY_TYPES:_,CLOSE_TIMEOUT:y,EMPTY_BUFFER:S,GUID:b,kForOnEventAttribute:x,kListener:v,kStatusCode:k,kWebSocket:w,NOOP:E}=e.r(74836),{EventTarget:{addEventListener:L,removeEventListener:P}}=e.r(70494),{format:O,parse:C}=e.r(96903),{toBuffer:T}=e.r(97970),A=Symbol("kAborted"),R=[8,13],N=["CONNECTING","OPEN","CLOSING","CLOSED"],I=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class D extends r{constructor(e,t,s){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=S,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=D.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),M(this,e,t,s)):(this._autoPong=s.autoPong,this._closeTimeout=s.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}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(e,t,s){let r=new f({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),i=new m(e,this._extensions,s.generateMask);this._receiver=r,this._sender=i,this._socket=e,r[w]=this,i[w]=this,e[w]=this,r.on("conclude",j),r.on("drain",G),r.on("error",z),r.on("message",q),r.on("ping",H),r.on("pong",K),i.onerror=J,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Z),e.on("data",Q),e.on("end",ee),e.on("error",et),this._readyState=D.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=D.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=D.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==D.CLOSED){if(this.readyState===D.CONNECTING){let e="WebSocket was closed before the connection was established";$(this,this._req,e);return}if(this.readyState===D.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=D.CLOSING,this._sender.close(e,t,!this._isServer,e=>{!e&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),X(this)}}pause(){this.readyState!==D.CONNECTING&&this.readyState!==D.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===D.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==D.OPEN)?B(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.ping(e||S,t,s))}pong(e,t,s){if(this.readyState===D.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==D.OPEN)?B(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.pong(e||S,t,s))}resume(){this.readyState!==D.CONNECTING&&this.readyState!==D.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===D.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==D.OPEN)return void B(this,e,s);let r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(e||S,r,s)}terminate(){if(this.readyState!==D.CLOSED){if(this.readyState===D.CONNECTING){let e="WebSocket was closed before the connection was established";$(this,this._req,e);return}this._socket&&(this._readyState=D.CLOSING,this._socket.destroy())}}}function M(e,t,s,r){let n,a,h,d,f={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:y,protocolVersion:R[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,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=f.autoPong,e._closeTimeout=f.closeTimeout,!R.includes(f.protocolVersion))throw RangeError(`Unsupported protocol version: ${f.protocolVersion} (supported versions: ${R.join(", ")})`);if(t instanceof p)n=t;else try{n=new p(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}"http:"===n.protocol?n.protocol="ws:":"https:"===n.protocol&&(n.protocol="wss:"),e._url=n.href;let m="wss:"===n.protocol,g="ws+unix:"===n.protocol;if("ws:"===n.protocol||m||g?g&&!n.pathname?a="The URL's pathname is empty":n.hash&&(a="The URL contains a fragment identifier"):a='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',a){let t=SyntaxError(a);if(0!==e._redirects)return void U(e,t);throw t}let _=m?443:80,S=l(16).toString("base64"),x=m?i.request:o.request,v=new Set;if(f.createConnection=f.createConnection||(m?W:F),f.defaultPort=f.defaultPort||_,f.port=n.port||_,f.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,f.headers={...f.headers,"Sec-WebSocket-Version":f.protocolVersion,"Sec-WebSocket-Key":S,Connection:"Upgrade",Upgrade:"websocket"},f.path=n.pathname+n.search,f.timeout=f.handshakeTimeout,f.perMessageDeflate&&(h=new u({...f.perMessageDeflate,isServer:!1,maxPayload:f.maxPayload}),f.headers["Sec-WebSocket-Extensions"]=O({[u.extensionName]:h.offer()})),s.length){for(let e of s){if("string"!=typeof e||!I.test(e)||v.has(e))throw SyntaxError("An invalid or duplicated subprotocol was specified");v.add(e)}f.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(f.origin&&(f.protocolVersion<13?f.headers["Sec-WebSocket-Origin"]=f.origin:f.headers.Origin=f.origin),(n.username||n.password)&&(f.auth=`${n.username}:${n.password}`),g){let e=f.path.split(":");f.socketPath=e[0],f.path=e[1]}if(f.followRedirects){if(0===e._redirects){e._originalIpc=g,e._originalSecure=m,e._originalHostOrSocketPath=g?f.socketPath:n.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,s]of Object.entries(t))r.headers[e.toLowerCase()]=s}else if(0===e.listenerCount("redirect")){let t=g?!!e._originalIpc&&f.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&n.host===e._originalHostOrSocketPath;t&&(!e._originalSecure||m)||(delete f.headers.authorization,delete f.headers.cookie,t||delete f.headers.host,f.auth=void 0)}f.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(f.auth).toString("base64")),d=e._req=x(f),e._redirects&&e.emit("redirect",e.url,d)}else d=e._req=x(f);f.timeout&&d.on("timeout",()=>{$(e,d,"Opening handshake has timed out")}),d.on("error",t=>{null===d||d[A]||(d=e._req=null,U(e,t))}),d.on("response",i=>{let o=i.headers.location,n=i.statusCode;if(o&&f.followRedirects&&n>=300&&n<400){let i;if(++e._redirects>f.maxRedirects)return void $(e,d,"Maximum redirects exceeded");d.abort();try{i=new p(o,t)}catch(t){U(e,SyntaxError(`Invalid URL: ${o}`));return}M(e,i,s,r)}else e.emit("unexpected-response",d,i)||$(e,d,`Unexpected server response: ${i.statusCode}`)}),d.on("upgrade",(t,s,r)=>{let i;if(e.emit("upgrade",t),e.readyState!==D.CONNECTING)return;d=e._req=null;let o=t.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void $(e,s,"Invalid Upgrade header");let n=c("sha1").update(S+b).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void $(e,s,"Invalid Sec-WebSocket-Accept header");let a=t.headers["sec-websocket-protocol"];if(void 0!==a?v.size?v.has(a)||(i="Server sent an invalid subprotocol"):i="Server sent a subprotocol but none was requested":v.size&&(i="Server sent no subprotocol"),i)return void $(e,s,i);a&&(e._protocol=a);let l=t.headers["sec-websocket-extensions"];if(void 0!==l){let t;if(!h)return void $(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{t=C(l)}catch(t){$(e,s,"Invalid Sec-WebSocket-Extensions header");return}let r=Object.keys(t);if(1!==r.length||r[0]!==u.extensionName)return void $(e,s,"Server indicated an extension that was not requested");try{h.accept(t[u.extensionName])}catch(t){$(e,s,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[u.extensionName]=h}e.setSocket(s,r,{allowSynchronousEvents:f.allowSynchronousEvents,generateMask:f.generateMask,maxBufferedChunks:f.maxBufferedChunks,maxFragments:f.maxFragments,maxPayload:f.maxPayload,skipUTF8Validation:f.skipUTF8Validation})}),f.finishRequest?f.finishRequest(d,e):d.end()}function U(e,t){e._readyState=D.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function F(e){return e.path=e.socketPath,n.connect(e)}function W(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function $(e,t,s){e._readyState=D.CLOSING;let r=Error(s);Error.captureStackTrace(r,$),t.setHeader?(t[A]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(U,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function B(e,t,s){if(t){let s=g(t)?t.size:T(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${N[e.readyState]})`);process.nextTick(s,t)}}function j(e,t){let s=this[w];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[w]&&(s._socket.removeListener("data",Q),process.nextTick(Y,s._socket),1005===e?s.close():s.close(e,t))}function G(){let e=this[w];e.isPaused||e._socket.resume()}function z(e){let t=this[w];void 0!==t._socket[w]&&(t._socket.removeListener("data",Q),process.nextTick(Y,t._socket),t.close(e[k])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function V(){this[w].emitClose()}function q(e,t){this[w].emit("message",e,t)}function H(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,E),t.emit("ping",e)}function K(e){this[w].emit("pong",e)}function Y(e){e.resume()}function J(e){let t=this[w];t.readyState!==D.CLOSED&&(t.readyState===D.OPEN&&(t._readyState=D.CLOSING,X(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function X(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function Z(){let e=this[w];if(this.removeListener("close",Z),this.removeListener("data",Q),this.removeListener("end",ee),e._readyState=D.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&0!==this._readableState.length){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",V),e._receiver.on("finish",V))}function Q(e){this[w]._receiver.write(e)||this.pause()}function ee(){let e=this[w];e._readyState=D.CLOSING,e._receiver.end(),this.end()}function et(){let e=this[w];this.removeListener("error",et),this.on("error",E),e&&(e._readyState=D.CLOSING,this.destroy())}Object.defineProperty(D,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")}),Object.defineProperty(D.prototype,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")}),Object.defineProperty(D,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")}),Object.defineProperty(D.prototype,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")}),Object.defineProperty(D,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")}),Object.defineProperty(D.prototype,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")}),Object.defineProperty(D,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")}),Object.defineProperty(D.prototype,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(D.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(D.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[v];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[x]:!0})}})}),D.prototype.addEventListener=L,D.prototype.removeEventListener=P,t.exports=D},21365,(e,t,s)=>{"use strict";e.r(35065);let{Duplex:r}=e.r(88947);function i(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}t.exports=function(e,t){let s=!0,a=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(t,s){let r=!s&&a._readableState.objectMode?t.toString():t;a.push(r)||e.pause()}),e.once("error",function(e){a.destroyed||(s=!1,a.destroy(e))}),e.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,a);return}let o=!1;e.once("error",function(e){o=!0,r(e)}),e.once("close",function(){o||r(t),process.nextTick(i,a)}),s&&e.terminate()},a._final=function(t){e.readyState===e.CONNECTING?e.once("open",function(){a._final(t)}):null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",function(){t()}),e.close()))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,r){e.readyState===e.CONNECTING?e.once("open",function(){a._write(t,s,r)}):e.send(t,r)},a.on("end",o),a.on("error",n),a}},42977,(e,t,s)=>{"use strict";let{tokenChars:r}=e.r(58739);t.exports={parse:function(e){let t=new Set,s=-1,i=-1,o=0;for(;o<e.length;o++){let n=e.charCodeAt(o);if(-1===i&&1===r[n])-1===s&&(s=o);else if(0!==o&&(32===n||9===n))-1===i&&-1!==s&&(i=o);else if(44===n){if(-1===s)throw SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);let r=e.slice(s,i);if(t.has(r))throw SyntaxError(`The "${r}" subprotocol is duplicated`);t.add(r),s=i=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(-1===s||-1!==i)throw SyntaxError("Unexpected end of input");let n=e.slice(s,o);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},17198,(e,t,s)=>{"use strict";let r=e.r(27699),i=e.r(21517),{Duplex:o}=e.r(88947),{createHash:n}=e.r(54799),a=e.r(96903),l=e.r(80295),c=e.r(42977),h=e.r(35065),{CLOSE_TIMEOUT:d,GUID:p,kWebSocket:u}=e.r(74836),f=/^[+/0-9A-Za-z]{22}==$/,m=0,g=1,_=2;class y extends r{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:h,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer((e,t)=>{let s=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=S(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=m}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===_){e&&this.once("close",()=>{e(Error("The server is not running"))}),process.nextTick(b,this);return}if(e&&this.once("close",e),this._state!==g)if(this._state=g,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(b,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{b(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,r){t.on("error",x);let i=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method)return void k(this,e,t,405,"Invalid HTTP method");if(void 0===o||"websocket"!==o.toLowerCase())return void k(this,e,t,400,"Invalid Upgrade header");if(void 0===i||!f.test(i))return void k(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==n&&8!==n)return void k(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(e))return void v(t,400);let h=e.headers["sec-websocket-protocol"],d=new Set;if(void 0!==h)try{d=c.parse(h)}catch(s){k(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&void 0!==p){let s=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=a.parse(p);e[l.extensionName]&&(s.accept(e[l.extensionName]),u[l.extensionName]=s)}catch(s){k(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let o={origin:e.headers[`${8===n?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,l)=>{if(!o)return v(t,n||401,a,l);this.completeUpgrade(u,i,d,e,t,s,r)});if(!this.options.verifyClient(o))return v(t,401)}this.completeUpgrade(u,i,d,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,c){if(!i.readable||!i.writable)return i.destroy();if(i[u])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>m)return v(i,503);let h=n("sha1").update(t+p).digest("base64"),d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${h}`],f=new this.options.WebSocket(null,void 0,this.options);if(s.size){let e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(d.push(`Sec-WebSocket-Protocol: ${e}`),f._protocol=e)}if(e[l.extensionName]){let t=e[l.extensionName].params,s=a.format({[l.extensionName]:[t]});d.push(`Sec-WebSocket-Extensions: ${s}`),f._extensions=e}this.emit("headers",d,r),i.write(d.concat("\r\n").join("\r\n")),i.removeListener("error",x),f.setSocket(i,o,{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(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&!this.clients.size&&process.nextTick(b,this)})),c(f,r)}}function S(e,t){for(let s of Object.keys(t))e.on(s,t[s]);return function(){for(let s of Object.keys(t))e.removeListener(s,t[s])}}function b(e){e._state=_,e.emit("close")}function x(){this.destroy()}function v(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r
2
- `+Object.keys(r).map(e=>`${e}: ${r[e]}`).join("\r\n")+"\r\n\r\n"+s)}function k(e,t,s,r,i,o){if(e.listenerCount("wsClientError")){let r=Error(i);Error.captureStackTrace(r,k),e.emit("wsClientError",r,s,t)}else v(s,r,i,o)}t.exports=y},29307,10928,__turbopack_context__=>{"use strict";var __TURBOPACK__imported__module__54799__=__turbopack_context__.i(54799);class AgentRunner{workspaceRoot;scopedDirs;lastSyncedWorkspaceFolders;tokenUsage={input:0,output:0,cost:0};parseTokenUsage(e){let t=e.replace(/\x1b\[[0-9;]*m/g,""),s=t.match(/(?:cost|estimated cost)[:\s]*\$([0-9.]+)/i);s&&(this.tokenUsage.cost=parseFloat(s[1]));let r=e=>(e=e.replace(/,/g,"").toLowerCase().trim()).endsWith("k")?1e3*parseFloat(e.slice(0,-1)):e.endsWith("m")?1e6*parseFloat(e.slice(0,-1)):parseInt(e,10)||0,i=/tokens?[:\s]*([0-9,.]+[km]?)\s*(?:sent|input|prompt)[^a-zA-Z0-9]+([0-9,.]+[km]?)\s*(?:received|output|completion)/i,o=t.match(i);if(o)this.tokenUsage.input=r(o[1]),this.tokenUsage.output=r(o[2]);else{let e=t.match(/([0-9,.]+[km]?)\s*(?:sent|input|prompt)\s*tokens?/i)||t.match(/tokens?\s*(?:sent|input|prompt)[:\s]*([0-9,.]+[km]?)/i);e&&(this.tokenUsage.input=r(e[1]));let s=t.match(/([0-9,.]+[km]?)\s*(?:received|output|completion)\s*tokens?/i)||t.match(/tokens?\s*(?:received|output|completion)[:\s]*([0-9,.]+[km]?)/i);s&&(this.tokenUsage.output=r(s[1]))}0===this.tokenUsage.cost&&(this.tokenUsage.input>0||this.tokenUsage.output>0)&&(this.tokenUsage.cost=3e-6*this.tokenUsage.input+15e-6*this.tokenUsage.output)}resize(e,t){}listeners=[];onOutput(e){this.listeners.push(e)}offOutput(e){this.listeners=this.listeners.filter(t=>t!==e)}emitOutput(e){this.listeners.forEach(t=>t(e))}}var __TURBOPACK__imported__module__22734__=__turbopack_context__.i(22734),__TURBOPACK__imported__module__14747__=__turbopack_context__.i(14747);class SessionPersister{static pendingSaves=new Map;static pendingData=new Map;static get workspaceRoot(){return process.env.ORIGINAL_CWD||process.cwd()}static getSessionsDir(){let e=__TURBOPACK__imported__module__14747__.default.join(this.workspaceRoot,".ai","neural-loom","sessions");return __TURBOPACK__imported__module__22734__.default.existsSync(e)||__TURBOPACK__imported__module__22734__.default.mkdirSync(e,{recursive:!0}),e}static saveSession(e,t=!1){let s={id:e.id,name:e.name,type:e.type,status:"running"===e.status&&"mock"===e.type?"running":e.status,createdAt:e.createdAt,logs:e.logs,workspaceRoot:e.workspaceRoot,scopedDirs:e.scopedDirs,lastSyncedWorkspaceFolders:e.lastSyncedWorkspaceFolders};if(t){let t=this.pendingSaves.get(e.id);t&&(clearTimeout(t),this.pendingSaves.delete(e.id)),this.pendingData.delete(e.id),this.writeToDisk(e.id,s);return}if(this.pendingData.set(e.id,s),!this.pendingSaves.has(e.id)){let t=setTimeout(()=>{this.pendingSaves.delete(e.id);let t=this.pendingData.get(e.id);t&&(this.pendingData.delete(e.id),this.writeToDisk(e.id,t))},1e3);this.pendingSaves.set(e.id,t)}}static writeToDisk(e,t){try{let s=this.getSessionsDir(),r=__TURBOPACK__imported__module__14747__.default.join(s,`${e}.json`);__TURBOPACK__imported__module__22734__.default.writeFile(r,JSON.stringify(t,null,2),"utf8",t=>{t&&console.error(`[SessionPersister] Failed to save session ${e} asynchronously:`,t)})}catch(t){console.error(`[SessionPersister] Failed to save session ${e}:`,t)}}static loadAllSessions(){try{let e=this.getSessionsDir(),t=__TURBOPACK__imported__module__22734__.default.readdirSync(e),s=[];for(let r of t)if(r.endsWith(".json")){let t=__TURBOPACK__imported__module__14747__.default.join(e,r),i=__TURBOPACK__imported__module__22734__.default.readFileSync(t,"utf8"),o=JSON.parse(i);"running"===o.status&&"mock"!==o.type&&(o.status="stopped",o.logs.push("\r\n\x1b[1;31m[System] Server restarted. Terminal connection lost.\x1b[0m\r\n"),__TURBOPACK__imported__module__22734__.default.writeFileSync(t,JSON.stringify(o,null,2),"utf8")),s.push(o)}return s}catch(e){return console.error("[SessionPersister] Failed to load sessions:",e),[]}}static cancelPendingSave(e){let t=this.pendingSaves.get(e);t&&(clearTimeout(t),this.pendingSaves.delete(e)),this.pendingData.delete(e)}static deleteSession(e){this.cancelPendingSave(e);try{let t=this.getSessionsDir(),s=__TURBOPACK__imported__module__14747__.default.join(t,`${e}.json`);__TURBOPACK__imported__module__22734__.default.existsSync(s)&&__TURBOPACK__imported__module__22734__.default.unlinkSync(s)}catch(t){console.error(`[SessionPersister] Failed to delete session ${e}:`,t)}}}__turbopack_context__.s(["SessionPersister",0,SessionPersister],10928);class MockRunner extends AgentRunner{id;name;type="mock";status="idle";createdAt;logs=[];intervalId=null;mockSteps=["[NeuralLoom] Loading virtual PTY context...","[NeuralLoom] Spawning sandbox mock runtime environment...","[Mock Agent] Model online (v2.0-mock-flash). Dedicated memory allocated.","[Mock Agent] System rules parsed successfully from global context registry.","[Mock Agent] Awaiting developer commands. Type '/help' to list mock skills."];stepIndex=0;constructor(e,t){super(),this.id=e,this.name=t||`Mock Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.parseTokenUsage(e),this.emitOutput(e+"\r\n"),SessionPersister.saveSession(this)}async start(){"running"!==this.status&&(this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m"),this.appendLog("\x1b[1;36m NEURALLOOM SIMULATED AGENT ENVIRONMENT \x1b[0m"),this.appendLog("\x1b[1;35m==================================================\x1b[0m"),this.stepIndex<this.mockSteps.length&&this.appendLog(this.mockSteps[this.stepIndex++]),this.intervalId=setInterval(()=>{if(this.tokenUsage.input+=Math.floor(50*Math.random())+10,this.tokenUsage.output+=Math.floor(20*Math.random())+5,this.tokenUsage.cost=3e-6*this.tokenUsage.input+15e-6*this.tokenUsage.output,this.stepIndex<this.mockSteps.length)this.appendLog(this.mockSteps[this.stepIndex++]);else{let e=new Date().toLocaleTimeString();this.appendLog(`[${e}] [Telemetry] CPU utilization 1.2% | Memory 142MB | Link stable.`)}},4e3))}async stop(){this.status="stopped",this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.appendLog("\x1b[1;31m[System] Process terminated. Connection closed.\x1b[0m")}async sendInput(e,t){"running"!==this.status?this.appendLog(`\x1b[1;31m[Error] Cannot write input: process is ${this.status}.\x1b[0m`):(this.appendLog(`\x1b[1;32m> ${e}\x1b[0m`),setTimeout(()=>{let t=e.trim().toLowerCase();"/help"===t?(this.appendLog("[Mock Agent] Available commands:"),this.appendLog(" /help - List available mock commands."),this.appendLog(" /status - Fetch current agent diagnostic metrics."),this.appendLog(" /context - View loaded staging files."),this.appendLog(" /clear - Flush terminal console buffer.")):"/status"===t?(this.appendLog("[Mock Agent] Diagnostics:"),this.appendLog(" - Connection Type: WebSocket gateway (mock)"),this.appendLog(` - Active Runtime: ${this.id}`),this.appendLog(" - Sandbox State: Healthy (0 warnings)")):"/context"===t?(this.appendLog("[Mock Agent] Loaded Workspace Context Files:"),this.appendLog(" - [Mounted] src/app/globals.css (Modified)"),this.appendLog(" - [Mounted] src/app/page.tsx")):"/clear"===t?(this.logs=[],this.appendLog("\x1b[1;33m[Console Cleared]\x1b[0m")):(this.appendLog(`[Mock Agent] Received command: "${e}". Processing...`),setTimeout(()=>{this.appendLog("[Mock Agent] Done. Task simulated successfully.")},1500))},400))}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__1=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__1=__TURBOPACK__imported__module__14747__,__TURBOPACK__imported__module__46786__=__turbopack_context__.i(46786),__TURBOPACK__imported__module__33405__=__turbopack_context__.i(33405);function isWindows(){return"u">typeof process&&"win32"===process.platform}function findGitBash(){if(!isWindows())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__1.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__1.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__1.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__1.default.existsSync(e))||null}class ClaudeRunner extends AgentRunner{id;name;type="claude";status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t){super(),this.id=e,this.name=t||`Claude Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;let useCmd=isWindows(),shellPath=useCmd?process.env.COMSPEC||"cmd.exe":findGitBash();if(!shellPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Shell not found. Cannot spawn terminal.\x1b[0m\r\n");return}let shellArgs=useCmd?["/c"]:["-c"];try{this.ptyModule||(this.ptyModule=eval("require")("node-pty")),this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("\x1b[1;36m NEURALLOOM ACTIVE CLAUDE TERMINAL ROUTE \x1b[0m\r\n"),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n");let targetCwd=this.workspaceRoot&&__TURBOPACK__imported__module__22734__1.default.existsSync(this.workspaceRoot)?this.workspaceRoot:process.env.ORIGINAL_CWD||process.cwd(),extraFlags="",claudeConfigPath=__TURBOPACK__imported__module__14747__1.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom","claude.json");if(__TURBOPACK__imported__module__22734__1.default.existsSync(claudeConfigPath))try{let config=JSON.parse(__TURBOPACK__imported__module__22734__1.default.readFileSync(claudeConfigPath,"utf8"));config.extraFlags&&(extraFlags=config.extraFlags)}catch(err){console.error("Failed to parse Claude configuration:",err)}let customEnv={...process.env,TERM:"xterm-256color",COLORTERM:"truecolor"};if(isWindows()){let vsNode="C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\VisualStudio\\NodeJs",localNpm=__TURBOPACK__imported__module__14747__1.default.join(__TURBOPACK__imported__module__46786__.default.homedir(),"AppData","Local","npm"),existingPath=process.env.Path||process.env.PATH||"",winPath=[vsNode,localNpm,existingPath].filter(Boolean).join(";");for(let key of Object.keys(customEnv))"path"===key.toLowerCase()&&delete customEnv[key];customEnv.Path=winPath,customEnv.PATH=winPath}let baseCmd="claude";try{let checkCmd=isWindows()?"where.exe claude":"which claude";(0,__TURBOPACK__imported__module__33405__.execSync)(checkCmd,{env:customEnv,stdio:"ignore"})}catch{baseCmd="npx -y @anthropic-ai/claude-code"}let claudeCmd=`${baseCmd} ${extraFlags}`.trim();this.appendLog(`[System] Spawning command: ${claudeCmd}\r
1
+ module.exports=[54799,(e,t,s)=>{t.exports=e.x("crypto",()=>require("crypto"))},27699,(e,t,s)=>{t.exports=e.x("events",()=>require("events"))},24836,(e,t,s)=>{t.exports=e.x("https",()=>require("https"))},21517,(e,t,s)=>{t.exports=e.x("http",()=>require("http"))},4446,(e,t,s)=>{t.exports=e.x("net",()=>require("net"))},55004,(e,t,s)=>{t.exports=e.x("tls",()=>require("tls"))},88947,(e,t,s)=>{t.exports=e.x("stream",()=>require("stream"))},92509,(e,t,s)=>{t.exports=e.x("url",()=>require("url"))},6461,(e,t,s)=>{t.exports=e.x("zlib",()=>require("zlib"))},74836,(e,t,s)=>{"use strict";let r=["nodebuffer","arraybuffer","fragments"],i="u">typeof Blob;i&&r.push("blob"),t.exports={BINARY_TYPES:r,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:i,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}},97970,(e,t,s)=>{"use strict";let{EMPTY_BUFFER:r}=e.r(74836),i=Buffer[Symbol.species];function o(e,t,s,r,i){for(let o=0;o<i;o++)s[r+o]=e[o]^t[3&o]}function n(e,t){for(let s=0;s<e.length;s++)e[s]^=t[3&s]}function a(e){let t;return(a.readOnly=!0,Buffer.isBuffer(e))?e:(e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),a.readOnly=!1),t)}if(t.exports={concat:function(e,t){if(0===e.length)return r;if(1===e.length)return e[0];let s=Buffer.allocUnsafe(t),o=0;for(let t=0;t<e.length;t++){let r=e[t];s.set(r,o),o+=r.length}return o<t?new i(s.buffer,s.byteOffset,o):s},mask:o,toArrayBuffer:function(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)},toBuffer:a,unmask:n},!process.env.WS_NO_BUFFER_UTIL)try{let e=(()=>{let e=Error("Cannot find module 'bufferutil'");throw e.code="MODULE_NOT_FOUND",e})();t.exports.mask=function(t,s,r,i,n){n<48?o(t,s,r,i,n):e.mask(t,s,r,i,n)},t.exports.unmask=function(t,s){t.length<32?n(t,s):e.unmask(t,s)}}catch(e){}},62048,(e,t,s)=>{"use strict";let r=Symbol("kDone"),i=Symbol("kRun");class o{constructor(e){this[r]=()=>{this.pending--,this[i]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[i]()}[i](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[r])}}}t.exports=o},80295,(e,t,s)=>{"use strict";let r,i=e.r(6461),o=e.r(97970),n=e.r(62048),{kStatusCode:a}=e.r(74836),l=Buffer[Symbol.species],h=Buffer.from([0,0,255,255]),c=Symbol("permessage-deflate"),d=Symbol("total-length"),p=Symbol("callback"),u=Symbol("buffers"),f=Symbol("error");class m{constructor(e){this._options=e||{},this._threshold=void 0!==this._options.threshold?this._options.threshold:1024,this._maxPayload=0|this._options.maxPayload,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,r||(r=new n(void 0!==this._options.concurrencyLimit?this._options.concurrencyLimit:10))}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:null==this._options.clientMaxWindowBits&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[p];this._deflate.close(),this._deflate=null,e&&e(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,s=e.find(e=>(!1!==t.serverNoContextTakeover||!e.server_no_context_takeover)&&(!e.server_max_window_bits||!1!==t.serverMaxWindowBits&&("number"!=typeof t.serverMaxWindowBits||!(t.serverMaxWindowBits>e.server_max_window_bits)))&&("number"!=typeof t.clientMaxWindowBits||!!e.client_max_window_bits));if(!s)throw Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(s.server_no_context_takeover=!0),t.clientNoContextTakeover&&(s.client_no_context_takeover=!0),"number"==typeof t.serverMaxWindowBits&&(s.server_max_window_bits=t.serverMaxWindowBits),"number"==typeof t.clientMaxWindowBits?s.client_max_window_bits=t.clientMaxWindowBits:(!0===s.client_max_window_bits||!1===t.clientMaxWindowBits)&&delete s.client_max_window_bits,s}acceptAsClient(e){let t=e[0];if(!1===this._options.clientNoContextTakeover&&t.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(t.client_max_window_bits){if(!1===this._options.clientMaxWindowBits||"number"==typeof this._options.clientMaxWindowBits&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"')}else"number"==typeof this._options.clientMaxWindowBits&&(t.client_max_window_bits=this._options.clientMaxWindowBits);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let s=e[t];if(s.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(s=s[0],"client_max_window_bits"===t){if(!0!==s){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else if("server_max_window_bits"===t){let e=+s;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${s}`);s=e}else if("client_no_context_takeover"===t||"server_no_context_takeover"===t){if(!0!==s)throw TypeError(`Invalid value for parameter "${t}": ${s}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=s})}),e}decompress(e,t,s){r.add(r=>{this._decompress(e,t,(e,t)=>{r(),s(e,t)})})}compress(e,t,s){r.add(r=>{this._compress(e,t,(e,t)=>{r(),s(e,t)})})}_decompress(e,t,s){let r=this._isServer?"client":"server";if(!this._inflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._inflate=i.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[d]=0,this._inflate[u]=[],this._inflate.on("error",y),this._inflate.on("data",_)}this._inflate[p]=s,this._inflate.write(e),t&&this._inflate.write(h),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,s(e);return}let i=o.concat(this._inflate[u],this._inflate[d]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[d]=0,this._inflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._inflate.reset()),s(null,i)})}_compress(e,t,s){let r=this._isServer?"server":"client";if(!this._deflate){let e=`${r}_max_window_bits`,t="number"!=typeof this.params[e]?i.Z_DEFAULT_WINDOWBITS:this.params[e];this._deflate=i.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[d]=0,this._deflate[u]=[],this._deflate.on("data",g)}this._deflate[p]=s,this._deflate.write(e),this._deflate.flush(i.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=o.concat(this._deflate[u],this._deflate[d]);t&&(e=new l(e.buffer,e.byteOffset,e.length-4)),this._deflate[p]=null,this._deflate[d]=0,this._deflate[u]=[],t&&this.params[`${r}_no_context_takeover`]&&this._deflate.reset(),s(null,e)})}}function g(e){this[u].push(e),this[d]+=e.length}function _(e){(this[d]+=e.length,this[c]._maxPayload<1||this[d]<=this[c]._maxPayload)?this[u].push(e):(this[f]=RangeError("Max payload size exceeded"),this[f].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[f][a]=1009,this.removeListener("data",_),this.reset())}function y(e){(this[c]._inflate=null,this[f])?this[p](this[f]):(e[a]=1007,this[p](e))}t.exports=m},874,(e,t,s)=>{t.exports=e.x("buffer",()=>require("buffer"))},58739,(e,t,s)=>{"use strict";let{isUtf8:r}=e.r(874),{hasBlob:i}=e.r(74836);function o(e){let t=e.length,s=0;for(;s<t;)if((128&e[s])==0)s++;else if((224&e[s])==192){if(s+1===t||(192&e[s+1])!=128||(254&e[s])==192)return!1;s+=2}else if((240&e[s])==224){if(s+2>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||224===e[s]&&(224&e[s+1])==128||237===e[s]&&(224&e[s+1])==160)return!1;s+=3}else{if((248&e[s])!=240||s+3>=t||(192&e[s+1])!=128||(192&e[s+2])!=128||(192&e[s+3])!=128||240===e[s]&&(240&e[s+1])==128||244===e[s]&&e[s+1]>143||e[s]>244)return!1;s+=4}return!0}if(t.exports={isBlob:function(e){return i&&"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&("Blob"===e[Symbol.toStringTag]||"File"===e[Symbol.toStringTag])},isValidStatusCode:function(e){return e>=1e3&&e<=1014&&1004!==e&&1005!==e&&1006!==e||e>=3e3&&e<=4999},isValidUTF8:o,tokenChars:[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]},r)t.exports.isValidUTF8=function(e){return e.length<24?o(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=(()=>{let e=Error("Cannot find module 'utf-8-validate'");throw e.code="MODULE_NOT_FOUND",e})();t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch(e){}},29485,(e,t,s)=>{"use strict";let{Writable:r}=e.r(88947),i=e.r(80295),{BINARY_TYPES:o,EMPTY_BUFFER:n,kStatusCode:a,kWebSocket:l}=e.r(74836),{concat:h,toArrayBuffer:c,unmask:d}=e.r(97970),{isValidStatusCode:p,isValidUTF8:u}=e.r(58739),f=Buffer[Symbol.species],m=0,g=1,_=2,y=3,S=4,b=5,x=6;class v extends r{constructor(e={}){super(),this._allowSynchronousEvents=void 0===e.allowSynchronousEvents||e.allowSynchronousEvents,this._binaryType=e.binaryType||o[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=0|e.maxBufferedChunks,this._maxFragments=0|e.maxFragments,this._maxPayload=0|e.maxPayload,this._skipUTF8Validation=!!e.skipUTF8Validation,this[l]=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=m}_write(e,t,s){return 8===this._opcode&&this._state==m?s():this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?void s(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS")):void(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(s))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new f(t.buffer,t.byteOffset+e,t.length-e),new f(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let s=this._buffers[0],r=t.length-e;e>=s.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(s.buffer,s.byteOffset,e),r),this._buffers[0]=new f(s.buffer,s.byteOffset+e,s.length-e)),e-=s.length}while(e>0)return t}startLoop(e){this._loop=!0;do switch(this._state){case m:this.getInfo(e);break;case g:this.getPayloadLength16(e);break;case _:this.getPayloadLength64(e);break;case y:this.getMask();break;case S:this.getData(e);break;case b:case x:this._loop=!1;return}while(this._loop)this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if((48&t[0])!=0)return void e(this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3"));let s=(64&t[0])==64;if(s&&!this._extensions[i.extensionName])return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._fin=(128&t[0])==128,this._opcode=15&t[0],this._payloadLength=127&t[1],0===this._opcode){if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(!this._fragmented)return void e(this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE"));this._opcode=this._fragmented}else if(1===this._opcode||2===this._opcode){if(this._fragmented)return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));this._compressed=s}else{if(!(this._opcode>7)||!(this._opcode<11))return void e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE"));if(!this._fin)return void e(this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN"));if(s)return void e(this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1"));if(this._payloadLength>125||8===this._opcode&&1===this._payloadLength)return void e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"))}if(this._fin||this._fragmented||(this._fragmented=this._opcode),this._masked=(128&t[1])==128,this._isServer){if(!this._masked)return void e(this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK"))}else if(this._masked)return void e(this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK"));126===this._payloadLength?this._state=g:127===this._payloadLength?this._state=_:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),s=t.readUInt32BE(0);s>2097151?e(this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=0x100000000*s+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH")):this._masked?this._state=y:this._state=S}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=S}getData(e){let t=n;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!=0&&d(t,this._mask)}if(this._opcode>7)return void this.controlMessage(t,e);if(this._compressed){this._state=b,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void e(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,s)=>{if(e)return t(e);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return void t(this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));if(this._maxFragments>0&&this._fragments.length>=this._maxFragments)return void t(this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));this._fragments.push(s)}this.dataMessage(t),this._state===m&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=m;return}let t=this._messageLength,s=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],2===this._opcode){let r;r="nodebuffer"===this._binaryType?h(s,t):"arraybuffer"===this._binaryType?c(h(s,t)):"blob"===this._binaryType?new Blob(s):s,this._allowSynchronousEvents?(this.emit("message",r,!0),this._state=m):(this._state=x,setImmediate(()=>{this.emit("message",r,!0),this._state=m,this.startLoop(e)}))}else{let r=h(s,t);if(!this._skipUTF8Validation&&!u(r))return void e(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._state===b||this._allowSynchronousEvents?(this.emit("message",r,!1),this._state=m):(this._state=x,setImmediate(()=>{this.emit("message",r,!1),this._state=m,this.startLoop(e)}))}}controlMessage(e,t){if(8===this._opcode){if(0===e.length)this._loop=!1,this.emit("conclude",1005,n),this.end();else{let s=e.readUInt16BE(0);if(!p(s))return void t(this.createError(RangeError,`invalid status code ${s}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE"));let r=new f(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!u(r))return void t(this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8"));this._loop=!1,this.emit("conclude",s,r),this.end()}this._state=m;return}this._allowSynchronousEvents?(this.emit(9===this._opcode?"ping":"pong",e),this._state=m):(this._state=x,setImmediate(()=>{this.emit(9===this._opcode?"ping":"pong",e),this._state=m,this.startLoop(t)}))}createError(e,t,s,r,i){this._loop=!1,this._errored=!0;let o=new e(s?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(o,this.createError),o.code=i,o[a]=r,o}}t.exports=v},16735,(e,t,s)=>{"use strict";let r,{Duplex:i}=e.r(88947),{randomFillSync:o}=e.r(54799),{types:{isUint8Array:n}}=e.r(24361),a=e.r(80295),{EMPTY_BUFFER:l,kWebSocket:h,NOOP:c}=e.r(74836),{isBlob:d,isValidStatusCode:p}=e.r(58739),{mask:u,toBuffer:f}=e.r(97970),m=Symbol("kByteLength"),g=Buffer.alloc(4),_=8192,y=8192,S=0,b=1,x=2;class v{constructor(e,t,s){this._extensions=t||{},s&&(this._generateMask=s,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=S,this.onerror=c,this[h]=void 0}static frame(e,t){let s,i,n=!1,a=2,l=!1;t.mask&&(s=t.maskBuffer||g,t.generateMask?t.generateMask(s):(y===_&&(void 0===r&&(r=Buffer.alloc(_)),o(r,0,_),y=0),s[0]=r[y++],s[1]=r[y++],s[2]=r[y++],s[3]=r[y++]),l=(s[0]|s[1]|s[2]|s[3])==0,a=6),"string"==typeof e?i=(!t.mask||l)&&void 0!==t[m]?t[m]:(e=Buffer.from(e)).length:(i=e.length,n=t.mask&&t.readOnly&&!l);let h=i;i>=65536?(a+=8,h=127):i>125&&(a+=2,h=126);let c=Buffer.allocUnsafe(n?i+a:a);return(c[0]=t.fin?128|t.opcode:t.opcode,t.rsv1&&(c[0]|=64),c[1]=h,126===h?c.writeUInt16BE(i,2):127===h&&(c[2]=c[3]=0,c.writeUIntBE(i,4,6)),t.mask)?(c[1]|=128,c[a-4]=s[0],c[a-3]=s[1],c[a-2]=s[2],c[a-1]=s[3],l)?[c,e]:n?(u(e,s,c,a,i),[c]):(u(e,s,e,0,i),[c,e]):[c,e]}close(e,t,s,r){let i;if(void 0===e)i=l;else if("number"==typeof e&&p(e))if(void 0!==t&&t.length){let s=Buffer.byteLength(t);if(s>123)throw RangeError("The message must not be greater than 123 bytes");if((i=Buffer.allocUnsafe(2+s)).writeUInt16BE(e,0),"string"==typeof t)i.write(t,2);else if(n(t))i.set(t,2);else throw TypeError("Second argument must be a string or a Uint8Array")}else(i=Buffer.allocUnsafe(2)).writeUInt16BE(e,0);else throw TypeError("First argument must be a valid error code number");let o={[m]:i.length,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==S?this.enqueue([this.dispatch,i,!1,o,r]):this.sendFrame(v.frame(i,o),r)}ping(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):d(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let o={[m]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:i,rsv1:!1};d(e)?this._state!==S?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):this._state!==S?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(v.frame(e,o),s)}pong(e,t,s){let r,i;if("string"==typeof e?(r=Buffer.byteLength(e),i=!1):d(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),r>125)throw RangeError("The data size must not be greater than 125 bytes");let o={[m]:r,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:i,rsv1:!1};d(e)?this._state!==S?this.enqueue([this.getBlobData,e,!1,o,s]):this.getBlobData(e,!1,o,s):this._state!==S?this.enqueue([this.dispatch,e,!1,o,s]):this.sendFrame(v.frame(e,o),s)}send(e,t,s){let r,i,o=this._extensions[a.extensionName],n=t.binary?2:1,l=t.compress;"string"==typeof e?(r=Buffer.byteLength(e),i=!1):d(e)?(r=e.size,i=!1):(r=(e=f(e)).length,i=f.readOnly),this._firstFragment?(this._firstFragment=!1,l&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=r>=o._threshold),this._compress=l):(l=!1,n=0),t.fin&&(this._firstFragment=!0);let h={[m]:r,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:i,rsv1:l};d(e)?this._state!==S?this.enqueue([this.getBlobData,e,this._compress,h,s]):this.getBlobData(e,this._compress,h,s):this._state!==S?this.enqueue([this.dispatch,e,this._compress,h,s]):this.dispatch(e,this._compress,h,s)}getBlobData(e,t,s,r){this._bufferedBytes+=s[m],this._state=x,e.arrayBuffer().then(e=>{if(this._socket.destroyed){let e=Error("The socket was closed while the blob was being read");process.nextTick(k,this,e,r);return}this._bufferedBytes-=s[m];let i=f(e);t?this.dispatch(i,t,s,r):(this._state=S,this.sendFrame(v.frame(i,s),r),this.dequeue())}).catch(e=>{process.nextTick(w,this,e,r)})}dispatch(e,t,s,r){if(!t)return void this.sendFrame(v.frame(e,s),r);let i=this._extensions[a.extensionName];this._bufferedBytes+=s[m],this._state=b,i.compress(e,s.fin,(e,t)=>{this._socket.destroyed?k(this,Error("The socket was closed while data was being compressed"),r):(this._bufferedBytes-=s[m],this._state=S,s.readOnly=!1,this.sendFrame(v.frame(t,s),r),this.dequeue())})}dequeue(){for(;this._state===S&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){2===e.length?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}}function k(e,t,s){"function"==typeof s&&s(t);for(let s=0;s<e._queue.length;s++){let r=e._queue[s],i=r[r.length-1];"function"==typeof i&&i(t)}}function w(e,t,s){k(e,t,s),e.onerror(t)}t.exports=v},70494,(e,t,s)=>{"use strict";let{kForOnEventAttribute:r,kListener:i}=e.r(74836),o=Symbol("kCode"),n=Symbol("kData"),a=Symbol("kError"),l=Symbol("kMessage"),h=Symbol("kReason"),c=Symbol("kTarget"),d=Symbol("kType"),p=Symbol("kWasClean");class u{constructor(e){this[c]=null,this[d]=e}get target(){return this[c]}get type(){return this[d]}}Object.defineProperty(u.prototype,"target",{enumerable:!0}),Object.defineProperty(u.prototype,"type",{enumerable:!0});class f extends u{constructor(e,t={}){super(e),this[o]=void 0===t.code?0:t.code,this[h]=void 0===t.reason?"":t.reason,this[p]=void 0!==t.wasClean&&t.wasClean}get code(){return this[o]}get reason(){return this[h]}get wasClean(){return this[p]}}Object.defineProperty(f.prototype,"code",{enumerable:!0}),Object.defineProperty(f.prototype,"reason",{enumerable:!0}),Object.defineProperty(f.prototype,"wasClean",{enumerable:!0});class m extends u{constructor(e,t={}){super(e),this[a]=void 0===t.error?null:t.error,this[l]=void 0===t.message?"":t.message}get error(){return this[a]}get message(){return this[l]}}Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});class g extends u{constructor(e,t={}){super(e),this[n]=void 0===t.data?null:t.data}get data(){return this[n]}}Object.defineProperty(g.prototype,"data",{enumerable:!0});let _={addEventListener(e,t,s={}){let o;for(let o of this.listeners(e))if(!s[r]&&o[i]===t&&!o[r])return;if("message"===e)o=function(e,s){let r=new g("message",{data:s?e:e.toString()});r[c]=this,y(t,this,r)};else if("close"===e)o=function(e,s){let r=new f("close",{code:e,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[c]=this,y(t,this,r)};else if("error"===e)o=function(e){let s=new m("error",{error:e,message:e.message});s[c]=this,y(t,this,s)};else{if("open"!==e)return;o=function(){let e=new u("open");e[c]=this,y(t,this,e)}}o[r]=!!s[r],o[i]=t,s.once?this.once(e,o):this.on(e,o)},removeEventListener(e,t){for(let s of this.listeners(e))if(s[i]===t&&!s[r]){this.removeListener(e,s);break}}};function y(e,t,s){"object"==typeof e&&e.handleEvent?e.handleEvent.call(e,s):e.call(t,s)}t.exports={CloseEvent:f,ErrorEvent:m,Event:u,EventTarget:_,MessageEvent:g}},96903,(e,t,s)=>{"use strict";let{tokenChars:r}=e.r(58739);function i(e,t,s){void 0===e[t]?e[t]=[s]:e[t].push(s)}t.exports={format:function(e){return Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>[t].concat(Object.keys(e).map(t=>{let s=e[t];return Array.isArray(s)||(s=[s]),s.map(e=>!0===e?t:`${t}=${e}`).join("; ")})).join("; ")).join(", ")}).join(", ")},parse:function(e){let t,s,o=Object.create(null),n=Object.create(null),a=!1,l=!1,h=!1,c=-1,d=-1,p=-1,u=0;for(;u<e.length;u++)if(d=e.charCodeAt(u),void 0===t)if(-1===p&&1===r[d])-1===c&&(c=u);else if(0!==u&&(32===d||9===d))-1===p&&-1!==c&&(p=u);else if(59===d||44===d){if(-1===c)throw SyntaxError(`Unexpected character at index ${u}`);-1===p&&(p=u);let s=e.slice(c,p);44===d?(i(o,s,n),n=Object.create(null)):t=s,c=p=-1}else throw SyntaxError(`Unexpected character at index ${u}`);else if(void 0===s)if(-1===p&&1===r[d])-1===c&&(c=u);else if(32===d||9===d)-1===p&&-1!==c&&(p=u);else if(59===d||44===d){if(-1===c)throw SyntaxError(`Unexpected character at index ${u}`);-1===p&&(p=u),i(n,e.slice(c,p),!0),44===d&&(i(o,t,n),n=Object.create(null),t=void 0),c=p=-1}else if(61===d&&-1!==c&&-1===p)s=e.slice(c,u),c=p=-1;else throw SyntaxError(`Unexpected character at index ${u}`);else if(l){if(1!==r[d])throw SyntaxError(`Unexpected character at index ${u}`);-1===c?c=u:a||(a=!0),l=!1}else if(h)if(1===r[d])-1===c&&(c=u);else if(34===d&&-1!==c)h=!1,p=u;else if(92===d)l=!0;else throw SyntaxError(`Unexpected character at index ${u}`);else if(34===d&&61===e.charCodeAt(u-1))h=!0;else if(-1===p&&1===r[d])-1===c&&(c=u);else if(-1!==c&&(32===d||9===d))-1===p&&(p=u);else if(59===d||44===d){if(-1===c)throw SyntaxError(`Unexpected character at index ${u}`);-1===p&&(p=u);let r=e.slice(c,p);a&&(r=r.replace(/\\/g,""),a=!1),i(n,s,r),44===d&&(i(o,t,n),n=Object.create(null),t=void 0),s=void 0,c=p=-1}else throw SyntaxError(`Unexpected character at index ${u}`);if(-1===c||h||32===d||9===d)throw SyntaxError("Unexpected end of input");-1===p&&(p=u);let f=e.slice(c,p);return void 0===t?i(o,f,n):(void 0===s?i(n,f,!0):a?i(n,s,f.replace(/\\/g,"")):i(n,s,f),i(o,t,n)),o}}},35065,(e,t,s)=>{"use strict";let r=e.r(27699),i=e.r(24836),o=e.r(21517),n=e.r(4446),a=e.r(55004),{randomBytes:l,createHash:h}=e.r(54799),{Duplex:c,Readable:d}=e.r(88947),{URL:p}=e.r(92509),u=e.r(80295),f=e.r(29485),m=e.r(16735),{isBlob:g}=e.r(58739),{BINARY_TYPES:_,CLOSE_TIMEOUT:y,EMPTY_BUFFER:S,GUID:b,kForOnEventAttribute:x,kListener:v,kStatusCode:k,kWebSocket:w,NOOP:E}=e.r(74836),{EventTarget:{addEventListener:L,removeEventListener:P}}=e.r(70494),{format:O,parse:C}=e.r(96903),{toBuffer:T}=e.r(97970),A=Symbol("kAborted"),R=[8,13],N=["CONNECTING","OPEN","CLOSING","CLOSED"],I=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class D extends r{constructor(e,t,s){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=S,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=D.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,null!==e?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,void 0===t?t=[]:Array.isArray(t)||("object"==typeof t&&null!==t?(s=t,t=[]):t=[t]),M(this,e,t,s)):(this._autoPong=s.autoPong,this._closeTimeout=s.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}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(e,t,s){let r=new f({allowSynchronousEvents:s.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:s.maxBufferedChunks,maxFragments:s.maxFragments,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation}),i=new m(e,this._extensions,s.generateMask);this._receiver=r,this._sender=i,this._socket=e,r[w]=this,i[w]=this,e[w]=this,r.on("conclude",j),r.on("drain",G),r.on("error",z),r.on("message",q),r.on("ping",H),r.on("pong",K),i.onerror=J,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Z),e.on("data",Q),e.on("end",ee),e.on("error",et),this._readyState=D.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=D.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[u.extensionName]&&this._extensions[u.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=D.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==D.CLOSED){if(this.readyState===D.CONNECTING){let e="WebSocket was closed before the connection was established";B(this,this._req,e);return}if(this.readyState===D.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=D.CLOSING,this._sender.close(e,t,!this._isServer,e=>{!e&&(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),X(this)}}pause(){this.readyState!==D.CONNECTING&&this.readyState!==D.CLOSED&&(this._paused=!0,this._socket.pause())}ping(e,t,s){if(this.readyState===D.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==D.OPEN)?W(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.ping(e||S,t,s))}pong(e,t,s){if(this.readyState===D.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");("function"==typeof e?(s=e,e=t=void 0):"function"==typeof t&&(s=t,t=void 0),"number"==typeof e&&(e=e.toString()),this.readyState!==D.OPEN)?W(this,e,s):(void 0===t&&(t=!this._isServer),this._sender.pong(e||S,t,s))}resume(){this.readyState!==D.CONNECTING&&this.readyState!==D.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,s){if(this.readyState===D.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if("function"==typeof t&&(s=t,t={}),"number"==typeof e&&(e=e.toString()),this.readyState!==D.OPEN)return void W(this,e,s);let r={binary:"string"!=typeof e,mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[u.extensionName]||(r.compress=!1),this._sender.send(e||S,r,s)}terminate(){if(this.readyState!==D.CLOSED){if(this.readyState===D.CONNECTING){let e="WebSocket was closed before the connection was established";B(this,this._req,e);return}this._socket&&(this._readyState=D.CLOSING,this._socket.destroy())}}}function M(e,t,s,r){let n,a,c,d,f={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:y,protocolVersion:R[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,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=f.autoPong,e._closeTimeout=f.closeTimeout,!R.includes(f.protocolVersion))throw RangeError(`Unsupported protocol version: ${f.protocolVersion} (supported versions: ${R.join(", ")})`);if(t instanceof p)n=t;else try{n=new p(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}"http:"===n.protocol?n.protocol="ws:":"https:"===n.protocol&&(n.protocol="wss:"),e._url=n.href;let m="wss:"===n.protocol,g="ws+unix:"===n.protocol;if("ws:"===n.protocol||m||g?g&&!n.pathname?a="The URL's pathname is empty":n.hash&&(a="The URL contains a fragment identifier"):a='The URL\'s protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"',a){let t=SyntaxError(a);if(0!==e._redirects)return void U(e,t);throw t}let _=m?443:80,S=l(16).toString("base64"),x=m?i.request:o.request,v=new Set;if(f.createConnection=f.createConnection||(m?$:F),f.defaultPort=f.defaultPort||_,f.port=n.port||_,f.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,f.headers={...f.headers,"Sec-WebSocket-Version":f.protocolVersion,"Sec-WebSocket-Key":S,Connection:"Upgrade",Upgrade:"websocket"},f.path=n.pathname+n.search,f.timeout=f.handshakeTimeout,f.perMessageDeflate&&(c=new u({...f.perMessageDeflate,isServer:!1,maxPayload:f.maxPayload}),f.headers["Sec-WebSocket-Extensions"]=O({[u.extensionName]:c.offer()})),s.length){for(let e of s){if("string"!=typeof e||!I.test(e)||v.has(e))throw SyntaxError("An invalid or duplicated subprotocol was specified");v.add(e)}f.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(f.origin&&(f.protocolVersion<13?f.headers["Sec-WebSocket-Origin"]=f.origin:f.headers.Origin=f.origin),(n.username||n.password)&&(f.auth=`${n.username}:${n.password}`),g){let e=f.path.split(":");f.socketPath=e[0],f.path=e[1]}if(f.followRedirects){if(0===e._redirects){e._originalIpc=g,e._originalSecure=m,e._originalHostOrSocketPath=g?f.socketPath:n.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,s]of Object.entries(t))r.headers[e.toLowerCase()]=s}else if(0===e.listenerCount("redirect")){let t=g?!!e._originalIpc&&f.socketPath===e._originalHostOrSocketPath:!e._originalIpc&&n.host===e._originalHostOrSocketPath;t&&(!e._originalSecure||m)||(delete f.headers.authorization,delete f.headers.cookie,t||delete f.headers.host,f.auth=void 0)}f.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(f.auth).toString("base64")),d=e._req=x(f),e._redirects&&e.emit("redirect",e.url,d)}else d=e._req=x(f);f.timeout&&d.on("timeout",()=>{B(e,d,"Opening handshake has timed out")}),d.on("error",t=>{null===d||d[A]||(d=e._req=null,U(e,t))}),d.on("response",i=>{let o=i.headers.location,n=i.statusCode;if(o&&f.followRedirects&&n>=300&&n<400){let i;if(++e._redirects>f.maxRedirects)return void B(e,d,"Maximum redirects exceeded");d.abort();try{i=new p(o,t)}catch(t){U(e,SyntaxError(`Invalid URL: ${o}`));return}M(e,i,s,r)}else e.emit("unexpected-response",d,i)||B(e,d,`Unexpected server response: ${i.statusCode}`)}),d.on("upgrade",(t,s,r)=>{let i;if(e.emit("upgrade",t),e.readyState!==D.CONNECTING)return;d=e._req=null;let o=t.headers.upgrade;if(void 0===o||"websocket"!==o.toLowerCase())return void B(e,s,"Invalid Upgrade header");let n=h("sha1").update(S+b).digest("base64");if(t.headers["sec-websocket-accept"]!==n)return void B(e,s,"Invalid Sec-WebSocket-Accept header");let a=t.headers["sec-websocket-protocol"];if(void 0!==a?v.size?v.has(a)||(i="Server sent an invalid subprotocol"):i="Server sent a subprotocol but none was requested":v.size&&(i="Server sent no subprotocol"),i)return void B(e,s,i);a&&(e._protocol=a);let l=t.headers["sec-websocket-extensions"];if(void 0!==l){let t;if(!c)return void B(e,s,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");try{t=C(l)}catch(t){B(e,s,"Invalid Sec-WebSocket-Extensions header");return}let r=Object.keys(t);if(1!==r.length||r[0]!==u.extensionName)return void B(e,s,"Server indicated an extension that was not requested");try{c.accept(t[u.extensionName])}catch(t){B(e,s,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[u.extensionName]=c}e.setSocket(s,r,{allowSynchronousEvents:f.allowSynchronousEvents,generateMask:f.generateMask,maxBufferedChunks:f.maxBufferedChunks,maxFragments:f.maxFragments,maxPayload:f.maxPayload,skipUTF8Validation:f.skipUTF8Validation})}),f.finishRequest?f.finishRequest(d,e):d.end()}function U(e,t){e._readyState=D.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function F(e){return e.path=e.socketPath,n.connect(e)}function $(e){return e.path=void 0,e.servername||""===e.servername||(e.servername=n.isIP(e.host)?"":e.host),a.connect(e)}function B(e,t,s){e._readyState=D.CLOSING;let r=Error(s);Error.captureStackTrace(r,B),t.setHeader?(t[A]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(U,e,r)):(t.destroy(r),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function W(e,t,s){if(t){let s=g(t)?t.size:T(t).length;e._socket?e._sender._bufferedBytes+=s:e._bufferedAmount+=s}if(s){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${N[e.readyState]})`);process.nextTick(s,t)}}function j(e,t){let s=this[w];s._closeFrameReceived=!0,s._closeMessage=t,s._closeCode=e,void 0!==s._socket[w]&&(s._socket.removeListener("data",Q),process.nextTick(Y,s._socket),1005===e?s.close():s.close(e,t))}function G(){let e=this[w];e.isPaused||e._socket.resume()}function z(e){let t=this[w];void 0!==t._socket[w]&&(t._socket.removeListener("data",Q),process.nextTick(Y,t._socket),t.close(e[k])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function V(){this[w].emitClose()}function q(e,t){this[w].emit("message",e,t)}function H(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,E),t.emit("ping",e)}function K(e){this[w].emit("pong",e)}function Y(e){e.resume()}function J(e){let t=this[w];t.readyState!==D.CLOSED&&(t.readyState===D.OPEN&&(t._readyState=D.CLOSING,X(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function X(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function Z(){let e=this[w];if(this.removeListener("close",Z),this.removeListener("data",Q),this.removeListener("end",ee),e._readyState=D.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&0!==this._readableState.length){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",V),e._receiver.on("finish",V))}function Q(e){this[w]._receiver.write(e)||this.pause()}function ee(){let e=this[w];e._readyState=D.CLOSING,e._receiver.end(),this.end()}function et(){let e=this[w];this.removeListener("error",et),this.on("error",E),e&&(e._readyState=D.CLOSING,this.destroy())}Object.defineProperty(D,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")}),Object.defineProperty(D.prototype,"CONNECTING",{enumerable:!0,value:N.indexOf("CONNECTING")}),Object.defineProperty(D,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")}),Object.defineProperty(D.prototype,"OPEN",{enumerable:!0,value:N.indexOf("OPEN")}),Object.defineProperty(D,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")}),Object.defineProperty(D.prototype,"CLOSING",{enumerable:!0,value:N.indexOf("CLOSING")}),Object.defineProperty(D,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")}),Object.defineProperty(D.prototype,"CLOSED",{enumerable:!0,value:N.indexOf("CLOSED")}),["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(D.prototype,e,{enumerable:!0})}),["open","error","close","message"].forEach(e=>{Object.defineProperty(D.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[v];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}"function"==typeof t&&this.addEventListener(e,t,{[x]:!0})}})}),D.prototype.addEventListener=L,D.prototype.removeEventListener=P,t.exports=D},21365,(e,t,s)=>{"use strict";e.r(35065);let{Duplex:r}=e.r(88947);function i(e){e.emit("close")}function o(){!this.destroyed&&this._writableState.finished&&this.destroy()}function n(e){this.removeListener("error",n),this.destroy(),0===this.listenerCount("error")&&this.emit("error",e)}t.exports=function(e,t){let s=!0,a=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(t,s){let r=!s&&a._readableState.objectMode?t.toString():t;a.push(r)||e.pause()}),e.once("error",function(e){a.destroyed||(s=!1,a.destroy(e))}),e.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,a);return}let o=!1;e.once("error",function(e){o=!0,r(e)}),e.once("close",function(){o||r(t),process.nextTick(i,a)}),s&&e.terminate()},a._final=function(t){e.readyState===e.CONNECTING?e.once("open",function(){a._final(t)}):null!==e._socket&&(e._socket._writableState.finished?(t(),a._readableState.endEmitted&&a.destroy()):(e._socket.once("finish",function(){t()}),e.close()))},a._read=function(){e.isPaused&&e.resume()},a._write=function(t,s,r){e.readyState===e.CONNECTING?e.once("open",function(){a._write(t,s,r)}):e.send(t,r)},a.on("end",o),a.on("error",n),a}},42977,(e,t,s)=>{"use strict";let{tokenChars:r}=e.r(58739);t.exports={parse:function(e){let t=new Set,s=-1,i=-1,o=0;for(;o<e.length;o++){let n=e.charCodeAt(o);if(-1===i&&1===r[n])-1===s&&(s=o);else if(0!==o&&(32===n||9===n))-1===i&&-1!==s&&(i=o);else if(44===n){if(-1===s)throw SyntaxError(`Unexpected character at index ${o}`);-1===i&&(i=o);let r=e.slice(s,i);if(t.has(r))throw SyntaxError(`The "${r}" subprotocol is duplicated`);t.add(r),s=i=-1}else throw SyntaxError(`Unexpected character at index ${o}`)}if(-1===s||-1!==i)throw SyntaxError("Unexpected end of input");let n=e.slice(s,o);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);return t.add(n),t}}},17198,(e,t,s)=>{"use strict";let r=e.r(27699),i=e.r(21517),{Duplex:o}=e.r(88947),{createHash:n}=e.r(54799),a=e.r(96903),l=e.r(80295),h=e.r(42977),c=e.r(35065),{CLOSE_TIMEOUT:d,GUID:p,kWebSocket:u}=e.r(74836),f=/^[+/0-9A-Za-z]{22}==$/,m=0,g=1,_=2;class y extends r{constructor(e,t){if(super(),null==(e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:0x6400000,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:c,...e}).port&&!e.server&&!e.noServer||null!=e.port&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(null!=e.port?(this._server=i.createServer((e,t)=>{let s=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),t.end(s)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const e=this.emit.bind(this,"connection");this._removeListeners=S(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(t,s,r)=>{this.handleUpgrade(t,s,r,e)}})}!0===e.perMessageDeflate&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=m}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===_){e&&this.once("close",()=>{e(Error("The server is not running"))}),process.nextTick(b,this);return}if(e&&this.once("close",e),this._state!==g)if(this._state=g,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(b,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{b(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((-1!==t?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,s,r){t.on("error",x);let i=e.headers["sec-websocket-key"],o=e.headers.upgrade,n=+e.headers["sec-websocket-version"];if("GET"!==e.method)return void k(this,e,t,405,"Invalid HTTP method");if(void 0===o||"websocket"!==o.toLowerCase())return void k(this,e,t,400,"Invalid Upgrade header");if(void 0===i||!f.test(i))return void k(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");if(13!==n&&8!==n)return void k(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});if(!this.shouldHandle(e))return void v(t,400);let c=e.headers["sec-websocket-protocol"],d=new Set;if(void 0!==c)try{d=h.parse(c)}catch(s){k(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],u={};if(this.options.perMessageDeflate&&void 0!==p){let s=new l({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=a.parse(p);e[l.extensionName]&&(s.accept(e[l.extensionName]),u[l.extensionName]=s)}catch(s){k(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let o={origin:e.headers[`${8===n?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(2===this.options.verifyClient.length)return void this.options.verifyClient(o,(o,n,a,l)=>{if(!o)return v(t,n||401,a,l);this.completeUpgrade(u,i,d,e,t,s,r)});if(!this.options.verifyClient(o))return v(t,401)}this.completeUpgrade(u,i,d,e,t,s,r)}completeUpgrade(e,t,s,r,i,o,h){if(!i.readable||!i.writable)return i.destroy();if(i[u])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>m)return v(i,503);let c=n("sha1").update(t+p).digest("base64"),d=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${c}`],f=new this.options.WebSocket(null,void 0,this.options);if(s.size){let e=this.options.handleProtocols?this.options.handleProtocols(s,r):s.values().next().value;e&&(d.push(`Sec-WebSocket-Protocol: ${e}`),f._protocol=e)}if(e[l.extensionName]){let t=e[l.extensionName].params,s=a.format({[l.extensionName]:[t]});d.push(`Sec-WebSocket-Extensions: ${s}`),f._extensions=e}this.emit("headers",d,r),i.write(d.concat("\r\n").join("\r\n")),i.removeListener("error",x),f.setSocket(i,o,{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(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&!this.clients.size&&process.nextTick(b,this)})),h(f,r)}}function S(e,t){for(let s of Object.keys(t))e.on(s,t[s]);return function(){for(let s of Object.keys(t))e.removeListener(s,t[s])}}function b(e){e._state=_,e.emit("close")}function x(){this.destroy()}function v(e,t,s,r){s=s||i.STATUS_CODES[t],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r
2
+ `+Object.keys(r).map(e=>`${e}: ${r[e]}`).join("\r\n")+"\r\n\r\n"+s)}function k(e,t,s,r,i,o){if(e.listenerCount("wsClientError")){let r=Error(i);Error.captureStackTrace(r,k),e.emit("wsClientError",r,s,t)}else v(s,r,i,o)}t.exports=y},29307,10928,__turbopack_context__=>{"use strict";var __TURBOPACK__imported__module__54799__=__turbopack_context__.i(54799);class AgentRunner{workspaceRoot;scopedDirs;lastSyncedWorkspaceFolders;tokenUsage={input:0,output:0,cost:0};parseTokenUsage(e){let t=e.replace(/\x1b\[[0-9;]*m/g,""),s=t.match(/(?:cost|estimated cost)[:\s]*\$([0-9.]+)/i);s&&(this.tokenUsage.cost=parseFloat(s[1]));let r=e=>(e=e.replace(/,/g,"").toLowerCase().trim()).endsWith("k")?1e3*parseFloat(e.slice(0,-1)):e.endsWith("m")?1e6*parseFloat(e.slice(0,-1)):parseInt(e,10)||0,i=/tokens?[:\s]*([0-9,.]+[km]?)\s*(?:sent|input|prompt)[^a-zA-Z0-9]+([0-9,.]+[km]?)\s*(?:received|output|completion)/i,o=t.match(i);if(o)this.tokenUsage.input=r(o[1]),this.tokenUsage.output=r(o[2]);else{let e=t.match(/([0-9,.]+[km]?)\s*(?:sent|input|prompt)\s*tokens?/i)||t.match(/tokens?\s*(?:sent|input|prompt)[:\s]*([0-9,.]+[km]?)/i);e&&(this.tokenUsage.input=r(e[1]));let s=t.match(/([0-9,.]+[km]?)\s*(?:received|output|completion)\s*tokens?/i)||t.match(/tokens?\s*(?:received|output|completion)[:\s]*([0-9,.]+[km]?)/i);s&&(this.tokenUsage.output=r(s[1]))}0===this.tokenUsage.cost&&(this.tokenUsage.input>0||this.tokenUsage.output>0)&&(this.tokenUsage.cost=3e-6*this.tokenUsage.input+15e-6*this.tokenUsage.output)}resize(e,t){}listeners=[];onOutput(e){this.listeners.push(e)}offOutput(e){this.listeners=this.listeners.filter(t=>t!==e)}emitOutput(e){this.listeners.forEach(t=>t(e))}}var __TURBOPACK__imported__module__22734__=__turbopack_context__.i(22734),__TURBOPACK__imported__module__14747__=__turbopack_context__.i(14747);class SessionPersister{static pendingSaves=new Map;static pendingData=new Map;static get workspaceRoot(){return process.env.ORIGINAL_CWD||process.cwd()}static getSessionsDir(){let e=__TURBOPACK__imported__module__14747__.default.join(this.workspaceRoot,".ai","neural-loom","sessions");return __TURBOPACK__imported__module__22734__.default.existsSync(e)||__TURBOPACK__imported__module__22734__.default.mkdirSync(e,{recursive:!0}),e}static saveSession(e,t=!1){let s={id:e.id,name:e.name,type:e.type,status:"running"===e.status&&"mock"===e.type?"running":e.status,createdAt:e.createdAt,logs:e.logs,workspaceRoot:e.workspaceRoot,scopedDirs:e.scopedDirs,lastSyncedWorkspaceFolders:e.lastSyncedWorkspaceFolders};if(t){let t=this.pendingSaves.get(e.id);t&&(clearTimeout(t),this.pendingSaves.delete(e.id)),this.pendingData.delete(e.id),this.writeToDisk(e.id,s);return}if(this.pendingData.set(e.id,s),!this.pendingSaves.has(e.id)){let t=setTimeout(()=>{this.pendingSaves.delete(e.id);let t=this.pendingData.get(e.id);t&&(this.pendingData.delete(e.id),this.writeToDisk(e.id,t))},1e3);this.pendingSaves.set(e.id,t)}}static writeToDisk(e,t){try{let s=this.getSessionsDir(),r=__TURBOPACK__imported__module__14747__.default.join(s,`${e}.json`);__TURBOPACK__imported__module__22734__.default.writeFile(r,JSON.stringify(t,null,2),"utf8",t=>{t&&console.error(`[SessionPersister] Failed to save session ${e} asynchronously:`,t)})}catch(t){console.error(`[SessionPersister] Failed to save session ${e}:`,t)}}static loadAllSessions(){try{let e=this.getSessionsDir(),t=__TURBOPACK__imported__module__22734__.default.readdirSync(e),s=[];for(let r of t)if(r.endsWith(".json")){let t=__TURBOPACK__imported__module__14747__.default.join(e,r),i=__TURBOPACK__imported__module__22734__.default.readFileSync(t,"utf8"),o=JSON.parse(i);"running"===o.status&&"mock"!==o.type&&(o.status="stopped",o.logs.push("\r\n\x1b[1;31m[System] Server restarted. Terminal connection lost.\x1b[0m\r\n"),__TURBOPACK__imported__module__22734__.default.writeFileSync(t,JSON.stringify(o,null,2),"utf8")),s.push(o)}return s}catch(e){return console.error("[SessionPersister] Failed to load sessions:",e),[]}}static cancelPendingSave(e){let t=this.pendingSaves.get(e);t&&(clearTimeout(t),this.pendingSaves.delete(e)),this.pendingData.delete(e)}static deleteSession(e){this.cancelPendingSave(e);try{let t=this.getSessionsDir(),s=__TURBOPACK__imported__module__14747__.default.join(t,`${e}.json`);__TURBOPACK__imported__module__22734__.default.existsSync(s)&&__TURBOPACK__imported__module__22734__.default.unlinkSync(s)}catch(t){console.error(`[SessionPersister] Failed to delete session ${e}:`,t)}}}__turbopack_context__.s(["SessionPersister",0,SessionPersister],10928);class MockRunner extends AgentRunner{id;name;type="mock";status="idle";createdAt;logs=[];intervalId=null;mockSteps=["[NeuralLoom] Loading virtual PTY context...","[NeuralLoom] Spawning sandbox mock runtime environment...","[Mock Agent] Model online (v2.0-mock-flash). Dedicated memory allocated.","[Mock Agent] System rules parsed successfully from global context registry.","[Mock Agent] Awaiting developer commands. Type '/help' to list mock skills."];stepIndex=0;constructor(e,t){super(),this.id=e,this.name=t||`Mock Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.parseTokenUsage(e),this.emitOutput(e+"\r\n"),SessionPersister.saveSession(this)}async start(){"running"!==this.status&&(this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m"),this.appendLog("\x1b[1;36m NEURALLOOM SIMULATED AGENT ENVIRONMENT \x1b[0m"),this.appendLog("\x1b[1;35m==================================================\x1b[0m"),this.stepIndex<this.mockSteps.length&&this.appendLog(this.mockSteps[this.stepIndex++]),this.intervalId=setInterval(()=>{if(this.tokenUsage.input+=Math.floor(50*Math.random())+10,this.tokenUsage.output+=Math.floor(20*Math.random())+5,this.tokenUsage.cost=3e-6*this.tokenUsage.input+15e-6*this.tokenUsage.output,this.stepIndex<this.mockSteps.length)this.appendLog(this.mockSteps[this.stepIndex++]);else{let e=new Date().toLocaleTimeString();this.appendLog(`[${e}] [Telemetry] CPU utilization 1.2% | Memory 142MB | Link stable.`)}},4e3))}async stop(){this.status="stopped",this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null),this.appendLog("\x1b[1;31m[System] Process terminated. Connection closed.\x1b[0m")}async sendInput(e,t){"running"!==this.status?this.appendLog(`\x1b[1;31m[Error] Cannot write input: process is ${this.status}.\x1b[0m`):(this.appendLog(`\x1b[1;32m> ${e}\x1b[0m`),setTimeout(()=>{let t=e.trim().toLowerCase();"/help"===t?(this.appendLog("[Mock Agent] Available commands:"),this.appendLog(" /help - List available mock commands."),this.appendLog(" /status - Fetch current agent diagnostic metrics."),this.appendLog(" /context - View loaded staging files."),this.appendLog(" /clear - Flush terminal console buffer.")):"/status"===t?(this.appendLog("[Mock Agent] Diagnostics:"),this.appendLog(" - Connection Type: WebSocket gateway (mock)"),this.appendLog(` - Active Runtime: ${this.id}`),this.appendLog(" - Sandbox State: Healthy (0 warnings)")):"/context"===t?(this.appendLog("[Mock Agent] Loaded Workspace Context Files:"),this.appendLog(" - [Mounted] src/app/globals.css (Modified)"),this.appendLog(" - [Mounted] src/app/page.tsx")):"/clear"===t?(this.logs=[],this.appendLog("\x1b[1;33m[Console Cleared]\x1b[0m")):(this.appendLog(`[Mock Agent] Received command: "${e}". Processing...`),setTimeout(()=>{this.appendLog("[Mock Agent] Done. Task simulated successfully.")},1500))},400))}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__1=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__1=__TURBOPACK__imported__module__14747__,__TURBOPACK__imported__module__46786__=__turbopack_context__.i(46786),__TURBOPACK__imported__module__33405__=__turbopack_context__.i(33405),__TURBOPACK__imported__module__98003__=__turbopack_context__.i(98003);function isWindows(){return"u">typeof process&&"win32"===process.platform}function findGitBash(){if(!isWindows())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__1.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__1.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__1.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__1.default.existsSync(e))||null}class ClaudeRunner extends AgentRunner{id;name;type="claude";status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t){super(),this.id=e,this.name=t||`Claude Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;let useCmd=isWindows(),shellPath=useCmd?process.env.COMSPEC||"cmd.exe":findGitBash();if(!shellPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Shell not found. Cannot spawn terminal.\x1b[0m\r\n");return}let shellArgs=useCmd?["/c"]:["-c"];try{this.ptyModule||(this.ptyModule=eval("require")("node-pty")),this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("\x1b[1;36m NEURALLOOM ACTIVE CLAUDE TERMINAL ROUTE \x1b[0m\r\n"),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n");let targetCwd=this.workspaceRoot&&__TURBOPACK__imported__module__22734__1.default.existsSync(this.workspaceRoot)?this.workspaceRoot:process.env.ORIGINAL_CWD||process.cwd(),extraFlags="",claudeConfigPath=__TURBOPACK__imported__module__14747__1.default.join((0,__TURBOPACK__imported__module__98003__.getConfigDir)(),"claude.json");if(__TURBOPACK__imported__module__22734__1.default.existsSync(claudeConfigPath))try{let config=JSON.parse(__TURBOPACK__imported__module__22734__1.default.readFileSync(claudeConfigPath,"utf8"));config.extraFlags&&(extraFlags=config.extraFlags)}catch(err){console.error("Failed to parse Claude configuration:",err)}let customEnv={...process.env,TERM:"xterm-256color",COLORTERM:"truecolor"};if(isWindows()){let vsNode="C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Microsoft\\VisualStudio\\NodeJs",localNpm=__TURBOPACK__imported__module__14747__1.default.join(__TURBOPACK__imported__module__46786__.default.homedir(),"AppData","Local","npm"),existingPath=process.env.Path||process.env.PATH||"",winPath=[vsNode,localNpm,existingPath].filter(Boolean).join(";");for(let key of Object.keys(customEnv))"path"===key.toLowerCase()&&delete customEnv[key];customEnv.Path=winPath,customEnv.PATH=winPath}let baseCmd="claude";try{let checkCmd=isWindows()?"where.exe claude":"which claude";(0,__TURBOPACK__imported__module__33405__.execSync)(checkCmd,{env:customEnv,stdio:"ignore"})}catch{baseCmd="npx -y @anthropic-ai/claude-code"}let claudeCmd=`${baseCmd} ${extraFlags}`.trim();this.appendLog(`[System] Spawning command: ${claudeCmd}\r
3
3
  `),this.ptyProcess=this.ptyModule.spawn(shellPath,[...shellArgs,claudeCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:customEnv}),this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
4
4
  \x1b[1;31m[System] Claude Code PTY process exited (code=${e}, signal=${t}).\x1b[0m\r
5
5
  `),this.ptyProcess=null})}catch(err){let errorMessage=err instanceof Error?err.message:"Unknown error";this.status="stopped",this.appendLog(`\x1b[1;31m[System Error] Failed to initialize node-pty runner: ${errorMessage}\x1b[0m\r
6
6
  `),console.error("Failed to start Claude PTY runner:",err)}}async stop(){if(this.status="stopped",this.ptyProcess){try{this.ptyProcess.kill()}catch(e){console.error("Error killing PTY process:",e)}this.ptyProcess=null}this.appendLog("\r\n\x1b[1;31m[System] Terminal bridge terminated.\x1b[0m\r\n")}async sendInput(e,t=!1){"running"===this.status&&this.ptyProcess?this.ptyProcess.write(t?e:e+"\r"):this.appendLog(`\r
7
7
  \x1b[1;31m[Error] Cannot write: session process is ${this.status}.\x1b[0m\r
8
- `)}resize(e,t){if(this.ptyProcess)try{this.ptyProcess.resize(e,t)}catch(e){console.error("[ClaudeRunner] Failed to resize PTY:",e)}}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,workspaceRoot:this.workspaceRoot,scopedDirs:this.scopedDirs,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__2=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__2=__TURBOPACK__imported__module__14747__;function isWindows1(){return"u">typeof process&&"win32"===process.platform}function findGitBash1(){if(!isWindows1())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__2.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__2.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__2.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__2.default.existsSync(e))||null}class DockerRunner extends AgentRunner{id;name;type="claude-docker";status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t){super(),this.id=e,this.name=t||`Docker Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("\x1b[1;36m NEURALLOOM DOCKER SANDBOX RUNTIME BRIDGE \x1b[0m\r\n"),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("[System] Verifying Docker environment accessibility...\r\n");let bashPath=findGitBash1();if(!bashPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Git Bash not found. Cannot bootstrap PTY sandbox.\x1b[0m\r\n");return}try{this.ptyModule||(this.ptyModule=eval("require")("node-pty"));let targetCwd=this.workspaceRoot&&__TURBOPACK__imported__module__22734__2.default.existsSync(this.workspaceRoot)?this.workspaceRoot:process.env.ORIGINAL_CWD||process.cwd(),testPty=this.ptyModule.spawn(bashPath,["-c","docker --version"],{name:"xterm-256color",cols:80,rows:10,cwd:targetCwd}),hasDocker=!1;if(testPty.onData(e=>{e.toLowerCase().includes("docker version")&&(hasDocker=!0)}),await new Promise(e=>setTimeout(e,800)),testPty.kill(),!hasDocker){this.status="stopped",this.appendLog("\x1b[1;31m[Dependency Warning] Docker command not recognized in local PATH.\x1b[0m\r\n"),this.appendLog("\x1b[1;33mPlease install Docker Desktop (https://www.docker.com/products/docker-desktop) and ensure the daemon is running.\x1b[0m\r\n"),this.appendLog("\x1b[1;31m[System] Sandbox launch aborted.\x1b[0m\r\n");return}this.appendLog("[System] Docker detected. Initializing container mount...\r\n");let mounts=[`-v "${targetCwd}:/workspace"`];this.scopedDirs&&Array.isArray(this.scopedDirs)&&this.scopedDirs.forEach(e=>{if(__TURBOPACK__imported__module__22734__2.default.existsSync(e)){let t=__TURBOPACK__imported__module__14747__2.default.basename(e).replace(/[^a-zA-Z0-9-_]/g,"_");mounts.push(`-v "${e}:/scoped/${t}"`)}});let mountsStr=mounts.join(" "),extraFlags="",claudeConfigPath=__TURBOPACK__imported__module__14747__2.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom","claude.json");if(__TURBOPACK__imported__module__22734__2.default.existsSync(claudeConfigPath))try{let config=JSON.parse(__TURBOPACK__imported__module__22734__2.default.readFileSync(claudeConfigPath,"utf8"));config.extraFlags&&(extraFlags=config.extraFlags)}catch(err){console.error("Failed to parse Claude configuration:",err)}let dockerCmd=`docker run -it --name neural-loom-session-${this.id} --rm ${mountsStr} -w /workspace node:20-alpine npx -y @anthropic-ai/claude-code ${extraFlags}`.trim();this.ptyProcess=this.ptyModule.spawn(bashPath,["-c",dockerCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:{...process.env,TERM:"xterm-256color",COLORTERM:"truecolor"}}),this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
8
+ `)}resize(e,t){if(this.ptyProcess)try{this.ptyProcess.resize(e,t)}catch(e){console.error("[ClaudeRunner] Failed to resize PTY:",e)}}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,workspaceRoot:this.workspaceRoot,scopedDirs:this.scopedDirs,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__2=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__2=__TURBOPACK__imported__module__14747__,__TURBOPACK__imported__module__98003__1=__TURBOPACK__imported__module__98003__;function isWindows1(){return"u">typeof process&&"win32"===process.platform}function findGitBash1(){if(!isWindows1())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__2.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__2.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__2.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__2.default.existsSync(e))||null}class DockerRunner extends AgentRunner{id;name;type="claude-docker";status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t){super(),this.id=e,this.name=t||`Docker Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("\x1b[1;36m NEURALLOOM DOCKER SANDBOX RUNTIME BRIDGE \x1b[0m\r\n"),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("[System] Verifying Docker environment accessibility...\r\n");let bashPath=findGitBash1();if(!bashPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Git Bash not found. Cannot bootstrap PTY sandbox.\x1b[0m\r\n");return}try{this.ptyModule||(this.ptyModule=eval("require")("node-pty"));let targetCwd=this.workspaceRoot&&__TURBOPACK__imported__module__22734__2.default.existsSync(this.workspaceRoot)?this.workspaceRoot:process.env.ORIGINAL_CWD||process.cwd(),testPty=this.ptyModule.spawn(bashPath,["-c","docker --version"],{name:"xterm-256color",cols:80,rows:10,cwd:targetCwd}),hasDocker=!1;if(testPty.onData(e=>{e.toLowerCase().includes("docker version")&&(hasDocker=!0)}),await new Promise(e=>setTimeout(e,800)),testPty.kill(),!hasDocker){this.status="stopped",this.appendLog("\x1b[1;31m[Dependency Warning] Docker command not recognized in local PATH.\x1b[0m\r\n"),this.appendLog("\x1b[1;33mPlease install Docker Desktop (https://www.docker.com/products/docker-desktop) and ensure the daemon is running.\x1b[0m\r\n"),this.appendLog("\x1b[1;31m[System] Sandbox launch aborted.\x1b[0m\r\n");return}this.appendLog("[System] Docker detected. Initializing container mount...\r\n");let mounts=[`-v "${targetCwd}:/workspace"`];this.scopedDirs&&Array.isArray(this.scopedDirs)&&this.scopedDirs.forEach(e=>{if(__TURBOPACK__imported__module__22734__2.default.existsSync(e)){let t=__TURBOPACK__imported__module__14747__2.default.basename(e).replace(/[^a-zA-Z0-9-_]/g,"_");mounts.push(`-v "${e}:/scoped/${t}"`)}});let mountsStr=mounts.join(" "),extraFlags="",claudeConfigPath=__TURBOPACK__imported__module__14747__2.default.join((0,__TURBOPACK__imported__module__98003__1.getConfigDir)(),"claude.json");if(__TURBOPACK__imported__module__22734__2.default.existsSync(claudeConfigPath))try{let config=JSON.parse(__TURBOPACK__imported__module__22734__2.default.readFileSync(claudeConfigPath,"utf8"));config.extraFlags&&(extraFlags=config.extraFlags)}catch(err){console.error("Failed to parse Claude configuration:",err)}let dockerCmd=`docker run -it --name neural-loom-session-${this.id} --rm ${mountsStr} -w /workspace node:20-alpine npx -y @anthropic-ai/claude-code ${extraFlags}`.trim();this.ptyProcess=this.ptyModule.spawn(bashPath,["-c",dockerCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:{...process.env,TERM:"xterm-256color",COLORTERM:"truecolor"}}),this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
9
9
  \x1b[1;31m[System] Docker Sandbox exited (code=${e}, signal=${t}).\x1b[0m\r
10
10
  `),this.ptyProcess=null})}catch(err){let errorMessage=err instanceof Error?err.message:"Unknown error";this.status="stopped",this.appendLog(`\x1b[1;31m[System Error] Failed to launch Docker runner: ${errorMessage}\x1b[0m\r
11
11
  `)}}async stop(){if(this.status="stopped",this.ptyProcess){try{this.ptyProcess.kill()}catch(e){console.error("Error killing Docker PTY process:",e)}this.ptyProcess=null}this.appendLog("\r\n\x1b[1;31m[System] Docker container stopped and unmounted.\x1b[0m\r\n")}async sendInput(e,t=!1){"running"===this.status&&this.ptyProcess?this.ptyProcess.write(t?e:e+"\r"):this.appendLog(`\r
12
12
  \x1b[1;31m[Error] Cannot write: Docker container is ${this.status}.\x1b[0m\r
13
- `)}resize(e,t){if(this.ptyProcess)try{this.ptyProcess.resize(e,t)}catch(e){console.error("[DockerRunner] Failed to resize PTY:",e)}}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,workspaceRoot:this.workspaceRoot,scopedDirs:this.scopedDirs,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__3=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__3=__TURBOPACK__imported__module__14747__;function isWindows2(){return"u">typeof process&&"win32"===process.platform}function findGitBash2(){if(!isWindows2())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__3.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__3.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__3.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__3.default.existsSync(e))||null}class SSHRunner extends AgentRunner{id;name;type="claude-ssh";status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t){super(),this.id=e,this.name=t||`SSH Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("\x1b[1;36m NEURALLOOM REMOTE VM (SSH) ROUTE BRIDGE \x1b[0m\r\n"),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("[System] Loading SSH configuration...\r\n");let bashPath=findGitBash2();if(!bashPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Git Bash not found. Cannot bootstrap SSH terminal.\x1b[0m\r\n");return}let configPath=__TURBOPACK__imported__module__14747__3.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom","ssh.json");if(!__TURBOPACK__imported__module__22734__3.default.existsSync(configPath)){this.status="stopped",this.appendLog("\x1b[1;31m[Configuration Error] ssh.json not found!\x1b[0m\r\n"),this.appendLog(`\x1b[1;33mPlease create the SSH credentials file at: ${configPath}\x1b[0m\r
13
+ `)}resize(e,t){if(this.ptyProcess)try{this.ptyProcess.resize(e,t)}catch(e){console.error("[DockerRunner] Failed to resize PTY:",e)}}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,workspaceRoot:this.workspaceRoot,scopedDirs:this.scopedDirs,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__3=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__3=__TURBOPACK__imported__module__14747__,__TURBOPACK__imported__module__98003__2=__TURBOPACK__imported__module__98003__;function isWindows2(){return"u">typeof process&&"win32"===process.platform}function findGitBash2(){if(!isWindows2())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__3.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__3.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__3.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__3.default.existsSync(e))||null}class SSHRunner extends AgentRunner{id;name;type="claude-ssh";status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t){super(),this.id=e,this.name=t||`SSH Session ${e.substring(0,8)}`,this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("\x1b[1;36m NEURALLOOM REMOTE VM (SSH) ROUTE BRIDGE \x1b[0m\r\n"),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog("[System] Loading SSH configuration...\r\n");let bashPath=findGitBash2();if(!bashPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Git Bash not found. Cannot bootstrap SSH terminal.\x1b[0m\r\n");return}let configPath=__TURBOPACK__imported__module__14747__3.default.join((0,__TURBOPACK__imported__module__98003__2.getConfigDir)(),"ssh.json");if(!__TURBOPACK__imported__module__22734__3.default.existsSync(configPath)){this.status="stopped",this.appendLog("\x1b[1;31m[Configuration Error] ssh.json not found!\x1b[0m\r\n"),this.appendLog(`\x1b[1;33mPlease create the SSH credentials file at: ${configPath}\x1b[0m\r
14
14
  `),this.appendLog("\x1b[1;36mTemplate structure:\x1b[0m\r\n"),this.appendLog(JSON.stringify({host:"your.remote.host.com",username:"dave",privateKeyPath:"C:\\\\Users\\\\Dave\\\\.ssh\\\\id_rsa",port:22},null,2).replace(/\n/g,"\r\n")+"\r\n"),this.appendLog("\x1b[1;31m[System] SSH startup aborted.\x1b[0m\r\n");return}try{let rawConfig=__TURBOPACK__imported__module__22734__3.default.readFileSync(configPath,"utf8"),config=JSON.parse(rawConfig);if(!config.host||!config.username){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Invalid ssh.json configuration. 'host' and 'username' are required.\x1b[0m\r\n");return}this.ptyModule||(this.ptyModule=eval("require")("node-pty")),this.appendLog(`[System] Connecting to ${config.username}@${config.host}...\r
15
- `);let portOpt=config.port?`-p ${config.port}`:"",keyOpt=config.privateKeyPath?`-i "${config.privateKeyPath}"`:"",extraFlags="",claudeConfigPath=__TURBOPACK__imported__module__14747__3.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom","claude.json");if(__TURBOPACK__imported__module__22734__3.default.existsSync(claudeConfigPath))try{let config=JSON.parse(__TURBOPACK__imported__module__22734__3.default.readFileSync(claudeConfigPath,"utf8"));config.extraFlags&&(extraFlags=config.extraFlags)}catch(err){console.error("Failed to parse Claude configuration:",err)}let sshCmd=`ssh -t ${keyOpt} ${portOpt} ${config.username}@${config.host} "claude ${extraFlags}"`;this.ptyProcess=this.ptyModule.spawn(bashPath,["-c",sshCmd],{name:"xterm-256color",cols:120,rows:30,cwd:process.env.ORIGINAL_CWD||process.cwd(),env:{...process.env,TERM:"xterm-256color",COLORTERM:"truecolor"}}),this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
15
+ `);let portOpt=config.port?`-p ${config.port}`:"",keyOpt=config.privateKeyPath?`-i "${config.privateKeyPath}"`:"",extraFlags="",claudeConfigPath=__TURBOPACK__imported__module__14747__3.default.join((0,__TURBOPACK__imported__module__98003__2.getConfigDir)(),"claude.json");if(__TURBOPACK__imported__module__22734__3.default.existsSync(claudeConfigPath))try{let config=JSON.parse(__TURBOPACK__imported__module__22734__3.default.readFileSync(claudeConfigPath,"utf8"));config.extraFlags&&(extraFlags=config.extraFlags)}catch(err){console.error("Failed to parse Claude configuration:",err)}let sshCmd=`ssh -t ${keyOpt} ${portOpt} ${config.username}@${config.host} "claude ${extraFlags}"`;this.ptyProcess=this.ptyModule.spawn(bashPath,["-c",sshCmd],{name:"xterm-256color",cols:120,rows:30,cwd:process.env.ORIGINAL_CWD||process.cwd(),env:{...process.env,TERM:"xterm-256color",COLORTERM:"truecolor"}}),this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
16
16
  \x1b[1;31m[System] SSH Session exited (code=${e}, signal=${t}).\x1b[0m\r
17
17
  `),this.ptyProcess=null})}catch(err){let errorMessage=err instanceof Error?err.message:"Unknown error";this.status="stopped",this.appendLog(`\x1b[1;31m[System Error] SSH connection failed: ${errorMessage}\x1b[0m\r
18
18
  `)}}async stop(){if(this.status="stopped",this.ptyProcess){try{this.ptyProcess.kill()}catch(e){console.error("Error killing SSH PTY process:",e)}this.ptyProcess=null}this.appendLog("\r\n\x1b[1;31m[System] SSH Connection terminated.\x1b[0m\r\n")}async sendInput(e,t=!1){"running"===this.status&&this.ptyProcess?this.ptyProcess.write(t?e:e+"\r"):this.appendLog(`\r
19
19
  \x1b[1;31m[Error] Cannot write: SSH session is ${this.status}.\x1b[0m\r
20
- `)}resize(e,t){if(this.ptyProcess)try{this.ptyProcess.resize(e,t)}catch(e){console.error("[SSHRunner] Failed to resize PTY:",e)}}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,workspaceRoot:this.workspaceRoot,scopedDirs:this.scopedDirs,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__4=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__4=__TURBOPACK__imported__module__14747__,__TURBOPACK__imported__module__33405__1=__TURBOPACK__imported__module__33405__;function isWindows3(){return"u">typeof process&&"win32"===process.platform}function findGitBash3(){if(!isWindows3())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__4.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__4.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__4.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__4.default.existsSync(e))||null}function getFilesForAider(e){let t=150,s=[];function r(i){if(!(s.length>=t))try{for(let o of __TURBOPACK__imported__module__22734__4.default.readdirSync(i,{withFileTypes:!0})){let n=o.name;if(n.startsWith(".")||"node_modules"===n||"out"===n||".next"===n||"bin"===n||"obj"===n||"dist"===n||"build"===n)continue;let a=__TURBOPACK__imported__module__14747__4.default.join(i,n);if(o.isDirectory())r(a);else{let r=__TURBOPACK__imported__module__14747__4.default.relative(e,a);if(s.push(r),s.length>=t)return}}}catch(e){console.error("Error reading dir for Aider files list:",e)}}return r(e),s.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(" ")}class AiderRunner extends AgentRunner{id;name;type;status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t,s){super(),this.id=e,this.type=t,this.name=s||("aider-docker"===t?`Aider Docker ${e.substring(0,8)}`:`Aider Session ${e.substring(0,8)}`),this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog(`\x1b[1;36m NEURALLOOM AIDER AGENT ROUTE (${this.type.toUpperCase()}) \x1b[0m\r
21
- `),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n");let useCmd=isWindows3(),shellPath=useCmd?process.env.COMSPEC||"cmd.exe":findGitBash3();if(!shellPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Shell not found. Cannot spawn terminal.\x1b[0m\r\n");return}let shellArgs=useCmd?["/c"]:["-c"];try{this.ptyModule||(this.ptyModule=eval("require")("node-pty"));let aiderConfig={openaiApiKey:"",anthropicApiKey:"",geminiApiKey:"",model:"claude-3-5-sonnet",extraFlags:"",loadAllFiles:!0},aiderConfigPath=__TURBOPACK__imported__module__14747__4.default.join(process.env.ORIGINAL_CWD||process.cwd(),".ai","neural-loom","aider.json");if(__TURBOPACK__imported__module__22734__4.default.existsSync(aiderConfigPath))try{aiderConfig=JSON.parse(__TURBOPACK__imported__module__22734__4.default.readFileSync(aiderConfigPath,"utf8"))}catch(err){console.error("Failed to parse Aider configuration:",err)}let customEnv={...process.env,TERM:"xterm-256color",COLORTERM:"truecolor",NEURAL_LOOM:"true"};aiderConfig.openaiApiKey&&(customEnv.OPENAI_API_KEY=aiderConfig.openaiApiKey),aiderConfig.anthropicApiKey&&(customEnv.ANTHROPIC_API_KEY=aiderConfig.anthropicApiKey),aiderConfig.geminiApiKey&&(customEnv.GEMINI_API_KEY=aiderConfig.geminiApiKey);let targetCwd=this.workspaceRoot&&__TURBOPACK__imported__module__22734__4.default.existsSync(this.workspaceRoot)?this.workspaceRoot:process.env.ORIGINAL_CWD||process.cwd(),modelFlag=aiderConfig.model?`--model ${aiderConfig.model}`:"",extraFlags=aiderConfig.extraFlags||"",loadAllFilesFlag="";if(!1!==aiderConfig.loadAllFiles&&(loadAllFilesFlag=extraFlags.includes("--no-git")?getFilesForAider(targetCwd):"."),"aider-docker"===this.type){if(this.appendLog("[System] Verifying Docker environment accessibility...\r\n"),!await new Promise(e=>{(0,__TURBOPACK__imported__module__33405__1.exec)("docker --version",{env:process.env},(t,s)=>{!t&&s.toLowerCase().includes("version")?e(!0):e(!1)})})){this.status="stopped",this.appendLog("\x1b[1;31m[Dependency Warning] Docker command not recognized in local PATH.\x1b[0m\r\n"),this.appendLog("\x1b[1;33mPlease install Docker Desktop and ensure the daemon is running.\x1b[0m\r\n");return}this.appendLog("[System] Spawning Aider container environment...\r\n");let envFlags=[];aiderConfig.openaiApiKey&&envFlags.push("-e OPENAI_API_KEY"),aiderConfig.anthropicApiKey&&envFlags.push("-e ANTHROPIC_API_KEY"),aiderConfig.geminiApiKey&&envFlags.push("-e GEMINI_API_KEY"),envFlags.push("-e NEURAL_LOOM=true");let envFlagsStr=envFlags.join(" "),mounts=[`-v "${targetCwd}:/workspace"`];this.scopedDirs&&Array.isArray(this.scopedDirs)&&this.scopedDirs.forEach(e=>{if(__TURBOPACK__imported__module__22734__4.default.existsSync(e)){let t=__TURBOPACK__imported__module__14747__4.default.basename(e).replace(/[^a-zA-Z0-9-_]/g,"_");mounts.push(`-v "${e}:/scoped/${t}"`)}});let mountsStr=mounts.join(" "),dockerCmd=`docker run -it --name neural-loom-session-${this.id} --rm ${mountsStr} -w /workspace ${envFlagsStr} paulgauthier/aider ${modelFlag} ${extraFlags} --no-fancy-input ${loadAllFilesFlag}`.trim();this.ptyProcess=this.ptyModule.spawn(shellPath,[...shellArgs,dockerCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:customEnv})}else{if(this.appendLog("[System] Verifying 'aider' command availability in local PATH...\r\n"),!await new Promise(e=>{(0,__TURBOPACK__imported__module__33405__1.exec)("aider --version",{env:process.env},(t,s)=>{!t&&s.toLowerCase().includes("aider")?e(!0):e(!1)})})){this.status="stopped",this.appendLog("\x1b[1;31m[Dependency Warning] 'aider' executable not found on local PATH.\x1b[0m\r\n"),this.appendLog("\x1b[1;33mPlease install Aider globally via pip:\r\n pip install aider-chat\x1b[0m\r\n");return}this.appendLog("[System] Spawning local Aider CLI...\r\n");let localCmd=`aider ${modelFlag} ${extraFlags} --no-fancy-input ${loadAllFilesFlag}`.trim();this.ptyProcess=this.ptyModule.spawn(shellPath,[...shellArgs,localCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:customEnv})}this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
20
+ `)}resize(e,t){if(this.ptyProcess)try{this.ptyProcess.resize(e,t)}catch(e){console.error("[SSHRunner] Failed to resize PTY:",e)}}getStatus(){return{id:this.id,name:this.name,type:this.type,status:this.status,createdAt:this.createdAt,logsCount:this.logs.length,workspaceRoot:this.workspaceRoot,scopedDirs:this.scopedDirs,tokenUsage:this.tokenUsage}}}var __TURBOPACK__imported__module__22734__4=__TURBOPACK__imported__module__22734__,__TURBOPACK__imported__module__14747__4=__TURBOPACK__imported__module__14747__,__TURBOPACK__imported__module__33405__1=__TURBOPACK__imported__module__33405__,__TURBOPACK__imported__module__98003__3=__TURBOPACK__imported__module__98003__;function isWindows3(){return"u">typeof process&&"win32"===process.platform}function findGitBash3(){if(!isWindows3())return"bash";let e=process.env.PROGRAMFILES||"C:\\Program Files",t=process.env["PROGRAMFILES(X86)"]||"C:\\Program Files (x86)",s=process.env.LOCALAPPDATA||"";return[process.env.WINGMAN_BASH_PATH,__TURBOPACK__imported__module__14747__4.default.join(e,"Git","bin","bash.exe"),__TURBOPACK__imported__module__14747__4.default.join(t,"Git","bin","bash.exe"),s?__TURBOPACK__imported__module__14747__4.default.join(s,"Programs","Git","bin","bash.exe"):""].filter(e=>"string"==typeof e&&""!==e).find(e=>__TURBOPACK__imported__module__22734__4.default.existsSync(e))||null}function getFilesForAider(e){let t=150,s=[];function r(i){if(!(s.length>=t))try{for(let o of __TURBOPACK__imported__module__22734__4.default.readdirSync(i,{withFileTypes:!0})){let n=o.name;if(n.startsWith(".")||"node_modules"===n||"out"===n||".next"===n||"bin"===n||"obj"===n||"dist"===n||"build"===n)continue;let a=__TURBOPACK__imported__module__14747__4.default.join(i,n);if(o.isDirectory())r(a);else{let r=__TURBOPACK__imported__module__14747__4.default.relative(e,a);if(s.push(r),s.length>=t)return}}}catch(e){console.error("Error reading dir for Aider files list:",e)}}return r(e),s.map(e=>`"${e.replace(/"/g,'\\"')}"`).join(" ")}class AiderRunner extends AgentRunner{id;name;type;status="idle";createdAt;logs=[];ptyProcess=null;ptyModule=null;constructor(e,t,s){super(),this.id=e,this.type=t,this.name=s||("aider-docker"===t?`Aider Docker ${e.substring(0,8)}`:`Aider Session ${e.substring(0,8)}`),this.createdAt=new Date().toISOString()}appendLog(e){this.logs.push(e),this.logs.length>5e3&&this.logs.shift(),this.parseTokenUsage(e),this.emitOutput(e),SessionPersister.saveSession(this)}async start(){if("running"===this.status)return;this.status="running",this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n"),this.appendLog(`\x1b[1;36m NEURALLOOM AIDER AGENT ROUTE (${this.type.toUpperCase()}) \x1b[0m\r
21
+ `),this.appendLog("\x1b[1;35m==================================================\x1b[0m\r\n");let useCmd=isWindows3(),shellPath=useCmd?process.env.COMSPEC||"cmd.exe":findGitBash3();if(!shellPath){this.status="stopped",this.appendLog("\x1b[1;31m[System Error] Shell not found. Cannot spawn terminal.\x1b[0m\r\n");return}let shellArgs=useCmd?["/c"]:["-c"];try{this.ptyModule||(this.ptyModule=eval("require")("node-pty"));let aiderConfig={openaiApiKey:"",anthropicApiKey:"",geminiApiKey:"",model:"claude-3-5-sonnet",extraFlags:"",loadAllFiles:!0},aiderConfigPath=__TURBOPACK__imported__module__14747__4.default.join((0,__TURBOPACK__imported__module__98003__3.getConfigDir)(),"aider.json");if(__TURBOPACK__imported__module__22734__4.default.existsSync(aiderConfigPath))try{aiderConfig=JSON.parse(__TURBOPACK__imported__module__22734__4.default.readFileSync(aiderConfigPath,"utf8"))}catch(err){console.error("Failed to parse Aider configuration:",err)}let customEnv={...process.env,TERM:"xterm-256color",COLORTERM:"truecolor",NEURAL_LOOM:"true"};aiderConfig.openaiApiKey&&(customEnv.OPENAI_API_KEY=aiderConfig.openaiApiKey),aiderConfig.anthropicApiKey&&(customEnv.ANTHROPIC_API_KEY=aiderConfig.anthropicApiKey),aiderConfig.geminiApiKey&&(customEnv.GEMINI_API_KEY=aiderConfig.geminiApiKey);let targetCwd=this.workspaceRoot&&__TURBOPACK__imported__module__22734__4.default.existsSync(this.workspaceRoot)?this.workspaceRoot:process.env.ORIGINAL_CWD||process.cwd(),modelFlag=aiderConfig.model?`--model ${aiderConfig.model}`:"",extraFlags=aiderConfig.extraFlags||"",loadAllFilesFlag="";if(!1!==aiderConfig.loadAllFiles&&(loadAllFilesFlag=extraFlags.includes("--no-git")?getFilesForAider(targetCwd):"."),"aider-docker"===this.type){if(this.appendLog("[System] Verifying Docker environment accessibility...\r\n"),!await new Promise(e=>{(0,__TURBOPACK__imported__module__33405__1.exec)("docker --version",{env:process.env},(t,s)=>{!t&&s.toLowerCase().includes("version")?e(!0):e(!1)})})){this.status="stopped",this.appendLog("\x1b[1;31m[Dependency Warning] Docker command not recognized in local PATH.\x1b[0m\r\n"),this.appendLog("\x1b[1;33mPlease install Docker Desktop and ensure the daemon is running.\x1b[0m\r\n");return}this.appendLog("[System] Spawning Aider container environment...\r\n");let envFlags=[];aiderConfig.openaiApiKey&&envFlags.push("-e OPENAI_API_KEY"),aiderConfig.anthropicApiKey&&envFlags.push("-e ANTHROPIC_API_KEY"),aiderConfig.geminiApiKey&&envFlags.push("-e GEMINI_API_KEY"),envFlags.push("-e NEURAL_LOOM=true");let envFlagsStr=envFlags.join(" "),mounts=[`-v "${targetCwd}:/workspace"`];this.scopedDirs&&Array.isArray(this.scopedDirs)&&this.scopedDirs.forEach(e=>{if(__TURBOPACK__imported__module__22734__4.default.existsSync(e)){let t=__TURBOPACK__imported__module__14747__4.default.basename(e).replace(/[^a-zA-Z0-9-_]/g,"_");mounts.push(`-v "${e}:/scoped/${t}"`)}});let mountsStr=mounts.join(" "),dockerCmd=`docker run -it --name neural-loom-session-${this.id} --rm ${mountsStr} -w /workspace ${envFlagsStr} paulgauthier/aider ${modelFlag} ${extraFlags} --no-fancy-input ${loadAllFilesFlag}`.trim();this.ptyProcess=this.ptyModule.spawn(shellPath,[...shellArgs,dockerCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:customEnv})}else{if(this.appendLog("[System] Verifying 'aider' command availability in local PATH...\r\n"),!await new Promise(e=>{(0,__TURBOPACK__imported__module__33405__1.exec)("aider --version",{env:process.env},(t,s)=>{!t&&s.toLowerCase().includes("aider")?e(!0):e(!1)})})){this.status="stopped",this.appendLog("\x1b[1;31m[Dependency Warning] 'aider' executable not found on local PATH.\x1b[0m\r\n"),this.appendLog("\x1b[1;33mPlease install Aider globally via pip:\r\n pip install aider-chat\x1b[0m\r\n");return}this.appendLog("[System] Spawning local Aider CLI...\r\n");let localCmd=`aider ${modelFlag} ${extraFlags} --no-fancy-input ${loadAllFilesFlag}`.trim();this.ptyProcess=this.ptyModule.spawn(shellPath,[...shellArgs,localCmd],{name:"xterm-256color",cols:120,rows:30,cwd:targetCwd,env:customEnv})}this.ptyProcess.onData(e=>{this.appendLog(e)}),this.ptyProcess.onExit(({exitCode:e,signal:t})=>{this.status="stopped",this.appendLog(`\r
22
22
  \x1b[1;31m[System] Aider process exited (code=${e}, signal=${t}).\x1b[0m\r
23
23
  `),this.ptyProcess=null})}catch(err){let errorMessage=err instanceof Error?err.message:"Unknown error";this.status="stopped",this.appendLog(`\x1b[1;31m[System Error] Failed to launch Aider: ${errorMessage}\x1b[0m\r
24
24
  `)}}async stop(){if(this.status="stopped",this.ptyProcess){try{this.ptyProcess.kill()}catch(e){console.error("Error killing Aider PTY process:",e)}this.ptyProcess=null}this.appendLog("\r\n\x1b[1;31m[System] Aider session terminated.\x1b[0m\r\n")}async sendInput(e,t=!1){"running"===this.status&&this.ptyProcess?this.ptyProcess.write(t?e:e+"\r"):this.appendLog(`\r