@jingyi0605/codingns 0.8.0 → 0.8.5

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 (620) hide show
  1. package/bin/codingns.mjs +180 -0
  2. package/dist/public/assets/{AdaptiveButlerPage-BsgVNRAa.js → AdaptiveButlerPage-CJw8Ae62.js} +3 -3
  3. package/dist/public/assets/App-BOHBGFOd.js +30 -0
  4. package/dist/public/assets/{BootstrapPage--MDOigQi.js → BootstrapPage-BxHQT4nA.js} +1 -1
  5. package/dist/public/assets/{ConversationPage-BBss5ED8.js → ConversationPage-DWFsF6BB.js} +6 -6
  6. package/dist/public/assets/{DesktopDetachPreviewPage-CB8DoqwU.js → DesktopDetachPreviewPage-DOgEjYEf.js} +1 -1
  7. package/dist/public/assets/DesktopModal-D_A8sgQU.js +1 -0
  8. package/dist/public/assets/DesktopWindowPage-DK7L7osV.js +2 -0
  9. package/dist/public/assets/FileContextPanel-BdCoubcJ.js +1 -0
  10. package/dist/public/assets/GitSidebar-BeZ0hj7A.js +6 -0
  11. package/dist/public/assets/MobileCreateSessionSheet-DfLMVu8q.js +1 -0
  12. package/dist/public/assets/MobileSheet-5kZ-w-gU.js +1 -0
  13. package/dist/public/assets/{MobileTopHeaderFrame-DGVOzXyg.js → MobileTopHeaderFrame-lcp2GscV.js} +1 -1
  14. package/dist/public/assets/MobileWorkspaceSwitcherHeader-C6JMiOq_.js +1 -0
  15. package/dist/public/assets/PluginAccessOverview-DGcKAMQl.js +1 -0
  16. package/dist/public/assets/PluginContainerPage-BlY-xJDh.js +1 -0
  17. package/dist/public/assets/PluginDetailPage-CAJ7LFpD.js +1 -0
  18. package/dist/public/assets/PluginsListPage-BxZG1NyT.js +1 -0
  19. package/dist/public/assets/{RelayConnectEntryPage-0MPPjxtQ.js → RelayConnectEntryPage-CfNO_TIl.js} +1 -1
  20. package/dist/public/assets/ServerSettingsModal-by36Z_5k.js +1 -0
  21. package/dist/public/assets/SessionIndexPage-DkBp9Mqz.js +1 -0
  22. package/dist/public/assets/SettingsPage-C-ASmJAG.js +2 -0
  23. package/dist/public/assets/TerminalManagerPanel-NVZRxxmH.js +1 -0
  24. package/dist/public/assets/{TerminalPage-B6Rdhylx.js → TerminalPage-C4LNoPBp.js} +3 -3
  25. package/dist/public/assets/TerminalRuntimeFallbackModal-Bzum5nZ0.js +1 -0
  26. package/dist/public/assets/ToolFilesPage-47zbdgTW.js +1 -0
  27. package/dist/public/assets/ToolGitPage-Fuk_b_jg.js +1 -0
  28. package/dist/public/assets/ToolProcessesPage-sWSMWD-9.js +1 -0
  29. package/dist/public/assets/ToolsHomePage-R1mZlbZi.js +1 -0
  30. package/dist/public/assets/WorkbenchLandingPage-CqmiFH2u.js +1 -0
  31. package/dist/public/assets/WorkbenchLayout-OFi6CWgH.js +244 -0
  32. package/dist/public/assets/WorkbenchModal-C7qoQElW.js +1 -0
  33. package/dist/public/assets/WorkbenchShellRoute-BAQe_E0O.js +1 -0
  34. package/dist/public/assets/WorkspaceDebugDetailPage-DhKa6e9y.js +1 -0
  35. package/dist/public/assets/WorkspaceDetailPage-BPsrFffw.js +1 -0
  36. package/dist/public/assets/WorkspaceHomePage-KAtqZOAb.js +1 -0
  37. package/dist/public/assets/{client-runtime-manager-DGdKvYzx.js → client-runtime-manager-wmCJZKYd.js} +1 -1
  38. package/dist/public/assets/file-tree-icon-Mg1DiBRX.js +590 -0
  39. package/dist/public/assets/{index-CcaQt50x.css → index-C4t-vvqk.css} +1 -1
  40. package/dist/public/assets/index-CL97fwWB.js +42 -0
  41. package/dist/public/assets/{login-direct-candidate-resolver-DEP_xCmR.js → login-direct-candidate-resolver-BOAgTuUf.js} +1 -1
  42. package/dist/public/assets/plugin-permission-copy-Cq99cnzV.js +1 -0
  43. package/dist/public/assets/plugins-api-BQTV5DOp.js +1 -0
  44. package/dist/public/assets/{preferences-service-CV6Ih0BG.js → preferences-service-DJxbEEeg.js} +1 -1
  45. package/dist/public/assets/realtime-client-CLafKzzJ.js +1 -0
  46. package/dist/public/assets/{relay-entry-C751A-Sm.js → relay-entry-D-LfvdiX.js} +1 -1
  47. package/dist/public/assets/{terminal-runtime-meta-CRAVR-8G.js → terminal-runtime-meta-BJmy8dyK.js} +1 -1
  48. package/dist/public/assets/useRegisteredDebugTemplates-DQAWVdCo.js +1 -0
  49. package/dist/public/assets/workbench-navigation-MEzCSmsK.js +1 -0
  50. package/dist/public/index.html +2 -2
  51. package/dist/server/config/env.d.ts +1 -0
  52. package/dist/server/config/env.js +4 -0
  53. package/dist/server/config/env.js.map +1 -1
  54. package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.js +1 -1
  55. package/dist/server/helpers/wechat-claw-runtime/modules/runtime-state-store.js.map +1 -1
  56. package/dist/server/main.js +2 -0
  57. package/dist/server/main.js.map +1 -1
  58. package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +1 -0
  59. package/dist/server/modules/assistant-capability/assistant-capability-controller.js +1 -0
  60. package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
  61. package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +1 -0
  62. package/dist/server/modules/assistant-capability/assistant-capability-service.js +1 -0
  63. package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
  64. package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +2 -1
  65. package/dist/server/modules/browser-runtime/browser-runtime-controller.js +1 -0
  66. package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -1
  67. package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +4 -1
  68. package/dist/server/modules/browser-runtime/browser-runtime-service.js +40 -0
  69. package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -1
  70. package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +2 -0
  71. package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -1
  72. package/dist/server/modules/file/file-access-guard.d.ts +2 -0
  73. package/dist/server/modules/file/file-access-guard.js +24 -2
  74. package/dist/server/modules/file/file-access-guard.js.map +1 -1
  75. package/dist/server/modules/file/file-controller.d.ts +153 -1
  76. package/dist/server/modules/file/file-controller.js +215 -1
  77. package/dist/server/modules/file/file-controller.js.map +1 -1
  78. package/dist/server/modules/file/file-preview-link-service.d.ts +2 -0
  79. package/dist/server/modules/file/file-preview-link-service.js +5 -1
  80. package/dist/server/modules/file/file-preview-link-service.js.map +1 -1
  81. package/dist/server/modules/file/runtime/codingns-workspace-bridge.js +911 -0
  82. package/dist/server/modules/file/workspace-file-bridge-service.d.ts +126 -0
  83. package/dist/server/modules/file/workspace-file-bridge-service.js +471 -0
  84. package/dist/server/modules/file/workspace-file-bridge-service.js.map +1 -0
  85. package/dist/server/modules/file/workspace-file-bridge-watch-service.d.ts +42 -0
  86. package/dist/server/modules/file/workspace-file-bridge-watch-service.js +304 -0
  87. package/dist/server/modules/file/workspace-file-bridge-watch-service.js.map +1 -0
  88. package/dist/server/modules/git/git-command-helper-process.js +0 -18
  89. package/dist/server/modules/git/git-command-helper-process.js.map +1 -1
  90. package/dist/server/modules/git/git-command-runner.js +0 -18
  91. package/dist/server/modules/git/git-command-runner.js.map +1 -1
  92. package/dist/server/modules/model-switch/cc-switch-adapter.js +1 -1
  93. package/dist/server/modules/model-switch/cc-switch-adapter.js.map +1 -1
  94. package/dist/server/modules/plugins/plugin-controller.d.ts +131 -0
  95. package/dist/server/modules/plugins/plugin-controller.js +277 -0
  96. package/dist/server/modules/plugins/plugin-controller.js.map +1 -0
  97. package/dist/server/modules/plugins/plugin-file-gateway-service.d.ts +38 -0
  98. package/dist/server/modules/plugins/plugin-file-gateway-service.js +178 -0
  99. package/dist/server/modules/plugins/plugin-file-gateway-service.js.map +1 -0
  100. package/dist/server/modules/plugins/plugin-manifest.d.ts +8 -0
  101. package/dist/server/modules/plugins/plugin-manifest.js +420 -0
  102. package/dist/server/modules/plugins/plugin-manifest.js.map +1 -0
  103. package/dist/server/modules/plugins/plugin-permission-service.d.ts +49 -0
  104. package/dist/server/modules/plugins/plugin-permission-service.js +267 -0
  105. package/dist/server/modules/plugins/plugin-permission-service.js.map +1 -0
  106. package/dist/server/modules/plugins/plugin-process-runner.d.ts +21 -0
  107. package/dist/server/modules/plugins/plugin-process-runner.js +127 -0
  108. package/dist/server/modules/plugins/plugin-process-runner.js.map +1 -0
  109. package/dist/server/modules/plugins/plugin-registry-service.d.ts +41 -0
  110. package/dist/server/modules/plugins/plugin-registry-service.js +238 -0
  111. package/dist/server/modules/plugins/plugin-registry-service.js.map +1 -0
  112. package/dist/server/modules/plugins/plugin-runtime-service.d.ts +55 -0
  113. package/dist/server/modules/plugins/plugin-runtime-service.js +252 -0
  114. package/dist/server/modules/plugins/plugin-runtime-service.js.map +1 -0
  115. package/dist/server/modules/plugins/plugin-runtime-session-service.d.ts +21 -0
  116. package/dist/server/modules/plugins/plugin-runtime-session-service.js +83 -0
  117. package/dist/server/modules/plugins/plugin-runtime-session-service.js.map +1 -0
  118. package/dist/server/modules/plugins/plugin-scheduler-service.d.ts +31 -0
  119. package/dist/server/modules/plugins/plugin-scheduler-service.js +232 -0
  120. package/dist/server/modules/plugins/plugin-scheduler-service.js.map +1 -0
  121. package/dist/server/modules/plugins/plugin-static-service.d.ts +11 -0
  122. package/dist/server/modules/plugins/plugin-static-service.js +145 -0
  123. package/dist/server/modules/plugins/plugin-static-service.js.map +1 -0
  124. package/dist/server/modules/presentation/presentation-controller.d.ts +3 -0
  125. package/dist/server/modules/presentation/presentation-controller.js +11 -0
  126. package/dist/server/modules/presentation/presentation-controller.js.map +1 -1
  127. package/dist/server/modules/presentation/presentation-export-task-service.d.ts +6 -0
  128. package/dist/server/modules/presentation/presentation-export-task-service.js +52 -8
  129. package/dist/server/modules/presentation/presentation-export-task-service.js.map +1 -1
  130. package/dist/server/modules/presentation/presentation-pptx-export-service.js +200 -14
  131. package/dist/server/modules/presentation/presentation-pptx-export-service.js.map +1 -1
  132. package/dist/server/modules/presentation/presentation-renderer.d.ts +50 -0
  133. package/dist/server/modules/presentation/presentation-renderer.js +450 -37
  134. package/dist/server/modules/presentation/presentation-renderer.js.map +1 -1
  135. package/dist/server/modules/sessions/session-live-runtime-service.js +46 -3
  136. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  137. package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +1 -0
  138. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +11 -2
  139. package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -1
  140. package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +2 -2
  141. package/dist/server/modules/tasks/task-types.d.ts +2 -0
  142. package/dist/server/modules/tasks/task-types.js +2 -0
  143. package/dist/server/modules/tasks/task-types.js.map +1 -1
  144. package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js +1 -1
  145. package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js.map +1 -1
  146. package/dist/server/routes/files.js +40 -0
  147. package/dist/server/routes/files.js.map +1 -1
  148. package/dist/server/routes/plugins-public.d.ts +3 -0
  149. package/dist/server/routes/plugins-public.js +5 -0
  150. package/dist/server/routes/plugins-public.js.map +1 -0
  151. package/dist/server/routes/plugins.d.ts +3 -0
  152. package/dist/server/routes/plugins.js +19 -0
  153. package/dist/server/routes/plugins.js.map +1 -0
  154. package/dist/server/routes/presentation.js +1 -0
  155. package/dist/server/routes/presentation.js.map +1 -1
  156. package/dist/server/server/create-server.d.ts +20 -0
  157. package/dist/server/server/create-server.js +47 -1
  158. package/dist/server/server/create-server.js.map +1 -1
  159. package/dist/server/shared/http/error-handler.js +63 -25
  160. package/dist/server/shared/http/error-handler.js.map +1 -1
  161. package/dist/server/shared/runtime/better-sqlite3.d.ts +5 -0
  162. package/dist/server/shared/runtime/better-sqlite3.js +6 -0
  163. package/dist/server/shared/runtime/better-sqlite3.js.map +1 -0
  164. package/dist/server/shared/utils/install-console-timestamp-prefix.d.ts +1 -0
  165. package/dist/server/shared/utils/install-console-timestamp-prefix.js +28 -0
  166. package/dist/server/shared/utils/install-console-timestamp-prefix.js.map +1 -0
  167. package/dist/server/storage/repositories/plugin-audit-event-repository.d.ts +8 -0
  168. package/dist/server/storage/repositories/plugin-audit-event-repository.js +49 -0
  169. package/dist/server/storage/repositories/plugin-audit-event-repository.js.map +1 -0
  170. package/dist/server/storage/repositories/plugin-definition-repository.d.ts +10 -0
  171. package/dist/server/storage/repositories/plugin-definition-repository.js +84 -0
  172. package/dist/server/storage/repositories/plugin-definition-repository.js.map +1 -0
  173. package/dist/server/storage/repositories/plugin-enablement-repository.d.ts +9 -0
  174. package/dist/server/storage/repositories/plugin-enablement-repository.js +74 -0
  175. package/dist/server/storage/repositories/plugin-enablement-repository.js.map +1 -0
  176. package/dist/server/storage/repositories/plugin-permission-grant-repository.d.ts +12 -0
  177. package/dist/server/storage/repositories/plugin-permission-grant-repository.js +142 -0
  178. package/dist/server/storage/repositories/plugin-permission-grant-repository.js.map +1 -0
  179. package/dist/server/storage/repositories/plugin-run-repository.d.ts +10 -0
  180. package/dist/server/storage/repositories/plugin-run-repository.js +111 -0
  181. package/dist/server/storage/repositories/plugin-run-repository.js.map +1 -0
  182. package/dist/server/storage/repositories/plugin-runtime-session-repository.d.ts +10 -0
  183. package/dist/server/storage/repositories/plugin-runtime-session-repository.js +86 -0
  184. package/dist/server/storage/repositories/plugin-runtime-session-repository.js.map +1 -0
  185. package/dist/server/storage/sqlite/client.d.ts +2 -2
  186. package/dist/server/storage/sqlite/client.js +250 -1
  187. package/dist/server/storage/sqlite/client.js.map +1 -1
  188. package/dist/server/storage/sqlite/schema.sql +140 -0
  189. package/dist/server/types/domain.d.ts +122 -0
  190. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +42 -0
  191. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +346 -0
  192. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -0
  193. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
  194. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
  195. package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
  196. package/node_modules/@codingns/session-sync-core/dist/index.d.ts +18 -0
  197. package/node_modules/@codingns/session-sync-core/dist/index.js +19 -0
  198. package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -0
  199. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +18 -0
  200. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +659 -0
  201. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +1 -0
  202. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +11 -0
  203. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +72 -0
  204. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +1 -0
  205. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +67 -0
  206. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +752 -0
  207. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -0
  208. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +48 -0
  209. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +1184 -0
  210. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -0
  211. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +11 -0
  212. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +105 -0
  213. package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +1 -0
  214. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +84 -0
  215. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +2436 -0
  216. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -0
  217. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +47 -0
  218. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +1480 -0
  219. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -0
  220. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +33 -0
  221. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +684 -0
  222. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -0
  223. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +9 -0
  224. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +17 -0
  225. package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +1 -0
  226. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +1 -0
  227. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +8 -0
  228. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +1 -0
  229. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +48 -0
  230. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +373 -0
  231. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -0
  232. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +61 -0
  233. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +1191 -0
  234. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -0
  235. package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +27 -0
  236. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +415 -0
  237. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +1 -0
  238. package/node_modules/@codingns/session-sync-core/dist/registry.d.ts +7 -0
  239. package/node_modules/@codingns/session-sync-core/dist/registry.js +22 -0
  240. package/node_modules/@codingns/session-sync-core/dist/registry.js.map +1 -0
  241. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +24 -0
  242. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +329 -0
  243. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -0
  244. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +30 -0
  245. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +939 -0
  246. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -0
  247. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +1 -0
  248. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +16 -0
  249. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +1 -0
  250. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +70 -0
  251. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +2571 -0
  252. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -0
  253. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +21 -0
  254. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +561 -0
  255. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +1 -0
  256. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +38 -0
  257. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +911 -0
  258. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +1 -0
  259. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +15 -0
  260. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +16 -0
  261. package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +1 -0
  262. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +38 -0
  263. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +970 -0
  264. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -0
  265. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +21 -0
  266. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +168 -0
  267. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -0
  268. package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +152 -0
  269. package/node_modules/@codingns/session-sync-core/dist/runtime/types.js +2 -0
  270. package/node_modules/@codingns/session-sync-core/dist/runtime/types.js.map +1 -0
  271. package/node_modules/@codingns/session-sync-core/dist/services.d.ts +28 -0
  272. package/node_modules/@codingns/session-sync-core/dist/services.js +148 -0
  273. package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -0
  274. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +6 -0
  275. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +9 -0
  276. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +1 -0
  277. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +198 -0
  278. package/node_modules/@codingns/session-sync-core/dist/types.js +2 -0
  279. package/node_modules/@codingns/session-sync-core/dist/types.js.map +1 -0
  280. package/node_modules/@codingns/session-sync-core/package.json +33 -0
  281. package/package.json +15 -6
  282. package/scripts/postinstall.mjs +248 -11
  283. package/vendor/better-sqlite3-win32-x64-node22/LICENSE +21 -0
  284. package/vendor/better-sqlite3-win32-x64-node22/README.md +12 -0
  285. package/vendor/better-sqlite3-win32-x64-node22/README.upstream.md +99 -0
  286. package/vendor/better-sqlite3-win32-x64-node22/binding.gyp +38 -0
  287. package/vendor/better-sqlite3-win32-x64-node22/build/Release/better_sqlite3.node +0 -0
  288. package/vendor/better-sqlite3-win32-x64-node22/deps/common.gypi +68 -0
  289. package/vendor/better-sqlite3-win32-x64-node22/deps/copy.js +31 -0
  290. package/vendor/better-sqlite3-win32-x64-node22/deps/defines.gypi +41 -0
  291. package/vendor/better-sqlite3-win32-x64-node22/deps/download.sh +122 -0
  292. package/vendor/better-sqlite3-win32-x64-node22/deps/patches/1208.patch +15 -0
  293. package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3/sqlite3.c +265994 -0
  294. package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3/sqlite3.h +13968 -0
  295. package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3/sqlite3ext.h +730 -0
  296. package/vendor/better-sqlite3-win32-x64-node22/deps/sqlite3.gyp +80 -0
  297. package/vendor/better-sqlite3-win32-x64-node22/deps/test_extension.c +21 -0
  298. package/vendor/better-sqlite3-win32-x64-node22/lib/database.js +90 -0
  299. package/vendor/better-sqlite3-win32-x64-node22/lib/index.js +3 -0
  300. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/aggregate.js +43 -0
  301. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/backup.js +67 -0
  302. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/function.js +31 -0
  303. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/inspect.js +7 -0
  304. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/pragma.js +12 -0
  305. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/serialize.js +16 -0
  306. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/table.js +189 -0
  307. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/transaction.js +78 -0
  308. package/vendor/better-sqlite3-win32-x64-node22/lib/methods/wrappers.js +54 -0
  309. package/vendor/better-sqlite3-win32-x64-node22/lib/sqlite-error.js +20 -0
  310. package/vendor/better-sqlite3-win32-x64-node22/lib/util.js +12 -0
  311. package/vendor/better-sqlite3-win32-x64-node22/package.json +38 -0
  312. package/vendor/better-sqlite3-win32-x64-node22/scripts/verify-runtime.cjs +42 -0
  313. package/vendor/better-sqlite3-win32-x64-node22/src/addon.cpp +47 -0
  314. package/vendor/better-sqlite3-win32-x64-node22/src/better_sqlite3.cpp +74 -0
  315. package/vendor/better-sqlite3-win32-x64-node22/src/objects/backup.cpp +120 -0
  316. package/vendor/better-sqlite3-win32-x64-node22/src/objects/backup.hpp +36 -0
  317. package/vendor/better-sqlite3-win32-x64-node22/src/objects/database.cpp +417 -0
  318. package/vendor/better-sqlite3-win32-x64-node22/src/objects/database.hpp +103 -0
  319. package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement-iterator.cpp +113 -0
  320. package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement-iterator.hpp +50 -0
  321. package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement.cpp +383 -0
  322. package/vendor/better-sqlite3-win32-x64-node22/src/objects/statement.hpp +58 -0
  323. package/vendor/better-sqlite3-win32-x64-node22/src/util/bind-map.cpp +73 -0
  324. package/vendor/better-sqlite3-win32-x64-node22/src/util/binder.cpp +193 -0
  325. package/vendor/better-sqlite3-win32-x64-node22/src/util/constants.cpp +172 -0
  326. package/vendor/better-sqlite3-win32-x64-node22/src/util/custom-aggregate.cpp +121 -0
  327. package/vendor/better-sqlite3-win32-x64-node22/src/util/custom-function.cpp +59 -0
  328. package/vendor/better-sqlite3-win32-x64-node22/src/util/custom-table.cpp +409 -0
  329. package/vendor/better-sqlite3-win32-x64-node22/src/util/data-converter.cpp +17 -0
  330. package/vendor/better-sqlite3-win32-x64-node22/src/util/data.cpp +194 -0
  331. package/vendor/better-sqlite3-win32-x64-node22/src/util/helpers.cpp +109 -0
  332. package/vendor/better-sqlite3-win32-x64-node22/src/util/macros.cpp +83 -0
  333. package/vendor/better-sqlite3-win32-x64-node22/src/util/query-macros.cpp +71 -0
  334. package/vendor/better-sqlite3-win32-x64-node22/src/util/row-builder.cpp +49 -0
  335. package/vendor/node-pty-fork/LICENSE +69 -0
  336. package/vendor/node-pty-fork/README.md +92 -0
  337. package/vendor/node-pty-fork/binding.gyp +117 -0
  338. package/vendor/node-pty-fork/deps/.editorconfig +2 -0
  339. package/vendor/node-pty-fork/deps/winpty/.drone.yml +17 -0
  340. package/vendor/node-pty-fork/deps/winpty/.gitattributes +19 -0
  341. package/vendor/node-pty-fork/deps/winpty/LICENSE +21 -0
  342. package/vendor/node-pty-fork/deps/winpty/Makefile +166 -0
  343. package/vendor/node-pty-fork/deps/winpty/README.md +151 -0
  344. package/vendor/node-pty-fork/deps/winpty/RELEASES.md +280 -0
  345. package/vendor/node-pty-fork/deps/winpty/VERSION.txt +1 -0
  346. package/vendor/node-pty-fork/deps/winpty/configure +167 -0
  347. package/vendor/node-pty-fork/deps/winpty/misc/BufferResizeTests.cc +90 -0
  348. package/vendor/node-pty-fork/deps/winpty/misc/ChangeScreenBuffer.cc +53 -0
  349. package/vendor/node-pty-fork/deps/winpty/misc/ClearConsole.cc +72 -0
  350. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.cc +117 -0
  351. package/vendor/node-pty-fork/deps/winpty/misc/ConinMode.ps1 +116 -0
  352. package/vendor/node-pty-fork/deps/winpty/misc/ConoutMode.cc +113 -0
  353. package/vendor/node-pty-fork/deps/winpty/misc/DebugClient.py +42 -0
  354. package/vendor/node-pty-fork/deps/winpty/misc/DebugServer.py +63 -0
  355. package/vendor/node-pty-fork/deps/winpty/misc/DumpLines.py +5 -0
  356. package/vendor/node-pty-fork/deps/winpty/misc/EnableExtendedFlags.txt +46 -0
  357. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +528 -0
  358. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +633 -0
  359. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP932.txt +630 -0
  360. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP936.txt +630 -0
  361. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP949.txt +630 -0
  362. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/CP950.txt +630 -0
  363. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +16 -0
  364. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Results.txt +4 -0
  365. package/vendor/node-pty-fork/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +144 -0
  366. package/vendor/node-pty-fork/deps/winpty/misc/FontSurvey.cc +100 -0
  367. package/vendor/node-pty-fork/deps/winpty/misc/FormatChar.h +21 -0
  368. package/vendor/node-pty-fork/deps/winpty/misc/FreezePerfTest.cc +62 -0
  369. package/vendor/node-pty-fork/deps/winpty/misc/GetCh.cc +20 -0
  370. package/vendor/node-pty-fork/deps/winpty/misc/GetConsolePos.cc +41 -0
  371. package/vendor/node-pty-fork/deps/winpty/misc/GetFont.cc +261 -0
  372. package/vendor/node-pty-fork/deps/winpty/misc/IdentifyConsoleWindow.ps1 +51 -0
  373. package/vendor/node-pty-fork/deps/winpty/misc/IsNewConsole.cc +87 -0
  374. package/vendor/node-pty-fork/deps/winpty/misc/MouseInputNotes.txt +90 -0
  375. package/vendor/node-pty-fork/deps/winpty/misc/MoveConsoleWindow.cc +34 -0
  376. package/vendor/node-pty-fork/deps/winpty/misc/Notes.txt +219 -0
  377. package/vendor/node-pty-fork/deps/winpty/misc/OSVersion.cc +27 -0
  378. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferFreezeInactive.cc +101 -0
  379. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest.cc +671 -0
  380. package/vendor/node-pty-fork/deps/winpty/misc/ScreenBufferTest2.cc +151 -0
  381. package/vendor/node-pty-fork/deps/winpty/misc/SelectAllTest.cc +45 -0
  382. package/vendor/node-pty-fork/deps/winpty/misc/SetBufferSize.cc +32 -0
  383. package/vendor/node-pty-fork/deps/winpty/misc/SetCursorPos.cc +10 -0
  384. package/vendor/node-pty-fork/deps/winpty/misc/SetFont.cc +145 -0
  385. package/vendor/node-pty-fork/deps/winpty/misc/SetWindowRect.cc +36 -0
  386. package/vendor/node-pty-fork/deps/winpty/misc/ShowArgv.cc +12 -0
  387. package/vendor/node-pty-fork/deps/winpty/misc/ShowConsoleInput.cc +40 -0
  388. package/vendor/node-pty-fork/deps/winpty/misc/Spew.py +5 -0
  389. package/vendor/node-pty-fork/deps/winpty/misc/TestUtil.cc +172 -0
  390. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeDoubleWidthTest.cc +102 -0
  391. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest1.cc +246 -0
  392. package/vendor/node-pty-fork/deps/winpty/misc/UnicodeWideTest2.cc +130 -0
  393. package/vendor/node-pty-fork/deps/winpty/misc/UnixEcho.cc +89 -0
  394. package/vendor/node-pty-fork/deps/winpty/misc/Utf16Echo.cc +46 -0
  395. package/vendor/node-pty-fork/deps/winpty/misc/VeryLargeRead.cc +122 -0
  396. package/vendor/node-pty-fork/deps/winpty/misc/VkEscapeTest.cc +56 -0
  397. package/vendor/node-pty-fork/deps/winpty/misc/Win10ResizeWhileFrozen.cc +52 -0
  398. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest1.cc +57 -0
  399. package/vendor/node-pty-fork/deps/winpty/misc/Win10WrapTest2.cc +30 -0
  400. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo1.cc +26 -0
  401. package/vendor/node-pty-fork/deps/winpty/misc/Win32Echo2.cc +19 -0
  402. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test1.cc +46 -0
  403. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test2.cc +70 -0
  404. package/vendor/node-pty-fork/deps/winpty/misc/Win32Test3.cc +78 -0
  405. package/vendor/node-pty-fork/deps/winpty/misc/Win32Write1.cc +44 -0
  406. package/vendor/node-pty-fork/deps/winpty/misc/WindowsBugCrashReader.cc +27 -0
  407. package/vendor/node-pty-fork/deps/winpty/misc/WriteConsole.cc +106 -0
  408. package/vendor/node-pty-fork/deps/winpty/misc/build32.sh +9 -0
  409. package/vendor/node-pty-fork/deps/winpty/misc/build64.sh +9 -0
  410. package/vendor/node-pty-fork/deps/winpty/misc/color-test.sh +212 -0
  411. package/vendor/node-pty-fork/deps/winpty/misc/font-notes.txt +300 -0
  412. package/vendor/node-pty-fork/deps/winpty/misc/winbug-15048.cc +201 -0
  413. package/vendor/node-pty-fork/deps/winpty/ship/build-pty4j-libpty.bat +36 -0
  414. package/vendor/node-pty-fork/deps/winpty/ship/common_ship.py +53 -0
  415. package/vendor/node-pty-fork/deps/winpty/ship/make_msvc_package.py +165 -0
  416. package/vendor/node-pty-fork/deps/winpty/ship/ship.py +108 -0
  417. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.cc +605 -0
  418. package/vendor/node-pty-fork/deps/winpty/src/agent/Agent.h +103 -0
  419. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.cc +84 -0
  420. package/vendor/node-pty-fork/deps/winpty/src/agent/AgentCreateDesktop.h +28 -0
  421. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.cc +632 -0
  422. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleFont.h +28 -0
  423. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.cc +852 -0
  424. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInput.h +109 -0
  425. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.cc +121 -0
  426. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleInputReencoding.h +36 -0
  427. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.cc +152 -0
  428. package/vendor/node-pty-fork/deps/winpty/src/agent/ConsoleLine.h +41 -0
  429. package/vendor/node-pty-fork/deps/winpty/src/agent/Coord.h +87 -0
  430. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.cc +239 -0
  431. package/vendor/node-pty-fork/deps/winpty/src/agent/DebugShowInput.h +32 -0
  432. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.cc +422 -0
  433. package/vendor/node-pty-fork/deps/winpty/src/agent/DefaultInputMap.h +28 -0
  434. package/vendor/node-pty-fork/deps/winpty/src/agent/DsrSender.h +30 -0
  435. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.cc +99 -0
  436. package/vendor/node-pty-fork/deps/winpty/src/agent/EventLoop.h +47 -0
  437. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.cc +246 -0
  438. package/vendor/node-pty-fork/deps/winpty/src/agent/InputMap.h +114 -0
  439. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.cc +71 -0
  440. package/vendor/node-pty-fork/deps/winpty/src/agent/LargeConsoleRead.h +68 -0
  441. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.cc +378 -0
  442. package/vendor/node-pty-fork/deps/winpty/src/agent/NamedPipe.h +125 -0
  443. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.cc +699 -0
  444. package/vendor/node-pty-fork/deps/winpty/src/agent/Scraper.h +103 -0
  445. package/vendor/node-pty-fork/deps/winpty/src/agent/SimplePool.h +75 -0
  446. package/vendor/node-pty-fork/deps/winpty/src/agent/SmallRect.h +143 -0
  447. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.cc +535 -0
  448. package/vendor/node-pty-fork/deps/winpty/src/agent/Terminal.h +69 -0
  449. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncoding.h +157 -0
  450. package/vendor/node-pty-fork/deps/winpty/src/agent/UnicodeEncodingTest.cc +189 -0
  451. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.cc +107 -0
  452. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32Console.h +67 -0
  453. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.cc +193 -0
  454. package/vendor/node-pty-fork/deps/winpty/src/agent/Win32ConsoleBuffer.h +99 -0
  455. package/vendor/node-pty-fork/deps/winpty/src/agent/main.cc +114 -0
  456. package/vendor/node-pty-fork/deps/winpty/src/agent/subdir.mk +61 -0
  457. package/vendor/node-pty-fork/deps/winpty/src/configurations.gypi +60 -0
  458. package/vendor/node-pty-fork/deps/winpty/src/debugserver/DebugServer.cc +117 -0
  459. package/vendor/node-pty-fork/deps/winpty/src/debugserver/subdir.mk +41 -0
  460. package/vendor/node-pty-fork/deps/winpty/src/include/winpty.h +242 -0
  461. package/vendor/node-pty-fork/deps/winpty/src/include/winpty_constants.h +131 -0
  462. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.cc +75 -0
  463. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/AgentLocation.h +28 -0
  464. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/LibWinptyException.h +54 -0
  465. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/WinptyInternal.h +72 -0
  466. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/subdir.mk +46 -0
  467. package/vendor/node-pty-fork/deps/winpty/src/libwinpty/winpty.cc +970 -0
  468. package/vendor/node-pty-fork/deps/winpty/src/shared/AgentMsg.h +38 -0
  469. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.cc +122 -0
  470. package/vendor/node-pty-fork/deps/winpty/src/shared/BackgroundDesktop.h +73 -0
  471. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.cc +103 -0
  472. package/vendor/node-pty-fork/deps/winpty/src/shared/Buffer.h +102 -0
  473. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.cc +187 -0
  474. package/vendor/node-pty-fork/deps/winpty/src/shared/DebugClient.h +38 -0
  475. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.cc +138 -0
  476. package/vendor/node-pty-fork/deps/winpty/src/shared/GenRandom.h +55 -0
  477. package/vendor/node-pty-fork/deps/winpty/src/shared/GetCommitHash.bat +13 -0
  478. package/vendor/node-pty-fork/deps/winpty/src/shared/Mutex.h +54 -0
  479. package/vendor/node-pty-fork/deps/winpty/src/shared/OsModule.h +63 -0
  480. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.cc +36 -0
  481. package/vendor/node-pty-fork/deps/winpty/src/shared/OwnedHandle.h +45 -0
  482. package/vendor/node-pty-fork/deps/winpty/src/shared/PrecompiledHeader.h +43 -0
  483. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilder.h +227 -0
  484. package/vendor/node-pty-fork/deps/winpty/src/shared/StringBuilderTest.cc +114 -0
  485. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.cc +55 -0
  486. package/vendor/node-pty-fork/deps/winpty/src/shared/StringUtil.h +80 -0
  487. package/vendor/node-pty-fork/deps/winpty/src/shared/TimeMeasurement.h +63 -0
  488. package/vendor/node-pty-fork/deps/winpty/src/shared/UnixCtrlChars.h +45 -0
  489. package/vendor/node-pty-fork/deps/winpty/src/shared/UpdateGenVersion.bat +20 -0
  490. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.cc +460 -0
  491. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsSecurity.h +104 -0
  492. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.cc +252 -0
  493. package/vendor/node-pty-fork/deps/winpty/src/shared/WindowsVersion.h +29 -0
  494. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.cc +55 -0
  495. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyAssert.h +64 -0
  496. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.cc +57 -0
  497. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyException.h +43 -0
  498. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.cc +42 -0
  499. package/vendor/node-pty-fork/deps/winpty/src/shared/WinptyVersion.h +27 -0
  500. package/vendor/node-pty-fork/deps/winpty/src/shared/winpty_snprintf.h +99 -0
  501. package/vendor/node-pty-fork/deps/winpty/src/subdir.mk +5 -0
  502. package/vendor/node-pty-fork/deps/winpty/src/tests/subdir.mk +28 -0
  503. package/vendor/node-pty-fork/deps/winpty/src/tests/trivial_test.cc +158 -0
  504. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.cc +114 -0
  505. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/InputHandler.h +56 -0
  506. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.cc +80 -0
  507. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/OutputHandler.h +53 -0
  508. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.cc +86 -0
  509. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/Util.h +31 -0
  510. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.cc +70 -0
  511. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/WakeupFd.h +42 -0
  512. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/main.cc +729 -0
  513. package/vendor/node-pty-fork/deps/winpty/src/unix-adapter/subdir.mk +41 -0
  514. package/vendor/node-pty-fork/deps/winpty/src/winpty.gyp +206 -0
  515. package/vendor/node-pty-fork/deps/winpty/vcbuild.bat +83 -0
  516. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js +20 -0
  517. package/vendor/node-pty-fork/lib/conpty_console_list_agent.js.map +1 -0
  518. package/vendor/node-pty-fork/lib/eventEmitter2.js +47 -0
  519. package/vendor/node-pty-fork/lib/eventEmitter2.js.map +1 -0
  520. package/vendor/node-pty-fork/lib/eventEmitter2.test.js +30 -0
  521. package/vendor/node-pty-fork/lib/eventEmitter2.test.js.map +1 -0
  522. package/vendor/node-pty-fork/lib/index.js +51 -0
  523. package/vendor/node-pty-fork/lib/index.js.map +1 -0
  524. package/vendor/node-pty-fork/lib/interfaces.js +7 -0
  525. package/vendor/node-pty-fork/lib/interfaces.js.map +1 -0
  526. package/vendor/node-pty-fork/lib/shared/conout.js +11 -0
  527. package/vendor/node-pty-fork/lib/shared/conout.js.map +1 -0
  528. package/vendor/node-pty-fork/lib/terminal.js +190 -0
  529. package/vendor/node-pty-fork/lib/terminal.js.map +1 -0
  530. package/vendor/node-pty-fork/lib/terminal.test.js +139 -0
  531. package/vendor/node-pty-fork/lib/terminal.test.js.map +1 -0
  532. package/vendor/node-pty-fork/lib/testUtils.test.js +28 -0
  533. package/vendor/node-pty-fork/lib/testUtils.test.js.map +1 -0
  534. package/vendor/node-pty-fork/lib/types.js +7 -0
  535. package/vendor/node-pty-fork/lib/types.js.map +1 -0
  536. package/vendor/node-pty-fork/lib/unixTerminal.js +304 -0
  537. package/vendor/node-pty-fork/lib/unixTerminal.js.map +1 -0
  538. package/vendor/node-pty-fork/lib/unixTerminal.test.js +330 -0
  539. package/vendor/node-pty-fork/lib/unixTerminal.test.js.map +1 -0
  540. package/vendor/node-pty-fork/lib/utils.js +17 -0
  541. package/vendor/node-pty-fork/lib/utils.js.map +1 -0
  542. package/vendor/node-pty-fork/lib/windowsConoutConnection.js +122 -0
  543. package/vendor/node-pty-fork/lib/windowsConoutConnection.js.map +1 -0
  544. package/vendor/node-pty-fork/lib/windowsPtyAgent.js +324 -0
  545. package/vendor/node-pty-fork/lib/windowsPtyAgent.js.map +1 -0
  546. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js +90 -0
  547. package/vendor/node-pty-fork/lib/windowsPtyAgent.test.js.map +1 -0
  548. package/vendor/node-pty-fork/lib/windowsTerminal.js +201 -0
  549. package/vendor/node-pty-fork/lib/windowsTerminal.js.map +1 -0
  550. package/vendor/node-pty-fork/lib/windowsTerminal.test.js +203 -0
  551. package/vendor/node-pty-fork/lib/windowsTerminal.test.js.map +1 -0
  552. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js +22 -0
  553. package/vendor/node-pty-fork/lib/worker/conoutSocketWorker.js.map +1 -0
  554. package/vendor/node-pty-fork/package.json +35 -0
  555. package/vendor/node-pty-fork/scripts/apply-patches.mjs +341 -0
  556. package/vendor/node-pty-fork/scripts/fetch-upstream.mjs +41 -0
  557. package/vendor/node-pty-fork/scripts/install-smoke.cjs +59 -0
  558. package/vendor/node-pty-fork/scripts/runtime-install-context.cjs +24 -0
  559. package/vendor/node-pty-fork/scripts/smoke-load.cjs +10 -0
  560. package/vendor/node-pty-fork/scripts/sync-upstream.mjs +29 -0
  561. package/vendor/node-pty-fork/scripts/verify-runtime.cjs +62 -0
  562. package/vendor/node-pty-fork/scripts/verify-runtime.test.cjs +52 -0
  563. package/vendor/node-pty-fork/scripts/verify-tarball.cjs +80 -0
  564. package/vendor/node-pty-fork/src/conpty_console_list_agent.ts +19 -0
  565. package/vendor/node-pty-fork/src/eventEmitter2.test.ts +30 -0
  566. package/vendor/node-pty-fork/src/eventEmitter2.ts +48 -0
  567. package/vendor/node-pty-fork/src/index.ts +51 -0
  568. package/vendor/node-pty-fork/src/interfaces.ts +129 -0
  569. package/vendor/node-pty-fork/src/native.d.ts +56 -0
  570. package/vendor/node-pty-fork/src/shared/conout.ts +15 -0
  571. package/vendor/node-pty-fork/src/terminal.test.ts +119 -0
  572. package/vendor/node-pty-fork/src/terminal.ts +211 -0
  573. package/vendor/node-pty-fork/src/testUtils.test.ts +23 -0
  574. package/vendor/node-pty-fork/src/tsconfig.json +22 -0
  575. package/vendor/node-pty-fork/src/types.ts +15 -0
  576. package/vendor/node-pty-fork/src/unix/pty.cc +826 -0
  577. package/vendor/node-pty-fork/src/unix/spawn-helper.cc +23 -0
  578. package/vendor/node-pty-fork/src/unixTerminal.test.ts +335 -0
  579. package/vendor/node-pty-fork/src/unixTerminal.ts +320 -0
  580. package/vendor/node-pty-fork/src/utils.ts +9 -0
  581. package/vendor/node-pty-fork/src/win/conpty.cc +500 -0
  582. package/vendor/node-pty-fork/src/win/conpty_console_list.cc +43 -0
  583. package/vendor/node-pty-fork/src/win/path_util.cc +73 -0
  584. package/vendor/node-pty-fork/src/win/path_util.h +22 -0
  585. package/vendor/node-pty-fork/src/win/winpty.cc +322 -0
  586. package/vendor/node-pty-fork/src/windowsConoutConnection.ts +79 -0
  587. package/vendor/node-pty-fork/src/windowsPtyAgent.test.ts +94 -0
  588. package/vendor/node-pty-fork/src/windowsPtyAgent.ts +323 -0
  589. package/vendor/node-pty-fork/src/windowsTerminal.test.ts +214 -0
  590. package/vendor/node-pty-fork/src/windowsTerminal.ts +208 -0
  591. package/vendor/node-pty-fork/src/worker/conoutSocketWorker.ts +22 -0
  592. package/vendor/node-pty-fork/typings/node-pty.d.ts +203 -0
  593. package/vendor-src/better-sqlite3-win32-x64-node22/README.md +12 -0
  594. package/dist/public/assets/App-tPcbyRdS.js +0 -30
  595. package/dist/public/assets/DesktopWindowPage-GtIx5m8K.js +0 -2
  596. package/dist/public/assets/FileContextPanel-BcM7AIT4.js +0 -1
  597. package/dist/public/assets/GitSidebar-CMtkaxuI.js +0 -6
  598. package/dist/public/assets/MobileCreateSessionSheet-CrFY41_8.js +0 -1
  599. package/dist/public/assets/MobileWorkspaceSwitcherHeader-DLkACTnQ.js +0 -1
  600. package/dist/public/assets/ServerSettingsModal-vgOhwus4.js +0 -1
  601. package/dist/public/assets/SessionIndexPage-KK626Ra9.js +0 -1
  602. package/dist/public/assets/SettingsPage-B3edBJIo.js +0 -2
  603. package/dist/public/assets/TerminalManagerPanel-BxlhZp8c.js +0 -1
  604. package/dist/public/assets/TerminalRuntimeFallbackModal-BVLfrpSa.js +0 -1
  605. package/dist/public/assets/ToolFilesPage-N_gwwUjD.js +0 -1
  606. package/dist/public/assets/ToolGitPage-DOcuuWM1.js +0 -1
  607. package/dist/public/assets/ToolProcessesPage-D-FfJ7Re.js +0 -1
  608. package/dist/public/assets/ToolsHomePage-CHfPxd20.js +0 -1
  609. package/dist/public/assets/WorkbenchLandingPage-CTTnfovY.js +0 -1
  610. package/dist/public/assets/WorkbenchLayout-CbpJg0g1.js +0 -244
  611. package/dist/public/assets/WorkbenchModal-Bt_1fYmM.js +0 -1
  612. package/dist/public/assets/WorkbenchShellRoute-DyaMnPfS.js +0 -1
  613. package/dist/public/assets/WorkspaceDebugDetailPage-s7yuDIxR.js +0 -1
  614. package/dist/public/assets/WorkspaceDetailPage-Cf-gVpqK.js +0 -1
  615. package/dist/public/assets/WorkspaceHomePage-COf6I8sT.js +0 -1
  616. package/dist/public/assets/file-tree-icon-BeHqeru9.js +0 -590
  617. package/dist/public/assets/index-CuzMc7q2.js +0 -42
  618. package/dist/public/assets/model-switch-api-c6kcbBGm.js +0 -1
  619. package/dist/public/assets/realtime-client-CRCx5xBt.js +0 -1
  620. package/dist/public/assets/useRegisteredDebugTemplates-D6YtNS0r.js +0 -1
