@jingyi0605/codingns 0.8.0 → 0.8.1

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 (425) hide show
  1. package/dist/public/assets/{AdaptiveButlerPage-BsgVNRAa.js → AdaptiveButlerPage-b7s6F_sd.js} +1 -1
  2. package/dist/public/assets/{App-tPcbyRdS.js → App-B0q8uDA-.js} +3 -3
  3. package/dist/public/assets/{BootstrapPage--MDOigQi.js → BootstrapPage-jFfl7KNK.js} +1 -1
  4. package/dist/public/assets/{ConversationPage-BBss5ED8.js → ConversationPage-sj_rn4q0.js} +1 -1
  5. package/dist/public/assets/{DesktopDetachPreviewPage-CB8DoqwU.js → DesktopDetachPreviewPage-C5c88SOX.js} +1 -1
  6. package/dist/public/assets/{DesktopWindowPage-GtIx5m8K.js → DesktopWindowPage-BdKUZrKG.js} +1 -1
  7. package/dist/public/assets/{FileContextPanel-BcM7AIT4.js → FileContextPanel-lM5mBcfn.js} +1 -1
  8. package/dist/public/assets/{GitSidebar-CMtkaxuI.js → GitSidebar-CmXAhyjo.js} +1 -1
  9. package/dist/public/assets/{MobileCreateSessionSheet-CrFY41_8.js → MobileCreateSessionSheet-CceV0-AH.js} +1 -1
  10. package/dist/public/assets/{MobileTopHeaderFrame-DGVOzXyg.js → MobileTopHeaderFrame-_I0t7cC_.js} +1 -1
  11. package/dist/public/assets/{MobileWorkspaceSwitcherHeader-DLkACTnQ.js → MobileWorkspaceSwitcherHeader-DhaM9fgx.js} +1 -1
  12. package/dist/public/assets/{RelayConnectEntryPage-0MPPjxtQ.js → RelayConnectEntryPage-CMtDWyGS.js} +1 -1
  13. package/dist/public/assets/{ServerSettingsModal-vgOhwus4.js → ServerSettingsModal-Rkgn3jft.js} +1 -1
  14. package/dist/public/assets/{SessionIndexPage-KK626Ra9.js → SessionIndexPage-BOumP3ij.js} +1 -1
  15. package/dist/public/assets/{SettingsPage-B3edBJIo.js → SettingsPage-vx_c-00-.js} +1 -1
  16. package/dist/public/assets/{TerminalManagerPanel-BxlhZp8c.js → TerminalManagerPanel-D9JHCS6d.js} +1 -1
  17. package/dist/public/assets/{TerminalPage-B6Rdhylx.js → TerminalPage-CBIKHI33.js} +1 -1
  18. package/dist/public/assets/{TerminalRuntimeFallbackModal-BVLfrpSa.js → TerminalRuntimeFallbackModal-W5NjqFEz.js} +1 -1
  19. package/dist/public/assets/{ToolFilesPage-N_gwwUjD.js → ToolFilesPage-DWtpaN_7.js} +1 -1
  20. package/dist/public/assets/{ToolGitPage-DOcuuWM1.js → ToolGitPage-MpGXsw4_.js} +1 -1
  21. package/dist/public/assets/{ToolProcessesPage-D-FfJ7Re.js → ToolProcessesPage-B1jHQKhZ.js} +1 -1
  22. package/dist/public/assets/{ToolsHomePage-CHfPxd20.js → ToolsHomePage-CJrn8ZFl.js} +1 -1
  23. package/dist/public/assets/{WorkbenchLandingPage-CTTnfovY.js → WorkbenchLandingPage-CJQ1V5U-.js} +1 -1
  24. package/dist/public/assets/{WorkbenchLayout-CbpJg0g1.js → WorkbenchLayout-D48i71PU.js} +3 -3
  25. package/dist/public/assets/{WorkbenchModal-Bt_1fYmM.js → WorkbenchModal-BYNuMIoV.js} +1 -1
  26. package/dist/public/assets/WorkbenchShellRoute-CGKjy4J-.js +1 -0
  27. package/dist/public/assets/{WorkspaceDebugDetailPage-s7yuDIxR.js → WorkspaceDebugDetailPage-DCAYgays.js} +1 -1
  28. package/dist/public/assets/{WorkspaceDetailPage-Cf-gVpqK.js → WorkspaceDetailPage-D5v-nUIi.js} +1 -1
  29. package/dist/public/assets/{WorkspaceHomePage-COf6I8sT.js → WorkspaceHomePage-I5G1p5SR.js} +1 -1
  30. package/dist/public/assets/{client-runtime-manager-DGdKvYzx.js → client-runtime-manager-CdJP7nUp.js} +1 -1
  31. package/dist/public/assets/{file-tree-icon-BeHqeru9.js → file-tree-icon-BFwaPxKs.js} +6 -6
  32. package/dist/public/assets/{index-CuzMc7q2.js → index-CjewzOUG.js} +3 -3
  33. package/dist/public/assets/{index-CcaQt50x.css → index-VVxfF0s5.css} +1 -1
  34. package/dist/public/assets/{login-direct-candidate-resolver-DEP_xCmR.js → login-direct-candidate-resolver-C-mo698r.js} +1 -1
  35. package/dist/public/assets/{model-switch-api-c6kcbBGm.js → model-switch-api-Br0ivfe5.js} +1 -1
  36. package/dist/public/assets/{preferences-service-CV6Ih0BG.js → preferences-service-CnaTvZq2.js} +1 -1
  37. package/dist/public/assets/{realtime-client-CRCx5xBt.js → realtime-client-BlQRqVmm.js} +1 -1
  38. package/dist/public/assets/{relay-entry-C751A-Sm.js → relay-entry-D7OgZZN-.js} +1 -1
  39. package/dist/public/assets/{terminal-runtime-meta-CRAVR-8G.js → terminal-runtime-meta-BCtAYB0E.js} +1 -1
  40. package/dist/public/assets/{useRegisteredDebugTemplates-D6YtNS0r.js → useRegisteredDebugTemplates-CXmxu69X.js} +1 -1
  41. package/dist/public/index.html +2 -2
  42. package/dist/server/main.js +2 -0
  43. package/dist/server/main.js.map +1 -1
  44. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +1 -0
  45. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +1 -0
  46. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  47. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +1 -0
  48. package/dist/server/modules/assistant-capability/assistant-capability-service.js +1 -0
  49. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  50. package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +2 -1
  51. package/dist/server/modules/browser-runtime/browser-runtime-controller.js +1 -0
  52. package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -1
  53. package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +4 -1
  54. package/dist/server/modules/browser-runtime/browser-runtime-service.js +40 -0
  55. package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -1
  56. package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +2 -0
  57. package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -1
  58. package/dist/server/modules/git/git-command-helper-process.js +0 -18
  59. package/dist/server/modules/git/git-command-helper-process.js.map +1 -1
  60. package/dist/server/modules/git/git-command-runner.js +0 -18
  61. package/dist/server/modules/git/git-command-runner.js.map +1 -1
  62. package/dist/server/modules/sessions/session-live-runtime-service.js +46 -3
  63. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  64. package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +1 -0
  65. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +11 -2
  66. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
  67. package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +2 -2
  68. package/dist/server/shared/http/error-handler.js +53 -19
  69. package/dist/server/shared/http/error-handler.js.map +1 -1
  70. package/dist/server/shared/utils/install-console-timestamp-prefix.d.ts +1 -0
  71. package/dist/server/shared/utils/install-console-timestamp-prefix.js +28 -0
  72. package/dist/server/shared/utils/install-console-timestamp-prefix.js.map +1 -0
  73. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +42 -0
  74. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +346 -0
  75. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -0
  76. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
  77. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
  78. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
  79. package/node_modules/@codingns/session-sync-core/dist/index.d.ts +18 -0
  80. package/node_modules/@codingns/session-sync-core/dist/index.js +19 -0
  81. package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -0
  82. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +18 -0
  83. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +659 -0
  84. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +1 -0
  85. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +11 -0
  86. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +72 -0
  87. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +1 -0
  88. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +67 -0
  89. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +752 -0
  90. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -0
  91. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +48 -0
  92. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +1184 -0
  93. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -0
  94. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +11 -0
  95. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +105 -0
  96. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +1 -0
  97. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +84 -0
  98. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +2436 -0
  99. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -0
  100. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +47 -0
  101. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +1480 -0
  102. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -0
  103. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +33 -0
  104. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +684 -0
  105. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -0
  106. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +9 -0
  107. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +17 -0
  108. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +1 -0
  109. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +1 -0
  110. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +8 -0
  111. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +1 -0
  112. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +48 -0
  113. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +373 -0
  114. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -0
  115. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +61 -0
  116. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +1191 -0
  117. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -0
  118. package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +27 -0
  119. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +415 -0
  120. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +1 -0
  121. package/node_modules/@codingns/session-sync-core/dist/registry.d.ts +7 -0
  122. package/node_modules/@codingns/session-sync-core/dist/registry.js +22 -0
  123. package/node_modules/@codingns/session-sync-core/dist/registry.js.map +1 -0
  124. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +24 -0
  125. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +329 -0
  126. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -0
  127. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +30 -0
  128. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +939 -0
  129. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -0
  130. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +1 -0
  131. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +16 -0
  132. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -0
  133. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +70 -0
  134. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +2571 -0
  135. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -0
  136. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +21 -0
  137. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +561 -0
  138. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +1 -0
  139. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +38 -0
  140. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +911 -0
  141. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +1 -0
  142. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +15 -0
  143. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +16 -0
  144. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +1 -0
  145. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +38 -0
  146. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +970 -0
  147. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -0
  148. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +21 -0
  149. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +168 -0
  150. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -0
  151. package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +152 -0
  152. package/node_modules/@codingns/session-sync-core/dist/runtime/types.js +2 -0
  153. package/node_modules/@codingns/session-sync-core/dist/runtime/types.js.map +1 -0
  154. package/node_modules/@codingns/session-sync-core/dist/services.d.ts +28 -0
  155. package/node_modules/@codingns/session-sync-core/dist/services.js +148 -0
  156. package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -0
  157. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +6 -0
  158. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +9 -0
  159. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +1 -0
  160. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +198 -0
  161. package/node_modules/@codingns/session-sync-core/dist/types.js +2 -0
  162. package/node_modules/@codingns/session-sync-core/dist/types.js.map +1 -0
  163. package/node_modules/@codingns/session-sync-core/package.json +33 -0
  164. package/package.json +6 -4
  165. package/vendor/node-pty-fork/LICENSE +69 -0
  166. package/vendor/node-pty-fork/README.md +91 -0
  167. package/vendor/node-pty-fork/binding.gyp +117 -0
  168. package/vendor/node-pty-fork/deps/.editorconfig +2 -0
  169. package/vendor/node-pty-fork/deps/winpty/.drone.yml +17 -0
  170. package/vendor/node-pty-fork/deps/winpty/.gitattributes +19 -0
  171. package/vendor/node-pty-fork/deps/winpty/LICENSE +21 -0
  172. package/vendor/node-pty-fork/deps/winpty/Makefile +166 -0
  173. package/vendor/node-pty-fork/deps/winpty/README.md +151 -0
  174. package/vendor/node-pty-fork/deps/winpty/RELEASES.md +280 -0
  175. package/vendor/node-pty-fork/deps/winpty/VERSION.txt +1 -0
  176. package/vendor/node-pty-fork/deps/winpty/configure +167 -0
  177. package/vendor/node-pty-fork/deps/winpty/misc/BufferResizeTests.cc +90 -0
  178. package/vendor/node-pty-fork/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  179. package/vendor/node-pty-fork/deps/winpty/misc/ClearConsole.cc +72 -0
  180. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.cc +117 -0
  181. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.ps1 +116 -0
  182. package/vendor/node-pty-fork/deps/winpty/misc/ConoutMode.cc +113 -0
  183. package/vendor/node-pty-fork/deps/winpty/misc/DebugClient.py +42 -0
  184. package/vendor/node-pty-fork/deps/winpty/misc/DebugServer.py +63 -0
  185. package/vendor/node-pty-fork/deps/winpty/misc/DumpLines.py +5 -0
  186. package/vendor/node-pty-fork/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  187. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  188. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  189. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  190. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  191. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  192. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  193. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  194. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  195. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  196. package/vendor/node-pty-fork/deps/winpty/misc/FontSurvey.cc +100 -0
  197. package/vendor/node-pty-fork/deps/winpty/misc/FormatChar.h +21 -0
  198. package/vendor/node-pty-fork/deps/winpty/misc/FreezePerfTest.cc +62 -0
  199. package/vendor/node-pty-fork/deps/winpty/misc/GetCh.cc +20 -0
  200. package/vendor/node-pty-fork/deps/winpty/misc/GetConsolePos.cc +41 -0
  201. package/vendor/node-pty-fork/deps/winpty/misc/GetFont.cc +261 -0
  202. package/vendor/node-pty-fork/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  203. package/vendor/node-pty-fork/deps/winpty/misc/IsNewConsole.cc +87 -0
  204. package/vendor/node-pty-fork/deps/winpty/misc/MouseInputNotes.txt +90 -0
  205. package/vendor/node-pty-fork/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  206. package/vendor/node-pty-fork/deps/winpty/misc/Notes.txt +219 -0
  207. package/vendor/node-pty-fork/deps/winpty/misc/OSVersion.cc +27 -0
  208. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  209. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  210. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  211. package/vendor/node-pty-fork/deps/winpty/misc/SelectAllTest.cc +45 -0
  212. package/vendor/node-pty-fork/deps/winpty/misc/SetBufferSize.cc +32 -0
  213. package/vendor/node-pty-fork/deps/winpty/misc/SetCursorPos.cc +10 -0
  214. package/vendor/node-pty-fork/deps/winpty/misc/SetFont.cc +145 -0
  215. package/vendor/node-pty-fork/deps/winpty/misc/SetWindowRect.cc +36 -0
  216. package/vendor/node-pty-fork/deps/winpty/misc/ShowArgv.cc +12 -0
  217. package/vendor/node-pty-fork/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  218. package/vendor/node-pty-fork/deps/winpty/misc/Spew.py +5 -0
  219. package/vendor/node-pty-fork/deps/winpty/misc/TestUtil.cc +172 -0
  220. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  221. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  222. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  223. package/vendor/node-pty-fork/deps/winpty/misc/UnixEcho.cc +89 -0
  224. package/vendor/node-pty-fork/deps/winpty/misc/Utf16Echo.cc +46 -0
  225. package/vendor/node-pty-fork/deps/winpty/misc/VeryLargeRead.cc +122 -0
  226. package/vendor/node-pty-fork/deps/winpty/misc/VkEscapeTest.cc +56 -0
  227. package/vendor/node-pty-fork/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  228. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  229. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  230. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo1.cc +26 -0
  231. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo2.cc +19 -0
  232. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test1.cc +46 -0
  233. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test2.cc +70 -0
  234. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test3.cc +78 -0
  235. package/vendor/node-pty-fork/deps/winpty/misc/Win32Write1.cc +44 -0
  236. package/vendor/node-pty-fork/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  237. package/vendor/node-pty-fork/deps/winpty/misc/WriteConsole.cc +106 -0
  238. package/vendor/node-pty-fork/deps/winpty/misc/build32.sh +9 -0
  239. package/vendor/node-pty-fork/deps/winpty/misc/build64.sh +9 -0
  240. package/vendor/node-pty-fork/deps/winpty/misc/color-test.sh +212 -0
  241. package/vendor/node-pty-fork/deps/winpty/misc/font-notes.txt +300 -0
  242. package/vendor/node-pty-fork/deps/winpty/misc/winbug-15048.cc +201 -0
  243. package/vendor/node-pty-fork/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  244. package/vendor/node-pty-fork/deps/winpty/ship/common_ship.py +53 -0
  245. package/vendor/node-pty-fork/deps/winpty/ship/make_msvc_package.py +165 -0
  246. package/vendor/node-pty-fork/deps/winpty/ship/ship.py +108 -0
  247. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.cc +605 -0
  248. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.h +103 -0
  249. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  250. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  251. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  252. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.h +28 -0
  253. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  254. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.h +109 -0
  255. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  256. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  257. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  258. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.h +41 -0
  259. package/vendor/node-pty-fork/deps/winpty/src/agent/Coord.h +87 -0
  260. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  261. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.h +32 -0
  262. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  263. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  264. package/vendor/node-pty-fork/deps/winpty/src/agent/DsrSender.h +30 -0
  265. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.cc +99 -0
  266. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.h +47 -0
  267. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.cc +246 -0
  268. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.h +114 -0
  269. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  270. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  271. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.cc +378 -0
  272. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.h +125 -0
  273. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.cc +699 -0
  274. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.h +103 -0
  275. package/vendor/node-pty-fork/deps/winpty/src/agent/SimplePool.h +75 -0
  276. package/vendor/node-pty-fork/deps/winpty/src/agent/SmallRect.h +143 -0
  277. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.cc +535 -0
  278. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.h +69 -0
  279. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  280. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  281. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.cc +107 -0
  282. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.h +67 -0
  283. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  284. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  285. package/vendor/node-pty-fork/deps/winpty/src/agent/main.cc +114 -0
  286. package/vendor/node-pty-fork/deps/winpty/src/agent/subdir.mk +61 -0
  287. package/vendor/node-pty-fork/deps/winpty/src/configurations.gypi +60 -0
  288. package/vendor/node-pty-fork/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  289. package/vendor/node-pty-fork/deps/winpty/src/debugserver/subdir.mk +41 -0
  290. package/vendor/node-pty-fork/deps/winpty/src/include/winpty.h +242 -0
  291. package/vendor/node-pty-fork/deps/winpty/src/include/winpty_constants.h +131 -0
  292. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  293. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  294. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  295. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  296. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/subdir.mk +46 -0
  297. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/winpty.cc +970 -0
  298. package/vendor/node-pty-fork/deps/winpty/src/shared/AgentMsg.h +38 -0
  299. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  300. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  301. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.cc +103 -0
  302. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.h +102 -0
  303. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.cc +187 -0
  304. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.h +38 -0
  305. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.cc +138 -0
  306. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.h +55 -0
  307. package/vendor/node-pty-fork/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  308. package/vendor/node-pty-fork/deps/winpty/src/shared/Mutex.h +54 -0
  309. package/vendor/node-pty-fork/deps/winpty/src/shared/OsModule.h +63 -0
  310. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  311. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.h +45 -0
  312. package/vendor/node-pty-fork/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  313. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilder.h +227 -0
  314. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  315. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.cc +55 -0
  316. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.h +80 -0
  317. package/vendor/node-pty-fork/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  318. package/vendor/node-pty-fork/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  319. package/vendor/node-pty-fork/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  320. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  321. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  322. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  323. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.h +29 -0
  324. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  325. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.h +64 -0
  326. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.cc +57 -0
  327. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.h +43 -0
  328. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  329. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.h +27 -0
  330. package/vendor/node-pty-fork/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  331. package/vendor/node-pty-fork/deps/winpty/src/subdir.mk +5 -0
  332. package/vendor/node-pty-fork/deps/winpty/src/tests/subdir.mk +28 -0
  333. package/vendor/node-pty-fork/deps/winpty/src/tests/trivial_test.cc +158 -0
  334. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  335. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  336. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  337. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  338. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.cc +86 -0
  339. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.h +31 -0
  340. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  341. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  342. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/main.cc +729 -0
  343. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  344. package/vendor/node-pty-fork/deps/winpty/src/winpty.gyp +206 -0
  345. package/vendor/node-pty-fork/deps/winpty/vcbuild.bat +83 -0
  346. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js +20 -0
  347. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js.map +1 -0
  348. package/vendor/node-pty-fork/lib/eventEmitter2.js +47 -0
  349. package/vendor/node-pty-fork/lib/eventEmitter2.js.map +1 -0
  350. package/vendor/node-pty-fork/lib/eventEmitter2.test.js +30 -0
  351. package/vendor/node-pty-fork/lib/eventEmitter2.test.js.map +1 -0
  352. package/vendor/node-pty-fork/lib/index.js +51 -0
  353. package/vendor/node-pty-fork/lib/index.js.map +1 -0
  354. package/vendor/node-pty-fork/lib/interfaces.js +7 -0
  355. package/vendor/node-pty-fork/lib/interfaces.js.map +1 -0
  356. package/vendor/node-pty-fork/lib/shared/conout.js +11 -0
  357. package/vendor/node-pty-fork/lib/shared/conout.js.map +1 -0
  358. package/vendor/node-pty-fork/lib/terminal.js +190 -0
  359. package/vendor/node-pty-fork/lib/terminal.js.map +1 -0
  360. package/vendor/node-pty-fork/lib/terminal.test.js +139 -0
  361. package/vendor/node-pty-fork/lib/terminal.test.js.map +1 -0
  362. package/vendor/node-pty-fork/lib/testUtils.test.js +28 -0
  363. package/vendor/node-pty-fork/lib/testUtils.test.js.map +1 -0
  364. package/vendor/node-pty-fork/lib/types.js +7 -0
  365. package/vendor/node-pty-fork/lib/types.js.map +1 -0
  366. package/vendor/node-pty-fork/lib/unixTerminal.js +304 -0
  367. package/vendor/node-pty-fork/lib/unixTerminal.js.map +1 -0
  368. package/vendor/node-pty-fork/lib/unixTerminal.test.js +330 -0
  369. package/vendor/node-pty-fork/lib/unixTerminal.test.js.map +1 -0
  370. package/vendor/node-pty-fork/lib/utils.js +17 -0
  371. package/vendor/node-pty-fork/lib/utils.js.map +1 -0
  372. package/vendor/node-pty-fork/lib/windowsConoutConnection.js +122 -0
  373. package/vendor/node-pty-fork/lib/windowsConoutConnection.js.map +1 -0
  374. package/vendor/node-pty-fork/lib/windowsPtyAgent.js +324 -0
  375. package/vendor/node-pty-fork/lib/windowsPtyAgent.js.map +1 -0
  376. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js +90 -0
  377. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js.map +1 -0
  378. package/vendor/node-pty-fork/lib/windowsTerminal.js +201 -0
  379. package/vendor/node-pty-fork/lib/windowsTerminal.js.map +1 -0
  380. package/vendor/node-pty-fork/lib/windowsTerminal.test.js +203 -0
  381. package/vendor/node-pty-fork/lib/windowsTerminal.test.js.map +1 -0
  382. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js +22 -0
  383. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js.map +1 -0
  384. package/vendor/node-pty-fork/package.json +35 -0
  385. package/vendor/node-pty-fork/scripts/apply-patches.mjs +341 -0
  386. package/vendor/node-pty-fork/scripts/fetch-upstream.mjs +41 -0
  387. package/vendor/node-pty-fork/scripts/install-smoke.cjs +59 -0
  388. package/vendor/node-pty-fork/scripts/smoke-load.cjs +10 -0
  389. package/vendor/node-pty-fork/scripts/sync-upstream.mjs +29 -0
  390. package/vendor/node-pty-fork/scripts/verify-runtime.cjs +54 -0
  391. package/vendor/node-pty-fork/scripts/verify-runtime.test.cjs +22 -0
  392. package/vendor/node-pty-fork/scripts/verify-tarball.cjs +80 -0
  393. package/vendor/node-pty-fork/src/conpty_console_list_agent.ts +19 -0
  394. package/vendor/node-pty-fork/src/eventEmitter2.test.ts +30 -0
  395. package/vendor/node-pty-fork/src/eventEmitter2.ts +48 -0
  396. package/vendor/node-pty-fork/src/index.ts +51 -0
  397. package/vendor/node-pty-fork/src/interfaces.ts +129 -0
  398. package/vendor/node-pty-fork/src/native.d.ts +56 -0
  399. package/vendor/node-pty-fork/src/shared/conout.ts +15 -0
  400. package/vendor/node-pty-fork/src/terminal.test.ts +119 -0
  401. package/vendor/node-pty-fork/src/terminal.ts +211 -0
  402. package/vendor/node-pty-fork/src/testUtils.test.ts +23 -0
  403. package/vendor/node-pty-fork/src/tsconfig.json +22 -0
  404. package/vendor/node-pty-fork/src/types.ts +15 -0
  405. package/vendor/node-pty-fork/src/unix/pty.cc +826 -0
  406. package/vendor/node-pty-fork/src/unix/spawn-helper.cc +23 -0
  407. package/vendor/node-pty-fork/src/unixTerminal.test.ts +335 -0
  408. package/vendor/node-pty-fork/src/unixTerminal.ts +320 -0
  409. package/vendor/node-pty-fork/src/utils.ts +9 -0
  410. package/vendor/node-pty-fork/src/win/conpty.cc +500 -0
  411. package/vendor/node-pty-fork/src/win/conpty_console_list.cc +43 -0
  412. package/vendor/node-pty-fork/src/win/path_util.cc +73 -0
  413. package/vendor/node-pty-fork/src/win/path_util.h +22 -0
  414. package/vendor/node-pty-fork/src/win/winpty.cc +322 -0
  415. package/vendor/node-pty-fork/src/windowsConoutConnection.ts +79 -0
  416. package/vendor/node-pty-fork/src/windowsPtyAgent.test.ts +94 -0
  417. package/vendor/node-pty-fork/src/windowsPtyAgent.ts +323 -0
  418. package/vendor/node-pty-fork/src/windowsTerminal.test.ts +214 -0
  419. package/vendor/node-pty-fork/src/windowsTerminal.ts +208 -0
  420. package/vendor/node-pty-fork/src/worker/conoutSocketWorker.ts +22 -0
  421. package/vendor/node-pty-fork/typings/node-pty.d.ts +203 -0
  422. package/dist/public/assets/WorkbenchShellRoute-DyaMnPfS.js +0 -1
  423. package/dist/server/modules/channels/wechat-claw-client.d.ts +0 -51
  424. package/dist/server/modules/channels/wechat-claw-client.js +0 -245
  425. package/dist/server/modules/channels/wechat-claw-client.js.map +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js","assets/ServerSettingsModal-vgOhwus4.js","assets/index-CuzMc7q2.js","assets/index-CcaQt50x.css","assets/relay-entry-C751A-Sm.js","assets/WorkbenchModal-Bt_1fYmM.js","assets/BootstrapPage--MDOigQi.js","assets/RelayConnectEntryPage-0MPPjxtQ.js","assets/DesktopDetachPreviewPage-CB8DoqwU.js","assets/DesktopWindowPage-GtIx5m8K.js","assets/model-switch-api-c6kcbBGm.js","assets/FileContextPanel-BcM7AIT4.js","assets/WorkbenchLayout-CbpJg0g1.js","assets/file-tree-icon-BeHqeru9.js","assets/GitSidebar-CMtkaxuI.js","assets/TerminalManagerPanel-BxlhZp8c.js","assets/terminal-runtime-meta-CRAVR-8G.js","assets/TerminalRuntimeFallbackModal-BVLfrpSa.js","assets/TerminalPage-B6Rdhylx.js","assets/MobileWorkspaceSwitcherHeader-DLkACTnQ.js","assets/MobileTopHeaderFrame-DGVOzXyg.js","assets/TerminalPage-6GBZ9nXN.css","assets/WorkbenchShellRoute-DyaMnPfS.js","assets/WorkbenchShellRoute-B4XB8SwG.css","assets/WorkbenchLandingPage-CTTnfovY.js","assets/WorkspaceHomePage-COf6I8sT.js","assets/butler-records-events-DgWCG364.js","assets/MobileCreateSessionSheet-CrFY41_8.js","assets/WorkspaceDetailPage-Cf-gVpqK.js","assets/useRegisteredDebugTemplates-D6YtNS0r.js","assets/WorkspaceDebugDetailPage-s7yuDIxR.js","assets/SessionIndexPage-KK626Ra9.js","assets/styles-JKFlsYFv.js","assets/styles-DkbkRgWw.css","assets/ConversationPage-BBss5ED8.js","assets/realtime-client-CRCx5xBt.js","assets/ToolsHomePage-CHfPxd20.js","assets/ToolFilesPage-N_gwwUjD.js","assets/ToolGitPage-DOcuuWM1.js","assets/ToolProcessesPage-D-FfJ7Re.js","assets/AdaptiveButlerPage-BsgVNRAa.js","assets/AdaptiveButlerPage-B153lk5H.css","assets/SettingsPage-B3edBJIo.js"])))=>i.map(i=>d[i]);