@@ -1,30 +0,0 @@
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]);/**
3
- * @remix-run/router v1.23.2
4
- *
5
- * Copyright (c) Remix Software Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE.md file in the root directory of this source tree.
9
- *
10
- * @license MIT
11
- */function G(){return G=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},G.apply(this,arguments)}var ee;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(ee||(ee={}));const vr="popstate";function aa(e){e===void 0&&(e={});function t(n,a){let{pathname:i,search:o,hash:c}=n.location;return st("",{pathname:i,search:o,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:ut(a)}return oa(t,r,null,e)}function U(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function He(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ia(){return Math.random().toString(36).substr(2,8)}function gr(e,t){return{usr:e.state,key:e.key,idx:t}}function st(e,t,r,n){return r===void 0&&(r=null),G({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ie(t):t,{state:r,key:t&&t.key||n||ia()})}function ut(e){let{pathname:t="/",search:r="",hash:n=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ie(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substr(n),e=e.substr(0,n)),e&&(t.pathname=e)}return t}function oa(e,t,r,n){n===void 0&&(n={});let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,c=ee.Pop,l=null,d=p();d==null&&(d=0,o.replaceState(G({},o.state,{idx:d}),""));function p(){return(o.state||{idx:null}).idx}function v(){c=ee.Pop;let D=p(),k=D==null?null:D-d;d=D,l&&l({action:c,location:E.location,delta:k})}function b(D,k){c=ee.Push;let L=st(E.location,D,k);d=p()+1;let K=gr(L,d),te=E.createHref(L);try{o.pushState(K,"",te)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;a.location.assign(te)}i&&l&&l({action:c,location:E.location,delta:1})}function w(D,k){c=ee.Replace;let L=st(E.location,D,k);d=p();let K=gr(L,d),te=E.createHref(L);o.replaceState(K,"",te),i&&l&&l({action:c,location:E.location,delta:0})}function T(D){let k=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof D=="string"?D:ut(D);return L=L.replace(/ $/,"%20"),U(k,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,k)}let E={get action(){return c},get location(){return e(a,o)},listen(D){if(l)throw new Error("A history only accepts one active listener");return a.addEventListener(vr,v),l=D,()=>{a.removeEventListener(vr,v),l=null}},createHref(D){return t(a,D)},createURL:T,encodeLocation(D){let k=T(D);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:b,replace:w,go(D){return o.go(D)}};return E}var B;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(B||(B={}));const sa=new Set(["lazy","caseSensitive","path","id","index","children"]);function la(e){return e.index===!0}function Dt(e,t,r,n){return r===void 0&&(r=[]),n===void 0&&(n={}),e.map((a,i)=>{let o=[...r,String(i)],c=typeof a.id=="string"?a.id:o.join("-");if(U(a.index!==!0||!a.children,"Cannot specify children on an index route"),U(!n[c],'Found a route id collision on id "'+c+`". Route id's must be globally unique within Data Router usages`),la(a)){let l=G({},a,t(a),{id:c});return n[c]=l,l}else{let l=G({},a,t(a),{id:c,children:void 0});return n[c]=l,a.children&&(l.children=Dt(a.children,t,o,n)),l}})}function Ve(e,t,r){return r===void 0&&(r="/"),Tt(e,t,r,!1)}function Tt(e,t,r,n){let a=typeof t=="string"?Ie(t):t,i=dt(a.pathname||"/",r);if(i==null)return null;let o=$r(e);ua(o);let c=null;for(let l=0;c==null&&l<o.length;++l){let d=xa(i);c=ba(o[l],d,n)}return c}function ca(e,t){let{route:r,pathname:n,params:a}=e;return{id:r.id,pathname:n,params:a,data:t[r.id],handle:r.handle}}function $r(e,t,r,n){t===void 0&&(t=[]),r===void 0&&(r=[]),n===void 0&&(n="");let a=(i,o,c)=>{let l={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};l.relativePath.startsWith("/")&&(U(l.relativePath.startsWith(n),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(n.length));let d=Me([n,l.relativePath]),p=r.concat(l);i.children&&i.children.length>0&&(U(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),$r(i.children,t,p,d)),!(i.path==null&&!i.index)&&t.push({path:d,score:ga(d,i.index),routesMeta:p})};return e.forEach((i,o)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))a(i,o);else for(let l of Kr(i.path))a(i,o,l)}),t}function Kr(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=Kr(n.join("/")),c=[];return c.push(...o.map(l=>l===""?i:[i,l].join("/"))),a&&c.push(...o),c.map(l=>e.startsWith("/")&&l===""?"/":l)}function ua(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:ya(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const da=/^:[\w-]+$/,fa=3,ha=2,ma=1,pa=10,va=-2,yr=e=>e==="*";function ga(e,t){let r=e.split("/"),n=r.length;return r.some(yr)&&(n+=va),t&&(n+=ha),r.filter(a=>!yr(a)).reduce((a,i)=>a+(da.test(i)?fa:i===""?ma:pa),n)}function ya(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function ba(e,t,r){r===void 0&&(r=!1);let{routesMeta:n}=e,a={},i="/",o=[];for(let c=0;c<n.length;++c){let l=n[c],d=c===n.length-1,p=i==="/"?t:t.slice(i.length)||"/",v=br({path:l.relativePath,caseSensitive:l.caseSensitive,end:d},p),b=l.route;if(!v&&d&&r&&!n[n.length-1].route.index&&(v=br({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},p)),!v)return null;Object.assign(a,v.params),o.push({params:a,pathname:Me([i,v.pathname]),pathnameBase:Pa(Me([i,v.pathnameBase])),route:b}),v.pathnameBase!=="/"&&(i=Me([i,v.pathnameBase]))}return o}function br(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=wa(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:n.reduce((d,p,v)=>{let{paramName:b,isOptional:w}=p;if(b==="*"){let E=c[v]||"";o=i.slice(0,i.length-E.length).replace(/(.)\/+$/,"$1")}const T=c[v];return w&&!T?d[b]=void 0:d[b]=(T||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:e}}function wa(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),He(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,l)=>(n.push({paramName:c,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function xa(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return He(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function dt(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}const Ea=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sa=e=>Ea.test(e);function Ra(e,t){t===void 0&&(t="/");let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?Ie(e):e,i;if(r)if(Sa(r))i=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),He(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+r))}r.startsWith("/")?i=wr(r.substring(1),"/"):i=wr(r,t)}else i=t;return{pathname:i,search:Ta(n),hash:_a(a)}}function wr(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function kt(e,t,r,n){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function Yr(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Xt(e,t){let r=Yr(e);return t?r.map((n,a)=>a===r.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function qt(e,t,r,n){n===void 0&&(n=!1);let a;typeof e=="string"?a=Ie(e):(a=G({},e),U(!a.pathname||!a.pathname.includes("?"),kt("?","pathname","search",a)),U(!a.pathname||!a.pathname.includes("#"),kt("#","pathname","hash",a)),U(!a.search||!a.search.includes("#"),kt("#","search","hash",a)));let i=e===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=r;else{let v=t.length-1;if(!n&&o.startsWith("..")){let b=o.split("/");for(;b[0]==="..";)b.shift(),v-=1;a.pathname=b.join("/")}c=v>=0?t[v]:"/"}let l=Ra(a,c),d=o&&o!=="/"&&o.endsWith("/"),p=(i||o===".")&&r.endsWith("/");return!l.pathname.endsWith("/")&&(d||p)&&(l.pathname+="/"),l}const Me=e=>e.join("/").replace(/\/\/+/g,"/"),Pa=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ta=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_a=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Lt{constructor(t,r,n,a){a===void 0&&(a=!1),this.status=t,this.statusText=r||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}}function lt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Gr=["post","put","patch","delete"],Ca=new Set(Gr),Da=["get",...Gr],La=new Set(Da),ja=new Set([301,302,303,307,308]),Na=new Set([307,308]),Ft={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ma={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},nt={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Qt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ia=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Jr="remix-router-transitions";function Ua(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",n=!r;U(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let s=e.detectErrorBoundary;a=u=>({hasErrorBoundary:s(u)})}else a=Ia;let i={},o=Dt(e.routes,a,void 0,i),c,l=e.basename||"/",d=e.dataStrategy||Fa,p=e.patchRoutesOnNavigation,v=G({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),b=null,w=new Set,T=null,E=null,D=null,k=e.hydrationData!=null,L=Ve(o,e.history.location,l),K=!1,te=null;if(L==null&&!p){let s=le(404,{pathname:e.history.location.pathname}),{matches:u,route:f}=jr(o);L=u,te={[f.id]:s}}L&&!e.hydrationData&&wt(L,o,e.history.location.pathname).active&&(L=null);let $;if(L)if(L.some(s=>s.route.lazy))$=!1;else if(!L.some(s=>s.route.loader))$=!0;else if(v.v7_partialHydration){let s=e.hydrationData?e.hydrationData.loaderData:null,u=e.hydrationData?e.hydrationData.errors:null;if(u){let f=L.findIndex(y=>u[y.route.id]!==void 0);$=L.slice(0,f+1).every(y=>!Wt(y.route,s,u))}else $=L.every(f=>!Wt(f.route,s,u))}else $=e.hydrationData!=null;else if($=!1,L=[],v.v7_partialHydration){let s=wt(null,o,e.history.location.pathname);s.active&&s.matches&&(K=!0,L=s.matches)}let he,g={historyAction:e.history.action,location:e.history.location,matches:L,initialized:$,navigation:Ft,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||te,fetchers:new Map,blockers:new Map},N=ee.Pop,F=!1,I,re=!1,J=new Map,oe=null,ae=!1,se=!1,We=[],$e=new Set,Q=new Map,Te=0,_e=-1,we=new Map,ce=new Set,Ce=new Map,Ue=new Map,ue=new Set,xe=new Map,pe=new Map,Oe;function vt(){if(b=e.history.listen(s=>{let{action:u,location:f,delta:y}=s;if(Oe){Oe(),Oe=void 0;return}He(pe.size===0||y!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let x=fr({currentLocation:g.location,nextLocation:f,historyAction:u});if(x&&y!=null){let C=new Promise(j=>{Oe=j});e.history.go(y*-1),bt(x,{state:"blocked",location:f,proceed(){bt(x,{state:"proceeding",proceed:void 0,reset:void 0,location:f}),C.then(()=>e.history.go(y))},reset(){let j=new Map(g.blockers);j.set(x,nt),H({blockers:j})}});return}return Ae(u,f)}),r){Za(t,J);let s=()=>ei(t,J);t.addEventListener("pagehide",s),oe=()=>t.removeEventListener("pagehide",s)}return g.initialized||Ae(ee.Pop,g.location,{initialHydration:!0}),he}function V(){b&&b(),oe&&oe(),w.clear(),I&&I.abort(),g.fetchers.forEach((s,u)=>yt(u)),g.blockers.forEach((s,u)=>dr(u))}function de(s){return w.add(s),()=>w.delete(s)}function H(s,u){u===void 0&&(u={}),g=G({},g,s);let f=[],y=[];v.v7_fetcherPersist&&g.fetchers.forEach((x,C)=>{x.state==="idle"&&(ue.has(C)?y.push(C):f.push(C))}),ue.forEach(x=>{!g.fetchers.has(x)&&!Q.has(x)&&y.push(x)}),[...w].forEach(x=>x(g,{deletedFetchers:y,viewTransitionOpts:u.viewTransitionOpts,flushSync:u.flushSync===!0})),v.v7_fetcherPersist?(f.forEach(x=>g.fetchers.delete(x)),y.forEach(x=>yt(x))):y.forEach(x=>ue.delete(x))}function ve(s,u,f){var y,x;let{flushSync:C}=f===void 0?{}:f,j=g.actionData!=null&&g.navigation.formMethod!=null&&me(g.navigation.formMethod)&&g.navigation.state==="loading"&&((y=s.state)==null?void 0:y._isRedirect)!==!0,R;u.actionData?Object.keys(u.actionData).length>0?R=u.actionData:R=null:j?R=g.actionData:R=null;let P=u.loaderData?Dr(g.loaderData,u.loaderData,u.matches||[],u.errors):g.loaderData,S=g.blockers;S.size>0&&(S=new Map(S),S.forEach((O,ie)=>S.set(ie,nt)));let _=F===!0||g.navigation.formMethod!=null&&me(g.navigation.formMethod)&&((x=s.state)==null?void 0:x._isRedirect)!==!0;c&&(o=c,c=void 0),ae||N===ee.Pop||(N===ee.Push?e.history.push(s,s.state):N===ee.Replace&&e.history.replace(s,s.state));let M;if(N===ee.Pop){let O=J.get(g.location.pathname);O&&O.has(s.pathname)?M={currentLocation:g.location,nextLocation:s}:J.has(s.pathname)&&(M={currentLocation:s,nextLocation:g.location})}else if(re){let O=J.get(g.location.pathname);O?O.add(s.pathname):(O=new Set([s.pathname]),J.set(g.location.pathname,O)),M={currentLocation:g.location,nextLocation:s}}H(G({},u,{actionData:R,loaderData:P,historyAction:N,location:s,initialized:!0,navigation:Ft,revalidation:"idle",restoreScrollPosition:mr(s,u.matches||g.matches),preventScrollReset:_,blockers:S}),{viewTransitionOpts:M,flushSync:C===!0}),N=ee.Pop,F=!1,re=!1,ae=!1,se=!1,We=[]}async function gt(s,u){if(typeof s=="number"){e.history.go(s);return}let f=Ht(g.location,g.matches,l,v.v7_prependBasename,s,v.v7_relativeSplatPath,u==null?void 0:u.fromRouteId,u==null?void 0:u.relative),{path:y,submission:x,error:C}=xr(v.v7_normalizeFormMethod,!1,f,u),j=g.location,R=st(g.location,y,u&&u.state);R=G({},R,e.history.encodeLocation(R));let P=u&&u.replace!=null?u.replace:void 0,S=ee.Push;P===!0?S=ee.Replace:P===!1||x!=null&&me(x.formMethod)&&x.formAction===g.location.pathname+g.location.search&&(S=ee.Replace);let _=u&&"preventScrollReset"in u?u.preventScrollReset===!0:void 0,M=(u&&u.flushSync)===!0,O=fr({currentLocation:j,nextLocation:R,historyAction:S});if(O){bt(O,{state:"blocked",location:R,proceed(){bt(O,{state:"proceeding",proceed:void 0,reset:void 0,location:R}),gt(s,u)},reset(){let ie=new Map(g.blockers);ie.set(O,nt),H({blockers:ie})}});return}return await Ae(S,R,{submission:x,pendingError:C,preventScrollReset:_,replace:u&&u.replace,enableViewTransition:u&&u.viewTransition,flushSync:M})}function wn(){if(It(),H({revalidation:"loading"}),g.navigation.state!=="submitting"){if(g.navigation.state==="idle"){Ae(g.historyAction,g.location,{startUninterruptedRevalidation:!0});return}Ae(N||g.historyAction,g.navigation.location,{overrideNavigation:g.navigation,enableViewTransition:re===!0})}}async function Ae(s,u,f){I&&I.abort(),I=null,N=s,ae=(f&&f.startUninterruptedRevalidation)===!0,Ln(g.location,g.matches),F=(f&&f.preventScrollReset)===!0,re=(f&&f.enableViewTransition)===!0;let y=c||o,x=f&&f.overrideNavigation,C=f!=null&&f.initialHydration&&g.matches&&g.matches.length>0&&!K?g.matches:Ve(y,u,l),j=(f&&f.flushSync)===!0;if(C&&g.initialized&&!se&&$a(g.location,u)&&!(f&&f.submission&&me(f.submission.formMethod))){ve(u,{matches:C},{flushSync:j});return}let R=wt(C,y,u.pathname);if(R.active&&R.matches&&(C=R.matches),!C){let{error:W,notFoundMatches:z,route:X}=Ut(u.pathname);ve(u,{matches:z,loaderData:{},errors:{[X.id]:W}},{flushSync:j});return}I=new AbortController;let P=Je(e.history,u,I.signal,f&&f.submission),S;if(f&&f.pendingError)S=[ze(C).route.id,{type:B.error,error:f.pendingError}];else if(f&&f.submission&&me(f.submission.formMethod)){let W=await xn(P,u,f.submission,C,R.active,{replace:f.replace,flushSync:j});if(W.shortCircuited)return;if(W.pendingActionResult){let[z,X]=W.pendingActionResult;if(fe(X)&&lt(X.error)&&X.error.status===404){I=null,ve(u,{matches:W.matches,loaderData:{},errors:{[z]:X.error}});return}}C=W.matches||C,S=W.pendingActionResult,x=Vt(u,f.submission),j=!1,R.active=!1,P=Je(e.history,P.url,P.signal)}let{shortCircuited:_,matches:M,loaderData:O,errors:ie}=await En(P,u,C,R.active,x,f&&f.submission,f&&f.fetcherSubmission,f&&f.replace,f&&f.initialHydration===!0,j,S);_||(I=null,ve(u,G({matches:M||C},Lr(S),{loaderData:O,errors:ie})))}async function xn(s,u,f,y,x,C){C===void 0&&(C={}),It();let j=qa(u,f);if(H({navigation:j},{flushSync:C.flushSync===!0}),x){let S=await xt(y,u.pathname,s.signal);if(S.type==="aborted")return{shortCircuited:!0};if(S.type==="error"){let _=ze(S.partialMatches).route.id;return{matches:S.partialMatches,pendingActionResult:[_,{type:B.error,error:S.error}]}}else if(S.matches)y=S.matches;else{let{notFoundMatches:_,error:M,route:O}=Ut(u.pathname);return{matches:_,pendingActionResult:[O.id,{type:B.error,error:M}]}}}let R,P=ot(y,u);if(!P.route.action&&!P.route.lazy)R={type:B.error,error:le(405,{method:s.method,pathname:u.pathname,routeId:P.route.id})};else if(R=(await Ze("action",g,s,[P],y,null))[P.route.id],s.signal.aborted)return{shortCircuited:!0};if(Be(R)){let S;return C&&C.replace!=null?S=C.replace:S=Tr(R.response.headers.get("Location"),new URL(s.url),l,e.history)===g.location.pathname+g.location.search,await ke(s,R,!0,{submission:f,replace:S}),{shortCircuited:!0}}if(Ne(R))throw le(400,{type:"defer-action"});if(fe(R)){let S=ze(y,P.route.id);return(C&&C.replace)!==!0&&(N=ee.Push),{matches:y,pendingActionResult:[S.route.id,R]}}return{matches:y,pendingActionResult:[P.route.id,R]}}async function En(s,u,f,y,x,C,j,R,P,S,_){let M=x||Vt(u,C),O=C||j||Mr(M),ie=!ae&&(!v.v7_partialHydration||!P);if(y){if(ie){let q=ir(_);H(G({navigation:M},q!==void 0?{actionData:q}:{}),{flushSync:S})}let A=await xt(f,u.pathname,s.signal);if(A.type==="aborted")return{shortCircuited:!0};if(A.type==="error"){let q=ze(A.partialMatches).route.id;return{matches:A.partialMatches,loaderData:{},errors:{[q]:A.error}}}else if(A.matches)f=A.matches;else{let{error:q,notFoundMatches:Ye,route:rt}=Ut(u.pathname);return{matches:Ye,loaderData:{},errors:{[rt.id]:q}}}}let W=c||o,[z,X]=Sr(e.history,g,f,O,u,v.v7_partialHydration&&P===!0,v.v7_skipActionErrorRevalidation,se,We,$e,ue,Ce,ce,W,l,_);if(Ot(A=>!(f&&f.some(q=>q.route.id===A))||z&&z.some(q=>q.route.id===A)),_e=++Te,z.length===0&&X.length===0){let A=cr();return ve(u,G({matches:f,loaderData:{},errors:_&&fe(_[1])?{[_[0]]:_[1].error}:null},Lr(_),A?{fetchers:new Map(g.fetchers)}:{}),{flushSync:S}),{shortCircuited:!0}}if(ie){let A={};if(!y){A.navigation=M;let q=ir(_);q!==void 0&&(A.actionData=q)}X.length>0&&(A.fetchers=Sn(X)),H(A,{flushSync:S})}X.forEach(A=>{Le(A.key),A.controller&&Q.set(A.key,A.controller)});let Ke=()=>X.forEach(A=>Le(A.key));I&&I.signal.addEventListener("abort",Ke);let{loaderResults:et,fetcherResults:Se}=await or(g,f,z,X,s);if(s.signal.aborted)return{shortCircuited:!0};I&&I.signal.removeEventListener("abort",Ke),X.forEach(A=>Q.delete(A.key));let ge=Pt(et);if(ge)return await ke(s,ge.result,!0,{replace:R}),{shortCircuited:!0};if(ge=Pt(Se),ge)return ce.add(ge.key),await ke(s,ge.result,!0,{replace:R}),{shortCircuited:!0};let{loaderData:At,errors:tt}=Cr(g,f,et,_,X,Se,xe);xe.forEach((A,q)=>{A.subscribe(Ye=>{(Ye||A.done)&&xe.delete(q)})}),v.v7_partialHydration&&P&&g.errors&&(tt=G({},g.errors,tt));let Fe=cr(),Et=ur(_e),St=Fe||Et||X.length>0;return G({matches:f,loaderData:At,errors:tt},St?{fetchers:new Map(g.fetchers)}:{})}function ir(s){if(s&&!fe(s[1]))return{[s[0]]:s[1].data};if(g.actionData)return Object.keys(g.actionData).length===0?null:g.actionData}function Sn(s){return s.forEach(u=>{let f=g.fetchers.get(u.key),y=at(void 0,f?f.data:void 0);g.fetchers.set(u.key,y)}),new Map(g.fetchers)}function Rn(s,u,f,y){if(n)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Le(s);let x=(y&&y.flushSync)===!0,C=c||o,j=Ht(g.location,g.matches,l,v.v7_prependBasename,f,v.v7_relativeSplatPath,u,y==null?void 0:y.relative),R=Ve(C,j,l),P=wt(R,C,j);if(P.active&&P.matches&&(R=P.matches),!R){Ee(s,u,le(404,{pathname:j}),{flushSync:x});return}let{path:S,submission:_,error:M}=xr(v.v7_normalizeFormMethod,!0,j,y);if(M){Ee(s,u,M,{flushSync:x});return}let O=ot(R,S),ie=(y&&y.preventScrollReset)===!0;if(_&&me(_.formMethod)){Pn(s,u,S,O,R,P.active,x,ie,_);return}Ce.set(s,{routeId:u,path:S}),Tn(s,u,S,O,R,P.active,x,ie,_)}async function Pn(s,u,f,y,x,C,j,R,P){It(),Ce.delete(s);function S(Z){if(!Z.route.action&&!Z.route.lazy){let Ge=le(405,{method:P.formMethod,pathname:f,routeId:u});return Ee(s,u,Ge,{flushSync:j}),!0}return!1}if(!C&&S(y))return;let _=g.fetchers.get(s);De(s,Qa(P,_),{flushSync:j});let M=new AbortController,O=Je(e.history,f,M.signal,P);if(C){let Z=await xt(x,new URL(O.url).pathname,O.signal,s);if(Z.type==="aborted")return;if(Z.type==="error"){Ee(s,u,Z.error,{flushSync:j});return}else if(Z.matches){if(x=Z.matches,y=ot(x,f),S(y))return}else{Ee(s,u,le(404,{pathname:f}),{flushSync:j});return}}Q.set(s,M);let ie=Te,z=(await Ze("action",g,O,[y],x,s))[y.route.id];if(O.signal.aborted){Q.get(s)===M&&Q.delete(s);return}if(v.v7_fetcherPersist&&ue.has(s)){if(Be(z)||fe(z)){De(s,je(void 0));return}}else{if(Be(z))if(Q.delete(s),_e>ie){De(s,je(void 0));return}else return ce.add(s),De(s,at(P)),ke(O,z,!1,{fetcherSubmission:P,preventScrollReset:R});if(fe(z)){Ee(s,u,z.error);return}}if(Ne(z))throw le(400,{type:"defer-action"});let X=g.navigation.location||g.location,Ke=Je(e.history,X,M.signal),et=c||o,Se=g.navigation.state!=="idle"?Ve(et,g.navigation.location,l):g.matches;U(Se,"Didn't find any matches after fetcher action");let ge=++Te;we.set(s,ge);let At=at(P,z.data);g.fetchers.set(s,At);let[tt,Fe]=Sr(e.history,g,Se,P,X,!1,v.v7_skipActionErrorRevalidation,se,We,$e,ue,Ce,ce,et,l,[y.route.id,z]);Fe.filter(Z=>Z.key!==s).forEach(Z=>{let Ge=Z.key,pr=g.fetchers.get(Ge),Mn=at(void 0,pr?pr.data:void 0);g.fetchers.set(Ge,Mn),Le(Ge),Z.controller&&Q.set(Ge,Z.controller)}),H({fetchers:new Map(g.fetchers)});let Et=()=>Fe.forEach(Z=>Le(Z.key));M.signal.addEventListener("abort",Et);let{loaderResults:St,fetcherResults:A}=await or(g,Se,tt,Fe,Ke);if(M.signal.aborted)return;M.signal.removeEventListener("abort",Et),we.delete(s),Q.delete(s),Fe.forEach(Z=>Q.delete(Z.key));let q=Pt(St);if(q)return ke(Ke,q.result,!1,{preventScrollReset:R});if(q=Pt(A),q)return ce.add(q.key),ke(Ke,q.result,!1,{preventScrollReset:R});let{loaderData:Ye,errors:rt}=Cr(g,Se,St,void 0,Fe,A,xe);if(g.fetchers.has(s)){let Z=je(z.data);g.fetchers.set(s,Z)}ur(ge),g.navigation.state==="loading"&&ge>_e?(U(N,"Expected pending action"),I&&I.abort(),ve(g.navigation.location,{matches:Se,loaderData:Ye,errors:rt,fetchers:new Map(g.fetchers)})):(H({errors:rt,loaderData:Dr(g.loaderData,Ye,Se,rt),fetchers:new Map(g.fetchers)}),se=!1)}async function Tn(s,u,f,y,x,C,j,R,P){let S=g.fetchers.get(s);De(s,at(P,S?S.data:void 0),{flushSync:j});let _=new AbortController,M=Je(e.history,f,_.signal);if(C){let z=await xt(x,new URL(M.url).pathname,M.signal,s);if(z.type==="aborted")return;if(z.type==="error"){Ee(s,u,z.error,{flushSync:j});return}else if(z.matches)x=z.matches,y=ot(x,f);else{Ee(s,u,le(404,{pathname:f}),{flushSync:j});return}}Q.set(s,_);let O=Te,W=(await Ze("loader",g,M,[y],x,s))[y.route.id];if(Ne(W)&&(W=await Zt(W,M.signal,!0)||W),Q.get(s)===_&&Q.delete(s),!M.signal.aborted){if(ue.has(s)){De(s,je(void 0));return}if(Be(W))if(_e>O){De(s,je(void 0));return}else{ce.add(s),await ke(M,W,!1,{preventScrollReset:R});return}if(fe(W)){Ee(s,u,W.error);return}U(!Ne(W),"Unhandled fetcher deferred data"),De(s,je(W.data))}}async function ke(s,u,f,y){let{submission:x,fetcherSubmission:C,preventScrollReset:j,replace:R}=y===void 0?{}:y;u.response.headers.has("X-Remix-Revalidate")&&(se=!0);let P=u.response.headers.get("Location");U(P,"Expected a Location header on the redirect Response"),P=Tr(P,new URL(s.url),l,e.history);let S=st(g.location,P,{_isRedirect:!0});if(r){let z=!1;if(u.response.headers.has("X-Remix-Reload-Document"))z=!0;else if(Qt.test(P)){const X=e.history.createURL(P);z=X.origin!==t.location.origin||dt(X.pathname,l)==null}if(z){R?t.location.replace(P):t.location.assign(P);return}}I=null;let _=R===!0||u.response.headers.has("X-Remix-Replace")?ee.Replace:ee.Push,{formMethod:M,formAction:O,formEncType:ie}=g.navigation;!x&&!C&&M&&O&&ie&&(x=Mr(g.navigation));let W=x||C;if(Na.has(u.response.status)&&W&&me(W.formMethod))await Ae(_,S,{submission:G({},W,{formAction:P}),preventScrollReset:j||F,enableViewTransition:f?re:void 0});else{let z=Vt(S,x);await Ae(_,S,{overrideNavigation:z,fetcherSubmission:C,preventScrollReset:j||F,enableViewTransition:f?re:void 0})}}async function Ze(s,u,f,y,x,C){let j,R={};try{j=await Va(d,s,u,f,y,x,C,i,a)}catch(P){return y.forEach(S=>{R[S.route.id]={type:B.error,error:P}}),R}for(let[P,S]of Object.entries(j))if(Ka(S)){let _=S.result;R[P]={type:B.redirect,response:Ha(_,f,P,x,l,v.v7_relativeSplatPath)}}else R[P]=await Ba(S);return R}async function or(s,u,f,y,x){let C=s.matches,j=Ze("loader",s,x,f,u,null),R=Promise.all(y.map(async _=>{if(_.matches&&_.match&&_.controller){let O=(await Ze("loader",s,Je(e.history,_.path,_.controller.signal),[_.match],_.matches,_.key))[_.match.route.id];return{[_.key]:O}}else return Promise.resolve({[_.key]:{type:B.error,error:le(404,{pathname:_.path})}})})),P=await j,S=(await R).reduce((_,M)=>Object.assign(_,M),{});return await Promise.all([Ja(u,P,x.signal,C,s.loaderData),Xa(u,S,y)]),{loaderResults:P,fetcherResults:S}}function It(){se=!0,We.push(...Ot()),Ce.forEach((s,u)=>{Q.has(u)&&$e.add(u),Le(u)})}function De(s,u,f){f===void 0&&(f={}),g.fetchers.set(s,u),H({fetchers:new Map(g.fetchers)},{flushSync:(f&&f.flushSync)===!0})}function Ee(s,u,f,y){y===void 0&&(y={});let x=ze(g.matches,u);yt(s),H({errors:{[x.route.id]:f},fetchers:new Map(g.fetchers)},{flushSync:(y&&y.flushSync)===!0})}function sr(s){return Ue.set(s,(Ue.get(s)||0)+1),ue.has(s)&&ue.delete(s),g.fetchers.get(s)||Ma}function yt(s){let u=g.fetchers.get(s);Q.has(s)&&!(u&&u.state==="loading"&&we.has(s))&&Le(s),Ce.delete(s),we.delete(s),ce.delete(s),v.v7_fetcherPersist&&ue.delete(s),$e.delete(s),g.fetchers.delete(s)}function _n(s){let u=(Ue.get(s)||0)-1;u<=0?(Ue.delete(s),ue.add(s),v.v7_fetcherPersist||yt(s)):Ue.set(s,u),H({fetchers:new Map(g.fetchers)})}function Le(s){let u=Q.get(s);u&&(u.abort(),Q.delete(s))}function lr(s){for(let u of s){let f=sr(u),y=je(f.data);g.fetchers.set(u,y)}}function cr(){let s=[],u=!1;for(let f of ce){let y=g.fetchers.get(f);U(y,"Expected fetcher: "+f),y.state==="loading"&&(ce.delete(f),s.push(f),u=!0)}return lr(s),u}function ur(s){let u=[];for(let[f,y]of we)if(y<s){let x=g.fetchers.get(f);U(x,"Expected fetcher: "+f),x.state==="loading"&&(Le(f),we.delete(f),u.push(f))}return lr(u),u.length>0}function Cn(s,u){let f=g.blockers.get(s)||nt;return pe.get(s)!==u&&pe.set(s,u),f}function dr(s){g.blockers.delete(s),pe.delete(s)}function bt(s,u){let f=g.blockers.get(s)||nt;U(f.state==="unblocked"&&u.state==="blocked"||f.state==="blocked"&&u.state==="blocked"||f.state==="blocked"&&u.state==="proceeding"||f.state==="blocked"&&u.state==="unblocked"||f.state==="proceeding"&&u.state==="unblocked","Invalid blocker state transition: "+f.state+" -> "+u.state);let y=new Map(g.blockers);y.set(s,u),H({blockers:y})}function fr(s){let{currentLocation:u,nextLocation:f,historyAction:y}=s;if(pe.size===0)return;pe.size>1&&He(!1,"A router only supports one blocker at a time");let x=Array.from(pe.entries()),[C,j]=x[x.length-1],R=g.blockers.get(C);if(!(R&&R.state==="proceeding")&&j({currentLocation:u,nextLocation:f,historyAction:y}))return C}function Ut(s){let u=le(404,{pathname:s}),f=c||o,{matches:y,route:x}=jr(f);return Ot(),{notFoundMatches:y,route:x,error:u}}function Ot(s){let u=[];return xe.forEach((f,y)=>{(!s||s(y))&&(f.cancel(),u.push(y),xe.delete(y))}),u}function Dn(s,u,f){if(T=s,D=u,E=f||null,!k&&g.navigation===Ft){k=!0;let y=mr(g.location,g.matches);y!=null&&H({restoreScrollPosition:y})}return()=>{T=null,D=null,E=null}}function hr(s,u){return E&&E(s,u.map(y=>ca(y,g.loaderData)))||s.key}function Ln(s,u){if(T&&D){let f=hr(s,u);T[f]=D()}}function mr(s,u){if(T){let f=hr(s,u),y=T[f];if(typeof y=="number")return y}return null}function wt(s,u,f){if(p)if(s){if(Object.keys(s[0].params).length>0)return{active:!0,matches:Tt(u,f,l,!0)}}else return{active:!0,matches:Tt(u,f,l,!0)||[]};return{active:!1,matches:null}}async function xt(s,u,f,y){if(!p)return{type:"success",matches:s};let x=s;for(;;){let C=c==null,j=c||o,R=i;try{await p({signal:f,path:u,matches:x,fetcherKey:y,patch:(_,M)=>{f.aborted||Pr(_,M,j,R,a)}})}catch(_){return{type:"error",error:_,partialMatches:x}}finally{C&&!f.aborted&&(o=[...o])}if(f.aborted)return{type:"aborted"};let P=Ve(j,u,l);if(P)return{type:"success",matches:P};let S=Tt(j,u,l,!0);if(!S||x.length===S.length&&x.every((_,M)=>_.route.id===S[M].route.id))return{type:"success",matches:null};x=S}}function jn(s){i={},c=Dt(s,a,void 0,i)}function Nn(s,u){let f=c==null;Pr(s,u,c||o,i,a),f&&(o=[...o],H({}))}return he={get basename(){return l},get future(){return v},get state(){return g},get routes(){return o},get window(){return t},initialize:vt,subscribe:de,enableScrollRestoration:Dn,navigate:gt,fetch:Rn,revalidate:wn,createHref:s=>e.history.createHref(s),encodeLocation:s=>e.history.encodeLocation(s),getFetcher:sr,deleteFetcher:_n,dispose:V,getBlocker:Cn,deleteBlocker:dr,patchRoutes:Nn,_internalFetchControllers:Q,_internalActiveDeferreds:xe,_internalSetRoutes:jn},he}function Oa(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Ht(e,t,r,n,a,i,o,c){let l,d;if(o){l=[];for(let v of t)if(l.push(v),v.route.id===o){d=v;break}}else l=t,d=t[t.length-1];let p=qt(a||".",Xt(l,i),dt(e.pathname,r)||e.pathname,c==="path");if(a==null&&(p.search=e.search,p.hash=e.hash),(a==null||a===""||a===".")&&d){let v=er(p.search);if(d.route.index&&!v)p.search=p.search?p.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&v){let b=new URLSearchParams(p.search),w=b.getAll("index");b.delete("index"),w.filter(E=>E).forEach(E=>b.append("index",E));let T=b.toString();p.search=T?"?"+T:""}}return n&&r!=="/"&&(p.pathname=p.pathname==="/"?r:Me([r,p.pathname])),ut(p)}function xr(e,t,r,n){if(!n||!Oa(n))return{path:r};if(n.formMethod&&!Ga(n.formMethod))return{path:r,error:le(405,{method:n.formMethod})};let a=()=>({path:r,error:le(400,{type:"invalid-body"})}),i=n.formMethod||"get",o=e?i.toUpperCase():i.toLowerCase(),c=Qr(r);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!me(o))return a();let b=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((w,T)=>{let[E,D]=T;return""+w+E+"="+D+`
12
- `},""):String(n.body);return{path:r,submission:{formMethod:o,formAction:c,formEncType:n.formEncType,formData:void 0,json:void 0,text:b}}}else if(n.formEncType==="application/json"){if(!me(o))return a();try{let b=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:r,submission:{formMethod:o,formAction:c,formEncType:n.formEncType,formData:void 0,json:b,text:void 0}}}catch{return a()}}}U(typeof FormData=="function","FormData is not available in this environment");let l,d;if(n.formData)l=$t(n.formData),d=n.formData;else if(n.body instanceof FormData)l=$t(n.body),d=n.body;else if(n.body instanceof URLSearchParams)l=n.body,d=_r(l);else if(n.body==null)l=new URLSearchParams,d=new FormData;else try{l=new URLSearchParams(n.body),d=_r(l)}catch{return a()}let p={formMethod:o,formAction:c,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:d,json:void 0,text:void 0};if(me(p.formMethod))return{path:r,submission:p};let v=Ie(r);return t&&v.search&&er(v.search)&&l.append("index",""),v.search="?"+l,{path:ut(v),submission:p}}function Er(e,t,r){r===void 0&&(r=!1);let n=e.findIndex(a=>a.route.id===t);return n>=0?e.slice(0,r?n+1:n):e}function Sr(e,t,r,n,a,i,o,c,l,d,p,v,b,w,T,E){let D=E?fe(E[1])?E[1].error:E[1].data:void 0,k=e.createURL(t.location),L=e.createURL(a),K=r;i&&t.errors?K=Er(r,Object.keys(t.errors)[0],!0):E&&fe(E[1])&&(K=Er(r,E[0]));let te=E?E[1].statusCode:void 0,$=o&&te&&te>=400,he=K.filter((N,F)=>{let{route:I}=N;if(I.lazy)return!0;if(I.loader==null)return!1;if(i)return Wt(I,t.loaderData,t.errors);if(Aa(t.loaderData,t.matches[F],N)||l.some(oe=>oe===N.route.id))return!0;let re=t.matches[F],J=N;return Rr(N,G({currentUrl:k,currentParams:re.params,nextUrl:L,nextParams:J.params},n,{actionResult:D,actionStatus:te,defaultShouldRevalidate:$?!1:c||k.pathname+k.search===L.pathname+L.search||k.search!==L.search||Xr(re,J)}))}),g=[];return v.forEach((N,F)=>{if(i||!r.some(ae=>ae.route.id===N.routeId)||p.has(F))return;let I=Ve(w,N.path,T);if(!I){g.push({key:F,routeId:N.routeId,path:N.path,matches:null,match:null,controller:null});return}let re=t.fetchers.get(F),J=ot(I,N.path),oe=!1;b.has(F)?oe=!1:d.has(F)?(d.delete(F),oe=!0):re&&re.state!=="idle"&&re.data===void 0?oe=c:oe=Rr(J,G({currentUrl:k,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:r[r.length-1].params},n,{actionResult:D,actionStatus:te,defaultShouldRevalidate:$?!1:c})),oe&&g.push({key:F,routeId:N.routeId,path:N.path,matches:I,match:J,controller:new AbortController})}),[he,g]}function Wt(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let n=t!=null&&t[e.id]!==void 0,a=r!=null&&r[e.id]!==void 0;return!n&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!n&&!a}function Aa(e,t,r){let n=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return n||a}function Xr(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Rr(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Pr(e,t,r,n,a){var i;let o;if(e){let d=n[e];U(d,"No route found to patch children into: routeId = "+e),d.children||(d.children=[]),o=d.children}else o=r;let c=t.filter(d=>!o.some(p=>qr(d,p))),l=Dt(c,a,[e||"_","patch",String(((i=o)==null?void 0:i.length)||"0")],n);o.push(...l)}function qr(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,n)=>{var a;return(a=t.children)==null?void 0:a.some(i=>qr(r,i))}):!1}async function ka(e,t,r){if(!e.lazy)return;let n=await e.lazy();if(!e.lazy)return;let a=r[e.id];U(a,"No route found in manifest");let i={};for(let o in n){let l=a[o]!==void 0&&o!=="hasErrorBoundary";He(!l,'Route "'+a.id+'" has a static property "'+o+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+o+'" will be ignored.')),!l&&!sa.has(o)&&(i[o]=n[o])}Object.assign(a,i),Object.assign(a,G({},t(a),{lazy:void 0}))}async function Fa(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,i,o)=>Object.assign(a,{[r[o].route.id]:i}),{})}async function Va(e,t,r,n,a,i,o,c,l,d){let p=i.map(w=>w.route.lazy?ka(w.route,l,c):void 0),v=i.map((w,T)=>{let E=p[T],D=a.some(L=>L.route.id===w.route.id);return G({},w,{shouldLoad:D,resolve:async L=>(L&&n.method==="GET"&&(w.route.lazy||w.route.loader)&&(D=!0),D?za(t,n,w,E,L,d):Promise.resolve({type:B.data,result:void 0}))})}),b=await e({matches:v,request:n,params:i[0].params,fetcherKey:o,context:d});try{await Promise.all(p)}catch{}return b}async function za(e,t,r,n,a,i){let o,c,l=d=>{let p,v=new Promise((T,E)=>p=E);c=()=>p(),t.signal.addEventListener("abort",c);let b=T=>typeof d!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):d({request:t,params:r.params,context:i},...T!==void 0?[T]:[]),w=(async()=>{try{return{type:"data",result:await(a?a(E=>b(E)):b())}}catch(T){return{type:"error",result:T}}})();return Promise.race([w,v])};try{let d=r.route[e];if(n)if(d){let p,[v]=await Promise.all([l(d).catch(b=>{p=b}),n]);if(p!==void 0)throw p;o=v}else if(await n,d=r.route[e],d)o=await l(d);else if(e==="action"){let p=new URL(t.url),v=p.pathname+p.search;throw le(405,{method:t.method,pathname:v,routeId:r.route.id})}else return{type:B.data,result:void 0};else if(d)o=await l(d);else{let p=new URL(t.url),v=p.pathname+p.search;throw le(404,{pathname:v})}U(o.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(d){return{type:B.error,result:d}}finally{c&&t.signal.removeEventListener("abort",c)}return o}async function Ba(e){let{result:t,type:r}=e;if(Zr(t)){let v;try{let b=t.headers.get("Content-Type");b&&/\bapplication\/json\b/.test(b)?t.body==null?v=null:v=await t.json():v=await t.text()}catch(b){return{type:B.error,error:b}}return r===B.error?{type:B.error,error:new Lt(t.status,t.statusText,v),statusCode:t.status,headers:t.headers}:{type:B.data,data:v,statusCode:t.status,headers:t.headers}}if(r===B.error){if(Nr(t)){var n,a;if(t.data instanceof Error){var i,o;return{type:B.error,error:t.data,statusCode:(i=t.init)==null?void 0:i.status,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:B.error,error:new Lt(((n=t.init)==null?void 0:n.status)||500,void 0,t.data),statusCode:lt(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:B.error,error:t,statusCode:lt(t)?t.status:void 0}}if(Ya(t)){var c,l;return{type:B.deferred,deferredData:t,statusCode:(c=t.init)==null?void 0:c.status,headers:((l=t.init)==null?void 0:l.headers)&&new Headers(t.init.headers)}}if(Nr(t)){var d,p;return{type:B.data,data:t.data,statusCode:(d=t.init)==null?void 0:d.status,headers:(p=t.init)!=null&&p.headers?new Headers(t.init.headers):void 0}}return{type:B.data,data:t}}function Ha(e,t,r,n,a,i){let o=e.headers.get("Location");if(U(o,"Redirects returned/thrown from loaders/actions must have a Location header"),!Qt.test(o)){let c=n.slice(0,n.findIndex(l=>l.route.id===r)+1);o=Ht(new URL(t.url),c,a,!0,o,i),e.headers.set("Location",o)}return e}function Tr(e,t,r,n){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Qt.test(e)){let i=e,o=i.startsWith("//")?new URL(t.protocol+i):new URL(i);if(a.includes(o.protocol))throw new Error("Invalid redirect location");let c=dt(o.pathname,r)!=null;if(o.origin===t.origin&&c)return o.pathname+o.search+o.hash}try{let i=n.createURL(e);if(a.includes(i.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Je(e,t,r,n){let a=e.createURL(Qr(t)).toString(),i={signal:r};if(n&&me(n.formMethod)){let{formMethod:o,formEncType:c}=n;i.method=o.toUpperCase(),c==="application/json"?(i.headers=new Headers({"Content-Type":c}),i.body=JSON.stringify(n.json)):c==="text/plain"?i.body=n.text:c==="application/x-www-form-urlencoded"&&n.formData?i.body=$t(n.formData):i.body=n.formData}return new Request(a,i)}function $t(e){let t=new URLSearchParams;for(let[r,n]of e.entries())t.append(r,typeof n=="string"?n:n.name);return t}function _r(e){let t=new FormData;for(let[r,n]of e.entries())t.append(r,n);return t}function Wa(e,t,r,n,a){let i={},o=null,c,l=!1,d={},p=r&&fe(r[1])?r[1].error:void 0;return e.forEach(v=>{if(!(v.route.id in t))return;let b=v.route.id,w=t[b];if(U(!Be(w),"Cannot handle redirect results in processLoaderData"),fe(w)){let T=w.error;p!==void 0&&(T=p,p=void 0),o=o||{};{let E=ze(e,b);o[E.route.id]==null&&(o[E.route.id]=T)}i[b]=void 0,l||(l=!0,c=lt(w.error)?w.error.status:500),w.headers&&(d[b]=w.headers)}else Ne(w)?(n.set(b,w.deferredData),i[b]=w.deferredData.data,w.statusCode!=null&&w.statusCode!==200&&!l&&(c=w.statusCode),w.headers&&(d[b]=w.headers)):(i[b]=w.data,w.statusCode&&w.statusCode!==200&&!l&&(c=w.statusCode),w.headers&&(d[b]=w.headers))}),p!==void 0&&r&&(o={[r[0]]:p},i[r[0]]=void 0),{loaderData:i,errors:o,statusCode:c||200,loaderHeaders:d}}function Cr(e,t,r,n,a,i,o){let{loaderData:c,errors:l}=Wa(t,r,n,o);return a.forEach(d=>{let{key:p,match:v,controller:b}=d,w=i[p];if(U(w,"Did not find corresponding fetcher result"),!(b&&b.signal.aborted))if(fe(w)){let T=ze(e.matches,v==null?void 0:v.route.id);l&&l[T.route.id]||(l=G({},l,{[T.route.id]:w.error})),e.fetchers.delete(p)}else if(Be(w))U(!1,"Unhandled fetcher revalidation redirect");else if(Ne(w))U(!1,"Unhandled fetcher deferred data");else{let T=je(w.data);e.fetchers.set(p,T)}}),{loaderData:c,errors:l}}function Dr(e,t,r,n){let a=G({},t);for(let i of r){let o=i.route.id;if(t.hasOwnProperty(o)?t[o]!==void 0&&(a[o]=t[o]):e[o]!==void 0&&i.route.loader&&(a[o]=e[o]),n&&n.hasOwnProperty(o))break}return a}function Lr(e){return e?fe(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ze(e,t){return(t?e.slice(0,e.findIndex(n=>n.route.id===t)+1):[...e]).reverse().find(n=>n.route.hasErrorBoundary===!0)||e[0]}function jr(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function le(e,t){let{pathname:r,routeId:n,method:a,type:i,message:o}=t===void 0?{}:t,c="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(c="Bad Request",a&&r&&n?l="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+n+'", ')+"so there is no way to handle the request.":i==="defer-action"?l="defer() is not supported in actions":i==="invalid-body"&&(l="Unable to encode submission body")):e===403?(c="Forbidden",l='Route "'+n+'" does not match URL "'+r+'"'):e===404?(c="Not Found",l='No route matches URL "'+r+'"'):e===405&&(c="Method Not Allowed",a&&r&&n?l="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+n+'", ')+"so there is no way to handle the request.":a&&(l='Invalid request method "'+a.toUpperCase()+'"')),new Lt(e||500,c,new Error(l),!0)}function Pt(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[n,a]=t[r];if(Be(a))return{key:n,result:a}}}function Qr(e){let t=typeof e=="string"?Ie(e):e;return ut(G({},t,{hash:""}))}function $a(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function Ka(e){return Zr(e.result)&&ja.has(e.result.status)}function Ne(e){return e.type===B.deferred}function fe(e){return e.type===B.error}function Be(e){return(e&&e.type)===B.redirect}function Nr(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function Ya(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function Zr(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Ga(e){return La.has(e.toLowerCase())}function me(e){return Ca.has(e.toLowerCase())}async function Ja(e,t,r,n,a){let i=Object.entries(t);for(let o=0;o<i.length;o++){let[c,l]=i[o],d=e.find(b=>(b==null?void 0:b.route.id)===c);if(!d)continue;let p=n.find(b=>b.route.id===d.route.id),v=p!=null&&!Xr(p,d)&&(a&&a[d.route.id])!==void 0;Ne(l)&&v&&await Zt(l,r,!1).then(b=>{b&&(t[c]=b)})}}async function Xa(e,t,r){for(let n=0;n<r.length;n++){let{key:a,routeId:i,controller:o}=r[n],c=t[a];e.find(d=>(d==null?void 0:d.route.id)===i)&&Ne(c)&&(U(o,"Expected an AbortController for revalidating fetcher deferred result"),await Zt(c,o.signal,!0).then(d=>{d&&(t[a]=d)}))}}async function Zt(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:B.data,data:e.deferredData.unwrappedData}}catch(a){return{type:B.error,error:a}}return{type:B.data,data:e.deferredData.data}}}function er(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function ot(e,t){let r=typeof t=="string"?Ie(t).search:t.search;if(e[e.length-1].route.index&&er(r||""))return e[e.length-1];let n=Yr(e);return n[n.length-1]}function Mr(e){let{formMethod:t,formAction:r,formEncType:n,text:a,formData:i,json:o}=e;if(!(!t||!r||!n)){if(a!=null)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:void 0,text:a};if(i!=null)return{formMethod:t,formAction:r,formEncType:n,formData:i,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:r,formEncType:n,formData:void 0,json:o,text:void 0}}}function Vt(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function qa(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function at(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Qa(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function je(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Za(e,t){try{let r=e.sessionStorage.getItem(Jr);if(r){let n=JSON.parse(r);for(let[a,i]of Object.entries(n||{}))i&&Array.isArray(i)&&t.set(a,new Set(i||[]))}}catch{}}function ei(e,t){if(t.size>0){let r={};for(let[n,a]of t)r[n]=[...a];try{e.sessionStorage.setItem(Jr,JSON.stringify(r))}catch(n){He(!1,"Failed to save applied view transitions in sessionStorage ("+n+").")}}}/**
13
- * React Router v6.30.3
14
- *
15
- * Copyright (c) Remix Software Inc.
16
- *
17
- * This source code is licensed under the MIT license found in the
18
- * LICENSE.md file in the root directory of this source tree.
19
- *
20
- * @license MIT
21
- */function jt(){return jt=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},jt.apply(this,arguments)}const Mt=h.createContext(null),en=h.createContext(null),ft=h.createContext(null),tr=h.createContext(null),Pe=h.createContext({outlet:null,matches:[],isDataRoute:!1}),tn=h.createContext(null);function ht(){return h.useContext(tr)!=null}function mt(){return ht()||U(!1),h.useContext(tr).location}function rn(e){h.useContext(ft).static||h.useLayoutEffect(e)}function rr(){let{isDataRoute:e}=h.useContext(Pe);return e?mi():ti()}function ti(){ht()||U(!1);let e=h.useContext(Mt),{basename:t,future:r,navigator:n}=h.useContext(ft),{matches:a}=h.useContext(Pe),{pathname:i}=mt(),o=JSON.stringify(Xt(a,r.v7_relativeSplatPath)),c=h.useRef(!1);return rn(()=>{c.current=!0}),h.useCallback(function(d,p){if(p===void 0&&(p={}),!c.current)return;if(typeof d=="number"){n.go(d);return}let v=qt(d,JSON.parse(o),i,p.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:Me([t,v.pathname])),(p.replace?n.replace:n.push)(v,p.state,p)},[t,n,o,i,e])}const ri=h.createContext(null);function ni(e){let t=h.useContext(Pe).outlet;return t&&h.createElement(ri.Provider,{value:e},t)}function Ko(){let{matches:e}=h.useContext(Pe),t=e[e.length-1];return t?t.params:{}}function ai(e,t,r,n){ht()||U(!1);let{navigator:a}=h.useContext(ft),{matches:i}=h.useContext(Pe),o=i[i.length-1],c=o?o.params:{};o&&o.pathname;let l=o?o.pathnameBase:"/";o&&o.route;let d=mt(),p;p=d;let v=p.pathname||"/",b=v;if(l!=="/"){let E=l.replace(/^\//,"").split("/");b="/"+v.replace(/^\//,"").split("/").slice(E.length).join("/")}let w=Ve(e,{pathname:b});return ci(w&&w.map(E=>Object.assign({},E,{params:Object.assign({},c,E.params),pathname:Me([l,a.encodeLocation?a.encodeLocation(E.pathname).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?l:Me([l,a.encodeLocation?a.encodeLocation(E.pathnameBase).pathname:E.pathnameBase])})),i,r,n)}function ii(){let e=hi(),t=lt(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:a},r):null,null)}const oi=h.createElement(ii,null);class si extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?h.createElement(Pe.Provider,{value:this.props.routeContext},h.createElement(tn.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function li(e){let{routeContext:t,match:r,children:n}=e,a=h.useContext(Mt);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),h.createElement(Pe.Provider,{value:t},n)}function ci(e,t,r,n){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),n===void 0&&(n=null),e==null){var i;if(!r)return null;if(r.errors)e=r.matches;else if((i=n)!=null&&i.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,c=(a=r)==null?void 0:a.errors;if(c!=null){let p=o.findIndex(v=>v.route.id&&(c==null?void 0:c[v.route.id])!==void 0);p>=0||U(!1),o=o.slice(0,Math.min(o.length,p+1))}let l=!1,d=-1;if(r&&n&&n.v7_partialHydration)for(let p=0;p<o.length;p++){let v=o[p];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(d=p),v.route.id){let{loaderData:b,errors:w}=r,T=v.route.loader&&b[v.route.id]===void 0&&(!w||w[v.route.id]===void 0);if(v.route.lazy||T){l=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((p,v,b)=>{let w,T=!1,E=null,D=null;r&&(w=c&&v.route.id?c[v.route.id]:void 0,E=v.route.errorElement||oi,l&&(d<0&&b===0?(pi("route-fallback"),T=!0,D=null):d===b&&(T=!0,D=v.route.hydrateFallbackElement||null)));let k=t.concat(o.slice(0,b+1)),L=()=>{let K;return w?K=E:T?K=D:v.route.Component?K=h.createElement(v.route.Component,null):v.route.element?K=v.route.element:K=p,h.createElement(li,{match:v,routeContext:{outlet:p,matches:k,isDataRoute:r!=null},children:K})};return r&&(v.route.ErrorBoundary||v.route.errorElement||b===0)?h.createElement(si,{location:r.location,revalidation:r.revalidation,component:E,error:w,children:L(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):L()},null)}var nn=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(nn||{}),an=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(an||{});function ui(e){let t=h.useContext(Mt);return t||U(!1),t}function di(e){let t=h.useContext(en);return t||U(!1),t}function fi(e){let t=h.useContext(Pe);return t||U(!1),t}function on(e){let t=fi(),r=t.matches[t.matches.length-1];return r.route.id||U(!1),r.route.id}function hi(){var e;let t=h.useContext(tn),r=di(an.UseRouteError),n=on();return t!==void 0?t:(e=r.errors)==null?void 0:e[n]}function mi(){let{router:e}=ui(nn.UseNavigateStable),t=on(),r=h.useRef(!1);return rn(()=>{r.current=!0}),h.useCallback(function(a,i){i===void 0&&(i={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,jt({fromRouteId:t},i)))},[e,t])}const Ir={};function pi(e,t,r){Ir[e]||(Ir[e]=!0)}function vi(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function sn(e){let{to:t,replace:r,state:n,relative:a}=e;ht()||U(!1);let{future:i,static:o}=h.useContext(ft),{matches:c}=h.useContext(Pe),{pathname:l}=mt(),d=rr(),p=qt(t,Xt(c,i.v7_relativeSplatPath),l,a==="path"),v=JSON.stringify(p);return h.useEffect(()=>d(JSON.parse(v),{replace:r,state:n,relative:a}),[d,v,a,r,n]),null}function gi(e){return ni(e.context)}function yi(e){let{basename:t="/",children:r=null,location:n,navigationType:a=ee.Pop,navigator:i,static:o=!1,future:c}=e;ht()&&U(!1);let l=t.replace(/^\/*/,"/"),d=h.useMemo(()=>({basename:l,navigator:i,static:o,future:jt({v7_relativeSplatPath:!1},c)}),[l,c,i,o]);typeof n=="string"&&(n=Ie(n));let{pathname:p="/",search:v="",hash:b="",state:w=null,key:T="default"}=n,E=h.useMemo(()=>{let D=dt(p,l);return D==null?null:{location:{pathname:D,search:v,hash:b,state:w,key:T},navigationType:a}},[l,p,v,b,w,T,a]);return E==null?null:h.createElement(ft.Provider,{value:d},h.createElement(tr.Provider,{children:r,value:E}))}new Promise(()=>{});function bi(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:h.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:h.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:h.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
22
- * React Router DOM v6.30.3
23
- *
24
- * Copyright (c) Remix Software Inc.
25
- *
26
- * This source code is licensed under the MIT license found in the
27
- * LICENSE.md file in the root directory of this source tree.
28
- *
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};
@@ -1,2 +0,0 @@
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};
@@ -1 +0,0 @@
1
- import{b as c,j as i,t as r,A as In}from"./index-CuzMc7q2.js";import{f as ei,e as Ri,g as _i}from"./App-tPcbyRdS.js";import{ar as Ti,u as Fi,h as Ai,v as Li}from"./model-switch-api-c6kcbBGm.js";import{bl as Bi,bm as ti,b as nn,w as ft,bn as Wi,u as $i,a7 as Re,bo as Oi,bp as gt,bq as Ke,br as Hi,bs as zi,bt as Ui,bu as Vi}from"./WorkbenchLayout-CbpJg0g1.js";import{W as $n}from"./WorkbenchModal-Bt_1fYmM.js";import{r as Rt,a as _t,F as Ki}from"./file-tree-icon-BeHqeru9.js";import"./window-BVUB8gMK.js";import"./event-DvH9tcej.js";import"./relay-entry-C751A-Sm.js";const Gi=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),Xi=["._"];function ut(t){return t.split(/[/\\]/).filter(Boolean).pop()??t}function qi(t){const n=t.trim().toLowerCase();return n?Gi.has(n)||Xi.some(l=>n.startsWith(l)):!1}function Tt(t,n,l){return l?[...t]:t.filter(o=>!qi(n(o)))}function Nt(t,n){return Tt(t,l=>l.name,n)}function Yi(t,n){return n?t:Object.entries(t).reduce((l,[o,m])=>(l[o]=Nt(m,!1),l),{})}async function Et(t,n){const[l,o]=await Promise.all([Bi(n),Ti(t)]);return Zi(l.changes,o.items)}function Zi(t,n){const l=new Set(n.map(o=>kt(o.path)));return t.filter(o=>l.has(kt(o.path))||o.oldPath!==null&&l.has(kt(o.oldPath)))}function Ji(t){const n=On("","");for(const l of t){const o=kt(l.path),m=o.split("/").filter(Boolean);let h=n;m.forEach((b,x)=>{const j=m.slice(0,x+1).join("/");if(x===m.length-1){h.children.set(`file:${j}`,{kind:"file",name:b,path:o,change:l});return}const T=`directory:${j}`,M=h.children.get(T);if(M&&M.kind==="directory"){h=M;return}const Q=On(b,j);h.children.set(T,Q),h=Q})}return ai(ii([...n.children.values()]))}function ni(t,n){const l=t.oldPath?`${t.oldPath} -> ${t.path}`:t.path;return ln(t)?`${l} ${n}`:l}function ln(t){return t.status==="D"||t.stagedStatus==="D"||t.worktreeStatus==="D"}function Dt(t){return t.split("/").filter(Boolean).pop()??t}function kt(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function On(t,n){return{kind:"directory",name:t,path:n,children:new Map}}function ii(t){return[...t].sort((n,l)=>n.kind!==l.kind?n.kind==="directory"?-1:1:n.name.localeCompare(l.name,"zh-CN")).map(n=>n.kind==="directory"?{kind:"directory",name:n.name,path:n.path,children:ii([...n.children.values()])}:n)}function ai(t){return t.map(n=>{var b;if(n.kind!=="directory")return n;const l=ai(n.children);let o=n.name,m=n.path,h=l;for(;h.length===1&&((b=h[0])==null?void 0:b.kind)==="directory";){const x=h[0];o=`${o}/${x.name}`,m=x.path,h=x.children}return{kind:"directory",name:o,path:m,children:h}})}const Qi=450,Ii=60*1e3,Hn=20,zn=16;function ea({sessionId:t,workspaceId:n,showSystemFiles:l,selectedPath:o,refreshVersion:m,onCountChange:h,onSelectFile:b,onOpenFile:x}){const[j,T]=c.useState("tree"),[M,Q]=c.useState([]),[me,K]=c.useState(!0),[pe,be]=c.useState(!1),[G,ht]=c.useState([]),D=c.useRef(null),At=ti(),{showToast:je}=ei();c.useEffect(()=>{const p=nn(Pt(n,t),Ii);T("tree"),Q(p??[]),K(p===null),be(!1),ht([]),D.current=null},[t,n]),c.useEffect(()=>{let p=!1;async function S(){K(!0);try{const v=await Et(t,n);p||(Q(v),ft(Pt(n,t),v))}catch(v){p||je({title:It(v,r("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{p||K(!1)}}return S(),()=>{p=!0}},[m,t,je,n]);async function Se(){K(!0);try{const p=await Et(t,n);Q(p),ft(Pt(n,t),p)}catch(p){je({title:It(p,r("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{K(!1)}}async function E(){if(R.length!==0){be(!0);try{await Wi(n,R.map(S=>S.path));const p=await Et(t,n);Q(p),ft(Pt(n,t),p),je({title:r("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(p){je({title:It(p,r("git.stageFailed")),tone:"error"})}finally{be(!1)}}}function F(p){ht(S=>S.includes(p)?S.filter(v=>v!==p):[...S,p])}function X(p){const S=Date.now(),v=D.current;return D.current={filePath:p,timestamp:S},(v==null?void 0:v.filePath)===p&&S-v.timestamp<=Qi}async function $(p,S){if(S&&X(p)){await x(p),D.current=null;return}S||(D.current=null),await b(p)}const ie=c.useMemo(()=>Tt(M,p=>Dt(p.path),l),[M,l]),R=ie.filter(p=>!p.staged),_e=Ji(ie),ae=new Set(G);return c.useEffect(()=>{h==null||h(ie.length)},[h,ie.length]),i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"file-panel-session-toolbar",children:[i.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":r("conversation.filePanelSessionViewLabel"),children:[i.jsx("button",{className:j==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":j==="tree",onClick:()=>T("tree"),children:r("conversation.filePanelSessionTreeView")}),i.jsx("button",{className:j==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":j==="list",onClick:()=>T("list"),children:r("conversation.filePanelSessionListView")})]}),i.jsxs("div",{className:"file-panel-session-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Se(),disabled:me||pe,children:r("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void E(),disabled:pe||R.length===0,children:r("conversation.filePanelSessionStageAll")})]})]}),i.jsxs("div",{className:"file-panel-session-summary",children:[i.jsx("span",{children:`${r("conversation.filePanelSessionSummary")} ${ie.length}`}),i.jsx("span",{children:`${r("conversation.filePanelSessionUnstagedSummary")} ${R.length}`})]}),i.jsx("div",{ref:At,className:"file-tree","data-scrollbar-autohide":"true",children:me?i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelSessionLoading")}):ie.length===0?i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelSessionEmpty")}):j==="tree"?li({nodes:_e,depth:0,collapsedPathSet:ae,selectedPath:o,onToggleTreePath:F,onFileClick:$}):ta({items:ie,selectedPath:o,onFileClick:$})})]})}function li({nodes:t,depth:n,collapsedPathSet:l,selectedPath:o,onToggleTreePath:m,onFileClick:h}){return t.map(b=>{if(b.kind==="directory"){const x=!l.has(b.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":x,style:{paddingInlineStart:`${Hn+n*zn}px`},onClick:()=>m(b.path),children:[i.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:x?"v":">"}),i.jsx("span",{className:"file-tree-label",children:b.name})]}),x?i.jsx("div",{className:"file-tree-children",children:li({nodes:b.children,depth:n+1,collapsedPathSet:l,selectedPath:o,onToggleTreePath:m,onFileClick:h})}):null]},`session-directory:${b.path}`)}return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":o===b.change.path,"data-kind":"file",style:{paddingInlineStart:`${Hn+n*zn}px`},onClick:()=>void h(b.change.path,!ln(b.change)),children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(b.name),"aria-hidden":"true",children:Rt(b.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:b.name}),i.jsx("span",{className:"file-tree-path",children:ni(b.change,r("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":b.change.status,children:b.change.status}),i.jsx("span",{className:"file-session-badge subtle",children:b.change.staged?r("git.stagedLabel"):r("git.workingTreeLabel")})]})]})},`session-file:${b.path}`)})}function ta({items:t,selectedPath:n,onFileClick:l}){return t.map(o=>i.jsx("div",{className:"file-session-list-item",children:i.jsxs("button",{className:"file-session-list-button",type:"button","data-active":n===o.path,onClick:()=>void l(o.path,!ln(o)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(Dt(o.path)),"aria-hidden":"true",children:Rt(Dt(o.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:Dt(o.path)}),i.jsx("span",{className:"file-tree-path",children:ni(o,r("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":o.status,children:o.status}),i.jsx("span",{className:"file-session-badge subtle",children:o.staged?r("git.stagedLabel"):r("git.workingTreeLabel")})]})]})},`session-list:${o.path}`))}function Pt(t,n){return`file-panel.session-changes.${t}.${n}`}function It(t,n){return t instanceof In?t.message:typeof t=="object"&&t&&"message"in t?String(t.message??n):n}const g="",na=450,ne=8,Ct=4,ia=176,aa=120,la=300*1e3,sa=60*1e3,Un=1600,ra=220,oa=20,ca=16;function el({className:t,sessionId:n,workspaceId:l,hideHeading:o=!1,hideTabs:m=!1,externalRevealRequest:h=null,externalWindowMode:b=!1,workbenchShellOverrides:x}){var Ln,Bn;const j=$i(),{navigationGroups:T,subscribeFileTree:M,requestFileTreeRefresh:Q,addFileTreeSnapshotListener:me,subscribeGitSnapshot:K,requestGitRefresh:pe,addGitSnapshotListener:be}={...j,...x},[G,ht]=c.useState({}),[D,At]=c.useState([]),[je,Se]=c.useState([]),[E,F]=c.useState(g),[X,$]=c.useState([]),[ie,R]=c.useState(null),[_e,ae]=c.useState(!1),[p,S]=c.useState(!1),[v,mt]=c.useState(!1),[Xe,qe]=c.useState(!1),[A,Ye]=c.useState(""),[Lt,q]=c.useState(null),[pt,bt]=c.useState(!1),[we,Ze]=c.useState(null),[O,Je]=c.useState("workspace"),[rn,Ne]=c.useState(0),[on,Bt]=c.useState(0),[Qe,I]=c.useState(!1),[Ie,L]=c.useState(!1),[le,H]=c.useState(null),[ve,Te]=c.useState(null),[B,Fe]=c.useState(null),[P,Wt]=c.useState(null),[w,et]=c.useState(null),[$t,Ae]=c.useState(""),[cn,un]=c.useState([]),[ee,Ot]=c.useState(!1),[hi,ye]=c.useState(null),fn=c.useId(),se=c.useRef({}),Y=c.useRef({}),_=c.useRef([]),te=c.useRef(g),tt=c.useRef(!1),nt=c.useRef(null),mi=ti(),dn=c.useRef(null),hn=c.useRef(null),Ht=c.useRef(null),mn=c.useRef(null),pn=c.useRef(null),xe=c.useRef(0),re=c.useRef(new Map),{showToast:C}=ei(),it=Ri(),z=Fi(e=>e.showSystemFiles),Le=!!(n!=null&&n.trim()),bn=o&&it.isMobile;c.useEffect(()=>{Re("file_panel.props",{sessionId:n,workspaceId:l,externalWindowMode:b})},[b,n,l]),c.useEffect(()=>{te.current=E},[E]);function zt(e){Bt(e),!(!l||!n)&&ft(Yn(l,n),e)}async function vn(){if(!l||!n){zt(0);return}const e=await Et(n,l),a=Tt(e,s=>ut(s.path),z).length;zt(a)}function Ee(e){ht(a=>{const s=typeof e=="function"?e(a):e;return se.current=s,s})}function Be(e){At(a=>{const s=typeof e=="function"?e(a):e;return _.current=s,s})}c.useEffect(()=>{var f,d;if(Gt(),!l){Gt(),tt.current=!1,se.current={},Y.current={},_.current=[],te.current=g,Ee({}),Be([]),Se([]),F(g),qe(!1),Ye(""),q(null),bt(!1),ae(!1),Ot(!1),ye(null),$([]),R(null),H(null),Te(null),Fe(null),et(null),Ae("");return}tt.current=!0;const e=nn(qn(l),la);Re("file_panel.workspace_snapshot",{workspaceId:l,cached:!!e,cachedRootItems:((d=(f=e==null?void 0:e.treeCache)==null?void 0:f[g])==null?void 0:d.length)??0,cachedDirectoryCount:Object.keys((e==null?void 0:e.treeCache)??{}).length});const a=Ea((e==null?void 0:e.activeDirectoryPath)??g,(e==null?void 0:e.treeCache)??{}),s=Xn((e==null?void 0:e.expandedDirectories)??[],a),u=wt((e==null?void 0:e.treeCache)??{},a,s);se.current=u,Y.current=Zn((e==null?void 0:e.treeRevisionByPath)??{},u),_.current=s,te.current=a,Ee(u),Be(s),Se([]),F(a),ae(!1),S(!1),qe(!1),Ye(""),q(null),bt(!1),queueMicrotask(()=>{tt.current=!1})},[l]),c.useEffect(()=>{if(!h||h.workspaceId!==l)return;const e=()=>{if(pn.current===h.requestId)return;pn.current=h.requestId,Je("workspace"),(h.openViewer?ze(h.filePath):ce(h.filePath)).catch(s=>{C({title:J(s,r("conversation.filePanelOpenFailed")),tone:"error"})})};if(tt.current){queueMicrotask(e);return}e()},[h,ze,ce,C,l]),c.useEffect(()=>{if(l)return me(e=>{e.workspaceId===l&&(Y.current={...Y.current,[e.path]:typeof e.revision=="string"?e.revision:null},Ee(a=>({...a,[e.path]:e.items})),e.path===g&&ae(!1),Se(a=>a.filter(s=>s!==e.path)),Sn(e.path,e.items))})},[me,l]),c.useEffect(()=>()=>{Gt()},[]),c.useEffect(()=>{l&&M(l,tn(_.current,te.current),{knownRevisionByPath:Y.current})},[E,D,M,l]),c.useEffect(()=>{$([]),R(null),Ze(null),ye(null),Ne(0),I(!1),L(!1),H(null),Te(null),Fe(null),et(null),Ae(""),nt.current=null,xe.current+=1},[n]),c.useEffect(()=>{!Le&&O==="session"&&Je("workspace")},[O,Le]),c.useEffect(()=>{m&&O!=="workspace"&&Je("workspace")},[O,m]),c.useEffect(()=>{if(!Qe&&!Ie&&!le)return;function e(s){var y,N,fe;if(!(s.target instanceof Node))return;const u=((y=dn.current)==null?void 0:y.contains(s.target))??!1,f=((N=hn.current)==null?void 0:N.contains(s.target))??!1,d=((fe=Ht.current)==null?void 0:fe.contains(s.target))??!1;!u&&!f&&!d&&(I(!1),L(!1),H(null),Te(null))}function a(s){s.key==="Escape"&&(I(!1),L(!1),H(null),Te(null))}return document.addEventListener("pointerdown",e),document.addEventListener("keydown",a),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",a)}},[Qe,Ie,le]),c.useLayoutEffect(()=>{if(!le||typeof window>"u"){Te(null);return}const e=le;function a(){const u=Ht.current;if(!u)return;const f=u.getBoundingClientRect();Te(va({x:e.positionX,y:e.positionY},{width:f.width||ia,height:f.height||u.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}a();const s=window.requestAnimationFrame(a);return window.addEventListener("resize",a),window.addEventListener("scroll",a,!0),()=>{window.cancelAnimationFrame(s),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[le]),c.useEffect(()=>{if(!l)return;const e=Xn(D,E),a=wt(G,E,e);ft(qn(l),{treeCache:a,treeRevisionByPath:Zn(Y.current,a),expandedDirectories:e,activeDirectoryPath:E})},[E,D,G,l]),c.useEffect(()=>{if(tt.current)return;const e=wt(G,E,D);ka(G,e)||Ee(e)},[E,D,G]),c.useEffect(()=>{let e=!1;const a=(l==null?void 0:l.trim())??null;async function s(f){if(!a)return;const d=Nt(se.current[g]??[],z),y=(f==null?void 0:f.silent)!==!0&&d.length===0;y&&ae(!0),Re("file_panel.load_root_tree.start",{sessionId:n,workspaceId:a,silent:(f==null?void 0:f.silent)===!0,cachedRootItems:d.length});try{const N=await Kt(g,{force:!0});e||(Re("file_panel.load_root_tree.end",{sessionId:n,workspaceId:a,itemCount:N.length}),Ee(fe=>({...wt(fe,te.current,_.current),[g]:N})))}catch(N){!e&&!Jn(N)&&C({title:J(N,r("conversation.filePanelLoadFailed")),tone:"error"})}finally{!e&&y&&ae(!1)}}if(Nt(se.current[g]??[],z).length>0){const f=window.setTimeout(()=>{a&&(M(a,tn(_.current,te.current),{knownRevisionByPath:Y.current}),s({silent:!0}))},1500);return()=>{e=!0,window.clearTimeout(f)}}return s(),()=>{e=!0}},[n,z,C,l]),c.useEffect(()=>{if(!l||!n){Bt(0);return}const e=nn(Yn(l,n),sa);Re("file_panel.session_change_count.snapshot",{sessionId:n,workspaceId:l,cached:e!==null,cachedCount:e}),Bt(e??0);let a=!1;return vn().catch(()=>{}),()=>{a=!0}},[n,rn,z,l]),c.useEffect(()=>{if(!l){un([]);return}const e=l.trim();K(e),pe(e)},[l,K,pe]),c.useEffect(()=>{if(!l)return;const e=l.trim();return be(a=>{var s;a.workspaceId===e&&un(((s=a.status)==null?void 0:s.changes)??[])})},[be,l]);const vt=c.useMemo(()=>Tt(cn,e=>ut(e.path),z),[cn,z]),W=c.useMemo(()=>{const e=new Map,a=new Set;for(const s of vt){const u=s.path.replace(/\\/g,"/"),f=s.worktreeStatus??s.stagedStatus??s.status;e.set(u,f);const d=u.split("/");for(let y=1;y<d.length;y++)a.add(d.slice(0,y).join("/"))}return{statusByPath:e,changedDirs:a}},[vt]),De=c.useMemo(()=>Yi(G,z),[z,G]),ke=c.useMemo(()=>Lt===null?null:Nt(Lt,z),[Lt,z]),We=De[g]??[],oe=Xe&&ke!==null,yt=c.useMemo(()=>ee?an(We,De,W.statusByPath,W.changedDirs):We,[W.changedDirs,W.statusByPath,We,ee,De]),pi=c.useMemo(()=>oe?(ke??[]).map(e=>V(e.path,e.kind)):si(yt,De,D,ee,W.statusByPath,W.changedDirs),[D,W.changedDirs,W.statusByPath,oe,ee,ke,De,yt]),$e=((Ln=T.find(e=>e.workspace.id===l))==null?void 0:Ln.workspace)??null,k=Gn(X),Ut=(k==null?void 0:k.path)??null,ge=(k==null?void 0:k.kind)==="file"?k.path:null,xt=c.useMemo(()=>new Set(X.map(e=>e.path)),[X]),at=c.useMemo(()=>St(X),[X]),Vt=!!($e!=null&&$e.path&&X.length===1&&Ut),yn=X.length===1&&(k==null?void 0:k.kind)==="file",xn=at.length>0,Me=at.length>0,lt=!!(P!=null&&P.items.length&&l),gn=!!l&&X.length===1&&k!==null,Pn=!!((ge?he(ge):E)&&D.length),Cn=P?P.mode==="copy"?r("conversation.filePanelClipboardCopyReady",{count:P.items.length}):r("conversation.filePanelClipboardCutReady",{count:P.items.length}):null,U=w?Pa(w):null;async function jn(e,a=!1){if(!l)return[];if(!a){const s=se.current[e];if(s)return s}e===g?ae(!0):Se(s=>Mt(s,e));try{const s=await Kt(e,{force:a});return Ee(u=>({...u,[e]:s})),s}catch(s){throw Jn(s)||C({title:J(s,r("conversation.filePanelLoadFailed")),tone:"error"}),s}finally{e===g?ae(!1):Se(s=>s.filter(u=>u!==e))}}async function Pe(e){if(!l)return;const a=(e==null?void 0:e.activeDirectoryPath)??te.current,s=(e==null?void 0:e.expandedDirectories)??_.current,u=Da(se.current,a,s);Re("file_panel.refresh_tree_cache.start",{sessionId:n,workspaceId:l,targetDirectories:u});const d=(await Promise.all(u.map(async y=>{const N=await Kt(y,{force:!0});return[y,N]}))).reduce((y,[N,fe])=>(y[N]=fe,y),{});Re("file_panel.refresh_tree_cache.end",{sessionId:n,workspaceId:l,targetDirectories:u,directoryCount:Object.keys(d).length}),Ee(d)}async function Kt(e,a){if(!l)return[];if(!(a!=null&&a.force)){const d=se.current[e];if(d)return d}const s=tn(Mt(_.current,e),e||te.current);M(l,s,{knownRevisionByPath:Y.current}),Q(l,[e],{knownRevisionByPath:Y.current});const u=bi(e,Un,{allowCached:(a==null?void 0:a.force)!==!0}),f=Ma(ra).then(async()=>{if(!l)return[];const y=(await Ui(l,e||void 0)).items;return Y.current={...Y.current,[e]:null},Sn(e,y),y});try{return await Promise.race([u,f])}catch(d){if(!fi(d))throw d;return await f}}function bi(e,a=Un,s){const u=se.current[e];return(s==null?void 0:s.allowCached)!==!1&&u?Promise.resolve(u):new Promise((f,d)=>{const y=window.setTimeout(()=>{vi(e,y),d(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${e}`))},a),N=re.current.get(e)??[];re.current.set(e,[...N,{resolve:f,reject:d,timerId:y}])})}function Sn(e,a){const s=re.current.get(e)??[];s.length!==0&&(re.current.delete(e),s.forEach(u=>{window.clearTimeout(u.timerId),u.resolve(a)}))}function vi(e,a){const u=(re.current.get(e)??[]).filter(f=>f.timerId!==a);if(u.length===0){re.current.delete(e);return}re.current.set(e,u)}function Gt(){for(const[e,a]of re.current.entries())a.forEach(s=>{window.clearTimeout(s.timerId),s.reject(new Error(`FILE_TREE_ABORTED:${e}`))});re.current.clear()}function Oe(e){$([e]),R(e.path)}function st(e){F(e.kind==="directory"?e.path:he(e.path))}function yi(e){const a=da(pi,ie,e);$(a),R(e.path),st(e)}function xi(e){const a=fa(X,e),s=Gn(a);$(a),R(e.path),s&&st(s)}function wn(e){Oe(e),st(e)}function He(e,a){if(a!=null&&a.shiftKey){yi(e);return}if(jt(a)){xi(e);return}wn(e)}async function rt(e,a=!1){const s=dt(e,a);if(!s.length){F(g);return}Be(u=>ui(u,s)),F(s[s.length-1]??g);for(const u of s)try{await jn(u)}catch{return}}async function ce(e){const a=V(e,"file");Oe(a),st(a),await rt(e)}async function ze(e){Ze(e),ye(null),nt.current=null,xe.current+=1,ce(e);const a=xe.current,s=e.replace(/\\/g,"/"),u=W.statusByPath.get(s);if(l&&u&&u!=="?"&&u!=="D")try{const f=await Oi(l,e,!1);xe.current===a&&ye(f.content||null)}catch{xe.current===a&&ye(null)}}function Nn(e){const a=Date.now(),s=nt.current;return nt.current={filePath:e,timestamp:a},(s==null?void 0:s.filePath)===e&&a-s.timestamp<=na}function Ce(){nt.current=null}async function gi(e,a){const s=V(e,"file");if(a!=null&&a.shiftKey||jt(a)){Ce(),He(s,a);return}if(Nn(e)){await ze(e);return}He(s,a),await rt(e)}function En(){qe(!1),Ye(""),q(null),Ce()}async function Pi(e,a){const s=V(e.path,e.kind);if(a!=null&&a.shiftKey||jt(a)){Ce(),He(s,a);return}if(e.kind==="directory"){En(),He(s,a),await Dn(e.path);return}if(Nn(e.path)){En(),await ze(e.path);return}await ce(e.path)}async function Dn(e){if(Oe(V(e,"directory")),F(e),!_.current.includes(e))try{await jn(e),Be(a=>Mt(a,e))}catch{}}async function kn(e){if(Oe(V(e,"directory")),F(e),_.current.includes(e)){Mn(e);return}await Dn(e)}function Mn(e){Be(a=>a.filter(s=>s!==e&&!s.startsWith(`${e}/`))),F(he(e)),$([]),R(null)}async function Rn(){if(!l)return;const e=l;try{if(pe(e),await Pe(),ge&&await rt(ge),oe&&A.trim()){const a=await Ke(e,A.trim());q(a.items)}if(Le&&n)if(O==="session")Ne(a=>a+1);else try{await vn()}catch(a){C({title:J(a,r("conversation.filePanelSessionLoadFailed")),tone:"error"})}}catch(a){C({title:J(a,r("conversation.filePanelLoadFailed")),tone:"error"})}}async function Ci(e){if(e==null||e.preventDefault(),!l||!A.trim()){q(null);return}bt(!0);try{const a=await Ke(l,A.trim());q(a.items)}catch(a){C({title:J(a,r("conversation.filePanelSearchFailed")),tone:"error"})}finally{bt(!1)}}function _n(){if(Xe){qe(!1),Ye(""),q(null);return}qe(!0)}function Z(e){L(!1),e()}function Tn(){var e;(e=mn.current)==null||e.click()}async function ji(e){var d;const a=((d=e.target.files)==null?void 0:d[0])??null;if(e.target.value="",!a||!l)return;const s=ua(a.name);if(!s){C({title:r("conversation.filePanelUploadFailed"),tone:"error"});return}const u=Vn(E,k),f=Kn(u,s);mt(!0);try{const y=await Ca(a);await Hi({workspaceId:l,path:f,contentBase64:y}),await Pe(),await ce(f),C({title:r("conversation.filePanelUploadSuccess",{name:s}),tone:"success"})}catch(y){C({title:J(y,r("conversation.filePanelUploadFailed")),tone:"error"})}finally{mt(!1)}}async function Xt(e=ge){if(!(!l||!e)){mt(!0);try{const a=await zi(l,e),s=ja(a.contentBase64);Sa(a.fileName,new Blob([s],{type:"application/octet-stream"})),C({title:r("conversation.filePanelDownloadSuccess",{name:a.fileName}),tone:"success"})}catch(a){C({title:J(a,r("conversation.filePanelDownloadFailed")),tone:"error"})}finally{mt(!1)}}}function Fn(){const e=ge?he(ge):E;!e||!_.current.includes(e)||Mn(e)}function qt(){et(null),Ae("")}function Yt(){p||qt()}function Ue(e,a=Vn(E,k)){if(!l)return;const s=a,u=s?`${s}/`:"";I(!1),L(!1),H(null),et({mode:e,baseDirectory:s}),Ae(u)}function Zt(e=k){!l||!e||(I(!1),L(!1),H(null),et({mode:"rename",target:e}),Ae(e.path))}async function Si(e){if(e==null||e.preventDefault(),!l||!w)return;const a=($t??"").trim();if(a){if(w.mode==="rename"&&Ge(w.target.path)===Ge(a)){Yt();return}S(!0);try{if(w.mode==="rename"){const s=w.target.path,u=V(a,w.target.kind),f=we?ci(we,s,a):null;if(await gt({workspaceId:l,opType:"rename",srcPath:s,dstPath:a}),P&&Wt({...P,items:ga(P.items,s,a)}),qt(),Ce(),await Pe(),w.target.kind==="directory"?(await rt(a,!0),Oe(u),F(a)):await ce(a),f!==we&&(xe.current+=1,Ze(f),ye(null)),oe&&A.trim()){const d=await Ke(l,A.trim());q(d.items)}Ne(d=>d+1),C({title:r("conversation.filePanelRenameSuccess",{name:ut(a)||a}),tone:"success"});return}if(await gt({workspaceId:l,opType:w.mode,dstPath:a,content:w.mode==="create_file"?"":void 0}),qt(),await Pe(),w.mode==="create_directory"?(await rt(a,!0),Oe(V(a,"directory")),F(a)):await ce(a),oe&&A.trim()){const s=await Ke(l,A.trim());q(s.items)}Ne(s=>s+1)}catch(s){C({title:J(s,r("conversation.filePanelMutateFailed")),tone:"error"})}finally{S(!1)}}}function ue(e,a=at){var u;if(a.length===0)return;const s=St(a);Wt({mode:e,items:s}),$(s),R(((u=s[s.length-1])==null?void 0:u.path)??null),C({title:e==="copy"?r("conversation.filePanelCopySelectionSuccess",{count:s.length}):r("conversation.filePanelCutSelectionSuccess",{count:s.length}),tone:"success"}),H(null)}async function ot(e=pa(k,E)){if(!l||!P||!P.items.length)return;const a=e??g,s=P.items.map(u=>({source:u,destinationPath:Kn(a,ut(u.path)||u.path)}));S(!0);try{for(const d of s)P.mode==="cut"&&Ge(d.source.path)===Ge(d.destinationPath)||await gt({workspaceId:l,opType:P.mode==="copy"?"copy":"move",srcPath:d.source.path,dstPath:d.destinationPath});const u=s.map(d=>V(d.destinationPath,d.source.kind)),f=u[u.length-1]??null;if(P.mode==="cut"&&Wt(null),$(u),R((f==null?void 0:f.path)??null),f&&st(f),Ce(),await Pe({activeDirectoryPath:(f==null?void 0:f.kind)==="directory"?f.path:f?he(f.path):te.current,expandedDirectories:_.current}),oe&&A.trim()){const d=await Ke(l,A.trim());q(d.items)}Ne(d=>d+1),C({title:r("conversation.filePanelPasteSuccess",{count:u.length}),tone:"success"}),H(null)}catch(u){await Pe().catch(()=>{}),C({title:J(u,r("conversation.filePanelPasteFailed")),tone:"error"})}finally{S(!1)}}function Jt(e=at){!e.length||p||(Fe(St(e)),H(null))}async function wi(){var a,s;if(!l||!(B!=null&&B.length))return;const e=St(B);S(!0);try{for(const d of e)await gt({workspaceId:l,opType:"delete",srcPath:d.path});const u=ba(E,e),f=_.current.filter(d=>!e.some(y=>y.kind==="directory"&&Ft(y.path,d)));if(we&&e.some(d=>Ft(d.path,we))&&(xe.current+=1,Ze(null),ye(null)),Fe(null),$([]),R(null),te.current=u,_.current=f,F(u),Be(f),Ce(),await Pe({activeDirectoryPath:u,expandedDirectories:f}),oe&&A.trim()){const d=await Ke(l,A.trim());q(d.items)}Ne(d=>d+1),C({title:e.length===1?r("conversation.filePanelDeleteSuccess",{name:ut(((a=e[0])==null?void 0:a.path)??"")||((s=e[0])==null?void 0:s.path)||""}):r("conversation.filePanelDeleteSelectionSuccess",{count:e.length}),tone:"success"})}catch(u){C({title:J(u,r("conversation.filePanelMutateFailed")),tone:"error"})}finally{S(!1)}}async function Ve(e,a=k){const s=($e==null?void 0:$e.path)??"",u=(a==null?void 0:a.path)??null;if(u===null||!s){I(!1);return}try{const f=xa(s),d=e==="absolute"?ya(s,u,f):Ge(u,f);await wa(d,it),C({title:e==="absolute"?r("conversation.filePanelCopyAbsolutePathSuccess"):r("conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(f){C({title:f instanceof Error?f.message:r("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{I(!1),H(null)}}function Ni(e,a,s){return[{id:`open-${e.path}`,label:e.kind==="directory"?D.includes(e.path)?r("conversation.filePanelCollapseDirectory"):r("conversation.filePanelExpandDirectory"):r("conversation.filePanelOpenFile"),onSelect:()=>{if(e.kind==="directory"){kn(e.path);return}ze(e.path)}},{id:`download-${e.path}`,label:r("conversation.filePanelDownload"),disabled:e.kind!=="file"||v,onSelect:()=>{Xt(e.kind==="file"?e.path:null)}},{id:`create-file-${e.path}`,label:r("conversation.filePanelNewFile"),disabled:!l||p||v,onSelect:()=>{Ue("create_file",s)}},{id:`create-directory-${e.path}`,label:r("conversation.filePanelNewDirectory"),disabled:!l||p||v,onSelect:()=>{Ue("create_directory",s)}},{id:`rename-${e.path}`,label:r("conversation.filePanelRenameMove"),disabled:a.length!==1||p||v,onSelect:()=>Zt(e)},{id:`copy-${e.path}`,label:r("conversation.filePanelCopy"),disabled:a.length===0,onSelect:()=>ue("copy",a)},{id:`cut-${e.path}`,label:r("conversation.filePanelCut"),disabled:a.length===0,onSelect:()=>ue("cut",a)},{id:`paste-${e.path}`,label:r("conversation.filePanelPaste"),disabled:!lt,onSelect:()=>{ot(s)}},{id:`copy-relative-${e.path}`,label:r("conversation.filePanelCopyRelativePath"),onSelect:()=>{Ve("relative",e)}},{id:`copy-absolute-${e.path}`,label:r("conversation.filePanelCopyAbsolutePath"),onSelect:()=>{Ve("absolute",e)}},{id:`delete-${e.path}`,label:r("conversation.filePanelDelete"),disabled:a.length===0||p||v,onSelect:()=>Jt(a)}]}async function An(e,a){if(it.isMobile)return;e.preventDefault();const s=V(a.path,a.kind),u=xt.has(s.path)?at:[s],f=s.kind==="directory"?s.path:he(s.path);xt.has(s.path)||wn(s);const d=Ni(s,u,f);if(it.isDesktop){await Vi(d);return}it.isWeb&&(I(!1),L(!1),H({positionX:e.clientX,positionY:e.clientY,items:d}))}c.useEffect(()=>{if(O!=="workspace")return;function e(a){if(!ha(a)||a.altKey||a.shiftKey||ma(a.target))return;const s=a.key.toLowerCase();if(s==="c"&&Me){a.preventDefault(),ue("copy");return}if(s==="x"&&Me){a.preventDefault(),ue("cut");return}s==="v"&&lt&&(a.preventDefault(),ot())}return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[O,Me,lt,ue,ot]);function Qt(e,a){return i.jsx(i.Fragment,{children:e.map(s=>{const u=V(s.path,s.kind),f=s.kind==="directory",d=f&&D.includes(s.path),y=f&&je.includes(s.path),N=De[s.path]??[],fe=ee?an(N,De,W.statusByPath,W.changedDirs):N,Di=xt.has(s.path),ki=Ut===s.path,ct=W.statusByPath.get(s.path.replace(/\\/g,"/")),Wn=f&&W.changedDirs.has(s.path.replace(/\\/g,"/")),Mi=(P==null?void 0:P.mode)==="cut"&&P.items.some(de=>de.path===s.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":ki,"data-selected":Di,"data-cut-pending":Mi||void 0,"data-kind":s.kind,"aria-expanded":f?d:void 0,style:{paddingInlineStart:`${oa+a*ca}px`},onClick:de=>{if(f){if(de.shiftKey||jt(de)){Ce(),He(u,de);return}Ce(),He(u,de),kn(s.path);return}gi(s.path,de)},onContextMenu:de=>{An(de,s)},children:[i.jsx("span",{className:`file-tree-chevron${f?"":" is-hidden"}`,"aria-hidden":"true",children:d?"v":">"}),f?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(s.name),"aria-hidden":"true",children:Rt(s.name)}),i.jsx("span",{className:"file-tree-label","data-status":ct??void 0,"data-has-changes":Wn||void 0,children:s.name}),!f&&ct?i.jsx("span",{className:"git-status-badge","data-status":ct,"aria-label":ct,children:ct}):null,f&&Wn?i.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,y?i.jsx("span",{className:"file-tree-meta",children:r("common.loading")}):null]}),f&&d?i.jsx("div",{className:"file-tree-children",children:y&&!N.length?i.jsx("p",{className:"file-tree-empty",children:r("common.loading")}):fe.length?Qt(fe,a+1):i.jsx("p",{className:"file-tree-empty",children:r("conversation.filePanelEmptyDirectory")})}):null]},`${s.kind}-${s.path}`)})})}function Ei(e){return i.jsx(i.Fragment,{children:e.map(a=>{const s=a.kind==="directory",u=xt.has(a.path),f=Ut===a.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":f,"data-selected":u,"data-kind":a.kind,onClick:d=>{Pi(a,d)},onContextMenu:d=>{An(d,a)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),s?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":_t(a.name),"aria-hidden":"true",children:Rt(a.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:a.name}),i.jsx("span",{className:"file-tree-path",children:a.path})]})]})},`search-${a.kind}-${a.path}`)})})}return i.jsx("section",{className:["conversation-panel","surface-card","file-panel",t].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:l?i.jsxs(i.Fragment,{children:[i.jsx(Ki,{workspaceId:l,filePath:we,open:we!==null,onClose:()=>{xe.current+=1,Ze(null),ye(null)},onSaved:async e=>{await Pe(),await ce(e),Ne(a=>a+1)},diffContent:hi}),o?null:i.jsx("div",{className:"file-panel-heading-row",children:i.jsx("h2",{className:"file-panel-heading",children:r("conversation.filePanelTitle")})}),m?null:i.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":r("conversation.filePanelTitle"),children:[i.jsx("button",{className:O==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":O==="workspace",onClick:()=>Je("workspace"),children:r("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:O==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":O==="session",onClick:()=>{Le&&Je("session")},disabled:!Le,children:[r("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${r("conversation.filePanelSessionTab")} ${on}`,children:on})]})]}),O==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:mn,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:e=>void ji(e)}),bn?i.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":r("conversation.filePanelTitle"),children:i.jsxs("div",{className:"file-mobile-action-shell",ref:hn,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":r("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":Ie,"data-active":Ie,onClick:()=>{I(!1),L(e=>!e)},children:[i.jsx("span",{children:r("conversation.filePanelActionsMenu")}),i.jsx(Ua,{})]}),Ie?i.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":r("conversation.filePanelActionsMenu"),children:[i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>ue("copy")),disabled:!Me,children:r("conversation.filePanelCopy")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>ue("cut")),disabled:!Me,children:r("conversation.filePanelCut")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>ot()),disabled:!lt||p||v,children:r("conversation.filePanelPaste")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),_n()},children:Xe?r("conversation.filePanelHideSearch"):r("conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Ot(e=>!e)},disabled:vt.length===0,children:ee?r("conversation.filePanelShowAll"):r("conversation.filePanelFilterChanges")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(Rn),disabled:_e||p||pt,children:r("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Fn()},disabled:!Pn,children:r("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{L(!1),Tn()},disabled:p||v,children:r("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(Xt),disabled:!yn||v,children:r("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(Zt),disabled:!gn||p||v,children:r("conversation.filePanelRenameMove")}),i.jsx("button",{className:"file-mobile-action-menu-item danger",type:"button",role:"menuitem",onClick:()=>Z(Jt),disabled:!xn||p||v,children:r("conversation.filePanelDelete")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ue("create_file")),disabled:p||v,children:r("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ue("create_directory")),disabled:p||v,children:r("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ve("absolute")),disabled:!Vt,children:r("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Z(()=>Ve("relative")),disabled:!Vt,children:r("conversation.filePanelCopyRelativePath")})]}):null]})}):i.jsxs("div",{className:"file-panel-toolbar","aria-label":r("conversation.filePanelTitle"),children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCopy"),"aria-label":r("conversation.filePanelCopy"),onClick:()=>ue("copy"),disabled:!Me,children:i.jsx(Fa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCut"),"aria-label":r("conversation.filePanelCut"),onClick:()=>ue("cut"),disabled:!Me,children:i.jsx(Aa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelPaste"),"aria-label":r("conversation.filePanelPaste"),onClick:()=>void ot(),disabled:!lt||p||v,children:i.jsx(La,{})}),i.jsxs("div",{className:"file-toolbar-menu-shell",ref:dn,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCopyPath"),"aria-label":r("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":Qe,"data-active":Qe,onClick:()=>{L(!1),I(e=>!e)},disabled:!Vt,children:i.jsx(Ta,{})}),Qe?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ve("absolute"),children:r("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ve("relative"),children:r("conversation.filePanelCopyRelativePath")})]}):null]}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelCollapseCurrent"),"aria-label":r("conversation.filePanelCollapseCurrent"),onClick:Fn,disabled:!Pn,children:i.jsx(Ra,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelRefresh"),"aria-label":r("conversation.filePanelRefresh"),onClick:()=>void Rn(),disabled:_e||p||pt,children:i.jsx(_a,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelSearchButton"),"aria-label":r("conversation.filePanelSearchButton"),"data-active":Xe,onClick:_n,disabled:_e,children:i.jsx(Qn,{})}),vt.length>0?i.jsx("button",{className:"file-toolbar-button",type:"button",title:ee?r("conversation.filePanelShowAll"):r("conversation.filePanelFilterChanges"),"aria-label":ee?r("conversation.filePanelShowAll"):r("conversation.filePanelFilterChanges"),"data-active":ee,onClick:()=>Ot(e=>!e),children:i.jsx(Va,{})}):null,i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelUpload"),"aria-label":r("conversation.filePanelUpload"),onClick:Tn,disabled:p||v,children:i.jsx(Wa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelDownload"),"aria-label":r("conversation.filePanelDownload"),onClick:()=>void Xt(),disabled:!yn||v,children:i.jsx($a,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelRenameMove"),"aria-label":r("conversation.filePanelRenameMove"),onClick:()=>Zt(),disabled:!gn||p||v,children:i.jsx(za,{})}),i.jsx("button",{className:"file-toolbar-button danger",type:"button",title:r("conversation.filePanelDelete"),"aria-label":r("conversation.filePanelDelete"),onClick:()=>Jt(),disabled:!xn||p||v,children:i.jsx(Oa,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelNewFile"),"aria-label":r("conversation.filePanelNewFile"),onClick:()=>void Ue("create_file"),disabled:p||v,children:i.jsx(Ba,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:r("conversation.filePanelNewDirectory"),"aria-label":r("conversation.filePanelNewDirectory"),onClick:()=>void Ue("create_directory"),disabled:p||v,children:i.jsx(Ha,{})})]}),le&&typeof document<"u"?_i.createPortal(i.jsx("div",{className:"file-web-context-menu",ref:Ht,role:"menu","aria-label":r("conversation.filePanelActionsMenu"),style:{left:`${(ve==null?void 0:ve.left)??Math.max(8,le.positionX)}px`,top:`${(ve==null?void 0:ve.top)??Math.max(8,le.positionY)}px`,maxHeight:ve?`${ve.maxHeight}px`:void 0},children:le.items.map(e=>i.jsx("button",{className:["file-web-context-menu-item",e.label===r("conversation.filePanelDelete")?"danger":""].filter(Boolean).join(" "),type:"button",role:"menuitem",disabled:e.disabled,onClick:()=>{H(null),e.onSelect()},children:e.label},e.id))}),document.body):null,Cn?i.jsx("p",{className:"file-panel-clipboard-status","data-mode":P==null?void 0:P.mode,children:Cn}):null,Xe?i.jsxs("form",{className:"file-toolbar-search",onSubmit:e=>void Ci(e),children:[i.jsx("input",{value:A,onChange:e=>Ye(e.target.value),placeholder:r("conversation.filePanelSearchPlaceholder")}),bn?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":r("conversation.filePanelSearchButton"),disabled:pt,children:r("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:r("conversation.filePanelSearchButton"),"aria-label":r("conversation.filePanelSearchButton"),disabled:pt,children:i.jsx(Qn,{})})]}):null,i.jsx("div",{ref:mi,className:"file-tree","data-search-mode":oe,"data-scrollbar-autohide":"true",children:_e&&We.length===0?i.jsx("p",{className:"file-tree-status status-text",children:r("common.loading")}):oe?ke!=null&&ke.length?Ei(ke):i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelSearchEmpty")}):ee?yt.length?Qt(yt,0):i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelNoChanges")}):We.length?Qt(We,0):i.jsx("p",{className:"file-tree-status status-text",children:r("conversation.filePanelEmptyDirectory")})}),i.jsx($n,{open:w!==null,title:(U==null?void 0:U.title)??"",description:U==null?void 0:U.description,onClose:Yt,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:e=>void Si(e),children:[i.jsx(Ai,{label:r("conversation.filePanelPathFieldLabel"),htmlFor:fn,description:(w==null?void 0:w.mode)==="rename"?w.target.path:(w==null?void 0:w.baseDirectory)||void 0,children:i.jsx("input",{id:fn,type:"text",value:$t??"",placeholder:r("conversation.filePanelPathFieldPlaceholder"),autoFocus:!0,onChange:e=>Ae(e.target.value)})}),i.jsxs(Li,{children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:Yt,children:r("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:p||!($t??"").trim(),children:p?(U==null?void 0:U.pendingLabel)??r("common.loading"):(U==null?void 0:U.submitLabel)??r("common.save")})]})]})}),i.jsxs($n,{open:B!==null,title:r("conversation.filePanelDeleteConfirmTitle"),description:r("conversation.filePanelDeleteConfirmDescription"),onClose:()=>{p||Fe(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:B!=null&&B.length?B.length===1?((Bn=B[0])==null?void 0:Bn.kind)==="directory"?r("conversation.filePanelDeleteDirectoryConfirm",{path:B[0].path}):r("conversation.filePanelDeleteFileConfirm",{path:B[0].path}):r("conversation.filePanelDeleteSelectionConfirm",{count:B.length}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:()=>Fe(null),children:r("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:p,onClick:()=>{wi()},children:p?r("conversation.filePanelDeleting"):r("conversation.filePanelDelete")})]})]})]}):Le&&n?i.jsx(ea,{sessionId:n,workspaceId:l,showSystemFiles:z,selectedPath:ge,refreshVersion:rn,onCountChange:zt,onSelectFile:ce,onOpenFile:ze}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:r("conversation.filePanelSessionNoSession")})})]}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:r("conversation.filePanelNoWorkspace")})})})}function he(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):g}function dt(t,n=!1){const l=t.split("/").filter(Boolean),o=n?l.length:l.length-1,m=[];for(let h=0;h<o;h+=1)m.push(l.slice(0,h+1).join("/"));return m}function Vn(t,n){return t||((n==null?void 0:n.kind)==="directory"?n.path:n!=null&&n.path?he(n.path):g)}function Kn(t,n){return t?`${t}/${n}`:n}function ua(t){var n;return((n=t.split(/[/\\]/).pop())==null?void 0:n.trim())??""}function V(t,n){return{path:t,kind:n}}function Gn(t){return t[t.length-1]??null}function fa(t,n){return t.findIndex(o=>o.path===n.path)>=0?t.filter(o=>o.path!==n.path):[...t,n]}function da(t,n,l){const o=t.findIndex(x=>x.path===l.path);if(o<0)return[l];const m=n?t.findIndex(x=>x.path===n):o;if(m<0)return[l];const h=Math.min(m,o),b=Math.max(m,o);return t.slice(h,b+1)}function jt(t){return!!(t!=null&&t.ctrlKey||t!=null&&t.metaKey)}function ha(t){return t.ctrlKey||t.metaKey}function ma(t){if(!(t instanceof HTMLElement))return!1;const n=t.tagName.toLowerCase();return n==="input"||n==="textarea"||n==="select"||t.isContentEditable}function St(t){const n=[...new Map(t.map(o=>[o.path,o])).values()].sort((o,m)=>o.path.localeCompare(m.path)),l=[];for(const o of n)l.some(m=>m.kind==="directory"&&Ft(m.path,o.path))||l.push(o);return l}function pa(t,n){return(t==null?void 0:t.kind)==="directory"?t.path:t!=null&&t.path?he(t.path):n}function ba(t,n){let l=t;for(;l&&n.some(o=>o.kind==="directory"&&Ft(o.path,l));)l=he(l);return l}function si(t,n,l,o,m,h){const b=[];for(const x of t){if(b.push(V(x.path,x.kind)),x.kind!=="directory"||!l.includes(x.path))continue;const j=n[x.path]??[],T=o?an(j,n,m,h):j;b.push(...si(T,n,l,o,m,h))}return b}function va(t,n,l){const o=Math.max(0,l.width),m=Math.max(0,l.height),h=Math.max(0,m-ne*2),b=Math.max(0,o-ne*2),x=Math.min(Math.max(n.width,0),b),j=Math.max(0,m-t.y-Ct-ne),T=Math.max(0,t.y-Ct-ne),M=j<n.height&&T>j,me=en(Math.max(M?T:j,aa),0,h),K=Math.min(Math.max(n.height,0),me),pe=M?t.y-Ct-K:t.y+Ct,be=Math.max(ne,m-ne-K),G=Math.max(ne,o-ne-x);return{top:en(pe,ne,be),left:en(t.x,ne,G),maxHeight:Math.max(0,me)}}function en(t,n,l){return!Number.isFinite(t)||l<n?n:Math.min(Math.max(t,n),l)}function Ge(t,n="posix"){return t?ri(t,n):"."}function ya(t,n,l){const o=ri(t,l),m=Ge(n,l).replace(/^\.[/\\]?/,"");if(!m)return o;const h=oi(l),b=m.replace(/^[/\\]+/,"");return b?o.endsWith("/")||o.endsWith("\\")?`${o}${b}`:`${o}${h}${b}`:o}function xa(t){return/^[a-zA-Z]:[\\/]/.test(t)||t.includes("\\")?"windows":"posix"}function ri(t,n){return t&&(oi(n)==="\\"?t.replace(/\//g,"\\"):t.replace(/\\/g,"/"))}function oi(t){return t==="windows"?"\\":"/"}function Ft(t,n){return n===t||n.startsWith(`${t}/`)}function ci(t,n,l){return t===n?l:t.startsWith(`${n}/`)?`${l}${t.slice(n.length)}`:t}function ga(t,n,l){return t.map(o=>({...o,path:ci(o.path,n,l)}))}function Pa(t){return t.mode==="create_file"?{title:r("conversation.filePanelNewFile"),description:r("conversation.filePanelCreateFileDescription"),submitLabel:r("conversation.filePanelCreateFileSubmit"),pendingLabel:r("conversation.filePanelCreatingFile")}:t.mode==="create_directory"?{title:r("conversation.filePanelNewDirectory"),description:r("conversation.filePanelCreateDirectoryDescription"),submitLabel:r("conversation.filePanelCreateDirectorySubmit"),pendingLabel:r("conversation.filePanelCreatingDirectory")}:{title:r("conversation.filePanelRenameMove"),description:r("conversation.filePanelRenameDescription"),submitLabel:r("conversation.filePanelRenameSubmit"),pendingLabel:r("conversation.filePanelRenaming")}}async function Ca(t){const n=await t.arrayBuffer(),l=new Uint8Array(n),o=32768;let m="";for(let h=0;h<l.length;h+=o){const b=l.subarray(h,h+o);m+=String.fromCharCode(...b)}return btoa(m)}function ja(t){const n=atob(t),l=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)l[o]=n.charCodeAt(o);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}function Sa(t,n){if(typeof document>"u")throw new Error(r("conversation.filePanelDownloadFailed"));const l=window.URL.createObjectURL(n),o=document.createElement("a");o.href=l,o.download=t,document.body.append(o),o.click(),o.remove(),window.URL.revokeObjectURL(l)}async function wa(t,n){var l;if(!(n.isDesktop&&(await n.bridge.writeClipboardText(t)).ok)){if(typeof navigator<"u"&&((l=navigator.clipboard)!=null&&l.writeText))try{await navigator.clipboard.writeText(t);return}catch{}if(!Na(t))throw new Error(r("conversation.filePanelCopyPathFailed"))}}function Na(t){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const n=document.createElement("textarea");n.value=t,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.top="-9999px",n.style.left="-9999px",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(n)}}function Ea(t,n){return t&&dt(t,!0).every(m=>m in n)?t:g}function Xn(t,n){if(!n)return[];const l=dt(n,!0);return t.filter(o=>l.includes(o))}function wt(t,n,l){const o=sn(n,l);return Object.entries(t).reduce((m,[h,b])=>(o.has(h)&&(m[h]=b),m),{})}function Da(t,n,l){const m=[...sn(n,l)].filter(h=>h===g||h in t);return m.length?m:[g]}function sn(t,n){const l=new Set([g]),o=ui(n,dt(t,!0));for(const m of o){l.add(m);for(const h of dt(m,!0))l.add(h)}return l}function ka(t,n){const l=Object.keys(t),o=Object.keys(n);return l.length!==o.length?!1:l.every(m=>t[m]===n[m])}function Mt(t,n){return t.includes(n)?t:[...t,n]}function ui(t,n){return n.reduce((l,o)=>Mt(l,o),t)}function qn(t){return`file-panel.workspace-tree.${t}`}function Yn(t,n){return`file-panel.session-change-count.${t}.${n}`}function Zn(t,n){return Object.fromEntries(Object.keys(n).map(l=>[l,t[l]??null]))}function tn(t,n){return[...sn(n,t)]}function J(t,n){return t instanceof In?t.message:n}function fi(t){return t instanceof Error&&t.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")}function Jn(t){return fi(t)||t instanceof Error&&t.message.startsWith("FILE_TREE_ABORTED:")}function Ma(t){return new Promise(n=>{window.setTimeout(n,t)})}function Ra(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function _a(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function Qn(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function Ta(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Fa(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Aa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4.2 4.2a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm0 5.4a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm1-3.2 6.6 5.6M5.2 9.6l6.6-5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function La(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 3.5h8v10H4zM6 2.2h4v2H6z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M6 7.2h4M6 9.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Ba(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function Wa(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function $a(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oa(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 4.5h9M6.2 2.5h3.6l.6 1.4H13v1.2H3V3.9h2.6zM5.2 5.7v6.1m2.8-6.1v6.1m2.8-6.1v6.1M4.4 13.5h7.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ha(){return i.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[i.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function za(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.2 11.9h2.2l5.9-5.9-2.2-2.2-5.9 5.9zM8.3 3.8l2.2 2.2M2.8 13.2h10.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ua(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function Va(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function an(t,n,l,o){const m=[];for(const h of t){const b=h.path.replace(/\\/g,"/");h.kind==="file"?l.has(b)&&m.push(h):di(b,n,l,o)&&m.push(h)}return m}function di(t,n,l,o,m){const h=m??new Set;if(h.has(t))return!1;h.add(t);const b=n[t];if(!b)return o.has(t);for(const x of b){const j=x.path.replace(/\\/g,"/");if(x.kind==="file"){if(l.has(j))return!0}else if(di(j,n,l,o,h))return!0}return!1}export{el as FileContextPanel};