2
- var In=Object.defineProperty;var Un=(e,t,r)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Re=(e,t,r)=>Un(e,typeof t!="symbol"?t+"":t,r);import{u as qe,j as m,t as be,a as Jt,g as On,r as An,b as h,R as kn,c as ct,_ as Y,d as Fn,e as ye,f as Xe,h as Ct,n as Br,i as Hr,k as Vn,l as zn,m as Rt,o as Bn,p as Hn,q as Wn,s as $n,v as Kn,w as Bt,x as Yn,y as Gn,z as Jn,A as Xn,B as qn,I as Qn}from"./index-CuzMc7q2.js";function Zn(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(n,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ea=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function ta({variant:e="default",className:t}){const r=qe(a=>a.profile.language);function n(a){a!==r&&Jt({language:a}).catch(()=>{})}return m.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[m.jsx("span",{className:"language-switcher-label",children:be("common.language")}),m.jsx("div",{className:"language-switcher-options",role:"group","aria-label":be("common.language"),children:ea.map(a=>m.jsx("button",{type:"button",className:`language-switcher-option${r===a.id?" active":""}`,"aria-pressed":r===a.id,onClick:()=>n(a.id),children:be(a.labelKey)},a.id))})]})}var Wr=An();const ra=On(Wr),na=Zn({__proto__:null,default:ra},[Wr]);/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js","assets/ServerSettingsModal-Rkgn3jft.js","assets/index-CjewzOUG.js","assets/index-VVxfF0s5.css","assets/relay-entry-D7OgZZN-.js","assets/WorkbenchModal-BYNuMIoV.js","assets/BootstrapPage-jFfl7KNK.js","assets/RelayConnectEntryPage-CMtDWyGS.js","assets/DesktopDetachPreviewPage-C5c88SOX.js","assets/DesktopWindowPage-BdKUZrKG.js","assets/model-switch-api-Br0ivfe5.js","assets/FileContextPanel-lM5mBcfn.js","assets/WorkbenchLayout-D48i71PU.js","assets/file-tree-icon-BFwaPxKs.js","assets/GitSidebar-CmXAhyjo.js","assets/TerminalManagerPanel-D9JHCS6d.js","assets/terminal-runtime-meta-BCtAYB0E.js","assets/TerminalRuntimeFallbackModal-W5NjqFEz.js","assets/TerminalPage-CBIKHI33.js","assets/MobileWorkspaceSwitcherHeader-DhaM9fgx.js","assets/MobileTopHeaderFrame-_I0t7cC_.js","assets/TerminalPage-6GBZ9nXN.css","assets/WorkbenchShellRoute-CGKjy4J-.js","assets/WorkbenchShellRoute-B4XB8SwG.css","assets/WorkbenchLandingPage-CJQ1V5U-.js","assets/WorkspaceHomePage-I5G1p5SR.js","assets/butler-records-events-DgWCG364.js","assets/MobileCreateSessionSheet-CceV0-AH.js","assets/WorkspaceDetailPage-D5v-nUIi.js","assets/useRegisteredDebugTemplates-CXmxu69X.js","assets/WorkspaceDebugDetailPage-DCAYgays.js","assets/SessionIndexPage-BOumP3ij.js","assets/styles-JKFlsYFv.js","assets/styles-DkbkRgWw.css","assets/ConversationPage-sj_rn4q0.js","assets/realtime-client-BlQRqVmm.js","assets/ToolsHomePage-CJrn8ZFl.js","assets/ToolFilesPage-DWtpaN_7.js","assets/ToolGitPage-MpGXsw4_.js","assets/ToolProcessesPage-B1jHQKhZ.js","assets/AdaptiveButlerPage-b7s6F_sd.js","assets/AdaptiveButlerPage-B153lk5H.css","assets/SettingsPage-vx_c-00-.js"])))=>i.map(i=>d[i]);
2
+ var In=Object.defineProperty;var Un=(e,t,r)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Re=(e,t,r)=>Un(e,typeof t!="symbol"?t+"":t,r);import{u as qe,j as m,t as be,a as Jt,g as On,r as An,b as h,R as kn,c as ct,_ as Y,d as Fn,e as ye,f as Xe,h as Ct,n as Br,i as Hr,k as Vn,l as zn,m as Rt,o as Bn,p as Hn,q as Wn,s as $n,v as Kn,w as Bt,x as Yn,y as Gn,z as Jn,A as Xn,B as qn,I as Qn}from"./index-CjewzOUG.js";function Zn(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in e)){const i=Object.getOwnPropertyDescriptor(n,a);i&&Object.defineProperty(e,a,i.get?i:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ea=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function ta({variant:e="default",className:t}){const r=qe(a=>a.profile.language);function n(a){a!==r&&Jt({language:a}).catch(()=>{})}return m.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[m.jsx("span",{className:"language-switcher-label",children:be("common.language")}),m.jsx("div",{className:"language-switcher-options",role:"group","aria-label":be("common.language"),children:ea.map(a=>m.jsx("button",{type:"button",className:`language-switcher-option${r===a.id?" active":""}`,"aria-pressed":r===a.id,onClick:()=>n(a.id),children:be(a.labelKey)},a.id))})]})}var Wr=An();const ra=On(Wr),na=Zn({__proto__:null,default:ra},[Wr]);/**
3
3
  * @remix-run/router v1.23.2
4
4
  *
5
5
  * Copyright (c) Remix Software Inc.
@@ -27,4 +27,4 @@ var In=Object.defineProperty;var Un=(e,t,r)=>t in e?In(e,t,{enumerable:!0,config
27
27
  * LICENSE.md file in the root directory of this source tree.
28
28
  *
29
29
  * @license MIT
30
- */function Nt(){return Nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nt.apply(this,arguments)}function Kt(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function wi(e,t){let r=Kt(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const xi="6";try{window.__reactRouterVersion=xi}catch{}function Ei(e,t){return Ua({basename:void 0,future:Nt({},void 0,{v7_prependBasename:!0}),history:aa({window:void 0}),hydrationData:Si(),routes:e,mapRouteProperties:bi,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Si(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Nt({},t,{errors:Ri(t.errors)})),t}function Ri(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&a.__type==="RouteErrorResponse")r[n]=new Lt(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let o=new i(a.message);o.stack="",r[n]=o}catch{}}if(r[n]==null){let i=new Error(a.message);i.stack="",r[n]=i}}else r[n]=a;return r}const Pi=h.createContext({isTransitioning:!1}),Ti=h.createContext(new Map),_i="startTransition",Ur=kn[_i],Ci="flushSync",Or=na[Ci];function Di(e){Ur?Ur(e):e()}function it(e){Or?Or(e):e()}class Li{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function ji(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=h.useState(r.state),[o,c]=h.useState(),[l,d]=h.useState({isTransitioning:!1}),[p,v]=h.useState(),[b,w]=h.useState(),[T,E]=h.useState(),D=h.useRef(new Map),{v7_startTransition:k}=n||{},L=h.useCallback(N=>{k?Di(N):N()},[k]),K=h.useCallback((N,F)=>{let{deletedFetchers:I,flushSync:re,viewTransitionOpts:J}=F;N.fetchers.forEach((ae,se)=>{ae.data!==void 0&&D.current.set(se,ae.data)}),I.forEach(ae=>D.current.delete(ae));let oe=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!J||oe){re?it(()=>i(N)):L(()=>i(N));return}if(re){it(()=>{b&&(p&&p.resolve(),b.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:J.currentLocation,nextLocation:J.nextLocation})});let ae=r.window.document.startViewTransition(()=>{it(()=>i(N))});ae.finished.finally(()=>{it(()=>{v(void 0),w(void 0),c(void 0),d({isTransitioning:!1})})}),it(()=>w(ae));return}b?(p&&p.resolve(),b.skipTransition(),E({state:N,currentLocation:J.currentLocation,nextLocation:J.nextLocation})):(c(N),d({isTransitioning:!0,flushSync:!1,currentLocation:J.currentLocation,nextLocation:J.nextLocation}))},[r.window,b,p,D,L]);h.useLayoutEffect(()=>r.subscribe(K),[r,K]),h.useEffect(()=>{l.isTransitioning&&!l.flushSync&&v(new Li)},[l]),h.useEffect(()=>{if(p&&o&&r.window){let N=o,F=p.promise,I=r.window.document.startViewTransition(async()=>{L(()=>i(N)),await F});I.finished.finally(()=>{v(void 0),w(void 0),c(void 0),d({isTransitioning:!1})}),w(I)}},[L,o,p,r.window]),h.useEffect(()=>{p&&o&&a.location.key===o.location.key&&p.resolve()},[p,b,a.location,o]),h.useEffect(()=>{!l.isTransitioning&&T&&(c(T.state),d({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}),E(void 0))},[l.isTransitioning,T]),h.useEffect(()=>{},[]);let te=h.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:N=>r.navigate(N),push:(N,F,I)=>r.navigate(N,{state:F,preventScrollReset:I==null?void 0:I.preventScrollReset}),replace:(N,F,I)=>r.navigate(N,{replace:!0,state:F,preventScrollReset:I==null?void 0:I.preventScrollReset})}),[r]),$=r.basename||"/",he=h.useMemo(()=>({router:r,navigator:te,static:!1,basename:$}),[r,te,$]),g=h.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return h.useEffect(()=>vi(n,r.future),[n,r.future]),h.createElement(h.Fragment,null,h.createElement(Mt.Provider,{value:he},h.createElement(en.Provider,{value:a},h.createElement(Ti.Provider,{value:D.current},h.createElement(Pi.Provider,{value:l},h.createElement(yi,{basename:$,location:a.location,navigationType:a.historyAction,navigator:te,future:g},a.initialized||r.future.v7_partialHydration?h.createElement(Ni,{routes:r.routes,future:r.future,state:a}):t))))),null)}const Ni=h.memo(Mi);function Mi(e){let{routes:t,future:r,state:n}=e;return ai(t,void 0,n,r)}var Ar;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ar||(Ar={}));var kr;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(kr||(kr={}));function Ii(e){let t=h.useRef(Kt(e)),r=h.useRef(!1),n=mt(),a=h.useMemo(()=>wi(n.search,r.current?null:t.current),[n.search]),i=rr(),o=h.useCallback((c,l)=>{const d=Kt(typeof c=="function"?c(a):c);r.current=!0,i("?"+d,l)},[i,a]);return[a,o]}const Ui="desktop://window-lifecycle",Oi=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Ai(e){return e instanceof HTMLInputElement?!Oi.has(e.type.toLowerCase()):!1}function ki(e){const t=e.activeElement;if(Ai(t)||t instanceof HTMLTextAreaElement){const r=t.selectionStart??0,n=t.selectionEnd??r;return n<=r?null:t.value.slice(r,n)}return null}function Fi(e){const t=ki(e);if(t!==null)return t;const r=e.getSelection();if(!r||r.isCollapsed)return null;const n=r.toString();return n.length>0?n:null}function Vi(e,t){var a;const r=(a=e.execCommand)==null?void 0:a.bind(e);if(typeof r!="function")return!1;const n=e.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.opacity="0",e.body.append(n),n.select();try{return r("copy")}catch{return!1}finally{n.remove()}}async function zi(e,t,r){var a,i;try{if(await r(t))return}catch{}const n=(a=e.defaultView)==null?void 0:a.navigator;if((i=n==null?void 0:n.clipboard)!=null&&i.writeText)try{await n.clipboard.writeText(t);return}catch{}Vi(e,t)}function Bi(e){const{window:t,document:r,writeClipboardText:n}=e;function a(i){if(i.defaultPrevented||!i.metaKey||i.ctrlKey||i.altKey||i.key.toLowerCase()!=="c")return;const o=Fi(r);o&&(i.preventDefault(),zi(r,o,n))}return t.addEventListener("keydown",a,!0),()=>{t.removeEventListener("keydown",a,!0)}}const ln=h.createContext(null),Hi=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function Wi(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Yt(){var e;if(!(typeof document>"u"))for(const t of Hi)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function $i(e){if(typeof document>"u")return;if(!e){Yt();return}const t=[document.documentElement,document.body].filter(n=>!!n),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const n of t)for(const[a,i]of r)n.style.setProperty(a,i)}function Ki(){if(!(typeof window>"u"))return window.innerWidth}function Yi({children:e}){const[t,r]=h.useState(()=>Ki()),n=h.useMemo(()=>ct({viewportWidth:t}),[t]);return h.useEffect(()=>{if(typeof window>"u")return;function a(){r(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),h.useEffect(()=>{Wi(n)},[n]),h.useEffect(()=>{if(!(typeof window>"u"||typeof document>"u")&&!(!n.isDesktop||n.ui.osFamily!=="macos"||!n.bridge.supported))return Bi({window,document,writeClipboardText:async a=>(await n.bridge.writeClipboardText(a)).ok})},[n]),h.useEffect(()=>()=>{Yt()},[]),h.useEffect(()=>{let a=!1,i=null;return!n.isDesktop||!n.bridge.supported?()=>{a=!0}:(Y(()=>import("./event-DvH9tcej.js").then(o=>o.c),[]).then(async({listen:o})=>{const c=await o(Ui,l=>{const d=l.payload,p=d==null?void 0:d.descriptor;p!=null&&p.windowId&&(n.windows.registerDescriptor(p),d.isOpen?n.windows.markWindowOpen(p.windowId):n.windows.markWindowClosed(p.windowId))});if(a){c();return}i=c}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),h.useEffect(()=>{let a=!1,i=null;async function o(){var l,d;const c=await n.bridge.getRuntimeInfo();a||$i(c.ok?(d=(l=c.value)==null?void 0:l.windowChrome)==null?void 0:d.macosTitlebar:null)}return!n.isDesktop||n.ui.osFamily!=="macos"||!n.ui.prefersOverlayTitlebar?(Yt(),()=>{a=!0}):(o(),Y(()=>import("./window-BVUB8gMK.js").then(c=>c.w),__vite__mapDeps([0,1])).then(async({getCurrentWindow:c})=>{const l=await c().onScaleChanged(()=>{o()});if(a){l();return}i=l}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),m.jsx(ln.Provider,{value:n,children:e})}function pt(){return h.useContext(ln)??ct()}const Yo=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function Go(e){return be(e.labelKey)}function Gi(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function cn(e,t){return t?Gi():e}function Ji(){const{theme:e,autoTheme:t}=Fn.getState().profile;return cn(e,t)}function Xi(e){Jt({theme:e,autoTheme:!1}).catch(()=>{})}function qi(e){Jt({autoTheme:e}).catch(()=>{})}function un(e){typeof window>"u"||document.documentElement.setAttribute("data-theme",e)}function Qi(){const e=qe(n=>n.profile.theme),t=qe(n=>n.profile.autoTheme);return{theme:cn(e,t),selectedTheme:e,autoTheme:t,setTheme:Xi,setAutoTheme:qi}}function Zi(){un(Ji())}function eo({children:e}){const t=qe(n=>n.profile.theme),r=qe(n=>n.profile.autoTheme);return h.useEffect(()=>{Zi()},[t,r]),h.useEffect(()=>{if(!r||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{un(n.matches?"dark":"light")};return a(),typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[r]),m.jsx(m.Fragment,{children:e})}const to={showToast:()=>"",dismissToast:()=>{}},dn=h.createContext(to);function ro(){return`toast-${Math.random().toString(36).slice(2,10)}`}function no({toast:e,onDismiss:t}){const{id:r,title:n,description:a,tone:i,durationMs:o,action:c}=e;return h.useEffect(()=>{if(o===null)return;const l=window.setTimeout(()=>{t(r)},o);return()=>{window.clearTimeout(l)}},[o,r,t,n,a,i]),m.jsxs("article",{className:"toast-card","data-tone":i,role:i==="error"?"alert":"status",children:[m.jsxs("div",{className:"toast-body",children:[m.jsx("strong",{className:"toast-title",children:n}),a?m.jsx("p",{className:"toast-description",children:a}):null]}),m.jsxs("div",{className:"toast-actions",children:[c?m.jsx("button",{className:"toast-action",type:"button",onClick:()=>{c.onClick(),t(r)},children:c.label}):null,m.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function ao({children:e}){const[t,r]=h.useState([]),n=h.useCallback(o=>{r(c=>c.filter(l=>l.id!==o))},[]),a=h.useCallback(o=>{const c=o.id??ro(),l={id:c,title:o.title,description:o.description,tone:o.tone??"info",durationMs:o.durationMs===void 0?4200:o.durationMs,action:o.action};return r(d=>{const p=d.findIndex(b=>b.id===c);if(p===-1)return[...d,l];const v=[...d];return v[p]=l,v}),c},[]),i=h.useMemo(()=>({showToast:a,dismissToast:n}),[n,a]);return m.jsxs(dn.Provider,{value:i,children:[e,m.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(o=>m.jsx(no,{toast:o,onDismiss:n},o.id))})]})}function Jo(){return h.useContext(dn)}const _t="0.8.0",fn=h.createContext(_t);function io({children:e}){const t=pt(),[r,n]=h.useState(_t);return h.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(i=>{var c,l;if(a)return;const o=i.ok?(l=(c=i.value)==null?void 0:c.version)==null?void 0:l.trim():"";n(o||_t)}),()=>{a=!0}):(n(_t),()=>{a=!0})},[t]),m.jsx(fn.Provider,{value:r,children:e})}function oo(){return h.useContext(fn)}const Fr={latestState:null,lastNotifiedVersion:null,pendingRestartVersion:null};class so{constructor(){Re(this,"state",Fr);Re(this,"listeners",new Set);Re(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Re(this,"getState",()=>this.state)}recordState(t){const r=zt(this.state.pendingRestartVersion),n=zt(t.currentVersion);this.state={latestState:t,lastNotifiedVersion:t.hasUpdate?this.state.lastNotifiedVersion:null,pendingRestartVersion:r&&r===n?null:this.state.pendingRestartVersion},this.emit()}markVersionNotified(t){this.state.lastNotifiedVersion!==t&&(this.state={...this.state,lastNotifiedVersion:t},this.emit())}markRestartPending(t){const r=zt(t);!r||this.state.pendingRestartVersion===r||(this.state={...this.state,pendingRestartVersion:r},this.emit())}reset(){this.state=Fr,this.emit()}emit(){for(const t of this.listeners)t()}}const Qe=new so;function zt(e){const t=e==null?void 0:e.trim();return t||null}function lo(e){return h.useSyncExternalStore(Qe.subscribe,()=>e(Qe.getState()))}function co(){return Qe.getState()}function uo(e){Qe.recordState(e)}function fo(e){Qe.markVersionNotified(e)}function ho(e){Qe.markRestartPending(e)}async function mo(){const e=ct(),t=ye.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function po(e={}){const t=e.notify??"never",r=await mo();return uo(r),await vo(r,t),r}async function Xo(){const e=ct(),t=ye.getState();return e.bridge.installUpdate(t.releaseChannel)}function qo(e){ho(e)}async function Qo(){var e;if(typeof window>"u"||typeof((e=window.__TAURI_INTERNALS__)==null?void 0:e.invoke)!="function")throw new Error("当前运行环境不支持桌面应用重启。");try{await window.__TAURI_INTERNALS__.invoke("restart_application")}catch(t){throw new Error(t instanceof Error?t.message:"重启应用失败。")}}async function vo(e,t){var i,o,c;if(!e.hasUpdate||t==="never")return;const r=((o=(i=e.manifest)==null?void 0:i.version)==null?void 0:o.trim())||e.currentVersion.trim();if(!r)return;const n=co().lastNotifiedVersion;if(t==="always"||n!==r)try{(await ct().bridge.showNotification(be("settings.releaseUpdateReady"),((c=e.manifest)==null?void 0:c.version)??e.currentVersion)).ok&&fo(r)}catch{}}const go=3600*1e3;function yo(){const e=Xe(a=>a.platform),t=Xe(a=>a.autoCheckUpdate),r=Xe(a=>a.releaseChannel),n=lo(a=>a.pendingRestartVersion);return h.useEffect(()=>{if(e!=="desktop"||!t||n)return;async function a(){try{await po({notify:"if-new"})}catch{}}a();const i=window.setInterval(()=>{a()},go);return()=>{window.clearInterval(i)}},[t,n,e,r]),null}const hn="codingns.server.base-url.history",nr=6,mn="__custom__";function pn(){return typeof window<"u"&&typeof window.localStorage<"u"}function vn(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function ar(e){if(!e)return null;try{return Br(e)}catch{return null}}function gn(){if(!pn())return[];const e=window.localStorage.getItem(hn);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?ar(r):null).filter(r=>!!r):[]}catch{return[]}}function bo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n)||(t.add(n),r.push(n));return r}function wo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n.value)||(t.add(n.value),r.push(n));return r}function xo(e,t){const r=gn();return bo([e,...t,...r,ar(vn())]).slice(0,nr)}function Eo(e){const t=Ct(e),r=gn().map(c=>({value:c,source:"history"})),n=ar(vn()),a=e.hosts.map(c=>({value:c.baseUrl,source:"saved"})),i=zn(e).map(c=>({value:c.baseUrl,source:"discovered"})),o=t?{value:t.baseUrl,source:Hr(t)?"discovered":"saved"}:null;return wo([o,...a,...i,...r,n?{value:n,source:"origin"}:null]).slice(0,nr)}function So(e){pn()&&window.localStorage.setItem(hn,JSON.stringify(e.slice(0,nr)))}class Ro{constructor(){Re(this,"state",this.createState(ye.getState()));Re(this,"listeners",new Set);Re(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Re(this,"getState",()=>this.state);ye.subscribe(()=>{const t=this.createState(ye.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,n)=>r===this.state.options[n])&&t.presetOptions.length===this.state.presetOptions.length&&t.presetOptions.every((r,n)=>{const a=this.state.presetOptions[n];return(a==null?void 0:a.value)===r.value&&(a==null?void 0:a.source)===r.source})||(this.state=t,this.emit())})}setBaseUrl(t){const r=ye.getState(),n=Ct(r);if(!n)return!1;const a=Br(t),i=a!==n.baseUrl,o=To(a,n);if(Hr(n))return ye.updateRuntime({discoveredHosts:r.discoveredHosts.map(l=>l.id===n.id?{...l,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:l)}),this.state=this.createState(ye.getState()),this.emit(),i;const c=r.hosts.map(l=>l.id===n.id?{...l,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:l);return this.state=this.createState({...r,hosts:c}),this.emit(),ye.update({hosts:c}),i}reset(){this.state=this.createState(ye.getState()),this.emit()}createState(t){const r=Ct(t),n=(r==null?void 0:r.baseUrl)??"",a=Eo(t),i=xo(n,a.map(o=>o.value));return So(i),{baseUrl:n,options:i,presetOptions:a}}emit(){for(const t of this.listeners)t()}}const Gt=new Ro;function Po(e){return h.useSyncExternalStore(Gt.subscribe,()=>e(Gt.getState()))}function Zo(e,t){return t.includes(e)?e:mn}function es(){return mn}function To(e,t){const r=Vn(e);if(!r)return null;const n=t==null?void 0:t.relayTunnel,a=(n==null?void 0:n.provider)==="codingns_relay"&&n.tunnelDomain===r.tunnelDomain&&n.controlBaseUrl===r.controlBaseUrl,i=((n==null?void 0:n.candidateEndpoints)??[]).filter(o=>o.kind!=="relay");return{provider:"codingns_relay",enabled:!0,tunnelDomain:r.tunnelDomain,controlBaseUrl:r.controlBaseUrl,bindingId:a?(n==null?void 0:n.bindingId)??null:null,hostFingerprint:a?(n==null?void 0:n.hostFingerprint)??null:null,candidateEndpoints:[{endpointId:`relay-entry:${r.relayBaseUrl}`,kind:"relay",url:r.relayBaseUrl,priority:0,expiresAt:null,source:"user_saved"},...i]}}const _o={login(e,t){return Rt.login(e,t)},bootstrap(e,t,r){return Rt.bootstrap(e,t,r)},refresh(){return Rt.refresh()},logout(){Rt.clear()}},Co=h.lazy(async()=>({default:(await Y(()=>import("./ServerSettingsModal-vgOhwus4.js"),__vite__mapDeps([2,3,4,5,6]))).ServerSettingsModal})),Vr="width=device-width, initial-scale=1.0, viewport-fit=cover",Do="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function Lo(){const e=h.useRef(null);return h.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let n;const a=()=>{o(),c()};let i=[];const o=()=>{t.width=window.innerWidth,t.height=window.innerHeight},c=()=>{i=[];const d=Math.min(50,Math.floor(t.width*t.height/25e3));for(let p=0;p<d;p++)i.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},l=()=>{r.clearRect(0,0,t.width,t.height),i.forEach((d,p)=>{d.x+=d.vx,d.y+=d.vy,d.x<0&&(d.x=t.width),d.x>t.width&&(d.x=0),d.y<0&&(d.y=t.height),d.y>t.height&&(d.y=0),r.beginPath(),r.arc(d.x,d.y,d.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${d.opacity})`,r.fill(),i.slice(p+1).forEach(v=>{const b=d.x-v.x,w=d.y-v.y,T=Math.sqrt(b*b+w*w);T<150&&(r.beginPath(),r.moveTo(d.x,d.y),r.lineTo(v.x,v.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-T/150)})`,r.stroke())})}),n=requestAnimationFrame(l)};return o(),c(),l(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(n)}},[]),m.jsx("canvas",{ref:e,className:"particle-canvas"})}function jo({text:e}){return m.jsx("span",{className:"glitch-text","data-text":e,children:e})}function No({text:e}){const[t,r]=h.useState(""),[n,a]=h.useState(!0);return h.useEffect(()=>{let i=0,o=null;const c=setInterval(()=>{i<=e.length?(r(e.slice(0,i)),i++):(clearInterval(c),o=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(c),o!==null&&window.clearTimeout(o)}},[e]),m.jsxs("span",{className:"typewriter-text",children:[t,n&&m.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function Mo(e){const t=e==null?void 0:e.captcha;if(typeof t!="object"||t===null)return null;const r=t.captchaId,n=t.imageDataUrl;return typeof r!="string"||typeof n!="string"?null:{captchaId:r,imageDataUrl:n}}function Io(){const e=rr(),t=Bn(),[r]=Ii(),n=pt(),a=oo(),i=Xe(V=>Hn(V)),o=Wn(n.platform),c=h.useMemo(()=>$n(n),[n]),l=h.useMemo(()=>c?Kn(i):{credentials:null,legacyServerBaseUrl:null},[i,c]),d=l.credentials,p=l.legacyServerBaseUrl,[v,b]=h.useState(()=>(d==null?void 0:d.username)??"admin"),[w,T]=h.useState(()=>(d==null?void 0:d.password)??""),[E,D]=h.useState(null),[k,L]=h.useState(""),[K,te]=h.useState(()=>!!d),$=Po(V=>V.baseUrl),[he,g]=h.useState($),[N,F]=h.useState(null),[I,re]=h.useState(!1),[J,oe]=h.useState(!1),[ae,se]=h.useState(null),[We,$e]=h.useState(!1),Q=Bt(V=>V.session),Te=h.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:_e}=Qi(),we=h.useRef(!1),ce=n.isNativeMobile,Ce=h.useMemo(()=>_e==="light"?"light":"dark",[_e]);h.useEffect(()=>{b((d==null?void 0:d.username)??"admin"),T((d==null?void 0:d.password)??""),D(null),L(""),te(!!d)},[d]),h.useEffect(()=>{if(typeof document>"u")return;const V=document.querySelector('meta[name="viewport"]');if(!(V instanceof HTMLMetaElement))return;const de=V.getAttribute("content")??Vr;return ce?V.setAttribute("content",Do):V.setAttribute("content",Vr),()=>{V.setAttribute("content",de)}},[ce]),h.useEffect(()=>{we.current||(we.current=!0,!(!c||!p||p===$)&&(Gt.setBaseUrl(p),g(p)))},[$,c,p]),h.useEffect(()=>{if(Q){e(Te,{replace:!0});return}if(!he)return;let V=!1;const de=window.setTimeout(()=>{Y(async()=>{const{probeHost:H}=await import("./index-CuzMc7q2.js").then(ve=>ve.$);return{probeHost:H}},__vite__mapDeps([3,4])).then(({probeHost:H})=>H(he)).then(H=>{V||(H.demoMode&&($e(!0),Yn()&&F(t("auth.demoSessionExpired"))),H.reachable&&!H.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{V||F(t("auth.authUnavailable"))})},0);return()=>{V=!0,window.clearTimeout(de)}},[Q,e,he,Te,t]);async function Ue(V){V.preventDefault(),re(!0),F(null),g($),c&&!K&&i&&Gn(i);try{const de=E?{username:v,password:w,captchaId:E.captchaId,captchaCode:k}:{username:v,password:w};await _o.login(de,$),D(null),L("");const{userPreferenceStore:H}=await Y(async()=>{const{userPreferenceStore:ve}=await import("./index-CuzMc7q2.js").then(gt=>gt.Z);return{userPreferenceStore:ve}},__vite__mapDeps([3,4]));await H.refreshForAuthenticatedUser(),c&&K&&i&&Jn({hostId:i,username:v,password:w}),e(Te,{replace:!0})}catch(de){if(de instanceof Xn){if(de.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}const H=Mo(de.data);H?(D(H),L("")):de.errorCode==="INVALID_CREDENTIALS"&&(D(null),L("")),F(de.message)}else F(t("auth.authUnavailable"))}finally{re(!1)}}function ue(V){b(V),E&&(D(null),L(""))}function xe(V){g(V),F(null)}const pe="login-username",Oe="login-password",vt="login-captcha";return m.jsxs("main",{className:"cyber-login-page","data-theme":Ce,"data-native-mobile":ce?"true":"false",children:[m.jsxs("div",{className:"cyber-bg",children:[m.jsx("div",{className:"cyber-grid"}),m.jsx("div",{className:"cyber-glow cyber-glow-1"}),m.jsx("div",{className:"cyber-glow cyber-glow-2"}),m.jsx(Lo,{})]}),m.jsx("div",{className:"scanlines"}),m.jsxs("div",{className:"cyber-login-container",children:[m.jsx("div",{className:"cyber-login-toolbar",children:m.jsx(ta,{variant:"compact"})}),m.jsxs("div",{className:"cyber-login-content",children:[m.jsxs("div",{className:"cyber-brand",children:[m.jsx("div",{className:"cyber-logo",children:m.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),m.jsx("h1",{className:"cyber-brand-title",children:m.jsx(jo,{text:"CodingNS"})}),m.jsx("p",{className:"cyber-brand-subtitle",children:m.jsx(No,{text:t("auth.loginSubtitle")})})]}),m.jsxs("div",{className:"cyber-card",children:[m.jsx("div",{className:"cyber-corner corner-tl"}),m.jsx("div",{className:"cyber-corner corner-tr"}),m.jsx("div",{className:"cyber-corner corner-bl"}),m.jsx("div",{className:"cyber-corner corner-br"}),m.jsxs("div",{className:"cyber-card-header",children:[m.jsx("div",{className:"cyber-line"}),m.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),m.jsx("div",{className:"cyber-line"})]}),We?m.jsxs("div",{className:"cyber-demo-banner",children:[m.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),m.jsx("span",{children:t("auth.demoBanner")})]}):null,m.jsxs("form",{className:"cyber-form",onSubmit:Ue,children:[m.jsxs("div",{className:`cyber-field ${ae==="username"?"focused":""}`,children:[m.jsx("div",{className:"cyber-field-border",children:m.jsx("div",{className:"cyber-field-border-glow"})}),m.jsxs("label",{className:"cyber-field-label",htmlFor:pe,children:[m.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),m.jsx("input",{id:pe,"aria-label":t("auth.username"),className:"cyber-input",value:v,onChange:V=>ue(V.target.value),onFocus:()=>se("username"),onBlur:()=>se(null),autoComplete:"username"})]}),m.jsxs("div",{className:`cyber-field ${ae==="password"?"focused":""}`,children:[m.jsx("div",{className:"cyber-field-border",children:m.jsx("div",{className:"cyber-field-border-glow"})}),m.jsxs("label",{className:"cyber-field-label",htmlFor:Oe,children:[m.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),m.jsx("input",{id:Oe,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:w,onChange:V=>T(V.target.value),onFocus:()=>se("password"),onBlur:()=>se(null),autoComplete:"current-password"})]}),E?m.jsxs("div",{className:"cyber-captcha-panel",children:[m.jsx("img",{alt:t("auth.captchaImageAlt"),className:"cyber-captcha-image",draggable:!1,src:E.imageDataUrl}),m.jsx("p",{className:"cyber-captcha-hint",children:t("auth.captchaHint")}),m.jsxs("div",{className:`cyber-field ${ae==="captcha"?"focused":""}`,children:[m.jsx("div",{className:"cyber-field-border",children:m.jsx("div",{className:"cyber-field-border-glow"})}),m.jsxs("label",{className:"cyber-field-label",htmlFor:vt,children:[m.jsx("span",{className:"cyber-field-icon",children:"#"}),t("auth.captcha")]}),m.jsx("input",{id:vt,"aria-label":t("auth.captcha"),className:"cyber-input",placeholder:t("auth.captchaPlaceholder"),value:k,onChange:V=>L(V.target.value),onFocus:()=>se("captcha"),onBlur:()=>se(null),autoComplete:"one-time-code"})]})]}):null,c?m.jsxs("label",{className:"cyber-remember-toggle",children:[m.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:K,onChange:V=>te(V.target.checked)}),m.jsx("span",{children:t("auth.rememberPassword")})]}):null,N?m.jsxs("div",{className:"cyber-status","data-tone":"error",children:[m.jsx("span",{className:"cyber-status-icon",children:"⚠"}),m.jsx("span",{children:N})]}):null,m.jsxs("button",{className:`cyber-submit ${I?"loading":""}`,type:"submit",disabled:I,children:[m.jsx("span",{className:"cyber-submit-glow"}),m.jsx("span",{className:"cyber-submit-border"}),m.jsx("span",{className:"cyber-submit-text",children:I?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),o?m.jsxs("div",{className:"cyber-footer",children:[m.jsxs("div",{className:"cyber-divider",children:[m.jsx("span",{className:"cyber-divider-line"}),m.jsx("span",{className:"cyber-divider-text",children:"//"}),m.jsx("span",{className:"cyber-divider-line"})]}),m.jsxs("button",{className:"cyber-server-btn",onClick:()=>oe(!0),type:"button",children:[m.jsx("span",{className:"cyber-server-icon",children:"⚙"}),m.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),m.jsx("span",{className:"cyber-server-current",children:$})]})]}):null]})]}),m.jsxs("div",{className:"cyber-version",children:[m.jsxs("span",{className:"cyber-version-text",children:["v",a]}),m.jsx("span",{className:"cyber-version-divider",children:"|"}),m.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),o&&J?m.jsx(h.Suspense,{fallback:null,children:m.jsx(Co,{isOpen:J,onClose:()=>oe(!1),onSave:xe})}):null]})}function yn(){return m.jsx("main",{className:"page-center app-shell",children:m.jsxs("section",{className:"auth-card surface-card",children:[m.jsx("h1",{children:be("auth.trustedEntryOnlyTitle")}),m.jsx("p",{className:"status-text",children:be("auth.trustedEntryOnlyDescription")}),m.jsxs("div",{className:"field-group",children:[m.jsx("span",{children:be("auth.trustedEntryOnlyHintTitle")}),m.jsx("span",{className:"auth-server-value",children:be("auth.trustedEntryOnlyHint")})]})]})})}function Uo({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function Oo(){return!1}function bn(e,t,r=Oo()){var i,o;if(!r||t!=="web")return!1;const n=Ct(e),a=n==null?void 0:n.relayTunnel;return!(a!=null&&a.enabled&&((i=a.tunnelDomain)!=null&&i.trim())&&((o=a.controlBaseUrl)!=null&&o.trim()))}function Ao({runtimeKey:e,children:t}){return m.jsx("div",{children:t},e)}function ko(){const e=qn();return m.jsx(Ao,{runtimeKey:e,children:m.jsx(gi,{})})}function Fo(){const e=Xe(i=>i),t=pt(),r=Bt(i=>i.session),n=Bt(i=>i.sessionReady),a=mt();if(bn(e,t.platform))return m.jsx(yn,{});if(!r){const i=`${a.pathname}${a.search}`;return m.jsx(sn,{to:`/login?returnTo=${encodeURIComponent(i)}`,replace:!0})}return n?m.jsx(ko,{}):m.jsx("div",{children:be("common.loading")})}function Vo(){const e=Xe(r=>r),t=pt();return bn(e,t.platform)?m.jsx(yn,{}):m.jsx(Io,{})}function zr(){const e=pt(),t=Uo(e);return m.jsx(sn,{to:t==="mobile"?"/workspaces":"/landing",replace:!0})}function ne(e,t){return async()=>({Component:(await e())[t]})}const zo=[{path:"/bootstrap",lazy:ne(()=>Y(()=>import("./BootstrapPage--MDOigQi.js"),__vite__mapDeps([7,3,4])),"BootstrapPage")},{path:"/login",element:m.jsx(Vo,{})},{path:"/connect/:tunnelDomain",lazy:ne(()=>Y(()=>import("./RelayConnectEntryPage-0MPPjxtQ.js"),__vite__mapDeps([8,3,4,5])),"RelayConnectEntryPage")},{path:"/desktop-window-preview",lazy:ne(()=>Y(()=>import("./DesktopDetachPreviewPage-CB8DoqwU.js"),__vite__mapDeps([9,3,4])),"DesktopDetachPreviewPage")},{path:"/",element:m.jsx(Fo,{}),children:[{path:"desktop-window/:windowId",lazy:ne(()=>Y(()=>import("./DesktopWindowPage-GtIx5m8K.js"),__vite__mapDeps([10,3,4,11,12,13,0,1,6,5,14,15,16,17,18,19,20,21,22])),"DesktopWindowPage")},{lazy:ne(()=>Y(()=>import("./WorkbenchShellRoute-DyaMnPfS.js"),__vite__mapDeps([23,3,4,13,11,0,1,6,5,24])),"WorkbenchShellRoute"),children:[{index:!0,element:m.jsx(zr,{})},{path:"landing",lazy:ne(()=>Y(()=>import("./WorkbenchLandingPage-CTTnfovY.js"),__vite__mapDeps([25,3,4,13,11,0,1,6,5])),"WorkbenchLandingPage")},{path:"workspaces",lazy:ne(()=>Y(()=>import("./WorkspaceHomePage-COf6I8sT.js"),__vite__mapDeps([26,3,4,13,11,0,1,6,5,27,20,21,28])),"WorkspaceHomePage")},{path:"workspaces/:workspaceId",lazy:ne(()=>Y(()=>import("./WorkspaceDetailPage-Cf-gVpqK.js"),__vite__mapDeps([29,3,4,13,11,0,1,6,5,30,17,20,21,28])),"WorkspaceDetailPage")},{path:"workspaces/:workspaceId/debug",lazy:ne(()=>Y(()=>import("./WorkspaceDebugDetailPage-s7yuDIxR.js"),__vite__mapDeps([31,3,4,30,11,17,13,0,1,6,5])),"WorkspaceDebugDetailPage")},{path:"workspaces/:workspaceId/sessions",lazy:ne(()=>Y(()=>import("./SessionIndexPage-KK626Ra9.js"),__vite__mapDeps([32,3,4,11,13,0,1,6,5,20,21,28,33,34])),"SessionIndexPage")},{path:"workspaces/:workspaceId/sessions/:sessionId",lazy:ne(()=>Y(()=>import("./ConversationPage-BBss5ED8.js"),__vite__mapDeps([35,3,4,6,11,13,0,1,5,36,12,14,15,16,17,18,19,20,21,22,33,34])),"ConversationPage")},{path:"workspaces/:workspaceId/tools",lazy:ne(()=>Y(()=>import("./ToolsHomePage-CHfPxd20.js"),__vite__mapDeps([37,3,4,13,11,0,1,6,5])),"ToolsHomePage")},{path:"workspaces/:workspaceId/tools/files",lazy:ne(()=>Y(()=>import("./ToolFilesPage-N_gwwUjD.js"),__vite__mapDeps([38,3,4,13,11,0,1,6,5])),"ToolFilesPage")},{path:"workspaces/:workspaceId/tools/git",lazy:ne(()=>Y(()=>import("./ToolGitPage-DOcuuWM1.js"),__vite__mapDeps([39,3,4,13,11,0,1,6,5])),"ToolGitPage")},{path:"workspaces/:workspaceId/tools/processes",lazy:ne(()=>Y(()=>import("./ToolProcessesPage-D-FfJ7Re.js"),__vite__mapDeps([40,3,4,13,11,0,1,6,5])),"ToolProcessesPage")},{path:"workspaces/:workspaceId/terminals",lazy:ne(()=>Y(()=>import("./TerminalPage-B6Rdhylx.js"),__vite__mapDeps([19,3,4,11,13,0,1,6,5,20,21,17,18,22])),"TerminalPage")},{path:"workspaces/:workspaceId/butler",lazy:ne(()=>Y(()=>import("./AdaptiveButlerPage-BsgVNRAa.js"),__vite__mapDeps([41,3,4,13,11,0,1,6,5,36,12,14,27,20,21,42])),"AdaptiveButlerPage")},{path:"settings",lazy:ne(()=>Y(()=>import("./SettingsPage-B3edBJIo.js"),__vite__mapDeps([43,3,4,11,6,21])),"SettingsPage")},{path:"settings/:section",lazy:ne(()=>Y(()=>import("./SettingsPage-B3edBJIo.js"),__vite__mapDeps([43,3,4,11,6,21])),"SettingsPage")},{path:"*",element:m.jsx(zr,{})}]}]}];function Bo(){return Ei(zo)}function Ho(){const e=qe(r=>r.profile.language),t=h.useMemo(()=>Bo(),[]);return m.jsx(Yi,{children:m.jsx(io,{children:m.jsx(Qn,{language:e,children:m.jsx(eo,{children:m.jsxs(ao,{children:[m.jsx(yo,{}),m.jsx(ji,{router:t})]})})})})})}const ts=Object.freeze(Object.defineProperty({__proto__:null,App:Ho},Symbol.toStringTag,{value:"Module"}));export{ts as A,ta as L,sn as N,gi as O,Yo as T,Po as a,_o as b,Ko as c,Ii as d,pt as e,Jo as f,Wr as g,mt as h,lo as i,Qi as j,po as k,Xo as l,br as m,qo as n,Qo as o,oo as p,Go as q,Uo as r,Zo as s,es as t,rr as u,Gt as v};
30
+ */function Nt(){return Nt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Nt.apply(this,arguments)}function Kt(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(a=>[r,a]):[[r,n]])},[]))}function wi(e,t){let r=Kt(e);return t&&t.forEach((n,a)=>{r.has(a)||t.getAll(a).forEach(i=>{r.append(a,i)})}),r}const xi="6";try{window.__reactRouterVersion=xi}catch{}function Ei(e,t){return Ua({basename:void 0,future:Nt({},void 0,{v7_prependBasename:!0}),history:aa({window:void 0}),hydrationData:Si(),routes:e,mapRouteProperties:bi,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Si(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Nt({},t,{errors:Ri(t.errors)})),t}function Ri(e){if(!e)return null;let t=Object.entries(e),r={};for(let[n,a]of t)if(a&&a.__type==="RouteErrorResponse")r[n]=new Lt(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let i=window[a.__subType];if(typeof i=="function")try{let o=new i(a.message);o.stack="",r[n]=o}catch{}}if(r[n]==null){let i=new Error(a.message);i.stack="",r[n]=i}}else r[n]=a;return r}const Pi=h.createContext({isTransitioning:!1}),Ti=h.createContext(new Map),_i="startTransition",Ur=kn[_i],Ci="flushSync",Or=na[Ci];function Di(e){Ur?Ur(e):e()}function it(e){Or?Or(e):e()}class Li{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",t(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",r(n))}})}}function ji(e){let{fallbackElement:t,router:r,future:n}=e,[a,i]=h.useState(r.state),[o,c]=h.useState(),[l,d]=h.useState({isTransitioning:!1}),[p,v]=h.useState(),[b,w]=h.useState(),[T,E]=h.useState(),D=h.useRef(new Map),{v7_startTransition:k}=n||{},L=h.useCallback(N=>{k?Di(N):N()},[k]),K=h.useCallback((N,F)=>{let{deletedFetchers:I,flushSync:re,viewTransitionOpts:J}=F;N.fetchers.forEach((ae,se)=>{ae.data!==void 0&&D.current.set(se,ae.data)}),I.forEach(ae=>D.current.delete(ae));let oe=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!J||oe){re?it(()=>i(N)):L(()=>i(N));return}if(re){it(()=>{b&&(p&&p.resolve(),b.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:J.currentLocation,nextLocation:J.nextLocation})});let ae=r.window.document.startViewTransition(()=>{it(()=>i(N))});ae.finished.finally(()=>{it(()=>{v(void 0),w(void 0),c(void 0),d({isTransitioning:!1})})}),it(()=>w(ae));return}b?(p&&p.resolve(),b.skipTransition(),E({state:N,currentLocation:J.currentLocation,nextLocation:J.nextLocation})):(c(N),d({isTransitioning:!0,flushSync:!1,currentLocation:J.currentLocation,nextLocation:J.nextLocation}))},[r.window,b,p,D,L]);h.useLayoutEffect(()=>r.subscribe(K),[r,K]),h.useEffect(()=>{l.isTransitioning&&!l.flushSync&&v(new Li)},[l]),h.useEffect(()=>{if(p&&o&&r.window){let N=o,F=p.promise,I=r.window.document.startViewTransition(async()=>{L(()=>i(N)),await F});I.finished.finally(()=>{v(void 0),w(void 0),c(void 0),d({isTransitioning:!1})}),w(I)}},[L,o,p,r.window]),h.useEffect(()=>{p&&o&&a.location.key===o.location.key&&p.resolve()},[p,b,a.location,o]),h.useEffect(()=>{!l.isTransitioning&&T&&(c(T.state),d({isTransitioning:!0,flushSync:!1,currentLocation:T.currentLocation,nextLocation:T.nextLocation}),E(void 0))},[l.isTransitioning,T]),h.useEffect(()=>{},[]);let te=h.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:N=>r.navigate(N),push:(N,F,I)=>r.navigate(N,{state:F,preventScrollReset:I==null?void 0:I.preventScrollReset}),replace:(N,F,I)=>r.navigate(N,{replace:!0,state:F,preventScrollReset:I==null?void 0:I.preventScrollReset})}),[r]),$=r.basename||"/",he=h.useMemo(()=>({router:r,navigator:te,static:!1,basename:$}),[r,te,$]),g=h.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return h.useEffect(()=>vi(n,r.future),[n,r.future]),h.createElement(h.Fragment,null,h.createElement(Mt.Provider,{value:he},h.createElement(en.Provider,{value:a},h.createElement(Ti.Provider,{value:D.current},h.createElement(Pi.Provider,{value:l},h.createElement(yi,{basename:$,location:a.location,navigationType:a.historyAction,navigator:te,future:g},a.initialized||r.future.v7_partialHydration?h.createElement(Ni,{routes:r.routes,future:r.future,state:a}):t))))),null)}const Ni=h.memo(Mi);function Mi(e){let{routes:t,future:r,state:n}=e;return ai(t,void 0,n,r)}var Ar;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ar||(Ar={}));var kr;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(kr||(kr={}));function Ii(e){let t=h.useRef(Kt(e)),r=h.useRef(!1),n=mt(),a=h.useMemo(()=>wi(n.search,r.current?null:t.current),[n.search]),i=rr(),o=h.useCallback((c,l)=>{const d=Kt(typeof c=="function"?c(a):c);r.current=!0,i("?"+d,l)},[i,a]);return[a,o]}const Ui="desktop://window-lifecycle",Oi=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Ai(e){return e instanceof HTMLInputElement?!Oi.has(e.type.toLowerCase()):!1}function ki(e){const t=e.activeElement;if(Ai(t)||t instanceof HTMLTextAreaElement){const r=t.selectionStart??0,n=t.selectionEnd??r;return n<=r?null:t.value.slice(r,n)}return null}function Fi(e){const t=ki(e);if(t!==null)return t;const r=e.getSelection();if(!r||r.isCollapsed)return null;const n=r.toString();return n.length>0?n:null}function Vi(e,t){var a;const r=(a=e.execCommand)==null?void 0:a.bind(e);if(typeof r!="function")return!1;const n=e.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.opacity="0",e.body.append(n),n.select();try{return r("copy")}catch{return!1}finally{n.remove()}}async function zi(e,t,r){var a,i;try{if(await r(t))return}catch{}const n=(a=e.defaultView)==null?void 0:a.navigator;if((i=n==null?void 0:n.clipboard)!=null&&i.writeText)try{await n.clipboard.writeText(t);return}catch{}Vi(e,t)}function Bi(e){const{window:t,document:r,writeClipboardText:n}=e;function a(i){if(i.defaultPrevented||!i.metaKey||i.ctrlKey||i.altKey||i.key.toLowerCase()!=="c")return;const o=Fi(r);o&&(i.preventDefault(),zi(r,o,n))}return t.addEventListener("keydown",a,!0),()=>{t.removeEventListener("keydown",a,!0)}}const ln=h.createContext(null),Hi=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function Wi(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Yt(){var e;if(!(typeof document>"u"))for(const t of Hi)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function $i(e){if(typeof document>"u")return;if(!e){Yt();return}const t=[document.documentElement,document.body].filter(n=>!!n),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const n of t)for(const[a,i]of r)n.style.setProperty(a,i)}function Ki(){if(!(typeof window>"u"))return window.innerWidth}function Yi({children:e}){const[t,r]=h.useState(()=>Ki()),n=h.useMemo(()=>ct({viewportWidth:t}),[t]);return h.useEffect(()=>{if(typeof window>"u")return;function a(){r(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),h.useEffect(()=>{Wi(n)},[n]),h.useEffect(()=>{if(!(typeof window>"u"||typeof document>"u")&&!(!n.isDesktop||n.ui.osFamily!=="macos"||!n.bridge.supported))return Bi({window,document,writeClipboardText:async a=>(await n.bridge.writeClipboardText(a)).ok})},[n]),h.useEffect(()=>()=>{Yt()},[]),h.useEffect(()=>{let a=!1,i=null;return!n.isDesktop||!n.bridge.supported?()=>{a=!0}:(Y(()=>import("./event-DvH9tcej.js").then(o=>o.c),[]).then(async({listen:o})=>{const c=await o(Ui,l=>{const d=l.payload,p=d==null?void 0:d.descriptor;p!=null&&p.windowId&&(n.windows.registerDescriptor(p),d.isOpen?n.windows.markWindowOpen(p.windowId):n.windows.markWindowClosed(p.windowId))});if(a){c();return}i=c}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),h.useEffect(()=>{let a=!1,i=null;async function o(){var l,d;const c=await n.bridge.getRuntimeInfo();a||$i(c.ok?(d=(l=c.value)==null?void 0:l.windowChrome)==null?void 0:d.macosTitlebar:null)}return!n.isDesktop||n.ui.osFamily!=="macos"||!n.ui.prefersOverlayTitlebar?(Yt(),()=>{a=!0}):(o(),Y(()=>import("./window-BVUB8gMK.js").then(c=>c.w),__vite__mapDeps([0,1])).then(async({getCurrentWindow:c})=>{const l=await c().onScaleChanged(()=>{o()});if(a){l();return}i=l}).catch(()=>{}),()=>{a=!0,i==null||i()})},[n]),m.jsx(ln.Provider,{value:n,children:e})}function pt(){return h.useContext(ln)??ct()}const Yo=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function Go(e){return be(e.labelKey)}function Gi(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function cn(e,t){return t?Gi():e}function Ji(){const{theme:e,autoTheme:t}=Fn.getState().profile;return cn(e,t)}function Xi(e){Jt({theme:e,autoTheme:!1}).catch(()=>{})}function qi(e){Jt({autoTheme:e}).catch(()=>{})}function un(e){typeof window>"u"||document.documentElement.setAttribute("data-theme",e)}function Qi(){const e=qe(n=>n.profile.theme),t=qe(n=>n.profile.autoTheme);return{theme:cn(e,t),selectedTheme:e,autoTheme:t,setTheme:Xi,setAutoTheme:qi}}function Zi(){un(Ji())}function eo({children:e}){const t=qe(n=>n.profile.theme),r=qe(n=>n.profile.autoTheme);return h.useEffect(()=>{Zi()},[t,r]),h.useEffect(()=>{if(!r||typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>{un(n.matches?"dark":"light")};return a(),typeof n.addEventListener=="function"?(n.addEventListener("change",a),()=>n.removeEventListener("change",a)):(n.addListener(a),()=>n.removeListener(a))},[r]),m.jsx(m.Fragment,{children:e})}const to={showToast:()=>"",dismissToast:()=>{}},dn=h.createContext(to);function ro(){return`toast-${Math.random().toString(36).slice(2,10)}`}function no({toast:e,onDismiss:t}){const{id:r,title:n,description:a,tone:i,durationMs:o,action:c}=e;return h.useEffect(()=>{if(o===null)return;const l=window.setTimeout(()=>{t(r)},o);return()=>{window.clearTimeout(l)}},[o,r,t,n,a,i]),m.jsxs("article",{className:"toast-card","data-tone":i,role:i==="error"?"alert":"status",children:[m.jsxs("div",{className:"toast-body",children:[m.jsx("strong",{className:"toast-title",children:n}),a?m.jsx("p",{className:"toast-description",children:a}):null]}),m.jsxs("div",{className:"toast-actions",children:[c?m.jsx("button",{className:"toast-action",type:"button",onClick:()=>{c.onClick(),t(r)},children:c.label}):null,m.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function ao({children:e}){const[t,r]=h.useState([]),n=h.useCallback(o=>{r(c=>c.filter(l=>l.id!==o))},[]),a=h.useCallback(o=>{const c=o.id??ro(),l={id:c,title:o.title,description:o.description,tone:o.tone??"info",durationMs:o.durationMs===void 0?4200:o.durationMs,action:o.action};return r(d=>{const p=d.findIndex(b=>b.id===c);if(p===-1)return[...d,l];const v=[...d];return v[p]=l,v}),c},[]),i=h.useMemo(()=>({showToast:a,dismissToast:n}),[n,a]);return m.jsxs(dn.Provider,{value:i,children:[e,m.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(o=>m.jsx(no,{toast:o,onDismiss:n},o.id))})]})}function Jo(){return h.useContext(dn)}const _t="0.8.1",fn=h.createContext(_t);function io({children:e}){const t=pt(),[r,n]=h.useState(_t);return h.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(i=>{var c,l;if(a)return;const o=i.ok?(l=(c=i.value)==null?void 0:c.version)==null?void 0:l.trim():"";n(o||_t)}),()=>{a=!0}):(n(_t),()=>{a=!0})},[t]),m.jsx(fn.Provider,{value:r,children:e})}function oo(){return h.useContext(fn)}const Fr={latestState:null,lastNotifiedVersion:null,pendingRestartVersion:null};class so{constructor(){Re(this,"state",Fr);Re(this,"listeners",new Set);Re(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Re(this,"getState",()=>this.state)}recordState(t){const r=zt(this.state.pendingRestartVersion),n=zt(t.currentVersion);this.state={latestState:t,lastNotifiedVersion:t.hasUpdate?this.state.lastNotifiedVersion:null,pendingRestartVersion:r&&r===n?null:this.state.pendingRestartVersion},this.emit()}markVersionNotified(t){this.state.lastNotifiedVersion!==t&&(this.state={...this.state,lastNotifiedVersion:t},this.emit())}markRestartPending(t){const r=zt(t);!r||this.state.pendingRestartVersion===r||(this.state={...this.state,pendingRestartVersion:r},this.emit())}reset(){this.state=Fr,this.emit()}emit(){for(const t of this.listeners)t()}}const Qe=new so;function zt(e){const t=e==null?void 0:e.trim();return t||null}function lo(e){return h.useSyncExternalStore(Qe.subscribe,()=>e(Qe.getState()))}function co(){return Qe.getState()}function uo(e){Qe.recordState(e)}function fo(e){Qe.markVersionNotified(e)}function ho(e){Qe.markRestartPending(e)}async function mo(){const e=ct(),t=ye.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function po(e={}){const t=e.notify??"never",r=await mo();return uo(r),await vo(r,t),r}async function Xo(){const e=ct(),t=ye.getState();return e.bridge.installUpdate(t.releaseChannel)}function qo(e){ho(e)}async function Qo(){var e;if(typeof window>"u"||typeof((e=window.__TAURI_INTERNALS__)==null?void 0:e.invoke)!="function")throw new Error("当前运行环境不支持桌面应用重启。");try{await window.__TAURI_INTERNALS__.invoke("restart_application")}catch(t){throw new Error(t instanceof Error?t.message:"重启应用失败。")}}async function vo(e,t){var i,o,c;if(!e.hasUpdate||t==="never")return;const r=((o=(i=e.manifest)==null?void 0:i.version)==null?void 0:o.trim())||e.currentVersion.trim();if(!r)return;const n=co().lastNotifiedVersion;if(t==="always"||n!==r)try{(await ct().bridge.showNotification(be("settings.releaseUpdateReady"),((c=e.manifest)==null?void 0:c.version)??e.currentVersion)).ok&&fo(r)}catch{}}const go=3600*1e3;function yo(){const e=Xe(a=>a.platform),t=Xe(a=>a.autoCheckUpdate),r=Xe(a=>a.releaseChannel),n=lo(a=>a.pendingRestartVersion);return h.useEffect(()=>{if(e!=="desktop"||!t||n)return;async function a(){try{await po({notify:"if-new"})}catch{}}a();const i=window.setInterval(()=>{a()},go);return()=>{window.clearInterval(i)}},[t,n,e,r]),null}const hn="codingns.server.base-url.history",nr=6,mn="__custom__";function pn(){return typeof window<"u"&&typeof window.localStorage<"u"}function vn(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function ar(e){if(!e)return null;try{return Br(e)}catch{return null}}function gn(){if(!pn())return[];const e=window.localStorage.getItem(hn);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?ar(r):null).filter(r=>!!r):[]}catch{return[]}}function bo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n)||(t.add(n),r.push(n));return r}function wo(e){const t=new Set,r=[];for(const n of e)!n||t.has(n.value)||(t.add(n.value),r.push(n));return r}function xo(e,t){const r=gn();return bo([e,...t,...r,ar(vn())]).slice(0,nr)}function Eo(e){const t=Ct(e),r=gn().map(c=>({value:c,source:"history"})),n=ar(vn()),a=e.hosts.map(c=>({value:c.baseUrl,source:"saved"})),i=zn(e).map(c=>({value:c.baseUrl,source:"discovered"})),o=t?{value:t.baseUrl,source:Hr(t)?"discovered":"saved"}:null;return wo([o,...a,...i,...r,n?{value:n,source:"origin"}:null]).slice(0,nr)}function So(e){pn()&&window.localStorage.setItem(hn,JSON.stringify(e.slice(0,nr)))}class Ro{constructor(){Re(this,"state",this.createState(ye.getState()));Re(this,"listeners",new Set);Re(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Re(this,"getState",()=>this.state);ye.subscribe(()=>{const t=this.createState(ye.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,n)=>r===this.state.options[n])&&t.presetOptions.length===this.state.presetOptions.length&&t.presetOptions.every((r,n)=>{const a=this.state.presetOptions[n];return(a==null?void 0:a.value)===r.value&&(a==null?void 0:a.source)===r.source})||(this.state=t,this.emit())})}setBaseUrl(t){const r=ye.getState(),n=Ct(r);if(!n)return!1;const a=Br(t),i=a!==n.baseUrl,o=To(a,n);if(Hr(n))return ye.updateRuntime({discoveredHosts:r.discoveredHosts.map(l=>l.id===n.id?{...l,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:l)}),this.state=this.createState(ye.getState()),this.emit(),i;const c=r.hosts.map(l=>l.id===n.id?{...l,baseUrl:a,name:new URL(a).host,relayTunnel:o,updatedAt:new Date().toISOString()}:l);return this.state=this.createState({...r,hosts:c}),this.emit(),ye.update({hosts:c}),i}reset(){this.state=this.createState(ye.getState()),this.emit()}createState(t){const r=Ct(t),n=(r==null?void 0:r.baseUrl)??"",a=Eo(t),i=xo(n,a.map(o=>o.value));return So(i),{baseUrl:n,options:i,presetOptions:a}}emit(){for(const t of this.listeners)t()}}const Gt=new Ro;function Po(e){return h.useSyncExternalStore(Gt.subscribe,()=>e(Gt.getState()))}function Zo(e,t){return t.includes(e)?e:mn}function es(){return mn}function To(e,t){const r=Vn(e);if(!r)return null;const n=t==null?void 0:t.relayTunnel,a=(n==null?void 0:n.provider)==="codingns_relay"&&n.tunnelDomain===r.tunnelDomain&&n.controlBaseUrl===r.controlBaseUrl,i=((n==null?void 0:n.candidateEndpoints)??[]).filter(o=>o.kind!=="relay");return{provider:"codingns_relay",enabled:!0,tunnelDomain:r.tunnelDomain,controlBaseUrl:r.controlBaseUrl,bindingId:a?(n==null?void 0:n.bindingId)??null:null,hostFingerprint:a?(n==null?void 0:n.hostFingerprint)??null:null,candidateEndpoints:[{endpointId:`relay-entry:${r.relayBaseUrl}`,kind:"relay",url:r.relayBaseUrl,priority:0,expiresAt:null,source:"user_saved"},...i]}}const _o={login(e,t){return Rt.login(e,t)},bootstrap(e,t,r){return Rt.bootstrap(e,t,r)},refresh(){return Rt.refresh()},logout(){Rt.clear()}},Co=h.lazy(async()=>({default:(await Y(()=>import("./ServerSettingsModal-Rkgn3jft.js"),__vite__mapDeps([2,3,4,5,6]))).ServerSettingsModal})),Vr="width=device-width, initial-scale=1.0, viewport-fit=cover",Do="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function Lo(){const e=h.useRef(null);return h.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let n;const a=()=>{o(),c()};let i=[];const o=()=>{t.width=window.innerWidth,t.height=window.innerHeight},c=()=>{i=[];const d=Math.min(50,Math.floor(t.width*t.height/25e3));for(let p=0;p<d;p++)i.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},l=()=>{r.clearRect(0,0,t.width,t.height),i.forEach((d,p)=>{d.x+=d.vx,d.y+=d.vy,d.x<0&&(d.x=t.width),d.x>t.width&&(d.x=0),d.y<0&&(d.y=t.height),d.y>t.height&&(d.y=0),r.beginPath(),r.arc(d.x,d.y,d.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${d.opacity})`,r.fill(),i.slice(p+1).forEach(v=>{const b=d.x-v.x,w=d.y-v.y,T=Math.sqrt(b*b+w*w);T<150&&(r.beginPath(),r.moveTo(d.x,d.y),r.lineTo(v.x,v.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-T/150)})`,r.stroke())})}),n=requestAnimationFrame(l)};return o(),c(),l(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(n)}},[]),m.jsx("canvas",{ref:e,className:"particle-canvas"})}function jo({text:e}){return m.jsx("span",{className:"glitch-text","data-text":e,children:e})}function No({text:e}){const[t,r]=h.useState(""),[n,a]=h.useState(!0);return h.useEffect(()=>{let i=0,o=null;const c=setInterval(()=>{i<=e.length?(r(e.slice(0,i)),i++):(clearInterval(c),o=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(c),o!==null&&window.clearTimeout(o)}},[e]),m.jsxs("span",{className:"typewriter-text",children:[t,n&&m.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function Mo(e){const t=e==null?void 0:e.captcha;if(typeof t!="object"||t===null)return null;const r=t.captchaId,n=t.imageDataUrl;return typeof r!="string"||typeof n!="string"?null:{captchaId:r,imageDataUrl:n}}function Io(){const e=rr(),t=Bn(),[r]=Ii(),n=pt(),a=oo(),i=Xe(V=>Hn(V)),o=Wn(n.platform),c=h.useMemo(()=>$n(n),[n]),l=h.useMemo(()=>c?Kn(i):{credentials:null,legacyServerBaseUrl:null},[i,c]),d=l.credentials,p=l.legacyServerBaseUrl,[v,b]=h.useState(()=>(d==null?void 0:d.username)??"admin"),[w,T]=h.useState(()=>(d==null?void 0:d.password)??""),[E,D]=h.useState(null),[k,L]=h.useState(""),[K,te]=h.useState(()=>!!d),$=Po(V=>V.baseUrl),[he,g]=h.useState($),[N,F]=h.useState(null),[I,re]=h.useState(!1),[J,oe]=h.useState(!1),[ae,se]=h.useState(null),[We,$e]=h.useState(!1),Q=Bt(V=>V.session),Te=h.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:_e}=Qi(),we=h.useRef(!1),ce=n.isNativeMobile,Ce=h.useMemo(()=>_e==="light"?"light":"dark",[_e]);h.useEffect(()=>{b((d==null?void 0:d.username)??"admin"),T((d==null?void 0:d.password)??""),D(null),L(""),te(!!d)},[d]),h.useEffect(()=>{if(typeof document>"u")return;const V=document.querySelector('meta[name="viewport"]');if(!(V instanceof HTMLMetaElement))return;const de=V.getAttribute("content")??Vr;return ce?V.setAttribute("content",Do):V.setAttribute("content",Vr),()=>{V.setAttribute("content",de)}},[ce]),h.useEffect(()=>{we.current||(we.current=!0,!(!c||!p||p===$)&&(Gt.setBaseUrl(p),g(p)))},[$,c,p]),h.useEffect(()=>{if(Q){e(Te,{replace:!0});return}if(!he)return;let V=!1;const de=window.setTimeout(()=>{Y(async()=>{const{probeHost:H}=await import("./index-CjewzOUG.js").then(ve=>ve.$);return{probeHost:H}},__vite__mapDeps([3,4])).then(({probeHost:H})=>H(he)).then(H=>{V||(H.demoMode&&($e(!0),Yn()&&F(t("auth.demoSessionExpired"))),H.reachable&&!H.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{V||F(t("auth.authUnavailable"))})},0);return()=>{V=!0,window.clearTimeout(de)}},[Q,e,he,Te,t]);async function Ue(V){V.preventDefault(),re(!0),F(null),g($),c&&!K&&i&&Gn(i);try{const de=E?{username:v,password:w,captchaId:E.captchaId,captchaCode:k}:{username:v,password:w};await _o.login(de,$),D(null),L("");const{userPreferenceStore:H}=await Y(async()=>{const{userPreferenceStore:ve}=await import("./index-CjewzOUG.js").then(gt=>gt.Z);return{userPreferenceStore:ve}},__vite__mapDeps([3,4]));await H.refreshForAuthenticatedUser(),c&&K&&i&&Jn({hostId:i,username:v,password:w}),e(Te,{replace:!0})}catch(de){if(de instanceof Xn){if(de.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}const H=Mo(de.data);H?(D(H),L("")):de.errorCode==="INVALID_CREDENTIALS"&&(D(null),L("")),F(de.message)}else F(t("auth.authUnavailable"))}finally{re(!1)}}function ue(V){b(V),E&&(D(null),L(""))}function xe(V){g(V),F(null)}const pe="login-username",Oe="login-password",vt="login-captcha";return m.jsxs("main",{className:"cyber-login-page","data-theme":Ce,"data-native-mobile":ce?"true":"false",children:[m.jsxs("div",{className:"cyber-bg",children:[m.jsx("div",{className:"cyber-grid"}),m.jsx("div",{className:"cyber-glow cyber-glow-1"}),m.jsx("div",{className:"cyber-glow cyber-glow-2"}),m.jsx(Lo,{})]}),m.jsx("div",{className:"scanlines"}),m.jsxs("div",{className:"cyber-login-container",children:[m.jsx("div",{className:"cyber-login-toolbar",children:m.jsx(ta,{variant:"compact"})}),m.jsxs("div",{className:"cyber-login-content",children:[m.jsxs("div",{className:"cyber-brand",children:[m.jsx("div",{className:"cyber-logo",children:m.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),m.jsx("h1",{className:"cyber-brand-title",children:m.jsx(jo,{text:"CodingNS"})}),m.jsx("p",{className:"cyber-brand-subtitle",children:m.jsx(No,{text:t("auth.loginSubtitle")})})]}),m.jsxs("div",{className:"cyber-card",children:[m.jsx("div",{className:"cyber-corner corner-tl"}),m.jsx("div",{className:"cyber-corner corner-tr"}),m.jsx("div",{className:"cyber-corner corner-bl"}),m.jsx("div",{className:"cyber-corner corner-br"}),m.jsxs("div",{className:"cyber-card-header",children:[m.jsx("div",{className:"cyber-line"}),m.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),m.jsx("div",{className:"cyber-line"})]}),We?m.jsxs("div",{className:"cyber-demo-banner",children:[m.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),m.jsx("span",{children:t("auth.demoBanner")})]}):null,m.jsxs("form",{className:"cyber-form",onSubmit:Ue,children:[m.jsxs("div",{className:`cyber-field ${ae==="username"?"focused":""}`,children:[m.jsx("div",{className:"cyber-field-border",children:m.jsx("div",{className:"cyber-field-border-glow"})}),m.jsxs("label",{className:"cyber-field-label",htmlFor:pe,children:[m.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),m.jsx("input",{id:pe,"aria-label":t("auth.username"),className:"cyber-input",value:v,onChange:V=>ue(V.target.value),onFocus:()=>se("username"),onBlur:()=>se(null),autoComplete:"username"})]}),m.jsxs("div",{className:`cyber-field ${ae==="password"?"focused":""}`,children:[m.jsx("div",{className:"cyber-field-border",children:m.jsx("div",{className:"cyber-field-border-glow"})}),m.jsxs("label",{className:"cyber-field-label",htmlFor:Oe,children:[m.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),m.jsx("input",{id:Oe,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:w,onChange:V=>T(V.target.value),onFocus:()=>se("password"),onBlur:()=>se(null),autoComplete:"current-password"})]}),E?m.jsxs("div",{className:"cyber-captcha-panel",children:[m.jsx("img",{alt:t("auth.captchaImageAlt"),className:"cyber-captcha-image",draggable:!1,src:E.imageDataUrl}),m.jsx("p",{className:"cyber-captcha-hint",children:t("auth.captchaHint")}),m.jsxs("div",{className:`cyber-field ${ae==="captcha"?"focused":""}`,children:[m.jsx("div",{className:"cyber-field-border",children:m.jsx("div",{className:"cyber-field-border-glow"})}),m.jsxs("label",{className:"cyber-field-label",htmlFor:vt,children:[m.jsx("span",{className:"cyber-field-icon",children:"#"}),t("auth.captcha")]}),m.jsx("input",{id:vt,"aria-label":t("auth.captcha"),className:"cyber-input",placeholder:t("auth.captchaPlaceholder"),value:k,onChange:V=>L(V.target.value),onFocus:()=>se("captcha"),onBlur:()=>se(null),autoComplete:"one-time-code"})]})]}):null,c?m.jsxs("label",{className:"cyber-remember-toggle",children:[m.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:K,onChange:V=>te(V.target.checked)}),m.jsx("span",{children:t("auth.rememberPassword")})]}):null,N?m.jsxs("div",{className:"cyber-status","data-tone":"error",children:[m.jsx("span",{className:"cyber-status-icon",children:"⚠"}),m.jsx("span",{children:N})]}):null,m.jsxs("button",{className:`cyber-submit ${I?"loading":""}`,type:"submit",disabled:I,children:[m.jsx("span",{className:"cyber-submit-glow"}),m.jsx("span",{className:"cyber-submit-border"}),m.jsx("span",{className:"cyber-submit-text",children:I?m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),o?m.jsxs("div",{className:"cyber-footer",children:[m.jsxs("div",{className:"cyber-divider",children:[m.jsx("span",{className:"cyber-divider-line"}),m.jsx("span",{className:"cyber-divider-text",children:"//"}),m.jsx("span",{className:"cyber-divider-line"})]}),m.jsxs("button",{className:"cyber-server-btn",onClick:()=>oe(!0),type:"button",children:[m.jsx("span",{className:"cyber-server-icon",children:"⚙"}),m.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),m.jsx("span",{className:"cyber-server-current",children:$})]})]}):null]})]}),m.jsxs("div",{className:"cyber-version",children:[m.jsxs("span",{className:"cyber-version-text",children:["v",a]}),m.jsx("span",{className:"cyber-version-divider",children:"|"}),m.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),o&&J?m.jsx(h.Suspense,{fallback:null,children:m.jsx(Co,{isOpen:J,onClose:()=>oe(!1),onSave:xe})}):null]})}function yn(){return m.jsx("main",{className:"page-center app-shell",children:m.jsxs("section",{className:"auth-card surface-card",children:[m.jsx("h1",{children:be("auth.trustedEntryOnlyTitle")}),m.jsx("p",{className:"status-text",children:be("auth.trustedEntryOnlyDescription")}),m.jsxs("div",{className:"field-group",children:[m.jsx("span",{children:be("auth.trustedEntryOnlyHintTitle")}),m.jsx("span",{className:"auth-server-value",children:be("auth.trustedEntryOnlyHint")})]})]})})}function Uo({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function Oo(){return!1}function bn(e,t,r=Oo()){var i,o;if(!r||t!=="web")return!1;const n=Ct(e),a=n==null?void 0:n.relayTunnel;return!(a!=null&&a.enabled&&((i=a.tunnelDomain)!=null&&i.trim())&&((o=a.controlBaseUrl)!=null&&o.trim()))}function Ao({runtimeKey:e,children:t}){return m.jsx("div",{children:t},e)}function ko(){const e=qn();return m.jsx(Ao,{runtimeKey:e,children:m.jsx(gi,{})})}function Fo(){const e=Xe(i=>i),t=pt(),r=Bt(i=>i.session),n=Bt(i=>i.sessionReady),a=mt();if(bn(e,t.platform))return m.jsx(yn,{});if(!r){const i=`${a.pathname}${a.search}`;return m.jsx(sn,{to:`/login?returnTo=${encodeURIComponent(i)}`,replace:!0})}return n?m.jsx(ko,{}):m.jsx("div",{children:be("common.loading")})}function Vo(){const e=Xe(r=>r),t=pt();return bn(e,t.platform)?m.jsx(yn,{}):m.jsx(Io,{})}function zr(){const e=pt(),t=Uo(e);return m.jsx(sn,{to:t==="mobile"?"/workspaces":"/landing",replace:!0})}function ne(e,t){return async()=>({Component:(await e())[t]})}const zo=[{path:"/bootstrap",lazy:ne(()=>Y(()=>import("./BootstrapPage-jFfl7KNK.js"),__vite__mapDeps([7,3,4])),"BootstrapPage")},{path:"/login",element:m.jsx(Vo,{})},{path:"/connect/:tunnelDomain",lazy:ne(()=>Y(()=>import("./RelayConnectEntryPage-CMtDWyGS.js"),__vite__mapDeps([8,3,4,5])),"RelayConnectEntryPage")},{path:"/desktop-window-preview",lazy:ne(()=>Y(()=>import("./DesktopDetachPreviewPage-C5c88SOX.js"),__vite__mapDeps([9,3,4])),"DesktopDetachPreviewPage")},{path:"/",element:m.jsx(Fo,{}),children:[{path:"desktop-window/:windowId",lazy:ne(()=>Y(()=>import("./DesktopWindowPage-BdKUZrKG.js"),__vite__mapDeps([10,3,4,11,12,13,0,1,6,5,14,15,16,17,18,19,20,21,22])),"DesktopWindowPage")},{lazy:ne(()=>Y(()=>import("./WorkbenchShellRoute-CGKjy4J-.js"),__vite__mapDeps([23,3,4,13,11,0,1,6,5,24])),"WorkbenchShellRoute"),children:[{index:!0,element:m.jsx(zr,{})},{path:"landing",lazy:ne(()=>Y(()=>import("./WorkbenchLandingPage-CJQ1V5U-.js"),__vite__mapDeps([25,3,4,13,11,0,1,6,5])),"WorkbenchLandingPage")},{path:"workspaces",lazy:ne(()=>Y(()=>import("./WorkspaceHomePage-I5G1p5SR.js"),__vite__mapDeps([26,3,4,13,11,0,1,6,5,27,20,21,28])),"WorkspaceHomePage")},{path:"workspaces/:workspaceId",lazy:ne(()=>Y(()=>import("./WorkspaceDetailPage-D5v-nUIi.js"),__vite__mapDeps([29,3,4,13,11,0,1,6,5,30,17,20,21,28])),"WorkspaceDetailPage")},{path:"workspaces/:workspaceId/debug",lazy:ne(()=>Y(()=>import("./WorkspaceDebugDetailPage-DCAYgays.js"),__vite__mapDeps([31,3,4,30,11,17,13,0,1,6,5])),"WorkspaceDebugDetailPage")},{path:"workspaces/:workspaceId/sessions",lazy:ne(()=>Y(()=>import("./SessionIndexPage-BOumP3ij.js"),__vite__mapDeps([32,3,4,11,13,0,1,6,5,20,21,28,33,34])),"SessionIndexPage")},{path:"workspaces/:workspaceId/sessions/:sessionId",lazy:ne(()=>Y(()=>import("./ConversationPage-sj_rn4q0.js"),__vite__mapDeps([35,3,4,6,11,13,0,1,5,36,12,14,15,16,17,18,19,20,21,22,33,34])),"ConversationPage")},{path:"workspaces/:workspaceId/tools",lazy:ne(()=>Y(()=>import("./ToolsHomePage-CJrn8ZFl.js"),__vite__mapDeps([37,3,4,13,11,0,1,6,5])),"ToolsHomePage")},{path:"workspaces/:workspaceId/tools/files",lazy:ne(()=>Y(()=>import("./ToolFilesPage-DWtpaN_7.js"),__vite__mapDeps([38,3,4,13,11,0,1,6,5])),"ToolFilesPage")},{path:"workspaces/:workspaceId/tools/git",lazy:ne(()=>Y(()=>import("./ToolGitPage-MpGXsw4_.js"),__vite__mapDeps([39,3,4,13,11,0,1,6,5])),"ToolGitPage")},{path:"workspaces/:workspaceId/tools/processes",lazy:ne(()=>Y(()=>import("./ToolProcessesPage-B1jHQKhZ.js"),__vite__mapDeps([40,3,4,13,11,0,1,6,5])),"ToolProcessesPage")},{path:"workspaces/:workspaceId/terminals",lazy:ne(()=>Y(()=>import("./TerminalPage-CBIKHI33.js"),__vite__mapDeps([19,3,4,11,13,0,1,6,5,20,21,17,18,22])),"TerminalPage")},{path:"workspaces/:workspaceId/butler",lazy:ne(()=>Y(()=>import("./AdaptiveButlerPage-b7s6F_sd.js"),__vite__mapDeps([41,3,4,13,11,0,1,6,5,36,12,14,27,20,21,42])),"AdaptiveButlerPage")},{path:"settings",lazy:ne(()=>Y(()=>import("./SettingsPage-vx_c-00-.js"),__vite__mapDeps([43,3,4,11,6,21])),"SettingsPage")},{path:"settings/:section",lazy:ne(()=>Y(()=>import("./SettingsPage-vx_c-00-.js"),__vite__mapDeps([43,3,4,11,6,21])),"SettingsPage")},{path:"*",element:m.jsx(zr,{})}]}]}];function Bo(){return Ei(zo)}function Ho(){const e=qe(r=>r.profile.language),t=h.useMemo(()=>Bo(),[]);return m.jsx(Yi,{children:m.jsx(io,{children:m.jsx(Qn,{language:e,children:m.jsx(eo,{children:m.jsxs(ao,{children:[m.jsx(yo,{}),m.jsx(ji,{router:t})]})})})})})}const ts=Object.freeze(Object.defineProperty({__proto__:null,App:Ho},Symbol.toStringTag,{value:"Module"}));export{ts as A,ta as L,sn as N,gi as O,Yo as T,Po as a,_o as b,Ko as c,Ii as d,pt as e,Jo as f,Wr as g,mt as h,lo as i,Qi as j,po as k,Xo as l,br as m,qo as n,Qo as o,oo as p,Go as q,Uo as r,Zo as s,es as t,rr as u,Gt as v};
@@ -1 +1 @@
1
- import{b as t,j as s,t as e,A as v}from"./index-CuzMc7q2.js";import{u as S,a as w,b as N}from"./App-tPcbyRdS.js";function T(){const h=S(),m=w(a=>a.baseUrl),[l,x]=t.useState("admin"),[n,f]=t.useState(""),[u,j]=t.useState(""),[i,r]=t.useState(null),[b,o]=t.useState("error"),[c,d]=t.useState(!1);async function g(a){if(a.preventDefault(),n!==u){o("error"),r(e("auth.bootstrapMismatch"));return}d(!0),r(null);try{await N.bootstrap(l,n),o("success"),r(e("auth.bootstrapSuccess")),window.setTimeout(()=>h("/login",{replace:!0}),500)}catch(p){o("error"),p instanceof v?r(p.message):r(e("auth.authUnavailable"))}finally{d(!1)}}return s.jsx("main",{className:"page-center app-shell",children:s.jsxs("section",{className:"auth-card surface-card",children:[s.jsx("h1",{children:e("auth.bootstrapTitle")}),s.jsx("p",{className:"status-text",children:e("auth.bootstrapSubtitle")}),s.jsxs("div",{className:"field-group",children:[s.jsx("span",{children:e("auth.serverCurrent")}),s.jsx("span",{className:"auth-server-value",children:m})]}),s.jsxs("form",{className:"auth-form",onSubmit:g,children:[s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.username")}),s.jsx("input",{value:l,onChange:a=>x(a.target.value)})]}),s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.password")}),s.jsx("input",{type:"password",value:n,onChange:a=>f(a.target.value)})]}),s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.confirmPassword")}),s.jsx("input",{type:"password",value:u,onChange:a=>j(a.target.value)})]}),i?s.jsx("p",{className:"status-text","data-tone":b,children:i}):null,s.jsx("button",{className:"primary-button",type:"submit",disabled:c,children:c?e("common.loading"):e("auth.submitBootstrap")})]})]})})}export{T as BootstrapPage};
1
+ import{b as t,j as s,t as e,A as v}from"./index-CjewzOUG.js";import{u as S,a as w,b as N}from"./App-B0q8uDA-.js";function T(){const h=S(),m=w(a=>a.baseUrl),[l,x]=t.useState("admin"),[n,f]=t.useState(""),[u,j]=t.useState(""),[i,r]=t.useState(null),[b,o]=t.useState("error"),[c,d]=t.useState(!1);async function g(a){if(a.preventDefault(),n!==u){o("error"),r(e("auth.bootstrapMismatch"));return}d(!0),r(null);try{await N.bootstrap(l,n),o("success"),r(e("auth.bootstrapSuccess")),window.setTimeout(()=>h("/login",{replace:!0}),500)}catch(p){o("error"),p instanceof v?r(p.message):r(e("auth.authUnavailable"))}finally{d(!1)}}return s.jsx("main",{className:"page-center app-shell",children:s.jsxs("section",{className:"auth-card surface-card",children:[s.jsx("h1",{children:e("auth.bootstrapTitle")}),s.jsx("p",{className:"status-text",children:e("auth.bootstrapSubtitle")}),s.jsxs("div",{className:"field-group",children:[s.jsx("span",{children:e("auth.serverCurrent")}),s.jsx("span",{className:"auth-server-value",children:m})]}),s.jsxs("form",{className:"auth-form",onSubmit:g,children:[s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.username")}),s.jsx("input",{value:l,onChange:a=>x(a.target.value)})]}),s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.password")}),s.jsx("input",{type:"password",value:n,onChange:a=>f(a.target.value)})]}),s.jsxs("label",{className:"field-group",children:[s.jsx("span",{children:e("auth.confirmPassword")}),s.jsx("input",{type:"password",value:u,onChange:a=>j(a.target.value)})]}),i?s.jsx("p",{className:"status-text","data-tone":b,children:i}):null,s.jsx("button",{className:"primary-button",type:"submit",disabled:c,children:c?e("common.loading"):e("auth.submitBootstrap")})]})]})})}export{T as BootstrapPage};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js"])))=>i.map(i=>d[i]);
2
- var Bi=Object.defineProperty;var Fi=(e,t,s)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var xe=(e,t,s)=>Fi(e,typeof t!="symbol"?t+"":t,s);import{t as c,b as l,u as Wi,E as Ui,j as i,m as Ss,A as $i,_ as Mn}from"./index-CuzMc7q2.js";import{D as ps,W as Vi}from"./WorkbenchModal-Bt_1fYmM.js";import{l as Gi,m as Xi,n as zi,o as ss,p as jt,q as Yi,s as gr,t as Ki,v as ms,f as bt,h as es,a as Lt,M as Qi,w as vr,x as sn,y as br,z as wr,A as Zi,S as Ji,B as eo,C as to,D as so,E as no,F as ro,G as io,H as Fs,I as Sn,J as oo,K as ao,L as lo,N as co,O as Mr,u as uo,e as nn,P as ho,Q as fo,R as po,T as mo,U as go,i as vo,j as bo,V as wo}from"./model-switch-api-c6kcbBGm.js";import{u as ht,Q as In,R as Kt,S as yn,T as Mo,U as So,V as Is,X as xn,Y as Io,f as Pn,Z as ut,c as Xe,_ as yo,$ as xo,a0 as Po,a1 as Ro,a2 as To,a3 as ko,a4 as Co,I as Eo,i as Sr,b as Rn,a5 as Tn,a6 as Ir,a7 as be,a8 as ns,a9 as yr,w as Ao,aa as ze,ab as ys,ac as xr,ad as Pr,ae as jo,af as Rr,ag as _o,ah as rn,ai as yt,aj as Ht,ak as No,r as Tr,al as Bt,M as gs,K as on,am as ts,an,ao as Ws,ap as Oo,O as vs,aq as Lo,ar as kn,H as Do,as as qo,F as Ho,at as Bo,au as kr,av as wt,aw as Fo,ax as Us,ay as ln,n as Mt,az as Wo,aA as Uo,aB as $o,aC as Vo,o as Go,C as Rt,aD as Cr,aE as Er,aF as Ar,aG as jr,D as _r,g as Ft,aH as Nr,P as Or,aI as Xo,aJ as zo,aK as Lr,aL as Yo,aM as Cn,aN as Ko,L as Qo,J as Zo}from"./WorkbenchLayout-CbpJg0g1.js";import{f as at,u as lt,e as Tt,g as xt,h as cn,c as Jo}from"./App-tPcbyRdS.js";import{R as ea,P as Dr,C as un}from"./realtime-client-CRCx5xBt.js";import{FileContextPanel as qr}from"./FileContextPanel-BcM7AIT4.js";import{GitSidebar as Hr}from"./GitSidebar-CMtkaxuI.js";import{TerminalManagerPanel as Br}from"./TerminalManagerPanel-BxlhZp8c.js";import{TerminalPage as ta}from"./TerminalPage-B6Rdhylx.js";import{f as Fr,a as bs,M as Wr}from"./MobileWorkspaceSwitcherHeader-DLkACTnQ.js";import{w as Nt,r as xs,a as En,b as An}from"./styles-JKFlsYFv.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-C751A-Sm.js";import"./file-tree-icon-BeHqeru9.js";import"./terminal-runtime-meta-CRAVR-8G.js";import"./TerminalRuntimeFallbackModal-BVLfrpSa.js";import"./MobileTopHeaderFrame-DGVOzXyg.js";function dn({connectionState:e,onReconnect:t}){const{showToast:s,dismissToast:n}=at(),r=Gi(),a=r?c(Xi(r.kind)):null;return l.useEffect(()=>{if(e==="connected"||e==="closed"){n("conversation-connection-state");return}if(e==="reconnect_failed"){s({id:"conversation-connection-state",title:c("conversation.connectionReconnectFailed"),description:a?c("conversation.reconnectFailedExplainWithRoute",{route:a}):c("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:c("conversation.reconnectButton"),onClick:t}});return}s({id:"conversation-connection-state",title:c("conversation.connectionReconnecting"),description:a?c("conversation.reconnectExplainWithRoute",{route:a}):c("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[a,e,n,t,s]),null}const sa=48;function na(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function ra(e,t){var s;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!na(e))throw new Error(c("conversation.copyContentFailed"))}}function jn(e,t,s){return Math.min(Math.max(e,t),s)}function Ps(e,t=ss){return e&&t.includes(e)?e:t[0]??"codex"}function ia(e){return ss.includes(e)}function oa(e,t){const s=e.flatMap(n=>ia(n)?[n]:[]);return s.length>0?s:t?[t]:[]}function $s(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function _n(e){var s,n;const t=$s(e);return((n=(s=t==null?void 0:t.closest("[data-message-id]"))==null?void 0:s.getAttribute("data-message-id"))==null?void 0:n.trim())||null}function aa(e,t){return[t.trim()||c("conversation.selectionActionDefaultPrompt"),"",c("conversation.selectionActionQuotedLabel"),"```text",e.trim(),"```"].join(`
2
+ var Bi=Object.defineProperty;var Fi=(e,t,s)=>t in e?Bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var xe=(e,t,s)=>Fi(e,typeof t!="symbol"?t+"":t,s);import{t as c,b as l,u as Wi,E as Ui,j as i,m as Ss,A as $i,_ as Mn}from"./index-CjewzOUG.js";import{D as ps,W as Vi}from"./WorkbenchModal-BYNuMIoV.js";import{l as Gi,m as Xi,n as zi,o as ss,p as jt,q as Yi,s as gr,t as Ki,v as ms,f as bt,h as es,a as Lt,M as Qi,w as vr,x as sn,y as br,z as wr,A as Zi,S as Ji,B as eo,C as to,D as so,E as no,F as ro,G as io,H as Fs,I as Sn,J as oo,K as ao,L as lo,N as co,O as Mr,u as uo,e as nn,P as ho,Q as fo,R as po,T as mo,U as go,i as vo,j as bo,V as wo}from"./model-switch-api-Br0ivfe5.js";import{u as ht,Q as In,R as Kt,S as yn,T as Mo,U as So,V as Is,X as xn,Y as Io,f as Pn,Z as ut,c as Xe,_ as yo,$ as xo,a0 as Po,a1 as Ro,a2 as To,a3 as ko,a4 as Co,I as Eo,i as Sr,b as Rn,a5 as Tn,a6 as Ir,a7 as be,a8 as ns,a9 as yr,w as Ao,aa as ze,ab as ys,ac as xr,ad as Pr,ae as jo,af as Rr,ag as _o,ah as rn,ai as yt,aj as Ht,ak as No,r as Tr,al as Bt,M as gs,K as on,am as ts,an,ao as Ws,ap as Oo,O as vs,aq as Lo,ar as kn,H as Do,as as qo,F as Ho,at as Bo,au as kr,av as wt,aw as Fo,ax as Us,ay as ln,n as Mt,az as Wo,aA as Uo,aB as $o,aC as Vo,o as Go,C as Rt,aD as Cr,aE as Er,aF as Ar,aG as jr,D as _r,g as Ft,aH as Nr,P as Or,aI as Xo,aJ as zo,aK as Lr,aL as Yo,aM as Cn,aN as Ko,L as Qo,J as Zo}from"./WorkbenchLayout-D48i71PU.js";import{f as at,u as lt,e as Tt,g as xt,h as cn,c as Jo}from"./App-B0q8uDA-.js";import{R as ea,P as Dr,C as un}from"./realtime-client-BlQRqVmm.js";import{FileContextPanel as qr}from"./FileContextPanel-lM5mBcfn.js";import{GitSidebar as Hr}from"./GitSidebar-CmXAhyjo.js";import{TerminalManagerPanel as Br}from"./TerminalManagerPanel-D9JHCS6d.js";import{TerminalPage as ta}from"./TerminalPage-CBIKHI33.js";import{f as Fr,a as bs,M as Wr}from"./MobileWorkspaceSwitcherHeader-DhaM9fgx.js";import{w as Nt,r as xs,a as En,b as An}from"./styles-JKFlsYFv.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-D7OgZZN-.js";import"./file-tree-icon-BFwaPxKs.js";import"./terminal-runtime-meta-BCtAYB0E.js";import"./TerminalRuntimeFallbackModal-W5NjqFEz.js";import"./MobileTopHeaderFrame-_I0t7cC_.js";function dn({connectionState:e,onReconnect:t}){const{showToast:s,dismissToast:n}=at(),r=Gi(),a=r?c(Xi(r.kind)):null;return l.useEffect(()=>{if(e==="connected"||e==="closed"){n("conversation-connection-state");return}if(e==="reconnect_failed"){s({id:"conversation-connection-state",title:c("conversation.connectionReconnectFailed"),description:a?c("conversation.reconnectFailedExplainWithRoute",{route:a}):c("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:c("conversation.reconnectButton"),onClick:t}});return}s({id:"conversation-connection-state",title:c("conversation.connectionReconnecting"),description:a?c("conversation.reconnectExplainWithRoute",{route:a}):c("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[a,e,n,t,s]),null}const sa=48;function na(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function ra(e,t){var s;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!na(e))throw new Error(c("conversation.copyContentFailed"))}}function jn(e,t,s){return Math.min(Math.max(e,t),s)}function Ps(e,t=ss){return e&&t.includes(e)?e:t[0]??"codex"}function ia(e){return ss.includes(e)}function oa(e,t){const s=e.flatMap(n=>ia(n)?[n]:[]);return s.length>0?s:t?[t]:[]}function $s(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function _n(e){var s,n;const t=$s(e);return((n=(s=t==null?void 0:t.closest("[data-message-id]"))==null?void 0:s.getAttribute("data-message-id"))==null?void 0:n.trim())||null}function aa(e,t){return[t.trim()||c("conversation.selectionActionDefaultPrompt"),"",c("conversation.selectionActionQuotedLabel"),"```text",e.trim(),"```"].join(`
3
3
  `)}function Rs(e){if(typeof window>"u")return null;const t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return null;const s=t.getRangeAt(0),n=$s(s.startContainer),r=$s(s.endContainer);if(!n||!r||!e.contains(n)||!e.contains(r))return null;const a=t.toString().trim();if(!a)return null;const o=s.getBoundingClientRect();if(!o.width&&!o.height)return null;const u=_n(s.startContainer),d=_n(s.endContainer);return{text:a,sourceMessageId:u&&u===d?u:null,rect:{left:o.left,top:o.top,right:o.right,bottom:o.bottom,width:o.width,height:o.height}}}function la({containerRef:e,session:t,currentCapabilities:s}){const n=lt(),r=Tt(),{showToast:a}=at(),{shellMode:o,requestNavigationRefresh:u,selectWorkspace:d,upsertNavigationSession:h}=ht(),f=Wi(g=>g.profile.providers),p=l.useMemo(()=>In(t==null?void 0:t.providerConfigMode,t==null?void 0:t.providerPresetId),[t==null?void 0:t.providerConfigMode,t==null?void 0:t.providerPresetId]),[x,v]=l.useState(null),[w,M]=l.useState(null),[j,y]=l.useState(!1),{visibleProviders:O}=zi(ss,j),[k,_]=l.useState(""),[A,P]=l.useState(!1),[C,m]=l.useState(Ps(t==null?void 0:t.provider)),[b,L]=l.useState(Kt),[G,X]=l.useState(p.providerConfigMode),[Z,te]=l.useState(p.providerPresetId),[D,ge]=l.useState({}),[B,S]=l.useState(!1),[U,H]=l.useState(null),[K,oe]=l.useState({}),[ue,de]=l.useState(!1),[ve,E]=l.useState(!1),[V,z]=l.useState(!1),[$,ae]=l.useState(0),[F,re]=l.useState(null),[Te,Ne]=l.useState(()=>({width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight})),q=l.useRef(!1),W=l.useRef(!1),he=l.useRef(!1),ke=l.useRef(null),me=l.useRef(null),Ee=o==="mobile"||r.isMobile,Be=l.useMemo(()=>g=>{var Y,Q;return(Ui(g)?(Q=(Y=f[g])==null?void 0:Y.defaultModel)==null?void 0:Q.trim():null)||Kt},[f]),J=l.useMemo(()=>In(G,Z),[G,Z]),se=l.useMemo(()=>oa(O,C),[C,O]),we=l.useMemo(()=>yn(C),[C]),Fe=l.useMemo(()=>we?D[we]??null:null,[D,we]),R=l.useMemo(()=>Mo(Fe),[Fe]),N=l.useMemo(()=>So(Fe),[Fe]),Ie=J.providerConfigMode==="cc-switch-preset"?J.providerPresetId??Is:Is,Pe=l.useMemo(()=>N.find(g=>g.value===Ie)??N[0]??null,[N,Ie]),ne=l.useMemo(()=>C===(t==null?void 0:t.provider)&&J.providerConfigMode===p.providerConfigMode&&J.providerPresetId===p.providerPresetId&&s?s:U??jt(C),[s,U,C,J.providerConfigMode,J.providerPresetId,t==null?void 0:t.provider,p.providerConfigMode,p.providerPresetId]),fe=l.useMemo(()=>{var Y;const g=jt(C).modelOptions??[];return(Y=ne.modelOptions)!=null&&Y.length?ne.modelOptions:g},[ne.modelOptions,C]),le=l.useMemo(()=>fe.map(g=>({value:g.id,label:xn(g)?c("conversation.modelUseCliDefault"):g.name})),[fe]),Oe=l.useMemo(()=>fe.find(g=>g.id===b)??fe[0]??null,[fe,b]),Me=l.useMemo(()=>{const g=Oe?xn(Oe)?c("conversation.modelUseCliDefault"):Oe.name:c("conversation.modelUseCliDefault");return R?`${(Pe==null?void 0:Pe.label)??c("conversation.deploymentDefaultPreset")} · ${g}`:g},[Oe,Pe,R]),De=l.useCallback(g=>{if(m(g),L(Be(g)),t&&g===t.provider&&yn(g)){X(p.providerConfigMode),te(p.providerPresetId);return}X("global-default"),te(null)},[Be,t,p.providerConfigMode,p.providerPresetId]),Re=l.useMemo(()=>{const g=K[C]??(C===(t==null?void 0:t.provider)&&J.providerConfigMode===p.providerConfigMode&&J.providerPresetId===p.providerPresetId?s:U);return!g||g.canStartSession!==!1?null:g.limitations[0]??c("conversation.capabilityDenied")},[s,U,K,C,J.providerConfigMode,J.providerPresetId,t==null?void 0:t.provider,p.providerConfigMode,p.providerPresetId]),et=l.useMemo(()=>{var je;if(!x||typeof window>"u")return null;const g=(je=e.current)==null?void 0:je.getBoundingClientRect(),Y=g?Math.max(80,g.left+80):96,Q=g?Math.min(Te.width-80,g.right-80):Te.width-96,ye=g?Math.max(12,g.top+12):12,qe=g?Math.max(ye,g.bottom-48):Math.max(12,Te.height-48),We=x.rect.left+x.rect.width/2;return{left:jn(We,Y,Math.max(Y,Q)),top:jn(x.rect.top-48,ye,qe)}},[e,x,Te.height,Te.width]);l.useEffect(()=>{if(typeof window>"u")return;const g=()=>{Ne({width:window.innerWidth,height:window.innerHeight})};return g(),window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)}},[]),l.useEffect(()=>{if(!t){me.current!==null&&typeof window<"u"&&(window.clearTimeout(me.current),me.current=null),ke.current=null,he.current=!1,v(null),M(null),y(!1);return}const g=Ps(t.provider);De(g)},[De,t]),l.useEffect(()=>{if(!j){S(!1);return}if(!we){S(!1);return}let g=!1;return S(!0),Yi().then(Y=>{g||ge(Object.fromEntries(Y.items.map(Q=>[Q.app,Q])))}).catch(()=>{g||ge({})}).finally(()=>{g||S(!1)}),()=>{g=!0}},[j,we]),l.useEffect(()=>{!we||J.providerConfigMode!=="cc-switch-preset"||!J.providerPresetId||B||!Fe||Fe.options.some(g=>g.id===J.providerPresetId)||(X("global-default"),te(null))},[B,Fe,we,J.providerConfigMode,J.providerPresetId]),l.useEffect(()=>{if(!t||!e.current||typeof window>"u"){me.current!==null&&(window.clearTimeout(me.current),me.current=null),ke.current=null,he.current=!1,v(null),M(null);return}const g=e.current,Y=_e=>{q.current||(ke.current=_e,v(_e),_e||y(!1))},Q=()=>{me.current!==null&&(window.clearTimeout(me.current),me.current=null)},ye=(_e,ct)=>{if(ke.current=_e,Q(),ct!=null&&ct.immediate){Y(_e);return}me.current=window.setTimeout(()=>{me.current=null,Y(ke.current)},sa)},qe=()=>{const _e=Rs(g);if(he.current){ke.current=_e;return}ye(_e)},We=()=>{const _e=Rs(g);if(he.current){ke.current=_e;return}ye(_e,{immediate:!0})},je=_e=>{!(_e.target instanceof Node)||!g.contains(_e.target)||(he.current=!0,Q())},Le=()=>{he.current&&(he.current=!1,ye(Rs(g)))};return document.addEventListener("pointerdown",je),document.addEventListener("selectionchange",qe),window.addEventListener("pointerup",Le),window.addEventListener("pointercancel",Le),window.addEventListener("mouseup",Le),window.addEventListener("touchend",Le),window.addEventListener("resize",We),window.addEventListener("scroll",We,!0),()=>{Q(),document.removeEventListener("pointerdown",je),document.removeEventListener("selectionchange",qe),window.removeEventListener("pointerup",Le),window.removeEventListener("pointercancel",Le),window.removeEventListener("mouseup",Le),window.removeEventListener("touchend",Le),window.removeEventListener("resize",We),window.removeEventListener("scroll",We,!0)}},[e,t]),l.useEffect(()=>{(!j||!(w!=null&&w.sourceMessageId))&&P(!1)},[j,w==null?void 0:w.sourceMessageId]),l.useEffect(()=>{if(!j||!t)return;let g=!1;return C===t.provider&&J.providerConfigMode===p.providerConfigMode&&J.providerPresetId===p.providerPresetId&&s?(de(!1),H(s),()=>{g=!0}):(de(!0),H(jt(C)),gr(C,t.workspaceId,we?{providerConfigMode:J.providerConfigMode,providerPresetId:J.providerPresetId}:void 0).then(Y=>{g||H(Y)}).catch(()=>{g||H(jt(C))}).finally(()=>{g||de(!1)}),()=>{g=!0})},[j,s,we,C,J.providerConfigMode,J.providerPresetId,t,p.providerConfigMode,p.providerPresetId]),l.useEffect(()=>{if(!j||!t){oe({});return}let g=!1;return Ki(se,t.workspaceId).then(Y=>{g||oe(Y)}),()=>{g=!0}},[j,t,se]),l.useEffect(()=>{if(!j||!t)return;const g=se.filter(Q=>{const ye=K[Q];return!ye||ye.canStartSession!==!1});if(g.length===0||g.includes(C))return;const Y=g[0];De(Y)},[j,De,K,C,t,se]),l.useEffect(()=>{var Y;const g=Be(C);if(!fe.some(Q=>Q.id===b)){if(fe.some(Q=>Q.id===g)){L(g);return}L(((Y=fe[0])==null?void 0:Y.id)??Kt)}},[fe,Be,b,C]),l.useEffect(()=>{if(!j){q.current=!1;return}q.current=!0},[j]),l.useEffect(()=>{if(typeof window>"u")return;const g=Y=>{Y.key==="Escape"&&(y(!1),M(null),v(null),q.current=!1)};return window.addEventListener("keydown",g),()=>{window.removeEventListener("keydown",g)}},[]);async function it(){var Y,Q;if(!x)return;const g=x.text;v(null),typeof window<"u"&&((Q=(Y=window.getSelection())==null?void 0:Y.removeAllRanges)==null||Q.call(Y));try{await ra(g,r),a({title:c("conversation.copyContentSuccess"),tone:"success"})}catch(ye){a({title:ye instanceof Error?ye.message:c("conversation.copyContentFailed"),tone:"error"})}}function ft(){x&&(re({title:"",content:x.text}),ae(g=>g+1),z(!0),y(!1),M(null),v(null),q.current=!1)}function pt(){var Q,ye;if(!x||!t)return;const g=x,Y=Ps(t.provider,se.length>0?se:ss);De(Y),_(""),P(!1),M(g),v(null),y(!0),typeof window<"u"&&((ye=(Q=window.getSelection())==null?void 0:Q.removeAllRanges)==null||ye.call(Q))}function Ze(g){g.preventDefault(),q.current=!0}function tt(){W.current=!0,pt()}function mt(){if(W.current){W.current=!1;return}pt()}async function Ae(){var g,Y,Q,ye;if(!(!w||!t)){if(Re){a({title:Re,tone:"error"});return}E(!0);try{const qe=aa(w.text,k),We=(Oe==null?void 0:Oe.id)===Kt?null:(Oe==null?void 0:Oe.id)??null;let je=null;if(A&&w.sourceMessageId)je=await vr(t.sessionId,{sourceType:"message",sourceMessageId:w.sourceMessageId,strategy:"auto",targetProvider:C,providerConfigMode:J.providerConfigMode,providerPresetId:J.providerPresetId,sessionKind:"annotation",annotationSourceMessageId:w.sourceMessageId,annotationSourceText:w.text}),h(je),await sn(je.sessionId,{content:qe,clientRequestId:((Y=(g=globalThis.crypto)==null?void 0:g.randomUUID)==null?void 0:Y.call(g))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:We,permissionMode:ut(),providerConfigMode:J.providerConfigMode,providerPresetId:J.providerPresetId});else{const Le=await br({workspaceId:t.workspaceId,provider:C,content:qe,clientRequestId:((ye=(Q=globalThis.crypto)==null?void 0:Q.randomUUID)==null?void 0:ye.call(Q))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:We,permissionMode:ut(),providerConfigMode:J.providerConfigMode,providerPresetId:J.providerPresetId,parentSessionId:t.sessionId,sessionKind:"annotation",annotationSourceMessageId:w.sourceMessageId??null,annotationSourceText:w.text});je=Le.session??await wr(Le.sessionId)}h(je),u(),d(je.workspaceId),n(Xe(je.workspaceId,je.sessionId)),y(!1),M(null),v(null),q.current=!1}catch(qe){a({title:qe instanceof Error?qe.message:c("conversation.selectionActionFailed"),tone:"error"})}finally{E(!1)}}}function st(g=!1){y(!1),M(null),q.current=!1,g&&v(null)}const ot=!!(!j&&x&&et),Ve=!!(j&&w),Ce=i.jsxs(ms,{children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>st(!1),children:c("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:ve||!!Re||se.length===0,onClick:()=>void Ae(),children:ve?c("conversation.sendingState"):c("conversation.selectionActionSubmit")})]}),ce=w?i.jsxs(i.Fragment,{children:[i.jsx(bt,{className:"conversation-selection-preview-section",heading:c("conversation.selectionActionPreviewLabel"),children:i.jsx("div",{className:"conversation-selection-action-dialog-quote",children:w.text})}),i.jsxs(bt,{className:"conversation-selection-request-section",children:[i.jsx(es,{className:"conversation-selection-field conversation-selection-prompt-field",label:c("conversation.selectionActionPromptLabel"),children:i.jsx("textarea",{value:k,rows:4,placeholder:c("conversation.selectionActionPromptPlaceholder"),onChange:g=>_(g.target.value)})}),i.jsxs("div",{className:"conversation-selection-context-block",children:[i.jsxs("label",{className:"conversation-selection-checkbox",children:[i.jsx("input",{type:"checkbox",checked:A,disabled:!w.sourceMessageId,onChange:g=>P(g.target.checked)}),i.jsx("span",{children:c("conversation.selectionActionIncludeContext")})]}),w.sourceMessageId?null:i.jsx("p",{className:"conversation-selection-hint",children:c("conversation.selectionActionContextUnavailable")}),Re?i.jsx("p",{className:"conversation-selection-hint",children:Re}):null]})]}),i.jsx(bt,{className:"conversation-selection-target-section",heading:c("conversation.selectionActionTargetLabel"),children:i.jsxs("div",{className:"conversation-selection-grid",children:[i.jsx(es,{className:"conversation-selection-field",label:c("conversation.forkTargetProviderLabel"),children:i.jsx("select",{value:C,onChange:g=>{De(g.target.value)},children:se.map(g=>{var Y;return i.jsx("option",{value:g,disabled:((Y=K[g])==null?void 0:Y.canStartSession)===!1,children:Lt(g,"full")},g)})})}),i.jsx(es,{className:"conversation-selection-field",label:c("conversation.forkTargetModelLabel"),children:we?i.jsx("div",{className:"conversation-selection-deployment-select",children:i.jsx(Io,{ariaLabel:c("conversation.forkTargetModelLabel"),triggerLabel:Me,presetOptions:N,selectedPresetValue:Ie,selectedPresetSummary:(Pe==null?void 0:Pe.summary)??null,onSelectPreset:g=>{if(g===Is){X("global-default"),te(null);return}X("cc-switch-preset"),te(g)},modelOptions:le,selectedModelValue:b,onSelectModel:L,loadingPresets:B,loadingModels:ue,modelColumnDisabled:ue||!!Re,showPresetColumn:R,modelEmptyText:c("conversation.deploymentModelEmpty")})}):i.jsx("select",{value:b,disabled:ue||!!Re,onChange:g=>L(g.target.value),children:fe.map(g=>i.jsx("option",{value:g.id,children:g.name},g.id))})})]})})]}):null;return!t||!ot&&!Ve||typeof document>"u"?i.jsx(Pn,{open:V,preferredWorkspaceId:(t==null?void 0:t.workspaceId)??null,preferredSessionId:(t==null?void 0:t.sessionId)??null,creationRequestId:$,initialDraft:F,onClose:()=>z(!1)}):i.jsxs(i.Fragment,{children:[xt.createPortal(ot?i.jsxs("div",{className:"conversation-selection-toolbar",style:et??void 0,onMouseDown:g=>g.preventDefault(),children:[i.jsx("button",{type:"button",className:"conversation-selection-action",onClick:()=>void it(),children:c("conversation.copyAction")}),i.jsx("button",{type:"button",className:"conversation-selection-action",onClick:ft,children:c("conversation.selectionTodoAction")}),i.jsx("button",{type:"button",className:"conversation-selection-action is-primary",onPointerDown:Ze,onMouseDown:Ze,onPointerUp:tt,onClick:mt,children:c("conversation.selectionActionButton")})]}):null,document.body),Ee?i.jsx(Qi,{open:Ve,title:c("conversation.selectionActionButton"),height:"auto",kind:"form",showHandle:!0,showCancelButton:!1,cardClassName:"conversation-selection-action-dialog",bodyClassName:"conversation-selection-action-dialog-body",footer:Ce,onClose:()=>st(!1),children:ce}):i.jsx(ps,{open:Ve,title:c("conversation.selectionActionButton"),size:"compact",layout:"form",className:"conversation-selection-action-dialog",bodyClassName:"conversation-selection-action-dialog-body",footer:Ce,onClose:()=>st(!1),children:ce}),i.jsx(Pn,{open:V,preferredWorkspaceId:t.workspaceId,preferredSessionId:t.sessionId,creationRequestId:$,initialDraft:F,onClose:()=>z(!1)})]})}const At=5,Ur=["codex","claude-code"];function $r(){return[{id:"recommended",label:c("conversation.butlerCompletionTemplateRecommendedLabel"),description:c("conversation.butlerCompletionTemplateRecommendedDescription"),value:c("conversation.butlerCompletionTemplateRecommendedValue")},{id:"spec-finish",label:c("conversation.butlerCompletionTemplateSpecLabel"),description:c("conversation.butlerCompletionTemplateSpecDescription"),value:c("conversation.butlerCompletionTemplateSpecValue")},{id:"bugfix",label:c("conversation.butlerCompletionTemplateBugfixLabel"),description:c("conversation.butlerCompletionTemplateBugfixDescription"),value:c("conversation.butlerCompletionTemplateBugfixValue")}]}function Ts(){var e;return((e=$r()[0])==null?void 0:e.value)??""}function ks(e,t=Ur){return e==="claude-code"&&t.includes("claude-code")?"claude-code":t.includes("codex")?"codex":t[0]??null}function Vr(e){return e==="codex"||e==="claude-code"}function ca(e){return e.flatMap(t=>!t.enabled||!Vr(t.provider)?[]:[t.provider])}function Gr({session:e,showTrigger:t=!0,openRequestKey:s=0}){const{showToast:n}=at(),{requestNavigationRefresh:r}=ht(),a=l.useId(),o=l.useId(),u=l.useId(),d=l.useId(),[h,f]=l.useState(!1),[p,x]=l.useState(!1),[v,w]=l.useState(null),[M,j]=l.useState(null),[y,O]=l.useState(null),[k,_]=l.useState(ks(e==null?void 0:e.provider)),[A,P]=l.useState(""),[C,m]=l.useState(()=>Ts()),[b,L]=l.useState(At),[G,X]=l.useState(!1),[Z,te]=l.useState(0),{items:D}=Zi(!!(e!=null&&e.sessionId)),ge=$r(),B=l.useMemo(()=>D?ca(D):Ur,[D]),S=D!==null&&B.length===0,U=l.useMemo(()=>{var F;return((F=e==null?void 0:e.title)==null?void 0:F.trim())||null},[e==null?void 0:e.title]),H=l.useMemo(()=>v?{workspaceId:v.workspaceId,project:v.project,session:v.session}:null,[v]),K=(v==null?void 0:v.latestFollowUpTask)??null,oe=(v==null?void 0:v.latestVerificationRun)??null,ue=K&&(K.status==="active"||K.status==="waiting_user")?K:null,de=oe&&(oe.status==="queued"||oe.status==="running")?oe:null;l.useEffect(()=>{f(!1),X(!1),j(null),w(null),P(""),_(ks(e==null?void 0:e.provider)),m(Ts()),L(At)},[e==null?void 0:e.sessionId]),l.useEffect(()=>{const F=ks(e==null?void 0:e.provider,B);(!k||!B.includes(k))&&_(F)},[B,k,e==null?void 0:e.provider]),l.useEffect(()=>{if(!(e!=null&&e.sessionId)){x(!1);return}let F=!1;return x(!0),j(null),yo(e.sessionId).then(re=>{F||w(re.context)}).catch(re=>{F||(w(null),j(re instanceof Error?re.message:c("conversation.butlerActionLoadFailed")))}).finally(()=>{F||x(!1)}),()=>{F=!0}},[Z,e==null?void 0:e.sessionId]);function ve(){p||te(F=>F+1)}function E(){!v&&!p&&ve()}if(l.useEffect(()=>{t||s<=0||(f(!0),E())},[p,s,t,v]),!(e!=null&&e.sessionId))return null;async function V(){if(!H){E();return}if(!k)return;const F=A.trim(),re=C.trim();if(!F){n({title:c("conversation.butlerFollowUpObjectiveRequired"),tone:"warning"});return}if(!re){n({title:c("conversation.butlerFollowUpCompletionCriteriaRequired"),tone:"warning"});return}O("follow-up");try{const Te=await ko({projectId:H.project.id,butlerSessionId:H.session.id,providerId:k,objective:F,completionCriteria:re,maxAutoContinueCount:b});w(Ne=>Ne&&{...Ne,latestFollowUpTask:Te.task}),r(),n({title:c("conversation.butlerFollowUpStarted"),description:c("conversation.butlerFollowUpStartedDescription",{projectName:H.project.name}),tone:"success"}),P(""),m(Ts()),L(At),f(!1)}catch(Te){n({title:c("conversation.butlerFollowUpFailed"),description:Te instanceof Error?Te.message:void 0,tone:"error"})}finally{O(null)}}async function z(){if(K){O("follow-up");try{const F=await Po(K.id);w(re=>re&&{...re,latestFollowUpTask:F.task}),r(),n({title:c("conversation.butlerFollowUpStopped"),description:c("conversation.butlerFollowUpStoppedDescription"),tone:"success"}),f(!1)}catch(F){n({title:c("conversation.butlerFollowUpStopFailed"),description:F instanceof Error?F.message:void 0,tone:"error"})}finally{O(null)}}}async function $(){if(!H){E();return}O("verification");try{const F=await To({projectId:H.project.id,butlerSessionId:H.session.id,verificationType:"browser",targetRef:U||H.session.title||H.project.name});w(re=>re&&{...re,latestVerificationRun:F.result.run}),r(),n({title:c("conversation.butlerVerificationStarted"),description:c("conversation.butlerVerificationStartedDescription",{projectName:H.project.name}),tone:"success"}),f(!1)}catch(F){n({title:c("conversation.butlerVerificationFailed"),description:F instanceof Error?F.message:void 0,tone:"error"})}finally{O(null)}}async function ae(){if(oe){O("verification");try{const F=await Ro(oe.projectId,oe.id);w(re=>re&&{...re,latestVerificationRun:F.run}),r(),n({title:c("conversation.butlerVerificationStopped"),description:c("conversation.butlerVerificationStoppedDescription"),tone:"success"}),f(!1)}catch(F){n({title:c("conversation.butlerVerificationStopFailed"),description:F instanceof Error?F.message:void 0,tone:"error"})}finally{O(null)}}}return i.jsxs(i.Fragment,{children:[t?i.jsxs("div",{className:"conversation-butler-entry",onMouseEnter:()=>{X(!0),E()},onMouseLeave:()=>{X(!1)},children:[i.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":c("conversation.butlerActionButton"),title:c("conversation.butlerActionButton"),onFocus:()=>{X(!0),E()},onBlur:()=>{X(!1)},onClick:()=>{f(!0),E()},children:i.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:i.jsx(xo,{})})}),G?i.jsxs("div",{className:"conversation-butler-analysis-popover",role:"status","aria-live":"polite",children:[i.jsx("strong",{children:c("conversation.butlerAnalysisTitle")}),p?i.jsx("p",{children:c("conversation.butlerActionLoading")}):M?i.jsx("p",{children:M}):K?i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:[c("conversation.butlerAnalysisObjectiveLabel"),":",K.objective]}),i.jsxs("p",{children:[c("conversation.butlerAnalysisStatusLabel"),":",Nn(K.status)]}),i.jsxs("p",{children:[c("conversation.butlerAnalysisSummaryLabel"),":",K.lastAutomationSummary||K.waitingReason||c("conversation.butlerAnalysisEmpty")]}),K.waitingReason?i.jsxs("p",{children:[c("conversation.butlerAnalysisWaitingReasonLabel"),":",K.waitingReason]}):null]}):i.jsx("p",{children:c("conversation.butlerAnalysisEmpty")})]}):null]}):null,i.jsx(Vi,{open:h,title:c("conversation.butlerActionModalTitle"),description:c("conversation.butlerActionModalDescription"),className:"conversation-butler-modal-card",footer:!p&&!M&&H?i.jsxs(ms,{children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:y!==null,onClick:()=>{$()},children:c("conversation.butlerVerificationAction")}),i.jsx("button",{type:"button",className:"primary-button",disabled:y!==null||S||!k,onClick:()=>{V()},children:c("conversation.butlerFollowUpAction")})]}):void 0,onClose:()=>{y||f(!1)},children:i.jsxs("div",{className:"conversation-butler-modal",children:[p?i.jsx("p",{className:"conversation-butler-modal-hint",children:c("conversation.butlerActionLoading")}):null,!p&&M?i.jsx("p",{className:"conversation-butler-modal-error",children:M}):null,!p&&!M&&H?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"conversation-butler-target-grid",children:[i.jsxs("div",{className:"conversation-butler-target-card",children:[i.jsx("span",{children:c("conversation.butlerActionProjectLabel")}),i.jsx("strong",{children:H.project.name})]}),i.jsxs("div",{className:"conversation-butler-target-card",children:[i.jsx("span",{children:c("conversation.butlerActionSessionLabel")}),i.jsx("strong",{children:H.session.title||U||H.session.sessionId})]})]}),i.jsxs("div",{className:"conversation-butler-follow-up-grid",children:[i.jsxs("div",{className:"workbench-modal-field conversation-butler-modal-field",children:[i.jsxs("div",{className:"conversation-butler-field-heading",children:[i.jsx("label",{children:c("conversation.butlerFollowUpProviderLabel")}),i.jsx("small",{children:c("conversation.butlerFollowUpProviderHint")})]}),S?i.jsx("p",{className:"conversation-butler-modal-hint",children:c("conversation.butlerFollowUpProviderHint")}):i.jsx(Ji,{workspaceId:H.workspaceId,providers:B,selectedProvider:k,disabled:y!==null,onSelect:F=>{Vr(F)&&_(F)}})]}),i.jsxs("div",{className:"workbench-modal-field conversation-butler-modal-field conversation-butler-round-limit-field",children:[i.jsxs("div",{className:"conversation-butler-field-heading",children:[i.jsx("label",{htmlFor:d,children:c("conversation.butlerFollowUpRoundLimitLabel")}),i.jsx("small",{children:c("conversation.butlerFollowUpRoundLimitHint")})]}),i.jsx("input",{id:d,type:"number",min:1,max:20,value:b,disabled:y!==null,onChange:F=>{const re=Number.parseInt(F.target.value,10);L(Number.isFinite(re)?re:At)}})]})]}),i.jsxs("div",{className:"workbench-modal-field conversation-butler-modal-field",children:[i.jsx("label",{htmlFor:a,children:c("conversation.butlerFollowUpObjectiveLabel")}),i.jsx("textarea",{id:a,rows:3,value:A,placeholder:c("conversation.butlerFollowUpObjectivePlaceholder"),disabled:y!==null,onChange:F=>{P(F.target.value)}})]}),i.jsxs("div",{className:"workbench-modal-field conversation-butler-modal-field",children:[i.jsxs("div",{className:"conversation-butler-field-heading",children:[i.jsx("label",{htmlFor:o,children:c("conversation.butlerFollowUpCompletionCriteriaLabel")}),i.jsx("small",{id:u,children:c("conversation.butlerCompletionTemplateSectionHint")})]}),i.jsx("textarea",{id:o,rows:3,value:C,placeholder:c("conversation.butlerFollowUpCompletionCriteriaPlaceholder"),"aria-describedby":u,disabled:y!==null,onChange:F=>{m(F.target.value)}}),i.jsx("div",{className:"conversation-butler-preset-grid",role:"group","aria-label":c("conversation.butlerCompletionTemplateSectionLabel"),children:ge.map(F=>i.jsxs("button",{type:"button",className:"conversation-butler-preset-card","data-selected":C.trim()===F.value,"aria-pressed":C.trim()===F.value,disabled:y!==null,onClick:()=>{m(F.value)},children:[i.jsx("strong",{children:F.label}),i.jsx("span",{children:F.description})]},F.id))})]}),ue||de?i.jsxs("div",{className:"conversation-butler-meta-grid",children:[ue?i.jsxs("div",{className:"conversation-butler-target-card conversation-butler-current-task-card",children:[i.jsx("span",{children:c("conversation.butlerCurrentFollowUpLabel")}),i.jsx("strong",{children:Nn(ue.status)}),i.jsx("small",{children:c("conversation.butlerCurrentFollowUpProgress",{current:ue.autoContinueCount,max:ue.maxAutoContinueCount??At})}),i.jsx("button",{type:"button",className:"workbench-secondary-button",disabled:y!==null,onClick:()=>{z()},children:c("conversation.butlerStopFollowUpAction")})]}):null,de?i.jsxs("div",{className:"conversation-butler-target-card conversation-butler-current-task-card",children:[i.jsx("span",{children:c("conversation.butlerCurrentVerificationLabel")}),i.jsx("strong",{children:ua(de.status)}),i.jsx("small",{children:de.targetRef||de.verificationType}),i.jsx("button",{type:"button",className:"workbench-secondary-button",disabled:y!==null,onClick:()=>{ae()},children:c("conversation.butlerStopVerificationAction")})]}):null]}):null]}):null]})})]})}function Nn(e){switch(e){case"waiting_user":return c("shell.butlerAutomationStatusWaitingUser");case"completed":return c("shell.butlerAutomationStatusCompleted");case"failed":return c("shell.butlerAutomationStatusFailed");case"cancelled":return c("shell.butlerAutomationStatusCancelled");case"active":default:return c("shell.butlerAutomationStatusActive")}}function ua(e){switch(e){case"queued":case"running":return c("shell.butlerAutomationStatusActive");case"passed":case"skipped":return c("shell.butlerAutomationStatusCompleted");case"failed":return c("shell.butlerAutomationStatusFailed");case"cancelled":default:return c("shell.butlerAutomationStatusCancelled")}}const da=340;function ha({session:e,onOpenBranchTree:t}){const s=lt(),n=cn(),r=l.useRef(null),a=l.useRef(null),[o,u]=l.useState(!1),[d,h]=l.useState(null),[f,p]=l.useState(null),[x,v]=l.useState(0);l.useEffect(()=>{u(!1),h(null)},[n.pathname,n.search]),l.useLayoutEffect(()=>{if(!o||!d||typeof window>"u"){p(null);return}const P=()=>{var L,G;const b=Eo(d,{width:((L=a.current)==null?void 0:L.offsetWidth)??0,height:((G=a.current)==null?void 0:G.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:da});p({position:"fixed",left:`${Math.round(b.left)}px`,top:`${Math.round(b.top)}px`,width:`${Math.round(b.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(b.maxHeight)}px`,transformOrigin:b.transformOrigin})},C=b=>{var G,X;const L=b.target;L&&!((G=a.current)!=null&&G.contains(L))&&!((X=r.current)!=null&&X.contains(L))&&M()},m=b=>{b.key==="Escape"&&M()};return P(),window.addEventListener("pointerdown",C),window.addEventListener("keydown",m),window.addEventListener("resize",P),window.addEventListener("scroll",P,!0),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",m),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}},[d,o]);function w(){var C;const P=(C=r.current)==null?void 0:C.getBoundingClientRect();P&&(h({x:P.right,y:P.bottom}),u(!0))}function M(){u(!1),h(null)}function j(P){s(P),M()}function y(P){const C=new URLSearchParams(n.search);C.set("toolPanel",P),j(`${n.pathname}?${C.toString()}`)}function O(){if(o){M();return}w()}function k(P){P.key!=="ContextMenu"&&!(P.shiftKey&&P.key==="F10")||(P.preventDefault(),P.stopPropagation(),w())}if(!e)return null;const _=[{key:"assistant",label:c("shell.butlerEntry"),onSelect:()=>{v(P=>P+1),M()}},...t?[{key:"branch",label:c("conversation.branchAction"),onSelect:()=>{t(),M()}}]:[],{key:"files",label:c("shell.filesEntry"),onSelect:()=>{y("files")}},{key:"git",label:c("shell.gitEntry"),onSelect:()=>{y("git")}},{key:"processes",label:c("shell.mobileConversationToolProcessesTab"),onSelect:()=>{y("processes")}}],A=o&&typeof document<"u"?xt.createPortal(i.jsx("div",{ref:a,className:"session-action-menu mobile-conversation-action-menu surface-card",role:"menu","aria-label":c("conversation.moreSessionActions"),style:f??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:P=>P.stopPropagation(),children:_.map(P=>i.jsx("button",{type:"button",className:"session-action-menu-item mobile-conversation-action-menu-item",role:"menuitem",onClick:P.onSelect,children:P.label},P.key))}),document.body):null;return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"mobile-conversation-session-actions",children:[i.jsx("button",{ref:r,type:"button",className:"conversation-header-ai-button mobile-conversation-more-button","aria-label":c("conversation.moreSessionActions"),title:c("conversation.moreSessionActions"),"aria-haspopup":"menu","aria-expanded":o,onClick:O,onKeyDown:k,children:i.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:i.jsx(Co,{})})}),i.jsx(Gr,{session:e,showTrigger:!1,openRequestKey:x})]}),A]})}function Xr({items:e,deletingQueueItemId:t=null,steeringQueueItemId:s=null,canSteer:n=!1,onDelete:r,onSteer:a}){return e.length===0?null:i.jsxs("section",{className:"queued-message-list","aria-label":c("conversation.queueTitle"),children:[i.jsx("div",{className:"queued-message-list__header",children:i.jsx("h2",{children:`${c("conversation.queueTitle")} · ${e.length}`})}),i.jsx("div",{className:"queued-message-list__items",children:e.map((o,u)=>{const d=o.status==="queued"||o.status==="failed",h=n&&typeof a=="function"&&(o.status==="queued"||o.status==="failed");return i.jsxs("article",{className:"queued-message-item",children:[i.jsxs("div",{className:"queued-message-item__main",children:[i.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:u+1}),i.jsx("p",{className:"queued-message-item__content",title:o.content||c("conversation.queueImageOnly"),children:o.content||c("conversation.queueImageOnly")}),i.jsx("span",{className:`queued-message-item__status queued-message-item__status--${o.status}`,children:o.status==="failed"?c("conversation.queueStatusFailed"):c("conversation.queueStatusQueued")}),i.jsxs("div",{className:"queued-message-item__actions",children:[h?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void a(o.id),disabled:s===o.id,"aria-label":c("conversation.queueSteer"),title:c("conversation.queueSteer"),children:s===o.id?c("conversation.queueSteering"):c("conversation.queueSteer")}):null,d?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void r(o.id),disabled:t===o.id,"aria-label":c("conversation.queueDelete"),title:c("conversation.queueDelete"),children:t===o.id?"…":"×"}):null]})]}),o.errorDetail?i.jsx("p",{className:"queued-message-item__error",children:o.errorDetail}):null]},o.id)})})]})}function fa(e){const{sending:t,setSending:s,session:n,runtimeHasActiveRun:r,runtimeCanInterrupt:a}=e,o=l.useRef(!1);l.useEffect(()=>{if(!t){o.current=!1;return}if(pa(n,r,a)){o.current=!0;return}o.current&&(o.current=!1,s(!1))},[a,r,t,n,s])}function pa(e,t,s){return t===!0||s===!0||(e==null?void 0:e.runningState)==="stale"||(e==null?void 0:e.runningState)==="unknown"?!0:Sr(e)}const ma=30,Cs=80,_t=60,zr=600,On=300*1e3,ga=600,va=5e3,ba=1e4,Vs=120*1e3,wa=8,Ma=/\[\[CODINGNS_IMAGE_ATTACHMENTS\]\][\s\S]*?\[\[\/CODINGNS_IMAGE_ATTACHMENTS\]\]/g;class Sa{constructor(t,s={}){xe(this,"state");xe(this,"authoritativeMessages",[]);xe(this,"runtimeOverlayMessages",[]);xe(this,"activeRuntimeOverlayKeys",[]);xe(this,"pendingMessages",[]);xe(this,"listeners",new Set);xe(this,"realtimeClient",null);xe(this,"historyBootstrapFallbackTimer",null);xe(this,"historyBootstrapEnvelopeReceived",!1);xe(this,"markSeenTimer",null);xe(this,"markSeenInFlight",!1);xe(this,"lastMarkSeenRequestAt",0);xe(this,"seenWatermark",null);xe(this,"runtimeRefreshTimer",null);xe(this,"runtimeRefreshMode",null);xe(this,"replaceSnapshotSeedOnBackfill",!1);xe(this,"olderHistoryPrefetchCursor",null);xe(this,"olderHistoryPrefetchPromise",null);xe(this,"prefetchedOlderHistoryPage",null);xe(this,"pendingReplyDebugTraces",[]);xe(this,"hasAuthoritativeBootstrapMessages");xe(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));xe(this,"getState",()=>this.state);var o;this.sessionId=t,this.options=s;const n=Rn(qs(t),On);this.hasAuthoritativeBootstrapMessages=(((o=s.bootstrapMessages)==null?void 0:o.length)??0)>0;const r=Qt(s.initialSession??null,(n==null?void 0:n.session)??null),a=Bn(Ia(),this.sessionId,{type:"timeline.seed",source:"constructor_seed",snapshotMessages:(n==null?void 0:n.messages)??[],bootstrapMessages:s.bootstrapMessages??[],replaceSnapshotSeedOnBackfill:!this.hasAuthoritativeBootstrapMessages&&((n==null?void 0:n.messages.length)??0)>0&&((n==null?void 0:n.messages.length)??0)<_t&&((n==null?void 0:n.pagesLoaded)??0)<=1});this.authoritativeMessages=a.timeline.authoritativeMessages,this.runtimeOverlayMessages=a.timeline.runtimeOverlayMessages,this.activeRuntimeOverlayKeys=a.timeline.activeRuntimeOverlayKeys,this.pendingMessages=a.timeline.pendingMessages,this.replaceSnapshotSeedOnBackfill=a.timeline.replaceSnapshotSeedOnBackfill,this.state=Tn({session:r,capabilities:(n==null?void 0:n.capabilities)??null,runtimeHasActiveRun:(n==null?void 0:n.runtimeHasActiveRun)??null,runtimeCanInterrupt:(n==null?void 0:n.runtimeCanInterrupt)??null,contextUsage:(n==null?void 0:n.contextUsage)??null,messages:a.messages,timelineItems:js(r,a.messages),permissionRequests:(n==null?void 0:n.permissionRequests)??[],queuedMessages:(n==null?void 0:n.queuedMessages)??[],olderCursor:(n==null?void 0:n.olderCursor)??null,hasOlderMessages:(n==null?void 0:n.hasOlderMessages)??!1,lastCursor:(n==null?void 0:n.lastCursor)??null,interruptSource:(n==null?void 0:n.interruptSource)??null,pagesLoaded:(n==null?void 0:n.pagesLoaded)??0}),this.seenWatermark=(r==null?void 0:r.lastSeenAt)??null}async initialize(){this.historyBootstrapEnvelopeReceived=!1,this.clearHistoryBootstrapFallbackTimer(),this.clearOlderHistoryPrefetch();const t=this.options.bootstrapMessages??[],s=this.applyTimelineEvent({type:"history.merge",source:"initialize_bootstrap",messages:t,replaceSnapshotSeed:!1}),n=this.hasAuthoritativeBootstrapMessages;this.patch({messages:s.messages,historyState:Za(this.state.session,n?this.authoritativeMessages.length:0),loadingOlderMessages:!1,olderCursor:n?null:this.state.olderCursor,hasOlderMessages:vt({session:this.state.session,loadedMessageCount:this.authoritativeMessages.length,olderCursor:n?null:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),pagesLoaded:n?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshPermissionRequests(),this.refreshQueue();try{this.startRealtime(),n&&this.scheduleMarkSeen()}catch(r){this.handleError(r)}}async reload(){var n,r;this.clearHistoryBootstrapFallbackTimer(),this.historyBootstrapEnvelopeReceived=!1,this.clearOlderHistoryPrefetch(),(n=this.realtimeClient)==null||n.close(),this.realtimeClient=null;const t=Rn(qs(this.sessionId),On),s=this.applyTimelineEvent({type:"timeline.seed",source:"reload_seed",snapshotMessages:(t==null?void 0:t.messages)??[],bootstrapMessages:this.options.bootstrapMessages??[],replaceSnapshotSeedOnBackfill:!this.hasAuthoritativeBootstrapMessages&&((t==null?void 0:t.messages.length)??0)>0&&((t==null?void 0:t.messages.length)??0)<_t&&((t==null?void 0:t.pagesLoaded)??0)<=1});this.state=Tn({session:Qt(this.options.initialSession??null,(t==null?void 0:t.session)??null),capabilities:(t==null?void 0:t.capabilities)??null,runtimeHasActiveRun:(t==null?void 0:t.runtimeHasActiveRun)??null,runtimeCanInterrupt:(t==null?void 0:t.runtimeCanInterrupt)??null,contextUsage:(t==null?void 0:t.contextUsage)??null,messages:s.messages,permissionRequests:(t==null?void 0:t.permissionRequests)??[],queuedMessages:(t==null?void 0:t.queuedMessages)??[],olderCursor:(t==null?void 0:t.olderCursor)??null,hasOlderMessages:(t==null?void 0:t.hasOlderMessages)??!1,lastCursor:(t==null?void 0:t.lastCursor)??null,pagesLoaded:(t==null?void 0:t.pagesLoaded)??0}),this.seenWatermark=((r=this.state.session)==null?void 0:r.lastSeenAt)??null,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const s=Qt(this.state.session,t);s!==this.state.session&&this.patch({session:s,hasOlderMessages:vt({session:s,loadedMessageCount:this.authoritativeMessages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages})})}async sendMessage(t,s){const n=Kn();this.beginPendingReplyDebugTrace("send_live",n,t.length);const r=Ir(this.sessionId,t,n,(s==null?void 0:s.attachmentMeta)??[],(s==null?void 0:s.attachments)??[],za(this.buildTimelineMessages("send_sequence"),this.state.session)),a=this.applyTimelineEvent({type:"pending.insert",source:"send_pending",pending:r});this.patch({messages:a.messages,session:Je(this.state.session,"running"),runtimeHasActiveRun:Qn(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:Zn(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const o=await this.sendMessageWithFallback(t,n,s);this.markPendingReplyDebugTraceResponseReady(n,{returnedMessageId:o.message.messageId,returnedProviderSessionId:o.message.providerSessionId}),this.resolvePendingMessage(o.message,n),this.patch({messages:this.buildTimelineMessages("send_resolved")})}catch(o){this.failPendingReplyDebugTrace(n,o);const u=this.applyTimelineEvent({type:"pending.fail",source:"send_failed",clientRequestId:n});throw this.patch({messages:u.messages,session:Je(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),o}}async retryMessage(t){const s=this.pendingMessages.find(r=>r.clientRequestId===t);if(!s)return;const n=this.applyTimelineEvent({type:"pending.retry",source:"retry_pending",clientRequestId:t});this.patch({messages:n.messages,runtimeHasActiveRun:Qn(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:Zn(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt}),this.beginPendingReplyDebugTrace("retry_live",t,s.content.length);try{const r=await this.sendMessageWithFallback(s.content,t,{attachments:s.attachmentPayloads??[],attachmentMeta:s.attachments});this.markPendingReplyDebugTraceResponseReady(t,{returnedMessageId:r.message.messageId,returnedProviderSessionId:r.message.providerSessionId}),this.resolvePendingMessage(r.message,t),this.patch({messages:this.buildTimelineMessages("retry_resolved")})}catch(r){this.failPendingReplyDebugTrace(t,r);const a=this.applyTimelineEvent({type:"pending.fail",source:"retry_failed",clientRequestId:t});throw this.patch({messages:a.messages,session:Je(this.state.session,"failed")}),r}}async enqueueMessage(t,s){const n=Kn();try{const r=await eo(this.sessionId,{content:t,clientRequestId:n,model:(s==null?void 0:s.model)??null,reasoningLevel:(s==null?void 0:s.reasoningLevel)??null,permissionMode:ut(),attachments:(s==null?void 0:s.attachments)??[],providerConfigMode:s==null?void 0:s.providerConfigMode,providerPresetId:(s==null?void 0:s.providerPresetId)??null});this.patch({queuedMessages:ll(this.state.queuedMessages,r)}),await this.refreshQueue()}catch(r){throw r}}async deleteQueuedMessage(t){await to(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await so(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await no(this.sessionId),this.patch({session:Je(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,interruptSource:"user",errorCode:null,errorDetail:null})}async replyPermissionRequest(t,s){if(!(this.state.permissionRequests.find(a=>a.id===t)??null))return;const r=await ro(this.sessionId,t,s);this.patch({permissionRequests:Hs(this.state.permissionRequests,r)})}reconnect(){var t;(t=this.realtimeClient)==null||t.reconnectNow()}async loadOlderMessages(){var t;if(!(this.state.historyState!=="ready"||this.state.loadingOlderMessages||!this.state.olderCursor)){this.patch({loadingOlderMessages:!0,errorCode:null,errorDetail:null});try{const s=this.state.olderCursor,n=await this.takePrefetchedOlderHistoryPage(s);if(n&&this.state.olderCursor===s){this.applyOlderHistoryPage(n,"prefetch_cache");return}if(!((t=this.realtimeClient)==null?void 0:t.requestOlderMessages(s,Cs)))throw new Error("REALTIME_NOT_CONNECTED")}catch(s){const n=s instanceof Error?s.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:n})}}}destroy(){var t;this.clearHistoryBootstrapFallbackTimer(),this.clearOlderHistoryPrefetch(),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.pendingReplyDebugTraces.length=0,this.markSeenTimer!==null&&(window.clearTimeout(this.markSeenTimer),this.markSeenTimer=null),this.runtimeRefreshTimer!==null&&(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null),this.runtimeRefreshMode=null}startRealtime(){var s;if(!((s=Ss.getState().session)==null?void 0:s.accessToken)){Ss.clear();return}this.realtimeClient=new ea({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:_t,onSubscribed:()=>{be("session_send.realtime_subscribed",{sessionId:this.sessionId,lastCursor:this.state.lastCursor}),this.patch({connectionState:"connected",hasOlderMessages:vt({session:this.state.session,loadedMessageCount:this.authoritativeMessages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages})}),this.scheduleHistoryBootstrapFallback()},onConnectionChange:n=>{var a;const r=this.state.connectionState;if(this.patch({connectionState:n,session:n==="reconnecting"&&Qe((a=this.state.session)==null?void 0:a.runningState)?Je(this.state.session,"reconnecting"):this.state.session}),n==="connected"){this.clearRuntimeRefreshTimer("poll"),r!=="closed"&&r!=="connected"&&this.patch({errorCode:null,errorDetail:null});return}this.scheduleRuntimeRefresh("poll","connection_state_change")},onEnvelope:n=>{var u,d;this.historyBootstrapEnvelopeReceived=!0,this.clearHistoryBootstrapFallbackTimer();const r=n.type==="session.backfill"&&this.replaceSnapshotSeedOnBackfill,{messages:a,replacedSnapshotSeed:o}=this.mergeHistoryMessages(n.messages,r,n.type==="session.backfill"?"realtime_backfill":"realtime_delta");this.patch({messages:a,lastCursor:n.cursor,historyState:"ready",olderCursor:n.type==="session.backfill"&&!o&&this.state.pagesLoaded>1?this.state.olderCursor:n.olderCursor??this.state.olderCursor,hasOlderMessages:n.type==="session.backfill"?!o&&this.state.pagesLoaded>1?this.state.hasOlderMessages:!!n.olderCursor:vt({session:this.state.session,loadedMessageCount:this.authoritativeMessages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),pagesLoaded:n.type==="session.backfill"?!o&&this.state.pagesLoaded>1?this.state.pagesLoaded:Math.max(this.state.pagesLoaded,this.authoritativeMessages.length>0?1:0):this.state.pagesLoaded,session:Je(this.state.session,Gn(n.type,(u=this.state.session)==null?void 0:u.runningState))}),(d=this.realtimeClient)==null||d.updateCursor(n.cursor),this.scheduleMarkSeen(),this.scheduleOlderHistoryPrefetch(n.type==="session.backfill"?"backfill":"delta"),this.state.queuedMessages.length>0&&this.refreshQueue()},onOlderHistory:n=>{this.applyOlderHistoryPage({messages:n.messages,nextCursor:n.olderCursor},"realtime")},onRuntimeMessage:n=>{this.handleRuntimeMessage(n)},onActivity:n=>{this.handleActivity(n)},onRuntimeStatus:n=>{this.handleRuntimeStatus(n)},onRuntimeError:n=>{this.handleRuntimeError(n)},onInterrupted:n=>{this.handleInterrupted(n)},onPermissionRequest:n=>{this.handlePermissionRequest(n)},onPermissionRequestResolved:n=>{this.handlePermissionRequestResolved(n)},onError:n=>{this.patch({loadingOlderMessages:!1,errorCode:n.error_code,errorDetail:n.detail})},onUnauthorized:()=>{Ss.clear()}}),this.realtimeClient.start()}patch(t){let s=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),s={...t,session:this.applySeenWatermark(t.session??null)}),(Object.prototype.hasOwnProperty.call(s,"session")||Object.prototype.hasOwnProperty.call(s,"messages"))&&(s={...s,timelineItems:js((Object.prototype.hasOwnProperty.call(s,"session")?s.session:this.state.session)??null,(Object.prototype.hasOwnProperty.call(s,"messages")?s.messages:this.state.messages)??[])}),this.state={...this.state,...s},(Object.prototype.hasOwnProperty.call(s,"session")||Object.prototype.hasOwnProperty.call(s,"capabilities")||Object.prototype.hasOwnProperty.call(s,"contextUsage")||Object.prototype.hasOwnProperty.call(s,"messages")||Object.prototype.hasOwnProperty.call(s,"timelineItems")||Object.prototype.hasOwnProperty.call(s,"permissionRequests")||Object.prototype.hasOwnProperty.call(s,"queuedMessages"))&&this.persistSnapshot(),this.emit()}applyTimelineEvent(t){const s=Bn({authoritativeMessages:this.authoritativeMessages,runtimeOverlayMessages:this.runtimeOverlayMessages,activeRuntimeOverlayKeys:this.activeRuntimeOverlayKeys,pendingMessages:this.pendingMessages,replaceSnapshotSeedOnBackfill:this.replaceSnapshotSeedOnBackfill},this.sessionId,t);this.authoritativeMessages=s.timeline.authoritativeMessages,this.runtimeOverlayMessages=s.timeline.runtimeOverlayMessages,this.activeRuntimeOverlayKeys=s.timeline.activeRuntimeOverlayKeys,this.pendingMessages=s.timeline.pendingMessages,this.replaceSnapshotSeedOnBackfill=s.timeline.replaceSnapshotSeedOnBackfill;const n=Ga(s.previousMessages,s.messages,"assistant"),r=Va(t);return(s.validationIssues.length>0||r.some(o=>o.role==="assistant")||n.length>0)&&ns("timeline.event",{sessionId:this.sessionId,eventType:t.type,source:t.source,replacedSnapshotSeed:s.replacedSnapshotSeed,validationIssues:s.validationIssues,authoritativeCount:this.authoritativeMessages.length,runtimeOverlayCount:this.runtimeOverlayMessages.length,pendingCount:this.pendingMessages.length,eventMessages:r.map(o=>oi(o)),assistantMoves:n,previousTail:Wn(s.previousMessages.slice(-6)),nextTail:Wn(s.messages.slice(-6))}),s}mergeHistoryMessages(t,s,n){const r=this.applyTimelineEvent({type:"history.merge",source:n,messages:t,replaceSnapshotSeed:s});return this.logCodexMergeDebug(n,r.previousMessages,t,r.messages,{replacedSnapshotSeedAttempted:s,replacedSnapshotSeed:r.replacedSnapshotSeed,baseMessageCount:r.replacedSnapshotSeed?0:r.previousMessages.length}),{messages:r.messages,replacedSnapshotSeed:r.replacedSnapshotSeed}}buildTimelineMessages(t){return Ys({authoritativeMessages:this.authoritativeMessages,runtimeOverlayMessages:this.runtimeOverlayMessages,activeRuntimeOverlayKeys:this.activeRuntimeOverlayKeys,pendingMessages:this.pendingMessages,replaceSnapshotSeedOnBackfill:this.replaceSnapshotSeedOnBackfill})}clearActiveRuntimeTail(t){if(this.activeRuntimeOverlayKeys.length===0)return;this.activeRuntimeOverlayKeys=[];const s=this.buildTimelineMessages(t);this.patch({messages:s})}resolvePendingMessage(t,s){this.applyTimelineEvent({type:"pending.resolve",source:"pending_resolved",clientRequestId:s,message:t})}handleError(t){this.clearHistoryBootstrapFallbackTimer();const s=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:s})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const s=this.getMarkSeenThrottleDelayMs(),n=Math.max(ga,s);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const r=this.getTargetSeenAt();r!==null&&(be("session_seen.start",{sessionId:this.sessionId,targetSeenAt:r,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),io(this.sessionId).then(()=>{var a,o;this.bumpSeenWatermark(r),this.patch({session:Un(this.state.session,r)}),(o=(a=this.options).onSeen)==null||o.call(a,this.sessionId,r),be("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{be("session_seen.error",{sessionId:this.sessionId,targetSeenAt:r})}).finally(()=>{this.markSeenInFlight=!1,this.shouldMarkSeen()&&this.scheduleMarkSeen()}))},n)}clearRuntimeRefreshTimer(t){this.runtimeRefreshTimer!==null&&(t&&this.runtimeRefreshMode!==t||(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null))}scheduleHistoryBootstrapFallback(){this.historyBootstrapEnvelopeReceived||this.historyBootstrapFallbackTimer!==null||(this.historyBootstrapFallbackTimer=window.setTimeout(()=>{this.historyBootstrapFallbackTimer=null,!this.historyBootstrapEnvelopeReceived&&this.resolveHistoryBootstrapFallback()},350))}clearHistoryBootstrapFallbackTimer(){this.historyBootstrapFallbackTimer!==null&&(window.clearTimeout(this.historyBootstrapFallbackTimer),this.historyBootstrapFallbackTimer=null)}async resolveHistoryBootstrapFallback(){try{const t=Math.min(zr,Math.max(_t,this.authoritativeMessages.length,ma)),s=await Fs(this.sessionId,null,t,"backward");if(this.historyBootstrapEnvelopeReceived)return;this.historyBootstrapEnvelopeReceived=!0;const{messages:n,replacedSnapshotSeed:r}=this.mergeHistoryMessages(s.messages,this.replaceSnapshotSeedOnBackfill,"http_bootstrap_fallback");this.patch({messages:n,historyState:"ready",olderCursor:!r&&this.state.pagesLoaded>1?this.state.olderCursor:s.nextCursor,hasOlderMessages:!r&&this.state.pagesLoaded>1?this.state.hasOlderMessages:vt({session:this.state.session,loadedMessageCount:this.authoritativeMessages.length,olderCursor:s.nextCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),lastCursor:s.cursor??this.state.lastCursor,pagesLoaded:!r&&this.state.pagesLoaded>1?this.state.pagesLoaded:this.authoritativeMessages.length>0?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.scheduleMarkSeen(),this.scheduleOlderHistoryPrefetch("bootstrap_fallback")}catch{}}applyOlderHistoryPage(t,s){const{messages:n}=this.mergeHistoryMessages(t.messages,!1,s==="realtime"?"older_history_realtime":"older_history_prefetch_cache");this.patch({messages:n,historyState:"ready",loadingOlderMessages:!1,olderCursor:t.nextCursor,hasOlderMessages:!!t.nextCursor,pagesLoaded:this.state.pagesLoaded+1,errorCode:null,errorDetail:null}),be("session.history_older.applied",{sessionId:this.sessionId,source:s,messageCount:t.messages.length,nextCursor:t.nextCursor}),this.scheduleOlderHistoryPrefetch(s)}scheduleOlderHistoryPrefetch(t){var n;const s=this.state.olderCursor;this.state.historyState!=="ready"||this.state.loadingOlderMessages||!s||((n=this.prefetchedOlderHistoryPage)==null?void 0:n.requestedCursor)!==s&&(this.olderHistoryPrefetchPromise&&this.olderHistoryPrefetchCursor===s||this.prefetchOlderHistoryPage(s,t))}async prefetchOlderHistoryPage(t,s){var r;if(((r=this.prefetchedOlderHistoryPage)==null?void 0:r.requestedCursor)===t)return this.prefetchedOlderHistoryPage.page;if(this.olderHistoryPrefetchPromise&&this.olderHistoryPrefetchCursor===t)return this.olderHistoryPrefetchPromise;this.olderHistoryPrefetchCursor=t,be("session.history_older.prefetch.start",{sessionId:this.sessionId,requestedCursor:t,reason:s,limit:Cs});const n=Fs(this.sessionId,t,Cs,"backward").then(a=>(this.state.olderCursor===t&&(this.prefetchedOlderHistoryPage={requestedCursor:t,page:a}),be("session.history_older.prefetch.end",{sessionId:this.sessionId,requestedCursor:t,messageCount:a.messages.length,nextCursor:a.nextCursor}),a)).catch(a=>(be("session.history_older.prefetch.error",{sessionId:this.sessionId,requestedCursor:t,message:a instanceof Error?a.message:"unknown"}),null)).finally(()=>{this.olderHistoryPrefetchPromise===n&&(this.olderHistoryPrefetchPromise=null),this.olderHistoryPrefetchCursor===t&&(this.olderHistoryPrefetchCursor=null)});return this.olderHistoryPrefetchPromise=n,n}async takePrefetchedOlderHistoryPage(t){var s;if(((s=this.prefetchedOlderHistoryPage)==null?void 0:s.requestedCursor)===t){const n=this.prefetchedOlderHistoryPage.page;return this.prefetchedOlderHistoryPage=null,be("session.history_older.prefetch.hit",{sessionId:this.sessionId,requestedCursor:t,messageCount:n.messages.length,nextCursor:n.nextCursor}),n}if(this.olderHistoryPrefetchPromise&&this.olderHistoryPrefetchCursor===t){const n=await this.olderHistoryPrefetchPromise;return!n||this.state.olderCursor!==t?null:(this.prefetchedOlderHistoryPage=null,be("session.history_older.prefetch.await_hit",{sessionId:this.sessionId,requestedCursor:t,messageCount:n.messages.length,nextCursor:n.nextCursor}),n)}return null}clearOlderHistoryPrefetch(){this.olderHistoryPrefetchCursor=null,this.olderHistoryPrefetchPromise=null,this.prefetchedOlderHistoryPage=null}scheduleRuntimeRefresh(t,s){var n,r;if(!Qe((n=this.state.session)==null?void 0:n.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,be("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:s,connectionState:this.state.connectionState,runningState:((r=this.state.session)==null?void 0:r.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const a=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(a,s)},t==="poll"?ba:1200))}async refreshRuntimeState(t,s){var n,r,a,o,u;be("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:s,connectionState:this.state.connectionState,runningState:((n=this.state.session)==null?void 0:n.runningState)??null});try{const d=await Sn(this.sessionId),h=Ls(this.state.runtimeHasActiveRun,d.runningState,d.hasActiveRun),f=Ds(this.state.runtimeCanInterrupt,d.runningState,h,d.canInterrupt);this.patch({session:$n(this.state.session,d),runtimeHasActiveRun:h,runtimeCanInterrupt:f,contextUsage:d.contextUsage,...Ns(d,this.state.interruptSource)}),await this.refreshQueue();const p=t==="poll"&&this.state.connectionState!=="connected"&&Qe((r=this.state.session)==null?void 0:r.runningState);be("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:s,connectionState:this.state.connectionState,runningState:((a=this.state.session)==null?void 0:a.runningState)??null,continuePolling:p}),p&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(d){be("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:s,connectionState:this.state.connectionState,runningState:((o=this.state.session)==null?void 0:o.runningState)??null,message:d instanceof Error?d.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&Qe((u=this.state.session)==null?void 0:u.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(wr(this.sessionId).then(s=>{this.patch({session:Qt(s,this.state.session)})}).catch(()=>{})),Vn(this.state.capabilities)&&t.push(oo(this.sessionId).then(s=>{this.patch({capabilities:s})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await ao(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||Vn(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null||al(this.state.session,this.state.runtimeHasActiveRun,this.state.runtimeCanInterrupt)}async refreshRuntimeSnapshot(t){be("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const s=await Sn(this.sessionId),n=Ls(this.state.runtimeHasActiveRun,s.runningState,s.hasActiveRun),r=Ds(this.state.runtimeCanInterrupt,s.runningState,n,s.canInterrupt);this.patch({session:$n(this.state.session,s),runtimeHasActiveRun:n,runtimeCanInterrupt:r,contextUsage:s.contextUsage,...Ns(s,this.state.interruptSource)}),await this.refreshQueue(),be("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:s.contextUsage!==null})}catch(s){be("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:s instanceof Error?s.message:"unknown"})}}async refreshQueue(){try{const t=await lo(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,s,n){var r;try{return await sn(this.sessionId,{content:t,clientRequestId:s,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:ut(),attachments:(n==null?void 0:n.attachments)??[],providerConfigMode:n==null?void 0:n.providerConfigMode,providerPresetId:(n==null?void 0:n.providerPresetId)??null})}catch(a){if(!(a instanceof $i)||a.status!==404&&a.status!==405||(((r=n==null?void 0:n.attachments)==null?void 0:r.length)??0)>0)throw a;return be("session_send.live_fallback",{sessionId:this.sessionId,clientRequestId:s,reason:a.message}),co(this.sessionId,{content:t,clientRequestId:s,permissionMode:ut()})}}handleRuntimeStatus(t){var n;const s=_s((n=this.state.session)==null?void 0:n.runningState,t.status);this.patch({session:Je(this.state.session,s),runtimeHasActiveRun:Qe(s)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:Qe(s)?this.state.runtimeCanInterrupt:!1,interruptSource:s==="interrupted"?t.interruptSource??this.state.interruptSource:s==="completed"||s==="failed"?null:this.state.interruptSource,errorCode:null,errorDetail:s===t.status?t.detail:this.state.errorDetail}),qt(s)&&(this.clearActiveRuntimeTail("runtime_status_terminal"),this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_terminal_before_message",{status:t.status,detail:t.detail}),this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleActivity(t){const s=Ls(this.state.runtimeHasActiveRun,t.runningState,t.hasActiveRun),n=Ds(this.state.runtimeCanInterrupt,t.runningState,s,t.canInterrupt);if(this.patch({session:el(this.state.session,t),runtimeHasActiveRun:s,runtimeCanInterrupt:n,...Ns(t,this.state.interruptSource)}),qt(t.runningState)){this.clearActiveRuntimeTail("activity_terminal"),this.clearRuntimeRefreshTimer(),this.refreshQueue();return}(t.runningState==="stale"||t.runningState==="unknown")&&this.scheduleRuntimeRefresh("tail","activity_watchdog")}handleRuntimeMessage(t){var r;t.message.role==="assistant"&&this.completePendingReplyDebugTrace(t);const s=this.applyTimelineEvent({type:"runtime.message",source:t.source,message:yr(this.sessionId,t.message)}),n=s.messages;this.logCodexMergeDebug("runtime_message",s.previousMessages,[t.message],n,{runtimeSource:t.source}),this.patch({messages:n,historyState:"ready",hasOlderMessages:vt({session:this.state.session,loadedMessageCount:this.authoritativeMessages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),session:Je(this.state.session,Gn("session.delta",(r=this.state.session)==null?void 0:r.runningState))}),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()}handleRuntimeError(t){var n;const s=_s((n=this.state.session)==null?void 0:n.runningState,"failed");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_runtime_error",{errorCode:t.error_code,detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:Je(this.state.session,s),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,interruptSource:null,errorCode:s==="failed"?t.error_code:this.state.errorCode,errorDetail:s==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var n;const s=_s((n=this.state.session)==null?void 0:n.runningState,"interrupted");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_interrupted",{detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:Je(this.state.session,s),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,interruptSource:s==="interrupted"?t.interruptSource??this.state.interruptSource:this.state.interruptSource,errorCode:s==="interrupted"?null:this.state.errorCode,errorDetail:s==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}handlePermissionRequest(t){this.patch({permissionRequests:Hs(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:Hs(this.state.permissionRequests,t.request)})}shouldMarkSeen(){return this.getTargetSeenAt()!==null}getTargetSeenAt(){const t=[...this.state.messages].reverse().find(n=>n.role!=="user");if(!t)return null;const s=this.seenWatermark;return s?t.timestamp>s?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,va-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:Un(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){Ao(qs(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:Jn(this.authoritativeMessages),timelineItems:js(this.state.session,Jn(this.authoritativeMessages)),permissionRequests:this.state.permissionRequests,queuedMessages:this.state.queuedMessages,olderCursor:this.state.olderCursor,hasOlderMessages:this.state.hasOlderMessages,lastCursor:this.state.lastCursor,pagesLoaded:this.state.pagesLoaded,interruptSource:this.state.interruptSource})}beginPendingReplyDebugTrace(t,s,n){const r={mode:t,clientRequestId:s,startedAtMs:performance.now(),responseReadyAtMs:null,contentLength:n};this.pendingReplyDebugTraces.push(r),be(`session_send.${t}.client_start`,{sessionId:this.sessionId,clientRequestId:s,contentLength:n})}markPendingReplyDebugTraceResponseReady(t,s={}){const n=this.pendingReplyDebugTraces.find(r=>r.clientRequestId===t);!n||n.responseReadyAtMs!==null||(n.responseReadyAtMs=performance.now(),be(`session_send.${n.mode}.client_response`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(n.responseReadyAtMs-n.startedAtMs),...s}))}failPendingReplyDebugTrace(t,s){const n=this.pendingReplyDebugTraces.find(r=>r.clientRequestId===t);n&&(be(`session_send.${n.mode}.client_error`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(performance.now()-n.startedAtMs),error:s instanceof Error?s.message:String(s)}),this.removePendingReplyDebugTrace(n.clientRequestId))}completePendingReplyDebugTrace(t){const s=this.pendingReplyDebugTraces[0];if(!s)return;const n=performance.now();be(`session_send.${s.mode}.first_assistant_message`,{sessionId:this.sessionId,clientRequestId:s.clientRequestId,durationMs:Math.round(n-s.startedAtMs),responseToAssistantMs:s.responseReadyAtMs===null?null:Math.round(n-s.responseReadyAtMs),messageId:t.message.messageId,kind:t.message.kind,contentLength:t.message.content.length}),this.removePendingReplyDebugTrace(s.clientRequestId)}completePendingReplyDebugTraceWithoutAssistant(t,s={}){const n=this.pendingReplyDebugTraces[0];n&&(be(t,{sessionId:this.sessionId,clientRequestId:n.clientRequestId,durationMs:Math.round(performance.now()-n.startedAtMs),responseReady:n.responseReadyAtMs!==null,...s}),this.removePendingReplyDebugTrace(n.clientRequestId))}removePendingReplyDebugTrace(t){const s=this.pendingReplyDebugTraces.findIndex(n=>n.clientRequestId===t);s<0||this.pendingReplyDebugTraces.splice(s,1)}logCodexMergeDebug(t,s,n,r,a={}){const o=n.filter(sl);if(o.length===0)return;const u=zn(s),d=zn(r);ze("session.messages.merge",{sessionId:this.sessionId,source:t,beforeCount:s.length,incomingCount:n.length,afterCount:r.length,incoming:o.slice(0,5).map(rl),beforeDuplicateGroupCount:u.length,afterDuplicateGroupCount:d.length,afterDuplicateGroups:d.slice(0,3),...a})}}function Ia(){return{authoritativeMessages:[],runtimeOverlayMessages:[],activeRuntimeOverlayKeys:[],pendingMessages:[],replaceSnapshotSeedOnBackfill:!1}}function ya(e,t){const s=new Map,n=new Set;for(const r of e)s.set(r.id,r),n.add(r.id);for(const r of t){const a=s.get(r.id)??null,o=ni(s,n,r,a);if(o){const h=s.get(o)??null;if(h){ze("session.messages.runtime_overlay_authoritative_bridge",{mode:"prefer_equivalent",previous:pe(h),overlay:pe(r),replacedSameId:a?pe(a):null}),s.set(o,Es(h,r));continue}}if(a){ze("session.messages.runtime_overlay_authoritative_bridge",{mode:"same_id",previous:pe(a),overlay:pe(r)}),s.set(r.id,Es(a,r));continue}const u=hn(s,n,r);if(u){const h=s.get(u)??null;if(h){ze("session.messages.runtime_overlay_authoritative_bridge",{mode:"codex_compat",previous:pe(h),overlay:pe(r)}),s.set(u,Es(h,r));continue}}const d=fn(s,r);if(d&&n.has(d)){const h=s.get(d)??null;if(h){if(ze("session.messages.runtime_overlay_authoritative_bridge",{mode:"opencode_compat",previous:pe(h),overlay:pe(r)}),ws(h,r)){s.set(d,Ln(h,r));continue}s.set(d,Ln(h,r));continue}}ze("session.messages.runtime_overlay_authoritative_bridge",{mode:"insert",overlay:pe(r)}),s.set(r.id,r)}return ka(Array.from(s.values()))}function Es(e,t){return{...Yr(e,{...t,id:e.id,clientRequestId:e.clientRequestId??t.clientRequestId}),id:e.id,rawRef:e.rawRef,timestamp:e.timestamp,sequence:e.sequence,clientRequestId:e.clientRequestId??t.clientRequestId}}function Yr(e,t){if(e.id!==t.id)return t;if(Dt(e,t)){const o=rs(e.toolCall,t.toolCall),u=Kr(e,t,o,is),d=os(e.attachments,t.attachments),h=as(e,t);return{...St(e,t),kind:(o==null?void 0:o.status)==="running"?"tool_call":"tool_result",content:u,toolCall:o,attachments:d,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,rawRef:h.rawRef,timestamp:h.timestamp,sequence:h.sequence}}if(e.role!==t.role||e.kind!==t.kind)return St(e,t);const s=rs(e.toolCall,t.toolCall),n=is(e.content,t.content,e.timestamp,t.timestamp),r=os(e.attachments,t.attachments),a=as(e,t);return{...St(e,t),content:n,toolCall:s,attachments:r,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,rawRef:a.rawRef,timestamp:a.timestamp,sequence:a.sequence}}function Ln(e,t){if(Dt(e,t)){const o=rs(e.toolCall,t.toolCall),u=Kr(e,t,o,is),d=os(e.attachments,t.attachments),h=as(e,t);return{...St(e,t),id:e.id,kind:(o==null?void 0:o.status)==="running"?"tool_call":"tool_result",content:u,toolCall:o,attachments:d,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,rawRef:h.rawRef,timestamp:h.timestamp,sequence:h.sequence,clientRequestId:e.clientRequestId??t.clientRequestId}}if(e.role!==t.role||e.kind!==t.kind)return{...St(e,t),id:e.id,clientRequestId:e.clientRequestId??t.clientRequestId};const s=rs(e.toolCall,t.toolCall),n=is(e.content,t.content,e.timestamp,t.timestamp),r=os(e.attachments,t.attachments),a=as(e,t);return{...St(e,t),id:e.id,content:n,toolCall:s,attachments:r,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,rawRef:a.rawRef,timestamp:a.timestamp,sequence:a.sequence,clientRequestId:e.clientRequestId??t.clientRequestId}}function Dt(e,t){return ws(e,t)||Ms(e,t)}function Kr(e,t,s,n){if((s==null?void 0:s.status)==="running"){if(t.kind==="tool_call"&&t.content)return t.content;if(e.kind==="tool_call"&&e.content)return e.content}else{if(t.kind==="tool_result"&&t.content)return t.content;if(e.kind==="tool_result"&&e.content)return e.content;if(s!=null&&s.output)return s.output}return n(e.content,t.content,e.timestamp,t.timestamp)}function hn(e,t,s){if(!zs(s))return null;for(const[n,r]of e.entries())if(!(n===s.id||!t.has(n)||!xa(r,s)))return ze("session.messages.codex_identity_bridge_match",{previous:pe(r),incoming:pe(s)}),n;return null}function xa(e,t){if(!Ea(e,t))return!1;if(e.rawRef===t.rawRef)return!0;if(e.kind==="tool_call"||e.kind==="tool_result")return Ms(e,t);const s=cs(e.rawRef),n=cs(t.rawRef);if(!s||!n||s!==n)return!1;const r=Math.abs(e.sequence-t.sequence);return r>1?(ze("session.messages.codex_identity_bridge_rejected",{reason:"sequence_distance",sequenceDistance:r,previous:pe(e),incoming:pe(t)}),!1):!0}function fn(e,t){if(!qn(t))return null;const s=ls(t.rawRef);if(s===null)return null;const n=Pt(t.timestamp);let r=null,a=Number.POSITIVE_INFINITY;for(const[o,u]of e.entries()){if(o===t.id||!qn(u)||u.role!==t.role)continue;if(ws(u,t))return o;if(u.kind!==t.kind||ls(u.rawRef)!==s)continue;const h=Pt(u.timestamp),f=Math.abs(h-n),x=Math.abs(u.sequence-t.sequence)*6e4+f;x<a&&(r=o,a=x)}return r}function Pa(e,t,s){if(!pn(t))return!1;const n=Gs(e.authoritativeMessages,t,"authoritative",s);if(n)return ze("session.messages.runtime_user_echo_suppressed",{sessionId:s,target:"authoritative",matched:pe(n),incoming:pe(t)}),!0;const r=Gs(e.pendingMessages,t,"pending",s);return r?(ze("session.messages.runtime_user_echo_suppressed",{sessionId:s,target:"pending",matched:pe(r),incoming:pe(t)}),!0):!1}function Gs(e,t,s,n){const r=Pt(t.timestamp),a=$e(t.content),o=Xs(t.content),u=us(t.attachments);let d=null,h=Number.POSITIVE_INFINITY;const f=[];for(const p of e){if(!(s==="authoritative"?Ca(p):Zr(p)))continue;const v=$e(p.content),w=Xs(p.content),M=v===a,j=w===o;if(!M&&!j)continue;const y=Pt(p.timestamp),O=Math.abs(y-r);if(O>300*1e3)continue;const k=Math.abs(p.sequence-t.sequence),_=us(p.attachments),A=ja(_,u);if(f.push(Na(p,{strictTextMatches:M,relaxedTextMatches:j,attachmentCompatibility:A,distanceMs:O,sequenceDistance:k})),A==="conflict"&&(M||a.length===0))continue;const P=O+k*15e3+(M?0:500)+_a(A);P<h&&(d=p,h=P)}return f.length>0&&ze("session.messages.runtime_user_match",{sessionId:n,target:s,matchedId:(d==null?void 0:d.id)??null,matchedScore:Number.isFinite(h)?h:null,incoming:Oa(t,{relaxedContent:o,attachmentSignature:u}),candidates:f.slice(0,5)}),d}function Ra(e,t,s){for(const n of t){if(n.role!=="user"||n.kind!=="text")continue;const r=yr(s,n,"sent",null);if(!Gs(e,r,"authoritative",s))return!0}return!1}function rs(e,t){return e?t?{...Ta(e,t),input:Qr(e.input,t.input),output:Dn(e.output,t.output),error:Dn(e.error,t.error)}:e:t}function Ta(e,t){const s=e.status==="running"?0:1,n=t.status==="running"?0:1;return n!==s?n>s?t:e:t}function is(e,t,s,n){const r=$e(e),a=$e(t);return r===a?e.length>=t.length?e:t:r.length>a.length&&r.includes(a)?e:a.length>r.length&&a.includes(r)||n.localeCompare(s)>=0?t:e}function os(e,t){const s=(e==null?void 0:e.length)??0,n=(t==null?void 0:t.length)??0;return n!==s?n>s?t:e:t??e}function Qr(e,t){return t.length>e.length?t:e}function Dn(e,t){return e===null?t:t===null?e:Qr(e,t)}function St(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function as(e,t){return Ht(e,t)<=0?e:t}function $e(e){return e.replace(Ma,"").replace(/\r\n/g,`
4
4
  `).trimEnd()}function Xs(e){return $e(e).replace(/[ \t]+\n/g,`
5
5
  `).replace(/\n{2,}/g,`
@@ -1 +1 @@
1
- import{b as d,j as e}from"./index-CuzMc7q2.js";function c(){return d.useEffect(()=>{const t=document.documentElement.style.background,s=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=t,document.body.style.background=s}},[]),e.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:e.jsxs("section",{className:"desktop-detach-preview-card",children:[e.jsx("header",{className:"desktop-detach-preview-bar",children:e.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),e.jsx("div",{className:"desktop-detach-preview-body",children:e.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}export{c as DesktopDetachPreviewPage};
1
+ import{b as d,j as e}from"./index-CjewzOUG.js";function c(){return d.useEffect(()=>{const t=document.documentElement.style.background,s=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=t,document.body.style.background=s}},[]),e.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:e.jsxs("section",{className:"desktop-detach-preview-card",children:[e.jsx("header",{className:"desktop-detach-preview-bar",children:e.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),e.jsx("div",{className:"desktop-detach-preview-body",children:e.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}export{c as DesktopDetachPreviewPage};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/window-BVUB8gMK.js","assets/event-DvH9tcej.js"])))=>i.map(i=>d[i]);
2
- import{b as a,m as E,_ as y,j as t,t as c}from"./index-CuzMc7q2.js";import{u as q,g as O}from"./model-switch-api-c6kcbBGm.js";import{FileContextPanel as F}from"./FileContextPanel-BcM7AIT4.js";import{GitSidebar as C}from"./GitSidebar-CMtkaxuI.js";import{TerminalManagerPanel as P}from"./TerminalManagerPanel-BxlhZp8c.js";import{TerminalPage as _}from"./TerminalPage-B6Rdhylx.js";import{r as $,W as U,m as W}from"./WorkbenchLayout-CbpJg0g1.js";import{c as z,u as A,e as H,N as K}from"./App-tPcbyRdS.js";import"./WorkbenchModal-Bt_1fYmM.js";import"./file-tree-icon-BeHqeru9.js";import"./terminal-runtime-meta-CRAVR-8G.js";import"./TerminalRuntimeFallbackModal-BVLfrpSa.js";import"./MobileWorkspaceSwitcherHeader-DLkACTnQ.js";import"./MobileTopHeaderFrame-DGVOzXyg.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-C751A-Sm.js";function V(n){return{navigationGroups:n,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function B(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function J(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function Q(n,u){return{navigationGroups:u,currentWorkspaceId:n,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function x(n){return n.kind==="files"?c("shell.filesEntry"):n.kind==="git"?c("shell.gitEntry"):n.kind==="processes"?c("shell.terminalManagerEntry"):n.kind==="terminals"?c("shell.terminalsEntry"):n.kind}function M(n,u){var s;return n.workspaceName??(n.workspaceId?((s=u.find(d=>d.workspace.id===n.workspaceId))==null?void 0:s.workspace.name)??null:null)}function X(n,u){const s=M(n,u),d=x(n);return s?`CodingNS - ${d}(${s})`:`CodingNS - ${d}`}function we(){const{windowId:n}=z(),u=A(),s=H(),d=$(s),h=q(i=>i.sessionDisplaySortMode),[e,b]=a.useState(null),[N,w]=a.useState(!0),[T,v]=a.useState(null),[o,k]=a.useState([]),[r,S]=a.useState(null);a.useEffect(()=>{let i=!1;async function l(){if(!n){b(null),w(!1),v(c("desktopWindow.invalidWindowId"));return}w(!0),v(null);const p=await s.bridge.getWindowDescriptor(n),g=p.ok?p.value??null:s.windows.getDescriptor(n);if(!i){if(!g){b(null),w(!1),v(p.detail??c("desktopWindow.loadDescriptorFailed"));return}s.windows.registerDescriptor(g),s.windows.markWindowOpen(g.windowId),b(g),w(!1)}}return l(),()=>{i=!0}},[s,n]),a.useEffect(()=>{if(!(e!=null&&e.workspaceId)){k([]);return}let i=!1;async function l(){try{const p=await O();if(i)return;k(W(p,h))}catch{if(i)return;k([])}}return l(),()=>{i=!0}},[e==null?void 0:e.workspaceId,h]),a.useEffect(()=>{if(!e){S(null);return}const i=new U({onConnectionChange:()=>{},onSnapshot:l=>{k(W(l,h))},onUnauthorized:()=>{E.clear(),u(`/login?returnTo=${encodeURIComponent(`/desktop-window/${e.windowId}`)}`,{replace:!0})}});return S(i),i.start(),()=>{i.close(),S(null)}},[e,u,h]),a.useEffect(()=>{if(!s.isDesktop||!s.bridge.supported||!e||e.mode!=="external")return;const i=X(e,o);document.title=i,y(async()=>{const{getCurrentWindow:l}=await import("./window-BVUB8gMK.js").then(p=>p.w);return{getCurrentWindow:l}},__vite__mapDeps([0,1])).then(({getCurrentWindow:l})=>l().setTitle(i)).catch(()=>{})},[e,o,s.bridge.supported,s.isDesktop]);const D=a.useMemo(()=>r?{navigationGroups:o,subscribeFileTree:r.subscribeFileTree.bind(r),requestFileTreeRefresh:r.requestFileTreeRefresh.bind(r),addFileTreeSnapshotListener:r.addFileTreeSnapshotListener.bind(r),subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:V(o),[o,r]),I=a.useMemo(()=>r?{subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:B(),[r]),R=a.useMemo(()=>r?{subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:J(),[r]),G=a.useMemo(()=>r?{navigationGroups:o,currentWorkspaceId:(e==null?void 0:e.workspaceId)??null,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:Q((e==null?void 0:e.workspaceId)??null,o),[e==null?void 0:e.workspaceId,o,r]);if(!s.isDesktop)return t.jsx(K,{to:"/",replace:!0});if(N)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("common.loading")})});if(T)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:T})});if(!e)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.loadDescriptorFailed")})});let m=null;if(e.kind==="files"?m=t.jsx(F,{sessionId:e.sessionId,workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:D}):e.kind==="git"?m=t.jsx(C,{workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:I}):e.kind==="processes"?m=t.jsx(P,{currentWorkspaceId:e.workspaceId,navigationGroups:o,externalWindowMode:!0,workbenchShellOverrides:R}):e.kind==="terminals"&&(m=t.jsx(_,{externalWindowMode:!0,externalWindowWorkspaceId:e.workspaceId,workbenchShellOverrides:G})),!m)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.unsupportedKind",{kind:e.kind})})});const f=x(e),j=M(e,o),L=e.mode==="external"&&e.kind==="processes";return t.jsxs("main",{className:"desktop-window-page",children:[L?t.jsx("header",{className:"desktop-window-drag-header","data-window-kind":e.kind,"data-window-drag-handle":"desktop-window-drag-header","data-tauri-drag-region":d,"aria-label":f,children:t.jsxs("div",{className:"desktop-window-drag-header-copy","data-tauri-drag-region":d,children:[t.jsx("span",{className:"desktop-window-drag-header-tag","data-tauri-drag-region":d,children:f}),t.jsx("strong",{"data-tauri-drag-region":d,children:j??f})]})}):null,t.jsx("div",{className:"desktop-window-body","data-window-kind":e.kind,"aria-label":f,children:m})]})}export{we as DesktopWindowPage};
2
+ import{b as a,m as E,_ as y,j as t,t as c}from"./index-CjewzOUG.js";import{u as q,g as O}from"./model-switch-api-Br0ivfe5.js";import{FileContextPanel as F}from"./FileContextPanel-lM5mBcfn.js";import{GitSidebar as C}from"./GitSidebar-CmXAhyjo.js";import{TerminalManagerPanel as P}from"./TerminalManagerPanel-D9JHCS6d.js";import{TerminalPage as _}from"./TerminalPage-CBIKHI33.js";import{r as $,W as U,m as W}from"./WorkbenchLayout-D48i71PU.js";import{c as z,u as A,e as H,N as K}from"./App-B0q8uDA-.js";import"./WorkbenchModal-BYNuMIoV.js";import"./file-tree-icon-BFwaPxKs.js";import"./terminal-runtime-meta-BCtAYB0E.js";import"./TerminalRuntimeFallbackModal-W5NjqFEz.js";import"./MobileWorkspaceSwitcherHeader-DhaM9fgx.js";import"./MobileTopHeaderFrame-_I0t7cC_.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-D7OgZZN-.js";function V(n){return{navigationGroups:n,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function B(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function J(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function Q(n,u){return{navigationGroups:u,currentWorkspaceId:n,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function x(n){return n.kind==="files"?c("shell.filesEntry"):n.kind==="git"?c("shell.gitEntry"):n.kind==="processes"?c("shell.terminalManagerEntry"):n.kind==="terminals"?c("shell.terminalsEntry"):n.kind}function M(n,u){var s;return n.workspaceName??(n.workspaceId?((s=u.find(d=>d.workspace.id===n.workspaceId))==null?void 0:s.workspace.name)??null:null)}function X(n,u){const s=M(n,u),d=x(n);return s?`CodingNS - ${d}(${s})`:`CodingNS - ${d}`}function we(){const{windowId:n}=z(),u=A(),s=H(),d=$(s),h=q(i=>i.sessionDisplaySortMode),[e,b]=a.useState(null),[N,w]=a.useState(!0),[T,v]=a.useState(null),[o,k]=a.useState([]),[r,S]=a.useState(null);a.useEffect(()=>{let i=!1;async function l(){if(!n){b(null),w(!1),v(c("desktopWindow.invalidWindowId"));return}w(!0),v(null);const p=await s.bridge.getWindowDescriptor(n),g=p.ok?p.value??null:s.windows.getDescriptor(n);if(!i){if(!g){b(null),w(!1),v(p.detail??c("desktopWindow.loadDescriptorFailed"));return}s.windows.registerDescriptor(g),s.windows.markWindowOpen(g.windowId),b(g),w(!1)}}return l(),()=>{i=!0}},[s,n]),a.useEffect(()=>{if(!(e!=null&&e.workspaceId)){k([]);return}let i=!1;async function l(){try{const p=await O();if(i)return;k(W(p,h))}catch{if(i)return;k([])}}return l(),()=>{i=!0}},[e==null?void 0:e.workspaceId,h]),a.useEffect(()=>{if(!e){S(null);return}const i=new U({onConnectionChange:()=>{},onSnapshot:l=>{k(W(l,h))},onUnauthorized:()=>{E.clear(),u(`/login?returnTo=${encodeURIComponent(`/desktop-window/${e.windowId}`)}`,{replace:!0})}});return S(i),i.start(),()=>{i.close(),S(null)}},[e,u,h]),a.useEffect(()=>{if(!s.isDesktop||!s.bridge.supported||!e||e.mode!=="external")return;const i=X(e,o);document.title=i,y(async()=>{const{getCurrentWindow:l}=await import("./window-BVUB8gMK.js").then(p=>p.w);return{getCurrentWindow:l}},__vite__mapDeps([0,1])).then(({getCurrentWindow:l})=>l().setTitle(i)).catch(()=>{})},[e,o,s.bridge.supported,s.isDesktop]);const D=a.useMemo(()=>r?{navigationGroups:o,subscribeFileTree:r.subscribeFileTree.bind(r),requestFileTreeRefresh:r.requestFileTreeRefresh.bind(r),addFileTreeSnapshotListener:r.addFileTreeSnapshotListener.bind(r),subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:V(o),[o,r]),I=a.useMemo(()=>r?{subscribeGitSnapshot:r.subscribeGit.bind(r),requestGitRefresh:r.requestGitRefresh.bind(r),addGitSnapshotListener:r.addGitSnapshotListener.bind(r)}:B(),[r]),R=a.useMemo(()=>r?{subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:J(),[r]),G=a.useMemo(()=>r?{navigationGroups:o,currentWorkspaceId:(e==null?void 0:e.workspaceId)??null,selectWorkspace:()=>{},subscribeTerminalManagerSnapshot:r.subscribeTerminalManager.bind(r),requestTerminalManagerRefresh:r.requestTerminalManagerRefresh.bind(r),addTerminalManagerSnapshotListener:r.addTerminalManagerSnapshotListener.bind(r)}:Q((e==null?void 0:e.workspaceId)??null,o),[e==null?void 0:e.workspaceId,o,r]);if(!s.isDesktop)return t.jsx(K,{to:"/",replace:!0});if(N)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("common.loading")})});if(T)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:T})});if(!e)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.loadDescriptorFailed")})});let m=null;if(e.kind==="files"?m=t.jsx(F,{sessionId:e.sessionId,workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:D}):e.kind==="git"?m=t.jsx(C,{workspaceId:e.workspaceId,externalWindowMode:!0,workbenchShellOverrides:I}):e.kind==="processes"?m=t.jsx(P,{currentWorkspaceId:e.workspaceId,navigationGroups:o,externalWindowMode:!0,workbenchShellOverrides:R}):e.kind==="terminals"&&(m=t.jsx(_,{externalWindowMode:!0,externalWindowWorkspaceId:e.workspaceId,workbenchShellOverrides:G})),!m)return t.jsx("main",{className:"desktop-window-page",children:t.jsx("p",{className:"status-text",children:c("desktopWindow.unsupportedKind",{kind:e.kind})})});const f=x(e),j=M(e,o),L=e.mode==="external"&&e.kind==="processes";return t.jsxs("main",{className:"desktop-window-page",children:[L?t.jsx("header",{className:"desktop-window-drag-header","data-window-kind":e.kind,"data-window-drag-handle":"desktop-window-drag-header","data-tauri-drag-region":d,"aria-label":f,children:t.jsxs("div",{className:"desktop-window-drag-header-copy","data-tauri-drag-region":d,children:[t.jsx("span",{className:"desktop-window-drag-header-tag","data-tauri-drag-region":d,children:f}),t.jsx("strong",{"data-tauri-drag-region":d,children:j??f})]})}):null,t.jsx("div",{className:"desktop-window-body","data-window-kind":e.kind,"aria-label":f,children:m})]})}export{we as DesktopWindowPage};